diff --git a/dist/frontend.js b/dist/frontend.js index 37fdabe..6063787 100644 --- a/dist/frontend.js +++ b/dist/frontend.js @@ -134,7 +134,7 @@ const n=new WeakMap,s=Object(r.d)(e=>t=>{if(!(t instanceof r.b))throw new Error( * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */const c=new WeakMap,d=Object(r.d)(e=>t=>{if(!(t instanceof r.b))throw new Error("unsafeSVG can only be used in text bindings");const i=c.get(t);if(void 0!==i&&Object(o.h)(e)&&e===i.value&&t.value===i.fragment)return;const a=document.createElement("template");a.innerHTML=``;const n=a.content,s=n.firstChild;n.removeChild(s),Object(l.c)(n,s.firstChild);const d=document.importNode(n,!0);t.setValue(d),c.set(t,{value:e,fragment:d})}),b=new WeakMap,f=Object(r.d)(e=>t=>{if(!(t instanceof r.a)||t instanceof r.c||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:i}=t,{style:a}=i.element;let o=b.get(t);void 0===o&&(a.cssText=i.strings.join(" "),b.set(t,o=new Set)),o.forEach(t=>{t in e||(o.delete(t),-1===t.indexOf("-")?a[t]=null:a.removeProperty(t))});for(const t in e)o.add(t),-1===t.indexOf("-")?a[t]=e[t]:a.setProperty(t,e[t])});async function h(e){try{e=new URL(e,window.location.origin).href}catch(e){}return{url:e,coll:"id-"+(await async function(e,t){const i=(new TextEncoder).encode(e),a=await crypto.subtle.digest(t,i);return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,"0")).join("")}(e,"SHA-256")).slice(0,12)}}var u;function m(e,t){void 0===t&&(t={});var i=t.registrationOptions;void 0===i&&(i={}),delete t.registrationOptions;var a=function(e){for(var i=[],a=arguments.length-1;a-- >0;)i[a]=arguments[a+1];t&&t[e]&&t[e].apply(t,i)};"serviceWorker"in navigator&&u.then((function(){Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))?(!function(e,t,i){fetch(e).then((function(a){404===a.status?(t("error",new Error("Service worker not found at "+e)),v()):-1===a.headers.get("content-type").indexOf("javascript")?(t("error",new Error("Expected "+e+" to have javascript content-type, but received "+a.headers.get("content-type"))),v()):g(e,t,i)})).catch((function(e){return p(t,e)}))}(e,a,i),navigator.serviceWorker.ready.then((function(e){a("ready",e)}))):(g(e,a,i),navigator.serviceWorker.ready.then((function(e){a("ready",e)})))}))}function p(e,t){navigator.onLine||e("offline"),e("error",t)}function g(e,t,i){navigator.serviceWorker.register(e,i).then((function(e){t("registered",e),e.waiting?t("updated",e):e.onupdatefound=function(){t("updatefound",e);var i=e.installing;i.onstatechange=function(){"installed"===i.state&&(navigator.serviceWorker.controller?t("updated",e):t("cached",e))}}})).catch((function(e){return p(t,e)}))}function v(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}"undefined"!=typeof window&&(u="undefined"!=typeof Promise?new Promise((function(e){return window.addEventListener("load",e)})):{then:function(e){return window.addEventListener("load",e)}});var x=i(53),w=i.n(x),k=i(82),y=i.n(k),z=(i(106),i(83)),S=i.n(z),_=i(84),$=i.n(_),C=i(85),T=i.n(C),U=i(86),A=i.n(U),j=i(87),P=i.n(j),I=i(88),E=i.n(I),L=i(89),R=i.n(L),N=i(90),O=i.n(N),M=i(91),G=i.n(M),D=i(92),q=i.n(D),B=i(93),F=i.n(B);const H=Object(a.d)(S.a);function V(e){return[H,e]}const W=new Worker("./sw.js");class Z extends a.a{constructor(){super(),this.sourceUrl=null,this.collInfo=null,this.showTerms=!1,this.pageParams={}}static get properties(){return{pageParams:{type:Object},sourceUrl:{type:String},navMenuShown:{type:Boolean},showTerms:{type:Boolean},collInfo:{type:Object},loadInfo:{type:Object},embed:{type:String}}}static get styles(){return V(a.b` + */const c=new WeakMap,d=Object(r.d)(e=>t=>{if(!(t instanceof r.b))throw new Error("unsafeSVG can only be used in text bindings");const i=c.get(t);if(void 0!==i&&Object(o.h)(e)&&e===i.value&&t.value===i.fragment)return;const a=document.createElement("template");a.innerHTML=``;const n=a.content,s=n.firstChild;n.removeChild(s),Object(l.c)(n,s.firstChild);const d=document.importNode(n,!0);t.setValue(d),c.set(t,{value:e,fragment:d})}),b=new WeakMap,f=Object(r.d)(e=>t=>{if(!(t instanceof r.a)||t instanceof r.c||"style"!==t.committer.name||t.committer.parts.length>1)throw new Error("The `styleMap` directive must be used in the style attribute and must be the only part in the attribute.");const{committer:i}=t,{style:a}=i.element;let o=b.get(t);void 0===o&&(a.cssText=i.strings.join(" "),b.set(t,o=new Set)),o.forEach(t=>{t in e||(o.delete(t),-1===t.indexOf("-")?a[t]=null:a.removeProperty(t))});for(const t in e)o.add(t),-1===t.indexOf("-")?a[t]=e[t]:a.setProperty(t,e[t])});async function h(e){try{e=new URL(e,window.location.origin).href}catch(e){}return{url:e,coll:"id-"+(await async function(e,t){const i=(new TextEncoder).encode(e),a=await crypto.subtle.digest(t,i);return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,"0")).join("")}(e,"SHA-256")).slice(0,12)}}var u;function m(e,t){void 0===t&&(t={});var i=t.registrationOptions;void 0===i&&(i={}),delete t.registrationOptions;var a=function(e){for(var i=[],a=arguments.length-1;a-- >0;)i[a]=arguments[a+1];t&&t[e]&&t[e].apply(t,i)};"serviceWorker"in navigator&&u.then((function(){Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))?(!function(e,t,i){fetch(e).then((function(a){404===a.status?(t("error",new Error("Service worker not found at "+e)),v()):-1===a.headers.get("content-type").indexOf("javascript")?(t("error",new Error("Expected "+e+" to have javascript content-type, but received "+a.headers.get("content-type"))),v()):g(e,t,i)})).catch((function(e){return p(t,e)}))}(e,a,i),navigator.serviceWorker.ready.then((function(e){a("ready",e)}))):(g(e,a,i),navigator.serviceWorker.ready.then((function(e){a("ready",e)})))}))}function p(e,t){navigator.onLine||e("offline"),e("error",t)}function g(e,t,i){navigator.serviceWorker.register(e,i).then((function(e){t("registered",e),e.waiting?t("updated",e):e.onupdatefound=function(){t("updatefound",e);var i=e.installing;i.onstatechange=function(){"installed"===i.state&&(navigator.serviceWorker.controller?t("updated",e):t("cached",e))}}})).catch((function(e){return p(t,e)}))}function v(){"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()}))}"undefined"!=typeof window&&(u="undefined"!=typeof Promise?new Promise((function(e){return window.addEventListener("load",e)})):{then:function(e){return window.addEventListener("load",e)}});var x=i(53),w=i.n(x),k=i(82),y=i.n(k),z=(i(106),i(83)),S=i.n(z),_=i(84),$=i.n(_),C=i(85),T=i.n(C),U=i(86),A=i.n(U),j=i(87),P=i.n(j),I=i(88),E=i.n(I),L=i(89),R=i.n(L),N=i(90),O=i.n(N),D=i(91),M=i.n(D),G=i(92),q=i.n(G),B=i(93),F=i.n(B);const H=Object(a.d)(S.a);function V(e){return[H,e]}const W=new Worker("./sw.js");class Z extends a.a{constructor(){super(),this.sourceUrl=null,this.collInfo=null,this.showTerms=!1,this.pageParams={}}static get properties(){return{pageParams:{type:Object},sourceUrl:{type:String},navMenuShown:{type:Boolean},showTerms:{type:Boolean},collInfo:{type:Object},loadInfo:{type:Object},embed:{type:String}}}static get styles(){return V(a.b` #logo { max-height: 2.5rem; margin-right: 8px; @@ -195,6 +195,9 @@ const n=new WeakMap,s=Object(r.d)(e=>t=>{if(!(t instanceof r.b))throw new Error(
+ `:""} @@ -251,7 +254,7 @@ const n=new WeakMap,s=Object(r.d)(e=>t=>{if(!(t instanceof r.b))throw new Error( - `:""} `}firstUpdated(){this.initRoute()}updated(e){e.has("sourceUrl")&&(this.collInfo=null)}onFavIcons(e){const t=document.querySelector("head"),i=document.querySelectorAll("link[rel*='icon']");for(const e of i)t.removeChild(e);for(const i of e.detail.icons){const e=document.createElement("link");e.rel=i.rel,e.href=i.href,t.appendChild(e)}}onNavMenu(){this.navMenuShown=!this.navMenuShown}initRoute(){this.pageParams=new URLSearchParams(window.location.search);let e=this.pageParams.get("state");if(e)try{if(e=JSON.parse(e),e.ids instanceof Array&&e.userId&&"open"===e.action)return this.pageParams.set("source","googledrive://"+e.ids[0]),this.pageParams.delete("state"),void(window.location.search=this.pageParams.toString())}catch(e){console.log(e)}if(this.sourceUrl=this.pageParams.get("source")||"",this.embed=this.pageParams.get("embed")||"",this.pageParams.has("terms")&&(this.showTerms=!0),this.pageParams.has("config")){this.loadInfo||(this.loadInfo={});try{this.loadInfo.extraConfig=JSON.parse(this.pageParams.get("config"))}catch(e){console.log("invalid config: "+e)}}this.pageParams.has("customColl")&&(this.loadInfo||(this.loadInfo={}),this.loadInfo.customColl=this.pageParams.get("customColl"))}onStartLoad(e){if(!e.detail.blobUrl)return this.pageParams.set("source",e.detail.sourceUrl),void(window.location.search=this.pageParams.toString());this.sourceUrl=e.detail.sourceUrl,this.loadInfo=e.detail}onCollLoaded(e){this.loadInfo=null,e.detail.collInfo&&(this.collInfo=e.detail.collInfo),e.detail.alreadyLoaded||(this.initRoute(),e.detail.sourceUrl!==this.sourceUrl&&(this.pageParams.set("source",e.detail.sourceUrl),window.location.search=this.pageParams.toString()))}}class Y extends a.a{constructor(){super(),this.progress=0,this.total=0,this.percent=0,this.coll="",this.state="waiting",this.loadInfo=null}static get properties(){return{sourceUrl:{type:String},loadInfo:{type:Object},state:{type:String},progress:{type:Number},percent:{type:Number},error:{type:String},total:{type:Number},status:{type:String},coll:{type:String}}}firstUpdated(e){this.initMessages()}initMessages(){W.addEventListener("message",e=>{switch(e.data.msg_type){case"collProgress":e.data.name===this.coll&&(this.percent=e.data.percent,e.data.error&&(this.error=e.data.error,this.state="errored"));break;case"collAdded":e.data.name===this.coll&&(this.total||(this.total=100),this.progress=this.total,this.percent=100,this.dispatchEvent(new CustomEvent("coll-loaded",{detail:e.data})))}})}async doLoad(){let e=this.sourceUrl,t=null;try{const{scheme:i,host:a,path:o}=function(e){let t=e.indexOf("://"),i=0,a="",o="",r="";return t>=0?(a=e.slice(0,t),t+=3):(t++,e.startsWith("//")&&(t+=2)),i=e.indexOf("/",t),i>0?(o=e.slice(t,i),r=e.slice(i)):(o=e.slice(t),r=""),{scheme:a,host:o,path:r}}(e);switch(i){case"googledrive":this.state="googledrive",t=await this.googledriveInit();break;case"s3":t={sourceUrl:e,loadUrl:`https://${a}.s3.amazonaws.com${o}`,name:this.sourceUrl};break;case"file":if(!this.loadInfo)return this.state="errored",void(this.error="File URLs can not be entered directly or shared.\nYou can select a file to upload from the main page by clicking the 'Choose File...' button.");t={sourceUrl:this.loadInfo.sourceUrl,loadUrl:this.loadInfo.blobUrl,name:this.loadInfo.name}}}catch(e){}t||(t={sourceUrl:e}),this.state="started";const i={msg_type:"addColl",name:this.coll,skipExisting:!0,file:t};this.loadInfo&&this.loadInfo.extraConfig&&(i.extraConfig=this.loadInfo.extraConfig),W.postMessage(i)}googledriveInit(){return this._gdWait=new Promise(e=>this._gdResolve=e),this._gdWait}async onLoadReady(e){this._gdResolve&&this._gdResolve(e.detail)}onCancel(){W.postMessage({msg_type:"cancelLoad",name:this.coll})}updated(e){this.sourceUrl&&e.has("sourceUrl")&&this.doLoad()}static get styles(){return V(a.b` + `:""} `}firstUpdated(){this.initRoute()}updated(e){e.has("sourceUrl")&&(this.collInfo=null)}onFavIcons(e){const t=document.querySelector("head"),i=document.querySelectorAll("link[rel*='icon']");for(const e of i)t.removeChild(e);for(const i of e.detail.icons){const e=document.createElement("link");e.rel=i.rel,e.href=i.href,t.appendChild(e)}}onNavMenu(){this.navMenuShown=!this.navMenuShown}initRoute(){this.pageParams=new URLSearchParams(window.location.search);let e=this.pageParams.get("state");if(e)try{if(e=JSON.parse(e),e.ids instanceof Array&&e.userId&&"open"===e.action)return this.pageParams.set("source","googledrive://"+e.ids[0]),this.pageParams.delete("state"),void(window.location.search=this.pageParams.toString())}catch(e){console.log(e)}if(this.sourceUrl=this.pageParams.get("source")||"",this.embed=this.pageParams.get("embed")||"",this.pageParams.has("terms")&&(this.showTerms=!0),this.pageParams.has("config")){this.loadInfo||(this.loadInfo={});try{this.loadInfo.extraConfig=JSON.parse(this.pageParams.get("config"))}catch(e){console.log("invalid config: "+e)}}this.pageParams.has("customColl")&&(this.loadInfo||(this.loadInfo={}),this.loadInfo.customColl=this.pageParams.get("customColl"))}onStartLoad(e){if(!e.detail.blobUrl)return this.pageParams.set("source",e.detail.sourceUrl),void(window.location.search=this.pageParams.toString());this.sourceUrl=e.detail.sourceUrl,this.loadInfo=e.detail}onCollLoaded(e){this.loadInfo=null,e.detail.collInfo&&(this.collInfo=e.detail.collInfo),e.detail.alreadyLoaded||(this.initRoute(),e.detail.sourceUrl!==this.sourceUrl&&(this.pageParams.set("source",e.detail.sourceUrl),window.location.search=this.pageParams.toString()))}}class K extends a.a{constructor(){super(),this.progress=0,this.total=0,this.percent=0,this.coll="",this.state="waiting",this.loadInfo=null}static get properties(){return{sourceUrl:{type:String},loadInfo:{type:Object},state:{type:String},progress:{type:Number},percent:{type:Number},error:{type:String},total:{type:Number},status:{type:String},coll:{type:String}}}firstUpdated(e){this.initMessages()}initMessages(){W.addEventListener("message",e=>{switch(e.data.msg_type){case"collProgress":e.data.name===this.coll&&(this.percent=e.data.percent,e.data.error&&(this.error=e.data.error,this.state="errored"));break;case"collAdded":e.data.name===this.coll&&(this.total||(this.total=100),this.progress=this.total,this.percent=100,this.dispatchEvent(new CustomEvent("coll-loaded",{detail:e.data})))}})}async doLoad(){let e=this.sourceUrl,t=null;try{const{scheme:i,host:a,path:o}=function(e){let t=e.indexOf("://"),i=0,a="",o="",r="";return t>=0?(a=e.slice(0,t),t+=3):(t++,e.startsWith("//")&&(t+=2)),i=e.indexOf("/",t),i>0?(o=e.slice(t,i),r=e.slice(i)):(o=e.slice(t),r=""),{scheme:a,host:o,path:r}}(e);switch(i){case"googledrive":this.state="googledrive",t=await this.googledriveInit();break;case"s3":t={sourceUrl:e,loadUrl:`https://${a}.s3.amazonaws.com${o}`,name:this.sourceUrl};break;case"file":if(!this.loadInfo)return this.state="errored",void(this.error="File URLs can not be entered directly or shared.\nYou can select a file to upload from the main page by clicking the 'Choose File...' button.");t={sourceUrl:this.loadInfo.sourceUrl,loadUrl:this.loadInfo.blobUrl,name:this.loadInfo.name}}}catch(e){}t||(t={sourceUrl:e}),this.state="started";const i={msg_type:"addColl",name:this.coll,skipExisting:!0,file:t};this.loadInfo&&this.loadInfo.extraConfig&&(i.extraConfig=this.loadInfo.extraConfig),W.postMessage(i)}googledriveInit(){return this._gdWait=new Promise(e=>this._gdResolve=e),this._gdWait}async onLoadReady(e){this._gdResolve&&this._gdResolve(e.detail)}onCancel(){W.postMessage({msg_type:"cancelLoad",name:this.coll})}updated(e){this.sourceUrl&&e.has("sourceUrl")&&this.doLoad()}static get styles(){return V(a.b` .logo { width: 96px; height: 96px; @@ -300,7 +303,10 @@ const n=new WeakMap,s=Object(r.d)(e=>t=>{if(!(t instanceof r.b))throw new Error(| URL | -Timestamp | -Mime | -Status | +URL | +Timestamp | +Mime | +Status |
|---|
Loaded Archives