@benev/slate
Version:
frontend web stuff
96 lines (91 loc) • 43.4 kB
JavaScript
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),n=new WeakMap;let r=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(s,t))}return t}toString(){return this.cssText}};const i=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>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[n+1]),t[0]);return new r(n,t,s)},o=(s,n)=>{if(e)s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of n){const n=document.createElement("style"),r=t.litNonce;void 0!==r&&n.setAttribute("nonce",r),n.textContent=e.cssText,s.appendChild(n)}},a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,s))(e)})(t):t
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,{is:c,defineProperty:l,getOwnPropertyDescriptor:h,getOwnPropertyNames:u,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,f=globalThis,g=f.trustedTypes,m=g?g.emptyScript:"",_=f.reactiveElementPolyfillSupport,w=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?m: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}},$=(t,e)=>!c(t,e),b={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:$};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let v=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=b){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(),n=this.getPropertyDescriptor(t,s,e);void 0!==n&&l(this.prototype,t,n)}}static getPropertyDescriptor(t,e,s){const{get:n,set:r}=h(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const i=n?.call(this);r?.call(this,e),this.requestUpdate(t,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(w("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(w("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(w("properties"))){const t=this.properties,e=[...u(t),...d(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(a(t))}else void 0!==t&&e.push(a(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 o(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),n=this.constructor._$Eu(t,s);if(void 0!==n&&!0===s.reflect){const r=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){const s=this.constructor,n=s._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=s.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=n,this[n]=r.fromAttribute(e,t.type)??this._$Ej?.get(n)??null,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const n=this.constructor,r=this[t];if(s??=n.getPropertyOptions(t),!((s.hasChanged??$)(r,e)||s.useDefault&&s.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:n,wrapped:r},i){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==r||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===n&&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,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,s,n)}}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){}};v.elementStyles=[],v.shadowRootOptions={mode:"open"},v[w("elementProperties")]=new Map,v[w("finalized")]=new Map,_?.({ReactiveElement:v}),(f.reactiveElementVersions??=[]).push("2.1.0");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const A=globalThis,S=A.trustedTypes,C=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,k="$lit$",x=`lit$${Math.random().toFixed(9).slice(2)}$`,E="?"+x,M=`<${E}>`,P=document,O=()=>P.createComment(""),U=t=>null===t||"object"!=typeof t&&"function"!=typeof t,R=Array.isArray,T="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,H=/-->/g,j=/>/g,z=RegExp(`>|${T}(?:([^\\s"'>=/]+)(${T}*=${T}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,q=/"/g,V=/^(?:script|style|textarea|title)$/i,L=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),B=Symbol.for("lit-noChange"),I=Symbol.for("lit-nothing"),W=new WeakMap,Z=P.createTreeWalker(P,129);function J(t,e){if(!R(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==C?C.createHTML(e):e}const K=(t,e)=>{const s=t.length-1,n=[];let r,i=2===e?"<svg>":3===e?"<math>":"",o=N;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===N?"!--"===c[1]?o=H:void 0!==c[1]?o=j:void 0!==c[2]?(V.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=z):void 0!==c[3]&&(o=z):o===z?">"===c[0]?(o=r??N,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?z:'"'===c[3]?q:D):o===q||o===D?o=z:o===H||o===j?o=N:(o=z,r=void 0);const u=o===z&&t[e+1].startsWith("/>")?" ":"";i+=o===N?s+M:l>=0?(n.push(a),s.slice(0,l)+k+s.slice(l)+x+u):s+x+(-2===l?e:u)}return[J(t,i+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class F{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let r=0,i=0;const o=t.length-1,a=this.parts,[c,l]=K(t,e);if(this.el=F.createElement(c,s),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=Z.nextNode())&&a.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(k)){const e=l[i++],s=n.getAttribute(t).split(x),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:r,name:o[2],strings:s,ctor:"."===o[1]?tt:"?"===o[1]?et:"@"===o[1]?st:Y}),n.removeAttribute(t)}else t.startsWith(x)&&(a.push({type:6,index:r}),n.removeAttribute(t));if(V.test(n.tagName)){const t=n.textContent.split(x),e=t.length-1;if(e>0){n.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)n.append(t[s],O()),Z.nextNode(),a.push({type:2,index:++r});n.append(t[e],O())}}}else if(8===n.nodeType)if(n.data===E)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=n.data.indexOf(x,t+1));)a.push({type:7,index:r}),t+=x.length-1}r++}}static createElement(t,e){const s=P.createElement("template");return s.innerHTML=t,s}}function G(t,e,s=t,n){if(e===B)return e;let r=void 0!==n?s._$Co?.[n]:s._$Cl;const i=U(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(t),r._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=r:s._$Cl=r),void 0!==r&&(e=G(t,r._$AS(t,e.values),r,n)),e}class Q{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,n=(t?.creationScope??P).importNode(e,!0);Z.currentNode=n;let r=Z.nextNode(),i=0,o=0,a=s[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new X(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new nt(r,this,t)),this._$AV.push(e),a=s[++o]}i!==a?.index&&(r=Z.nextNode(),i++)}return Z.currentNode=P,n}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 X{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=I,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.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=G(this,t,e),U(t)?t===I||null==t||""===t?(this._$AH!==I&&this._$AR(),this._$AH=I):t!==this._$AH&&t!==B&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>R(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!==I&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=F.createElement(J(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new Q(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new F(t)),e}k(t){R(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const r of t)n===e.length?e.push(s=new X(this.O(O()),this.O(O()),this,this.options)):s=e[n],s._$AI(r),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$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 Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,r){this.type=1,this._$AH=I,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=I}_$AI(t,e=this,s,n){const r=this.strings;let i=!1;if(void 0===r)t=G(this,t,e,0),i=!U(t)||t!==this._$AH&&t!==B,i&&(this._$AH=t);else{const n=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=G(this,n[s+o],e,o),a===B&&(a=this._$AH[o]),i||=!U(a)||a!==this._$AH[o],a===I?t=I:t!==I&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}i&&!n&&this.j(t)}j(t){t===I?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends Y{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===I?void 0:t}}class et extends Y{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==I)}}class st extends Y{constructor(t,e,s,n,r){super(t,e,s,n,r),this.type=5}_$AI(t,e=this){if((t=G(this,t,e,0)??I)===B)return;const s=this._$AH,n=t===I&&s!==I||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==I&&(s===I||n);n&&this.element.removeEventListener(this.name,this,s),r&&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 nt{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){G(this,t)}}const rt=A.litHtmlPolyfillSupport;rt?.(F,X),(A.litHtmlVersions??=[]).push("3.3.0");const it=(t,e,s)=>{const n=s?.renderBefore??e;let r=n._$litPart$;if(void 0===r){const t=s?.renderBefore??null;n._$litPart$=r=new X(e.insertBefore(O(),t),t,void 0,s??{})}return r._$AI(t),r
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/},ot=globalThis;let at=class extends v{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=it(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};at._$litElement$=!0,at.finalized=!0,ot.litElementHydrateSupport?.({LitElement:at});const ct=ot.litElementPolyfillSupport;ct?.({LitElement:at}),(ot.litElementVersions??=[]).push("4.2.0");class lt{#t=!1;lock(t){this.#t=!0;const e=t();return this.#t=!1,e}get locked(){return this.#t}}const ht=()=>new Map,ut=()=>new Set;function dt(t){return{guarantee:(e,s)=>function(t,e,s){if(t.has(e))return t.get(e);{const n=s();return t.set(e,n),n}}(t,e,s)}}class pt{#e=new WeakMap;grab_keymap(t){const e=dt(this.#e).guarantee(t,ht);return{keymap:e,grab_symbolmap:t=>dt(e).guarantee(t,ht)}}clear(){this.#e=new WeakMap}}class ft{#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 gt{#n=[];record(t){const e=ht();this.#n.push(e);const s=t();return this.#n.pop(),{payload:s,recording:e}}record_that_key_was_accessed(t,e){const s=this.#n.at(-1);if(s){dt(s).guarantee(t,ut).add(e)}}}class mt extends Error{name=this.constructor.name}class _t extends mt{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}}class wt extends mt{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}}function yt(t){return new Proxy(t,{get:(t,e)=>t[e],set(t,e){throw new wt(e)}})}function $t(t,e){let s,n,r=[];function i(){s=[],n&&clearTimeout(n),n=void 0,r=[]}return i(),(...o)=>{s=o,n&&clearTimeout(n);const a=new Promise(((t,e)=>{r.push({resolve:t,reject:e})}));return n=setTimeout((()=>{Promise.resolve().then((()=>e(...s))).then((t=>{for(const{resolve:e}of r)e(t);i()})).catch((t=>{for(const{reject:e}of r)e(t);i()}))}),t),a}}class bt{#r=new Map;#i=Promise.resolve();#o=$t(0,(()=>{const t=[...this.#r.values()];this.#r.clear();for(const e of t)e()}));get wait(){return this.#i}add(t,e){this.#r.set(t,e),this.#i=this.#o()}}function vt(t){return function(e){return()=>{const s="function"==typeof t?t():t;return e(s)}}}function At(t,e,s,n){const r=[];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,n),r.push((()=>i.delete(t)))}}return()=>r.forEach((t=>t()))}class St{#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),n=t(s);return this.#a.setter(e,n)}))}slice({getter:t,setter:e}){return new St({parent:this,getter:t,setter:e})}}const Ct=t=>"object"==typeof t&&null!==t;const kt={clone:function t(e,s=new Set){if(s.has(e))throw new Error("cannot clone circular reference");let n;return"function"==typeof e||null!==e&&"object"==typeof e?(s.add(e),n=Array.isArray(e)?e.map((e=>t(e,new Set(s)))):e.constructor===Object?Object.fromEntries(Object.entries(e).map((([e,n])=>[e,t(n,new Set(s))]))):e instanceof Map?new Map(Array.from(e,(([e,n])=>[e,t(n,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)):n=e,n},equal:(t,e)=>function t(e,s,n){if(!Ct(e)||!Ct(s))return e===s;if(n.includes(e))throw new Error("forbidden circularity detected in deep equal comparison");const r=[...n,e];if(e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(const[n,i]of e)if(!s.has(n)||!t(i,s.get(n),r))return!1}else if(e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(const n of e)if(!Array.from(s).some((e=>t(n,e,r))))return!1}else{const n=Object.keys(e),i=Object.keys(s);if(n.length!==i.length)return!1;for(const o of n){if(!i.includes(o))return!1;if(!t(e[o],s[o],r))return!1}}return!0}(t,e,[]),freeze:function(t){return function t(e,s){if(!Ct(e)||s.includes(e))return e;const n=[...s,e];if(e instanceof Map)for(const s of e.entries())for(const e of s)t(e,n);else if(e instanceof Set)for(const s of e)t(s,n);else if(Array.isArray(e))for(const s of e)t(s,n);else for(const s of Object.values(e))t(s,n);return Object.freeze(e)}(t,[])}};class xt{#c;#l;#h;#u=!1;#d(){return kt.freeze(structuredClone(this.#c))}constructor(t,e=()=>{}){this.#c=structuredClone(t),this.#l=this.#d(),this.#h=e}get state(){return this.#l}transmute(t){if(this.#u)throw new Error("circular error");this.#u=!0,this.#c=t(structuredClone(this.#c)),this.#l=this.#d(),this.#h(),this.#u=!1}slice({getter:t,setter:e}){return new St({parent:this,getter:t,setter:e})}}const Et=Error;var Mt;function Pt(t){return{map:e=>Ot(t,e),filter:e=>Ut(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 Et("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 n=await s();return e(t.ready(n)),n}catch(s){const n=s instanceof Et?s.message:"string"==typeof s?s:"error";throw e(t.error(n)),s}},t.morph=function(e,n){return s(e,{loading:()=>t.loading(),error:e=>t.error(e),ready:e=>t.ready(n(e))})},t.all=function(...s){const n=s.find(t.is.error);return n||(s.every(t.is.ready)?t.ready(s.map(e)):t.loading())}}(Mt||(Mt={})),Pt.pipe=Object.freeze({map:t=>e=>Ot(e,t),filter:t=>e=>Ut(e,t)});const Ot=(t,e)=>Object.fromEntries(Object.entries(t).map((([t,s])=>[t,e(s,t)]))),Ut=(t,e)=>Object.fromEntries(Object.entries(t).filter((([t,s])=>e(s,t)))),Rt=Symbol();class Tt extends Error{name=this.constructor.name}class Nt{static unwrap=t=>t instanceof Nt?t.value:t;#p;#f=!1;#i;#g=new Set;[Rt]=!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=$t(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[Rt]=!0,this.#p}set value(t){if(this.#f)throw new Tt("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 Tt("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");kt.equal(t,this.#p)||(this.#p=t,this.publish())}setAndPublish(t){if(this.#f)throw new Tt("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 Tt("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 Ht extends Nt{#_=0;constructor(t){super(t)}async load(t){const e=++this.#_;return Mt.load((t=>{this.#_===e&&(this.value=t)}),t)}setLoading(){this.value=Mt.loading()}setError(t){this.value=Mt.error(t)}setReady(t){this.value=Mt.ready(t)}isLoading(){return Mt.is.loading(this.value)}isError(){return Mt.is.error(this.value)}isReady(){return Mt.is.ready(this.value)}get payload(){return Mt.payload(this.value)}select(t){return Mt.select(this.value,t)}}class jt{#w=!0;#y;#$;#b=new Set;#v=new Set;constructor({all_signals:t,waiters:e}){this.#y=t,this.#$=e}#o=$t(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)}}));#A(){for(const t of this.#y)t[Rt]=!1}get#S(){return[...this.#y].filter((t=>t[Rt]&&!this.#b.has(t)))}observe(t){this.#A();return{payload:t(),recording:this.#S}}add_listeners(t,e){for(const s of e)this.#b.add(s),this.#v.add(s.on((()=>this.#$.add(this.#o(t)))))}shutdown(){this.#w=!1,this.#v.forEach((t=>t()))}}const zt=new class{static readonly=yt;static collectivize=vt;#C=new pt;#k=new gt;#x=new lt;#E=new ft;#M=new bt;#P=function(t,e,s,n,r){function i([s,r]){if("lean"in r)r.actor();else{const{payload:i,recording:o}=e.record(r.collector);n.add(s,At(s,o,t,r)),r.responder&&r.responder(i)}}return{get:(t,s)=>(e.record_that_key_was_accessed(t,s),t[s]),set:(e,n,o)=>{if(s.locked)throw new _t(n);e[n]=o;const a=[...t.grab_keymap(e).grab_symbolmap(n)];for(const t of a){const[e]=t;r.add(e,(()=>s.lock((()=>i(t)))))}return!0}}}(this.#C,this.#k,this.#x,this.#E,this.#M);get wait(){return this.#M.wait}state(t){return new Proxy(t,this.#P)}reaction(t,e){const s=Symbol(),{recording:n}=this.#k.record((()=>this.#x.lock(t)));return this.#E.add(s,At(s,n,this.#C,{collector:t,responder:e})),()=>this.#E.stop(s)}lean(t){const e=Symbol();return{stop:()=>this.#E.stop(e),collect:s=>{const{payload:n,recording:r}=this.#k.record((()=>this.#x.lock(s)));return this.#E.add(e,At(e,r,this.#C,{lean:!0,actor:t})),n}}}clear(){this.#C.clear()}},Dt=new class{#O=new Set;#$=new Set;signal(t){const e=new Nt(t);return this.#O.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()),n=this.signal(s);return this.reaction(t,(async t=>{n.value=await e(t)})),n}op(t=Mt.loading()){const e=new Ht(t);return this.#O.add(e),e}load(t){const e=this.op(Mt.loading());return e.load(t),e}many(t){return Pt(t).map((t=>this.signal(t)))}reaction(t,e){const s=new jt({waiters:this.#$,all_signals:this.#O}),n={collector:t,responder:e},{recording:r}=s.observe(n.collector);return s.add_listeners(n,r),()=>s.shutdown()}lean(t){const e=new jt({waiters:this.#$,all_signals:this.#O}),s={lean:!0,actor:t};return{stop:()=>e.shutdown(),collect:t=>{const{payload:n,recording:r}=e.observe(t);return e.add_listeners(s,r),n}}}async#U(){return await Promise.all([...this.#O].map((t=>t.wait))).then((()=>Promise.all([...this.#$]))).then((()=>{this.#$.clear()}))}get wait(){return Promise.resolve().then((()=>this.#U())).then((()=>this.#U()))}},qt=new class{#O;#R=new Set;#g=new Set;#T=new Map;#N=Promise.resolve();constructor(t){this.#O=t}get wait(){return this.#N}#H=$t(0,(()=>{for(const t of this.#R)t();for(const t of this.#g)t()}));dispatch(){this.#N=this.#H()}computed(t){const e=this.#O.signal(t());return this.#R.add((()=>{e.value=t()})),e}track(t,e){let s=!0;const n=()=>{const n=t(),r=this.#T.get(t);!s&&kt.equal(n,r)||(s=!1,this.#T.set(t,n),e(n))};n(),this.#g.add(n);return()=>this.#g.delete(n)}stateTree(t){return new xt(t,(()=>this.dispatch()))}}(Dt);zt.state.bind(zt),Dt.signal.bind(Dt),Dt.computed.bind(Dt),Dt.op.bind(Dt);const Vt=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(r()):()=>r(),n=this.lean(s),r=()=>n.collect(t);return r(),n.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)))}}}(zt,Dt);class Lt extends(function(t){return class extends t{#j=(new Set).add((()=>this.setup()));#z=new Set;register_setup(t){this.#j.add(t)}setup(){return()=>{}}connectedCallback(){for(const t of this.#j)this.#z.add(t())}disconnectedCallback(){for(const t of this.#z)t();this.#z.clear()}}}(HTMLElement)){}function Bt(){let t,e;const s=new Promise(((s,n)=>{t=s,e=n}));return{promise:s,resolve:t,reject:e,entangle:function(n){return n.then(t).catch(e),s}}}function It(t,e){o(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(a(t))}else void 0!==t&&e.push(a(t));return e}(e))}class Wt extends Lt{static get styles(){}#D;#q=Bt();#i=this.#q.promise;init(){}constructor(){super(),this.#D=this.attachShadow({mode:"open"});const t=this.constructor;It(this.#D,t.styles),this.init()}get root(){return this.#D}get updateComplete(){return this.#i.then((()=>!0))}render(){}#V=$t(0,(()=>{const t=this.#D,e=this.render();e&&it(e,t,{host:this})}));async requestUpdate(){const t=this.#V();return this.#q&&(t.then(this.#q.resolve),this.#q=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}i`
@layer reset {
* {
margin: 0;
padding: 0;
box-sizing: border-box;
scrollbar-width: thin;
scrollbar-color: #888 transparent;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
::-webkit-scrollbar-thumb:hover { background: #444; }
}
`;class Zt{theme=[]}class Jt{#L;constructor(t){this.#L=t}get context(){if(this.#L)return this.#L;throw new Error("nexus.context was not set, but it's necessary")}set context(t){this.#L=t}}class Kt{static with(t){return new this(t)}#B;constructor(t){this.#B=t}to(t){return new Kt(t(this.#B))}done(){return this.#B}}var Ft;function Gt(t){return[t].flat().filter((t=>!!t))}!function(t){function e(...t){return function(e){return class extends e{static get styles(){return Xt(e.styles,t)}}}}function s(t=Vt){return function(e){return class extends e{#I=null;render(){return this.#I?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#I=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#I&&(this.#I.stop(),this.#I=null)}}}}t.css=e,t.css_deferred=function(t){return function(e){return class extends e{static get styles(){return Xt(e.styles,t())}}}},t.signals=function(t){return function(e){return class extends e{#I=null;render(){return this.#I?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#I=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#I&&(this.#I.stop(),this.#I=null)}}}},t.flat=function(t){return function(e){return class extends e{#I=null;render(){return this.#I?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#I=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#I&&(this.#I.stop(),this.#I=null)}}}},t.reactive=s,t.reactor=s,t.setup=function(...t){return function(n){return Kt.with(n).to(e(...t)).to(s()).done()}}}(Ft||(Ft={}));const Qt=t=>void 0!==t;function Xt(t,e){return[...Gt(t)??[],...Gt(e)].flat().filter(Qt)}var Yt;function te(){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=n=>{e(n),t.delete(s)};return t.add(s),()=>{t.delete(s)}},e}!function(t){t.css=t=>e=>Pt(e).map((e=>Ft.css(t)(e))),t.flat=t=>e=>Pt(e).map((e=>Ft.flat(t)(e))),t.signals=t=>e=>Pt(e).map((e=>Ft.signals(t)(e))),t.reactive=(t=Vt)=>e=>Pt(e).map((e=>Ft.reactive(t)(e))),t.reactor=t.reactive,t.context=e=>s=>Kt.with(s).to(t.css(e.theme)).to(t.reactive()).done(),t.setup=(...t)=>e=>Pt(e).map((e=>Ft.setup(...t)(e)))}(Yt||(Yt={}));class ee extends HTMLElement{static tag="slate-view";onConnected=te();onDisconnected=te();connectedCallback(){this.onConnected.publish()}disconnectedCallback(){this.onDisconnected.publish()}}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const se=2;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class ne{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)}}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const re=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),re(t,e);return!0},ie=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},oe=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),le(e)}};function ae(t){void 0!==this._$AN?(ie(this),this._$AM=t,oe(this)):this._$AM=t}function ce(t,e=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)re(n[t],!1),ie(n[t]);else null!=n&&(re(n,!1),ie(n));else re(this,t)}const le=t=>{t.type==se&&(t._$AP??=ce,t._$AQ??=ae)};class he extends ne{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),oe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(re(this,t),ie(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(){}}const ue=Symbol();class de{#p=0;pull(){return this.#p++}reset(){this.#p=0}}class pe{[ue]={wrap:t=>(...e)=>(this.#W.reset(),t(...e)),disconnect:()=>{for(const t of this.#Z)t();this.#Z.clear();for(const t of this.#J)t();this.#J.clear(),this.#K.clear();for(const{untrack:t}of this.#F.values())t();this.#F.clear()},reconnect:()=>{for(const t of this.#G.values())this.#Z.add(t());for(const[t,e]of this.#Q.entries()){const[s,n]=e();this.#K.set(t,s),this.#J.add(n)}},afterRender:()=>{for(const t of this.#X.values())t()}};#L;#Y;#W=new de;constructor(t,e){this.#Y=t,this.#L=e}get context(){return this.#L}rerender(){this.#Y()}#G=new Map;#Z=new Set;mount(t){const e=this.#W.pull();this.#G.has(e)||(this.#G.set(e,t),this.#Z.add(t()))}#Q=new Map;#K=new Map;#J=new Set;init(t){const e=this.#W.pull();if(!this.#Q.has(e)){this.#Q.set(e,t);const[s,n]=t();return this.#K.set(e,s),this.#J.add(n),s}return this.#K.get(e)}#tt=new Map;once(t){const e=this.#W.pull();return dt(this.#tt).guarantee(e,t)}#X=new Map;defer(t){const e=this.signal(void 0),s=this.#W.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.#W.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.#W.pull();return[dt(this.#st).guarantee(e,(()=>"function"==typeof t?t():t)),t=>{this.#st.set(e,t),this.#Y()},()=>this.#st.get(e)]}#nt=new Map;flatstate(t){const e=this.#W.pull();return dt(this.#nt).guarantee(e,(()=>zt.state("function"==typeof t?t():t)))}#O=new Map;signal(t){const e=this.#W.pull();return dt(this.#O).guarantee(e,(()=>Dt.signal("function"==typeof t?t():t)))}computed(t){const e=this.#W.pull();return dt(this.#O).guarantee(e,(()=>Dt.computed(t)))}op(){const t=this.#W.pull();return dt(this.#O).guarantee(t,(()=>Dt.op()))}load(t){const e=this.op();return this.once((()=>e.load(t))),e}#F=new Map;watch(t){const e=this.#W.pull(),{data:s}=dt(this.#F).guarantee(e,(()=>{const e={data:t(),untrack:()=>{}};return e.untrack=qt.track(t,(t=>{e.data=t,this.#Y()})),e}));return s}#rt=new Map;effect(t,e){e=e.map(Nt.unwrap);const s=this.#W.pull(),n=this.#rt.get(s);if(n){const[r,i]=n;kt.equal(e,i)||(r(),this.#rt.set(s,[t(),e]))}else{this.#G.set(s,t);const n=t();this.#Z.add(n),this.#rt.set(s,[n,e])}}}class fe extends pe{#it;get element(){return this.#it}#ot;get shadow(){return this.#ot}styles(...t){this.once((()=>It(this.shadow,[this.context.theme,...t])))}css(...t){return this.styles(...t)}constructor(t,e,s,n){super(s,n),this.#it=t,this.#ot=e}}var ge;function me(t){let e;return function(s){return e||(e=function(t,e){return ge.on_change(t,(()=>t.requestUpdate())),ge.proxy(t,e)}(t,s)),e}}!function(t){t.proxy=(t,e)=>new Proxy(e,{get:(s,n)=>{const r=e[n],i=t.getAttribute(n);switch(r){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 "${n}"`)}},set:(s,n,r)=>{switch(e[n]){case String:return t.setAttribute(n,r),!0;case Number:return t.setAttribute(n,r.toString()),!0;case Boolean:return r?t.setAttribute(n,""):t.removeAttribute(n),!0;default:throw new Error(`invalid attribute type for "${n}"`)}}}),t.on_change=function(t,e){const s=new MutationObserver(e);return s.observe(t,{attributes:!0}),()=>s.disconnect()}}(ge||(ge={}));class _e extends fe{attrs;constructor(t,e,s,n){super(t,e,s,n),this.attrs=me(t)}}class we extends pe{#it;get element(){return this.#it}attrs;constructor(t,e,s){super(e,s),this.#it=t,this.attrs=me(t)}}class ye extends _e{}class $e extends we{}class be extends pe{element;name(t){this.once((()=>this.element.setAttribute("view",t)))}constructor(t,e,s){super(e,s),this.element=t}}class ve extends fe{name(t){this.once((()=>this.element.setAttribute("view",t)))}}function Ae(t,e){const s=Vt.lean(e);return{stop:s.stop,render:(...e)=>s.collect((()=>t(...e)))}}const Se=t=>e=>(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends he{#at;#it=document.createElement(ee.tag);#ct(t){return it(t,this.#it),this.#lt[ue].afterRender(),this.#it}#Y=$t(0,(()=>{this.#at&&this.isConnected&&this.setValue(this.#ct(this.render(...this.#at)))}));#lt=new be(this.#it,this.#Y,t.context);#ht=this.#lt[ue].wrap(e(this.#lt));#ut=Ae(this.#ht,this.#Y);update(t,e){return this.#ct(this.render(...e))}render(...t){return this.#at=t,this.#ut?.render(...t)}reconnected(){this.#lt[ue].reconnect(),this.#ut=Ae(this.#ht,this.#Y)}disconnected(){this.#lt[ue].disconnect(),this.#ut&&(this.#ut.stop(),this.#ut=void 0)}});function Ce(...t){const e=new Set,s=t.map((t=>t??"")).flatMap(ke);for(const t of s)e.add(t);return e}function ke(t){return t.split(/\s+/).map((t=>t.trim())).filter((t=>!!t))}function xe(t){return t.split(",").map((t=>t.trim())).filter((t=>!!t)).map((t=>t.includes(":")?t.split(":").map((t=>t.trim()))[1]:t))}function Ee(t,e){const s=Ce(t.getAttribute("part")),n=Ce(t.getAttribute("data-gpart")),r=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([...r.part.flatMap(ke),...r.exportparts.flatMap(xe)]),o=new Set([...r.gpart.flatMap(ke),...r.gexportparts.flatMap(ke)]);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,...[...n].flatMap((t=>[...i].map((e=>`${t}-${e}`))))].join(" "))}function Me(t,e={},s={}){const{content:n,attrs:r={}}=e,{attrs:i={}}=s;function o(e,s,n,r){e!==s&&(void 0===e?t.removeAttribute(n):t.setAttribute(n,r()))}r&&function(t,e){for(const[s,n]of Object.entries(e))"string"==typeof n?t.setAttribute(s,n):"number"==typeof n?t.setAttribute(s,n.toString()):"boolean"==typeof n?!0===n?t.setAttribute(s,""):t.removeAttribute(s):void 0===n?t.removeAttribute(s):console.warn(`invalid attribute type ${s} is ${typeof n}`)}(t,r),o(r.class,i?.class,"class",(()=>r.class)),o(r.part,i?.part,"part",(()=>r.part)),o(r.gpart,i?.gpart,"data-gpart",(()=>r.gpart)),n&&it(n,t,{host:t})}const Pe=t=>e=>(t=>(e,s={})=>({_$litDirective$:t,values:[{meta:s,props:e}]}))(class extends he{#B;#dt=!0;#D=function({afterRender:t,onConnected:e,onDisconnected:s}){const n=document.createElement(ee.tag);n.onConnected(e),n.onDisconnected(s);const r=n.attachShadow({mode:"open"});let i=!1;return{container:n,shadow:r,set auto_exportparts(t){i=t},render_into_shadow:e=>(it(e,r),i&&Ee(n,r),t(),n)}}({afterRender:()=>this.#lt[ue].afterRender(),onDisconnected:()=>this.disconnected(),onConnected:()=>{this.#dt||this.reconnected(),this.#dt=!1}});#Y=$t(0,(()=>{this.#B&&this.isConnected&&this.setValue(this.#D.render_into_shadow(this.render(this.#B)))}));#lt=new ve(this.#D.container,this.#D.shadow,this.#Y,t.context);#ht=this.#lt[ue].wrap(e(this.#lt));#ut=Ae(this.#ht,this.#Y);update(t,e){return this.#D.render_into_shadow(this.render(...e))}render(t){return Me(this.#D.container,t.meta,this.#B?.meta),this.#B=t,this.#D.auto_exportparts=t.meta.auto_exportparts??!0,this.#ut?.render(...t.props)}reconnected(){this.#lt[ue].reconnect(),this.#ut=Ae(this.#ht,this.#Y)}disconnected(){this.#lt[ue].disconnect(),this.#ut&&(this.#ut.stop(),this.#ut=void 0)}});const Oe=function(t,e={}){const{soft:s=!1,upgrade:n=!0}=e;for(const[e,r]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,r),n&&document.querySelectorAll(t).forEach((t=>{t.constructor===HTMLElement&&customElements.upgrade(t)})))}};class Ue extends Lt{#q=Bt();#i=this.#q.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#i.then((()=>!0))}render(){}#V=$t(0,(()=>{const t=this.render();it(t,this,{host:this})}));async requestUpdate(){const t=this.#V();return this.#q&&(t.then(this.#q.resolve),this.#q=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}const Re=t=>e=>class extends Ue{#lt=new $e(this,(()=>{this.requestUpdate()}),t.context);#ht=this.#lt[ue].wrap((()=>e(this.#lt)));#ut;render(){return this.updateComplete.then((()=>this.#lt[ue].afterRender())),this.#ut?.render()}connectedCallback(){super.connectedCallback(),this.#ut=Ae(this.#ht,(()=>{this.requestUpdate()})),this.#lt[ue].reconnect()}disconnectedCallback(){super.disconnectedCallback(),this.#ut&&(this.#ut.stop(),this.#ut=void 0),this.#lt[ue].disconnect()}},Te=t=>e=>class extends Wt{#lt=new ye(this,this.root,(()=>{this.requestUpdate()}),t.context);#ht=this.#lt[ue].wrap((()=>e(this.#lt)));#ut;render(){return this.updateComplete.then((()=>this.#lt[ue].afterRender())),this.#ut?.render()}connectedCallback(){super.connectedCallback(),this.#lt[ue].reconnect(),this.#ut=Ae(this.#ht,(()=>{this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.#lt[ue].disconnect(),this.#ut&&(this.#ut.stop(),this.#ut=void 0)}},Ne=(t,...e)=>L(t,...e.map(Nt.unwrap)),He=i`
:host {
display: contents;
}
`;"undefined"!=typeof process&&process.versions&&process.versions.node||"undefined"!=typeof Deno&&void 0!==Deno.version||Oe({SlateView:ee},{soft:!0});class je extends Jt{lightComponent;shadowComponent;lightView;shadowView;shadowComponentify;constructor(t){super(t),this.lightComponent=Re(this),this.shadowComponent=Te(this),this.lightView=Se(this),this.shadowView=Pe(this),this.shadowComponentify=(t=>e=>t.shadowComponent((t=>(t.styles(He),e([])))))(this)}component=t=>Ft.setup(this.context.theme)(t);components=t=>Yt.setup(this.context.theme)(t)}const ze=new je(new Zt);ze.lightView,ze.lightComponent,ze.shadowView,ze.shadowComponent,ze.component,ze.components,ze.shadowComponentify;const De=new je,qe=i`span { color: green }`;let Ve=0,Le=0;const Be=De.shadowView((t=>e=>{t.styles(qe);const s=++Ve,n=t.signal(e);return Ne`
<span>${n} (renders ${s})</span>
<button @click=${()=>n.value+=1}>outer</button>
${Ie([1])}
`})),Ie=De.shadowView((t=>e=>{t.styles(qe);const s=++Le,n=t.signal(e);return Ne`
<span>${n} (renders ${s})</span>
<button @click=${()=>n.value+=1}>inner</button>
`})),We=De.lightView((t=>e=>{t.name("quartz-tripler");const[s,n]=t.state(e),r=t.flatstate({count:e}),i=t.signal(e);return Ne`
<span>${s}</span>
<button @click=${()=>n(3*s)}>quartz-a</button>
<span>${r.count}</span>
<button @click=${()=>r.count*=3}>quartz-b</button>
<span>${i}</span>
<button @click=${()=>i.value*=3}>quartz-c</button>
`})),Ze=De.shadowView((t=>e=>{t.name("quadrupler"),t.styles(i`span { color: yellow }`);const s=t.signal(e);return Ne`
<span>${s}</span>
<button @click=${()=>s.value*=4}>obsidian</button>
`}));const Je=()=>Math.ceil(1e3*Math.random()),Ke=De.shadowComponent((t=>{t.styles(i`button { color: green }`);const e=t.signal(Je);return Ne`
<span>${e}</span>
<button @click=${()=>e.value=Je()}>carbon</button>
`})),Fe=De.lightComponent((t=>{const e=t.signal(256);return Ne`
<span>${e}</span>
<button @click=${()=>e.value-=8}>oxygen</button>
`}));De.context=new class extends Zt{theme;constructor(t){super(),this.theme=t}}(i`
button {
font-weight: bold;
color: red;
}
`),Oe({SlateCarbon:Ke,SlateOxygen:Fe,...De.components({SlateGold:class extends Wt{static get styles(){return i`span {color: orange}`}#c=zt.state({count:0});render(){return L`
<span>${this.#c.count}</span>
<button @click=${()=>this.#c.count++}>gold</button>
`}},SlateSilver:class extends Ue{render(){return L`
${We(1)}
${Ze([33])}
<br/>
${Be([1])}
`}}})});