Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

4.0 KB
Raw Blame
import{f as e}from"./predicate-DSCS8XT4.js";function t(e){return e instanceof Node&&e.nodeType===9}function n(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function r(e){return e instanceof HTMLImageElement}function i(t,n,r={}){if(!t||typeof document>`u`)return;let i=t;for(;i;){let t=n(i);if(!e(t))return t;i=r.composed?a(i):i.parentElement}}function a(e){if(e.assignedSlot)return e.assignedSlot;if(e.parentElement)return e.parentElement;let t=e.getRootNode();return n(t)?t.host:null}function o(e){return i(e,e=>e.hasAttribute(`keep-alive`)?!0:void 0,{composed:!0})??!1}const s=/* @__PURE__ */ new WeakSet;function c(e){e.shadowRoot&&l(e.shadowRoot),l(e)}function l(e){for(let t of Array.from(e.children))s.has(t)?t.destroy():c(t)}function u(e){class t extends e{#e=!1;#t=/* @__PURE__ */ new Set;constructor(...e){super(...e),s.add(this)}get destroyed(){return this.#e}destroy(){this.#e||(this.#e=!0,c(this),this.destroyCallback())}destroyCallback(){for(let e of this.#t)e.hostDestroyed?.()}addController(e){super.addController(e),this.#t.add(e)}removeController(e){super.removeController(e),this.#t.delete(e)}connectedCallback(){this.#e||super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),!this.#e&&!o(this)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected||this.destroy()})})}performUpdate(){this.#e||super.performUpdate()}}return t}const d=/* @__PURE__ */ new WeakMap,f=/* @__PURE__ */ new Map,p=globalThis.HTMLElement??class{};var m=class extends p{static{this.properties={}}static get observedAttributes(){return[...h(this).attrToProp.keys()]}#e;#t;#n;#r;#i;constructor(){super(),this.#e=/* @__PURE__ */ new Set,this.#t=/* @__PURE__ */ new Map,this.#r=!1,this.isUpdatePending=!1,this.hasUpdated=!1,this.#i=new Promise(e=>this.enableUpdating=e);let{props:e}=h(this.constructor);for(let t of e.keys())Object.hasOwn(this,t)&&((this.#n??=/* @__PURE__ */ new Map).set(t,this[t]),delete this[t]);this.requestUpdate()}enableUpdating(e){}addController(e){this.#e.add(e),this.isConnected&&e.hostConnected?.()}removeController(e){this.#e.delete(e)}connectedCallback(){this.#o(),this.enableUpdating(!0);for(let e of this.#e)e.hostConnected?.()}disconnectedCallback(){for(let e of this.#e)e.hostDisconnected?.()}attributeChangedCallback(e,t,n){if(t===n)return;let{props:r,attrToProp:i}=h(this.constructor),a=i.get(e);if(!a)return;let o=r.get(a);if(!o)return;let s=n;o.type===Boolean?s=n!==null:o.type===Number&&(s=n===null?null:Number(n)),this[a]=s}requestUpdate(e,t){e!==void 0&&!this.#t.has(e)&&this.#t.set(e,t),!this.isUpdatePending&&(this.#i=this.#a())}async#a(){this.isUpdatePending=!0;try{await this.#i}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;let e=this.#t;this.willUpdate(e);for(let e of this.#e)e.hostUpdate?.();this.update(e),this.#t=/* @__PURE__ */ new Map,this.isUpdatePending=!1;for(let e of this.#e)e.hostUpdated?.();this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}willUpdate(e){}update(e){}firstUpdated(e){}updated(e){}get updateComplete(){return this.#i}#o(){if(this.#r)return;this.#r=!0;let{props:e}=h(this.constructor);for(let t of e.keys()){let e=this.#n?.has(t)??!1,n=Object.hasOwn(this,t);if(!e&&!n)continue;let r=e?this.#n?.get(t):Reflect.get(this,t);n&&Reflect.deleteProperty(this,t),Reflect.set(this,t,r)}this.#n=void 0}};function h(e){let t=d.get(e);if(t)return t;let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map;for(let[t,i]of Object.entries(e.properties))if(n.set(t,i),r.set(i.attribute??t,t),!Object.getOwnPropertyDescriptor(e.prototype,t)?.get){let n=f.get(t);n||(n=Symbol(t),f.set(t,n)),Object.defineProperty(e.prototype,t,{get(){return this[n]},set(e){let r=this[n];this[n]=e,Object.is(r,e)||this.requestUpdate(t,r)},configurable:!0,enumerable:!0})}let i={props:n,attrToProp:r};return d.set(e,i),i}var g=class extends u(m){};export{t as a,i,m as n,r as o,u as r,n as s,g as t};
//# sourceMappingURL=ui-element-tYNJ8-5H.js.map