sveast 0.6.0 → 0.7.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.
@@ -1,3 +0,0 @@
1
- import{n,l}from"./shared-f8ty80r9.js";import{p,o,c,e,O,D,B,F,V,M,j,W,z,U,N,H,G,C,K,Q,X,Y,A,_,J,P,Z,ee,s,te,ie,re,se,ne,oe,ae,le,pe,L,ce,he,ue,fe,de,me,E,ye,xe,ge,I,be,ve,Se,ke,i,we,Te,Ae,b,h,Ee}from"./shared-3xek95jd.js";import{w}from"./shared-9f69x2q9.js";import{f,d}from"./shared-c1jf0gfc.js";import{T}from"./shared-0ehch67h.js";var fn={li:["li"],dt:["dt","dd"],dd:["dt","dd"],p:"address article aside blockquote div dl fieldset footer form h1 h2 h3 h4 h5 h6 header hgroup hr main menu nav ol p pre section table ul".split(" "),rt:["rt","rp"],rp:["rt","rp"],optgroup:["optgroup"],option:["option","optgroup"],thead:["tbody","tfoot"],tbody:["tbody","tfoot"],tfoot:["tbody"],tr:["tr","tbody"],td:["td","th","tr"],th:["td","th","tr"]};function mn(t,r){return Object.hasOwn(fn,t)&&fn[t].includes(r)}var Ye=new Set("arguments await break case catch class const continue debugger default delete do else enum eval export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof var void while with yield".split(" ")),Ke=/<!--[\s\S]*?-->|<script\s+(?:[^>]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/y,it=/\r(?!\n)|[\u2028\u2029]/;function Re(t){if(t===32||t<=13&&t>=9)return!0;if(t<160)return!1;return t===160||t===5760||t>=8192&&t<=8202||t===8232||t===8233||t===8239||t===8287||t===12288||t===65279}function De(t,r){let a=r;while(a<t.length&&Re(t.charCodeAt(a)))a++;return a}function Ve(t,r){let a=t.codePointAt(r);if(a===void 0||!n(a,!0))return r;let u=r+(a<=65535?1:2),x=t.codePointAt(u);while(x!==void 0&&l(x,!0))u+=x<=65535?1:2,x=t.codePointAt(u);return u}function ot(t){let r=t.indexOf("<");while(r!==-1){let a=t.charCodeAt(r+1);if(a===33||a===115){Ke.lastIndex=r;let u=Ke.exec(t);if(u){if(a===115)return u[2]==="ts";r=t.indexOf("<",Ke.lastIndex);continue}}r=t.indexOf("<",r+1)}return!1}class Je{source;index=0;loc;lfOnly;isTypeScript;typescript;entityNames;css;script;comments;root;stack;fragments;metaTags=new Set;lastAutoClosedTag;nextAngle=-1;nextBrace=-1;constructor(t,r,a,u={}){if(this.source=t,this.loc=u.loc??!1,this.lfOnly=this.loc&&!it.test(t),this.isTypeScript=ot(t),this.typescript=a.typescript,this.isTypeScript&&!this.typescript)T();this.entityNames=a.entityNames,this.css=u.css??!0,this.script=u.script??!0,this.comments=u.comments??!0,this.root={type:"Root",start:0,end:r,css:null,js:[],options:null,fragment:{type:"Fragment",nodes:[]},comments:[]},this.stack=[this.root],this.fragments=[this.root.fragment]}match(t){if(t.length===1)return this.source.charCodeAt(this.index)===t.charCodeAt(0);return this.source.startsWith(t,this.index)}matchRegex(t){return t.lastIndex=this.index,t.exec(this.source)?.[0]??null}eat(t,r=!1){if(this.match(t))return this.index+=t.length,!0;if(r)s(this.index,t);return!1}read(t){let r=this.matchRegex(t);if(r)this.index+=r.length;return r}readUntil(t){if(this.index>=this.source.length)i(this.source.length);let r=this.source.indexOf(t,this.index),a=r===-1?this.source.length:r,u=this.source.slice(this.index,a);return this.index=a,u}allowWhitespace(){this.index=De(this.source,this.index)}requireWhitespace(){if(!Re(this.source.charCodeAt(this.index)))te(this.index);this.allowWhitespace()}eatClosingBrace(){this.allowWhitespace(),this.eat("}",!0)}sourceLocation(t,r){return this.loc?{start:o(t),end:o(r)}:void 0}readIdentifierName(){let t=this.index,r=Ve(this.source,t),a=this.source.slice(t,r);if(this.index=r,Ye.has(a))we(t,a);let u={type:"Identifier",name:a,start:t,end:r};if(this.loc)u.loc=this.sourceLocation(t,r);return u}current(){return this.stack[this.stack.length-1]}append(t){this.fragments[this.fragments.length-1].nodes.push(t)}open(t,r){this.append(t),this.stack.push(t),this.fragments.push(r)}setFragment(t){this.fragments[this.fragments.length-1]=t}close(){this.stack.pop(),this.fragments.pop()}}var lt=["===","!==","==","!=","&&","||","??"];function en(t,r,a,u){return{type:"Literal",start:r,end:a,value:u,raw:t.slice(r,a)}}function hn(t,r){let a=t.charCodeAt(r);if(a===34||a===39){for(let x=r+1;x<t.length;x++){let S=t.charCodeAt(x);if(S===a)return en(t,r,x+1,t.slice(r+1,x));if(S===92||S===10||S===13)return null}return null}let u=r;for(;u<t.length;u++){let x=t.charCodeAt(u);if(x<48||x>57)break}if(u===r||a===48&&u-r>1)return null;return en(t,r,u,Number(t.slice(r,u)))}function st(t,r){let a=Ve(t,r);if(a===r)return hn(t,r);let u=t.slice(r,a);if(u==="true"||u==="false"||u==="null")return en(t,r,a,u==="null"?null:u==="true");if(Ye.has(u))return null;let x={type:"Identifier",start:r,end:a,name:u};for(let S=a;;){let g=t.charCodeAt(S),v,y;if(g===46){if(y=Ve(t,S+1),y===S+1)return null;v={type:"Identifier",start:S+1,end:y,name:t.slice(S+1,y)}}else if(g===91){if(v=hn(t,S+1),!v||t.charCodeAt(v.end)!==93)return null;y=v.end+1}else return x;x={type:"MemberExpression",start:r,end:y,object:x,property:v,computed:g===91,optional:!1},S=y}}function nn(t,r){if(t.charCodeAt(r)!==33||t.charCodeAt(r+1)===61)return st(t,r);let a=nn(t,De(t,r+1));if(!a)return null;return{type:"UnaryExpression",start:r,end:a.end,operator:"!",prefix:!0,argument:a}}function xn(t,r){let a=De(t,r);if(a>=t.length)return!1;let u=t.charCodeAt(a);return u===125||u===41}function ct(t,r){let a=nn(t,r);if(!a||xn(t,a.end))return a;let u=De(t,a.end),x=lt.find((v)=>t.startsWith(v,u));if(!x)return null;let S=nn(t,De(t,u+x.length));if(!S||!xn(t,S.end))return null;let{end:g}=S;if(x==="&&"||x==="||"||x==="??")return{type:"LogicalExpression",start:a.start,end:g,left:a,operator:x,right:S};return{type:"BinaryExpression",start:a.start,end:g,left:a,operator:x,right:S}}function We(t){if(t.loc={start:c(t.start),end:c(t.end)},t.type==="MemberExpression")We(t.object),We(t.property);else if(t.type==="UnaryExpression")We(t.argument);else if(t.type==="BinaryExpression"||t.type==="LogicalExpression")We(t.left),We(t.right)}function Ce(t){let r=!t.loc||t.lfOnly?ct(t.source,t.index):null;if(r){if(t.index=r.end,t.loc)We(r);return r}let{node:a,end:u}=h(t,t.source,t.index);return t.index=u,a}var Sn=/<\/script\s*>/g,at=new Set(["server","client","worker","test","default"]);function gn(t,r,a){let{source:u,index:x}=t;if(x>=u.length)i(u.length);Sn.lastIndex=x;let S=Sn.exec(u);if(!S)A(u.length,"script");t.index=S.index+S[0].length;let g=t.script?b(t,u.slice(0,S.index),x):pt(x,S.index);if(g.start=x,g.loc)Object.assign(g.loc.start,c(r)),Object.assign(g.loc.end,c(t.index));else if(t.loc)g.loc={start:c(r),end:c(t.index)};let v="default";for(let y of a){if(at.has(y.name))oe(y,y.name);if(y.name==="module"){if(y.value!==!0)se(y,y.name);v="module"}if(y.name==="context"){let k=y.value;if(k===!0||!Array.isArray(k)||k.length!==1||k[0].type!=="Text"||k[0].data!=="module")ne(y);v="module"}}return{type:"Script",start:r,end:t.index,context:v,content:g,attributes:a}}function pt(t,r){return{type:"Program",start:t,end:r,body:[],sourceType:"module"}}var ut=/(even|odd|\+?(\d+|\d*n(\s*[+-]\s*\d+)?)|-\d*n(\s*\+\s*\d+))((?=\s*[,)])|\s+of(\s+|(?=[.#[*:&])))/y,dt=/\d+(\.\d+)?%/y,ft=/\\[0-9a-fA-F]{1,6}(\r\n|\s)?/y,mt=/\s*>/y,Ne=-1,on=34,ht=35,xt=36,St=38,ln=39,gt=40,yt=41,Ge=42,At=43,Tt=45,Et=46,sn=47,tn=58,bt=59,En=60,yn=61,Ct=62,_t=91,He=92,vt=93,wt=94,bn=123,rn=124,kt=125,Cn=126,$e=[];function _n(t,r,a){let u=t.index;$e=[];let x=t.css?Rt(t):Pt(t),S=t.index;return t.eat("</style",!0),t.read(mt),{type:"StyleSheet",start:r,end:t.index,attributes:a,children:x,comments:$e,content:{start:u,end:S,styles:t.source.slice(u,S),comment:null}}}function Pt(t){let{source:r,index:a}=t;while(a<r.length){let u=r.charCodeAt(a);if(u===sn&&r.charCodeAt(a+1)===Ge){let x=r.indexOf("*/",a+2);a=x===-1?r.length:x+2}else if(u===on||u===ln){a++;while(a<r.length){let x=r.charCodeAt(a);if(x===u||x===10)break;a+=x===He?2:1}a++}else if(u===En&&r.startsWith("</style",a))break;else a++}return t.index=Math.min(a,r.length),[]}function Rt(t){let r=[];for(;;){if(Ie(t,!0),t.match("</style")||t.index>=t.source.length)break;r.push(t.match("@")?vn(t):wn(t))}return r}function vn(t){let r=t.index;t.eat("@",!0);let a=Le(t),u=cn(t,!0),x=null;if(t.match("{"))x=Rn(t);else t.eat(";",!0);return{type:"Atrule",start:r,end:t.index,name:a,prelude:u,block:x}}function wn(t){let r=t.index;return{type:"Rule",prelude:kn(t,!1),block:Rn(t),start:r,end:t.index}}function kn(t,r){let a=[];Ie(t,!0);let u=t.index;while(t.index<t.source.length){a.push(Ot(t,r));let x=t.index;if(Ie(t,!0),t.match(r?")":"{"))return{type:"SelectorList",start:u,end:x,children:a};t.eat(",",!0),Ie(t,!0)}return i(t.source.length)}function An(t,r){return{type:"RelativeSelector",combinator:t,selectors:[],start:r,end:-1}}function Ot(t,r){let{source:a,index:u}=t,x=[],S=An(null,t.index);while(t.index<a.length){let g=t.index,v=a.charCodeAt(g),y=S.selectors;if(v===St)t.index++,y.push({type:"NestingSelector",name:"&",start:g,end:t.index});else if(v===Ge)t.index++,y.push(Tn(t,g,"*"));else if(v===ht)t.index++,y.push({type:"IdSelector",name:Le(t),start:g,end:t.index});else if(v===Et)t.index++,y.push({type:"ClassSelector",name:Le(t),start:g,end:t.index});else if(v===tn){let _e=a.charCodeAt(g+1)===tn;t.index+=_e?2:1;let Pe=Le(t),Be=null;if(t.eat("("))Be=kn(t,!0),t.eat(")",!0);if(_e)y.push({type:"PseudoElementSelector",name:Pe,start:g,end:t.index,...Be&&{args:Be}});else y.push({type:"PseudoClassSelector",name:Pe,args:Be,start:g,end:t.index})}else if(v===_t)t.index++,y.push(Nt(t,g));else{let _e=r?t.read(ut):null,Pe=!_e&&je(v)?t.read(dt):null;if(_e)y.push({type:"Nth",value:_e,start:g,end:t.index});else if(Pe)y.push({type:"Percentage",value:Pe,start:g,end:t.index});else if(Pn(a,g)===0){let Be=Le(t);y.push(Tn(t,g,Be))}}let k=t.index;Ie(t,!1);let R=t.match(",")||t.match(r?")":"{");if(t.index=k,R)return S.end=k,x.push(S),{type:"ComplexSelector",start:u,end:k,children:x};let q=Lt(t);if(q){if(S.selectors.length>0)S.end=k,x.push(S);if(S=An(q,q.start),t.allowWhitespace(),t.match(",")||t.match(r?")":"{"))H(t.index)}}return i(a.length)}function Tn(t,r,a){let u=a,x;if(t.eat("|"))x=u,u=t.eat("*")?"*":Le(t);return{type:"TypeSelector",name:u,...x!==void 0&&{namespace:x},start:r,end:t.index}}function Nt(t,r){let a=t.source;t.allowWhitespace();let u=Le(t);t.allowWhitespace();let x=null,S=null,g=a.charCodeAt(t.index);if(g===yn)S="=";else if((g===Cn||g===wt||g===xt||g===Ge||g===rn)&&a.charCodeAt(t.index+1)===yn)S=a.slice(t.index,t.index+2);if(S)t.index+=S.length,t.allowWhitespace(),x=It(t);t.allowWhitespace();let v=t.index;while(Nn(a.charCodeAt(t.index)))t.index++;let y=t.index>v?a.slice(v,t.index):null;return t.allowWhitespace(),t.eat("]",!0),{type:"AttributeSelector",start:r,end:t.index,name:u,matcher:S,value:x,flags:y}}function Pn(t,r){let a=t.charCodeAt(r);if(a===At||a===Cn||a===Ct)return 1;if(a===rn&&t.charCodeAt(r+1)===rn)return 2;return 0}function Lt(t){let r=t.index;t.allowWhitespace();let a=t.index,u=Pn(t.source,a);if(u>0){t.index+=u;let x=t.index;return t.allowWhitespace(),{type:"Combinator",name:t.source.slice(a,x),start:a,end:x}}if(t.index!==r)return{type:"Combinator",name:" ",start:r,end:t.index};return null}function Rn(t){let r=t.index;t.eat("{",!0);let a=[];while(t.index<t.source.length){if(Ie(t,!0),t.match("}"))break;a.push(Bt(t))}return t.eat("}",!0),{type:"Block",start:r,end:t.index,children:a}}function Bt(t){if(t.match("@"))return vn(t);let r=t.index;cn(t,!1);let a=t.source.charCodeAt(t.index);return t.index=r,a===bn?wn(t):Dt(t)}function Dt(t){let{source:r,index:a}=t;if(a>=r.length)i(r.length);let u=a;while(u<r.length){let y=r.charCodeAt(u);if(y===tn||Re(y))break;u++}let x=r.slice(a,u);t.index=u,t.allowWhitespace(),t.eat(":");let S=t.index;t.allowWhitespace();let g=cn(t,!0);if(!g&&!x.startsWith("--"))U({start:a,end:S});let v=t.index;if(!t.match("}"))t.eat(";",!0);return{type:"Declaration",start:a,end:v,property:x,value:g}}function cn(t,r){let a=t.source,u=a.length,x="",S=t.index,g=null,v=!1,y=!1,k=Ne,R=t.index;while(R<u){let q=a.charCodeAt(R);if(v){v=!1,R++;continue}if(q===He){v=!0,R++;continue}if(q===k)k=Ne;else if(q===yt)y=!1;else if(k===Ne&&(q===on||q===ln))k=q;else if(q===gt){if(Wt(a,x,S,R))y=!0}else if((q===bt||q===bn||q===kt)&&!y&&k===Ne){if(t.index=R,!r)return"";if(x+=a.slice(S,R),g){let _e=x.length-x.trimStart().length;for(let Pe of g)Pe.position=Math.max(0,(Pe.position??0)-_e)}return x.trim()}else if(q===sn&&!y&&k===Ne&&a.charCodeAt(R+1)===Ge){x+=a.slice(S,R),t.index=R;let _e=On(t);if(r)_e.position=x.length,$e.push(_e),g??=[],g.push(_e);R=t.index,S=R;continue}R++}return t.index=u,i(u)}function Wt(t,r,a,u){if(u-a>=3)return t.charCodeAt(u-3)===117&&t.charCodeAt(u-2)===114&&t.charCodeAt(u-1)===108;return(r+t.slice(a,u)).endsWith("url")}function It(t){let r=t.source,a=Ne;if(t.eat('"'))a=on;else if(t.eat("'"))a=ln;let u=t.index,x=!1,S=u;while(S<r.length){let g=r.charCodeAt(S);if(x)x=!1;else if(g===He)x=!0;else if(a===Ne?g===vt||Re(g):g===a)return t.index=a===Ne?S:S+1,r.slice(u,S).trim();S++}return t.index=S,i(r.length)}function Le(t){let{source:r,index:a}=t,u=r.charCodeAt(a);if(je(u)||u===Tt&&je(r.charCodeAt(a+1)))N(a);let x="",S=a,g=a;while(g<r.length){let v=r.charCodeAt(g);if(v===He){x+=r.slice(S,g),t.index=g;let y=t.matchRegex(ft);if(y){let k=String.fromCodePoint(Number.parseInt(y.slice(1),16));x+=k==="\\"?"\\\\":k,g+=y.length}else x+=`\\${r[g+1]}`,g+=2;S=g}else if(v>=160||Ft(v))g++;else break}if(x+=r.slice(S,g),t.index=g,x==="")N(a);return x}function Ie(t,r){let a=t.source;t.allowWhitespace();for(;;){let u=a.charCodeAt(t.index);if(u===sn&&a.charCodeAt(t.index+1)===Ge){let x=On(t);if(r)$e.push(x)}else if(u===En&&t.eat("<!--"))t.readUntil("-->"),t.eat("-->",!0);else break;t.allowWhitespace()}}function On(t){let r=t.index;t.eat("/*",!0);let a=t.readUntil("*/");return t.eat("*/",!0),{type:"CSSComment",value:a,start:r,end:t.index}}function je(t){return t>=48&&t<=57}function Nn(t){return t>=65&&t<=90||t>=97&&t<=122}function Ft(t){return Nn(t)||je(t)||t===95||t===45}var an=/<\/textarea(\s[^>]*)?>/iy,Mt=/^![a-zA-Z]+$/,Gt=/^[a-zA-Z][a-zA-Z0-9]*:[a-zA-Z][a-zA-Z0-9-]*[a-zA-Z0-9]$/,Ut=/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u,pn="\\u200C\\u200D",qt=new RegExp(`^(?:\\p{Lu}[$${pn}\\p{ID_Continue}.]*|\\p{ID_Start}[$${pn}\\p{ID_Continue}]*(?:\\.[$${pn}\\p{ID_Continue}]+)+)$`,"u"),Vt=new Set("area base br col command embed hr img input keygen link meta param source track wbr".split(" ")),$t=new Map([["use","UseDirective"],["animate","AnimateDirective"],["bind","BindDirective"],["class","ClassDirective"],["style","StyleDirective"],["on","OnDirective"],["let","LetDirective"],["in","TransitionDirective"],["out","TransitionDirective"],["transition","TransitionDirective"]]),un=new Map([["svelte:head",["SvelteHead",!0]],["svelte:options",["SvelteOptions",!0]],["svelte:window",["SvelteWindow",!0]],["svelte:document",["SvelteDocument",!0]],["svelte:body",["SvelteBody",!0]],["svelte:element",["SvelteElement",!1]],["svelte:component",["SvelteComponent",!1]],["svelte:self",["SvelteSelf",!1]],["svelte:fragment",["SvelteFragment",!1]],["svelte:boundary",["SvelteBoundary",!1]]]),Ln=[...un.keys()],jt=`${Ln.slice(0,-1).join(", ")} or ${Ln.at(-1)}`,Gn=47,Xe=62,Un=61,Ht=34,Xt=39,Bn=123,Fe=(t)=>t===Ht||t===Xt;function zt(t,r,a){let u=r;for(;u<t.length;u++){let x=t.charCodeAt(u);if(Re(x)||x===Gn||x===Xe)break;if(a&&(Fe(x)||x===Un))break}return u}function ze(t,r){let a=t.index;if(a>=t.source.length)i(t.source.length);let u=zt(t.source,a,r);return t.index=u,{name:t.source.slice(a,u),start:a,end:u,loc:t.sourceLocation(a,u)}}var Ue=(t,r,a,u=a)=>({start:t,end:r,type:"Text",raw:a,data:u});function qn(t){return Vt.has(t)||t.charCodeAt(0)===33&&t.toLowerCase()==="!doctype"}function Qt(t){let r=t.charCodeAt(0);if(r>=97&&r<=122&&!t.includes("."))return!1;return qt.test(t)}function Zt(t){let r=!0;for(let a=0;a<t.length&&r;a++){let u=t.charCodeAt(a);r=u>=97&&u<=122||a>0&&u>=48&&u<=57}return r&&t.length>0||Mt.test(t)||Gt.test(t)||Ut.test(t)}function Dn(t,r){for(let a=t.length-1;a>=0;a--){let u=r(t[a]);if(u!==void 0)return u}return!1}function Kt(t,r,a){let u=un.get(r);if(u)return u[0];if(a)return"Component";if(r==="title"){if(Dn(t.stack,({type:S})=>{if(S==="SvelteHead")return!0;return S==="RegularElement"||S==="Component"?!1:void 0}))return"TitleElement"}if(r==="slot"){if(!Dn(t.stack,(S)=>S.type==="RegularElement"&&S.attributes.some((g)=>g.type==="Attribute"&&g.name==="shadowrootmode")?!0:void 0))return"SlotElement"}return"RegularElement"}function Vn(t){let r=t.index++;if(t.eat("!--")){let a=t.readUntil("-->");t.eat("-->",!0),t.append({type:"Comment",start:r,end:t.index,data:a})}else if(t.eat("/"))Yt(t,r);else er(t,r)}function Yt(t,r){let{name:a}=ze(t,!1);if(t.allowWhitespace(),t.eat(">",!0),qn(a))Ae(r);let u=t.current();while(!("name"in u)||u.name!==a){if(u.type!=="RegularElement"){let x=t.lastAutoClosedTag;if(x?.tag===a)Y(r,a,x.reason);X(r,a)}u.end=r,t.close(),u=t.current()}if(u.end=t.index,t.close(),t.stack.length<(t.lastAutoClosedTag?.depth??0))t.lastAutoClosedTag=void 0}function Jt(t,r,a){return{type:t,start:r,end:-1,name:a}}function er(t,r){let a=ze(t,!1),{name:u}=a,x=un.get(u);if(!x&&u.startsWith("svelte:"))fe(a,jt);let S=Qt(u);if(!S&&!Zt(u))Se(a);if(x?.[1]){if(t.metaTags.has(u))ce(r,u);if(t.current().type!=="Root")ue(r,u);t.metaTags.add(u)}let g=Jt(Kt(t,u,S),r,u);if(t.loc)g.name_loc=a.loc;g.attributes=[],g.fragment={type:"Fragment",nodes:[]},t.allowWhitespace();let v=t.current();if(v.type==="RegularElement"&&mn(v.name,u))v.end=r,t.close(),t.lastAutoClosedTag={tag:v.name,reason:u,depth:t.stack.length};if((u==="script"||u==="style")&&t.current().type==="Root"){let k=[];g.attributes=k,Mn(t,k,lr),tr(t,g,r,k);return}if(Mn(t,g.attributes,cr),g.type==="SvelteComponent"){let k=Wn(g);if(!k)pe(r);if(!In(k.value))le(k.start);g.expression=Fn(k.value)}else if(g.type==="SvelteElement"){let k=Wn(g);if(!k)L(r);if(k.value===!0)L(k);g.tag=In(k.value)?Fn(k.value):or(k.value[0])}if(!t.eat("/")&&!qn(u))if(t.eat(">",!0),u==="textarea")g.fragment.nodes=jn(t,(k,R)=>(an.lastIndex=R,an.test(k)),"inside <textarea>"),t.read(an);else if(u==="script"||u==="style")g.fragment.nodes.push(nr(t,`</${u}>`));else{t.open(g,g.fragment);return}else t.eat(">",!0);g.end=t.index,t.append(g)}function nr(t,r){let a=t.index,u=t.source.indexOf(r,a);t.index=u===-1?t.source.length:u;let x=Ue(a,t.index,t.source.slice(a,t.index));return t.eat(r,!0),x}function tr(t,r,a,u){t.eat(">",!0);let x=rr(t.root.fragment.nodes,a);if(r.name==="style"){let v=_n(t,a,u);if(v.content.comment=x,t.root.css)ae(a);t.root.css=v;return}let S=gn(t,a,u);if(x&&t.comments)S.content.leadingComments=[{type:"Line",value:x.data}];let g=S.context==="module"?"module":"instance";if(t.root[g])re(a);t.root[g]=S}function rr(t,r){let a=t.length-1;if(a<0||t[a].end!==r)return null;for(let u=a;u>=0;u--){let x=t[u];if(x.type==="Comment")return x;if(x.type!=="Text"||x.data.trim())return null}return null}var ir=(t)=>t.type==="Attribute"&&t.name==="this";function Wn(t){let r=t.attributes.find(ir);if(r)t.attributes.splice(t.attributes.indexOf(r),1);return r}function In(t){if(t===!0)return!1;if(!Array.isArray(t))return!0;return t.length===1&&t[0].type==="ExpressionTag"}function Fn(t){return(Array.isArray(t)?t[0]:t).expression}function or(t){if(t.type!=="Text")return t.expression;return{type:"Literal",value:t.data,raw:`'${t.raw}'`,start:t.start,end:t.end}}function Mn(t,r,a){let u=new Set;for(;;){let x=a(t);if(!x)return;let{type:S}=x;if(S==="Attribute"||S==="BindDirective"||S==="StyleDirective"||S==="ClassDirective"){let g=`${S==="BindDirective"?"Attribute":S}${x.name}`;if(u.has(g))O(x);if(x.name!=="this")u.add(g)}r.push(x),t.allowWhitespace()}}function dn(t,r,a,u,x){return t.loc?{type:"Attribute",start:a,end:u,name:r.name,name_loc:r.loc,value:x}:{type:"Attribute",start:a,end:u,name:r.name,value:x}}function $n(t){if(Fe(t.source.charCodeAt(t.index)))s(t.index,"=")}function lr(t){let r=t.index,a=ze(t,!0);if(!a.name)return null;let u=!0;if(t.eat("=")){t.allowWhitespace();let{source:x}=t,S=t.index,g=-1;if(Fe(x.charCodeAt(S))){let k=x.indexOf(x[S],S+1);if(k!==-1)g=k+1}if(g===-1){g=S;while(g<x.length&&x.charCodeAt(g)!==Xe&&!Re(x.charCodeAt(g)))g++;if(g===S)_(S)}t.index=g;let v=Fe(x.charCodeAt(S))?1:0,y=x.slice(S+v,g-v);u=[Ue(g-y.length-v,g-v,y,w(y,!0,t.entityNames))]}return $n(t),dn(t,a,r,t.index,u)}function sr(t){let r=t.index,a=t.match("/*");if(!a&&!t.match("//"))return!1;t.index+=2;let u=t.readUntil(a?"*/":`
2
- `);if(a)t.eat("*/");let x={type:a?"Block":"Line",start:r,end:t.index,value:u},S=t.sourceLocation(r,t.index);if(S)x.loc=S;if(t.comments)t.root.comments.push(x);return!0}function cr(t){while(sr(t))t.allowWhitespace();let r=t.index;if(t.eat("{"))return ar(t,r);let a=ze(t,!0);if(!a.name)return null;let u=t.index;t.allowWhitespace();let x=!0;if(t.eat("=")){if(t.allowWhitespace(),t.match("/>"))x=[Ue(t.index,t.index+1,"/")],t.index++;else x=dr(t);u=t.index}else $n(t);let S=a.name.indexOf(":"),g=S>0?$t.get(a.name.slice(0,S)):void 0;return g?ur(t,g,a,S,r,u,x):dn(t,a,r,u,x)}function ar(t,r){if(t.allowWhitespace(),t.eat("@attach")){t.requireWhitespace();let x=Ce(t);return t.eatClosingBrace(),{type:"AttachTag",start:r,end:t.index,expression:x}}if(t.eat("...")){let x=Ce(t);return t.eatClosingBrace(),{type:"SpreadAttribute",start:r,end:t.index,expression:x}}let a=t.readIdentifierName();if(a.name==="")D(r);t.eatClosingBrace();let u={type:"ExpressionTag",start:a.start,end:a.end,expression:a};return dn(t,a,r,t.index,u)}function pr(t){if(t===!0)return;return Array.isArray(t)?t[0]:t}function ur(t,r,a,u,x,S,g){let[v,...y]=a.name.slice(u+1).split("|");if(v==="")Q({start:x,end:x+u+1},a.name);let k={start:x,end:S,type:r,name:v};if(t.loc)k.name_loc=a.loc;if(r==="StyleDirective")return k.modifiers=y,k.value=g,k;let R=pr(g);if(R&&(Array.isArray(g)&&g.length>1||R.type==="Text"))K(R.start);if(k.expression=R?.expression??null,k.modifiers=y,r==="TransitionDirective"){let q=a.name.slice(0,u);k.intro=q!=="out",k.outro=q!=="in"}if((r==="BindDirective"||r==="ClassDirective")&&!k.expression)k.expression={start:x+u+1,end:S,type:"Identifier",name:v};return k}function dr(t){let r=t.source.charCodeAt(t.index),a=Fe(r);if(a){if(t.index++,t.source.charCodeAt(t.index)===r)return t.index++,[Ue(t.index-1,t.index-1,"")]}let u;try{u=jn(t,a?(x,S)=>x.charCodeAt(S)===r:fr,"in attribute value",a?r:void 0)}catch(x){let S=x instanceof e?x.position?.[0]:void 0;if(x instanceof e&&x.code==="js_parse_error"&&S!==void 0&&t.source.startsWith("/>",S-1))t.index=S,s(S,a?String.fromCharCode(r):"}");throw x}if(a)t.index++;else if(u.length===0)_(t.index);return a||u.length>1||u[0].type==="Text"?u:u[0]}function fr(t,r){let a=t.charCodeAt(r);return Re(a)||Fe(a)||a===Un||a===60||a===Xe||a===96||a===Gn&&t.charCodeAt(r+1)===Xe}function jn(t,r,a,u){let{source:x}=t,S=[],g=t.index,v=(y)=>{if(y<=g)return;let k=x.slice(g,y);S.push(Ue(g,y,k,w(k,!0,t.entityNames)))};while(t.index<x.length){let y=t.index;if(r(x,y))return v(y),S;if(x.charCodeAt(y)!==Bn){if(t.index++,u!==void 0)while(t.index<x.length&&x.charCodeAt(t.index)!==Bn&&x.charCodeAt(t.index)!==u)t.index++;continue}t.index++;let k=x.charCodeAt(t.index);if(k===35||k===64){t.index++;let q=t.index;while(t.index<x.length&&x.charCodeAt(t.index)>=97&&x.charCodeAt(t.index)<=122)t.index++;let _e=x.slice(q,t.index);(k===35?M:ke)(y,_e,a)}v(y),t.allowWhitespace();let R=Ce(t);t.eatClosingBrace(),S.push({type:"ExpressionTag",start:y,end:t.index,expression:R}),g=t.index}i(x.length)}var mr=new Map([["html","html"],["svg","svg"],["mathml","mathml"],["http://www.w3.org/2000/svg","svg"],["http://www.w3.org/1998/Math/MathML","mathml"]]),hr=new Map([["type",(t,r)=>{if(r!=="String"&&r!=="Number"&&r!=="Boolean"&&r!=="Array"&&r!=="Object")return!1;return t.type=r,!0}],["reflect",(t,r)=>{if(typeof r!=="boolean")return!1;return t.reflect=r,!0}],["attribute",(t,r)=>{if(typeof r!=="string")return!1;return t.attribute=r,!0}]]),Hn="[a-z0-9_.\\xB7\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}-]",xr=new RegExp(`^[a-z]${Hn}*-${Hn}*$`,"u"),Sr=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ")),Qe=(t)=>(r,a)=>{let u=Ze(a);if(typeof u!=="boolean")E(a,"true or false");r[t]=u},gr=new Map([["runes",Qe("runes")],["immutable",Qe("immutable")],["preserveWhitespace",Qe("preserveWhitespace")],["accessors",Qe("accessors")],["namespace",(t,r)=>{let a=mr.get(Ze(r));if(!a)E(r,'"html", "mathml" or "svg"');t.namespace=a}],["css",(t,r)=>{if(Ze(r)!=="injected")E(r,'"injected"');t.css="injected"}],["tag",(t,r)=>de(r)],["customElement",(t,r)=>{let a=Ar(r);if(a)t.customElement=a}]]);function zn(t){let r=[],a={start:t.start,end:t.end,attributes:r};for(let u of t.attributes){if(u.type!=="Attribute")me(u);r.push(u);let x=gr.get(u.name);if(!x)ve(u,u.name);x(a,u)}return a}function Ze({value:t}){if(t===!0)return!0;let r=Array.isArray(t)?t:[t];if(r.length===0)return!0;if(r.length>1)return null;let[a]=r;if(a.type==="Text")return a.data;return a.expression.type==="Literal"?a.expression.value:null}function Xn(t,r){if(typeof r!=="string")I(t);if(!r)return;if(!xr.test(r))I(t);if(Sr.has(r))be(t)}function yr(t,r){let a=new Map;for(let u of t.properties){if(u.type!=="Property"||u.computed||u.key.type!=="Identifier")r();if(!a.has(u.key.name))a.set(u.key.name,u.value)}return a}function Ar(t){let r=()=>ye(t);if(t.value===!0)r();let a=Array.isArray(t.value)?t.value[0]:t.value;if(a.type==="Text"){let R=Ze(t);return Xn(t,R),{tag:R}}let{expression:u}=a;if(u.type!=="ObjectExpression"){if(u.type==="Literal"&&u.value===null)return;r()}let x=yr(u,r),S={},g=x.get("tag");if(g){let R=g.type==="Literal"?g.value:void 0;Xn(null,R),S.tag=R}let v=x.get("props");if(v){let R=()=>xe(t);if(v.type!=="ObjectExpression")R();S.props={};for(let q of v.properties){if(q.type!=="Property"||q.computed||q.key.type!=="Identifier"||q.value.type!=="ObjectExpression")R();let _e={};S.props[q.key.name]=_e;for(let Pe of q.value.properties){if(Pe.type!=="Property"||Pe.computed||Pe.key.type!=="Identifier"||Pe.value.type!=="Literal")R();if(!hr.get(Pe.key.name)?.(_e,Pe.value.value))R()}}}let y=x.get("shadow");if(y)if(y.type==="ObjectExpression")S.shadow=y;else if(y.type==="Literal"&&(y.value==="open"||y.value==="none"))S.shadow=y.value;else ge(t);let k=x.get("extend");if(k)S.extend=k;return S}var Tr={"{":"}","(":")","[":"]"};function qe(t,r,a=Tr){let u=Object.values(a),x=[],S=r;while(S<t.length){let g=t[S++];if(g==="'"||g==='"'||g==="`")S=Er(t,S,g);else if(Object.hasOwn(a,g))x.push(g);else if(u.includes(g)){let v=a[x.pop()??""];if(g!==v)s(S-1,v);if(x.length===0)return S}}i(t.length)}function Er(t,r,a){let u=r;while(u<t.length){let x=t[u++];if(x===a)return u;if(x==="\\")u++;else if(a==="`"&&x==="$"&&t[u]==="{")u=qe(t,u)}Te(r)}var br=/\?\s*:/g;function Me(t){let r=t.index,a=t.readIdentifierName();if(a.name!==""){let v=Qn(t);return{...a,typeAnnotation:v}}let u=t.source[t.index];if(u!=="{"&&u!=="[")Z(t.index);t.index=qe(t.source,r);let{node:x}=h(t,`${t.source.slice(0,t.index)} = 1`,r);d(x,"AssignmentExpression");let S=x.left;d(S,"ObjectPattern","ArrayPattern");let g=Qn(t);if(S.typeAnnotation=g,g)S.end=g.end;return S}function Qn(t){let r=t.index;if(t.allowWhitespace(),!t.eat(":")){t.index=r;return}let a="_ as ",u=t.index-a.length,x=t.source.slice(0,u)+a+t.source.slice(t.index).replace(br,":"),S=h(t,x,u).node;if(S.type==="AssignmentExpression"){let g=S.right.start;while(x[g]!=="=")g-=1;S=h(t,x.slice(0,g),u).node}if(S.type==="SequenceExpression")S=S.expressions[0];return d(S,"TSAsExpression"),t.index=S.end,{type:"TSTypeAnnotation",start:r,end:t.index,typeAnnotation:S.typeAnnotation}}var Cr=/\s*}/y,_r={IfBlock:"if",EachBlock:"each",KeyBlock:"key",AwaitBlock:"await",SnippetBlock:"snippet"},Oe=()=>({type:"Fragment",nodes:[]});function Kn(t,r){if(t.eat("if")){t.requireWhitespace();let a=Ce(t);t.eatClosingBrace();let u=Oe();t.open({type:"IfBlock",elseif:!1,start:r,end:-1,test:a,consequent:u,alternate:null},u)}else if(t.eat("each"))wr(t,r);else if(t.eat("await")){t.requireWhitespace();let a=Ce(t);t.allowWhitespace();let u={type:"AwaitBlock",start:r,end:-1,expression:a,value:null,error:null,pending:null,then:null,catch:null},x=Oe();if(t.eat("then"))u.value=Zn(t),u.then=x;else if(t.eat("catch"))u.error=Zn(t),u.catch=x;else u.pending=x;t.eat("}",!0),t.open(u,x)}else if(t.eat("key")){t.requireWhitespace();let a=Ce(t);t.eatClosingBrace();let u=Oe();t.open({type:"KeyBlock",start:r,end:-1,expression:a,fragment:u},u)}else if(t.eat("snippet"))kr(t,r);else J(t.index)}function Zn(t){if(t.matchRegex(Cr))return t.allowWhitespace(),null;t.requireWhitespace();let r=Me(t);return t.allowWhitespace(),r}function vr(t){let r={assertion:null},a=t.end,u=(S)=>{if(S.type==="TSAsExpression"&&S.end===t.end)return r.assertion=S,a=S.expression.end,S.expression;return f(S,u),S},x=t;if(t.type==="TSAsExpression")r.assertion=t,x=t.expression,a=x.end;else f(t,u);return x.end=a,{expression:x,assertion:r.assertion}}function wr(t,r){t.requireWhitespace();let a=t.source,u;while(!u)try{u=Ce(t)}catch(y){let R=((y instanceof e?y.position:void 0)?.[0]??r)-2;while(R>r&&t.source.slice(R,R+2)!=="as")R-=1;if(R<=r)throw t.source=a,y;t.source=a.slice(0,R)}if(t.source=a,t.allowWhitespace(),!t.match("as")){if(u.type==="SequenceExpression")u=u.expressions[0];let y=vr(u);if(u=y.expression,y.assertion){let k=y.assertion.typeAnnotation.start-2;while(t.source.slice(k,k+2)!=="as")k-=1;t.index=k}}let x=null,S,g;if(t.eat("as"))t.requireWhitespace(),x=Me(t);else t.index=u.end;if(t.allowWhitespace(),t.eat(",")){if(t.allowWhitespace(),S=t.readIdentifierName().name,!S)P(t.index);t.allowWhitespace()}if(t.eat("("))t.allowWhitespace(),g=Ce(t),t.allowWhitespace(),t.eat(")",!0),t.allowWhitespace();t.eat("}",!0);let v=Oe();t.open({type:"EachBlock",start:r,end:-1,expression:u,body:v,context:x,index:S,key:g},v)}function kr(t,r){t.requireWhitespace();let a=t.readIdentifierName();if(a.name==="")P(t.index);t.allowWhitespace();let u=t.index,x;if(t.isTypeScript&&t.match("<")){let y=qe(t.source,u,{"<":">"});x=t.source.slice(u+1,y-1),t.index=y}t.allowWhitespace(),t.eat("(",!0);let S=1;while(t.index<t.source.length&&(!t.match(")")||S!==1)){if(t.match("("))S++;if(t.match(")"))S--;t.index+=1}t.eat(")",!0);let{node:g}=h(t,`${t.source.slice(0,t.index)} => {}`,u,!0);d(g,"ArrowFunctionExpression"),t.eatClosingBrace();let v=Oe();t.open({type:"SnippetBlock",start:r,end:-1,expression:a,typeParams:x,parameters:g.params,body:v},v)}function Yn(t,r){let a=t.index-1,u=t.current();if(u.type==="IfBlock"){if(!t.eat("else"))s(a,"{:else} or {:else if}");if(t.eat("if"))V(a);if(t.allowWhitespace(),u.alternate=Oe(),t.setFragment(u.alternate),t.eat("if")){t.requireWhitespace();let x=Ce(t);t.eatClosingBrace();let S=Oe();t.open({start:r,end:-1,type:"IfBlock",elseif:!0,test:x,consequent:S,alternate:null},S)}else t.eatClosingBrace()}else if(u.type==="EachBlock"){if(!t.eat("else"))s(a,"{:else}");t.eatClosingBrace(),u.fallback=Oe(),t.setFragment(u.fallback)}else if(u.type==="AwaitBlock"){let x;if(t.eat("then"))x="then";else if(t.eat("catch"))x="catch";else s(a,"{:then ...} or {:catch ...}");if(u[x])B(a,`{:${x}}`);if(!t.eat("}")){t.requireWhitespace();let g=Me(t);if(x==="then")u.value=g;else u.error=g;t.eatClosingBrace()}let S=Oe();u[x]=S,t.setFragment(S)}else F(a)}function Jn(t){let r=t.current(),a=_r[r.type];if(!a)W(t.index-1);t.eat(a,!0),t.eatClosingBrace();while(r.type==="IfBlock"&&r.elseif)r.end=t.index,t.close(),r=t.current();r.end=t.index,t.close()}var Pr=/\s*}/y;function Rr(t){return t.type==="CallExpression"||t.type==="ChainExpression"&&t.expression.type==="CallExpression"}function et(t,r){if(t.eat("html")){t.requireWhitespace();let a=Ce(t);t.eatClosingBrace(),t.append({type:"HtmlTag",start:r,end:t.index,expression:a})}else if(t.eat("debug")){let a=[];if(!t.read(Pr)){let u=Ce(t),x=u.type==="SequenceExpression"?u.expressions:[u];for(let S of x){if(S.type!=="Identifier")G(S.start);a.push(S)}t.eatClosingBrace()}t.append({type:"DebugTag",start:r,end:t.index,identifiers:a})}else if(t.eat("const")){t.requireWhitespace();let a=Me(t);t.allowWhitespace(),t.eat("=",!0),t.allowWhitespace();let u=t.index,x=Ce(t),S=t.index;if(x.type==="SequenceExpression"&&!t.source.slice(u,x.start).includes("("))z(x);t.eatClosingBrace();let g={type:"VariableDeclarator",id:a,init:x,start:a.start,end:S};t.append({type:"ConstTag",start:r,end:t.index,declaration:{type:"VariableDeclaration",kind:"const",declarations:[g],start:r+2,end:t.index-1}})}else if(t.eat("render")){t.requireWhitespace();let a=Ce(t);if(!Rr(a))ie(a);t.eatClosingBrace(),t.append({type:"RenderTag",start:r,end:t.index,expression:a})}else ee(t.index)}var Or=/(?:var|interface|enum)\b/y,Nr=/(?:let|const|type)\b/y;function nt(t){let r=t.index;if(t.index+=1,t.allowWhitespace(),t.eat("#"))Kn(t,r);else if(t.eat(":"))Yn(t,r);else if(t.eat("@"))et(t,r);else if(t.match("/")&&!t.match("/*")&&!t.match("//"))t.index+=1,Jn(t);else if(!Lr(t,r)){let a=Ce(t);t.eatClosingBrace(),t.append({type:"ExpressionTag",start:r,end:t.index,expression:a})}}function Lr(t,r){let a=t.index,u=t.matchRegex(Or);if(u)C({start:a,end:a+u.length});if(!t.matchRegex(Nr))return!1;let x=t.root.comments.length,S=Ee(t,t.source,a);if(S.type==="ExpressionStatement")return t.root.comments.length=x,!1;if(S.type!=="VariableDeclaration"||S.kind!=="let"&&S.kind!=="const")C(S);return t.index=S.end,t.eatClosingBrace(),t.append({type:"DeclarationTag",start:r,end:t.index,declaration:S}),!0}function rt(t){let{source:r,index:a}=t;if(t.nextAngle<a)t.nextAngle=tt(r,"<",a);if(t.nextBrace<a)t.nextBrace=tt(r,"{",a);let u=Math.min(t.nextAngle,t.nextBrace);t.index=u;let x=r.slice(a,u);t.append({type:"Text",start:a,end:u,raw:x,data:w(x,!1,t.entityNames)})}function tt(t,r,a){let u=t.indexOf(r,a);return u===-1?t.length:u}function m(t,r,a){let u=t.charCodeAt(0)===65279?t.slice(1):t;p(u);let x=new Je(u.trimEnd(),u.length,a,r);while(x.index<x.source.length)if(x.match("<"))Vn(x);else if(x.match("{"))nt(x);else rt(x);if(x.stack.length>1){let y=x.current();if(y.end=y.start+1,y.type==="RegularElement")A(y,y.name);j(y)}let{nodes:S}=x.root.fragment,g=S.findIndex((y)=>y.type==="SvelteOptions"),v=S[g];if(v?.type==="SvelteOptions"){S.splice(g,1),x.root.options=zn(v);let{nodes:y}=v.fragment;if(y.length>0)he({start:y[0].start,end:y[y.length-1].end},v.name)}return x.root}
3
- export{m};