From a3214dc081dedeb18dc7be978fde7955a903b859 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Sun, 6 Sep 2020 17:10:48 -0700 Subject: [PATCH] minor tweaks: - add padding to markdown

in story mode, fixing #6? - fix page sorting: switch to best match if searching, otherwise default to date --- src/pages.js | 25 +++++++++++++------------ src/sorter.js | 27 +++++++++++++++++++-------- src/story.js | 6 +++++- ui.js | 31 ++++++++++++++++--------------- 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/src/pages.js b/src/pages.js index d4dd4f2..44c98d0 100644 --- a/src/pages.js +++ b/src/pages.js @@ -38,8 +38,8 @@ class Pages extends LitElement this.menuActive = false; - this.sortKey = "ts"; - this.sortDesc = true; + this.sortKey = null; + this.sortDesc = null; this.isSidebar = false; this.url = ""; @@ -72,6 +72,7 @@ class Pages extends LitElement sortedPages: { type: Array }, query: { type: String }, + defaultKey: { type: String }, loading: { type: Boolean }, updatingSearch: { type: Boolean }, @@ -102,12 +103,15 @@ class Pages extends LitElement async updated(changedProperties) { if (changedProperties.has("collInfo")) { this.updateTextSearch(); - } else if (changedProperties.has("query")) { - this.filter(); - // default sort to score if has query, otherwise timestamp - this.sortKey = this.query ? "" : "ts"; - this.sortDesc = this.query ? false : true; + } else if (changedProperties.has("query")) { + + if (this.query && !changedProperties.get("query")) { + this.sortKey = null; + this.sortDesc = null; + } + + this.filter(); } else if (changedProperties.has("currList")) { this.filter(); @@ -610,13 +614,10 @@ class Pages extends LitElement

- - -
${this.formatResults()}
-
+

${this.collInfo.title}

