@lipsjs/lips 0.5.0 → 0.6.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/dist/parts.min.js CHANGED
@@ -37,10 +37,10 @@ var F="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000",N="
37
37
  </div>`}}};var X=(t)=>({name:"icons",components:{icon:{static:{get set(){return t}},default:`<let i={ static.set[ input.name ] } color={ input.color || 'currentColor' } size={ input.size || 24 }/>
38
38
  <if( i )><svg class=input.class viewBox=( i.box || '0 0 24 24' ) width=size height=size fill=( i.stroke ? 'none' : color ) stroke=( i.stroke ? color : null ) stroke-width=( i.stroke || null ) stroke-linecap=( i.stroke ? 'round' : null ) stroke-linejoin=( i.stroke ? 'round' : null ) role=( input.label ? 'img' : null ) aria-label=( input.label || null ) aria-hidden=( input.label ? null : 'true' )>
39
39
  <for [d] in=i.paths><path d=d/></for>
40
- </svg></if>`}}});var O=(t,e)=>t.label.toLocaleLowerCase().includes(e.toLocaleLowerCase()),g=(t)=>t.input.of||t.context.popover,Z={name:"combobox",requires:[c],components:{"popover-combobox":{state:{text:"",typing:!1,shown:[],active:-1},handler:{onInput(){let t=this,{options:e=[],value:n}=t.input;t.state.typing||(t.state.text=e.find((i)=>i.id===n)?.label??""),t.find()},onMount(){g(this).trigger=this.refs.el},find(){let t=this,{options:e=[],match:n=O}=t.input,i=t.state;i.shown=i.typing?e.filter((a)=>n(a,i.text)):e.slice(),i.active>=i.shown.length&&(i.active=-1)},typed(t){let e=this,n=e.state,i=g(e);n.text=t.target?.value??"",n.typing=!0,e.find(),n.active=u(n.shown,-1,1),e.emit("query",n.text),i.open||i.set(!0,!1)},key(t){let e=this,n=e.state,i=g(e),a=(o)=>{t.preventDefault?.(),o>=0&&(n.active=o)};switch(t.key){case"ArrowDown":if(!i.open)return i.set(!0,!1),a(n.active>=0?n.active:u(n.shown,-1,1));return a(u(n.shown,n.active,1));case"ArrowUp":if(!i.open)return i.set(!0,!1),a(u(n.shown,n.shown.length,-1));return a(u(n.shown,n.active<0?n.shown.length:n.active,-1));case"Enter":if(!i.open||n.active<0)return;return t.preventDefault?.(),e.pick(n.active);case"Escape":if(!i.open)return;return t.preventDefault?.(),i.set(!1,!1);case"Tab":return i.open&&i.set(!1,!1)}},pick(t){let e=this,n=e.state,i=n.shown[t];if(!i||i.disabled)return;n.text=i.label,n.typing=!1,e.find(),e.emit("change",i),g(e).set(!1)}},default:`<let p={ input.of || context.popover } on={ p.open && state.active >= 0 }/>
41
- <input id="{p.id}-trigger" class=input.class role="combobox" aria-expanded=p.open aria-controls=p.controls aria-autocomplete="list" aria-activedescendant=( on ? p.id + '-' + state.shown[ state.active ].id : null ) aria-label=input.label placeholder=input.placeholder value=state.text @ref="el" on-input( typed ) on-keydown( key )/>
40
+ </svg></if>`}}});var O=(t,e)=>t.label.toLocaleLowerCase().includes(e.toLocaleLowerCase()),g=(t)=>t.input.of||t.context.popover,Z={name:"combobox",requires:[c],components:{"popover-combobox":{state:{text:"",typing:!1,shown:[],active:-1},handler:{onInput(){let t=this,{options:e=[],value:n}=t.input;t.state.typing||(t.state.text=e.find((i)=>i.id===n)?.label??""),t.find()},onMount(){g(this).trigger=this.refs.el},find(){let t=this,{options:e=[],match:n=O}=t.input,i=t.state;i.shown=i.typing?e.filter((a)=>n(a,i.text)):e.slice(),i.active>=i.shown.length&&(i.active=-1)},typed(t){let e=this,n=e.state,i=g(e);n.text=t.target?.value??"",n.typing=!0,e.find(),n.active=u(n.shown,-1,1),e.emit("query",n.text),i.open||i.set(!0,!1)},key(t){let e=this,n=e.state,i=g(e),a=(o)=>{t.preventDefault?.(),o>=0&&(n.active=o)};switch(t.key){case"ArrowDown":if(!i.open)return i.set(!0,!1),a(n.active>=0?n.active:u(n.shown,-1,1));return a(u(n.shown,n.active,1));case"ArrowUp":if(!i.open)return i.set(!0,!1),a(u(n.shown,n.shown.length,-1));return a(u(n.shown,n.active<0?n.shown.length:n.active,-1));case"Enter":if(!i.open||n.active<0)return;return t.preventDefault?.(),e.pick(n.active);case"Escape":if(!i.open)return;return t.preventDefault?.(),e.left(),i.set(!1,!1);case"Tab":return e.left(),i.open&&i.set(!1,!1)}},left(){let t=this,e=t.state;e.typing=!1,e.text=(t.input.options||[]).find((n)=>n.id===t.input.value)?.label??"",t.find()},pick(t){let e=this,n=e.state,i=n.shown[t];if(!i||i.disabled)return;n.text=i.label,n.typing=!1,e.find(),e.emit("change",i),g(e).set(!1)}},default:`<let p={ input.of || context.popover } on={ p.open && state.active >= 0 }/>
41
+ <input id=( input.id || p.id + '-trigger' ) class=input.class role="combobox" aria-expanded=p.open aria-controls=p.controls aria-autocomplete="list" aria-activedescendant=( on ? p.id + '-' + state.shown[ state.active ].id : null ) aria-label=( input.labelledby ? null : input.label ) aria-labelledby=input.labelledby aria-describedby=input.describedby aria-required=( input.required ? 'true' : null ) aria-invalid=( input.invalid ? 'true' : null ) placeholder=input.placeholder value=state.text @ref="el" on-input( typed ) on-keydown( key )/>
42
42
  <popover-content of=p class=input.list popup="content">
43
- <div id=p.id role="listbox" aria-label=input.label>
43
+ <div id=p.id role="listbox" aria-label=( input.labelledby ? null : input.label ) aria-labelledby=input.labelledby>
44
44
  <for [o, i] in=state.shown by="id">
45
45
  <div id="{p.id}-{o.id}" role="option" aria-selected=( o.id === input.value ) class="{input.option}{state.active === i ? ' is-active' : ''}{o.id === input.value ? ' is-selected' : ''}{o.disabled ? ' is-disabled' : ''}" aria-disabled=( o.disabled ? true : null ) on-click( pick, i )>
46
46
  <if( input.renderer )><{input.renderer} option=o active=( state.active === i ) selected=( o.id === input.value )/></if>
@@ -60,7 +60,7 @@ var F="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000",N="
60
60
  <for [item, i] in=input.items by="id">
61
61
  <list-item class=input.row estimated-main-axis-size-px=input.size><{input.renderer} item=item index=i/></list-item>
62
62
  </for>
63
- </list>`}}};var S=(t)=>String(t).padStart(2,"0");function b(t,e,n){let i=new Date(Date.UTC(t,e,n));return`${i.getUTCFullYear()}-${S(i.getUTCMonth()+1)}-${S(i.getUTCDate())}`}var m=(t)=>{let[e,n,i]=t.split("-").map(Number);return[e,n-1,i||1]},A=(t)=>{let[e,n,i]=m(t);return new Date(Date.UTC(e,n,i))},f=(t,e)=>{let[n,i,a]=m(t);return b(n,i,a+e)};function h(t,e){let[n,i,a]=m(t),o=new Date(Date.UTC(n,i+e+1,0)).getUTCDate();return b(n,i+e,Math.min(a,o))}function K(t,e=1){let[n,i]=m(t),a=b(n,i,1),o=f(a,-((A(a).getUTCDay()-e+7)%7)),l=[];do{let s=[];for(let r=0;r<7;r++,o=f(o,1))s.push(o);l.push(s)}while(m(o)[1]===i);return l}var y={months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],prev:"Previous month",next:"Next month"};function W(t){try{let e=(s)=>new Intl.DateTimeFormat(t,{...s,timeZone:"UTC"}),n=e({month:"long"}),i=e({weekday:"long"}),a=e({weekday:"short"}),o=n.format(new Date(Date.UTC(2024,0,15)));if(!o||/\d{4}/.test(o))return y;let l=(s)=>new Date(Date.UTC(2024,0,7+s));return{...y,months:y.months.map((s,r)=>n.format(new Date(Date.UTC(2024,r,15)))),days:y.days.map((s,r)=>i.format(l(r))),short:y.short.map((s,r)=>a.format(l(r))),title:(s,r)=>e({month:"long",year:"numeric"}).format(new Date(Date.UTC(s,r,15))),day:(s,r,p)=>e({dateStyle:"full"}).format(new Date(Date.UTC(s,r,p)))}}catch{return y}}function C(t){try{let e=new Intl.Locale(t),n=e.getWeekInfo?.()??e.weekInfo;if(n?.firstDay)return n.firstDay%7}catch{}return 1}var B=()=>{let t=new Date;return b(t.getFullYear(),t.getMonth(),t.getDate())},tt=0,et=(t)=>t.input.of||t.context.popover,nt=`<div class=input.class>
63
+ </list>`}}};var S=(t)=>String(t).padStart(2,"0");function b(t,e,n){let i=new Date(Date.UTC(t,e,n));return`${i.getUTCFullYear()}-${S(i.getUTCMonth()+1)}-${S(i.getUTCDate())}`}var m=(t)=>{let[e,n,i]=t.split("-").map(Number);return[e,n-1,i||1]},A=(t)=>{let[e,n,i]=m(t);return new Date(Date.UTC(e,n,i))},f=(t,e)=>{let[n,i,a]=m(t);return b(n,i,a+e)};function h(t,e){let[n,i,a]=m(t),o=new Date(Date.UTC(n,i+e+1,0)).getUTCDate();return b(n,i+e,Math.min(a,o))}function B(t,e=1){let[n,i]=m(t),a=b(n,i,1),o=f(a,-((A(a).getUTCDay()-e+7)%7)),l=[];do{let s=[];for(let r=0;r<7;r++,o=f(o,1))s.push(o);l.push(s)}while(m(o)[1]===i);return l}var y={months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],prev:"Previous month",next:"Next month"};function K(t){try{let e=(s)=>new Intl.DateTimeFormat(t,{...s,timeZone:"UTC"}),n=e({month:"long"}),i=e({weekday:"long"}),a=e({weekday:"short"}),o=n.format(new Date(Date.UTC(2024,0,15)));if(!o||/\d{4}/.test(o))return y;let l=(s)=>new Date(Date.UTC(2024,0,7+s));return{...y,months:y.months.map((s,r)=>n.format(new Date(Date.UTC(2024,r,15)))),days:y.days.map((s,r)=>i.format(l(r))),short:y.short.map((s,r)=>a.format(l(r))),title:(s,r)=>e({month:"long",year:"numeric"}).format(new Date(Date.UTC(s,r,15))),day:(s,r,p)=>e({dateStyle:"full"}).format(new Date(Date.UTC(s,r,p)))}}catch{return y}}function C(t){try{let e=new Intl.Locale(t),n=e.getWeekInfo?.()??e.weekInfo;if(n?.firstDay)return n.firstDay%7}catch{}return 1}var q=()=>{let t=new Date;return b(t.getFullYear(),t.getMonth(),t.getDate())},tt=0,et=(t)=>t.input.of||t.context.popover,nt=`<div class=input.class>
64
64
  <div class=input.head>
65
65
  <button class=input.prev aria-label=state.words.prev on-click( prev )><span>‹</span></button>
66
66
  <span id="{static.id}-title" aria-live="polite">{state.title}</span>
@@ -90,11 +90,11 @@ var F="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000",N="
90
90
  </for>
91
91
  </div>
92
92
  </for>
93
- </div>`,at={name:"date-picker",requires:[c],components:{"date-grid":{state:{shown:"",active:"",title:"",words:y,heads:[],weeks:[]},static:{id:"",value:void 0},handler:{onCreate(){this.static.id=`lips-date-${++tt}`},onInput(){let t=this,{value:e}=t.input,n=t.state;if(e!==t.static.value||!n.active)t.static.value=e,n.active=e||n.active||t.input.today||B(),n.shown=n.active.slice(0,7);t.draw()},onAttach(){this.input.autofocus&&this.refs.grid?.focus()},refused(t){let{min:e,max:n,disabled:i}=this.input;return!!(e&&t<e||n&&t>n||i?.(t))},draw(){let t=this,{state:e,input:n}=t,i=n.lang||t.lang||"en",a=n.words||W(i),o=n.first??C(i),l=n.today||B(),[s,r]=m(e.shown);e.words=a,e.title=a.title?a.title(s,r):`${a.months[r]} ${s}`,e.heads=Array.from({length:7},(p,d)=>({short:a.short[(o+d)%7],long:a.days[(o+d)%7]})),e.weeks=K(e.shown,o).map((p)=>({id:p[0],days:p.map((d)=>{let[v,w,x]=m(d),T=t.refused(d),M=d===n.value,q=[n.day,d===e.active&&"is-active",M&&"is-selected",d===l&&"is-today",w!==r&&"is-outside",T&&"is-disabled"],E=A(d).getUTCDay();return{iso:d,n:x,selected:M,disabled:T,cls:q.filter(Boolean).join(" "),label:a.day?a.day(v,w,x,E):`${a.days[E]} ${x} ${a.months[w]} ${v}`}})}))},go(t){let e=this,n=e.state,i=t.slice(0,7);n.active=t,i!==n.shown&&(n.shown=i,e.emit("month",i)),e.draw()},prev(){let t=this;t.go(h(t.state.active,-1))},next(){let t=this;t.go(h(t.state.active,1))},key(t){let e=this,n=e.state.active,i=e.input.first??C(e.input.lang||e.lang||"en"),a=(A(n).getUTCDay()-i+7)%7,o={ArrowLeft:()=>f(n,-1),ArrowRight:()=>f(n,1),ArrowUp:()=>f(n,-7),ArrowDown:()=>f(n,7),Home:()=>f(n,-a),End:()=>f(n,6-a),PageUp:()=>h(n,t.shiftKey?-12:-1),PageDown:()=>h(n,t.shiftKey?12:1)};if(o[t.key])return t.preventDefault?.(),e.go(o[t.key]());if(t.key==="Enter"||t.key===" ")t.preventDefault?.(),e.choose(n)},pick(t){let e=this;if(e.refused(t))return;e.go(t),e.choose(t)},choose(t){let e=this;!e.refused(t)&&e.emit("change",t)}},default:nt,lynx:it},"popover-date":{handler:{choose(t){this.emit("change",t),et(this).set(!1)}},default:`<let p={ input.of || context.popover }/>
93
+ </div>`,at={name:"date-picker",requires:[c],components:{"date-grid":{state:{shown:"",active:"",title:"",words:y,heads:[],weeks:[]},static:{id:"",value:void 0},handler:{onCreate(){this.static.id=`lips-date-${++tt}`},onInput(){let t=this,{value:e}=t.input,n=t.state;if(e!==t.static.value||!n.active)t.static.value=e,n.active=e||n.active||t.input.today||q(),n.shown=n.active.slice(0,7);t.draw()},onAttach(){this.input.autofocus&&this.refs.grid?.focus()},refused(t){let{min:e,max:n,disabled:i}=this.input;return!!(e&&t<e||n&&t>n||i?.(t))},draw(){let t=this,{state:e,input:n}=t,i=n.lang||t.lang||"en",a=n.words||K(i),o=n.first??C(i),l=n.today||q(),[s,r]=m(e.shown);e.words=a,e.title=a.title?a.title(s,r):`${a.months[r]} ${s}`,e.heads=Array.from({length:7},(p,d)=>({short:a.short[(o+d)%7],long:a.days[(o+d)%7]})),e.weeks=B(e.shown,o).map((p)=>({id:p[0],days:p.map((d)=>{let[v,w,x]=m(d),T=t.refused(d),M=d===n.value,W=[n.day,d===e.active&&"is-active",M&&"is-selected",d===l&&"is-today",w!==r&&"is-outside",T&&"is-disabled"],E=A(d).getUTCDay();return{iso:d,n:x,selected:M,disabled:T,cls:W.filter(Boolean).join(" "),label:a.day?a.day(v,w,x,E):`${a.days[E]} ${x} ${a.months[w]} ${v}`}})}))},go(t){let e=this,n=e.state,i=t.slice(0,7);n.active=t,i!==n.shown&&(n.shown=i,e.emit("month",i)),e.draw()},prev(){let t=this;t.go(h(t.state.active,-1))},next(){let t=this;t.go(h(t.state.active,1))},key(t){let e=this,n=e.state.active,i=e.input.first??C(e.input.lang||e.lang||"en"),a=(A(n).getUTCDay()-i+7)%7,o={ArrowLeft:()=>f(n,-1),ArrowRight:()=>f(n,1),ArrowUp:()=>f(n,-7),ArrowDown:()=>f(n,7),Home:()=>f(n,-a),End:()=>f(n,6-a),PageUp:()=>h(n,t.shiftKey?-12:-1),PageDown:()=>h(n,t.shiftKey?12:1)};if(o[t.key])return t.preventDefault?.(),e.go(o[t.key]());if(t.key==="Enter"||t.key===" ")t.preventDefault?.(),e.choose(n)},pick(t){let e=this;if(e.refused(t))return;e.go(t),e.choose(t)},choose(t){let e=this;!e.refused(t)&&e.emit("change",t)}},default:nt,lynx:it},"popover-date":{handler:{choose(t){this.emit("change",t),et(this).set(!1)}},default:`<let p={ input.of || context.popover }/>
94
94
  <popover-content of=p class=input.class popup="content">
95
95
  <div id=p.id role="dialog" aria-label=input.label>
96
96
  <date-grid value=input.value min=input.min max=input.max disabled=input.disabled first=input.first lang=input.lang words=input.words today=input.today class=input.grid head=input.head prev=input.prev next=input.next week=input.week weekday=input.weekday day=input.day autofocus=true on-change( choose )/>
97
97
  </div>
98
- </popover-content>`}}};export{N as CENTER,y as ENGLISH,z as FILL,F as LAYER,f as addDays,h as addMonths,W as calendarWords,Z as combobox,O as contains,at as datePicker,G as dialog,C as firstDay,R as frame,X as icons,U as inert,b as isoOf,k as layer,_ as menu,u as move,I as place,c as popover,Q as reveal,J as toast,L as typed,V as virtualList,K as weeksOf};
98
+ </popover-content>`}}};export{N as CENTER,y as ENGLISH,z as FILL,F as LAYER,f as addDays,h as addMonths,K as calendarWords,Z as combobox,O as contains,at as datePicker,G as dialog,C as firstDay,R as frame,X as icons,U as inert,b as isoOf,k as layer,_ as menu,u as move,I as place,c as popover,Q as reveal,J as toast,L as typed,V as virtualList,B as weeksOf};
99
99
 
100
- //# debugId=1E9B697F414CDBC264756E2164756E21
100
+ //# debugId=AC7DB3834EDBC9E464756E2164756E21
@@ -8,12 +8,12 @@
8
8
  "/**\n * Dialog: a panel over the whole page that holds the page still until it\n * closes (RFC-008 §5; WAI-ARIA's modal dialog).\n *\n * lips.use( dialog ) // and the popover and layer it is built on\n *\n * <popover open=state.editing on-change( setEditing )>\n * <popover-trigger haspopup=\"dialog\"><span>Rename</span></popover-trigger>\n * <popover-dialog class=\"sheet\" blur=8 on-placed( started )>\n * <dialog-title class=\"title\"><span>Rename the file</span></dialog-title>\n * …\n * </popover-dialog>\n * </popover>\n *\n * It is a popover's: the popover holds whether it is open (the app's\n * `open`), its id and its trigger, and a dialog opened with no trigger is\n * the same with none written. Named `popover-dialog`: `dialog` is an HTML\n * element.\n *\n * Open, it is a centred panel in the layer (`page-layer`, `./layer`),\n * `role=\"dialog\"` (or the app's `role`, as `alertdialog`), `aria-modal`,\n * labelled by its `dialog-title`, or by `label` where it has none. Focus\n * goes to the panel, which a screen reader reads by its title; it says\n * `placed` then, for the app to move focus on to a field. The page behind\n * it is held still:\n * - on the web, the rest of the page is `inert`, and Tab and Shift+Tab\n * go round what can be focused in it;\n * - on Lynx, `aria-modal` is `accessibility-exclusive-focus` (RFC-006\n * §4.8): a screen reader stays inside it. Lynx has no Tab.\n *\n * It closes on Escape and on a tap on the backdrop, and whenever the app's\n * `open` turns false (its own button, a saved form); then the page is\n * given back and focus goes back to the trigger.\n */\nimport type { Plugin } from '../types'\nimport { popover } from './popover'\n\n/** What can take focus, on the DOM */\nconst FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\n/**\n * Everything in the page's body but `el` and what holds it made `inert`;\n * what undoes it. What is already inert is left as it is, and stays. On\n * the DOM only: a Lynx node has no `parentElement`.\n */\nexport function inert( el: any ): () => void {\n const made: Element[] = []\n for( let n = el; n?.parentElement && n !== n.ownerDocument.body; n = n.parentElement )\n for( const s of n.parentElement.children )\n s !== n && !s.hasAttribute('inert') && ( s.setAttribute( 'inert', '' ), made.push( s ) )\n\n return () => made.forEach( s => s.removeAttribute('inert') )\n}\n\nexport const dialog: Plugin = {\n name: 'dialog',\n requires: [ popover ],\n components: {\n 'popover-dialog': {\n handler: {\n placed(){ ( this as any ).emit('placed') }\n },\n default: `<let p={ input.of || context.popover }/>\n<if( p.open )><dialog-layer of=p class=input.class role=input.role label=input.label backdrop=input.backdrop blur=input.blur effect=input.effect on-placed( placed )><{input.renderer}/></dialog-layer></if>`\n },\n\n /** Mounted each time the dialog opens, gone when it closes */\n 'dialog-layer': {\n static: { panel: 'position: relative', restore: null as null | ( () => void ) },\n handler: {\n /** In the page: the rest of it held still, focus on the panel */\n live( layer: any ){\n const self = this as any\n self.static.restore = inert( layer )\n self.refs.panel?.focus()\n self.emit('placed')\n },\n /** Closed, however it closed: the page given back, then focus, which an inert trigger would refuse */\n onDestroy(){\n const self = this as any\n self.static.restore?.()\n self.input.of.trigger?.focus()\n },\n dismiss(){ ( this as any ).input.of.set( false ) },\n /** Tab and Shift+Tab go round what can be focused in it */\n trap( e: KeyboardEvent ){\n const panel = ( this as any ).refs.panel\n if( e.key !== 'Tab' || !panel?.querySelectorAll ) return\n\n const all = [ ...panel.querySelectorAll( FOCUSABLE ) ] as HTMLElement[], at = panel.ownerDocument.activeElement\n const to = !all.length ? panel\n : e.shiftKey && ( at === all[ 0 ] || at === panel ) ? all[ all.length - 1 ]\n : !e.shiftKey && at === all[ all.length - 1 ] ? all[ 0 ]\n : null\n if( !to ) return\n e.preventDefault()\n to.focus()\n }\n },\n default: `<let p=input.of/>\n<page-layer center=true backdrop=input.backdrop blur=input.blur effect=input.effect on-live( live ) on-dismiss( dismiss )>\n <div id=p.id class=input.class role=( input.role || 'dialog' ) aria-modal=\"true\" aria-label=input.label aria-labelledby=( input.label ? null : p.id + '-title' ) tabindex=\"-1\" style=static.panel @ref=\"panel\" on-keydown( trap )><{input.renderer}/></div>\n</page-layer>`\n },\n\n /** The dialog's title, and so its label */\n 'dialog-title': {\n default: `<let p={ input.of || context.popover }/>\n<div id=\"{p.id}-title\" role=\"heading\" class=input.class><{input.renderer}/></div>`\n }\n }\n}\n",
