@wcstack/state 4.7.0 → 4.9.0
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/README.ja.md +10 -9
- package/README.md +10 -9
- package/dist/auto.min.js +1 -1
- package/dist/auto.min.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/parser.esm.js +1 -1
- package/dist/split/auto.js +1 -1
- package/dist/split/chunks/chunk-47I6RYV3.js +2 -0
- package/dist/split/chunks/{chunk-XXVJ6J2N.js.map → chunk-47I6RYV3.js.map} +1 -1
- package/dist/split/chunks/{chunk-DRSAQE4E.js → chunk-EBIQH2HE.js} +2 -2
- package/dist/split/chunks/{chunk-P3EXTBXC.js → chunk-FQUDP3XK.js} +2 -2
- package/dist/split/chunks/{chunk-IBGHHABS.js → chunk-ISBASPV2.js} +2 -2
- package/dist/split/chunks/{chunk-GQTEYSRZ.js → chunk-J3PTKUWV.js} +2 -2
- package/dist/split/chunks/{chunk-QMOIMPIJ.js → chunk-LWRYFYOC.js} +2 -2
- package/dist/split/chunks/{chunk-PKEAYPFR.js → chunk-P3JKSHRN.js} +2 -2
- package/dist/split/chunks/{chunk-T3KW5DZD.js → chunk-SOFOV2OG.js} +2 -2
- package/dist/split/chunks/{chunk-NITPUCPA.js → chunk-TS2HEHBQ.js} +2 -2
- package/dist/split/chunks/chunk-YIDHPXYQ.js +2 -0
- package/dist/split/chunks/{chunk-UN6ADZKP.js.map → chunk-YIDHPXYQ.js.map} +1 -1
- package/dist/split/core.js +1 -1
- package/dist/split/features/devtools.js +1 -1
- package/dist/split/features/diagnostics.js +1 -1
- package/dist/split/features/diagnostics.js.map +1 -1
- package/dist/split/features/formats.js +1 -1
- package/dist/split/features/list-keys.js +1 -1
- package/dist/split/features/native-commands.js +1 -1
- package/dist/split/features/recursion.js +1 -1
- package/dist/split/features/scopes.js +1 -1
- package/dist/split/features/ssr.js +1 -1
- package/dist/split/features/temporal.js +1 -1
- package/package.json +1 -1
- package/dist/split/chunks/chunk-UN6ADZKP.js +0 -2
- package/dist/split/chunks/chunk-XXVJ6J2N.js +0 -2
- /package/dist/split/chunks/{chunk-DRSAQE4E.js.map → chunk-EBIQH2HE.js.map} +0 -0
- /package/dist/split/chunks/{chunk-P3EXTBXC.js.map → chunk-FQUDP3XK.js.map} +0 -0
- /package/dist/split/chunks/{chunk-IBGHHABS.js.map → chunk-ISBASPV2.js.map} +0 -0
- /package/dist/split/chunks/{chunk-GQTEYSRZ.js.map → chunk-J3PTKUWV.js.map} +0 -0
- /package/dist/split/chunks/{chunk-QMOIMPIJ.js.map → chunk-LWRYFYOC.js.map} +0 -0
- /package/dist/split/chunks/{chunk-PKEAYPFR.js.map → chunk-P3JKSHRN.js.map} +0 -0
- /package/dist/split/chunks/{chunk-T3KW5DZD.js.map → chunk-SOFOV2OG.js.map} +0 -0
- /package/dist/split/chunks/{chunk-NITPUCPA.js.map → chunk-TS2HEHBQ.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"../chunks/chunk-UN6ADZKP.js";import{b as t,c as l}from"../chunks/chunk-QMOIMPIJ.js";import"../chunks/chunk-GQTEYSRZ.js";import{a as n,i as o,j as r,k as i,l as s,m as a,n as c,o as u}from"../chunks/chunk-XXVJ6J2N.js";import"../chunks/chunk-IBGHHABS.js";import"../chunks/chunk-T3KW5DZD.js";import{a as f}from"../chunks/chunk-P3EXTBXC.js";import"../chunks/chunk-NITPUCPA.js";import"../chunks/chunk-PKEAYPFR.js";import"../chunks/chunk-DRSAQE4E.js";import{a as d,b as p}from"../chunks/chunk-BCL75PFH.js";var m=e=>e.split(".").slice(0,2).join("."),h=class extends t{static find(e){return e.querySelector?.(f.tagNames.ssr)??null}get version(){return this.getAttribute("version")??""}get stateData(){let e=this.querySelector('script[type="application/json"]');return null===e?{}:JSON.parse(e.textContent||"{}")}get templates(){let e=new Map;for(let t of Array.from(this.children))"template"===t.localName&&e.set(t.id,t);return e}get hydrateProps(){return{}}getTemplate(e){return this.templates.get(e)??null}verifyVersion(){return m(this.version)===m(e)}};function g(e){let t=f.tagNames.ssr;void 0===e.get(t)&&e.define(t,class extends h{})}var b=()=>f.tagNames.ssr,v=Symbol.for("wcstack.ssr.snapshotBuilder"),y=()=>!0===document.documentElement?.hasAttribute("data-wcs-server"),N=e=>document.createComment(e),w=(e,t)=>null!==e&&8===e.nodeType&&e.data===t,S=(e,t)=>null!==e&&8===e.nodeType&&e.data.startsWith(t),A=new WeakMap,x=new WeakMap,k=new WeakMap,T=new WeakSet,$=new WeakMap;function E(e,t){let l=[];for(let n=e;null!==n&&(l.push(n),n!==t);n=n.nextSibling);return l}function C(e,t,...l){for(let l of Array.from(e.attributes))t.setAttribute(l.name,l.value);return(t.content??t).append(...l),t}var j=e=>{let t=e.nextSibling;return 1!==e.nodeType||"a"!==t?.localName||!t.hasAttribute("data-wcs-ssr-link")&&e.anchorElement!==t?null:t};function W(e,t,l,n){let o=N(null===n?"wcs-[":`wcs-[:${n}`),r=N("wcs-]");l.length>0&&l[0].Pe().before(...E(e,t)),t.after(o);for(let e of l)null===n&&e.Pe().before(N("wcs-|"));let i=l.length>0?(e=>null===e.L?e.ct:e.L[e.L.length-1])(l[l.length-1]):o;(j(i)??i).after(r);for(let e of E(o,r))T.add(e)}function q(e){if(e instanceof o){W(e.S,e.S,e.Ae,null);for(let t of e.Ae)I(t);return}let t=e.I;null!==t&&(W(e.q[e.y].S,e.q[e.q.length-1].S,[t],e.y),I(t))}function I(e){if(null!==e.u)for(let t of e.u)q(t)}var M=new Set(["script","style","template","textarea","title"]),P="data-wcs-raw",D=e=>M.has(e.localName)||e.localName===b();function O(e){for(let t of Array.from(e.childNodes))3===t.nodeType?""===t.data?t.replaceWith(N("wcs-e")):null!==t.nextSibling&&3===t.nextSibling.nodeType&&t.after(N("wcs-s")):1===t.nodeType&&!D(t)&&O(t)}var R=0;function z(t,l){let n=t.getRootNode(),o=[l];for(let e of x.get(n)??[])e!==l&&!0===e.element?.hasAttribute("bind-component")&&o.push(e);let r=new Map;for(let e of o){let t=A.get(e);if(void 0===t)continue;let l=new Map;for(let t of e.oe.values())if(null!==t.N&&l.set(t.N.S,t.N),null!==t.M)for(let e of t.M)l.set(e.S,e);for(let t of e.ue.values())for(let e of t)if(null!==e.D)for(let t of e.D.q)l.set(t.S,e.D);let n=new Set;for(let[e,o]of t){r.set(e,o);let t=l.get(e);void 0!==t&&!n.has(t)&&e.isConnected&&(n.add(t),q(t))}}for(let e of Array.from(n.querySelectorAll("*"))){let t=k.get(e);if(void 0!==t){let l=document.createTreeWalker(e,133,{acceptNode:e=>T.has(e)||1===e.nodeType&&t.has(e)&&L(e)?2:1}),n=[];for(let e=l.nextNode();null!==e;e=l.nextNode()){let l=e.previousSibling;(3===e.nodeType?e.data.includes("{{")&&!(D(e.parentNode)?$.has(e):t.has(l)&&S(l,"wcs-t:"))&&($.has(e)||t.get(e)!==e.data):!t.has(e))&&n.push(e)}for(let e of n)e.remove()}let l=Array.from(e.childNodes);D(e)&&l.some(e=>$.has(e))&&e.setAttribute(P,l.map(e=>$.has(e)?`{{ ${$.get(e)} }}`:8===e.nodeType?`\x3c!--${e.data}--\x3e`:e.textContent).join(""))}O(9===n.nodeType?n.body:n);let i=document.createElement(b());i.setAttribute("version",e);let s=document.createElement("script");s.type="application/json",s.textContent=function(e){return JSON.stringify(e).replace(/[<>&\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(function(e){let t={};for(let l of Object.keys(e)){if("$"===l[0])continue;let n=Object.getOwnPropertyDescriptor(e,l);void 0!==n.get||void 0!==n.set||"function"==typeof n.value||(t[l]=n.value)}return t}(l.target)),i.append(s);for(let[e,t]of r){if(!e.isConnected)continue;let l=e.parentNode;for(;null!==l&&"svg"!==l.localName&&"foreignObject"!==l.localName;)l=l.parentElement;let n="svg"===l?.localName,o=`wcs-${n?"s":"t"}${R++}`;e.replaceWith(N(`wcs-p:${o}`));let r=document.importNode(u(t),!0);for(let e of Array.from(r.querySelectorAll("template")))"http://www.w3.org/2000/svg"===e.namespaceURI&&e.replaceWith(C(e,document.createElement("template"),...e.childNodes));if(n){let e=document.createElementNS(l.namespaceURI,"svg");e.append(r),r=e}let s=document.createElement("template");s.id=o,i.append(C(t,s,r))}t.before(i)}function U(e){!function(e){if(null!==e.querySelector(f.tagNames.state))for(let t of Array.from(e.querySelectorAll("input,textarea,select")))if("select"===t.localName){let e=Array.from(t.options);if(t.multiple||e.some(e=>e.hasAttribute("selected"))||e[t.selectedIndex]!==e.find(e=>!e.disabled))for(let t of e)t.toggleAttribute("selected",t.selected)}else"textarea"===t.localName?t.value!==t.defaultValue&&!t.value.includes("{{")&&!Array.from(t.childNodes).some(e=>$.has(e))&&(t.textContent=t.value):"checkbox"===t.type||"radio"===t.type?t.toggleAttribute("checked",t.checked):"password"!==t.type&&t.value!==t.defaultValue&&t.setAttribute("value",t.value)}(e);for(let t of Array.from(e.querySelectorAll(`${f.tagNames.state}[enable-ssr]`))){if(t.hasAttribute("mount")||t.hasAttribute("bind-component")||t.previousElementSibling?.localName===b())continue;let e=t.engine;null!=e&&z(t,e)}}var J=Symbol.for("wcstack.state.ssr.impl"),B=new Map,V=new WeakMap,L=e=>!0===d.Eo?.(e),X=e=>1===e.nodeType&&!D(e)&&!L(e),Z=e=>e.f.flat().concat(e.z??[]),H=e=>{for(let t of Z(e))t.remove()};function K(e,t,l){let n=/^wcs-\[(?::(\d+))?/.exec(e.data),o=e.previousSibling,r=e.parentNode,i=[],s=e.nextSibling;for(e.remove();null!==s&&!w(s,"wcs-]");){let e=s.nextSibling;if(w(s,"wcs-|"))i.push([]),s.remove();else{0===i.length&&i.push([]);let l=i[i.length-1];S(s,"wcs-[")?e=K(s,t,l):(l.push(s),X(s)&&Q(s,t))}s=e}let c={branch:void 0===n[1]?null:Number(n[1]),f:i,z:s??r.appendChild(N("wcs-]"))},u=Z(c);s=c.z.nextSibling;for(let e of u)l?.push(e),t&&a.add(e);return t&&null!==o?B.set(o,c):H(c),s}function Q(e,t){for(let l=e.firstChild;null!==l;)S(l,"wcs-[")?l=K(l,t):(X(l)&&Q(l,t),l=l.nextSibling)}function F(e,t,l){let n=e=>{for(let o of Array.from(e.childNodes))if(o.parentNode===e)if(8===o.nodeType){let e=o.data;try{if("wcs-s"===e)o.remove();else if("wcs-e"===e)o.replaceWith("");else if(e.startsWith("wcs-t:")){let t=N(`@@:${decodeURIComponent(e.slice(6))}`),l=o.nextSibling;for(;null!==l&&!w(l,"wcs-/t");){let e=l.nextSibling;l.remove(),l=e}l?.remove(),o.replaceWith(t)}else if(e.startsWith("wcs-p:")){let l=t.querySelector(`template[id="${e.slice(6)}"]`);if(null!==l){let t=o.parentNode,n="s"===e[10]?C(l,document.createElementNS(t.namespaceURI,"template"),...document.importNode(l.content.firstChild,!0).childNodes):document.importNode(l,!0);n.removeAttribute("id"),t.replaceChild(n,o)}}}catch{}}else 1===o.nodeType&&!D(o)&&(L(o)?V.set(o,{ssr:t,Te:l}):n(o))};n(e),function(e){for(let t of Array.from(e.querySelectorAll("table > tbody"))){let e=[];for(let l=t.previousSibling;null!==l&&(8===l.nodeType||oe(l)||"template"===l.localName);l=l.previousSibling)e.unshift(l);let l=0,n=0;if(e.forEach((e,t)=>{S(e,"wcs-[")?n++:w(e,"wcs-]")&&--n<0&&(n=0,l=t+1)}),0===n)continue;let o=0;for(let n=t.firstChild;null!==n;n=n.nextSibling)if(S(n,"wcs-["))o++;else if(w(n,"wcs-]")&&0===o--){t.prepend(...e.slice(l));break}}}(e),Q(e,l)}function G(e,t){let l=V.get(e);if(void 0===l)return null;V.delete(e);let n=e=>F(e,l.ssr,l.Te);if(l.Te||te(t,e,e,n),n(e),!l.Te)return null;let o=d.Te;return d.Te=se,()=>{d.Te=o,Y()}}function Y(){for(let e of B.values())H(e);B.clear()}function _(e){let t=[];for(let l=document.createTreeWalker(e,128);l.nextNode();)t.push(l.currentNode);return t}function ee(e,t,l,n){let o=null;for(let n of e){let e=n[l];null!==e&&(""===e||t===e||t.startsWith(`${e}.`))&&(null===o||e.length>o[l].length)&&(o=n)}let r=o?.[n];if(null==r)return null;let i=o[l],s=""===i?t:t.slice(i.length+1);return""===r?s:""===s?r:`${r}.${s}`}function te(e,t,l,n){let o=document.createElement("template").content;for(let e of l.childNodes)o.appendChild(o.ownerDocument.importNode(e,!0));n(o),e.root=t;let r=()=>{};c(e,[...o.childNodes],null,!0,r,r,r,(t,l)=>s(e,l,null,0))}function le(e,t,l){if(y()){if(l instanceof Array){for(let e=l.length;e-- >0;)r(l[e])&&l.splice(e,1);let e=t;if(l.some(i))T.add(e);else if(e.localName.includes("-")&&!L(e)){let t=new Map;for(let l=document.createTreeWalker(e,133);l.nextNode();)t.set(l.currentNode,l.currentNode.data);k.set(e,t)}return}if("string"==typeof l){if($.set(t,l),D(t.parentNode))return;let e=N(`wcs-t:${encodeURIComponent(l)}`),n=N("wcs-/t");return t.before(e),void t.after(n)}let n=A.get(e);void 0===n&&A.set(e,n=new Map),n.set(t,l);let o=t.getRootNode(),s=x.get(o);return void 0===s&&x.set(o,s=new Set),void s.add(e)}if("string"!=typeof l&&B.size>0){let e=B.get(l);void 0!==e&&(B.delete(l),B.set(t,e))}}var ne=e=>null!==e&&8===e.nodeType&&[f.commentIfPrefix,f.commentElseIfPrefix,f.commentElsePrefix].includes(e.data),oe=e=>3===e.nodeType&&""===e.data.trim(),re=e=>{let t=B.get(e)?.z??e;return(j(t)??t).nextSibling};function ie(e,t){if(t.length!==e.ln.childNodes.length)return!1;let l=e.Cn;for(let n=0;n<l.length;n++){let o=l[n],r=e.ln,i=t[o[0]];for(let e=0;;){if(r=r.childNodes[o[e]],i?.nodeName!==r.nodeName)return!1;if(++e===o.length)break;i=(j(i)??i).firstChild;for(let t=o[e];t>0&&null!==i;t--)i=re(i)}e.So[n]=i}return!0}function se(e,t,l){if(0===B.size)return null;let n=t,o=0;if(!l){let e=f.commentIfPrefix;if(!w(t,e))for(let l=t.previousSibling;null!==l&&1!==l.nodeType&&(ne(l)&&o++,!w(l,e));l=l.previousSibling);for(let l=t.nextSibling;!B.has(n)&&null!==l&&!w(l,e)&&1!==l.nodeType;l=l.nextSibling)ne(l)&&(n=l)}let r=B.get(n);if(void 0===r)return null;if(!l&&r.branch!==o)return B.delete(n),H(r),null;let i=r.f.shift();if(0===r.f.length&&B.delete(n),r.z?.replaceWith(...E(t,n)),r.z=null,void 0===i)return null;let s=[];for(let e=0;e<i.length;e++){let t=B.get(i[e]);if(s.push(i[e]),void 0!==t)for(;e<i.length&&i[e]!==t.z;)e++;else j(i[e])===i[e+1]&&e++}if(!ie(e,s)){let l=(e.Dn?e.root:e.ln).cloneNode(!0);s=e.Dn?[l]:[...l.childNodes],ie(e,s),(i[0]??r.f.find(e=>e.length>0)?.[0]??t).before(l);for(let e of i)e.remove()}return s}var ae={name:"ssr",hooks:d,install(){d.jn=le,d.hr=G;let t=d.element;d.element=(l,o)=>{"mounting"===o&&function(t){let l=t.element;if(!l.hasAttribute("enable-ssr")||y())return;let o=l.previousElementSibling,r=o?.localName===b(),i=r?o.getAttribute("version"):null,s=null===i||m(i)===m(e);if(s){let e=t,l=e.$e;e.$e=(e,n)=>"$connectedCallback"===e?void 0:l.call(t,e,n)}if(!r)return;let a=!s&&parseInt(i)<4,c=/^3\.(\d+)\.(\d+)$/.exec(i),u=null!==c&&(+c[1]-5||+c[2]-3)>=0;s||console.warn(`[@wcstack/state] <${b()} version="${i}"> does not match ${e}: its snapshot is discarded, and the page renders on the client from its own state.${a&&!u?" 3.x output keeps only the path of a text binding outside a template, so such a binding loses its filters: deploy @wcstack/server 4.0 with this client.":""}`);let p=s?o.querySelector('script[type="application/json"]'):null;if(null!==p){let e=JSON.parse(p.textContent||"{}"),l=t.target;for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(l,t);void 0!==n&&(void 0!==n.get||void 0!==n.set||"function"==typeof n.value)||(l[t]=e[t])}t.hydrated=!0}let h=l.getRootNode();for(let e of Array.from(h.querySelectorAll(`[${P}]`)))e.textContent=e.getAttribute(P),e.removeAttribute(P);let g=9===h.nodeType?h.body:h;o.remove();let v=e=>a?function(e,t,l){let o=new Map,r=e=>{let t=e.parentElement;for(;null!==t&&!L(t);)t=t.parentElement;if(null===t)return null;let l=o.get(t);if(void 0===l){let e=r(t),i=t.querySelector(`:scope > ${f.tagNames.state}[bind-component]`).getAttribute("bind-component");o.set(t,l=[]);for(let o of n(t.getAttribute(f.bindAttributeName)??"")){let t=o.Ze;o.Ne[0]===i&&l.push([e?ee(e,t,1,0):t,o.Ne.slice(1).join("."),e&&t])}}return l},i=(e,t,l)=>{let n=r(e);if(null===n)return t;let o=/^([^|]*)#m\d+\.([^|]*)$/.exec(t);if(null===o)return l?t:ee(n,t,0,1)??t;let i=o[1].replace(/#m\d+\./g,"").slice(0,-1);return n.some(e=>""===e[1]&&(e[0]===i||e[2]===i))?o[2]:ee(n,o[2],2,1)??o[2]};for(let t of _(e).reverse()){let e=/^@@wcs-(\w+)-start:([\s\S]*)/.exec(t.data);if(null===e)continue;let n=t.nextSibling;for(;null!==n&&!w(n,`@@wcs-${e[1]}-end:${e[2]}`);)n=n.nextSibling;if(null!==n){for(;t.nextSibling!==n;)t.nextSibling.remove();n.remove(),t.replaceWith(..."text"===e[1]?[N(`@@:${i(t,e[2],l)}`)]:[])}}let s=(e,l)=>{for(let n of _(e)){let e=/^@@wcs-(?:for|if|elseif|else):(\S+)$/.exec(n.data)?.[1],o=Array.from(t.querySelectorAll("template")).find(t=>t.id===e);if(void 0===o)continue;let r=document.importNode(o,!0),a=f.bindAttributeName;r.removeAttribute("id"),r.setAttribute(a,r.getAttribute(a).replace(/^(\s*\w+\s*:\s*)([^\s|]+)/,(e,t,o)=>t+i(l??n,o))),s(r.content,l??n);let c=r.content.firstChild;n.replaceWith(.../^\s*elseif\s*:/.test(c?.getAttribute?.(a)??"")?r.content.childNodes:[r])}};s(e);for(let t of Array.from(e.querySelectorAll("[data-wcs-ssr-id]")))t.removeAttribute("data-wcs-ssr-id")}(e,o,u):F(e,o,s);s||te(t,h,g,v),queueMicrotask(function(e){let t=[];for(let l of Array.from(e.querySelectorAll("input,textarea,select")))if("select"===l.localName){let e=Array.from(l.options),n=e.map(e=>e.selected),o=e.map(e=>e.hasAttribute("selected")),r=o.lastIndexOf(!0);r<0&&(r=e.findIndex(e=>!e.disabled)),(l.multiple?e.some((e,t)=>n[t]!==o[t]):l.selectedIndex!==r)&&t.push([l,()=>e.forEach((e,t)=>e.selected=n[t])])}else if("checkbox"===l.type||"radio"===l.type){let e=l.checked;e!==l.defaultChecked&&(e||"checkbox"===l.type)&&t.push([l,()=>l.checked=e])}else if("file"!==l.type&&l.value!==l.defaultValue){let e=l.value;t.push([l,()=>l.value=e])}return()=>{for(let[e,l]of t)e.isConnected&&(l(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}(g)),v(g),s&&(d.Te=se,queueMicrotask(()=>{Y(),d.Te=null}))}(l),t?.(l,o)},function(){let e=globalThis;e[J]={build:U,reset(){R=0}},void 0===e[v]&&(e[v]={protocol:"wcs-ssr-snapshot",version:1,build:t=>e[J].build(t),reset:()=>e[J].reset()})}(),d.Ao=p(d.Ao,g);for(let e of l())g(e)}},ce=ae;export{ce as default,ae as ssr};
|
|
1
|
+
import{a as e}from"../chunks/chunk-YIDHPXYQ.js";import{b as t,c as l}from"../chunks/chunk-LWRYFYOC.js";import"../chunks/chunk-J3PTKUWV.js";import{a as n,i as o,j as r,k as i,l as s,m as a,n as c,o as u}from"../chunks/chunk-47I6RYV3.js";import"../chunks/chunk-ISBASPV2.js";import"../chunks/chunk-SOFOV2OG.js";import{a as f}from"../chunks/chunk-FQUDP3XK.js";import"../chunks/chunk-TS2HEHBQ.js";import"../chunks/chunk-P3JKSHRN.js";import"../chunks/chunk-EBIQH2HE.js";import{a as d,b as p}from"../chunks/chunk-BCL75PFH.js";var m=e=>e.split(".").slice(0,2).join("."),h=class extends t{static find(e){return e.querySelector?.(f.tagNames.ssr)??null}get version(){return this.getAttribute("version")??""}get stateData(){let e=this.querySelector('script[type="application/json"]');return null===e?{}:JSON.parse(e.textContent||"{}")}get templates(){let e=new Map;for(let t of Array.from(this.children))"template"===t.localName&&e.set(t.id,t);return e}get hydrateProps(){return{}}getTemplate(e){return this.templates.get(e)??null}verifyVersion(){return m(this.version)===m(e)}};function g(e){let t=f.tagNames.ssr;void 0===e.get(t)&&e.define(t,class extends h{})}var b=()=>f.tagNames.ssr,v=Symbol.for("wcstack.ssr.snapshotBuilder"),y=()=>!0===document.documentElement?.hasAttribute("data-wcs-server"),w=e=>document.createComment(e),N=(e,t)=>null!==e&&8===e.nodeType&&e.data===t,S=(e,t)=>null!==e&&8===e.nodeType&&e.data.startsWith(t),A=new WeakMap,x=new WeakMap,k=new WeakMap,T=new WeakSet,$=new WeakMap;function j(e,t){let l=[];for(let n=e;null!==n&&(l.push(n),n!==t);n=n.nextSibling);return l}function C(e,t,...l){for(let l of Array.from(e.attributes))t.setAttribute(l.name,l.value);return(t.content??t).append(...l),t}var E=e=>{let t=e.nextSibling;return 1!==e.nodeType||"a"!==t?.localName||!t.hasAttribute("data-wcs-ssr-link")&&e.anchorElement!==t?null:t};function W(e,t,l,n){let o=w(null===n?"wcs-[":`wcs-[:${n}`),r=w("wcs-]");l.length>0&&l[0].Re().before(...j(e,t)),t.after(o);for(let e of l)null===n&&e.Re().before(w("wcs-|"));let i=l.length>0?(e=>null===e.L?e.ct:e.L[e.L.length-1])(l[l.length-1]):o;(E(i)??i).after(r);for(let e of j(o,r))T.add(e)}function q(e){if(e instanceof o){W(e.S,e.S,e.Ae,null);for(let t of e.Ae)I(t);return}let t=e.I;null!==t&&(W(e.q[e.y].S,e.q[e.q.length-1].S,[t],e.y),I(t))}function I(e){if(null!==e.u)for(let t of e.u)q(t)}var O=new Set(["script","style","template","textarea","title"]),M="data-wcs-raw",P=e=>O.has(e.localName)||e.localName===b();function R(e){for(let t of Array.from(e.childNodes))3===t.nodeType?""===t.data?t.replaceWith(w("wcs-e")):null!==t.nextSibling&&3===t.nextSibling.nodeType&&t.after(w("wcs-s")):1===t.nodeType&&!P(t)&&R(t)}var z=0;function V(t,l){let n=t.getRootNode(),o=[l];for(let e of x.get(n)??[])e!==l&&!0===e.element?.hasAttribute("bind-component")&&o.push(e);let r=new Map;for(let e of o){let t=A.get(e);if(void 0===t)continue;let l=new Map;for(let t of e.oe.values())if(null!==t.N&&l.set(t.N.S,t.N),null!==t.W)for(let e of t.W)l.set(e.S,e);for(let t of e.ue.values())for(let e of t)if(null!==e.j)for(let t of e.j.q)l.set(t.S,e.j);let n=new Set;for(let[e,o]of t){r.set(e,o);let t=l.get(e);void 0!==t&&!n.has(t)&&e.isConnected&&(n.add(t),q(t))}}for(let e of Array.from(n.querySelectorAll("*"))){let t=k.get(e);if(void 0!==t){let l=document.createTreeWalker(e,133,{acceptNode:e=>T.has(e)||1===e.nodeType&&t.has(e)&&J(e)?2:1}),n=[];for(let e=l.nextNode();null!==e;e=l.nextNode()){let l=e.previousSibling;(3===e.nodeType?e.data.includes("{{")&&!(P(e.parentNode)?$.has(e):t.has(l)&&S(l,"wcs-t:"))&&($.has(e)||t.get(e)!==e.data):!t.has(e))&&n.push(e)}for(let e of n)e.remove()}let l=Array.from(e.childNodes);P(e)&&l.some(e=>$.has(e))&&e.setAttribute(M,l.map(e=>$.has(e)?`{{ ${$.get(e)} }}`:8===e.nodeType?`\x3c!--${e.data}--\x3e`:e.textContent).join(""))}R(9===n.nodeType?n.body:n);let i=document.createElement(b());i.setAttribute("version",e);let s=document.createElement("script");s.type="application/json",s.textContent=function(e){return JSON.stringify(e).replace(/[<>&\u2028\u2029]/g,e=>`\\u${e.charCodeAt(0).toString(16).padStart(4,"0")}`)}(function(e){let t={};for(let l of Object.keys(e)){if("$"===l[0])continue;let n=Object.getOwnPropertyDescriptor(e,l);void 0!==n.get||void 0!==n.set||"function"==typeof n.value||(t[l]=n.value)}return t}(l.target)),i.append(s);for(let[e,t]of r){if(!e.isConnected)continue;let l=e.parentNode;for(;null!==l&&"svg"!==l.localName&&"foreignObject"!==l.localName;)l=l.parentElement;let n="svg"===l?.localName,o=`wcs-${n?"s":"t"}${z++}`;e.replaceWith(w(`wcs-p:${o}`));let r=document.importNode(u(t),!0);for(let e of Array.from(r.querySelectorAll("template")))"http://www.w3.org/2000/svg"===e.namespaceURI&&e.replaceWith(C(e,document.createElement("template"),...e.childNodes));if(n){let e=document.createElementNS(l.namespaceURI,"svg");e.append(r),r=e}let s=document.createElement("template");s.id=o,i.append(C(t,s,r))}t.before(i)}function D(e){!function(e){if(null!==e.querySelector(f.tagNames.state))for(let t of Array.from(e.querySelectorAll("input,textarea,select")))if("select"===t.localName){let e=Array.from(t.options);if(t.multiple||e.some(e=>e.hasAttribute("selected"))||e[t.selectedIndex]!==e.find(e=>!e.disabled))for(let t of e)t.toggleAttribute("selected",t.selected)}else"textarea"===t.localName?t.value!==t.defaultValue&&!t.value.includes("{{")&&!Array.from(t.childNodes).some(e=>$.has(e))&&(t.textContent=t.value):"checkbox"===t.type||"radio"===t.type?t.toggleAttribute("checked",t.checked):"password"!==t.type&&t.value!==t.defaultValue&&t.setAttribute("value",t.value)}(e);for(let t of Array.from(e.querySelectorAll(`${f.tagNames.state}[enable-ssr]`))){if(t.hasAttribute("mount")||t.hasAttribute("bind-component")||t.previousElementSibling?.localName===b())continue;let e=t.engine;null!=e&&V(t,e)}}var H=Symbol.for("wcstack.state.ssr.impl"),U=new Map,B=new WeakMap,J=e=>!0===d.Eo?.(e),L=e=>1===e.nodeType&&!P(e)&&!J(e),Y=e=>e.f.flat().concat(e.z??[]),F=e=>{for(let t of Y(e))t.remove()};function Q(e,t,l){let n=/^wcs-\[(?::(\d+))?/.exec(e.data),o=e.previousSibling,r=e.parentNode,i=[],s=e.nextSibling;for(e.remove();null!==s&&!N(s,"wcs-]");){let e=s.nextSibling;if(N(s,"wcs-|"))i.push([]),s.remove();else{0===i.length&&i.push([]);let l=i[i.length-1];S(s,"wcs-[")?e=Q(s,t,l):(l.push(s),L(s)&&K(s,t))}s=e}let c={branch:void 0===n[1]?null:Number(n[1]),f:i,z:s??r.appendChild(w("wcs-]"))},u=Y(c);s=c.z.nextSibling;for(let e of u)l?.push(e),t&&a.add(e);return t&&null!==o?U.set(o,c):F(c),s}function K(e,t){for(let l=e.firstChild;null!==l;)S(l,"wcs-[")?l=Q(l,t):(L(l)&&K(l,t),l=l.nextSibling)}function X(e,t,l){let n=e=>{for(let o of Array.from(e.childNodes))if(o.parentNode===e)if(8===o.nodeType){let e=o.data;try{if("wcs-s"===e)o.remove();else if("wcs-e"===e)o.replaceWith("");else if(e.startsWith("wcs-t:")){let t=w(`@@:${decodeURIComponent(e.slice(6))}`),l=o.nextSibling;for(;null!==l&&!N(l,"wcs-/t");){let e=l.nextSibling;l.remove(),l=e}l?.remove(),o.replaceWith(t)}else if(e.startsWith("wcs-p:")){let l=t.querySelector(`template[id="${e.slice(6)}"]`);if(null!==l){let t=o.parentNode,n="s"===e[10]?C(l,document.createElementNS(t.namespaceURI,"template"),...document.importNode(l.content.firstChild,!0).childNodes):document.importNode(l,!0);n.removeAttribute("id"),t.replaceChild(n,o)}}}catch{}}else 1===o.nodeType&&!P(o)&&(J(o)?B.set(o,{ssr:t,Te:l}):n(o))};n(e),function(e){for(let t of Array.from(e.querySelectorAll("table > tbody"))){let e=[];for(let l=t.previousSibling;null!==l&&(8===l.nodeType||oe(l)||"template"===l.localName);l=l.previousSibling)e.unshift(l);let l=0,n=0;if(e.forEach((e,t)=>{S(e,"wcs-[")?n++:N(e,"wcs-]")&&--n<0&&(n=0,l=t+1)}),0===n)continue;let o=0;for(let n=t.firstChild;null!==n;n=n.nextSibling)if(S(n,"wcs-["))o++;else if(N(n,"wcs-]")&&0===o--){t.prepend(...e.slice(l));break}}}(e),K(e,l)}function G(e,t){let l=B.get(e);if(void 0===l)return null;B.delete(e);let n=e=>X(e,l.ssr,l.Te);if(l.Te||te(t,e,e,n),n(e),!l.Te)return null;let o=d.Te;return d.Te=se,()=>{d.Te=o,Z()}}function Z(){for(let e of U.values())F(e);U.clear()}function _(e){let t=[];for(let l=document.createTreeWalker(e,128);l.nextNode();)t.push(l.currentNode);return t}function ee(e,t,l,n){let o=null;for(let n of e){let e=n[l];null!==e&&(""===e||t===e||t.startsWith(`${e}.`))&&(null===o||e.length>o[l].length)&&(o=n)}let r=o?.[n];if(null==r)return null;let i=o[l],s=""===i?t:t.slice(i.length+1);return""===r?s:""===s?r:`${r}.${s}`}function te(e,t,l,n){let o=document.createElement("template").content;for(let e of l.childNodes)o.appendChild(o.ownerDocument.importNode(e,!0));n(o),e.root=t;let r=()=>{};c(e,[...o.childNodes],null,!0,r,r,r,(t,l)=>s(e,l,null,0))}function le(e,t,l){if(y()){if(l instanceof Array){for(let e=l.length;e-- >0;)r(l[e])&&l.splice(e,1);let e=t;if(l.some(i))T.add(e);else if(e.localName.includes("-")&&!J(e)){let t=new Map;for(let l=document.createTreeWalker(e,133);l.nextNode();)t.set(l.currentNode,l.currentNode.data);k.set(e,t)}return}if("string"==typeof l){if($.set(t,l),P(t.parentNode))return;let e=w(`wcs-t:${encodeURIComponent(l)}`),n=w("wcs-/t");return t.before(e),void t.after(n)}let n=A.get(e);void 0===n&&A.set(e,n=new Map),n.set(t,l);let o=t.getRootNode(),s=x.get(o);return void 0===s&&x.set(o,s=new Set),void s.add(e)}if("string"!=typeof l&&U.size>0){let e=U.get(l);void 0!==e&&(U.delete(l),U.set(t,e))}}var ne=e=>null!==e&&8===e.nodeType&&[f.commentIfPrefix,f.commentElseIfPrefix,f.commentElsePrefix].includes(e.data),oe=e=>3===e.nodeType&&""===e.data.trim(),re=e=>{let t=U.get(e)?.z??e;return(E(t)??t).nextSibling};function ie(e,t){if(t.length!==e.ln.childNodes.length)return!1;let l=e.Cn;for(let n=0;n<l.length;n++){let o=l[n],r=e.ln,i=t[o[0]];for(let e=0;;){if(r=r.childNodes[o[e]],i?.nodeName!==r.nodeName)return!1;if(++e===o.length)break;i=(E(i)??i).firstChild;for(let t=o[e];t>0&&null!==i;t--)i=re(i)}e.So[n]=i}return!0}function se(e,t,l){if(0===U.size)return null;let n=t,o=0;if(!l){let e=f.commentIfPrefix;if(!N(t,e))for(let l=t.previousSibling;null!==l&&1!==l.nodeType&&(ne(l)&&o++,!N(l,e));l=l.previousSibling);for(let l=t.nextSibling;!U.has(n)&&null!==l&&!N(l,e)&&1!==l.nodeType;l=l.nextSibling)ne(l)&&(n=l)}let r=U.get(n);if(void 0===r)return null;if(!l&&r.branch!==o)return U.delete(n),F(r),null;let i=r.f.shift();if(0===r.f.length&&U.delete(n),r.z?.replaceWith(...j(t,n)),r.z=null,void 0===i)return null;let s=[];for(let e=0;e<i.length;e++){let t=U.get(i[e]);if(s.push(i[e]),void 0!==t)for(;e<i.length&&i[e]!==t.z;)e++;else E(i[e])===i[e+1]&&e++}if(!ie(e,s)){let l=(e.jn?e.root:e.ln).cloneNode(!0);s=e.jn?[l]:[...l.childNodes],ie(e,s),(i[0]??r.f.find(e=>e.length>0)?.[0]??t).before(l);for(let e of i)e.remove()}return s}var ae={name:"ssr",hooks:d,install(){d.Dn=le,d.hr=G;let t=d.element;d.element=(l,o)=>{"mounting"===o&&function(t){let l=t.element;if(!l.hasAttribute("enable-ssr")||y())return;let o=l.previousElementSibling,r=o?.localName===b(),i=r?o.getAttribute("version"):null,s=null===i||m(i)===m(e);if(s){let e=t,l=e.$e;e.$e=(e,n)=>"$connectedCallback"===e?void 0:l.call(t,e,n)}if(!r)return;let a=!s&&parseInt(i)<4,c=/^3\.(\d+)\.(\d+)$/.exec(i),u=null!==c&&(+c[1]-5||+c[2]-3)>=0;s||console.warn(`[@wcstack/state] <${b()} version="${i}"> does not match ${e}: its snapshot is discarded, and the page renders on the client from its own state.${a&&!u?" 3.x output keeps only the path of a text binding outside a template, so such a binding loses its filters: deploy @wcstack/server 4.0 with this client.":""}`);let p=s?o.querySelector('script[type="application/json"]'):null;if(null!==p){let e=JSON.parse(p.textContent||"{}"),l=t.target;for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(l,t);void 0!==n&&(void 0!==n.get||void 0!==n.set||"function"==typeof n.value)||(l[t]=e[t])}t.hydrated=!0}let h=l.getRootNode();for(let e of Array.from(h.querySelectorAll(`[${M}]`)))e.textContent=e.getAttribute(M),e.removeAttribute(M);let g=9===h.nodeType?h.body:h;o.remove();let v=e=>a?function(e,t,l){let o=new Map,r=e=>{let t=e.parentElement;for(;null!==t&&!J(t);)t=t.parentElement;if(null===t)return null;let l=o.get(t);if(void 0===l){let e=r(t),i=t.querySelector(`:scope > ${f.tagNames.state}[bind-component]`).getAttribute("bind-component");o.set(t,l=[]);for(let o of n(t.getAttribute(f.bindAttributeName)??"")){let t=o.Ze;o.Ne[0]===i&&l.push([e?ee(e,t,1,0):t,o.Ne.slice(1).join("."),e&&t])}}return l},i=(e,t,l)=>{let n=r(e);if(null===n)return t;let o=/^([^|]*)#m\d+\.([^|]*)$/.exec(t);if(null===o)return l?t:ee(n,t,0,1)??t;let i=o[1].replace(/#m\d+\./g,"").slice(0,-1);return n.some(e=>""===e[1]&&(e[0]===i||e[2]===i))?o[2]:ee(n,o[2],2,1)??o[2]};for(let t of _(e).reverse()){let e=/^@@wcs-(\w+)-start:([\s\S]*)/.exec(t.data);if(null===e)continue;let n=t.nextSibling;for(;null!==n&&!N(n,`@@wcs-${e[1]}-end:${e[2]}`);)n=n.nextSibling;if(null!==n){for(;t.nextSibling!==n;)t.nextSibling.remove();n.remove(),t.replaceWith(..."text"===e[1]?[w(`@@:${i(t,e[2],l)}`)]:[])}}let s=(e,l)=>{for(let n of _(e)){let e=/^@@wcs-(?:for|if|elseif|else):(\S+)$/.exec(n.data)?.[1],o=Array.from(t.querySelectorAll("template")).find(t=>t.id===e);if(void 0===o)continue;let r=document.importNode(o,!0),a=f.bindAttributeName;r.removeAttribute("id"),r.setAttribute(a,r.getAttribute(a).replace(/^(\s*\w+\s*:\s*)([^\s|]+)/,(e,t,o)=>t+i(l??n,o))),s(r.content,l??n);let c=r.content.firstChild;n.replaceWith(.../^\s*elseif\s*:/.test(c?.getAttribute?.(a)??"")?r.content.childNodes:[r])}};s(e);for(let t of Array.from(e.querySelectorAll("[data-wcs-ssr-id]")))t.removeAttribute("data-wcs-ssr-id")}(e,o,u):X(e,o,s);s||te(t,h,g,v),queueMicrotask(function(e){let t=[];for(let l of Array.from(e.querySelectorAll("input,textarea,select")))if("select"===l.localName){let e=Array.from(l.options),n=e.map(e=>e.selected),o=e.map(e=>e.hasAttribute("selected")),r=o.lastIndexOf(!0);r<0&&(r=e.findIndex(e=>!e.disabled)),(l.multiple?e.some((e,t)=>n[t]!==o[t]):l.selectedIndex!==r)&&t.push([l,()=>e.forEach((e,t)=>e.selected=n[t])])}else if("checkbox"===l.type||"radio"===l.type){let e=l.checked;e!==l.defaultChecked&&(e||"checkbox"===l.type)&&t.push([l,()=>l.checked=e])}else if("file"!==l.type&&l.value!==l.defaultValue){let e=l.value;t.push([l,()=>l.value=e])}return()=>{for(let[e,l]of t)e.isConnected&&(l(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))}}(g)),v(g),s&&(d.Te=se,queueMicrotask(()=>{Z(),d.Te=null}))}(l),t?.(l,o)},function(){let e=globalThis;e[H]={build:D,reset(){z=0}},void 0===e[v]&&(e[v]={protocol:"wcs-ssr-snapshot",version:1,build:t=>e[H].build(t),reset:()=>e[H].reset()})}(),d.Ao=p(d.Ao,g);for(let e of l())g(e)}},ce=ae;export{ce as default,ae as ssr};
|
|
2
2
|
//# sourceMappingURL=ssr.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as t,c as e}from"../chunks/chunk-
|
|
1
|
+
import{a as t,c as e}from"../chunks/chunk-TS2HEHBQ.js";import{a as n,b as r,c as i,d as s,e as l,j as a,k as o}from"../chunks/chunk-BCL75PFH.js";var h={},f=/\.\d/,u=new Set(Object.getOwnPropertyNames(Object.prototype)),c=0,d=!1,p=null,m=()=>{d=!1,c++};function g(){if(null===p)if("function"==typeof MessageChannel){let t=new MessageChannel;t.port1.onmessage=m,t.port1.unref?.(),p=()=>t.port2.postMessage(0)}else p=()=>setTimeout(m,0);return d||(d=!0,p()),c}function y(t,e){let n=new Set,r=[t];for(;r.length>0;){let t=r.pop();if(!n.has(t)){n.add(t);for(let n of t.Q){for(let r of e)if(n.ee(r)&&(n.n===r.n||!(r.n<t.n&&t.h[r.n+1].ee(r))))return!0;null!==n.getter&&r.push(n)}}}return!1}var v=class{constructor(t,e){this.active=!1,this.Fe=new Map,this.early=[],this.n=0,this.Fo=-1,this.Wn=new Set,this.Ke=null,this.engine=t,this.je=e}ur(){let t=this.engine;this.Fe.clear();let e=this.early;this.early=[];for(let e of this.je)e.getter=null!==e.p.getter||e.p.ae,e.s=new WeakMap,this.prime(e,()=>{0===e.p.n?e.getter&&e.s.set(h,t.v(e.p,null)):this.Mn(e.p,1,null,n=>{e.getter&&this.prime(e,()=>e.s.set(n,t.v(e.p,n)))})});this.active=!0;let n=new Set;for(let[r,i,s,l]of e)if((null===i||i.w)&&Object.is(t.v(r,i),l)){n.add(r);for(let t of this.je)t.p===r&&this.dt(t,i,s,!0)}for(let t of this.je)t.getter&&0===t.p.n&&!this.Fe.has(t)&&y($(t.p),n)&&this.dt(t,null,void 0,!0);this.Fe.size>0&&t.ve()}prime(t,e){try{e()}catch(e){o(e,`[@wcstack/state] $watch initial evaluation of "${t.t}" threw.`),n.at?.(this.engine,{type:"state:watch-error",phase:"prime",path:t.t,error:e})}}Oo(){this.active=!1,this.Fe.clear(),this.early=[]}Mn(t,e,n,r){let i=this.engine.Ue(n,t.h[e]);for(let n of i.f)e===t.n?r(n):this.Mn(t,e+1,n,r)}dt(t,e,n,r){let i=this.Fe.get(t);void 0===i&&this.Fe.set(t,i=new Map);let s=i.get(e);void 0===s?i.set(e,[n,this.n,r]):(s[1]<this.n&&(s[1]=this.n),s[2]||=r)}re(t,e,n,r,i,s){if(this.active){(this.Ke??=new Set).add(t);for(let s of this.je){let l=s.p;l.n!==t.n||!l.ee(t)||this.dt(s,e,s.getter?s.s.get(e??h):l===t&&i&&this.engine._t&&(null===r||"object"!=typeof r&&"function"!=typeof r)?n:void 0,!0)}}else s&&this.early.push([t,e,n,r])}Se(t,e){if(this.active)for(let n of this.je)(n.getter||=null!==n.p.getter||n.p.ae)&&n.p.n===t.n&&n.p.ee(t)&&this.dt(n,e,n.s.get(e??h),!1)}Qt(t,e){if(!this.active)return;let n=null;for(let r of this.je){let i=r.p;if(!(i.n<t.n||i.h[t.n]!==t.o)){n??=new Set(e);for(let e of t.f)n.has(e)||(i.n===t.n?this.dt(r,e,void 0,!0):this.Mn(i,t.n+1,e,t=>this.dt(r,t,void 0,!0)))}}}me(){let t=this.Ke;if(this.Ke=null,!this.active||0===this.Fe.size)return;let e=this.Fe;this.Fe=new Map;let r=this.engine,i=[];for(let s of this.je){let l=e.get(s);if(void 0===l)continue;let a,u=[...l].filter(([t])=>null===t||t.w);u.length>1&&u.sort((t,e)=>w(t[0],e[0]));for(let[e,[l,c,d]]of u){let u,p="evaluate",m=r.d;this.n=c+1,r.Ce++;try{if(u=r.v(s.p,e),s.getter&&(s.s.set(e??h,u),Object.is(u,l)&&(f.test(s.t)||null!==e&&!d&&!(a??=null!==t&&y($(s.p),t)))))continue;if(c>32){i.includes(s.t)||i.push(s.t);continue}r.d=e,n.at?.(r,{type:"state:watch-fired",path:s.t}),p="handler",s.handler.call(r.proxy,u,l,...r.H(e))}catch(t){o(t,`[@wcstack/state] $watch "${s.t}" failed; the other watches still run.`),n.at?.(r,{type:"state:watch-error",phase:p,path:s.t,error:t})}finally{r.d=m,this.n=0,r.Ce--}}}i.length>0&&this.Co(i)}Co(t){let e=g();e!==this.Fo&&(this.Fo=e,this.Wn.clear());let r=t.filter(t=>!this.Wn.has(t));if(0!==r.length){for(let t of r)this.Wn.add(t);o("[@wcstack/state] $watch handlers / $stream restarts kept writing for 32 batches; the chain is cut (nothing is rolled back)."),n.at?.(this.engine,{type:"state:watch-chain-limit",maxDepth:32,paths:r})}}};function $(t){for(;null===t.getter&&null!==t.c;)t=t.c;return t}function w(t,e){let n=[],r=[];for(let e=t;null!==e;e=e.l.ce)n.unshift(e.y);for(let t=e;null!==t;t=t.l.ce)r.unshift(t.y);for(let t=0;t<n.length&&t<r.length;t++)if(n[t]!==r[t])return n[t]-r[t];return n.length-r.length}var b="$streamStatus",j="$streamError",M=new Set(Object.getOwnPropertyNames(Object.prototype)),O=!1;function S(t,e){for(let n=t;null!==n&&n!==Object.prototype;n=Object.getPrototypeOf(n)){let t=Object.getOwnPropertyDescriptor(n,e);if(void 0!==t)return void 0!==t.get||void 0!==t.set||"function"==typeof t.value}return!1}var k=class{constructor(t,e,n){this.engine=t,this.entries=e,this.M=n}set(t,e,n){O=!0;try{this.engine.A(this.engine.o(`${t}.${e}`),null,n)}finally{O=!1}}dr(){for(let t of this.entries)this.start(t,!0)}fr(){for(let t of this.entries)t.ft=!1,t.J?.abort(),t.J=null}pr(){for(let t of this.entries)t.ft=!1,null!==t.J&&(t.J.abort(),t.J=null),this.set(b,t.name,"idle")}Se(t){let e=this.M.n;for(let n of this.entries)n.g===t&&(n.n=n.ft?Math.max(n.n,e):e,n.ft=!0)}me(){let t=this.engine,n=this.M,r=[];for(let i of this.entries){if(!i.ft)continue;let s=i.n;if(i.ft=!1,s>32)r.push(i.name),i.g.Y=e;else{n.n=s+1,t.Ce++;try{this.start(i,!1)}finally{t.Ce--,n.n=0}}}r.length>0&&n.Co(r)}start(t,n){let r,i=this.engine;if(null!==t.J&&t.J.abort(),t.J=null,null!==t.g){let s=t.g;s.getter=t.args;let l=s.Q.slice();J(s);try{r=i.read(s,null),function(t,e,n){null!==n&&"function"==typeof n?.then&&a(`$stream "${t}": args must be synchronous (it returned a Promise).`);for(let n of e.Q)n.n>0&&a(`$stream "${t}": args must not read a wildcard path ("${n.t}").`),(n.t===t||n.t===`${b}.${t}`||n.t===`${j}.${t}`)&&a(`$stream "${t}": args must not read the stream itself ("${n.t}").`)}(t.name,s,r)}catch(r){J(s);for(let t of l)t._n(s);if(s.Y=e,n)throw r;return this.set(j,t.name,r),void this.set(b,t.name,"error")}}let s=new AbortController;t.J=s,i.A(i.o(t.name),null,t.K),this.set(j,t.name,null),this.set(b,t.name,"active"),this.mr(t,s,r)}async mr(t,e,n){let r=this.engine,i=e.signal,s=()=>!i.aborted&&t.J===e,l=r.o(t.name),a=this.M.n,o=g(),h=t=>{g()===o&&(this.M.n=a);try{t()}finally{this.M.n=0}},f=t.K;try{let e=await t.source(n,i);if(!s())return;let a=e=>{f=void 0!==t.Io?t.Io(f,e):e,h(()=>r.A(l,null,f))};if(null!==e&&"function"==typeof e?.getReader){let t=e.getReader();for(i.addEventListener("abort",()=>{t.cancel().catch(()=>{})});;){let e=await t.read();if(!s())return;if(e.done)break;a(e.value)}}else{if(null===e||"function"!=typeof e?.[Symbol.asyncIterator])throw new TypeError(`$stream "${t.name}": source must return an async iterable or a ReadableStream`);{let t=e[Symbol.asyncIterator]();for(i.addEventListener("abort",()=>{t.return?.()});;){let e=await t.next();if(!s())return;if(e.done)break;a(e.value)}}}if(!s())return;t.J=null,h(()=>this.set(b,t.name,"done"))}catch(n){if(!s())return;t.J=null,e.abort(),h(()=>{this.set(j,t.name,n),this.set(b,t.name,"error")})}}};function J(e){for(let t of e.Q){let n=t.B.indexOf(e);n>=0&&t.B.splice(n,1),t.ht.delete(e)}e.Q.length=0,e.Y=t}var F=new WeakMap;function I(t){let e=F.get(t);return e?.target===t.target?e:void 0}function C(t,e){let r=new v(t,function(t,e){if(void 0===e)return[];(null===e||"object"!=typeof e)&&a("$watch must be an object mapping paths to handler functions.");let r=[];for(let i of Object.keys(e)){let s=e[i];(""===i||"$"===i[0]||i.includes("@")||u.has(i))&&a(`$watch path "${i}" is not a path of the state tree.`),"function"!=typeof s&&a(`$watch entry "${i}" must be a function.`);let l=t.o(i);n.$o?.(t,l,!0),r.push({t:i,p:l,handler:s,getter:!1,s:new WeakMap})}return r}(t,e.$watch)),i=new k(t,function(t,e){let n=e.$stream;if(void 0===n)return[];(null===n||"object"!=typeof n)&&a("$stream must be an object mapping stream names to definitions.");let r=[],i={},s={};for(let l of Object.keys(n)){let o=n[l];(""===l||"$"===l[0]||/[.*]/.test(l)||M.has(l))&&a(`$stream entry "${l}" must be a flat property name.`),(null===o||"object"!=typeof o)&&a(`$stream entry "${l}" must be an object.`);let h=o.source,f=o.fold,u=o.args,c=o.initial;"function"!=typeof h&&a(`$stream entry "${l}" needs a source function.`),void 0!==f&&"function"!=typeof f&&a(`$stream entry "${l}": fold must be a function.`),void 0!==f&&!("initial"in o)&&a(`$stream entry "${l}": fold needs an initial value.`),void 0!==u&&"function"!=typeof u&&a(`$stream entry "${l}": args must be a function.`),S(e,l)&&a(`$stream entry "${l}" collides with a getter, setter or method of the state.`),void 0===e[l]&&(e[l]=c),i[l]="idle",s[l]=null,r.push({name:l,source:h,Io:f,K:c,J:null,ft:!1,n:0,g:void 0===u?null:t.o(`$streamArgs.${l}`),args:void 0===u?null:function(){return u(this)}})}return e[b]=i,e[j]=s,r}(t,e),r),s=F.get(t);void 0!==s&&(s.M.Oo(),s.It.fr()),F.set(t,{M:r,It:i,Je:s?.Je??!1,target:e})}function Q(t,e){let n=F.get(t);if(void 0!==n&&"mounting"!==e&&!document.documentElement?.hasAttribute("data-wcs-server")&&("reset"!==e&&(n.Je="connected"===e),n.target===t.target)){if("disconnected"===e)return n.M.Oo(),void n.It.pr();n.Je&&(n.M.ur(),n.It.dr())}}var A=["$streamStatus","$streamError"],E={name:"temporal",hooks:n,install(){n.fe=r(n.fe,C),n.element=r(n.element,Q),n.re=r(n.re,(t,e,n,r,i,s,l)=>I(t)?.M.re(e,n,r,i,s,l)),n.Se=r(n.Se,(t,e,n)=>{let r=I(t);void 0!==r&&(r.M.Se(e,n),r.It.Se(e))}),n.Qt=r(n.Qt,(t,e,n)=>I(t)?.M.Qt(e,n)),n.me=r(n.me,t=>{let e=I(t);void 0!==e&&(e.M.me(),e.It.me())}),n.rt=i(l,n.rt,(t,e)=>{let n=e.split(".",1)[0];if(A.includes(n))return n===e?t.target[e]:t.read(t.o(e),null)}),n.Ie=i(s,n.Ie,(t,e)=>(!O&&36===e.t.charCodeAt(0)&&A.includes(e.t.split(".",1)[0])&&a(`"${e.t}" is read-only (the stream runtime owns it).`),!1))}},K=E;export{K as default,E as temporal};
|
|
2
2
|
//# sourceMappingURL=temporal.js.map
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{l as e}from"./chunk-IBGHHABS.js";import{a as t,d as n,e as l,j as i,k as r}from"./chunk-T3KW5DZD.js";import{a as s,g as o}from"./chunk-P3EXTBXC.js";import{a as u}from"./chunk-NITPUCPA.js";import{a,b as h,c,d as f,e as d,f as m,g as p,h as g,i as v,j as b,k as w,l as x,n as y}from"./chunk-PKEAYPFR.js";import{a as N,b as S}from"./chunk-DRSAQE4E.js";import{a as C,k as A}from"./chunk-BCL75PFH.js";var k=new Map,T=new Set(["if","elseif","else","for"]),j=new Set([a,"if","elseif","for","..."]),P=new Set([d,m,p,f,h,c]);function E(e){let t=function(e){return w(e,";")}(e).map(v).filter(e=>e.length>0).map(e=>{let t=b(e,":");-1===t&&S(101,[e]);let n=e.slice(0,t).trim(),l=e.slice(t+1).trim(),i=n.split("#")[0].split("|")[0].trim();if(j.has(i)){let t;return i!==n&&S(102,[e,i]),i===a?(l.length>0&&S(103,[e]),t={Ze:"#else",et:[]}):"..."===i?(0===l.length&&S(104,[e]),t=y(l),t.et.length>0&&S(105,[e])):(t=y(l),"for"===i&&t.et.length>0&&S(121,[e])),{Ee:i,Ne:[i],rn:[],j:[],...t,b:"..."===i?"spread":i}}(i===d||i===m)&&S(122,[e,i]);let r=y(l),s=function(e){let[t,n]=x(e,"input",k),l=t.split("#").map(v);l.length>2&&S(115,[t]);let[i,r]=l,s=i.split(".").map(v);return!(s.length>1&&""===s[0])&&(0===i.length||s.some(e=>0===e.length))&&S(116,[e]),{Ee:i,Ne:s,rn:r?r.split(",").map(v):[],j:n}}(n),[o]=s.Ne;if(""===o&&s.Ne.length>1){let e=s.Ne.slice(1);return(e.includes("")||P.has(e[0]))&&S(106,[n]),{...s,Ee:e.join("."),Ne:e,...r,b:"prop"}}return{...s,...r,b:"radio"===i||"checkbox"===i?i:o===h||o.startsWith("on")?"event":"prop"}});return t.length>1&&t.some(e=>T.has(e.b))&&S(201,[e]),t}function L(e,t){if(null!==e)for(let n=0;n<e.length;n++)t=e[n](t);return t}function I(t){return 0===t.length?null:(e(),t.map(e=>o(e.Hn,e.args,e.literals)))}var R=Symbol.for("wcstack.state.view-transition-naming"),F=new WeakSet;function K(){let e=t("state");return null!==e&&"auto"===e.naming?e.namingLimit:-1}var q=new Set(["click","dblclick","input","change","submit","keydown","keyup","mousedown","mouseup","pointerdown","pointerup"]),M=0,$=2,O=3,D=4,W=5,B=["text","prop","prop","prop","prop","event","for","if","prop","radio","checkbox","prop","prop","event","spread"],X=(e,t,n,l)=>e.Jt(t,n.o?.t??n.Tt,l,B[n.i]),G=Symbol();function H(e,t,n){let l=t.K;return null===l||"state"===l||"auto"===l&&void 0!==e.v(t.o,n)?t.U:G}var U=class{constructor(e,t,n,l,i,r,s,o,u,a=null){this.te=!1,this.j=null,this.An=!1,this.engine=e,this.i=t,this.a=n,this.name=l,this.o=i,this.r=r,this.Tn=s,this.x=o,this.value=u,this.D=a}on(){return B[this.i]}apply(){if(null!==this.D)return void this.D.xt();let e=L(this.x,this.engine.read(this.o,this.r));if(e===this.value&&9!==this.i&&("object"!=typeof e||null===e||11===this.i||8===this.i||i(this.name)))return;if(this.value===G)return void(this.value=e);let t=this.a;if(11!==this.i)9===this.i?t.checked=void 0!==e&&this.sn()===e:10===this.i?t.checked=Array.isArray(e)&&e.includes(this.sn()):V(this.i,t,this.name,e),this.value=e;else{if(void 0===e)return void(this.value=e);this.value=e,this.An=!0;try{t[this.name]!==e&&(t[this.name]=e)}finally{this.An=!1}}}sn(){return L(this.j,this.a.value)}ir(){let e,t=this.a,n=this.engine;if(9===this.i){if(!t.checked)return;e=this.sn()}else if(10===this.i){let l=this.sn(),i=n.v(this.o,this.r),r=Array.isArray(i)?i:[],s=r.includes(l);if(t.checked?s:!s)return;e=s?r.filter(e=>e!==l):[...r,l]}else e=L(this.j,t[this.name]),this.value=NaN;n.A(this.o,this.r,e,!1,!0)}},Z=e=>"textContent"===e||"innerText"===e||"innerHTML"===e;function V(e,t,n,l){switch(e){case 0:return void(t.data=null==l?"":String(l));case 1:return void(Z(n)?t[n]="innerHTML"===n?r(l):null==l?"":String(l):i(n)?null==l&&"srcdoc"===n?t.removeAttribute(n):void 0!==l&&(t[n]=r(l)):void 0!==l&&(t[n]!==l&&!("value"===n&&t.value===String(l))&&(t[n]=l),("value"===n||"selectedIndex"===n)&&"select"===t.localName&&(t[z]=[n,l])));case 8:return void(t.innerHTML=r(l));case 2:return null!=l&&"boolean"!=typeof l&&S(401,[n,typeof l]),void t.classList.toggle(n,!0===l);case 3:return void(null==l?t.removeAttribute(n):t.setAttribute(n,String(l)));case 4:return void(n.includes("-")?null==l?t.style.removeProperty(n):t.style.setProperty(n,String(l)):t.style[n]=null==l?"":String(l))}}var z=Symbol();function J(e){let t="optgroup"===e.localName?e.parentNode:e,n=t?.[z];void 0!==n&&(t[n[0]]=n[1])}var Q=class{constructor(e,t,n,l){this.w=!0,this.we=null,this.u=null,this.Rt=null,this.On=null,this.r=e,this.ct=t,this.L=n,this.C=l}Qo(e,t){let n=t.target,l=this.C,i=[],r=null;for(let t of l.Oe){if(t.name!==e)continue;let s=l.Cn[t.a],o=ae(null===this.L?this.ct:this.L[s[0]],s,1);o.contains(n)&&(o!==r&&i.unshift([]),i[0].push(t),r=o)}for(let e of i){for(let n of e)n.Fn(t,this.r);if(t.cancelBubble)return!0}return!1}get s(){return null===this.L?this.ct:this.L[this.L.length-1]}Pe(){let e=this.On;return(null===e?null:e.In(this.ct))??this.ct}insertBefore(e,t){let n=this.s;for(let l=this.Pe();;){let i=l.nextSibling;if(e.insertBefore(l,t),l===n)return;l=i}}bo(){null===this.L?this.ct.remove():he(this.Pe(),this.s)}Re(e){if(this.w=!1,null!==this.Rt)for(let e of this.Rt)e();let t=this.we;if(null!==t)for(let n=0;n<t.length;n++)e.Pn(t[n]);if(null!==this.u)for(let e of this.u)e.Re()}},Y=class extends Q{constructor(e,t,n,l){super(e,t,n,l),this.vo=0,this.V=null,this.pe=0===l.Xe.length?null:new Array(2*l.Xe.length)}ko(e,t){let n=this.V??=new Array(this.C.Xe.length),l=n[t];if(void 0===l){let i=this.C.Xe[t],r=this.pe;l=n[t]=new U(e,i.i,r[2*t],i.name,i.o,this.r,this,i.x,r[2*t+1])}return l}fo(e,t){let n=this.C.Xe;for(let l=0;l<n.length;l++)n[l].o.ee(t)&&e.tn(this.ko(e,l))}Re(e){let t=this.r;t.N===this&&(t.N=null),super.Re(e)}};function _(e,t,n,i){let r=l(n,t.n);try{return e.Ke(r,t)}catch(n){return e.Jt(n,t.t,i,"for"),null===r?e.oe.get(t):r.u.get(t)}}function ee(e,t,n){n&&e.nr(t);let l=t.Tn;null!==l&&(l.we??=[]).push(t)}var te=null;function ne(){let e=te;return te=null,e}var le=-1;function ie(e,t,n,l,i=null){let r,s=t.Cn,o=t.build,u=t.So,a=null,h=C.Te?.(t,null===l?i:l.S,null!==l),c=!h&&t.Dn,f=h?document.createDocumentFragment():(c?t.root:t.ln).cloneNode(!0);if(!h)for(let e=0;e<o.length;e++){let t=o[e];u[t]=ae(f,s[t],c?1:0)}c?r=f:(a=h||[...f.childNodes],r=a[0]);let d,m=null;if(null!==l?(d=m=new Y(n,r,a,t),null===l.map?n.N=m:l.map.set(n,m)):d=new Q(n,r,a,t),le>=0&&function(e,t,n,l){let i=null;if(null===t)i=1===e.nodeType?e:null;else for(let e=0;e<t.length&&null===i;e++)1===t[e].nodeType&&(i=t[e]);let r=i?.style;if(null===i||void 0===r||F.has(i))return;let s=globalThis[R]??={counter:0,assigned:0,warned:!1};s.assigned>=l?s.warned||(s.warned=!0,console.warn(`[@wcstack/state] ${N(25,[l])}`)):(F.add(i),s.assigned++,r.setProperty("view-transition-name",`wcs-${n}-${++s.counter}`),r.setProperty("view-transition-class",`wcs-${n}`))}(r,a,null!==l?"row":"branch",le),t.Oe.length>0){let t=e.Kn;if(null===a)r[t]=d;else for(let e of a)1===e.nodeType&&(e[t]=d)}let p=t.sr,g=e.Me,v=t.lr?u.slice(0,s.length):u,b=null===m?null:m.pe;if(null!==b){let e=t.Xe;for(let t=0;t<e.length;t++)b[2*t]=v[e[t].a],b[2*t+1]=e[t].U}for(let t=0;t<p.length;t++){let l=p[t],i=v[l.a],s=l.F;if(s>=0&&null!==b){let t=m.V?.[s];if(void 0!==t){t.te=!1,e.qe(t);continue}try{let t=L(l.x,e.read(l.o,n));t!==l.U&&(V(l.i,i,l.name,t),b[2*s+1]=t),null!==g&&e.mo(l.o,n)}catch(t){e.Pt(t,m.ko(e,s))}continue}switch(l.i){case 6:{let t=new ue(e,l.C,_(e,l.o,n,i),i);(d.u??=[]).push(t),i===r&&(d.On=t),t.xt();break}case 7:{let t=se(e,l.q.map(e=>({C:e.C,o:e.o,x:e.x,S:v[e.a]})),n,d);(d.u??=[]).push(t),i===r&&(d.On=t);break}default:try{re(e,l,i,n,d)}catch(t){X(e,t,l,i)}}}return te=d,f}function re(e,t,n,i,r){let s=n;switch(t.i){case 5:return void function(e,t,n,l,i){let r=n.Fn,s=e=>r(e,l);if(n.nt){let l=e.co(n.name),i=t[l];t[l]=void 0===i?s:e=>{i(e),s(e)},n.xe&&t.addEventListener(n.name,e=>e.bubbles||s(e))}else t.addEventListener(n.name,s),n.wo&&null!==i&&(i.Rt??=[]).push(()=>t.removeEventListener(n.name,s))}(e,n,t,i,r);case 12:return void de(e,t,s,r,n=>function(e,t,n,l,i){let r=t.name,s=e.command(t.Tt.slice(9)),o=null===i?C.or?.(n,r):null;o||(null===i&&pe(1202,n,`command.${r}`),i.commands.has(r)||S(1203,[n.localName,r]));let u=new WeakRef(n),a=s.subscribe((...e)=>{let t=u.deref();if(void 0!==t)return t.isConnected?o?o(t,e):t[r](...e):void 0;a()});null!==l&&(l.Rt??=[]).push(a)}(e,t,s,r,n));case 13:return void de(e,t,s,r,n=>function(e,t,n,l,i){let r=t.name;null===i&&pe(1202,n,`eventToken.${r}`);let s=i.properties.get(r);void 0===s&&S(1204,[n.localName,r]);let o=t.Tt;n.addEventListener(s.event,n=>{t.At&&n.preventDefault(),t.Ft&&n.stopPropagation();try{e.Zo(o,n,l)}catch(e){A(e)}})}(e,t,s,i,n))}let o=t.o,u=l(i,o.n);if(14===t.i)return void de(e,t,s,r,n=>function(e,t,n,l,i,r){null===r&&pe(1501,n,`"...: ${t.o.t}"`);let s=new Set([...r.properties.keys(),...r.inputs]);for(let o of s){if(t.yo?.includes(o))continue;let s=e.o(`${t.o.t}.${o}`),u=0===s.n?null:l;me(e,{...t,K:null,G:null},n,o,s,u,i,r)}}(e,t,s,u,r,n));if(t.xe&&1===t.i)return void de(e,t,s,r,n=>function(e,t,n,l,i,r){if(null!==r)return void me(e,t,n,t.name,t.o,l,i,r);let s=new U(e,1,n,t.name,t.o,l,i,t.x,H(e,t,l));s.j=t.j,!C.ar?.(s,t.ro)&&(ee(e,s,!0),e.qe(s))}(e,t,s,u,r,n));let a=new U(e,t.i,n,t.name,o,u,r,t.x,H(e,t,u));a.j=t.j,ee(e,a,!0),e.qe(a),null!==t.Ot&&n.addEventListener(t.Ot,()=>a.ir())}function se(e,t,n,i){let r=new oe(e,t,n),s=null;for(let o of t){if(null===o.o)continue;let t=o.o,u=new U(e,7,o.S,"if",t,l(n,t.n),i,null,void 0,r);ee(e,u,!0),null===i&&r.ue.push(u),s??=u}return e.qe(s),r}var oe=class{constructor(e,t,n){this.w=!0,this.I=null,this.y=-1,this.ue=[],this.engine=e,this.q=t,this.r=n}In(e){return null!==this.I&&this.q[this.y].S===e?this.I.Pe():null}xt(){let e=this.engine,t=-1;for(let n=0;n<this.q.length;n++){let i=this.q[n];if(null===i.o||L(i.x,e.read(i.o,l(this.r,i.o.n)))){t=n;break}}if(t!==this.y&&(le=K(),null!==this.I&&(this.I.bo(),this.I.Re(e),this.I=null),this.y=t,t>=0)){let n=this.q[t],l=ie(e,n.C,this.r,null,n.S);this.I=ne();let i=n.S.parentNode;i.insertBefore(l,n.S),J(i)}}Re(){this.w=!1;for(let e of this.ue)this.engine.Pn(e);null!==this.I&&this.I.Re(this.engine)}},ue=class{constructor(e,t,n,l){this.w=!0,this.Ae=[],this.engine=e,this.C=t,this.l=n,this.S=l,null===n.N?(n.N=this,this.map=null):((n.M??=[]).push(this),this.map=new Map)}In(e){return 0===this.Ae.length?null:this.Ae[0].Pe()}Ct(e){return null===this.map?e.N:this.map.get(e)??null}Lt(e){let t=this.map;null!==t&&t.get(e.r)===e&&t.delete(e.r),e.Re(this.engine)}xt(){let e=this.engine,t=this.l.f,n=this.Ae;le=K();let l=t.length,i=n.length,r=this.S,s=r.parentNode;if(0===l){if(i>0){let e=n[0].Pe(),t=n[i-1].s,l=[];for(let n=s.firstChild;null!==n;n=n===e?t.nextSibling:n.nextSibling)if(n!==e){if(n!==r&&3!==n.nodeType){l=null;break}l.push(n)}null!==l?s.replaceChildren(...l):he(e,t);for(let e=0;e<i;e++)this.Lt(n[e])}return void(this.Ae=[])}let o=new Array(l),u=0;for(;u<l&&u<i&&this.Ct(t[u])===n[u];)o[u]=n[u],u++;let a=i-1,h=l-1;for(;a>=u&&h>=u&&this.Ct(t[h])===n[a];)o[h]=n[a],a--,h--;for(let e=u;e<=a;e++){let t=n[e],l=t.r;l.w&&this.Ct(l)===t?t.vo=e:(t.bo(),this.Lt(t))}if(u<=h){let n=h-u+1,a=new Int32Array(n),c=!1;if(i>0)for(let e=0;e<n;e++){let n=this.Ct(t[u+e]);null!==n&&n.w?(a[e]=n.vo,c=!0):a[e]=-1}let f=h+1<l?o[h+1].Pe():r;if(c){let l=function(e){let t=e.length,n=new Uint8Array(t),l=new Int32Array(t).fill(-1),i=[];for(let n=0;n<t;n++){let t=e[n];if(t<0)continue;let r=0,s=i.length;for(;r<s;){let n=r+s>>1;e[i[n]]<t?r=n+1:s=n}r>0&&(l[n]=i[r-1]),i[r]=n}let r=i.length>0?i[i.length-1]:-1;for(;r>=0;)n[r]=1,r=l[r];return n}(a),i=f;for(let r=n-1;r>=0;r--){let n=t[u+r],a=this.Ct(n);null!==a&&a.w?0===l[r]&&a.insertBefore(s,i):(s.insertBefore(ie(e,this.C,n,this),i),a=ne()),o[u+r]=a,i=a.Pe()}}else{let n=document.createDocumentFragment();for(let l=u;l<=h;l++)n.appendChild(ie(e,this.C,t[l],this)),o[l]=ne();s.insertBefore(n,f)}}this.Ae=o,J(s)}Re(){this.w=!1;let e=this.l;if(e.N===this)e.N=null;else if(null!==e.M){let t=e.M.indexOf(this);t>=0&&e.M.splice(t,1),0===e.M.length&&(e.M=null)}for(let e of this.Ae)e.Re(this.engine);this.map?.clear()}};function ae(e,t,n){for(;n<t.length;n++){e=e.firstChild;for(let l=t[n];l>0;l--)e=e.nextSibling}return e}function he(e,t){for(let n,l=e;l!==t;l=n)n=l.nextSibling,l.remove();t.remove()}var ce=new WeakMap,fe=e=>e.customElementRegistry??customElements;function de(e,t,n,l,i,r=!1){let s=n.localName;if(!s.includes("-"))return i(null);let o=fe(n);if(!r&&!n.isConnected&&void 0===o.get(s)&&"customElementRegistry"in n)return void queueMicrotask(()=>de(e,t,n,l,i,!0));let u=()=>{let e=o.get(s);o.upgrade(n),i(e?function(e){if(ce.has(e))return ce.get(e);let t=e.wcBindable,n=null;if(null!==t&&"object"==typeof t&&"wc-bindable"===t.protocol&&Number.isInteger(t.version)&&t.version>=1){n={properties:new Map,inputs:new Set,commands:new Set};for(let e of t.properties??[])n.properties.set(e.name,{event:e.event,getter:"function"==typeof e.getter?e.getter:null,go:"event"===e.semantics});for(let e of t.inputs??[])n.inputs.add(e.name);for(let e of t.commands??[])null!==e&&"object"==typeof e&&"string"==typeof e.name&&n.commands.add(e.name)}return ce.set(e,n),n}(e):null)};if(!r&&void 0!==o.get(s))return u();null!==l&&!l.w||function(e,t,n){let l=n;null!==t&&(t.Rt??=[]).push(()=>{l=null}),e.then(()=>l?.())}(o.whenDefined(s),l,()=>{try{u()}catch(l){X(e,l,t,n)}e.ve()})}function me(e,t,n,l,i=t.o,r,s,o){let u=o.properties.get(l)??null,a=o.inputs.has(l),h=e.Vt;h&&null===u&&!a&&S(38,[l]);let c=t.K;(null===u?"element"===c||"auto"===c:!a&&("state"===c||"auto"===c))&&S(39,[c,l]),"connect"===t.G&&null===u&&S(40,[l]);let f=h&&null!==u&&!a,d=new U(e,11,n,l,i,r,s,t.x,void 0);d.j=t.j,ee(e,d,!f),null!==u&&!t.ro&&n.addEventListener(u.event,t=>{let i;null!==u.getter?i=u.getter(t):(i=t.detail,u.go||C.detail?.(n,l,i)),(!d.An||!Object.is(i,d.value))&&(i=L(d.j,i),null===d.x&&(d.value=i),e.A(d.o,d.r,i,u.go,!0))});let m=c??(f?"element":"state");if("state"===m)f||e.qe(d);else if("element"===m||"auto"===m){let i=()=>{if(null!==s&&!s.w)return;if("auto"===m&&void 0!==e.v(d.o,d.r))return void(f||e.qe(d));let t=n[l];null===d.x&&(d.value=t),e.A(d.o,d.r,t,!1,!0)};"connect"!==t.G||n.isConnected?i():Promise.resolve().then(i)}return d}function pe(e,t,n){S(e,[t.localName,n])}var ge=()=>s.bindAttributeName;function ve(){return{a:0,i:1,name:"",o:null,x:null,U:u,Fn:null,C:null,q:null,j:null,Ot:null,xe:!1,K:null,G:null,ro:!1,At:!1,Ft:!1,Tt:null,yo:null,F:-1,nt:!1,wo:!1}}var be=["state","element","auto","none"],we=["call","connect"],xe="$command.";function ye(e,t,n){g.test(t)&&(null===n&&S(1401,[t,Number(t.slice(1))]),t=`${n.t}.*.${t}`);let l=e.o(function(e,t){return 46!==e.charCodeAt(0)?e:(null===t&&S(1402,[e]),"."===e?`${t.t}.*`:`${t.t}.*${e}`)}(t,n)),i=null===n?0:n.n+1;l.n>i&&S(1401,[l.t,l.n,i]);for(let e=1;e<=l.n;e++){let t=e===i?n:n.h[e];l.h[e]!==t&&S(1403,[l.t,l.h[e].t,t.t])}return C.$o?.(e,l),l}var Ne=e=>1===e.i&&("outerHTML"===e.name||"outerText"===e.name),Se=e=>8===e.i||Ne(e)||1===e.i&&Z(e.name);function Ce(e){S(202,[e])}function Ae(e,t,l,r,s){let o=E(t).map(t=>function(e,t,l,r,s){let o=function(e,t){let n=t.find(e=>e.startsWith("on")),l=null,i=null;for(let n of t){let t=n.indexOf("=");if(t<0)continue;e.Vt||S(31);let r=n.slice(0,t).trim(),s=n.slice(t+1).trim(),o="init"===r;!o&&"sync"!==r&&S(33,[r,n]),null!==(o?l:i)&&S(34,[r]),(o?be:we).includes(s)||S(35,[r,s]),o?l=s:i=s}return{ro:t.includes("ro"),At:t.includes("prevent"),Ft:t.includes("stop"),event:n?n.slice(2):null,K:l,G:i}}(e,t.rn),u=r.localName.includes("-"),a=t.Ne,h=t.Ze;if("event"===t.b){if(null!==o.K&&"none"!==o.K&&S(36),"eventToken"===a[0])return{...ve(),a:s,i:13,name:a.slice(1).join("."),Tt:h,xe:u,At:o.At,Ft:o.Ft};let l=h.startsWith(xe)?h.slice(9):null,{At:i,Ft:r}=o,c=t.Ee.slice(2),f=t.rn.includes("direct"),d=!f&&q.has(c);d&&e.co(c);let m=t=>{A(t),d&&C.handlerThrew?.(e,h,c)};return{...ve(),a:s,i:5,name:c,nt:d,xe:u,wo:f,Fn(t,s){i&&t.preventDefault(),r&&t.stopPropagation();try{if(null!==l)e.er(l,t,s);else{let l=e.tr(h,t,s);n(l)&&l.then(void 0,m)}}catch(e){m(e)}}}}if("spread"===t.b)return{...ve(),a:s,i:14,o:ye(e,h,l),xe:u};if("command"===a[0]&&a.length>1)return h.startsWith(xe)||S(1201,[t.Ee,h]),{...ve(),a:s,i:12,name:a.slice(1).join("."),Tt:h,xe:u};let c=ye(e,h,l),f={...ve(),a:s,i:1,name:t.Ee,o:c,x:I(t.et),j:I(t.j),ro:o.ro,K:o.K,G:o.G};if("radio"===t.b||"checkbox"===t.b)return("element"===o.K||"auto"===o.K)&&S(37,[t.b,o.K]),f.i="radio"===t.b?9:10,o.ro||(f.Ot=o.event??"input"),f;if(a.length>1){let e=a.slice(1).join("."),t=a[0];if("class"===t||"attr"===t||"style"===t)return f.K=null,f.name=e,"class"===t?(f.i=2,f.U=r.classList.contains(e)):f.i="attr"===t?"srcdoc"===e&&"iframe"===r.localName?1:3:4,f}return"html"===t.Ee?(f.i=8,f):(f.name="text"===t.Ee?"textContent":t.Ee,f.xe=u&&!i(f.name),!u&&!o.ro&&function(e,t){let n=e.localName;if("input"===n){let n=(e.getAttribute("type")||"text").toLowerCase();return"button"!==n&&(("radio"===n||"checkbox"===n)&&"checked"===t||"value"===t||"valueAsNumber"===t||"valueAsDate"===t)}return("select"===n||"textarea"===n)&&"value"===t}(r,f.name)&&(f.Ot=o.event??("select"===r.localName?"change":"input")),f)}(e,t,l,r,s));for(let e=0;e<o.length;e++)14===o[e].i&&(o[e].yo=o.slice(e+1).filter(e=>1===e.i).map(e=>e.name));return o}var ke=/\{\{([\s\S]+?)\}\}/g;function Te(e){let t=e.data,n=[],l=0;ke.lastIndex=0;for(let i=ke.exec(t);null!==i;i=ke.exec(t)){let r=ke.lastIndex-i[0].length;r>l&&e.before(t.slice(l,r));let s=e.ownerDocument.createTextNode("");e.before(s),n.push({a:s,cr:i[1].trim()}),l=ke.lastIndex}return 0===n.length||(l<t.length&&e.before(t.slice(l)),e.remove()),n}function je(e,t,n,l){let i=function(e){return{Ee:"textContent",Ne:["textContent"],rn:[],j:[],...y(e),b:"text"}}(t);return{...ve(),a:l,i:0,o:ye(e,i.Ze,n),x:I(i.et),U:""}}function Pe(e){let t=e.getAttribute(ge());if(null===t)return null;let n=E(t)[0];return void 0===n||"for"!==n.b&&"if"!==n.b&&"elseif"!==n.b&&"else"!==n.b?null:n}var Ee=(e,t)=>0===e?s.commentIfPrefix:null===t.o?s.commentElsePrefix:s.commentElseIfPrefix;function Le(e,t,n){let l=(t,l)=>({el:t,o:"else"===l.b?null:ye(e,l.Ze,n),x:"else"===l.b?null:I(l.et)}),i=[l(t,Pe(t))];for(let e=t.nextSibling;null!==e;e=e.nextSibling){if(3===e.nodeType&&""===e.data.trim()||8===e.nodeType)continue;if(1!==e.nodeType||"template"!==e.localName)break;let t=Pe(e);if(null===t||"elseif"!==t.b&&"else"!==t.b||(i.push(l(e,t)),"else"===t.b))break}return i}var Ie=new WeakSet;function Re(e,t,n,l,i,r,o,u){let a=(t,n)=>{let i=document.createComment(n);return t.replaceWith(i),l&&C.jn?.(e,i,t),i},h=t=>{for(let c=0;c<t.length;c++){let f=t[c];if(null!==f.parentNode)if(1===f.nodeType){let t=f,u=t.localName;if(t.hasAttribute(ge()+"-ignore"))continue;if(l){if("script"===u||"style"===u||Ie.has(t))continue;if(Ie.add(t),u===s.tagNames.state){h([...t.childNodes]);continue}}let c="template"===u?Pe(t):null;if(null!==c){if("for"===c.b){let l=ye(e,c.Ze,n),r=qe(e,t,l,!0);i(a(t,s.commentForPrefix),l,r)}else"if"===c.b?r(Le(e,t,n).map((t,l)=>({C:qe(e,t.el,n,!1),o:t.o,x:t.x,S:a(t.el,Ee(l,t))}))):Ce(c.b);continue}let d=t.getAttribute(ge()),m=null===d?null:Ae(e,d,n,t,0),p="noscript"!==u&&"iframe"!==u&&!m?.some(Se)&&!C.Eo?.(t);try{l&&p&&h([...t.childNodes])}finally{null!==m&&o(t,m)}!l&&p&&h([...t.childNodes])}else if(3===f.nodeType&&e.Wt&&f.data.includes("{{")&&!Ie.has(f))for(let{a:e,cr:t}of Te(f))u(e,t);else if(8===f.nodeType){let e=Fe.exec(f.data),t=e&&f.parentNode.localName;if(null!==t&&"textarea"!==t&&"title"!==t){let t=document.createTextNode("");f.replaceWith(t),u(t,e[1])}}}};h(t)}var Fe=/^\s*@@\s*(?:wcs-text)?\s*:\s*([\s\S]+?)\s*$/,Ke=e=>{let t=document.createRange();return t.selectNodeContents(e),e.content??t.cloneContents()};function qe(e,t,n,l){let i=document.importNode(Ke(t),!0),r=[],s=[],o=e=>r.push(e)-1;Re(e,[...i.childNodes],n,!1,(e,t,n)=>{s.push({...ve(),a:o(e),i:6,o:t,C:n})},e=>{let t=e.map(e=>({a:o(e.S),C:e.C,o:e.o,x:e.x}));s.push({...ve(),a:t[0].a,i:7,q:t})},(e,t)=>{let n=o(e);for(let e of t)Ne(e)&&S(203,[e.name]),e.a=n;s.push(...t),e.removeAttribute(ge())},(t,l)=>{s.push(je(e,l,n,o(t)))}),De(i,new Set(r),!0);let u=r.map(e=>function(e,t){let n=[];for(let l=t;l!==e;l=l.parentNode){let e=0;for(let t=l.previousSibling;null!==t;t=t.previousSibling)e++;n.unshift(e)}return n}(i,e)),a=1===i.childNodes.length&&8!==i.firstChild.nodeType,h=s.some(e=>6===e.i||7===e.i),c=[],f=new Set,d=[],m=[],p=l?n.n+1:-1;for(let e of s){if(5===e.i&&e.nt&&!e.xe&&!Me(r[e.a],i)){d.push(e);continue}m.push(e);let t=e.o;if(null!==t&&t.n===p&&t.h[p]===n&&$e(e)&&(e.F=c.push(e)-1),7===e.i)for(let t of e.q)f.add(t.a);else f.add(e.a)}let g=[...f].sort((e,t)=>e-t);return{ln:i,root:a?i.firstChild:null,Cn:u,build:g,Oe:d,sr:m,Dn:a,lr:h,So:[],Xe:c}}function Me(e,t){for(;e.parentNode!==t;e=e.parentNode){if(e.parentNode.localName.includes("-"))return!0;for(let t=e.previousSibling;t;t=t.previousSibling)if(8===t.nodeType)return!0}return!1}function $e(e){if(null!==e.K)return!1;switch(e.i){case 0:case 2:case 3:case 4:case 8:return!0;case 1:return!e.xe&&null===e.Ot;default:return!1}}var Oe=new Set(["table","thead","tbody","tfoot","tr","colgroup","select","optgroup","datalist"]);function De(e,t,n){for(let l=e.firstChild;null!==l;){let e=l.nextSibling;3===l.nodeType?n&&!t.has(l)&&""===l.data.trim()&&l.remove():1===l.nodeType&&De(l,t,Oe.has(l.localName)),l=e}}var We=new WeakMap;function Be(e,t){let n=9===t.nodeType?t.body:t;e.root=t,We.set(t,e),Ge(e,[...n.childNodes]),e.ze()}function Xe(e,t,n){try{let l="template"===t.localName?Pe(t):null;null!==l&&!n&&S(204,[l.b]),Ge(e,[t])}catch(e){A(e)}e.ze()}function Ge(e,t){Re(e,t,null,!0,(t,n,l)=>{new ue(e,l,_(e,n,null,t),t).xt()},t=>{se(e,t,null,null)},(t,n)=>{C.jn?.(e,t,n);for(let l of n)re(e,l,t,null,null)},(t,n)=>{C.jn?.(e,t,n),re(e,je(e,n,null,0),t,null,null)})}export{E as a,fe as b,M as c,$ as d,O as e,D as f,W as g,Y as h,ue as i,Ne as j,Se as k,je as l,Ie as m,Re as n,Ke as o,We as p,Be as q,Xe as r};
|
|
2
|
-
//# sourceMappingURL=chunk-XXVJ6J2N.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|