${this.collInfo.desc ? unsafeHTML(marked(this.collInfo.desc)) : ''}
diff --git a/ui.js b/ui.js index f35a5f1..a7a3507 100644 --- a/ui.js +++ b/ui.js @@ -81,7 +81,7 @@ const _=e=>null===e||!("object"==typeof e||"function"==typeof e),C=e=>Array.isAr * 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 - */;function j(e){let t=M.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},M.set(e.type,t));let i=t.stringsArray.get(e.strings);if(void 0!==i)return i;const a=e.strings.join(n);return i=t.keyString.get(a),void 0===i&&(i=new c(e,e.getTemplateElement()),t.keyString.set(a,i)),t.stringsArray.set(e.strings,i),i}const M=new Map,q=new WeakMap; + */;function j(e){let t=q.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},q.set(e.type,t));let i=t.stringsArray.get(e.strings);if(void 0!==i)return i;const a=e.strings.join(n);return i=t.keyString.get(a),void 0===i&&(i=new c(e,e.getTemplateElement()),t.keyString.set(a,i)),t.stringsArray.set(e.strings,i),i}const q=new Map,M=new WeakMap; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -121,7 +121,7 @@ class{handleAttributeExpressions(e,t,i,a){const r=t[0];if("."===r){return new E( * 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 - */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const O=(e,...t)=>new $(e,t,"html",N),B=(e,t)=>`${e}--${t}`;let G=!0;void 0===window.ShadyCSS?G=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),G=!1);const H=e=>t=>{const i=B(t.type,e);let a=M.get(i);void 0===a&&(a={stringsArray:new WeakMap,keyString:new Map},M.set(i,a));let r=a.stringsArray.get(t.strings);if(void 0!==r)return r;const o=t.strings.join(n);if(r=a.keyString.get(o),void 0===r){const i=t.getTemplateElement();G&&window.ShadyCSS.prepareTemplateDom(i,e),r=new c(t,i),a.keyString.set(o,r)}return a.stringsArray.set(t.strings,r),r},F=["html","svg"],W=new Set,V=(e,t,i)=>{W.add(e);const a=i?i.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:o}=r;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(a,e);const n=document.createElement("style");for(let e=0;e{F.forEach(t=>{const i=M.get(B(t,e));void 0!==i&&i.keyString.forEach(e=>{const{element:{content:t}}=e,i=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{i.add(e)}),u(e,i)})})})(e);const s=a.content;i?function(e,t,i=null){const{element:{content:a},parts:r}=e;if(null==i)return void a.appendChild(t);const o=document.createTreeWalker(a,133,null,!1);let n=g(r),s=0,l=-1;for(;o.nextNode();){for(l++,o.currentNode===i&&(s=m(t),i.parentNode.insertBefore(t,i));-1!==n&&r[n].index===l;){if(s>0){for(;-1!==n;)r[n].index+=s,n=g(r,n);return}n=g(r,n)}}}(i,n,s.firstChild):s.insertBefore(n,s.firstChild),window.ShadyCSS.prepareTemplateStyles(a,e);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(i){s.insertBefore(n,s.firstChild);const e=new Set;e.add(n),u(i,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const K={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Z=(e,t)=>t!==e&&(t==t||e==e),Y={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:Z};class J extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,i)=>{const a=this._attributeNameForProperty(i,t);void 0!==a&&(this._attributeToPropertyMap.set(a,i),e.push(a))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=Y){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const i="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,i,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this._requestUpdate(e,a)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Y}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const i of t)this.createProperty(i,e[i])}}static _attributeNameForProperty(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,i=Z){return i(e,t)}static _propertyValueFromAttribute(e,t){const i=t.type,a=t.converter||K,r="function"==typeof a?a:a.fromAttribute;return r?r(e,i):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const i=t.type,a=t.converter;return(a&&a.toAttribute||K.toAttribute)(e,i)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,i){t!==i&&this._attributeToProperty(e,i)}_propertyToAttribute(e,t,i=Y){const a=this.constructor,r=a._attributeNameForProperty(e,i);if(void 0!==r){const e=a._propertyValueToAttribute(t,i);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const i=this.constructor,a=i._attributeToPropertyMap.get(e);if(void 0!==a){const e=i.getPropertyOptions(a);this._updateState=16|this._updateState,this[a]=i._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}_requestUpdate(e,t){let i=!0;if(void 0!==e){const a=this.constructor,r=a.getPropertyOptions(e);a._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}J.finalized=!0; + */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const O=(e,...t)=>new $(e,t,"html",N),B=(e,t)=>`${e}--${t}`;let G=!0;void 0===window.ShadyCSS?G=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),G=!1);const H=e=>t=>{const i=B(t.type,e);let a=q.get(i);void 0===a&&(a={stringsArray:new WeakMap,keyString:new Map},q.set(i,a));let r=a.stringsArray.get(t.strings);if(void 0!==r)return r;const o=t.strings.join(n);if(r=a.keyString.get(o),void 0===r){const i=t.getTemplateElement();G&&window.ShadyCSS.prepareTemplateDom(i,e),r=new c(t,i),a.keyString.set(o,r)}return a.stringsArray.set(t.strings,r),r},F=["html","svg"],W=new Set,V=(e,t,i)=>{W.add(e);const a=i?i.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:o}=r;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(a,e);const n=document.createElement("style");for(let e=0;e{F.forEach(t=>{const i=q.get(B(t,e));void 0!==i&&i.keyString.forEach(e=>{const{element:{content:t}}=e,i=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{i.add(e)}),u(e,i)})})})(e);const s=a.content;i?function(e,t,i=null){const{element:{content:a},parts:r}=e;if(null==i)return void a.appendChild(t);const o=document.createTreeWalker(a,133,null,!1);let n=g(r),s=0,l=-1;for(;o.nextNode();){for(l++,o.currentNode===i&&(s=m(t),i.parentNode.insertBefore(t,i));-1!==n&&r[n].index===l;){if(s>0){for(;-1!==n;)r[n].index+=s,n=g(r,n);return}n=g(r,n)}}}(i,n,s.firstChild):s.insertBefore(n,s.firstChild),window.ShadyCSS.prepareTemplateStyles(a,e);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(i){s.insertBefore(n,s.firstChild);const e=new Set;e.add(n),u(i,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const K={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},Z=(e,t)=>t!==e&&(t==t||e==e),Y={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:Z};class J extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,i)=>{const a=this._attributeNameForProperty(i,t);void 0!==a&&(this._attributeToPropertyMap.set(a,i),e.push(a))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=Y){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const i="symbol"==typeof e?Symbol():"__"+e,a=this.getPropertyDescriptor(e,i,t);void 0!==a&&Object.defineProperty(this.prototype,e,a)}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this._requestUpdate(e,a)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Y}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const i of t)this.createProperty(i,e[i])}}static _attributeNameForProperty(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,i=Z){return i(e,t)}static _propertyValueFromAttribute(e,t){const i=t.type,a=t.converter||K,r="function"==typeof a?a:a.fromAttribute;return r?r(e,i):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const i=t.type,a=t.converter;return(a&&a.toAttribute||K.toAttribute)(e,i)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,i){t!==i&&this._attributeToProperty(e,i)}_propertyToAttribute(e,t,i=Y){const a=this.constructor,r=a._attributeNameForProperty(e,i);if(void 0!==r){const e=a._propertyValueToAttribute(t,i);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const i=this.constructor,a=i._attributeToPropertyMap.get(e);if(void 0!==a){const e=i.getPropertyOptions(a);this._updateState=16|this._updateState,this[a]=i._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}_requestUpdate(e,t){let i=!0;if(void 0!==e){const a=this.constructor,r=a.getPropertyOptions(e);a._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}J.finalized=!0; /** @license Copyright (c) 2019 The Polymer Project Authors. All rights reserved. @@ -146,7 +146,7 @@ const Q="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.pro * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");const ie={};class ae extends J{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(void 0===e)this._styles=[];else if(Array.isArray(e)){const t=(e,i)=>e.reduceRight((e,i)=>Array.isArray(i)?t(i,e):(e.add(i),e),i),i=t(e,new Set),a=[];i.forEach(e=>a.unshift(e)),this._styles=a}else this._styles=[e]}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Q?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==ie&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return ie}}ae.finalized=!0,ae.render=(e,t,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const a=i.scopeName,r=q.has(t),n=G&&11===t.nodeType&&!!t.host,s=n&&!W.has(a),l=s?document.createDocumentFragment():t;if(((e,t,i)=>{let a=q.get(t);void 0===a&&(o(t,t.firstChild),q.set(t,a=new T(Object.assign({templateFactory:j},i))),a.appendInto(t)),a.setValue(e),a.commit()})(e,l,Object.assign({templateFactory:H(a)},i)),s){const e=q.get(l);q.delete(l);const i=e.value instanceof S?e.value.template:void 0;V(a,l,i),o(t,t.firstChild),t.appendChild(l),q.set(t,e)}!r&&n&&window.ShadyCSS.styleElement(t.host)}; +(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");const ie={};class ae extends J{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(void 0===e)this._styles=[];else if(Array.isArray(e)){const t=(e,i)=>e.reduceRight((e,i)=>Array.isArray(i)?t(i,e):(e.add(i),e),i),i=t(e,new Set),a=[];i.forEach(e=>a.unshift(e)),this._styles=a}else this._styles=[e]}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Q?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==ie&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return ie}}ae.finalized=!0,ae.render=(e,t,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const a=i.scopeName,r=M.has(t),n=G&&11===t.nodeType&&!!t.host,s=n&&!W.has(a),l=s?document.createDocumentFragment():t;if(((e,t,i)=>{let a=M.get(t);void 0===a&&(o(t,t.firstChild),M.set(t,a=new T(Object.assign({templateFactory:j},i))),a.appendInto(t)),a.setValue(e),a.commit()})(e,l,Object.assign({templateFactory:H(a)},i)),s){const e=M.get(l);M.delete(l);const i=e.value instanceof S?e.value.template:void 0;V(a,l,i),o(t,t.firstChild),t.appendChild(l),M.set(t,e)}!r&&n&&window.ShadyCSS.styleElement(t.host)}; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -386,7 +386,7 @@ const re=new WeakMap,oe=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeSVG
- `:""} `:O``}firstUpdated(){this.initRoute(),window.addEventListener("popstate",e=>{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(e){e.stopPropagation(),this.navMenuShown=!this.navMenuShown,this.navMenuShown&&document.addEventListener("click",()=>{this.navMenuShown=!1},{once:!0})}initRoute(){this.inited=!0,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.get("config")){this.loadInfo||(this.loadInfo={});try{this.loadInfo.extraConfig=JSON.parse(this.pageParams.get("config"))}catch(e){console.log("invalid config: "+e)}}this.pageParams.get("basePageUrl")&&(this.loadInfo||(this.loadInfo={extraConfig:{}}),this.loadInfo.extraConfig||(this.loadInfo.extraConfig={}),this.loadInfo.extraConfig.baseUrl=this.pageParams.get("basePageUrl")),this.pageParams.get("customColl")&&(this.loadInfo||(this.loadInfo={}),this.loadInfo.customColl=this.pageParams.get("customColl"))}onStartLoad(e){if(this.pageParams.set("source",e.detail.sourceUrl),e.detail.isFile){{const e=new URL(window.location.href);e.search=this.pageParams.toString(),window.history.pushState({},"",e.toString())}this.sourceUrl=e.detail.sourceUrl,this.loadInfo=e.detail}else window.location.search=this.pageParams.toString()}onCollLoaded(e){this.loadInfo=null,e.detail.collInfo&&(this.collInfo=e.detail.collInfo),e.detail.alreadyLoaded||e.detail.sourceUrl!==this.sourceUrl&&(this.pageParams.set("source",e.detail.sourceUrl),window.location.search=this.pageParams.toString())}});var je=i(93),Me=i.n(je);customElements.define("wr-chooser",class extends ae{constructor(){super(),this.fileDisplayName="",this.file=null}onChooseFile(e){0!==e.currentTarget.files.length&&(this.file=e.currentTarget.files[0],this.fileDisplayName="file://"+(this.file.path||this.file.name),this.requestUpdate())}onStartLoad(e){e.preventDefault();const t={sourceUrl:this.fileDisplayName};if(this.file){if(t.isFile=!0,this.file.path){const e=new URL("http://files.replayweb.page/");e.searchParams.set("filename",this.file.path),t.loadUrl=e.href}else t.loadUrl=URL.createObjectURL(this.file),t.blob=this.file;t.size=this.file.size,t.noCache=void 0!==this.file.path,t.name=this.fileDisplayName}return this.dispatchEvent(new CustomEvent("load-start",{detail:t})),!1}onInput(e){this.fileDisplayName=e.currentTarget.value,this.file&&this.fileDisplayName&&this.fileDisplayName.startsWith("file://")&&(this.file=null,this.fileDisplayName="")}static get styles(){return ue(te` + `:""} `:O``}firstUpdated(){this.initRoute(),window.addEventListener("popstate",e=>{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(e){e.stopPropagation(),this.navMenuShown=!this.navMenuShown,this.navMenuShown&&document.addEventListener("click",()=>{this.navMenuShown=!1},{once:!0})}initRoute(){this.inited=!0,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.get("config")){this.loadInfo||(this.loadInfo={});try{this.loadInfo.extraConfig=JSON.parse(this.pageParams.get("config"))}catch(e){console.log("invalid config: "+e)}}this.pageParams.get("basePageUrl")&&(this.loadInfo||(this.loadInfo={extraConfig:{}}),this.loadInfo.extraConfig||(this.loadInfo.extraConfig={}),this.loadInfo.extraConfig.baseUrl=this.pageParams.get("basePageUrl")),this.pageParams.get("customColl")&&(this.loadInfo||(this.loadInfo={}),this.loadInfo.customColl=this.pageParams.get("customColl"))}onStartLoad(e){if(this.pageParams.set("source",e.detail.sourceUrl),e.detail.isFile){{const e=new URL(window.location.href);e.search=this.pageParams.toString(),window.history.pushState({},"",e.toString())}this.sourceUrl=e.detail.sourceUrl,this.loadInfo=e.detail}else window.location.search=this.pageParams.toString()}onCollLoaded(e){this.loadInfo=null,e.detail.collInfo&&(this.collInfo=e.detail.collInfo),e.detail.alreadyLoaded||e.detail.sourceUrl!==this.sourceUrl&&(this.pageParams.set("source",e.detail.sourceUrl),window.location.search=this.pageParams.toString())}});var je=i(93),qe=i.n(je);customElements.define("wr-chooser",class extends ae{constructor(){super(),this.fileDisplayName="",this.file=null}onChooseFile(e){0!==e.currentTarget.files.length&&(this.file=e.currentTarget.files[0],this.fileDisplayName="file://"+(this.file.path||this.file.name),this.requestUpdate())}onStartLoad(e){e.preventDefault();const t={sourceUrl:this.fileDisplayName};if(this.file){if(t.isFile=!0,this.file.path){const e=new URL("http://files.replayweb.page/");e.searchParams.set("filename",this.file.path),t.loadUrl=e.href}else t.loadUrl=URL.createObjectURL(this.file),t.blob=this.file;t.size=this.file.size,t.noCache=void 0!==this.file.path,t.name=this.fileDisplayName}return this.dispatchEvent(new CustomEvent("load-start",{detail:t})),!1}onInput(e){this.fileDisplayName=e.currentTarget.value,this.file&&this.fileDisplayName&&this.fileDisplayName.startsWith("file://")&&(this.file=null,this.fileDisplayName="")}static get styles(){return ue(te` .extra-padding { padding: 2em; } @@ -436,7 +436,7 @@ const re=new WeakMap,oe=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeSVG @change=${this.onChooseFile} type="file" id="fileupload" name="fileupload"> - + Choose File... @@ -462,7 +462,7 @@ const re=new WeakMap,oe=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeSVG - `}});var qe=i(94),Ne=i.n(qe),Oe=i(95),Be=i.n(Oe),Ge=i(96),He=i.n(Ge),Fe=i(18),We=i.n(Fe);class Ve extends ae{constructor(){super(),this.colls=[],this.filteredColls=[],this.sortedColls=[],this.query="",this.hideHeader="1"===localStorage.getItem("index:hideHeader"),this._deleting={}}static get sortKeys(){return[{key:"title",name:"Title"},{key:"sourceUrl",name:"Source"},{key:"ctime",name:"Date Loaded"},{key:"size",name:"Total Size"}]}static get properties(){return{colls:{type:Array},query:{type:String},filteredColls:{type:Array},sortedColls:{type:Array},hideHeader:{type:Boolean},_deleting:{type:Object}}}firstUpdated(){this.loadColls()}updated(e){e.has("hideHeader")&&localStorage.setItem("index:hideHeader",this.hideHeader?"1":"0"),(e.has("colls")||e.has("query"))&&this.filter()}filter(){if(this.query){this.filteredColls=[];for(const e of this.colls)(e.sourceUrl.indexOf(this.query)>=0||e.filename.indexOf(this.query)>=0||e.title&&e.title.indexOf(this.query)>=0)&&this.filteredColls.push(e)}else this.filteredColls=this.colls}async loadColls(){const e=await fetch("./wabac/api/index");try{const t=await e.json();this.colls=t.colls.map(e=>(e.title=e.title||e.filename,e))}catch(e){}this._deleting={}}async onDeleteColl(e){if(e.preventDefault(),e.stopPropagation(),!this.sortedColls)return;const t=Number(e.currentTarget.getAttribute("data-coll-index")),i=this.sortedColls[t];if(!i||this._deleting[i.sourceUrl])return;this._deleting[i.sourceUrl]=!0,this.requestUpdate();const a=await fetch("./wabac/api/"+i.id,{method:"DELETE"});if(200===a.status){const e=await a.json();this.colls=e.colls}return!1}static get styles(){return ue(te` + `}});var Me=i(94),Ne=i.n(Me),Oe=i(95),Be=i.n(Oe),Ge=i(96),He=i.n(Ge),Fe=i(18),We=i.n(Fe);class Ve extends ae{constructor(){super(),this.colls=[],this.filteredColls=[],this.sortedColls=[],this.query="",this.hideHeader="1"===localStorage.getItem("index:hideHeader"),this._deleting={}}static get sortKeys(){return[{key:"title",name:"Title"},{key:"sourceUrl",name:"Source"},{key:"ctime",name:"Date Loaded"},{key:"size",name:"Total Size"}]}static get properties(){return{colls:{type:Array},query:{type:String},filteredColls:{type:Array},sortedColls:{type:Array},hideHeader:{type:Boolean},_deleting:{type:Object}}}firstUpdated(){this.loadColls()}updated(e){e.has("hideHeader")&&localStorage.setItem("index:hideHeader",this.hideHeader?"1":"0"),(e.has("colls")||e.has("query"))&&this.filter()}filter(){if(this.query){this.filteredColls=[];for(const e of this.colls)(e.sourceUrl.indexOf(this.query)>=0||e.filename.indexOf(this.query)>=0||e.title&&e.title.indexOf(this.query)>=0)&&this.filteredColls.push(e)}else this.filteredColls=this.colls}async loadColls(){const e=await fetch("./wabac/api/index");try{const t=await e.json();this.colls=t.colls.map(e=>(e.title=e.title||e.filename,e))}catch(e){}this._deleting={}}async onDeleteColl(e){if(e.preventDefault(),e.stopPropagation(),!this.sortedColls)return;const t=Number(e.currentTarget.getAttribute("data-coll-index")),i=this.sortedColls[t];if(!i||this._deleting[i.sourceUrl])return;this._deleting[i.sourceUrl]=!0,this.requestUpdate();const a=await fetch("./wabac/api/"+i.id,{method:"DELETE"});if(200===a.status){const e=await a.json();this.colls=e.colls}return!1}static get styles(){return ue(te` :host { overflow-y: auto; } @@ -989,6 +989,10 @@ const zt=new WeakMap,$t=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTM align-items: center; } + .desc p { + margin-bottom: 1.0em; + } + .columns { width: 100%; height: 100%; @@ -1073,7 +1077,7 @@ const zt=new WeakMap,$t=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTM
-
+

${this.collInfo.title}

${this.collInfo.desc?$t(Ct()(this.collInfo.desc)):""}
@@ -1190,7 +1194,7 @@ const zt=new WeakMap,$t=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTM ${this.embed?O` window.parent.location.reload()}>Try Again`:O` Back`} -
`;case"waiting":default:return O``}}});var Tt=i(103),Dt=i.n(Tt),Et=i(104),At=i.n(Et),It=i(105),Ut=i.n(It),Rt=i(106),jt=i.n(Rt),Mt=i(107),qt=i.n(Mt);class Nt extends ae{constructor(){super(),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.newQuery=null,this.loading=!1,this.updatingSearch=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set,this.menuActive=!1,this.sortKey="ts",this.sortDesc=!0,this.isSidebar=!1,this.url="",this.ts=""}static get sortKeys(){return[{key:"",name:"Best Match"},{key:"title",name:"Title"},{key:"ts",name:"Date"}]}static get properties(){return{active:{type:Boolean},collInfo:{type:Object},currList:{type:Number},filteredPages:{type:Array},sortedPages:{type:Array},query:{type:String},loading:{type:Boolean},updatingSearch:{type:Boolean},editable:{type:Boolean},selectedPages:{type:Set},allSelected:{type:Boolean},menuActive:{type:Boolean},sortKey:{type:String},sortDesc:{type:Boolean},isSidebar:{type:Boolean},url:{type:String},ts:{type:String}}}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}async updated(e){if(e.has("collInfo")?this.updateTextSearch():e.has("query")?(this.filter(),this.sortKey=this.query?"":"ts",this.sortDesc=!this.query):e.has("currList")&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter(),e.has("sortedPages")&&this.isSidebar){const e=this.renderRoot.querySelector(".current");if(e){const t={behavior:"smooth",block:"nearest",inline:"nearest"};setTimeout(()=>e.scrollIntoView(t),100)}}}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout(()=>this._timedUpdate(),250)}async filter(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query){const e=await this.flex.search(this.query,{limit:25});this.filteredPages=e}else this.filteredPages=[...this.collInfo.pages];0!==this.currList&&await this.filterCurated(),this.loading=!1,this.changeNeeded=!1;const e={query:this.query,currList:this.currList};this.sendChangeEvent(e)}async filterCurated(){const e=await fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`),t=await e.json(),i=[];for(const e of t.curated)for(const t of this.filteredPages)if(t.id===e.page){i.push(t);break}this.filteredPages=i}sendChangeEvent(e){this.dispatchEvent(new CustomEvent("coll-tab-nav",{detail:{data:e}}))}async updateTextSearch(){if(this.updatingSearch)return;this.updatingSearch=!0;let e=0;try{const i=new At.a({doc:{id:"id",field:["url","title","text"]},async:!0});this.flex=i;const a=await caches.open("cache:"+this.collInfo.coll),r=this.collInfo.apiPrefix+"/textIndex";let o=await a.match(r);o&&Number(o.headers.get("Content-Length"))||(o=await fetch(this.collInfo.apiPrefix+"/textIndex"),200===o.status&&Number(o.headers.get("Content-Length"))&&a.put(r,o.clone()));let n=[];async function t(){let t=n;n=[],await i.add(t),console.log("added "+e+" "+t.length),console.log(i.info())}for await(const i of Dt()(o.body.getReader()))i.text&&(i.id=++e,n.push(i),e%100==0&&await t());await t()}finally{0===e&&this.flex.add(this.collInfo.pages),this.updatingSearch=!1}await this.filter()}static get styles(){return ue(te` + `;case"waiting":default:return O``}}});var Tt=i(103),Dt=i.n(Tt),Et=i(104),At=i.n(Et),It=i(105),Ut=i.n(It),Rt=i(106),jt=i.n(Rt),qt=i(107),Mt=i.n(qt);class Nt extends ae{constructor(){super(),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.newQuery=null,this.loading=!1,this.updatingSearch=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set,this.menuActive=!1,this.sortKey=null,this.sortDesc=null,this.isSidebar=!1,this.url="",this.ts=""}static get sortKeys(){return[{key:"",name:"Best Match"},{key:"title",name:"Title"},{key:"ts",name:"Date"}]}static get properties(){return{active:{type:Boolean},collInfo:{type:Object},currList:{type:Number},filteredPages:{type:Array},sortedPages:{type:Array},query:{type:String},defaultKey:{type:String},loading:{type:Boolean},updatingSearch:{type:Boolean},editable:{type:Boolean},selectedPages:{type:Set},allSelected:{type:Boolean},menuActive:{type:Boolean},sortKey:{type:String},sortDesc:{type:Boolean},isSidebar:{type:Boolean},url:{type:String},ts:{type:String}}}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}async updated(e){if(e.has("collInfo")?this.updateTextSearch():e.has("query")?(this.query&&!e.get("query")&&(this.sortKey=null,this.sortDesc=null),this.filter()):e.has("currList")&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter(),e.has("sortedPages")&&this.isSidebar){const e=this.renderRoot.querySelector(".current");if(e){const t={behavior:"smooth",block:"nearest",inline:"nearest"};setTimeout(()=>e.scrollIntoView(t),100)}}}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout(()=>this._timedUpdate(),250)}async filter(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query){const e=await this.flex.search(this.query,{limit:25});this.filteredPages=e}else this.filteredPages=[...this.collInfo.pages];0!==this.currList&&await this.filterCurated(),this.loading=!1,this.changeNeeded=!1;const e={query:this.query,currList:this.currList};this.sendChangeEvent(e)}async filterCurated(){const e=await fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`),t=await e.json(),i=[];for(const e of t.curated)for(const t of this.filteredPages)if(t.id===e.page){i.push(t);break}this.filteredPages=i}sendChangeEvent(e){this.dispatchEvent(new CustomEvent("coll-tab-nav",{detail:{data:e}}))}async updateTextSearch(){if(this.updatingSearch)return;this.updatingSearch=!0;let e=0;try{const i=new At.a({doc:{id:"id",field:["url","title","text"]},async:!0});this.flex=i;const a=await caches.open("cache:"+this.collInfo.coll),r=this.collInfo.apiPrefix+"/textIndex";let o=await a.match(r);o&&Number(o.headers.get("Content-Length"))||(o=await fetch(this.collInfo.apiPrefix+"/textIndex"),200===o.status&&Number(o.headers.get("Content-Length"))&&a.put(r,o.clone()));let n=[];async function t(){let t=n;n=[],await i.add(t),console.log("added "+e+" "+t.length),console.log(i.info())}for await(const i of Dt()(o.body.getReader()))i.text&&(i.id=++e,n.push(i),e%100==0&&await t());await t()}finally{0===e&&this.flex.add(this.collInfo.pages),this.updatingSearch=!1}await this.filter()}static get styles(){return ue(te` :host { width: 100%; height: 100%; @@ -1410,7 +1414,7 @@ const zt=new WeakMap,$t=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTM Hide - Full Page View + Full Page View `:""} @@ -1518,13 +1522,10 @@ const zt=new WeakMap,$t=w(e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTM
- - -
${this.formatResults()}
t=>{if(!(t instanceof T))throw new Error("unsafeHTM
`:""} - `}});var Ft=i(108),Wt=i.n(Ft),Vt=i(109),Kt=i.n(Vt);customElements.define("wr-sorter",class extends ae{constructor(){super(),this.sortedData=[],this.data=[],this.numResults=100,this.defaultDesc=!1,this.sortKey="url",this.sortDesc=!1,this.defaultKey="",this.defaultDesc=!1}static get properties(){return{id:{type:String},defaultKey:{type:String},defaultDesc:{type:Boolean},data:{type:Array},sortedData:{type:Array},sortKey:{type:String},sortDesc:{type:Boolean}}}firstUpdated(){this.sortKey=localStorage.getItem(this.id+":sortKey")||this.defaultKey;const e=localStorage.getItem(this.id+":sortDesc");this.sortDesc=e?"1"===e:this.defaultDesc}updated(e){const t=e.has("sortKey"),i=e.has("sortDesc"),a=e.has("data");e.has("numResults");t&&localStorage.setItem(this.id+":sortKey",this.sortKey),i&&localStorage.setItem(this.id+":sortDesc",this.sortDesc?"1":"0"),(t||i||a)&&this.sortData()}sortData(){this.sortedData=[...this.data],this.numResults=100,""===this.sortKey?this.sortDesc&&this.sortedData.reverse():this.sortedData.sort((e,t)=>e[this.sortKey]===t[this.sortKey]?0:this.sortDesc==e[this.sortKey]=this.sortedData.length||(this.numResults+=e,this.sendSortChanged())}static get styles(){return ue(te` + `}});var Ft=i(108),Wt=i.n(Ft),Vt=i(109),Kt=i.n(Vt);customElements.define("wr-sorter",class extends ae{constructor(){super(),this.sortedData=[],this.data=[],this.numResults=100,this.sortKey=null,this.sortDesc=null,this.defaultKey="",this.defaultDesc=!1}static get properties(){return{id:{type:String},defaultKey:{type:String},defaultDesc:{type:Boolean},data:{type:Array},sortedData:{type:Array},sortKey:{type:String},sortDesc:{type:Boolean}}}updated(e){const t=e.has("sortKey"),i=e.has("sortDesc"),a=e.has("data");e.has("numResults");e.has("defaultKey")&&(this.sortKey=this.defaultKey),e.has("defaultDesc")&&(this.sortDesc=this.defaultDesc),t&&localStorage.setItem(this.id+":sortKey",this.sortKey),i&&localStorage.setItem(this.id+":sortDesc",this.sortDesc?"1":"0"),(t||i||a)&&this.sortData()}sortData(){this.sortedData=[...this.data],this.numResults=100,""===this.sortKey?this.sortDesc&&this.sortedData.reverse():this.sortedData.sort((e,t)=>e[this.sortKey]===t[this.sortKey]?0:this.sortDesc==e[this.sortKey]=this.sortedData.length||(this.numResults+=e,this.sendSortChanged())}static get styles(){return ue(te` :host { min-width: 100px; box-sizing: border-box !important;