@krate/runtime 0.5.0-rc.15 → 0.5.0-rc.17

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.
Files changed (58) hide show
  1. package/NOTICE +10 -0
  2. package/README.md +92 -1
  3. package/dist/actions.js +10 -5
  4. package/dist/cache-scope.d.ts +10 -2
  5. package/dist/cache-scope.js +26 -4
  6. package/dist/context.js +3 -0
  7. package/dist/dev/app.js +6 -2
  8. package/dist/dev/modal.js +9 -9
  9. package/dist/dev/panel.js +3 -1
  10. package/dist/dev/sourcemap.d.ts +5 -0
  11. package/dist/dev/sourcemap.js +36 -2
  12. package/dist/dev/util.d.ts +6 -0
  13. package/dist/dev/util.js +1 -0
  14. package/dist/dom.d.ts +26 -0
  15. package/dist/dom.js +78 -5
  16. package/dist/flight-props.d.ts +8 -0
  17. package/dist/flight-props.js +44 -0
  18. package/dist/hints.d.ts +12 -0
  19. package/dist/hints.js +32 -2
  20. package/dist/index.d.ts +4 -0
  21. package/dist/island-swap.js +46 -8
  22. package/dist/krate-core.js +1 -1
  23. package/dist/krate-dev.js +14 -14
  24. package/dist/krate-f-actions.js +1 -1
  25. package/dist/krate-f-list.js +1 -1
  26. package/dist/krate-f-navigation.js +1 -1
  27. package/dist/krate-f-router.js +1 -1
  28. package/dist/krate-features.json +32 -1
  29. package/dist/krate-hydrate-lite.js +5 -5
  30. package/dist/krate-hydrate.js +5 -5
  31. package/dist/krate-island-swap.js +1 -1
  32. package/dist/krate-runtime.js +5 -5
  33. package/dist/list.js +8 -3
  34. package/dist/memsize.d.ts +14 -0
  35. package/dist/memsize.js +71 -0
  36. package/dist/metadata.js +20 -5
  37. package/dist/middleware-cookies.d.ts +4 -0
  38. package/dist/middleware-cookies.js +67 -0
  39. package/dist/navigation-react.js +2 -1
  40. package/dist/navigation.d.ts +7 -0
  41. package/dist/navigation.js +26 -1
  42. package/dist/react-compat.js +9 -0
  43. package/dist/react.d.ts +1 -1
  44. package/dist/react.js +5 -0
  45. package/dist/router.js +55 -9
  46. package/dist/segmented-lru.d.ts +14 -1
  47. package/dist/segmented-lru.js +90 -21
  48. package/dist/server-handler.d.ts +1 -0
  49. package/dist/server-handler.js +100 -6
  50. package/dist/server-renderer.js +4 -1
  51. package/dist/server.d.ts +6 -3
  52. package/dist/server.js +78 -38
  53. package/dist/shared-isr.js +2 -1
  54. package/dist/signal.js +13 -3
  55. package/dist/slots.js +8 -1
  56. package/dist/ssr-core.d.ts +10 -2
  57. package/dist/ssr-core.js +19 -6
  58. package/package.json +3 -2
