@tempo-ai/mcp 0.0.142 → 0.0.144-staging.1

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.
@@ -0,0 +1,224 @@
1
+ exports.tempoRuntimeContract=1;exports.createRuntime=function(__tempoRuntime){const require=__tempoRuntime.require;const module={exports:{}};const exports=module.exports;
2
+ var Ui=Object.create;var lt=Object.defineProperty;var Vi=Object.getOwnPropertyDescriptor;var Wi=Object.getOwnPropertyNames;var Bi=Object.getPrototypeOf,Ji=Object.prototype.hasOwnProperty;var c=(t,e)=>lt(t,"name",{value:e,configurable:!0});var O=(t,e)=>()=>(t&&(e=t(t=0)),e);var Be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Pt=(t,e)=>{for(var r in e)lt(t,r,{get:e[r],enumerable:!0})},an=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Wi(e))!Ji.call(t,o)&&o!==r&&lt(t,o,{get:()=>e[o],enumerable:!(n=Vi(e,o))||n.enumerable});return t};var dr=(t,e,r)=>(r=t!=null?Ui(Bi(t)):{},an(e||!t||!t.__esModule?lt(r,"default",{value:t,enumerable:!0}):r,t)),fr=t=>an(lt({},"__esModule",{value:!0}),t);function ke(t){let e=5381,r=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);e=(e<<5)+e^o,r=o+(r<<6)+(r<<16)-r|0}return ln(e)+ln(r)}function ln(t){return(t>>>0).toString(16).padStart(8,"0")}var Je=O(()=>{"use strict";c(ke,"sourceVersionHash");c(ln,"toHex8")});function Ie(t){let e=t;for(;["ParenthesizedExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression","TSInstantiationExpression"].includes(e.type);){let r=e.expression;if(!r)break;e=r}return e}function Te(t){let e=Ie(t);if(["Literal","StringLiteral","NumericLiteral","BooleanLiteral"].includes(e.type)&&(typeof e.value=="string"||typeof e.value=="boolean"||typeof e.value=="number"&&Number.isFinite(e.value)))return e.value;if(e.type==="TemplateLiteral"){let r=e.expressions,n=e.quasis;if(r.length===0&&n.length===1&&typeof n[0]?.value.cooked=="string")return n[0].value.cooked}if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let r=Te(e.argument);if(typeof r=="number")return e.operator==="-"?-r:r}if(e.type==="BinaryExpression"&&["+","-","*","/"].includes(e.operator)){let r=Te(e.left),n=Te(e.right);if(typeof r!="number"||typeof n!="number")return null;let o=e.operator==="+"?r+n:e.operator==="-"?r-n:e.operator==="*"?r*n:r/n;return Number.isFinite(o)?o:null}return null}function mr(t){if(t.type!=="JSXExpressionContainer")return null;let e=Ie(t.expression);return e.type==="JSXElement"?e:null}function ct(t,e=!1){if(!e&&t.type==="Identifier")return typeof t.name=="string"?t.name:null;let r=Te(t);return typeof r=="string"||typeof r=="number"?String(r):null}var Nt=O(()=>{"use strict";c(Ie,"unwrapLiteralExpression");c(Te,"readLiteralExpression");c(mr,"literalJsxChild");c(ct,"literalPropertyName")});function un(t,e,r=!1){let o=t.openingElement.attributes,i=[];!r&&e!=="JSXElement"&&e!=="JSXFragment"&&i.push(Ki);let s=new Map;o.forEach((l,u)=>{let p=Gi(l);p!==null&&s.set(p,u)});let a=-1;o.forEach((l,u)=>{l.type==="JSXSpreadAttribute"&&(a=u)});for(let[l,u]of s){if(Xi(l))continue;let p=u<a,d=o[u].value;if(d!==null){if(l==="style"&&!p){i.push(...zi(d));continue}if(p)i.push(l);else{if(l==="className"&&Qi(d))continue;qi(d)||i.push(l)}}}return i.length>0?i.join(" "):a>=0?"":void 0}function Gi(t){if(t.type!=="JSXAttribute")return null;let e=t.name;return e.type==="JSXIdentifier"?e.name:e.type==="JSXNamespacedName"?`${e.namespace.name}:${e.name.name}`:null}function Xi(t){return t==="key"||t.startsWith("data-tempo-")}function zi(t){let e=t.type==="JSXExpressionContainer"?Zi(t.expression):t;if(e.type!=="ObjectExpression")return["style"];let r=e.properties,n=new Map;r.forEach((i,s)=>{let a=cn(i);a!==null&&n.set(a,s)});let o=[];for(let[i,s]of n){let a=r[s],l=r.slice(s+1).some(p=>p.type==="SpreadElement"||p.computed&&cn(p)===null),u=a.type!=="ObjectMethod"&&!a.shorthand&&pn(a.value);(l||!u)&&o.push(`style.${i}`)}return o}function cn(t){return t.type==="Property"||t.type==="ObjectProperty"||t.type==="ObjectMethod"?ct(t.key,!!t.computed):null}function qi(t){return t.type==="Literal"||t.type==="StringLiteral"?!0:t.type!=="JSXExpressionContainer"?!1:pn(t.expression)}function Qi(t){if(t.type!=="JSXExpressionContainer")return!1;let e=t.expression;if(e.type!=="CallExpression")return!1;let r=e.callee;return r.type!=="Identifier"||!Yi.has(r.name)?!1:e.arguments.every(n=>(n.type==="Literal"||n.type==="StringLiteral")&&typeof n.value=="string"||n.type==="TemplateLiteral"&&n.expressions.length===0)}function pn(t){return Te(t)!==null}function Zi(t){return Ie(t)}var gr,Ki,Yi,Mt=O(()=>{"use strict";Nt();Nt();gr="data-tempo-expr",Ki="#slot";c(un,"expressionFacts");c(Gi,"attributeName");c(Xi,"unstamped");c(zi,"styleFacts");c(cn,"styleKey");c(qi,"isLiteralValue");Yi=new Set(["cn","clsx","twMerge","cx","classNames"]);c(Qi,"isClassHelperCall");c(pn,"isLiteral");c(Zi,"unwrap")});function ut(t,e,r){let n=e-r;n=n<0?-n<<1|1:n<<1;do{let o=n&31;n>>>=5,n>0&&(o|=32),t.write(gn[o])}while(n>0);return e}function hn(t){let e=new na,r=0,n=0,o=0,i=0;for(let s=0;s<t.length;s++){let a=t[s];if(s>0&&e.write(ta),a.length===0)continue;let l=0;for(let u=0;u<a.length;u++){let p=a[u];u>0&&e.write(ea),l=ut(e,p[0],l),p.length!==1&&(r=ut(e,p[1],r),n=ut(e,p[2],n),o=ut(e,p[3],o),p.length!==4&&(i=ut(e,p[4],i)))}}return e.flush()}var ea,ta,dn,gn,ra,fn,mn,na,yn=O(()=>{ea=44,ta=59,dn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=new Uint8Array(64),ra=new Uint8Array(128);for(let t=0;t<dn.length;t++){let e=dn.charCodeAt(t);gn[t]=e,ra[e]=t}c(ut,"encodeInteger");fn=1024*16,mn=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(t){return Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString()}}:{decode(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e}},na=class{static{c(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(fn)}write(t){let{buffer:e}=this;e[this.pos++]=t,this.pos===fn&&(this.out+=mn.decode(e),this.pos=0)}flush(){let{buffer:t,out:e,pos:r}=this;return r>0?e+mn.decode(t.subarray(0,r)):e}};c(hn,"encode")});function oa(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?t=>globalThis.btoa(unescape(encodeURIComponent(t))):typeof Buffer=="function"?t=>Buffer.from(t,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}function ia(t){let e=t.split(`
3
+ `),r=e.filter(i=>/^\t+/.test(i)),n=e.filter(i=>/^ {2,}/.test(i));if(r.length===0&&n.length===0)return null;if(r.length>=n.length)return" ";let o=n.reduce((i,s)=>{let a=/^ +/.exec(s)[0].length;return Math.min(a,i)},1/0);return new Array(o+1).join(" ")}function aa(t,e){let r=t.split(/[/\\]/),n=e.split(/[/\\]/);for(r.pop();r[0]===n[0];)r.shift(),n.shift();if(r.length){let o=r.length;for(;o--;)r[o]=".."}return r.concat(n).join("/")}function ca(t){return la.call(t)==="[object Object]"}function Sn(t){let e=t.split(`
4
+ `),r=[];for(let n=0,o=0;n<e.length;n++)r.push(o),o+=e[n].length+1;return c(function(o){let i=0,s=r.length;for(;i<s;){let u=i+s>>1;o<r[u]?s=u:i=u+1}let a=i-1,l=o-r[a];return{line:a,column:l}},"locate")}var Ot,$t,sa,hr,la,ua,yr,pt,Ke,He,Sr=O(()=>{yn();Ot=class t{static{c(this,"BitSet")}constructor(e){this.bits=e instanceof t?e.bits.slice():[]}add(e){this.bits[e>>5]|=1<<(e&31)}has(e){return!!(this.bits[e>>5]&1<<(e&31))}},$t=class t{static{c(this,"Chunk")}constructor(e,r,n){this.start=e,this.end=r,this.original=n,this.intro="",this.outro="",this.content=n,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(e){this.outro+=e}appendRight(e){this.intro=this.intro+e}clone(){let e=new t(this.start,this.end,this.original);return e.intro=this.intro,e.outro=this.outro,e.content=this.content,e.storeName=this.storeName,e.edited=this.edited,e}contains(e){return this.start<e&&e<this.end}eachNext(e){let r=this;for(;r;)e(r),r=r.next}eachPrevious(e){let r=this;for(;r;)e(r),r=r.previous}edit(e,r,n){return this.content=e,n||(this.intro="",this.outro=""),this.storeName=r,this.edited=!0,this}prependLeft(e){this.outro=e+this.outro}prependRight(e){this.intro=e+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(e){let r=e-this.start,n=this.original.slice(0,r),o=this.original.slice(r);this.original=n;let i=new t(e,this.end,o);return i.outro=this.outro,this.outro="",this.end=e,this.edited?(i.edit("",!1),this.content=""):this.content=n,i.next=this.next,i.next&&(i.next.previous=i),i.previous=this,this.next=i,i}toString(){return this.intro+this.content+this.outro}trimEnd(e){if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;let r=this.content.replace(e,"");if(r.length)return r!==this.content&&(this.split(this.start+r.length).edit("",void 0,!0),this.edited&&this.edit(r,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(e,""),this.intro.length)return!0}trimStart(e){if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;let r=this.content.replace(e,"");if(r.length){if(r!==this.content){let n=this.split(this.end-r.length);this.edited&&n.edit(r,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(e,""),this.outro.length)return!0}};c(oa,"getBtoa");sa=oa(),hr=class{static{c(this,"SourceMap")}constructor(e){this.version=3,this.file=e.file,this.sources=e.sources,this.sourcesContent=e.sourcesContent,this.names=e.names,this.mappings=hn(e.mappings),typeof e.x_google_ignoreList<"u"&&(this.x_google_ignoreList=e.x_google_ignoreList),typeof e.debugId<"u"&&(this.debugId=e.debugId)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+sa(this.toString())}};c(ia,"guessIndent");c(aa,"getRelativePath");la=Object.prototype.toString;c(ca,"isObject");c(Sn,"getLocator");ua=/\w/,yr=class{static{c(this,"Mappings")}constructor(e){this.hires=e,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(e,r,n,o){if(r.length){let i=r.length-1,s=r.indexOf(`
5
+ `,0),a=-1;for(;s>=0&&i>s;){let u=[this.generatedCodeColumn,e,n.line,n.column];o>=0&&u.push(o),this.rawSegments.push(u),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=s,s=r.indexOf(`
6
+ `,s+1)}let l=[this.generatedCodeColumn,e,n.line,n.column];o>=0&&l.push(o),this.rawSegments.push(l),this.advance(r.slice(a+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(r));this.pending=null}addUneditedChunk(e,r,n,o,i){let s=r.start,a=!0,l=!1;for(;s<r.end;){if(n[s]===`
7
+ `)o.line+=1,o.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=!0,l=!1;else{if(this.hires||a||i.has(s)){let u=[this.generatedCodeColumn,e,o.line,o.column];this.hires==="boundary"?ua.test(n[s])?l||(this.rawSegments.push(u),l=!0):(this.rawSegments.push(u),l=!1):this.rawSegments.push(u)}o.column+=1,this.generatedCodeColumn+=1,a=!1}s+=1}this.pending=null}advance(e){if(!e)return;let r=e.split(`
8
+ `);if(r.length>1){for(let n=0;n<r.length-1;n++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=r[r.length-1].length}},pt=`
9
+ `,Ke={insertLeft:!1,insertRight:!1,storeName:!1},He=class t{static{c(this,"MagicString")}constructor(e,r={}){let n=new $t(0,e.length,e);Object.defineProperties(this,{original:{writable:!0,value:e},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:n},lastChunk:{writable:!0,value:n},lastSearchedChunk:{writable:!0,value:n},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:r.filename},indentExclusionRanges:{writable:!0,value:r.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new Ot},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:r.ignoreList},offset:{writable:!0,value:r.offset||0}}),this.byStart[0]=n,this.byEnd[e.length]=n}addSourcemapLocation(e){this.sourcemapLocations.add(e)}append(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.outro+=e,this}appendLeft(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byEnd[e];return n?n.appendLeft(r):this.intro+=r,this}appendRight(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byStart[e];return n?n.appendRight(r):this.outro+=r,this}clone(){let e=new t(this.original,{filename:this.filename,offset:this.offset}),r=this.firstChunk,n=e.firstChunk=e.lastSearchedChunk=r.clone();for(;r;){e.byStart[n.start]=n,e.byEnd[n.end]=n;let o=r.next,i=o&&o.clone();i&&(n.next=i,i.previous=n,n=i),r=o}return e.lastChunk=n,this.indentExclusionRanges&&(e.indentExclusionRanges=this.indentExclusionRanges.slice()),e.sourcemapLocations=new Ot(this.sourcemapLocations),e.intro=this.intro,e.outro=this.outro,e}generateDecodedMap(e){e=e||{};let r=0,n=Object.keys(this.storedNames),o=new yr(e.hires),i=Sn(this.original);return this.intro&&o.advance(this.intro),this.firstChunk.eachNext(s=>{let a=i(s.start);s.intro.length&&o.advance(s.intro),s.edited?o.addEdit(r,s.content,a,s.storeName?n.indexOf(s.original):-1):o.addUneditedChunk(r,s,this.original,a,this.sourcemapLocations),s.outro.length&&o.advance(s.outro)}),this.outro&&o.advance(this.outro),{file:e.file?e.file.split(/[/\\]/).pop():void 0,sources:[e.source?aa(e.file||"",e.source):e.file||""],sourcesContent:e.includeContent?[this.original]:void 0,names:n,mappings:o.raw,x_google_ignoreList:this.ignoreList?[r]:void 0}}generateMap(e){return new hr(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=ia(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(e,r){let n=/^[^\r\n]/gm;if(ca(e)&&(r=e,e=void 0),e===void 0&&(this._ensureindentStr(),e=this.indentStr||" "),e==="")return this;r=r||{};let o={};r.exclude&&(typeof r.exclude[0]=="number"?[r.exclude]:r.exclude).forEach(p=>{for(let d=p[0];d<p[1];d+=1)o[d]=!0});let i=r.indentStart!==!1,s=c(u=>i?`${e}${u}`:(i=!0,u),"replacer");this.intro=this.intro.replace(n,s);let a=0,l=this.firstChunk;for(;l;){let u=l.end;if(l.edited)o[a]||(l.content=l.content.replace(n,s),l.content.length&&(i=l.content[l.content.length-1]===`
10
+ `));else for(a=l.start;a<u;){if(!o[a]){let p=this.original[a];p===`
11
+ `?i=!0:p!=="\r"&&i&&(i=!1,a===l.start||(this._splitChunk(l,a),l=l.next),l.prependRight(e))}a+=1}a=l.end,l=l.next}return this.outro=this.outro.replace(n,s),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(e,r){return Ke.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Ke.insertLeft=!0),this.appendLeft(e,r)}insertRight(e,r){return Ke.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Ke.insertRight=!0),this.prependRight(e,r)}move(e,r,n){if(e=e+this.offset,r=r+this.offset,n=n+this.offset,n>=e&&n<=r)throw new Error("Cannot move a selection inside itself");this._split(e),this._split(r),this._split(n);let o=this.byStart[e],i=this.byEnd[r],s=o.previous,a=i.next,l=this.byStart[n];if(!l&&i===this.lastChunk)return this;let u=l?l.previous:this.lastChunk;return s&&(s.next=a),a&&(a.previous=s),u&&(u.next=o),l&&(l.previous=i),o.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=o.previous,this.lastChunk.next=null),o.previous=u,i.next=l||null,u||(this.firstChunk=o),l||(this.lastChunk=i),this}overwrite(e,r,n,o){return o=o||{},this.update(e,r,n,{...o,overwrite:!o.contentOnly})}update(e,r,n,o){if(e=e+this.offset,r=r+this.offset,typeof n!="string")throw new TypeError("replacement content must be a string");if(this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(r>this.original.length)throw new Error("end is out of bounds");if(e===r)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(e),this._split(r),o===!0&&(Ke.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Ke.storeName=!0),o={storeName:!0});let i=o!==void 0?o.storeName:!1,s=o!==void 0?o.overwrite:!1;if(i){let u=this.original.slice(e,r);Object.defineProperty(this.storedNames,u,{writable:!0,value:!0,enumerable:!0})}let a=this.byStart[e],l=this.byEnd[r];if(a){let u=a;for(;u!==l;){if(u.next!==this.byStart[u.end])throw new Error("Cannot overwrite across a split point");u=u.next,u.edit("",!1)}a.edit(n,i,!s)}else{let u=new $t(e,r,"").edit(n,i);l.next=u,u.previous=l}return this}prepend(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.intro=e+this.intro,this}prependLeft(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byEnd[e];return n?n.prependLeft(r):this.intro=r+this.intro,this}prependRight(e,r){if(e=e+this.offset,typeof r!="string")throw new TypeError("inserted content must be a string");this._split(e);let n=this.byStart[e];return n?n.prependRight(r):this.outro=r+this.outro,this}remove(e,r){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(e===r)return this;if(e<0||r>this.original.length)throw new Error("Character is out of bounds");if(e>r)throw new Error("end must be greater than start");this._split(e),this._split(r);let n=this.byStart[e];for(;n;)n.intro="",n.outro="",n.edit(""),n=r>n.end?this.byStart[n.end]:null;return this}reset(e,r){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}if(e===r)return this;if(e<0||r>this.original.length)throw new Error("Character is out of bounds");if(e>r)throw new Error("end must be greater than start");this._split(e),this._split(r);let n=this.byStart[e];for(;n;)n.reset(),n=r>n.end?this.byStart[n.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let e=this.lastChunk;do{if(e.outro.length)return e.outro[e.outro.length-1];if(e.content.length)return e.content[e.content.length-1];if(e.intro.length)return e.intro[e.intro.length-1]}while(e=e.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let e=this.outro.lastIndexOf(pt);if(e!==-1)return this.outro.substr(e+1);let r=this.outro,n=this.lastChunk;do{if(n.outro.length>0){if(e=n.outro.lastIndexOf(pt),e!==-1)return n.outro.substr(e+1)+r;r=n.outro+r}if(n.content.length>0){if(e=n.content.lastIndexOf(pt),e!==-1)return n.content.substr(e+1)+r;r=n.content+r}if(n.intro.length>0){if(e=n.intro.lastIndexOf(pt),e!==-1)return n.intro.substr(e+1)+r;r=n.intro+r}}while(n=n.previous);return e=this.intro.lastIndexOf(pt),e!==-1?this.intro.substr(e+1)+r:this.intro+r}slice(e=0,r=this.original.length-this.offset){if(e=e+this.offset,r=r+this.offset,this.original.length!==0){for(;e<0;)e+=this.original.length;for(;r<0;)r+=this.original.length}let n="",o=this.firstChunk;for(;o&&(o.start>e||o.end<=e);){if(o.start<r&&o.end>=r)return n;o=o.next}if(o&&o.edited&&o.start!==e)throw new Error(`Cannot use replaced character ${e} as slice start anchor.`);let i=o;for(;o;){o.intro&&(i!==o||o.start===e)&&(n+=o.intro);let s=o.start<r&&o.end>=r;if(s&&o.edited&&o.end!==r)throw new Error(`Cannot use replaced character ${r} as slice end anchor.`);let a=i===o?e-o.start:0,l=s?o.content.length+r-o.end:o.content.length;if(n+=o.content.slice(a,l),o.outro&&(!s||o.end===r)&&(n+=o.outro),s)break;o=o.next}return n}snip(e,r){let n=this.clone();return n.remove(0,e),n.remove(r,n.original.length),n}_split(e){if(this.byStart[e]||this.byEnd[e])return;let r=this.lastSearchedChunk,n=r,o=e>r.end;for(;r;){if(r.contains(e))return this._splitChunk(r,e);if(r=o?this.byStart[r.end]:this.byEnd[r.start],r===n)return;n=r}}_splitChunk(e,r){if(e.edited&&e.content.length){let o=Sn(this.original)(r);throw new Error(`Cannot split a chunk that has already been edited (${o.line}:${o.column} \u2013 "${e.original}")`)}let n=e.split(r);return this.byEnd[r]=e,this.byStart[r]=n,this.byEnd[n.end]=n,e===this.lastChunk&&(this.lastChunk=n),this.lastSearchedChunk=e,!0}toString(){let e=this.intro,r=this.firstChunk;for(;r;)e+=r.toString(),r=r.next;return e+this.outro}isEmpty(){let e=this.firstChunk;do if(e.intro.length&&e.intro.trim()||e.content.length&&e.content.trim()||e.outro.length&&e.outro.trim())return!1;while(e=e.next);return!0}length(){let e=this.firstChunk,r=0;do r+=e.intro.length+e.content.length+e.outro.length;while(e=e.next);return r}trimLines(){return this.trim("[\\r\\n]")}trim(e){return this.trimStart(e).trimEnd(e)}trimEndAborted(e){let r=new RegExp((e||"\\s")+"+$");if(this.outro=this.outro.replace(r,""),this.outro.length)return!0;let n=this.lastChunk;do{let o=n.end,i=n.trimEnd(r);if(n.end!==o&&(this.lastChunk===n&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),i)return!0;n=n.previous}while(n);return!1}trimEnd(e){return this.trimEndAborted(e),this}trimStartAborted(e){let r=new RegExp("^"+(e||"\\s")+"+");if(this.intro=this.intro.replace(r,""),this.intro.length)return!0;let n=this.firstChunk;do{let o=n.end,i=n.trimStart(r);if(n.end!==o&&(n===this.lastChunk&&(this.lastChunk=n.next),this.byEnd[n.end]=n,this.byStart[n.next.start]=n.next,this.byEnd[n.next.end]=n.next),i)return!0;n=n.next}while(n);return!1}trimStart(e){return this.trimStartAborted(e),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(e,r){function n(i,s){return typeof r=="string"?r.replace(/\$(\$|&|\d+)/g,(a,l)=>l==="$"?"$":l==="&"?i[0]:+l<i.length?i[+l]:`$${l}`):r(...i,i.index,s,i.groups)}c(n,"getReplacement");function o(i,s){let a,l=[];for(;a=i.exec(s);)l.push(a);return l}if(c(o,"matchAll"),e.global)o(e,this.original).forEach(s=>{if(s.index!=null){let a=n(s,this.original);a!==s[0]&&this.overwrite(s.index,s.index+s[0].length,a)}});else{let i=this.original.match(e);if(i&&i.index!=null){let s=n(i,this.original);s!==i[0]&&this.overwrite(i.index,i.index+i[0].length,s)}}return this}_replaceString(e,r){let{original:n}=this,o=n.indexOf(e);return o!==-1&&(typeof r=="function"&&(r=r(e,o,n)),e!==r&&this.overwrite(o,o+e.length,r)),this}replace(e,r){return typeof e=="string"?this._replaceString(e,r):this._replaceRegexp(e,r)}_replaceAllString(e,r){let{original:n}=this,o=e.length;for(let i=n.indexOf(e);i!==-1;i=n.indexOf(e,i+o)){let s=n.slice(i,i+o),a=r;typeof r=="function"&&(a=r(s,i,n)),s!==a&&this.overwrite(i,i+o,a)}return this}replaceAll(e,r){if(typeof e=="string")return this._replaceAllString(e,r);if(!e.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(e,r)}}});function V(t){if(!t||typeof t!="object")return null;let e=t;return typeof e.type=="string"&&Number.isInteger(e.start)&&Number.isInteger(e.end)?e:null}function oe(t){return Array.isArray(t)?t.flatMap(e=>V(e)??[]):[]}function Ge(t){let e=V(t);return e?typeof e.name=="string"?e.name:e.type==="JSXMemberExpression"?`${Ge(e.object)}.${Ge(e.property)}`:e.type==="JSXNamespacedName"?`${Ge(e.namespace)}:${Ge(e.name)}`:"":""}function xe(t){try{let e=(0,vn.parse)(t),r=e.diagnostics.filter(l=>l.severity==="error");if(r.length)return{kind:"invalid",message:r.map(l=>l.text).join(`
12
+ `)};let n=V(e.ast);if(!n||n.type!=="AstroRoot"||n.end!==t.length)return{kind:"invalid",message:"Unsupported Astro compiler AST or source offset contract"};let o=new Map,i=c((l,u,p)=>{if(l.type==="JSXElement"||l.type==="JSXFragment"){let f=V(l.openingElement??l.openingFragment),g=V(l.closingElement??l.closingFragment),h=V(f.name),y=l.type==="JSXFragment"?"Fragment":Ge(h);if(t[l.start]!=="<"||f.end<=l.start||!y)throw new Error("Astro source range does not address an authored opening tag");let x=y==="Fragment"?"fragment":y==="slot"?"slot":y==="script"?"script":y==="style"?"style":/^[A-Z]/.test(y)||y.includes(".")?"component":"native-element",E=oe(f.attributes).map(C=>({name:C.type==="JSXSpreadAttribute"?null:Ge(C.name),start:C.start,end:C.end,spread:C.type==="JSXSpreadAttribute",value:V(C.value??C.argument)})),w=oe(l.children);o.set(l.start,{kind:x,tagName:y,start:l.start,end:l.end,openingEnd:f.end,nameEnd:h?.end??f.end-1,childrenStart:g?f.end:null,childrenEnd:g?.start??null,selfClosing:f.selfClosing===!0,parentOffset:u,scopes:p,attributes:E,children:w,node:l});for(let C of oe(f.attributes))i(C,l.start,[...p,C.start]);for(let C of w)i(C,l.start,p);return}if(l.type==="JSXText")return;let d=l.type==="JSXExpressionContainer"?[...p,l.start]:p;for(let f of Object.values(l))if(Array.isArray(f))for(let g of oe(f))i(g,u,d);else{let g=V(f);g&&i(g,u,d)}},"visit");for(let l of oe(n.body))i(l,null,[]);let s=V(n.frontmatter),a=V(s?.program);return{kind:"ok",root:n,elements:o,sourceVersion:ke(t),frontmatter:s&&s.end>s.start&&a?{start:s.start,end:s.end,contentStart:a.start,contentEnd:a.end}:null,imports:oe(a?.body).filter(l=>l.type==="ImportDeclaration")}}catch(e){return{kind:"invalid",message:e instanceof Error?e.message:String(e)}}}function we(t){if(!t)return{known:!0,value:!0};if(t.type==="JSXExpressionContainer"){let r=V(t.expression);return r?we(r):{known:!1}}let e=Ie(t);if(e.type==="TemplateLiteral"){let r=Te(e);return typeof r=="string"?{known:!0,value:r}:{known:!1}}if(e.type==="Literal"&&(e.value===null||typeof e.value=="string"||typeof e.value=="boolean"||typeof e.value=="number"&&Number.isFinite(e.value)))return{known:!0,value:e.value};if(e.type==="UnaryExpression"&&(e.operator==="-"||e.operator==="+")){let r=we(V(e.argument));if(r.known&&typeof r.value=="number")return{known:!0,value:e.operator==="-"?-r.value:r.value}}if(e.type==="ArrayExpression"&&Array.isArray(e.elements)){let r=e.elements.map(n=>n?we(V(n)):{known:!1});if(r.every(n=>n.known))return{known:!0,value:r.map(n=>n.value)}}if(e.type==="ObjectExpression"){let r=Object.create(null);for(let n of oe(e.properties)){let o=V(n.key),i=o?.type==="Identifier"?o.name:o?.type==="Literal"?o.value:void 0;if(n.type!=="Property"||n.computed||n.method||n.kind!=="init"||typeof i!="string"&&typeof i!="number")return{known:!1};let s=V(n.value);if(!s)return{known:!1};let a=we(s);if(!a.known)return a;r[i]=a.value}return{known:!0,value:r}}return{known:!1}}var vn,Xe=O(()=>{"use strict";vn=require("@astrojs/compiler-rs");Mt();Je();c(V,"astroNode");c(oe,"astroNodes");c(Ge,"astroName");c(xe,"parseAstroSource");c(we,"readAstroLiteral")});function pa(t){let e=new Map;for(let r of t.attributes){if(r.spread){e.clear();continue}let n=r.name;if(!n||n.includes(":"))continue;let o=we(r.value);o.known?e.set(n,o.value):e.delete(n)}return Object.fromEntries(e)}function da(t){let e=V(t.key);return t.type==="Property"&&e?ct(e,t.computed===!0):null}function fa(t){let e=t.scopes.some(o=>o>(t.parentOffset??-1))?["#slot"]:[];t.attributes.some(o=>["x-text","x-html","set:html","set:text"].includes(o.name??""))&&e.push("children"),t.attributes.some(o=>[":style","x-bind:style"].includes(o.name??""))&&e.push("style");let r=new Map,n=-1;t.attributes.forEach((o,i)=>{o.spread?n=i:o.name&&r.set(o.name,i)});for(let[o,i]of r){if(o.startsWith("data-tempo-"))continue;let s=t.attributes[i],a=s.value?.type==="JSXExpressionContainer"?V(s.value.expression):s.value,l=a&&Ie(a);if(o==="style"&&i>n&&l?.type==="ObjectExpression"){let p=oe(l.properties),d=new Map;for(let f of p){let g=da(f);if(g===null){for(let y of d.keys())d.set(y,!1);continue}let h=f.method||f.kind!=="init"?{known:!1}:we(V(f.value));d.delete(g),d.set(g,h.known&&(h.value===null||["string","number"].includes(typeof h.value)))}for(let[f,g]of d)g||e.push(`style.${f}`);continue}let u=we(t.attributes[i].value);(i<n||!u.known)&&e.push(o==="class"?"className":o)}return e.length?e.join(" "):n>=0?"":void 0}function En(t,e,r=e.filepath){let n=xe(t);if(n.kind!=="ok")return n;if(!e.filepath||n.sourceVersion!==e.sourceVersion||!Number.isSafeInteger(e.modifiedTs)||e.modifiedTs<0)return{kind:"invalid",message:"Astro annotation requires a receipt for these exact source bytes"};let o=new He(t),i="$$tempoAstroHostId";for(;t.includes(i);)i+="_";for(let s of n.elements.values()){if(s.attributes.some(({name:p})=>p===bn||p?.startsWith("data-tempo-")&&p!=="data-tempo-locked"&&p!=="data-tempo-svg-paint"))return{kind:"invalid",message:"Astro source already contains reserved Tempo instrumentation"};if(s.kind!=="native-element"&&s.kind!=="component")continue;let a=fa(s),l=s.kind==="component"?{[bn]:{...e,position:s.start,name:s.tagName,expressions:a,literalProps:pa(s)}}:{"data-tempo-filepath":e.filepath,"data-tempo-position":s.start,"data-tempo-modifiedts":e.modifiedTs,"data-tempo-source-version":e.sourceVersion,...a!==void 0?{"data-tempo-expr":a}:{}},u=s.openingEnd-1;if(s.selfClosing){for(;/\s/.test(t[u-1]);)u--;t[u-1]==="/"&&u--}o.appendLeft(u,Object.entries(l).map(([p,d])=>` ${p}={${JSON.stringify(d)}}`).join("")+(s.kind==="native-element"?` data-tempo-astro-node={${i}()}`:""))}return{kind:"ok",code:o.toString(),occurrenceFactory:i,map:o.generateMap({source:r,includeContent:!0,hires:!0})}}var bn,wn=O(()=>{"use strict";Mt();Sr();Xe();bn="__tempo_astro_callsite__";c(pa,"literalComponentProps");c(da,"styleKey");c(fa,"astroExpressionFacts");c(En,"annotateAstroSource")});function xn(t,e,r,n){let o=(0,vr.parseSync)(`${e}.js`,t);if(o.errors.length)return;let i="$$tempoFrameworkComponent";for(;t.includes(i);)i+="_";let s=new He(t),a=new Map,l=!1;for(let u of o.program.body)if(u.type==="ExportDefaultDeclaration"){let p=u.declaration;p.type==="Identifier"?a.set(p.name,"default"):(p.type==="FunctionDeclaration"||p.type==="ClassDeclaration")&&p.id?a.set(p.id.name,"default"):(s.prependLeft(p.start,`${i}(`),s.appendLeft(p.end,`, ${JSON.stringify({...r,exportName:"default"})})`),l=!0)}else if(u.type==="ExportNamedDeclaration"&&!u.source){let p=u.declaration;if(p?.type==="VariableDeclaration")for(let d of p.declarations)d.id.type==="Identifier"&&a.set(d.id.name,d.id.name);else(p?.type==="FunctionDeclaration"||p?.type==="ClassDeclaration")&&p.id&&a.set(p.id.name,p.id.name);for(let d of u.specifiers)d.local.type==="Identifier"&&a.set(d.local.name,d.exported.type==="Identifier"?d.exported.name:d.exported.value)}if(!(!l&&!a.size)){s.prepend(`import { instrumentFrameworkComponent as ${i} } from ${JSON.stringify(n)};
13
+ `);for(let[u,p]of a)s.append(`
14
+ ${i}(${u}, ${JSON.stringify({...r,exportName:p})});`);return{code:s.toString(),map:s.generateMap({source:e,includeContent:!0,hires:!0})}}}function br(t,e,r,n,o){let i=(0,vr.parseSync)(`${e}.js`,t);if(i.errors.length)throw new Error(`Tempo could not parse Astro's compiled module: ${e}`);let s=new He(t),a="$$tempo";for(;t.includes(a);)a+="_";let l=[],u=!1;for(let p of i.program.body){if(p.type!=="ImportDeclaration")continue;let d=p.source.value;if(!(d!=="astro/runtime/server/index.js"&&d!=="astro/compiler-runtime"&&d!=="astro/runtime/compiler/index.js"&&!d.endsWith("/astro/dist/runtime/compiler/index.js")))for(let f of p.specifiers){if(f.type!=="ImportSpecifier"||f.imported.type!=="Identifier")continue;let g=f.imported.name;if(g!=="createComponent"&&g!=="renderComponent")continue;if(g==="createComponent"&&!r){u=!0;continue}let h=f.local,y=`${a}_${g}`;s.overwrite(f.start,f.end,`${g} as ${y}`);let x=g==="createComponent"?"instrumentCreateComponent":"instrumentRenderComponent";l.push(`const ${h.name} = ${a}_${x}(${y}${g==="createComponent"?`, ${JSON.stringify(r)}`:""});`),g==="createComponent"&&(u=!0)}}if(!u)throw new Error(`Unsupported Astro compiler output for ${e}; Tempo requires Astro 7 createComponent (${i.program.body.filter(p=>p.type==="ImportDeclaration").map(p=>p.source.value).join(", ")})`);return s.prepend(`import { astroHostId as ${o}, instrumentCreateComponent as ${a}_instrumentCreateComponent, instrumentRenderComponent as ${a}_instrumentRenderComponent } from ${JSON.stringify(n)};
15
+ ${l.join(`
16
+ `)}
17
+ `),{code:s.toString(),map:s.generateMap({source:e,includeContent:!0,hires:!0})}}var vr,Cn=O(()=>{Sr();vr=require("oxc-parser");c(xn,"instrumentFrameworkModule");c(br,"instrumentAstroModule")});function An(t,e,r){let n=(0,re.resolve)(e??t);if(!e)for(let a=n;;a=(0,re.dirname)(a)){let l=(0,re.join)(a,"tempo/tempo.config.json");if((0,fe.existsSync)(l)){let u=JSON.parse((0,fe.readFileSync)(l,"utf8"));if(a===t||(0,re.resolve)(a,u.apps?.[0]?.appDir??u.appDir??".")===t){n=a;break}}if((0,re.dirname)(a)===a)break}let o=(0,re.join)(n,"tempo"),i=(0,re.join)(o,"tempo.config.json"),s=(0,fe.existsSync)(i)?JSON.parse((0,fe.readFileSync)(i,"utf8")):{};return{root:n,tempoRoot:o,canvasesRoot:r?(0,re.resolve)(n,r):(0,re.resolve)(o,s.paths?.canvases??"designs")}}function _n(t){let e=new Set,r=c((n,o)=>{if(!(!(0,fe.existsSync)(n)||o>5))for(let i of(0,fe.readdirSync)(n,{withFileTypes:!0})){if(i.isSymbolicLink())continue;let s=(0,re.join)(n,i.name);if(i.isDirectory())r(s,o+1);else if(i.name.endsWith(".astro")){let a=(0,fe.readFileSync)(s,"utf8"),l=xe(a);if(l.kind!=="ok")continue;for(let u of l.imports){let p=u.source?.value;if(typeof p!="string"||!p.endsWith(".css")||p.endsWith(".module.css"))continue;let d=p.startsWith(".")?(0,re.resolve)((0,re.dirname)(s),p):p;(!p.startsWith(".")||(0,fe.existsSync)(d))&&e.add(d)}}}},"scan");if(r((0,re.join)(t,"src/layouts"),0),e.size||r((0,re.join)(t,"src/pages"),0),!e.size)for(let n of["src/styles/global.css","src/styles/tailwind.css","src/styles.css","src/index.css"]){let o=(0,re.resolve)(t,n);if((0,fe.existsSync)(o)){e.add(o);break}}return[...e]}var fe,re,Rn=O(()=>{fe=require("node:fs"),re=require("node:path");Xe();c(An,"astroProjectContext");c(_n,"discoverAstroStyles")});var Ce,Lt=O(()=>{Ce=__tempoRuntime.sdkModuleUrl});function dt(t){let e=`preview ${JSON.stringify(t)}`;if(t.includes("\\"))return{error:`${e} uses a backslash; use "/" (paths in canvases are POSIX).`};let r=t.lastIndexOf("#");if(r<0)return{error:`${e} needs "#<function>" after the file, e.g. "../../lib/cards.dart#productCard".`};let n=t.slice(0,r),o=t.slice(r+1);return!n.startsWith("./")&&!n.startsWith("../")?{error:n.startsWith("lib/")?`${e} is no longer relative to a Flutter app folder; write the path from this canvas file, starting with "./" or "../".`:`${e} must be a path relative to this canvas file and start with "./" or "../", like a relative import.`}:n.endsWith(".dart")?/[?#]/.test(n)||n.includes("//")?{error:`${e} must not contain "?", "#", or empty path segments.`}:/^[A-Za-z$][A-Za-z0-9_$]*$/.test(o)?{file:n,functionName:o}:{error:`${e}: ${JSON.stringify(o)} is not a public Dart function name.`}:{error:`${e} must name a .dart file.`}}var kn,Ft=O(()=>{"use strict";c(dt,"parseFlutterPreview");kn="data-tempo-flutter-preview-key"});var ma,ft,Dt,Er=O(()=>{"use strict";ma={Storyboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".tsx"},SvelteStoryboard:{importSource:"tempo-sdk/canvas/svelte",kind:"component",uiFramework:"svelte",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".svelte"},VueStoryboard:{importSource:"tempo-sdk/canvas/vue",kind:"component",uiFramework:"vue",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".vue"},AstroStoryboard:{importSource:"tempo-sdk/canvas/astro",kind:"component",uiFramework:"astro",requiresComponentProp:!0,allowsVrt:!0,componentFileExtension:".astro",componentImportQuery:"?tempo-component"},FlutterStoryboard:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!0},RouteStoryboard:{importSource:"tempo-sdk/canvas",kind:"route",requiresComponentProp:!1,allowsVrt:!1},HtmlStoryboard:{importSource:"tempo-sdk/canvas",kind:"html",requiresComponentProp:!1,allowsVrt:!0},LegacyStoryboardV1:{importSource:"tempo-sdk/canvas",kind:"component",requiresComponentProp:!1,allowsVrt:!1}},ft=ma,Dt=Object.keys(ft)});function Nn(t){return t.componentFramework??t.runtimeFramework??t.uiFramework}function Ye(t,e){let r=[],n;try{let E=(0,Pn.parseSync)(t,e);n=E.program;for(let w of E.errors??[])r.push({message:w.message??"Unable to parse canvas source",span:N(w)??N(w?.labels?.[0]),kind:"structural"})}catch(E){return{filePath:t,pageName:In(t),imports:[],misimportedSdkCanvasImports:[],storyboards:[],errors:[{message:E instanceof Error?E.message:"Unable to parse canvas source",kind:"structural"}]}}let o=Ea(n),i=ba(n),{legacyObjects:s,stringBindings:a}=wa(n,o,e),l=null,u=[];Cr(n,E=>{if(E.type!=="JSXElement")return;let w=Ar(E.openingElement?.name,o),C=Ha(E.openingElement?.name,o,i);if(C&&i.add(C),w==="Canvas"){l?r.push({message:"Canvas file must declare exactly one <Canvas> element",span:N(E),kind:"structural"}):l=E;return}_r(w)&&u.push({element:E,component:w})});let p=l?Ra(l,o):[],d=new Set(p.map(E=>E.element)),f=p.map(E=>_a(E.element,E.component,o,s,e,r));for(let E of u)d.has(E.element)||r.push({message:`<${E.component}> declarations must be direct children of the <Canvas> element`,span:N(E.element),kind:"structural"});if(ka(f,r),l)r.push(...Ta(l,o));else if(i.all.length>0)for(let E of i.all)r.push({message:va(E),span:E.sourceSpan,kind:"structural"});else r.push({message:Sa,kind:"structural"});let g=l?.openingElement,h=wr(g,"name",a),y=Pe(g,"path"),x=wr(g,"backgroundColor",a)??wr(g,"background",a);return g&&!h&&r.push({message:'<Canvas> must include a literal "name" prop',span:N(g),kind:"degraded"}),{filePath:t,canvasPath:y?.value,pageName:h?.value??In(t),backgroundColor:x?.value,canvasElementSpan:N(l),canvasOpeningElementSpan:N(g),canvasChildrenInsertionOffset:typeof l?.closingElement?.start=="number"?l.closingElement.start:void 0,nameSpan:h?.valueSpan,nameAttributeSpan:h?.attributeSpan,pathSpan:y?.valueSpan,pathAttributeSpan:y?.attributeSpan,backgroundColorSpan:x?.valueSpan,backgroundColorAttributeSpan:x?.attributeSpan,imports:o.all,misimportedSdkCanvasImports:i.all,storyboards:f,errors:r}}function va(t){return`Tempo canvas components must be imported from "tempo-sdk/canvas" \u2014 found import of ${t.importedNames.join(", ")} from "${t.source}"`}function ba(t){let e=[],r=new Map,n=new Map,o=c(i=>{let s=Va(i.sourceSpan);r.has(s)||(r.set(s,i),e.push(i))},"add");for(let i of t?.body??[]){if(i?.type!=="ImportDeclaration"||typeof i.source?.value!="string"||!Hn(i.source.value)||i.importKind==="type")continue;let s=i.source.value,a=N(i.source);if(!a)continue;let l=(i.specifiers??[]).filter(f=>f?.importKind!=="type"),u=l.map(Ht),p={source:s,sourceSpan:a,importedNames:u,rewritable:l.length>0&&l.every(f=>f?.type==="ImportSpecifier"&&ya.has(Ht(f)))};l.some(f=>f?.type==="ImportSpecifier"&&jt.has(Ht(f)))&&o(p);for(let f of l){if(f?.type!=="ImportNamespaceSpecifier")continue;let g=f.local?.name;typeof g=="string"&&n.set(g,p)}}return{all:e,byDeclarationKey:r,namespaceCandidatesByLocalName:n,add:o}}function Ea(t){let e=[],r=new Map,n=new Map,o=new Set;for(let i of t?.body??[]){if(i?.type!=="ImportDeclaration"||typeof i.source?.value!="string")continue;let s=i.source.value,a=Dn(s);for(let l of i.specifiers??[]){let u=l.local?.name;if(typeof u!="string")continue;let p=Ht(l),d={localName:u,source:s,importedName:p,kind:Ua(l),importKind:l.importKind==="type"?"type":"value",span:N(l)??N(i)??{start:0,end:0},declarationSpan:N(i)??{start:0,end:0},specifierCount:i.specifiers?.length??0,namedSpecifierCount:(i.specifiers??[]).filter(f=>f?.type==="ImportSpecifier").length,hasDefaultSpecifier:(i.specifiers??[]).some(f=>f?.type==="ImportDefaultSpecifier"),hasNamespaceSpecifier:(i.specifiers??[]).some(f=>f?.type==="ImportNamespaceSpecifier")};if(e.push(d),r.set(u,d),!!a){if(l.type==="ImportNamespaceSpecifier"){o.add(u);continue}jt.has(p)&&n.set(u,p)}}}return{all:e,byLocalName:r,sdkLocalNames:n,sdkNamespaces:o}}function wa(t,e,r){let n=new Map,o=new Map;for(let i of xa(t)){if(i.id?.type!=="Identifier")continue;let s=Ut(i.init);if(s?.type!=="ObjectExpression")continue;let a=i.id.name;n.set(a,Ca(a,s,e,r));let l=Aa(s);l.size>0&&o.set(a,l)}return{legacyObjects:n,stringBindings:o}}function xa(t){let e=[];for(let r of t?.body??[]){let n=r?.type==="VariableDeclaration"?r:r?.type==="ExportNamedDeclaration"&&r.declaration?.type==="VariableDeclaration"?r.declaration:null;n&&e.push(...n.declarations??[])}return e}function Ca(t,e,r,n){let o=[],i=Ne(e,"name"),s=i?Ln(i.value):null,a=Ne(e,"layout"),l=a?$n(a.value,"LegacyStoryboardV1"):{value:qe,errors:[{message:'<LegacyStoryboardV1> storyboard object must include a literal "layout" object',span:N(e),kind:"degraded"}]},u=Ne(e,"render"),p=$a(u?.value,r,n);return i&&!s&&o.push({message:"<LegacyStoryboardV1> storyboard.name must be a string literal when set",span:N(i),kind:"degraded"}),o.push(...l.errors),{bindingName:t,displayName:s?.value,component:p??void 0,objectSpan:N(e),objectClose:xr(e),nameSpan:s?.span,namePropertySpan:N(i),layoutPropertySpan:N(a),layout:l.value,layoutSpans:l.spans,errors:o}}function Aa(t){let e=new Map;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;let n=Vt(r.key),o=Ln(r.value);!n||!o||e.set(n,o)}return e}function _a(t,e,r,n,o,i){let s=t.openingElement,a=[],l=Pe(s,"id"),u=Pe(s,"name"),p=e==="LegacyStoryboardV1"?Tn(s,"storyboard",o):void 0,d=p?.expression&&La(p.expression)?n.get(p.expression):void 0,f=e==="LegacyStoryboardV1"?{value:d?.layout??qe,spans:d?.layoutSpans,attributeSpan:void 0,errors:d?.errors??(p?[{message:"<LegacyStoryboardV1> storyboard prop must reference a same-file object literal",span:p.span,kind:"degraded"}]:[{message:'<LegacyStoryboardV1> must include a "storyboard" expression prop',span:N(s),kind:"degraded"}])}:Fa(s,e),g=ft[e];l||a.push({message:`<${e}> must include a literal "id" prop`,span:N(s),kind:"structural"}),f.errors.length>0&&a.push(...f.errors);let h={storyboardKey:l?.value??"",displayName:u?.value??d?.displayName,kind:g.kind,...g.uiFramework?{componentFramework:g.uiFramework}:{},...g.uiFramework==="svelte"?{uiFramework:g.uiFramework}:g.uiFramework==="astro"?{runtimeFramework:g.uiFramework}:{},layout:f.value,editable:!!l&&f.errors.length===0,jsxElementSpan:N(t)??{start:0,end:0},openingElementSpan:N(s),idSpan:l?.valueSpan,idAttributeSpan:l?.attributeSpan,nameSpan:u?.valueSpan??d?.nameSpan,nameAttributeSpan:u?.attributeSpan??d?.namePropertySpan,layoutAttributeSpan:f.attributeSpan,layoutSpans:f.spans,props:Tn(s,"props",o),component:d?.component,legacyV1:p?{storyboard:p,objectName:d?.bindingName,objectSpan:d?.objectSpan,objectClose:d?.objectClose,namePropertySpan:d?.namePropertySpan,layoutPropertySpan:d?.layoutPropertySpan}:void 0,errors:a};if(g.requiresComponentProp){let y=Oa(s,r,o);y?h.component=y:a.push({message:`<${e}> must include a "component" expression prop`,span:N(s),kind:"degraded"})}if(g.allowsVrt){let y=On(s,a);y&&(y.value&&(h.vrt=y.value),h.vrtAttributeSpan=y.attributeSpan)}if(e==="RouteStoryboard"){let y=Pe(s,"route");y?(h.route=y.value,h.routeSpan=y.valueSpan,h.routeAttributeSpan=y.attributeSpan):a.push({message:'<RouteStoryboard> must include a literal "route" prop',span:N(s),kind:"degraded"})}if(e==="HtmlStoryboard"){let y=Pe(s,"filepath"),x=Pe(s,"src");h.filepath=y?.value.trim()?y.value:void 0,h.filepathSpan=y?.valueSpan,h.filepathAttributeSpan=y?.attributeSpan,h.src=x?.value,h.srcSpan=x?.valueSpan,h.srcAttributeSpan=x?.attributeSpan,!y?.value.trim()&&!x?.value.trim()&&a.push({message:'<HtmlStoryboard> must include a literal "filepath" or "src" prop',span:N(s),kind:"degraded"})}if(e==="FlutterStoryboard"){let y=Pe(s,"preview");if(y?.value.trim()){h.preview=y.value,h.previewSpan=y.valueSpan,h.previewAttributeSpan=y.attributeSpan;let x=dt(y.value);"error"in x&&a.push({message:`flutter_preview_invalid: ${x.error}`,span:y.valueSpan,kind:"structural"})}else a.push({message:'<FlutterStoryboard> must include a literal "preview" prop naming a Flutter @Preview function, e.g. preview="../../lib/cards.dart#productCard"',span:N(je(s,"preview")??s),kind:"structural"})}return i.push(...a),h}function Ra(t,e){let r=[];for(let n of t.children??[]){if(n?.type!=="JSXElement")continue;let o=Ar(n.openingElement?.name,e);_r(o)&&r.push({element:n,component:o})}return r}function ka(t,e){let r=new Map;for(let n of t){if(!n.storyboardKey)continue;let o=r.get(n.storyboardKey);o?o.push(n):r.set(n.storyboardKey,[n])}for(let[n,o]of r)o.length<2||e.push({message:`Duplicate storyboard id "${n}" (${o.length} declarations) \u2014 storyboard ids must be unique`,span:o[1]?.jsxElementSpan,kind:"structural"})}function Ta(t,e){let r=[];for(let n of t.children??[])if(n&&!(n.type==="JSXText"&&typeof n.value=="string"&&n.value.trim()==="")){if(n.type==="JSXExpressionContainer"){if(n.expression?.type==="JSXEmptyExpression")continue;r.push({message:"<Canvas> children must be static storyboard declarations, not expressions",span:N(n),kind:"structural"});continue}if(n.type==="JSXElement"){let o=Ar(n.openingElement?.name,e);if(_r(o))continue;let i=Pa(n.openingElement?.name,e);if(i){r.push(Na(n,i));continue}}r.push({message:ha,span:N(n),kind:"structural"})}return r}function Pa(t,e){let r,n;if(t?.type==="JSXIdentifier"){let s=e.byLocalName.get(t.name);if(s?.kind!=="named")return null;r=s.importedName,n=s.source}else if(t?.type==="JSXMemberExpression"&&t.object?.type==="JSXIdentifier"&&t.property?.type==="JSXIdentifier"){let s=e.byLocalName.get(t.object.name);if(s?.kind!=="namespace")return null;r=t.property.name,n=s.source}else return null;let o=Ia.test(n),i=r.endsWith("Storyboard");return o&&i?r:null}function Na(t,e){let r=t.openingElement,n=Pe(r,"id")?.value,o=On(r,[])?.value!=null,i=n?` id="${n}"`:"";return{message:`<${e}${i}> is a storyboard from a newer tempo-sdk than this reader supports`,span:N(t),kind:"structural",newerSdkStoryboard:{component:e,...n?{storyboardKey:n}:{},vrt:o}}}function On(t,e){let r=je(t,"vrt");if(!r)return null;let n=N(r);if(r.value==null)return{value:{},attributeSpan:n};let o=Ut(Qe(r.value));if(o?.type==="Literal"&&o.value===!0)return{value:{},attributeSpan:n};if(o?.type==="Literal"&&o.value===!1)return{value:null,attributeSpan:n};if(o?.type!=="ObjectExpression")return e.push({message:"<Storyboard> vrt must be a boolean literal or an object literal ({ threshold?, skip?, ignore? })",span:N(o)??n,kind:"degraded"}),{value:null,attributeSpan:n};let i={};for(let s of o.properties??[]){if(s?.type!=="Property"||s.computed){e.push({message:"<Storyboard> vrt must contain only literal properties",span:N(s??o),kind:"degraded"});continue}let a=Vt(s.key);if(a==="threshold"){let l=ze(s.value);l&&l.value>=0&&l.value<=.5?i.threshold=l.value:e.push({message:"<Storyboard> vrt.threshold must be a number literal between 0 and 0.5",span:N(s),kind:"degraded"});continue}if(a==="skip"){s.value?.type==="Literal"&&typeof s.value.value=="boolean"?s.value.value&&(i.skip=!0):e.push({message:"<Storyboard> vrt.skip must be a boolean literal",span:N(s),kind:"degraded"});continue}if(a==="ignore"){let l=Ma(s.value,e);l&&(i.ignore=l);continue}e.push({message:`<Storyboard> vrt has unknown property "${a??"?"}" \u2014 expected threshold, skip, or ignore`,span:N(s),kind:"degraded"})}return{value:i,attributeSpan:n}}function Ma(t,e){if(t?.type!=="ArrayExpression")return e.push({message:"<Storyboard> vrt.ignore must be an array of { x, y, w, h } literals",span:N(t),kind:"degraded"}),null;let r=[];for(let n of t.elements??[]){let o={};for(let i of["x","y","w","h"]){let s=Ne(n,i),a=s?ze(s.value):null;a&&(o[i]=a.value)}if(o.x===void 0||o.y===void 0||o.w===void 0||o.h===void 0)return e.push({message:"<Storyboard> vrt.ignore regions must be { x, y, w, h } number literals",span:N(n)??N(t),kind:"degraded"}),null;r.push(o)}return r}function Oa(t,e,r){let n=je(t,"component"),o=Qe(n?.value),i=N(o);if(!o||!i)return null;let s=o.type==="Identifier"?o.name:o.type==="MemberExpression"&&o.object?.type==="Identifier"?o.object.name:void 0;return{expression:r.slice(i.start,i.end),span:i,attributeSpan:N(n),localName:s,import:s?e.byLocalName.get(s):void 0}}function $a(t,e,r){if(t?.type!=="ArrowFunctionExpression")return null;let n=Ut(t.body);if(n?.type!=="JSXElement")return null;let o=n.openingElement?.name;if(o?.type!=="JSXIdentifier")return null;let i=N(o);return!i||typeof o.name!="string"?null:{expression:r.slice(i.start,i.end),span:i,localName:o.name,import:e.byLocalName.get(o.name)}}function Tn(t,e,r){let n=je(t,e),o=Qe(n?.value),i=N(o);if(!(!o||!i))return{expression:r.slice(i.start,i.end),span:i,attributeSpan:N(n)}}function La(t){return/^[A-Za-z_$][\w$]*$/.test(t)}function Fa(t,e){let r=Fn(e),n=je(t,"layout"),o=Qe(n?.value);return o?{...$n(o,e),attributeSpan:N(n)}:{value:r?Mn:qe,attributeSpan:N(n),errors:[{message:`<${e}> must include a literal "layout" object prop`,span:N(t),kind:"degraded"}]}}function $n(t,e){let r=[],n=Fn(e);if(t.type!=="ObjectExpression")return{value:n?Mn:qe,spans:{layoutClose:xr(t)},errors:[{message:`<${e}> layout must be an object literal`,span:N(t),kind:"degraded"}]};let o={layoutClose:xr(t)},i={...qe},s=Ne(t,"width"),a=Ne(t,"height"),l=Ne(t,"intrinsicSizing"),u=l?.value?.value==="root-element",d=n||!!(s&&a)&&!u;!n&&!!s!=!!a&&r.push({message:"layout.width and layout.height must be set together",span:N(t),kind:"degraded"});let g=d?{width:s?ze(s.value):null,height:a?ze(a.value):null}:null,h=d?["x","y","width","height"]:["x","y"];for(let E of h){let w=E==="width"?s:E==="height"?a:Ne(t,E),C=E==="width"||E==="height"?g?.[E]:w?ze(w.value):null,k=E==="x"||E==="y"||n||!!(g?.width&&g.height);if(!C){r.push({message:`<${e}> layout.${E} must be a number literal`,span:N(w??t),kind:"degraded"});continue}k&&(i[E]=C.value,o[E]=C.span)}let y=Ne(t,"zIndex");if(y){let E=ze(y.value);E?(i.zIndex=E.value,o.zIndex=E.span):r.push({message:`<${e}> layout.zIndex must be a number literal`,span:N(y),kind:"degraded"})}return l&&(l.value?.type!=="Literal"||!u)&&r.push({message:`<${e}> layout.intrinsicSizing must be "root-element" when set`,span:N(l),kind:"degraded"}),{value:i,spans:o,errors:r}}function Ln(t){return t?.type==="Literal"&&typeof t.value=="string"?{value:t.value,span:N(t)??{start:0,end:0}}:null}function Ut(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function wr(t,e,r){let n=Pe(t,e);if(n)return n;let o=je(t,e),i=Qe(o?.value),s=N(i),a=N(o);if(!i||!s||!a)return null;let l=Da(i,r);return l?{value:l.value,valueSpan:s,attributeSpan:a}:null}function Da(t,e){if(t?.type!=="MemberExpression"||t.object?.type!=="Identifier")return null;let r=Vt(t.property);return r?e.get(t.object.name)?.get(r)??null:null}function Pe(t,e){let r=je(t,e);if(!r)return null;let n=r.value;if(n?.type==="Literal"&&typeof n.value=="string")return{value:n.value,valueSpan:N(n)??N(r)??{start:0,end:0},attributeSpan:N(r)??{start:0,end:0}};let o=Ut(Qe(n)),i=o?.type==="Literal"&&typeof o.value=="string"?o.value:o?.type==="TemplateLiteral"&&(o.expressions?.length??0)===0&&o.quasis?.length===1&&typeof o.quasis[0]?.value?.cooked=="string"?o.quasis[0].value.cooked:null;return i!==null?{value:i,valueSpan:N(o)??N(r)??{start:0,end:0},attributeSpan:N(r)??{start:0,end:0}}:null}function je(t,e){for(let r of t?.attributes??[])if(r?.type==="JSXAttribute"&&r.name?.type==="JSXIdentifier"&&r.name.name===e)return r;return null}function Qe(t){return t?t.type==="JSXExpressionContainer"?t.expression:t:null}function Vt(t){return t?.type==="Identifier"?t.name:t?.type==="Literal"&&typeof t.value=="string"?t.value:null}function Ne(t,e){if(t?.type!=="ObjectExpression")return null;for(let r of t.properties??[]){if(r?.type!=="Property"||r.computed)continue;if(Vt(r.key)===e)return r}return null}function ze(t){return t?.type==="Literal"&&typeof t.value=="number"&&Number.isFinite(t.value)?{value:t.value,span:N(t)??{start:0,end:0}}:t?.type==="UnaryExpression"&&t.operator==="-"&&t.argument?.type==="Literal"&&typeof t.argument.value=="number"&&Number.isFinite(t.argument.value)?{value:-t.argument.value,span:N(t)??{start:0,end:0}}:null}function Ar(t,e){return t?.type==="JSXIdentifier"?e.sdkLocalNames.get(t.name)??null:t?.type==="JSXMemberExpression"&&t.object?.type==="JSXIdentifier"&&t.property?.type==="JSXIdentifier"&&e.sdkNamespaces.has(t.object.name)&&jt.has(t.property.name)?t.property.name:null}function Ha(t,e,r){if(t?.type!=="JSXMemberExpression"||t.object?.type!=="JSXIdentifier"||t.property?.type!=="JSXIdentifier"||!jt.has(t.property.name))return null;let n=e.byLocalName.get(t.object.name);return n?.kind!=="namespace"||!Hn(n.source)?null:r.namespaceCandidatesByLocalName.get(t.object.name)??null}function _r(t){return t!==null&&t!=="Canvas"}function ja(t){return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`}function Fn(t){return t==="RouteStoryboard"||t==="HtmlStoryboard"||t==="FlutterStoryboard"}function Ht(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"*":t.imported?.name??t.local?.name??"unknown"}function Ua(t){return t.type==="ImportDefaultSpecifier"?"default":t.type==="ImportNamespaceSpecifier"?"namespace":"named"}function Dn(t){for(let e of ga)if(t===e||t.endsWith(`/${e}`))return!0;return!1}function Hn(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!Dn(t)}function Va(t){return`${t.start}:${t.end}`}function xr(t){return typeof t?.end=="number"&&Number.isFinite(t.end)?t.end-1:void 0}function In(t){let r=t.replace(/\\/g,"/").split("/").filter(Boolean),n=r.length>0?r[r.length-1]:t,o=r.length>1?r[r.length-2]:n;return(/^index\.canvas\.[tj]sx?$/.test(n)?o:n.replace(/\.canvas\.[tj]sx?$/,"")).split(/[-_\s]+/).filter(Boolean).map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function N(t){return typeof t?.start=="number"&&Number.isFinite(t.start)&&typeof t?.end=="number"&&Number.isFinite(t.end)?{start:t.start,end:t.end}:void 0}function Cr(t,e,r=new Set){if(!(!t||typeof t!="object"||r.has(t))){r.add(t),e(t);for(let n of Object.values(t))if(n)if(Array.isArray(n))for(let o of n)Cr(o,e,r);else typeof n=="object"&&Cr(n,e,r)}}var Pn,ga,jt,ha,ya,qe,Mn,Sa,Ia,Wt=O(()=>{Ft();Pn=require("oxc-parser");Er();Er();c(Nn,"componentFrameworkForStoryboard");ga=new Set(["tempo-sdk/canvas",...Dt.map(t=>ft[t].importSource)]),jt=new Set(["Canvas",...Dt]),ha=`<Canvas> children must be ${ja(Dt.map(t=>`<${t}>`))} declarations`,ya=new Set(["Canvas","CanvasContext","getCanvasStoryboardRenderId","CanvasHost","buildRenderContentFiberSelector","buildRenderContentSelector","buildRenderSelector","captureStoryboardCombined","captureStoryboardHtml","captureStoryboardImage","stripRenderContentWrapperAttributes","stripRenderContentWrapperFromCombinedCapture","watchStoryboardCombined","getCanvasHostRuntime","getOptionalCanvasHostRuntime","useActiveState","FlutterStoryboard","HtmlStoryboard","LegacyStoryboardV1","RouteStoryboard","Storyboard","StoryboardSlot"]),qe={x:0,y:0},Mn={...qe,width:600,height:400},Sa="No <Canvas> declaration found in canvas file";c(Ye,"parseCanvasFile");c(va,"misimportedSdkCanvasImportMessage");c(ba,"readMisimportedSdkCanvasImports");c(Ea,"readImports");c(wa,"readObjectExpressionBindings");c(xa,"readTopLevelVariableDeclarators");c(Ca,"readLegacyStoryboardObject");c(Aa,"readObjectStringProperties");c(_a,"readStoryboard");c(Ra,"readDirectCanvasStoryboardElements");c(ka,"reportDuplicateStoryboardIds");c(Ta,"validateCanvasChildren");Ia=/(^|\/)tempo-sdk\/canvas(\/[^/]+)?$/;c(Pa,"resolveNewerSdkStoryboardComponent");c(Na,"newerSdkStoryboardError");c(On,"readVrt");c(Ma,"readVrtIgnoreRegions");c(Oa,"readComponentReference");c($a,"readRenderComponentReference");c(Tn,"readExpressionReference");c(La,"isIdentifierExpression");c(Fa,"readLayout");c($n,"readLayoutExpression");c(Ln,"readStringLiteralValue");c(Ut,"unwrapTsExpression");c(wr,"readResolvableStringAttribute");c(Da,"resolveStringMemberExpression");c(Pe,"readStringAttribute");c(je,"getAttribute");c(Qe,"unwrapAttributeExpression");c(Vt,"readPropertyKeyName");c(Ne,"getObjectProperty");c(ze,"readNumberLiteral");c(Ar,"resolveSdkComponent");c(Ha,"resolveMisimportedNamespaceSdkComponent");c(_r,"isStoryboardSdkComponent");c(ja,"formatAlternatives");c(Fn,"requiresFixedLayoutSize");c(Ht,"readImportedName");c(Ua,"readImportKind");c(Dn,"isSdkImportSource");c(Hn,"isWrongTempoSdkCanvasImportSource");c(Va,"spanKey");c(xr,"readLayoutClose");c(In,"fallbackPageName");c(N,"toSpan");c(Cr,"walk")});function jn(t,e){return`/__tempo/astro/${encodeURIComponent(t)}/${encodeURIComponent(e)}`}var Un=O(()=>{"use strict";c(jn,"astroStoryboardPath")});function Rr(t){if(!t)return{};let e=(0,Vn.parseSync)("props.ts",`(${t})`);if(e.errors.length)throw new Error("Astro storyboard props must be a JSON object literal");let r=c(i=>{if(i?.type==="ParenthesizedExpression")return r(i.expression);if(i?.type==="Literal"&&(i.value===null||["string","boolean"].includes(typeof i.value)||typeof i.value=="number"&&Number.isFinite(i.value)))return i.value;if(i?.type==="UnaryExpression"&&["-","+"].includes(i.operator)&&i.argument?.type==="Literal"&&typeof i.argument.value=="number"&&Number.isFinite(i.argument.value))return i.operator==="-"?-i.argument.value:i.argument.value;if(i?.type==="ArrayExpression")return i.elements.map(r);if(i?.type==="ObjectExpression"){let s=Object.create(null);for(let a of i.properties){if(a.type!=="Property"||a.computed||a.method||a.shorthand||a.kind!=="init")throw new Error("Astro storyboard props cannot contain expressions, spreads or getters");let l=a.key.type==="Identifier"?a.key.name:a.key.value;if(typeof l!="string"&&typeof l!="number")throw new Error("Astro storyboard props require literal keys");s[l]=r(a.value)}return s}throw new Error("Astro storyboard props must be static JSON; use an authored .astro fixture for server data or slots")},"read"),n=e.program.body[0],o=r(n?.type==="ExpressionStatement"?n.expression:void 0);if(!o||typeof o!="object"||Array.isArray(o))throw new Error("Astro storyboard props must be a JSON object literal");return o}var Vn,Wn=O(()=>{Vn=require("oxc-parser");c(Rr,"readAstroStoryboardProps")});function Gn(t){return(0,ee.existsSync)(t)?(0,ee.readdirSync)(t,{withFileTypes:!0}).flatMap(e=>{if(e.isSymbolicLink())return[];let r=(0,ne.join)(t,e.name);return e.isDirectory()?Gn(r):e.name.endsWith(".canvas.tsx")?[r]:[]}):[]}function Bn(t,e,r,n=[]){let o=[];for(let s of new Set((Array.isArray(e)?e:[e]).flatMap(Gn))){let a=(0,ee.openSync)(s,"r"),l,u;try{let f=(0,ee.fstatSync)(a);l=(0,ee.readFileSync)(a,"utf8");let g=(0,ee.fstatSync)(a);if(!["mtimeMs","ctimeMs","size","ino","dev"].every(h=>f[h]===g[h]))throw new Error(`Canvas changed while reading: ${s}`);u=Math.trunc(f.mtimeMs)}finally{(0,ee.closeSync)(a)}let p=Ye(s,l),d=p.canvasPath??(0,ne.relative)(t,(0,ne.dirname)(s)).replaceAll("\\","/");for(let f of p.storyboards){if(Nn(f)!=="astro")continue;let g=jn(d,f.storyboardKey),h=(0,ne.join)(r,`${(0,kr.createHash)("sha256").update(g).digest("hex")}.astro`),y=(0,kr.createHash)("sha256").update(l).digest("hex"),x;try{if(p.errors.some(P=>P.kind==="structural")||f.errors.length)throw new Error("Fix the Astro storyboard's canvas declaration before rendering it");let E=f.component?.import;if(!E||E.kind!=="default"||!E.source.endsWith(".astro?tempo-component"))throw new Error("AstroStoryboard requires a default .astro?tempo-component import; use an authored .astro fixture for slots and server data");let w=E.source.slice(0,-16),C=w.startsWith(".")?(0,ne.resolve)((0,ne.dirname)(s),w).replaceAll("\\","/"):w,k=JSON.stringify(Rr(f.props?.expression)).replaceAll("<","\\u003c"),L=JSON.stringify({filepath:(0,ne.relative)(t,s).replaceAll("\\","/"),sourceVersion:ke(l),modifiedTs:u,position:f.jsxElementSpan.start,name:f.component?.localName??"Component"}),M=JSON.stringify({canvasPath:d,storyboardId:f.storyboardKey,revision:y}),W;if(s.replaceAll("\\","/").includes("/.tempo/asset-edit-previews/")){for(let P of(0,Kn.parseSync)(s,l).program.body)if(!(P.type!=="ExportNamedDeclaration"||P.declaration?.type!=="VariableDeclaration"))for(let $ of P.declaration.declarations)$.id.type==="Identifier"&&$.id.name==="__tempoAstroAssetPreview"&&$.init&&(W=Rr(l.slice($.init.start,$.init.end)))}if(x=`---
18
+ import Component from ${JSON.stringify(C)};
19
+ import ComponentMetadata from ${JSON.stringify(C+"?tempo-component")};
20
+ ${n.map(P=>`import ${JSON.stringify(P.replaceAll("\\","/"))};`).join(`
21
+ `)}
22
+ const props = ${k};
23
+ const controls = JSON.stringify(ComponentMetadata.__tempoAstroControls ?? {});
24
+ ---
25
+ <!doctype html><html><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="tempo-project-root" content={${JSON.stringify(t)}} /><meta name="tempo-astro-storyboard" content={${JSON.stringify(M)}} /></head><body style="margin:0"><Component {...props} __tempo_astro_callsite__={${L}} /><pre hidden data-asset-definition={controls}>Component controls</pre></body></html>`,W){let P=(0,Jn.fileURLToPath)(new URL(Ce("astro/storyboards.ts").endsWith(".ts")?"./asset-preview-client.ts":"./asset-preview-client.js",Ce("astro/storyboards.ts")));x=x.replace(`const props = ${k};`,`const preview = ${JSON.stringify(W).replaceAll("<","\\u003c")};
26
+ const raw = Astro.url.searchParams.get("__tempo_asset_update");
27
+ if (raw && raw.length > 64000) throw new Error("Astro preview props are too large");
28
+ const update = raw ? JSON.parse(raw) : {variant:null,edits:{}};
29
+ if (!(update.variant === null || typeof update.variant === "string") || !update.edits || typeof update.edits !== "object" || Array.isArray(update.edits)) throw new Error("Invalid Astro preview props");
30
+ const variant = update.variant !== null && Object.hasOwn(preview.asset.variants,update.variant) ? preview.asset.variants[update.variant] : undefined;
31
+ if (update.variant !== null && (!variant || variant.error)) throw new Error(variant?.error ?? "The Astro asset variant no longer exists");
32
+ const props = {...variant?.props};
33
+ for (const [key,value] of Object.entries(update.edits)) { if(value && typeof value === "object" && Object.keys(value).length===1 && value.__tempo_omit_prop__===true) delete props[key]; else Object.defineProperty(props,key,{value,enumerable:true,configurable:true}); }
34
+ const assetMetadata = JSON.stringify({sessionId:preview.sessionId,metadata:{asset:preview.asset,...ComponentMetadata.__tempoAstroControls}});`).replace("</head>",'<meta name="tempo-astro-asset-preview" content={assetMetadata} /></head>').replace(`<Component {...props} __tempo_astro_callsite__={${L}} />`,`{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${L}} />}`).replace("</body>",`<script>import {startAstroAssetPreview} from ${JSON.stringify(P)}; startAstroAssetPreview();</script></body>`)}}catch(E){x=`---
35
+ throw new Error(${JSON.stringify(E instanceof Error?E.message:String(E))});
36
+ ---`}x=x.replace("</body>",`${Wa}</body>`),o.push({path:g,file:h,source:x,revision:y})}}let i=new Set;for(let s of o){if(i.has(s.path))throw new Error(`Duplicate Astro storyboard address: ${s.path}`);i.add(s.path)}return o}function Bt(t,e){let r=(0,ee.existsSync)(t);if(!(r&&(0,ee.readFileSync)(t,"utf8")===e))return(0,ee.mkdirSync)((0,ne.dirname)(t),{recursive:!0}),(0,ee.writeFileSync)(t,e),r?"updated":"created"}function Ba(t){return String.raw`---
37
+ import { readFileSync } from "node:fs";
38
+ import { createComponent } from "astro/runtime/server/index.js";
39
+ const base = import.meta.env.BASE_URL.replace(/\/$/, "");
40
+ const pathname = Astro.url.pathname.slice(base.length).replace(/\/$/, "");
41
+ const routes = JSON.parse(readFileSync(${JSON.stringify(t)}, "utf8"));
42
+ const route = routes.find((entry) => entry.path === pathname);
43
+ if (!route) return new Response("Astro storyboard not found", { status: 404 });
44
+ // Do not turn these into a glob or a static import map: unopened boards may
45
+ // contain broken imports, and their global CSS must never enter this document.
46
+ const { default: assets } = await import(/* @vite-ignore */ route.file + "?astroPropagatedAssets");
47
+ const { default: Page } = await assets.getMod();
48
+ const Preview = createComponent((result, props, slots) => {
49
+ // The generated document owns its <head>. It was loaded during frontmatter,
50
+ // after Astro computed the dispatch page's static head metadata.
51
+ result._metadata.headInTree = true;
52
+ result._metadata.routeHasPropagation = true;
53
+ for (const style of assets.collectedStyles) {
54
+ result.styles.add({ props: { "data-vite-dev-id": style.id }, children: style.content });
55
+ const src = style.id.startsWith("/@id/") ? style.id : "/@fs/" + style.id.replace(/^\//, "");
56
+ result.scripts.add({ props: { type: "module", src: base + src }, children: "" });
57
+ }
58
+ for (const href of assets.collectedLinks) {
59
+ result.links.add({ props: { rel: "stylesheet", href }, children: "" });
60
+ }
61
+ return Page(result, props, slots);
62
+ });
63
+ ---
64
+ <Preview />`}function Xn(t,e,r,n=[]){let o=Array.isArray(e)?e:[e],i=Bn(t,o,r,n),s=i,a=(0,ne.join)(r,"routes.json"),l=(0,ne.join)(r,"storyboards.astro"),u=c(h=>JSON.stringify(h.map(({path:y,file:x})=>({path:y,file:x.replaceAll("\\","/")}))),"shape"),p=new Set,d=c(h=>{let y=Bt(h.file,h.source),x=h.file.replaceAll("\\","/");return y==="created"?p.add(x):y==="updated"&&p.delete(x),y},"writeDocument");for(let h of i)d(h);Bt(a,u(i)),Bt(l,Ba(a));let f;return{routes:i,registryFile:a,entrypoint:l,plugin:{name:"tempo:astro-storyboards",hotUpdate:{order:"pre",async handler({type:h,file:y,modules:x,read:E}){if(this.environment.name==="client"&&y.endsWith(".canvas.tsx")&&(h!=="delete"&&await E(),f?.(y)),h==="create"&&p.has(y))return x.filter(w=>w.file!==y)}},configureServer(h){f=c(w=>{if(!(!w.endsWith(".canvas.tsx")||!o.some(C=>{let k=(0,ne.relative)(C,w);return!(0,ne.isAbsolute)(k)&&!k.startsWith("../")})))try{let C=Bn(t,o,r,n),k=C.filter(M=>d(M)==="updated").map(M=>M.file),L=new Set(C.map(M=>M.file.replaceAll("\\","/")));for(let M of p)L.has(M)||p.delete(M);s=C,Bt(a,u(C));for(let M of k)h.watcher.emit("change",M)}catch(C){h.config.logger.error(String(C))}},"changed"),h.watcher.add(o);let x=c((w,C)=>{if(typeof w?.path!="string"||typeof w.revision!="string")return;let k=h.config.base.replace(/\/$/,""),L=k&&w.path.startsWith(`${k}/`)?w.path.slice(k.length):w.path,M=s.find(W=>W.path===L);M&&C.send({type:"custom",event:"tempo:astro:revision",data:{path:w.path,revision:M.revision}})},"verifyRevision");h.ws.on("tempo:astro:revision-request",x);let E=c(()=>{h.ws.off("tempo:astro:revision-request",x)},"dispose");h.httpServer?.once("close",E)}}}}var kr,ee,ne,Jn,Kn,Wa,zn=O(()=>{Lt();kr=require("node:crypto"),ee=require("node:fs");Je();ne=require("node:path"),Jn=require("node:url");Wt();Un();Wn();Kn=require("oxc-parser"),Wa=`<script>
65
+ const hot = import.meta.hot;
66
+ if (hot) {
67
+ const receipt = () => JSON.parse(document.querySelector('meta[name="tempo-astro-storyboard"]')?.getAttribute('content') ?? 'null');
68
+ const check = () => hot.send('tempo:astro:revision-request', { path: location.pathname, revision: receipt()?.revision });
69
+ const accept = (data) => {
70
+ if (data.path === location.pathname && data.revision !== receipt()?.revision) location.reload();
71
+ };
72
+ hot.on('tempo:astro:revision', accept);
73
+ hot.on('vite:ws:connect', check);
74
+ check();
75
+ hot.dispose(() => {
76
+ hot.off('tempo:astro:revision', accept);
77
+ hot.off('vite:ws:connect', check);
78
+ });
79
+ }
80
+ </script>`;c(Gn,"filesUnder");c(Bn,"collectAstroStoryboards");c(Bt,"writeChanged");c(Ba,"storyboardEntrypoint");c(Xn,"createAstroStoryboardRegistry")});function qn(t,e){return{name:"tempo:astro-tailwind-sources",enforce:"pre",transform:{order:"pre",handler(r,n){let o=n.split("?")[0];if(!o.endsWith(".css")||o.replaceAll("\\","/").includes("/node_modules/"))return;let i=(0,Jt.relative)(t,o);if(!(i.startsWith("..")||(0,Jt.isAbsolute)(i))&&/@import\s+(?:url\(\s*)?["']tailwindcss(?:\/[\w.-]+)?["']/.test(r))return{code:`${r}
81
+ ${e.map(s=>`@source ${JSON.stringify(s.replaceAll("\\","/"))};`).join(`
82
+ `)}
83
+ `,map:null}}}}}var Jt,Yn=O(()=>{Jt=require("node:path");c(qn,"astroTailwindSources")});async function Zn(t=process.env.TEMPO_SDK_RUNTIME_PATH){if(!t||!(0,$e.isAbsolute)(t))throw new Error("Tempo browser runtime is not provisioned. Set TEMPO_SDK_RUNTIME_PATH to the host's private runtime directory.");let e=JSON.parse(await(0,Ze.readFile)((0,$e.resolve)(t,"runtime.json"),"utf8")),r=e.browser;if(e.tempoRuntimeContract!==1||typeof r?.file!="string"||typeof r?.sha256!="string")throw new Error("Incompatible Tempo browser runtime. Update the host application.");let n=await(0,Ze.realpath)(t),o=await(0,Ze.realpath)((0,$e.resolve)(n,r.file)),i=(0,$e.relative)(n,o);if((0,$e.isAbsolute)(i)||i===".."||i.startsWith("../")||i.startsWith("..\\"))throw new Error("Tempo browser runtime path escapes its directory.");let s=await(0,Ze.readFile)(o,"utf8");if((0,Qn.createHash)("sha256").update(s).digest("hex")!==r.sha256)throw new Error("Tempo browser runtime artifact failed its integrity check.");return s}var Qn,Ze,$e,eo=O(()=>{Qn=require("node:crypto"),Ze=require("node:fs/promises"),$e=require("node:path");c(Zn,"readBrowserRuntimeScript")});function Kt(t){return`${t.replace(/\/$/,"")}${Ja}`}function to(t){let e=Kt(t),r;return async(n,o,i)=>{if(n.url?.split(/[?#]/)[0]!==e)return i();if(o.setHeader("Cache-Control","no-store"),o.setHeader("X-Content-Type-Options","nosniff"),n.method!=="GET"&&n.method!=="HEAD"){o.statusCode=405,o.setHeader("Allow","GET, HEAD"),o.end();return}try{r||(r=await Tr()),o.setHeader("Content-Type","application/javascript; charset=utf-8"),o.end(n.method==="HEAD"?void 0:r)}catch(a){o.statusCode=503,o.setHeader("Content-Type","text/plain; charset=utf-8"),o.end(n.method==="HEAD"?void 0:`Tempo browser runtime unavailable: ${a instanceof Error?a.message:String(a)}`)}}}async function Tr(){return Ka(await Zn())}function Ka(t){return`(() => { const provider = globalThis.__tempoSdkRuntime; if (provider) { if (provider.contract !== 1 || typeof provider.createBrowserRuntime !== "function" || typeof provider.createDocumentRuntime !== "function") throw new Error("Incompatible Tempo browser runtime. Update the host application."); return; }
84
+ ${t}
85
+ })();`}function ro(t){return t.replace(/<\/script/gi,e=>e.replace("/","\\/"))}var Ja,Ir=O(()=>{eo();Ja="/@tempo/browser-runtime.js";c(Kt,"browserRuntimeUrl");c(to,"createBrowserRuntimeMiddleware");c(Tr,"readBrowserRuntimeInstallScript");c(Ka,"browserRuntimeInstallScript");c(ro,"escapeBrowserRuntimeInlineScript")});var Gt,Xt,et,zt,no,qt=O(()=>{"use strict";Gt="/@tempo/server-errors",Xt="\0tempo:server-errors",et="tempo:server-error-state",zt="tempo:subscribe-server-errors",no="__tempoViteServerErrors"});var Pr,Nr=O(()=>{qt();Pr=`
86
+ if (import.meta.hot) {
87
+ const hot = import.meta.hot;
88
+ const feed = globalThis.${no} ??= (() => {
89
+ const listeners = new Set();
90
+ let hasState = false;
91
+ let state;
92
+ return {
93
+ subscribe(listener) {
94
+ listeners.add(listener);
95
+ if (hasState) listener(state);
96
+ return () => listeners.delete(listener);
97
+ },
98
+ publish(next) {
99
+ hasState = true;
100
+ state = next;
101
+ for (const listener of listeners) listener(state);
102
+ },
103
+ };
104
+ })();
105
+ const publish = (state) => feed.publish(state);
106
+ const subscribe = () => hot.send(${JSON.stringify(zt)});
107
+ hot.on(${JSON.stringify(et)}, publish);
108
+ hot.on("vite:ws:connect", subscribe);
109
+ subscribe();
110
+ hot.dispose(() => {
111
+ hot.off(${JSON.stringify(et)}, publish);
112
+ hot.off("vite:ws:connect", subscribe);
113
+ });
114
+ }
115
+ `});function oo(t){if(process.env.TEMPO_MONOREPO_SDK_SOURCE!=="local-prebuilt")return[];let e=(0,mt.resolve)(t??process.cwd(),"node_modules/tempo-sdk");return(0,Mr.existsSync)((0,mt.join)(e,".tempo-prebuilt-source.json"))?["canvas","assets"].flatMap(r=>{let n=(0,mt.join)(e,"dist",r,"index.js");return(0,Mr.existsSync)(n)?[{find:new RegExp(`^tempo-sdk/${r}$`),replacement:n}]:[]}):[]}var Mr,mt,so=O(()=>{Mr=require("node:fs"),mt=require("node:path");c(oo,"localPrebuiltAliases")});function lo(t,e=process.env){let r=e.TEMPO_CANVAS_HOST_ROOT,n=e.TEMPO_CANVAS_SOURCE_ROOT;if(!r||!n||(0,Le.resolve)(t.root??process.cwd())!==(0,Le.resolve)(r))return;let o=[(0,Le.relative)(r,n).replace(/\\/g,"/"),"**/index.canvas.tsx"].filter(Boolean).join("/"),i=t.optimizeDeps?.entries,s=(i===void 0?[]:typeof i=="string"?[i]:i).filter(a=>a.replace(/\\/g,"/").replace(/^\.\//,"")!==o);t.optimizeDeps??={},t.optimizeDeps.entries=[...new Set(["index.html",...s])];for(let a of["tempo-sdk/canvas","tempo-sdk/canvas/interact-projection"])t.optimizeDeps.exclude?.some(l=>a===l||a.startsWith(`${l}/`))||(t.optimizeDeps.include=[...new Set([...t.optimizeDeps.include??[],a])])}function co(t){if(t.optimizeDeps?.entries!==void 0||t.build?.rollupOptions?.input!==void 0)return;let e=(0,Le.resolve)(t.root??process.cwd()),r=(0,Le.join)(e,io,"tempo.config.json");(0,ao.existsSync)(r)&&(t.optimizeDeps??={},t.optimizeDeps.entries=["**/*.html","!**/__tests__/**","!**/coverage/**",`!${io}/**`])}var ao,Le,io,uo=O(()=>{ao=require("node:fs"),Le=require("node:path");c(lo,"applyManagedCanvasDependencyScan");io="tempo";c(co,"excludeTempoHostFromAppDependencyScan")});function tt(t){return t.replace(/[?#].*$/,"")}function Xa(t){return t.length>0&&t[0]===t[0].toLowerCase()}function Or(t,e){for(let r of t.element.openingElement.attributes)if(r.name?.name===e)return!0;return!1}function za(t,e,r,n){return{"data-tempo-filepath":e,"data-tempo-position":t.element.openingElement.start,"data-tempo-source-tag":t.tagName,"data-tempo-modifiedts":r,"data-tempo-source-version":n}}function po(t,e,r,n){let o=JSON.stringify({file:e,modifiedTs:r,sourceVersion:n});return`${t}
116
+ ;typeof window !== "undefined" && (globalThis.__TEMPO_MODULE_VERSIONS__ || (globalThis.__TEMPO_MODULE_VERSIONS__ = [])).push(${o});
117
+ `}function fo(t){let{info:e,filepath:r,modifiedtsMs:n,sourceVersion:o,computeAnnotatedProps:i,elementSupportOverrides:s}=t,a={...i?i(e,r,n,o):za(e,r,n,o),...e.parentType!==void 0&&!Or(e,gr)?{[gr]:un(e.element,e.parentType,e.isStaticJsxChild)}:{}};if(Xa(e.tagName))return{...a,"data-tempo-supports-children":Or(e,"data-tempo-supports-children")?void 0:!Ga.has(e.tagName)};let l=s?.get(e.tagName);return l?{...a,"data-tempo-supports-children":Or(e,"data-tempo-supports-children")?void 0:l.supportsChildren}:a}var Ga,Yt=O(()=>{Mt();Je();Ga=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);c(tt,"cleanModuleId");c(Xa,"isIntrinsicElement");c(Or,"hasJsxAttribute");c(za,"defaultComputeAnnotatedProps");c(po,"appendModuleVersionRecord");c(fo,"computeTempoAnnotatedProps")});function mo(t){let e=t.now??Date.now,r=t.watcherGraceMs??1e3,n=t.maxEmitsPerRevision??3,o=new Map,i=new Map;return{async sweep(){let s=[];for(let[a,l]of t.listServedFiles()){let u=await t.statMtimeMs(a);if(u===null){i.delete(a);continue}let p=o.get(a);if(p===void 0){let y=t.lastHotUpdateMtimeMs?.(a);if(y===void 0||y>=u){o.set(a,u);continue}p=y,o.set(a,y)}if(u>p){if(e()-u<r)continue;o.set(a,u)}else u<p&&o.set(a,u);let d=i.get(a);if(u<=p&&d===void 0)continue;let f=t.lastHotUpdateMtimeMs?.(a),g;if(f!==void 0)g=f>=u;else{g=!1;for(let y of l)if((y.lastInvalidationTimestamp??0)>=u){g=!0;break}}if(g){i.delete(a);continue}let h=d!==void 0&&d.mtimeMs===u?d:{mtimeMs:u,emits:0};i.set(a,h),!(h.emits>=n)&&(h.emits+=1,t.emitChange(a),s.push(a))}return s}}}var go=O(()=>{c(mo,"createMissedChangeSweep")});function ho(t){let e=t?.quietMs??100,r=t?.schedule??setTimeout,n=t?.cancel??clearTimeout,o=new Map,i=c((s,a)=>{s.eventCount<2||(a?.gate&&a.release?(s.gate=a.gate,s.release=a.release,a.release=void 0,a.expiry&&n(a.expiry)):s.gate=new Promise(l=>{s.release=l}),s.expiry=r(()=>s.release?.(),e*2))},"armGate");return{observe(s,a){let l=o.get(s);l?.timer&&n(l.timer);let u={eventCount:(l?.eventCount??0)+1,replay:a};i(u,l),u.timer=r(()=>{if(o.get(s)!==u||(o.delete(s),u.expiry&&n(u.expiry),u.release?.(),u.eventCount<2))return;let p={eventCount:-1,replay:u.replay};p.timer=r(()=>{o.get(s)===p&&o.delete(s)},e),o.set(s,p),u.replay()},e),o.set(s,u)},settled(s){return o.get(s)?.gate??Promise.resolve()},clear(){for(let s of o.values())s.timer&&n(s.timer),s.expiry&&n(s.expiry),s.release?.();o.clear()}}}var yo=O(()=>{c(ho,"createRapidHotUpdateReplay")});function me(t){return tt(t).replace(/^\/@fs\//,"/")}function gt(t){return me(t).replace(/\\/g,"/")}function So(){let t=ho(),e=new Map,r=c(n=>{let o=me(n),i=gt(n);try{e.set(i,(0,$r.statSync)(o).mtimeMs)}catch{e.delete(i)}},"recordCoverage");return{recordCoverage:r,lastHotUpdateMtimeMs(n){return e.get(gt(n))},observeUpdate(n,o){t.observe(gt(o),()=>{n.config.logger.info(`[tempo] replaying settled rapid watcher change: ${o}`,{timestamp:!0}),n.watcher.emit("change",o)})},settled(n){return t.settled(gt(n))},installCoverage(n){for(let o of["change","add","unlink"])n.watcher?.prependListener?.(o,r)},installSweep(n,o={}){let i=n.config.cacheDir?.replace(/\\/g,"/").replace(/\/+$/,""),s=mo({listServedFiles:c(()=>{let u=new Map(n.moduleGraph?.fileToModulesMap??new Map);for(let p of o.listExtraFiles?.()??[]){let d=me(p),f=(0,Fe.isAbsolute)(d)?d:(0,Fe.resolve)(n.config.root,d);u.has(f)||u.set(f,[])}if(i)for(let p of u.keys())p.replace(/\\/g,"/").startsWith(`${i}/`)&&u.delete(p);return qa(n,u),u.entries()},"listServedFiles"),statMtimeMs:c(async u=>{try{return(0,$r.statSync)(u).mtimeMs}catch{return null}},"statMtimeMs"),emitChange:c(u=>{n.config?.logger?.info?.(`[tempo] re-emitting lost watcher change: ${u}`,{timestamp:!0}),n.watcher?.emit?.("change",u)},"emitChange"),lastHotUpdateMtimeMs:c(u=>e.get(gt(u)),"lastHotUpdateMtimeMs")}),a=!1,l=setInterval(()=>{a||(a=!0,s.sweep().then(()=>o.afterSweep?.()).catch(()=>{}).finally(()=>{a=!1}))},o.sweepIntervalMs??ht);l.unref?.(),n.httpServer?.once("close",()=>clearInterval(l))},clear(){t.clear(),e.clear()}}}function qa(t,e){let n=t.watcher?.getWatched?.();if(n)for(let o of[...e.keys()]){let i=n[(0,Fe.dirname)(o)];i&&!i.includes((0,Fe.basename)(o))&&e.delete(o)}}var $r,Fe,ht,yt=O(()=>{$r=require("node:fs"),Fe=require("node:path");Yt();go();yo();ht=3e3;c(me,"fsPathFromModuleId");c(gt,"fileKey");c(So,"createHotUpdateNet");c(qa,"dropUnwatched")});function Qa(t,e){return t.type===e.type&&t.message===e.message&&t.loc?.line===e.loc?.line&&t.loc?.column===e.loc?.column}function Za(t,e){let r=new Map;function n(){if(r.size===0)return null;let s=null;for(let a of r.values())s=a;return s}c(n,"getMostRecentError");function o(){e?.(i.currentError);let s=JSON.stringify(i.currentError);for(let a of i.clients)a.write(`data: ${s}
118
+
119
+ `)}c(o,"broadcastCurrentState");let i={get currentError(){return n()},get errorFiles(){return[...r.keys()].filter(s=>s!=="unknown")},clients:new Set,setError(s){let a=s.file??s.loc?.file??"unknown",l=r.get(a);l&&Qa(l,s)||(a!=="unknown"&&!l&&t?.(a),r.delete(a),r.set(a,s),o())},clearErrorForModules(s){if(r.size===0)return;let a=!1;for(let l of[...r.keys()])l!=="unknown"&&s.some(u=>bo(l,u))&&(r.delete(l),a=!0);a&&o()},clearAll(){r.clear(),o()}};return i}function bo(t,e){let r=c(n=>tt(n).replace(/^file:\/\//,"").replace(/^\/@fs\//,"/").replace(/\\/g,"/").replace(/^\/+/,""),"normalize");return r(t)===r(e)}function Eo(t={}){let e,r=Za(t.onErrorFile,l=>e?.ws.send(et,l)),n=c(l=>l.replace(/\\/g,"/"),"normalizedFileKey"),o=c(l=>r.errorFiles.some(u=>bo(u,l)),"hasActiveCompileError"),i=c(async(l,u)=>{if(!o(u))return!1;let p=me(u),d=`/@fs/${p.replace(/^\/+/,"")}`,f=l.environments?.client,g=f??l;try{let h=(0,St.readFileSync)(p,"utf8"),y=/\.canvas\.[cm]?[jt]sx?$/.test(p),x=c(k=>{let L=(0,vo.parseSync)(p,k);return!L.errors.length&&L.program.body.some(M=>M.type==="ExportDefaultDeclaration"||M.type==="ExportNamedDeclaration"&&M.exportKind!=="type"&&M.specifiers.some(W=>W.exportKind!=="type"&&(W.exported.type==="Identifier"?W.exported.name:W.exported.value)==="default"))},"hasDefault");if(y&&!x(h))return!1;let E=p;try{E=(0,St.realpathSync)(p)}catch{}let w=new Set([...g.moduleGraph.getModulesByFile(E)??[],...g.moduleGraph.getModulesByFile(p)??[]]);for(let k of w)g.moduleGraph.invalidateModule(k);let C=await g.transformRequest(d);if(!C||(0,St.readFileSync)(p,"utf8")!==h||y&&(typeof C!="object"||!("code"in C)||typeof C.code!="string"||!x(C.code)))return!1}catch{return!1}return r.clearErrorForModules([u,p,d]),l.config.logger.info(`[tempo] recovered compile-error module after validated transform: ${p}`,{timestamp:!0}),(f?.hot??l.ws).send({type:"full-reload",path:"*"}),!0},"recoverActiveCompileError"),s=new Map;return{errorServer:r,attach(l){e=l,l.ws.on?.(zt,(u,p)=>{p.send(et,r.currentError)})},handleRequest(l,u){let p=l.url;return p==="/__tempo/report-error"&&l.method==="POST"?(tl(l).then(d=>{try{r.setError(JSON.parse(d))}catch{}u.statusCode=200,u.end("ok")}),!0):p==="/__tempo/report-clear"&&l.method==="POST"?(r.clearAll(),u.statusCode=200,u.end("ok"),!0):p==="/__tempo/errors"&&l.method==="OPTIONS"?(u.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, OPTIONS","Access-Control-Allow-Headers":"*"}),u.end(),!0):p==="/__tempo/errors"&&l.method==="GET"?(u.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}),u.write(`data: ${JSON.stringify(r.currentError)}
120
+
121
+ `),r.clients.add(u),l.on("close",()=>{r.clients.delete(u)}),!0):!1},recordHmrError(l){r.setError({type:"compile",message:l?.message??"Unknown error",stack:l?.stack,file:l?.id??l?.loc?.file,frame:l?.frame,plugin:l?.plugin,loc:l?.loc})},hasActiveCompileError:o,recover:i,pollRecovery:c(async l=>{let u=new Map(r.errorFiles.map(d=>[n(me(d)),d]));for(let d of[...s.keys()])u.has(d)||s.delete(d);let p=Date.now();for(let[d,f]of u){let g=s.get(d);if(g&&p<g.nextAttemptAtMs)continue;if(await i(l,f)){s.delete(d);continue}let h=g?.intervalMs??Ya;s.set(d,{nextAttemptAtMs:p+h,intervalMs:Math.min(h*2,el)})}},"pollCompileErrorRecovery"),reset(){s.clear()}}}function tl(t){return new Promise((e,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>e(Buffer.concat(n).toString())),t.on("error",r)})}var St,vo,Ya,el,wo=O(()=>{Nr();St=require("node:fs"),vo=require("oxc-parser");Yt();yt();qt();Ya=ht;c(Qa,"isSameError");c(Za,"createErrorServer");c(bo,"moduleIdsMatch");el=3e4;c(Eo,"createCompileErrorStream");c(tl,"readBody")});function Qt(t){return t.trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"")}var Lr,Fr,xo=O(()=>{"use strict";Lr="/__tempo/canvas-host-registration",Fr="x-tempo-canvas-host-registration";c(Qt,"normalizeCanvasRegistrationPath")});async function Ao(t,e){let r=performance.now(),n=!1,o=setTimeout(()=>{n=!0,e("pending",Math.round(performance.now()-r))},5e3),i=c(s=>{let a=Math.round(performance.now()-r);(n||a>=5e3)&&e(s,a)},"settled");try{let s=await t();return i("ready"),s}catch(s){throw i("error"),s}finally{clearTimeout(o)}}function _o(){let t=new Map;return c(async function(r,n){let o=(0,Co.readFileSync)(r,"utf8"),i=t.get(r);if(i?.source===o&&(i.pending||i.current()))return i.result;let s={source:o,pending:!0,current:c(()=>!1,"current"),result:Promise.resolve()};return t.set(r,s),s.result=Promise.resolve().then(async()=>{s.current=await n(),s.pending=!1}).catch(a=>{throw t.get(r)===s&&t.delete(r),a}),s.result},"confirm")}async function Ro(t,e,r,n=1e3){if(!r)return await t,null;let o;try{return await Promise.race([t.then(()=>null),new Promise(i=>{o=setTimeout(()=>i(e()),n)})])}finally{clearTimeout(o)}}var Co,ko=O(()=>{Co=require("node:fs");c(Ao,"traceSlowRegistration");c(_o,"createRegistrationTransforms");c(Ro,"registrationReply")});function Po(t){let e=new Set,r=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")/g;for(let n of t.matchAll(r))try{let o=JSON.parse(n[1]??"");if(typeof o!="string")continue;let i=Qt(o);i&&e.add(i)}catch{}return[...e]}async function nl(t,e){let r=(0,vt.resolve)(t.config.root,".tempo","tempo-host.tsx"),n;try{n=(0,Ue.readFileSync)(r,"utf8")}catch(u){throw new Error(`Canvas host wrapper is unavailable at ${r}: ${u instanceof Error?u.message:String(u)}`)}if(!Po(n).includes(e))throw Object.assign(new Error(`Generated canvas host wrapper does not contain ${JSON.stringify(e)}`),{statusCode:409});let i=(0,Ue.realpathSync)(r),s=/\bcanvasPath:\s*("(?:\\.|[^"\\])*")\s*,\s*load:\s*\(\)\s*=>\s*import\(\s*("(?:\\.|[^"\\])*")\s*\)/g,a,l=t.environments?.client??t;for(let u of n.matchAll(s)){if(Qt(JSON.parse(u[1]))!==e)continue;let p=await l.pluginContainer.resolveId(JSON.parse(u[2]),r);if(!p)throw new Error(`Cannot resolve canvas ${e}`);let d=me(p.id),f=`/@fs/${d.replace(/^\/+/,"")}`;a=`${ol(t)}${f.slice(1)}`,await To(t,l,(0,Ue.realpathSync)(d),d,f);break}return await To(t,l,i,r),n.includes("tempo-incremental-canvas-registration")?a:void 0}function ol(t){let e=t.config.base||"/",r=e.startsWith("/")?e:new URL(e,"http://tempo.invalid").pathname;return r.endsWith("/")?r:`${r}/`}function No(t){let e=t.environments?.client?.depsOptimizer;return{status:"compiling",phase:e?.scanProcessing?"scanning":Object.values(e?.metadata.discovered??{}).some(n=>n.processing)?"bundling":"transforming",progress:Zt.get(t)??0}}async function To(t,e,r,n,o=rl){let i=Dr.get(e);i||(i=_o(),Dr.set(e,i)),await i(r,()=>Ao(async()=>{let s=c(()=>e.moduleGraph.getModulesByFile(r)??e.moduleGraph.getModulesByFile(n),"modules");for(let p of s()??[])e.moduleGraph.invalidateModule(p);if(!await e.transformRequest(o))throw new Error(`Vite did not transform ${o} after registration`);await e.waitForRequestsIdle?.();let l=t.environments?.client?.depsOptimizer;await l?.scanProcessing,await Promise.all(Object.values(l?.metadata.discovered??{}).map(p=>p.processing)),l&&await e.transformRequest(o);let u=[...s()??[]].map(p=>[p,p.transformResult]);return()=>u.length>0&&u.every(([p,d])=>d!=null&&s()?.has(p)&&p.transformResult===d)},(s,a)=>{t.config.logger.info(`[tempo] canvas registration ${JSON.stringify({...No(t),status:s,module:(0,vt.relative)(t.config.root,r),elapsedMs:a})}`)}))}function Io(t){t.setHeader("Access-Control-Allow-Origin","*"),t.setHeader("Access-Control-Expose-Headers",Fr),t.setHeader(Fr,"1")}function Mo(t,e){if(t.replace(/\\/g,"/")!==e.replace(/\\/g,"/"))return!1;try{return(0,Ue.readFileSync)(t,"utf8").includes("tempo-incremental-canvas-registration")}catch{return!1}}function Oo(t,e,r,n){let o=(0,vt.relative)(e.sourceRoot,t).replace(/\\/g,"/"),i;try{i=(0,Ue.readFileSync)(e.wrapperPath,"utf8")}catch{return}if(!Po(i).includes(o))return;let s=r.getModulesByFile(e.wrapperPath);if(s?.size){for(let a of s)r.invalidateModule(a);return[...new Set([...n,...s])]}}function $o(t){Zt.set(t,0),Dr.delete(t.environments?.client??t)}function Lo(t){Zt.set(t,(Zt.get(t)??0)+1)}function Fo(t,e,r){let n=e.url;return n===Lr&&e.method==="OPTIONS"?(Io(r),r.writeHead(204,{"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"content-type"}),r.end(),!0):n===Lr&&e.method==="POST"?(Io(r),sl(e).then(async o=>{let i=JSON.parse(o),s=typeof i.canvasPath=="string"?Qt(i.canvasPath):"";if(!s)throw Object.assign(new Error("canvasPath must be a non-empty string"),{statusCode:400});let a,l=await Ro(nl(t,s).then(u=>{a=u}),()=>No(t),i.poll===!0);r.statusCode=l?202:200,r.setHeader("Content-Type","application/json"),r.setHeader("Cache-Control","no-store"),r.end(JSON.stringify(l??{canvasPath:s,...a?{moduleUrl:a}:{}}))}).catch(o=>{r.statusCode=typeof o=="object"&&o!==null&&"statusCode"in o&&typeof o.statusCode=="number"?o.statusCode:500,r.setHeader("Content-Type","text/plain; charset=utf-8"),r.end(o instanceof Error?o.message:String(o))}),!0):!1}function sl(t){return new Promise((e,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>e(Buffer.concat(n).toString())),t.on("error",r)})}var Ue,vt,rl,Dr,Zt,Do=O(()=>{Ue=require("node:fs"),vt=require("node:path");xo();ko();yt();rl="/.tempo/tempo-host";c(Po,"readGeneratedCanvasPaths");c(nl,"synchronizeCanvasHostRegistrationTransform");c(ol,"viteBasePath");Dr=new WeakMap,Zt=new WeakMap;c(No,"registrationProgress");c(To,"retransformCanvasHostWrapper");c(Io,"writeCanvasRegistrationResponseHeaders");c(Mo,"isIncrementalWrapperFile");c(Oo,"withRegisteredCanvasLoader");c($o,"resetCanvasHostRegistration");c(Lo,"noteCanvasHostRegistrationActivity");c(Fo,"handleCanvasHostRegistrationRequest");c(sl,"readBody")});var Ho=O(()=>{});var bt=Be((Kp,Bo)=>{"use strict";var jo="[^\\\\/]",il="(?=.)",Uo="[^/]",Hr="(?:\\/|$)",Vo="(?:^|\\/)",jr=`\\.{1,2}${Hr}`,al="(?!\\.)",ll=`(?!${Vo}${jr})`,cl=`(?!\\.{0,1}${Hr})`,ul=`(?!${jr})`,pl="[^.\\/]",dl=`${Uo}*?`,fl="/",Wo={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:il,QMARK:Uo,END_ANCHOR:Hr,DOTS_SLASH:jr,NO_DOT:al,NO_DOTS:ll,NO_DOT_SLASH:cl,NO_DOTS_SLASH:ul,QMARK_NO_DOT:pl,STAR:dl,START_ANCHOR:Vo,SEP:fl},ml={...Wo,SLASH_LITERAL:"[\\\\/]",QMARK:jo,STAR:`${jo}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},gl={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Bo.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:gl,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?ml:Wo}}});var Et=Be(se=>{"use strict";var{REGEX_BACKSLASH:hl,REGEX_REMOVE_BACKSLASH:yl,REGEX_SPECIAL_CHARS:Sl,REGEX_SPECIAL_CHARS_GLOBAL:vl}=bt();se.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);se.hasRegexChars=t=>Sl.test(t);se.isRegexChar=t=>t.length===1&&se.hasRegexChars(t);se.escapeRegex=t=>t.replace(vl,"\\$1");se.toPosixSlashes=t=>t.replace(hl,"/");se.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};se.removeBackslashes=t=>t.replace(yl,e=>e==="\\"?"":e);se.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?se.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};se.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};se.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};se.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var Qo=Be((Xp,Yo)=>{"use strict";var Jo=Et(),{CHAR_ASTERISK:Ur,CHAR_AT:bl,CHAR_BACKWARD_SLASH:rt,CHAR_COMMA:El,CHAR_DOT:Vr,CHAR_EXCLAMATION_MARK:Wr,CHAR_FORWARD_SLASH:qo,CHAR_LEFT_CURLY_BRACE:Br,CHAR_LEFT_PARENTHESES:er,CHAR_LEFT_SQUARE_BRACKET:wl,CHAR_PLUS:xl,CHAR_QUESTION_MARK:Ko,CHAR_RIGHT_CURLY_BRACE:Cl,CHAR_RIGHT_PARENTHESES:Go,CHAR_RIGHT_SQUARE_BRACKET:Al}=bt(),Xo=c(t=>t===qo||t===rt,"isPathSeparator"),zo=c(t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},"depth"),_l=c((t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.tokens===!0||r.scanToEnd===!0,i=[],s=[],a=[],l=t,u=-1,p=0,d=0,f=!1,g=!1,h=!1,y=!1,x=!1,E=!1,w=!1,C=!1,k=!1,L=!1,M=0,W,P,$={value:"",depth:0,isGlob:!1},S=c(()=>u>=n,"eos"),z=c(()=>l.charCodeAt(u+1),"peek"),F=c(()=>(W=P,l.charCodeAt(++u)),"advance");for(;u<n;){P=F();let B;if(P===rt){w=$.backslashes=!0,P=F(),P===Br&&(E=!0);continue}if(E===!0||P===Br){for(M++;S()!==!0&&(P=F());){if(P===rt){w=$.backslashes=!0,F();continue}if(P===Br){M++;continue}if(E!==!0&&P===Vr&&(P=F())===Vr){if(f=$.isBrace=!0,h=$.isGlob=!0,L=!0,o===!0)continue;break}if(E!==!0&&P===El){if(f=$.isBrace=!0,h=$.isGlob=!0,L=!0,o===!0)continue;break}if(P===Cl&&(M--,M===0)){E=!1,f=$.isBrace=!0,L=!0;break}}if(o===!0)continue;break}if(P===qo){if(i.push(u),s.push($),$={value:"",depth:0,isGlob:!1},L===!0)continue;if(W===Vr&&u===p+1){p+=2;continue}d=u+1;continue}if(r.noext!==!0&&(P===xl||P===bl||P===Ur||P===Ko||P===Wr)===!0&&z()===er){if(h=$.isGlob=!0,y=$.isExtglob=!0,L=!0,P===Wr&&u===p&&(k=!0),o===!0){let Z=0;for(;S()!==!0&&(P=F());){if(P===rt){w=$.backslashes=!0,F();continue}if(P===er){Z++;continue}if(P===Go&&--Z===0){L=!0;break}}continue}break}if(P===Ur){if(W===Ur&&(x=$.isGlobstar=!0),h=$.isGlob=!0,L=!0,o===!0)continue;break}if(P===Ko){if(h=$.isGlob=!0,L=!0,o===!0)continue;break}if(P===wl){for(;S()!==!0&&(B=F());){if(B===rt){w=$.backslashes=!0,F();continue}if(B===Al){g=$.isBracket=!0,h=$.isGlob=!0,L=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&P===Wr&&u===p){C=$.negated=!0,p++;continue}if(r.noparen!==!0&&P===er){if(h=$.isGlob=!0,o===!0){let Q=1;for(;S()!==!0&&(P=F());){if(P===rt){w=$.backslashes=!0,F();continue}if(P===er){Q++;continue}if(P===Go&&--Q===0){L=!0;break}}continue}break}if(h===!0){if(L=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,h=!1);let D=l,v="",b="";p>0&&(v=l.slice(0,p),l=l.slice(p),d-=p),D&&h===!0&&d>0?(D=l.slice(0,d),b=l.slice(d)):h===!0?(D="",b=l):D=l,D&&D!==""&&D!=="/"&&D!==l&&Xo(D.charCodeAt(D.length-1))&&(D=D.slice(0,-1)),r.unescape===!0&&(b&&(b=Jo.removeBackslashes(b)),D&&w===!0&&(D=Jo.removeBackslashes(D)));let te={prefix:v,input:t,start:p,base:D,glob:b,isBrace:f,isBracket:g,isGlob:h,isExtglob:y,isGlobstar:x,negated:C,negatedExtglob:k};if(r.tokens===!0&&(te.maxDepth=0,Xo(P)||s.push($),te.tokens=s),r.parts===!0||r.tokens===!0){let B;for(let X=0;X<i.length;X++){let Se=B!==void 0?B+1:p,Me=i[X],be=t.slice(Se,Me);r.tokens&&(X===0&&p!==0?(s[X].isPrefix=!0,s[X].value=v):s[X].value=be,zo(s[X]),te.maxDepth+=s[X].depth),Me>=p&&(a.push(be),B=Me)}let Q=B!==void 0?B+1:p,Z=t.slice(Q);a.push(Z),r.tokens&&B&&B+1<t.length&&(s[s.length-1].value=Z,zo(s[s.length-1]),te.maxDepth+=s[s.length-1].depth),te.slashes=i,te.parts=a}return te},"scan");Yo.exports=_l});var rs=Be((qp,ts)=>{"use strict";var wt=bt(),ue=Et(),{MAX_LENGTH:tr,POSIX_REGEX_SOURCE:Rl,REGEX_NON_SPECIAL_CHARS:kl,REGEX_SPECIAL_CHARS_BACKREF:Tl,REPLACEMENTS:Zo}=wt,Il=c((t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>ue.escapeRegex(o)).join("..")}return r},"expandRange"),nt=c((t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,"syntaxError"),es=c(t=>{let e=[],r=0,n=0,o=0,i="",s=!1;for(let a of t){if(s===!0){i+=a,s=!1;continue}if(a==="\\"){i+=a,s=!0;continue}if(a==='"'){o=o===1?0:1,i+=a;continue}if(o===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(i),i="";continue}}}i+=a}return e.push(i),e},"splitTopLevel"),Pl=c(t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},"isPlainBranch"),Kr=c(t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(Pl(e))return e.replace(/\\(.)/g,"$1")},"normalizeSimpleBranch"),Nl=c(t=>{let e=t.map(Kr).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let o=e[r],i=e[n],s=o[0];if(!(!s||o!==s.repeat(o.length)||i!==s.repeat(i.length))&&(o===i||o.startsWith(i)||i.startsWith(o)))return!0}return!1},"hasRepeatedCharPrefixOverlap"),Jr=c((t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,o=0,i=!1;for(let s=1;s<t.length;s++){let a=t[s];if(i===!0){i=!1;continue}if(a==="\\"){i=!0;continue}if(a==='"'){o=o===1?0:1;continue}if(o!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&s!==t.length-1?void 0:{type:t[0],body:t.slice(2,s),end:s}}}}},"parseRepeatedExtglob"),Ml=c(t=>`${t.length===1?ue.escapeRegex(t[0]):`[${t.map(r=>ue.escapeRegex(r)).join("")}]`}*`,"buildCharClassStar"),Ol=c(t=>{let e=0,r=[];for(;e<t.length;){let n=Jr(t.slice(e),!1);if(!n||n.type!=="*")return;let o=es(n.body).map(s=>s.trim());if(o.length!==1)return;let i=Kr(o[0]);if(!i||i.length!==1)return;r.push(i),e+=n.end+1}if(!(r.length<1))return r},"getStarExtglobSequenceChars"),$l=c(t=>{let e=0,r=t.trim(),n=Jr(r);for(;n;)e++,r=n.body.trim(),n=Jr(r);return e},"repeatedExtglobRecursion"),Ll=c((t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:wt.DEFAULT_MAX_EXTGLOB_RECURSION,n=es(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||Nl(n)))return{risky:!0};let o=[],i=!1,s=!0;for(let a of n){let l=Ol(a);if(l){i=!0,o.push(...l);continue}let u=Kr(a);if(u&&u.length===1){o.push(u);continue}if(s=!1,$l(a)>r)return{risky:!0}}return i?s?{risky:!0,safeOutput:Ml([...new Set(o)])}:{risky:!0}:{risky:!1}},"analyzeRepeatedExtglob"),Gr=c((t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Zo[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(tr,r.maxLength):tr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},s=[i],a=r.capture?"":"?:",l=wt.globChars(r.windows),u=wt.extglobChars(l),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:g,DOTS_SLASH:h,NO_DOT:y,NO_DOT_SLASH:x,NO_DOTS_SLASH:E,QMARK:w,QMARK_NO_DOT:C,STAR:k,START_ANCHOR:L}=l,M=c(R=>`(${a}(?:(?!${L}${R.dot?h:p}).)*?)`,"globstar"),W=r.dot?"":y,P=r.dot?w:C,$=r.bash===!0?M(r):k;r.capture&&($=`(${$})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let S={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ue.removePrefix(t,S),o=t.length;let z=[],F=[],D=[],v=i,b,te=c(()=>S.index===o-1,"eos"),B=S.peek=(R=1)=>t[S.index+R],Q=S.advance=()=>t[++S.index]||"",Z=c(()=>t.slice(S.index+1),"remaining"),X=c((R="",J=0)=>{S.consumed+=R,S.index+=J},"consume"),Se=c(R=>{S.output+=R.output!=null?R.output:R.value,X(R.value)},"append"),Me=c(()=>{let R=1;for(;B()==="!"&&(B(2)!=="("||B(3)==="?");)Q(),S.start++,R++;return R%2===0?!1:(S.negated=!0,S.start++,!0)},"negate"),be=c(R=>{S[R]++,D.push(R)},"increment"),le=c(R=>{S[R]--,D.pop()},"decrement"),H=c(R=>{if(v.type==="globstar"){let J=S.braces>0&&(R.type==="comma"||R.type==="brace"),_=R.extglob===!0||z.length&&(R.type==="pipe"||R.type==="paren");R.type!=="slash"&&R.type!=="paren"&&!J&&!_&&(S.output=S.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=$,S.output+=v.output)}if(z.length&&R.type!=="paren"&&(z[z.length-1].inner+=R.value),(R.value||R.output)&&Se(R),v&&v.type==="text"&&R.type==="text"){v.output=(v.output||v.value)+R.value,v.value+=R.value;return}R.prev=v,s.push(R),v=R},"push"),We=c((R,J)=>{let _={...u[J],conditions:1,inner:""};_.prev=v,_.parens=S.parens,_.output=S.output,_.startIndex=S.index,_.tokensIndex=s.length;let j=(r.capture?"(":"")+_.open;be("parens"),H({type:R,value:J,output:S.output?"":g}),H({type:"paren",extglob:!0,value:Q(),output:j}),z.push(_)},"extglobOpen"),ur=c(R=>{let J=t.slice(R.startIndex,S.index+1),_=t.slice(R.startIndex+2,S.index),j=Ll(_,r);if((R.type==="plus"||R.type==="star")&&j.risky){let T=j.safeOutput?(R.output?"":g)+(r.capture?`(${j.safeOutput})`:j.safeOutput):void 0,I=s[R.tokensIndex];I.type="text",I.value=J,I.output=T||ue.escapeRegex(J);for(let U=R.tokensIndex+1;U<s.length;U++)s[U].value="",s[U].output="",delete s[U].suffix;S.output=R.output+I.output,S.backtrack=!0,H({type:"paren",extglob:!0,value:b,output:""}),le("parens");return}let m=R.close+(r.capture?")":""),A;if(R.type==="negate"){let T=$;if(R.inner&&R.inner.length>1&&R.inner.includes("/")&&(T=M(r)),(T!==$||te()||/^\)+$/.test(Z()))&&(m=R.close=`)$))${T}`),R.inner.includes("*")&&(A=Z())&&/^\.[^\\/.]+$/.test(A)){let I=Gr(A,{...e,fastpaths:!1}).output;m=R.close=`)${I})${T})`}R.prev.type==="bos"&&(S.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:b,output:m}),le("parens")},"extglobClose");if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let R=!1,J=t.replace(Tl,(_,j,m,A,T,I)=>A==="\\"?(R=!0,_):A==="?"?j?j+A+(T?w.repeat(T.length):""):I===0?P+(T?w.repeat(T.length):""):w.repeat(m.length):A==="."?p.repeat(m.length):A==="*"?j?j+A+(T?$:""):$:j?_:`\\${_}`);return R===!0&&(r.unescape===!0?J=J.replace(/\\/g,""):J=J.replace(/\\+/g,_=>_.length%2===0?"\\\\":_?"\\":"")),J===t&&r.contains===!0?(S.output=t,S):(S.output=ue.wrapOutput(J,S,e),S)}for(;!te();){if(b=Q(),b==="\0")continue;if(b==="\\"){let _=B();if(_==="/"&&r.bash!==!0||_==="."||_===";")continue;if(!_){b+="\\",H({type:"text",value:b});continue}let j=/^\\+/.exec(Z()),m=0;if(j&&j[0].length>2&&(m=j[0].length,S.index+=m,m%2!==0&&(b+="\\")),r.unescape===!0?b=Q():b+=Q(),S.brackets===0){H({type:"text",value:b});continue}}if(S.brackets>0&&(b!=="]"||v.value==="["||v.value==="[^")){if(r.posix!==!1&&b===":"){let _=v.value.slice(1);if(_.includes("[")&&(v.posix=!0,_.includes(":"))){let j=v.value.lastIndexOf("["),m=v.value.slice(0,j),A=v.value.slice(j+2),T=Rl[A];if(T){v.value=m+T,S.backtrack=!0,Q(),!i.output&&s.indexOf(v)===1&&(i.output=g);continue}}}(b==="["&&B()!==":"||b==="-"&&B()==="]")&&(b=`\\${b}`),b==="]"&&(v.value==="["||v.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&v.value==="["&&(b="^"),v.value+=b,Se({value:b});continue}if(S.quotes===1&&b!=='"'){b=ue.escapeRegex(b),v.value+=b,Se({value:b});continue}if(b==='"'){S.quotes=S.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:b});continue}if(b==="("){be("parens"),H({type:"paren",value:b});continue}if(b===")"){if(S.parens===0&&r.strictBrackets===!0)throw new SyntaxError(nt("opening","("));let _=z[z.length-1];if(_&&S.parens===_.parens+1){ur(z.pop());continue}H({type:"paren",value:b,output:S.parens?")":"\\)"}),le("parens");continue}if(b==="["){if(r.nobracket===!0||!Z().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(nt("closing","]"));b=`\\${b}`}else be("brackets");H({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){H({type:"text",value:b,output:`\\${b}`});continue}if(S.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(nt("opening","["));H({type:"text",value:b,output:`\\${b}`});continue}le("brackets");let _=v.value.slice(1);if(v.posix!==!0&&_[0]==="^"&&!_.includes("/")&&(b=`/${b}`),v.value+=b,Se({value:b}),r.literalBrackets===!1||ue.hasRegexChars(_))continue;let j=ue.escapeRegex(v.value);if(S.output=S.output.slice(0,-v.value.length),r.literalBrackets===!0){S.output+=j,v.value=j;continue}v.value=`(${a}${j}|${v.value})`,S.output+=v.value;continue}if(b==="{"&&r.nobrace!==!0){be("braces");let _={type:"brace",value:b,output:"(",outputIndex:S.output.length,tokensIndex:S.tokens.length};F.push(_),H(_);continue}if(b==="}"){let _=F[F.length-1];if(r.nobrace===!0||!_){H({type:"text",value:b,output:b});continue}let j=")";if(_.dots===!0){let m=s.slice(),A=[];for(let T=m.length-1;T>=0&&(s.pop(),m[T].type!=="brace");T--)m[T].type!=="dots"&&A.unshift(m[T].value);j=Il(A,r),S.backtrack=!0}if(_.comma!==!0&&_.dots!==!0){let m=S.output.slice(0,_.outputIndex),A=S.tokens.slice(_.tokensIndex);_.value=_.output="\\{",b=j="\\}",S.output=m;for(let T of A)S.output+=T.output||T.value}H({type:"brace",value:b,output:j}),le("braces"),F.pop();continue}if(b==="|"){z.length>0&&z[z.length-1].conditions++,H({type:"text",value:b});continue}if(b===","){let _=b,j=F[F.length-1];j&&D[D.length-1]==="braces"&&(j.comma=!0,_="|"),H({type:"comma",value:b,output:_});continue}if(b==="/"){if(v.type==="dot"&&S.index===S.start+1){S.start=S.index+1,S.consumed="",S.output="",s.pop(),v=i;continue}H({type:"slash",value:b,output:f});continue}if(b==="."){if(S.braces>0&&v.type==="dot"){v.value==="."&&(v.output=p);let _=F[F.length-1];v.type="dots",v.output+=b,v.value+=b,_.dots=!0;continue}if(S.braces+S.parens===0&&v.type!=="bos"&&v.type!=="slash"){H({type:"text",value:b,output:p});continue}H({type:"dot",value:b,output:p});continue}if(b==="?"){if(!(v&&v.value==="(")&&r.noextglob!==!0&&B()==="("&&B(2)!=="?"){We("qmark",b);continue}if(v&&v.type==="paren"){let j=B(),m=b;(v.value==="("&&!/[!=<:]/.test(j)||j==="<"&&!/<([!=]|\w+>)/.test(Z()))&&(m=`\\${b}`),H({type:"text",value:b,output:m});continue}if(r.dot!==!0&&(v.type==="slash"||v.type==="bos")){H({type:"qmark",value:b,output:C});continue}H({type:"qmark",value:b,output:w});continue}if(b==="!"){if(r.noextglob!==!0&&B()==="("&&(B(2)!=="?"||!/[!=<:]/.test(B(3)))){We("negate",b);continue}if(r.nonegate!==!0&&S.index===0){Me();continue}}if(b==="+"){if(r.noextglob!==!0&&B()==="("&&B(2)!=="?"){We("plus",b);continue}if(v&&v.value==="("||r.regex===!1){H({type:"plus",value:b,output:d});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||S.parens>0){H({type:"plus",value:b});continue}H({type:"plus",value:d});continue}if(b==="@"){if(r.noextglob!==!0&&B()==="("&&B(2)!=="?"){H({type:"at",extglob:!0,value:b,output:""});continue}H({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let _=kl.exec(Z());_&&(b+=_[0],S.index+=_[0].length),H({type:"text",value:b});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=b,v.output=$,S.backtrack=!0,S.globstar=!0,X(b);continue}let R=Z();if(r.noextglob!==!0&&/^\([^?]/.test(R)){We("star",b);continue}if(v.type==="star"){if(r.noglobstar===!0){X(b);continue}let _=v.prev,j=_.prev,m=_.type==="slash"||_.type==="bos",A=j&&(j.type==="star"||j.type==="globstar");if(r.bash===!0&&(!m||R[0]&&R[0]!=="/")){H({type:"star",value:b,output:""});continue}let T=S.braces>0&&(_.type==="comma"||_.type==="brace"),I=z.length&&(_.type==="pipe"||_.type==="paren");if(!m&&_.type!=="paren"&&!T&&!I){H({type:"star",value:b,output:""});continue}for(;R.slice(0,3)==="/**";){let q=t[S.index+4];if(q&&q!=="/")break;R=R.slice(3),X("/**",3)}let U=te()||S.parens>0&&R===")".repeat(S.parens)&&!z.some(q=>q.type==="negate");if(_.type==="bos"&&te()){v.type="globstar",v.value+=b,v.output=M(r),S.output=v.output,S.globstar=!0,X(b);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&!A&&U){S.output=S.output.slice(0,-(_.output+v.output).length),_.output=`(?:${_.output}`,v.type="globstar",v.output=M(r)+(r.strictSlashes?")":"|$)"),v.value+=b,S.globstar=!0,S.output+=_.output+v.output,X(b);continue}if(_.type==="slash"&&_.prev.type!=="bos"&&R[0]==="/"){let q=R[1]!==void 0?"|$":"";S.output=S.output.slice(0,-(_.output+v.output).length),_.output=`(?:${_.output}`,v.type="globstar",v.output=`${M(r)}${f}|${f}${q})`,v.value+=b,S.output+=_.output+v.output,S.globstar=!0,X(b+Q()),H({type:"slash",value:"/",output:""});continue}if(_.type==="bos"&&R[0]==="/"){v.type="globstar",v.value+=b,v.output=`(?:^|${f}|${M(r)}${f})`,S.output=v.output,S.globstar=!0,X(b+Q()),H({type:"slash",value:"/",output:""});continue}S.output=S.output.slice(0,-v.output.length),v.type="globstar",v.output=M(r),v.value+=b,S.output+=v.output,S.globstar=!0,X(b);continue}let J={type:"star",value:b,output:$};if(r.bash===!0){J.output=".*?",(v.type==="bos"||v.type==="slash")&&(J.output=W+J.output),H(J);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&r.regex===!0){J.output=b,H(J);continue}(S.index===S.start||v.type==="slash"||v.type==="dot")&&(v.type==="dot"?(S.output+=x,v.output+=x):r.dot===!0?(S.output+=E,v.output+=E):(S.output+=W,v.output+=W),B()!=="*"&&(S.output+=g,v.output+=g)),H(J)}for(;S.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing","]"));S.output=ue.escapeLast(S.output,"["),le("brackets")}for(;S.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing",")"));S.output=ue.escapeLast(S.output,"("),le("parens")}for(;S.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(nt("closing","}"));S.output=ue.escapeLast(S.output,"{"),le("braces")}if(r.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${f}?`}),S.backtrack===!0){S.output="";for(let R of S.tokens)S.output+=R.output!=null?R.output:R.value,R.suffix&&(S.output+=R.suffix)}return S},"parse");Gr.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(tr,r.maxLength):tr,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=Zo[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:s,ONE_CHAR:a,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:g}=wt.globChars(r.windows),h=r.dot?p:u,y=r.dot?d:u,x=r.capture?"":"?:",E={negated:!1,prefix:""},w=r.bash===!0?".*?":f;r.capture&&(w=`(${w})`);let C=c(W=>W.noglobstar===!0?w:`(${x}(?:(?!${g}${W.dot?l:i}).)*?)`,"globstar"),k=c(W=>{switch(W){case"*":return`${h}${a}${w}`;case".*":return`${i}${a}${w}`;case"*.*":return`${h}${w}${i}${a}${w}`;case"*/*":return`${h}${w}${s}${a}${y}${w}`;case"**":return h+C(r);case"**/*":return`(?:${h}${C(r)}${s})?${y}${a}${w}`;case"**/*.*":return`(?:${h}${C(r)}${s})?${y}${w}${i}${a}${w}`;case"**/.*":return`(?:${h}${C(r)}${s})?${i}${a}${w}`;default:{let P=/^(.*?)\.(\w+)$/.exec(W);if(!P)return;let $=k(P[1]);return $?$+i+P[2]:void 0}}},"create"),L=ue.removePrefix(t,E),M=k(L);return M&&r.strictSlashes!==!0&&(M+=`${s}?`),M};ts.exports=Gr});var ss=Be((Qp,os)=>{"use strict";var Fl=Qo(),Xr=rs(),ns=Et(),Dl=bt(),Hl=c(t=>t&&typeof t=="object"&&!Array.isArray(t),"isObject"),Y=c((t,e,r=!1)=>{if(Array.isArray(t)){let p=t.map(f=>Y(f,e,r));return c(f=>{for(let g of p){let h=g(f);if(h)return h}return!1},"arrayMatcher")}let n=Hl(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=o.windows,s=n?Y.compileRe(t,e):Y.makeRe(t,e,!1,!0),a=s.state;delete s.state;let l=c(()=>!1,"isIgnored");if(o.ignore){let p={...e,ignore:null,onMatch:null,onResult:null};l=Y(o.ignore,p,r)}let u=c((p,d=!1)=>{let{isMatch:f,match:g,output:h}=Y.test(p,s,e,{glob:t,posix:i}),y={glob:t,state:a,regex:s,posix:i,input:p,output:h,match:g,isMatch:f};return typeof o.onResult=="function"&&o.onResult(y),f===!1?(y.isMatch=!1,d?y:!1):l(p)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,d?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),d?y:!0)},"matcher");return r&&(u.state=a),u},"picomatch");Y.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},s=i.format||(o?ns.toPosixSlashes:null),a=t===n,l=a&&s?s(t):t;return a===!1&&(l=s?s(t):t,a=l===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=Y.matchBase(t,e,r,o):a=e.exec(l)),{isMatch:!!a,match:a,output:l}};Y.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Y.makeRe(e,r)).test(ns.basename(t,{windows:n}));Y.isMatch=(t,e,r)=>Y(e,r)(t);Y.parse=(t,e)=>Array.isArray(t)?t.map(r=>Y.parse(r,e)):Xr(t,{...e,fastpaths:!1});Y.scan=(t,e)=>Fl(t,e);Y.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",s=o.contains?"":"$",a=`${i}(?:${t.output})${s}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let l=Y.toRegex(a,e);return n===!0&&(l.state=t),l};Y.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=Xr.fastpaths(t,e)),o.output||(o=Xr(t,e)),Y.compileRe(o,e,r,n)};Y.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Y.constants=Dl;os.exports=Y});var cs=Be((ed,ls)=>{"use strict";var is=ss(),jl=Et();function as(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:jl.isWindows()}),is(t,e,r)}c(as,"picomatch");Object.assign(as,is);ls.exports=as});function Ul(t){return Array.isArray(t)}function us(t){return Ul(t)?t:t==null?[]:[t]}function Wl(t,e){if(e===!1||(0,Ae.isAbsolute)(t)||t.startsWith("**"))return rr(t);let r=rr((0,Ae.resolve)(e||"")).replace(/[-^$*+?.()|[\]{}]/g,"\\$&");return Ae.posix.join(r,rr(t))}var Ae,ps,Vl,rr,zr,Bl,Jl,Kl,od,ds=O(()=>{Ae=require("path");Ho();ps=dr(cs(),1);c(Ul,"isArray");c(us,"ensureArray");Vl=new RegExp(`\\${Ae.win32.sep}`,"g"),rr=c(function(e){return e.replace(Vl,Ae.posix.sep)},"normalizePath");c(Wl,"getMatcherString");zr=c(function(e,r,n){let o=n&&n.resolve,i=c(l=>l instanceof RegExp?l:{test:c(u=>{let p=Wl(l,o);return(0,ps.default)(p,{dot:!0})(u)},"test")},"getMatcher"),s=us(e).map(i),a=us(r).map(i);return!s.length&&!a.length?l=>typeof l=="string"&&!l.includes("\0"):c(function(u){if(typeof u!="string"||u.includes("\0"))return!1;let p=rr(u);for(let d=0;d<a.length;++d){let f=a[d];if(f instanceof RegExp&&(f.lastIndex=0),f.test(p))return!1}for(let d=0;d<s.length;++d){let f=s[d];if(f instanceof RegExp&&(f.lastIndex=0),f.test(p))return!0}return!s.length},"result")},"createFilter"),Bl="break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public",Jl="arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl",Kl=new Set(`${Bl} ${Jl}`.split(" "));Kl.add("");od="isWellFormed"in String.prototype});var xt,fs=O(()=>{"use strict";xt="tempo-interact-preview"});function qr(t){switch(t.type){case"JSXIdentifier":return t.name;case"JSXNamespacedName":return`${t.namespace.name}:${t.name.name}`;case"JSXMemberExpression":return ms(t)}}function ms(t){return`${t.object.type==="JSXIdentifier"?t.object.name:ms(t.object)}.${t.property.name}`}var gs=O(()=>{"use strict";c(qr,"getTagName");c(ms,"getJSXMemberExpressionName")});function nr(t,e,r=null){if(t==null||typeof t!="object")return;if(Array.isArray(t)){for(let s of t)nr(s,e,r);return}let n=t,o=n.type;typeof o=="string"&&o in e&&e[o](t,r);let i=typeof o=="string"?t:r;for(let s of Object.values(n))s!==null&&typeof s=="object"&&nr(s,e,i)}var ys,hs,pd,Ss=O(()=>{"use strict";ys=dr(require("oxc-parser/src-js/generated/visit/keys.js"),1),hs=ys.default,pd=hs.default??hs;c(nr,"walk")});function Gl(t){return t===void 0?null:typeof t=="function"?t.toString():JSON.stringify(t)}function Xl(t){return Object.entries(t).map(([e,r])=>{let n=Gl(r);return n===null?null:` ${e}={${n}}`}).filter(e=>e!==null).join("")}function zl(t){let e=new Set;for(let r of t.openingElement.attributes??[])r.type==="JSXAttribute"&&e.add(qr(r.name));return e}function ql(t,e){return Object.fromEntries(Object.entries(t).filter(([r])=>!e.has(r)))}function bs(t,e,r){let n=(0,vs.parseSync)(e,t),o=[],i=new WeakSet,s=c(u=>{for(let p of u.children){let d=mr(p);d&&i.add(d)}},"noteChildren");nr(n.program,{JSXFragment(u){s(u)},JSXElement(u,p){let d=u;s(d);let f=qr(d.openingElement.name);if(Yl.has(f))return;let g=p?.type??null,h=ql(r({element:d,tagName:f,parentType:g,...i.has(d)?{isStaticJsxChild:!0}:{}}),zl(d));if(Object.keys(h).length===0)return;let y=d.openingElement,x=y.end-1;if(y.selfClosing)for(x--;x>y.start&&/\s/.test(t[x-1]);)x--;o.push({position:x,text:Xl(h)})}}),o.sort((u,p)=>u.position-p.position);let a=[],l=0;for(let{position:u,text:p}of o)a.push(t.slice(l,u)),a.push(p),l=u;return a.push(t.slice(l)),{annotatedSource:a.join(""),elementsAnnotated:o.length,parseResult:n}}var vs,Yl,Es=O(()=>{"use strict";gs();Ss();vs=require("oxc-parser");Nt();c(Gl,"formatPropValue");c(Xl,"formatProps");c(zl,"getExistingAttributeNames");c(ql,"removeExistingProps");Yl=new Set(["Fragment","React.Fragment"]);c(bs,"annotateFile")});var Ql,Yr=O(()=>{"use strict";Ql=Object.freeze({$unresolved:!0})});function Zl(t){let e=(0,Cs.createRequire)(__tempoRuntime.sdkModuleUrl("assets/parser.ts"))("@astrojs/compiler-rs").parse(t),r=e.diagnostics.filter(n=>n.severity==="error");if(r.length)throw new Error(r.map(n=>n.text).join(`
122
+ `));return e.ast}function ec(t,e){try{if(t.endsWith(".astro"))return{program:Zl(e).frontmatter?.program??{type:"Program",body:[]},errors:[]};let r=(0,xs.parseSync)(t,e),n=(r.errors??[]).map(o=>({code:"unparseable_source",severity:"structural",message:o?.message??"Unable to parse asset source",span:At(o)??At(o?.labels?.[0])}));return n.length>0?{program:null,errors:n}:{program:r.program,errors:[]}}catch(r){return{program:null,errors:[{code:"unparseable_source",severity:"structural",message:r instanceof Error?r.message:"Unable to parse asset source"}]}}}function tc(t){let e={trustedDefineControlsNames:new Set,trustedDefineAssetNames:new Set,importedBindings:new Map,referenceableImports:new Map,importDeclarationSpans:[],misimports:[]};for(let r of t?.body??[]){if(r?.type!=="ImportDeclaration"||typeof r.source?.value!="string")continue;let n=At(r);if(n&&e.importDeclarationSpans.push(n),r.importKind==="type")continue;let o=r.source.value,i=_s(o);for(let s of r.specifiers??[]){if(s?.importKind==="type")continue;let a=s?.local?.name;if(typeof a!="string")continue;if(e.importedBindings.set(a,o),s.type==="ImportDefaultSpecifier"){e.referenceableImports.set(a,{importSpecifier:o,importedName:"default"});continue}if(s.type!=="ImportSpecifier")continue;let l=s.imported?.name??s.imported?.value??a;e.referenceableImports.set(a,{importSpecifier:o,importedName:l}),i&&l==="defineControls"&&e.trustedDefineControlsNames.add(a),l==="defineAsset"&&(i?e.trustedDefineAssetNames.add(a):rc(o)&&e.misimports.push({source:o,span:At(r.source)??n??{start:0,end:0}}))}}return e}function As(t,e,r=ec(t,e)){let{program:n}=r,o=tc(n),i=n?nc(n):null,s=new Set;if(t.endsWith(".astro")){for(let a of n?.body??[])if(!(a.type!=="ImportDeclaration"||a.source.value!=="tempo-sdk/astro/controls"||a.importKind==="type"))for(let l of a.specifiers)l.type==="ImportSpecifier"&&l.importKind!=="type"&&(l.imported.name??l.imported.value)==="defineAstroControls"&&s.add(l.local.name)}return(n?.body??[]).flatMap(a=>{let l=a.type==="ExpressionStatement"?a.expression:null;if(l?.type==="CallExpression"&&l.callee.type==="Identifier"&&s.has(l.callee.name)&&l.arguments.length===1)return[{bindingName:"default",exportKind:"default",start:l.start,end:l.end}];if(l?.type!=="CallExpression"||l.callee.type!=="Identifier"||!o.trustedDefineControlsNames?.has(l.callee.name)||l.arguments.length!==2||l.arguments[0]?.type!=="Identifier")return[];let u=l.arguments[0].name,p=o.referenceableImports.get(u),d=i?.bindings.get(u);return!p&&!d?[]:[{bindingName:u,reference:p,exportKind:p?.importedName==="default"?"default":d?.exportKind??"named",start:l.start,end:l.end}]})}function _s(t){return t===ws||t.endsWith(`/${ws}`)}function rc(t){return(t==="tempo-sdk"||t.startsWith("tempo-sdk/"))&&!_s(t)}function nc(t){let e=new Map,r=new Set,n=new Set,o=new Set,i=c((s,a,l)=>{let u=c(p=>{l==="named"&&n.add(p),l==="default"&&o.add(p)},"markExported");if(s?.type==="FunctionDeclaration"||s?.type==="ClassDeclaration"){let p=s.id?.name;typeof p=="string"&&(e.set(p,{name:p,statementSpan:a,exportKind:"none"}),u(p));return}if(s?.type==="VariableDeclaration")for(let p of s.declarations??[])if(p?.id?.type==="Identifier"){let d=p.id.name;p.init?(e.set(d,{name:d,statementSpan:a,exportKind:"none"}),u(d)):r.add(d)}else Ct(p?.id,r)},"register");for(let s of t?.body??[]){let a=At(s)??{start:0,end:0};if(s?.type==="ExportNamedDeclaration"){if(s.declaration&&i(s.declaration,a,"named"),!s.source)for(let l of s.specifiers??[]){if(l?.type!=="ExportSpecifier")continue;let u=l.local?.name;if(typeof u!="string")continue;((l.exported?.name??l.exported?.value)==="default"?o:n).add(u)}continue}if(s?.type==="ExportDefaultDeclaration"){let l=s.declaration;if(l?.type==="FunctionDeclaration"||l?.type==="ClassDeclaration")i(l,a,"default");else{let u=oc(l);u?.type==="Identifier"&&o.add(u.name)}continue}i(s,a,null)}for(let s of e.values())s.exportKind=o.has(s.name)?"default":n.has(s.name)?"named":"none";return{bindings:e,nonSimpleNames:r}}function Ct(t,e){if(!(!t||typeof t!="object")){if(t.type==="Identifier"&&typeof t.name=="string"){e.add(t.name);return}if(t.type==="ObjectPattern"){for(let r of t.properties??[])Ct(r?.value??r?.argument,e);return}if(t.type==="ArrayPattern"){for(let r of t.elements??[])Ct(r,e);return}if(t.type==="AssignmentPattern"){Ct(t.left,e);return}t.type==="RestElement"&&Ct(t.argument,e)}}function oc(t){let e=t;for(;e?.type==="TSSatisfiesExpression"||e?.type==="TSAsExpression"||e?.type==="TSNonNullExpression"||e?.type==="ParenthesizedExpression";)e=e.expression;return e}function At(t){return typeof t?.start=="number"&&Number.isFinite(t.start)&&typeof t?.end=="number"&&Number.isFinite(t.end)?{start:t.start,end:t.end}:void 0}var xs,Cs,ws,Rs=O(()=>{xs=require("oxc-parser"),Cs=require("node:module");Yr();Yr();c(Zl,"parseAstroAssetSource");ws="tempo-sdk/assets";c(ec,"parseAssetProgram");c(tc,"readAssetImports");c(As,"parseControlsFile");c(_s,"isTrustedAssetImportSource");c(rc,"isMisimportedAssetSdkSource");c(nc,"collectTopLevelScope");c(Ct,"collectPatternNames");c(oc,"unwrapTsExpression");c(At,"toSourceSpan")});function ks(t,e,r=!1){let n=t.includes("defineControls")?As(e,t):[];if(!n.length&&!r)return t;for(let{start:o,end:i}of n.reverse())t=t.slice(0,o)+`((dispose) => { if (import.meta.hot && typeof dispose === "function") import.meta.hot.data.__tempoControlsDisposers.push(dispose); })(${t.slice(o,i)})`+t.slice(i);return`if (import.meta.hot) {
123
+ for (const dispose of import.meta.hot.data.__tempoControlsDisposers ?? []) dispose();
124
+ import.meta.hot.data.__tempoControlsDisposers = [];
125
+ import.meta.hot.dispose(() => {
126
+ for (const dispose of import.meta.hot.data.__tempoControlsDisposers ?? []) dispose();
127
+ import.meta.hot.data.__tempoControlsDisposers = [];
128
+ });
129
+ }
130
+ ${t}`}var Ts=O(()=>{Rs();c(ks,"transformControlsForHmr")});function _t(t){let e=Ve.default.resolve(t);try{return or.realpathSync.native(e)}catch(r){let n=r.code;if(n!=="ENOENT"&&n!=="ENOTDIR")throw r;let o=!1;try{o=(0,or.lstatSync)(e).isSymbolicLink()}catch(s){if(s.code!=="ENOENT"&&s.code!=="ENOTDIR")throw s}if(o)throw r;let i=Ve.default.dirname(e);if(i===e)throw r;return Ve.default.join(_t(i),Ve.default.basename(e))}}function Is(t,e,r){return`${Ve.default.relative(_t(t),_t(e)).split(Ve.default.sep).join("/")}#${r}`}var or,Ve,Ps=O(()=>{Ft();or=require("node:fs"),Ve=dr(require("node:path"),1);c(_t,"canonicalPathAllowMissing");c(Is,"flutterPreviewKey")});function sc(t,e,r){let n=r?.get(e),o=n?.startsWith("\0tempo:astro-component:")?decodeURIComponent(n.slice(23,-3)):n,i=o===void 0?e:o.replace(/\bt=\d{13}&?\b/,"").replace(/[?&]$/,"");if(i.startsWith("\0"))return i;let s=i.search(/[?#]/),a=(s<0?i:i.slice(0,s)).replace(/\\/g,"/"),l=s<0||i.endsWith(".astro?tempo-component")?"":i.slice(s);if(o===void 0&&a.startsWith(".")&&(a=(0,pe.resolve)((0,pe.dirname)(t),a)),!(0,pe.isAbsolute)(a)&&!/^[A-Za-z]:\//.test(a))return i;if(o!==void 0)try{a=Ms.realpathSync.native(a)}catch{}return(0,pe.normalize)(a).replace(/\\/g,"/")+l}function Os(t,e,r,n){let o=new Map;if(!e.includes("tempo-sdk/canvas"))return o;let i=Ye(t,e);for(let s of i.storyboards){if(s.kind!=="component"||s.openingElementSpan===void 0)continue;let a=s.preview?dt(s.preview):null;if(a&&!("error"in a)&&n){let h;try{let y=(0,pe.resolve)((0,pe.dirname)(_t(t)),a.file);h=Is(n,y,a.functionName)}catch{continue}o.set(s.openingElementSpan.start,{[kn]:h,[Ns]:JSON.stringify(["flutter",h.slice(0,h.lastIndexOf("#")),a.functionName]),"data-tempo-external-component":"true"});continue}let l=s.component;if(!l?.localName)continue;let u=l.expression.match(/^\s*([$\w]+)(?:\s*\.\s*([$\w]+))?\s*$/);if(!u)continue;let p;if(l.import)if(l.import.kind==="namespace"){if(!u[2])continue;p=u[2]}else{if(u[2])continue;p=l.import.importedName}else{if(u[2])continue;p=l.localName}let d=l.import?.source.replace(/\\/g,"/").replace(/[?#].*/,""),f=pe.posix.dirname(t.replace(/\\/g,"/")),g=d!==void 0&&(!d.startsWith(".")||!pe.posix.join(f,d).startsWith(`${f}/`));o.set(s.openingElementSpan.start,{[Ns]:JSON.stringify([l.import?"import":"local",sc(t,l.import?.source??t,r),p]),...g?{"data-tempo-external-component":"true"}:{}})}return o}var Ms,pe,Ns,$s=O(()=>{Ms=require("node:fs"),pe=require("node:path");Ft();Ps();Wt();Ns="data-tempo-component-reference";c(sc,"moduleIdentity");c(Os,"canvasComponentAnnotations")});function Qr(t){let e=/\bexport\s+default\s+/.exec(t);if(!e)return null;let r=t.slice(e.index+e[0].length),n=ic.exec(r);if(n)return{kind:"function",name:n[1]??null};let o=ac.exec(r);if(o)return{kind:"class",name:o[1]??null};if(lc.test(r))return{kind:"function",name:null};let i=cc.exec(r);return i?{kind:"identifier",name:i[1]}:null}function Fs(t,e){return t?t.name===null?!0:!e||t.name===e.name?!1:Ls(t)&&Ls(e):!1}function Ls(t){return t.name===null||/^[A-Z]/.test(t.name)}var ic,ac,lc,cc,Ds=O(()=>{ic=/^(?:async\s+)?function(?:\s*\*)?(?:\s+([A-Za-z_$][\w$]*))?\s*\(/,ac=/^(?:abstract\s+)?class(?:\s+([A-Za-z_$][\w$]*))?(?=[\s{])/,lc=/^(?:async\s+)?(?:\([^()]*\)|[A-Za-z_$][\w$]*)\s*=>/,cc=/^([A-Za-z_$][\w$]*)[ \t]*(?:;|\r?\n|$)/;c(Qr,"readDefaultExportIdentity");c(Fs,"isDefaultExportIdentityRewrite");c(Ls,"isComponentShaped")});function js(t){let e=new Set;function r(a,l){let u=ks(a,l,e.has(l));return u!==a&&e.add(l),u}c(r,"transformControls");let n=new Map,o=c(a=>{let l=me(a);try{return ie.realpathSync.native(l)}catch{return l.replace(/\\/g,"/")}},"canonicalIdentityKey");async function i(a,l,u){let p=t.transformsControls(u)?r(l,u):l,d=t.stampedFilepath(u);if(d===null)return p!==l?{code:p,map:null}:null;try{let f=(0,ie.openSync)(u,"r"),g;try{let F=(0,ie.fstatSync)(f),D=(0,ie.readFileSync)(f,"utf8");g={before:F,rawSource:D,after:(0,ie.fstatSync)(f)}}finally{(0,ie.closeSync)(f)}let{before:h,after:y,rawSource:x}=g,E=["mtimeMs","ctimeMs","size","ino","dev"],w=l===x?l:void 0;if(w===void 0&&typeof a.getCombinedSourcemap=="function")try{let F=a.getCombinedSourcemap(),D=F.sourceRoot,v=F.sources.flatMap((b,te)=>{let B=b.startsWith("file:")?(0,Hs.fileURLToPath)(b):b,Q=(0,ot.isAbsolute)(B)?B:(0,ot.resolve)((0,ot.dirname)(u),typeof D=="string"?D:"",B),Z=tt(Q).replace(/\\/g,"/")===u.replace(/\\/g,"/");if(!Z)try{Z=ie.realpathSync.native(Q)===ie.realpathSync.native(u)}catch{}return Z&&typeof F.sourcesContent?.[te]=="string"?[F.sourcesContent[te]]:[]});v.length===1&&(w=v[0])}catch{}let C=w===x&&E.every(F=>h[F]===y[F]),k=C?Math.trunc(h.mtimeMs):0,L=C?ke(x):"",M=o(u);n.has(M)||n.set(M,Qr(x));let W=new Map;if(l.includes("tempo-sdk/canvas")&&typeof a.resolve=="function"){let F=Ye(u,l).storyboards.flatMap(D=>D.component?.import?.source??[]);await Promise.all([...new Set(F)].map(async D=>{let v=await a.resolve(D,u,{skipSelf:!0});v&&W.set(D,v.id)}))}let P=Os(u,l,W,t.flutterHostRoot?.()),$=bs(l,u,F=>{let D={...P.get(F.element.openingElement.start),...fo({info:F,filepath:d,modifiedtsMs:k,sourceVersion:L,computeAnnotatedProps:t.computeAnnotatedProps})};return C||(delete D["data-tempo-filepath"],delete D["data-tempo-position"],delete D["data-tempo-source-tag"],delete D["data-tempo-expr"],delete D["data-tempo-modifiedts"],delete D["data-tempo-source-version"]),D});if($.parseResult.errors.length>0)return null;let S=$.elementsAnnotated===0?l:$.annotatedSource,z=t.transformsControls(u)?r(S,u):S;return{code:C?po(z,d,k,L):z,map:null}}catch{return null}}c(i,"annotateJsxModule");async function s(a){let{file:l}=a,u=o(l);if(!n.has(u))return!1;let p;try{p=(0,ie.readFileSync)(l,"utf8"),p.length===0&&(p=await a.read())}catch{return!1}let d=n.get(u);if(d===void 0)return!1;let f=Qr(p);return n.set(u,f),Fs(d,f)}return c(s,"defaultExportIdentityRewritten"),{annotateJsxModule:i,defaultExportIdentityRewritten:s,forgetDefaultExportIdentity(a){n.delete(o(a))}}}var ie,ot,Hs,Us=O(()=>{ie=require("node:fs"),ot=require("node:path"),Hs=require("node:url");Es();Je();Yt();Ts();$s();Wt();Ds();yt();c(js,"createJsxModuleAnnotation")});function Vs(){let t=0,e=0,r=new WeakMap;return{observePrune(n,o){let i=++t;for(let s of o){let a=n.urlToModuleMap.get(s);a&&(r.has(a)||e++,r.set(a,i))}},observeRequest(n,o,i,s,a){if(!e||["document","iframe","frame"].includes(String(s)))return;let l=t;return async(u,p,d)=>{if(!e||u<200||u>=400||u!==304&&!/^text\/(?:javascript|css)(?:;|$)/i.test(String(p)))return;let f=u===304?a:d;if(typeof f!="string"||!n.getModuleByEtag(f))return;let g=o;i!=="/"&&g.startsWith(i)&&(g=`/${g.slice(i.length)}`);try{g=decodeURI(g).replace(/__x00__/g,"\0"),g.startsWith("/@id/")&&(g=g.slice(5));let[,h]=await n.resolveUrl(g),y=n.getModuleById(h);y&&y.transformResult?.etag===f&&(r.get(y)??1/0)<=l&&(r.delete(y),e--)}catch{}}},suppressDeletion(n,o){if(!o.length||!o.every(s=>r.has(s)&&s.importers.size===0))return!1;let i=new Set;for(let s of o)n.invalidateModule(s,i);return!0},clear(){r=new WeakMap,e=0}}}var Ws=O(()=>{c(Vs,"createPrunedModuleDeletionGuard")});function Qs(t,e=console){let r=t.TEMPO_FLUTTER_URL?.trim();if(!r)return null;try{let n=new URL(r);if(n.protocol==="http:")return n}catch{}return e.warn(`[tempo] ignoring TEMPO_FLUTTER_URL=${JSON.stringify(r)}: expected an http:// origin such as http://127.0.0.1:<port>`),null}function Zs(t){let e=t.intervalMs??3e3,r=new URL(uc,t.target.origin),n=null,o=!1,i=null;async function s(){try{let a=await fetch(r,{signal:AbortSignal.timeout(e)}),l=a.ok?await a.json():null;if(!o&&l?.status==="ready"&&typeof l.spawn=="number"){let u=n!==null&&l.spawn!==n;n=l.spawn,u&&t.onRelaunch()}}catch{}o||(i=setTimeout(s,e),i.unref?.())}return c(s,"poll"),s(),()=>{o=!0,i&&clearTimeout(i)}}function Js(t){let e=t.slice(Zr.length);return e.startsWith("/")?e:`/${e}`}function Ks(t){if(!t.startsWith(Zr))return!1;let e=t.charAt(Zr.length);return e===""||e==="/"||e==="?"}function ei(t){let{target:e,config:r}=t,n=pc(r),o=!0;function i(){o||(o=!0,r.logger.info(`[tempo] Flutter dev server reachable at ${e.origin}`))}c(i,"noteReachable");function s(u){o&&(o=!1,r.logger.warn(`[tempo] Flutter dev server unreachable at ${e.origin} (${u.code??u.message}); answering 502 until it is up`))}c(s,"noteUnreachable");function a(u,p,d){let f=(0,Xs.request)({hostname:e.hostname,port:e.port,method:u.method,path:d,headers:{...Gs(u.headers),host:e.host}},g=>{i(),p.writeHead(g.statusCode??502,g.statusMessage,Gs(g.headers)),(0,qs.pipeline)(g,p,()=>{})});f.on("error",g=>{if(p.headersSent||p.destroyed){p.destroy();return}s(g),p.writeHead(502,{"content-type":"application/json"}),p.end(JSON.stringify(Bs))}),p.on("close",()=>{p.writableFinished||f.destroy()}),u.pipe(f)}c(a,"forward");function l(u,p,d,f){let g=!1,h=(0,zs.connect)({host:e.hostname,port:Number(e.port)||80},()=>{g=!0,i(),h.write(dc(u,f,e.host)),d.length>0&&h.write(d),h.pipe(p),p.pipe(h)});h.on("error",y=>{if(g){p.destroy();return}s(y);let x=JSON.stringify(Bs);p.end(`HTTP/1.1 502 Bad Gateway\r
131
+ Content-Type: application/json\r
132
+ Content-Length: ${Buffer.byteLength(x)}\r
133
+ Connection: close\r
134
+ \r
135
+ ${x}`)}),h.on("close",()=>{g&&p.destroy()}),p.on("error",()=>h.destroy()),p.on("close",()=>h.destroy())}return c(l,"forwardUpgrade"),{prefix(u,p,d){let f=u.url??"/";if(!Ks(f))return d();a(u,p,Js(f))},fallthrough(u,p,d){let f=u.originalUrl??u.url??"/",g=ti(f);if(g===null||g.startsWith("/@")||g.startsWith("/__tempo/")||fc(g)||mc(u.headers.accept,g)||gc(r.root,g))return d();a(u,p,f)},upgrade(u,p,d){let f=u.url??"/";if(n(u,f))return;let g=Ks(f)?Js(f):f;l(u,p,d,g)}}}function pc(t){let e=t.server.hmr,r=typeof e=="object"&&e.path?De.posix.join(t.base||"/",e.path):null,n=Object.keys(t.server.proxy??{});return(o,i)=>{let s=o.headers["sec-websocket-protocol"]??"";return s.includes("vite-hmr")||s.includes("vite-ping")||r!==null&&ti(i)===r?!0:n.some(a=>a.startsWith("^")?new RegExp(a).test(i):i.startsWith(a))}}function dc(t,e,r){let n=[`${t.method??"GET"} ${e} HTTP/${t.httpVersion}`];for(let o=0;o<t.rawHeaders.length;o+=2){let i=t.rawHeaders[o]??"",s=i.toLowerCase()==="host"?r:t.rawHeaders[o+1];n.push(`${i}: ${s}`)}return`${n.join(`\r
136
+ `)}\r
137
+ \r
138
+ `}function fc(t){return t.replace(/\/+$/,"")==="/tempo-host"}function mc(t,e){return!!t?.includes("text/html")&&(0,De.extname)(e)===""}function gc(t,e){return e.split("/").includes("..")?!1:e.endsWith(".html")?(0,sr.existsSync)((0,De.join)(t,e)):e.endsWith("/")?(0,sr.existsSync)((0,De.join)(t,e,"index.html")):(0,sr.existsSync)((0,De.join)(t,`${e}.html`))}function ti(t){try{return decodeURIComponent(new URL(t,"http://host").pathname)}catch{return null}}function Gs(t){let e={};for(let[r,n]of Object.entries(t))n===void 0||hc.has(r)||(e[r]=n);return e}var sr,Xs,zs,De,qs,Zr,Bs,Ys,uc,hc,ri=O(()=>{sr=require("node:fs"),Xs=require("node:http"),zs=require("node:net"),De=require("node:path"),qs=require("node:stream"),Zr="/__tempo/flutter",Bs={error:"flutter_unreachable"},Ys="**/.flutter-host/**";c(Qs,"readFlutterDevServerUrl");uc="/__tempo_flutter_status";c(Zs,"watchFlutterRelaunches");c(Js,"stripFlutterPrefix");c(Ks,"isUnderFlutterPrefix");c(ei,"createFlutterForwarding");c(pc,"createViteUpgradeMatcher");c(dc,"upgradeRequestHead");c(fc,"isCanvasHostPage");c(mc,"isHtmlNavigation");c(gc,"rootHasHtmlPage");c(ti,"decodePathname");hc=new Set(["connection","keep-alive","proxy-authenticate","proxy-authorization","proxy-connection","te","trailer","transfer-encoding","upgrade"]);c(Gs,"endToEndHeaders")});function yc(t){let e=typeof t.type=="string"?t.type:null,r=typeof t.acceptedPath=="string"?t.acceptedPath:typeof t.path=="string"?t.path:null;return!e||!r?null:`${e}\0${r}`}function ni(){let t=new Map;return{filter(e){let r=[];for(let n of e){let o=yc(n),i=n.timestamp;if(o===null||typeof i!="number"||!Number.isFinite(i)){r.push(n);continue}let s=t.get(o);s!==void 0&&i<s||((s===void 0||i>s)&&t.set(o,i),r.push(n))}return r},clear(){t.clear()}}}var oi=O(()=>{c(yc,"generationIdentity");c(ni,"createHmrGenerationFence")});function si(t){for(let e of t){if(e.name==="vite:react-refresh"&&e.load&&!ir.has(e)){ir.add(e);let i=e.load,s=typeof i=="function"?i:i.handler,a=c(async function(...l){let u=await s.apply(this,l);if(!u||l[0]!=="/@react-refresh")return u;let p=typeof u=="string"?u:u.code;if(!p||!/\b(?:let|const) allFamiliesByType = new WeakMap\(\)/.test(p)||!p.includes("function performReactRefresh()"))return u;let d=`${p}
139
+ globalThis[Symbol.for("tempo.react-refresh.family")] = (type) => allFamiliesByType.get(type);
140
+ globalThis[Symbol.for("tempo.react-refresh.flush")] = performReactRefresh;
141
+ `;return typeof u=="string"?d:{...u,code:d}},"wrapped");e.load=typeof i=="function"?a:{...i,handler:a}}if(e.name!=="vite:react-babel"||!e.transform||ir.has(e))continue;ir.add(e);let r=e.transform,n=typeof r=="function"?r:r.handler,o=c(async function(...i){let s=await n.apply(this,i);if(!s)return s;let a=typeof s=="string"?s:s.code;if(!a)return s;let l=a.replace(/RefreshRuntime\.__hmr_import\(import\.meta\.url\)\.then\(\(currentExports\) => \{\n(\s*RefreshRuntime\.registerExportsForReactRefresh\([^\n]+\);)\n\s*import\.meta\.hot\.accept\(\(nextExports\) => \{([\s\S]*?)\n\s*\}\);\n\s*\}\);/,(u,p,d)=>`const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
142
+ ${p}
143
+ return currentExports;
144
+ });
145
+ import.meta.hot.accept(async (nextExports) => {
146
+ const currentExports = await __tempoReactRefreshExports;${d}
147
+ });`);return l===a?s:typeof s=="string"?l:{...s,code:l}},"wrapped");e.transform=typeof r=="function"?o:{...r,handler:o}}}var ir,ii=O(()=>{ir=new WeakSet;c(si,"installSynchronousReactRefreshBoundary")});function li(){let t=new Map,e=c(r=>{let n=[],o=r,i=!1;for(;;){let s=t.get(o);if(s!==void 0){i=s;break}n.push(o);let a=vc(o);if(a!==void 0){i=a?.name===ai;break}let l=(0,Rt.dirname)(o);if(l===o)break;o=l}for(let s of n)t.set(s,i);return i},"nearestPackageIsSdk");return r=>{if(r.replace(/\\/g,"/").includes(Sc))return!0;let n=r;try{n=ar.realpathSync.native(r)}catch{}return e((0,Rt.dirname)(n))}}function vc(t){let e;try{e=(0,ar.readFileSync)((0,Rt.join)(t,"package.json"),"utf8")}catch{return}try{let r=JSON.parse(e);return r&&typeof r=="object"?r:null}catch{return null}}var ar,Rt,ai,Sc,ci=O(()=>{ar=require("node:fs"),Rt=require("node:path"),ai="tempo-sdk",Sc=`/node_modules/${ai}/`;c(li,"createSdkFileMatcher");c(vc,"readPackageManifest")});function ui(t){let e=/(const mod = this\.hotModulesMap\.get\(path\);\s*)if \(!mod\)\s*(?:return;|\{\s*return;\s*\})/,r="this.hmrClient.hotModulesMap.set(this.ownerPath, mod);";return!e.test(t)||!t.includes(r)?t:t.replace(e,`$1if (!mod || mod.pendingUpdates) {
148
+ const pending = mod || {
149
+ id: path,
150
+ callbacks: [],
151
+ pendingUpdates: new Map(),
152
+ };
153
+ pending.pendingUpdates.set(acceptedPath, update);
154
+ this.hotModulesMap.set(path, pending);
155
+ return;
156
+ }`).replace(r,`${r}
157
+ if (mod.pendingUpdates) {
158
+ const pendingUpdates = [...mod.pendingUpdates.values()];
159
+ delete mod.pendingUpdates;
160
+ queueMicrotask(() => {
161
+ for (const update of pendingUpdates) {
162
+ void this.hmrClient.queueUpdate(update).catch((error) => {
163
+ this.hmrClient.logger.error(error);
164
+ });
165
+ }
166
+ });
167
+ }`)}var pi=O(()=>{c(ui,"preservePendingViteModuleUpdates")});function kt(t){return t.replace(/\\/g,"/")}function fi(t){let e=t.slice(t.lastIndexOf("/")+1),r=e.lastIndexOf(".");return r<=0?"":e.slice(r+1).toLowerCase()}function Cc(t){let e=kt(t);return di.has(fi(e))?!bc.some(r=>e.includes(r)):!1}function Ac(t){if(t.includes("*"))return!0;let e=fi(kt(t));return e!==""&&e!=="css"&&di.has(e)}function _c(t,e){if(t.deps===null)return!1;let r=kt(e),n=!1;for(let o of t.deps){let i=kt(o);if(i===r)return!1;!n&&Ac(i)&&(n=!0)}return n}function mi(t){let e=t.debounceMs??Ec,r=t.maxPokesPerPair??wc,n=new Set,o=new Map,i=new Set,s=null,a=Number.NEGATIVE_INFINITY,l=!1,u=c(()=>{s=null,a=Date.now(),i.clear();let p=[...n];n.clear();for(let d of p)t.emitChange(d)},"flush");return{handleWatcherFile(p){if(l||!Cc(p))return!1;let d=!1;for(let f of t.listCssEntries()){if(!_c(f,p))continue;let g=`${f.cssFile}\0${kt(p)}`;if(!i.has(g)){let h=o.get(g)??0;if(h>=r)continue;o.size>=xc&&o.clear(),o.set(g,h+1),i.add(g)}n.add(f.cssFile),d=!0}if(d&&s===null){let g=Date.now()-a>=e?0:e;s=setTimeout(u,g),s.unref?.()}return d},dispose(){l=!0,n.clear(),o.clear(),i.clear(),s!==null&&(clearTimeout(s),s=null)}}}var di,bc,Ec,wc,xc,gi=O(()=>{di=new Set(["ts","tsx","js","jsx","mjs","cjs","html","mdx","md","svelte","vue","astro"]),bc=["/node_modules/","/.git/","/.vite/","/.tempo/"],Ec=100,wc=2,xc=2e4;c(kt,"normalizeSlashes");c(fi,"fileExtension");c(Cc,"isScannableSourceFile");c(Ac,"isScanDep");c(_c,"cssEntryNeedsRescanFor");c(mi,"createTailwindScanNet")});function hi(t,e){try{let r=xe(t);if(r.kind!=="ok")throw new Error(r.message);let n=oe(V(V(r.root.frontmatter)?.program)?.body),o=new Set,i=new Map,s=new Map,a=new Set;for(let f of n){if(f.type==="ImportDeclaration")for(let h of oe(f.specifiers)){let y=String(V(h.local)?.name),x=String(V(f.source)?.value),E=h.type==="ImportDefaultSpecifier"?"default":String(V(h.imported)?.name??V(h.imported)?.value);x==="tempo-sdk/astro/controls"&&E==="defineAstroControls"?o.add(y):i.set(y,{source:x,name:E})}let g=f.type==="ExportNamedDeclaration"?V(f.declaration):f;if(g?.type==="VariableDeclaration"&&g.kind==="const")for(let h of oe(g.declarations)){let y=V(h.id),x=V(h.init);y?.type==="Identifier"&&x&&s.set(String(y.name),x)}}let l=n.flatMap(f=>{let g=f.type==="ExpressionStatement"?V(f.expression):null;return g?.type==="CallExpression"&&o.has(String(V(g.callee)?.name))?[g]:[]});if(l.length>1)throw new Error("Keep one defineAstroControls declaration in this component");let u=c((f,g=new Set)=>{let h=we(f);if(h.known)return h.value;if(["TSAsExpression","TSSatisfiesExpression","TSNonNullExpression","ParenthesizedExpression"].includes(f.type))return u(V(f.expression),g);if(f.type==="Identifier"){let y=String(f.name);if(g.has(y))throw new Error(`Controls contain a constant cycle through ${y}`);let x=s.get(y);if(x)return u(x,new Set([...g,y]));let E=i.get(y);if(E){a.add(E.source);let w=e?.(E.source,E.name);if(w!==void 0)return w}throw new Error(`Control value ${y} must resolve to a static constant`)}if(f.type==="ArrayExpression"){if(!Array.isArray(f.elements)||f.elements.some(y=>!V(y)||V(y)?.type==="SpreadElement"))throw new Error("Controls arrays cannot contain holes or spreads");return oe(f.elements).map(y=>u(y,g))}if(f.type==="ObjectExpression"){let y=Object.create(null);for(let x of oe(f.properties)){let E=V(x.key),w=V(x.value);if(x.type!=="Property"||x.computed||x.method||x.kind!=="init"||!E||!w)throw new Error("Controls require ordinary static object properties");let C=E.type==="Identifier"?E.name:E.value;if(typeof C!="string"&&typeof C!="number")throw new Error("Invalid control property");y[C]=u(w,g)}return y}if(f.type==="MemberExpression"){let y=u(V(f.object),g),x=V(f.property),E=f.computed?u(x,g):String(x.name);if(y&&typeof y=="object"&&(typeof E=="string"||typeof E=="number")&&Object.prototype.hasOwnProperty.call(y,E))return y[E]}throw new Error("Controls must use static values; calls, getters and request data are not evaluated")},"evaluate");if(!l.length)return{kind:"ok",declared:!1,controls:{},dependencies:[]};let p=oe(l[0].arguments);if(p.length!==1)throw new Error("defineAstroControls takes one controls object");let d=u(p[0]);if(!d||Array.isArray(d)||typeof d!="object")throw new Error("defineAstroControls requires a controls object");return{kind:"ok",declared:!0,controls:d,dependencies:[...a]}}catch(r){return{kind:"error",message:r instanceof Error?r.message:String(r)}}}var yi=O(()=>{"use strict";Xe();c(hi,"readAstroControls")});var Si={};Pt(Si,{readAstroControlsMetadata:()=>Rc});async function Rc(t,e,r,n=[]){let o=new Set([t]),i=new Set,s=new Map,a=new Map,l=c(async(d,f)=>{let g=`${d}#${f??"controls"}`;if(i.has(g)||i.size>16)return{kind:"error",message:"Controls have cyclic or excessively deep imports"};i.add(g);try{o.add(d),r(d);let h=a.get(d)??(0,Tt.readFileSync)(d,"utf8");if(f!==void 0){if(d.endsWith(".astro")){let w=xe(h);if(w.kind!=="ok"||!w.frontmatter)return{kind:"error",message:"This Astro file has no static exported constant"};h=h.slice(w.frontmatter.contentStart,w.frontmatter.contentEnd)}let y=(0,en.parseSync)(d.endsWith(".astro")?`${d}.ts`:d,h);if(y.errors.length)return{kind:"error",message:"Controls dependency cannot be parsed"};let x;for(let w of y.program.body){if(w.type==="ExportDefaultDeclaration"&&f==="default"&&(x=h.slice(w.declaration.start,w.declaration.end)),w.type!=="ExportNamedDeclaration")continue;let C=w.declaration;if(C?.type==="VariableDeclaration"&&C.kind==="const")for(let k of C.declarations)k.id.type==="Identifier"&&k.id.name===f&&(x=f);for(let k of w.specifiers){if((k.exported.type==="Identifier"?k.exported.name:k.exported.value)!==f)continue;let M=k.local.type==="Identifier"?k.local.name:k.local.value;if(w.source){let W=await e(w.source.value,d);return W?await l(W,M):{kind:"error",message:`Cannot resolve ${w.source.value}`}}x=M}}if(!x)return{kind:"error",message:`${f} is not a static exported constant`};let E="__tempoReadControls";for(;h.includes(E);)E+="_";h=`---
168
+ import { defineAstroControls as ${E} } from "tempo-sdk/astro/controls";
169
+ ${h}
170
+ ${E}({value: ${x}});
171
+ ---`}for(let y=0;y<64;y++){let x,E=hi(h,(k,L)=>{let M=`${d}:${k}#${L}`;if(s.has(M))return s.get(M);x??={specifier:k,name:L}});if(!x)return E;let w=await e(x.specifier,d);if(!w||w.startsWith("\0"))return{kind:"error",message:`Cannot statically read controls import ${x.specifier}`};let C=await l(w,x.name);if(C.kind==="error")return C;s.set(`${d}:${x.specifier}#${x.name}`,C.controls.value)}return{kind:"error",message:"Controls exceed the static dependency budget"}}catch(h){return{kind:"error",message:h instanceof Error?h.message:String(h)}}finally{i.delete(g)}},"read"),u=await l(t),p=!1;try{for(let d of new Set(n)){if(r(d),o.add(d),!(0,Tt.existsSync)(d))continue;let f=(0,Tt.readFileSync)(d,"utf8"),g=(0,en.parseSync)(d,f);if(g.errors.length)throw new Error("Shared component controls cannot be parsed");let h=new Set,y=new Set;for(let C of g.program.body)if(C.type==="ImportDeclaration")for(let k of C.specifiers)C.source.value==="tempo-sdk/assets"&&k.type==="ImportSpecifier"&&(k.imported.type==="Identifier"?k.imported.name:k.imported.value)==="defineControls"&&h.add(k.local.name),k.type==="ImportDefaultSpecifier"&&C.source.value.endsWith(".astro?tempo-component")&&await e(C.source.value.replace(/\?tempo-component$/,""),d)===t&&y.add(k.local.name);let x=g.program.body.flatMap(C=>{let k=C.type==="ExpressionStatement"?C.expression:null;return k?.type==="CallExpression"&&k.callee.type==="Identifier"&&h.has(k.callee.name)&&k.arguments[0]?.type==="Identifier"&&y.has(k.arguments[0].name)?[k]:[]});if(!x.length)continue;if(x.length>1||u.kind==="ok"&&u.declared)throw new Error("Keep one controls declaration for this Astro component; remove the duplicate shared declaration");if(u.kind==="error")break;let E=x[0].arguments[1];if(!E)throw new Error("defineControls requires a controls object");let w="__tempoReadSharedControls";for(;f.includes(w);)w+="_";a.set(d,`---
172
+ import {defineAstroControls as ${w}} from "tempo-sdk/astro/controls";
173
+ ${f}
174
+ ${w}(${f.slice(E.start,E.end)});
175
+ ---`),u=await l(d),p=!0}}catch(d){u={kind:"error",message:d instanceof Error?d.message:String(d)}}return u.kind==="ok"?{...u.declared?{controls:u.controls,...p?{shared:!0}:{}}:{},dependencies:[...o]}:{error:u.message,dependencies:[...o]}}var Tt,en,vi=O(()=>{Tt=require("node:fs");yi();Xe();en=require("oxc-parser");c(Rc,"readAstroControlsMetadata")});function wi(){let t=(0,G.dirname)((0,Ri.fileURLToPath)(Ce("index.ts")));for(let e of[(0,G.join)(t,"canvas","interact-projection.ts"),(0,G.join)(t,"canvas","interact-projection.js")])if((0,ae.existsSync)(e))return e.replace(/\\/g,"/");return null}function st(t){return t.replace(/[?#].*$/,"")}function Mc(t){return new URL(t,"http://tempo.local").pathname.replace(/\/+$/,"")==="/tempo-host"}function Oc(t){if(!Mc(t))return!1;let e=new URL(t,"http://tempo.local").searchParams,r=e.get("canvasPath")?.trim()??e.get("pageFile")?.trim()??e.get("importPath")?.trim(),n=e.get("storyboardId")?.trim()??e.get("exportName")?.trim()??e.get("importName")?.trim();return!r||!n}function Ci(t){return t.startsWith("./")||t.startsWith("../")}function Fc(t){if(!t||t.startsWith(".")||t.startsWith("/")||t.startsWith("\0")||t.startsWith("#")||t.includes(":"))return;let e=t.split("/"),r=t.startsWith("@")?e.length>=2&&e[0]!=="@"&&e[1]?`${e[0]}/${e[1]}`:void 0:e[0];return r&&/^@?[A-Za-z0-9_][A-Za-z0-9._/-]*$/.test(r)?r:void 0}function Dc(t,e){let r=me(t);try{return ae.realpathSync.native(r)===ae.realpathSync.native(e)}catch{return r.replace(/\\/g,"/")===e.replace(/\\/g,"/")}}function Ai(t){try{return ae.realpathSync.native(t)}catch{return t}}function Hc(t){return/<meta[^>]+name=["']tempo-project-root["'][^>]*>/i.test(t)}function jc(t){return/<meta[^>]+name=["']tempo-source-identity-root["'][^>]*>/i.test(t)}function Uc(t){return new RegExp(`<meta[^>]+name=["']${ge.TEMPO_WORKSPACE_NONCE_META_NAME}["'][^>]*>`,"i").test(t)}function Vc(t){return(t??[]).some(e=>e.name===ge.TEMPO_VUE_ANNOTATION_PLUGIN_NAME&&e.api?.enabled===!0)}function Wc(t,e,r,n,o){let i=r.url;if(!i?.startsWith("/__tempo/"))return o();if(i===ge.TEMPO_HOST_IDENTITY_ENDPOINT&&r.method==="GET"){let s=(0,ge.createTempoHostIdentity)("vite",{root:e.config?.root,pluginActive:!0,...Vc(e.config?.plugins)?{capabilities:{vueSourceAnnotation:1}}:{}});n.statusCode=200,n.setHeader("Cache-Control","no-store"),n.setHeader("Content-Type","application/json; charset=utf-8"),n.setHeader(ge.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),n.end(JSON.stringify(s));return}Fo(e,r,n)||t.handleRequest(r,n)||o()}function Jc(t){let e=mi({listCssEntries:c(function*(){let n=t.moduleGraph?.fileToModulesMap??new Map;for(let[o,i]of n)if(o.endsWith(".css"))for(let s of i){let a=[];for(let l of s.importedModules??[]){let u=l.file??l.url??l.id;u&&a.push(u)}yield{cssFile:o,deps:a}}},"listCssEntries"),emitChange:c(n=>{t.config?.logger?.info?.(`[tempo] new source file outside the Tailwind scan \u2014 re-emitting change: ${n}`,{timestamp:!0}),t.watcher?.emit?.("change",n)},"emitChange")}),r=c(n=>{e.handleWatcherFile(n)},"onWatcherFile");t.watcher?.on?.("add",r),t.watcher?.on?.("change",r),t.httpServer?.once("close",()=>{t.watcher?.off?.("add",r),t.watcher?.off?.("change",r),e.dispose()})}function ki(t={}){let e=t.enabled??!!process.env.TEMPO,r=e?Qs(process.env):null,n=t.include===void 0?kc:t.include,o=t.exclude===void 0?Tc:t.exclude,i=li(),s=zr(n,o),a=c(m=>s(m)&&!i(m),"filter"),l=zr(["**/*.tsx","**/*.jsx","**/*.ts","**/*.js"],o),u=c(m=>l(m)&&!i(m),"controlsFilter"),p=new Map,d=c((m,A,T)=>{let I=new Set(T);for(let[U,q]of p)if(q.has(m)){let Oe=A.getModuleById(U);Oe&&(A.invalidateModule(Oe),I.add(Oe))}return[...I]},"invalidateAstroDescriptors"),f=process.cwd(),g=js({stampedFilepath:c(m=>a(m)?(0,G.relative)(f,m):null,"stampedFilepath"),transformsControls:u,computeAnnotatedProps:t.computeAnnotatedProps,flutterHostRoot:c(()=>f,"flutterHostRoot")}),h=f,y="serve",x=!0,E=Eo({onErrorFile:c(m=>v(m),"onErrorFile")}),w=new Map,C,k=new Map,L=!1,M=!1,W=!1,P=null,$=new WeakSet,S=Vs(),z=ni(),F=So(),D=F.recordCoverage,v=c(m=>{D(m)},"pinErroneousRevisionCoverage"),b=c(async m=>await g.defaultExportIdentityRewritten(m)?(C?.ws.send({type:"full-reload",path:"*"}),!0):!1,"repairDefaultExportIdentityRewrite"),te=c(()=>(0,G.resolve)(f,".tempo","tempo-host.tsx"),"wrapperPath"),B=c(m=>Mo(m,te()),"isIncrementalRegistration"),Q=c((m,A,T)=>Oo(m,{wrapperPath:te(),sourceRoot:h},A,T),"invalidateCanvasLoader"),Z=c((m,A,T)=>{let I=`${A}\0${m}`;for(w.delete(I),w.set(I,{specifier:m,importer:A,packageName:T});w.size>$c;){let U=w.keys().next().value;if(U===void 0)break;w.delete(U)}J()},"rememberUnresolvedImport"),X=c(m=>{for(let[A,T]of w)Dc(T.importer,m)&&w.delete(A);J()},"forgetUnresolvedImportsFrom"),Se=c(m=>{k.get(m)?.watcher.close(),k.delete(m)},"closeUnresolvedImportWatcher"),Me=c(()=>{P!==null&&(clearTimeout(P),P=null)},"cancelUnresolvedImportWatchRearm"),be=c(()=>{P!==null||!C||w.size===0||(P=setTimeout(()=>{P=null,C&&w.size>0&&(J(),_())},Lc),P.unref?.())},"scheduleUnresolvedImportWatchRearm"),le=c(()=>{Me();for(let m of[...k.keys()])Se(m)},"closeUnresolvedImportWatchers"),H=c(()=>[...w.values()].some(m=>m.packageName!==void 0),"hasUnresolvedBarePackages"),We=c(m=>{let A=(0,G.dirname)(st(m.importer)),T;for(;;){try{if((0,ae.statSync)((0,G.join)(A,"node_modules")).isDirectory())return(0,G.join)(A,"node_modules",m.packageName)}catch{}if(T===void 0)try{(0,ae.statSync)((0,G.join)(A,"package.json")).isFile()&&(T=A)}catch{}let I=(0,G.dirname)(A);if(I===A)break;A=I}return(0,G.join)(T??f,"node_modules",m.packageName)},"packageWatchTarget"),ur=c(m=>m.packageName?We(m):(0,G.resolve)((0,G.dirname)(st(m.importer)),st(m.specifier)),"unresolvedImportWatchTarget"),R=c(m=>{let A=m;for(;;){try{if((0,ae.statSync)(A).isDirectory())return A}catch{}let T=(0,G.dirname)(A);if(T===A)return;A=T}},"nearestExistingDirectory");function J(){if(!C||w.size===0){le();return}let m=new Map;for(let A of w.values()){let T=ur(A),I=R(T);if(!I)continue;let U=m.get(I);m.set(I,{recursive:U?.recursive===!0||I===T})}for(let[A,T]of[...k]){let I=m.get(A);(!I||I.recursive!==T.recursive)&&Se(A)}for(let[A,T]of m)if(!k.has(A))try{let I=(0,ae.watch)(A,{recursive:T.recursive},_);k.set(A,{watcher:I,recursive:T.recursive}),I.on("error",()=>{Se(A),be()}),T.recursive&&_()}catch{Se(A),be()}[...m.keys()].every(A=>k.has(A))&&Me()}c(J,"syncUnresolvedImportWatcher");function _(){if(L||M){W=!0;return}L=!0,queueMicrotask(()=>{L=!1,j()})}c(_,"scheduleUnresolvedImportResolution");async function j(){let m=C;if(!(!m||M)){M=!0;try{do{W=!1,J();let A=!1;for(let[T,I]of[...w]){let U;if(Ci(I.specifier)){let q=I.specifier.search(/[?#]/),Oe=q<0?I.specifier:I.specifier.slice(0,q),K=(0,G.resolve)((0,G.dirname)(st(I.importer)),Oe),ce=[K,...xi.map(de=>`${K}${de}`),...xi.map(de=>(0,G.join)(K,`index${de}`))];for(let de of ce)try{if((0,ae.statSync)(de).isFile()){U=de;break}}catch{}}if(!U&&I.packageName)try{U=(0,_i.createRequire)(st(I.importer)).resolve(I.specifier)}catch{}U&&(m.watcher.add(U),w.delete(T),E.errorServer.clearErrorForModules([I.importer]),A=!0)}A&&m.ws.send({type:"full-reload",path:"*"}),J()}while(W)}finally{M=!1}}}return c(j,"runUnresolvedImportResolution"),{name:"tempo-annotate",apply:"serve",enforce:"pre",config(m,A){if(!e||A.command!=="serve")return;lo(m),co(m);let T=["react","react-dom"].filter(U=>!m.resolve?.dedupe?.includes(U)),I=oo(m.root);return{resolve:{dedupe:T,...I.length?{alias:I}:{}},...m.css?.devSourcemap===void 0?{css:{devSourcemap:!0}}:{},...r&&m.server?.watch!==null?{server:{watch:{ignored:[Ys]}}}:{}}},resolveId:{order:"pre",async handler(m,A,T){if(m.endsWith(".astro?tempo-component")){let I=await this.resolve(m.slice(0,-16),A,{...T,skipSelf:!0});return I?`\0tempo:astro-component:${encodeURIComponent(I.id)}.js`:null}if(e&&m===Gt)return Xt;if(m===bi)return tn;if(m===Ei&&A===tn){let I=await this.resolve(m,A,{...T,skipSelf:!0});return I||wi()}if(e&&A&&!A.startsWith("\0")){let I=Fc(m);if(!Ci(m)&&!I)return null;try{let U=await this.resolve(m,A,{...T,skipSelf:!0});return U||Z(m,A,I),U}catch(U){throw Z(m,A,I),U}}return null}},load:{order:"pre",async handler(m){if(m.startsWith("\0tempo:astro-component:")){let A=decodeURIComponent(m.slice(23,-3)),{readAstroControlsMetadata:T}=await Promise.resolve().then(()=>(vi(),Si)),I=await T(A,async(U,q)=>(await this.resolve(U,q,{skipSelf:!0}))?.id??null,U=>C?.watcher.add(U),[(0,G.resolve)(h,"tempo/controls.ts"),(0,G.resolve)(f,"controls.ts")]);return p.set(m,new Set(I.dependencies)),`export default {kind:"astro-component",module:${JSON.stringify(A.replaceAll("\\","/"))},__tempoAstroControls:${JSON.stringify(I).replaceAll("<","\\u003c")}};`}return e&&m===Xt?Pr:m===tn?`import { installTempoInteractProjectionSource } from ${JSON.stringify(Ei)};
176
+ let stop;
177
+ const releaseOwner = () => {
178
+ if (window.__tempoInteractProjectionOwner === "vite") delete window.__tempoInteractProjectionOwner;
179
+ };
180
+ if (window.parent !== window && !window.__tempoInteractProjectionOwner && (window.name === ${JSON.stringify(xt)} || window.name.startsWith(${JSON.stringify(`${xt}:`)}))) {
181
+ window.__tempoInteractProjectionOwner = "vite";
182
+ const stopSource = installTempoInteractProjectionSource();
183
+ stop = () => {
184
+ stopSource();
185
+ releaseOwner();
186
+ };
187
+ }
188
+ if (import.meta.hot) import.meta.hot.dispose(() => {
189
+ stop?.();
190
+ releaseOwner();
191
+ });`:(!e||y==="build"||m.startsWith("\0")||await F.settled(m),null)}},_tempoErrorServer:E.errorServer,_tempoHotUpdateState:{lastHotUpdateMtimeMs(m){return F.lastHotUpdateMtimeMs(m)}},_tempoUnresolvedImportState:{get size(){return w.size},get barePackageCount(){return[...w.values()].filter(m=>m.packageName!==void 0).length},get hasBarePackageWatcher(){return k.size>0&&H()},get barePackageWatchPath(){return H()?k.keys().next().value:void 0},get hasUnresolvedImportWatcher(){return k.size>0},get unresolvedImportWatchPath(){return k.keys().next().value},get unresolvedImportWatchPaths(){return[...k.keys()]},get hasUnresolvedImportWatchRearm(){return P!==null},emitUnresolvedImportWatcherErrorForTesting(){for(let{watcher:m}of k.values())m.emit("error",new Error("Simulated unresolved-import watcher failure"))}},configResolved(m){e&&(y=m.command,x=m.server?.hmr!==!1,y==="serve"&&x&&si(m.plugins??[]),f=Ai(t.root??m.root),h=t.sourceIdentityRoot?Ai((0,G.resolve)(m.root,t.sourceIdentityRoot)):f)},configureServer(m){if(!e||y!=="serve")return;let A=m.config?.base??"/",T=to(A);$o(m),F.installCoverage(m);let I=wi(),U=m.config?.server?.fs?.allow;if(Array.isArray(U)){let K=[h,...I?[(0,G.dirname)(I)]:[]];for(let ce of K)U.includes(ce)||U.push(ce)}C=m,E.attach(m),J(),m.watcher?.once?.("close",le),m.httpServer?.once("close",le),m.middlewares.use((K,ce,de)=>{if(K.url?.split(/[?#]/)[0]===Kt(A)){T(K,ce,de);return}let _e=m.environments?.client?.moduleGraph;if(_e&&K.url&&(K.method==="GET"||K.method==="HEAD")){let ve=S.observeRequest(_e,K.url,m.config.base,K.headers["sec-fetch-dest"],K.headers["if-none-match"]);ve&&ce.once("finish",()=>{ve(ce.statusCode,ce.getHeader("content-type"),ce.getHeader("etag"))})}let Re=K.url?.match(/^\/tempo-assets\/([a-zA-Z0-9._-]+)(?:\?.*)?$/)?.[1];if(Re){let ve=["public","static"].map(Ee=>(0,G.join)(h,Ee,"tempo-assets",Re)).find(Ee=>(0,ae.existsSync)(Ee));ve&&(K.url=`/@fs/${ve.replace(/\\/g,"/")}`)}Wc(E,m,K,ce,de)});let q=r?ei({target:r,config:m.config}):null;if(q&&(m.middlewares.use(q.prefix),m.httpServer?.on("upgrade",q.upgrade)),r){let K=Zs({target:r,onRelaunch(){m.config.logger.info("[tempo] Flutter dev server relaunched; reloading the canvas host page"),m.ws.send({type:"full-reload"})}});m.httpServer?.once("close",K),m.watcher?.once?.("close",K)}F.installSweep(m,{sweepIntervalMs:Bc,listExtraFiles:c(()=>E.errorServer.errorFiles,"listExtraFiles"),afterSweep:c(()=>E.pollRecovery(m),"afterSweep")}),Jc(m);let Oe=c(K=>{let ce=K.send.bind(K);K.send=((...de)=>{let _e=de[0];if(typeof _e=="object"&&_e!==null&&"type"in _e){let Re=_e;if(Re.type==="prune"){let ve=m.environments?.client?.moduleGraph;ve&&S.observePrune(ve,Re.paths??[])}if(Re.type==="error")E.recordHmrError(Re.err);else if(Re.type==="update"&&!$.has(_e)){$.add(_e);let ve=Re,Ee=ve.updates,at=Ee?z.filter(Ee):void 0;Ee&&at&&at.length!==Ee.length&&(ve.updates=at);let ji=at?.map(pr=>pr.path).filter(pr=>typeof pr=="string")??[];if(E.errorServer.clearErrorForModules(ji),Ee&&Ee.length>0&&at?.length===0)return}}return ce(...de)})},"interceptHmrSend");return Oe(m.ws),()=>{let K=m.environments?.client?.hot;K&&K!==m.ws&&Oe(K),q&&m.middlewares.use(q.fallthrough)}},closeBundle(){p.clear(),C=void 0,F.clear(),z.clear(),S.clear(),E.reset(),le()},hotUpdate:{order:"post",async handler(m){let A=d(m.file,this.environment.moduleGraph,m.modules);if(!e||this.environment.config.consumer!=="client")return A;if(m.modules.splice(0,m.modules.length,...A),B(m.file))return[];if(m.type==="create"&&/\/\.tempo\/asset-edit-previews\/\d+\/index\.canvas\.tsx$/.test(m.file.replace(/\\/g,"/")))return[];if(m.type==="update"&&m.modules.length>0&&F.observeUpdate(m.server,m.file),m.type!=="create"&&X(m.file),m.type==="update"&&E.hasActiveCompileError(m.file)&&await E.recover(m.server,m.file))return[];if(m.type==="delete")return g.forgetDefaultExportIdentity(m.file),S.suppressDeletion(this.environment.moduleGraph,m.modules)?[]:void 0;if(m.type==="update"&&await b(m))return[];if(m.type==="update")return Q(m.file,this.environment.moduleGraph,m.modules)}},handleHotUpdate:{order:"post",async handler(m){let A=d(m.file,m.server.moduleGraph,m.modules);if(m.modules.splice(0,m.modules.length,...A),!!e)return B(m.file)?[]:(m.modules.length>0&&F.observeUpdate(m.server,m.file),X(m.file),E.hasActiveCompileError(m.file)&&await E.recover(m.server,m.file)?[]:await b(m)?[]:Q(m.file,m.server.moduleGraph,m.modules))}},transformIndexHtml(m,A){if(!e||y!=="serve")return;let T=[{tag:"script",attrs:{src:Kt(C?.config.base??"/")},injectTo:"head-prepend"}];x&&T.push({tag:"script",attrs:{type:"module",src:Gt},injectTo:"head-prepend"}),Hc(m)||T.push({tag:"meta",attrs:{name:Ic,content:f},injectTo:"head"}),jc(m)||T.push({tag:"meta",attrs:{name:Pc,content:h},injectTo:"head"});let I=(0,ge.createTempoHostIdentity)("vite",{root:f,pluginActive:!0}).workspaceNonce;I&&!Uc(m)&&T.push({tag:"meta",attrs:{name:ge.TEMPO_WORKSPACE_NONCE_META_NAME,content:I},injectTo:"head"});let U=A?.originalUrl??A?.path,q=U?Oc(U):!1;return U&&!q&&(T.push({tag:"script",children:Nc,injectTo:"head-prepend"}),T.push({tag:"script",attrs:{type:"module",src:bi},injectTo:"head-prepend"})),T.length>0?T:void 0},async transform(m,A){if(!e||y==="build"||(C&&Lo(C),A.startsWith("\0")))return null;let T=st(A);if(T.replace(/\\/g,"/").endsWith("/vite/dist/client/client.mjs")){let I=ui(m);return I===m?null:{code:I,map:null}}return g.annotateJsxModule(this,m,T)}}}var ae,_i,G,Ri,ge,kc,Tc,Ic,Pc,bi,tn,Ei,Nc,$c,xi,Lc,Bc,Ti=O(()=>{Ir();Lt();Nr();so();uo();wo();Do();ae=require("node:fs"),_i=require("node:module"),G=require("node:path"),Ri=require("node:url");ds();fs();Us();Ws();ri();oi();ge=require("@tempo-sdk-public/host-identity");yt();ii();ci();pi();gi();qt();kc=["**/*.tsx","**/*.jsx"],Tc=["**/node_modules/**"],Ic="tempo-project-root",Pc="tempo-source-identity-root",bi="/@tempo/interact-projection",tn="\0tempo:interact-projection",Ei="tempo-sdk/canvas/interact-projection";c(wi,"resolveOwnInteractProjectionModule");Nc=`
192
+ (function() {
193
+ if (window.parent === window || (window.name !== ${JSON.stringify(xt)} && !window.name.startsWith(${JSON.stringify(`${xt}:`)}))) return;
194
+ var roots = new Map();
195
+ var existing = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
196
+ if (existing) {
197
+ if (existing.__tempoPendingFiberRoots) return;
198
+ existing.__tempoPendingFiberRoots = roots;
199
+ var originalCommit = existing.onCommitFiberRoot && existing.onCommitFiberRoot.bind(existing);
200
+ existing.onCommitFiberRoot = function(rendererId, root) {
201
+ if (existing.__tempoPendingFiberRoots === roots) roots.set(rendererId, root);
202
+ if (originalCommit) originalCommit.apply(null, arguments);
203
+ };
204
+ return;
205
+ }
206
+ window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
207
+ supportsFiber: true,
208
+ renderers: new Map(),
209
+ __tempoPendingFiberRoots: roots,
210
+ inject: function(renderer) {
211
+ var id = this.renderers.size + 1;
212
+ this.renderers.set(id, renderer);
213
+ return id;
214
+ },
215
+ onCommitFiberRoot: function(rendererId, root) {
216
+ if (this.__tempoPendingFiberRoots === roots) roots.set(rendererId, root);
217
+ },
218
+ onCommitFiberUnmount: function() {},
219
+ checkDCE: function() {},
220
+ onScheduleFiberRoot: function() {}
221
+ };
222
+ })();`;c(st,"cleanModuleId");c(Mc,"isCanvasHostRequest");c(Oc,"isDeclarativeCanvasHostRequest");$c=256,xi=[".mjs",".js",".mts",".ts",".jsx",".tsx",".json"],Lc=1e3;c(Ci,"isRelativeImportSpecifier");c(Fc,"barePackageName");c(Dc,"resolvedIdMatchesFile");c(Ai,"resolveCanonicalRoot");c(Hc,"hasRootMetaTag");c(jc,"hasSourceIdentityRootMetaTag");c(Uc,"hasWorkspaceNonceMetaTag");c(Vc,"runsVueSourceAnnotation");c(Wc,"handleTempoMiddleware");Bc=ht;c(Jc,"installTailwindScanNet");c(ki,"tempoVitePlugin")});var Mi={};Pt(Mi,{astroAnnotationPlugins:()=>Pi,default:()=>Kc,tempoAstro:()=>rn,withTempoAstro:()=>Ni});function rn(t={}){return{name:"tempo-astro",hooks:{async"astro:config:setup"({config:e,command:r,updateConfig:n,injectRoute:o,createCodegenDir:i,injectScript:s}){if(r!=="dev"||!(t.enabled??!!process.env.TEMPO))return;let[a,l]=process.versions.node.split(".").map(Number);if(a<22||a===22&&l<12)throw new Error("Tempo Astro support requires Node 22.12 or newer");let p=(0,Ii.createRequire)(new URL("package.json",e.root))("astro/package.json").version;if(!p.startsWith("7."))throw new Error(`Tempo native Astro support requires Astro 7; this app uses ${p}`);let d=ye.realpathSync.native((0,It.fileURLToPath)(e.root)),{root:f,tempoRoot:g,canvasesRoot:h}=An(d,t.root,t.canvasesRoot),y=(0,It.fileURLToPath)(i()),x=[h,(0,he.resolve)(g,".tempo/library-canvases"),(0,he.resolve)(g,".tempo/asset-edit-previews")],E=Xn(f,x,y,t.styles?.map(k=>(0,he.resolve)(d,k))??_n(d));o({pattern:"/__tempo/astro/[...storyboard]",entrypoint:E.entrypoint,prerender:!1}),s("head-inline",ro(await Tr())),s("head-inline",`if(!document.querySelector('meta[name="tempo-project-root"]')){const m=document.createElement('meta');m.name='tempo-project-root';m.content=${JSON.stringify(f).replaceAll("<","\\u003c")};document.head.append(m)}`);let w=(0,It.fileURLToPath)(new URL(Ce("astro.ts").endsWith(".ts")?"./astro/document-client.ts":"./astro/document-client.js",Ce("astro.ts")));s("page",`import { startAstroDocumentClient } from ${JSON.stringify(w)}; startAstroDocumentClient(import.meta.hot);`),n({vite:{plugins:[{name:"tempo:astro-identity",enforce:"pre",configureServer(k){k.middlewares.use((L,M,W)=>{if(L.method!=="GET"||L.url?.split("?")[0]!==it.TEMPO_HOST_IDENTITY_ENDPOINT)return W();M.setHeader(it.TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,"1"),M.setHeader("Cache-Control","no-store"),M.setHeader("Content-Type","application/json"),M.end(JSON.stringify({...(0,it.createTempoHostIdentity)("astro",{root:g,pluginActive:!0}),capabilities:{astroComponents:1}}))})}},qn(f,[...x,(0,he.resolve)(y,"*.astro")]),...Pi(f,y),ki({root:f,enabled:!0}),E.plugin]}})}}}}function Pi(t,e){let r=new WeakMap,n=c(s=>{let a=r.get(s);return a||(a=new Map,r.set(s,a)),a},"receiptMap"),o=(0,It.fileURLToPath)(new URL("./astro/runtime.js",Ce("astro.ts"))),i=Ce("astro.ts").endsWith(".ts")?o.replace(/\.js$/,".ts"):o;return[{name:"tempo:astro-source",enforce:"pre",transform:{order:"pre",handler(s,a,l){let u=a.endsWith(".astro"),p=l?.ssr&&/\.[jt]sx?$/.test(a);if(!u&&!p||a.includes("?")||!(0,he.isAbsolute)(a))return;let d=n(this.environment);d.delete(a);let f;try{f=ye.realpathSync.native(a)}catch{return}if(e&&!(0,he.relative)(e,f).startsWith(".."))return;let g=(0,he.relative)(t,f).replaceAll("\\","/");if(!g||g.startsWith("../")||(0,he.isAbsolute)(g)||g.split("/").includes("node_modules"))return;let h=(0,ye.openSync)(f,"r"),y;try{let E=(0,ye.fstatSync)(h),w=(0,ye.readFileSync)(h,"utf8"),C=(0,ye.fstatSync)(h);if(s!==w||!["mtimeMs","ctimeMs","size","ino","dev"].every(L=>E[L]===C[L]))return;let k=u?xe(s):null;if(k&&k.kind!=="ok")return;y={filepath:g,sourceVersion:k?.sourceVersion??ke(s),modifiedTs:Math.trunc(E.mtimeMs)}}finally{(0,ye.closeSync)(h)}if(p){d.set(a,{metadata:y});return}let x=En(s,y,a);return x.kind!=="ok"&&this.error(x.message),d.set(a,{metadata:y,occurrenceFactory:x.occurrenceFactory}),{code:x.code,map:x.map}}}},{name:"tempo:astro-compiled",enforce:"post",transform:{order:"post",handler(s,a){if(e&&a.endsWith(".astro")&&!(0,he.relative)(e,a).startsWith(".."))return br(s,a,null,i,"$$tempoStoryboardHostId");let l=n(this.environment),u=l.get(a);if(u)return l.delete(a),u.occurrenceFactory?br(s,a,u.metadata,i,u.occurrenceFactory):xn(s,a,u.metadata,i)}}}]}function Ni(t){return t instanceof Promise?t.then(e=>Ni(e)):{...t,integrations:[...t.integrations??[],rn()]}}var ye,Ii,he,It,it,Kc,Oi=O(()=>{ye=require("node:fs"),Ii=require("node:module"),he=require("node:path"),It=require("node:url");Je();wn();Xe();it=require("@tempo-sdk-public/host-identity");Cn();Rn();zn();Yn();Ir();Ti();Lt();c(rn,"tempoAstro");c(Pi,"astroAnnotationPlugins");Kc=rn;c(Ni,"withTempoAstro")});var Di={};Pt(Di,{astroHostId:()=>Li,instrumentCreateComponent:()=>qc,instrumentFrameworkComponent:()=>zc,instrumentRenderComponent:()=>Yc});function zc(t,e){return(typeof t=="function"||t&&typeof t=="object"&&"$$typeof"in t)&&Object.isExtensible(t)&&!Object.prototype.hasOwnProperty.call(t,lr)&&Object.defineProperty(t,lr,{value:e}),t}function Li(){return globalThis.crypto.randomUUID()}function on(t,e){return`<!--tempo:astro:${t}${e===void 0?"":`:${encodeURIComponent(JSON.stringify(e)).replaceAll("-","%2D")}`}-->`}function sn(t,e){return t&&typeof t.then=="function"?Promise.resolve(t).then(e):e(t)}function Fi(t,e){if(!t||typeof t!="object")return t;if(t[Xc]&&t.content)return{...t,content:Fi(t.content,e)};if(!t[Gc])return t;let r=[...t.htmlParts];return r[r.length-1]+=on("m",e),Object.assign(Object.create(Object.getPrototypeOf(t)),t,{htmlParts:r})}function qc(t,e){return(...r)=>{let n=c(s=>function(...a){return sn(s.apply(this,a),l=>Fi(l,e))},"wrap"),o=r[0],i=typeof o=="function"?t(n(o),...r.slice(1)):t({...o,factory:n(o.factory)},...r.slice(1));return Object.defineProperty(i,lr,{value:e}),i}}function Yc(t){return(e,r,n,o={},...i)=>{let s=o[$i];if(!s)return t(e,r,n,o,...i);let a={...o};return delete a[$i],sn(t(e,r,n,a,...i),l=>({render(u){let p=Li();return u.write((0,nn.markHTMLString)(on("b",{occurrence:p,source:s,definition:n?.[lr]??null}))),sn(l.render(u),()=>u.write((0,nn.markHTMLString)(on("e",{occurrence:p}))))}}))}}var nn,$i,lr,Gc,Xc,Hi=O(()=>{nn=require("astro/runtime/server/index.js"),$i="__tempo_astro_callsite__",lr=Symbol.for("tempo.astro.definition"),Gc=Symbol.for("astro.renderTemplateResult"),Xc=Symbol.for("astro.headAndContent");c(zc,"instrumentFrameworkComponent");c(Li,"astroHostId");c(on,"comment");c(sn,"thenOrValue");c(Fi,"withReceipt");c(qc,"instrumentCreateComponent");c(Yc,"instrumentRenderComponent")});var Zc={};Pt(Zc,{getEntry:()=>Qc});module.exports=fr(Zc);var cr={};function Qc(t){if(cr[t])return cr[t];switch(t){case"astro":return cr[t]=(Oi(),fr(Mi));case"astro/runtime":return cr[t]=(Hi(),fr(Di));default:throw new Error("Unknown Tempo runtime entry: "+t)}}c(Qc,"getEntry");0&&(module.exports={getEntry});
223
+
224
+ return module.exports;};