2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
const g={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return ie(this.context.count)},getNextContextId(){return ie(this.context.count++)}};function ie(e){const n=String(e),t=n.length-1;return g.context.id+(t?String.fromCharCode(96+t):"")+n}function I(e){g.context=e}function Te(){return{...g.context,id:g.getNextContextId(),count:0}}const Ne=!1,$e=(e,n)=>e===n,$=Symbol("solid-proxy"),le=Symbol("solid-track"),q={equals:$e};let Pe=be;const P=1,B=2,ue={owned:null,cleanups:null,context:null,owner:null};var y=null;let G=null,je=null,b=null,p=null,E=null,k=0;function ce(e,n){const t=b,s=y,i=e.length===0,l=n===void 0?s:n,o=i?ue:{owned:null,cleanups:null,context:l?l.context:null,owner:l},f=i?e:()=>e(()=>D(()=>K(o)));y=o,b=null;try{return R(f,!0)}finally{b=t,y=s}}function Q(e,n){n=n?Object.assign({},q,n):q;const t={value:e,observers:null,observerSlots:null,comparator:n.equals||void 0},s=i=>(typeof i=="function"&&(i=i(t.value)),ae(t,i));return[he.bind(t),s]}function W(e,n,t){const s=ge(e,n,!1,P);m(s)}function H(e,n,t){t=t?Object.assign({},q,t):q;const s=ge(e,n,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,m(s),he.bind(s)}function Fe(e){return R(e,!1)}function D(e){if(b===null)return e();const n=b;b=null;try{return e()}finally{b=n}}function Ie(e){return y===null||(y.cleanups===null?y.cleanups=[e]:y.cleanups.push(e)),e}function X(){return b}function ve(){return y}function _e(e){E.push.apply(E,e),e.length=0}function de(e,n){const t=Symbol("context");return{id:t,Provider:qe(t),defaultValue:e}}function Re(e){let n;return y&&y.context&&(n=y.context[e.id])!==void 0?n:e.defaultValue}function Le(e){const n=H(e),t=H(()=>Z(n()));return t.toArray=()=>{const s=t();return Array.isArray(s)?s:s!=null?[s]:[]},t}let oe;function He(){return oe||(oe=de())}function he(){if(this.sources&&this.state)if(this.state===P)m(this);else{const e=p;p=null,R(()=>U(this),!1),p=e}if(b){const e=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(e)):(b.sources=[this],b.sourceSlots=[e]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function ae(e,n,t){let s=e.value;return(!e.comparator||!e.comparator(s,n))&&(e.value=n,e.observers&&e.observers.length&&R(()=>{for(let i=0;i<e.observers.length;i+=1){const l=e.observers[i],o=G&&G.running;o&&G.disposed.has(l),(o?!l.tState:!l.state)&&(l.pure?p.push(l):E.push(l),l.observers&&we(l)),o||(l.state=P)}if(p.length>1e6)throw p=[],new Error},!1)),n}function m(e){if(!e.fn)return;K(e);const n=k;De(e,e.value,n)}function De(e,n,t){let s;const i=y,l=b;b=y=e;try{s=e.fn(n)}catch(o){return e.pure&&(e.state=P,e.owned&&e.owned.forEach(K),e.owned=null),e.updatedAt=t+1,pe(o)}finally{b=l,y=i}(!e.updatedAt||e.updatedAt<=t)&&(e.updatedAt!=null&&"observers"in e?ae(e,s):e.value=s,e.updatedAt=t)}function ge(e,n,t,s=P,i){const l={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:n,owner:y,context:y?y.context:null,pure:t};return y===null||y!==ue&&(y.owned?y.owned.push(l):y.owned=[l]),l}function ye(e){if(e.state===0)return;if(e.state===B)return U(e);if(e.suspense&&D(e.suspense.inFallback))return e.suspense.effects.push(e);const n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<k);)e.state&&n.push(e);for(let t=n.length-1;t>=0;t--)if(e=n[t],e.state===P)m(e);else if(e.state===B){const s=p;p=null,R(()=>U(e,n[0]),!1),p=s}}function R(e,n){if(p)return e();let t=!1;n||(p=[]),E?t=!0:E=[],k++;try{const s=e();return Ke(t),s}catch(s){t||(E=null),p=null,pe(s)}}function Ke(e){if(p&&(be(p),p=null),e)return;const n=E;E=null,n.length&&R(()=>Pe(n),!1)}function be(e){for(let n=0;n<e.length;n++)ye(e[n])}function U(e,n){e.state=0;for(let t=0;t<e.sources.length;t+=1){const s=e.sources[t];if(s.sources){const i=s.state;i===P?s!==n&&(!s.updatedAt||s.updatedAt<k)&&ye(s):i===B&&U(s,n)}}}function we(e){for(let n=0;n<e.observers.length;n+=1){const t=e.observers[n];t.state||(t.state=B,t.pure?p.push(t):E.push(t),t.observers&&we(t))}}function K(e){let n;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),s=e.sourceSlots.pop(),i=t.observers;if(i&&i.length){const l=i.pop(),o=t.observerSlots.pop();s<i.length&&(l.sourceSlots[o]=s,i[s]=l,t.observerSlots[s]=o)}}if(e.tOwned){for(n=e.tOwned.length-1;n>=0;n--)K(e.tOwned[n]);delete e.tOwned}if(e.owned){for(n=e.owned.length-1;n>=0;n--)K(e.owned[n]);e.owned=null}if(e.cleanups){for(n=e.cleanups.length-1;n>=0;n--)e.cleanups[n]();e.cleanups=null}e.state=0}function Me(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function pe(e,n=y){throw Me(e)}function Z(e){if(typeof e=="function"&&!e.length)return Z(e());if(Array.isArray(e)){const n=[];for(let t=0;t<e.length;t++){const s=Z(e[t]);Array.isArray(s)?n.push.apply(n,s):n.push(s)}return n}return e}function qe(e,n){return function(s){let i;return W(()=>i=D(()=>(y.context={...y.context,[e]:s.value},Le(()=>s.children))),void 0),i}}let Ae=!1;function Be(){Ae=!0}function z(e,n){if(Ae&&g.context){const t=g.context;I(Te());const s=D(()=>e(n||{}));return I(t),s}return D(()=>e(n||{}))}const We=de();function Ue(e){let n=0,t,s,i,l,o;const[f,u]=Q(!1),c=He(),r={increment:()=>{++n===1&&u(!0)},decrement:()=>{--n===0&&u(!1)},inFallback:f,effects:[],resolved:!1},d=ve();if(g.context&&g.load){const w=g.getContextId();let A=g.load(w);if(A&&(typeof A!="object"||A.s!==1?i=A:g.gather(w)),i&&i!=="$$f"){const[C,x]=Q(void 0,{equals:!1});l=C,i.then(()=>{if(g.done)return x();g.gather(w),I(s),x(),I()},T=>{o=T,x()})}}const h=Re(We);h&&(t=h.register(r.inFallback));let a;return Ie(()=>a&&a()),z(c.Provider,{value:r,get children(){return H(()=>{if(o)throw o;if(s=g.context,l)return l(),l=void 0;s&&i==="$$f"&&I();const w=H(()=>e.children);return H(A=>{const C=r.inFallback(),{showContent:x=!0,showFallback:T=!0}=t?t():{};if((!C||i&&i!=="$$f")&&x)return r.resolved=!0,a&&a(),a=s=i=void 0,_e(r.effects),w();if(T)return a?A:ce(Ee=>(a=Ee,s&&(I({id:s.id+"F",count:0}),s=void 0),e.fallback),d)})})}})}const ee=Symbol("store-raw"),v=Symbol("store-node"),O=Symbol("store-has"),Se=Symbol("store-self");function xe(e){let n=e[$];if(!n&&(Object.defineProperty(e,$,{value:n=new Proxy(e,ke)}),!Array.isArray(e))){const t=Object.keys(e),s=Object.getOwnPropertyDescriptors(e);for(let i=0,l=t.length;i<l;i++){const o=t[i];s[o].get&&Object.defineProperty(e,o,{enumerable:s[o].enumerable,get:s[o].get.bind(n)})}}return n}function N(e){let n;return e!=null&&typeof e=="object"&&(e[$]||!(n=Object.getPrototypeOf(e))||n===Object.prototype||Array.isArray(e))}function _(e,n=new Set){let t,s,i,l;if(t=e!=null&&e[ee])return t;if(!N(e)||n.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):n.add(e);for(let o=0,f=e.length;o<f;o++)i=e[o],(s=_(i,n))!==i&&(e[o]=s)}else{Object.isFrozen(e)?e=Object.assign({},e):n.add(e);const o=Object.keys(e),f=Object.getOwnPropertyDescriptors(e);for(let u=0,c=o.length;u<c;u++)l=o[u],!f[l].get&&(i=e[l],(s=_(i,n))!==i&&(e[l]=s))}return e}function Y(e,n){let t=e[n];return t||Object.defineProperty(e,n,{value:t=Object.create(null)}),t}function M(e,n,t){if(e[n])return e[n];const[s,i]=Q(t,{equals:!1,internal:!0});return s.$=i,e[n]=s}function Ye(e,n){const t=Reflect.getOwnPropertyDescriptor(e,n);return!t||t.get||!t.configurable||n===$||n===v||(delete t.value,delete t.writable,t.get=()=>e[$][n]),t}function Ce(e){X()&&M(Y(e,v),Se)()}function Ve(e){return Ce(e),Reflect.ownKeys(e)}const ke={get(e,n,t){if(n===ee)return e;if(n===$)return t;if(n===le)return Ce(e),t;const s=Y(e,v),i=s[n];let l=i?i():e[n];if(n===v||n===O||n==="__proto__")return l;if(!i){const o=Object.getOwnPropertyDescriptor(e,n);X()&&(typeof l!="function"||e.hasOwnProperty(n))&&!(o&&o.get)&&(l=M(s,n,l)())}return N(l)?xe(l):l},has(e,n){return n===ee||n===$||n===le||n===v||n===O||n==="__proto__"?!0:(X()&&M(Y(e,O),n)(),n in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Ve,getOwnPropertyDescriptor:Ye};function S(e,n,t,s=!1){if(!s&&e[n]===t)return;const i=e[n],l=e.length;t===void 0?(delete e[n],e[O]&&e[O][n]&&i!==void 0&&e[O][n].$()):(e[n]=t,e[O]&&e[O][n]&&i===void 0&&e[O][n].$());let o=Y(e,v),f;if((f=M(o,n,i))&&f.$(()=>t),Array.isArray(e)&&e.length!==l){for(let u=e.length;u<l;u++)(f=o[u])&&f.$();(f=M(o,"length",l))&&f.$(e.length)}(f=o[Se])&&f.$()}function Oe(e,n){const t=Object.keys(n);for(let s=0;s<t.length;s+=1){const i=t[s];S(e,i,n[i])}}function me(e,n){if(typeof n=="function"&&(n=n(e)),n=_(n),Array.isArray(n)){if(e===n)return;let t=0,s=n.length;for(;t<s;t++){const i=n[t];e[t]!==i&&S(e,t,i)}S(e,"length",s)}else Oe(e,n)}function L(e,n,t=[]){let s,i=e;if(n.length>1){s=n.shift();const o=typeof s,f=Array.isArray(e);if(Array.isArray(s)){for(let u=0;u<s.length;u++)L(e,[s[u]].concat(n),t);return}else if(f&&o==="function"){for(let u=0;u<e.length;u++)s(e[u],u)&&L(e,[u].concat(n),t);return}else if(f&&o==="object"){const{from:u=0,to:c=e.length-1,by:r=1}=s;for(let d=u;d<=c;d+=r)L(e,[d].concat(n),t);return}else if(n.length>1){L(e[s],n,[s].concat(t));return}i=e[s],t=[s].concat(t)}let l=n[0];typeof l=="function"&&(l=l(i,t),l===i)||s===void 0&&l==null||(l=_(l),s===void 0||N(i)&&N(l)&&!Array.isArray(l)?Oe(i,l):S(e,s,l))}function Ge(...[e,n]){const t=_(e||{}),s=Array.isArray(t),i=xe(t);function l(...o){Fe(()=>{s&&o.length===1?me(t,o[0]):L(t,o)})}return[i,l]}const ne=Symbol("store-root");function F(e,n,t,s,i){const l=n[t];if(e===l)return;const o=Array.isArray(e);if(t!==ne&&(!N(e)||!N(l)||o!==Array.isArray(l)||i&&e[i]!==l[i])){S(n,t,e);return}if(o){if(e.length&&l.length&&(!s||i&&e[0]&&e[0][i]!=null)){let c,r,d,h,a,w,A,C;for(d=0,h=Math.min(l.length,e.length);d<h&&(l[d]===e[d]||i&&l[d]&&e[d]&&l[d][i]&&l[d][i]===e[d][i]);d++)F(e[d],l,d,s,i);const x=new Array(e.length),T=new Map;for(h=l.length-1,a=e.length-1;h>=d&&a>=d&&(l[h]===e[a]||i&&l[h]&&e[a]&&l[h][i]&&l[h][i]===e[a][i]);h--,a--)x[a]=l[h];if(d>a||d>h){for(r=d;r<=a;r++)S(l,r,e[r]);for(;r<e.length;r++)S(l,r,x[r]),F(e[r],l,r,s,i);l.length>e.length&&S(l,"length",e.length);return}for(A=new Array(a+1),r=a;r>=d;r--)w=e[r],C=i&&w?w[i]:w,c=T.get(C),A[r]=c===void 0?-1:c,T.set(C,r);for(c=d;c<=h;c++)w=l[c],C=i&&w?w[i]:w,r=T.get(C),r!==void 0&&r!==-1&&(x[r]=l[c],r=A[r],T.set(C,r));for(r=d;r<e.length;r++)r in x?(S(l,r,x[r]),F(e[r],l,r,s,i)):S(l,r,e[r])}else for(let c=0,r=e.length;c<r;c++)F(e[c],l,c,s,i);l.length>e.length&&S(l,"length",e.length);return}const f=Object.keys(e);for(let c=0,r=f.length;c<r;c++)F(e[f[c]],l,f[c],s,i);const u=Object.keys(l);for(let c=0,r=u.length;c<r;c++)e[u[c]]===void 0&&S(l,u[c],void 0)}function Je(e,n={}){const{merge:t,key:s="id"}=n,i=_(e);return l=>{if(!N(l)||!N(i))return i;const o=F(i,{[ne]:l},ne,t,s);return o===void 0?l:o}}function Qe(e,n,t){let s=t.length,i=n.length,l=s,o=0,f=0,u=n[i-1].nextSibling,c=null;for(;o<i||f<l;){if(n[o]===t[f]){o++,f++;continue}for(;n[i-1]===t[l-1];)i--,l--;if(i===o){const r=l<s?f?t[f-1].nextSibling:t[l-f]:u;for(;f<l;)e.insertBefore(t[f++],r)}else if(l===f)for(;o<i;)(!c||!c.has(n[o]))&&n[o].remove(),o++;else if(n[o]===t[l-1]&&t[f]===n[i-1]){const r=n[--i].nextSibling;e.insertBefore(t[f++],n[o++].nextSibling),e.insertBefore(t[--l],r),n[i]=t[l]}else{if(!c){c=new Map;let d=f;for(;d<l;)c.set(t[d],d++)}const r=c.get(n[o]);if(r!=null)if(f<r&&r<l){let d=o,h=1,a;for(;++d<i&&d<l&&!((a=c.get(n[d]))==null||a!==r+h);)h++;if(h>r-f){const w=n[o];for(;f<r;)e.insertBefore(t[f++],w)}else e.replaceChild(t[f++],n[o++])}else o++;else n[o++].remove()}}}function te(e,n,t,s={}){let i;return ce(l=>{i=l,n===document?e():Xe(n,e(),n.firstChild?null:void 0,t)},s.owner),()=>{i(),n.textContent=""}}function Xe(e,n,t,s){if(t!==void 0&&!s&&(s=[]),typeof n!="function")return V(e,n,s,t);W(i=>V(e,n(),i,t),s)}function Ze(e,n,t={}){if(globalThis._$HY.done)return te(e,n,[...n.childNodes],t);g.completed=globalThis._$HY.completed,g.events=globalThis._$HY.events,g.load=s=>globalThis._$HY.r[s],g.has=s=>s in globalThis._$HY.r,g.gather=s=>fe(n,s),g.registry=new Map,g.context={id:t.renderId||"",count:0};try{return fe(n,t.renderId),te(e,n,[...n.childNodes],t)}finally{g.context=null}}function ze(e){return!!g.context&&!g.done&&(!e||e.isConnected)}function V(e,n,t,s,i){const l=ze(e);if(l){!t&&(t=[...e.childNodes]);let u=[];for(let c=0;c<t.length;c++){const r=t[c];r.nodeType===8&&r.data.slice(0,2)==="!$"?r.remove():u.push(r)}t=u}for(;typeof t=="function";)t=t();if(n===t)return t;const o=typeof n,f=s!==void 0;if(e=f&&t[0]&&t[0].parentNode||e,o==="string"||o==="number"){if(l||o==="number"&&(n=n.toString(),n===t))return t;if(f){let u=t[0];u&&u.nodeType===3?u.data!==n&&(u.data=n):u=document.createTextNode(n),t=j(e,t,s,u)}else t!==""&&typeof t=="string"?t=e.firstChild.data=n:t=e.textContent=n}else if(n==null||o==="boolean"){if(l)return t;t=j(e,t,s)}else{if(o==="function")return W(()=>{let u=n();for(;typeof u=="function";)u=u();t=V(e,u,t,s)}),()=>t;if(Array.isArray(n)){const u=[],c=t&&Array.isArray(t);if(se(u,n,t,i))return W(()=>t=V(e,u,t,s,!0)),()=>t;if(l){if(!u.length)return t;if(s===void 0)return t=[...e.childNodes];let r=u[0];if(r.parentNode!==e)return t;const d=[r];for(;(r=r.nextSibling)!==s;)d.push(r);return t=d}if(u.length===0){if(t=j(e,t,s),f)return t}else c?t.length===0?re(e,u,s):Qe(e,t,u):(t&&j(e),re(e,u));t=u}else if(n.nodeType){if(l&&n.parentNode)return t=f?[n]:n;if(Array.isArray(t)){if(f)return t=j(e,t,s,n);j(e,t,null,n)}else t==null||t===""||!e.firstChild?e.appendChild(n):e.replaceChild(n,e.firstChild);t=n}}return t}function se(e,n,t,s){let i=!1;for(let l=0,o=n.length;l<o;l++){let f=n[l],u=t&&t[e.length],c;if(!(f==null||f===!0||f===!1))if((c=typeof f)=="object"&&f.nodeType)e.push(f);else if(Array.isArray(f))i=se(e,f,u)||i;else if(c==="function")if(s){for(;typeof f=="function";)f=f();i=se(e,Array.isArray(f)?f:[f],Array.isArray(u)?u:[u])||i}else e.push(f),i=!0;else{const r=String(f);u&&u.nodeType===3&&u.data===r?e.push(u):e.push(document.createTextNode(r))}}return i}function re(e,n,t=null){for(let s=0,i=n.length;s<i;s++)e.insertBefore(n[s],t)}function j(e,n,t,s){if(t===void 0)return e.textContent="";const i=s||document.createTextNode("");if(n.length){let l=!1;for(let o=n.length-1;o>=0;o--){const f=n[o];if(i!==f){const u=f.parentNode===e;!l&&!o?u?e.replaceChild(i,f):e.insertBefore(i,t):u&&f.remove()}else l=!0}}else e.insertBefore(i,t);return[i]}function fe(e,n){const t=e.querySelectorAll("*[data-hk]");for(let s=0;s<t.length;s++){const i=t[s],l=i.getAttribute("data-hk");(!n||l.startsWith(n))&&!g.registry.has(l)&&g.registry.set(l,i)}}const en=(...e)=>(Be(),Ze(...e)),J=new WeakMap;var nn=e=>(n,t,s,{client:i})=>{if(!e.hasAttribute("ssr"))return;const l=i!=="only",o=l?en:te;let f,u={};if(Object.keys(s).length>0){if(i!=="only"){const h=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,a=>a===e?NodeFilter.FILTER_SKIP:a.nodeName==="ASTRO-SLOT"?NodeFilter.FILTER_ACCEPT:a.nodeName==="ASTRO-ISLAND"?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP);for(;f=h.nextNode();)u[f.getAttribute("name")||"default"]=f}for(const[h,a]of Object.entries(s))u[h]||(u[h]=document.createElement("astro-slot"),h!=="default"&&u[h].setAttribute("name",h),u[h].innerHTML=a)}const{default:c,...r}=u,d=e.dataset.solidRenderId;if(J.has(e))J.get(e)(Je({...t,...r,children:c}));else{const[h,a]=Ge({...t,...r,children:c});J.set(e,a);const w=o(()=>{const A=()=>z(n,h);return l?z(Ue,{get children(){return A()}}):A()},e,{renderId:d});e.addEventListener("astro:unmount",()=>w(),{once:!0})}};export{nn as default};
|