9
9
  "/**\n * Toasts: short messages in a region a screen reader is told of as they\n * come (RFC-008 §5; WAI-ARIA's status and alert).\n *\n * lips.use( toast )\n *\n * <toast-region items=state.toasts class=\"toasts\" item=\"toast\" act=\"toast-act\" on-dismiss( drop ) on-act( undo )/>\n * <toast-region items=state.errors role=\"alert\" … />\n *\n * The queue is the app's: `items` are data, `{ id, text, action?,\n * duration? }`, and the region asks for one to go with `dismiss`, which\n * the app does by taking it out. It is controlled, as every part is; it\n * holds only each toast's time left.\n *\n * The region is always drawn, empty or not, so what comes into it is\n * announced: `role=\"status\"` (polite) by default, or `alert` (assertive),\n * for errors. On Lynx, Lips announces a live region's new text through\n * `lynx.accessibilityAnnounce` (RFC-006 §4.8).\n *\n * A toast leaves by itself after its `duration` (or the region's, 5 s by\n * default), and not while the pointer or the focus is on it: its time is\n * held, and goes on from where it was. One that offers an `action` never\n * leaves by itself (WCAG 2.2.1): its button says `act`, and the app\n * decides when it goes. Each toast is drawn as its text and its action, or\n * by the slot, which gets `item`.\n */\nimport type { Plugin } from '../types'\n\nexport interface Toast {\n readonly id: string\n readonly text: string\n /** A button's words: a toast with one stays until the app takes it out */\n readonly action?: string\n /** How long it stays, in ms */\n readonly duration?: number\n}\n\nexport const toast: Plugin = {\n name: 'toast',\n components: {\n 'toast-region': {\n handler: {\n dismiss( t: Toast ){ ( this as any ).emit( 'dismiss', t ) },\n act( t: Toast ){ ( this as any ).emit( 'act', t ) }\n },\n default: `<div class=input.class role=( input.role || 'status' )>\n <for [t] in=input.items by=\"id\">\n <toast-item item=t class=input.item act=input.act duration=input.duration row=input.renderer on-dismiss( dismiss ) on-act( act )/>\n </for>\n</div>`\n },\n\n /** One toast: its own time */\n 'toast-item': {\n static: { timer: null as any, left: null as number | null, since: 0 },\n handler: {\n onMount(){\n const self = this as any, { item, duration } = self.input\n if( item.action ) return\n self.static.left = item.duration ?? duration ?? 5000\n self.resume()\n },\n /** The pointer or the focus came onto it: its time is held */\n pause(){\n const s = ( this as any ).static\n if( s.timer === null ) return\n clearTimeout( s.timer )\n s.timer = null\n s.left = Math.max( 1, s.left - ( Date.now() - s.since ) )\n },\n resume(){\n const self = this as any, s = self.static\n if( s.left === null || s.timer !== null ) return\n s.since = Date.now()\n // It asks once: the app takes it out\n s.timer = setTimeout( () => { s.timer = s.left = null; self.emit( 'dismiss', self.input.item ) }, s.left )\n },\n act(){ ( this as any ).emit( 'act', ( this as any ).input.item ) }\n },\n default: `<div class=input.class on-mouseenter( pause ) on-mouseleave( resume ) on-focusin( pause ) on-focusout( resume )>\n <if( input.row )><{input.row} item=input.item/></if>\n <else>\n <span>{input.item.text}</span>\n <if( input.item.action )><button class=input.act on-click( act )><span>{input.item.action}</span></button></if>\n </else>\n</div>`\n }\n }\n}\n",
10
10
  "/**\n * Icons: a set as data, drawn as inline svg (RFC-008 §5; lips#34).\n *\n * lips.use( icons({ check: { paths: [ 'M5 12l5 5L20 7' ], stroke: 2 }, … }) )\n *\n * <icon name=\"check\" size=16 color=state.tone/>\n * <button><icon name=\"close\" label=\"Close\"/></button>\n *\n * Each icon is its paths (`d`), its `box` (`0 0 24 24` by default), and a\n * stroke width for a line icon (drawn with no fill, round ends), or none\n * for a filled one. Its colour is bound into its markup: `color`, or the\n * text's (`currentColor`) on the web. On Lynx give `color`: Lynx draws an\n * svg from its markup, where neither a custom property nor the text's\n * colour reaches (RFC-008 §3).\n *\n * An icon with no `label` is `aria-hidden`; one with a label is an image\n * by that name, and alone in a button gives the button its label, on both\n * hosts. A name the set does not hold draws nothing.\n *\n * One set per Lips: a second `icons(…)` is refused as another plugin of\n * the same name. Merge sets before using them.\n */\nimport type { Plugin } from '../types'\n\nexport interface Icon {\n readonly paths: readonly string[]\n readonly box?: string\n /** A line icon's stroke width; none for a filled icon */\n readonly stroke?: number\n}\nexport type IconSet = Readonly<Record<string, Icon>>\n\nexport const icons = ( set: IconSet ): Plugin => ({\n name: 'icons',\n components: {\n 'icon': {\n // A getter stays a getter in each instance's `static` (`ir/initial`): the set is shared, not copied\n static: { get set(){ return set } },\n default: `<let i={ static.set[ input.name ] } color={ input.color || 'currentColor' } size={ input.size || 24 }/>\n<if( i )><svg class=input.class viewBox=( i.box || '0 0 24 24' ) width=size height=size fill=( i.stroke ? 'none' : color ) stroke=( i.stroke ? color : null ) stroke-width=( i.stroke || null ) stroke-linecap=( i.stroke ? 'round' : null ) stroke-linejoin=( i.stroke ? 'round' : null ) role=( input.label ? 'img' : null ) aria-label=( input.label || null ) aria-hidden=( input.label ? null : 'true' )>\n <for [d] in=i.paths><path d=d/></for>\n</svg></if>`\n }\n }\n})\n",
11
- "/**\n * Combobox: a text field and the options it finds as the person types\n * (RFC-008 §5; WAI-ARIA's combobox with a listbox, list autocomplete).\n *\n * lips.use( combobox ) // and the popover it is built on\n *\n * <popover open=state.open on-change( setOpen )>\n * <popover-combobox options=state.people value=state.owner class=\"field\" list=\"options\" option=\"option\" on-change( setOwner )/>\n * </popover>\n *\n * Its options are data, `{ id, label, disabled? }`, as a menu's items are;\n * `value` is the chosen option's id, the app's, and a choice comes back as\n * `change` with the option. What is typed is the combobox's own: it finds\n * the options that `match` it (`contains` by default, the label holding\n * the text, in any case), and says `query` with it for an app that finds\n * them itself, which gives `match=( () => true )` and its own `options`.\n *\n * The field is the popover's trigger: typing opens the list, on the first\n * option found. Focus stays in the field, which names the active option\n * with `aria-activedescendant`; ArrowDown and ArrowUp open the list and\n * move through it past disabled options, Enter chooses, Escape closes,\n * Tab closes and lets focus go on. Home and End stay the field's own. A\n * tap chooses the option tapped. Chosen, the field shows its label.\n *\n * On Lynx, which has neither a combobox nor a listbox role, and no keys\n * but the soft keyboard's: the person types and taps, each option is a\n * button, and the chosen one says so (`aria-selected`).\n *\n * The active option has the class `is-active`; the chosen one,\n * `is-selected`; a disabled one, `aria-disabled` and `is-disabled`. Each\n * is drawn as its label, or by the slot, which gets `option`, `active`\n * and `selected`.\n */\nimport type { Plugin } from '../types'\nimport { popover, type PopoverApi } from './popover'\nimport { move, type MenuItem } from './menu'\n\nexport type Option = MenuItem\nexport type Match = ( option: Option, text: string ) => boolean\n\n/** The label holds the text, in any case */\nexport const contains: Match = ( option, text ) => option.label.toLocaleLowerCase().includes( text.toLocaleLowerCase() )\n\nconst partOf = ( self: any ): PopoverApi => self.input.of || self.context.popover\n\nexport const combobox: Plugin = {\n name: 'combobox',\n requires: [ popover ],\n components: {\n 'popover-combobox': {\n state: { text: '', typing: false, shown: [] as Option[], active: -1 },\n handler: {\n /** Given new options or a new value: what is shown follows, and the field shows the chosen label unless typed in */\n onInput(){\n const self = this as any, { options = [], value } = self.input\n self.state.typing || ( self.state.text = options.find( ( o: Option ) => o.id === value )?.label ?? '' )\n self.find()\n },\n onMount(){ partOf( this ).trigger = ( this as any ).refs.el },\n find(){\n const self = this as any, { options = [], match = contains } = self.input, s = self.state\n s.shown = s.typing ? options.filter( ( o: Option ) => match( o, s.text ) ) : options.slice()\n s.active >= s.shown.length && ( s.active = -1 )\n },\n typed( e: any ){\n const self = this as any, s = self.state, p = partOf( self )\n s.text = e.target?.value ?? ''\n s.typing = true\n self.find()\n s.active = move( s.shown, -1, 1 )\n self.emit( 'query', s.text )\n p.open || p.set( true, false )\n },\n key( e: KeyboardEvent ){\n const self = this as any, s = self.state, p = partOf( self )\n const go = ( i: number ) => { e.preventDefault?.(); i >= 0 && ( s.active = i ) }\n\n switch( e.key ){\n case 'ArrowDown':\n if( !p.open ){ p.set( true, false ); return go( s.active >= 0 ? s.active : move( s.shown, -1, 1 ) ) }\n return go( move( s.shown, s.active, 1 ) )\n case 'ArrowUp':\n if( !p.open ){ p.set( true, false ); return go( move( s.shown, s.shown.length, -1 ) ) }\n return go( move( s.shown, s.active < 0 ? s.shown.length : s.active, -1 ) )\n case 'Enter':\n if( !p.open || s.active < 0 ) return\n e.preventDefault?.()\n return self.pick( s.active )\n case 'Escape':\n if( !p.open ) return\n e.preventDefault?.()\n return p.set( false, false )\n case 'Tab': return p.open && p.set( false, false )\n }\n },\n pick( i: number ){\n const self = this as any, s = self.state, o: Option | undefined = s.shown[ i ]\n if( !o || o.disabled ) return\n s.text = o.label\n s.typing = false\n self.find()\n self.emit( 'change', o )\n partOf( self ).set( false )\n }\n },\n default: `<let p={ input.of || context.popover } on={ p.open && state.active >= 0 }/>\n<input id=\"{p.id}-trigger\" class=input.class role=\"combobox\" aria-expanded=p.open aria-controls=p.controls aria-autocomplete=\"list\" aria-activedescendant=( on ? p.id + '-' + state.shown[ state.active ].id : null ) aria-label=input.label placeholder=input.placeholder value=state.text @ref=\"el\" on-input( typed ) on-keydown( key )/>\n<popover-content of=p class=input.list popup=\"content\">\n <div id=p.id role=\"listbox\" aria-label=input.label>\n <for [o, i] in=state.shown by=\"id\">\n <div id=\"{p.id}-{o.id}\" role=\"option\" aria-selected=( o.id === input.value ) class=\"{input.option}{state.active === i ? ' is-active' : ''}{o.id === input.value ? ' is-selected' : ''}{o.disabled ? ' is-disabled' : ''}\" aria-disabled=( o.disabled ? true : null ) on-click( pick, i )>\n <if( input.renderer )><{input.renderer} option=o active=( state.active === i ) selected=( o.id === input.value )/></if>\n <else><span>{o.label}</span></else>\n </div>\n </for>\n </div>\n</popover-content>`\n }\n }\n}\n",
11
+ "/**\n * Combobox: a text field and the options it finds as the person types\n * (RFC-008 §5; WAI-ARIA's combobox with a listbox, list autocomplete).\n *\n * lips.use( combobox ) // and the popover it is built on\n *\n * <popover open=state.open on-change( setOpen )>\n * <popover-combobox options=state.people value=state.owner class=\"field\" list=\"options\" option=\"option\" on-change( setOwner )/>\n * </popover>\n *\n * Its options are data, `{ id, label, disabled? }`, as a menu's items are;\n * `value` is the chosen option's id, the app's, and a choice comes back as\n * `change` with the option. What is typed is the combobox's own: it finds\n * the options that `match` it (`contains` by default, the label holding\n * the text, in any case), and says `query` with it for an app that finds\n * them itself, which gives `match=( () => true )` and its own `options`.\n *\n * The field is the popover's trigger: typing opens the list, on the first\n * option found. Focus stays in the field, which names the active option\n * with `aria-activedescendant`; ArrowDown and ArrowUp open the list and\n * move through it past disabled options, Enter chooses, Escape closes,\n * Tab closes and lets focus go on. Home and End stay the field's own. A\n * tap chooses the option tapped. Chosen, the field shows its label.\n *\n * On Lynx, which has neither a combobox nor a listbox role, and no keys\n * but the soft keyboard's: the person types and taps, each option is a\n * button, and the chosen one says so (`aria-selected`).\n *\n * In a form, the field is the app's: `id` names it, for a `<label for>`\n * and for the app to focus it; `labelledby` labels it and its list by an\n * element of the app's in place of `label`; `describedby`, `required` and\n * `invalid` say what the app says of its own fields. Text typed and left,\n * by Escape or Tab, goes back to the chosen option's label: the field\n * shows what is chosen, never what was only typed.\n *\n * The active option has the class `is-active`; the chosen one,\n * `is-selected`; a disabled one, `aria-disabled` and `is-disabled`. Each\n * is drawn as its label, or by the slot, which gets `option`, `active`\n * and `selected`.\n */\nimport type { Plugin } from '../types'\nimport { popover, type PopoverApi } from './popover'\nimport { move, type MenuItem } from './menu'\n\nexport type Option = MenuItem\nexport type Match = ( option: Option, text: string ) => boolean\n\n/** The label holds the text, in any case */\nexport const contains: Match = ( option, text ) => option.label.toLocaleLowerCase().includes( text.toLocaleLowerCase() )\n\nconst partOf = ( self: any ): PopoverApi => self.input.of || self.context.popover\n\nexport const combobox: Plugin = {\n name: 'combobox',\n requires: [ popover ],\n components: {\n 'popover-combobox': {\n state: { text: '', typing: false, shown: [] as Option[], active: -1 },\n handler: {\n /** Given new options or a new value: what is shown follows, and the field shows the chosen label unless typed in */\n onInput(){\n const self = this as any, { options = [], value } = self.input\n self.state.typing || ( self.state.text = options.find( ( o: Option ) => o.id === value )?.label ?? '' )\n self.find()\n },\n onMount(){ partOf( this ).trigger = ( this as any ).refs.el },\n find(){\n const self = this as any, { options = [], match = contains } = self.input, s = self.state\n s.shown = s.typing ? options.filter( ( o: Option ) => match( o, s.text ) ) : options.slice()\n s.active >= s.shown.length && ( s.active = -1 )\n },\n typed( e: any ){\n const self = this as any, s = self.state, p = partOf( self )\n s.text = e.target?.value ?? ''\n s.typing = true\n self.find()\n s.active = move( s.shown, -1, 1 )\n self.emit( 'query', s.text )\n p.open || p.set( true, false )\n },\n key( e: KeyboardEvent ){\n const self = this as any, s = self.state, p = partOf( self )\n const go = ( i: number ) => { e.preventDefault?.(); i >= 0 && ( s.active = i ) }\n\n switch( e.key ){\n case 'ArrowDown':\n if( !p.open ){ p.set( true, false ); return go( s.active >= 0 ? s.active : move( s.shown, -1, 1 ) ) }\n return go( move( s.shown, s.active, 1 ) )\n case 'ArrowUp':\n if( !p.open ){ p.set( true, false ); return go( move( s.shown, s.shown.length, -1 ) ) }\n return go( move( s.shown, s.active < 0 ? s.shown.length : s.active, -1 ) )\n case 'Enter':\n if( !p.open || s.active < 0 ) return\n e.preventDefault?.()\n return self.pick( s.active )\n case 'Escape':\n if( !p.open ) return\n e.preventDefault?.()\n self.left()\n return p.set( false, false )\n case 'Tab':\n self.left()\n return p.open && p.set( false, false )\n }\n },\n /** What was typed and not chosen, given up: the field shows the chosen label again */\n left(){\n const self = this as any, s = self.state\n s.typing = false\n s.text = ( self.input.options || [] ).find( ( o: Option ) => o.id === self.input.value )?.label ?? ''\n self.find()\n },\n pick( i: number ){\n const self = this as any, s = self.state, o: Option | undefined = s.shown[ i ]\n if( !o || o.disabled ) return\n s.text = o.label\n s.typing = false\n self.find()\n self.emit( 'change', o )\n partOf( self ).set( false )\n }\n },\n default: `<let p={ input.of || context.popover } on={ p.open && state.active >= 0 }/>\n<input id=( input.id || p.id + '-trigger' ) class=input.class role=\"combobox\" aria-expanded=p.open aria-controls=p.controls aria-autocomplete=\"list\" aria-activedescendant=( on ? p.id + '-' + state.shown[ state.active ].id : null ) aria-label=( input.labelledby ? null : input.label ) aria-labelledby=input.labelledby aria-describedby=input.describedby aria-required=( input.required ? 'true' : null ) aria-invalid=( input.invalid ? 'true' : null ) placeholder=input.placeholder value=state.text @ref=\"el\" on-input( typed ) on-keydown( key )/>\n<popover-content of=p class=input.list popup=\"content\">\n <div id=p.id role=\"listbox\" aria-label=( input.labelledby ? null : input.label ) aria-labelledby=input.labelledby>\n <for [o, i] in=state.shown by=\"id\">\n <div id=\"{p.id}-{o.id}\" role=\"option\" aria-selected=( o.id === input.value ) class=\"{input.option}{state.active === i ? ' is-active' : ''}{o.id === input.value ? ' is-selected' : ''}{o.disabled ? ' is-disabled' : ''}\" aria-disabled=( o.disabled ? true : null ) on-click( pick, i )>\n <if( input.renderer )><{input.renderer} option=o active=( state.active === i ) selected=( o.id === input.value )/></if>\n <else><span>{o.label}</span></else>\n </div>\n </for>\n </div>\n</popover-content>`\n }\n }\n}\n",
12
12
  "/**\n * A region that reveals and folds: a button and the content it shows, in\n * the page's flow (RFC-008 §5; WAI-ARIA's disclosure).\n *\n * lips.use( reveal ) // and the popover it is built on\n *\n * <popover open=state.more on-change( setMore )>\n * <popover-trigger class=\"more\"><span>Details</span></popover-trigger>\n * <reveal-region class=\"details\" keep=true>…</reveal-region>\n * </popover>\n *\n * It is a popover's: the popover holds whether it is open (the app's\n * `open`) and its id, and its trigger is the button, `aria-expanded`\n * and controlling the region while it shows. The region is not a layer:\n * it takes its place in the page, takes no focus, and nothing closes it\n * but the button and the app.\n *\n * Folded, it renders nothing, or with `keep` stays rendered and hidden\n * (`display: none`, which hides it from a screen reader on both hosts), so\n * what was typed in it stays. With a `role` (`region`), it is named by\n * its button.\n */\nimport type { Plugin } from '../types'\nimport { popover } from './popover'\n\nexport const reveal: Plugin = {\n name: 'reveal',\n requires: [ popover ],\n components: {\n 'reveal-region': {\n static: { folded: 'display: none' },\n default: `<let p={ input.of || context.popover }/>\n<if( p.open || input.keep )><div id=p.id class=input.class role=input.role aria-labelledby=( input.role ? p.id + '-trigger' : null ) style=( p.open ? null : static.folded )><{input.renderer}/></div></if>`\n }\n }\n}\n",
