@e280/quay 0.0.0-1
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/LICENSE +23 -0
- package/README.md +117 -0
- package/package.json +57 -0
- package/s/cellar/cask.ts +18 -0
- package/s/cellar/cellar.test.ts +100 -0
- package/s/cellar/cellar.ts +53 -0
- package/s/cellar/forklift.ts +9 -0
- package/s/cellar/index.ts +7 -0
- package/s/cellar/memory-forklift.ts +29 -0
- package/s/cellar/opfs-forklift.ts +49 -0
- package/s/demo/main.bundle.ts +39 -0
- package/s/demo/main.css +126 -0
- package/s/dom/components/breadcrumb/component.ts +29 -0
- package/s/dom/components/browser/component.ts +75 -0
- package/s/dom/components/browser/style.css.ts +118 -0
- package/s/dom/components/dropzone/component.ts +33 -0
- package/s/dom/components/dropzone/style.css.ts +54 -0
- package/s/dom/components/filter/component.ts +44 -0
- package/s/dom/components/outliner/component.ts +16 -0
- package/s/dom/components/searchbar/component.ts +29 -0
- package/s/dom/components/sort/component.ts +48 -0
- package/s/dom/components.ts +15 -0
- package/s/dom/context.ts +5 -0
- package/s/dom/theme.css.ts +11 -0
- package/s/dom/utils/find-group-name.ts +12 -0
- package/s/dom/utils/find-local-group.ts +9 -0
- package/s/dom/views/tree/component.ts +64 -0
- package/s/dom/views/tree/style.css.ts +64 -0
- package/s/genius/folio.md +29 -0
- package/s/genius/parts/hy-tree.ts +142 -0
- package/s/genius/quay.md +13 -0
- package/s/genius/turbo.md +21 -0
- package/s/genius/twig.ts +34 -0
- package/s/index.html.ts +89 -0
- package/s/index.ts +14 -0
- package/s/logic/aspects/codex/codex.ts +46 -0
- package/s/logic/aspects/codex/example.ts +65 -0
- package/s/logic/aspects/codex/parts/clade.ts +28 -0
- package/s/logic/aspects/codex/parts/codex-item.ts +94 -0
- package/s/logic/aspects/codex/parts/hierarchy.ts +82 -0
- package/s/logic/aspects/codex/parts/taxonomy.ts +18 -0
- package/s/logic/aspects/codex/parts/types.ts +23 -0
- package/s/logic/aspects/codex/utils/generate-id.ts +7 -0
- package/s/logic/aspects/dropzone.ts +77 -0
- package/s/logic/aspects/tree-trail.ts +33 -0
- package/s/logic/brain.ts +22 -0
- package/s/logic/group.ts +104 -0
- package/s/logic/permissions.ts +34 -0
- package/s/logic/presets/media/group.ts +94 -0
- package/s/logic/presets/media/schema.ts +22 -0
- package/s/logic/presets/opfs/schema.ts +21 -0
- package/s/logic/presets/plain/group.ts +44 -0
- package/s/logic/presets/plain/schema.ts +15 -0
- package/s/logic/types.ts +33 -0
- package/s/tests.test.ts +8 -0
- package/x/cellar/cask.d.ts +8 -0
- package/x/cellar/cask.js +19 -0
- package/x/cellar/cask.js.map +1 -0
- package/x/cellar/cellar.d.ts +22 -0
- package/x/cellar/cellar.js +47 -0
- package/x/cellar/cellar.js.map +1 -0
- package/x/cellar/cellar.test.d.ts +11 -0
- package/x/cellar/cellar.test.js +79 -0
- package/x/cellar/cellar.test.js.map +1 -0
- package/x/cellar/forklift.d.ts +7 -0
- package/x/cellar/forklift.js +2 -0
- package/x/cellar/forklift.js.map +1 -0
- package/x/cellar/index.d.ts +5 -0
- package/x/cellar/index.js +6 -0
- package/x/cellar/index.js.map +1 -0
- package/x/cellar/memory-forklift.d.ts +9 -0
- package/x/cellar/memory-forklift.js +21 -0
- package/x/cellar/memory-forklift.js.map +1 -0
- package/x/cellar/opfs-forklift.d.ts +11 -0
- package/x/cellar/opfs-forklift.js +44 -0
- package/x/cellar/opfs-forklift.js.map +1 -0
- package/x/demo/main.bundle.d.ts +1 -0
- package/x/demo/main.bundle.js +30 -0
- package/x/demo/main.bundle.js.map +1 -0
- package/x/demo/main.bundle.min.js +471 -0
- package/x/demo/main.css +126 -0
- package/x/dom/components/breadcrumb/component.d.ts +1 -0
- package/x/dom/components/breadcrumb/component.js +21 -0
- package/x/dom/components/breadcrumb/component.js.map +1 -0
- package/x/dom/components/browser/component.d.ts +1 -0
- package/x/dom/components/browser/component.js +65 -0
- package/x/dom/components/browser/component.js.map +1 -0
- package/x/dom/components/browser/style.css.d.ts +2 -0
- package/x/dom/components/browser/style.css.js +117 -0
- package/x/dom/components/browser/style.css.js.map +1 -0
- package/x/dom/components/dropzone/component.d.ts +1 -0
- package/x/dom/components/dropzone/component.js +27 -0
- package/x/dom/components/dropzone/component.js.map +1 -0
- package/x/dom/components/dropzone/style.css.d.ts +2 -0
- package/x/dom/components/dropzone/style.css.js +53 -0
- package/x/dom/components/dropzone/style.css.js.map +1 -0
- package/x/dom/components/filter/component.d.ts +1 -0
- package/x/dom/components/filter/component.js +40 -0
- package/x/dom/components/filter/component.js.map +1 -0
- package/x/dom/components/outliner/component.d.ts +1 -0
- package/x/dom/components/outliner/component.js +13 -0
- package/x/dom/components/outliner/component.js.map +1 -0
- package/x/dom/components/searchbar/component.d.ts +1 -0
- package/x/dom/components/searchbar/component.js +24 -0
- package/x/dom/components/searchbar/component.js.map +1 -0
- package/x/dom/components/sort/component.d.ts +1 -0
- package/x/dom/components/sort/component.js +44 -0
- package/x/dom/components/sort/component.js.map +1 -0
- package/x/dom/components.d.ts +18 -0
- package/x/dom/components.js +13 -0
- package/x/dom/components.js.map +1 -0
- package/x/dom/context.d.ts +2 -0
- package/x/dom/context.js +3 -0
- package/x/dom/context.js.map +1 -0
- package/x/dom/theme.css.d.ts +2 -0
- package/x/dom/theme.css.js +11 -0
- package/x/dom/theme.css.js.map +1 -0
- package/x/dom/utils/find-group-name.d.ts +1 -0
- package/x/dom/utils/find-group-name.js +9 -0
- package/x/dom/utils/find-group-name.js.map +1 -0
- package/x/dom/utils/find-local-group.d.ts +1 -0
- package/x/dom/utils/find-local-group.js +7 -0
- package/x/dom/utils/find-local-group.js.map +1 -0
- package/x/dom/views/tree/component.d.ts +7 -0
- package/x/dom/views/tree/component.js +52 -0
- package/x/dom/views/tree/component.js.map +1 -0
- package/x/dom/views/tree/style.css.d.ts +2 -0
- package/x/dom/views/tree/style.css.js +63 -0
- package/x/dom/views/tree/style.css.js.map +1 -0
- package/x/genius/folio.md +29 -0
- package/x/genius/parts/hy-tree.d.ts +44 -0
- package/x/genius/parts/hy-tree.js +116 -0
- package/x/genius/parts/hy-tree.js.map +1 -0
- package/x/genius/quay.md +13 -0
- package/x/genius/turbo.md +21 -0
- package/x/genius/twig.d.ts +34 -0
- package/x/genius/twig.js +2 -0
- package/x/genius/twig.js.map +1 -0
- package/x/importmap.json +47 -0
- package/x/index.d.ts +11 -0
- package/x/index.html +170 -0
- package/x/index.html.d.ts +3 -0
- package/x/index.html.js +87 -0
- package/x/index.html.js.map +1 -0
- package/x/index.js +9 -0
- package/x/index.js.map +1 -0
- package/x/logic/aspects/codex/codex.d.ts +17 -0
- package/x/logic/aspects/codex/codex.js +39 -0
- package/x/logic/aspects/codex/codex.js.map +1 -0
- package/x/logic/aspects/codex/example.d.ts +13 -0
- package/x/logic/aspects/codex/example.js +42 -0
- package/x/logic/aspects/codex/example.js.map +1 -0
- package/x/logic/aspects/codex/parts/clade.d.ts +16 -0
- package/x/logic/aspects/codex/parts/clade.js +23 -0
- package/x/logic/aspects/codex/parts/clade.js.map +1 -0
- package/x/logic/aspects/codex/parts/codex-item.d.ts +33 -0
- package/x/logic/aspects/codex/parts/codex-item.js +74 -0
- package/x/logic/aspects/codex/parts/codex-item.js.map +1 -0
- package/x/logic/aspects/codex/parts/hierarchy.d.ts +23 -0
- package/x/logic/aspects/codex/parts/hierarchy.js +69 -0
- package/x/logic/aspects/codex/parts/hierarchy.js.map +1 -0
- package/x/logic/aspects/codex/parts/taxonomy.d.ts +7 -0
- package/x/logic/aspects/codex/parts/taxonomy.js +13 -0
- package/x/logic/aspects/codex/parts/taxonomy.js.map +1 -0
- package/x/logic/aspects/codex/parts/types.d.ts +22 -0
- package/x/logic/aspects/codex/parts/types.js +2 -0
- package/x/logic/aspects/codex/parts/types.js.map +1 -0
- package/x/logic/aspects/codex/utils/generate-id.d.ts +1 -0
- package/x/logic/aspects/codex/utils/generate-id.js +5 -0
- package/x/logic/aspects/codex/utils/generate-id.js.map +1 -0
- package/x/logic/aspects/dropzone.d.ts +16 -0
- package/x/logic/aspects/dropzone.js +60 -0
- package/x/logic/aspects/dropzone.js.map +1 -0
- package/x/logic/aspects/tree-trail.d.ts +8 -0
- package/x/logic/aspects/tree-trail.js +24 -0
- package/x/logic/aspects/tree-trail.js.map +1 -0
- package/x/logic/brain.d.ts +11 -0
- package/x/logic/brain.js +17 -0
- package/x/logic/brain.js.map +1 -0
- package/x/logic/group.d.ts +51 -0
- package/x/logic/group.js +79 -0
- package/x/logic/group.js.map +1 -0
- package/x/logic/permissions.d.ts +18 -0
- package/x/logic/permissions.js +26 -0
- package/x/logic/permissions.js.map +1 -0
- package/x/logic/presets/media/group.d.ts +7 -0
- package/x/logic/presets/media/group.js +75 -0
- package/x/logic/presets/media/group.js.map +1 -0
- package/x/logic/presets/media/schema.d.ts +18 -0
- package/x/logic/presets/media/schema.js +2 -0
- package/x/logic/presets/media/schema.js.map +1 -0
- package/x/logic/presets/opfs/schema.d.ts +18 -0
- package/x/logic/presets/opfs/schema.js +2 -0
- package/x/logic/presets/opfs/schema.js.map +1 -0
- package/x/logic/presets/plain/group.d.ts +7 -0
- package/x/logic/presets/plain/group.js +33 -0
- package/x/logic/presets/plain/group.js.map +1 -0
- package/x/logic/presets/plain/schema.d.ts +12 -0
- package/x/logic/presets/plain/schema.js +2 -0
- package/x/logic/presets/plain/schema.js.map +1 -0
- package/x/logic/types.d.ts +20 -0
- package/x/logic/types.js +11 -0
- package/x/logic/types.js.map +1 -0
- package/x/tests.test.d.ts +1 -0
- package/x/tests.test.js +6 -0
- package/x/tests.test.js.map +1 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
class t{#t=!1;lock(t){this.#t=!0;const e=t();return this.#t=!1,e}get locked(){return this.#t}}const e=()=>new Map,s=()=>new Set;function r(t){return{guarantee:(e,s)=>function(t,e,s){if(t.has(e))return t.get(e);{const r=s();return t.set(e,r),r}}(t,e,s)}}class n{#e=new WeakMap;grab_keymap(t){const s=r(this.#e).guarantee(t,e);return{keymap:s,grab_symbolmap:t=>r(s).guarantee(t,e)}}clear(){this.#e=new WeakMap}}class i{#s=new Map;stop(t){const e=this.#s.get(t);e&&(this.#s.delete(t),e())}add(t,e){this.#s.set(t,e)}}class o{#r=[];record(t){const s=e();this.#r.push(s);const r=t();return this.#r.pop(),{payload:r,recording:s}}record_that_key_was_accessed(t,e){const n=this.#r.at(-1);if(n){r(n).guarantee(t,s).add(e)}}}class a extends Error{name=this.constructor.name}class c extends a{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}}class l extends a{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}}function h(t){return new Proxy(t,{get:(t,e)=>t[e],set(t,e){throw new l(e)}})}function d(t,e){let s,r,n=[];function i(){s=[],r&&clearTimeout(r),r=void 0,n=[]}return i(),(...o)=>{s=o,r&&clearTimeout(r);const a=new Promise(((t,e)=>{n.push({resolve:t,reject:e})}));return r=setTimeout((()=>{Promise.resolve().then((()=>e(...s))).then((t=>{for(const{resolve:e}of n)e(t);i()})).catch((t=>{for(const{reject:e}of n)e(t);i()}))}),t),a}}class u{#n=new Map;#i=Promise.resolve();#o=d(0,(()=>{const t=[...this.#n.values()];this.#n.clear();for(const e of t)e()}));get wait(){return this.#i}add(t,e){this.#n.set(t,e),this.#i=this.#o()}}function p(t){return function(e){return()=>{const s="function"==typeof t?t():t;return e(s)}}}function f(t,e,s,r){const n=[];for(const[i,o]of e){const{grab_symbolmap:e}=s.grab_keymap(i);for(const s of o){const i=e(s);i.set(t,r),n.push((()=>i.delete(t)))}}return()=>n.forEach((t=>t()))}var g;!function(t){t.proxy=(t,e)=>new Proxy(e,{get:(s,r)=>{const n=e[r],i=t.getAttribute(r);switch(n){case String:return i??void 0;case Number:return null!==i?Number(i):void 0;case Boolean:return null!==i;default:throw new Error(`invalid attribute type for "${r}"`)}},set:(s,r,n)=>{switch(e[r]){case String:return t.setAttribute(r,n),!0;case Number:return t.setAttribute(r,n.toString()),!0;case Boolean:return n?t.setAttribute(r,""):t.removeAttribute(r),!0;default:throw new Error(`invalid attribute type for "${r}"`)}}}),t.on_change=function(t,e){const s=new MutationObserver(e);return s.observe(t,{attributes:!0}),()=>s.disconnect()}}(g||(g={}));class m{#a;constructor(t){this.#a=t}get state(){return this.#a.getter(this.#a.parent.state)}transmute(t){this.#a.parent.transmute((e=>{const s=this.#a.getter(e),r=t(s);return this.#a.setter(e,r)}))}slice({getter:t,setter:e}){return new m({parent:this,getter:t,setter:e})}}const v=t=>"object"==typeof t&&null!==t;const w={clone:function t(e,s=new Set){if(s.has(e))throw new Error("cannot clone circular reference");let r;return"function"==typeof e||null!==e&&"object"==typeof e?(s.add(e),r=Array.isArray(e)?e.map((e=>t(e,new Set(s)))):e.constructor===Object?Object.fromEntries(Object.entries(e).map((([e,r])=>[e,t(r,new Set(s))]))):e instanceof Map?new Map(Array.from(e,(([e,r])=>[e,t(r,new Set(s))]))):e instanceof Set?new Set(Array.from(e,(e=>t(e,new Set(s))))):e instanceof Date?new Date(e.getTime()):e,s.delete(e)):r=e,r},equal:(t,e)=>function t(e,s,r){if(!v(e)||!v(s))return e===s;if(r.includes(e))throw new Error("forbidden circularity detected in deep equal comparison");const n=[...r,e];if(e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(const[r,i]of e)if(!s.has(r)||!t(i,s.get(r),n))return!1}else if(e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(const r of e)if(!Array.from(s).some((e=>t(r,e,n))))return!1}else{const r=Object.keys(e),i=Object.keys(s);if(r.length!==i.length)return!1;for(const o of r){if(!i.includes(o))return!1;if(!t(e[o],s[o],n))return!1}}return!0}(t,e,[]),freeze:function(t){return function t(e,s){if(!v(e)||s.includes(e))return e;const r=[...s,e];if(e instanceof Map)for(const s of e.entries())for(const e of s)t(e,r);else if(e instanceof Set)for(const s of e)t(s,r);else if(Array.isArray(e))for(const s of e)t(s,r);else for(const s of Object.values(e))t(s,r);return Object.freeze(e)}(t,[])}};class b{#c;#l;#h;#d=!1;#u(){return w.freeze(structuredClone(this.#c))}constructor(t,e=()=>{}){this.#c=structuredClone(t),this.#l=this.#u(),this.#h=e}get state(){return this.#l}transmute(t){if(this.#d)throw new Error("circular error");this.#d=!0,this.#c=t(structuredClone(this.#c)),this.#l=this.#u(),this.#h(),this.#d=!1}slice({getter:t,setter:e}){return new m({parent:this,getter:t,setter:e})}}const y=Error;var _;function $(t){return{map:e=>x(t,e),filter:e=>A(t,e)}}!function(t){function e(t){return"ready"===t.status?t.payload:void 0}function s(t,e){switch(t.status){case"loading":return e.loading();case"error":return e.error(t.reason);case"ready":return e.ready(t.payload);default:throw console.error("op",t),new y("invalid op status")}}t.loading=()=>({status:"loading"}),t.error=t=>({status:"error",reason:t}),t.ready=t=>({status:"ready",payload:t}),t.is=Object.freeze({loading:t=>"loading"===t.status,error:t=>"error"===t.status,ready:t=>"ready"===t.status}),t.payload=e,t.reason=function(t){return"error"===t.status?t.reason:void 0},t.select=s,t.load=async function(e,s){e(t.loading());try{const r=await s();return e(t.ready(r)),r}catch(s){const r=s instanceof y?s.message:"string"==typeof s?s:"error";throw e(t.error(r)),s}},t.morph=function(e,r){return s(e,{loading:()=>t.loading(),error:e=>t.error(e),ready:e=>t.ready(r(e))})},t.all=function(...s){const r=s.find(t.is.error);return r||(s.every(t.is.ready)?t.ready(s.map(e)):t.loading())}}(_||(_={})),$.pipe=Object.freeze({map:t=>e=>x(e,t),filter:t=>e=>A(e,t)});const x=(t,e)=>Object.fromEntries(Object.entries(t).map((([t,s])=>[t,e(s,t)]))),A=(t,e)=>Object.fromEntries(Object.entries(t).filter((([t,s])=>e(s,t)))),k=Symbol();class S extends Error{name=this.constructor.name}class C{static unwrap=t=>t instanceof C?t.value:t;#p;#f=!1;#i;#g=new Set;[k]=!1;constructor(t){this.#p=t,this.#i=Promise.resolve(t)}subscribe(t){return this.on(t)}on(t){return this.#g.add(t),()=>{this.#g.delete(t)}}once(t){const e=s=>{t(s),this.#g.delete(e)};return this.#g.add(e),()=>{this.#g.delete(e)}}clear(){return this.#g.clear()}#m=d(0,(()=>{const t=this.#p;this.#f=!0;for(const e of this.#g)e(t);return this.#f=!1,t}));async publish(){this.#i=this.#m(),await this.#i}get wait(){return this.#i}get value(){return this[k]=!0,this.#p}set value(t){if(this.#f)throw new S("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p!==t&&(this.#p=t,this.publish())}setDeep(t){if(this.#f)throw new S("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");w.equal(t,this.#p)||(this.#p=t,this.publish())}setAndPublish(t){if(this.#f)throw new S("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t,this.publish()}setWithoutPublish(t){if(this.#f)throw new S("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t}setValueNoPublish(t){return this.setWithoutPublish(t)}}class E extends C{#v=0;constructor(t){super(t)}async load(t){const e=++this.#v;return _.load((t=>{this.#v===e&&(this.value=t)}),t)}setLoading(){this.value=_.loading()}setError(t){this.value=_.error(t)}setReady(t){this.value=_.ready(t)}isLoading(){return _.is.loading(this.value)}isError(){return _.is.error(this.value)}isReady(){return _.is.ready(this.value)}get payload(){return _.payload(this.value)}select(t){return _.select(this.value,t)}}class P{#w=!0;#b;#y;#_=new Set;#$=new Set;constructor({all_signals:t,waiters:e}){this.#b=t,this.#y=e}#o=d(0,(t=>{if(this.#w)if("lean"in t)t.actor();else{const{payload:e,recording:s}=this.observe(t.collector);this.add_listeners(t,s),t.responder&&t.responder(e)}}));#x(){for(const t of this.#b)t[k]=!1}get#A(){return[...this.#b].filter((t=>t[k]&&!this.#_.has(t)))}observe(t){this.#x();return{payload:t(),recording:this.#A}}add_listeners(t,e){for(const s of e)this.#_.add(s),this.#$.add(s.on((()=>this.#y.add(this.#o(t)))))}shutdown(){this.#w=!1,this.#$.forEach((t=>t()))}}const M=new class{static readonly=h;static collectivize=p;#k=new n;#S=new o;#C=new t;#E=new i;#P=new u;#M=function(t,e,s,r,n){function i([s,n]){if("lean"in n)n.actor();else{const{payload:i,recording:o}=e.record(n.collector);r.add(s,f(s,o,t,n)),n.responder&&n.responder(i)}}return{get:(t,s)=>(e.record_that_key_was_accessed(t,s),t[s]),set:(e,r,o)=>{if(s.locked)throw new c(r);e[r]=o;const a=[...t.grab_keymap(e).grab_symbolmap(r)];for(const t of a){const[e]=t;n.add(e,(()=>s.lock((()=>i(t)))))}return!0}}}(this.#k,this.#S,this.#C,this.#E,this.#P);get wait(){return this.#P.wait}state(t){return new Proxy(t,this.#M)}reaction(t,e){const s=Symbol(),{recording:r}=this.#S.record((()=>this.#C.lock(t)));return this.#E.add(s,f(s,r,this.#k,{collector:t,responder:e})),()=>this.#E.stop(s)}lean(t){const e=Symbol();return{stop:()=>this.#E.stop(e),collect:s=>{const{payload:r,recording:n}=this.#S.record((()=>this.#C.lock(s)));return this.#E.add(e,f(e,n,this.#k,{lean:!0,actor:t})),r}}}clear(){this.#k.clear()}},z=new class{#z=new Set;#y=new Set;signal(t){const e=new C(t);return this.#z.add(e),e}computed(t){const e=this.signal(t());return this.reaction((()=>{e.value=t()})),e}async computedAsync(t,e){const s=await e(t()),r=this.signal(s);return this.reaction(t,(async t=>{r.value=await e(t)})),r}op(t=_.loading()){const e=new E(t);return this.#z.add(e),e}load(t){const e=this.op(_.loading());return e.load(t),e}many(t){return $(t).map((t=>this.signal(t)))}reaction(t,e){const s=new P({waiters:this.#y,all_signals:this.#z}),r={collector:t,responder:e},{recording:n}=s.observe(r.collector);return s.add_listeners(r,n),()=>s.shutdown()}lean(t){const e=new P({waiters:this.#y,all_signals:this.#z}),s={lean:!0,actor:t};return{stop:()=>e.shutdown(),collect:t=>{const{payload:r,recording:n}=e.observe(t);return e.add_listeners(s,n),r}}}async#O(){return await Promise.all([...this.#z].map((t=>t.wait))).then((()=>Promise.all([...this.#y]))).then((()=>{this.#y.clear()}))}get wait(){return Promise.resolve().then((()=>this.#O())).then((()=>this.#O()))}},O=new class{#z;#U=new Set;#g=new Set;#T=new Map;#j=Promise.resolve();constructor(t){this.#z=t}get wait(){return this.#j}#q=d(0,(()=>{for(const t of this.#U)t();for(const t of this.#g)t()}));dispatch(){this.#j=this.#q()}computed(t){const e=this.#z.signal(t());return this.#U.add((()=>{e.value=t()})),e}track(t,e){let s=!0;const r=()=>{const r=t(),n=this.#T.get(t);!s&&w.equal(r,n)||(s=!1,this.#T.set(t,r),e(r))};r(),this.#g.add(r);return()=>this.#g.delete(r)}stateTree(t){return new b(t,(()=>this.dispatch()))}}(z);M.state.bind(M);const U=z.signal.bind(z);z.computed.bind(z),z.op.bind(z);const T=new class{flat;signals;#i=Promise.resolve();constructor(t,e){this.flat=t,this.signals=e}get wait(){return Promise.all([this.flat.wait,this.signals.wait]).then((()=>this.#i))}reaction(t,e){const s=e?()=>e(n()):()=>n(),r=this.lean(s),n=()=>r.collect(t);return n(),r.stop}lean(t){const e=this.flat.lean(t),s=this.signals.lean(t);return{stop(){e.stop(),s.stop()},collect:t=>e.collect((()=>s.collect(t)))}}}(M,z);class j{static with(t){return new this(t)}#D;constructor(t){this.#D=t}to(t){return new j(t(this.#D))}done(){return this.#D}}var q;function D(t){return[t].flat().filter((t=>!!t))}!function(t){function e(...t){return function(e){return class extends e{static get styles(){return R(e.styles,t)}}}}function s(t=T){return function(e){return class extends e{#N=null;render(){return this.#N?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#N=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#N&&(this.#N.stop(),this.#N=null)}}}}t.css=e,t.css_deferred=function(t){return function(e){return class extends e{static get styles(){return R(e.styles,t())}}}},t.signals=function(t){return function(e){return class extends e{#N=null;render(){return this.#N?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#N=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#N&&(this.#N.stop(),this.#N=null)}}}},t.flat=function(t){return function(e){return class extends e{#N=null;render(){return this.#N?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#N=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#N&&(this.#N.stop(),this.#N=null)}}}},t.reactive=s,t.reactor=s,t.setup=function(...t){return function(r){return j.with(r).to(e(...t)).to(s()).done()}}}(q||(q={}));const N=t=>void 0!==t;function R(t,e){return[...D(t)??[],...D(e)].flat().filter(N)}var H;function F(t,e={}){const{soft:s=!1,upgrade:r=!0}=e;for(const[e,n]of Object.entries(t)){const t=e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase(),i=customElements.get(t);s&&i||(customElements.define(t,n),r&&document.querySelectorAll(t).forEach((t=>{t.constructor===HTMLElement&&customElements.upgrade(t)})))}}!function(t){t.css=t=>e=>$(e).map((e=>q.css(t)(e))),t.flat=t=>e=>$(e).map((e=>q.flat(t)(e))),t.signals=t=>e=>$(e).map((e=>q.signals(t)(e))),t.reactive=(t=T)=>e=>$(e).map((e=>q.reactive(t)(e))),t.reactor=t.reactive,t.context=e=>s=>j.with(s).to(t.css(e.theme)).to(t.reactive()).done(),t.setup=(...t)=>e=>$(e).map((e=>q.setup(...t)(e)))}(H||(H={}));const L=F,B=globalThis,I=B.ShadowRoot&&(void 0===B.ShadyCSS||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,V=Symbol(),K=new WeakMap;
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/let W=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==V)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(I&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=K.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&K.set(e,t))}return t}toString(){return this.cssText}};const Q=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1]),t[0]);return new W(s,t,V)},G=(t,e)=>{if(I)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const s of e){const e=document.createElement("style"),r=B.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=s.cssText,t.appendChild(e)}},Z=I?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new W("string"==typeof t?t:t+"",void 0,V))(e)})(t):t,{is:X,defineProperty:Y,getOwnPropertyDescriptor:J,getOwnPropertyNames:tt,getOwnPropertySymbols:et,getPrototypeOf:st}=Object,rt=globalThis,nt=rt.trustedTypes,it=nt?nt.emptyScript:"",ot=rt.reactiveElementPolyfillSupport,at=(t,e)=>t,ct={toAttribute(t,e){switch(e){case Boolean:t=t?it:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},lt=(t,e)=>!X(t,e),ht={attribute:!0,type:String,converter:ct,reflect:!1,useDefault:!1,hasChanged:lt};
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Copyright 2017 Google LLC
|
|
10
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
|
+
*/Symbol.metadata??=Symbol("metadata"),rt.litPropertyMetadata??=new WeakMap;let dt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ht){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&Y(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:n}=J(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const i=r?.call(this);n?.call(this,e),this.requestUpdate(t,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ht}static _$Ei(){if(this.hasOwnProperty(at("elementProperties")))return;const t=st(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(at("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(at("properties"))){const t=this.properties,e=[...tt(t),...et(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(Z(t))}else void 0!==t&&e.push(Z(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return G(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const n=(void 0!==s.converter?.toAttribute?s.converter:ct).toAttribute(e,s.type);this._$Em=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:ct;this._$Em=r,this[r]=n.fromAttribute(e,t.type)??this._$Ej?.get(r)??null,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const r=this.constructor,n=this[t];if(s??=r.getPropertyOptions(t),!((s.hasChanged??lt)(n,e)||s.useDefault&&s.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:n},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==n||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};dt.elementStyles=[],dt.shadowRootOptions={mode:"open"},dt[at("elementProperties")]=new Map,dt[at("finalized")]=new Map,ot?.({ReactiveElement:dt}),(rt.reactiveElementVersions??=[]).push("2.1.0");
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2017 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*/
|
|
17
|
+
const ut=globalThis,pt=ut.trustedTypes,ft=pt?pt.createPolicy("lit-html",{createHTML:t=>t}):void 0,gt="$lit$",mt=`lit$${Math.random().toFixed(9).slice(2)}$`,vt="?"+mt,wt=`<${vt}>`,bt=document,yt=()=>bt.createComment(""),_t=t=>null===t||"object"!=typeof t&&"function"!=typeof t,$t=Array.isArray,xt="[ \t\n\f\r]",At=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,kt=/-->/g,St=/>/g,Ct=RegExp(`>|${xt}(?:([^\\s"'>=/]+)(${xt}*=${xt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Et=/'/g,Pt=/"/g,Mt=/^(?:script|style|textarea|title)$/i,zt=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),Ot=Symbol.for("lit-noChange"),Ut=Symbol.for("lit-nothing"),Tt=new WeakMap,jt=bt.createTreeWalker(bt,129);function qt(t,e){if(!$t(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==ft?ft.createHTML(e):e}const Dt=(t,e)=>{const s=t.length-1,r=[];let n,i=2===e?"<svg>":3===e?"<math>":"",o=At;for(let e=0;e<s;e++){const s=t[e];let a,c,l=-1,h=0;for(;h<s.length&&(o.lastIndex=h,c=o.exec(s),null!==c);)h=o.lastIndex,o===At?"!--"===c[1]?o=kt:void 0!==c[1]?o=St:void 0!==c[2]?(Mt.test(c[2])&&(n=RegExp("</"+c[2],"g")),o=Ct):void 0!==c[3]&&(o=Ct):o===Ct?">"===c[0]?(o=n??At,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?Ct:'"'===c[3]?Pt:Et):o===Pt||o===Et?o=Ct:o===kt||o===St?o=At:(o=Ct,n=void 0);const d=o===Ct&&t[e+1].startsWith("/>")?" ":"";i+=o===At?s+wt:l>=0?(r.push(a),s.slice(0,l)+gt+s.slice(l)+mt+d):s+mt+(-2===l?e:d)}return[qt(t,i+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class Nt{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0;const o=t.length-1,a=this.parts,[c,l]=Dt(t,e);if(this.el=Nt.createElement(c,s),jt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=jt.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(gt)){const e=l[i++],s=r.getAttribute(t).split(mt),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:o[2],strings:s,ctor:"."===o[1]?Bt:"?"===o[1]?It:"@"===o[1]?Vt:Lt}),r.removeAttribute(t)}else t.startsWith(mt)&&(a.push({type:6,index:n}),r.removeAttribute(t));if(Mt.test(r.tagName)){const t=r.textContent.split(mt),e=t.length-1;if(e>0){r.textContent=pt?pt.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],yt()),jt.nextNode(),a.push({type:2,index:++n});r.append(t[e],yt())}}}else if(8===r.nodeType)if(r.data===vt)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=r.data.indexOf(mt,t+1));)a.push({type:7,index:n}),t+=mt.length-1}n++}}static createElement(t,e){const s=bt.createElement("template");return s.innerHTML=t,s}}function Rt(t,e,s=t,r){if(e===Ot)return e;let n=void 0!==r?s._$Co?.[r]:s._$Cl;const i=_t(e)?void 0:e._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),void 0===i?n=void 0:(n=new i(t),n._$AT(t,s,r)),void 0!==r?(s._$Co??=[])[r]=n:s._$Cl=n),void 0!==n&&(e=Rt(t,n._$AS(t,e.values),n,r)),e}class Ht{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??bt).importNode(e,!0);jt.currentNode=r;let n=jt.nextNode(),i=0,o=0,a=s[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new Ft(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new Kt(n,this,t)),this._$AV.push(e),a=s[++o]}i!==a?.index&&(n=jt.nextNode(),i++)}return jt.currentNode=bt,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class Ft{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=Ut,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Rt(this,t,e),_t(t)?t===Ut||null==t||""===t?(this._$AH!==Ut&&this._$AR(),this._$AH=Ut):t!==this._$AH&&t!==Ot&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>$t(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Ut&&_t(this._$AH)?this._$AA.nextSibling.data=t:this.T(bt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=Nt.createElement(qt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new Ht(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=Tt.get(t.strings);return void 0===e&&Tt.set(t.strings,e=new Nt(t)),e}k(t){$t(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const n of t)r===e.length?e.push(s=new Ft(this.O(yt()),this.O(yt()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Lt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=Ut,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=Ut}_$AI(t,e=this,s,r){const n=this.strings;let i=!1;if(void 0===n)t=Rt(this,t,e,0),i=!_t(t)||t!==this._$AH&&t!==Ot,i&&(this._$AH=t);else{const r=t;let o,a;for(t=n[0],o=0;o<n.length-1;o++)a=Rt(this,r[s+o],e,o),a===Ot&&(a=this._$AH[o]),i||=!_t(a)||a!==this._$AH[o],a===Ut?t=Ut:t!==Ut&&(t+=(a??"")+n[o+1]),this._$AH[o]=a}i&&!r&&this.j(t)}j(t){t===Ut?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Bt extends Lt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Ut?void 0:t}}class It extends Lt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Ut)}}class Vt extends Lt{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=Rt(this,t,e,0)??Ut)===Ot)return;const s=this._$AH,r=t===Ut&&s!==Ut||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==Ut&&(s===Ut||r);r&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Kt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Rt(this,t)}}const Wt=ut.litHtmlPolyfillSupport;Wt?.(Nt,Ft),(ut.litHtmlVersions??=[]).push("3.3.0");const Qt=(t,e,s)=>{const r=s?.renderBefore??e;let n=r._$litPart$;if(void 0===n){const t=s?.renderBefore??null;r._$litPart$=n=new Ft(e.insertBefore(yt(),t),t,void 0,s??{})}return n._$AI(t),n
|
|
18
|
+
/**
|
|
19
|
+
* @license
|
|
20
|
+
* Copyright 2017 Google LLC
|
|
21
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
+
*/},Gt=globalThis;let Zt=class extends dt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Qt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Ot}};Zt._$litElement$=!0,Zt.finalized=!0,Gt.litElementHydrateSupport?.({LitElement:Zt});const Xt=Gt.litElementPolyfillSupport;Xt?.({LitElement:Zt}),(Gt.litElementVersions??=[]).push("4.2.0");class Yt extends(function(t){return class extends t{#R=(new Set).add((()=>this.setup()));#H=new Set;register_setup(t){this.#R.add(t)}setup(){return()=>{}}connectedCallback(){for(const t of this.#R)this.#H.add(t())}disconnectedCallback(){for(const t of this.#H)t();this.#H.clear()}}}(HTMLElement)){}function Jt(){let t,e;const s=new Promise(((s,r)=>{t=s,e=r}));return{promise:s,resolve:t,reject:e,entangle:function(r){return r.then(t).catch(e),s}}}function te(t,e){G(t,function(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(Z(t))}else void 0!==t&&e.push(Z(t));return e}(e))}class ee extends Yt{static get styles(){}#F;#L=Jt();#i=this.#L.promise;init(){}constructor(){super(),this.#F=this.attachShadow({mode:"open"});const t=this.constructor;te(this.#F,t.styles),this.init()}get root(){return this.#F}get updateComplete(){return this.#i.then((()=>!0))}render(){}#B=d(0,(()=>{const t=this.#F,e=this.render();e&&Qt(e,t,{host:this})}));async requestUpdate(){const t=this.#B();return this.#L&&(t.then(this.#L.resolve),this.#L=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}class se extends Yt{#L=Jt();#i=this.#L.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#i.then((()=>!0))}render(){}#B=d(0,(()=>{const t=this.render();Qt(t,this,{host:this})}));async requestUpdate(){const t=this.#B();return this.#L&&(t.then(this.#L.resolve),this.#L=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}const re=Symbol();class ne{#p=0;pull(){return this.#p++}reset(){this.#p=0}}class ie{[re]={wrap:t=>(...e)=>(this.#I.reset(),t(...e)),disconnect:()=>{for(const t of this.#V)t();this.#V.clear();for(const t of this.#K)t();this.#K.clear(),this.#W.clear();for(const{untrack:t}of this.#Q.values())t();this.#Q.clear()},reconnect:()=>{for(const t of this.#G.values())this.#V.add(t());for(const[t,e]of this.#Z.entries()){const[s,r]=e();this.#W.set(t,s),this.#K.add(r)}},afterRender:()=>{for(const t of this.#X.values())t()}};#Y;#J;#I=new ne;constructor(t,e){this.#J=t,this.#Y=e}get context(){return this.#Y}rerender(){this.#J()}#G=new Map;#V=new Set;mount(t){const e=this.#I.pull();this.#G.has(e)||(this.#G.set(e,t),this.#V.add(t()))}#Z=new Map;#W=new Map;#K=new Set;init(t){const e=this.#I.pull();if(!this.#Z.has(e)){this.#Z.set(e,t);const[s,r]=t();return this.#W.set(e,s),this.#K.add(r),s}return this.#W.get(e)}#tt=new Map;once(t){const e=this.#I.pull();return r(this.#tt).guarantee(e,t)}#X=new Map;defer(t){const e=this.signal(void 0),s=this.#I.pull();return this.#X.has(s)||this.#X.set(s,(()=>{e.value=t()})),e}#et=new Set;deferOnce(t){this.mount((()=>(this.#et.clear(),()=>{})));const e=this.signal(void 0),s=this.#I.pull();return this.#X.has(s)||this.#X.set(s,(()=>{this.#et.has(s)||(this.#et.add(s),e.value=t())})),e}#st=new Map;state(t){const e=this.#I.pull();return[r(this.#st).guarantee(e,(()=>"function"==typeof t?t():t)),t=>{this.#st.set(e,t),this.#J()},()=>this.#st.get(e)]}#rt=new Map;flatstate(t){const e=this.#I.pull();return r(this.#rt).guarantee(e,(()=>M.state("function"==typeof t?t():t)))}#z=new Map;signal(t){const e=this.#I.pull();return r(this.#z).guarantee(e,(()=>z.signal("function"==typeof t?t():t)))}computed(t){const e=this.#I.pull();return r(this.#z).guarantee(e,(()=>z.computed(t)))}op(){const t=this.#I.pull();return r(this.#z).guarantee(t,(()=>z.op()))}load(t){const e=this.op();return this.once((()=>e.load(t))),e}#Q=new Map;watch(t){const e=this.#I.pull(),{data:s}=r(this.#Q).guarantee(e,(()=>{const e={data:t(),untrack:()=>{}};return e.untrack=O.track(t,(t=>{e.data=t,this.#J()})),e}));return s}#nt=new Map;effect(t,e){e=e.map(C.unwrap);const s=this.#I.pull(),r=this.#nt.get(s);if(r){const[n,i]=r;w.equal(e,i)||(n(),this.#nt.set(s,[t(),e]))}else{this.#G.set(s,t);const r=t();this.#V.add(r),this.#nt.set(s,[r,e])}}}class oe extends ie{#it;get element(){return this.#it}#ot;get shadow(){return this.#ot}styles(...t){this.once((()=>te(this.shadow,[this.context.theme,...t])))}css(...t){return this.styles(...t)}constructor(t,e,s,r){super(s,r),this.#it=t,this.#ot=e}}function ae(t){let e;return function(s){return e||(e=function(t,e){return g.on_change(t,(()=>t.requestUpdate())),g.proxy(t,e)}(t,s)),e}}class ce extends oe{attrs;constructor(t,e,s,r){super(t,e,s,r),this.attrs=ae(t)}}class le extends ie{#it;get element(){return this.#it}attrs;constructor(t,e,s){super(e,s),this.#it=t,this.attrs=ae(t)}}class he extends ce{}class de extends le{}class ue extends ie{element;name(t){this.once((()=>this.element.setAttribute("view",t)))}constructor(t,e,s){super(e,s),this.element=t}}class pe extends oe{name(t){this.once((()=>this.element.setAttribute("view",t)))}}class fe{#Y;constructor(t){this.#Y=t}get context(){if(this.#Y)return this.#Y;throw new Error("nexus.context was not set, but it's necessary")}set context(t){this.#Y=t}}function ge(t,e){const s=T.lean(e);return{stop:s.stop,render:(...e)=>s.collect((()=>t(...e)))}}const me=t=>e=>class extends ee{#at=new he(this,this.root,(()=>{this.requestUpdate()}),t.context);#ct=this.#at[re].wrap((()=>e(this.#at)));#lt;render(){return this.updateComplete.then((()=>this.#at[re].afterRender())),this.#lt?.render()}connectedCallback(){super.connectedCallback(),this.#at[re].reconnect(),this.#lt=ge(this.#ct,(()=>{this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.#at[re].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}},ve=2;
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2020 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/class we{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
28
|
+
/**
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright 2017 Google LLC
|
|
31
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
+
*/const be=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),be(t,e);return!0},ye=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},_e=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),Ae(e)}};function $e(t){void 0!==this._$AN?(ye(this),this._$AM=t,_e(this)):this._$AM=t}function xe(t,e=!1,s=0){const r=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(r))for(let t=s;t<r.length;t++)be(r[t],!1),ye(r[t]);else null!=r&&(be(r,!1),ye(r));else be(this,t)}const Ae=t=>{t.type==ve&&(t._$AP??=xe,t._$AQ??=$e)};class ke extends we{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),_e(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(be(this,t),ye(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}function Se(){const t=new Set;function e(e){return t.add(e),()=>{t.delete(e)}}return e.publish=e=>{for(const s of t)s(e)},e.clear=()=>t.clear(),e.once=e=>{const s=r=>{e(r),t.delete(s)};return t.add(s),()=>{t.delete(s)}},e}class Ce extends HTMLElement{static tag="slate-view";onConnected=Se();onDisconnected=Se();connectedCallback(){this.onConnected.publish()}disconnectedCallback(){this.onDisconnected.publish()}}function Ee(...t){const e=new Set,s=t.map((t=>t??"")).flatMap(Pe);for(const t of s)e.add(t);return e}function Pe(t){return t.split(/\s+/).map((t=>t.trim())).filter((t=>!!t))}function Me(t){return t.split(",").map((t=>t.trim())).filter((t=>!!t)).map((t=>t.includes(":")?t.split(":").map((t=>t.trim()))[1]:t))}function ze(t,e){const s=Ee(t.getAttribute("part")),r=Ee(t.getAttribute("data-gpart")),n=function(t,e){return Object.fromEntries(Object.entries(e).map((([e,s])=>[e,Array.from(t.querySelectorAll(`[${s}]`)).map((t=>t.getAttribute(s)))])))}(e,{part:"part",gpart:"data-gpart",exportparts:"exportparts",gexportparts:"gexportparts"}),i=new Set([...n.part.flatMap(Pe),...n.exportparts.flatMap(Me)]),o=new Set([...n.gpart.flatMap(Pe),...n.gexportparts.flatMap(Pe)]);i.size&&t.setAttribute("exportparts",[...s].flatMap(function(t,e){return s=>[...t].flatMap((t=>[`${t}:${s}-${t}`,...e.has(t)?[t]:[]]))}(i,o)).join(", ")),(o.size||t.hasAttribute("data-gpart"))&&t.setAttribute("gexportparts",[...o,...[...r].flatMap((t=>[...i].map((e=>`${t}-${e}`))))].join(" "))}function Oe(t,e={},s={}){const{content:r,attrs:n={}}=e,{attrs:i={}}=s;function o(e,s,r,n){e!==s&&(void 0===e?t.removeAttribute(r):t.setAttribute(r,n()))}n&&function(t,e){for(const[s,r]of Object.entries(e))"string"==typeof r?t.setAttribute(s,r):"number"==typeof r?t.setAttribute(s,r.toString()):"boolean"==typeof r?!0===r?t.setAttribute(s,""):t.removeAttribute(s):void 0===r?t.removeAttribute(s):console.warn(`invalid attribute type ${s} is ${typeof r}`)}(t,n),o(n.class,i?.class,"class",(()=>n.class)),o(n.part,i?.part,"part",(()=>n.part)),o(n.gpart,i?.gpart,"data-gpart",(()=>n.gpart)),r&&Qt(r,t,{host:t})}const Ue=t=>e=>(t=>(e,s={})=>({_$litDirective$:t,values:[{meta:s,props:e}]}))(class extends ke{#D;#ht=!0;#F=function({afterRender:t,onConnected:e,onDisconnected:s}){const r=document.createElement(Ce.tag);r.onConnected(e),r.onDisconnected(s);const n=r.attachShadow({mode:"open"});let i=!1;return{container:r,shadow:n,set auto_exportparts(t){i=t},render_into_shadow:e=>(Qt(e,n),i&&ze(r,n),t(),r)}}({afterRender:()=>this.#at[re].afterRender(),onDisconnected:()=>this.disconnected(),onConnected:()=>{this.#ht||this.reconnected(),this.#ht=!1}});#J=d(0,(()=>{this.#D&&this.isConnected&&this.setValue(this.#F.render_into_shadow(this.render(this.#D)))}));#at=new pe(this.#F.container,this.#F.shadow,this.#J,t.context);#ct=this.#at[re].wrap(e(this.#at));#lt=ge(this.#ct,this.#J);update(t,e){return this.#F.render_into_shadow(this.render(...e))}render(t){return Oe(this.#F.container,t.meta,this.#D?.meta),this.#D=t,this.#F.auto_exportparts=t.meta.auto_exportparts??!0,this.#lt?.render(...t.props)}reconnected(){this.#at[re].reconnect(),this.#lt=ge(this.#ct,this.#J)}disconnected(){this.#at[re].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}}),Te=t=>e=>class extends se{#at=new de(this,(()=>{this.requestUpdate()}),t.context);#ct=this.#at[re].wrap((()=>e(this.#at)));#lt;render(){return this.updateComplete.then((()=>this.#at[re].afterRender())),this.#lt?.render()}connectedCallback(){super.connectedCallback(),this.#lt=ge(this.#ct,(()=>{this.requestUpdate()})),this.#at[re].reconnect()}disconnectedCallback(){super.disconnectedCallback(),this.#lt&&(this.#lt.stop(),this.#lt=void 0),this.#at[re].disconnect()}},je=t=>e=>(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends ke{#dt;#it=document.createElement(Ce.tag);#ut(t){return Qt(t,this.#it),this.#at[re].afterRender(),this.#it}#J=d(0,(()=>{this.#dt&&this.isConnected&&this.setValue(this.#ut(this.render(...this.#dt)))}));#at=new ue(this.#it,this.#J,t.context);#ct=this.#at[re].wrap(e(this.#at));#lt=ge(this.#ct,this.#J);update(t,e){return this.#ut(this.render(...e))}render(...t){return this.#dt=t,this.#lt?.render(...t)}reconnected(){this.#at[re].reconnect(),this.#lt=ge(this.#ct,this.#J)}disconnected(){this.#at[re].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}});Q`
|
|
33
|
+
@layer reset {
|
|
34
|
+
* {
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
|
|
39
|
+
scrollbar-width: thin;
|
|
40
|
+
scrollbar-color: #888 transparent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
::-webkit-scrollbar { width: 8px; }
|
|
44
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
45
|
+
::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
|
|
46
|
+
::-webkit-scrollbar-thumb:hover { background: #444; }
|
|
47
|
+
}
|
|
48
|
+
`;const qe=(t,...e)=>zt(t,...e.map(C.unwrap));const De=Q`
|
|
49
|
+
:host {
|
|
50
|
+
display: contents;
|
|
51
|
+
}
|
|
52
|
+
`;"undefined"!=typeof process&&process.versions&&process.versions.node||"undefined"!=typeof Deno&&void 0!==Deno.version||L({SlateView:Ce},{soft:!0});const Ne=new class extends fe{lightComponent;shadowComponent;lightView;shadowView;shadowComponentify;constructor(t){super(t),this.lightComponent=Te(this),this.shadowComponent=me(this),this.lightView=je(this),this.shadowView=Ue(this),this.shadowComponentify=(t=>e=>t.shadowComponent((t=>(t.styles(De),e([])))))(this)}component=t=>q.setup(this.context.theme)(t);components=t=>H.setup(this.context.theme)(t)}(new class{theme=[]}),Re=Ne;Ne.lightView,Ne.lightComponent;const He=Ne.shadowView,Fe=Ne.shadowComponent;function Le(t,e){const s=setInterval(e,t);return()=>clearInterval(s)}Ne.component,Ne.components,Ne.shadowComponentify,Le.hz=(t,e)=>Le(1e3/t,e);const Be=Q`
|
|
53
|
+
:host {
|
|
54
|
+
color: red;
|
|
55
|
+
font-family: monospace;
|
|
56
|
+
}
|
|
57
|
+
`;Re.shadowView((t=>e=>(t.name("error-indicator"),t.styles(Be),qe`${e||"unknown error"}`)));const Ie=Q`
|
|
58
|
+
:host {
|
|
59
|
+
font-family: monospace;
|
|
60
|
+
}
|
|
61
|
+
`;Re.shadowView((t=>(e,s)=>{t.name("loading-indicator"),t.styles(Ie);const r=t.signal(0);return t.mount((()=>Le.hz(e,(()=>{const t=r.value+1;r.value=t<s.length?t:0})))),qe`${s[r.value]}`}));class Ve{#pt;constructor(t){this.#pt=t}#c=M.state({grabbed:void 0,hovering:void 0});dragzone={draggable:()=>"true",dragstart:t=>e=>{this.#c.grabbed=t},dragend:()=>t=>{this.#c.grabbed=void 0,this.#c.hovering=void 0}};dropzone={dragenter:()=>t=>{},dragleave:()=>t=>{(function(t){if(!t.relatedTarget||0===t.clientX&&0===t.clientY)return!0;const e=t.currentTarget.getBoundingClientRect(),s=t.clientX>=e.left&&t.clientX<=e.right,r=t.clientY>=e.top&&t.clientY<=e.bottom;return!(s&&r)})(t)&&(this.#c.hovering=void 0)},dragover:t=>e=>{const{out_of_band:s}=this.#pt;e.preventDefault(),(this.#c.grabbed||s&&s.predicate(e,t))&&(this.#c.hovering=t)},drop:t=>e=>{const{handle_drop:s,out_of_band:r}=this.#pt;e.preventDefault();const{grabbed:n}=this.#c;this.#c.grabbed=void 0,this.#c.hovering=void 0,n?s(e,n,t):r&&r.predicate(e,t)&&r.handle_drop(e,t)}};get grabbed(){return this.#c.grabbed}get hovering(){return this.#c.hovering}}const Ke=[..."aeiou"],We=[..."bcdfghjklmnprstvwxyz"],Qe=new Set(["fuc","sex","cum","dic","coc","pen","vag","pus","gay","fap","jiz","fag","cun","nig","jew","goy","sem","bal","fat","god","big","dog","cow","pet","vax","sis","rot","zog","ana","uti","cat","bag","cuc","fuk","fak","wet","cux","bug","gey","pig","rat","bat","dik","bed","boy","man","fem","men","nob","rub","fut","jap","tit","gun","job","nip","but","rim","guy","suc","dad","mom","buk","jis","peg","kox","ded","mum","son","nog","hun","wop","cuk"]);function Ge(t,e){const s=e.length-t;if(s<=0)return e;const r=e.length/s,n=[];let i=r;for(let t=0;t<e.length;t++)t>=Math.round(i)?i+=r:n.push(e[t]);return n.slice(0,t)}function Ze(t){return[...new Set(t)]}const Xe=Ze(Ge(256,We.map((t=>Ke.map((e=>We.map((s=>t+e+s)))))).flat(2).filter((t=>!Qe.has(t))))),Ye=Ze(Ge(256,Ke.map((t=>We.map((e=>Ke.map((s=>t+e+s)))))).flat(2).filter((t=>!Qe.has(t))))),Je=Ze([...Ge(192,Xe),...Ge(64,Ye)]);if(256!==Xe.length)throw new Error("xox not 256");if(256!==Ye.length)throw new Error("oxo not 256");if(256!==Je.length)throw new Error("syllables not 256");var ts;new Set([..."अआइईउऊऋएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषसह",..."அஆஇஈஉஊஎஏஐஒஓகஙசஜஞடணதநபமயரலவழளறன",..."অআইঈউঊএঐওকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ",..."ਅਆਇਈਉਊਏਐਓਕਖਗਘਙਚਛਜਝਞਟਠਡਢਣਤਥਦਧਨਪਫਬਭਮਯਰਲਵਸਹ",..."അആഇഈഉഊഎഏഐഒഓകഖഗഘങചഛജഝഞടഠഡഢണതഥദധനപഫബഭമയരലവശസഹളഴറ",..."અઆઇઈઉઊએઐઓકખગઘઙચછજઝઞટઠડઢણતથદધનપફબભમયરલવશષસહ",..."ଅଆଇଈଉଊଏଐଓଔକଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନପଫବଭମଯରଲଶଷସହ"]),function(t){t.actualize=function t(e,s){return $(s).map((s=>"function"==typeof s?(...t)=>{e.transmute((e=>(s(e,(t=>{e=t}))(...t),e)))}:t(e,s)))},t.fn=function(){return t=>t},t.blueprint=function(){return t=>t},t.prepFn=t=>e=>(s,r)=>(...n)=>(e(t(s,r))(...n),s),t.prepBlueprint=e=>s=>s(t.prepFn(e)),t.prep=function(e){return{action:t.prepFn(e),blueprint:t.prepBlueprint(e)}}}(ts||(ts={}));
|
|
62
|
+
/**
|
|
63
|
+
* @license
|
|
64
|
+
* Copyright 2017 Google LLC
|
|
65
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
66
|
+
*/
|
|
67
|
+
class es extends we{constructor(t){if(super(t),this.it=Ut,t.type!==ve)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Ut||null==t)return this._t=void 0,this.it=t;if(t===Ot)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}es.directiveName="unsafeHTML",es.resultType=1;const ss=Object.freeze({eq(t,e){if(t.length!==e.length)return!1;for(let s=0;s<=t.length;s++)if(t.at(s)!==e.at(s))return!1;return!0},random:t=>crypto.getRandomValues(new Uint8Array(t))}),rs=Object.freeze({fromBytes:t=>[...t].map((t=>t.toString(16).padStart(2,"0"))).join(""),toBytes(t){if(t.length%2!=0)throw new Error("must have even number of hex characters");const e=new Uint8Array(t.length/2);for(let s=0;s<t.length;s+=2)e[s/2]=parseInt(t.slice(s,s+2),16);return e},random(t=32){return this.fromBytes(ss.random(t))},string:t=>rs.fromBytes(t),bytes:t=>rs.toBytes(t)});class ns extends Map{static require(t,e){const s=t.get(e);if(void 0===s)throw new Error(`required key not found: "${e}"`);return s}static guarantee(t,e,s){let r=t.get(e);return void 0===r&&(r=s(),t.set(e,r)),r}array(){return[...this]}require(t){return ns.require(this,t)}guarantee(t,e){return ns.guarantee(this,t,e)}}function is(){const t=new Set;function e(e){return t.add(e),()=>{t.delete(e)}}async function s(...e){await Promise.all([...t].map((t=>t(...e))))}async function r(){const{promise:t,resolve:s}=function(){let t,e;const s=new Promise(((s,r)=>{t=s,e=r}));return{promise:s,resolve:t,reject:e,entangle:function(r){return r.then(t).catch(e),s}}}(),r=e(((...t)=>{s(t),r()}));return t}function n(){t.clear()}return e.pub=s,e.sub=e,e.on=e,e.once=r,e.clear=n,s.pub=s,s.sub=e,s.on=e,s.once=r,s.clear=n,[s,e]}function os(t){return is()[1]}const as=new class{#ft=new ns;setGroup(t,e){return this.#ft.set(t,e),e}getGroup(t){return this.#ft.require(t)}};var cs=Q`@layer theme, view; @layer theme {
|
|
68
|
+
|
|
69
|
+
* {
|
|
70
|
+
margin: 0;
|
|
71
|
+
padding: 0;
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}`;function ls(t){const e=function(t){for(let e=t;e;e=e.parentElement){const t=e.getAttribute("group");if(t)return t}return"default"}(t);return as.getGroup(e)}const hs=Fe((t=>{const e=ls(t.element);t.styles(cs,Q`
|
|
76
|
+
sl-button sl-icon {
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
sl-menu {
|
|
81
|
+
margin-top: 0.3em;
|
|
82
|
+
|
|
83
|
+
.item {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
gap: 0.5em;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`);return qe`
|
|
90
|
+
<div class="panel">
|
|
91
|
+
<sl-dropdown>
|
|
92
|
+
<sl-button size="small" slot="trigger" caret>
|
|
93
|
+
<sl-icon name="sort-down-alt"></sl-icon>
|
|
94
|
+
</sl-button>
|
|
95
|
+
<sl-menu @sl-select=${t=>{const s=t.detail.item.value;e.selectedSort.value=s}}>
|
|
96
|
+
${[...e.config.sorts?.keys()].map((t=>qe`
|
|
97
|
+
<sl-menu-item value=${t}>
|
|
98
|
+
<div class=item>
|
|
99
|
+
<sl-icon name="check" slot="prefix" style="visibility: ${t===e.selectedSort.value?"visible":"hidden"}"></sl-icon>
|
|
100
|
+
<span>${t}</span>
|
|
101
|
+
</div>
|
|
102
|
+
</sl-menu-item>
|
|
103
|
+
`))}
|
|
104
|
+
</sl-menu>
|
|
105
|
+
</sl-dropdown>
|
|
106
|
+
</div>`})),ds=Fe((t=>{const e=ls(t.element);t.styles(cs,Q`
|
|
107
|
+
sl-menu {
|
|
108
|
+
margin-top: 0.3em;
|
|
109
|
+
|
|
110
|
+
.item {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 0.5em;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`);return qe`
|
|
117
|
+
<div class="panel">
|
|
118
|
+
<sl-dropdown>
|
|
119
|
+
<sl-button size="small" slot="trigger" caret>
|
|
120
|
+
<sl-icon name="funnel"></sl-icon>
|
|
121
|
+
</sl-button>
|
|
122
|
+
<sl-menu @sl-select=${t=>{const s=t.detail.item.value;e.selectedFilter.value=s}}>
|
|
123
|
+
${[...e.config.filters?.keys()].map((t=>qe`
|
|
124
|
+
<sl-menu-item value=${t}>
|
|
125
|
+
<div class=item>
|
|
126
|
+
<sl-icon name="check" slot="prefix" style="visibility: ${t===e.selectedFilter.value?"visible":"hidden"}"></sl-icon>
|
|
127
|
+
<span>${t}</span>
|
|
128
|
+
</div>
|
|
129
|
+
</sl-menu-item>
|
|
130
|
+
`))}
|
|
131
|
+
</sl-menu>
|
|
132
|
+
</sl-dropdown>
|
|
133
|
+
</div>`}));var us=Q`
|
|
134
|
+
|
|
135
|
+
.toolbar {
|
|
136
|
+
display: flex;
|
|
137
|
+
justify-content: flex-end;
|
|
138
|
+
padding: 0.5rem;
|
|
139
|
+
|
|
140
|
+
sl-button {
|
|
141
|
+
background: #0F0F11;
|
|
142
|
+
border-radius: 5px;
|
|
143
|
+
|
|
144
|
+
&[data-active=true] {
|
|
145
|
+
background: var(--sl-color-neutral-0);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&::part(base) {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
height: 30px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&::part(label) {
|
|
155
|
+
display: flex;
|
|
156
|
+
width: 40px;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.tiles,
|
|
162
|
+
.details {
|
|
163
|
+
padding: 0.5rem;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.tiles {
|
|
167
|
+
display: flex;
|
|
168
|
+
flex-wrap: wrap;
|
|
169
|
+
row-gap: 1em;
|
|
170
|
+
width: 100%;
|
|
171
|
+
|
|
172
|
+
.item {
|
|
173
|
+
flex: 1;
|
|
174
|
+
max-width: 150px;
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
align-items: center;
|
|
178
|
+
|
|
179
|
+
.media-icon {
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
width: 100px;
|
|
184
|
+
height: 60px;
|
|
185
|
+
border: 2px solid #0D0D0E;
|
|
186
|
+
border-radius: 5px;
|
|
187
|
+
background: #0F0F11;
|
|
188
|
+
pointer-events: none;
|
|
189
|
+
|
|
190
|
+
img {
|
|
191
|
+
width: 100%;
|
|
192
|
+
height: 100%;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.label {
|
|
197
|
+
margin-top: 0.5em;
|
|
198
|
+
max-width: 150px;
|
|
199
|
+
font-size: 0.85rem;
|
|
200
|
+
text-align: center;
|
|
201
|
+
white-space: nowrap;
|
|
202
|
+
overflow: hidden;
|
|
203
|
+
text-overflow: ellipsis;
|
|
204
|
+
color: var(--sl-color-neutral-700);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.details {
|
|
210
|
+
.card {
|
|
211
|
+
display: flex;
|
|
212
|
+
gap: 1rem;
|
|
213
|
+
padding: 0.8rem;
|
|
214
|
+
border: 2px solid #0D0D0E;
|
|
215
|
+
background: #0F0F11;
|
|
216
|
+
border-radius: 6px;
|
|
217
|
+
margin-bottom: 0.5rem;
|
|
218
|
+
align-items: center;
|
|
219
|
+
|
|
220
|
+
.meta {
|
|
221
|
+
.name {
|
|
222
|
+
font-weight: 500;
|
|
223
|
+
color: var(--sl-color-neutral-800);
|
|
224
|
+
}
|
|
225
|
+
.type {
|
|
226
|
+
font-size: 0.75rem;
|
|
227
|
+
color: var(--sl-color-neutral-500);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
sl-icon {
|
|
234
|
+
font-size: 2rem;
|
|
235
|
+
color: var(--sl-color-neutral-300);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
sl-tooltip {
|
|
239
|
+
--sl-tooltip-arrow-size: 0;
|
|
240
|
+
|
|
241
|
+
&::part(body) {
|
|
242
|
+
background: #0D0D0E;
|
|
243
|
+
color: var(--sl-color-neutral-700);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
`;const ps=Fe((t=>{t.styles(cs,us);const e=ls(t.element),{trail:s,config:r}=e,[n,i]=t.state("tiles");t.mount((()=>{const s=e.on.upload.sub((()=>t.rerender()));return()=>s()}));const o=()=>e.sort(s.currentFolder).filter((t=>e.matches(t)));return qe`
|
|
248
|
+
<div class="toolbar">
|
|
249
|
+
<sl-button-group label="View mode">
|
|
250
|
+
<sl-tooltip content="Tiles">
|
|
251
|
+
<sl-button size="small" outline data-active=${"tiles"===n} @click=${()=>i("tiles")}>
|
|
252
|
+
<sl-icon name="grid-3x3-gap"></sl-icon>
|
|
253
|
+
</sl-button>
|
|
254
|
+
</sl-tooltip>
|
|
255
|
+
<sl-tooltip content="Details">
|
|
256
|
+
<sl-button size="small" outline data-active=${"details"===n} @click=${()=>i("details")}>
|
|
257
|
+
<sl-icon name="list"></sl-icon>
|
|
258
|
+
</sl-button>
|
|
259
|
+
</sl-tooltip>
|
|
260
|
+
</sl-button-group>
|
|
261
|
+
</div>
|
|
262
|
+
|
|
263
|
+
${"details"===n?qe`
|
|
264
|
+
<div class="details">
|
|
265
|
+
${o().map((t=>qe`
|
|
266
|
+
<div @click=${e=>s.setTrail(e,t)} class="card">
|
|
267
|
+
${r.renderIcon(t,!1)}
|
|
268
|
+
<div class=meta>
|
|
269
|
+
<div class=name>${r.renderLabel(t)}</div>
|
|
270
|
+
<div class=type>${t.kind}</div>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
`))}
|
|
274
|
+
</div>
|
|
275
|
+
`:qe`
|
|
276
|
+
<div class="tiles">
|
|
277
|
+
${o().map((t=>qe`
|
|
278
|
+
<div class="item" @click="${e=>s.setTrail(e,t)}">
|
|
279
|
+
<div class="media-icon">
|
|
280
|
+
${r.renderPreview(t)??r.renderIcon(t,!1)}
|
|
281
|
+
</div>
|
|
282
|
+
<div class="label" title="${r.renderLabel(t)}">
|
|
283
|
+
${r.renderLabel(t)}
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
`))}
|
|
287
|
+
</div>
|
|
288
|
+
`}
|
|
289
|
+
`}));var fs=Q`
|
|
290
|
+
|
|
291
|
+
.dropzone {
|
|
292
|
+
width: 100%;
|
|
293
|
+
height: 100%;
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: center;
|
|
297
|
+
position: relative;
|
|
298
|
+
border: 2px dashed var(--sl-color-neutral-300);
|
|
299
|
+
border-radius: 6px;
|
|
300
|
+
transition: background 0.2s;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.dz-input {
|
|
304
|
+
width: 100%;
|
|
305
|
+
height: 100%;
|
|
306
|
+
z-index: 999;
|
|
307
|
+
font-size: 14px;
|
|
308
|
+
cursor: pointer;
|
|
309
|
+
opacity: 0;
|
|
310
|
+
|
|
311
|
+
&::file-selector-button {
|
|
312
|
+
display: none;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.dropzone:hover {
|
|
317
|
+
background: var(--sl-color-gray-50);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.dropzone[data-hovering] {
|
|
321
|
+
background: var(--sl-color-gray-50);
|
|
322
|
+
border-color: var(--sl-color-primary-500);
|
|
323
|
+
|
|
324
|
+
& .dz-info {
|
|
325
|
+
color: var(--sl-color-primary-300);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.dz-info {
|
|
330
|
+
position: absolute;
|
|
331
|
+
display: flex;
|
|
332
|
+
flex-direction: column;
|
|
333
|
+
align-items: center;
|
|
334
|
+
justify-content: center;
|
|
335
|
+
gap: 0.5em;
|
|
336
|
+
color: var(--sl-color-neutral-700);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
`;const gs=Fe((t=>{t.styles(cs,fs);const e=ls(t.element),{dropzone:s,config:{root:r}}=e;return qe`
|
|
340
|
+
<div class="dropzone" ?data-hovering=${s.hovering}>
|
|
341
|
+
<input
|
|
342
|
+
type="file"
|
|
343
|
+
class="dz-input"
|
|
344
|
+
@change=${t=>s.change(t,r)}
|
|
345
|
+
@drop=${t=>s.drop(t,r)}
|
|
346
|
+
@dragover=${t=>s.dragover(t,r)}
|
|
347
|
+
@dragenter=${t=>s.dragenter(t,r)}
|
|
348
|
+
@dragleave=${s.dragleave}
|
|
349
|
+
>
|
|
350
|
+
<div class=dz-info>
|
|
351
|
+
<sl-icon name="upload"></sl-icon>
|
|
352
|
+
Drop files here
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
`}));var ms=Q`
|
|
356
|
+
|
|
357
|
+
sl-tree-item::part(expand-button) {
|
|
358
|
+
rotate: none;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
sl-tree-item::part(base) {
|
|
362
|
+
min-height: 30px;
|
|
363
|
+
justify-content: center;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
sl-icon:is(.item) {
|
|
367
|
+
padding: 0.5em;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
sl-tree-item:not([data-type=folder])::part(expand-button) {
|
|
371
|
+
display: none;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.file-import {
|
|
375
|
+
position: absolute;
|
|
376
|
+
opacity: 0;
|
|
377
|
+
left: 0;
|
|
378
|
+
width: 100%;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.folder-hover {
|
|
382
|
+
position: absolute;
|
|
383
|
+
width: 100%;
|
|
384
|
+
height: 100%;
|
|
385
|
+
left: 0;
|
|
386
|
+
bottom: 0;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
sl-tree-item {
|
|
390
|
+
min-height: 30px;
|
|
391
|
+
transition: background 0.2s ease, border-radius 0.2s ease;
|
|
392
|
+
|
|
393
|
+
::part(label) {
|
|
394
|
+
gap: 0.5em;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.folder {
|
|
398
|
+
display: flex;
|
|
399
|
+
justify-content: center;
|
|
400
|
+
align-items: center;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
::part(item--selected) {
|
|
404
|
+
background: rgba(0, 0, 0, 0.4);
|
|
405
|
+
min-height: 30px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
sl-tree-item[data-hover] {
|
|
411
|
+
border-radius: 5px;
|
|
412
|
+
background: rgba(0, 0, 0, 0.4);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
`;const vs=He((t=>e=>{t.styles(cs,ms);const{config:s}=e,{dropzone:r,trail:n,config:{root:i}}=e;t.mount((()=>{const s=e.on.upload.sub((()=>t.rerender()));return()=>s()}));const o=t=>qe`
|
|
416
|
+
<sl-tree-item
|
|
417
|
+
draggable="true"
|
|
418
|
+
@dragstart=${e=>r.dragstart(e,t)}
|
|
419
|
+
@dragend=${r.dragend}
|
|
420
|
+
@click=${e=>n.setTrail(e,t)}
|
|
421
|
+
data-type=${t.kind}
|
|
422
|
+
?data-hover=${r.hovering?.id===t.id}
|
|
423
|
+
>
|
|
424
|
+
${"folder"===t.kind?(t=>qe`
|
|
425
|
+
<input
|
|
426
|
+
@dragenter=${e=>r.dragenter(e,t)}
|
|
427
|
+
@dragleave=${r.dragleave}
|
|
428
|
+
@dragover=${e=>r.dragover(e,t)}
|
|
429
|
+
@drop=${e=>r.drop(e,t)}
|
|
430
|
+
@click=${t=>t.preventDefault()}
|
|
431
|
+
id="file-import"
|
|
432
|
+
class="file-import folder-hover"
|
|
433
|
+
>
|
|
434
|
+
<span class="folder" slot="expand-icon">${s.renderIcon(t,!1)}</span>
|
|
435
|
+
<span class="folder" slot="collapse-icon">${s.renderIcon(t,!0)}</span>
|
|
436
|
+
${s.renderLabel(t)}
|
|
437
|
+
`)(t):(t=>qe`
|
|
438
|
+
${s.renderIcon(t,!1)}
|
|
439
|
+
${s.renderLabel(t)}
|
|
440
|
+
`)(t)}
|
|
441
|
+
${e.sort(t.children).map((t=>e.matches(t)?o(t):null))}
|
|
442
|
+
</sl-tree-item>
|
|
443
|
+
`;return qe`
|
|
444
|
+
<sl-tree selection=leaf>
|
|
445
|
+
${o(i)}
|
|
446
|
+
</sl-tree>`})),ws=Fe((t=>{t.styles(cs);const e=ls(t.element);return qe`
|
|
447
|
+
<div class="panel">
|
|
448
|
+
${vs([e])}
|
|
449
|
+
</div>`})),bs=Q`
|
|
450
|
+
sl-input::part(prefix) {
|
|
451
|
+
padding-left: 0.5em;
|
|
452
|
+
}
|
|
453
|
+
`,ys=Fe((t=>{t.styles(cs,bs);const e=ls(t.element);return qe`
|
|
454
|
+
<sl-input
|
|
455
|
+
size='small'
|
|
456
|
+
pill
|
|
457
|
+
placeholder='Search'
|
|
458
|
+
clearable
|
|
459
|
+
@sl-input=${t=>e.searchText.value=t.target.value}
|
|
460
|
+
>
|
|
461
|
+
<sl-icon name='search' slot='prefix'></sl-icon>
|
|
462
|
+
</sl-input>
|
|
463
|
+
`})),_s=Fe((t=>{t.css(cs);const e=ls(t.element),{trail:s,config:{codex:r,renderLabel:n}}=e;return qe`
|
|
464
|
+
<sl-breadcrumb>
|
|
465
|
+
${s.signal.value.map((t=>qe`
|
|
466
|
+
<sl-breadcrumb-item @click="${(t=>s=>e.trail.setTrail(s,t))(t)}">
|
|
467
|
+
${null===t?"root":n(r.require(t.id))}
|
|
468
|
+
</sl-breadcrumb-item>
|
|
469
|
+
`))}
|
|
470
|
+
</sl-breadcrumb>
|
|
471
|
+
`})),$s={QuayOutliner:ws,QuaySearchbar:ys,QuayDropzone:gs,QuayBrowser:ps,QuayBreadcrumb:_s,QuayFilter:ds,QuaySort:hs};var xs;!function(t){t.rename="rename",t.move="move",t.delete="delete",t.refresh="refresh",t.newFolder="newFolder",t.search="search",t.upload="upload"}(xs||(xs={}));const As=Object.values(xs);function ks(t,e={}){const s={};for(const r of As)s[r]=r in e?e[r]:t;return s}const Ss={permissions:{all:ks(!0),readOnly:ks(!1,{[xs.refresh]:!0,[xs.search]:!0}),none:ks(!1)}};class Cs{group;#gt=new Ve({handle_drop:(t,e,s)=>this.group.move(e,s)});constructor(t){this.group=t}#mt=U(void 0);get grabbed(){return this.#gt.grabbed}get hovering(){return this.#gt.hovering??this.#mt.value}dragenter=(t,e)=>{t.preventDefault(),this.#gt.dropzone.dragenter()(t),this.#mt.value=e};dragleave=t=>{this.#gt.dropzone.dragleave()(t),this.#mt.value=void 0};dragstart=(t,e)=>{t.stopPropagation(),this.#gt.dragzone.dragstart(e)(t)};dragover=(t,e)=>{t.preventDefault(),this.#gt.dropzone.dragover(e)(t)};dragend=t=>{this.#gt.dragzone.dragend()(t),this.#mt.value=void 0};drop=(t,e)=>{t.preventDefault();const s=Array.from(t.dataTransfer?.files||[]);s.length&&this.group.upload(s,e);const r=this.grabbed?.id===this.hovering?.id,n=this.grabbed?.children.some((t=>this.hovering?.id===t.id)),i=this.grabbed?.parent?.id===this.hovering?.id;r||n||i||this.#gt.dropzone.drop(e)(t),this.#mt.value=void 0};change=(t,e)=>{const s=t.currentTarget,r=Array.from(s.files??[]);r.length&&this.group.upload(r,e)}}class Es{signal=U([]);constructor(t){this.signal.value=[t]}setTrail(t,e){if(t.target!==t.currentTarget)return;const s=[];let r="folder"===e.kind?e:e.parent;for(;r;)s.unshift(r),r=r.parent;this.signal.value=s}get currentFolder(){return this.signal.value.at(-1)?.children??[]}}class Ps{config;trail;dropzone=new Cs(this);searchText=U("");selectedFilter=U("");selectedSort=U("");on={newFolder:os(),move:os(),delete:os(),rename:os(),upload:os(),search:os(),refresh:os()};constructor(t){this.config=t,this.selectedFilter.value=t.defaultFilter,this.selectedSort.value=t.defaultSort,this.trail=new Es(t.root)}get permissions(){return this.config.permissions}getFilterFn(t){return this.config.filters.get(t)??(()=>!0)}getSearchFn(t){const e=t.trim().toLowerCase().split(/\s+/);return t=>this.config.search(e,t)}getSortFn(t){return this.config.sorts?.get(t)??(()=>0)}sort(t){const e=this.getSortFn(this.selectedSort.value);return[...t].sort(e)}matches(t){const e=this.getFilterFn(this.selectedFilter.value),s=this.getSearchFn(this.searchText.value);return e(t)&&s(t)}move(t,e){if(!this.permissions(t).move)throw new Error("move permission not granted");t.detach(),e.attach(t),this.on.move.pub({item:t,target:e})}delete(t){if(!this.permissions(t).delete)throw new Error("delete permission not granted");t.destroy(),this.on.delete.pub({item:t})}rename(t,e){if(!this.permissions(t).rename)throw new Error("rename permission not granted");this.on.rename.pub({item:t,newName:e})}upload(t,e){if(!this.permissions(e).upload)throw new Error("upload permission not granted");this.on.upload.pub({files:t,target:e})}addFolder(t){if(!this.permissions(t).newFolder)throw new Error("add folder permission not granted");this.on.newFolder.pub({parent:t})}components=()=>this.components}class Ms{taxonomy;onChange=os();#vt=new ns;constructor(t){this.taxonomy=t}getSpecimen(t){return this.#vt.require(t)}setSpecimen(t,e,s){this.#vt.set(t,[e,s]),this.onChange.pub()}query(t){const[e,s]=this.getSpecimen(t);return{kind:e,taxon:this.taxonomy.taxon(e),specimen:s}}}class zs{#wt=new ns;constructor(t){for(const[e,s]of Object.entries(t))this.#wt.set(e,s)}taxon(t){return this.#wt.require(t)}}class Os{#bt=new ns;#yt=new ns;has(t){return this.#bt.has(t)}getChildren(t){return this.#bt.require(t)}getParent(t){return this.#yt.get(t)}establishRoot(t){this.#bt.set(t,new Set)}attach(t,...e){const s=this.getChildren(t);for(const r of e){if(this.getParent(r))throw new Error("child already has parent");s.add(r),this.#yt.set(r,t),this.#bt.set(r,new Set)}}detach(t){if(!this.has(t))return;const e=this.getParent(t);if(e){this.getChildren(e).delete(t),this.#yt.delete(t)}}destroy(t){const e=[...this.crawl(t)];for(const[t]of e)this.#bt.delete(t),this.#yt.delete(t)}*crawl(t,e=()=>!0){const s=[[t,[]]],r=new Set;for(;s.length;){const[t,n]=s.shift();if(!r.has(t)&&e(t,n)){r.add(t),yield[t,n];for(const e of this.getChildren(t))s.push([e,[...n,t]])}}}}class Us{codex;id;signal=U(this);constructor(t,e){this.codex=t,this.id=e}get kind(){return this.codex.clade.query(this.id).kind}isKind(t){return t===this.kind}get taxon(){return this.codex.clade.query(this.id).taxon}get specimen(){return this.codex.clade.query(this.id).specimen}get parent(){const t=this.codex.hierarchy.getParent(this.id);return t?this.codex.require(t):void 0}get children(){return[...this.codex.hierarchy.getChildren(this.id)].map((t=>this.codex.require(t)))}attach(...t){return this.codex.hierarchy.attach(this.id,...t.map((t=>t.id))),this.signal.publish(),this}detach(){this.codex.hierarchy.detach(this.id),this.signal.publish()}create(t,e){const s=this.codex.create(t,e);return this.attach(s),s}destroy(){this.codex.hierarchy.destroy(this.id),this.signal.publish()}*crawl(t=()=>!0){const e=this.codex.hierarchy.crawl(this.id,((e,s)=>t(this.codex.require(e),s.map((t=>this.codex.require(t))))));for(const[t,s]of e)yield[this.codex.require(t),s.map((t=>this.codex.require(t)))]}}class Ts{clade;hierarchy;static setup(t){const e=new zs(t);return new this(new Ms(e),new Os)}#_t=new ns;constructor(t,e){this.clade=t,this.hierarchy=e}create(t,e){const s=rs.random();this.clade.setSpecimen(s,t,e);const r=new Us(this,s);return this.#_t.set(s,r),r.signal.value}root(t){return this.hierarchy.establishRoot(t.id),t.signal.value}require(t){return this.#_t.require(t).signal.value}}class js extends Ps{static config=()=>{const t=(new ns).set("audio",qe`<sl-icon name=music-note-beamed></sl-icon>`).set("video",qe`<sl-icon name=film></sl-icon>`).set("image",qe`<sl-icon name=image></sl-icon>`).set("other",qe`<sl-icon name=file-earmark></sl-icon>`),e=(new Map).set("all",(()=>!0)).set("video",(t=>t.isKind("folder")||t.isKind("file")&&"video"===t.specimen.format)).set("audio",(t=>t.isKind("folder")||t.isKind("file")&&"audio"===t.specimen.format)),s=(new Map).set("label",((t,e)=>t.specimen.label.localeCompare(e.specimen.label))).set("format",((t,e)=>t.isKind("file")&&e.isKind("file")?t.specimen.format.localeCompare(e.specimen.format):t.isKind("file")?-1:e.isKind("file")?1:0)),r=(t,e)=>{const s=t.join(" ").trim().toLowerCase();return""===s||("folder"===e.kind?e.children.some((e=>r(t,e))):e.specimen.label.toLowerCase().includes(s))},n=Ts.setup({folder:{icon:qe`<sl-icon name="folder"></sl-icon>`},file:{icon:qe`<sl-icon name="file"></sl-icon>`}}),i=n.root(n.create("folder",{label:"project"})),o=(e,s)=>e.isKind("file")?t.require(e.specimen.format):s?qe`<sl-icon name="folder2-open"></sl-icon>`:e.taxon.icon;return{codex:n,root:i,sorts:s,filters:e,defaultFilter:"all",defaultSort:"label",search:(t,e)=>t.some((t=>e.kind.includes(t)||e.id.includes(t)||e.specimen.label.includes(t)))||r(t,e),renderIcon:o,renderLabel:t=>t.specimen.label,renderPreview:t=>t.isKind("file")&&t.specimen.previewUrl?qe`<img src=${t.specimen.previewUrl}>`:o(t,!1),permissions:t=>Ss.permissions.all}};constructor(){super(js.config())}}const qs=as.setGroup("default",new js),{codex:Ds,root:Ns}=qs.config,Rs="/assets/preview.webp",Hs=Ds.create("file",{format:"video",label:"01‑introduction.mp4",previewUrl:Rs}),Fs=Ds.create("file",{format:"image",label:"cover.png",previewUrl:Rs}),Ls=Ds.create("file",{format:"audio",label:"click.wav",previewUrl:null}),Bs=Ds.create("folder",{label:"sprites"}),Is=Ds.create("file",{format:"image",label:"hero.png",previewUrl:Rs}),Vs=Ds.create("file",{format:"image",label:"enemy.png",previewUrl:Rs});Ds.root(Ns).attach(Hs).attach(Fs).attach(Ls).attach(Bs),Bs.attach(Is).attach(Vs),qs.on.upload.sub((({files:t,target:e})=>{for(const s of t){const t=s.type.split("/")[0],r=Ds.create("file",{label:s.name,format:t,previewUrl:Rs});e.attach(r)}})),document.documentElement.className="sl-theme-dark",F($s);
|