@react-grab/visual-edit 0.0.90 → 0.0.92

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,116 @@
1
+ var ReactGrabVisualEdit=(function(exports){'use strict';function Er(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function Sr(){let e=Er();if(e.__xstate__)return e.__xstate__}var Jt=e=>{if(typeof window>"u")return;let t=Sr();t&&t.register(e);};var Je=class{constructor(t){this._process=t,this._active=false,this._current=null,this._last=null;}start(){this._active=true,this.flush();}clear(){this._current&&(this._current.next=null,this._last=this._current);}enqueue(t){let n={value:t,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush();}flush(){for(;this._current;){let t=this._current;this._process(t.value),this._current=t.next;}this._last=null;}},Ct=".",Tr="",At="",Cr="#",Ar="*",on="xstate.init",sn="xstate.error",vt="xstate.stop";function _r(e,t){return {type:`xstate.after.${e}.${t}`}}function wt(e,t){return {type:`xstate.done.state.${e}`,output:t}}function Nr(e,t){return {type:`xstate.done.actor.${e}`,output:t,actorId:e}}function _t(e,t){return {type:`xstate.error.actor.${e}`,error:t,actorId:e}}function Nt(e){return {type:on,input:e}}function ie(e){setTimeout(()=>{throw e});}var kr=typeof Symbol=="function"&&Symbol.observable||"@@observable";function an(e,t){let n=Qt(e),r=Qt(t);return typeof r=="string"?typeof n=="string"?r===n:false:typeof n=="string"?n in r:Object.keys(n).every(o=>o in r?an(n[o],r[o]):false)}function et(e){if(cn(e))return e;let t=[],n="";for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n="";continue}n+=e[r];}return t.push(n),t}function Qt(e){if(to(e))return e.value;if(typeof e!="string")return e;let t=et(e);return Mr(t)}function Mr(e){if(e.length===1)return e[0];let t={},n=t;for(let r=0;r<e.length-1;r++)if(r===e.length-2)n[e[r]]=e[r+1];else {let o=n;n={},o[e[r]]=n;}return t}function kt(e,t){let n={},r=Object.keys(e);for(let o=0;o<r.length;o++){let s=r[o];n[s]=t(e[s],s,e,o);}return n}function ln(e){return cn(e)?e:[e]}function se(e){return e===void 0?[]:ln(e)}function xt(e,t,n,r){return typeof e=="function"?e({context:t,event:n,self:r}):e}function cn(e){return Array.isArray(e)}function Lr(e){return e.type.startsWith("xstate.error.actor")}function ye(e){return ln(e).map(t=>typeof t>"u"||typeof t=="string"?{target:t}:t)}function un(e){if(!(e===void 0||e===Tr))return se(e)}function Et(e,t,n){let r=typeof e=="object",o=r?e:void 0;return {next:(r?e.next:e)?.bind(o),error:(r?e.error:t)?.bind(o),complete:(r?e.complete:n)?.bind(o)}}function Mt(e,t){return `${t}.${e}`}function Re(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,r,o]=n,l=e.getStateNodeById(o).config.invoke;return (Array.isArray(l)?l[r]:l).src}function dn(e,t){if(t===e||t===Ar)return true;if(!t.endsWith(".*"))return false;let n=t.split("."),r=e.split(".");for(let o=0;o<n.length;o++){let s=n[o],l=r[o];if(s==="*")return o===n.length-1;if(s!==l)return false}return true}function en(e,t){return `${e.sessionId}.${t}`}var Ir=0;function Or(e,t){let n=new Map,r=new Map,o=new WeakMap,s=new Set,l={},{clock:c,logger:f}=t,m={schedule:(g,x,_,L,P=Math.random().toString(36).slice(2))=>{let K={source:g,target:x,event:_,delay:L,id:P,startedAt:Date.now()},W=en(g,P);v._snapshot._scheduledEvents[W]=K;let te=c.setTimeout(()=>{delete l[W],delete v._snapshot._scheduledEvents[W],v._relay(g,x,_);},L);l[W]=te;},cancel:(g,x)=>{let _=en(g,x),L=l[_];delete l[_],delete v._snapshot._scheduledEvents[_],L!==void 0&&c.clearTimeout(L);},cancelAll:g=>{for(let x in v._snapshot._scheduledEvents){let _=v._snapshot._scheduledEvents[x];_.source===g&&m.cancel(g,_.id);}}},S=g=>{if(!s.size)return;let x={...g,rootId:e.sessionId};s.forEach(_=>_.next?.(x));},v={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${Ir++}`,_register:(g,x)=>(n.set(g,x),g),_unregister:g=>{n.delete(g.sessionId);let x=o.get(g);x!==void 0&&(r.delete(x),o.delete(g));},get:g=>r.get(g),getAll:()=>Object.fromEntries(r.entries()),_set:(g,x)=>{let _=r.get(g);if(_&&_!==x)throw new Error(`Actor with system ID '${g}' already exists.`);r.set(g,x),o.set(x,g);},inspect:g=>{let x=Et(g);return s.add(x),{unsubscribe(){s.delete(x);}}},_sendInspectionEvent:S,_relay:(g,x,_)=>{v._sendInspectionEvent({type:"@xstate.event",sourceRef:g,actorRef:x,event:_}),x._send(_);},scheduler:m,getSnapshot:()=>({_scheduledEvents:{...v._snapshot._scheduledEvents}}),start:()=>{let g=v._snapshot._scheduledEvents;v._snapshot._scheduledEvents={};for(let x in g){let{source:_,target:L,event:P,delay:K,id:W}=g[x];m.schedule(_,L,P,K,W);}},_clock:c,_logger:f};return v}var bt=false,tt=1,Q=(function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e})({}),Pr={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:false},St=class{constructor(t,n){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new Je(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=Q.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let r={...Pr,...n},{clock:o,logger:s,parent:l,syncSnapshot:c,id:f,systemId:m,inspect:S}=r;this.system=l?l.system:Or(this,{clock:o,logger:s}),S&&!l&&this.system.inspect(Et(S)),this.sessionId=this.system._bookId(),this.id=f??this.sessionId,this.logger=n?.logger??this.system._logger,this.clock=n?.clock??this.system._clock,this._parent=l,this._syncSnapshot=c,this.options=r,this.src=r.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:v=>{this._deferred.push(v);},system:this.system,stopChild:v=>{if(v._parent!==this)throw new Error(`Cannot stop child actor ${v.id} of ${this.id} because it is not a child`);v._stop();},emit:v=>{let g=this.eventListeners.get(v.type),x=this.eventListeners.get("*");if(!g&&!x)return;let _=[...g?g.values():[],...x?x.values():[]];for(let L of _)try{L(v);}catch(P){ie(P);}},actionExecutor:v=>{let g=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:v.type,params:v.params}}),!v.exec)return;let x=bt;try{bt=!0,v.exec(v.info,v.params);}finally{bt=x;}};this._processingStatus===Q.Running?g():this._deferred.push(g);}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),m&&(this.systemId=m,this.system._set(m,this)),this._initState(n?.snapshot??n?.state),m&&this._snapshot.status!=="active"&&this.system._unregister(this);}_initState(t){try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,this.options?.input);}catch(n){this._snapshot={status:"error",output:void 0,error:n};}}update(t,n){this._snapshot=t;let r;for(;r=this._deferred.shift();)try{r();}catch(o){this._deferred.length=0,this._snapshot={...t,status:"error",error:o};}switch(this._snapshot.status){case "active":for(let o of this.observers)try{o.next?.(t);}catch(s){ie(s);}break;case "done":for(let o of this.observers)try{o.next?.(t);}catch(s){ie(s);}this._stopProcedure(),this._complete(),this._doneEvent=Nr(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case "error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:t});}subscribe(t,n,r){let o=Et(t,n,r);if(this._processingStatus!==Q.Stopped)this.observers.add(o);else switch(this._snapshot.status){case "done":try{o.complete?.();}catch(s){ie(s);}break;case "error":{let s=this._snapshot.error;if(!o.error)ie(s);else try{o.error(s);}catch(l){ie(l);}break}}return {unsubscribe:()=>{this.observers.delete(o);}}}on(t,n){let r=this.eventListeners.get(t);r||(r=new Set,this.eventListeners.set(t,r));let o=n.bind(void 0);return r.add(o),{unsubscribe:()=>{r.delete(o);}}}start(){if(this._processingStatus===Q.Running)return this;this._syncSnapshot&&this.subscribe({next:r=>{r.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:r});},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=Q.Running;let t=Nt(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case "done":return this.update(this._snapshot,t),this;case "error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope);}catch(r){return this._snapshot={...this._snapshot,status:"error",error:r},this._error(r),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let n,r;try{n=this.logic.transition(this._snapshot,t,this._actorScope);}catch(o){r={err:o};}if(r){let{err:o}=r;this._snapshot={...this._snapshot,status:"error",error:o},this._error(o);return}this.update(n,t),t.type===vt&&(this._stopProcedure(),this._complete());}_stop(){return this._processingStatus===Q.Stopped?this:(this.mailbox.clear(),this._processingStatus===Q.NotStarted?(this._processingStatus=Q.Stopped,this):(this.mailbox.enqueue({type:vt}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(let t of this.observers)try{t.complete?.();}catch(n){ie(n);}this.observers.clear();}_reportError(t){if(!this.observers.size){this._parent||ie(t);return}let n=false;for(let r of this.observers){let o=r.error;n||=!o;try{o?.(t);}catch(s){ie(s);}}this.observers.clear(),n&&ie(t);}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,_t(this.id,t));}_stopProcedure(){return this._processingStatus!==Q.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new Je(this._process.bind(this)),this._processingStatus=Q.Stopped,this.system._unregister(this),this)}_send(t){this._processingStatus!==Q.Stopped&&this.mailbox.enqueue(t);}send(t){this.system._relay(void 0,this,t);}attachDevTools(){let{devTools:t}=this.options;t&&(typeof t=="function"?t:Jt)(this);}toJSON(){return {xstate$$type:tt,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[kr](){return this}getSnapshot(){return this._snapshot}};function xe(e,...[t]){return new St(e,t)}function Dr(e,t,n,r,{sendId:o}){let s=typeof o=="function"?o(n,r):o;return [t,{sendId:s},void 0]}function Rr(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId);});}function Be(e){function t(n,r){}return t.type="xstate.cancel",t.sendId=e,t.resolve=Dr,t.execute=Rr,t}function Br(e,t,n,r,{id:o,systemId:s,src:l,input:c,syncSnapshot:f}){let m=typeof l=="string"?Re(t.machine,l):l,S=typeof o=="function"?o(n):o,v,g;return m&&(g=typeof c=="function"?c({context:t.context,event:n.event,self:e.self}):c,v=xe(m,{id:S,src:l,parent:e.self,syncSnapshot:f,systemId:s,input:g})),[fe(t,{children:{...t.children,[S]:v}}),{id:o,systemId:s,actorRef:v,src:l,input:g},void 0]}function Hr(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==Q.Stopped&&t.start();});}function He(...[e,{id:t,systemId:n,input:r,syncSnapshot:o=false}={}]){function s(l,c){}return s.type="xstate.spawnChild",s.id=t,s.systemId=n,s.src=e,s.input=r,s.syncSnapshot=o,s.resolve=Br,s.execute=Hr,s}function $r(e,t,n,r,{actorRef:o}){let s=typeof o=="function"?o(n,r):o,l=typeof s=="string"?t.children[s]:s,c=t.children;return l&&(c={...c},delete c[l.id]),[fe(t,{children:c}),l,void 0]}function Fr(e,t){if(t){if(e.system._unregister(t),t._processingStatus!==Q.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t);});}}function _e(e){function t(n,r){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=$r,t.execute=Fr,t}function Ne(e,t,n,r){let{machine:o}=r,s=typeof e=="function",l=s?e:o.implementations.guards[typeof e=="string"?e:e.type];if(!s&&!l)throw new Error(`Guard '${typeof e=="string"?e:e.type}' is not implemented.'.`);if(typeof l!="function")return Ne(l,t,n,r);let c={context:t,event:n},f=s||typeof e=="string"?void 0:"params"in e?typeof e.params=="function"?e.params({context:t,event:n}):e.params:void 0;return "check"in l?l.check(r,c,l):l(c,f)}var Lt=e=>e.type==="atomic"||e.type==="final";function Ce(e){return Object.values(e.states).filter(t=>t.type!=="history")}function $e(e,t){let n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function Fe(e){let t=new Set(e),n=fn(t);for(let r of t)if(r.type==="compound"&&(!n.get(r)||!n.get(r).length))tn(r).forEach(o=>t.add(o));else if(r.type==="parallel"){for(let o of Ce(r))if(o.type!=="history"&&!t.has(o)){let s=tn(o);for(let l of s)t.add(l);}}for(let r of t){let o=r.parent;for(;o;)t.add(o),o=o.parent;}return t}function pn(e,t){let n=t.get(e);if(!n)return {};if(e.type==="compound"){let o=n[0];if(o){if(Lt(o))return o.key}else return {}}let r={};for(let o of n)r[o.key]=pn(o,t);return r}function fn(e){let t=new Map;for(let n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function hn(e,t){let n=Fe(t);return pn(e,fn(n))}function nt(e,t){return t.type==="compound"?Ce(t).some(n=>n.type==="final"&&e.has(n)):t.type==="parallel"?Ce(t).every(n=>nt(e,n)):t.type==="final"}var ze=e=>e[0]===Cr;function mn(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(r=>dn(t,r)).sort((r,o)=>o.length-r.length).flatMap(r=>e.transitions.get(r))}function gn(e){let t=e.config.after;if(!t)return [];let n=o=>{let s=_r(o,e.id),l=s.type;return e.entry.push(Ge(s,{id:l,delay:o})),e.exit.push(Be(l)),l};return Object.keys(t).flatMap(o=>{let s=t[o],l=typeof s=="string"?{target:s}:s,c=Number.isNaN(+o)?o:+o,f=n(c);return se(l).map(m=>({...m,event:f,delay:c}))}).map(o=>{let{delay:s}=o;return {...de(e,o.event,o),delay:s}})}function de(e,t,n){let r=un(n.target),o=n.reenter??false,s=zr(e,r),l={...n,actions:se(n.actions),guard:n.guard,target:s,source:e,reenter:o,eventType:t,toJSON:()=>({...l,source:`#${e.id}`,target:s?s.map(c=>`#${c.id}`):void 0})};return l}function bn(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(n===At)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let r=e.config.on[n];t.set(n,ye(r).map(o=>de(e,n,o)));}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,ye(e.config.onDone).map(r=>de(e,n,r)));}for(let n of e.invoke){if(n.onDone){let r=`xstate.done.actor.${n.id}`;t.set(r,ye(n.onDone).map(o=>de(e,r,o)));}if(n.onError){let r=`xstate.error.actor.${n.id}`;t.set(r,ye(n.onError).map(o=>de(e,r,o)));}if(n.onSnapshot){let r=`xstate.snapshot.${n.id}`;t.set(r,ye(n.onSnapshot).map(o=>de(e,r,o)));}}for(let n of e.after){let r=t.get(n.eventType);r||(r=[],t.set(n.eventType,r)),r.push(n);}return t}function yn(e,t){let n=typeof t=="string"?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let r={source:e,actions:!t||typeof t=="string"?[]:se(t.actions),eventType:null,reenter:false,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function zr(e,t){if(t!==void 0)return t.map(n=>{if(typeof n!="string")return n;if(ze(n))return e.machine.getStateNodeById(n);let r=n[0]===Ct;if(r&&!e.parent)return De(e,n.slice(1));let o=r?e.key+n:n;if(e.parent)try{return De(e.parent,o)}catch(s){throw new Error(`Invalid transition definition for state node '${e.id}':
2
+ ${s.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function vn(e){let t=un(e.config.target);return t?{target:t.map(n=>typeof n=="string"?De(e.parent,n):n)}:e.parent.initial}function ve(e){return e.type==="history"}function tn(e){let t=It(e);for(let n of t)for(let r of $e(n,e))t.add(r);return t}function It(e){let t=new Set;function n(r){if(!t.has(r)){if(t.add(r),r.type==="compound")n(r.initial.target[0]);else if(r.type==="parallel")for(let o of Ce(r))n(o);}}return n(e),t}function Ae(e,t){if(ze(t))return e.machine.getStateNodeById(t);if(!e.states)throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);let n=e.states[t];if(!n)throw new Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function De(e,t){if(typeof t=="string"&&ze(t))try{return e.machine.getStateNodeById(t)}catch{}let n=et(t).slice(),r=e;for(;n.length;){let o=n.shift();if(!o.length)break;r=Ae(r,o);}return r}function Ue(e,t){if(typeof t=="string"){let o=e.states[t];if(!o)throw new Error(`State '${t}' does not exist on '${e.id}'`);return [e,o]}let n=Object.keys(t),r=n.map(o=>Ae(e,o)).filter(Boolean);return [e.machine.root,e].concat(r,n.reduce((o,s)=>{let l=Ae(e,s);if(!l)return o;let c=Ue(l,t[s]);return o.concat(c)},[]))}function Ur(e,t,n,r){let s=Ae(e,t).next(n,r);return !s||!s.length?e.next(n,r):s}function jr(e,t,n,r){let o=Object.keys(t),s=Ae(e,o[0]),l=rt(s,t[o[0]],n,r);return !l||!l.length?e.next(n,r):l}function Gr(e,t,n,r){let o=[];for(let s of Object.keys(t)){let l=t[s];if(!l)continue;let c=Ae(e,s),f=rt(c,l,n,r);f&&o.push(...f);}return o.length?o:e.next(n,r)}function rt(e,t,n,r){return typeof t=="string"?Ur(e,t,n,r):Object.keys(t).length===1?jr(e,t,n,r):Gr(e,t,n,r)}function Vr(e){return Object.keys(e.states).map(t=>e.states[t]).filter(t=>t.type==="history")}function pe(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function Kr(e,t){let n=new Set(e),r=new Set(t);for(let o of n)if(r.has(o))return true;for(let o of r)if(n.has(o))return true;return false}function wn(e,t,n){let r=new Set;for(let o of e){let s=false,l=new Set;for(let c of r)if(Kr(Tt([o],t,n),Tt([c],t,n)))if(pe(o.source,c.source))l.add(c);else {s=true;break}if(!s){for(let c of l)r.delete(c);r.add(o);}}return Array.from(r)}function Wr(e){let[t,...n]=e;for(let r of $e(t,void 0))if(n.every(o=>pe(o,r)))return r}function Ot(e,t){if(!e.target)return [];let n=new Set;for(let r of e.target)if(ve(r))if(t[r.id])for(let o of t[r.id])n.add(o);else for(let o of Ot(vn(r),t))n.add(o);else n.add(r);return [...n]}function xn(e,t){let n=Ot(e,t);if(!n)return;if(!e.reenter&&n.every(o=>o===e.source||pe(o,e.source)))return e.source;let r=Wr(n.concat(e.source));if(r)return r;if(!e.reenter)return e.source.machine.root}function Tt(e,t,n){let r=new Set;for(let o of e)if(o.target?.length){let s=xn(o,n);o.reenter&&o.source===s&&r.add(s);for(let l of t)pe(l,s)&&r.add(l);}return [...r]}function Xr(e,t){if(e.length!==t.size)return false;for(let n of e)if(!t.has(n))return false;return true}function Qe(e,t,n,r,o,s){if(!e.length)return t;let l=new Set(t._nodes),c=t.historyValue,f=wn(e,l,c),m=t;o||([m,c]=Jr(m,r,n,f,l,c,s,n.actionExecutor)),m=we(m,r,n,f.flatMap(v=>v.actions),s,void 0),m=Yr(m,r,n,f,l,s,c,o);let S=[...l];m.status==="done"&&(m=we(m,r,n,S.sort((v,g)=>g.order-v.order).flatMap(v=>v.exit),s,void 0));try{return c===t.historyValue&&Xr(t._nodes,l)?m:fe(m,{_nodes:S,historyValue:c})}catch(v){throw v}}function qr(e,t,n,r,o){if(r.output===void 0)return;let s=wt(o.id,o.output!==void 0&&o.parent?xt(o.output,e.context,t,n.self):void 0);return xt(r.output,e.context,s,n.self)}function Yr(e,t,n,r,o,s,l,c){let f=e,m=new Set,S=new Set;Zr(r,l,S,m),c&&S.add(e.machine.root);let v=new Set;for(let g of [...m].sort((x,_)=>x.order-_.order)){o.add(g);let x=[];x.push(...g.entry);for(let _ of g.invoke)x.push(He(_.src,{..._,syncSnapshot:!!_.onSnapshot}));if(S.has(g)){let _=g.initial.actions;x.push(..._);}if(f=we(f,t,n,x,s,g.invoke.map(_=>_.id)),g.type==="final"){let _=g.parent,L=_?.type==="parallel"?_:_?.parent,P=L||g;for(_?.type==="compound"&&s.push(wt(_.id,g.output!==void 0?xt(g.output,f.context,t,n.self):void 0));L?.type==="parallel"&&!v.has(L)&&nt(o,L);)v.add(L),s.push(wt(L.id)),P=L,L=L.parent;if(L)continue;f=fe(f,{status:"done",output:qr(f,t,n,f.machine.root,P)});}}return f}function Zr(e,t,n,r){for(let o of e){let s=xn(o,t);for(let c of o.target||[])!ve(c)&&(o.source!==c||o.source!==s||o.reenter)&&(r.add(c),n.add(c)),Te(c,t,n,r);let l=Ot(o,t);for(let c of l){let f=$e(c,s);s?.type==="parallel"&&f.push(s),En(r,t,n,f,!o.source.parent&&o.reenter?void 0:s);}}}function Te(e,t,n,r){if(ve(e))if(t[e.id]){let o=t[e.id];for(let s of o)r.add(s),Te(s,t,n,r);for(let s of o)yt(s,e.parent,r,t,n);}else {let o=vn(e);for(let s of o.target)r.add(s),o===e.parent?.initial&&n.add(e.parent),Te(s,t,n,r);for(let s of o.target)yt(s,e.parent,r,t,n);}else if(e.type==="compound"){let[o]=e.initial.target;ve(o)||(r.add(o),n.add(o)),Te(o,t,n,r),yt(o,e,r,t,n);}else if(e.type==="parallel")for(let o of Ce(e).filter(s=>!ve(s)))[...r].some(s=>pe(s,o))||(ve(o)||(r.add(o),n.add(o)),Te(o,t,n,r));}function En(e,t,n,r,o){for(let s of r)if((!o||pe(s,o))&&e.add(s),s.type==="parallel")for(let l of Ce(s).filter(c=>!ve(c)))[...e].some(c=>pe(c,l))||(e.add(l),Te(l,t,n,e));}function yt(e,t,n,r,o){En(n,r,o,$e(e,t));}function Jr(e,t,n,r,o,s,l,c){let f=e,m=Tt(r,o,s);m.sort((v,g)=>g.order-v.order);let S;for(let v of m)for(let g of Vr(v)){let x;g.history==="deep"?x=_=>Lt(_)&&pe(_,v):x=_=>_.parent===v,S??={...s},S[g.id]=Array.from(o).filter(x);}for(let v of m)f=we(f,t,n,[...v.exit,...v.invoke.map(g=>_e(g.id))],l,void 0),o.delete(v);return [f,S||s]}function Qr(e,t){return e.implementations.actions[t]}function Sn(e,t,n,r,o,s){let{machine:l}=e,c=e;for(let f of r){let m=typeof f=="function",S=m?f:Qr(l,typeof f=="string"?f:f.type),v={context:c.context,event:t,self:n.self,system:n.system},g=m||typeof f=="string"?void 0:"params"in f?typeof f.params=="function"?f.params({context:c.context,event:t}):f.params:void 0;if(!S||!("resolve"in S)){n.actionExecutor({type:typeof f=="string"?f:typeof f=="object"?f.type:f.name||"(anonymous)",info:v,params:g,exec:S});continue}let x=S,[_,L,P]=x.resolve(n,c,v,g,S,o);c=_,"retryResolve"in x&&s?.push([x,L]),"execute"in x&&n.actionExecutor({type:x.type,info:v,params:L,exec:x.execute.bind(null,n,L)}),P&&(c=Sn(c,t,n,P,o,s));}return c}function we(e,t,n,r,o,s){let l=s?[]:void 0,c=Sn(e,t,n,r,{internalQueue:o,deferredActorIds:s},l);return l?.forEach(([f,m])=>{f.retryResolve(n,c,m);}),c}function ot(e,t,n,r){let o=e,s=[];function l(m,S,v){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:S,snapshot:m,_transitions:v}),s.push(m);}if(t.type===vt)return o=fe(nn(o,t,n),{status:"stopped"}),l(o,t,[]),{snapshot:o,microstates:s};let c=t;if(c.type!==on){let m=c,S=Lr(m),v=rn(m,o);if(S&&!v.length)return o=fe(e,{status:"error",error:m.error}),l(o,m,[]),{snapshot:o,microstates:s};o=Qe(v,e,n,c,false,r),l(o,m,v);}let f=true;for(;o.status==="active";){let m=f?eo(o,c):[],S=m.length?o:void 0;if(!m.length){if(!r.length)break;c=r.shift(),m=rn(c,o);}o=Qe(m,o,n,c,false,r),f=o!==S,l(o,c,m);}return o.status!=="active"&&nn(o,c,n),{snapshot:o,microstates:s}}function nn(e,t,n){return we(e,t,n,Object.values(e.children).map(r=>_e(r)),[],void 0)}function rn(e,t){return t.machine.getTransitionData(t,e)}function eo(e,t){let n=new Set,r=e._nodes.filter(Lt);for(let o of r)e:for(let s of [o].concat($e(o,void 0)))if(s.always){for(let l of s.always)if(l.guard===void 0||Ne(l.guard,e.context,t,e)){n.add(l);break e}}return wn(Array.from(n),new Set(e._nodes),e.historyValue)}function Tn(e,t){let n=Fe(Ue(e,t));return hn(e,[...n])}function to(e){return !!e&&typeof e=="object"&&"machine"in e&&"value"in e}var no=function(t){return an(t,this.value)},ro=function(t){return this.tags.has(t)},oo=function(t){let n=this.machine.getTransitionData(this,t);return !!n?.length&&n.some(r=>r.target!==void 0||r.actions.length)},io=function(){let{_nodes:t,tags:n,machine:r,getMeta:o,toJSON:s,can:l,hasTag:c,matches:f,...m}=this;return {...m,tags:Array.from(n)}},so=function(){return this._nodes.reduce((t,n)=>(n.meta!==void 0&&(t[n.id]=n.meta),t),{})};function je(e,t){return {status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:hn(t.root,e._nodes),tags:new Set(e._nodes.flatMap(n=>n.tags)),children:e.children,historyValue:e.historyValue||{},matches:no,hasTag:ro,can:oo,getMeta:so,toJSON:io}}function fe(e,t={}){return je({...e,...t},e.machine)}function ao(e){if(typeof e!="object"||e===null)return {};let t={};for(let n in e){let r=e[n];Array.isArray(r)&&(t[n]=r.map(o=>({id:o.id})));}return t}function Cn(e,t){let{_nodes:n,tags:r,machine:o,children:s,context:l,can:c,hasTag:f,matches:m,getMeta:S,toJSON:v,...g}=e,x={};for(let L in s){let P=s[L];x[L]={snapshot:P.getPersistedSnapshot(t),src:P.src,systemId:P.systemId,syncSnapshot:P._syncSnapshot};}return {...g,context:An(l),children:x,historyValue:ao(g.historyValue)}}function An(e){let t;for(let n in e){let r=e[n];if(r&&typeof r=="object")if("sessionId"in r&&"send"in r&&"ref"in r)t??=Array.isArray(e)?e.slice():{...e},t[n]={xstate$$type:tt,id:r.id};else {let o=An(r);o!==r&&(t??=Array.isArray(e)?e.slice():{...e},t[n]=o);}}return t??e}function lo(e,t,n,r,{event:o,id:s,delay:l},{internalQueue:c}){let f=t.machine.implementations.delays;if(typeof o=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${o}" }) instead`);let m=typeof o=="function"?o(n,r):o,S;if(typeof l=="string"){let v=f&&f[l];S=typeof v=="function"?v(n,r):v;}else S=typeof l=="function"?l(n,r):l;return typeof S!="number"&&c.push(m),[t,{event:m,id:s,delay:S},void 0]}function co(e,t){let{event:n,delay:r,id:o}=t;if(typeof r=="number"){e.defer(()=>{let s=e.self;e.system.scheduler.schedule(s,s,n,r,o);});return}}function Ge(e,t){function n(r,o){}return n.type="xstate.raise",n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=lo,n.execute=co,n}function uo(e,{machine:t,context:n},r,o){let s=(l,c)=>{if(typeof l=="string"){let f=Re(t,l);if(!f)throw new Error(`Actor logic '${l}' not implemented in machine '${t.id}'`);let m=xe(f,{id:c?.id,parent:e.self,syncSnapshot:c?.syncSnapshot,input:typeof c?.input=="function"?c.input({context:n,event:r,self:e.self}):c?.input,src:l,systemId:c?.systemId});return o[m.id]=m,m}else return xe(l,{id:c?.id,parent:e.self,syncSnapshot:c?.syncSnapshot,input:c?.input,src:l,systemId:c?.systemId})};return (l,c)=>{let f=s(l,c);return o[f.id]=f,e.defer(()=>{f._processingStatus!==Q.Stopped&&f.start();}),f}}function po(e,t,n,r,{assignment:o}){if(!t.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let s={},l={context:t.context,event:n.event,spawn:uo(e,t,n.event,s),self:e.self,system:e.system},c={};if(typeof o=="function")c=o(l,r);else for(let m of Object.keys(o)){let S=o[m];c[m]=typeof S=="function"?S(l,r):S;}let f=Object.assign({},t.context,c);return [fe(t,{context:f,children:Object.keys(s).length?{...t.children,...s}:t.children}),void 0,void 0]}function O(e){function t(n,r){}return t.type="xstate.assign",t.assignment=e,t.resolve=po,t}var Nn=new WeakMap;function ke(e,t,n){let r=Nn.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},Nn.set(e,r)),r[t]}var fo={},Ve=e=>typeof e=="string"?{type:e}:typeof e=="function"?"resolve"in e?{type:e.type}:{type:e.name}:e,it=class e{constructor(t,n){if(this.config=t,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(Ct),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?kt(this.config.states,(r,o)=>new e(r,{_parent:this,_key:o,_machine:this.machine})):fo,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===true?"shallow":this.config.history||false,this.entry=se(this.config.entry).slice(),this.exit=se(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=se(t.tags).slice();}_initialize(){this.transitions=bn(this),this.config.always&&(this.always=ye(this.config.always).map(t=>de(this,At,t))),Object.keys(this.states).forEach(t=>{this.states[t]._initialize();});}get definition(){return {id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(Ve),eventType:null,reenter:false,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(Ve),eventType:null})}:void 0,history:this.history,states:kt(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(Ve)})),entry:this.entry.map(Ve),exit:this.exit.map(Ve),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return ke(this,"invoke",()=>se(this.config.invoke).map((t,n)=>{let{src:r,systemId:o}=t,s=t.id??Mt(this.id,n),l=typeof r=="string"?r:`xstate.invoke.${Mt(this.id,n)}`;return {...t,src:l,id:s,systemId:o,toJSON(){let{onDone:c,onError:f,...m}=t;return {...m,type:"xstate.invoke",src:l,id:s}}}}))}get on(){return ke(this,"on",()=>[...this.transitions].flatMap(([n,r])=>r.map(o=>[n,o])).reduce((n,[r,o])=>(n[r]=n[r]||[],n[r].push(o),n),{}))}get after(){return ke(this,"delayedTransitions",()=>gn(this))}get initial(){return ke(this,"initial",()=>yn(this,this.config.initial))}next(t,n){let r=n.type,o=[],s,l=ke(this,`candidates-${r}`,()=>mn(this,r));for(let c of l){let{guard:f}=c,m=t.context,S=false;try{S=!f||Ne(f,m,n,t);}catch(v){let g=typeof f=="string"?f:typeof f=="object"?f.type:void 0;throw new Error(`Unable to evaluate guard ${g?`'${g}' `:""}in transition for event '${r}' in state node '${this.id}':
3
+ ${v.message}`)}if(S){o.push(...c.actions),s=c;break}}return s?[s]:void 0}get events(){return ke(this,"events",()=>{let{states:t}=this,n=new Set(this.ownEvents);if(t)for(let r of Object.keys(t)){let o=t[r];if(o.states)for(let s of o.events)n.add(`${s}`);}return Array.from(n)})}get ownEvents(){let t=Object.keys(Object.fromEntries(this.transitions)),n=new Set(t.filter(r=>this.transitions.get(r).some(o=>!(!o.target&&!o.actions.length&&!o.reenter))));return Array.from(n)}},ho="#",st=class e{constructor(t,n){this.config=t,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=true,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=t.id||"(machine)",this.implementations={actors:n?.actors??{},actions:n?.actions??{},delays:n?.delays??{},guards:n?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new it(t,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events;}provide(t){let{actions:n,guards:r,actors:o,delays:s}=this.implementations;return new e(this.config,{actions:{...n,...t.actions},guards:{...r,...t.guards},actors:{...o,...t.actors},delays:{...s,...t.delays}})}resolveState(t){let n=Tn(this.root,t.value),r=Fe(Ue(this.root,n));return je({_nodes:[...r],context:t.context||{},children:{},status:nt(r,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,n,r){return ot(t,n,r,[]).snapshot}microstep(t,n,r){return ot(t,n,r,[]).microstates}getTransitionData(t,n){return rt(this.root,t.value,t,n)||[]}getPreInitialState(t,n,r){let{context:o}=this.config,s=je({context:typeof o!="function"&&o?o:{},_nodes:[this.root],children:{},status:"active"},this);return typeof o=="function"?we(s,n,t,[O(({spawn:c,event:f,self:m})=>o({spawn:c,input:f.input,self:m}))],r,void 0):s}getInitialSnapshot(t,n){let r=Nt(n),o=[],s=this.getPreInitialState(t,r,o),l=Qe([{target:[...It(this.root)],source:this.root,reenter:true,actions:[],eventType:null,toJSON:null}],s,t,r,true,o),{snapshot:c}=ot(l,r,t,o);return c}start(t){Object.values(t.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start();});}getStateNodeById(t){let n=et(t),r=n.slice(1),o=ze(n[0])?n[0].slice(ho.length):n[0],s=this.idMap.get(o);if(!s)throw new Error(`Child state node '#${o}' does not exist on machine '${this.id}'`);return De(s,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,n){return Cn(t,n)}restoreSnapshot(t,n){let r={},o=t.children;Object.keys(o).forEach(v=>{let g=o[v],x=g.snapshot,_=g.src,L=typeof _=="string"?Re(this,_):_;if(!L)return;let P=xe(L,{id:v,parent:n.self,syncSnapshot:g.syncSnapshot,snapshot:x,src:_,systemId:g.systemId});r[v]=P;});function s(v,g){if(g instanceof it)return g;try{return v.machine.getStateNodeById(g.id)}catch{}}function l(v,g){if(!g||typeof g!="object")return {};let x={};for(let _ in g){let L=g[_];for(let P of L){let K=s(v,P);K&&(x[_]??=[],x[_].push(K));}}return x}let c=l(this.root,t.historyValue),f=je({...t,children:r,_nodes:Array.from(Fe(Ue(this.root,t.value))),historyValue:c},this),m=new Set;function S(v,g){if(!m.has(v)){m.add(v);for(let x in v){let _=v[x];if(_&&typeof _=="object"){if("xstate$$type"in _&&_.xstate$$type===tt){v[x]=g[_.id];continue}S(_,g);}}}}return S(f.context,r),f}};function mo(e,t,n,r,{event:o}){let s=typeof o=="function"?o(n,r):o;return [t,{event:s},void 0]}function go(e,{event:t}){e.defer(()=>e.emit(t));}function Dt(e){function t(n,r){}return t.type="xstate.emit",t.event=e,t.resolve=mo,t.execute=go,t}var Pt=(function(e){return e.Parent="#_parent",e.Internal="#_internal",e})({});function bo(e,t,n,r,{to:o,event:s,id:l,delay:c},f){let m=t.machine.implementations.delays;if(typeof s=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${s}" }) instead`);let S=typeof s=="function"?s(n,r):s,v;if(typeof c=="string"){let _=m&&m[c];v=typeof _=="function"?_(n,r):_;}else v=typeof c=="function"?c(n,r):c;let g=typeof o=="function"?o(n,r):o,x;if(typeof g=="string"){if(g===Pt.Parent?x=e.self._parent:g===Pt.Internal?x=e.self:g.startsWith("#_")?x=t.children[g.slice(2)]:x=f.deferredActorIds?.includes(g)?g:t.children[g],!x)throw new Error(`Unable to send event to actor '${g}' from machine '${t.machine.id}'.`)}else x=g||e.self;return [t,{to:x,targetId:typeof g=="string"?g:void 0,event:S,id:l,delay:v},void 0]}function yo(e,t,n){typeof n.to=="string"&&(n.to=t.children[n.to]);}function vo(e,t){e.defer(()=>{let{to:n,event:r,delay:o,id:s}=t;if(typeof o=="number"){e.system.scheduler.schedule(e.self,n,r,o,s);return}e.system._relay(e.self,n,r.type===sn?_t(e.self.id,r.data):r);});}function at(e,t,n){function r(o,s){}return r.type="xstate.sendTo",r.to=e,r.event=t,r.id=n?.id,r.delay=n?.delay,r.resolve=bo,r.retryResolve=yo,r.execute=vo,r}function wo(e,t){return at(Pt.Parent,e,t)}function xo(e,t,n,r,{collect:o}){let s=[],l=function(f){s.push(f);};return l.assign=(...c)=>{s.push(O(...c));},l.cancel=(...c)=>{s.push(Be(...c));},l.raise=(...c)=>{s.push(Ge(...c));},l.sendTo=(...c)=>{s.push(at(...c));},l.sendParent=(...c)=>{s.push(wo(...c));},l.spawnChild=(...c)=>{s.push(He(...c));},l.stopChild=(...c)=>{s.push(_e(...c));},l.emit=(...c)=>{s.push(Dt(...c));},o({context:n.context,event:n.event,enqueue:l,check:c=>Ne(c,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,s]}function kn(e){function t(n,r){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=xo,t}function Eo(e,t,n,r,{value:o,label:s}){return [t,{value:typeof o=="function"?o(n,r):o,label:s},void 0]}function So({logger:e},{value:t,label:n}){n?e(n,t):e(t);}function Mn(e=({context:n,event:r})=>({context:n,event:r}),t){function n(r,o){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=Eo,n.execute=So,n}function To(e,t){return new st(e,t)}function Rt({schemas:e,actors:t,actions:n,guards:r,delays:o}){return {assign:O,sendTo:at,raise:Ge,log:Mn,cancel:Be,stopChild:_e,enqueueActions:kn,emit:Dt,spawnChild:He,createStateConfig:s=>s,createAction:s=>s,createMachine:s=>To({...s,schemas:e},{actors:t,actions:n,guards:r,delays:o}),extend:s=>Rt({schemas:e,actors:t,actions:{...n,...s.actions},guards:{...r,...s.guards},delays:{...o,...s.delays}})}}var Co=(e,t)=>e===t,Ln={equals:Co},Ao=Xn,Ie=1,ut=2;var ct=null,Me=null,In=null,Y=null,J=null,Ee=null,ft=0;function _o(e,t){t=t?Object.assign({},Ln,t):Ln;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=o=>(typeof o=="function"&&(o=o(n.value)),Vn(n,o));return [ko.bind(n),r]}function No(e){if(Y===null)return e();let t=Y;Y=null;try{return In?In.untrack(e):e()}finally{Y=t;}}_o(false);function ko(){let e=Me;if(this.sources&&this.state)if(this.state===Ie)Kn(this);else {let t=J;J=null,ht(()=>dt(this)),J=t;}if(Y){let t=this.observers?this.observers.length:0;Y.sources?(Y.sources.push(this),Y.sourceSlots.push(t)):(Y.sources=[this],Y.sourceSlots=[t]),this.observers?(this.observers.push(Y),this.observerSlots.push(Y.sources.length-1)):(this.observers=[Y],this.observerSlots=[Y.sources.length-1]);}return e&&Me.sources.has(this)?this.tValue:this.value}function Vn(e,t,n){let r=e.value;return (!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&ht(()=>{for(let o=0;o<e.observers.length;o+=1){let s=e.observers[o],l=Me&&Me.running;l&&Me.disposed.has(s)||((l?!s.tState:!s.state)&&(s.pure?J.push(s):Ee.push(s),s.observers&&qn(s)),l?s.tState=Ie:s.state=Ie);}if(J.length>1e6)throw J=[],new Error})),t}function Kn(e){if(!e.fn)return;pt(e);let t=ft;Mo(e,e.value,t);}function Mo(e,t,n){let r,o=ct,s=Y;Y=ct=e;try{r=e.fn(t);}catch(l){return e.pure&&(e.state=Ie,e.owned&&e.owned.forEach(pt),e.owned=null),e.updatedAt=n+1,Yn(l)}finally{Y=s,ct=o;}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Vn(e,r):e.value=r,e.updatedAt=n);}function Wn(e){if(e.state===0)return;if(e.state===ut)return dt(e);if(e.suspense&&No(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<ft);)e.state&&n.push(e);for(let r=n.length-1;r>=0;r--)if(e=n[r],e.state===Ie)Kn(e);else if(e.state===ut){let o=J;J=null,ht(()=>dt(e,n[0])),J=o;}}function ht(e,t){if(J)return e();let n=false;(J=[]),Ee?n=true:Ee=[],ft++;try{let r=e();return Lo(n),r}catch(r){n||(Ee=null),J=null,Yn(r);}}function Lo(e){if(J&&(Xn(J),J=null),e)return;let t=Ee;Ee=null,t.length&&ht(()=>Ao(t));}function Xn(e){for(let t=0;t<e.length;t++)Wn(e[t]);}function dt(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){let r=e.sources[n];if(r.sources){let o=r.state;o===Ie?r!==t&&(!r.updatedAt||r.updatedAt<ft)&&Wn(r):o===ut&&dt(r,t);}}}function qn(e){for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t];!n.state&&(n.state=ut,n.pure?J.push(n):Ee.push(n),n.observers&&qn(n));}}function pt(e){let t;if(e.sources)for(;e.sources.length;){let n=e.sources.pop(),r=e.sourceSlots.pop(),o=n.observers;if(o&&o.length){let s=o.pop(),l=n.observerSlots.pop();r<o.length&&(s.sourceSlots[l]=r,o[r]=s,n.observerSlots[r]=l);}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)pt(e.tOwned[t]);delete e.tOwned;}if(e.owned){for(t=e.owned.length-1;t>=0;t--)pt(e.owned[t]);e.owned=null;}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null;}e.state=0;}function Io(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Yn(e,t=ct){throw Io(e)}var On="_$DX_DELEGATE";function V(e,t,n,r){let o,s=()=>{let c=document.createElement("template");return c.innerHTML=e,c.content.firstChild},l=()=>(o||(o=s())).cloneNode(true);return l.cloneNode=l,l}function ge(e,t=window.document){let n=t[On]||(t[On]=new Set);for(let r=0,o=e.length;r<o;r++){let s=e[r];n.has(s)||(n.add(s),t.addEventListener(s,Oo));}}function Oo(e){let t=e.target,n=`$$${e.type}`,r=e.target,o=e.currentTarget,s=f=>Object.defineProperty(e,"target",{configurable:true,value:f}),l=()=>{let f=t[n];if(f&&!t.disabled){let m=t[`${n}Data`];if(m!==void 0?f.call(t,m,e):f.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&s(t.host),true},c=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:true,get(){return t||document}}),e.composedPath){let f=e.composedPath();s(f[0]);for(let m=0;m<f.length-2&&(t=f[m],!!l());m++){if(t._$host){t=t._$host,c();break}if(t.parentNode===o)break}}else c();s(r);}var Po="0.0.92";var Do=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),Ro=e=>{let t=e.trim();if(!t)return null;let n=parseFloat(t);return Do(n)?n:null},Pn=(e,t)=>{let n=e.split(",");if(n.length!==t)return null;let r=[];for(let o of n){let s=Ro(o);if(s===null)return null;r.push(s);}return r},Bo=(e,t,n,r)=>e===1&&t===0&&n===0&&r===1,Ho=e=>e[0]===1&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===1&&e[6]===0&&e[7]===0&&e[8]===0&&e[9]===0&&e[10]===1&&e[11]===0&&e[15]===1,$o=e=>{try{if(!(e instanceof Element))return "none";let t=window.getComputedStyle(e);if(!t)return "none";let n=t.transform;if(!n||n==="none")return "none";let r=n.match(/^matrix3d\(([^)]+)\)$/);if(r){let s=Pn(r[1],16);if(s&&s.length===16){let l=[...s];return l[12]=0,l[13]=0,l[14]=0,Ho(l)?"none":`matrix3d(${l.join(", ")})`}}let o=n.match(/^matrix\(([^)]+)\)$/);if(o){let s=Pn(o[1],6);if(s&&s.length===6){let[l,c,f,m]=s;return Bo(l,c,f,m)?"none":`matrix(${l}, ${c}, ${f}, ${m}, 0, 0)`}}return "none"}catch{return "none"}},Bt=e=>{let t=e.getBoundingClientRect();return {borderRadius:window.getComputedStyle(e).borderRadius||"0px",height:t.height,transform:$o(e),width:t.width,x:t.left,y:t.top}},Fo=e=>({isToggleMode:false,hasAgentProvider:false,keyHoldDuration:200,mousePosition:{x:-1e3,y:-1e3},dragStart:{x:-1e3,y:-1e3},copyStart:{x:-1e3,y:-1e3},copyOffsetFromCenterX:0,detectedElement:null,frozenElement:null,frozenElements:[],lastGrabbedElement:null,lastCopiedElement:null,selectionFilePath:null,selectionLineNumber:null,inputText:"",pendingClickData:null,replySessionId:null,viewportVersion:0,grabbedBoxes:[],labelInstances:[],nativeSelectionCursor:{x:-1e3,y:-1e3},nativeSelectionElements:[],agentSessions:new Map,sessionElements:new Map,abortControllers:new Map,isTouchMode:false,theme:e,activationTimestamp:null,previouslyFocusedElement:null,canUndo:false,canRedo:false,isAgentConnected:false,supportsUndo:false,supportsFollowUp:false,dismissButtonText:void 0}),zo=({context:e})=>e.hasAgentProvider,Uo=({context:e})=>e.frozenElement!==null||e.detectedElement!==null,jo=({context:e})=>e.nativeSelectionElements.length>0,Go=({context:e})=>e.inputText.trim().length>0,Vo=({context:e})=>e.isToggleMode,Ko=({context:e})=>e.pendingClickData!==null,Wo=({context:e})=>Array.from(e.agentSessions.values()).some(t=>t.isStreaming),Xo=({context:e})=>e.lastCopiedElement!==null&&document.contains(e.lastCopiedElement);Rt({delays:{KEY_HOLD_DURATION:({context:e})=>e.keyHoldDuration,DOUBLE_CLICK_THRESHOLD:250,SUCCESS_LABEL_DURATION:1700,COPIED_LABEL_DURATION:1500},guards:{hasAgentProvider:zo,hasElement:Uo,hasNativeSelection:jo,hasInputText:Go,isToggleMode:Vo,hasPendingClick:Ko,isAgentStreaming:Wo,hasLastCopiedElement:Xo},actions:{setMousePosition:O({mousePosition:({event:e})=>e.type==="MOUSE_MOVE"?e.position:{x:-1e3,y:-1e3}}),setDetectedElement:O({detectedElement:({event:e})=>e.type==="ELEMENT_DETECTED"?e.element:null}),setFrozenElement:O({frozenElement:({event:e})=>e.type==="FREEZE_ELEMENT"?e.element:null,frozenElements:({event:e})=>e.type==="FREEZE_ELEMENT"?[e.element]:[]}),setFrozenElements:O({frozenElements:({event:e})=>e.type==="FREEZE_ELEMENTS"?e.elements:[],frozenElement:({event:e})=>e.type==="FREEZE_ELEMENTS"&&e.elements.length>0?e.elements[0]:null}),clearFrozenElement:O({frozenElement:()=>null,frozenElements:()=>[]}),setDragStart:O({dragStart:({event:e})=>e.type==="DRAG_START"?{x:e.position.x+window.scrollX,y:e.position.y+window.scrollY}:{x:-1e3,y:-1e3}}),resetDragStart:O({dragStart:()=>({x:-1e3,y:-1e3})}),setCopyStart:O({copyStart:({event:e})=>e.type==="SET_COPY_START"?e.position:{x:-1e3,y:-1e3},copyOffsetFromCenterX:({event:e})=>{if(e.type==="SET_COPY_START"&&e.element){let t=Bt(e.element),n=t.x+t.width/2;return e.position.x-n}return 0}}),setInputText:O({inputText:({event:e})=>e.type==="INPUT_CHANGE"?e.value:""}),clearInputText:O({inputText:()=>""}),enableToggleMode:O({isToggleMode:()=>true}),disableToggleMode:O({isToggleMode:()=>false}),setToggleMode:O({isToggleMode:({event:e})=>e.type==="SET_TOGGLE_MODE"?e.value:false}),setLastGrabbedElement:O({lastGrabbedElement:({event:e})=>e.type==="SET_LAST_GRABBED"?e.element:null}),setLastCopiedElement:O({lastCopiedElement:({event:e})=>e.type==="SET_LAST_COPIED"||e.type==="COPY_DONE"?e.element??null:null}),clearLastCopiedElement:O({lastCopiedElement:()=>null}),incrementViewportVersion:O({viewportVersion:({context:e})=>e.viewportVersion+1}),addGrabbedBox:O({grabbedBoxes:({context:e,event:t})=>t.type==="ADD_GRABBED_BOX"?[...e.grabbedBoxes,t.box]:e.grabbedBoxes}),removeGrabbedBox:O({grabbedBoxes:({context:e,event:t})=>t.type==="REMOVE_GRABBED_BOX"?e.grabbedBoxes.filter(n=>n.id!==t.boxId):e.grabbedBoxes}),clearGrabbedBoxes:O({grabbedBoxes:()=>[]}),addLabelInstance:O({labelInstances:({context:e,event:t})=>t.type==="ADD_LABEL_INSTANCE"?[...e.labelInstances,t.instance]:e.labelInstances}),updateLabelInstance:O({labelInstances:({context:e,event:t})=>t.type==="UPDATE_LABEL_INSTANCE"?e.labelInstances.map(n=>n.id===t.instanceId?{...n,status:t.status}:n):e.labelInstances}),removeLabelInstance:O({labelInstances:({context:e,event:t})=>t.type==="REMOVE_LABEL_INSTANCE"?e.labelInstances.filter(n=>n.id!==t.instanceId):e.labelInstances}),clearLabelInstances:O({labelInstances:()=>[]}),setNativeSelectionCursor:O({nativeSelectionCursor:({event:e})=>e.type==="TEXT_SELECTED"?e.cursor:{x:-1e3,y:-1e3}}),setNativeSelectionElements:O({nativeSelectionElements:({event:e})=>e.type==="TEXT_SELECTED"?e.elements:[]}),clearNativeSelection:O({nativeSelectionCursor:()=>({x:-1e3,y:-1e3}),nativeSelectionElements:()=>[]}),setTouchMode:O({isTouchMode:({event:e})=>e.type==="SET_TOUCH_MODE"?e.value:false}),setSelectionSource:O({selectionFilePath:({event:e})=>e.type==="SET_SELECTION_SOURCE"?e.filePath:null,selectionLineNumber:({event:e})=>e.type==="SET_SELECTION_SOURCE"?e.lineNumber:null}),clearSelectionSource:O({selectionFilePath:()=>null,selectionLineNumber:()=>null}),setPendingClickData:O({pendingClickData:({event:e})=>e.type==="SET_PENDING_CLICK"?e.data:null}),clearPendingClickData:O({pendingClickData:()=>null}),setReplySessionId:O({replySessionId:({event:e})=>e.type==="SET_REPLY_SESSION"?e.sessionId:null}),clearReplySessionId:O({replySessionId:()=>null}),addAgentSession:O({agentSessions:({context:e,event:t})=>{if(t.type!=="SESSION_START")return e.agentSessions;let n=new Map(e.agentSessions);return n.set(t.sessionId,t.session),n}}),setSessionElement:O({sessionElements:({context:e,event:t})=>{if(t.type!=="SESSION_START")return e.sessionElements;let n=new Map(e.sessionElements);return n.set(t.sessionId,t.element),n}}),updateAgentSessionStatus:O({agentSessions:({context:e,event:t})=>{if(t.type!=="STREAM_STATUS")return e.agentSessions;let n=e.agentSessions.get(t.sessionId);if(!n)return e.agentSessions;let r=new Map(e.agentSessions);return r.set(t.sessionId,{...n,lastStatus:t.status}),r}}),completeAgentSession:O({agentSessions:({context:e,event:t})=>{if(t.type!=="STREAM_DONE")return e.agentSessions;let n=e.agentSessions.get(t.sessionId);if(!n)return e.agentSessions;let r=new Map(e.agentSessions);return r.set(t.sessionId,{...n,isStreaming:false,lastStatus:t.status??n.lastStatus}),r}}),setAgentSessionError:O({agentSessions:({context:e,event:t})=>{if(t.type!=="STREAM_ERROR")return e.agentSessions;let n=e.agentSessions.get(t.sessionId);if(!n)return e.agentSessions;let r=new Map(e.agentSessions);return r.set(t.sessionId,{...n,isStreaming:false,error:t.error}),r}}),removeAgentSession:O({agentSessions:({context:e,event:t})=>{if(t.type!=="SESSION_DISMISS"&&t.type!=="ERROR_ACKNOWLEDGE")return e.agentSessions;let n=new Map(e.agentSessions);return n.delete(t.sessionId),n},sessionElements:({context:e,event:t})=>{if(t.type!=="SESSION_DISMISS"&&t.type!=="ERROR_ACKNOWLEDGE")return e.sessionElements;let n=new Map(e.sessionElements);return n.delete(t.sessionId),n}}),storeActivationTimestamp:O({activationTimestamp:()=>Date.now(),previouslyFocusedElement:()=>document.activeElement}),clearActivationTimestamp:O({activationTimestamp:()=>null,previouslyFocusedElement:()=>null}),setKeyHoldDuration:O({keyHoldDuration:({event:e,context:t})=>e.type==="HOLD_START"&&e.duration!==void 0?e.duration:t.keyHoldDuration}),setHasAgentProvider:O({hasAgentProvider:({event:e})=>e.type==="SET_HAS_AGENT_PROVIDER"?e.value:false}),setUndoRedoState:O({canUndo:({event:e})=>e.type==="SET_UNDO_REDO_STATE"?e.canUndo:false,canRedo:({event:e})=>e.type==="SET_UNDO_REDO_STATE"?e.canRedo:false}),setAgentCapabilities:O({supportsUndo:({event:e})=>e.type==="SET_AGENT_CAPABILITIES"?e.supportsUndo:false,supportsFollowUp:({event:e})=>e.type==="SET_AGENT_CAPABILITIES"?e.supportsFollowUp:false,dismissButtonText:({event:e})=>e.type==="SET_AGENT_CAPABILITIES"?e.dismissButtonText:void 0,isAgentConnected:({event:e})=>e.type==="SET_AGENT_CAPABILITIES"?e.isAgentConnected:false}),resetActivationState:O({isToggleMode:()=>false,inputText:()=>"",frozenElement:()=>null,frozenElements:()=>[],pendingClickData:()=>null,activationTimestamp:()=>null}),updateSessionBounds:O({agentSessions:({context:e})=>{if(e.agentSessions.size===0)return e.agentSessions;let t=new Map(e.agentSessions),n=false;for(let[r,o]of e.agentSessions){let s=e.sessionElements.get(r);if(s&&document.contains(s)){let l=Bt(s),c=o.selectionBounds[0],f=o.position;if(c){let m=c.x+c.width/2,S=o.position.x-m,v=l.x+l.width/2;f={...o.position,x:v+S};}t.set(r,{...o,selectionBounds:[l],position:f}),n=true;}}return n?t:e.agentSessions}}),freezeCurrentElement:O({frozenElement:({context:e})=>e.frozenElement??e.detectedElement}),saveInputModePosition:O({copyStart:({event:e,context:t})=>e.type==="INPUT_MODE_ENTER"?e.position:t.copyStart,copyOffsetFromCenterX:({event:e})=>{if(e.type==="INPUT_MODE_ENTER"&&e.element){let t=Bt(e.element),n=t.x+t.width/2;return e.position.x-n}return 0},mousePosition:({event:e,context:t})=>e.type==="INPUT_MODE_ENTER"?e.position:t.mousePosition,frozenElement:({event:e,context:t})=>e.type==="INPUT_MODE_ENTER"?e.element:t.frozenElement})}}).createMachine({id:"grabMachine",type:"parallel",context:({input:e})=>({...Fo(e.theme),hasAgentProvider:e.hasAgentProvider,keyHoldDuration:e.keyHoldDuration}),states:{activation:{initial:"idle",states:{idle:{on:{HOLD_START:{target:"holding",actions:["setKeyHoldDuration"]},ACTIVATE:{target:"active",actions:["enableToggleMode","storeActivationTimestamp"]}}},holding:{after:{KEY_HOLD_DURATION:{target:"active",actions:["storeActivationTimestamp"]}},on:{RELEASE:{target:"idle"},ACTIVATE:{target:"active",actions:["enableToggleMode","storeActivationTimestamp"]}}},active:{initial:"hovering",states:{hovering:{on:{FREEZE:{target:"frozen",actions:["freezeCurrentElement"]},DRAG_START:{target:"dragging",actions:["setDragStart"]}}},frozen:{on:{UNFREEZE:{target:"hovering",actions:["clearFrozenElement"]},DRAG_START:{target:"dragging",actions:["setDragStart"]}}},dragging:{on:{DRAG_END:{target:"justDragged",actions:["resetDragStart"]},DRAG_CANCEL:{target:"hovering",actions:["resetDragStart"]}}},justDragged:{on:{DRAG_START:{target:"dragging",actions:["setDragStart"]}},after:{SUCCESS_LABEL_DURATION:{target:"hovering"}}}},on:{DEACTIVATE:{target:"idle",actions:["resetActivationState","clearActivationTimestamp"]},MOUSE_MOVE:{actions:["setMousePosition"]},ELEMENT_DETECTED:{actions:["setDetectedElement"]},SET_TOUCH_MODE:{actions:["setTouchMode"]},SET_SELECTION_SOURCE:{actions:["setSelectionSource"]}}}},on:{TOGGLE:[{guard:({context:e})=>e.activationTimestamp!==null,target:".idle",actions:["resetActivationState","clearActivationTimestamp"]},{target:".active",actions:["enableToggleMode","storeActivationTimestamp"]}],VIEWPORT_CHANGE:{actions:["incrementViewportVersion","updateSessionBounds"]},ADD_GRABBED_BOX:{actions:["addGrabbedBox"]},REMOVE_GRABBED_BOX:{actions:["removeGrabbedBox"]},CLEAR_GRABBED_BOXES:{actions:["clearGrabbedBoxes"]},SET_LAST_GRABBED:{actions:["setLastGrabbedElement"]},SET_LAST_COPIED:{actions:["setLastCopiedElement"]},SET_HAS_AGENT_PROVIDER:{actions:["setHasAgentProvider"]},SET_UNDO_REDO_STATE:{actions:["setUndoRedoState"]},SET_AGENT_CAPABILITIES:{actions:["setAgentCapabilities"]},SET_TOGGLE_MODE:{actions:["setToggleMode"]},FREEZE_ELEMENT:{actions:["setFrozenElement"]},FREEZE_ELEMENTS:{actions:["setFrozenElements"]}}},interaction:{initial:"idle",states:{idle:{on:{CLICK:{target:"awaitingDoubleClick",actions:["setPendingClickData"]},INPUT_MODE_ENTER:{target:"inputMode",actions:["saveInputModePosition","enableToggleMode"]},COPY_START:{target:"copying"}}},awaitingDoubleClick:{after:{DOUBLE_CLICK_THRESHOLD:{target:"copying"}},on:{DOUBLE_CLICK:{target:"inputMode",guard:"hasAgentProvider",actions:["clearPendingClickData","saveInputModePosition"]},CLICK:{target:"inputMode",guard:"hasAgentProvider",actions:["clearPendingClickData","saveInputModePosition"]}}},copying:{on:{COPY_DONE:{target:"justCopied",actions:["clearPendingClickData","setLastCopiedElement"]}}},justCopied:{after:{COPIED_LABEL_DURATION:{target:"idle"}}},inputMode:{initial:"typing",states:{typing:{on:{ESC:[{target:"confirmingDismiss",guard:"hasInputText"},{target:"#grabMachine.interaction.idle"}],INPUT_SUBMIT:{target:"#grabMachine.interaction.copying"}}},confirmingDismiss:{on:{CANCEL_DISMISS:{target:"typing"},CONFIRM_DISMISS:{target:"#grabMachine.interaction.idle",actions:["clearInputText","clearReplySessionId"]}}}},on:{INPUT_CHANGE:{actions:["setInputText"]},INPUT_CANCEL:{target:"idle",actions:["clearInputText","clearReplySessionId"]}}}},on:{ADD_LABEL_INSTANCE:{actions:["addLabelInstance"]},UPDATE_LABEL_INSTANCE:{actions:["updateLabelInstance"]},REMOVE_LABEL_INSTANCE:{actions:["removeLabelInstance"]},SET_COPY_START:{actions:["setCopyStart"]},SET_PENDING_CLICK:{actions:["setPendingClickData"]},SET_REPLY_SESSION:{actions:["setReplySessionId"]},DEACTIVATE:{target:".idle",actions:["clearInputText","clearReplySessionId","clearPendingClickData"]}}},nativeSelection:{initial:"inactive",states:{inactive:{on:{TEXT_SELECTED:{target:"active",actions:["setNativeSelectionCursor","setNativeSelectionElements"]}}},active:{on:{SELECTION_CLEARED:{target:"inactive",actions:["clearNativeSelection"]},CLEAR_NATIVE_SELECTION:{target:"inactive",actions:["clearNativeSelection"]},TEXT_SELECTED:{actions:["setNativeSelectionCursor","setNativeSelectionElements"]}}}}},agentSessions:{initial:"idle",states:{idle:{on:{SESSION_START:{target:"streaming",actions:["addAgentSession","setSessionElement"]}}},streaming:{on:{STREAM_STATUS:{actions:["updateAgentSessionStatus"]},STREAM_DONE:{target:"completed",actions:["completeAgentSession"]},STREAM_ERROR:{target:"error",actions:["setAgentSessionError"]},SESSION_ABORT:{target:"idle",actions:["removeAgentSession"]}}},completed:{on:{SESSION_DISMISS:{target:"idle",actions:["removeAgentSession"]},SESSION_START:{target:"streaming",actions:["addAgentSession","setSessionElement"]}}},error:{on:{ERROR_ACKNOWLEDGE:{target:"idle",actions:["removeAgentSession"]},SESSION_START:{target:"streaming",actions:["addAgentSession","setSessionElement"]}}}},on:{UPDATE_SESSION_BOUNDS:{actions:["updateSessionBounds"]}}},agentAbortConfirmation:{initial:"inactive",states:{inactive:{on:{ESC:{target:"confirming",guard:"isAgentStreaming"}}},confirming:{on:{CONFIRM_AGENT_ABORT:{target:"inactive"},CANCEL_AGENT_ABORT:{target:"inactive"}}}}}}});var Kt="-",qo=e=>{let t=Zo(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return {getClassGroupId:o=>{let s=o.split(Kt);return s[0]===""&&s.length!==1&&s.shift(),Zn(s,t)||Yo(o)},getConflictingClassGroupIds:(o,s)=>{let l=n[o]||[];return s&&r[o]?[...l,...r[o]]:l}}},Zn=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),o=r?Zn(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;let s=e.join(Kt);return t.validators.find(({validator:l})=>l(s))?.classGroupId},Dn=/^\[(.+)\]$/,Yo=e=>{if(Dn.test(e)){let t=Dn.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return "arbitrary.."+n}},Zo=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return Qo(Object.entries(e.classGroups),n).forEach(([o,s])=>{zt(s,r,o,t);}),r},zt=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){let s=o===""?t:Rn(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(Jo(o)){zt(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,l])=>{zt(l,Rn(t,s),n,r);});});},Rn=(e,t)=>{let n=e;return t.split(Kt).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r);}),n},Jo=e=>e.isThemeGetter,Qo=(e,t)=>t?e.map(([n,r])=>{let o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([l,c])=>[t+l,c])):s);return [n,o]}):e,ei=e=>{if(e<1)return {get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map,o=(s,l)=>{n.set(s,l),t++,t>e&&(t=0,r=n,n=new Map);};return {get(s){let l=n.get(s);if(l!==void 0)return l;if((l=r.get(s))!==void 0)return o(s,l),l},set(s,l){n.has(s)?n.set(s,l):o(s,l);}}},Jn="!",ti=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,l=c=>{let f=[],m=0,S=0,v;for(let P=0;P<c.length;P++){let K=c[P];if(m===0){if(K===o&&(r||c.slice(P,P+s)===t)){f.push(c.slice(S,P)),S=P+s;continue}if(K==="/"){v=P;continue}}K==="["?m++:K==="]"&&m--;}let g=f.length===0?c:c.substring(S),x=g.startsWith(Jn),_=x?g.substring(1):g,L=v&&v>S?v-S:void 0;return {modifiers:f,hasImportantModifier:x,baseClassName:_,maybePostfixModifierPosition:L}};return n?c=>n({className:c,parseClassName:l}):l},ni=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r);}),t.push(...n.sort()),t},ri=e=>({cache:ei(e.cacheSize),parseClassName:ti(e),...qo(e)}),oi=/\s+/,ii=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],l=e.trim().split(oi),c="";for(let f=l.length-1;f>=0;f-=1){let m=l[f],{modifiers:S,hasImportantModifier:v,baseClassName:g,maybePostfixModifierPosition:x}=n(m),_=!!x,L=r(_?g.substring(0,x):g);if(!L){if(!_){c=m+(c.length>0?" "+c:c);continue}if(L=r(g),!L){c=m+(c.length>0?" "+c:c);continue}_=false;}let P=ni(S).join(":"),K=v?P+Jn:P,W=K+L;if(s.includes(W))continue;s.push(W);let te=o(L,_);for(let ee=0;ee<te.length;++ee){let Z=te[ee];s.push(K+Z);}c=m+(c.length>0?" "+c:c);}return c};function si(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Qn(t))&&(r&&(r+=" "),r+=n);return r}var Qn=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Qn(e[r]))&&(n&&(n+=" "),n+=t);return n};function ai(e,...t){let n,r,o,s=l;function l(f){let m=t.reduce((S,v)=>v(S),e());return n=ri(m),r=n.cache.get,o=n.cache.set,s=c,c(f)}function c(f){let m=r(f);if(m)return m;let S=ii(f,n);return o(f,S),S}return function(){return s(si.apply(null,arguments))}}var X=e=>{let t=n=>n[e]||[];return t.isThemeGetter=true,t},er=/^\[(?:([a-z-]+):)?(.+)\]$/i,li=/^\d+\/\d+$/,ci=new Set(["px","full","screen"]),ui=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,di=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pi=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,fi=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hi=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ae=e=>Le(e)||ci.has(e)||li.test(e),he=e=>Oe(e,"length",Ei),Le=e=>!!e&&!Number.isNaN(Number(e)),Ht=e=>Oe(e,"number",Le),Ke=e=>!!e&&Number.isInteger(Number(e)),mi=e=>e.endsWith("%")&&Le(e.slice(0,-1)),F=e=>er.test(e),me=e=>ui.test(e),gi=new Set(["length","size","percentage"]),bi=e=>Oe(e,gi,tr),yi=e=>Oe(e,"position",tr),vi=new Set(["image","url"]),wi=e=>Oe(e,vi,Ti),xi=e=>Oe(e,"",Si),We=()=>true,Oe=(e,t,n)=>{let r=er.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):false},Ei=e=>di.test(e)&&!pi.test(e),tr=()=>false,Si=e=>fi.test(e),Ti=e=>hi.test(e),Ci=()=>{let e=X("colors"),t=X("spacing"),n=X("blur"),r=X("brightness"),o=X("borderColor"),s=X("borderRadius"),l=X("borderSpacing"),c=X("borderWidth"),f=X("contrast"),m=X("grayscale"),S=X("hueRotate"),v=X("invert"),g=X("gap"),x=X("gradientColorStops"),_=X("gradientColorStopPositions"),L=X("inset"),P=X("margin"),K=X("opacity"),W=X("padding"),te=X("saturate"),ee=X("scale"),Z=X("sepia"),ce=X("skew"),ue=X("space"),R=X("translate"),j=()=>["auto","contain","none"],H=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",F,t],E=()=>[F,t],y=()=>["",ae,he],T=()=>["auto",Le,F],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],k=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",F],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],b=()=>[Le,F];return {cacheSize:500,separator:":",theme:{colors:[We],spacing:[ae,he],blur:["none","",me,F],brightness:b(),borderColor:[e],borderRadius:["none","","full",me,F],borderSpacing:E(),borderWidth:y(),contrast:b(),grayscale:G(),hueRotate:b(),invert:G(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[mi,he],inset:N(),margin:N(),opacity:b(),padding:E(),saturate:b(),scale:b(),sepia:G(),skew:b(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",F]}],container:["container"],columns:[{columns:[me]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),F]}],overflow:[{overflow:H()}],"overflow-x":[{"overflow-x":H()}],"overflow-y":[{"overflow-y":H()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[L]}],"inset-x":[{"inset-x":[L]}],"inset-y":[{"inset-y":[L]}],start:[{start:[L]}],end:[{end:[L]}],top:[{top:[L]}],right:[{right:[L]}],bottom:[{bottom:[L]}],left:[{left:[L]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ke,F]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",F]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Ke,F]}],"grid-cols":[{"grid-cols":[We]}],"col-start-end":[{col:["auto",{span:["full",Ke,F]},F]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[We]}],"row-start-end":[{row:["auto",{span:[Ke,F]},F]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",F]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",F]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[W]}],px:[{px:[W]}],py:[{py:[W]}],ps:[{ps:[W]}],pe:[{pe:[W]}],pt:[{pt:[W]}],pr:[{pr:[W]}],pb:[{pb:[W]}],pl:[{pl:[W]}],m:[{m:[P]}],mx:[{mx:[P]}],my:[{my:[P]}],ms:[{ms:[P]}],me:[{me:[P]}],mt:[{mt:[P]}],mr:[{mr:[P]}],mb:[{mb:[P]}],ml:[{ml:[P]}],"space-x":[{"space-x":[ue]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[ue]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",F,t]}],"min-w":[{"min-w":[F,t,"min","max","fit"]}],"max-w":[{"max-w":[F,t,"none","full","min","max","fit","prose",{screen:[me]},me]}],h:[{h:[F,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[F,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[F,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[F,t,"auto","min","max","fit"]}],"font-size":[{text:["base",me,he]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ht]}],"font-family":[{font:[We]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",F]}],"line-clamp":[{"line-clamp":["none",Le,Ht]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ae,F]}],"list-image":[{"list-image":["none",F]}],"list-style-type":[{list:["none","disc","decimal",F]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[K]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[K]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...k(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ae,he]}],"underline-offset":[{"underline-offset":["auto",ae,F]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",F]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",F]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[K]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),yi]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",bi]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},wi]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[_]}],"gradient-via-pos":[{via:[_]}],"gradient-to-pos":[{to:[_]}],"gradient-from":[{from:[x]}],"gradient-via":[{via:[x]}],"gradient-to":[{to:[x]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[K]}],"border-style":[{border:[...k(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[K]}],"divide-style":[{divide:k()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...k()]}],"outline-offset":[{"outline-offset":[ae,F]}],"outline-w":[{outline:[ae,he]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[K]}],"ring-offset-w":[{"ring-offset":[ae,he]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",me,xi]}],"shadow-color":[{shadow:[We]}],opacity:[{opacity:[K]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",me,F]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[S]}],invert:[{invert:[v]}],saturate:[{saturate:[te]}],sepia:[{sepia:[Z]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[S]}],"backdrop-invert":[{"backdrop-invert":[v]}],"backdrop-opacity":[{"backdrop-opacity":[K]}],"backdrop-saturate":[{"backdrop-saturate":[te]}],"backdrop-sepia":[{"backdrop-sepia":[Z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",F]}],duration:[{duration:b()}],ease:[{ease:["linear","in","out","in-out",F]}],delay:[{delay:b()}],animate:[{animate:["none","spin","ping","pulse","bounce",F]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[ee]}],"scale-x":[{"scale-x":[ee]}],"scale-y":[{"scale-y":[ee]}],rotate:[{rotate:[Ke,F]}],"translate-x":[{"translate-x":[R]}],"translate-y":[{"translate-y":[R]}],"skew-x":[{"skew-x":[ce]}],"skew-y":[{"skew-y":[ce]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",F]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",F]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",F]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ae,he,Ht]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}};ai(Ci);V("<div style=overflow:visible>");V("<canvas style=position:fixed;top:0;left:0;pointer-events:none;z-index:2147483645>");V('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 22 19"fill=none><path d="M6.76263 18.6626C7.48251 18.6626 7.95474 18.1682 7.95474 17.4895C7.95474 17.1207 7.80474 16.8576 7.58683 16.6361L5.3018 14.4137L2.84621 12.3589L2.44374 13.0037L5.92137 13.1622H17.9232C20.4842 13.1622 21.593 12.021 21.593 9.47237V3.66983C21.593 1.10875 20.4842 0 17.9232 0H12.5414C11.8179 0 11.3018 0.545895 11.3018 1.21695C11.3018 1.888 11.8179 2.43389 12.5414 2.43389H17.8424C18.7937 2.43389 19.1897 2.83653 19.1897 3.78784V9.35747C19.1897 10.3257 18.7937 10.7314 17.8424 10.7314H5.92137L2.44374 10.8832L2.84621 11.5281L5.3018 9.47993L7.58683 7.2606C7.80474 7.03914 7.95474 6.7693 7.95474 6.40049C7.95474 5.72854 7.48251 5.22747 6.76263 5.22747C6.46129 5.22747 6.12975 5.36905 5.89231 5.6096L0.376815 11.0425C0.134921 11.2777 0 11.6141 0 11.9452C0 12.2728 0.134921 12.6158 0.376815 12.848L5.89231 18.2871C6.12975 18.5276 6.46129 18.6626 6.76263 18.6626Z"fill=currentColor>');V('<div class="absolute w-0 h-0"style="border-left:8px solid transparent;border-right:8px solid transparent">');V('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-linecap=round stroke-linejoin=round stroke-width=2><path d="M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6"></path><path d="M11 13l9-9"></path><path d="M15 4h5v5">');V("<div><span>");ge(["click"]);V("<span class=text-black/50>");V('<div role=button><div class="text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit"><span class=text-black>');ge(["click"]);V('<div class="[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-[5px] w-auto h-fit self-stretch [border-top-width:0.5px] border-t-solid border-t-[#D9D9D9] antialiased rounded-t-none rounded-b-sm -mt-px">');V('<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit"><button class="contain-layout shrink-0 flex items-center justify-center px-[3px] py-px rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] cursor-pointer transition-all hover:bg-[#F5F5F5] h-[17px]"><span class="text-black text-[13px] leading-3.5 font-sans font-medium">No</span></button><button class="contain-layout shrink-0 flex items-center justify-center gap-1 px-[3px] py-px rounded-sm bg-white [border-width:0.5px] border-solid border-[#7e0002] cursor-pointer transition-all hover:bg-[#FEF2F2] h-[17px]"><span class="text-[#B91C1C] text-[13px] leading-3.5 font-sans font-medium">Yes');V('<div class="contain-layout shrink-0 flex flex-col justify-center items-end gap-1 w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1 px-1.5 w-full h-fit"><span class="text-black text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit">Discard?');ge(["pointerdown","click"]);V('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4C7.58 4 4.01 7.58 4.01 12C4.01 16.42 7.58 20 12 20C15.73 20 18.84 17.45 19.73 14H17.65C16.83 16.33 14.61 18 12 18C8.69 18 6 15.31 6 12C6 8.69 8.69 6 12 6C13.66 6 15.14 6.69 16.22 7.78L13 11H20V4L17.65 6.35Z"fill=currentColor>');V('<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit"><button class="contain-layout shrink-0 flex items-center justify-center gap-1 px-[3px] py-px rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] cursor-pointer transition-all hover:bg-[#F5F5F5] h-[17px]"><span class="text-black text-[13px] leading-3.5 font-sans font-medium">Retry</span></button><button class="contain-layout shrink-0 flex items-center justify-center gap-1 px-[3px] py-px rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] cursor-pointer transition-all hover:bg-[#F5F5F5] h-[17px]"><span class="text-black text-[13px] leading-3.5 font-sans font-medium">Ok');V('<div class="contain-layout shrink-0 flex flex-col justify-center items-end gap-1 w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1 px-1.5 w-full h-fit"><span class="text-[#B91C1C] text-[13px] leading-4 font-sans font-medium">');ge(["pointerdown","click"]);V('<button class="contain-layout shrink-0 flex items-center justify-center px-[3px] py-px rounded-sm bg-white [border-width:0.5px] border-solid border-[#7e0002] cursor-pointer transition-all hover:bg-[#FEF2F2] h-[17px]"><span class="text-[#B91C1C] text-[13px] leading-3.5 font-sans font-medium">Undo');V('<button class="contain-layout shrink-0 flex items-center justify-center gap-1 px-[3px] py-px rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] cursor-pointer transition-all hover:bg-[#F5F5F5] h-[17px]"><span class="text-black text-[13px] leading-3.5 font-sans font-medium">');V('<div class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-1.5 w-full h-fit"><span class="text-black text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit tabular-nums"></span><div class="contain-layout shrink-0 flex items-center gap-[5px] h-fit">');V('<div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 px-1.5 w-full h-fit"><span class="text-black text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit tabular-nums">');V('<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events class="text-black text-[13px] leading-4 font-medium bg-transparent border-none outline-none resize-none flex-1 p-0 m-0 wrap-break-word overflow-y-auto"rows=1 style=field-sizing:content;min-height:16px;max-height:95px;scrollbar-width:none></textarea><button class="contain-layout shrink-0 flex flex-col items-start px-[3px] py-[3px] rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] size-fit cursor-pointer transition-all hover:scale-105 ml-1">');V('<div class="[font-synthesis:none] contain-layout shrink-0 flex flex-col justify-center items-end rounded-sm bg-white antialiased w-fit h-fit max-w-[280px]">');ge(["pointerdown","click","input","keydown"]);V('<button data-react-grab-ignore-events class="contain-layout shrink-0 flex flex-col items-start rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] p-1 size-fit cursor-pointer ml-1 transition-none hover:scale-105"><div data-react-grab-ignore-events class="shrink-0 w-[7px] h-[7px] rounded-[1px] bg-black pointer-events-none">');V('<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events class="text-black text-[13px] leading-4 font-medium bg-transparent border-none outline-none resize-none flex-1 p-0 m-0 opacity-50 wrap-break-word overflow-y-auto"placeholder="type to edit"rows=1 disabled style=field-sizing:content;min-height:16px;max-height:95px;scrollbar-width:none>');V('<div class="contain-layout shrink-0 flex flex-col justify-center items-start gap-1 w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1 px-1.5 w-auto h-fit"><div class="contain-layout flex items-center px-0 py-px w-auto h-fit rounded-sm gap-[3px]"><span class="text-[13px] leading-4 font-sans font-medium w-auto h-fit whitespace-normal text-[#71717a] animate-pulse tabular-nums">');V('<div class="contain-layout shrink-0 flex flex-col justify-center items-start gap-1 w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1 w-fit h-fit pl-1.5 pr-1">');V('<div class="shrink-0 flex items-center gap-0.5 w-full mb-0.5 overflow-hidden"><span class="text-[#a1a1aa] text-[10px] leading-3 shrink-0">>previously:</span><span class="text-[#a1a1aa] text-[10px] leading-3 italic truncate whitespace-nowrap">');V('<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events class="text-black text-[13px] leading-4 font-medium bg-transparent border-none outline-none resize-none flex-1 p-0 m-0 wrap-break-word overflow-y-auto"placeholder="type prompt"rows=1 style=field-sizing:content;min-height:16px;max-height:95px;scrollbar-width:none></textarea><button class="contain-layout shrink-0 flex flex-col items-start px-[3px] py-[3px] rounded-sm bg-white [border-width:0.5px] border-solid border-[#B3B3B3] size-fit cursor-pointer transition-all hover:scale-105 ml-1">');V('<div class="contain-layout shrink-0 flex flex-col justify-center items-start gap-1 w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1 w-fit h-fit pl-1.5 pr-1">');V('<div data-react-grab-ignore-events class="fixed font-sans text-[13px] antialiased transition-opacity duration-300 ease-out filter-[drop-shadow(0px_0px_4px_#51515180)] select-none"style=z-index:2147483647><div class="[font-synthesis:none] contain-layout flex items-center gap-[5px] rounded-sm bg-white antialiased w-fit h-fit p-0">');ge(["pointerdown","mousedown","click","pointerup","input","keydown"]);V('<div class="fixed z-2147483647"><button data-react-grab-selection-cursor>');ge(["click"]);V('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 18 18"fill=currentColor><path opacity=0.4 d="M7.65631 10.9565C7.31061 10.0014 7.54012 8.96635 8.25592 8.25195C8.74522 7.76615 9.38771 7.49951 10.0694 7.49951C10.3682 7.49951 10.6641 7.55171 10.9483 7.65381L16.0001 9.49902V4.75C16.0001 3.2334 14.7667 2 13.2501 2H4.75012C3.23352 2 2.00012 3.2334 2.00012 4.75V13.25C2.00012 14.7666 3.23352 16 4.75012 16H9.49962L7.65631 10.9565Z"></path><path d="M17.296 11.5694L10.4415 9.06545C10.0431 8.92235 9.61441 9.01658 9.31551 9.31338C9.01671 9.61168 8.92101 10.0429 9.06551 10.4413L11.5704 17.2948C11.7247 17.7191 12.128 18.0004 12.5772 18.0004C12.585 18.0004 12.5918 17.9999 12.5987 17.9999C13.0577 17.9906 13.4591 17.6913 13.5987 17.2543L14.4854 14.4857L17.2559 13.5985C17.6914 13.4589 17.9903 13.057 18 12.599C18.0097 12.141 17.7267 11.7276 17.296 11.5694Z">');V('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2.5 stroke-linecap=round stroke-linejoin=round><path d="m18 15-6-6-6 6">');V('<div data-react-grab-ignore-events style=z-index:2147483647><div><div><button data-react-grab-ignore-events class="contain-layout shrink-0 flex items-center justify-center cursor-pointer transition-all hover:scale-105"></button></div><button data-react-grab-ignore-events class="contain-layout shrink-0 flex items-center justify-center cursor-pointer transition-all hover:scale-105">');ge(["pointerdown","pointermove","pointerup","click"]);var Ai="0.5.27",nr=`bippy-${Ai}`,Bn=Object.defineProperty,_i=Object.prototype.hasOwnProperty,qe=()=>{},rr=e=>{try{Function.prototype.toString.call(e).indexOf("^_^")>-1&&setTimeout(()=>{throw Error("React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build")});}catch{}},or=(e=Pe())=>"getFiberRoots"in e,ir=false,Hn,Ut=(e=Pe())=>ir?true:(typeof e.inject=="function"&&(Hn=e.inject.toString()),!!Hn?.includes("(injected)")),jt=new Set,Ye=new Set,Ni=e=>{let t=new Map,n=0,r={_instrumentationIsActive:false,_instrumentationSource:nr,checkDCE:rr,hasUnsupportedRendererAttached:false,inject(o){let s=++n;return t.set(s,o),Ye.add(o),r._instrumentationIsActive||(r._instrumentationIsActive=true,jt.forEach(l=>l())),s},on:qe,onCommitFiberRoot:qe,onCommitFiberUnmount:qe,onPostCommitFiberRoot:qe,renderers:t,supportsFiber:true,supportsFlight:true};try{Bn(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:!0,get(){return r},set(l){if(l&&typeof l=="object"){let c=r.renderers;r=l,c.size>0&&(c.forEach((f,m)=>{Ye.add(f),l.renderers.set(m,f);}),Gt(e));}}});let o=window.hasOwnProperty,s=!1;Bn(window,"hasOwnProperty",{configurable:!0,value:function(...l){try{if(!s&&l[0]==="__REACT_DEVTOOLS_GLOBAL_HOOK__")return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,s=!0,-0}catch{}return o.apply(this,l)},writable:!0});}catch{Gt(e);}return r},Gt=e=>{try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=rr,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=nr,t._instrumentationIsActive=!1;let n=or(t);if(n||(t.on=qe),t.renderers.size){t._instrumentationIsActive=!0,jt.forEach(s=>s());return}let r=t.inject,o=Ut(t);o&&!n&&(ir=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=s=>{let l=r(s);return Ye.add(s),o&&t.renderers.set(l,s),t._instrumentationIsActive=!0,jt.forEach(c=>c()),l};}(t.renderers.size||t._instrumentationIsActive||Ut())&&e?.();}catch{}},ki=()=>_i.call(globalThis,"__REACT_DEVTOOLS_GLOBAL_HOOK__"),Pe=e=>ki()?(Gt(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):Ni(e),Mi=()=>!!(typeof window<"u"&&(window.document?.createElement||window.navigator?.product==="ReactNative")),Li=()=>{try{Mi()&&Pe();}catch{}},Ii=0,Oi=1,Pi=5,Di=11,Ri=13,Bi=15,Hi=16,$i=19,Fi=26,zi=27,Ui=28,ji=30;function Gi(e,t,n=false){if(!e)return null;let r=t(e);if(r instanceof Promise)return (async()=>{if(await r===true)return e;let s=n?e.return:e.child;for(;s;){let l=await ar(s,t,n);if(l)return l;s=n?null:s.sibling;}return null})();if(r===true)return e;let o=n?e.return:e.child;for(;o;){let s=sr(o,t,n);if(s)return s;o=n?null:o.sibling;}return null}var sr=(e,t,n=false)=>{if(!e)return null;if(t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=sr(r,t,n);if(o)return o;r=n?null:r.sibling;}return null},ar=async(e,t,n=false)=>{if(!e)return null;if(await t(e)===true)return e;let r=n?e.return:e.child;for(;r;){let o=await ar(r,t,n);if(o)return o;r=n?null:r.sibling;}return null},lr=e=>{let t=e;return typeof t=="function"?t:typeof t=="object"&&t?lr(t.type||t.render):null},Vt=e=>{let t=e;if(typeof t=="string")return t;if(typeof t!="function"&&!(typeof t=="object"&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=lr(t);return r&&(r.displayName||r.name)||null},cr=()=>!!Pe()._instrumentationIsActive||or()||Ut(),Vi=e=>{let t=Pe();for(let n of t.renderers.values())try{let r=n.findFiberByHostInstance?.(e);if(r)return r}catch{}if(typeof e=="object"&&e){if("_reactRootContainer"in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let n in e)if(n.startsWith("__reactContainer$")||n.startsWith("__reactInternalInstance$")||n.startsWith("__reactFiber"))return e[n]||null}return null},Ki=Object.create,ur=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,Xi=Object.getOwnPropertyNames,qi=Object.getPrototypeOf,Yi=Object.prototype.hasOwnProperty,Zi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ji=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Xi(t),s=0,l=o.length,c;s<l;s++)c=o[s],!Yi.call(e,c)&&c!==n&&ur(e,c,{get:(f=>t[f]).bind(null,c),enumerable:!(r=Wi(t,c))||r.enumerable});return e},Qi=(e,t,n)=>(n=e==null?{}:Ki(qi(e)),Ji(ur(n,"default",{value:e,enumerable:true}),e)),$n=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,es=["rsc://","file:///","webpack://","webpack-internal://","node:","turbopack://","metro://","/app-pages-browser/"],Fn="about://React/",ts=["<anonymous>","eval",""],ns=/\.(jsx|tsx|ts|js)$/,rs=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,os=/^\?[\w~.\-]+(?:=[^&#]*)?(?:&[\w~.\-]+(?:=[^&#]*)?)*$/,dr="(at Server)",is=/(^|@)\S+:\d+/,ss=/^\s*at .*(\S+:\d+|\(native\))/m,as=/^(eval@)?(\[native code\])?$/,pr=(e,t)=>{{let n=e.split(`
4
+ `),r=[];for(let o of n)if(/^\s*at\s+/.test(o)){let s=ls(o,void 0)[0];s&&r.push(s);}else if(/^\s*in\s+/.test(o)){let s=o.replace(/^\s*in\s+/,"").replace(/\s*\(at .*\)$/,"");r.push({functionName:s,source:o});}else if(o.match(is)){let s=cs(o,void 0)[0];s&&r.push(s);}return Wt(r,t)}},fr=e=>{if(!e.includes(":"))return [e,void 0,void 0];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/,n=e.startsWith("(")&&e.endsWith(")")?e.slice(1,-1):e,r=t.exec(n);return [r[1],r[2]||void 0,r[3]||void 0]},Wt=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,ls=(e,t)=>Wt(e.split(`
5
+ `).filter(n=>!!n.match(ss)),t).map(n=>{let r=n;r.includes("(eval ")&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let o=r.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),s=o.match(/ (\(.+\)$)/);o=s?o.replace(s[0],""):o;let l=fr(s?s[1]:o),c=s&&o||void 0,f=["eval","<anonymous>"].includes(l[0])?void 0:l[0];return {functionName:c,fileName:f,lineNumber:l[1]?+l[1]:void 0,columnNumber:l[2]?+l[2]:void 0,source:r}}),cs=(e,t)=>Wt(e.split(`
6
+ `).filter(n=>!n.match(as)),t).map(n=>{let r=n;if(r.includes(" > eval")&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!r.includes("@")&&!r.includes(":"))return {functionName:r};{let o=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,s=r.match(o),l=s&&s[1]?s[1]:void 0,c=fr(r.replace(o,""));return {functionName:l,fileName:c[0],lineNumber:c[1]?+c[1]:void 0,columnNumber:c[2]?+c[2]:void 0,source:r}}}),us=Zi((e,t)=>{(function(n,r){typeof e=="object"&&t!==void 0?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.sourcemapCodec={}));})(void 0,function(n){let r=44,o=59,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=new Uint8Array(64),c=new Uint8Array(128);for(let N=0;N<s.length;N++){let E=s.charCodeAt(N);l[N]=E,c[E]=N;}function f(N,E){let y=0,T=0,M=0;do{let $=N.next();M=c[$],y|=(M&31)<<T,T+=5;}while(M&32);let k=y&1;return y>>>=1,k&&(y=-2147483648|-y),E+y}function m(N,E,y){let T=E-y;T=T<0?-T<<1|1:T<<1;do{let M=T&31;T>>>=5,T>0&&(M|=32),N.write(l[M]);}while(T>0);return E}function S(N,E){return N.pos>=E?false:N.peek()!==r}let v=1024*16,g=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(N){return Buffer.from(N.buffer,N.byteOffset,N.byteLength).toString()}}:{decode(N){let E="";for(let y=0;y<N.length;y++)E+=String.fromCharCode(N[y]);return E}};class x{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(v);}write(E){let{buffer:y}=this;y[this.pos++]=E,this.pos===v&&(this.out+=g.decode(y),this.pos=0);}flush(){let{buffer:E,out:y,pos:T}=this;return T>0?y+g.decode(E.subarray(0,T)):y}}class _{constructor(E){this.pos=0,this.buffer=E;}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(E){let{buffer:y,pos:T}=this,M=y.indexOf(E,T);return M===-1?y.length:M}}let L=[];function P(N){let{length:E}=N,y=new _(N),T=[],M=[],k=0;for(;y.pos<E;y.pos++){k=f(y,k);let $=f(y,0);if(!S(y,E)){let p=M.pop();p[2]=k,p[3]=$;continue}let B=f(y,0),G=f(y,0),z=G&1,b=z?[k,$,0,0,B,f(y,0)]:[k,$,0,0,B],A=L;if(S(y,E)){A=[];do{let p=f(y,0);A.push(p);}while(S(y,E))}b.vars=A,T.push(b),M.push(b);}return T}function K(N){let E=new x;for(let y=0;y<N.length;)y=W(N,y,E,[0]);return E.flush()}function W(N,E,y,T){let M=N[E],{0:k,1:$,2:B,3:G,4:z,vars:b}=M;E>0&&y.write(r),T[0]=m(y,k,T[0]),m(y,$,0),m(y,z,0);let A=M.length===6?1:0;m(y,A,0),M.length===6&&m(y,M[5],0);for(let p of b)m(y,p,0);for(E++;E<N.length;){let p=N[E],{0:i,1:a}=p;if(i>B||i===B&&a>=G)break;E=W(N,E,y,T);}return y.write(r),T[0]=m(y,B,T[0]),m(y,G,0),E}function te(N){let{length:E}=N,y=new _(N),T=[],M=[],k=0,$=0,B=0,G=0,z=0,b=0,A=0,p=0;do{let i=y.indexOf(";"),a=0;for(;y.pos<i;y.pos++){if(a=f(y,a),!S(y,i)){let I=M.pop();I[2]=k,I[3]=a;continue}let u=f(y,0),d=u&1,h=u&2,w=u&4,C=null,D=L,U;if(d){let I=f(y,$);B=f(y,$===I?B:0),$=I,U=[k,a,0,0,I,B];}else U=[k,a,0,0];if(U.isScope=!!w,h){let I=G,ne=z;G=f(y,G);let oe=I===G;z=f(y,oe?z:0),b=f(y,oe&&ne===z?b:0),C=[G,z,b];}if(U.callsite=C,S(y,i)){D=[];do{A=k,p=a;let I=f(y,0),ne;if(I<-1){ne=[[f(y,0)]];for(let oe=-1;oe>I;oe--){let Se=A;A=f(y,A),p=f(y,A===Se?p:0);let gt=f(y,0);ne.push([gt,A,p]);}}else ne=[[I]];D.push(ne);}while(S(y,i))}U.bindings=D,T.push(U),M.push(U);}k++,y.pos=i+1;}while(y.pos<E);return T}function ee(N){if(N.length===0)return "";let E=new x;for(let y=0;y<N.length;)y=Z(N,y,E,[0,0,0,0,0,0,0]);return E.flush()}function Z(N,E,y,T){let M=N[E],{0:k,1:$,2:B,3:G,isScope:z,callsite:b,bindings:A}=M;T[0]<k?(ce(y,T[0],k),T[0]=k,T[1]=0):E>0&&y.write(r),T[1]=m(y,M[1],T[1]);let p=(M.length===6?1:0)|(b?2:0)|(z?4:0);if(m(y,p,0),M.length===6){let{4:i,5:a}=M;i!==T[2]&&(T[3]=0),T[2]=m(y,i,T[2]),T[3]=m(y,a,T[3]);}if(b){let{0:i,1:a,2:u}=M.callsite;i===T[4]?a!==T[5]&&(T[6]=0):(T[5]=0,T[6]=0),T[4]=m(y,i,T[4]),T[5]=m(y,a,T[5]),T[6]=m(y,u,T[6]);}if(A)for(let i of A){i.length>1&&m(y,-i.length,0);let a=i[0][0];m(y,a,0);let u=k,d=$;for(let h=1;h<i.length;h++){let w=i[h];u=m(y,w[1],u),d=m(y,w[2],d),m(y,w[0],0);}}for(E++;E<N.length;){let i=N[E],{0:a,1:u}=i;if(a>B||a===B&&u>=G)break;E=Z(N,E,y,T);}return T[0]<B?(ce(y,T[0],B),T[0]=B,T[1]=0):y.write(r),T[1]=m(y,G,T[1]),E}function ce(N,E,y){do N.write(o);while(++E<y)}function ue(N){let{length:E}=N,y=new _(N),T=[],M=0,k=0,$=0,B=0,G=0;do{let z=y.indexOf(";"),b=[],A=true,p=0;for(M=0;y.pos<z;){let i;M=f(y,M),M<p&&(A=false),p=M,S(y,z)?(k=f(y,k),$=f(y,$),B=f(y,B),S(y,z)?(G=f(y,G),i=[M,k,$,B,G]):i=[M,k,$,B]):i=[M],b.push(i),y.pos++;}A||R(b),T.push(b),y.pos=z+1;}while(y.pos<=E);return T}function R(N){N.sort(j);}function j(N,E){return N[0]-E[0]}function H(N){let E=new x,y=0,T=0,M=0,k=0;for(let $=0;$<N.length;$++){let B=N[$];if($>0&&E.write(o),B.length===0)continue;let G=0;for(let z=0;z<B.length;z++){let b=B[z];z>0&&E.write(r),G=m(E,b[0],G),b.length!==1&&(y=m(E,b[1],y),T=m(E,b[2],T),M=m(E,b[3],M),b.length!==4&&(k=m(E,b[4],k)));}}return E.flush()}n.decode=ue,n.decodeGeneratedRanges=te,n.decodeOriginalScopes=P,n.encode=H,n.encodeGeneratedRanges=ee,n.encodeOriginalScopes=K,Object.defineProperty(n,"__esModule",{value:true});});}),hr=Qi(us()),mr=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,ds=/^data:application\/json[^,]+base64,/,ps=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,gr=typeof WeakRef<"u",Xe=new Map,lt=new Map,fs=e=>gr&&e instanceof WeakRef,zn=(e,t,n,r)=>{if(n<0||n>=e.length)return null;let o=e[n];if(!o||o.length===0)return null;let s=null;for(let S of o)if(S[0]<=r)s=S;else break;if(!s||s.length<4)return null;let[,l,c,f]=s;if(l===void 0||c===void 0||f===void 0)return null;let m=t[l];return m?{columnNumber:f,fileName:m,lineNumber:c+1}:null},hs=(e,t,n)=>{if(e.sections){let r=null;for(let l of e.sections)if(t>l.offset.line||t===l.offset.line&&n>=l.offset.column)r=l;else break;if(!r)return null;let o=t-r.offset.line,s=t===r.offset.line?n-r.offset.column:n;return zn(r.map.mappings,r.map.sources,o,s)}return zn(e.mappings,e.sources,t-1,n)},ms=(e,t)=>{let n=t.split(`
7
+ `),r;for(let s=n.length-1;s>=0&&!r;s--){let l=n[s].match(ps);l&&(r=l[1]||l[2]);}if(!r)return null;let o=mr.test(r);if(!(ds.test(r)||o||r.startsWith("/"))){let s=e.split("/");s[s.length-1]=r,r=s.join("/");}return r},gs=e=>({file:e.file,mappings:(0, hr.decode)(e.mappings),names:e.names,sourceRoot:e.sourceRoot,sources:e.sources,sourcesContent:e.sourcesContent,version:3}),bs=e=>{let t=e.sections.map(({map:r,offset:o})=>({map:{...r,mappings:(0, hr.decode)(r.mappings)},offset:o})),n=new Set;for(let r of t)for(let o of r.map.sources)n.add(o);return {file:e.file,mappings:[],names:[],sections:t,sourceRoot:void 0,sources:Array.from(n),sourcesContent:void 0,version:3}},Un=e=>{if(!e)return false;let t=e.trim();if(!t)return false;let n=t.match(mr);if(!n)return true;let r=n[0].toLowerCase();return r==="http:"||r==="https:"},ys=async(e,t=fetch)=>{if(!Un(e))return null;let n;try{n=await(await t(e)).text();}catch{return null}if(!n)return null;let r=ms(e,n);if(!r||!Un(r))return null;try{let o=await t(r),s=await o.json();return "sections"in s?bs(s):gs(s)}catch{return null}},vs=async(e,t=true,n)=>{if(t&&Xe.has(e)){let s=Xe.get(e);if(s==null)return null;if(fs(s)){let l=s.deref();if(l)return l;Xe.delete(e);}else return s}if(t&&lt.has(e))return lt.get(e);let r=ys(e,n);t&&lt.set(e,r);let o=await r;return t&&lt.delete(e),t&&(o===null?Xe.set(e,null):Xe.set(e,gr?new WeakRef(o):o)),o},ws=async(e,t=true,n)=>await Promise.all(e.map(async r=>{if(!r.fileName)return r;let o=await vs(r.fileName,t,n);if(!o||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return r;let s=hs(o,r.lineNumber,r.columnNumber);return s?{...r,source:s.fileName&&r.source?r.source.replace(r.fileName,s.fileName):r.source,fileName:s.fileName,lineNumber:s.lineNumber,columnNumber:s.columnNumber,isSymbolicated:true}:r})),xs=e=>e._debugStack instanceof Error&&typeof e._debugStack?.stack=="string",Es=()=>{let e=Pe();for(let t of [...Array.from(Ye),...Array.from(e.renderers.values())]){let n=t.currentDispatcherRef;if(n&&typeof n=="object")return "H"in n?n.H:n.current}return null},jn=e=>{for(let t of Ye){let n=t.currentDispatcherRef;n&&typeof n=="object"&&("H"in n?n.H=e:n.current=e);}},le=e=>`
8
+ in ${e}`,Ss=(e,t)=>{let n=le(e);return t&&(n+=` (at ${t})`),n},$t=false,Ft=(e,t)=>{if(!e||$t)return "";let n=Error.prepareStackTrace;Error.prepareStackTrace=void 0,$t=true;let r=Es();jn(null);let o=console.error,s=console.warn;console.error=()=>{},console.warn=()=>{};try{let c={DetermineComponentFrameRoot(){let S;try{if(t){let v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[]);}catch(g){S=g;}Reflect.construct(e,[],v);}else {try{v.call();}catch(g){S=g;}e.call(v.prototype);}}else {try{throw Error()}catch(g){S=g;}let v=e();v&&typeof v.catch=="function"&&v.catch(()=>{});}}catch(v){if(v instanceof Error&&S instanceof Error&&typeof v.stack=="string")return [v.stack,S.stack]}return [null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot",Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name")?.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});let[f,m]=c.DetermineComponentFrameRoot();if(f&&m){let S=f.split(`
9
+ `),v=m.split(`
10
+ `),g=0,x=0;for(;g<S.length&&!S[g].includes("DetermineComponentFrameRoot");)g++;for(;x<v.length&&!v[x].includes("DetermineComponentFrameRoot");)x++;if(g===S.length||x===v.length)for(g=S.length-1,x=v.length-1;g>=1&&x>=0&&S[g]!==v[x];)x--;for(;g>=1&&x>=0;g--,x--)if(S[g]!==v[x]){if(g!==1||x!==1)do if(g--,x--,x<0||S[g]!==v[x]){let _=`
11
+ ${S[g].replace(" at new "," at ")}`,L=Vt(e);return L&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",L)),_}while(g>=1&&x>=0);break}}}finally{$t=false,Error.prepareStackTrace=n,jn(r),console.error=o,console.warn=s;}let l=e?Vt(e):"";return l?le(l):""},Ts=(e,t)=>{let n=e.tag,r="";switch(n){case Ui:r=le("Activity");break;case Oi:r=Ft(e.type,true);break;case Di:r=Ft(e.type.render,false);break;case Ii:case Bi:r=Ft(e.type,false);break;case Pi:case Fi:case zi:r=le(e.type);break;case Hi:r=le("Lazy");break;case Ri:r=e.child!==t&&t!==null?le("Suspense Fallback"):le("Suspense");break;case $i:r=le("SuspenseList");break;case ji:r=le("ViewTransition");break;default:return ""}return r},Cs=e=>{try{let t="",n=e,r=null;do{t+=Ts(n,r);let o=n._debugInfo;if(o&&Array.isArray(o))for(let s=o.length-1;s>=0;s--){let l=o[s];typeof l.name=="string"&&(t+=Ss(l.name,l.env));}r=n,n=n.return;}while(n);return t}catch(t){return t instanceof Error?`
12
+ Error generating stack: ${t.message}
13
+ ${t.stack}`:""}},As=e=>{let t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;let n=e;if(!n)return "";Error.prepareStackTrace=t,n.startsWith(`Error: react-stack-top-frame
14
+ `)&&(n=n.slice(29));let r=n.indexOf(`
15
+ `);if(r!==-1&&(n=n.slice(r+1)),r=Math.max(n.indexOf("react_stack_bottom_frame"),n.indexOf("react-stack-bottom-frame")),r!==-1&&(r=n.lastIndexOf(`
16
+ `,r)),r!==-1)n=n.slice(0,r);else return "";return n},_s=e=>!!(e.fileName?.startsWith("rsc://")&&e.functionName),Ns=(e,t)=>e.fileName===t.fileName&&e.lineNumber===t.lineNumber&&e.columnNumber===t.columnNumber,ks=e=>{let t=new Map;for(let n of e)for(let r of n.stackFrames){if(!_s(r))continue;let o=r.functionName,s=t.get(o)??[];s.some(l=>Ns(l,r))||(s.push(r),t.set(o,s));}return t},Ms=(e,t,n)=>{if(!e.functionName)return {...e,isServer:true};let r=t.get(e.functionName);if(!r||r.length===0)return {...e,isServer:true};let o=n.get(e.functionName)??0,s=r[o%r.length];return n.set(e.functionName,o+1),{...e,isServer:true,fileName:s.fileName,lineNumber:s.lineNumber,columnNumber:s.columnNumber,source:e.source?.replace(dr,`(${s.fileName}:${s.lineNumber}:${s.columnNumber})`)}},Ls=e=>{let t=[];return Gi(e,n=>{if(!xs(n))return;let r=typeof n.type=="string"?n.type:Vt(n.type)||"<anonymous>";t.push({componentName:r,stackFrames:pr(As(n._debugStack?.stack))});},true),t},Is=async(e,t=true,n)=>{let r=Ls(e),o=pr(Cs(e)),s=ks(r),l=new Map,c=o.map(m=>m.source?.includes(dr)??false?Ms(m,s,l):m),f=c.filter((m,S,v)=>{if(S===0)return true;let g=v[S-1];return m.functionName!==g.functionName});return ws(f,t,n)},br=e=>{if(!e||ts.some(o=>o===e))return "";let t=e;if(t.startsWith("http://")||t.startsWith("https://"))try{t=new URL(t).pathname;}catch{}if(t.startsWith(Fn)){let o=t.slice(Fn.length),s=o.indexOf("/"),l=o.indexOf(":");t=s!==-1&&(l===-1||s<l)?o.slice(s+1):o;}let n=true;for(;n;){n=false;for(let o of es)if(t.startsWith(o)){t=t.slice(o.length),o==="file:///"&&(t=`/${t.replace(/^\/+/,"")}`),n=true;break}}if($n.test(t)){let o=t.match($n);o&&(t=t.slice(o[0].length));}if(t.startsWith("//")){let o=t.indexOf("/",2);t=o===-1?"":t.slice(o);}let r=t.indexOf("?");if(r!==-1){let o=t.slice(r);os.test(o)&&(t=t.slice(0,r));}return t},Os=e=>{let t=br(e);return !(!t||!ns.test(t)||rs.test(t))},Ps=e=>e.length>0&&/^[A-Z]/.test(e);Li();var Ds=new Set(["InnerLayoutRouter","RedirectErrorBoundary","RedirectBoundary","HTTPAccessFallbackErrorBoundary","HTTPAccessFallbackBoundary","LoadingBoundary","ErrorBoundary","InnerScrollAndFocusHandler","ScrollAndFocusHandler","RenderFromTemplateContext","OuterLayoutRouter","body","html","DevRootHTTPAccessFallbackBoundary","AppDevOverlayErrorBoundary","AppDevOverlay","HotReload","Router","ErrorBoundaryHandler","AppRouter","ServerRoot","SegmentStateProvider","RootErrorBoundary","LoadableComponent","MotionDOMComponent"]),Rs=()=>typeof document>"u"?false:!!(document.getElementById("__NEXT_DATA__")||document.querySelector("nextjs-portal")),Bs=e=>!!(e.startsWith("_")||Ds.has(e)),Gn=e=>!(e.length<=1||Bs(e)||!Ps(e)||e.startsWith("Primitive.")||e.includes("Provider")&&e.includes("Context")),yr=async e=>{if(!cr())return [];let t=Vi(e);return t?await Is(t):null};var Xt=async(e,t={})=>{let{maxLines:n=3}=t,r=Hs(e),o=await yr(e),s=Rs(),l=[];if(o)for(let c of o){if(l.length>=n)break;if(c.isServer&&(!c.functionName||Gn(c.functionName))){l.push(`
17
+ in ${c.functionName||"<anonymous>"} (at Server)`);continue}if(c.fileName&&Os(c.fileName)){let f=`
18
+ in `,m=c.functionName&&Gn(c.functionName);m&&(f+=`${c.functionName} (at `),f+=br(c.fileName),s&&c.lineNumber&&c.columnNumber&&(f+=`:${c.lineNumber}:${c.columnNumber}`),m&&(f+=")"),l.push(f);}}return `${r}${l.join("")}`},Hs=e=>{let t=e.tagName.toLowerCase();if(!(e instanceof HTMLElement))return `<${t} />`;let n=e.innerText?.trim()??e.textContent?.trim()??"",r="",o=Array.from(e.attributes);for(let x of o){let _=x.name,L=x.value;L.length>20&&(L=`${L.slice(0,20)}...`),r+=` ${_}="${L}"`;}let s=[],l=[],c=false,f=Array.from(e.childNodes);for(let x of f)x.nodeType!==Node.COMMENT_NODE&&(x.nodeType===Node.TEXT_NODE?x.textContent&&x.textContent.trim().length>0&&(c=true):x instanceof Element&&(c?l.push(x):s.push(x)));let m=x=>x.length===0?"":x.length<=2?x.map(_=>`<${_.tagName.toLowerCase()} ...>`).join(`
19
+ `):`(${x.length} elements)`,S="",v=m(s);if(v&&(S+=`
20
+ ${v}`),n.length>0){let x=n.length>100?`${n.slice(0,100)}...`:n;S+=`
21
+ ${x}`;}let g=m(l);return g&&(S+=`
22
+ ${g}`),S.length>0?`<${t}${r}>${S}
23
+ </${t}>`:`<${t}${r} />`};var $s="application/x-react-grab",qt=(e,t)=>{let n=JSON.stringify({version:Po,content:e,timestamp:Date.now(),...t?.prompt}),r=s=>{s.preventDefault(),s.clipboardData?.setData("text/plain",e),s.clipboardData?.setData($s,n);};document.addEventListener("copy",r);let o=document.createElement("textarea");o.value=e,o.style.position="fixed",o.style.left="-9999px",o.ariaHidden="true",document.body.appendChild(o),o.select();try{let s=document.execCommand("copy");return s&&t?.onSuccess?.(),s}finally{document.removeEventListener("copy",r),o.remove();}};var Fs=new Set(["parentElement","parentNode","firstChild","lastChild","nextSibling","previousSibling","firstElementChild","lastElementChild","nextElementSibling","previousElementSibling"]),zs=new Set(["querySelector","closest"]),Us=new Set(["querySelectorAll","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS"]),js=new Set(["setAttribute","removeAttribute","toggleAttribute","setAttributeNS","removeAttributeNS","setAttributeNode","removeAttributeNode","appendChild","removeChild","insertBefore","replaceChild","remove","append","prepend","after","before","replaceWith","replaceChildren","insertAdjacentHTML","insertAdjacentElement","insertAdjacentText","setHTML","normalize","cloneNode","addEventListener","removeEventListener","attachShadow","animate","showModal","show","close","showPopover","hidePopover","togglePopover","scrollTo","scrollBy","scrollIntoView","setSelectionRange","setRangeText","splitText","appendData","deleteData","insertData","replaceData","focus","blur","reset","submit","requestSubmit","setCustomValidity","insertRow","deleteRow","insertCell","deleteCell","createTHead","deleteTHead","createTFoot","deleteTFoot","createTBody","createCaption","deleteCaption","add","stepUp","stepDown","play","pause","load","fastSeek","setPointerCapture","webkitMatchesSelector","contains","compareDocumentPosition","getRootNode","isEqualNode","isSameNode"]),Gs=new Set(["scrollTop","scrollLeft"]),Vs=new Set(["value","checked","selected","selectedIndex","disabled","readOnly","required","defaultValue","defaultChecked"]),Ks=new Set(["hidden","tabIndex","title","lang","dir","contentEditable","draggable","spellcheck","inert","slot","id","className","accessKey","autocapitalize","enterKeyHint","inputMode","nonce","popover","open","returnValue","indeterminate","type","name","placeholder","pattern","min","max","step","multiple","accept","src","href","alt","loading","crossOrigin","referrerPolicy","download","cols","rows","wrap","srcdoc","allowFullscreen","allow","rel","target","hreflang","media","sizes","srcset","decoding","fetchPriority","isMap","useMap","formAction","formEnctype","formMethod","formNoValidate","formTarget","maxLength","minLength","size","autocomplete","autofocus","dirName","list","noValidate","action","enctype","method","acceptCharset","cite","dateTime","label","span","headers","scope","abbr","colSpan","rowSpan","start","reversed","high","low","optimum","default","kind","srclang","integrity","as","blocking","async","defer","noModule","htmlFor","httpEquiv","content","charset","coords","shape","ping","seamless","width","height","data","form","summary","nodeValue"]),Ws=new Set(["currentTime","volume","muted","playbackRate","defaultPlaybackRate","autoplay","loop","controls","preload","poster","playsInline","disableRemotePlayback","preservesPitch","defaultMuted"]),Xs=new Set(["nodeName","nodeType","tagName","localName","namespaceURI","prefix","baseURI","isConnected","ownerDocument","offsetWidth","offsetHeight","offsetTop","offsetLeft","offsetParent","clientWidth","clientHeight","clientTop","clientLeft","scrollWidth","scrollHeight","computedStyleMap","assignedSlot","sheet","naturalWidth","naturalHeight","complete","currentSrc","videoWidth","videoHeight","duration","paused","ended","seeking","readyState","networkState","buffered","played","seekable","error","textTracks","audioTracks","videoTracks","mediaKeys","validity","validationMessage","willValidate","files","labels","form","selectionStart","selectionEnd","selectionDirection","textLength","options","selectedOptions","length","tHead","tFoot","tBodies","caption","rowIndex","sectionRowIndex","cellIndex","cells","control","internals","part"]),vr=new Set(["relList","sandbox","controlsList","part"]),mt=e=>{let t=[],n=b=>t.push(b),r=new WeakMap,o=new WeakMap,s=new WeakMap,l=new WeakMap,c=new WeakMap,f=new WeakMap,m=new WeakMap,S=new WeakMap,g=b=>r.get(b)??b,_=b=>b.map(A=>typeof A=="string"?A:g(A)),L=b=>({parent:b.parentNode,nextSibling:b.nextSibling}),P=(b,A)=>{A.parent&&A.parent.insertBefore(b,A.nextSibling);},K=b=>b instanceof DocumentFragment?Array.from(b.childNodes):[],W=(b,A)=>((...p)=>{let i=_(p),a=new Map;for(let w of i)typeof w!="string"&&!(w instanceof DocumentFragment)&&w.parentNode&&a.set(w,L(w));let u=A();b(...i);let h=A().filter(w=>!u.includes(w));n(()=>{for(let w of h)w.parentNode?.removeChild(w);for(let[w,C]of a)P(w,C);});}),te=b=>{let A=s.get(b);if(A)return A;let p=new Proxy(b,{get(i,a){if(a==="setProperty")return (d,h,w)=>{let C=i.getPropertyValue(d),D=i.getPropertyPriority(d);i.setProperty(d,h,w),n(()=>i.setProperty(d,C,D));};if(a==="removeProperty")return d=>{let h=i.getPropertyValue(d),w=i.getPropertyPriority(d),C=i.removeProperty(d);return h&&n(()=>i.setProperty(d,h,w)),C};let u=Reflect.get(i,a);return typeof u=="function"?u.bind(i):u},set(i,a,u){if(typeof a=="string"){let d=i.getPropertyValue(a)||i[a]||"";n(()=>{i[a]=d;});}return Reflect.set(i,a,u)}});return s.set(b,p),p},ee=b=>{let A=l.get(b);if(A)return A;let p=new Proxy(b,{get(i,a){if(a==="add")return (...d)=>{let h=d.filter(w=>!i.contains(w));return n(()=>i.remove(...h)),i.add(...d)};if(a==="remove")return (...d)=>{let h=d.filter(w=>i.contains(w));return n(()=>i.add(...h)),i.remove(...d)};if(a==="toggle")return (d,h)=>{let w=i.contains(d),C=i.toggle(d,h);return n(()=>w?i.add(d):i.remove(d)),C};if(a==="replace")return (d,h)=>{let w=i.contains(d),C=i.contains(h),D=i.replace(d,h);return w&&n(()=>{C||i.remove(h),i.add(d);}),D};if(a==="value")return i.value;let u=Reflect.get(i,a);return typeof u=="function"?u.bind(i):u},set(i,a,u){if(a==="value"){let d=i.value;n(()=>{i.value=d;});}return Reflect.set(i,a,u)}});return l.set(b,p),p},Z=b=>{let A=c.get(b);if(A)return A;let p=new Proxy(b,{set(i,a,u){if(typeof a=="string"){let d=i[a],h=a in i;n(()=>h?i[a]=d:delete i[a]);}return Reflect.set(i,a,u)},deleteProperty(i,a){if(typeof a=="string"&&a in i){let u=i[a];n(()=>{i[a]=u;});}return Reflect.deleteProperty(i,a)}});return c.set(b,p),p},ce=b=>{let A=f.get(b);if(A)return A;let p=new Proxy(b,{get(i,a){if(typeof a=="string"&&!isNaN(Number(a))){let d=i[Number(a)];return d?R(d):void 0}if(a==="item")return d=>{let h=i.item(d);return h?R(h):null};if(a==="getNamedItem")return d=>{let h=i.getNamedItem(d);return h?R(h):null};if(a==="getNamedItemNS")return (d,h)=>{let w=i.getNamedItemNS(d,h);return w?R(w):null};if(a==="setNamedItem")return d=>{let h=i.getNamedItem(d.name),w=h?.value,C=i.setNamedItem(d);return n(()=>{h&&w!==void 0?(h.value=w,i.setNamedItem(h)):i.removeNamedItem(d.name);}),C};if(a==="setNamedItemNS")return d=>{let h=i.getNamedItemNS(d.namespaceURI,d.localName),w=h?.value,C=i.setNamedItemNS(d);return n(()=>{h&&w!==void 0?(h.value=w,i.setNamedItemNS(h)):d.namespaceURI?i.removeNamedItemNS(d.namespaceURI,d.localName):i.removeNamedItem(d.name);}),C};if(a==="removeNamedItem")return d=>{let h=i.getNamedItem(d);if(h){let w=h.value,C=i.removeNamedItem(d);return n(()=>{let D=document.createAttribute(d);D.value=w,i.setNamedItem(D);}),C}return i.removeNamedItem(d)};if(a==="removeNamedItemNS")return (d,h)=>{let w=i.getNamedItemNS(d,h);if(w){let C=w.value,D=w.name,U=i.removeNamedItemNS(d,h);return n(()=>{let I=d?document.createAttributeNS(d,D):document.createAttribute(h);I.value=C,d?i.setNamedItemNS(I):i.setNamedItem(I);}),U}return i.removeNamedItemNS(d,h)};if(a===Symbol.iterator)return function*(){for(let d=0;d<i.length;d++)yield R(i[d]);};let u=Reflect.get(i,a);return typeof u=="function"?u.bind(i):u}});return f.set(b,p),p},ue=new WeakMap,R=b=>{let A=ue.get(b);if(A)return A;let p=new Proxy(b,{get(i,a){let u=Reflect.get(i,a);return typeof u=="function"?u.bind(i):u},set(i,a,u){if(a==="value"){let d=i.value;n(()=>{i.value=d;});}return Reflect.set(i,a,u)}});return ue.set(b,p),p},j=b=>{let A=m.get(b);if(A)return A;let p=new Proxy(b,{get(i,a){if(a==="set")return (d,...h)=>{let w=i.get(d);i.set(d,...h),n(()=>{w?i.set(d,w):i.delete(d);});};if(a==="delete")return d=>{let h=i.get(d);i.delete(d),h&&n(()=>i.set(d,h));};if(a==="append")return (d,...h)=>{let w=i.getAll(d);i.append(d,...h),n(()=>{i.delete(d);for(let C of w)i.append(d,C);});};if(a==="clear")return ()=>{let d=[];i.forEach((h,w)=>{d.push([w,i.getAll(w)]);}),i.clear(),n(()=>{for(let[h,w]of d)for(let C of w)i.append(h,C);});};if(a===Symbol.iterator)return i[Symbol.iterator].bind(i);let u=Reflect.get(i,a);return typeof u=="function"?u.bind(i):u}});return m.set(b,p),p},H=b=>new Proxy(b,{get(A,p){if(typeof p=="string"&&!isNaN(Number(p)))return k(A[Number(p)]??null);if(p==="item")return a=>k(A.item(a));if(p===Symbol.iterator)return function*(){for(let a=0;a<A.length;a++)yield k(A[a]);};if(p==="forEach")return (a,u)=>{A.forEach((d,h,w)=>{a.call(u,k(d),h,w);});};if(p==="entries")return function*(){for(let a=0;a<A.length;a++)yield [a,k(A[a])];};if(p==="keys")return A.keys.bind(A);if(p==="values")return function*(){for(let a=0;a<A.length;a++)yield k(A[a]);};let i=Reflect.get(A,p);return typeof i=="function"?i.bind(A):i}}),N=b=>b?new Proxy(b,{get(A,p){if(typeof p=="string"&&!isNaN(Number(p)))return k(A[Number(p)]??null);if(p==="item")return a=>k(A.item(a));if(p==="namedItem"&&"namedItem"in A)return a=>k(A.namedItem(a));if(p===Symbol.iterator)return function*(){for(let a=0;a<A.length;a++)yield k(A[a]);};let i=Reflect.get(A,p);return typeof i=="function"?i.bind(A):i}}):null,E=(b,A)=>{let p=S.get(b);if(p)return p;let i=new Proxy(b,{get(a,u){if(typeof u=="string"&&!isNaN(Number(u)))return k(a[Number(u)]??null);if(u==="item")return h=>k(a.item(h));if(u==="namedItem")return h=>k(a.namedItem(h));if(u==="add")return (h,w)=>{let C=g(h),D=typeof w=="number"||w==null?w:g(w);a.add(C,D),n(()=>C.parentNode?.removeChild(C));};if(u==="remove")return h=>{let w=a[h];if(w){let C=w.outerHTML,D=h;a.remove(h),n(()=>{let U=document.createElement("div");U.innerHTML=C;let I=U.firstChild;I&&(D>=a.length?A.appendChild(I):A.insertBefore(I,a[D]));});}};if(u==="selectedIndex")return a.selectedIndex;if(u==="length")return a.length;if(u===Symbol.iterator)return function*(){for(let h=0;h<a.length;h++)yield k(a[h]);};let d=Reflect.get(a,u);return typeof d=="function"?d.bind(a):d},set(a,u,d){if(u==="selectedIndex"){let h=a.selectedIndex;n(()=>{a.selectedIndex=h;});}if(u==="length"){let h=[];for(let w=0;w<a.length;w++)h.push(a[w].outerHTML);n(()=>{for(;a.length>0;)a.remove(0);for(let w of h){let C=document.createElement("div");C.innerHTML=w;let D=C.firstChild;D&&A.appendChild(D);}});}return Reflect.set(a,u,d)}});return S.set(b,i),i},y=(b,A)=>{let p=b;switch(A){case "setAttribute":return (i,a)=>{let u=p.hasAttribute(i),d=p.getAttribute(i);return n(()=>u?p.setAttribute(i,d):p.removeAttribute(i)),p.setAttribute(i,a)};case "removeAttribute":return i=>{if(p.hasAttribute(i)){let a=p.getAttribute(i);n(()=>p.setAttribute(i,a));}return p.removeAttribute(i)};case "toggleAttribute":return (i,a)=>{let u=p.hasAttribute(i),d=u?p.getAttribute(i):null,h=p.toggleAttribute(i,a);return n(()=>{u?p.setAttribute(i,d):p.removeAttribute(i);}),h};case "setAttributeNS":return (i,a,u)=>{let d=a.includes(":")?a.split(":")[1]:a,h=p.hasAttributeNS(i,d),w=p.getAttributeNS(i,d),C=p.getAttributeNodeNS(i,d)?.name??d;return n(()=>h?p.setAttributeNS(i,C,w):p.removeAttributeNS(i,d)),p.setAttributeNS(i,a,u)};case "removeAttributeNS":return (i,a)=>{if(p.hasAttributeNS(i,a)){let u=p.getAttributeNS(i,a),d=p.getAttributeNodeNS(i,a)?.name??a;n(()=>p.setAttributeNS(i,d,u));}return p.removeAttributeNS(i,a)};case "setAttributeNode":return i=>{let a=p.getAttributeNode(i.name),u=a?.value,d=p.setAttributeNode(i);return n(()=>{a&&u!==void 0?(a.value=u,p.setAttributeNode(a)):p.removeAttribute(i.name);}),d};case "removeAttributeNode":return i=>{let a=i.value,u=i.name,d=p.removeAttributeNode(i);return n(()=>{let h=document.createAttribute(u);h.value=a,p.setAttributeNode(h);}),d};case "appendChild":return i=>{let a=g(i),u=a.parentNode?L(a):null,d=K(a),h=p.appendChild(a);return n(()=>{if(d.length>0)for(let w of d)w.parentNode?.removeChild(w);else a.parentNode?.removeChild(a);u&&P(a,u);}),k(h)};case "removeChild":return i=>{let a=g(i),u=a.nextSibling,d=p.removeChild(a);return n(()=>p.insertBefore(a,u)),k(d)};case "insertBefore":return (i,a)=>{let u=g(i),d=a?g(a):null,h=u.parentNode?L(u):null,w=K(u),C=p.insertBefore(u,d);return n(()=>{if(w.length>0)for(let D of w)D.parentNode?.removeChild(D);else u.parentNode?.removeChild(u);h&&P(u,h);}),k(C)};case "replaceChild":return (i,a)=>{let u=g(i),d=g(a),h=d.nextSibling,w=u.parentNode?L(u):null,C=K(u),D=p.replaceChild(u,d);return n(()=>{if(C.length>0){let U=C[0];U?.parentNode&&U.parentNode.replaceChild(d,U);for(let I=1;I<C.length;I++)C[I].parentNode?.removeChild(C[I]);}else p.replaceChild(d,u);h&&h.parentNode===p&&d.nextSibling!==h&&p.insertBefore(d,h),w&&P(u,w);}),k(D)};case "remove":return ()=>{let i=b.parentNode,a=b.nextSibling;p.remove(),n(()=>i?.insertBefore(b,a));};case "append":return W(p.append.bind(p),()=>Array.from(p.childNodes));case "prepend":return W(p.prepend.bind(p),()=>Array.from(p.childNodes));case "after":return W(p.after.bind(p),()=>p.parentNode?Array.from(p.parentNode.childNodes):[]);case "before":return W(p.before.bind(p),()=>p.parentNode?Array.from(p.parentNode.childNodes):[]);case "replaceWith":return (...i)=>{let a=_(i),u=b.parentNode,d=b.nextSibling,h=new Map;for(let U of a)typeof U!="string"&&!(U instanceof DocumentFragment)&&U.parentNode&&h.set(U,L(U));let w=u?Array.from(u.childNodes):[];p.replaceWith(...a);let D=(u?Array.from(u.childNodes):[]).filter(U=>!w.includes(U));n(()=>{let U=D[0];if(u){u.insertBefore(b,U??d);for(let I of D)I!==b&&I.parentNode?.removeChild(I);}for(let[I,ne]of h)P(I,ne);});};case "replaceChildren":return (...i)=>{let a=_(i),u=Array.from(p.childNodes),d=new Map;for(let h of a)typeof h!="string"&&h.parentNode&&h.parentNode!==p&&d.set(h,L(h));p.replaceChildren(...a),n(()=>{p.replaceChildren(...u);for(let[h,w]of d)P(h,w);});};case "insertAdjacentHTML":return (i,a)=>{let u=Array.from(p.childNodes),d=p.parentNode?Array.from(p.parentNode.childNodes):[];p.insertAdjacentHTML(i,a);let h=Array.from(p.childNodes).filter(C=>!u.includes(C)),w=p.parentNode?Array.from(p.parentNode.childNodes).filter(C=>!d.includes(C)):[];n(()=>[...h,...w].forEach(C=>C.parentNode?.removeChild(C)));};case "insertAdjacentElement":return (i,a)=>{let u=g(a),d=u.parentNode?L(u):null,h=p.insertAdjacentElement(i,u);return h&&n(()=>{h.parentNode?.removeChild(h),d&&P(u,d);}),h?k(h):null};case "insertAdjacentText":return (i,a)=>{let u=Array.from(p.childNodes),d=p.parentNode?Array.from(p.parentNode.childNodes):[];p.insertAdjacentText(i,a);let h=Array.from(p.childNodes).filter(C=>!u.includes(C)),w=p.parentNode?Array.from(p.parentNode.childNodes).filter(C=>!d.includes(C)):[];n(()=>[...h,...w].forEach(C=>C.parentNode?.removeChild(C)));};case "setHTML":return (i,a)=>{if("setHTML"in p){let u=p.innerHTML;p.setHTML(i,a),n(()=>{p.innerHTML=u;});}};case "normalize":return ()=>{let i=[],a=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),u=a.nextNode();for(;u;){let C=u.nextSibling;for(;C&&C.nodeType===Node.TEXT_NODE;)C=C.nextSibling;i.push({parent:u.parentNode,data:u.data,nextNonTextSibling:C}),u=a.nextNode();}p.normalize();let d=[],h=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),w=h.nextNode();for(;w;)d.push(w),w=h.nextNode();n(()=>{for(let I of d)I.parentNode?.removeChild(I);let C=null,D=null,U;for(let{parent:I,data:ne,nextNonTextSibling:oe}of i){let Se=document.createTextNode(ne);I===D&&oe===U&&C?I.insertBefore(Se,C.nextSibling):I.insertBefore(Se,oe),C=Se,D=I,U=oe;}});};case "cloneNode":return i=>{let a=p.cloneNode(i);return k(a)};case "addEventListener":return (i,a,u)=>{p.addEventListener(i,a,u),n(()=>p.removeEventListener(i,a,u));};case "removeEventListener":return (i,a,u)=>{p.removeEventListener(i,a,u),n(()=>p.addEventListener(i,a,u));};case "attachShadow":return i=>{let a=p.attachShadow(i);return n(()=>{a.innerHTML="";}),k(a)};case "animate":return (i,a)=>{let u=p.animate(i,a);return n(()=>u.cancel()),u};case "showModal":return ()=>{let i=b;if("showModal"in i){let a=i.open;i.showModal(),a||n(()=>i.close());}};case "show":return ()=>{let i=b;if("show"in i){let a=i.open;i.show(),a||n(()=>i.close());}};case "close":return i=>{let a=b;if("close"in a){let u=a.open,d=a.matches(":modal"),h=a.returnValue;a.close(i),u&&n(()=>{a.returnValue=h,d?a.showModal():a.show();});}};case "showPopover":return ()=>{if("showPopover"in p&&"hidePopover"in p){let i=p,a=p.matches(":popover-open");i.showPopover(),a||n(()=>i.hidePopover());}};case "hidePopover":return ()=>{if("hidePopover"in p&&"showPopover"in p){let i=p,a=p.matches(":popover-open");i.hidePopover(),a&&n(()=>i.showPopover());}};case "togglePopover":return i=>{if("togglePopover"in p){let a=p,u=p.matches(":popover-open"),d=a.togglePopover(i);return n(()=>a.togglePopover(u)),d}return false};case "scrollTo":return (i,a)=>{let u=p.scrollLeft,d=p.scrollTop;typeof i=="number"?p.scrollTo(i,a??p.scrollTop):p.scrollTo(i),n(()=>p.scrollTo(u,d));};case "scrollBy":return (i,a)=>{let u=p.scrollLeft,d=p.scrollTop;typeof i=="number"?p.scrollBy(i,a??0):p.scrollBy(i),n(()=>p.scrollTo(u,d));};case "scrollIntoView":return i=>{let a=T(p),u=a?.scrollLeft??0,d=a?.scrollTop??0;p.scrollIntoView(i),a&&n(()=>a.scrollTo(u,d));};case "setSelectionRange":return (i,a,u)=>{let d=b;if("setSelectionRange"in d){let h=d.selectionStart,w=d.selectionEnd,C=d.selectionDirection;d.setSelectionRange(i,a,u),n(()=>d.setSelectionRange(h,w,C??void 0));}};case "setRangeText":return (i,a,u,d)=>{let h=b;if("setRangeText"in h){let w=h.value,C=h.selectionStart,D=h.selectionEnd;a!==void 0&&u!==void 0?h.setRangeText(i,a,u,d):h.setRangeText(i),n(()=>{h.value=w,h.setSelectionRange(C,D);});}};case "splitText":return i=>{let a=b;if("splitText"in a){let u=a.data,d=a.splitText(i);return n(()=>{a.data=u,d.parentNode?.removeChild(d);}),k(d)}return null};case "appendData":return i=>{let a=b;if("appendData"in a){let u=a.length;a.appendData(i),n(()=>a.deleteData(u,i.length));}};case "deleteData":return (i,a)=>{let u=b;if("deleteData"in u){let d=u.substringData(i,a);u.deleteData(i,a),n(()=>u.insertData(i,d));}};case "insertData":return (i,a)=>{let u=b;"insertData"in u&&(u.insertData(i,a),n(()=>u.deleteData(i,a.length)));};case "replaceData":return (i,a,u)=>{let d=b;if("replaceData"in d){let h=d.substringData(i,a);d.replaceData(i,a,u),n(()=>d.replaceData(i,u.length,h));}};case "focus":return i=>{let a=document.activeElement;p.focus(i),n(()=>{a&&a!==document.body&&"focus"in a?a.focus():p.blur();});};case "blur":return ()=>{let i=document.activeElement===p;p.blur(),i&&n(()=>p.focus());};case "reset":return ()=>{let i=b;if("reset"in i&&"elements"in i){let a=new Map;for(let u=0;u<i.elements.length;u++){let d=i.elements[u];if("value"in d)if(d instanceof HTMLInputElement&&(d.type==="checkbox"||d.type==="radio"))a.set(d,d.checked);else if(d instanceof HTMLSelectElement)if(d.multiple){let h=[];for(let w=0;w<d.options.length;w++)h.push(d.options[w].selected);a.set(d,h);}else a.set(d,d.selectedIndex);else a.set(d,d.value);}i.reset(),n(()=>{for(let[u,d]of a)if(u instanceof HTMLInputElement&&(u.type==="checkbox"||u.type==="radio"))u.checked=d;else if(u instanceof HTMLSelectElement)if(u.multiple){let h=d;for(let w=0;w<u.options.length;w++)u.options[w].selected=h[w]??false;}else u.selectedIndex=d;else "value"in u&&(u.value=d);});}};case "submit":return ()=>{let i=b;"submit"in i&&i.submit();};case "requestSubmit":return i=>{let a=b;if("requestSubmit"in a){let u=i&&g(i);a.requestSubmit(u);}};case "setCustomValidity":return i=>{let a=b;if("setCustomValidity"in a){let d=a.validity.customError?a.validationMessage:"";a.setCustomValidity(i),n(()=>a.setCustomValidity(d));}};case "insertRow":return i=>{let a=b;if("insertRow"in a){let u=a.insertRow(i);return n(()=>u.parentNode?.removeChild(u)),k(u)}return null};case "deleteRow":return i=>{let a=b;if("deleteRow"in a&&"rows"in a){let u=i<0?a.rows.length+i:i,d=a.rows[u];if(d){let h=d.outerHTML;a.deleteRow(i),n(()=>{let w=document.createElement("table");w.innerHTML=h;let C=w.rows[0];C&&(u>=a.rows.length?a.appendChild(C):a.insertBefore(C,a.rows[u]));});}}};case "insertCell":return i=>{let a=b;if("insertCell"in a){let u=a.insertCell(i);return n(()=>u.parentNode?.removeChild(u)),k(u)}return null};case "deleteCell":return i=>{let a=b;if("deleteCell"in a&&"cells"in a){let u=i<0?a.cells.length+i:i,d=a.cells[u];if(d){let h=d.outerHTML;a.deleteCell(i),n(()=>{let w=document.createElement("tr");w.innerHTML=h;let C=w.cells[0];C&&(u>=a.cells.length?a.appendChild(C):a.insertBefore(C,a.cells[u]));});}}};case "createTHead":return ()=>{let i=b;if("createTHead"in i){let a=i.tHead,u=i.createTHead();return a||n(()=>i.deleteTHead()),k(u)}return null};case "deleteTHead":return ()=>{let i=b;if("deleteTHead"in i&&i.tHead){let a=i.tHead.outerHTML;i.deleteTHead(),n(()=>{let u=document.createElement("table");u.innerHTML=a;let d=u.tHead;d&&(i.firstChild?i.insertBefore(d,i.firstChild):i.appendChild(d));});}};case "createTFoot":return ()=>{let i=b;if("createTFoot"in i){let a=i.tFoot,u=i.createTFoot();return a||n(()=>i.deleteTFoot()),k(u)}return null};case "deleteTFoot":return ()=>{let i=b;if("deleteTFoot"in i&&i.tFoot){let a=i.tFoot.outerHTML;i.deleteTFoot(),n(()=>{let u=document.createElement("table");u.innerHTML=a;let d=u.tFoot;d&&i.appendChild(d);});}};case "createTBody":return ()=>{let i=b;if("createTBody"in i){let a=i.createTBody();return n(()=>a.parentNode?.removeChild(a)),k(a)}return null};case "createCaption":return ()=>{let i=b;if("createCaption"in i){let a=i.caption,u=i.createCaption();return a||n(()=>i.deleteCaption()),k(u)}return null};case "deleteCaption":return ()=>{let i=b;if("deleteCaption"in i&&i.caption){let a=i.caption.outerHTML;i.deleteCaption(),n(()=>{let u=document.createElement("table");u.innerHTML=a;let d=u.caption;d&&(i.firstChild?i.insertBefore(d,i.firstChild):i.appendChild(d));});}};case "add":return (i,a)=>{let u=b;if("add"in u&&"options"in u){let d=g(i),h=typeof a=="number"||a==null?a:g(a);u.add(d,h),n(()=>d.parentNode?.removeChild(d));}};case "stepUp":return i=>{let a=b;if("stepUp"in a){let u=a.value;a.stepUp(i),n(()=>{a.value=u;});}};case "stepDown":return i=>{let a=b;if("stepDown"in a){let u=a.value;a.stepDown(i),n(()=>{a.value=u;});}};case "play":return ()=>{let i=b;if("play"in i){let a=i.paused,u=i.currentTime,d=i.play();return a&&n(()=>{i.pause(),i.currentTime=u;}),d}return Promise.resolve()};case "pause":return ()=>{let i=b;if("pause"in i){let a=i.paused,u=i.currentTime;i.pause(),a||n(()=>{i.currentTime=u,i.play();});}};case "load":return ()=>{let i=b;if("load"in i){let a=i.currentTime,u=i.src;i.load(),n(()=>{i.src===u&&(i.currentTime=a);});}};case "fastSeek":return i=>{let a=b;if("fastSeek"in a){let u=a.currentTime;a.fastSeek(i),n(()=>{a.currentTime=u;});}};case "setPointerCapture":return i=>{let a=b;"setPointerCapture"in a&&(a.setPointerCapture(i),n(()=>{try{a.releasePointerCapture(i);}catch{}}));};case "webkitMatchesSelector":return i=>{let a=b,u=a;return u.webkitMatchesSelector?u.webkitMatchesSelector(i):a.matches(i)};case "contains":return i=>b.contains(i?g(i):null);case "compareDocumentPosition":return i=>b.compareDocumentPosition(g(i));case "getRootNode":return i=>k(b.getRootNode(i));case "isEqualNode":return i=>b.isEqualNode(i?g(i):null);case "isSameNode":return i=>b.isSameNode(i?g(i):null);default:return null}},T=b=>{let A=b.parentElement;for(;A;){let{overflow:p,overflowY:i,overflowX:a}=getComputedStyle(A);if(p==="auto"||p==="scroll"||i==="auto"||i==="scroll"||a==="auto"||a==="scroll")return A;A=A.parentElement;}return document.documentElement},M=(b,A)=>{if(typeof A=="symbol")return false;if(Xs.has(A))return true;let p=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(b),A);return !!(p&&p.get&&!p.set)},k=b=>{if(!b)return null;let A=o.get(b);if(A)return A;let p=new Proxy(b,{get(i,a){if(a===Symbol.toStringTag)return i[Symbol.toStringTag];if(a===Symbol.toPrimitive)return i[Symbol.toPrimitive]?.bind(i);if(a===Symbol.iterator&&Symbol.iterator in i)return i[Symbol.iterator].bind(i);if(a==="constructor")return i.constructor;let u=i;if(a==="style"&&"style"in i)return te(u.style);if(a==="classList"&&"classList"in i)return ee(u.classList);if(a==="dataset"&&"dataset"in i)return Z(u.dataset);if(a==="attributes"&&"attributes"in i)return ce(u.attributes);if(a==="attributeStyleMap"&&"attributeStyleMap"in i)return j(u.attributeStyleMap);if(a==="shadowRoot"&&"shadowRoot"in i)return u.shadowRoot?k(u.shadowRoot):null;if(a==="content"&&i instanceof HTMLTemplateElement)return k(i.content);if(typeof a=="string"&&vr.has(a)&&a in i){let h=i[a];if(h instanceof DOMTokenList)return ee(h)}if(a==="options"&&i instanceof HTMLSelectElement)return E(i.options,i);if(typeof a=="string"&&Fs.has(a))return k(i[a]);if(a==="children"||a==="childNodes")return N(i[a]);if(typeof a=="string"&&zs.has(a)){let h=i;return w=>{let C=h[a]?.(w);return C?k(C):null}}if(typeof a=="string"&&Us.has(a)){let h=i;if(a==="querySelectorAll")return w=>H(h.querySelectorAll(w));if(a==="getElementsByClassName")return w=>N(h.getElementsByClassName(w));if(a==="getElementsByTagName")return w=>N(h.getElementsByTagName(w));if(a==="getElementsByTagNameNS")return (w,C)=>N(h.getElementsByTagNameNS(w,C))}if(typeof a=="string"&&js.has(a)){let h=y(i,a);if(h)return h}let d=Reflect.get(i,a);return typeof d=="function"?d.bind(i):d},set(i,a,u){if(M(i,a))return Reflect.set(i,a,u);let d=typeof a=="string"?a:String(a),h=i,w=()=>{let C=h[d];n(()=>{h[d]=C;});};if(Gs.has(d))w();else if(Vs.has(d)&&$(i))w();else if(d==="innerText"||d==="textContent"||d==="innerHTML"){let C=i,D=C.innerHTML;n(()=>{C.innerHTML=D;});}else if(vr.has(d)&&d in i){let C=h[d];if(C instanceof DOMTokenList){let D=C.value;n(()=>{h[d]=D;});}else w();}else if(Ks.has(d))w();else if(Ws.has(d)&&B(i))w();else if(d==="outerHTML"){let C=i,D=C.parentNode,U=C.nextSibling,I=C.outerHTML,ne=D?Array.from(D.childNodes):[],oe=Reflect.set(i,a,u),gt=(D?Array.from(D.childNodes):[]).filter(re=>!ne.includes(re));return n(()=>{for(let q of gt)q.parentNode?.removeChild(q);let re=C.tagName.toLowerCase(),be=null;if(re==="tr"){let q=document.createElement("table");q.innerHTML=I,be=q.querySelector("tr");}else if(re==="td"||re==="th"){let q=document.createElement("table");q.innerHTML=`<tbody><tr>${I}</tr></tbody>`,be=q.querySelector(re);}else if(re==="thead"||re==="tbody"||re==="tfoot"||re==="caption"||re==="colgroup"){let q=document.createElement("table");q.innerHTML=I,be=q.querySelector(re);}else if(re==="col"){let q=document.createElement("table");q.innerHTML=`<colgroup>${I}</colgroup>`,be=q.querySelector("col");}else {let q=document.createElement("div");q.innerHTML=I,be=q.firstChild;}be&&D&&D.insertBefore(be,U);}),oe}else w();return Reflect.set(i,a,u)}});return r.set(p,b),o.set(b,p),p},$=b=>b instanceof HTMLInputElement||b instanceof HTMLTextAreaElement||b instanceof HTMLSelectElement||b instanceof HTMLOptionElement,B=b=>b instanceof HTMLMediaElement;return {proxy:k(e),undo:()=>{for(let b=t.length-1;b>=0;b--)t[b]();}}},qs=e=>{let t=e.cloneNode(false),n=document.createElement("div");n.appendChild(t);let r=n.innerHTML,o=r.match(/<\/[^>]+>$/);return o?r.slice(0,-o[0].length):r},Ys=e=>`</${e.tagName.toLowerCase()}>`,wr=e=>{let t=document.createElement("div");t.innerHTML=e;let n=t.querySelectorAll("svg");for(let r of n){let o=document.createElementNS("http://www.w3.org/2000/svg","svg");r.hasAttribute("class")&&o.setAttribute("class",r.getAttribute("class")),r.hasAttribute("id")&&o.setAttribute("id",r.getAttribute("id")),o.textContent="...",r.replaceWith(o);}return t.innerHTML},Ze=e=>{let t=[],n=e.parentElement;for(let c=0;c<5&&n&&!(n===document.body||n===document.documentElement);c++)t.push(n),n=n.parentElement;if(t.length===0)return wr(e.outerHTML);t.reverse();let r="",o="";for(let c of t)r+=`${o}${qs(c)}
24
+ `,o+=" ";r+=`${o}<!-- START $el -->
25
+ `;let l=wr(e.outerHTML).split(`
26
+ `);for(let c of l)r+=`${o}${c}
27
+ `;r+=`${o}<!-- END $el -->
28
+ `;for(let c=t.length-1;c>=0;c--)o=" ".repeat(c),r+=`${o}${Ys(t[c])}
29
+ `;return r.trim()};var Zs=[/\beval\s*\(/,/\bFunction\s*\(/,/\bdocument\.cookie\b/,/\bfetch\s*\(/,/\bXMLHttpRequest\b/],Js=e=>e.replace(/[\u2018\u2019\u2032\u2035]/g,"'").replace(/[\u201C\u201D\u2033\u2036]/g,'"').replace(/[\u2014\u2013\u2212]/g,"-").replace(/\u2026/g,"...").replace(/[\u00A0\u2000-\u200A\u202F\u205F]/g," ").replace(/[\u200B-\u200D\uFEFF]/g,""),Yt=e=>{let t=Js(e);try{new Function("$el",t);}catch(n){return {isValid:false,error:`Invalid JavaScript syntax${n instanceof Error?`: ${n.message}`:""}`,sanitizedCode:t}}for(let n of Zs)if(n.test(t))return {isValid:false,error:`Potentially unsafe code detected: ${n.source}`,sanitizedCode:t};return {isValid:true,sanitizedCode:t}};var xr=async(e,t,n)=>{let r=await Xt(e),s=document.contains(e)?e.outerHTML:"(removed)",l=n.length>0?`Prompts:
30
+ ${n.join(`
31
+ `)}
32
+
33
+ `:"",c=`Before:
34
+ ${t}`,f=`After:
35
+ ${s}`;return `${l}${r}
36
+
37
+ ${c}
38
+
39
+ ${f}`};var Qs=e=>{let t=e.trim();if(t.startsWith("{")&&t.endsWith("}"))try{let n=JSON.parse(t);if(typeof n=="object"&&"code"in n)return n}catch{}return t},ea=(e,t,n)=>n?`Here is the HTML to modify:
40
+
41
+ ${t}
42
+
43
+ Modification request: ${e}
44
+
45
+ You can either:
46
+ 1. Output ONLY the JavaScript code if you're confident in the change
47
+ 2. Output JSON to iterate: { "iterate": true, "code": "...", "reason": "why you need to see the result" }
48
+
49
+ When iterating, the code will be executed and you'll see the updated HTML to refine further.`:`Follow-up modification request: ${e}
50
+
51
+ Remember: Output ONLY the JavaScript code for this modification. The $el variable still references the same element.`,ta=(e,t)=>{let n=`Here is the updated HTML after executing your code:
52
+
53
+ ${e}`;return t&&(n+=`
54
+
55
+ Execution result: ${t}`),n+=`
56
+
57
+ Continue modifying or output final JavaScript code (without JSON wrapper) when done.`,n},na="https://www.react-grab.com/api/visual-edit",ra="https://www.react-grab.com/api/check-visual-edit",oa=(e={})=>{let t=e.apiEndpoint??na,n=e.maxIterations??3,r=new Map,o=new Map,s=new Map,l=new Map,c=new Map,f=new Map,m=new Map,S=new Map,v=[],g=[],x=new Map,_=null,L=()=>({requestId:`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}),P=(R,j)=>{let H=R.context.options?.requestId;if(!H||j.length===0)return;let N=j.map(T=>Ze(T)),E=j.map(T=>T.outerHTML);r.set(H,N),o.set(H,E),s.set(H,j);let y=R.id;y&&!S.has(y)&&S.set(y,E);},K=async function*(R,j){let H=null,N=null,E=Date.now(),y=fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:R}),signal:j}).then(T=>{H=T;}).catch(T=>{N=T;});for(;!H&&!N;){let T=(Date.now()-E)/1e3;yield T>=.1?`Generating\u2026 ${T.toFixed(1)}s`:"Generating\u2026",await Promise.race([y,new Promise(M=>setTimeout(M,100))]);}if(N)throw N;if(!H.ok){let T=await H.text().catch(()=>"Unknown error"),M=T;try{let k=JSON.parse(T);k.error&&(M=typeof k.error=="string"?k.error:JSON.stringify(k.error));}catch{}throw new Error(M)}return yield await H.text(),""},W=(R,j)=>{if(!document.contains(R))return {success:false,result:"Element was removed from DOM",updatedHtml:"",undo:()=>{},elementRemoved:true};let{isValid:H,error:N,sanitizedCode:E}=Yt(j);if(!H)return {success:false,result:N??"Invalid code",updatedHtml:Ze(R),undo:()=>{},elementRemoved:false};let{proxy:y,undo:T}=mt(R);try{let M=new Function("$el",E).bind(null)(y),k=M!==void 0?String(M):null,$=document.contains(R);return {success:!0,result:k,updatedHtml:$?Ze(R):"",undo:T,elementRemoved:!$}}catch(M){return T(),{success:false,result:M instanceof Error?M.message:"Execution failed",updatedHtml:Ze(R),undo:()=>{},elementRemoved:false}}},te=async function*(R,j,H,N,E,y,T,M,k){let $=N&&!k?f.get(N)??[]:[],B=$.length===0,G=ea(H,j,B),z=[...$,{role:"user",content:G}],b=0,A=null,p=[];for(;b<=n;){let i="";for await(let I of K(z,y))typeof I=="string"&&!I.startsWith("{")&&(yield `${M>1?`[${T+1}/${M}] `:""}${I}`),i=I;let a=Qs(i);if(typeof a=="string"){A=a,z.push({role:"assistant",content:i});break}if(!a.iterate){A=a.code,z.push({role:"assistant",content:i});break}z.push({role:"assistant",content:i}),yield `${M>1?`[${T+1}/${M}] `:""}Applying\u2026`;let{success:d,result:h,updatedHtml:w,undo:C,elementRemoved:D}=W(R,a.code);if(p.push(C),D){for(let I=p.length-1;I>=0;I--)p[I]();throw new Error("Element was removed from the page during editing. This can happen if the page re-rendered.")}let U=ta(w,d?h:`Error: ${h}`);z.push({role:"user",content:U}),b++;}for(let i=p.length-1;i>=0;i--)p[i]();return f.set(N??E,z),A},ee={send:async function*(R,j){let H=R.options?.requestId??"",N=R.sessionId,E=r.get(H),y=s.get(H);if(!E||!y||y.length===0)throw new Error("Could not capture element HTML");for(let B of y)if(!document.contains(B))throw new Error("Element was removed from the page. This can happen if the page re-rendered.");let T=N?m.get(N)??[]:[],M=T.length===0,k=[...T,R.prompt];_=Date.now();let $=[];for(let B=0;B<y.length;B++){let G=y[B],z=E[B];y.length>1&&(yield `Processing element ${B+1} of ${y.length}...`);let b=yield*te(G,z,R.prompt,N,H,j,B,y.length,M);if(b===null)throw new Error(`Max iterations reached without final code for element ${B+1}`);$.push(b);}l.set(H,JSON.stringify($)),m.set(N??H,k),yield "Applying changes\u2026";},undo:async()=>{let R=v.pop();if(!R)return;let j=c.get(R);if(j)try{j(),g.push(R);}finally{c.delete(R);}},canUndo:()=>v.length>0,redo:async()=>{let R=g.pop();if(!R)return;let j=x.get(R);if(!j)return;let{code:H,elements:N}=j,E=JSON.parse(H),y=[];for(let T=0;T<N.length;T++){let M=N[T],k=E[T];if(!document.contains(M)||!k)continue;let{proxy:$,undo:B}=mt(M);try{new Function("$el",k).bind(null)($),y.push(B);}catch{B();}}y.length>0&&(c.set(R,()=>{for(let T=y.length-1;T>=0;T--)y[T]();}),v.push(R));},canRedo:()=>g.length>0,supportsFollowUp:true,dismissButtonText:"Keep",getCompletionMessage:()=>_===null?void 0:`Completed in ${((Date.now()-_)/1e3).toFixed(1)}s`},Z=R=>{r.delete(R),o.delete(R),s.delete(R),l.delete(R);};return {provider:ee,getOptions:L,onStart:P,onComplete:async(R,j)=>{let H=R.context.options?.requestId;if(!H)return;let N=l.get(H);if(!N)return;let E;try{E=JSON.parse(N);}catch{return Z(H),{error:"Failed to edit: invalid code format"}}if(j.length===0)return Z(H),{error:"Failed to edit: no elements found"};for(let p of j)if(!document.contains(p))return Z(H),{error:"Failed to edit: element was removed from the page. This can happen if the page re-rendered."};let y=R.id,T=(y?S.get(y):null)??o.get(H)??[],M=[],k=[],$=[];for(let p=0;p<j.length;p++){let i=j[p],a=E[p]?.trim()??"";if(a==="")continue;let{isValid:u,error:d,sanitizedCode:h}=Yt(a);if(!u){for(let D=M.length-1;D>=0;D--)M[D]();return Z(H),{error:`Failed to edit element ${p+1}: ${d??"invalid code"}`}}let{proxy:w,undo:C}=mt(i);try{new Function("$el",h).bind(null)(w),M.push(C),k.push(h),$.push(i);}catch(D){C();for(let I=M.length-1;I>=0;I--)M[I]();Z(H);let U=D instanceof Error?D.message:"Execution failed";return {error:`Failed to edit element ${p+1}: ${U}`}}}let B=()=>{for(let p=M.length-1;p>=0;p--)M[p]();};c.set(H,B),v.push(H),x.set(H,{code:JSON.stringify(k),elements:$}),g.length=0;let G=m.get(y??H)??[],z=j[0],b=T[0]??"",A=await xr(z,b,G);qt(A),Z(H);},onUndo:(R,j)=>{}}},Zt=e=>typeof e=="object"&&e!==null&&"setAgent"in e,ia=async()=>{let e=new AbortController,t=setTimeout(()=>e.abort(),1e3);try{let n=await fetch(ra,{method:"GET",signal:e.signal});return clearTimeout(t),n.ok?(await n.json().catch(()=>null))?.healthy===!0:!1}catch{return clearTimeout(t),false}},sa=async()=>{if(typeof window>"u"||!await ia())return;let{provider:t,getOptions:n,onStart:r,onComplete:o,onUndo:s}=oa(),l=m=>{m.setAgent({provider:t,getOptions:n,onStart:r,onComplete:o,onUndo:s});},c=window.__REACT_GRAB__;if(Zt(c)){l(c);return}window.addEventListener("react-grab:init",m=>{m instanceof CustomEvent&&Zt(m.detail)&&l(m.detail);},{once:true});let f=window.__REACT_GRAB__;Zt(f)&&l(f);};sa();/**
58
+ * @license MIT
59
+ *
60
+ * Copyright (c) 2025 Aiden Bai
61
+ *
62
+ * This source code is licensed under the MIT license found in the
63
+ * LICENSE file in the root directory of this source tree.
64
+ */
65
+ /*! Bundled license information:
66
+
67
+ bippy/dist/rdt-hook-BZMdLD7S.js:
68
+ (**
69
+ * @license bippy
70
+ *
71
+ * Copyright (c) Aiden Bai
72
+ *
73
+ * This source code is licensed under the MIT license found in the
74
+ * LICENSE file in the root directory of this source tree.
75
+ *)
76
+
77
+ bippy/dist/core-coQbWNwP.js:
78
+ (**
79
+ * @license bippy
80
+ *
81
+ * Copyright (c) Aiden Bai
82
+ *
83
+ * This source code is licensed under the MIT license found in the
84
+ * LICENSE file in the root directory of this source tree.
85
+ *)
86
+
87
+ bippy/dist/source.js:
88
+ (**
89
+ * @license bippy
90
+ *
91
+ * Copyright (c) Aiden Bai
92
+ *
93
+ * This source code is licensed under the MIT license found in the
94
+ * LICENSE file in the root directory of this source tree.
95
+ *)
96
+
97
+ bippy/dist/install-hook-only-BOBPiBkc.js:
98
+ (**
99
+ * @license bippy
100
+ *
101
+ * Copyright (c) Aiden Bai
102
+ *
103
+ * This source code is licensed under the MIT license found in the
104
+ * LICENSE file in the root directory of this source tree.
105
+ *)
106
+
107
+ bippy/dist/index.js:
108
+ (**
109
+ * @license bippy
110
+ *
111
+ * Copyright (c) Aiden Bai
112
+ *
113
+ * This source code is licensed under the MIT license found in the
114
+ * LICENSE file in the root directory of this source tree.
115
+ *)
116
+ */exports.attachAgent=sa;exports.createVisualEditAgentProvider=oa;return exports;})({});
package/dist/server.cjs CHANGED
@@ -7,7 +7,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
  var pc__default = /*#__PURE__*/_interopDefault(pc);
8
8
 
9
9
  // src/server.ts
10
- var VERSION = "0.0.90";
10
+ var VERSION = "0.0.92";
11
11
  try {
12
12
  fetch(
13
13
  `https://www.react-grab.com/api/version?source=visual-edit&t=${Date.now()}`
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import pc from 'picocolors';
2
2
 
3
3
  // src/server.ts
4
- var VERSION = "0.0.90";
4
+ var VERSION = "0.0.92";
5
5
  try {
6
6
  fetch(
7
7
  `https://www.react-grab.com/api/version?source=visual-edit&t=${Date.now()}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-grab/visual-edit",
3
- "version": "0.0.90",
3
+ "version": "0.0.92",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "react-grab-visual-edit": "./dist/cli.cjs"
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@types/node": "^24.10.2",
28
28
  "picocolors": "^1.1.1",
29
- "react-grab": "0.0.90"
29
+ "react-grab": "0.0.92"
30
30
  },
31
31
  "scripts": {
32
32
  "dev": "tsup --watch",