13
13
  "/**\n * Virtual list and grid: a long list of rows of one size, of which only\n * what is in view is drawn (RFC-008 §5).\n *\n * lips.use( virtualList )\n *\n * <virtual-list items=state.rows size=40 class=\"rows\" row=\"row\" [item, index]>\n * <span>{item.name}</span>\n * </virtual-list>\n * <virtual-list items=state.photos size=120 columns=3 …/>\n * <virtual-list items=state.lines size=32 role=\"grid\" …/>\n *\n * Its items are data, each with an `id`; `size` is a row's height in px,\n * `columns` how many items a row holds (1 by default), `overscan` how many\n * rows past the view are drawn too (3). Each item is drawn by the slot,\n * which gets `item` and `index`, in a box of the class `row`.\n *\n * On the web, the list is a box that scrolls, and only the rows in view\n * and the overscan are in the page, each placed where it falls. As\n * `grid` or `table` (`role`), a list of one column says how many rows it\n * has (`aria-rowcount`) and each row which it is (`aria-rowindex`), so a\n * screen reader knows where it is among rows that are not drawn.\n *\n * On Lynx, it is Lynx's own `list`, which draws only the cells in view and\n * recycles them (RFC-006 §4.5): every row is a `list-item`, `size` its\n * estimated height, `columns` its `span-count`. Its markup is its `lynx`\n * source (`lynxComponents`, `./lynx`).\n *\n * Not yet: rows of different heights, measured as they are drawn.\n */\nimport type { Plugin } from '../types'\n\n/** What is drawn of a list: each item in view, its index, and where its box goes */\nexport interface Placed<T = any> { id: unknown, item: T, index: number, style: string }\n\n/**\n * The items of a list of `count` in view of a box scrolled to `top` and\n * `height` high, in rows of `size` px holding `columns` each, with\n * `overscan` rows each side: from the first index, to the one past the last.\n */\nexport function frame( count: number, top: number, height: number, size: number, columns = 1, overscan = 3 ): [ number, number ] {\n if( !( size > 0 ) ) return [ 0, 0 ]\n const rows = Math.ceil( count / columns )\n const first = Math.max( 0, Math.floor( top / size ) - overscan )\n const last = Math.min( rows, Math.ceil( ( top + height ) / size ) + overscan )\n return [ first * columns, Math.min( count, last * columns ) ]\n}\n\nexport const virtualList: Plugin = {\n name: 'virtual-list',\n components: {\n 'virtual-list': {\n state: { shown: [] as Placed[], height: 0, rows: 0 },\n static: { top: 0, box: 'overflow-y: auto; position: relative' },\n handler: {\n /** Given new items, or a new size: what is in view is drawn again */\n onInput(){ ( this as any ).draw() },\n /** In the page: the box is measured, and what fits is drawn */\n async onAttach(){\n const self = this as any, b = await self.refs.box?.getBoundingClientRect()\n self.state.height = b?.height || 0\n self.draw()\n },\n scrolled( e: any ){\n const self = this as any, t = e.target\n self.static.top = t?.scrollTop || 0\n t?.clientHeight && ( self.state.height = t.clientHeight )\n self.draw()\n },\n draw(){\n const self = this as any, { items = [], size = 0, columns = 1, overscan = 3 } = self.input\n const [ from, to ] = frame( items.length, self.static.top, self.state.height, size, columns, overscan )\n const width = 100 / columns, shown: Placed[] = []\n\n for( let i = from; i < to; i++ ){\n const line = Math.floor( i / columns ), at = i % columns\n shown.push({ id: items[ i ].id, item: items[ i ], index: i,\n style: `position: absolute; top: ${line * size}px; left: ${at * width}%; width: ${width}%; height: ${size}px` })\n }\n self.state.rows = Math.ceil( items.length / columns )\n self.state.shown = shown\n }\n },\n default: `<let rows={ ( input.role === 'grid' || input.role === 'table' ) && !( input.columns > 1 ) }/>\n<div class=input.class role=input.role aria-rowcount=( rows ? state.rows : null ) style=static.box @ref=\"box\" on-scroll( scrolled )>\n <div style=\"position: relative; height: {state.rows * ( input.size || 0 )}px\">\n <for [p] in=state.shown by=\"id\">\n <div class=input.row role=( rows ? 'row' : null ) aria-rowindex=( rows ? p.index + 1 : null ) style=p.style><{input.renderer} item=p.item index=p.index/></div>\n </for>\n </div>\n</div>`,\n lynx: `<list class=input.class list-type=( input.columns > 1 ? 'flow' : 'single' ) span-count=( input.columns || 1 )>\n <for [item, i] in=input.items by=\"id\">\n <list-item class=input.row estimated-main-axis-size-px=input.size><{input.renderer} item=item index=i/></list-item>\n </for>\n</list>`\n }\n }\n}\n",
14
14
  "/**\n * Date picker: a month as a grid of days (RFC-008 §5; WAI-ARIA's date\n * picker grid).\n *\n * lips.use( datePicker ) // and the popover it is built on\n *\n * <date-grid value=state.due min=\"2026-01-01\" class=\"cal\" day=\"day\" on-change( setDue )/>\n *\n * <popover open=state.picking on-change( setPicking )>\n * <popover-trigger haspopup=\"dialog\"><span>{state.due}</span></popover-trigger>\n * <popover-date value=state.due label=\"Due date\" class=\"sheet\" day=\"day\" on-change( setDue )/>\n * </popover>\n *\n * Dates are ISO days, `YYYY-MM-DD`, computed in UTC so no clock change\n * moves one. `value` is the app's, and a choice comes back as `change`;\n * the month shown and the day under the keyboard are the grid's own, and\n * a new month shown says `month` (`YYYY-MM`).\n *\n * The grid keeps focus and names the active day with\n * `aria-activedescendant`, as a menu does. Left and Right move a day, Up\n * and Down a week, Home and End to the week's ends, Page Up and Page Down\n * a month (with Shift, a year), Enter or Space chooses; the buttons each\n * side of the title move a month. A day before `min`, after `max`, or one\n * `disabled( iso )` refuses is `aria-disabled` and cannot be chosen.\n *\n * The names of months and days, and the first day of the week, are the\n * reader's language's (`lang`, or the component's): from `Intl` where it\n * formats dates, which Lynx's PrimJS is not known to (`./i18n`), and from\n * `words` where it does not, or English. `first` (0 for Sunday) overrides\n * the week's start.\n *\n * Each day has the class `day` and, as it is, `is-active`, `is-selected`,\n * `is-today`, `is-outside` (of the month shown) and `is-disabled`. On\n * Lynx, which has no grid role, each day is a button, and the chosen one\n * says so (`aria-selected`): its markup is its `lynx` source.\n *\n * `popover-date` is the grid in a popover's layer, as a dialog of its\n * `label`: focused on the chosen day, or today, when it opens, and closed,\n * focus back on the trigger, when a day is chosen.\n */\nimport type { Plugin } from '../types'\nimport { popover, type PopoverApi } from './popover'\n\nconst pad = ( n: number ) => String( n ).padStart( 2, '0' )\n\n/** The ISO day of a year, a month from 0 and a day, carried over as `Date.UTC` carries it */\nexport function isoOf( y: number, m: number, d: number ): string {\n const t = new Date( Date.UTC( y, m, d ) )\n return `${t.getUTCFullYear()}-${pad( t.getUTCMonth() + 1 )}-${pad( t.getUTCDate() )}`\n}\nconst partsOf = ( iso: string ) => { const [ y, m, d ] = iso.split('-').map( Number ); return [ y, m - 1, d || 1 ] }\nconst dayOf = ( iso: string ) => { const [ y, m, d ] = partsOf( iso ); return new Date( Date.UTC( y, m, d ) ) }\n\n/** `days` later, or earlier */\nexport const addDays = ( iso: string, days: number ) => { const [ y, m, d ] = partsOf( iso ); return isoOf( y, m, d + days ) }\n\n/** `months` later, or earlier, on the same day or the month's last where it has fewer */\nexport function addMonths( iso: string, months: number ): string {\n const [ y, m, d ] = partsOf( iso ), last = new Date( Date.UTC( y, m + months + 1, 0 ) ).getUTCDate()\n return isoOf( y, m + months, Math.min( d, last ) )\n}\n\n/** The weeks a month's grid shows, each its seven ISO days, from the week holding its 1st */\nexport function weeksOf( month: string, first = 1 ): string[][] {\n const [ y, m ] = partsOf( month ), start = isoOf( y, m, 1 )\n let day = addDays( start, -( ( dayOf( start ).getUTCDay() - first + 7 ) % 7 ) )\n const weeks: string[][] = []\n do {\n const week: string[] = []\n for( let i = 0; i < 7; i++, day = addDays( day, 1 ) ) week.push( day )\n weeks.push( week )\n } while( partsOf( day )[ 1 ] === m )\n return weeks\n}\n\nexport interface CalendarWords {\n /** January first */\n readonly months: readonly string[]\n /** Sunday first */\n readonly days: readonly string[]\n /** Sunday first: a column's head */\n readonly short: readonly string[]\n readonly prev: string\n readonly next: string\n /** The grid's title: a month of a year, month from 0. Left out, the month's name and the year */\n readonly title?: ( year: number, month: number ) => string\n /** What a day is called to a screen reader, its weekday from Sunday's 0. Left out, the four in a row */\n readonly day?: ( year: number, month: number, date: number, weekday: number ) => string\n}\n\nexport const ENGLISH: CalendarWords = {\n months: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],\n days: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],\n short: [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],\n prev: 'Previous month',\n next: 'Next month'\n}\n\n/**\n * The names of months and days in `lang`, from `Intl`; English where it\n * does not format dates (the least of `Intl` that `./i18n` installs writes\n * a date whole, year and all). The title and a day's name are in the\n * language's order. The buttons' words are not `Intl`'s: they are\n * `words`' or English.\n */\nexport function calendarWords( lang: string ): CalendarWords {\n try {\n const at = ( o: Intl.DateTimeFormatOptions ) => new Intl.DateTimeFormat( lang, { ...o, timeZone: 'UTC' })\n const month = at({ month: 'long' }), long = at({ weekday: 'long' }), short = at({ weekday: 'short' })\n const jan = month.format( new Date( Date.UTC( 2024, 0, 15 ) ) )\n if( !jan || /\\d{4}/.test( jan ) ) return ENGLISH\n\n // 2024-01-07 is a Sunday\n const sun = ( i: number ) => new Date( Date.UTC( 2024, 0, 7 + i ) )\n return {\n ...ENGLISH,\n months: ENGLISH.months.map( ( _, i ) => month.format( new Date( Date.UTC( 2024, i, 15 ) ) ) ),\n days: ENGLISH.days.map( ( _, i ) => long.format( sun( i ) ) ),\n short: ENGLISH.short.map( ( _, i ) => short.format( sun( i ) ) ),\n title: ( y, m ) => at({ month: 'long', year: 'numeric' }).format( new Date( Date.UTC( y, m, 15 ) ) ),\n day: ( y, m, d ) => at({ dateStyle: 'full' }).format( new Date( Date.UTC( y, m, d ) ) )\n }\n }\n catch { return ENGLISH }\n}\n\n/** The day `lang`'s week starts on, 0 for Sunday, from `Intl.Locale`'s week info; Monday where it has none */\nexport function firstDay( lang: string ): number {\n try {\n const l: any = new Intl.Locale( lang ), w = l.getWeekInfo?.() ?? l.weekInfo\n if( w?.firstDay ) return w.firstDay % 7\n }\n catch {}\n return 1\n}\n\n/** Today, where the reader is */\nconst today = () => { const t = new Date(); return isoOf( t.getFullYear(), t.getMonth(), t.getDate() ) }\n\nlet seq = 0\nconst partOf = ( self: any ): PopoverApi => self.input.of || self.context.popover\n\nconst GRID = `<div class=input.class>\n <div class=input.head>\n <button class=input.prev aria-label=state.words.prev on-click( prev )><span>‹</span></button>\n <span id=\"{static.id}-title\" aria-live=\"polite\">{state.title}</span>\n <button class=input.next aria-label=state.words.next on-click( next )><span>›</span></button>\n </div>\n <div role=\"grid\" aria-labelledby=\"{static.id}-title\" tabindex=\"0\" aria-activedescendant=\"{static.id}-{state.active}\" @ref=\"grid\" on-keydown( key )>\n <div role=\"row\" class=input.week><for [h] in=state.heads by=\"long\"><span role=\"columnheader\" class=input.weekday aria-label=h.long>{h.short}</span></for></div>\n <for [w] in=state.weeks by=\"id\">\n <div role=\"row\" class=input.week>\n <for [d] in=w.days by=\"iso\">\n <div id=\"{static.id}-{d.iso}\" role=\"gridcell\" class=d.cls aria-selected=d.selected aria-disabled=( d.disabled ? true : null ) aria-label=d.label on-click( pick, d.iso )><span>{d.n}</span></div>\n </for>\n </div>\n </for>\n </div>\n</div>`\n\n/** On Lynx: no grid role, so each day is a button that says whether it is chosen */\nconst GRID_LYNX = `<div class=input.class>\n <div class=input.head>\n <button class=input.prev aria-label=state.words.prev on-click( prev )><span>‹</span></button>\n <span aria-live=\"polite\">{state.title}</span>\n <button class=input.next aria-label=state.words.next on-click( next )><span>›</span></button>\n </div>\n <div class=input.week><for [h] in=state.heads by=\"long\"><span class=input.weekday aria-label=h.long>{h.short}</span></for></div>\n <for [w] in=state.weeks by=\"id\">\n <div class=input.week>\n <for [d] in=w.days by=\"iso\">\n <button class=d.cls aria-selected=d.selected aria-disabled=( d.disabled ? true : null ) aria-label=d.label on-click( pick, d.iso )><span>{d.n}</span></button>\n </for>\n </div>\n </for>\n</div>`\n\nexport const datePicker: Plugin = {\n name: 'date-picker',\n requires: [ popover ],\n components: {\n 'date-grid': {\n state: { shown: '', active: '', title: '', words: ENGLISH as CalendarWords, heads: [] as any[], weeks: [] as any[] },\n static: { id: '', value: undefined as string | null | undefined },\n handler: {\n onCreate(){ ( this as any ).static.id = `lips-date-${++seq}` },\n /** Given a new value, it shows its month; given anything else, it draws again */\n onInput(){\n const self = this as any, { value } = self.input, s = self.state\n if( value !== self.static.value || !s.active ){\n self.static.value = value\n s.active = value || s.active || self.input.today || today()\n s.shown = s.active.slice( 0, 7 )\n }\n self.draw()\n },\n onAttach(){ ( this as any ).input.autofocus && ( this as any ).refs.grid?.focus() },\n refused( iso: string ){\n const { min, max, disabled } = ( this as any ).input\n return !!( min && iso < min || max && iso > max || disabled?.( iso ) )\n },\n draw(){\n const self = this as any, s = self.state, input = self.input\n const lang = input.lang || self.lang || 'en', w: CalendarWords = input.words || calendarWords( lang )\n const first = input.first ?? firstDay( lang ), now = input.today || today(), [ y, m ] = partsOf( s.shown )\n\n s.words = w\n s.title = w.title ? w.title( y, m ) : `${w.months[ m ]} ${y}`\n s.heads = Array.from( { length: 7 }, ( _, i ) => ({ short: w.short[ ( first + i ) % 7 ], long: w.days[ ( first + i ) % 7 ] }) )\n s.weeks = weeksOf( s.shown, first ).map( week => ({\n id: week[ 0 ],\n days: week.map( iso => {\n const [ dy, dm, dd ] = partsOf( iso ), off = self.refused( iso ), on = iso === input.value\n const cls = [ input.day, iso === s.active && 'is-active', on && 'is-selected', iso === now && 'is-today', dm !== m && 'is-outside', off && 'is-disabled' ]\n const wd = dayOf( iso ).getUTCDay()\n return { iso, n: dd, selected: on, disabled: off, cls: cls.filter( Boolean ).join(' '),\n label: w.day ? w.day( dy, dm, dd, wd ) : `${w.days[ wd ]} ${dd} ${w.months[ dm ]} ${dy}` }\n })\n }) )\n },\n /** The day under the keyboard moves, and the month shown with it */\n go( iso: string ){\n const self = this as any, s = self.state, month = iso.slice( 0, 7 )\n s.active = iso\n month !== s.shown && ( s.shown = month, self.emit( 'month', month ) )\n self.draw()\n },\n prev(){ const self = this as any; self.go( addMonths( self.state.active, -1 ) ) },\n next(){ const self = this as any; self.go( addMonths( self.state.active, 1 ) ) },\n key( e: KeyboardEvent ){\n const self = this as any, at = self.state.active, first = self.input.first ?? firstDay( self.input.lang || self.lang || 'en' )\n const back = ( dayOf( at ).getUTCDay() - first + 7 ) % 7\n const to: Record<string, () => string> = {\n ArrowLeft: () => addDays( at, -1 ), ArrowRight: () => addDays( at, 1 ),\n ArrowUp: () => addDays( at, -7 ), ArrowDown: () => addDays( at, 7 ),\n Home: () => addDays( at, -back ), End: () => addDays( at, 6 - back ),\n PageUp: () => addMonths( at, e.shiftKey ? -12 : -1 ), PageDown: () => addMonths( at, e.shiftKey ? 12 : 1 )\n }\n if( to[ e.key ] ){\n e.preventDefault?.()\n return self.go( to[ e.key ]() )\n }\n if( e.key === 'Enter' || e.key === ' ' ){\n e.preventDefault?.()\n self.choose( at )\n }\n },\n /** A tap on a day: chosen, and active; a day that cannot be chosen, nothing */\n pick( iso: string ){\n const self = this as any\n if( self.refused( iso ) ) return\n self.go( iso )\n self.choose( iso )\n },\n choose( iso: string ){\n const self = this as any\n !self.refused( iso ) && self.emit( 'change', iso )\n }\n },\n default: GRID,\n lynx: GRID_LYNX\n },\n\n 'popover-date': {\n handler: {\n choose( iso: string ){\n ;( this as any ).emit( 'change', iso )\n partOf( this ).set( false )\n }\n },\n default: `<let p={ input.of || context.popover }/>\n<popover-content of=p class=input.class popup=\"content\">\n <div id=p.id role=\"dialog\" aria-label=input.label>\n <date-grid value=input.value min=input.min max=input.max disabled=input.disabled first=input.first lang=input.lang words=input.words today=input.today class=input.grid head=input.head prev=input.prev next=input.next week=input.week weekday=input.weekday day=input.day autofocus=true on-change( choose )/>\n </div>\n</popover-content>`\n }\n }\n}\n"
15
15
  ],
16
- "mappings": "AA2BO,IACP,EAAQ,uEACR,EAAS,oIACT,EAAO,2DAEM,EAAgB,CAC3B,KAAM,QACN,WAAY,CACV,aAAc,CACZ,OAAQ,CAAE,MARR,uEAQsB,OAPrB,oIAOqC,KANvC,0DAMkD,EACnD,QAAS,CACP,QAAQ,EAAE,CAAI,KAAc,KAAM,OAAU,KAAc,KAAK,KAAM,GACrE,OAAO,EAAE,CAAI,KAAc,KAAK,SAAS,GACzC,GAAG,CAAE,EAAkB,CACrB,GAAI,EAAE,MAAQ,SAAW,OACzB,EAAE,iBAAiB,EAChB,KAAc,KAAK,SAAS,EAEnC,EACA,QAAS;AAAA;AAAA;AAAA;AAAA;AAAA,OAMX,EAUA,gBAAiB,CACf,QAAS,CACP,GAAG,EAAE,CAAI,KAAc,KAAK,OAAO,EACrC,EACA,QA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gB,CACd,QAAS,CACP,MAAM,CAAE,EAAa,CAChB,KAAc,KAAM,SAAU,CAAI,EACrC,GAAQ,IAAK,EAAE,IAAK,EAAM,EAE9B,EACA,QAAS;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMX,CACF,CACF",
17
+ "debugId": "AC7DB3834EDBC9E464756E2164756E21",
18
18
  "names": []
19
19
  }