@@ -1 +1 @@
1
- (()=>{var N="krate-island:",j="/krate-island",I="<!--"+N,R="<!--"+j+"-->",Q=/^krate-slot:([0-9a-z]+)$/;function x(e){return e.nodeType===8&&e.data.indexOf(N)===0}function M(e){return e.nodeType===8&&e.data===j}function H(e){return e.nodeType===1&&e.localName==="krate-island"&&e.hasAttribute("data-src")}function J(e){let s=0;for(let n=e.nextSibling;n;n=n.nextSibling)if(x(n))s++;else if(M(n)){if(!s)return n;s--}return null}function D(e,s){let n=[e];for(let t=e.nextSibling;t&&t!==s;t=t.nextSibling)n.push(t);return n.push(s),n}function C(e){return e.el?[e.el]:D(e.start,e.end)}function V(e){if(e.hasAttribute("data-props"))return e.getAttribute("data-props")||"";let s=e.previousElementSibling;return s&&s.localName==="script"&&s.hasAttribute("data-krate-props")&&s.textContent||""}function T(e,s=[],n=[]){for(let t=0;t<e.length;t++){let o=e[t];if(x(o)){let i=J(o),a=null;try{a=JSON.parse(o.data.slice(N.length))}catch{a=null}if(!i||!a)continue;for(n.push({key:a.m+"#"+a.e,start:o,end:i,json:o.data.slice(N.length),chain:s,rec:o.__krateIsland});t<e.length-1&&e[t]!==i;)t++}else H(o)?n.push({key:o.getAttribute("data-module")+"#"+o.getAttribute("data-export"),el:o,json:V(o),chain:s,rec:o.__krateIsland}):o.nodeType===1&&T(o.childNodes,s.concat(o),n)}return n}function X(e){let s=e&&e.handle;return!!e&&!e.gone&&e.status==="hydrated"&&!!s&&typeof s.update=="function"&&typeof s.unmount=="function"}function S(e,s){if(Array.isArray(e))return e.map(t=>S(t,s));if(!e||typeof e!="object")return e;let n={};for(let t in e){let o=e[t];t==="__krateSlotRef"&&typeof o=="string"||t==="r"&&e.$==="h"&&typeof o=="string"?n[t]=s(o):n[t]=S(o,s)}return n}function k(e){try{return JSON.parse(e)}catch{return}}function L(e){let s=k(e.json);return JSON.stringify(S(e.el?s:s&&s.p,()=>""))}function v(e){let s="";for(let n=0;n<e.length;n++){let t=e[n];s+=t.nodeType===1?t.outerHTML:t.nodeType===8?"<!--"+t.data+"-->":t.textContent||""}return s}function Y(e,s){for(let n=e.indexOf("<krate-island ",s);n>=0;n=e.indexOf("<krate-island ",n+1))if(/\sdata-src=/.test(e.slice(n,e.indexOf(">",n))))return n;return-1}function b(e){let s="",n=0;for(;;){let t=e.indexOf(I,n),o=Y(e,n);if(t===-1&&o<0)return s+e.slice(n);if(o>=0&&(t===-1||o<t)){let c=e.indexOf("</krate-island>",o);if(c===-1)return s+e.slice(n);s+=e.slice(n,o)+"<!--i:"+(/data-module="([^"]*)"/.exec(e.slice(o,e.indexOf(">",o)))||["",""])[1]+"-->",n=c+15;continue}let i=e.indexOf("-->",t);if(i===-1)return s+e.slice(n);let a=k(e.slice(t+I.length,i)),r=i+3,l=0;for(;;){let c=e.indexOf(I,r),d=e.indexOf(R,r);if(d===-1)return s+e.slice(n);if(c!==-1&&c<d){l++,r=c+I.length;continue}if(r=d+R.length,!l)break;l--}s+=e.slice(n,t)+"<!--i:"+(a?a.m+"#"+a.e:"")+"-->",n=r}}function Z(e){let s=[],n=new Set,t=o=>{if(n.has(o))return;n.add(o);let i=o.__krateIsland;if(i&&(x(o)||H(o))&&s.push(i),x(o)){let a=J(o);if(a)for(let l=o.nextSibling;l&&l!==a;l=l.nextSibling)t(l);let r=o.__krateInner;if(r)for(let l of r)t(l);return}if(o.nodeType===1)for(let a=o.firstChild;a;a=a.nextSibling)t(a)};for(let o=0;o<e.length;o++)t(e[o]);return s}function m(e){let s=Z(e);for(let n=s.length-1;n>=0;n--){let t=s[n];if(t.gone)continue;t.gone=!0;let o=t.handle;if(!(!o||typeof o.unmount!="function"))try{o.unmount()}catch(i){console.error(i)}}}function U(e,s){for(let n of Array.from(e.attributes))s.hasAttribute(n.name)||e.removeAttribute(n.name);for(let n of Array.from(s.attributes))e.getAttribute(n.name)!==n.value&&(n.namespaceURI?e.setAttributeNS(n.namespaceURI,n.name,n.value):e.setAttribute(n.name,n.value))}function ee(e,s,n){let t=e.moveBefore;if(typeof t=="function"&&s.isConnected&&e.isConnected&&s.parentNode)try{t.call(e,s,n);return}catch{}e.insertBefore(s,n)}function E(e,s,n,t){let o=new Set(s),i=globalThis.disposeNode;for(let r=n?n.nextSibling:e.firstChild;r&&r!==t;){let l=r.nextSibling;!o.has(r)&&!(g&&g.has(r))&&(e.removeChild(r),typeof i=="function"&&i(r)),r=l}let a=n?n.nextSibling:e.firstChild;for(let r of s){for(;a&&a!==t&&a!==r&&g&&g.has(a)&&!o.has(a);)a=a.nextSibling;r===a?a=a.nextSibling:ee(e,r,a)}}var g=null;function z(e,s){let n=g,t=new Set(n||[]);e.pairs.forEach(o=>C(o).forEach(i=>t.add(i))),e.map.forEach(o=>t.add(o)),g=t;try{s()}finally{g=n}}function P(e,s,n){let t=T(e),o=T(s),i=new Map,a=0;for(let c of o)for(let d=a;d<t.length;d++)if(t[d].key===c.key){a=d+1,X(t[d].rec)&&(!n||n(t[d],c))&&i.set(c,t[d]);break}i.forEach((c,d)=>{d.el||(d.slots=q(d))});let r=new Set(i.values()),l=new Map;return i.forEach((c,d)=>l.set(d.el||d.start,d)),{pairs:i,byStart:l,map:new Map,carry:new Set,gone:t.filter(c=>!r.has(c)),live:t,next:o}}function B(e){let s=new Set(e.map.values());e.pairs.forEach((n,t)=>{let o=!0;t.chain.forEach((i,a)=>{if(e.carry.add(i),!o)return;let r=n.chain[a],l=e.map.get(i);if(l){o=l===r;return}r&&r.localName===i.localName&&!s.has(r)?(e.map.set(i,r),s.add(r)):o=!1})})}function w(e,s){let n=[];for(let t=0;t<s.length;t++){let o=s[t],i=e.byStart.get(o);if(i){if(n.push(...C(e.pairs.get(i))),i.end)for(;t<s.length-1&&s[t]!==i.end;)t++;continue}let a=e.map.get(o);if(a){U(a,o),E(a,w(e,Array.from(o.childNodes)),null,null),n.push(a);continue}e.carry.has(o)&&E(o,w(e,Array.from(o.childNodes)),null,null),n.push(o)}return n}function G(e){return e.gone.length===0&&e.pairs.size===e.next.length}function $(e,s,n,t,o={}){let i=[];for(let l=s?s.nextSibling:e.firstChild;l&&l!==n;l=l.nextSibling)i.push(l);let a=[],r=P(i,t,o.sameProps?(l,c)=>L(l)===L(c):null);if(r.pairs.size>0&&G(r)&&b(v(i))===b(v(t)))return r.pairs.forEach((l,c)=>A(l,c,a)),a;for(let l of r.gone)m(C(l));return B(r),z(r,()=>E(e,w(r,t),s,n)),r.pairs.forEach((l,c)=>A(l,c,a)),a}function q(e){let s=[],n=0,t=[],o=i=>{if(x(i))return void n++;if(M(i))return void n--;if(n||i.nodeType!==8)return;let a=Q.exec(i.data);if(!a)return;let r=i.parentElement&&i.parentElement.closest("krate-island");if(r&&t.some(u=>u===r||u.contains(r)))return;let l="/krate-slot:"+a[1],c=[],d=i.nextSibling;for(;d&&!(d.nodeType===8&&d.data===l);d=d.nextSibling)c.push(d);d&&s.push({id:a[1],nodes:c})};t=D(e.start,e.end).slice(1,-1);for(let i of t){if(i.nodeType===8){o(i);continue}if(i.nodeType!==1)continue;let a=(i.ownerDocument||document).createTreeWalker(i,128);for(let r=a.nextNode();r;r=a.nextNode())o(r)}return s}function ne(e,s,n){let t=P(e,s,null),o=(r,l)=>{let c=new Map;for(let u of l)u.chain.length===0&&c.set(u.el||u.start,u);let d=[];for(let u=0;u<r.length;u++){let h=c.get(r[u]);if(d.push({node:r[u],isl:h}),h&&h.end)for(;u<r.length-1&&r[u]!==h.end;)u++}return d},i=o(e,t.live),a=o(s,t.next);if(i.length!==a.length)return!1;for(let r=0;r<i.length;r++){let l=i[r],c=a[r];if(l.isl||c.isl){if(!l.isl||!c.isl||t.pairs.get(c.isl)!==l.isl)return!1}else if(l.node.nodeType!==c.node.nodeType||l.node.nodeType===1&&l.node.localName!==c.node.localName)return!1}for(let r of t.gone)m(C(r));for(let r=0;r<i.length;r++)!i[r].isl&&i[r].node.nodeType===1&&t.map.set(a[r].node,i[r].node);return B(t),z(t,()=>{for(let r=0;r<i.length;r++){let l=i[r].node,c=a[r].node;i[r].isl||(l.nodeType===1?(U(l,c),E(l,w(t,Array.from(c.childNodes)),null,null)):l.data!==c.data&&(l.data=c.data))}}),t.pairs.forEach((r,l)=>A(r,l,n)),!0}function te(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/--/g,"-\\u002d")}function A(e,s,n){let t=e.rec.handle,o=k(s.json);if(o===void 0)return;if(e.el){if(s.json===e.json)return;try{let f=t.update(o);f&&typeof f.then=="function"&&n.push(f.catch(y=>console.error(y)))}catch(f){console.error(f)}return}let i={},a={},r=!1,l=t.slots||[],c=s.slots||q(s),d=[];if(c.forEach((f,y)=>{let p=l.length===c.length?l[y]:void 0,O=v(f.nodes);if(p){if(b(O)===b(p.html)){let _=P(p.set,f.nodes,null);if(G(_)){_.pairs.forEach((W,F)=>A(W,F,n)),i[f.id]=p.id,d.push(p);return}}if(ne(p.set,f.nodes,n)){i[f.id]=p.id,p.html=O,d.push(p);return}}p&&m(p.set),a[f.id]=[f.nodes],r=!0,d.push({id:f.id,html:O,set:f.nodes})}),l.length!==c.length)for(let f of l)m(f.set);t.slots=d;let u=S(o.p||{},f=>i[f]||f),h=k(e.json),K=r||JSON.stringify(u)!==JSON.stringify(h?h.p||{}:null);if(o.p=u,h&&h.i!==void 0&&(o.i=h.i),e.start.data=N+te(JSON.stringify(o)),typeof t.sync=="function")try{t.sync()}catch(f){console.error(f)}if(K)try{let f=r?t.update(u,a):t.update(u);f&&typeof f.then=="function"&&n.push(f.catch(y=>console.error(y)))}catch(f){console.error(f)}}window.__krateIslandSwap={swap:$,unmount:m};})();
1
+ (()=>{var N="krate-island:",J="/krate-island",x="<!--"+N,R="<!--"+J+"-->",X=/^krate-slot:([0-9a-z]+)$/;function k(e){return e.nodeType===8&&e.data.indexOf(N)===0}function H(e){return e.nodeType===8&&e.data===J}function D(e){return e.nodeType===1&&e.localName==="krate-island"&&e.hasAttribute("data-src")}function U(e){let o=0;for(let t=e.nextSibling;t;t=t.nextSibling)if(k(t))o++;else if(H(t)){if(!o)return t;o--}return null}function z(e,o){let t=[e];for(let n=e.nextSibling;n&&n!==o;n=n.nextSibling)t.push(n);return t.push(o),t}function O(e){return e.el?[e.el]:z(e.start,e.end)}function Y(e){if(e.hasAttribute("data-props"))return e.getAttribute("data-props")||"";let o=e.previousElementSibling;return o&&o.localName==="script"&&o.hasAttribute("data-krate-props")&&o.textContent||""}function L(e,o){return o===null?e:e+"#"+JSON.stringify(o)}function v(e,o=[],t=[]){for(let n=0;n<e.length;n++){let s=e[n];if(k(s)){let i=U(s),a=null;try{a=JSON.parse(s.data.slice(N.length))}catch{a=null}if(!i||!a)continue;let r=typeof a.k=="string";for(t.push({key:L(a.m+"#"+a.e,r?a.k:null),keyed:r,start:s,end:i,json:s.data.slice(N.length),chain:o,rec:s.__krateIsland});n<e.length-1&&e[n]!==i;)n++}else if(D(s)){let i=s.getAttribute("data-key");t.push({key:L(s.getAttribute("data-module")+"#"+s.getAttribute("data-export"),i),keyed:i!==null,el:s,json:Y(s),chain:o,rec:s.__krateIsland})}else s.nodeType===1&&v(s.childNodes,o.concat(s),t)}return t}function M(e){let o=e&&e.handle;return!!e&&!e.gone&&e.status==="hydrated"&&!!o&&typeof o.update=="function"&&typeof o.unmount=="function"}function I(e,o){if(Array.isArray(e))return e.map(n=>I(n,o));if(!e||typeof e!="object")return e;let t={};for(let n in e){let s=e[n];n==="__krateSlotRef"&&typeof s=="string"||n==="r"&&e.$==="h"&&typeof s=="string"?t[n]=o(s):t[n]=I(s,o)}return t}function S(e){try{return JSON.parse(e)}catch{return}}function j(e){let o=S(e.json);return JSON.stringify(I(e.el?o:o&&o.p,()=>""))}function T(e){let o="";for(let t=0;t<e.length;t++){let n=e[t];o+=n.nodeType===1?n.outerHTML:n.nodeType===8?"<!--"+n.data+"-->":n.textContent||""}return o}function Z(e,o){for(let t=e.indexOf("<krate-island ",o);t>=0;t=e.indexOf("<krate-island ",t+1))if(/\sdata-src=/.test(e.slice(t,e.indexOf(">",t))))return t;return-1}function b(e){let o="",t=0;for(;;){let n=e.indexOf(x,t),s=Z(e,t);if(n===-1&&s<0)return o+e.slice(t);if(s>=0&&(n===-1||s<n)){let f=e.indexOf("</krate-island>",s);if(f===-1)return o+e.slice(t);o+=e.slice(t,s)+"<!--i:"+(/data-module="([^"]*)"/.exec(e.slice(s,e.indexOf(">",s)))||["",""])[1]+"-->",t=f+15;continue}let i=e.indexOf("-->",n);if(i===-1)return o+e.slice(t);let a=S(e.slice(n+x.length,i)),r=i+3,l=0;for(;;){let f=e.indexOf(x,r),d=e.indexOf(R,r);if(d===-1)return o+e.slice(t);if(f!==-1&&f<d){l++,r=f+x.length;continue}if(r=d+R.length,!l)break;l--}o+=e.slice(t,n)+"<!--i:"+(a?a.m+"#"+a.e:"")+"-->",t=r}}function ee(e){let o=[],t=new Set,n=s=>{if(t.has(s))return;t.add(s);let i=s.__krateIsland;if(i&&(k(s)||D(s))&&o.push(i),k(s)){let a=U(s);if(a)for(let l=s.nextSibling;l&&l!==a;l=l.nextSibling)n(l);let r=s.__krateInner;if(r)for(let l of r)n(l);return}if(s.nodeType===1)for(let a=s.firstChild;a;a=a.nextSibling)n(a)};for(let s=0;s<e.length;s++)n(e[s]);return o}function y(e){let o=ee(e);for(let t=o.length-1;t>=0;t--){let n=o[t];if(n.gone)continue;n.gone=!0;let s=n.handle;if(!(!s||typeof s.unmount!="function"))try{s.unmount()}catch(i){console.error(i)}}}function K(e,o){for(let t of Array.from(e.attributes))o.hasAttribute(t.name)||e.removeAttribute(t.name);for(let t of Array.from(o.attributes))e.getAttribute(t.name)!==t.value&&(t.namespaceURI?e.setAttributeNS(t.namespaceURI,t.name,t.value):e.setAttribute(t.name,t.value))}function ne(e,o,t){let n=e.moveBefore;if(typeof n=="function"&&o.isConnected&&e.isConnected&&o.parentNode)try{n.call(e,o,t);return}catch{}e.insertBefore(o,t)}function E(e,o,t,n){let s=new Set(o),i=globalThis.disposeNode;for(let r=t?t.nextSibling:e.firstChild;r&&r!==n;){let l=r.nextSibling;!s.has(r)&&!(h&&h.has(r))&&(e.removeChild(r),typeof i=="function"&&i(r)),r=l}let a=t?t.nextSibling:e.firstChild;for(let r of o){for(;a&&a!==n&&a!==r&&h&&h.has(a)&&!s.has(a);)a=a.nextSibling;r===a?a=a.nextSibling:ne(e,r,a)}}var h=null;function B(e,o){let t=h,n=new Set(t||[]);e.pairs.forEach(s=>O(s).forEach(i=>n.add(i))),e.map.forEach(s=>n.add(s)),h=n;try{o()}finally{h=t}}function P(e,o,t){let n=v(e),s=v(o),i=new Map,a=new Map;for(let d of n)d.keyed&&!a.has(d.key)&&a.set(d.key,d);let r=0;for(let d of s){if(d.keyed){let c=a.get(d.key);if(!c)continue;a.delete(d.key),M(c.rec)&&(!t||t(c,d))&&i.set(d,c);continue}for(let c=r;c<n.length;c++)if(!(n[c].keyed||n[c].key!==d.key)){r=c+1,M(n[c].rec)&&(!t||t(n[c],d))&&i.set(d,n[c]);break}}i.forEach((d,c)=>{c.el||(c.slots=W(c))});let l=new Set(i.values()),f=new Map;return i.forEach((d,c)=>f.set(c.el||c.start,c)),{pairs:i,byStart:f,map:new Map,carry:new Set,gone:n.filter(d=>!l.has(d)),live:n,next:s}}function G(e){let o=new Set(e.map.values());e.pairs.forEach((t,n)=>{let s=!0;n.chain.forEach((i,a)=>{if(e.carry.add(i),!s)return;let r=t.chain[a],l=e.map.get(i);if(l){s=l===r;return}r&&r.localName===i.localName&&!o.has(r)?(e.map.set(i,r),o.add(r)):s=!1})})}function w(e,o){let t=[];for(let n=0;n<o.length;n++){let s=o[n],i=e.byStart.get(s);if(i){if(t.push(...O(e.pairs.get(i))),i.end)for(;n<o.length-1&&o[n]!==i.end;)n++;continue}let a=e.map.get(s);if(a){K(a,s),E(a,w(e,Array.from(s.childNodes)),null,null),t.push(a);continue}e.carry.has(s)&&E(s,w(e,Array.from(s.childNodes)),null,null),t.push(s)}return t}function $(e){if(e.gone.length!==0||e.pairs.size!==e.next.length)return!1;let o=-1;for(let t of e.next){let n=e.live.indexOf(e.pairs.get(t));if(n<o)return!1;o=n}return!0}function q(e,o,t,n,s={}){let i=[];for(let l=o?o.nextSibling:e.firstChild;l&&l!==t;l=l.nextSibling)i.push(l);let a=[],r=P(i,n,s.sameProps?(l,f)=>j(l)===j(f):null);if(r.pairs.size>0&&$(r)&&b(T(i))===b(T(n)))return r.pairs.forEach((l,f)=>A(l,f,a)),a;for(let l of r.gone)y(O(l));return G(r),B(r,()=>E(e,w(r,n),o,t)),r.pairs.forEach((l,f)=>A(l,f,a)),a}function W(e){let o=[],t=0,n=[],s=i=>{if(k(i))return void t++;if(H(i))return void t--;if(t||i.nodeType!==8)return;let a=X.exec(i.data);if(!a)return;let r=i.parentElement&&i.parentElement.closest("krate-island");if(r&&n.some(c=>c===r||c.contains(r)))return;let l="/krate-slot:"+a[1],f=[],d=i.nextSibling;for(;d&&!(d.nodeType===8&&d.data===l);d=d.nextSibling)f.push(d);d&&o.push({id:a[1],nodes:f})};n=z(e.start,e.end).slice(1,-1);for(let i of n){if(i.nodeType===8){s(i);continue}if(i.nodeType!==1)continue;let a=(i.ownerDocument||document).createTreeWalker(i,128);for(let r=a.nextNode();r;r=a.nextNode())s(r)}return o}function te(e,o,t){let n=P(e,o,null),s=(r,l)=>{let f=new Map;for(let c of l)c.chain.length===0&&f.set(c.el||c.start,c);let d=[];for(let c=0;c<r.length;c++){let g=f.get(r[c]);if(d.push({node:r[c],isl:g}),g&&g.end)for(;c<r.length-1&&r[c]!==g.end;)c++}return d},i=s(e,n.live),a=s(o,n.next);if(i.length!==a.length)return!1;for(let r=0;r<i.length;r++){let l=i[r],f=a[r];if(l.isl||f.isl){if(!l.isl||!f.isl||n.pairs.get(f.isl)!==l.isl)return!1}else if(l.node.nodeType!==f.node.nodeType||l.node.nodeType===1&&l.node.localName!==f.node.localName)return!1}for(let r of n.gone)y(O(r));for(let r=0;r<i.length;r++)!i[r].isl&&i[r].node.nodeType===1&&n.map.set(a[r].node,i[r].node);return G(n),B(n,()=>{for(let r=0;r<i.length;r++){let l=i[r].node,f=a[r].node;i[r].isl||(l.nodeType===1?(K(l,f),E(l,w(n,Array.from(f.childNodes)),null,null)):l.data!==f.data&&(l.data=f.data))}}),n.pairs.forEach((r,l)=>A(r,l,t)),!0}function oe(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/--/g,"-\\u002d")}function A(e,o,t){let n=e.rec.handle,s=S(o.json);if(s===void 0)return;if(e.el){if(o.json===e.json)return;try{let u=n.update(s);u&&typeof u.then=="function"&&t.push(u.catch(m=>console.error(m)))}catch(u){console.error(u)}return}let i={},a={},r=!1,l=n.slots||[],f=o.slots||W(o),d=[];if(f.forEach((u,m)=>{let p=l.length===f.length?l[m]:void 0,C=T(u.nodes);if(p){if(b(C)===b(p.html)){let _=P(p.set,u.nodes,null);if($(_)){_.pairs.forEach((Q,V)=>A(Q,V,t)),i[u.id]=p.id,d.push(p);return}}if(te(p.set,u.nodes,t)){i[u.id]=p.id,p.html=C,d.push(p);return}}p&&y(p.set),a[u.id]=[u.nodes],r=!0,d.push({id:u.id,html:C,set:u.nodes})}),l.length!==f.length)for(let u of l)y(u.set);n.slots=d;let c=I(s.p||{},u=>i[u]||u),g=S(e.json),F=r||JSON.stringify(c)!==JSON.stringify(g?g.p||{}:null);if(s.p=c,g&&g.i!==void 0&&(s.i=g.i),e.start.data=N+oe(JSON.stringify(s)),typeof n.sync=="function")try{n.sync()}catch(u){console.error(u)}if(F)try{let u=r?n.update(c,a):n.update(c);u&&typeof u.then=="function"&&t.push(u.catch(m=>console.error(m)))}catch(u){console.error(u)}}window.__krateIslandSwap={swap:q,unmount:y};})();