@@ -1,23 +1,23 @@
1
- var bt=(t,e,r)=>()=>{if(t)try{e=t(t=0)}catch(s){r=[s]}if(r)throw r[0];return e};function St(t,e){return t.replace(yt,(r,s,i,n,a)=>{if(n===void 0){let o=s!==void 0?parseInt(s,10):parseInt(i,16);return o>0&&o<=1114111?String.fromCodePoint(o):r}if(n in Q)return Q[n];return e?.(n,a),r})}class U{src;pos=0;lineStarts=null;diagnostics=[];constructor(t){this.src=t}locate(t){if(!this.lineStarts){this.lineStarts=[0];for(let s=0;s<this.src.length;s++)if(this.src[s]===`
2
- `)this.lineStarts.push(s+1)}let e=0,r=this.lineStarts.length-1;while(e<r){let s=e+r+1>>1;this.lineStarts[s]<=t?e=s:r=s-1}return{line:e+1,col:t-this.lineStarts[e]+1}}report(t,e,r,s,i=1,n){let{line:a,col:o}=this.locate(s);this.diagnostics.push({code:t,severity:e,message:r,hint:n,loc:{line:a,col:o,offset:s,length:i}})}decode(t,e){return St(t,(r,s)=>this.report("LIPS-P013","warning",`&${r}; is not decoded`,e+s,r.length+2,"Write the character, or its number: &#169;"))}eof(){return this.pos>=this.src.length}peek(t=0){return this.src[this.pos+t]}startsWith(t){return this.src.startsWith(t,this.pos)}skipSpace(){while(!this.eof()&&/\s/.test(this.src[this.pos]))this.pos++}scanBalanced(t,e){let r=this.pos,s=0;while(!this.eof()){let i=this.src[this.pos];if(i==="'"||i==='"'||i==="`"){this.pos++;while(!this.eof()&&this.src[this.pos]!==i){if(this.src[this.pos]==="\\")this.pos++;this.pos++}this.pos++;continue}if(s===0&&i===t){let n=this.src.slice(r,this.pos);return this.pos++,{content:n,loc:{offset:r,length:n.length}}}if(i==="("||i==="["||i==="{")s++;else if(i===")"||i==="]"||i==="}"){if(s===0&&i!==t){this.report(e,"error",`Unbalanced '${i}'`,this.pos),this.pos++;continue}s--}this.pos++}return this.report(e,"error",`Unterminated — expected '${t}'`,r,this.pos-r),null}parse(){let t=[];while(!this.eof())if(t.push(...this.parseNodes([])),this.startsWith("</")){let e=this.pos;this.pos+=2;while(!this.eof()&&this.peek()!==">")this.pos++;!this.eof()&&this.pos++,this.report("LIPS-P005","error",`Stray closing tag ${this.src.slice(e,this.pos)}`,e,this.pos-e)}return{root:{t:"fragment",children:t,loc:{offset:0,length:this.src.length}},diagnostics:this.diagnostics}}parseNodes(t){let e=[];while(!this.eof()){if(this.startsWith("</"))break;let r=this.pos;if(this.peek()==="<"&&this.peek(1)!==void 0){let s=this.parseTag(t);s&&e.push(s)}else{let s=this.parseText(t);s&&e.push(s)}if(this.pos===r)this.pos++}return e}parseText(t){let e=this.pos,r=[],s="";while(!this.eof()&&this.peek()!=="<"){if(this.peek()==="{"){this.pos++;let o=this.scanBalanced("}","LIPS-P007");if(o)s&&r.push(s),s="",r.push({expr:o.content.trim(),loc:o.loc});continue}s+=this.peek(),this.pos++}s&&r.push(s);let i={offset:e,length:this.pos-e};if(r.some((o)=>typeof o!=="string"))return{t:"interp",parts:r.map((o)=>typeof o==="string"?this.decode(o,e):o),loc:i};let n=r.length?r[0]:"",a=t.some((o)=>kt.has(o));if(!n||!a&&!n.trim())return null;return{t:"text",value:this.decode(n,e),loc:i}}parseTag(t){let e=this.pos;if(this.startsWith("<!--")){let n=this.src.indexOf("-->",this.pos+4);if(n===-1)return this.report("LIPS-P003","error","Unterminated comment",e,this.src.length-e),this.pos=this.src.length,null;let a=this.src.slice(this.pos+4,n);return this.pos=n+3,{t:"comment",value:a,loc:{offset:e,length:this.pos-e}}}if(this.startsWith("<>")){this.pos+=2;let n=[];while(!0)if(n.push(...this.parseNodes([...t,"#fragment"])),this.closeStatus("#fragment",e,t)!=="stray")break;return{t:"fragment",children:n,loc:{offset:e,length:this.pos-e}}}if(this.startsWith("<{")){this.pos+=2;let n=this.scanBalanced("}","LIPS-P008");if(!n)return null;let a={t:"element",tag:"#dynamic",dynamicTag:{expr:n.content.trim(),loc:n.loc},attrs:[],children:[],selfClosed:!1,loc:{offset:e,length:0}};return this.finishTag(a,t,e),a}this.pos++;let r=this.pos;while(!this.eof()&&/[A-Za-z0-9_-]/.test(this.peek()))this.pos++;let s=this.src.slice(r,this.pos);if(!s||!/^[A-Za-z]/.test(s))return this.report("LIPS-P002","error","Invalid tag name",e,this.pos-e+1),{t:"text",value:"<",loc:{offset:e,length:1}};let i={t:"element",tag:s.toLowerCase(),attrs:[],children:[],selfClosed:!1,loc:{offset:e,length:0}};if(this.peek()==="(")if(Y.has(i.tag)){this.pos++;let n=this.scanBalanced(")","LIPS-P012");n&&(i.head={expr:n.content.trim(),loc:n.loc})}else this.report("LIPS-P011","error",`Head expression is not allowed on <${i.tag}>`,this.pos,1,`Only ${[...Y].map((n)=>`<${n}(…)>`).join(", ")} take a head`);return this.finishTag(i,t,e),i}finishTag(t,e,r){if(this.parseAttrs(t),t.selfClosed||xt.has(t.tag)){t.selfClosed=!0,t.loc={offset:r,length:this.pos-r};return}let s=t.tag==="#dynamic"?"#dynamic":t.tag;t.children=[];while(!0)if(t.children.push(...this.parseNodes([...e,s])),this.closeStatus(s,r,e)!=="stray")break;t.loc={offset:r,length:this.pos-r}}closeStatus(t,e,r){if(this.eof())return this.report("LIPS-P006","error",`Unclosed <${t==="#fragment"?"":t}> — reached end of template`,e,1,`Add </${t==="#fragment"||t==="#dynamic"?"":t}>`),"eof";if(!this.startsWith("</"))return"closed";let s=this.pos;if(this.pos+=2,this.peek()===">"){if(this.pos++,t!=="#fragment"&&t!=="#dynamic")this.report("LIPS-P004","warning",`Generic '</>' closes <${t}>`,s,3,`Prefer </${t}>`);return"closed"}let i=this.pos;while(!this.eof()&&/[A-Za-z0-9_-]/.test(this.peek()))this.pos++;let n=this.src.slice(i,this.pos).toLowerCase();if(this.skipSpace(),this.peek()===">"?this.pos++:this.report("LIPS-P001","error","Malformed closing tag",s,this.pos-s),n===t)return"closed";if(r.includes(n))return this.report("LIPS-P004","warning",`</${n}> auto-closes <${t}>`,s,this.pos-s,`Add the missing </${t}> before </${n}>`),this.pos=s,"ancestor";return this.report("LIPS-P005","error",`Stray closing tag </${n}> — <${t}> is open`,s,this.pos-s),"stray"}parseAttrs(t){while(!0){if(this.skipSpace(),this.eof()){this.report("LIPS-P001","error","Unexpected end of template inside tag",t.loc.offset);return}if(this.startsWith("/>")){this.pos+=2,t.selfClosed=!0;return}if(this.peek()===">"){this.pos++;return}let e=this.pos;if(this.startsWith("...")){this.pos+=3;let n=this.readUnquotedValue();t.attrs.push({k:"spread",source:n,loc:{offset:e,length:this.pos-e}});continue}if(this.peek()==="["){this.pos++;let n=this.scanBalanced("]","LIPS-P009");if(n){let a=n.content.split(",").map((o)=>o.trim()).filter(Boolean);t.attrs.push({k:"args",names:a,loc:{offset:e,length:this.pos-e}})}continue}let r=!1;if(this.peek()==="!")r=!0,this.pos++;let s=this.pos;while(!this.eof()&&/[^\s=/>()]/.test(this.peek()))this.pos++;let i=this.src.slice(s,this.pos);if(!i){this.report("LIPS-P009","error",`Invalid attribute syntax at '${this.peek()}'`,this.pos),this.pos++;continue}if(this.peek()==="("){this.pos++;let n=this.scanBalanced(")","LIPS-P010"),a=n?n.content.trim():"",o={offset:e,length:this.pos-e};i.startsWith("on-")?t.attrs.push({k:"event",name:i.slice(3),source:a,loc:o}):t.attrs.push({k:"fn",name:i,source:a,loc:o});continue}if(this.peek()==="="){this.pos++,this.parseAttrValue(t,i,e);continue}t.attrs.push({k:"bool",name:i,value:!r,loc:{offset:e,length:this.pos-e}})}}parseAttrValue(t,e,r){let s=this.peek();if(s==='"'||s==="'"){this.pos++;let n=this.pos,a=[],o="";while(!this.eof()&&this.peek()!==s){if(this.peek()==="{"){this.pos++;let p=this.scanBalanced("}","LIPS-P007");if(p)o&&a.push(o),o="",a.push({expr:p.content.trim(),loc:p.loc});continue}o+=this.peek(),this.pos++}o&&a.push(o),this.eof()?this.report("LIPS-P010","error",`Unterminated value for '${e}'`,n,this.pos-n):this.pos++;let l={offset:r,length:this.pos-r};a.some((p)=>typeof p!=="string")?t.attrs.push({k:"interp",name:e,parts:a.map((p)=>typeof p==="string"?this.decode(p,n):p),loc:l}):t.attrs.push({k:"literal",name:e,value:this.decode(a[0]??"",n),loc:l});return}if(s==="{"){this.pos++;let n=this.scanBalanced("}","LIPS-P007");t.attrs.push({k:"expr",name:e,source:n?n.content.trim():"",loc:{offset:r,length:this.pos-r}});return}let i=this.readUnquotedValue();i?t.attrs.push({k:"expr",name:e,source:i,loc:{offset:r,length:this.pos-r}}):this.report("LIPS-P010","error",`Missing value for attribute '${e}'`,r)}readUnquotedValue(){let t=this.pos,e=0;while(!this.eof()){let r=this.peek();if(r==="'"||r==='"'||r==="`"){this.pos++;while(!this.eof()&&this.peek()!==r){if(this.peek()==="\\")this.pos++;this.pos++}this.pos++;continue}if(e===0){if(/\s/.test(r)||r===">")break;if(r==="/"&&this.peek(1)===">")break}if(r==="("||r==="["||r==="{")e++;else if(r===")"||r==="]"||r==="}")e--;this.pos++}return this.src.slice(t,this.pos).trim()}}function W(t){return new U(t||"").parse()}function X(t){let e=vt(t||""),r=(t||"").slice(0,e).trimEnd(),s=(t||"").slice(e),i=new U(s).parse(),n=r?r.split(`
1
+ var xt=(t,e,r)=>()=>{if(t)try{e=t(t=0)}catch(s){r=[s]}if(r)throw r[0];return e};function vt(t,e){return t.replace(St,(r,s,i,n,a)=>{if(n===void 0){let o=s!==void 0?parseInt(s,10):parseInt(i,16);return o>0&&o<=1114111?String.fromCodePoint(o):r}if(n in Q)return Q[n];return e?.(n,a),r})}class U{src;pos=0;lineStarts=null;diagnostics=[];constructor(t){this.src=t}locate(t){if(!this.lineStarts){this.lineStarts=[0];for(let s=0;s<this.src.length;s++)if(this.src[s]===`
2
+ `)this.lineStarts.push(s+1)}let e=0,r=this.lineStarts.length-1;while(e<r){let s=e+r+1>>1;this.lineStarts[s]<=t?e=s:r=s-1}return{line:e+1,col:t-this.lineStarts[e]+1}}report(t,e,r,s,i=1,n){let{line:a,col:o}=this.locate(s);this.diagnostics.push({code:t,severity:e,message:r,hint:n,loc:{line:a,col:o,offset:s,length:i}})}decode(t,e){return vt(t,(r,s)=>this.report("LIPS-P013","warning",`&${r}; is not decoded`,e+s,r.length+2,"Write the character, or its number: &#169;"))}eof(){return this.pos>=this.src.length}peek(t=0){return this.src[this.pos+t]}startsWith(t){return this.src.startsWith(t,this.pos)}skipSpace(){while(!this.eof()&&/\s/.test(this.src[this.pos]))this.pos++}scanBalanced(t,e){let r=this.pos,s=0;while(!this.eof()){let i=this.src[this.pos];if(i==="'"||i==='"'||i==="`"){this.pos++;while(!this.eof()&&this.src[this.pos]!==i){if(this.src[this.pos]==="\\")this.pos++;this.pos++}this.pos++;continue}if(s===0&&i===t){let n=this.src.slice(r,this.pos);return this.pos++,{content:n,loc:{offset:r,length:n.length}}}if(i==="("||i==="["||i==="{")s++;else if(i===")"||i==="]"||i==="}"){if(s===0&&i!==t){this.report(e,"error",`Unbalanced '${i}'`,this.pos),this.pos++;continue}s--}this.pos++}return this.report(e,"error",`Unterminated — expected '${t}'`,r,this.pos-r),null}parse(){let t=[];while(!this.eof())if(t.push(...this.parseNodes([])),this.startsWith("</")){let e=this.pos;this.pos+=2;while(!this.eof()&&this.peek()!==">")this.pos++;!this.eof()&&this.pos++,this.report("LIPS-P005","error",`Stray closing tag ${this.src.slice(e,this.pos)}`,e,this.pos-e)}return{root:{t:"fragment",children:t,loc:{offset:0,length:this.src.length}},diagnostics:this.diagnostics}}parseNodes(t){let e=[];while(!this.eof()){if(this.startsWith("</"))break;let r=this.pos;if(this.peek()==="<"&&this.peek(1)!==void 0){let s=this.parseTag(t);s&&e.push(s)}else{let s=this.parseText(t);s&&e.push(s)}if(this.pos===r)this.pos++}return e}parseText(t){let e=this.pos,r=[],s="";while(!this.eof()&&this.peek()!=="<"){if(this.peek()==="{"){this.pos++;let o=this.scanBalanced("}","LIPS-P007");if(o)s&&r.push(s),s="",r.push({expr:o.content.trim(),loc:o.loc});continue}s+=this.peek(),this.pos++}s&&r.push(s);let i={offset:e,length:this.pos-e};if(r.some((o)=>typeof o!=="string"))return{t:"interp",parts:r.map((o)=>typeof o==="string"?this.decode(o,e):o),loc:i};let n=r.length?r[0]:"",a=t.some((o)=>kt.has(o));if(!n||!a&&!n.trim())return null;return{t:"text",value:this.decode(n,e),loc:i}}parseTag(t){let e=this.pos;if(this.startsWith("<!--")){let n=this.src.indexOf("-->",this.pos+4);if(n===-1)return this.report("LIPS-P003","error","Unterminated comment",e,this.src.length-e),this.pos=this.src.length,null;let a=this.src.slice(this.pos+4,n);return this.pos=n+3,{t:"comment",value:a,loc:{offset:e,length:this.pos-e}}}if(this.startsWith("<>")){this.pos+=2;let n=[];while(!0)if(n.push(...this.parseNodes([...t,"#fragment"])),this.closeStatus("#fragment",e,t)!=="stray")break;return{t:"fragment",children:n,loc:{offset:e,length:this.pos-e}}}if(this.startsWith("<{")){this.pos+=2;let n=this.scanBalanced("}","LIPS-P008");if(!n)return null;let a={t:"element",tag:"#dynamic",dynamicTag:{expr:n.content.trim(),loc:n.loc},attrs:[],children:[],selfClosed:!1,loc:{offset:e,length:0}};return this.finishTag(a,t,e),a}this.pos++;let r=this.pos;while(!this.eof()&&/[A-Za-z0-9_-]/.test(this.peek()))this.pos++;let s=this.src.slice(r,this.pos);if(!s||!/^[A-Za-z]/.test(s))return this.report("LIPS-P002","error","Invalid tag name",e,this.pos-e+1),{t:"text",value:"<",loc:{offset:e,length:1}};let i={t:"element",tag:s.toLowerCase(),attrs:[],children:[],selfClosed:!1,loc:{offset:e,length:0}};if(this.peek()==="(")if(Y.has(i.tag)){this.pos++;let n=this.scanBalanced(")","LIPS-P012");n&&(i.head={expr:n.content.trim(),loc:n.loc})}else this.report("LIPS-P011","error",`Head expression is not allowed on <${i.tag}>`,this.pos,1,`Only ${[...Y].map((n)=>`<${n}(…)>`).join(", ")} take a head`);return this.finishTag(i,t,e),i}finishTag(t,e,r){if(this.parseAttrs(t),t.selfClosed||yt.has(t.tag)){t.selfClosed=!0,t.loc={offset:r,length:this.pos-r};return}let s=t.tag==="#dynamic"?"#dynamic":t.tag;t.children=[];while(!0)if(t.children.push(...this.parseNodes([...e,s])),this.closeStatus(s,r,e)!=="stray")break;t.loc={offset:r,length:this.pos-r}}closeStatus(t,e,r){if(this.eof())return this.report("LIPS-P006","error",`Unclosed <${t==="#fragment"?"":t}> — reached end of template`,e,1,`Add </${t==="#fragment"||t==="#dynamic"?"":t}>`),"eof";if(!this.startsWith("</"))return"closed";let s=this.pos;if(this.pos+=2,this.peek()===">"){if(this.pos++,t!=="#fragment"&&t!=="#dynamic")this.report("LIPS-P004","warning",`Generic '</>' closes <${t}>`,s,3,`Prefer </${t}>`);return"closed"}let i=this.pos;while(!this.eof()&&/[A-Za-z0-9_-]/.test(this.peek()))this.pos++;let n=this.src.slice(i,this.pos).toLowerCase();if(this.skipSpace(),this.peek()===">"?this.pos++:this.report("LIPS-P001","error","Malformed closing tag",s,this.pos-s),n===t)return"closed";if(r.includes(n))return this.report("LIPS-P004","warning",`</${n}> auto-closes <${t}>`,s,this.pos-s,`Add the missing </${t}> before </${n}>`),this.pos=s,"ancestor";return this.report("LIPS-P005","error",`Stray closing tag </${n}> — <${t}> is open`,s,this.pos-s),"stray"}parseAttrs(t){while(!0){if(this.skipSpace(),this.eof()){this.report("LIPS-P001","error","Unexpected end of template inside tag",t.loc.offset);return}if(this.startsWith("/>")){this.pos+=2,t.selfClosed=!0;return}if(this.peek()===">"){this.pos++;return}let e=this.pos;if(this.startsWith("...")){this.pos+=3;let n=this.readUnquotedValue();t.attrs.push({k:"spread",source:n,loc:{offset:e,length:this.pos-e}});continue}if(this.peek()==="["){this.pos++;let n=this.scanBalanced("]","LIPS-P009");if(n){let a=n.content.split(",").map((o)=>o.trim()).filter(Boolean);t.attrs.push({k:"args",names:a,loc:{offset:e,length:this.pos-e}})}continue}let r=!1;if(this.peek()==="!")r=!0,this.pos++;let s=this.pos;while(!this.eof()&&/[^\s=/>()]/.test(this.peek()))this.pos++;let i=this.src.slice(s,this.pos);if(!i){this.report("LIPS-P009","error",`Invalid attribute syntax at '${this.peek()}'`,this.pos),this.pos++;continue}if(this.peek()==="("){this.pos++;let n=this.scanBalanced(")","LIPS-P010"),a=n?n.content.trim():"",o={offset:e,length:this.pos-e};i.startsWith("on-")?t.attrs.push({k:"event",name:i.slice(3),source:a,loc:o}):t.attrs.push({k:"fn",name:i,source:a,loc:o});continue}if(this.peek()==="="){this.pos++,this.parseAttrValue(t,i,e);continue}t.attrs.push({k:"bool",name:i,value:!r,loc:{offset:e,length:this.pos-e}})}}parseAttrValue(t,e,r){let s=this.peek();if(s==='"'||s==="'"){this.pos++;let n=this.pos,a=[],o="";while(!this.eof()&&this.peek()!==s){if(this.peek()==="{"){this.pos++;let p=this.scanBalanced("}","LIPS-P007");if(p)o&&a.push(o),o="",a.push({expr:p.content.trim(),loc:p.loc});continue}o+=this.peek(),this.pos++}o&&a.push(o),this.eof()?this.report("LIPS-P010","error",`Unterminated value for '${e}'`,n,this.pos-n):this.pos++;let l={offset:r,length:this.pos-r};a.some((p)=>typeof p!=="string")?t.attrs.push({k:"interp",name:e,parts:a.map((p)=>typeof p==="string"?this.decode(p,n):p),loc:l}):t.attrs.push({k:"literal",name:e,value:this.decode(a[0]??"",n),loc:l});return}if(s==="{"){this.pos++;let n=this.scanBalanced("}","LIPS-P007");t.attrs.push({k:"expr",name:e,source:n?n.content.trim():"",loc:{offset:r,length:this.pos-r}});return}let i=this.readUnquotedValue();i?t.attrs.push({k:"expr",name:e,source:i,loc:{offset:r,length:this.pos-r}}):this.report("LIPS-P010","error",`Missing value for attribute '${e}'`,r)}readUnquotedValue(){let t=this.pos,e=0;while(!this.eof()){let r=this.peek();if(r==="'"||r==='"'||r==="`"){this.pos++;while(!this.eof()&&this.peek()!==r){if(this.peek()==="\\")this.pos++;this.pos++}this.pos++;continue}if(e===0){if(/\s/.test(r)||r===">")break;if(r==="/"&&this.peek(1)===">")break}if(r==="("||r==="["||r==="{")e++;else if(r===")"||r==="]"||r==="}")e--;this.pos++}return this.src.slice(t,this.pos).trim()}}function W(t){return new U(t||"").parse()}function X(t){let e=Et(t||""),r=(t||"").slice(0,e).trimEnd(),s=(t||"").slice(e),i=new U(s).parse(),n=r?r.split(`
3
3
  `).length+(/\n\s*\n$/.test(t.slice(0,e))?1:0):0;return i.diagnostics.forEach((a)=>{a.loc.line+=r?t.slice(0,e).split(`
4
- `).length-1:0,a.loc.offset+=e}),{script:r,...i}}function vt(t){let e=0,r=!0;for(let s=0;s<t.length;s++){let i=t[s];if(i==="'"||i==='"'||i==="`"){let n=i;s++;while(s<t.length&&t[s]!==n){if(t[s]==="\\")s++;s++}r=!1;continue}if(i==="/"&&t[s+1]==="/"){while(s<t.length&&t[s]!==`
4
+ `).length-1:0,a.loc.offset+=e}),{script:r,...i}}function Et(t){let e=0,r=!0;for(let s=0;s<t.length;s++){let i=t[s];if(i==="'"||i==='"'||i==="`"){let n=i;s++;while(s<t.length&&t[s]!==n){if(t[s]==="\\")s++;s++}r=!1;continue}if(i==="/"&&t[s+1]==="/"){while(s<t.length&&t[s]!==`
5
5
  `)s++;r=!0;continue}if(i==="/"&&t[s+1]==="*"){let n=t.indexOf("*/",s+2);s=n===-1?t.length:n+1;continue}if(i===`
6
- `){r=!0;continue}if(r&&e===0&&i==="<"&&/[A-Za-z{>!]/.test(t[s+1]||""))return s;if(i==="("||i==="["||i==="{")e++;else if(i===")"||i==="]"||i==="}")e=Math.max(0,e-1);if(!/\s/.test(i))r=!1}return 0}var xt,kt,Y,Q,yt;var H=bt(()=>{xt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),kt=new Set(["pre","textarea"]),Y=new Set(["if","else-if","switch","log"]),Q={__proto__:null,amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},yt=/&(?:#(\d+)|#[xX]([0-9a-fA-F]+)|([A-Za-z][A-Za-z0-9]*));/g});H();var Et=["===","!==","...","=>","==","!=","<=",">=","&&","||","??","?.","++","--","+=","-=","*=","/=","%=","+","-","*","/","%","<",">","!","?",":",".",",","(",")","[","]","{","}","="];function It(t,e){let r=[],s=0,i=(a)=>/[A-Za-z_$]/.test(a),n=(a)=>/[A-Za-z0-9_$]/.test(a);while(s<t.length){let a=t[s];if(/\s/.test(a)){s++;continue}if(/[0-9]/.test(a)||a==="."&&/[0-9]/.test(t[s+1])){let l=s;while(s<t.length&&/[0-9]/.test(t[s]))s++;if(t[s]==="."){s++;while(s<t.length&&/[0-9]/.test(t[s]))s++}if(t[s]==="e"||t[s]==="E"){if(s++,t[s]==="+"||t[s]==="-")s++;while(s<t.length&&/[0-9]/.test(t[s]))s++}r.push({t:"num",value:t.slice(l,s),start:l,end:s});continue}if(a==="'"||a==='"'){let l=s;s++;let p="",b=!1;while(s<t.length){let k=t[s];if(k==="\\"){let E=t[s+1],d={n:`
7
- `,t:"\t",r:"\r",b:"\b",f:"\f",v:"\v","0":"\x00"};if(E==="u"){let y=t.slice(s+2,s+6);p+=String.fromCharCode(parseInt(y,16)||0),s+=6}else p+=d[E]??E,s+=2;continue}if(k===a){b=!0,s++;break}p+=k,s++}if(!b)e.push({code:"LIPS-E001",message:"Unterminated string literal",loc:{offset:l,length:s-l}});r.push({t:"str",value:p,start:l,end:s});continue}if(i(a)){let l=s;while(s<t.length&&n(t[s]))s++;r.push({t:"id",value:t.slice(l,s),start:l,end:s});continue}let o=Et.find((l)=>t.startsWith(l,s));if(o==="?."&&/[0-9]/.test(t[s+2]??""))o="?";if(o){r.push({t:"punct",value:o,start:s,end:s+o.length}),s+=o.length;continue}e.push({code:"LIPS-E002",message:`Unexpected character '${a}'`,loc:{offset:s,length:1}}),s++}return r.push({t:"eof",value:"",start:t.length,end:t.length}),r}class tt{tokens;diagnostics;pos=0;constructor(t,e){this.tokens=t;this.diagnostics=e}peek(t=0){return this.tokens[Math.min(this.pos+t,this.tokens.length-1)]}next(){return this.tokens[this.pos++]??this.tokens[this.tokens.length-1]}at(t){let e=this.peek();return e.t==="punct"&&e.value===t}eat(t){if(this.at(t))return this.pos++,!0;return!1}error(t,e,r=this.peek()){return this.diagnostics.push({code:t,message:e,loc:{offset:r.start,length:Math.max(1,r.end-r.start)}}),{t:"error"}}expect(t,e){if(!this.eat(t))this.error(e,`Expected '${t}'`)}parse(){let t=this.assign();if(this.peek().t!=="eof")this.error("LIPS-E003",`Unexpected token '${this.peek().value}' after expression`);return t}isArrowAhead(){let t=this.peek();if(t.t==="id"){let e=this.peek(1);return e.t==="punct"&&e.value==="=>"}if(t.t==="punct"&&t.value==="("){let e=0,r=0;while(!0){let s=this.peek(r);if(s.t==="eof")return!1;if(s.t==="punct"&&s.value==="(")e++;if(s.t==="punct"&&s.value===")"){if(e--,e===0){let i=this.peek(r+1);return i.t==="punct"&&i.value==="=>"}}r++}}return!1}assign(){if(this.isArrowAhead()){let r=[];if(this.peek().t==="id")r.push(this.next().value);else{this.expect("(","LIPS-E004");while(!this.at(")")&&this.peek().t!=="eof"){let s=this.next();if(s.t!=="id")return this.error("LIPS-E005","Invalid arrow parameter",s);if(r.push(s.value),!this.eat(","))break}this.expect(")","LIPS-E004")}return this.expect("=>","LIPS-E004"),{t:"arrow",params:r,body:this.assign()}}let t=this.conditional(),e=this.peek();if(e.t==="punct"&&["=","+=","-=","*=","/=","%="].includes(e.value)){if(t.t!=="id"&&t.t!=="member")return this.error("LIPS-E006","Invalid assignment target",e);return this.next(),{t:"assign",op:e.value,target:t,value:this.assign()}}return t}conditional(){let t=this.nullish();if(this.eat("?")){let e=this.assign();return this.expect(":","LIPS-E007"),{t:"cond",test:t,cons:e,alt:this.assign()}}return t}nullish(){let t=this.or();while(this.at("??"))this.next(),t={t:"logic",op:"??",l:t,r:this.or()};return t}or(){let t=this.and();while(this.at("||"))this.next(),t={t:"logic",op:"||",l:t,r:this.and()};return t}and(){let t=this.equality();while(this.at("&&"))this.next(),t={t:"logic",op:"&&",l:t,r:this.equality()};return t}equality(){let t=this.relational();while(["===","!==","==","!="].some((e)=>this.at(e)))t={t:"bin",op:this.next().value,l:t,r:this.relational()};return t}relational(){let t=this.additive();while(["<=",">=","<",">"].some((e)=>this.at(e)))t={t:"bin",op:this.next().value,l:t,r:this.additive()};return t}additive(){let t=this.multiplicative();while(this.at("+")||this.at("-"))t={t:"bin",op:this.next().value,l:t,r:this.multiplicative()};return t}multiplicative(){let t=this.unary();while(this.at("*")||this.at("/")||this.at("%"))t={t:"bin",op:this.next().value,l:t,r:this.unary()};return t}unary(){if(this.at("!")||this.at("-")||this.at("+"))return{t:"unary",op:this.next().value,arg:this.unary()};if(this.at("++")||this.at("--")){let t=this.next().value,e=this.unary();if(e.t!=="id"&&e.t!=="member")return this.error("LIPS-E006","Invalid update target");return{t:"update",op:t,arg:e,prefix:!0}}return this.postfix()}postfix(){let t=this.callMember();if(this.at("++")||this.at("--")){let e=this.next().value;if(t.t!=="id"&&t.t!=="member")return this.error("LIPS-E006","Invalid update target");t={t:"update",op:e,arg:t,prefix:!1}}return t}callMember(){let t=this.primary();while(!0)if(this.eat(".")){let e=this.next();if(e.t!=="id")return this.error("LIPS-E008","Expected property name",e);t={t:"member",obj:t,prop:e.value,computed:!1,optional:!1,at:e.start}}else if(this.eat("?."))if(this.at("("))t={t:"call",callee:t,args:this.argList(),optional:!0};else if(this.eat("[")){let e=this.peek().start,r=this.assign();this.expect("]","LIPS-E009"),t={t:"member",obj:t,prop:r,computed:!0,optional:!0,at:e}}else{let e=this.next();if(e.t!=="id")return this.error("LIPS-E008","Expected property name",e);t={t:"member",obj:t,prop:e.value,computed:!1,optional:!0,at:e.start}}else if(this.eat("[")){let e=this.peek().start,r=this.assign();this.expect("]","LIPS-E009"),t={t:"member",obj:t,prop:r,computed:!0,optional:!1,at:e}}else if(this.at("("))t={t:"call",callee:t,args:this.argList(),optional:!1};else break;return t}argList(){this.expect("(","LIPS-E010");let t=[];while(!this.at(")")&&this.peek().t!=="eof")if(t.push(this.assign()),!this.eat(","))break;return this.expect(")","LIPS-E010"),t}primary(){let t=this.peek();if(t.t==="num")return this.next(),{t:"lit",v:parseFloat(t.value)};if(t.t==="str")return this.next(),{t:"lit",v:t.value};if(t.t==="id")switch(this.next(),t.value){case"true":return{t:"lit",v:!0};case"false":return{t:"lit",v:!1};case"null":return{t:"lit",v:null};case"undefined":return{t:"lit",v:void 0};case"NaN":return{t:"lit",v:NaN};case"Infinity":return{t:"lit",v:1/0};default:return{t:"id",name:t.value,at:t.start}}if(this.eat("(")){let e=this.assign();return this.expect(")","LIPS-E010"),e}if(this.eat("[")){let e=[];while(!this.at("]")&&this.peek().t!=="eof"){let r=this.eat("...");if(e.push({spread:r||void 0,value:this.assign()}),!this.eat(","))break}return this.expect("]","LIPS-E009"),{t:"arr",items:e}}if(this.eat("{")){let e=[];while(!this.at("}")&&this.peek().t!=="eof"){if(this.eat("..."))e.push({spread:!0,value:this.assign()});else{let r=this.next();if(r.t!=="id"&&r.t!=="str"&&r.t!=="num")return this.error("LIPS-E011","Invalid object key",r);if(this.eat(":"))e.push({key:String(r.value),value:this.assign(),at:r.start});else if(r.t==="id")e.push({key:r.value,value:{t:"id",name:r.value,at:r.start},at:r.start});else return this.error("LIPS-E011","Invalid shorthand property",r)}if(!this.eat(","))break}return this.expect("}","LIPS-E011"),{t:"obj",props:e}}return this.next(),this.error("LIPS-E012",t.t==="eof"?"Unexpected end of expression":`Unexpected token '${t.value}'`,t)}}function _(t){let e=[],r=It(t,e);return{ast:new tt(r,e).parse(),diagnostics:e}}function et(t){let e=new Set,r=(s,i)=>{switch(s.t){case"id":!i.has(s.name)&&e.add(s.name);return;case"member":r(s.obj,i),typeof s.prop!=="string"&&r(s.prop,i);return;case"call":r(s.callee,i),s.args.forEach((n)=>r(n,i));return;case"unary":case"update":r(s.arg,i);return;case"bin":case"logic":r(s.l,i),r(s.r,i);return;case"cond":r(s.test,i),r(s.cons,i),r(s.alt,i);return;case"assign":r(s.target,i),r(s.value,i);return;case"arrow":r(s.body,new Set([...i,...s.params]));return;case"arr":s.items.forEach((n)=>r(n.value,i));return;case"obj":s.props.forEach((n)=>r(n.value,i));return}};return r(t,new Set),[...e]}var Xt=Symbol("lips.ended");var st=new Set(["if","else-if","else","for","switch","async","let","const","log","context","i18n"]),rt=new Set(["case","default","then","catch","loading"]),it=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","marker","mask","path","pattern","polygon","polyline","radialgradient","rect","stop","symbol","text","tspan","use"]);var Pt="<!--$-->",$t=new Set(["stop","capture","outside"]),wt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Rt=(t)=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Lt=(t)=>t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;"),nt=(t)=>t!==""&&!isNaN(Number(t)),ot=(t)=>{let e=t.trim(),r=0;for(let s=0;s<e.length;s++){let i=e[s];if(i==="'"||i==='"'||i==="`"){s++;while(s<e.length&&e[s]!==i){if(e[s]==="\\")s++;s++}continue}if(i==="("||i==="["||i==="{")r++;else if(i===")"||i==="]"||i==="}"){if(r--,r===0&&e[0]==="{"&&s===e.length-1)return ot(e.slice(1,-1))}else if(r===0){if(i==="?")return!1;if(i===":")return!0}}return!1},Ct=(t)=>{if(t.k==="expr")return t.source;if(t.k!=="interp")return"";let e=t.parts.filter((r)=>typeof r!=="string");return e.length===1&&t.parts.every((r)=>typeof r!=="string"||!r.trim())?e[0].expr:""};class at{src;macros;tree;exprs=[];exprIndex=new Map;lineStarts=null;macroStack=[];diagnostics=[];constructor(t,e=new Map,r=!1){this.src=t;this.macros=e;this.tree=r}locate(t){if(!this.lineStarts){this.lineStarts=[0];for(let s=0;s<this.src.length;s++)if(this.src[s]===`
8
- `)this.lineStarts.push(s+1)}let e=0,r=this.lineStarts.length-1;while(e<r){let s=e+r+1>>1;this.lineStarts[s]<=t?e=s:r=s-1}return{line:e+1,col:t-this.lineStarts[e]+1}}report(t,e,r,s,i=1,n){let{line:a,col:o}=this.locate(s);this.diagnostics.push({code:t,severity:e,message:r,hint:n,loc:{line:a,col:o,offset:s,length:i}})}expr(t,e){let r=this.exprIndex.get(t);if(r!==void 0)return r;let{diagnostics:s}=_(t);for(let n of s){let a=(e?.offset??0)+n.loc.offset;this.report(n.code,"error",n.message,a,n.loc.length)}let i=this.exprs.length;return this.exprs.push(t),this.exprIndex.set(t,i),i}synth(t){let e=this.exprIndex.get(t);if(e!==void 0)return e;let r=this.exprs.length;return this.exprs.push(t),this.exprIndex.set(t,r),r}concat(t){t.filter((r)=>typeof r!=="string").forEach((r)=>{let{diagnostics:s}=_(r.expr);for(let i of s)this.report(i.code,"error",i.message,r.loc.offset+i.loc.offset,i.loc.length)});let e=t.map((r)=>typeof r==="string"?JSON.stringify(r):`((${r.expr})??"")`).join("+");return this.synth(e)}compInput(t){switch(t.k){case"literal":return{lit:t.value};case"bool":return{lit:t.value};case"expr":return{e:this.expr(t.source,t.loc)};case"interp":return{e:this.concat(t.parts)}}}compile(t){return{v:1,exprs:this.exprs,root:this.block(t,[])}}block(t,e){let r={html:"",scope:[...e],binds:[],blocks:[]},s=[],i=this.tree,n=[],a=(o,l,p,b=!1,k)=>{let E=0,d=!1,y=()=>(s.push(Pt),i&&p.push(0),d=!1,[...l,E++]);for(let I=0;I<o.length;I++){let m=o[I];switch(m.t){case"text":{if(b){let u={t:"text",p:y(),e:this.synth(JSON.stringify(m.value)),i18n:1};if(k)u.ik=k;r.binds.push(u);break}if(s.push(Rt(m.value)),i&&(d?p[p.length-1]+=m.value:p.push(m.value)),!d)E++;d=!0;break}case"comment":{if(i)break;let u=m.value.replace(/--/g,"- -");s.push(`<!--${/^-?>/.test(u)?" "+u:u}-->`),d=!1,E++;break}case"interp":{let u={t:"text",p:y(),e:this.concat(m.parts)};if(b)u.i18n=1;if(b&&k)u.ik=k;r.binds.push(u);break}case"fragment":{o=[...o.slice(0,I),...m.children,...o.slice(I+1)],I--;break}case"element":{if(st.has(m.tag)){if(this.controlBlock(m,o,I,y(),r,e),m.tag==="if"){let u=I+1;while(u<o.length){let R=o[u];if(R.t==="element"&&(R.tag==="else-if"||R.tag==="else"))u++;else break}o=[...o.slice(0,I+1),...o.slice(u)]}break}if(rt.has(m.tag)){this.report("LIPS-C002","error",`<${m.tag}> is only valid inside its parent construct`,m.loc.offset,m.loc.length);break}if(m.tag==="#dynamic"){r.blocks.push(this.compLike(m,y(),e,"dynamic"));break}if(this.macros.has(m.tag)){let u=this.macroCall(m,y(),e);u&&r.blocks.push(u);break}if(!it.has(m.tag)){r.blocks.push(this.compLike(m,y(),e,"comp"));break}this.emitElement(m,l,E++,s,r,a,p),d=!1;break}}}};if(a(t,[],n),r.html=s.join(""),i)r.nodes=n;return r}emitElement(t,e,r,s,i,n,a){let o=[...e,r],l=`<${t.tag}`,p=[t.tag],b={},k=(c,x)=>{Object.prototype.hasOwnProperty.call(b,c)||(b[c]=x)};this.tree&&a.push(p);let E=t.attrs.filter((c)=>("name"in c)),d=E.some((c)=>c.name==="i18n"&&(c.k==="bool"&&c.value||c.k==="literal")),y=(c)=>d&&(c==="title"||c==="placeholder"),I=(c)=>{let x=E.find((L)=>L.name===c&&L.k==="literal");return x&&"value"in x&&x.value?String(x.value):void 0},m=I("i18n"),u=(c)=>I(`i18n-${c}`);!d&&E.some((c)=>c.name.startsWith("i18n-"))&&this.report("LIPS-C014","warning",`i18n-* key on <${t.tag}> without the 'i18n' marker — the attribute will not be translated`,t.loc.offset,t.loc.length);for(let c of t.attrs){if(this.tree&&"name"in c&&c.name==="@html"){this.report("LIPS-C021","error",`@html on <${t.tag}>: the 'tree' target has no HTML parser`,c.loc.offset,c.loc.length,"Write the markup in the template, or use @text");continue}if("name"in c&&c.name==="style"){let x=Ct(c);if(x&&ot(x)){this.report("LIPS-C019","error",`style= on <${t.tag}> takes CSS text, not an object literal`,c.loc.offset,c.loc.length,'Write the declarations as CSS — style="border: 2px solid gray; margin: 3rem" — '+`and interpolate values into it where they vary: style="margin: {state.gap}rem". Styles that need pseudo-classes, media queries or keyframes belong in the component's stylesheet.`);continue}}if(this.quotedEvent(t.tag,c))continue;switch(c.k){case"literal":if(c.name==="@format"){i.binds.push(this.formatBind(o,c));break}if(c.name.startsWith("@")){i.binds.push({t:"prop",p:o,name:c.name.slice(1),e:this.synth(JSON.stringify(c.value))});break}if(c.name==="i18n"||c.name.startsWith("i18n-"))break;if(y(c.name)){let x={t:"attr",p:o,name:c.name,e:this.synth(JSON.stringify(c.value)),i18n:1},L=u(c.name);if(L)x.ik=L;i.binds.push(x);break}l+=` ${c.name}="${Lt(c.value)}"`,k(c.name,c.value);break;case"bool":if(c.name!=="i18n"&&c.value)l+=` ${c.name}`,k(c.name,"");break;case"expr":{if(c.name==="@format"){i.binds.push(this.formatBind(o,c));break}if(c.name.startsWith("@")){i.binds.push({t:"prop",p:o,name:c.name.slice(1),e:this.expr(c.source,c.loc)});break}let x={t:"attr",p:o,name:c.name,e:this.expr(c.source,c.loc)};if(y(c.name)){x.i18n=1;let L=u(c.name);if(L)x.ik=L}i.binds.push(x);break}case"interp":{if(c.name==="@format"){i.binds.push(this.formatBind(o,c));break}if(c.name.startsWith("@")){i.binds.push({t:"prop",p:o,name:c.name.slice(1),e:this.concat(c.parts)});break}let x={t:"attr",p:o,name:c.name,e:this.concat(c.parts)};if(y(c.name)){x.i18n=1;let L=u(c.name);if(L)x.ik=L}i.binds.push(x);break}case"event":this.modifiers(c),i.binds.push({t:"event",p:o,name:c.name,e:this.synth(c.source)});break;case"spread":i.binds.push({t:"spread",p:o,e:this.expr(c.source,c.loc)});break;case"fn":this.report("LIPS-C007","warning",`Callable attribute '${c.name}(…)' has no meaning on <${t.tag}>`,c.loc.offset,c.loc.length);break;case"args":this.report("LIPS-C008","warning",`Iterator arguments are not applicable to <${t.tag}>`,c.loc.offset,c.loc.length);break}}if(Object.keys(b).length&&(p[1]=b),wt.has(t.tag)){s.push(l+">");return}s.push(l+">");let w=m,j=t.children.filter((c)=>c.t==="text"||c.t==="interp");if(w&&(j.length>1||j.some((c)=>c.t==="interp")))this.report("LIPS-C015","error",`<${t.tag} i18n="${w}"> keys text that is not a single fixed string. Use @format="${w}, { … }" for interpolated text.`,t.loc.offset,t.loc.length),w=void 0;let f=[];if(t.children.length&&n(t.children,o,f,d,w),f.length)p[1]=b,p[2]=f;s.push(`</${t.tag}>`)}formatBind(t,e){let r=e.k==="literal"?e.value:e.k==="expr"?e.source:e.parts.map((a)=>typeof a==="string"?a:`{${a.expr}}`).join(""),s=r.indexOf(",");if(s===-1)return this.report("LIPS-C012","error",'@format expects "reference, { params }"',e.loc.offset,e.loc.length),{t:"prop",p:t,name:"format",e:this.synth("({})"),ref:r.trim()};let i=r.slice(0,s).trim(),n=r.slice(s+1).trim();return{t:"prop",p:t,name:"format",e:this.expr(n,e.loc),ref:i}}attrsOf(t){let e=new Map,r=[];for(let s of t.attrs)if(s.k==="args")r.push(...s.names);else if("name"in s)e.set(s.name,s);return{byName:e,args:r}}controlBlock(t,e,r,s,i,n){switch(t.tag){case"if":{let a=[{when:t.head?this.expr(t.head.expr,t.head.loc):this.missingHead(t),block:this.block(t.children,n)}];for(let o=r+1;o<e.length;o++){let l=e[o];if(l.t!=="element")break;if(l.tag==="else-if")a.push({when:l.head?this.expr(l.head.expr,l.head.loc):this.missingHead(l),block:this.block(l.children,n)});else if(l.tag==="else"){a.push({when:null,block:this.block(l.children,n)});break}else break}i.blocks.push({t:"if",p:s,branches:a});break}case"else-if":case"else":this.report("LIPS-C001","error",`<${t.tag}> without a preceding <if>`,t.loc.offset,t.loc.length);break;case"for":{let{byName:a,args:o}=this.attrsOf(t),l=a.get("in"),p=a.get("from"),b=a.get("to"),k=a.get("by");if(!l&&!p){this.report("LIPS-C004","error","<for> requires 'in' or 'from'/'to'",t.loc.offset,t.loc.length);break}let E={t:"for",p:s,args:o,block:this.block(t.children,[...n,...o])};if(l){let d=this.valueOf(l);d===void 0?this.report("LIPS-C004","error","<for in=…> takes an expression: in=state.items",l.loc.offset,l.loc.length):E.of=this.expr(d,l.loc)}if(p)E.from=this.numInput(p);if(b)E.to=this.numInput(b);if(k){let d=k.k==="literal"?void 0:this.valueOf(k);k.k==="literal"?E.by={lit:k.value}:d===void 0?this.report("LIPS-C004","error","<for by=…> takes a key path or an expression",k.loc.offset,k.loc.length):E.by={e:this.expr(d,k.loc)}}i.blocks.push(E);break}case"switch":{let a=t.head?this.expr(t.head.expr,t.head.loc):this.missingHead(t),o=[];for(let l of t.children){if(l.t!=="element")continue;if(l.tag==="case"){let{byName:p}=this.attrsOf(l),b=p.get("is");if(!b||b.k!=="literal"&&b.k!=="expr"){this.report("LIPS-C004","error","<case> requires an 'is' attribute",l.loc.offset,l.loc.length);continue}o.push({is:b.k==="literal"?{lit:b.value}:{e:this.expr(b.source,b.loc)},block:this.block(l.children,n)})}else if(l.tag==="default")o.push({is:null,block:this.block(l.children,n)});else this.report("LIPS-C003","error","Only <case>/<default> are valid inside <switch>",l.loc.offset,l.loc.length)}i.blocks.push({t:"switch",p:s,on:a,cases:o});break}case"async":{let a=t.attrs.find((l)=>l.k==="fn"&&l.name==="await");if(!a){this.report("LIPS-C004","error","<async> requires await(…)",t.loc.offset,t.loc.length);break}let o={t:"async",p:s,awaitE:this.expr(a.source,a.loc)};for(let l of t.children){if(l.t!=="element")continue;let{args:p}=this.attrsOf(l);if(l.tag==="then")o.then={args:p,block:this.block(l.children,[...n,...p])};else if(l.tag==="catch")o.catch={args:p,block:this.block(l.children,[...n,...p])};else if(l.tag==="loading")o.loading=this.block(l.children,n);else this.report("LIPS-C003","error","Only <then>/<catch>/<loading> are valid inside <async>",l.loc.offset,l.loc.length)}i.blocks.push(o);break}case"let":case"const":{let a={};for(let o of t.attrs){if(o.k==="spread"){this.report("LIPS-C013","error",`Spread is not supported on <${t.tag}> — scope names must be known at compile time`,o.loc.offset,o.loc.length,`Assign it to one variable: <${t.tag} obj={ ${o.source} }/> and read obj.<key>`);continue}if(o.k==="literal"||o.k==="expr"||o.k==="interp"||o.k==="bool")a[o.name]=this.compInput(o),!i.scope.includes(o.name)&&i.scope.push(o.name),!n.includes(o.name)&&n.push(o.name)}i.blocks.push({t:"let",p:s,const:t.tag==="const",vars:a});break}case"log":i.blocks.push({t:"log",p:s,e:t.head?this.synth(t.head.expr):this.missingHead(t)});break;case"context":{let a={};for(let o of t.attrs){if(o.k==="spread"){this.report("LIPS-C016","error","Spread is not supported on <context> — provided keys must be known at compile time",o.loc.offset,o.loc.length,"Provide them one by one: <context a=obj.a b=obj.b>");continue}if(o.k==="literal"||o.k==="expr"||o.k==="interp"||o.k==="bool")a[o.name]=this.compInput(o)}if(!Object.keys(a).length)this.report("LIPS-C017","warning","<context> provides nothing — it renders its children unchanged",t.loc.offset,t.loc.length);i.blocks.push({t:"provide",p:s,vars:a,block:this.block(t.children,n)});break}case"i18n":{let{byName:a}=this.attrsOf(t),o=a.get("lang");if(!o){this.report("LIPS-C018","error","<i18n> requires a 'lang' attribute: <i18n lang=state.docLang>",t.loc.offset,t.loc.length);break}i.blocks.push({t:"provide",p:s,vars:{},lang:this.compInput(o),block:this.block(t.children,n)});break}}}missingHead(t){return this.report("LIPS-C004","error",`<${t.tag}> requires a head expression: <${t.tag}( … )>`,t.loc.offset,t.loc.length),this.synth("undefined")}numInput(t){if(t.k==="literal")return{lit:nt(t.value)?Number(t.value):t.value};let e=this.valueOf(t);if(e!==void 0)return nt(e)?{lit:Number(e)}:{e:this.expr(e,t.loc)};return"name"in t&&this.report("LIPS-C004","error",`<for ${t.name}=…> takes a number or an expression`,t.loc.offset,t.loc.length),{lit:void 0}}valueOf(t){if(t.k==="expr")return t.source;if(t.k==="interp"&&t.parts.length===1&&typeof t.parts[0]!=="string")return t.parts[0].expr}macroCall(t,e,r){let s=this.macros.get(t.tag);if(this.macroStack.includes(s.name))return this.report("LIPS-C009","error",`Recursive macro <${s.name}> (${[...this.macroStack,s.name].join(" → ")})`,t.loc.offset,t.loc.length),null;let i=[];for(let a of t.attrs)if(a.k==="literal"||a.k==="expr"||a.k==="interp"||a.k==="bool")i.push({name:a.name,ci:this.compInput(a)});else if(a.k==="spread")i.push({spread:this.expr(a.source,a.loc)});else if(a.k==="event")this.report("LIPS-C023","error",`on-${a.name}( … ) on the macro <${t.tag}> wires no listener`,a.loc.offset,a.loc.length,"Pass the handler as an argument (fn=self.pick) and wire it in the body");t.children.length&&this.report("LIPS-C024","error",`<${t.tag}> is a macro: what it encloses is not rendered`,t.loc.offset,t.loc.length,"A component takes content: <{input.renderer}/>"),this.macroStack.push(s.name);let n=this.block(s.children,[...r,...s.argv]);return this.macroStack.pop(),{t:"macro",p:e,name:s.name,sets:i,args:s.argv,block:n}}quotedEvent(t,e){if(!("name"in e)||!e.name.startsWith("on-"))return!1;return this.report("LIPS-C020","error",`${e.name}="…" on <${t}> wires no listener`,e.loc.offset,e.loc.length,`Handlers use the instruction form: ${e.name}( … ). `+"Quoted, it is an ordinary attribute — the handler never runs and the source is emitted into the DOM."),!0}modifiers(t,e){let r=t.name.split(".").slice(1),s=r.find((i)=>!$t.has(i));(s||e&&r[0])&&this.report("LIPS-C022",s?"error":"warning",s?`Unknown event modifier .${s}: use .stop, .capture or .outside`:`.${r[0]} does nothing on a component's event`,t.loc.offset,t.loc.length)}compLike(t,e,r,s){let i={},n=[],a=[],o=[];for(let p of t.attrs){if(p.k!=="event"&&this.quotedEvent(t.tag,p))continue;switch(p.k){case"literal":case"bool":case"expr":case"interp":if(p.name==="@format"&&p.k!=="bool"){let{ref:b,e:k}=this.formatBind(e,p);i[p.name]={lit:{ref:b,e:k}};break}i[p.name]=this.compInput(p);break;case"event":this.modifiers(p,s==="comp"),a.push({name:p.name,e:this.synth(p.source)});break;case"spread":n.push(this.expr(p.source,p.loc));break;case"args":o=[...o,...p.names];break;case"fn":i[p.name]={e:this.expr(p.source,p.loc)};break}}let l=t.children.length?{args:o,block:this.block(t.children,[...r,...o])}:void 0;return s==="comp"?{t:"comp",p:e,name:t.tag,inputs:i,spreads:n,events:a,contents:l}:{t:"dynamic",p:e,tag:this.expr(t.dynamicTag.expr,t.dynamicTag.loc),inputs:i,spreads:n,events:a,contents:l}}}function Nt(t,e,r){let s=new Map;if(!t?.trim())return s;let i=W(t);e.push(...i.diagnostics),r?.(i.root.children,e,t);for(let n of i.root.children){if(n.t!=="element")continue;if(n.tag!=="macro"){e.push({code:"LIPS-C010",severity:"warning",message:`Only <macro> definitions are allowed in the macros source — ignoring <${n.tag}>`,loc:{line:1,col:1,offset:n.loc.offset,length:n.loc.length}});continue}let a="",o=[];for(let l of n.attrs)if(l.k==="args")o.push(...l.names);else if(l.k==="literal"&&l.name==="name")a=l.value;if(!a){e.push({code:"LIPS-C011",severity:"error",message:"<macro> requires a name attribute",loc:{line:1,col:1,offset:n.loc.offset,length:n.loc.length}});continue}s.set(a.toLowerCase(),{name:a,argv:o,children:n.children})}return s}function F(t,e){let r=[],s=Nt(e?.macros||"",r,e?.check),i=W(t);e?.check?.(i.root.children,r,t),e?.transform?.(i.root.children,r);let n=new at(t,s,e?.target==="tree");return{ir:n.compile(i.root.children),diagnostics:[...r,...i.diagnostics,...n.diagnostics]}}var Tt=null;var At=/^[-\w]+$/,ut=/^(%|[a-zA-Z]+)/,lt=["<number>","0"];function M(t,e){let r=t[e];e++;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===r)return e+1;e++}return e}function ft(t,e){let r=t.indexOf("*/",e+2);return r<0?t.length:r+2}function Ot(t,e){let r=t.indexOf(`
9
- `,e+2);return r<0?t.length:r}var _t=(t)=>t.replace(/["\\]/g,"\\$&");function D(t,e,r){let s=1,i=-1;for(let n=0;n<e;n++)if(t[n]===`
10
- `)s++,i=n;return{line:s,col:e-i,offset:e,length:r}}function G(t,e){let r=e+1,s=0,i=!1,n=!1;while(r<t.length){let o=t[r];if(o==='"'||o==="'"){r=M(t,r);continue}if(o==="{"||o===";")return null;if(o==="}")break;if(o==="("||o==="[")s++;else if(o===")"||o==="]")s--;else if(s===0){if(o==="?")i=!0;else if(o===":"&&!i)n=!0}r++}if(r>=t.length||n)return null;let a=t.slice(e+1,r).trim();return a?{end:r,expr:a}:null}var jt=new Set(["state","input","static","context","self"]);function Bt(t,e,r,s){let i=[],n=e,a=e,o=0;while(n<t.length){let l=t[n];if(l==='"'||l==="'"){n=M(t,n);continue}if(l==="/"&&t[n+1]==="*"){let p=ft(t,n);if(!r)i.push(t.slice(a,n)," "),a=p;n=p;continue}if(l==="("){o++,n++;continue}if(l===")"){o--,n++;continue}if(o===0&&(l===";"||l==="}"))return i.push(t.slice(a,n)),{end:n,parts:i};if(l==="{"){let p=G(t,n);if(!p)return t.indexOf("}",n+1)<0&&s?.(n),null;i.push(t.slice(a,n));let b=ut.exec(t.slice(p.end+1)),k=b?b[1]:"";i.push({expr:p.expr,unit:k,at:n}),n=p.end+1+k.length,a=n;continue}n++}return i.some((l)=>typeof l!=="string")&&s?.(e),null}var Dt=/^@(-\w+-)?(keyframes|font-face|property|counter-style|font-feature-values|font-palette-values|page|view-transition|position-try|color-profile|function)\b/i,ct=/^@(import|charset|namespace)\b/i,Mt=/^@(media|supports|container|layer|scope|starting-style|document)\b/i,qt=/^([a-zA-Z_*\\]|[^\x00-\x7f])/,Ut=/^(?:[-\w*|]|[^\x00-\x7f]|\\[\s\S])+/,Wt=/&[-_]/,gt=/\s/,pt=/[{};]/,ht=/[-\w]/,mt=/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/g,Ht=new RegExp(`(${mt.source})|\\s+`,"g"),Ft=/\/\*[\s\S]*?\*\//g,Gt=/^@layer\b/i,Vt=(t)=>t.replace(Ht,(e,r)=>r||" ");function zt(t){let e=[],r=0,s=0;for(let i=0;i<t.length;i++){let n=t[i];if(n==="\\"){i++;continue}if(n==='"'||n==="'"){i=M(t,i)-1;continue}if(n==="("||n==="[")s++;else if(n===")"||n==="]")s--;else if(n===","&&!s)e.push(t.slice(r,i)),r=i+1}return e.push(t.slice(r)),e.map((i)=>{let n=i.trimStart(),a=n.length;while(a&&gt.test(n[a-1])&&n[a-2]!=="\\")a--;if(n=n.slice(0,a),!qt.test(n))return n;return n.includes("&")?n.replace(Ut,":is($&)"):`& ${n}`}).join(",")}function Zt(t,e,r,s){let i=[],n=[],a=[],o=`--${e.nsp.replace(/[^a-zA-Z0-9_-]/g,"-")}`,l=(h,v,g,S,P)=>s.push({code:h,severity:"error",message:v,hint:P,loc:D(t,g,S)}),p=(h,v,g,S,P)=>s.push({code:h,severity:"warning",message:v,hint:P,loc:D(t,g,S)}),b=(h,v,g,S)=>e.lint?.(h,S)?.forEach((P)=>s.push({...P,loc:D(t,v,g-v)})),k=(h)=>{let v=i.indexOf(h);if(v<0)v=i.push(h)-1;return v},E=(h)=>{let{ast:v,diagnostics:g}=_(h.expr),S=h.expr.length+2;if(g.length){l("LIPS-S004",`Invalid expression: ${g[0].message}`,h.at,S);return}for(let P of et(v))if(!jt.has(P)&&!(P in globalThis))l("LIPS-S003",`'${P}' is not readable from a stylesheet`,h.at,S,"Stylesheets see state, input, static, context and self — not <for> iterators or <let> names, "+"which are local to a template position.");h.unit&&v.t==="lit"&&typeof v.v==="string"&&p("LIPS-S005",`Unit '${h.unit}' after a string value`,h.at,S,`A unit suffix multiplies a number: drop the unit, or return ${h.unit==="%"?"50":"8"} instead of a string.`)},d="",y="",I="",m=!1,u=(h)=>{if(!h)return;if(m&&I&&!pt.test(I)&&!pt.test(h[0]))y+=" ";m=!1,y+=h,I=h[h.length-1]},R=(h)=>{d+=y+h,y="",I=h,m=!1},w=()=>{let h=y;return y=I="",m=!1,h},j=(h)=>":"+(Vt(h).trim()||" "),f=0,c=0,x=0,L="",O="",z="",Z=!1,N=[{ctx:e.meta?"top":"style"}],dt=()=>{let h=N[N.length-1],v=y,g;if(h.ctx==="opaque"||b(v,x,f),v[0]==="@")if(h.ctx!=="opaque"&&Dt.test(v))g={ctx:"opaque",hoist:d.length};else if(Mt.test(v))g={ctx:h.ctx,group:v,at:d.length};else g={ctx:"opaque"};else{if(h.ctx==="style"){if(r)Wt.test(v.replace(mt,""))&&p("LIPS-S008",`'${v}' joins '&' to a name`,x,f-x,"Native nesting cannot: write the full selector, or use stylisPreprocessor."),y=zt(v)}g={ctx:h.ctx==="opaque"?"opaque":"style"}}N.push(g),R("{"),g.group&&(g.body=d.length)},J=()=>{let h=N.pop();if(h.group&&!y&&d.length===h.body&&!Gt.test(h.group)){d=d.slice(0,h.at),I="",m=!1;return}if(R("}"),h.hoist===void 0)return;let v=d.slice(h.hoist),g=N.filter((T)=>T.group),S=g.map((T)=>T.group).join("{"),P="}".repeat(g.length);d=d.slice(0,h.hoist),I="",O=S&&S===z?O.slice(0,O.length-P.length)+v+P:O+g.map((T)=>T.group+"{").join("")+v+P,z=S};while(f<t.length){let h=t[f];if(h==="\\"){u(t.slice(f,f+2)),f+=2;continue}let v=h==="/"&&!t.slice(x,f).trim();if(h==="/"&&(t[f+1]==="*"||t[f+1]==="/"&&v)){let g=t[f+1]==="/",S=g?Ot(t,f):ft(t,f);if(!g&&!r)y?u(t.slice(f,S)):d+=t.slice(f,S);else ht.test(I)&&ht.test(t[S]||"")&&(m=!0);v&&(x=S),f=S;continue}if(h==='"'||h==="'"){let g=M(t,f);u(t.slice(f,g)),f=g;continue}if(gt.test(h)){x===f&&x++,m=!0,f++;continue}if(h==="(")c++;else if(h===")")c--;if(h===":"&&c===0){let g=t.slice(x,f).replace(Ft,"").trim();if(At.test(g)){let S=Bt(t,f+1,!r,(P)=>{Z=!0,l("LIPS-S004","Unterminated interpolation",P,t.length-P,"Close the expression with `}`.")});if(S){let P=S.parts.filter((C)=>typeof C!=="string");for(let C of P)E(C);if(m=!1,g.startsWith("--")&&P.length===1&&!P[0].unit&&S.parts.every((C)=>typeof C!=="string"||!C.trim())){n.push({prop:g,e:k(P[0].expr)}),w(),f=S.end+(t[S.end]===";"?1:0),x=f;continue}let B="";for(let C of S.parts){if(typeof C==="string"){B+=C;continue}let K=k(C.expr),A=`${o}-${K}`;if(!n.some((q)=>q.prop===A)){if(n.push({prop:A,e:K}),C.unit&&!a.some((q)=>q.name===A))a.push({name:A,syntax:lt[0],inherits:!0,initial:lt[1]})}B+=C.unit?`calc(var(${A}) * 1${C.unit})`:`var(${A})`}b(g,x,S.end,B),u(j(B)),f=S.end;continue}}}if(h==="{"){if(c>0){let g=G(t,f);if(g){l("LIPS-S002","Interpolation in an at-rule condition",f,g.end-f+1,"Media and container conditions cannot read custom properties. Keep the condition static.");let S=ut.exec(t.slice(g.end+1));f=g.end+1+(S?S[1].length:0);continue}}if(!t.slice(x,f).trim()){let g=G(t,f);if(g){l("LIPS-S001","Interpolation in a selector",f,g.end-f+1,"Selectors are static in Layer 1. Bind a value inside the rule instead."),f=g.end+1,x=f;continue}}dt(),x=++f;continue}if(h==="}"){if(N.length>1)J();else p("LIPS-S007","Unmatched `}` dropped",f,1),y&&R(";");x=++f;continue}if(h===";"){if(y[0]==="@"&&b(y,x,f),N.length===1&&ct.test(y))L+=w()+";";else R(";");x=++f;continue}u(h),f++}if(N.length>1){Z||p("LIPS-S007","Unclosed `{` closed at the end",t.length,0);while(N.length>1)J()}return ct.test(y)&&(L+=w()+";"),R(""),{css:d,statements:L,hoisted:O,exprs:i,binds:n,props:a}}function V(t,e){let r=[],s=e.preprocess||Tt,{css:i,statements:n,hoisted:a,exprs:o,binds:l,props:p}=Zt(t,e,!s,r),b={v:1,nsp:e.nsp,css:"",exprs:[],binds:[]},k=e.meta||!i?i:`${e.scope||`[rel="${_t(e.nsp)}"]`}{${i}}`,E=a+k,d=e.layer?`@layer ${e.layer}{${E}}`:E,y;try{y=s?s(d):d}catch(u){return r.push({code:"LIPS-S006",severity:"error",message:`Style compilation failed: ${u.message}`,loc:D(t,0,t.length)}),{ir:b,diagnostics:r}}let I=p.map((u)=>`@property ${u.name}{syntax:"${u.syntax}";inherits:${u.inherits};initial-value:${u.initial}}`).join(""),m={v:1,nsp:e.nsp,css:n+I+y,exprs:o,binds:l};if(p.length)m.props=p;return{ir:m,diagnostics:r}}function pe(t,e={}){let r={macros:t.macros,target:e.target},{ir:s,diagnostics:i}=F(t.default||"",r),{default:n,macros:a,stylesheet:o,...l}=t;if(!o)return{template:{...l,ir:s},diagnostics:i};let p=V(o,{nsp:e.name||"lips",preprocess:e.preprocess});return{template:{...l,ir:s,style:p.ir},diagnostics:[...i,...p.diagnostics]}}var Jt=(t)=>JSON.stringify(t),Kt=(t)=>JSON.stringify(t);function he(t={}){let e=t.include||/\.lips$/,r=t.reportDiagnostics!==!1;return{name:"lips:precompile",enforce:"pre",async transform(s,i){if(!e.test(i))return null;await Promise.resolve().then(() => H());let{script:a}=X(s),o=s.slice(a.length),l=/\bconst\s+macros\s*=\s*`([^`]*)`/.exec(a)?.[1];if(/\bconst\s+macros\b/.test(a)&&(l===void 0||l.includes("${")))throw Error(`[lips] ${i}: const macros must be a plain template literal — it is inlined at build time`);let{ir:p,diagnostics:b}=F(o,{target:t.target,macros:l});if(r)for(let u of b)this?.warn?.(`[lips] ${u.code} ${u.message} (${i}:${u.loc.line}:${u.loc.col})`);let k=b.filter((u)=>u.severity==="error");if(k.length)throw Error(`[lips] ${i}: ${k[0].message} at line ${k[0].loc.line}:${k[0].loc.col}`);let E=(i.split(/[\\/]/).pop()||"lips").replace(/\.lips$/,""),d=/\bconst\s+stylesheet\s*=\s*`([^`]*)`/.exec(a),y=/\bconst\s+stylesheet\b/.test(a),I=d&&!d[1].includes("${"),m="";if(I){let u=V(d[1],{nsp:E,preprocess:t.preprocess});if(r)for(let w of u.diagnostics)this?.warn?.(`[lips] ${w.code} ${w.message} (${i}:${w.loc.line}:${w.loc.col})`);let R=u.diagnostics.filter((w)=>w.severity==="error");if(R.length)throw Error(`[lips] ${i}: ${R[0].message} at line ${R[0].loc.line}:${R[0].loc.col}`);m=` style: ${Kt(u.ir)},
11
- `}else if(y&&r)this?.warn?.(`[lips] ${i}: stylesheet could not be precompiled (interpolated template literal) — `+'it ships as source and needs "@lipsjs/lips", not "@lipsjs/lips/runtime".');return{code:`${a}
12
- const __lips_ir__ = ${Jt(p)};
6
+ `){r=!0;continue}if(r&&e===0&&i==="<"&&/[A-Za-z{>!]/.test(t[s+1]||""))return s;if(i==="("||i==="["||i==="{")e++;else if(i===")"||i==="]"||i==="}")e=Math.max(0,e-1);if(!/\s/.test(i))r=!1}return 0}var yt,kt,Y,Q,St;var H=xt(()=>{yt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),kt=new Set(["pre","textarea"]),Y=new Set(["if","else-if","switch","log"]),Q={__proto__:null,amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "},St=/&(?:#(\d+)|#[xX]([0-9a-fA-F]+)|([A-Za-z][A-Za-z0-9]*));/g});H();var It=["===","!==","...","=>","==","!=","<=",">=","&&","||","??","?.","++","--","+=","-=","*=","/=","%=","+","-","*","/","%","<",">","!","?",":",".",",","(",")","[","]","{","}","="];function Pt(t,e){let r=[],s=0,i=(a)=>/[A-Za-z_$]/.test(a),n=(a)=>/[A-Za-z0-9_$]/.test(a);while(s<t.length){let a=t[s];if(/\s/.test(a)){s++;continue}if(/[0-9]/.test(a)||a==="."&&/[0-9]/.test(t[s+1])){let l=s;while(s<t.length&&/[0-9]/.test(t[s]))s++;if(t[s]==="."){s++;while(s<t.length&&/[0-9]/.test(t[s]))s++}if(t[s]==="e"||t[s]==="E"){if(s++,t[s]==="+"||t[s]==="-")s++;while(s<t.length&&/[0-9]/.test(t[s]))s++}r.push({t:"num",value:t.slice(l,s),start:l,end:s});continue}if(a==="'"||a==='"'){let l=s;s++;let p="",b=!1;while(s<t.length){let y=t[s];if(y==="\\"){let E=t[s+1],d={n:`
7
+ `,t:"\t",r:"\r",b:"\b",f:"\f",v:"\v","0":"\x00"};if(E==="u"){let k=t.slice(s+2,s+6);p+=String.fromCharCode(parseInt(k,16)||0),s+=6}else p+=d[E]??E,s+=2;continue}if(y===a){b=!0,s++;break}p+=y,s++}if(!b)e.push({code:"LIPS-E001",message:"Unterminated string literal",loc:{offset:l,length:s-l}});r.push({t:"str",value:p,start:l,end:s});continue}if(i(a)){let l=s;while(s<t.length&&n(t[s]))s++;r.push({t:"id",value:t.slice(l,s),start:l,end:s});continue}let o=It.find((l)=>t.startsWith(l,s));if(o==="?."&&/[0-9]/.test(t[s+2]??""))o="?";if(o){r.push({t:"punct",value:o,start:s,end:s+o.length}),s+=o.length;continue}e.push({code:"LIPS-E002",message:`Unexpected character '${a}'`,loc:{offset:s,length:1}}),s++}return r.push({t:"eof",value:"",start:t.length,end:t.length}),r}class tt{tokens;diagnostics;pos=0;constructor(t,e){this.tokens=t;this.diagnostics=e}peek(t=0){return this.tokens[Math.min(this.pos+t,this.tokens.length-1)]}next(){return this.tokens[this.pos++]??this.tokens[this.tokens.length-1]}at(t){let e=this.peek();return e.t==="punct"&&e.value===t}eat(t){if(this.at(t))return this.pos++,!0;return!1}error(t,e,r=this.peek()){return this.diagnostics.push({code:t,message:e,loc:{offset:r.start,length:Math.max(1,r.end-r.start)}}),{t:"error"}}expect(t,e){if(!this.eat(t))this.error(e,`Expected '${t}'`)}parse(){let t=this.assign();if(this.peek().t!=="eof")this.error("LIPS-E003",`Unexpected token '${this.peek().value}' after expression`);return t}isArrowAhead(){let t=this.peek();if(t.t==="id"){let e=this.peek(1);return e.t==="punct"&&e.value==="=>"}if(t.t==="punct"&&t.value==="("){let e=0,r=0;while(!0){let s=this.peek(r);if(s.t==="eof")return!1;if(s.t==="punct"&&s.value==="(")e++;if(s.t==="punct"&&s.value===")"){if(e--,e===0){let i=this.peek(r+1);return i.t==="punct"&&i.value==="=>"}}r++}}return!1}assign(){if(this.isArrowAhead()){let r=[];if(this.peek().t==="id")r.push(this.next().value);else{this.expect("(","LIPS-E004");while(!this.at(")")&&this.peek().t!=="eof"){let s=this.next();if(s.t!=="id")return this.error("LIPS-E005","Invalid arrow parameter",s);if(r.push(s.value),!this.eat(","))break}this.expect(")","LIPS-E004")}return this.expect("=>","LIPS-E004"),{t:"arrow",params:r,body:this.assign()}}let t=this.conditional(),e=this.peek();if(e.t==="punct"&&["=","+=","-=","*=","/=","%="].includes(e.value)){if(t.t!=="id"&&t.t!=="member")return this.error("LIPS-E006","Invalid assignment target",e);return this.next(),{t:"assign",op:e.value,target:t,value:this.assign()}}return t}conditional(){let t=this.nullish();if(this.eat("?")){let e=this.assign();return this.expect(":","LIPS-E007"),{t:"cond",test:t,cons:e,alt:this.assign()}}return t}nullish(){let t=this.or();while(this.at("??"))this.next(),t={t:"logic",op:"??",l:t,r:this.or()};return t}or(){let t=this.and();while(this.at("||"))this.next(),t={t:"logic",op:"||",l:t,r:this.and()};return t}and(){let t=this.equality();while(this.at("&&"))this.next(),t={t:"logic",op:"&&",l:t,r:this.equality()};return t}equality(){let t=this.relational();while(["===","!==","==","!="].some((e)=>this.at(e)))t={t:"bin",op:this.next().value,l:t,r:this.relational()};return t}relational(){let t=this.additive();while(["<=",">=","<",">"].some((e)=>this.at(e)))t={t:"bin",op:this.next().value,l:t,r:this.additive()};return t}additive(){let t=this.multiplicative();while(this.at("+")||this.at("-"))t={t:"bin",op:this.next().value,l:t,r:this.multiplicative()};return t}multiplicative(){let t=this.unary();while(this.at("*")||this.at("/")||this.at("%"))t={t:"bin",op:this.next().value,l:t,r:this.unary()};return t}unary(){if(this.at("!")||this.at("-")||this.at("+"))return{t:"unary",op:this.next().value,arg:this.unary()};if(this.at("++")||this.at("--")){let t=this.next().value,e=this.unary();if(e.t!=="id"&&e.t!=="member")return this.error("LIPS-E006","Invalid update target");return{t:"update",op:t,arg:e,prefix:!0}}return this.postfix()}postfix(){let t=this.callMember();if(this.at("++")||this.at("--")){let e=this.next().value;if(t.t!=="id"&&t.t!=="member")return this.error("LIPS-E006","Invalid update target");t={t:"update",op:e,arg:t,prefix:!1}}return t}callMember(){let t=this.primary();while(!0)if(this.eat(".")){let e=this.next();if(e.t!=="id")return this.error("LIPS-E008","Expected property name",e);t={t:"member",obj:t,prop:e.value,computed:!1,optional:!1,at:e.start}}else if(this.eat("?."))if(this.at("("))t={t:"call",callee:t,args:this.argList(),optional:!0};else if(this.eat("[")){let e=this.peek().start,r=this.assign();this.expect("]","LIPS-E009"),t={t:"member",obj:t,prop:r,computed:!0,optional:!0,at:e}}else{let e=this.next();if(e.t!=="id")return this.error("LIPS-E008","Expected property name",e);t={t:"member",obj:t,prop:e.value,computed:!1,optional:!0,at:e.start}}else if(this.eat("[")){let e=this.peek().start,r=this.assign();this.expect("]","LIPS-E009"),t={t:"member",obj:t,prop:r,computed:!0,optional:!1,at:e}}else if(this.at("("))t={t:"call",callee:t,args:this.argList(),optional:!1};else break;return t}argList(){this.expect("(","LIPS-E010");let t=[];while(!this.at(")")&&this.peek().t!=="eof")if(t.push(this.assign()),!this.eat(","))break;return this.expect(")","LIPS-E010"),t}primary(){let t=this.peek();if(t.t==="num")return this.next(),{t:"lit",v:parseFloat(t.value)};if(t.t==="str")return this.next(),{t:"lit",v:t.value};if(t.t==="id")switch(this.next(),t.value){case"true":return{t:"lit",v:!0};case"false":return{t:"lit",v:!1};case"null":return{t:"lit",v:null};case"undefined":return{t:"lit",v:void 0};case"NaN":return{t:"lit",v:NaN};case"Infinity":return{t:"lit",v:1/0};default:return{t:"id",name:t.value,at:t.start}}if(this.eat("(")){let e=this.assign();return this.expect(")","LIPS-E010"),e}if(this.eat("[")){let e=[];while(!this.at("]")&&this.peek().t!=="eof"){let r=this.eat("...");if(e.push({spread:r||void 0,value:this.assign()}),!this.eat(","))break}return this.expect("]","LIPS-E009"),{t:"arr",items:e}}if(this.eat("{")){let e=[];while(!this.at("}")&&this.peek().t!=="eof"){if(this.eat("..."))e.push({spread:!0,value:this.assign()});else{let r=this.next();if(r.t!=="id"&&r.t!=="str"&&r.t!=="num")return this.error("LIPS-E011","Invalid object key",r);if(this.eat(":"))e.push({key:String(r.value),value:this.assign(),at:r.start});else if(r.t==="id")e.push({key:r.value,value:{t:"id",name:r.value,at:r.start},at:r.start});else return this.error("LIPS-E011","Invalid shorthand property",r)}if(!this.eat(","))break}return this.expect("}","LIPS-E011"),{t:"obj",props:e}}return this.next(),this.error("LIPS-E012",t.t==="eof"?"Unexpected end of expression":`Unexpected token '${t.value}'`,t)}}function _(t){let e=[],r=Pt(t,e);return{ast:new tt(r,e).parse(),diagnostics:e}}function et(t){let e=new Set,r=(s,i)=>{switch(s.t){case"id":!i.has(s.name)&&e.add(s.name);return;case"member":r(s.obj,i),typeof s.prop!=="string"&&r(s.prop,i);return;case"call":r(s.callee,i),s.args.forEach((n)=>r(n,i));return;case"unary":case"update":r(s.arg,i);return;case"bin":case"logic":r(s.l,i),r(s.r,i);return;case"cond":r(s.test,i),r(s.cons,i),r(s.alt,i);return;case"assign":r(s.target,i),r(s.value,i);return;case"arrow":r(s.body,new Set([...i,...s.params]));return;case"arr":s.items.forEach((n)=>r(n.value,i));return;case"obj":s.props.forEach((n)=>r(n.value,i));return}};return r(t,new Set),[...e]}var ee=Symbol("lips.ended");var st=new Set(["if","else-if","else","for","switch","async","let","const","log","context","i18n"]),rt=new Set(["case","default","then","catch","loading"]),it=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","svg","circle","clippath","defs","ellipse","foreignobject","g","image","line","lineargradient","marker","mask","path","pattern","polygon","polyline","radialgradient","rect","stop","symbol","text","tspan","use"]);var $t="<!--$-->",wt=new Set(["stop","capture","outside"]),Rt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Lt=(t)=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Ct=(t)=>t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;"),nt=(t)=>t!==""&&!isNaN(Number(t)),ot=(t)=>{let e=t.trim(),r=0;for(let s=0;s<e.length;s++){let i=e[s];if(i==="'"||i==='"'||i==="`"){s++;while(s<e.length&&e[s]!==i){if(e[s]==="\\")s++;s++}continue}if(i==="("||i==="["||i==="{")r++;else if(i===")"||i==="]"||i==="}"){if(r--,r===0&&e[0]==="{"&&s===e.length-1)return ot(e.slice(1,-1))}else if(r===0){if(i==="?")return!1;if(i===":")return!0}}return!1},Nt=(t)=>{if(t.k==="expr")return t.source;if(t.k!=="interp")return"";let e=t.parts.filter((r)=>typeof r!=="string");return e.length===1&&t.parts.every((r)=>typeof r!=="string"||!r.trim())?e[0].expr:""};class at{src;macros;tree;exprs=[];exprIndex=new Map;lineStarts=null;macroStack=[];diagnostics=[];constructor(t,e=new Map,r=!1){this.src=t;this.macros=e;this.tree=r}locate(t){if(!this.lineStarts){this.lineStarts=[0];for(let s=0;s<this.src.length;s++)if(this.src[s]===`
8
+ `)this.lineStarts.push(s+1)}let e=0,r=this.lineStarts.length-1;while(e<r){let s=e+r+1>>1;this.lineStarts[s]<=t?e=s:r=s-1}return{line:e+1,col:t-this.lineStarts[e]+1}}report(t,e,r,s,i=1,n){let{line:a,col:o}=this.locate(s);this.diagnostics.push({code:t,severity:e,message:r,hint:n,loc:{line:a,col:o,offset:s,length:i}})}expr(t,e){let r=this.exprIndex.get(t);if(r!==void 0)return r;let{diagnostics:s}=_(t);for(let n of s){let a=(e?.offset??0)+n.loc.offset;this.report(n.code,"error",n.message,a,n.loc.length)}let i=this.exprs.length;return this.exprs.push(t),this.exprIndex.set(t,i),i}synth(t){let e=this.exprIndex.get(t);if(e!==void 0)return e;let r=this.exprs.length;return this.exprs.push(t),this.exprIndex.set(t,r),r}concat(t){t.filter((r)=>typeof r!=="string").forEach((r)=>{let{diagnostics:s}=_(r.expr);for(let i of s)this.report(i.code,"error",i.message,r.loc.offset+i.loc.offset,i.loc.length)});let e=t.map((r)=>typeof r==="string"?JSON.stringify(r):`((${r.expr})??"")`).join("+");return this.synth(e)}compInput(t){switch(t.k){case"literal":return{lit:t.value};case"bool":return{lit:t.value};case"expr":return{e:this.expr(t.source,t.loc)};case"interp":return{e:this.concat(t.parts)}}}compile(t){return{v:1,exprs:this.exprs,root:this.block(t,[])}}block(t,e){let r={html:"",scope:[...e],binds:[],blocks:[]},s=[],i=this.tree,n=[],a=(o,l,p,b=!1,y)=>{let E=0,d=!1,k=()=>(s.push($t),i&&p.push(0),d=!1,[...l,E++]);for(let I=0;I<o.length;I++){let m=o[I];switch(m.t){case"text":{if(b){let u={t:"text",p:k(),e:this.synth(JSON.stringify(m.value)),i18n:1};if(y)u.ik=y;r.binds.push(u);break}if(s.push(Lt(m.value)),i&&(d?p[p.length-1]+=m.value:p.push(m.value)),!d)E++;d=!0;break}case"comment":{if(i)break;let u=m.value.replace(/--/g,"- -");s.push(`<!--${/^-?>/.test(u)?" "+u:u}-->`),d=!1,E++;break}case"interp":{let u={t:"text",p:k(),e:this.concat(m.parts)};if(b)u.i18n=1;if(b&&y)u.ik=y;r.binds.push(u);break}case"fragment":{o=[...o.slice(0,I),...m.children,...o.slice(I+1)],I--;break}case"element":{if(st.has(m.tag)){if(this.controlBlock(m,o,I,k(),r,e),m.tag==="if"){let u=I+1;while(u<o.length){let R=o[u];if(R.t==="element"&&(R.tag==="else-if"||R.tag==="else"))u++;else break}o=[...o.slice(0,I+1),...o.slice(u)]}break}if(rt.has(m.tag)){this.report("LIPS-C002","error",`<${m.tag}> is only valid inside its parent construct`,m.loc.offset,m.loc.length);break}if(m.tag==="#dynamic"){r.blocks.push(this.compLike(m,k(),e,"dynamic"));break}if(this.macros.has(m.tag)){let u=this.macroCall(m,k(),e);u&&r.blocks.push(u);break}if(!it.has(m.tag)){r.blocks.push(this.compLike(m,k(),e,"comp"));break}this.emitElement(m,l,E++,s,r,a,p),d=!1;break}}}};if(a(t,[],n),r.html=s.join(""),i)r.nodes=n;return r}emitElement(t,e,r,s,i,n,a){let o=[...e,r],l=`<${t.tag}`,p=[t.tag],b={},y=(c,x)=>{Object.prototype.hasOwnProperty.call(b,c)||(b[c]=x)};this.tree&&a.push(p);let E=t.attrs.filter((c)=>("name"in c)),d=E.some((c)=>c.name==="i18n"&&(c.k==="bool"&&c.value||c.k==="literal")),k=(c)=>d&&(c==="title"||c==="placeholder"),I=(c)=>{let x=E.find((L)=>L.name===c&&L.k==="literal");return x&&"value"in x&&x.value?String(x.value):void 0},m=I("i18n"),u=(c)=>I(`i18n-${c}`);!d&&E.some((c)=>c.name.startsWith("i18n-"))&&this.report("LIPS-C014","warning",`i18n-* key on <${t.tag}> without the 'i18n' marker — the attribute will not be translated`,t.loc.offset,t.loc.length);for(let c of t.attrs){if(this.tree&&"name"in c&&c.name==="@html"){this.report("LIPS-C021","error",`@html on <${t.tag}>: the 'tree' target has no HTML parser`,c.loc.offset,c.loc.length,"Write the markup in the template, or use @text");continue}if("name"in c&&c.name==="style"){let x=Nt(c);if(x&&ot(x)){this.report("LIPS-C019","error",`style= on <${t.tag}> takes CSS text, not an object literal`,c.loc.offset,c.loc.length,'Write the declarations as CSS — style="border: 2px solid gray; margin: 3rem" — '+`and interpolate values into it where they vary: style="margin: {state.gap}rem". Styles that need pseudo-classes, media queries or keyframes belong in the component's stylesheet.`);continue}}if(this.quotedEvent(t.tag,c))continue;switch(c.k){case"literal":if(c.name==="@format"){i.binds.push(this.formatBind(o,c));break}if(c.name.startsWith("@")){i.binds.push({t:"prop",p:o,name:c.name.slice(1),e:this.synth(JSON.stringify(c.value))});break}if(c.name==="i18n"||c.name.startsWith("i18n-"))break;if(k(c.name)){let x={t:"attr",p:o,name:c.name,e:this.synth(JSON.stringify(c.value)),i18n:1},L=u(c.name);if(L)x.ik=L;i.binds.push(x);break}l+=` ${c.name}="${Ct(c.value)}"`,y(c.name,c.value);break;case"bool":if(c.name!=="i18n"&&c.value)l+=` ${c.name}`,y(c.name,"");break;case"expr":{if(c.name==="@format"){i.binds.push(this.formatBind(o,c));break}if(c.name.startsWith("@")){i.binds.push({t:"prop",p:o,name:c.name.slice(1),e:this.expr(c.source,c.loc)});break}let x={t:"attr",p:o,name:c.name,e:this.expr(c.source,c.loc)};if(k(c.name)){x.i18n=1;let L=u(c.name);if(L)x.ik=L}i.binds.push(x);break}case"interp":{if(c.name==="@format"){i.binds.push(this.formatBind(o,c));break}if(c.name.startsWith("@")){i.binds.push({t:"prop",p:o,name:c.name.slice(1),e:this.concat(c.parts)});break}let x={t:"attr",p:o,name:c.name,e:this.concat(c.parts)};if(k(c.name)){x.i18n=1;let L=u(c.name);if(L)x.ik=L}i.binds.push(x);break}case"event":this.modifiers(c),i.binds.push({t:"event",p:o,name:c.name,e:this.synth(c.source)});break;case"spread":i.binds.push({t:"spread",p:o,e:this.expr(c.source,c.loc)});break;case"fn":this.report("LIPS-C007","warning",`Callable attribute '${c.name}(…)' has no meaning on <${t.tag}>`,c.loc.offset,c.loc.length);break;case"args":this.report("LIPS-C008","warning",`Iterator arguments are not applicable to <${t.tag}>`,c.loc.offset,c.loc.length);break}}if(Object.keys(b).length&&(p[1]=b),Rt.has(t.tag)){s.push(l+">");return}s.push(l+">");let w=m,j=t.children.filter((c)=>c.t==="text"||c.t==="interp");if(w&&(j.length>1||j.some((c)=>c.t==="interp")))this.report("LIPS-C015","error",`<${t.tag} i18n="${w}"> keys text that is not a single fixed string. Use @format="${w}, { … }" for interpolated text.`,t.loc.offset,t.loc.length),w=void 0;let f=[];if(t.children.length&&n(t.children,o,f,d,w),f.length)p[1]=b,p[2]=f;s.push(`</${t.tag}>`)}formatBind(t,e){let r=e.k==="literal"?e.value:e.k==="expr"?e.source:e.parts.map((a)=>typeof a==="string"?a:`{${a.expr}}`).join(""),s=r.indexOf(",");if(s===-1)return this.report("LIPS-C012","error",'@format expects "reference, { params }"',e.loc.offset,e.loc.length),{t:"prop",p:t,name:"format",e:this.synth("({})"),ref:r.trim()};let i=r.slice(0,s).trim(),n=r.slice(s+1).trim();return{t:"prop",p:t,name:"format",e:this.expr(n,e.loc),ref:i}}attrsOf(t){let e=new Map,r=[];for(let s of t.attrs)if(s.k==="args")r.push(...s.names);else if("name"in s)e.set(s.name,s);return{byName:e,args:r}}controlBlock(t,e,r,s,i,n){switch(t.tag){case"if":{let a=[{when:t.head?this.expr(t.head.expr,t.head.loc):this.missingHead(t),block:this.block(t.children,n)}];for(let o=r+1;o<e.length;o++){let l=e[o];if(l.t!=="element")break;if(l.tag==="else-if")a.push({when:l.head?this.expr(l.head.expr,l.head.loc):this.missingHead(l),block:this.block(l.children,n)});else if(l.tag==="else"){a.push({when:null,block:this.block(l.children,n)});break}else break}i.blocks.push({t:"if",p:s,branches:a});break}case"else-if":case"else":this.report("LIPS-C001","error",`<${t.tag}> without a preceding <if>`,t.loc.offset,t.loc.length);break;case"for":{let{byName:a,args:o}=this.attrsOf(t),l=a.get("in"),p=a.get("from"),b=a.get("to"),y=a.get("by");if(!l&&!p){this.report("LIPS-C004","error","<for> requires 'in' or 'from'/'to'",t.loc.offset,t.loc.length);break}let E={t:"for",p:s,args:o,block:this.block(t.children,[...n,...o])};if(l){let d=this.valueOf(l);d===void 0?this.report("LIPS-C004","error","<for in=…> takes an expression: in=state.items",l.loc.offset,l.loc.length):E.of=this.expr(d,l.loc)}if(p)E.from=this.numInput(p);if(b)E.to=this.numInput(b);if(y){let d=y.k==="literal"?void 0:this.valueOf(y);y.k==="literal"?E.by={lit:y.value}:d===void 0?this.report("LIPS-C004","error","<for by=…> takes a key path or an expression",y.loc.offset,y.loc.length):E.by={e:this.expr(d,y.loc)}}i.blocks.push(E);break}case"switch":{let a=t.head?this.expr(t.head.expr,t.head.loc):this.missingHead(t),o=[];for(let l of t.children){if(l.t!=="element")continue;if(l.tag==="case"){let{byName:p}=this.attrsOf(l),b=p.get("is");if(!b||b.k!=="literal"&&b.k!=="expr"){this.report("LIPS-C004","error","<case> requires an 'is' attribute",l.loc.offset,l.loc.length);continue}o.push({is:b.k==="literal"?{lit:b.value}:{e:this.expr(b.source,b.loc)},block:this.block(l.children,n)})}else if(l.tag==="default")o.push({is:null,block:this.block(l.children,n)});else this.report("LIPS-C003","error","Only <case>/<default> are valid inside <switch>",l.loc.offset,l.loc.length)}i.blocks.push({t:"switch",p:s,on:a,cases:o});break}case"async":{let a=t.attrs.find((l)=>l.k==="fn"&&l.name==="await");if(!a){this.report("LIPS-C004","error","<async> requires await(…)",t.loc.offset,t.loc.length);break}let o={t:"async",p:s,awaitE:this.expr(a.source,a.loc)};for(let l of t.children){if(l.t!=="element")continue;let{args:p}=this.attrsOf(l);if(l.tag==="then")o.then={args:p,block:this.block(l.children,[...n,...p])};else if(l.tag==="catch")o.catch={args:p,block:this.block(l.children,[...n,...p])};else if(l.tag==="loading")o.loading=this.block(l.children,n);else this.report("LIPS-C003","error","Only <then>/<catch>/<loading> are valid inside <async>",l.loc.offset,l.loc.length)}i.blocks.push(o);break}case"let":case"const":{let a={};for(let o of t.attrs){if(o.k==="spread"){this.report("LIPS-C013","error",`Spread is not supported on <${t.tag}> — scope names must be known at compile time`,o.loc.offset,o.loc.length,`Assign it to one variable: <${t.tag} obj={ ${o.source} }/> and read obj.<key>`);continue}if(o.k==="literal"||o.k==="expr"||o.k==="interp"||o.k==="bool")a[o.name]=this.compInput(o),!i.scope.includes(o.name)&&i.scope.push(o.name),!n.includes(o.name)&&n.push(o.name)}i.blocks.push({t:"let",p:s,const:t.tag==="const",vars:a});break}case"log":i.blocks.push({t:"log",p:s,e:t.head?this.synth(t.head.expr):this.missingHead(t)});break;case"context":{let a={};for(let o of t.attrs){if(o.k==="spread"){this.report("LIPS-C016","error","Spread is not supported on <context> — provided keys must be known at compile time",o.loc.offset,o.loc.length,"Provide them one by one: <context a=obj.a b=obj.b>");continue}if(o.k==="literal"||o.k==="expr"||o.k==="interp"||o.k==="bool")a[o.name]=this.compInput(o)}if(!Object.keys(a).length)this.report("LIPS-C017","warning","<context> provides nothing — it renders its children unchanged",t.loc.offset,t.loc.length);i.blocks.push({t:"provide",p:s,vars:a,block:this.block(t.children,n)});break}case"i18n":{let{byName:a}=this.attrsOf(t),o=a.get("lang");if(!o){this.report("LIPS-C018","error","<i18n> requires a 'lang' attribute: <i18n lang=state.docLang>",t.loc.offset,t.loc.length);break}i.blocks.push({t:"provide",p:s,vars:{},lang:this.compInput(o),block:this.block(t.children,n)});break}}}missingHead(t){return this.report("LIPS-C004","error",`<${t.tag}> requires a head expression: <${t.tag}( … )>`,t.loc.offset,t.loc.length),this.synth("undefined")}numInput(t){if(t.k==="literal")return{lit:nt(t.value)?Number(t.value):t.value};let e=this.valueOf(t);if(e!==void 0)return nt(e)?{lit:Number(e)}:{e:this.expr(e,t.loc)};return"name"in t&&this.report("LIPS-C004","error",`<for ${t.name}=…> takes a number or an expression`,t.loc.offset,t.loc.length),{lit:void 0}}valueOf(t){if(t.k==="expr")return t.source;if(t.k==="interp"&&t.parts.length===1&&typeof t.parts[0]!=="string")return t.parts[0].expr}macroCall(t,e,r){let s=this.macros.get(t.tag);if(this.macroStack.includes(s.name))return this.report("LIPS-C009","error",`Recursive macro <${s.name}> (${[...this.macroStack,s.name].join(" → ")})`,t.loc.offset,t.loc.length),null;let i=[];for(let a of t.attrs)if(a.k==="literal"||a.k==="expr"||a.k==="interp"||a.k==="bool")i.push({name:a.name,ci:this.compInput(a)});else if(a.k==="spread")i.push({spread:this.expr(a.source,a.loc)});else if(a.k==="event")this.report("LIPS-C023","error",`on-${a.name}( … ) on the macro <${t.tag}> wires no listener`,a.loc.offset,a.loc.length,"Pass the handler as an argument (fn=self.pick) and wire it in the body");t.children.length&&this.report("LIPS-C024","error",`<${t.tag}> is a macro: what it encloses is not rendered`,t.loc.offset,t.loc.length,"A component takes content: <{input.renderer}/>"),this.macroStack.push(s.name);let n=this.block(s.children,[...r,...s.argv]);return this.macroStack.pop(),{t:"macro",p:e,name:s.name,sets:i,args:s.argv,block:n}}quotedEvent(t,e){if(!("name"in e)||!e.name.startsWith("on-"))return!1;return this.report("LIPS-C020","error",`${e.name}="…" on <${t}> wires no listener`,e.loc.offset,e.loc.length,`Handlers use the instruction form: ${e.name}( … ). `+"Quoted, it is an ordinary attribute — the handler never runs and the source is emitted into the DOM."),!0}modifiers(t,e){let r=t.name.split(".").slice(1),s=r.find((i)=>!wt.has(i));(s||e&&r[0])&&this.report("LIPS-C022",s?"error":"warning",s?`Unknown event modifier .${s}: use .stop, .capture or .outside`:`.${r[0]} does nothing on a component's event`,t.loc.offset,t.loc.length)}compLike(t,e,r,s){let i={},n=[],a=[],o=[];for(let p of t.attrs){if(p.k!=="event"&&this.quotedEvent(t.tag,p))continue;switch(p.k){case"literal":case"bool":case"expr":case"interp":if(p.name==="@format"&&p.k!=="bool"){let{ref:b,e:y}=this.formatBind(e,p);i[p.name]={lit:{ref:b,e:y}};break}i[p.name]=this.compInput(p);break;case"event":this.modifiers(p,s==="comp"),a.push({name:p.name,e:this.synth(p.source)});break;case"spread":n.push(this.expr(p.source,p.loc));break;case"args":o=[...o,...p.names];break;case"fn":i[p.name]={e:this.expr(p.source,p.loc)};break}}let l=t.children.length?{args:o,block:this.block(t.children,[...r,...o])}:void 0;return s==="comp"?{t:"comp",p:e,name:t.tag,inputs:i,spreads:n,events:a,contents:l}:{t:"dynamic",p:e,tag:this.expr(t.dynamicTag.expr,t.dynamicTag.loc),inputs:i,spreads:n,events:a,contents:l}}}function Tt(t,e,r){let s=new Map;if(!t?.trim())return s;let i=W(t);e.push(...i.diagnostics),r?.(i.root.children,e,t);for(let n of i.root.children){if(n.t!=="element")continue;if(n.tag!=="macro"){e.push({code:"LIPS-C010",severity:"warning",message:`Only <macro> definitions are allowed in the macros source — ignoring <${n.tag}>`,loc:{line:1,col:1,offset:n.loc.offset,length:n.loc.length}});continue}let a="",o=[];for(let l of n.attrs)if(l.k==="args")o.push(...l.names);else if(l.k==="literal"&&l.name==="name")a=l.value;if(!a){e.push({code:"LIPS-C011",severity:"error",message:"<macro> requires a name attribute",loc:{line:1,col:1,offset:n.loc.offset,length:n.loc.length}});continue}s.set(a.toLowerCase(),{name:a,argv:o,children:n.children})}return s}function F(t,e){let r=[],s=Tt(e?.macros||"",r,e?.check),i=W(t);e?.check?.(i.root.children,r,t),e?.transform?.(i.root.children,r);let n=new at(t,s,e?.target==="tree");return{ir:n.compile(i.root.children),diagnostics:[...r,...i.diagnostics,...n.diagnostics]}}var At=null;var Ot=/^[-\w]+$/,ut=/^(%|[a-zA-Z]+)/,lt=["<number>","0"];function M(t,e){let r=t[e];e++;while(e<t.length){if(t[e]==="\\"){e+=2;continue}if(t[e]===r)return e+1;e++}return e}function ft(t,e){let r=t.indexOf("*/",e+2);return r<0?t.length:r+2}function _t(t,e){let r=t.indexOf(`
9
+ `,e+2);return r<0?t.length:r}var jt=(t)=>t.replace(/["\\]/g,"\\$&");function D(t,e,r){let s=1,i=-1;for(let n=0;n<e;n++)if(t[n]===`
10
+ `)s++,i=n;return{line:s,col:e-i,offset:e,length:r}}function G(t,e){let r=e+1,s=0,i=!1,n=!1;while(r<t.length){let o=t[r];if(o==='"'||o==="'"){r=M(t,r);continue}if(o==="{"||o===";")return null;if(o==="}")break;if(o==="("||o==="[")s++;else if(o===")"||o==="]")s--;else if(s===0){if(o==="?")i=!0;else if(o===":"&&!i)n=!0}r++}if(r>=t.length||n)return null;let a=t.slice(e+1,r).trim();return a?{end:r,expr:a}:null}var Bt=new Set(["state","input","static","context","self"]);function Dt(t,e,r,s){let i=[],n=e,a=e,o=0;while(n<t.length){let l=t[n];if(l==='"'||l==="'"){n=M(t,n);continue}if(l==="/"&&t[n+1]==="*"){let p=ft(t,n);if(!r)i.push(t.slice(a,n)," "),a=p;n=p;continue}if(l==="("){o++,n++;continue}if(l===")"){o--,n++;continue}if(o===0&&(l===";"||l==="}"))return i.push(t.slice(a,n)),{end:n,parts:i};if(l==="{"){let p=G(t,n);if(!p)return t.indexOf("}",n+1)<0&&s?.(n),null;i.push(t.slice(a,n));let b=ut.exec(t.slice(p.end+1)),y=b?b[1]:"";i.push({expr:p.expr,unit:y,at:n}),n=p.end+1+y.length,a=n;continue}n++}return i.some((l)=>typeof l!=="string")&&s?.(e),null}var Mt=/^@(-\w+-)?(keyframes|font-face|property|counter-style|font-feature-values|font-palette-values|page|view-transition|position-try|color-profile|function)\b/i,ct=/^@(import|charset|namespace)\b/i,qt=/^@(media|supports|container|layer|scope|starting-style|document)\b/i,Ut=/^([a-zA-Z_*\\]|[^\x00-\x7f])/,Wt=/^(?:[-\w*|]|[^\x00-\x7f]|\\[\s\S])+/,Ht=/&[-_]/,gt=/\s/,pt=/[{};]/,ht=/[-\w]/,mt=/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'/g,Ft=new RegExp(`(${mt.source})|\\s+`,"g"),Gt=/\/\*[\s\S]*?\*\//g,Vt=/^@layer\b/i,zt=(t)=>t.replace(Ft,(e,r)=>r||" ");function Zt(t){let e=[],r=0,s=0;for(let i=0;i<t.length;i++){let n=t[i];if(n==="\\"){i++;continue}if(n==='"'||n==="'"){i=M(t,i)-1;continue}if(n==="("||n==="[")s++;else if(n===")"||n==="]")s--;else if(n===","&&!s)e.push(t.slice(r,i)),r=i+1}return e.push(t.slice(r)),e.map((i)=>{let n=i.trimStart(),a=n.length;while(a&&gt.test(n[a-1])&&n[a-2]!=="\\")a--;if(n=n.slice(0,a),!Ut.test(n))return n;return n.includes("&")?n.replace(Wt,":is($&)"):`& ${n}`}).join(",")}function Jt(t,e,r,s){let i=[],n=[],a=[],o=`--${e.nsp.replace(/[^a-zA-Z0-9_-]/g,"-")}`,l=(h,v,g,S,P)=>s.push({code:h,severity:"error",message:v,hint:P,loc:D(t,g,S)}),p=(h,v,g,S,P)=>s.push({code:h,severity:"warning",message:v,hint:P,loc:D(t,g,S)}),b=(h,v,g,S)=>e.lint?.(h,S)?.forEach((P)=>s.push({...P,loc:D(t,v,g-v)})),y=(h)=>{let v=i.indexOf(h);if(v<0)v=i.push(h)-1;return v},E=(h)=>{let{ast:v,diagnostics:g}=_(h.expr),S=h.expr.length+2;if(g.length){l("LIPS-S004",`Invalid expression: ${g[0].message}`,h.at,S);return}for(let P of et(v))if(!Bt.has(P)&&!(P in globalThis))l("LIPS-S003",`'${P}' is not readable from a stylesheet`,h.at,S,"Stylesheets see state, input, static, context and self — not <for> iterators or <let> names, "+"which are local to a template position.");h.unit&&v.t==="lit"&&typeof v.v==="string"&&p("LIPS-S005",`Unit '${h.unit}' after a string value`,h.at,S,`A unit suffix multiplies a number: drop the unit, or return ${h.unit==="%"?"50":"8"} instead of a string.`)},d="",k="",I="",m=!1,u=(h)=>{if(!h)return;if(m&&I&&!pt.test(I)&&!pt.test(h[0]))k+=" ";m=!1,k+=h,I=h[h.length-1]},R=(h)=>{d+=k+h,k="",I=h,m=!1},w=()=>{let h=k;return k=I="",m=!1,h},j=(h)=>":"+(zt(h).trim()||" "),f=0,c=0,x=0,L="",O="",z="",Z=!1,N=[{ctx:e.meta?"top":"style"}],bt=()=>{let h=N[N.length-1],v=k,g;if(h.ctx==="opaque"||b(v,x,f),v[0]==="@")if(h.ctx!=="opaque"&&Mt.test(v))g={ctx:"opaque",hoist:d.length};else if(qt.test(v))g={ctx:h.ctx,group:v,at:d.length};else g={ctx:"opaque"};else{if(h.ctx==="style"){if(r)Ht.test(v.replace(mt,""))&&p("LIPS-S008",`'${v}' joins '&' to a name`,x,f-x,"Native nesting cannot: write the full selector, or use stylisPreprocessor."),k=Zt(v)}g={ctx:h.ctx==="opaque"?"opaque":"style"}}N.push(g),R("{"),g.group&&(g.body=d.length)},J=()=>{let h=N.pop();if(h.group&&!k&&d.length===h.body&&!Vt.test(h.group)){d=d.slice(0,h.at),I="",m=!1;return}if(R("}"),h.hoist===void 0)return;let v=d.slice(h.hoist),g=N.filter((T)=>T.group),S=g.map((T)=>T.group).join("{"),P="}".repeat(g.length);d=d.slice(0,h.hoist),I="",O=S&&S===z?O.slice(0,O.length-P.length)+v+P:O+g.map((T)=>T.group+"{").join("")+v+P,z=S};while(f<t.length){let h=t[f];if(h==="\\"){u(t.slice(f,f+2)),f+=2;continue}let v=h==="/"&&!t.slice(x,f).trim();if(h==="/"&&(t[f+1]==="*"||t[f+1]==="/"&&v)){let g=t[f+1]==="/",S=g?_t(t,f):ft(t,f);if(!g&&!r)k?u(t.slice(f,S)):d+=t.slice(f,S);else ht.test(I)&&ht.test(t[S]||"")&&(m=!0);v&&(x=S),f=S;continue}if(h==='"'||h==="'"){let g=M(t,f);u(t.slice(f,g)),f=g;continue}if(gt.test(h)){x===f&&x++,m=!0,f++;continue}if(h==="(")c++;else if(h===")")c--;if(h===":"&&c===0){let g=t.slice(x,f).replace(Gt,"").trim();if(Ot.test(g)){let S=Dt(t,f+1,!r,(P)=>{Z=!0,l("LIPS-S004","Unterminated interpolation",P,t.length-P,"Close the expression with `}`.")});if(S){let P=S.parts.filter((C)=>typeof C!=="string");for(let C of P)E(C);if(m=!1,g.startsWith("--")&&P.length===1&&!P[0].unit&&S.parts.every((C)=>typeof C!=="string"||!C.trim())){n.push({prop:g,e:y(P[0].expr)}),w(),f=S.end+(t[S.end]===";"?1:0),x=f;continue}let B="";for(let C of S.parts){if(typeof C==="string"){B+=C;continue}let K=y(C.expr),A=`${o}-${K}`;if(!n.some((q)=>q.prop===A)){if(n.push({prop:A,e:K}),C.unit&&!a.some((q)=>q.name===A))a.push({name:A,syntax:lt[0],inherits:!0,initial:lt[1]})}B+=C.unit?`calc(var(${A}) * 1${C.unit})`:`var(${A})`}b(g,x,S.end,B),u(j(B)),f=S.end;continue}}}if(h==="{"){if(c>0){let g=G(t,f);if(g){l("LIPS-S002","Interpolation in an at-rule condition",f,g.end-f+1,"Media and container conditions cannot read custom properties. Keep the condition static.");let S=ut.exec(t.slice(g.end+1));f=g.end+1+(S?S[1].length:0);continue}}if(!t.slice(x,f).trim()){let g=G(t,f);if(g){l("LIPS-S001","Interpolation in a selector",f,g.end-f+1,"Selectors are static in Layer 1. Bind a value inside the rule instead."),f=g.end+1,x=f;continue}}bt(),x=++f;continue}if(h==="}"){if(N.length>1)J();else p("LIPS-S007","Unmatched `}` dropped",f,1),k&&R(";");x=++f;continue}if(h===";"){if(k[0]==="@"&&b(k,x,f),N.length===1&&ct.test(k))L+=w()+";";else R(";");x=++f;continue}u(h),f++}if(N.length>1){Z||p("LIPS-S007","Unclosed `{` closed at the end",t.length,0);while(N.length>1)J()}return ct.test(k)&&(L+=w()+";"),R(""),{css:d,statements:L,hoisted:O,exprs:i,binds:n,props:a}}function V(t,e){let r=[],s=e.preprocess||At,{css:i,statements:n,hoisted:a,exprs:o,binds:l,props:p}=Jt(t,e,!s,r),b={v:1,nsp:e.nsp,css:"",exprs:[],binds:[]},y=e.meta||!i?i:`${e.scope||`[rel="${jt(e.nsp)}"]`}{${i}}`,E=a+y,d=e.layer?`@layer ${e.layer}{${E}}`:E,k;try{k=s?s(d):d}catch(u){return r.push({code:"LIPS-S006",severity:"error",message:`Style compilation failed: ${u.message}`,loc:D(t,0,t.length)}),{ir:b,diagnostics:r}}let I=p.map((u)=>`@property ${u.name}{syntax:"${u.syntax}";inherits:${u.inherits};initial-value:${u.initial}}`).join(""),m={v:1,nsp:e.nsp,css:n+I+k,exprs:o,binds:l};if(p.length)m.props=p;return{ir:m,diagnostics:r}}function dt(t){let e=new Map,r=new Map,s=[],i=(n)=>{let a=e.get(n.name);if(a&&a!==n)throw Error(`[lips] two plugins named <${n.name}>: one is compiled already`);if(a)return;e.set(n.name,n),n.requires?.forEach(i);let o=Object.entries(n.components||{});for(let[l,p]of o){if(r.has(l)&&r.get(l)!==p)throw Error(`[lips] <${l}> of plugin <${n.name}> is compiled already, from something else`);r.set(l,p)}s.push({plugin:n,components:o})};return t.forEach(i),s}function Kt(t,e={}){let r={macros:t.macros,target:e.target},{ir:s,diagnostics:i}=F(t.default||"",r),{default:n,macros:a,stylesheet:o,...l}=t;if(!o)return{template:{...l,ir:s},diagnostics:i};let p=V(o,{nsp:e.name||"lips",preprocess:e.preprocess});return{template:{...l,ir:s,style:p.ir},diagnostics:[...i,...p.diagnostics]}}function ge(t,e={}){let r={components:{},diagnostics:{}};for(let{components:s}of dt(t))for(let[i,n]of s){if(n.ir){r.components[i]=n.style?{ir:n.ir,style:n.style}:{ir:n.ir},r.diagnostics[i]=[];continue}let{template:a,diagnostics:o}=Kt(n,{...e,name:i});r.components[i]=a.style?{ir:a.ir,style:a.style}:{ir:a.ir},r.diagnostics[i]=o}return r}var Yt=(t)=>JSON.stringify(t),Qt=(t)=>JSON.stringify(t);function me(t={}){let e=t.include||/\.lips$/,r=t.reportDiagnostics!==!1;return{name:"lips:precompile",enforce:"pre",async transform(s,i){if(!e.test(i))return null;await Promise.resolve().then(() => H());let{script:a}=X(s),o=s.slice(a.length),l=/\bconst\s+macros\s*=\s*`([^`]*)`/.exec(a)?.[1];if(/\bconst\s+macros\b/.test(a)&&(l===void 0||l.includes("${")))throw Error(`[lips] ${i}: const macros must be a plain template literal — it is inlined at build time`);let{ir:p,diagnostics:b}=F(o,{target:t.target,macros:l});if(r)for(let u of b)this?.warn?.(`[lips] ${u.code} ${u.message} (${i}:${u.loc.line}:${u.loc.col})`);let y=b.filter((u)=>u.severity==="error");if(y.length)throw Error(`[lips] ${i}: ${y[0].message} at line ${y[0].loc.line}:${y[0].loc.col}`);let E=(i.split(/[\\/]/).pop()||"lips").replace(/\.lips$/,""),d=/\bconst\s+stylesheet\s*=\s*`([^`]*)`/.exec(a),k=/\bconst\s+stylesheet\b/.test(a),I=d&&!d[1].includes("${"),m="";if(I){let u=V(d[1],{nsp:E,preprocess:t.preprocess});if(r)for(let w of u.diagnostics)this?.warn?.(`[lips] ${w.code} ${w.message} (${i}:${w.loc.line}:${w.loc.col})`);let R=u.diagnostics.filter((w)=>w.severity==="error");if(R.length)throw Error(`[lips] ${i}: ${R[0].message} at line ${R[0].loc.line}:${R[0].loc.col}`);m=` style: ${Qt(u.ir)},
11
+ `}else if(k&&r)this?.warn?.(`[lips] ${i}: stylesheet could not be precompiled (interpolated template literal) — `+'it ships as source and needs "@lipsjs/lips", not "@lipsjs/lips/runtime".');return{code:`${a}
12
+ const __lips_ir__ = ${Yt(p)};
13
13
  export default {
14
14
  ir: __lips_ir__,
15
15
  ${m} ${/\bconst\s+state\b/.test(a)?"state,":""}
16
16
  ${/\bconst\s+handler\b/.test(a)?"handler,":""}
17
17
  ${/\bconst\s+_static\b/.test(a)?"_static,":""}
18
18
  ${/\bconst\s+watchContext\b/.test(a)?"watchContext,":""}
19
- ${y&&!I?"stylesheet,":""}
19
+ ${k&&!I?"stylesheet,":""}
20
20
  };
21
- `,map:null}}}}export{he as lipsPlugin,pe as precompile,Jt as serializeIR,Kt as serializeStyleIR};
21
+ `,map:null}}}}export{me as lipsPlugin,Kt as precompile,ge as precompilePlugins,Yt as serializeIR,Qt as serializeStyleIR};
22
22
 
23
- //# debugId=14B7246B84A3AC2564756E2164756E21
23
+ //# debugId=8622CCC9EF7F13D464756E2164756E21