create-buntui 0.1.0-alpha.3 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +4 -0
- package/package.json +8 -9
- package/templates/basic/package.json +3 -3
- package/templates/basic/src/apps/main/main.ts +12 -0
- package/templates/basic/src/shared/runApp.ts +14 -0
- package/templates/full/README.md +14 -12
- package/templates/full/package.json +3 -3
- package/templates/full/src/{components → apps/main/components}/BoxDemo.vue +5 -5
- package/templates/full/src/apps/main/main.ts +12 -0
- package/templates/full/src/shared/runApp.ts +14 -0
- package/templates/sfc/README.md +5 -3
- package/templates/sfc/package.json +3 -3
- package/templates/sfc/src/apps/main/main.ts +12 -0
- package/templates/sfc/src/shared/runApp.ts +14 -0
- package/dist/buntui.so +0 -0
- package/dist/index.js +0 -7
- package/templates/basic/scripts/build.ts +0 -65
- package/templates/basic/src/dev.ts +0 -27
- package/templates/basic/src/main.ts +0 -15
- package/templates/full/scripts/build.ts +0 -66
- package/templates/full/src/dev.ts +0 -40
- package/templates/full/src/main.ts +0 -21
- package/templates/sfc/scripts/build.ts +0 -66
- package/templates/sfc/src/dev.ts +0 -40
- package/templates/sfc/src/main.ts +0 -21
- /package/templates/basic/src/{App.vue → apps/main/App.vue} +0 -0
- /package/templates/full/src/{App.vue → apps/main/App.vue} +0 -0
- /package/templates/full/src/{components → apps/main/components}/ButtonDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/CheckboxDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/InputDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/ProgressDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/RadioDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/ScrollBoxDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/SelectDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/SwitchDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/TableDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/TextDemo.vue +0 -0
- /package/templates/full/src/{components → apps/main/components}/TextareaDemo.vue +0 -0
- /package/templates/sfc/src/{App.vue → apps/main/App.vue} +0 -0
package/dist/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var Q6=Object.create;var{getPrototypeOf:_6,defineProperty:s1,getOwnPropertyNames:J6}=Object;var U6=Object.prototype.hasOwnProperty;function z6(x){return this[x]}var N6,q6,t1=(x,F,h)=>{var B=x!=null&&typeof x==="object";if(B){var $=F?N6??=new WeakMap:q6??=new WeakMap,Z=$.get(x);if(Z)return Z}h=x!=null?Q6(_6(x)):{};let Q=F||!x||!x.__esModule?s1(h,"default",{value:x,enumerable:!0}):h;for(let _ of J6(x))if(!U6.call(Q,_))s1(Q,_,{get:z6.bind(x,_),enumerable:!0});if(B)$.set(x,Q);return Q};var p1=(x,F)=>()=>(F||x((F={exports:{}}).exports,F),F.exports);var o1=import.meta.require;var bh=p1((Wh)=>{Object.defineProperty(Wh,"__esModule",{value:!0});function p(x){let F=Object.create(null);for(let h of x.split(","))F[h]=1;return(h)=>(h in F)}var q4=Object.freeze({}),K4=Object.freeze([]),C4=()=>{},j4=()=>!1,G4=(x)=>x.charCodeAt(0)===111&&x.charCodeAt(1)===110&&(x.charCodeAt(2)>122||x.charCodeAt(2)<97),Y4=(x)=>x.startsWith("onUpdate:"),X4=Object.assign,I4=(x,F)=>{let h=x.indexOf(F);if(h>-1)x.splice(h,1)},D4=Object.prototype.hasOwnProperty,A4=(x,F)=>D4.call(x,F),V0=Array.isArray,jh=(x)=>O0(x)==="[object Map]",Gh=(x)=>O0(x)==="[object Set]",D1=(x)=>O0(x)==="[object Date]",H4=(x)=>O0(x)==="[object RegExp]",r0=(x)=>typeof x==="function",Z0=(x)=>typeof x==="string",l0=(x)=>typeof x==="symbol",E0=(x)=>x!==null&&typeof x==="object",E4=(x)=>{return(E0(x)||r0(x))&&r0(x.then)&&r0(x.catch)},A1=Object.prototype.toString,O0=(x)=>A1.call(x),M4=(x)=>{return O0(x).slice(8,-1)},Yh=(x)=>O0(x)==="[object Object]",P4=(x)=>Z0(x)&&x!=="NaN"&&x[0]!=="-"&&""+parseInt(x,10)===x,L4=p(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),W4=p("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),Ax=(x)=>{let F=Object.create(null);return(h)=>{return F[h]||(F[h]=x(h))}},b4=/-\w/g,R4=Ax((x)=>{return x.replace(b4,(F)=>F.slice(1).toUpperCase())}),V4=/\B([A-Z])/g,Xh=Ax((x)=>x.replace(V4,"-$1").toLowerCase()),Ih=Ax((x)=>{return x.charAt(0).toUpperCase()+x.slice(1)}),O4=Ax((x)=>{return x?`on${Ih(x)}`:""}),m4=(x,F)=>!Object.is(x,F),f4=(x,...F)=>{for(let h=0;h<x.length;h++)x[h](...F)},S4=(x,F,h,B=!1)=>{Object.defineProperty(x,F,{configurable:!0,enumerable:!1,writable:B,value:h})},T4=(x)=>{let F=parseFloat(x);return isNaN(F)?x:F},w4=(x)=>{let F=Z0(x)?Number(x):NaN;return isNaN(F)?x:F},Kh,k4=()=>{return Kh||(Kh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{})},c4=/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;function i4(x){return c4.test(x)?`__props.${x}`:`__props[${JSON.stringify(x)}]`}function g4(x,F){return x+JSON.stringify(F,(h,B)=>typeof B==="function"?B.toString():B)}var d4={TEXT:1,"1":"TEXT",CLASS:2,"2":"CLASS",STYLE:4,"4":"STYLE",PROPS:8,"8":"PROPS",FULL_PROPS:16,"16":"FULL_PROPS",NEED_HYDRATION:32,"32":"NEED_HYDRATION",STABLE_FRAGMENT:64,"64":"STABLE_FRAGMENT",KEYED_FRAGMENT:128,"128":"KEYED_FRAGMENT",UNKEYED_FRAGMENT:256,"256":"UNKEYED_FRAGMENT",NEED_PATCH:512,"512":"NEED_PATCH",DYNAMIC_SLOTS:1024,"1024":"DYNAMIC_SLOTS",DEV_ROOT_FRAGMENT:2048,"2048":"DEV_ROOT_FRAGMENT",CACHED:-1,"-1":"CACHED",BAIL:-2,"-2":"BAIL"},u4={[1]:"TEXT",[2]:"CLASS",[4]:"STYLE",[8]:"PROPS",[16]:"FULL_PROPS",[32]:"NEED_HYDRATION",[64]:"STABLE_FRAGMENT",[128]:"KEYED_FRAGMENT",[256]:"UNKEYED_FRAGMENT",[512]:"NEED_PATCH",[1024]:"DYNAMIC_SLOTS",[2048]:"DEV_ROOT_FRAGMENT",[-1]:"CACHED",[-2]:"BAIL"},n4={ELEMENT:1,"1":"ELEMENT",FUNCTIONAL_COMPONENT:2,"2":"FUNCTIONAL_COMPONENT",STATEFUL_COMPONENT:4,"4":"STATEFUL_COMPONENT",TEXT_CHILDREN:8,"8":"TEXT_CHILDREN",ARRAY_CHILDREN:16,"16":"ARRAY_CHILDREN",SLOTS_CHILDREN:32,"32":"SLOTS_CHILDREN",TELEPORT:64,"64":"TELEPORT",SUSPENSE:128,"128":"SUSPENSE",COMPONENT_SHOULD_KEEP_ALIVE:256,"256":"COMPONENT_SHOULD_KEEP_ALIVE",COMPONENT_KEPT_ALIVE:512,"512":"COMPONENT_KEPT_ALIVE",COMPONENT:6,"6":"COMPONENT"},y4={STABLE:1,"1":"STABLE",DYNAMIC:2,"2":"DYNAMIC",FORWARDED:3,"3":"FORWARDED"},s4={[1]:"STABLE",[2]:"DYNAMIC",[3]:"FORWARDED"},t4="Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol",Dh=p(t4),p4=Dh,Ch=2;function o4(x,F=0,h=x.length){if(F=Math.max(0,Math.min(F,x.length)),h=Math.max(0,Math.min(h,x.length)),F>h)return"";let B=x.split(/(\r?\n)/),$=B.filter((_,J)=>J%2===1);B=B.filter((_,J)=>J%2===0);let Z=0,Q=[];for(let _=0;_<B.length;_++)if(Z+=B[_].length+($[_]&&$[_].length||0),Z>=F){for(let J=_-Ch;J<=_+Ch||h>Z;J++){if(J<0||J>=B.length)continue;let N=J+1;Q.push(`${N}${" ".repeat(Math.max(3-String(N).length,0))}| ${B[J]}`);let K=B[J].length,q=$[J]&&$[J].length||0;if(J===_){let G=F-(Z-(K+q)),Y=Math.max(1,h>Z?K-G:h-F);Q.push(" | "+" ".repeat(G)+"^".repeat(Y))}else if(J>_){if(h>Z){let G=Math.max(Math.min(h-Z,K),1);Q.push(" | "+"^".repeat(G))}Z+=K+q}}break}return Q.join(`
|
|
3
|
-
`)}function H1(x){if(V0(x)){let F={};for(let h=0;h<x.length;h++){let B=x[h],$=Z0(B)?Ah(B):H1(B);if($)for(let Z in $)F[Z]=$[Z]}return F}else if(Z0(x)||E0(x))return x}var v4=/;(?![^(]*\))/g,r4=/:([^]+)/,l4=/\/\*[^]*?\*\//g;function Ah(x){let F={};return x.replace(l4,"").split(v4).forEach((h)=>{if(h){let B=h.split(r4);B.length>1&&(F[B[0].trim()]=B[1].trim())}}),F}function a4(x){if(!x)return"";if(Z0(x))return x;let F="";for(let h in x){let B=x[h];if(Z0(B)||typeof B==="number"){let $=h.startsWith("--")?h:Xh(h);F+=`${$}:${B};`}}return F}function E1(x){let F="";if(Z0(x))F=x;else if(V0(x))for(let h=0;h<x.length;h++){let B=E1(x[h]);if(B)F+=B+" "}else if(E0(x)){for(let h in x)if(x[h])F+=h+" "}return F.trim()}function e4(x){if(!x)return null;let{class:F,style:h}=x;if(F&&!Z0(F))x.class=E1(F);if(h)x.style=H1(h);return x}var x2="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",F2="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",h2="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",B2="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",$2=p(x2),Z2=p(F2),Q2=p(h2),_2=p(B2),Hh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",J2=p(Hh),U2=p(Hh+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");function z2(x){return!!x||x===""}var N2=/[>/="'\u0009\u000a\u000c\u0020]/,X1={};function q2(x){if(X1.hasOwnProperty(x))return X1[x];let F=N2.test(x);if(F)console.error(`unsafe attribute name: ${x}`);return X1[x]=!F}var K2={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},C2=p("accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap"),j2=p("xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan"),G2=p("accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns");function Y2(x){if(x==null)return!1;let F=typeof x;return F==="string"||F==="number"||F==="boolean"}var X2=/["'&<>]/;function I2(x){let F=""+x,h=X2.exec(F);if(!h)return F;let B="",$,Z,Q=0;for(Z=h.index;Z<F.length;Z++){switch(F.charCodeAt(Z)){case 34:$=""";break;case 38:$="&";break;case 39:$="'";break;case 60:$="<";break;case 62:$=">";break;default:continue}if(Q!==Z)B+=F.slice(Q,Z);Q=Z+1,B+=$}return Q!==Z?B+F.slice(Q,Z):B}var D2=/^-?>|<!--|-->|--!>|<!-$/g;function A2(x){return x.replace(D2,"")}var Eh=/[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;function H2(x,F){return x.replace(Eh,(h)=>F?h==='"'?"\\\\\\\"":`\\\\${h}`:`\\${h}`)}function E2(x,F){if(x.length!==F.length)return!1;let h=!0;for(let B=0;h&&B<x.length;B++)h=Hx(x[B],F[B]);return h}function Hx(x,F){if(x===F)return!0;let h=D1(x),B=D1(F);if(h||B)return h&&B?x.getTime()===F.getTime():!1;if(h=l0(x),B=l0(F),h||B)return x===F;if(h=V0(x),B=V0(F),h||B)return h&&B?E2(x,F):!1;if(h=E0(x),B=E0(F),h||B){if(!h||!B)return!1;let $=Object.keys(x).length,Z=Object.keys(F).length;if($!==Z)return!1;for(let Q in x){let _=x.hasOwnProperty(Q),J=F.hasOwnProperty(Q);if(_&&!J||!_&&J||!Hx(x[Q],F[Q]))return!1}}return String(x)===String(F)}function M2(x,F){return x.findIndex((h)=>Hx(h,F))}var Mh=(x)=>{return!!(x&&x.__v_isRef===!0)},Ph=(x)=>{return Z0(x)?x:x==null?"":V0(x)||E0(x)&&(x.toString===A1||!r0(x.toString))?Mh(x)?Ph(x.value):JSON.stringify(x,Lh,2):String(x)},Lh=(x,F)=>{if(Mh(F))return Lh(x,F.value);else if(jh(F))return{[`Map(${F.size})`]:[...F.entries()].reduce((h,[B,$],Z)=>{return h[I1(B,Z)+" =>"]=$,h},{})};else if(Gh(F))return{[`Set(${F.size})`]:[...F.values()].map((h)=>I1(h))};else if(l0(F))return I1(F);else if(E0(F)&&!V0(F)&&!Yh(F))return String(F);return F},I1=(x,F="")=>{var h;return l0(x)?`Symbol(${(h=x.description)!=null?h:F})`:x};function P2(x){if(x==null)return"initial";if(typeof x==="string")return x===""?" ":x;if(typeof x!=="number"||!Number.isFinite(x))console.warn("[Vue warn] Invalid value used for CSS binding. Expected a string or a finite number but received:",x);return String(x)}Wh.EMPTY_ARR=K4;Wh.EMPTY_OBJ=q4;Wh.NO=j4;Wh.NOOP=C4;Wh.PatchFlagNames=u4;Wh.PatchFlags=d4;Wh.ShapeFlags=n4;Wh.SlotFlags=y4;Wh.camelize=R4;Wh.capitalize=Ih;Wh.cssVarNameEscapeSymbolsRE=Eh;Wh.def=S4;Wh.escapeHtml=I2;Wh.escapeHtmlComment=A2;Wh.extend=X4;Wh.genCacheKey=g4;Wh.genPropsAccessExp=i4;Wh.generateCodeFrame=o4;Wh.getEscapedCssVarName=H2;Wh.getGlobalThis=k4;Wh.hasChanged=m4;Wh.hasOwn=A4;Wh.hyphenate=Xh;Wh.includeBooleanAttr=z2;Wh.invokeArrayFns=f4;Wh.isArray=V0;Wh.isBooleanAttr=U2;Wh.isBuiltInDirective=W4;Wh.isDate=D1;Wh.isFunction=r0;Wh.isGloballyAllowed=Dh;Wh.isGloballyWhitelisted=p4;Wh.isHTMLTag=$2;Wh.isIntegerKey=P4;Wh.isKnownHtmlAttr=C2;Wh.isKnownMathMLAttr=G2;Wh.isKnownSvgAttr=j2;Wh.isMap=jh;Wh.isMathMLTag=Q2;Wh.isModelListener=Y4;Wh.isObject=E0;Wh.isOn=G4;Wh.isPlainObject=Yh;Wh.isPromise=E4;Wh.isRegExp=H4;Wh.isRenderableAttrValue=Y2;Wh.isReservedProp=L4;Wh.isSSRSafeAttrName=q2;Wh.isSVGTag=Z2;Wh.isSet=Gh;Wh.isSpecialBooleanAttr=J2;Wh.isString=Z0;Wh.isSymbol=l0;Wh.isVoidTag=_2;Wh.looseEqual=Hx;Wh.looseIndexOf=M2;Wh.looseToNumber=T4;Wh.makeMap=p;Wh.normalizeClass=E1;Wh.normalizeCssVarValue=P2;Wh.normalizeProps=e4;Wh.normalizeStyle=H1;Wh.objectToString=A1;Wh.parseStringStyle=Ah;Wh.propsToAttrMap=K2;Wh.remove=I4;Wh.slotFlagsText=s4;Wh.stringifyStyle=a4;Wh.toDisplayString=Ph;Wh.toHandlerKey=O4;Wh.toNumber=w4;Wh.toRawType=M4;Wh.toTypeString=O0});var g1=p1((x6)=>{Object.defineProperty(x6,"__esModule",{value:!0});var C=bh();function t(x,...F){console.warn(`[Vue warn] ${x}`,...F)}var f;class R1{constructor(x=!1){if(this.detached=x,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!x&&f)if(f.active)this.parent=f,this.index=(f.scopes||(f.scopes=[])).push(this)-1;else this._active=!1,this._warnOnRun=!1}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let x,F;if(this.scopes)for(x=0,F=this.scopes.length;x<F;x++)this.scopes[x].pause();for(x=0,F=this.effects.length;x<F;x++)this.effects[x].pause()}}resume(){if(this._active){if(this._isPaused){this._isPaused=!1;let x,F;if(this.scopes)for(x=0,F=this.scopes.length;x<F;x++)this.scopes[x].resume();for(x=0,F=this.effects.length;x<F;x++)this.effects[x].resume()}}}run(x){if(this._active){let F=f;try{return f=this,x()}finally{f=F}}else if(this._warnOnRun)t("cannot run an inactive effect scope.")}on(){if(++this._on===1)this.prevScope=f,f=this}off(){if(this._on>0&&--this._on===0){if(f===this)f=this.prevScope;else{let x=f;while(x){if(x.prevScope===this){x.prevScope=this.prevScope;break}x=x.prevScope}}this.prevScope=void 0}}stop(x){if(this._active){this._active=!1;let F,h;for(F=0,h=this.effects.length;F<h;F++)this.effects[F].stop();this.effects.length=0;for(F=0,h=this.cleanups.length;F<h;F++)this.cleanups[F]();if(this.cleanups.length=0,this.scopes){for(F=0,h=this.scopes.length;F<h;F++)this.scopes[F].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!x){let B=this.parent.scopes.pop();if(B&&B!==this)this.parent.scopes[this.index]=B,B.index=this.index}this.parent=void 0}}}function s8(x){return new R1(x)}function mh(){return f}function t8(x,F=!1){if(f)f.cleanups.push(x);else if(!F)t("onScopeDispose() is called when there is no active effect scope to be associated with.")}var D,p8={ACTIVE:1,"1":"ACTIVE",RUNNING:2,"2":"RUNNING",TRACKING:4,"4":"TRACKING",NOTIFIED:8,"8":"NOTIFIED",DIRTY:16,"16":"DIRTY",ALLOW_RECURSE:32,"32":"ALLOW_RECURSE",PAUSED:64,"64":"PAUSED",EVALUATED:128,"128":"EVALUATED"},M1=new WeakSet;class u0{constructor(x){if(this.fn=x,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,f)if(f.active)f.effects.push(this);else this.flags&=-2}pause(){this.flags|=64}resume(){if(this.flags&64){if(this.flags&=-65,M1.has(this))M1.delete(this),this.trigger()}}notify(){if(this.flags&2&&!(this.flags&32))return;if(!(this.flags&8))Sh(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Rh(this),Th(this);let x=D,F=o;D=this,o=!0;try{return this.fn()}finally{if(D!==this)t("Active effect was not restored correctly - this is likely a Vue internal bug.");wh(this),D=x,o=F,this.flags&=-3}}stop(){if(this.flags&1){for(let x=this.deps;x;x=x.nextDep)m1(x);this.deps=this.depsTail=void 0,Rh(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){if(this.flags&64)M1.add(this);else if(this.scheduler)this.scheduler();else this.runIfDirty()}runIfDirty(){if(W1(this))this.run()}get dirty(){return W1(this)}}var fh=0,e0,xx;function Sh(x,F=!1){if(x.flags|=8,F){x.next=xx,xx=x;return}x.next=e0,e0=x}function V1(){fh++}function O1(){if(--fh>0)return;if(xx){let F=xx;xx=void 0;while(F){let h=F.next;F.next=void 0,F.flags&=-9,F=h}}let x;while(e0){let F=e0;e0=void 0;while(F){let h=F.next;if(F.next=void 0,F.flags&=-9,F.flags&1)try{F.trigger()}catch(B){if(!x)x=B}F=h}}if(x)throw x}function Th(x){for(let F=x.deps;F;F=F.nextDep)F.version=-1,F.prevActiveLink=F.dep.activeLink,F.dep.activeLink=F}function wh(x){let F,h=x.depsTail,B=h;while(B){let $=B.prevDep;if(B.version===-1){if(B===h)h=$;m1(B),o8(B)}else F=B;B.dep.activeLink=B.prevActiveLink,B.prevActiveLink=void 0,B=$}x.deps=F,x.depsTail=h}function W1(x){for(let F=x.deps;F;F=F.nextDep)if(F.dep.version!==F.version||F.dep.computed&&(kh(F.dep.computed)||F.dep.version!==F.version))return!0;if(x._dirty)return!0;return!1}function kh(x){if(x.flags&4&&!(x.flags&16))return;if(x.flags&=-17,x.globalVersion===Fx)return;if(x.globalVersion=Fx,!x.isSSR&&x.flags&128&&(!x.deps&&!x._dirty||!W1(x)))return;x.flags|=2;let F=x.dep,h=D,B=o;D=x,o=!0;try{Th(x);let $=x.fn(x._value);if(F.version===0||C.hasChanged($,x._value))x.flags|=128,x._value=$,F.version++}catch($){throw F.version++,$}finally{D=h,o=B,wh(x),x.flags&=-3}}function m1(x,F=!1){let{dep:h,prevSub:B,nextSub:$}=x;if(B)B.nextSub=$,x.prevSub=void 0;if($)$.prevSub=B,x.nextSub=void 0;if(h.subsHead===x)h.subsHead=$;if(h.subs===x){if(h.subs=B,!B&&h.computed){h.computed.flags&=-5;for(let Z=h.computed.deps;Z;Z=Z.nextDep)m1(Z,!0)}}if(!F&&!--h.sc&&h.map)h.map.delete(h.key)}function o8(x){let{prevDep:F,nextDep:h}=x;if(F)F.nextDep=h,x.prevDep=void 0;if(h)h.prevDep=F,x.nextDep=void 0}function v8(x,F){if(x.effect instanceof u0)x=x.effect.fn;let h=new u0(x);if(F)C.extend(h,F);try{h.run()}catch($){throw h.stop(),$}let B=h.run.bind(h);return B.effect=h,B}function r8(x){x.effect.stop()}var o=!0,f1=[];function S1(){f1.push(o),o=!1}function l8(){f1.push(o),o=!0}function T1(){let x=f1.pop();o=x===void 0?!0:x}function a8(x,F=!1){if(D instanceof u0)D.cleanup=x;else if(!F)t("onEffectCleanup() was called when there was no active effect to associate with.")}function Rh(x){let{cleanup:F}=x;if(x.cleanup=void 0,F){let h=D;D=void 0;try{F()}finally{D=h}}}var Fx=0;class ch{constructor(x,F){this.sub=x,this.dep=F,this.version=F.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class hx{constructor(x){this.computed=x,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0,this.subsHead=void 0}track(x){if(!D||!o||D===this.computed)return;let F=this.activeLink;if(F===void 0||F.sub!==D){if(F=this.activeLink=new ch(D,this),!D.deps)D.deps=D.depsTail=F;else F.prevDep=D.depsTail,D.depsTail.nextDep=F,D.depsTail=F;ih(F)}else if(F.version===-1){if(F.version=this.version,F.nextDep){let h=F.nextDep;if(h.prevDep=F.prevDep,F.prevDep)F.prevDep.nextDep=h;if(F.prevDep=D.depsTail,F.nextDep=void 0,D.depsTail.nextDep=F,D.depsTail=F,D.deps===F)D.deps=h}}if(D.onTrack)D.onTrack(C.extend({effect:D},x));return F}trigger(x){this.version++,Fx++,this.notify(x)}notify(x){V1();try{for(let F=this.subsHead;F;F=F.nextSub)if(F.sub.onTrigger&&!(F.sub.flags&8))F.sub.onTrigger(C.extend({effect:F.sub},x));for(let F=this.subs;F;F=F.prevSub)if(F.sub.notify())F.sub.dep.notify()}finally{O1()}}}function ih(x){if(x.dep.sc++,x.sub.flags&4){let F=x.dep.computed;if(F&&!x.dep.subs){F.flags|=20;for(let B=F.deps;B;B=B.nextDep)ih(B)}let h=x.dep.subs;if(h!==x){if(x.prevSub=h,h)h.nextSub=x}if(x.dep.subsHead===void 0)x.dep.subsHead=x;x.dep.subs=x}}var Lx=new WeakMap,P0=Symbol("Object iterate"),Wx=Symbol("Map keys iterate"),n0=Symbol("Array iterate");function y(x,F,h){if(o&&D){let B=Lx.get(x);if(!B)Lx.set(x,B=new Map);let $=B.get(h);if(!$)B.set(h,$=new hx),$.map=B,$.key=h;$.track({target:x,type:F,key:h})}}function K0(x,F,h,B,$,Z){let Q=Lx.get(x);if(!Q){Fx++;return}let _=(J)=>{if(J)J.trigger({target:x,type:F,key:h,newValue:B,oldValue:$,oldTarget:Z})};if(V1(),F==="clear")Q.forEach(_);else{let J=C.isArray(x),N=J&&C.isIntegerKey(h);if(J&&h==="length"){let K=Number(B);Q.forEach((q,G)=>{if(G==="length"||G===n0||!C.isSymbol(G)&&G>=K)_(q)})}else{if(h!==void 0||Q.has(void 0))_(Q.get(h));if(N)_(Q.get(n0));switch(F){case"add":if(!J){if(_(Q.get(P0)),C.isMap(x))_(Q.get(Wx))}else if(N)_(Q.get("length"));break;case"delete":if(!J){if(_(Q.get(P0)),C.isMap(x))_(Q.get(Wx))}break;case"set":if(C.isMap(x))_(Q.get(P0));break}}}O1()}function e8(x,F){let h=Lx.get(x);return h&&h.get(F)}function m0(x){let F=A(x);if(F===x)return F;return y(F,"iterate",n0),v(x)?F:F.map(_0)}function Vx(x){return y(x=A(x),"iterate",n0),x}function Q0(x,F){if(j0(x))return f0(x)?y0(_0(F)):y0(F);return _0(F)}var x7={__proto__:null,[Symbol.iterator](){return P1(this,Symbol.iterator,(x)=>Q0(this,x))},concat(...x){return m0(this).concat(...x.map((F)=>C.isArray(F)?m0(F):F))},entries(){return P1(this,"entries",(x)=>{return x[1]=Q0(this,x[1]),x})},every(x,F){return q0(this,"every",x,F,void 0,arguments)},filter(x,F){return q0(this,"filter",x,F,(h)=>h.map((B)=>Q0(this,B)),arguments)},find(x,F){return q0(this,"find",x,F,(h)=>Q0(this,h),arguments)},findIndex(x,F){return q0(this,"findIndex",x,F,void 0,arguments)},findLast(x,F){return q0(this,"findLast",x,F,(h)=>Q0(this,h),arguments)},findLastIndex(x,F){return q0(this,"findLastIndex",x,F,void 0,arguments)},forEach(x,F){return q0(this,"forEach",x,F,void 0,arguments)},includes(...x){return L1(this,"includes",x)},indexOf(...x){return L1(this,"indexOf",x)},join(x){return m0(this).join(x)},lastIndexOf(...x){return L1(this,"lastIndexOf",x)},map(x,F){return q0(this,"map",x,F,void 0,arguments)},pop(){return a0(this,"pop")},push(...x){return a0(this,"push",x)},reduce(x,...F){return Vh(this,"reduce",x,F)},reduceRight(x,...F){return Vh(this,"reduceRight",x,F)},shift(){return a0(this,"shift")},some(x,F){return q0(this,"some",x,F,void 0,arguments)},splice(...x){return a0(this,"splice",x)},toReversed(){return m0(this).toReversed()},toSorted(x){return m0(this).toSorted(x)},toSpliced(...x){return m0(this).toSpliced(...x)},unshift(...x){return a0(this,"unshift",x)},values(){return P1(this,"values",(x)=>Q0(this,x))}};function P1(x,F,h){let B=Vx(x),$=B[F]();if(B!==x&&!v(x))$._next=$.next,$.next=()=>{let Z=$._next();if(!Z.done)Z.value=h(Z.value);return Z};return $}var F7=Array.prototype;function q0(x,F,h,B,$,Z){let Q=Vx(x),_=Q!==x&&!v(x),J=Q[F];if(J!==F7[F]){let q=J.apply(x,Z);return _?_0(q):q}let N=h;if(Q!==x){if(_)N=function(q,G){return h.call(this,Q0(x,q),G,x)};else if(h.length>2)N=function(q,G){return h.call(this,q,G,x)}}let K=J.call(Q,N,B);return _&&$?$(K):K}function Vh(x,F,h,B){let $=Vx(x),Z=$!==x&&!v(x),Q=h,_=!1;if($!==x){if(Z)_=B.length===0,Q=function(N,K,q){if(_)_=!1,N=Q0(x,N);return h.call(this,N,Q0(x,K),q,x)};else if(h.length>3)Q=function(N,K,q){return h.call(this,N,K,q,x)}}let J=$[F](Q,...B);return _?Q0(x,J):J}function L1(x,F,h){let B=A(x);y(B,"iterate",n0);let $=B[F](...h);if(($===-1||$===!1)&&fx(h[0]))return h[0]=A(h[0]),B[F](...h);return $}function a0(x,F,h=[]){S1(),V1();let B=A(x)[F].apply(x,h);return O1(),T1(),B}var h7=C.makeMap("__proto__,__v_isRef,__isVue"),gh=new Set(Object.getOwnPropertyNames(Symbol).filter((x)=>x!=="arguments"&&x!=="caller").map((x)=>Symbol[x]).filter(C.isSymbol));function B7(x){if(!C.isSymbol(x))x=String(x);let F=A(this);return y(F,"has",x),F.hasOwnProperty(x)}class w1{constructor(x=!1,F=!1){this._isReadonly=x,this._isShallow=F}get(x,F,h){if(F==="__v_skip")return x.__v_skip;let B=this._isReadonly,$=this._isShallow;if(F==="__v_isReactive")return!B;else if(F==="__v_isReadonly")return B;else if(F==="__v_isShallow")return $;else if(F==="__v_raw"){if(h===(B?$?yh:nh:$?uh:dh).get(x)||Object.getPrototypeOf(x)===Object.getPrototypeOf(h))return x;return}let Z=C.isArray(x);if(!B){let _;if(Z&&(_=x7[F]))return _;if(F==="hasOwnProperty")return B7}let Q=Reflect.get(x,F,c(x)?x:h);if(C.isSymbol(F)?gh.has(F):h7(F))return Q;if(!B)y(x,"get",F);if($)return Q;if(c(Q)){let _=Z&&C.isIntegerKey(F)?Q:Q.value;return B&&C.isObject(_)?bx(_):_}if(C.isObject(Q))return B?bx(Q):i1(Q);return Q}}class k1 extends w1{constructor(x=!1){super(!1,x)}set(x,F,h,B){let $=x[F],Z=C.isArray(x)&&C.isIntegerKey(F);if(!this._isShallow){let J=j0($);if(!v(h)&&!j0(h))$=A($),h=A(h);if(!Z&&c($)&&!c(h))if(J)return t(`Set operation on key "${String(F)}" failed: target is readonly.`,x[F]),!0;else return $.value=h,!0}let Q=Z?Number(F)<x.length:C.hasOwn(x,F),_=Reflect.set(x,F,h,c(x)?x:B);if(x===A(B)){if(!Q)K0(x,"add",F,h);else if(C.hasChanged(h,$))K0(x,"set",F,h,$)}return _}deleteProperty(x,F){let h=C.hasOwn(x,F),B=x[F],$=Reflect.deleteProperty(x,F);if($&&h)K0(x,"delete",F,void 0,B);return $}has(x,F){let h=Reflect.has(x,F);if(!C.isSymbol(F)||!gh.has(F))y(x,"has",F);return h}ownKeys(x){return y(x,"iterate",C.isArray(x)?"length":P0),Reflect.ownKeys(x)}}class c1 extends w1{constructor(x=!1){super(!0,x)}set(x,F){return t(`Set operation on key "${String(F)}" failed: target is readonly.`,x),!0}deleteProperty(x,F){return t(`Delete operation on key "${String(F)}" failed: target is readonly.`,x),!0}}var $7=new k1,Z7=new c1,Q7=new k1(!0),_7=new c1(!0),b1=(x)=>x,Ex=(x)=>Reflect.getPrototypeOf(x);function J7(x,F,h){return function(...B){let $=this.__v_raw,Z=A($),Q=C.isMap(Z),_=x==="entries"||x===Symbol.iterator&&Q,J=x==="keys"&&Q,N=$[x](...B),K=h?b1:F?y0:_0;return!F&&y(Z,"iterate",J?Wx:P0),C.extend(Object.create(N),{next(){let{value:q,done:G}=N.next();return G?{value:q,done:G}:{value:_?[K(q[0]),K(q[1])]:K(q),done:G}}})}}function Mx(x){return function(...F){{let h=F[0]?`on key "${F[0]}" `:"";t(`${C.capitalize(x)} operation ${h}failed: target is readonly.`,A(this))}return x==="delete"?!1:x==="clear"?void 0:this}}function U7(x,F){let h={get($){let Z=this.__v_raw,Q=A(Z),_=A($);if(!x){if(C.hasChanged($,_))y(Q,"get",$);y(Q,"get",_)}let{has:J}=Ex(Q),N=F?b1:x?y0:_0;if(J.call(Q,$))return N(Z.get($));else if(J.call(Q,_))return N(Z.get(_));else if(Z!==Q)Z.get($)},get size(){let $=this.__v_raw;return!x&&y(A($),"iterate",P0),$.size},has($){let Z=this.__v_raw,Q=A(Z),_=A($);if(!x){if(C.hasChanged($,_))y(Q,"has",$);y(Q,"has",_)}return $===_?Z.has($):Z.has($)||Z.has(_)},forEach($,Z){let Q=this,_=Q.__v_raw,J=A(_),N=F?b1:x?y0:_0;return!x&&y(J,"iterate",P0),_.forEach((K,q)=>{return $.call(Z,N(K),N(q),Q)})}};return C.extend(h,x?{add:Mx("add"),set:Mx("set"),delete:Mx("delete"),clear:Mx("clear")}:{add($){let Z=A(this),Q=Ex(Z),_=A($),J=!F&&!v($)&&!j0($)?_:$;if(!(Q.has.call(Z,J)||C.hasChanged($,J)&&Q.has.call(Z,$)||C.hasChanged(_,J)&&Q.has.call(Z,_)))Z.add(J),K0(Z,"add",J,J);return this},set($,Z){if(!F&&!v(Z)&&!j0(Z))Z=A(Z);let Q=A(this),{has:_,get:J}=Ex(Q),N=_.call(Q,$);if(!N)$=A($),N=_.call(Q,$);else Oh(Q,_,$);let K=J.call(Q,$);if(Q.set($,Z),!N)K0(Q,"add",$,Z);else if(C.hasChanged(Z,K))K0(Q,"set",$,Z,K);return this},delete($){let Z=A(this),{has:Q,get:_}=Ex(Z),J=Q.call(Z,$);if(!J)$=A($),J=Q.call(Z,$);else Oh(Z,Q,$);let N=_?_.call(Z,$):void 0,K=Z.delete($);if(J)K0(Z,"delete",$,void 0,N);return K},clear(){let $=A(this),Z=$.size!==0,Q=C.isMap($)?new Map($):new Set($),_=$.clear();if(Z)K0($,"clear",void 0,void 0,Q);return _}}),["keys","values","entries",Symbol.iterator].forEach(($)=>{h[$]=J7($,x,F)}),h}function Ox(x,F){let h=U7(x,F);return(B,$,Z)=>{if($==="__v_isReactive")return!x;else if($==="__v_isReadonly")return x;else if($==="__v_raw")return B;return Reflect.get(C.hasOwn(h,$)&&$ in B?h:B,$,Z)}}var z7={get:Ox(!1,!1)},N7={get:Ox(!1,!0)},q7={get:Ox(!0,!1)},K7={get:Ox(!0,!0)};function Oh(x,F,h){let B=A(h);if(B!==h&&F.call(x,B)){let $=C.toRawType(x);t(`Reactive ${$} contains both the raw and reactive versions of the same object${$==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var dh=new WeakMap,uh=new WeakMap,nh=new WeakMap,yh=new WeakMap;function C7(x){switch(x){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function j7(x){return x.__v_skip||!Object.isExtensible(x)?0:C7(C.toRawType(x))}function i1(x){if(j0(x))return x;return mx(x,!1,$7,z7,dh)}function G7(x){return mx(x,!1,Q7,N7,uh)}function bx(x){return mx(x,!0,Z7,q7,nh)}function Y7(x){return mx(x,!0,_7,K7,yh)}function mx(x,F,h,B,$){if(!C.isObject(x))return t(`value cannot be made ${F?"readonly":"reactive"}: ${String(x)}`),x;if(x.__v_raw&&!(F&&x.__v_isReactive))return x;let Z=j7(x);if(Z===0)return x;let Q=$.get(x);if(Q)return Q;let _=new Proxy(x,Z===2?B:h);return $.set(x,_),_}function f0(x){if(j0(x))return f0(x.__v_raw);return!!(x&&x.__v_isReactive)}function j0(x){return!!(x&&x.__v_isReadonly)}function v(x){return!!(x&&x.__v_isShallow)}function fx(x){return x?!!x.__v_raw:!1}function A(x){let F=x&&x.__v_raw;return F?A(F):x}function X7(x){if(!C.hasOwn(x,"__v_skip")&&Object.isExtensible(x))C.def(x,"__v_skip",!0);return x}var _0=(x)=>C.isObject(x)?i1(x):x,y0=(x)=>C.isObject(x)?bx(x):x;function c(x){return x?x.__v_isRef===!0:!1}function sh(x){return th(x,!1)}function I7(x){return th(x,!0)}function th(x,F){if(c(x))return x;return new ph(x,F)}class ph{constructor(x,F){this.dep=new hx,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=F?x:A(x),this._value=F?x:_0(x),this.__v_isShallow=F}get value(){return this.dep.track({target:this,type:"get",key:"value"}),this._value}set value(x){let F=this._rawValue,h=this.__v_isShallow||v(x)||j0(x);if(x=h?x:A(x),C.hasChanged(x,F))this._rawValue=x,this._value=h?x:_0(x),this.dep.trigger({target:this,type:"set",key:"value",newValue:x,oldValue:F})}}function D7(x){if(x.dep)x.dep.trigger({target:x,type:"set",key:"value",newValue:x._value})}function Sx(x){return c(x)?x.value:x}function A7(x){return C.isFunction(x)?x():Sx(x)}var H7={get:(x,F,h)=>F==="__v_raw"?x:Sx(Reflect.get(x,F,h)),set:(x,F,h,B)=>{let $=x[F];if(c($)&&!c(h))return $.value=h,!0;else return Reflect.set(x,F,h,B)}};function E7(x){return f0(x)?x:new Proxy(x,H7)}class oh{constructor(x){this.__v_isRef=!0,this._value=void 0;let F=this.dep=new hx,{get:h,set:B}=x(F.track.bind(F),F.trigger.bind(F));this._get=h,this._set=B}get value(){return this._value=this._get()}set value(x){this._set(x)}}function M7(x){return new oh(x)}function P7(x){if(!fx(x))t("toRefs() expects a reactive object but received a plain one.");let F=C.isArray(x)?Array(x.length):{};for(let h in x)F[h]=lh(x,h);return F}class vh{constructor(x,F,h){this._object=x,this._defaultValue=h,this.__v_isRef=!0,this._value=void 0,this._key=C.isSymbol(F)?F:String(F),this._raw=A(x);let B=!0,$=x;if(!C.isArray(x)||C.isSymbol(this._key)||!C.isIntegerKey(this._key))do B=!fx($)||v($);while(B&&($=$.__v_raw));this._shallow=B}get value(){let x=this._object[this._key];if(this._shallow)x=Sx(x);return this._value=x===void 0?this._defaultValue:x}set value(x){if(this._shallow&&c(this._raw[this._key])){let F=this._object[this._key];if(c(F)){F.value=x;return}}this._object[this._key]=x}get dep(){return e8(this._raw,this._key)}}class rh{constructor(x){this._getter=x,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function L7(x,F,h){if(c(x))return x;else if(C.isFunction(x))return new rh(x);else if(C.isObject(x)&&arguments.length>1)return lh(x,F,h);else return sh(x)}function lh(x,F,h){return new vh(x,F,h)}class ah{constructor(x,F,h){this.fn=x,this.setter=F,this._value=void 0,this.dep=new hx(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Fx-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!F,this.isSSR=h}notify(){if(this.flags|=16,!(this.flags&8)&&D!==this)return Sh(this,!0),!0}get value(){let x=this.dep.track({target:this,type:"get",key:"value"});if(kh(this),x)x.version=this.dep.version;return this._value}set value(x){if(this.setter)this.setter(x);else t("Write operation failed: computed value is readonly")}}function W7(x,F,h=!1){let B,$;if(C.isFunction(x))B=x;else B=x.get,$=x.set;let Z=new ah(B,$,h);if(F&&!h)Z.onTrack=F.onTrack,Z.onTrigger=F.onTrigger;return Z}var b7={GET:"get",HAS:"has",ITERATE:"iterate"},R7={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},V7={SKIP:"__v_skip",IS_REACTIVE:"__v_isReactive",IS_READONLY:"__v_isReadonly",IS_SHALLOW:"__v_isShallow",RAW:"__v_raw",IS_REF:"__v_isRef"},O7={WATCH_GETTER:2,"2":"WATCH_GETTER",WATCH_CALLBACK:3,"3":"WATCH_CALLBACK",WATCH_CLEANUP:4,"4":"WATCH_CLEANUP"},Px={},Rx=new WeakMap,M0=void 0;function m7(){return M0}function eh(x,F=!1,h=M0){if(h){let B=Rx.get(h);if(!B)Rx.set(h,B=[]);B.push(x)}else if(!F)t("onWatcherCleanup() was called when there was no active watcher to associate with.")}function f7(x,F,h=C.EMPTY_OBJ){let{immediate:B,deep:$,once:Z,scheduler:Q,augmentJob:_,call:J}=h,N=(X)=>{(h.onWarn||t)("Invalid watch source: ",X,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")},K=(X)=>{if($)return X;if(v(X)||$===!1||$===0)return C0(X,1);return C0(X)},q,G,Y,E,H=!1,W=!1;if(c(x))G=()=>x.value,H=v(x);else if(f0(x))G=()=>K(x),H=!0;else if(C.isArray(x))W=!0,H=x.some((X)=>f0(X)||v(X)),G=()=>x.map((X)=>{if(c(X))return X.value;else if(f0(X))return K(X);else if(C.isFunction(X))return J?J(X,2):X();else N(X)});else if(C.isFunction(x))if(F)G=J?()=>J(x,2):x;else G=()=>{if(Y){S1();try{Y()}finally{T1()}}let X=M0;M0=q;try{return J?J(x,3,[E]):x(E)}finally{M0=X}};else G=C.NOOP,N(x);if(F&&$){let X=G,M=$===!0?1/0:$;G=()=>C0(X(),M)}let I=mh(),P=()=>{if(q.stop(),I&&I.active)C.remove(I.effects,q)};if(Z&&F){let X=F;F=(...M)=>{X(...M),P()}}let R=W?Array(x.length).fill(Px):Px,L=(X)=>{if(!(q.flags&1)||!q.dirty&&!X)return;if(F){let M=q.run();if($||H||(W?M.some((i,g)=>C.hasChanged(i,R[g])):C.hasChanged(M,R))){if(Y)Y();let i=M0;M0=q;try{let g=[M,R===Px?void 0:W&&R[0]===Px?[]:R,E];R=M,J?J(F,3,g):F(...g)}finally{M0=i}}}else q.run()};if(_)_(L);if(q=new u0(G),q.scheduler=Q?()=>Q(L,!1):L,E=(X)=>eh(X,!1,q),Y=q.onStop=()=>{let X=Rx.get(q);if(X){if(J)J(X,4);else for(let M of X)M();Rx.delete(q)}},q.onTrack=h.onTrack,q.onTrigger=h.onTrigger,F)if(B)L(!0);else R=q.run();else if(Q)Q(L.bind(null,!0),!0);else q.run();return P.pause=q.pause.bind(q),P.resume=q.resume.bind(q),P.stop=P,P}function C0(x,F=1/0,h){if(F<=0||!C.isObject(x)||x.__v_skip)return x;if(h=h||new Map,(h.get(x)||0)>=F)return x;if(h.set(x,F),F--,c(x))C0(x.value,F,h);else if(C.isArray(x))for(let B=0;B<x.length;B++)C0(x[B],F,h);else if(C.isSet(x)||C.isMap(x))x.forEach((B)=>{C0(B,F,h)});else if(C.isPlainObject(x)){for(let B in x)C0(x[B],F,h);for(let B of Object.getOwnPropertySymbols(x))if(Object.prototype.propertyIsEnumerable.call(x,B))C0(x[B],F,h)}return x}x6.ARRAY_ITERATE_KEY=n0;x6.EffectFlags=p8;x6.EffectScope=R1;x6.ITERATE_KEY=P0;x6.MAP_KEY_ITERATE_KEY=Wx;x6.ReactiveEffect=u0;x6.ReactiveFlags=V7;x6.TrackOpTypes=b7;x6.TriggerOpTypes=R7;x6.WatchErrorCodes=O7;x6.computed=W7;x6.customRef=M7;x6.effect=v8;x6.effectScope=s8;x6.enableTracking=l8;x6.getCurrentScope=mh;x6.getCurrentWatcher=m7;x6.isProxy=fx;x6.isReactive=f0;x6.isReadonly=j0;x6.isRef=c;x6.isShallow=v;x6.markRaw=X7;x6.onEffectCleanup=a8;x6.onScopeDispose=t8;x6.onWatcherCleanup=eh;x6.pauseTracking=S1;x6.proxyRefs=E7;x6.reactive=i1;x6.reactiveReadArray=m0;x6.readonly=bx;x6.ref=sh;x6.resetTracking=T1;x6.shallowReactive=G7;x6.shallowReadArray=Vx;x6.shallowReadonly=Y7;x6.shallowRef=I7;x6.stop=r8;x6.toRaw=A;x6.toReactive=_0;x6.toReadonly=y0;x6.toRef=L7;x6.toRefs=P7;x6.toValue=A7;x6.track=y;x6.traverse=C0;x6.trigger=K0;x6.triggerRef=D7;x6.unref=Sx;x6.watch=f7});import n1 from"process";import B4 from"path";import Xx from"process";import T0 from"path";import p0 from"fs";import wx from"process";import{CString as a3,suffix as Y6}from"bun:ffi";import v1 from"process";import K6 from"fs";import{suffix as C6}from"bun:ffi";var s3=`buntui.${C6}`,j6=`${v1.platform}-${v1.arch}`;function G6(){try{let x=o1(`@buntui/native-${j6}`);if(K6.existsSync(x.binaryPath))return x.binaryPath}catch{}return}function r1(){return G6()??""}var s;function l1(){if(s)return s;let x=`buntui.${Y6}`,F=wx.platform==="win32"?"":"lib",h=wx.platform==="win32"?"bin":"lib",B=`${F}${x}`,$=wx.env.BUNTUI_DLL;if($)return s=T0.resolve($),s;let Z=r1();if(p0.existsSync(Z))return s=Z,s;let Q=T0.resolve(T0.dirname(Bun.main),x);if(p0.existsSync(Q))return s=Q,s;let _=T0.resolve(import.meta.dir,x);if(p0.existsSync(_))return s=_,s;let J=T0.resolve(import.meta.dir,"..","..","..","packages","native","zig-out","bin",x);if(p0.existsSync(J))return s=J,s;let N=T0.resolve(import.meta.dir,"..","..","..","packages","native","zig-out",h,B);if(p0.existsSync(N))return s=N,s;throw Error(`Cannot find native library: ${x}. Set BUNTUI_DLL env or ensure the binary is in the search path.`)}function a1(x={}){let F=x.arch??64,h=F===64?8:4,B=0;function $(Z){let Q=0;if(typeof Z==="number")Q=Z;else if(Z==="pointer")Q=h;else if(Z==="bool")Q=1;else{let K=Number.parseInt(Z.slice(1),10);Q=Math.ceil(K/8)}let _=Math.min(Q,h),J=(_-B%_)%_;B+=J;let N=B;return B+=Q,N}return{get currentOffset(){return B},get arch(){return F},mark:$}}var X6=new TextEncoder("utf-8");function kx(x){let F=X6.encode(x),h=new Uint8Array(F.length+1);return h.set(F),h[F.length]=0,h}var cx={False:0,True:1};function e1(x){return x}class xF{#F;constructor(x,F,h){this.#F=new globalThis.DataView(x,F,h)}get byteLength(){return this.#F.byteLength}getFloat32(x,F){return this.#F.getFloat32(x,F)}getFloat64(x,F){return this.#F.getFloat64(x,F)}getInt8(x){return this.#F.getInt8(x)}getInt16(x,F){return this.#F.getInt16(x,F)}getInt32(x,F){return this.#F.getInt32(x,F)}getUint8(x){return this.#F.getUint8(x)}getUint16(x,F){return this.#F.getUint16(x,F)}getUint32(x,F){return this.#F.getUint32(x,F)}setFloat32(x,F,h){this.#F.setFloat32(x,F,h)}setFloat64(x,F,h){this.#F.setFloat64(x,F,h)}setInt8(x,F){this.#F.setInt8(x,F)}setInt16(x,F,h){this.#F.setInt16(x,F,h)}setInt32(x,F,h){this.#F.setInt32(x,F,h)}setUint8(x,F){this.#F.setUint8(x,F)}setUint16(x,F,h){this.#F.setUint16(x,F,h)}setUint32(x,F,h){this.#F.setUint32(x,F,h)}getBigInt64(x,F){return this.#F.getBigInt64(x,F)}getBigUint64(x,F){return this.#F.getBigUint64(x,F)}setBigInt64(x,F,h){this.#F.setBigInt64(x,F,h)}setBigUint64(x,F,h){this.#F.setBigUint64(x,F,h)}getFloat16(x,F){return this.#F.getFloat16(x,F)}setFloat16(x,F,h){this.#F.setFloat16(x,F,h)}setPointer(x,F){this.#F.setBigUint64(x,BigInt(F),!0)}getPointer(x){return e1(Number(this.#F.getBigUint64(x,!0)))}getBool(x){let F=this.#F.getUint8(x);if(F!==1&&F!==0)throw Error(`Invalid boolean value: ${F}`);return F!==0}setBool(x,F){this.#F.setUint8(x,F?cx.True:cx.False)}get[Symbol.toStringTag](){return this.#F[Symbol.toStringTag]}}var x0=xF;var _x=1,Jx=2,Ux=4,zx=8,FF=16,hF=1,BF=2,$F=16,m={KeyboardEvent:1,MouseEvent:2,WheelEvent:3,TermResizeEvent:4};class ix{key;shiftKey;ctrlKey;altKey;metaKey;repeat;charCode;constructor(x){let F=new x0(x),h=F.getUint8(0);this.charCode=F.getUint16(1,!0);let B=F.getUint8(3);if(this.shiftKey=(h&_x)===_x,this.ctrlKey=(h&Jx)===Jx,this.altKey=(h&Ux)===Ux,this.metaKey=(h&zx)===zx,this.repeat=(h&FF)===FF,B>0){let $=new Uint8Array(x,4,B);this.key=new TextDecoder("utf-8").decode($)}else this.key=void 0}}class w0{static LEFT_MOUSE_BUTTON=0;static MIDDLE_MOUSE_BUTTON=1;static RIGHT_MOUSE_BUTTON=2;button;buttons;x;y;isRelease;shiftKey;ctrlKey;altKey;metaKey;constructor(x){let F=new x0(x),h=F.getUint8(0),B=F.getUint8(1);this.shiftKey=(h&_x)===_x,this.ctrlKey=(h&Jx)===Jx,this.altKey=(h&Ux)===Ux,this.metaKey=(h&zx)===zx,this.x=F.getUint16(4,!0)-1,this.y=F.getUint16(6,!0)-1,this.button=(B&hF)===hF?F.getUint8(2):void 0,this.buttons=(B&BF)===BF?F.getUint8(3):void 0,this.isRelease=(B&$F)===$F}}class gx extends w0{wheelDeltaY;constructor(x){super(x);let F=new x0(x);this.wheelDeltaY=F.getInt8(8)}}class dx{rows;cols;constructor(x){let F=new x0(x);this.rows=F.getUint16(0,!0),this.cols=F.getUint16(2,!0)}}import{ptr as I6}from"bun:ffi";var D6={Fixed:0,Auto:1},D0=a1(),V=Object.freeze({tick:D0.mark("u64"),x:D0.mark("u16"),y:D0.mark("u16"),rows:D0.mark("u16"),cols:D0.mark("u16"),resizeBehavior:D0.mark("u8"),debugMode:D0.mark("u8")});class ZF{#F;#x;constructor(){let x=new ArrayBuffer(D0.currentOffset);this.#F=I6(x);let F=new x0(x);this.#x=F,F.setBigUint64(V.tick,0n,!0),F.setUint16(V.x,0,!0),F.setUint16(V.y,0,!0),F.setUint16(V.rows,0,!0),F.setUint16(V.cols,0,!0),F.setUint8(V.resizeBehavior,D6.Auto),F.setBool(V.debugMode,!1)}get ptr(){return this.#F}get tick(){return this.#x.getBigUint64(V.tick,!0)}get x(){return this.#x.getUint16(V.x,!0)}set x(x){this.#x.setUint16(V.x,x,!0)}get y(){return this.#x.getUint16(V.y,!0)}set y(x){this.#x.setUint16(V.y,x,!0)}get rows(){return this.#x.getUint16(V.rows,!0)}set rows(x){this.#x.setUint16(V.rows,x,!0)}get cols(){return this.#x.getUint16(V.cols,!0)}set cols(x){this.#x.setUint16(V.cols,x,!0)}get resizeBehavior(){return this.#x.getUint8(V.resizeBehavior)}set resizeBehavior(x){this.#x.setUint8(V.resizeBehavior,x)}get debugMode(){return this.#x.getBool(V.debugMode)}set debugMode(x){this.#x.setBool(V.debugMode,x)}}var T=new ZF;import ux from"fs";import A6 from"path";import{appendFile as Nx}from"fs/promises";var _F=0,yx=1,JF=2,UF=3;function sx(x){switch(x){case"debug":return _F;case"info":return yx;case"warning":return JF;case"error":return UF}}var nx="",QF=0;function qx(){let x=new Date,F=x.getTime();if(F===QF)return nx;let h=x.getFullYear(),B=x.getMonth()+1,$=x.getDate(),Z=x.getHours(),Q=x.getMinutes(),_=x.getSeconds();QF=F;let J=(N)=>String(N).padStart(2,"0");return nx=`[${h}-${J(B)}-${J($)} ${J(Z)}:${J(Q)}:${J(_)}]`,nx}class zF{#F="";#x="";#h=yx;#B=[];#$=!1;#Q;async init(x){this.#F=x.logFileDir;let{logLevel:F,clearLog:h}=x;if(this.#x=A6.resolve(this.#F,x.frontendLogName),this.#h=sx(F),!ux.existsSync(this.#F))ux.mkdirSync(this.#F,{recursive:!0});if(h)ux.writeFileSync(this.#x,"");this.#$=!0;let B=async()=>{if(!this.#$)return;try{let $=[];while(this.#B.length>0){let Z=this.#B.shift();if(Z)$.push(Z())}await Promise.all($)}finally{this.#Q=setImmediate(()=>{B()})}};this.#Q=setImmediate(()=>{B()})}deinit(){if(this.#$=!1,this.#Q!==void 0)clearImmediate(this.#Q),this.#Q=void 0;for(let x of this.#B)x();this.#B.length=0}logDebug(x){if(this.#h===_F)this.#B.push(async()=>{await Nx(this.#x,`${qx()} debug: ${x}
|
|
4
|
-
`)})}logInfo(x){if(this.#h<=yx)this.#B.push(async()=>{await Nx(this.#x,`${qx()} info: ${x}
|
|
5
|
-
`)})}logWarning(x){if(this.#h<=JF)this.#B.push(async()=>{await Nx(this.#x,`${qx()} warning: ${x}
|
|
6
|
-
`)})}logError(x){if(this.#h<=UF)this.#B.push(async()=>{await Nx(this.#x,`${qx()} error: ${x}
|
|
7
|
-
`)})}}var b=new zF;class NF{#F={};#x;on(x,F){this.#F[x]||=[],this.#F[x].push(F)}off(x,F){let h=this.#F[x];if(h){let B=h.indexOf(F);if(B!==-1)h.splice(B,1)}}attach(x){this.#x=x}start(){if(!this.#x)throw Error("EventBus: no backend attached. Call attach() before start().");this.#x.startEvents(this.#h)}stop(){this.#x?.stopEvents(),this.#x=void 0}#h=(x,F)=>{let h=this.#F[x];if(h)for(let B of h)B(F)}}var w=new NF;var H6=0n;function qF(){return++H6}var E6=/^#([\da-f]{6})([\da-f]{2})$/iv,M6=/^#([\da-f])([\da-f])([\da-f])([\da-f])$/iv;function Kx(x){let F=Number.parseInt(x,16);return F<<4|F}function z(x){if(typeof x==="number")return x;let F=x.trim(),h=Bun.color(F,"css");if(h){let $=E6.exec(h);if($?.[1]&&$[2]){let Q=Number.parseInt($[1],16),_=Number.parseInt($[2],16);return(Q<<8|_)>>>0}let Z=M6.exec(h);if(Z?.[1]&&Z[2]&&Z[3]&&Z[4]){let Q=Kx(Z[1]),_=Kx(Z[2]),J=Kx(Z[3]),N=Kx(Z[4]);return(Q<<24|_<<16|J<<8|N)>>>0}}let B=Bun.color(F,"number");if(B===null)throw Error(`Invalid color: ${x}`);return(B<<8|255)>>>0}function o0(x){return"handleKey"in x&&"focus"in x&&"blur"in x&&"acceptsFocus"in x}var P6=["background","surface","surfaceHover","surfaceFocused","surfacePressed","surfaceDisabled","text","textMuted","border","borderFocused","accent","accentHover","selectionBg","selectionFg","shadow","scrollbar","scrollbarTrack","progressFill","progressTrack","success","successMuted","danger","dangerMuted","warning","placeholder"],L6=["normal","focused","pressed","disabled"];function v0(x){if(!x.name||typeof x.name!=="string")throw TypeError("defineTheme: theme.name must be a non-empty string");if(!x.colors||typeof x.colors!=="object")throw TypeError("defineTheme: theme.colors must be an object");let F=P6.filter((B)=>!(B in x.colors));if(F.length>0)throw TypeError(`defineTheme: missing color keys: ${F.join(", ")}`);if(!x.borderStyle||typeof x.borderStyle!=="object")throw TypeError("defineTheme: theme.borderStyle must be an object");let h=L6.filter((B)=>!(B in x.borderStyle));if(h.length>0)throw TypeError(`defineTheme: missing borderStyle keys: ${h.join(", ")}`);return x}function U(x,F,h,B=255){return(x<<24|F<<16|h<<8|B)>>>0}var Cx={normal:"solid",focused:"solid",pressed:"bold",disabled:"dashed"},W6={background:U(30,32,48),surface:U(34,36,54),surfaceHover:U(47,51,77),surfaceFocused:U(47,51,77),surfacePressed:U(57,75,112),surfaceDisabled:U(25,27,41),text:U(200,211,245),textMuted:U(99,109,166),border:U(59,66,97),borderFocused:U(130,170,255),accent:U(130,170,255),accentHover:U(101,188,255),selectionBg:U(62,104,215,128),selectionFg:U(200,211,245),shadow:0,scrollbar:U(99,109,166),scrollbarTrack:U(47,51,77),progressFill:U(130,170,255),progressTrack:U(47,51,77),success:U(79,214,190),successMuted:U(43,74,78,128),danger:U(255,117,127),dangerMuted:U(74,43,48,128),warning:U(255,199,119),placeholder:U(99,109,166)},KF=v0({name:"tokyo-night-moon",colors:W6,borderStyle:Cx}),b6={background:U(31,35,53),surface:U(36,40,59),surfaceHover:U(41,46,66),surfaceFocused:U(41,46,66),surfacePressed:U(57,75,112),surfaceDisabled:U(27,30,45),text:U(192,202,245),textMuted:U(86,95,137),border:U(59,66,97),borderFocused:U(122,162,247),accent:U(122,162,247),accentHover:U(42,195,222),selectionBg:U(61,89,161,128),selectionFg:U(192,202,245),shadow:0,scrollbar:U(86,95,137),scrollbarTrack:U(41,46,66),progressFill:U(122,162,247),progressTrack:U(41,46,66),success:U(158,206,106),successMuted:U(43,74,46,128),danger:U(247,118,142),dangerMuted:U(74,43,48,128),warning:U(224,175,104),placeholder:U(86,95,137)},I9=v0({name:"tokyo-night-storm",colors:b6,borderStyle:Cx}),R6={background:U(35,33,54),surface:U(42,39,63),surfaceHover:U(57,53,82),surfaceFocused:U(57,53,82),surfacePressed:U(68,65,90),surfaceDisabled:U(31,29,48),text:U(224,222,244),textMuted:U(110,106,134),border:U(57,53,82),borderFocused:U(196,167,231),accent:U(196,167,231),accentHover:U(235,188,186),selectionBg:U(62,143,176,102),selectionFg:U(224,222,244),shadow:0,scrollbar:U(110,106,134),scrollbarTrack:U(57,53,82),progressFill:U(196,167,231),progressTrack:U(57,53,82),success:U(156,207,216),successMuted:U(43,74,78,128),danger:U(235,111,146),dangerMuted:U(74,43,56,128),warning:U(246,193,119),placeholder:U(110,106,134)},D9=v0({name:"rose-pine-moon",colors:R6,borderStyle:Cx}),V6={background:U(250,244,237),surface:U(255,250,243),surfaceHover:U(242,233,225),surfaceFocused:U(242,233,225),surfacePressed:U(223,218,217),surfaceDisabled:U(244,237,232),text:U(70,66,97),textMuted:U(152,147,165),border:U(206,202,205),borderFocused:U(144,122,169),accent:U(144,122,169),accentHover:U(196,167,231),selectionBg:U(40,105,131,68),selectionFg:U(70,66,97),shadow:0,scrollbar:U(121,117,147),scrollbarTrack:U(242,233,225),progressFill:U(144,122,169),progressTrack:U(242,233,225),success:U(86,148,159),successMuted:U(86,148,159,77),danger:U(180,99,122),dangerMuted:U(180,99,122,77),warning:U(234,157,52),placeholder:U(152,147,165)},A9=v0({name:"rose-pine-dawn",colors:V6,borderStyle:Cx}),O6={background:255,surface:U(26,26,26),surfaceHover:U(51,51,51),surfaceFocused:U(38,38,38),surfacePressed:U(64,64,64),surfaceDisabled:U(18,18,18),text:U(255,255,255),textMuted:U(170,170,170),border:U(128,128,128),borderFocused:U(255,255,0),accent:U(0,255,255),accentHover:U(128,255,255),selectionBg:U(0,85,170),selectionFg:U(255,255,255),shadow:0,scrollbar:U(204,204,204),scrollbarTrack:U(51,51,51),progressFill:U(0,255,0),progressTrack:U(51,51,51),success:U(0,255,0),successMuted:U(0,68,0),danger:U(255,0,0),dangerMuted:U(68,0,0),warning:U(255,255,0),placeholder:U(128,128,128)},m6={normal:"solid",focused:"bold",pressed:"bold",disabled:"none"},H9=v0({name:"high-contrast",colors:O6,borderStyle:m6});var CF=KF,tx=new Set;function F0(){return CF}function jF(x){CF=x;for(let F of tx)F(x)}function jx(x){return tx.add(x),()=>{tx.delete(x)}}function GF(x,F,h,B){switch(x.type){case"absolute":return f6(x,h,B);case"anchor":return S6(x,F,h,B);case"center":return T6(F,h,B);case"corner":return w6(x,F,h,B)}}function f6(x,F,h){return{x:Gx(x.x,0,F-1),y:Gx(x.y,0,h-1)}}function S6(x,F,h,B){let{anchor:$,placement:Z,offset:Q=0}=x,_=$.rect,J=F.width,N=F.height,K=Z,q=Q;if(x.edgeClamp)K=k6({placement:Z,anchorRect:_,widgetWidth:J,widgetHeight:N,offset:q,termCols:h,termRows:B});let G,Y;switch(K){case"bottom":{G=_.x,Y=_.y+_.height+Q;break}case"top":{G=_.x,Y=_.y-N-Q;break}case"right":{G=_.x+_.width+Q,Y=_.y;break}case"left":{G=_.x-J-Q,Y=_.y;break}}return{x:Gx(G,0,Math.max(0,h-J)),y:Gx(Y,0,Math.max(0,B-N))}}function T6(x,F,h){return{x:Math.max(0,Math.floor((F-x.width)/2)),y:Math.max(0,Math.floor((h-x.height)/2))}}function w6(x,F,h,B){let $=x.margin??0,{width:Z,height:Q}=F;switch(x.corner){case"top-left":return{x:$,y:$};case"top-right":return{x:Math.max(0,h-Z-$),y:$};case"bottom-left":return{x:$,y:Math.max(0,B-Q-$)};case"bottom-right":return{x:Math.max(0,h-Z-$),y:Math.max(0,B-Q-$)}}}function k6(x){let{placement:F,anchorRect:h,widgetWidth:B,widgetHeight:$,offset:Z,termCols:Q,termRows:_}=x;switch(F){case"bottom":{let J=_-h.y-h.height-Z,N=h.y-Z;if(J<$&&N>=$)return"top";break}case"top":{let J=h.y-Z,N=_-h.y-h.height-Z;if(J<$&&N>=$)return"bottom";break}case"right":{let J=Q-h.x-h.width-Z,N=h.x-Z;if(J<B&&N>=B)return"left";break}case"left":{let J=h.x-Z,N=Q-h.x-h.width-Z;if(J<B&&N>=B)return"right";break}}return F}function Gx(x,F,h){return Math.max(F,Math.min(h,x))}var c6=100,i6=170;class px{#F;#x;#h=[];#B;#$;constructor(x){this.#F=x?.baseZIndex??c6,this.#x=x?.backdropRgba??i6,this.#$=this.#F}setFocusManager(x){this.#B=x}open(x,F){let h={widget:x,handle:void 0,options:F??{},zIndex:this.#$++,previousZIndex:x.zIndex,previousPortal:x.portal,savedFocus:void 0},B=new YF(x,()=>{this.#Q(h)});if(h.handle=B,x.setPortal(!0),x.setZIndex(h.zIndex),h.options.positionStrategy)this.#J(x,h.options.positionStrategy);if(h.options.trapFocus&&this.#B)h.savedFocus=this.#B.focusedWidget,this.#B.pushFocusScope(x);return this.#h.push(h),B}close(x){let F=this.#h.findIndex((h)=>h.handle===x);if(F!==-1)this.#Q(this.#h[F])}closeAll(){while(this.#h.length>0)this.#Q(this.#h.at(-1))}getTopOverlay(){return this.#h.at(-1)?.widget}getBackdropEntries(){let x=[];for(let F of this.#h)if(F.options.backdrop&&F.widget.visible){let h=F.options.backdropRgba??this.#x;x.push({zIndex:F.zIndex,draw(B){let $=T.cols,Z=T.rows;B.drawRect({x:0,y:0,width:$,height:Z,bgRgba:h})}})}return x}#Q(x){let F=this.#h.indexOf(x);if(F===-1)return;if(this.#h.splice(F,1),x.widget.setPortal(x.previousPortal),x.widget.setZIndex(x.previousZIndex),x.options.trapFocus&&this.#B){if(this.#B.popFocusScope(),x.savedFocus?.acceptsFocus)this.#B.focusWidget(x.savedFocus)}g6(x.handle)}#J(x,F){let h=T.cols,B=T.rows,{width:$,height:Z}=x.rect,{x:Q,y:_}=GF(F,{width:$,height:Z},h,B);x.updateRect({x:Q,y:_})}}class YF{#F;#x;#h=[];#B=!1;constructor(x,F){this.#F=x,this.#x=F}get widget(){return this.#F}get closed(){return this.#B}close(){if(!this.#B)this.#x()}onClosed(x){if(this.#B){x();return}this.#h.push(x)}fireClosed(){this.#B=!0;for(let x of this.#h)x();this.#h.length=0}}function g6(x){x.fireClosed()}class XF{#F;#x;#h;#B;#$=new Set;#Q=new Map;#J=[];#U=void 0;#z=new px;constructor(x){if(this.#F=qF(),this.#x=x?.visible??!1,this.#h=this.#E(x?.bgHexRgb??F0().colors.background),x?.bgHexRgb===void 0)this.#B=jx((F)=>{this.#h=z(F.colors.background)})}get id(){return this.#F}get bgHexRgb(){return this.#h>>8}get visible(){return this.#x}getOverlayManager(){return this.#z}mount(x){return this.#$.add(x),this.#N(),x.mounted(),this}unmount(x){return this.#$.delete(x),this.#N(),x.unmounted(),this}setBgRgb(x,F,h){this.#h=typeof x==="number"&&F!==void 0&&h!==void 0?z(`rgb(${x},${F},${h})`):this.#E(x)}setVisible(x){this.#x=x}update(x){for(let F of this.#J)F(x);for(let F of this.#$)if(F.visible)F.update(x)}emitDrawCommands(x){let F=T.cols,h=T.rows;for(let Q of this.#$)if(Q.hasPercentLayout)Q.resolveLayout(F,h);x.setBackground(this.#h),x.setSynchronizedUpdate(!0),x.hideCursor();let B=this.#X(),$=this.#z.getBackdropEntries(),Z=[];for(let Q of this.#$)Z.push({kind:"widget",zIndex:Q.zIndex,widget:Q});for(let Q of B)Z.push({kind:"widget",zIndex:Q.zIndex,widget:Q});for(let Q of $)Z.push({kind:"backdrop",zIndex:Q.zIndex,draw:Q.draw});Z.sort((Q,_)=>Q.zIndex-_.zIndex);for(let Q of Z)if(Q.kind==="widget"){if(Q.widget.visible)Q.widget.emitDrawCommands(x)}else Q.draw(x)}hitTest(x){let{x:F,y:h}=x;for(let B of this.#K())if(B.visible&&B.containsPoint(F,h))return this.#Y(B,F,h);return}getFocusableWidgets(){return this.#G()}clearWidgets(){for(let x of this.#$)x.unmounted();this.#$.clear(),this.#J.length=0,this.#N()}destroy(){this.#B?.(),this.#B=void 0;for(let x of this.#$)this.unmount(x);this.#Q.clear(),this.#J.length=0}onTick(x){this.#J.push(x);let F=!1;return()=>{if(F)return;F=!0;let h=this.#J.indexOf(x);if(h!==-1)this.#J.splice(h,1)}}offTick(x){let F=this.#J.indexOf(x);if(F!==-1)this.#J.splice(F,1)}on(x,F){let h=this.#Q.get(x)??[];h.push(F),this.#Q.set(x,h)}off(x,F){let h=this.#Q.get(x);if(!h)return;let B=h.indexOf(F);if(B!==-1)h.splice(B,1)}emitLifecycle(x){let F=this.#Q.get(x);if(!F)return;for(let h of F)h()}#N(){this.#U=void 0}#K(){let x=[...this.#$,...this.#X()];return this.#U=x.toReversed().toSorted((F,h)=>h.zIndex-F.zIndex),this.#U}#Y(x,F,h){let{children:B}=x;if(B.length>0){let $=B.toSorted((Z,Q)=>Q.zIndex-Z.zIndex);for(let Z of $)if(Z.visible&&Z.containsPoint(F,h))return this.#Y(Z,F,h)}return x}#G(){let x=[];for(let F of this.#$)this.#Z(F,x);return x.toSorted((F,h)=>{let B=F.tabIndex,$=h.tabIndex;if(B!==void 0&&$!==void 0)return B-$;if(B!==void 0)return-1;if($!==void 0)return 1;return 0})}#Z(x,F){if(!x.visible)return;if(o0(x)&&x.acceptsFocus)F.push(x);for(let h of x.children)this.#Z(h,F)}#E(x){if(typeof x==="object")return z(`rgb(${x.r},${x.g},${x.b})`);return z(x)}#X(){let x=[];for(let F of this.#$){if(!F.visible)continue;this.#I(F,x)}return x}#I(x,F){for(let h of x.children){if(!h.visible)continue;if(h.portal)F.push(h);this.#I(h,F)}}}var IF=XF;var d6=/^\d+(\.\d+)?%$/v;function U0(x){return typeof x==="string"&&d6.test(x)}function DF(x,F,h,B){let $={};if(U0(x))$.x=x;if(U0(F))$.y=F;if(U0(h))$.width=h;if(U0(B))$.height=B;if($.x===void 0&&$.y===void 0&&$.width===void 0&&$.height===void 0)return;return $}class W0{#F=0;#x=!1;#h=!0;#B=!1;#$=void 0;#Q=null;#J=new Map;#U=[];#z=void 0;#N=!1;#K=[];get hasPercentLayout(){return this.#z!==void 0}setPercentSpec(x){this.#z=x}clearPositionPercentSpec(){if(!this.#z)return;if(delete this.#z.x,delete this.#z.y,this.#z.width===void 0&&this.#z.height===void 0)this.#z=void 0}resolveLayout(x,F){if(!this.#z)return;let h={},B=this.#z;if(B.x!==void 0)h.x=this.#Y(B.x,x);if(B.y!==void 0)h.y=this.#Y(B.y,F);if(B.width!==void 0)h.width=this.#Y(B.width,x);if(B.height!==void 0)h.height=this.#Y(B.height,F);if(Object.keys(h).length>0)this.updateRect(h)}get referenceCount(){return this.#F}get draggable(){return this.#x}get portal(){return this.#B}get visible(){return this.#h}get children(){return this.#U}get parent(){return this.#Q}closest(x){if(x(this))return this;return this.#Q?.closest(x)}get zIndex(){return this.#$??0}get rect(){return{x:0,y:0,width:0,height:0}}setDraggable(x){this.#x=x}setZIndex(x){this.#$=x}setPortal(x){this.#B=x}setVisible(x){this.#h=x}addChild(x){this.#U.push(x),x.#Q=this,x.mounted()}removeChild(x){let F=this.#U.indexOf(x);if(F!==-1)this.#U.splice(F,1),x.#Q=null,x.unmounted()}updateRect(x){}containsPoint(x,F){let{x:h,y:B,width:$,height:Z}=this.rect;return x>=h&&x<h+$&&F>=B&&F<B+Z}on(x,F){let h=this.#J.get(x);if(!h)h=new Set,this.#J.set(x,h);h.add(F)}off(x,F){this.#J.get(x)?.delete(F)}dispatch(x,F){this.#N=!1,this.#G(x,F,!1)}stopPropagation(){this.#N=!0}dispatchKeyEvent(x){this.dispatch("key",x)}mounted(){this.#F++}unmounted(){if(this.#F--,this.#F<=0){for(let x of this.#K)x();this.#K.length=0,this.#J.clear()}}addCleanup(x){this.#K.push(x)}intrinsicSize(){return}update(x){}getZIndexOverride(){return this.#$}initRect(x,F,h,B,$){let Z=DF(x,F,h,B);if(Z)this.setPercentSpec(Z);return{x:U0(x)?0:x??$?.x??0,y:U0(F)?0:F??$?.y??0,width:U0(h)?0:h??$?.width??0,height:U0(B)?0:B??$?.height??0}}propagatePositionDelta(x,F){if(x===0&&F===0)return;for(let h of this.#U)h.updateRect({x:h.rect.x+x,y:h.rect.y+F})}renderChildren(x){for(let F of this.#U)if(F.visible&&!F.portal)F.emitDrawCommands(x)}#Y(x,F){let h=Number.parseFloat(x);return Math.max(0,Math.floor(h/100*F))}#G(x,F,h){if(h)return;let B=this.#J.get(x);if(B)for(let $ of B)$(F);if(this.#Q)this.#Q.#G(x,F,this.#N)}}class O extends W0{static setFocusRequestCallback(x){O.#x=x}static#F=new Set(["click","mousedown","mouseup","mouseover","mousemove","contextmenu"]);static#x;#h=!1;#B=!1;#$=!1;#Q;constructor(){super();this.on("mouseover",()=>{this.#$=!0}),this.on("mouseout",()=>{this.#$=!1})}get acceptsFocus(){return!this.#B}get tabIndex(){return this.#Q}get focused(){return this.#h}get hovered(){return this.#$}get disabled(){return this.#B}focus(){if(this.#h)return;if(O.#x)O.#x(this);this.#h=!0,this.dispatch("focus",void 0)}blur(){this.#h=!1,this.#$=!1,this.dispatch("blur",void 0)}setDisabled(x){if(this.#B=x,this.#B&&this.#h)this.blur()}setTabIndex(x){this.#Q=x}dispatch(x,F){if(this.#B&&O.#F.has(x))return;super.dispatch(x,F)}unmounted(){if(this.#h)this.blur();super.unmounted()}handleKey(x){if(!this.acceptsFocus||x.key===void 0)return;this.dispatchKeyEvent(x),this.handleActiveKey(x)}}var u6={normal:"normal",focused:"focused",pressed:"pressed",disabled:"disabled"};function a(x){let F=F0(),h={};for(let[B,$]of Object.entries(x))h[B]=AF(F,String($));return h}function AF(x,F){if(F.startsWith("border.")){let h=u6[F.slice(7)];if(h!==void 0)return x.borderStyle[h];return}return x.colors[F]}function u(x,F,h,B){let $=Object.fromEntries(Object.entries(F).filter(([Q])=>h[Q]===void 0));if(Object.keys($).length===0)return;let Z=jx((Q)=>{let _={};for(let[J,N]of Object.entries($))_[J]=AF(Q,String(N));B(_)});x.addCleanup(Z)}var k={SetBackground:1,SetCursor:2,PushClip:3,PopClip:4,SetEntityId:5,DrawRect:16,DrawText:17,DrawBorder:18,DrawShadow:19,DrawFill:20,DrawChar:21,DrawLine:22,SetTitle:32,ShowCursor:33,HideCursor:34,SetCursorMode:35,BeginSync:48,EndSync:49},z0={Top:1,Right:2,Bottom:4,Left:8,All:15};var n6={"blinking-block":1,block:2,"blinking-underscore":3,underscore:4,"blinking-ibeam":5,ibeam:6};function HF(x){if(typeof x==="string")return n6[x]??1;return x}var EF=8,ox=8,MF=21570,PF=1;var LF={bold:1,dim:2,italic:4,underline:8,slowblink:16,rapidblink:32,reverse:64,hidden:128,crossedout:256,fraktur:512,overline:1024};function k0(x){if(x===void 0)return 0;if(typeof x==="number")return x;if(Array.isArray(x)){let F=0;for(let h of x)F|=LF[h]??0;return F}return LF[x]??0}var y6={none:0,solid:1,double:2,rounded:3,bold:4,dashed:5,dotted:6,outsetbold:7,outsetdouble:8};function S(x){if(typeof x==="string")return y6[x]??0;return x}var s6={horizontal:0,vertical:1};function vx(x){if(typeof x==="string")return s6[x]??1;return x}var c0={Start:0,Center:1,End:2,Stretch:3},t6={start:0,center:1,end:2,stretch:3};function rx(x){if(typeof x==="string")return t6[x]??3;return x}function WF(x){if(typeof x==="boolean")return{borderTop:x,borderRight:x,borderBottom:x,borderLeft:x};if(typeof x==="number"){let Q=x!==0;return{borderTop:Q,borderRight:Q,borderBottom:Q,borderLeft:Q}}if(x==="true"||x==="1")return{borderTop:!0,borderRight:!0,borderBottom:!0,borderLeft:!0};if(x==="false"||x==="0"||x==="")return{borderTop:!1,borderRight:!1,borderBottom:!1,borderLeft:!1};let F=x.split(/\s+/v),h,B,$,Z;switch(F.length){case 1:{let Q=F[0]!=="0";h=Q,B=Q,$=Q,Z=Q;break}case 2:{let Q=F[0]!=="0",_=F[1]!=="0";h=Q,$=Q,B=_,Z=_;break}case 3:{h=F[0]!=="0",B=F[1]!=="0",$=F[2]!=="0",Z=B;break}default:{h=F[0]!=="0",B=F[1]!=="0",$=F[2]!=="0",Z=F[3]!=="0";break}}return{borderTop:h,borderRight:B,borderBottom:$,borderLeft:Z}}function p6(x){let F=F0(),h=x.border===void 0?void 0:WF(x.border);return{borderColor:z(x.borderColor??F.colors.border),borderStyle:S(x.borderStyle??"none"),borderTop:x.borderTop??h?.borderTop??!1,borderRight:x.borderRight??h?.borderRight??!1,borderBottom:x.borderBottom??h?.borderBottom??!1,borderLeft:x.borderLeft??h?.borderLeft??!1}}class lx extends W0{#F;#x;#h;#B;#$;#Q;#J;#U;#z;#N=!1;#K=[];constructor(x){super();this.#F=this.initRect(x.x,x.y,x.width,x.height,{width:32,height:3});let F=F0();if(this.#x={colorFg:z(x.colorFg??F.colors.text),colorBg:z(x.colorBg??F.colors.background)},this.#h={styleZIndex:x.styleZIndex??0,styleModifier:k0(x.styleModifier)},this.#B=p6(x),this.#$={shadowOffsetX:x.shadowOffsetX??0,shadowOffsetY:x.shadowOffsetY??0,shadowColor:z(x.shadowColor??0),shadowCovered:x.shadowCovered??!1},this.#Q={paddingTop:x.paddingTop??0,paddingRight:x.paddingRight??0,paddingBottom:x.paddingBottom??0,paddingLeft:x.paddingLeft??0},this.#J=vx(x.direction??"vertical"),this.#U=x.gap??0,this.#z=rx(x.align??"stretch"),this.#N=!0,x.draggable)this.setDraggable(!0)}get rect(){return this.#F}get color(){return this.#x}get style(){return this.#h}get border(){return this.#B}get shadow(){return this.#$}get padding(){return this.#Q}get zIndex(){return this.getZIndexOverride()??this.#h.styleZIndex}updateRect(x){let F=this.#F.x,h=this.#F.y;Object.assign(this.#F,x),this.#N=!0,this.propagatePositionDelta(this.#F.x-F,this.#F.y-h)}updateColor(x){if(x.colorFg!==void 0)this.#x.colorFg=z(x.colorFg);if(x.colorBg!==void 0)this.#x.colorBg=z(x.colorBg)}updateThemeColors(x){if(this.updateColor({colorFg:x.colorFg===void 0?void 0:z(x.colorFg),colorBg:x.colorBg===void 0?void 0:z(x.colorBg)}),x.borderColor!==void 0)this.updateBorder({borderColor:z(x.borderColor)})}updateStyle(x){if(x.styleModifier!==void 0)this.#h.styleModifier=k0(x.styleModifier);if(x.styleZIndex!==void 0)this.#h.styleZIndex=x.styleZIndex}updateBorder(x){if(x.borderColor!==void 0)this.#B.borderColor=z(x.borderColor);if(x.borderStyle!==void 0)this.#B.borderStyle=S(x.borderStyle);if(x.border!==void 0){let{borderTop:F,borderRight:h,borderBottom:B,borderLeft:$}=WF(x.border);this.#B.borderTop=F,this.#B.borderRight=h,this.#B.borderBottom=B,this.#B.borderLeft=$}if(x.borderTop!==void 0)this.#B.borderTop=x.borderTop;if(x.borderRight!==void 0)this.#B.borderRight=x.borderRight;if(x.borderBottom!==void 0)this.#B.borderBottom=x.borderBottom;if(x.borderLeft!==void 0)this.#B.borderLeft=x.borderLeft}updateShadow(x){if(x.shadowColor!==void 0)this.#$.shadowColor=z(x.shadowColor);if(x.shadowOffsetX!==void 0)this.#$.shadowOffsetX=x.shadowOffsetX;if(x.shadowOffsetY!==void 0)this.#$.shadowOffsetY=x.shadowOffsetY;if(x.shadowCovered!==void 0)this.#$.shadowCovered=x.shadowCovered}updatePadding(x){Object.assign(this.#Q,x),this.#N=!0}setDirection(x){this.#J=vx(x),this.#N=!0}setGap(x){this.#U=x,this.#N=!0}setAlign(x){this.#z=rx(x),this.#N=!0}addChild(x){super.addChild(x),this.#K.push(x),this.#N=!0}removeChild(x){super.removeChild(x);let F=this.#K.indexOf(x);if(F!==-1)this.#K.splice(F,1);this.#N=!0}intrinsicSize(){if(this.#K.length===0)return;let x=0,F=0;for(let Z of this.#K){let Q=Z.intrinsicSize();if(!Q)return;let _=this.#J===1?Q.height:Q.width,J=this.#J===1?Q.width:Q.height;if(x+=_,J>F)F=J}let h=Math.max(0,this.#K.length-1)*this.#U;x+=h;let B=(this.#B.borderLeft?1:0)+(this.#B.borderRight?1:0),$=(this.#B.borderTop?1:0)+(this.#B.borderBottom?1:0);if(this.#J===1)return{width:F+this.#Q.paddingLeft+this.#Q.paddingRight+B,height:x+this.#Q.paddingTop+this.#Q.paddingBottom+$};return{width:x+this.#Q.paddingLeft+this.#Q.paddingRight+B,height:F+this.#Q.paddingTop+this.#Q.paddingBottom+$}}emitDrawCommands(x){if(this.#N)this.#Z();let{x:F,y:h,width:B,height:$}=this.#F,{colorBg:Z}=this.#x,{borderColor:Q,borderStyle:_,borderTop:J,borderRight:N,borderBottom:K,borderLeft:q}=this.#B;if(x.pushClip(F,h,B,$),x.drawRect({x:F,y:h,width:B,height:$,bgRgba:Z}),_!==0){let L=(J?z0.Top:0)|(N?z0.Right:0)|(K?z0.Bottom:0)|(q?z0.Left:0);x.drawBorder({x:F,y:h,width:B,height:$,colorRgba:Q,style:_,sides:L})}let G=(q?1:0)+(N?1:0),Y=(J?1:0)+(K?1:0),{paddingTop:E,paddingLeft:H}=this.#Q,W=F+H+(q?1:0),I=h+E+(J?1:0),P=B-H-this.#Q.paddingRight-G,R=$-E-this.#Q.paddingBottom-Y;x.pushClip(W,I,P,R),this.renderChildren(x),x.popClip(),x.popClip()}#Y(x,F){let h=x.intrinsicSize();if(F)return h?.height??x.rect.height;return h?.width??x.rect.width}#G(x,F,h){let B=x.intrinsicSize(),$;$=h?B?.width??x.rect.width:B?.height??x.rect.height;let Z;switch(this.#z){case c0.Start:{Z=0;break}case c0.Center:{Z=Math.floor((F-$)/2);break}case c0.End:{Z=F-$;break}case c0.Stretch:{Z=0,$=F;break}}return{crossPos:Z,crossExtent:$}}#Z(){let x=this.#J,F=this.#K;if(F.length===0){this.#N=!1;return}let{x:h,y:B,width:$,height:Z}=this.#F,{paddingTop:Q,paddingLeft:_}=this.#Q,J=(this.#B.borderLeft?1:0)+(this.#B.borderRight?1:0),N=(this.#B.borderTop?1:0)+(this.#B.borderBottom?1:0),K=_+this.#Q.paddingRight+J,q=Q+this.#Q.paddingBottom+N,G=h+_+(this.#B.borderLeft?1:0),Y=B+Q+(this.#B.borderTop?1:0),E=$-K,H=Z-q,W=x===1,I=W?E:H,P=this.#z===c0.Stretch,R=0;for(let L of F){if(L.hasPercentLayout)L.resolveLayout(E,H);let X=this.#Y(L,W),{crossPos:M,crossExtent:i}=this.#G(L,I,W),g=W?{x:G+M,y:Y+R,width:P?I:i,height:X}:{x:G+R,y:Y+M,width:X,height:P?I:i};L.updateRect(g),R+=X+this.#U}this.#N=!1}}var bF={colorFg:"text",colorBg:"background",borderColor:"border"};function o6(){return{x:0,y:0,width:32,height:3,border:!0,borderStyle:"solid",...a(bF)}}function N0(x={}){let F=new lx({...o6(),...x});return u(F,bF,x??{},(h)=>{F.updateThemeColors(h)}),F}function Yx(x,F,h){let B=Math.max(0,F-x),$=x/F,Z=Math.max(1,Math.round($*x)),Q=x-Z,_=B>0?Math.round(h/B*Q):0;return{thumbSize:Z,thumbOffset:_,scrollableRange:Q,maxScroll:B}}function RF(x){let{buffer:F,x:h,trackY:B,trackHeight:$,geometry:Z,thumbColor:Q,trackColor:_}=x,{thumbSize:J,thumbOffset:N}=Z;for(let K=0;K<$;K++){let q=K>=N&&K<N+J;F.drawChar({x:h,y:B+K,char:q?9608:9474,fgRgba:q?Q:_,bgRgba:0})}}function VF(x,F,h){if(x!==h.x)return{type:"none"};if(F<h.trackY||F>=h.trackY+h.trackHeight)return{type:"none"};if(F>=h.thumbY&&F<h.thumbY+h.thumbSize)return{type:"thumb"};if(F<h.thumbY)return{type:"track-above"};return{type:"track-below"}}function OF(x,F,h){if(h.scrollableRange<=0)return F;return F+Math.round(x/h.scrollableRange*h.maxScroll)}class ax extends O{#F;#x=0;#h=!0;#B=[];#$;#Q;#J;#U;#z;#N;#K=!1;#Y=0;#G=0;#Z=!1;#E=0;#X=0;constructor(x){super();this.#F=this.initRect(x.x,x.y,x.width,x.height,{width:20,height:10}),this.#$=N0({x:this.#F.x,y:this.#F.y,width:this.#F.width,height:this.#F.height,colorBg:x.colorBg,borderColor:x.borderColor,borderStyle:x.borderStyle,borderTop:x.borderTop,borderRight:x.borderRight,borderBottom:x.borderBottom,borderLeft:x.borderLeft,shadowColor:x.shadowColor,shadowOffsetX:x.shadowOffsetX,shadowOffsetY:x.shadowOffsetY,shadowCovered:x.shadowCovered,paddingTop:x.paddingTop,paddingRight:x.paddingRight,paddingBottom:x.paddingBottom,paddingLeft:x.paddingLeft}),this.#Q=x.gap??0,this.#J=x.scrollSpeed??3,this.#U=x.alwaysShowScrollbar??!1;let F=F0();this.#z=z(x.scrollbarColor??F.colors.scrollbar),this.#N=z(x.scrollbarTrackColor??F.colors.scrollbarTrack),this.on("wheel",(h)=>{this.scrollBy(h.wheelDeltaY*this.#J)}),this.on("mousedown",(h)=>{let B=this.#q();switch((B?VF(h.x,h.y,B):{type:"none"}).type){case"thumb":{this.#Z=!0,this.#E=h.y,this.#X=this.#x;break}case"track-above":{this.scrollBy(-this.#I().height);break}case"track-below":{this.scrollBy(this.#I().height);break}case"none":{this.#K=!0,this.#Y=h.y,this.#G=this.#x;break}}}),this.on("mousemove",(h)=>{if(this.#Z){if((h.buttons??0)===0){this.#Z=!1;return}let $=h.y-this.#E,Z=this.#I(),Q=Yx(Z.height,this.#H(),this.#X);this.scrollTo(OF($,this.#X,Q));return}if(!this.#K)return;if((h.buttons??0)===0){this.#K=!1;return}let B=h.y-this.#Y;this.scrollTo(this.#G+B)}),this.on("mouseup",()=>{this.#K=!1,this.#Z=!1})}get rect(){return this.#F}get scrollOffsetY(){return this.#x}get maxScrollY(){return this.#A()}handleActiveKey(x){let F=x.key,h=this.#I();switch(F){case"ArrowUp":{this.scrollBy(-1);break}case"ArrowDown":{this.scrollBy(1);break}case"PageUp":{this.scrollBy(-h.height);break}case"PageDown":{this.scrollBy(h.height);break}case"Home":{this.scrollTo(0);break}case"End":{this.scrollTo(this.#A());break}default:break}}scrollTo(x){let F=Math.max(0,Math.min(x,this.#A()));if(F!==this.#x)this.#x=F,this.#h=!0,this.dispatch("scroll",{scrollOffsetY:F,maxScrollY:this.#A()})}scrollToTop(){this.scrollTo(0)}scrollToBottom(){this.scrollTo(this.#A())}scrollBy(x){this.scrollTo(this.#x+x)}scrollIntoView(x){let F=this.#B.indexOf(x);if(F===-1)return;let h=this.#I(),B=0;for(let J=0;J<F;J++){let N=this.#B[J],K=N.intrinsicSize();B+=(K?.height??N.rect.height)+this.#Q}let $=this.#B[F],Q=$.intrinsicSize()?.height??$.rect.height,_=B+Q;if(B<this.#x)this.scrollTo(B);else if(_>this.#x+h.height)this.scrollTo(_-h.height)}updateRect(x){let F=this.#F.x,h=this.#F.y;Object.assign(this.#F,x),this.#h=!0,this.#$.updateRect({x:this.#F.x,y:this.#F.y,width:this.#F.width,height:this.#F.height}),this.propagatePositionDelta(this.#F.x-F,this.#F.y-h)}updateThemeColors(x){if(x.colorBg!==void 0)this.updateColor({colorBg:z(x.colorBg)});if(x.borderColor!==void 0)this.updateBorder({borderColor:z(x.borderColor)});if(x.scrollbarColor!==void 0)this.setScrollbarColor(z(x.scrollbarColor));if(x.scrollbarTrackColor!==void 0)this.setScrollbarTrackColor(z(x.scrollbarTrackColor))}updateColor(x){this.#$.updateColor(x)}updateBorder(x){this.#$.updateBorder(x),this.#h=!0}updateShadow(x){this.#$.updateShadow(x)}updatePadding(x){this.#$.updatePadding(x),this.#h=!0}setGap(x){this.#Q=x,this.#h=!0}setAlwaysShowScrollbar(x){this.#U=x}setScrollbarColor(x){this.#z=z(x)}setScrollbarTrackColor(x){this.#N=z(x)}addChild(x){super.addChild(x),this.#B.push(x),this.#h=!0}removeChild(x){super.removeChild(x);let F=this.#B.indexOf(x);if(F!==-1)this.#B.splice(F,1);this.#h=!0}intrinsicSize(){return}emitDrawCommands(x){if(this.#h)this.#_();let{x:F,y:h,width:B,height:$}=this.#F;x.pushClip(F,h,B,$),this.#$.emitDrawCommands(x);let Z=this.#I();x.pushClip(Z.x,Z.y,Z.width,Z.height);for(let Q of this.#B){if(!Q.visible)continue;let{x:_,y:J,width:N,height:K}=Q.rect;if(J+K<=Z.y||J>=Z.y+Z.height)continue;if(_>=Z.x+Z.width||_+N<=Z.x)continue;Q.emitDrawCommands(x)}x.popClip(),this.#j(x),x.popClip()}#I(){let{x,y:F,width:h,height:B}=this.#F,{paddingTop:$,paddingLeft:Z,paddingRight:Q,paddingBottom:_}=this.#$.padding,{borderTop:J,borderRight:N,borderBottom:K,borderLeft:q}=this.#$.border,G=(q?1:0)+(N?1:0),Y=(J?1:0)+(K?1:0),E=x+Z+(q?1:0),H=F+$+(J?1:0),W=h-Z-Q-G-1,I=B-$-_-Y;return{x:E,y:H,width:W,height:I}}#H(){let x=0;for(let F of this.#B){let h=F.intrinsicSize();x+=h?.height??F.rect.height}return x+=Math.max(0,this.#B.length-1)*this.#Q,x}#A(){let x=this.#I();return Math.max(0,this.#H()-x.height)}#_(){let x=this.#B;if(x.length===0){this.#h=!1;return}let F=this.#I(),h=0;for(let B of x){let Z=B.intrinsicSize()?.height??B.rect.height,Q=F.y+h-this.#x;B.updateRect({x:F.x,y:Q,width:F.width,height:Z}),h+=Z+this.#Q}this.#h=!1}#j(x){if(this.#A()===0&&!this.#U)return;let h=this.#I(),B=this.#H();if(B<=0)return;let $=Yx(h.height,B,this.#x);RF({buffer:x,x:h.x+h.width,trackY:h.y,trackHeight:h.height,geometry:$,thumbColor:this.#z,trackColor:this.#N})}#q(){if(this.#A()===0&&!this.#U)return;let F=this.#I(),h=this.#H();if(h<=0)return;let B=Yx(F.height,h,this.#x);return{x:F.x+F.width,trackY:F.y,trackHeight:F.height,thumbY:F.y+B.thumbOffset,thumbSize:B.thumbSize}}}class ex{#F;#x;#h;#B=[];constructor(x){this.#h=x}start(x){O.setFocusRequestCallback((F)=>{this.focusWidget(F)}),this.#x=(F)=>{if(this.#F&&!this.#F.acceptsFocus)this.#F=void 0;if(F.key==="Tab"&&!F.ctrlKey&&!F.altKey&&!F.metaKey){this.#J(F.shiftKey?-1:1);return}if(this.#F){this.#F.handleKey(F);return}x?.(F)},w.on(m.KeyboardEvent,this.#x)}stop(){if(O.setFocusRequestCallback(void 0),this.#x)w.off(m.KeyboardEvent,this.#x),this.#x=void 0;this.blurWidget()}focusWidget(x){if(x===this.#F)return;if(!x.acceptsFocus)return;if(this.#F)this.#F.blur();this.#F=x,x.focus(),this.#Q(x)}blurWidget(){if(this.#F)this.#F.blur(),this.#F=void 0}get focusedWidget(){return this.#F}getFocusableWidgets(){let x=this.#h()?.getFocusableWidgets()??[];if(this.#B.length===0)return x;let F=this.#B.at(-1);return x.filter((h)=>this.#$(h,F))}pushFocusScope(x){this.#B.push(x)}popFocusScope(){this.#B.pop()}#$(x,F){let h=x;while(h){if(h===F)return!0;h=h.parent}return!1}#Q(x){let F=x.parent;while(F){if(F instanceof ax)F.scrollIntoView(x);F=F.parent}}#J(x){let F=this.getFocusableWidgets();if(F.length===0)return;let h;if(this.#F){let B=F.indexOf(this.#F);if(B===-1)h=x===1?0:F.length-1;else h=(B+x+F.length)%F.length}else h=x===1?0:F.length-1;for(let B=0;B<F.length;B++){let $=(h+x*B+F.length)%F.length;if(F[$].acceptsFocus){this.focusWidget(F[$]);return}}}}class x1{#F;#x;#h;#B=!1;#$=0;#Q=0;#J;#U;#z;#N;constructor(x,F){this.#z=x,this.#N=F}start(){this.#J=(x)=>{let F=this.#z();if(!F)return;if(x.button===void 0){let h=F.hitTest(x);if(h!==this.#h){if(this.#h)this.#h.dispatch("mouseout",x);if(this.#h=h,this.#h)this.#h.dispatch("mouseover",x)}else if(this.#h)this.#h.dispatch("mousemove",x);if(this.#F&&x.buttons&&x.buttons>0){let B=this.#x;if(B){if(!this.#B)this.#B=!0,B.clearPositionPercentSpec(),B.dispatch("dragstart",x);let{x:$,y:Z}=x,Q=$-this.#$,_=Z-this.#Q,J=B.rect.x,N=B.rect.y;if(B.updateRect({x:Q,y:_}),Q!==J)B.dispatch("update:x",{x:Q});if(_!==N)B.dispatch("update:y",{y:_});B.dispatch("drag",x)}else this.#F.dispatch("mousemove",x)}return}if(x.button===w0.RIGHT_MOUSE_BUTTON){if(!x.isRelease)this.#F=F.hitTest(x);else if(this.#F){if(F.hitTest(x)===this.#F)this.#F.dispatch("contextmenu",x);this.#F=void 0}return}if(!x.isRelease){let h=F.hitTest(x);if(this.#F=h,h){if(h.dispatch("mousedown",x),this.#x=h.closest(($)=>$.draggable),this.#x)this.#$=x.x-this.#x.rect.x,this.#Q=x.y-this.#x.rect.y;let B=h.closest(($)=>o0($));if(B&&o0(B))this.#N.focusWidget(B);else this.#N.blurWidget()}else this.#x=void 0,this.#N.blurWidget();return}if(this.#B){this.#x?.dispatch("dragend",x),this.#B=!1,this.#x=void 0,this.#F=void 0;return}if(this.#F){if(this.#F.dispatch("mouseup",x),F.hitTest(x)===this.#F)this.#F.dispatch("click",x);this.#F=void 0,this.#x=void 0}},w.on(m.MouseEvent,this.#J),this.#U=(x)=>{let F=this.#z();if(!F)return;let h=F.hitTest(x);if(h)h.dispatch("wheel",x)},w.on(m.WheelEvent,this.#U)}stop(){if(this.#J)w.off(m.MouseEvent,this.#J),this.#J=void 0;if(this.#U)w.off(m.WheelEvent,this.#U),this.#U=void 0;this.resetState()}resetState(){if(this.#h)this.#h.dispatch("mouseout",{button:void 0,buttons:void 0,x:0,y:0,isRelease:!1,shiftKey:!1,ctrlKey:!1,altKey:!1,metaKey:!1});this.#F=void 0,this.#x=void 0,this.#h=void 0,this.#B=!1}}import{ptr as v6}from"bun:ffi";var mF=new TextEncoder;class F1{#F;#x;#h=0;#B=!1;constructor(x=65536){this.#F=new ArrayBuffer(x),this.#x=new x0(this.#F)}get ptr(){return v6(this.#F)}get byteLength(){return this.#h}get buffer(){return this.#F}reset(){this.#h=0,this.#B=!1,this.#x.setUint16(0,MF,!0),this.#x.setUint8(2,PF),this.#x.setUint8(3,0),this.#x.setUint32(4,0,!0),this.#h=EF}finish(){let x=this.#B?1:0;this.#x.setUint8(3,x)}setSynchronizedUpdate(x){this.#B=x}setBackground(x){this.#$(k.SetBackground,0,4),this.#x.setUint32(this.#h,x,!0),this.#h+=4}setCursor(x,F){this.#$(k.SetCursor,0,4),this.#x.setInt16(this.#h,x,!0),this.#x.setInt16(this.#h+2,F,!0),this.#h+=4}pushClip(x,F,h,B){this.#$(k.PushClip,0,8),this.#x.setInt16(this.#h,x,!0),this.#x.setInt16(this.#h+2,F,!0),this.#x.setInt16(this.#h+4,h,!0),this.#x.setInt16(this.#h+6,B,!0),this.#h+=8}popClip(){this.#$(k.PopClip,0,0)}setEntityId(x){this.#$(k.SetEntityId,0,8),this.#x.setBigUint64(this.#h,x,!0),this.#h+=8}drawRect({x,y:F,width:h,height:B,bgRgba:$,fillChar:Z=32,fontStyle:Q=0}){this.#$(k.DrawRect,0,16);let _=this.#h;this.#x.setInt16(_,x,!0),this.#x.setInt16(_+2,F,!0),this.#x.setInt16(_+4,h,!0),this.#x.setInt16(_+6,B,!0),this.#x.setUint32(_+8,$,!0),this.#x.setUint16(_+12,Z,!0),this.#x.setUint16(_+14,Q,!0),this.#h=_+16}drawText({x,y:F,text:h,fgRgba:B,bgRgba:$,fontStyle:Z=0}){let Q=mF.encode(h),_=Q.length;this.#$(k.DrawText,0,16+_);let J=this.#h;this.#x.setInt16(J,x,!0),this.#x.setInt16(J+2,F,!0),this.#x.setUint32(J+4,B,!0),this.#x.setUint32(J+8,$,!0),this.#x.setUint16(J+12,Z,!0),this.#x.setUint16(J+14,_,!0),new Uint8Array(this.#F).set(Q,J+16),this.#h=J+16+_}drawBorder({x,y:F,width:h,height:B,colorRgba:$,style:Z,sides:Q}){this.#$(k.DrawBorder,0,16);let _=this.#h;this.#x.setInt16(_,x,!0),this.#x.setInt16(_+2,F,!0),this.#x.setInt16(_+4,h,!0),this.#x.setInt16(_+6,B,!0),this.#x.setUint32(_+8,$,!0),this.#x.setUint8(_+12,Z),this.#x.setUint8(_+13,Q),this.#x.setUint16(_+14,0,!0),this.#h=_+16}drawShadow({x,y:F,width:h,height:B,offsetX:$,offsetY:Z,colorRgba:Q}){this.#$(k.DrawShadow,0,16);let _=this.#h;this.#x.setInt16(_,x,!0),this.#x.setInt16(_+2,F,!0),this.#x.setInt16(_+4,h,!0),this.#x.setInt16(_+6,B,!0),this.#x.setInt16(_+8,$,!0),this.#x.setInt16(_+10,Z,!0),this.#x.setUint32(_+12,Q,!0),this.#h=_+16}drawFill({x,y:F,width:h,height:B,rgba:$}){this.#$(k.DrawFill,0,12);let Z=this.#h;this.#x.setInt16(Z,x,!0),this.#x.setInt16(Z+2,F,!0),this.#x.setInt16(Z+4,h,!0),this.#x.setInt16(Z+6,B,!0),this.#x.setUint32(Z+8,$,!0),this.#h=Z+12}drawChar({x,y:F,char:h,fgRgba:B,bgRgba:$,fontStyle:Z=0,wide:Q=!1}){let _=Q?1:0;this.#$(k.DrawChar,_,16);let J=this.#h;this.#x.setInt16(J,x,!0),this.#x.setInt16(J+2,F,!0),this.#x.setUint32(J+4,B,!0),this.#x.setUint32(J+8,$,!0),this.#x.setUint16(J+12,h,!0),this.#x.setUint16(J+14,Z,!0),this.#h=J+16}drawLine({x,y:F,length:h,direction:B,colorRgba:$,lineStyle:Z}){this.#$(k.DrawLine,0,16);let Q=this.#h;this.#x.setInt16(Q,x,!0),this.#x.setInt16(Q+2,F,!0),this.#x.setUint16(Q+4,h,!0),this.#x.setUint16(Q+6,B,!0),this.#x.setUint32(Q+8,$,!0),this.#x.setUint8(Q+12,Z),this.#h=Q+16}setTitle(x){let F=mF.encode(x);this.#$(k.SetTitle,0,2+F.length),this.#x.setUint16(this.#h,F.length,!0),new Uint8Array(this.#F).set(F,this.#h+2),this.#h+=2+F.length}showCursor(){this.#$(k.ShowCursor,0,0)}hideCursor(){this.#$(k.HideCursor,0,0)}setCursorMode(x){this.#$(k.SetCursorMode,0,1),this.#x.setUint8(this.#h,x),this.#h+=1}#$(x,F,h){let B=ox+h;if(this.#h+B>this.#F.byteLength)throw Error(`DrawListBuffer overflow: need ${B} bytes at cursor ${this.#h}, buffer size ${this.#F.byteLength}`);let $=this.#h;this.#x.setUint16($,x,!0),this.#x.setUint16($+2,F,!0),this.#x.setUint32($+4,h,!0),this.#h=$+ox}}var r6=60,l6=30;class h1{#F=new F1;#x;#h;#B;#$;#Q=!1;#J;#U=0;#z=0;#N=0;constructor(x,F,h){this.#x=x,this.#h=F,this.#B=1000/(h?.tickRate??r6),this.#$=1000/(h?.renderRate??l6)}start(){this.#Q=!0,this.#U=performance.now(),this.#N=this.#U,this.#z=0;let x=()=>{if(!this.#Q)return;try{let F=this.#x();if(F?.visible){let h=performance.now(),B=h-this.#U;this.#U=h,this.#z+=B;while(this.#z>=this.#B)F.update(this.#B),this.#z-=this.#B;if(h-this.#N>=this.#$)this.#F.reset(),F.emitDrawCommands(this.#F),this.#F.finish(),this.#h.renderDrawList(T,this.#F),this.#N=h}}catch(F){b.logError(`Render loop error: ${a6(F)}`)}this.#J=setImmediate(x)};this.#J=setImmediate(x)}stop(){if(this.#Q=!1,this.#J!==void 0)clearImmediate(this.#J),this.#J=void 0}}function a6(x){if(x instanceof Error)return x.stack??x.message;return String(x)}import{dlopen as e6,FFIType as n,toArrayBuffer as fF}from"bun:ffi";var x4=new Map([[m.KeyboardEvent,ix],[m.MouseEvent,w0],[m.WheelEvent,gx],[m.TermResizeEvent,dx]]);function F4(){return e6(l1(),{setupLogger:{returns:n.void,args:[n.cstring,n.cstring,n.u8,n.u8]},startApp:{returns:n.void,args:[]},stopApp:{returns:n.void,args:[]},detectTermSize:{returns:n.void,args:[n.pointer]},renderDrawList:{returns:n.void,args:[n.pointer,n.pointer,n.uint64_t]},event_bus_poll:{args:[],returns:n.ptr},event_bus_commit:{args:[],returns:n.void}}).symbols}var SF;function i0(){return SF??=F4(),SF}class B1{#F=!1;setupLogger(x,F,h,B){let $=sx(h);i0().setupLogger(kx(x),kx(F),$,B?1:0)}startApp(){i0().startApp()}stopApp(){i0().stopApp()}detectTermSize(x){i0().detectTermSize(x.ptr)}renderDrawList(x,F){i0().renderDrawList(x.ptr,F.ptr,F.byteLength)}startEvents(x){this.#F=!0;let F=i0(),h=()=>{if(!this.#F)return;let B=F.event_bus_poll();if(B!==null)try{let $=fF(B,0,16),Z=new x0($),Q=Z.getUint32(0,!0),_=Z.getUint32(4,!0),J=fF(B,16,_),N=x4.get(Q);if(!N)throw b.logWarning(`Unknown event type: ${Q}`),Error(`Unknown event type: ${Q}`);let K=new N(J);x(Q,K)}catch($){b.logError(`Event parse error: ${h4($)}`)}finally{F.event_bus_commit()}setImmediate(h)};h()}stopEvents(){this.#F=!1}}function h4(x){if(x instanceof Error)return x.stack??x.message;return String(x)}var TF,wF,kF;function cF(x,F){let h=[],B=[];TF=x,wF=h,kF=B;let $=F();wF=void 0,TF=void 0,kF=void 0;for(let Q of B)Q();let Z=h;return()=>{for(let Q of Z)Q();$?.()}}class gF{#F;#x;#h=[];#B=void 0;#$;#Q;#J;#U=new Map;constructor(x){this.#x=x?.backend??new B1;let F=x?.logLevel??"info",h=x?.logFilePath??B4.dirname(Bun.main),B=x?.backendLogName??"buntui-backend.log",$=x?.frontendLogName??"buntui-frontend.log",Z=x?.clearLog??!1;this.#x.setupLogger(h,B,F,Z),this.#F=x?.debugMode??!1,b.init({logFileDir:h,logLevel:F,clearLog:Z,frontendLogName:$,backendLogName:B});let Q=()=>this.#B;this.#$=new ex(Q),this.#Q=new x1(Q,this.#$),this.#J=new h1(Q,this.#x,{tickRate:x?.tickRate,renderRate:x?.renderRate}),iF(this)}start(){if($4(),this.#F)w.on(m.KeyboardEvent,(x)=>{b.logDebug(`keyboard event: ${JSON.stringify(x)}`)}),w.on(m.WheelEvent,(x)=>{b.logDebug(`wheel event: ${JSON.stringify(x)}`)}),w.on(m.MouseEvent,(x)=>{b.logDebug(`mouse event: ${JSON.stringify(x)}`)});this.#$.start(),w.on(m.KeyboardEvent,(x)=>{if(x.key==="q"||x.key==="Q")setTimeout(()=>{this.stop()})}),w.attach(this.#x),w.on(m.TermResizeEvent,()=>{this.#x.detectTermSize(T),b.logInfo(`Terminal resized: ${T.rows}x${T.cols}`)}),this.#Q.start(),this.#x.startApp(),w.start(),this.#x.detectTermSize(T),b.logInfo(`TUI_CONTEXT_INSTANCE.scale: ${T.rows} ${T.cols}`),this.#J.start()}get focusedWidget(){return this.#$.focusedWidget}focusWidget(x){this.#$.focusWidget(x)}blurWidget(){this.#$.blurWidget()}getFocusableWidgets(){return this.#$.getFocusableWidgets()}dispose(){this.#J.stop(),this.#Q.stop(),this.#$.stop(),tF(),sF(),iF(void 0),this.#B?.destroy(),this.#x.stopApp(),w.stop(),b.logInfo("TUI application stopped"),b.deinit()}[Symbol.dispose](){this.dispose()}async[Symbol.asyncDispose](){this.dispose()}stop(){this.dispose(),Xx.exit(0)}setTheme(x){jF(x)}createScene(x,F){let h=new IF(F),B=x;if(typeof B.setup==="function"){let $=B.setup,Z=cF(h,()=>$(h));this.#U.set(h.id,Z)}if(this.#h.push(h),h.visible)this.activateScene(h);return h}destroyScene(x){let F=typeof x==="bigint"?x:x.id,h=this.#h.find(($)=>$.id===F);if(!h)return;let B=this.#U.get(F);if(B)B(),this.#U.delete(F);if(h.destroy(),this.#h=this.#h.filter(($)=>$.id!==F),this.#B===h){this.#B=void 0,this.#$.blurWidget(),this.#Q.resetState();let $=this.#h.at(-1);if($)this.activateScene($)}}switchScene(x){if(!this.#h.some((F)=>F.id===x.id))return;this.activateScene(x)}activateScene(x){if(this.#B===x)return;if(this.#B)this.#B.setVisible(!1),this.#$.blurWidget(),this.#Q.resetState(),this.#B.emitLifecycle("exit");this.#B=x,x.setVisible(!0),x.emitLifecycle("enter")}}var dF;function iF(x){dF=x}var{log:uF,error:nF,warn:yF}=console,g0=[];function $4(){console.log=(...x)=>{let F=x.map((h)=>$1(h)).join(" ");b.logInfo(F),g0.push({level:"log",message:F})},console.error=(...x)=>{let F=x.map((h)=>$1(h)).join(" ");b.logError(F),g0.push({level:"error",message:F})},console.warn=(...x)=>{let F=x.map((h)=>$1(h)).join(" ");b.logWarning(F),g0.push({level:"warn",message:F})}}function sF(){for(let{level:x,message:F}of g0)switch(x){case"error":{nF(F);break}case"warn":{yF(F);break}case"log":{uF(F);break}}g0.length=0}function tF(){console.log=uF,console.error=nF,console.warn=yF}function $1(x){if(x instanceof Error)return x.stack??x.message;if(typeof x==="object"&&x!==null)try{return JSON.stringify(x)}catch{return"[object]"}return String(x)}function pF(x){let F=x instanceof Error?x.stack??x.message:String(x);b.logError(`Unhandled error: ${F}`),g0.push({level:"error",message:F}),tF(),sF(),setTimeout(()=>{dF?.dispose(),Xx.exit(1)})}Xx.on("unhandledRejection",pF);Xx.on("uncaughtException",pF);var oF=gF;function Z1(x){return new oF(x)}function b0(x){let F=x.codePointAt(0);if(F<32||F===127)return 0;if(F>=19968&&F<=40959||F>=13312&&F<=19903||F>=12288&&F<=12351||F>=12352&&F<=12447||F>=12448&&F<=12543||F>=44032&&F<=55215||F>=65281&&F<=65376||F>=63744&&F<=64255||F>=11904&&F<=12255||F>=12544&&F<=12687||F>=12800&&F<=13311||F>=65072&&F<=65103||F>=9728&&F<=10175||F>=127744&&F<=129535)return 2;return 1}function B0(x){let F=0;for(let h of x)F+=b0(h);return F}function A0(x,F){let h=0,B=0;for(let $ of x){let Z=b0($);if(h+Z>F)break;h+=Z,B++}return x.slice(0,B)}class Ix extends W0{#F;#x;#h;#B;#$;#Q;#J;#U=0;#z=0;#N=!1;#K=0;#Y=!0;constructor(x){super();this.#F=this.initRect(x.x,x.y,x.width,x.height,{width:32,height:1});let F=F0();this.#x={colorFg:z(x.colorFg??F.colors.text),colorBg:z(x.colorBg??0)},this.#h={styleZIndex:x.styleZIndex??0,styleModifier:k0(x.styleModifier)},this.#B=x.value,this.#$=x.overflow??"marquee",this.#Q=x.scrollSpeed??4,this.#J=x.scrollPauseMs??1000}get rect(){return this.#F}updateRect(x){Object.assign(this.#F,x)}get color(){return this.#x}updateThemeColors(x){this.updateColor({colorFg:x.colorFg===void 0?void 0:z(x.colorFg)})}updateColor(x){if(x.colorFg!==void 0)this.#x.colorFg=z(x.colorFg);if(x.colorBg!==void 0)this.#x.colorBg=z(x.colorBg)}get style(){return this.#h}updateStyle(x){if(x.styleModifier!==void 0)this.#h.styleModifier=k0(x.styleModifier);if(x.styleZIndex!==void 0)this.#h.styleZIndex=x.styleZIndex}get zIndex(){return this.getZIndexOverride()??this.#h.styleZIndex}get value(){return this.#B}updateValue(x){this.#B=x,this.#U=0,this.#z=0,this.#N=!1,this.#Y=!0}setScrollSpeed(x){this.#Q=x}setScrollPauseMs(x){this.#J=x}intrinsicSize(){return{width:B0(this.#B),height:1}}unmounted(){super.unmounted(),this.#K=0}emitDrawCommands(x){let{x:F,y:h,width:B,height:$}=this.#F,{colorFg:Z,colorBg:Q}=this.#x;if(x.pushClip(F,h,B,$),Q!==0)x.drawRect({x:F,y:h,width:B,height:$,bgRgba:Q});if(this.#B.length>0)if(this.#$==="marquee")this.#G(x,{x:F,y:h,visibleWidth:B,fgRgba:Z});else x.drawText({x:F,y:h,text:this.#B,fgRgba:Z,bgRgba:0});x.popClip()}#G(x,{x:F,y:h,visibleWidth:B,fgRgba:$}){let Z=B0(this.#B);if(Z<=B){x.drawText({x:F,y:h,text:this.#B,fgRgba:$,bgRgba:0});return}let Q=Date.now();if(this.#K===0)this.#K=Q;let _=Q-this.#K;if(this.#K=Q,this.#Y)this.#Y=!1,this.#z=this.#J;let J=0,N=[...this.#B];for(let I=N.length-1;I>=0;I--){let P=N[I],R=b0(P);if(J+R>B)break;J+=R}let K=Math.max(Z-B,Z-J);if(this.#z>0){if(this.#z-=_,this.#z<0){if(this.#z=0,this.#N)this.#N=!1,this.#U=0,this.#z=this.#J}}else{let I=this.#Q*_/1000;if(this.#U+=I,this.#U>=K)this.#U=K,this.#z=this.#J,this.#N=!0}let q=Math.floor(this.#U),G=0,Y=0;for(let I of this.#B){let P=b0(I);if(Y+P>q)break;Y+=P,G++}let E=B-(Y-q),H=A0(this.#B.slice(G),E),W=F+Y-q;x.drawText({x:W,y:h,text:H,fgRgba:$,bgRgba:0})}}var vF={x:0,y:0,width:32,height:1,value:""},rF={colorFg:"text"};function H0(x){if(typeof x==="string"){let h=new Ix({...vF,value:x});return u(h,rF,{},(B)=>{h.updateThemeColors(B)}),h}let F=new Ix({...vF,...x});return u(F,rF,x,(h)=>{F.updateThemeColors(h)}),F}var lF=[["Normal","normal"],["Hovered","hovered"],["Focused","focused"],["Selected","selected"],["Pressed","pressed"],["Disabled","disabled"],["Active","active"],["Unfocused","normal"]],Z4={colorFg:"fg",colorBg:"bg",colorCross:"cross",colorCheck:"check",colorDim:"dim",colorTrack:"track",colorFill:"fill",borderColor:"borderColor"};function $0(x,F){let h=x;for(let[B,$]of Object.entries(F)){if($===void 0)continue;for(let[Z,Q]of lF){if(!B.endsWith(Z))continue;let _=B.slice(0,-Z.length),J=Z4[_];if(J===void 0)break;let N=h[Q];if(N!==void 0)N[J]=z($);break}if(B.startsWith("borderStyle"))for(let[Z,Q]of lF){if(!B.endsWith(Z))continue;let _=h[Q];if(_!==void 0&&"borderStyle"in _)_.borderStyle=S($);break}}}function e(x,F){if(F.disabled&&x.disabled)return x.disabled;if(F.pressed&&x.pressed)return x.pressed;if(F.selected&&x.selected)return x.selected;if(F.hovered&&x.hovered)return x.hovered;if(F.focused&&x.focused)return x.focused;if(F.active&&x.active)return x.active;return x.normal}import aF from"process";import{spawnSync as d0}from"child_process";class Q1{read(){try{let{platform:x}=aF;if(x==="win32"){let F=d0("powershell",["-command","Get-Clipboard"],{encoding:"utf8",timeout:3000,windowsHide:!0});if(F.status===0&&F.stdout)return F.stdout.replace(/\r?\n$/v,"")}else if(x==="darwin"){let F=d0("pbpaste",{encoding:"utf8",timeout:3000});if(F.status===0&&F.stdout)return F.stdout}else{let F=d0("xclip",["-selection","clipboard","-o"],{encoding:"utf8",timeout:3000});if(F.status===0&&F.stdout)return F.stdout}}catch{}return""}write(x){try{let{platform:F}=aF;if(F==="win32")d0("clip",{input:x,timeout:3000,windowsHide:!0});else if(F==="darwin")d0("pbcopy",{input:x,timeout:3000});else d0("xclip",["-selection","clipboard"],{input:x,timeout:3000})}catch{}}}var Q4=new Q1;function Dx(){return Q4}function _4(x,F){let h=0,B=0;for(let $ of x){let Z=b0($);if(h+Z>F)break;h+=Z,B++}return B}var J4=0,U4=1,z4=2,N4=3;function h0(x){if(x<=32)return U4;if(x>=19968&&x<=40959||x>=13312&&x<=19903||x>=12288&&x<=12351||x>=65280&&x<=65519)return N4;if(x>=33&&x<=47||x>=58&&x<=64||x>=91&&x<=96||x>=123&&x<=126)return z4;return J4}var eF={colorFgNormal:"text",colorBgNormal:"surface",colorFgFocused:"text",colorBgFocused:"surface",borderColorUnfocused:"border",borderColorFocused:"borderFocused",borderColorDisabled:"border",borderStyle:"border.normal",placeholderColorFg:"placeholder",selectionBgColor:"selectionBg",selectionFgColor:"selectionFg",colorFgDisabled:"textMuted",colorBgDisabled:"surfaceDisabled"};function xh(){return{x:0,y:0,width:32,height:3,placeholder:"",value:"",maxLength:0,label:"",readonly:!1,disabled:!1,...a(eF)}}class _1 extends O{#F;#x;#h;#B;#$;#Q;#J;#U;#z;#N;#K;#Y;#G;#Z;#E;#X;#I;#H;#A;#_=0;#j=0;#q;#R=!1;#V=0;#k=0;#c=-1;#S="blinking-ibeam";#L=[];#O=[];constructor(x={}){super();let F={...xh(),...x},h=this.initRect(F.x,F.y,F.width,F.height);this.#F=h.x,this.#x=h.y,this.#h=h.width,this.#B=h.height,this.#$={normal:{fg:z(F.colorFgNormal),bg:z(F.colorBgNormal),borderColor:z(F.borderColorUnfocused)},focused:{fg:z(F.colorFgFocused),bg:z(F.colorBgFocused),borderColor:z(F.borderColorFocused)},disabled:{fg:z(F.colorFgDisabled),bg:z(F.colorBgDisabled),borderColor:z(F.borderColorDisabled)}},this.#Q=S(F.borderStyle??"solid"),this.#J=F.maxLength??0,this.#U=F.placeholder??"",this.#z=z(F.placeholderColorFg),this.#N=z(F.selectionBgColor),this.#K=z(F.selectionFgColor),this.#Y=F.label??"",this.#G=F.readonly??!1,this.#E=(F.type??"text")==="password",this.#X=(F.type??"text")==="number",this.#I=F.min??0,this.#H=F.max??100,this.#A=F.step??1,this.#Z=F.value??"",this.#_=this.#Z.length,this.setDisabled(F.disabled??!1),this.on("mousedown",(B)=>{if(this.disabled)return;if(this.#X){let Q=this.#F+this.#h-2;if(B.x===Q){let _=this.#x+1;if(B.y===_){this.#T();return}if(this.#B===3&&B.y===_+1){this.#w();return}}}let $=this.#i(B),Z=Date.now();if(Z-this.#k<300&&$===this.#c)this.#V++;else this.#V=1;if(this.#k=Z,this.#c=$,this.#V>=3){this.#q=0,this.#_=this.#Z.length,this.#R=!0,this.#C();return}if(this.#V===2){let[Q,_]=this.#u($);this.#q=Q,this.#_=_,this.#R=!0,this.#C();return}if(B.shiftKey){if(this.#q===void 0)this.#q=this.#_}else this.#q=$;this.#_=$,this.#R=!0,this.#C()}),this.on("mousemove",(B)=>{if(!this.#R)return;if(!B.buttons||B.buttons===0)return;let $=B.x,Z=this.#F+1,Q=this.#X?this.#F+this.#h-3:this.#F+this.#h-1;if($<Z&&this.#j>0){this.#j--,this.#_=this.#j;return}if($>=Q&&this.#_<this.#Z.length){this.#_++,this.#C();return}let _=this.#i(B);if(_!==this.#_)this.#_=_,this.#C()}),this.on("mouseup",()=>{this.#R=!1}),this.on("wheel",(B)=>{if(this.disabled||!this.#X)return;if(B.wheelDeltaY>0)this.#T();else if(B.wheelDeltaY<0)this.#w()})}get value(){return this.#Z}get readonly(){return this.#G}setReadonly(x){this.#G=x}setLabel(x){this.#Y=x}setMaxLength(x){this.#J=x}setPlaceholder(x){this.#U=x}setMin(x){this.#I=x}setMax(x){this.#H=x}setStep(x){this.#A=x}updateColor(x){if(x.colorFg!==void 0){let F=z(x.colorFg);this.#$.normal.fg=F,this.#$.focused.fg=F}if(x.colorBg!==void 0){let F=z(x.colorBg);this.#$.normal.bg=F,this.#$.focused.bg=F}}updateBorder(x){if(x.borderStyle!==void 0)this.#Q=S(x.borderStyle)}updateValue(x){this.#Z=x,this.#_=Math.min(this.#_,this.#Z.length),this.#q=void 0,this.#C()}get acceptsFocus(){return super.acceptsFocus}blur(){if(this.#X)this.#g();this.#q=void 0,super.blur()}handleActiveKey(x){let F=x.key;if(F.length===1&&!x.ctrlKey&&!x.altKey&&!x.metaKey){if(!this.#G)if(this.#X)this.#Q0(F);else this.#f(F);return}if(x.ctrlKey&&this.#x0(F,x))return;if(this.#X){if(F==="ArrowUp"){this.#T();return}if(F==="ArrowDown"){this.#w();return}}switch(F){case"Backspace":{if(!this.#G)if(x.ctrlKey)this.#n();else this.#s();break}case"Delete":{if(!this.#G)if(x.ctrlKey)this.#y();else this.#t();break}case"ArrowLeft":{if(x.ctrlKey)this.#v(x);else this.#p(x);break}case"ArrowRight":{if(x.ctrlKey)this.#r(x);else this.#o(x);break}case"Home":{this.#l(x);break}case"End":{this.#a(x);break}case"Escape":break;case"Insert":{this.#d();break}case"Enter":{if(this.#X)this.#g();this.#q=void 0,this.dispatch("submit",{value:this.#Z});break}default:break}}updateRect(x){if(x.x!==void 0)this.#F=x.x;if(x.y!==void 0)this.#x=x.y;if(x.width!==void 0)this.#h=x.width;if(x.height!==void 0)this.#B=x.height}updateThemeColors(x){if($0(this.#$,x),x.borderStyle!==void 0)this.#Q=S(x.borderStyle);if(x.placeholderColorFg!==void 0)this.#z=z(x.placeholderColorFg);if(x.selectionBgColor!==void 0)this.#N=z(x.selectionBgColor);if(x.selectionFgColor!==void 0)this.#K=z(x.selectionFgColor)}emitDrawCommands(x){if(this.#h<=0||this.#B<=0)return;x.pushClip(this.#F,this.#x,this.#h,this.#B);let F=e(this.#$,{disabled:this.disabled,focused:this.focused});x.drawRect({x:this.#F,y:this.#x,width:this.#h,height:this.#B,bgRgba:F.bg});let h=this.#F+1,B=this.#x+1,$=this.#X?this.#h-4:this.#h-2;if(this.#Z.length>0){let Z=this.#M(),Q=this.#Z.slice(this.#j),_=this.#W(Q),J=A0(_,$),N=this.#j+[...J].length;if(Z===void 0)x.drawText({x:h,y:B,text:J,fgRgba:F.fg,bgRgba:0});else{let K=Math.max(Z.start,this.#j),q=Math.min(Z.end,N),G=h;if(K>this.#j){let Y=this.#W(this.#Z.slice(this.#j,K)),E=A0(Y,$-(G-h));x.drawText({x:G,y:B,text:E,fgRgba:F.fg,bgRgba:0}),G+=B0(E)}if(q>K){let Y=$-(G-h),E=this.#W(this.#Z.slice(K,q)),H=A0(E,Y);x.drawText({x:G,y:B,text:H,fgRgba:this.#K,bgRgba:this.#N}),G+=B0(H)}if(q<N){let Y=$-(G-h);if(Y>0){let E=this.#W(this.#Z.slice(q,N)),H=A0(E,Y);x.drawText({x:G,y:B,text:H,fgRgba:F.fg,bgRgba:0})}}}}else if(this.#U.length>0)x.drawText({x:h,y:B,text:this.#U.slice(0,$),fgRgba:this.#z,bgRgba:0});if(this.#Q!==0){if(x.drawBorder({x:this.#F,y:this.#x,width:this.#h,height:this.#B,colorRgba:F.borderColor,style:this.#Q,sides:z0.All}),this.#Y.length>0){let Z=this.#X?this.#h-4:this.#h-2,Q=A0(this.#Y,Z);x.drawText({x:this.#F+1,y:this.#x,text:Q,fgRgba:F.fg,bgRgba:F.bg})}}if(this.#X){let Z=this.#F+this.#h-2,Q=this.#x+1;if(x.drawChar({x:Z,y:Q,char:9650,fgRgba:F.fg,bgRgba:F.bg}),this.#B>=3)x.drawChar({x:Z,y:Q+1,char:9660,fgRgba:F.fg,bgRgba:F.bg})}if(this.focused&&!this.disabled){let Z=this.#W(this.#Z.slice(this.#j,this.#_)),Q=h+B0(Z);x.setCursor(Q,B),x.setCursorMode(HF(this.#S)),x.showCursor()}x.popClip()}get rect(){return{x:this.#F,y:this.#x,width:this.#h,height:this.#B}}intrinsicSize(){return{width:this.#h,height:this.#B}}getSelection(){let x=this.#M();if(x===void 0)return;return{start:x.start,end:x.end,text:this.#Z.slice(x.start,x.end)}}select(){this.#q=0,this.#_=this.#Z.length,this.#C()}setSelectionRange(x,F){let h=Math.max(0,Math.min(x,this.#Z.length)),B=Math.max(0,Math.min(F,this.#Z.length));this.#q=Math.min(h,B),this.#_=Math.max(h,B),this.#C()}#d(){let x=["blinking-ibeam","blinking-block","blinking-underscore","ibeam","block","underscore"],F=x.indexOf(this.#S);this.#S=x[(F+1)%x.length]}#W(x){if(!this.#E)return x;return"\u2022".repeat([...x].length)}#m(x,F){return this.#W(this.#Z.slice(x,F))}#M(){if(this.#q===void 0||this.#q===this.#_)return;return this.#q<this.#_?{start:this.#q,end:this.#_}:{start:this.#_,end:this.#q}}#P(){let x=this.#M();if(x===void 0)return!1;return this.#Z=this.#Z.slice(0,x.start)+this.#Z.slice(x.end),this.#_=x.start,this.#q=void 0,this.#C(),this.dispatch("input",{value:this.#Z}),!0}#C(){let x=this.#X?this.#h-4:this.#h-2;if(x<=0)return;if(this.#_<this.#j)this.#j=this.#_;if(B0(this.#m(this.#j,this.#_))>=x){while(this.#j<this.#_)if(this.#j++,B0(this.#m(this.#j,this.#_))<x)break}while(this.#j>0){let h=this.#j-1;if(B0(this.#m(h))<=x)this.#j=h;else break}}#i(x){let F=x.x-this.#F-1,h=this.#X?this.#h-4:this.#h-2;if(F<0||F>=h)return this.#_;let B=this.#m(this.#j);return Math.max(0,Math.min(this.#Z.length,this.#j+_4(B,F)))}#u(x){let{length:F}=this.#Z;if(F===0)return[0,0];let h=Math.min(x,F-1),B=h,$=h,Z=h0(this.#Z.codePointAt(h));while(B>0&&h0(this.#Z.codePointAt(B-1))===Z)B--;while($<F&&h0(this.#Z.codePointAt($))===Z)$++;return[B,$]}#f(x){if(this.#J===0||this.#Z.length<this.#J||this.#M()!==void 0){if(this.#D(),this.#P(),this.#J===0||this.#Z.length<this.#J)this.#Z=this.#Z.slice(0,this.#_)+x+this.#Z.slice(this.#_),this.#_++;this.#C(),this.dispatch("input",{value:this.#Z})}}#n(){if(this.#M()!==void 0){this.#D(),this.#P();return}if(this.#_<=0)return;this.#D();let x=this.#_,F=h0(this.#Z.codePointAt(x-1));x--;while(x>0&&h0(this.#Z.codePointAt(x-1))===F)x--;this.#Z=this.#Z.slice(0,x)+this.#Z.slice(this.#_),this.#_=x,this.#C(),this.dispatch("input",{value:this.#Z})}#y(){if(this.#M()!==void 0){this.#D(),this.#P();return}let{length:x}=this.#Z;if(this.#_>=x)return;this.#D();let F=this.#_,h=h0(this.#Z.codePointAt(F));F++;while(F<x&&h0(this.#Z.codePointAt(F))===h)F++;this.#Z=this.#Z.slice(0,this.#_)+this.#Z.slice(F),this.#C(),this.dispatch("input",{value:this.#Z})}#s(){if(this.#M()!==void 0){this.#D(),this.#P();return}if(this.#_>0)this.#D(),this.#Z=this.#Z.slice(0,this.#_-1)+this.#Z.slice(this.#_),this.#_--,this.#C(),this.dispatch("input",{value:this.#Z})}#t(){if(this.#M()!==void 0){this.#D(),this.#P();return}if(this.#_<this.#Z.length)this.#D(),this.#Z=this.#Z.slice(0,this.#_)+this.#Z.slice(this.#_+1),this.#C(),this.dispatch("input",{value:this.#Z})}#b(x){if(x.shiftKey){if(this.#q===void 0)this.#q=this.#_}else this.#q=void 0}#p(x){if(this.#b(x),this.#_>0)this.#_--,this.#C()}#o(x){if(this.#b(x),this.#_<this.#Z.length)this.#_++,this.#C()}#v(x){if(this.#b(x),this.#_<=0)return;let F=this.#_,h=h0(this.#Z.codePointAt(F-1));F--;while(F>0&&h0(this.#Z.codePointAt(F-1))===h)F--;this.#_=F,this.#C()}#r(x){this.#b(x);let{length:F}=this.#Z;if(this.#_>=F)return;let h=this.#_,B=h0(this.#Z.codePointAt(h));h++;while(h<F&&h0(this.#Z.codePointAt(h))===B)h++;this.#_=h,this.#C()}#l(x){this.#b(x),this.#_=0,this.#j=0}#a(x){this.#b(x),this.#_=this.#Z.length,this.#C()}#e(x){if(x.ctrlKey&&!x.altKey&&!x.metaKey&&this.#Z.length>0)this.#q=0,this.#_=this.#Z.length,this.#C()}#x0(x,F){if(x==="a")return this.#e(F),!0;if(x==="c")return this.#F0(),!0;if(x==="z"){if(!this.#G)this.#$0();return!0}if(x==="y"){if(!this.#G)this.#Z0();return!0}if(x==="v"){if(!this.#G)this.#B0();return!0}if(x==="x"){if(!this.#G)this.#h0();return!0}return!1}#F0(){let x=this.getSelection();if(x===void 0)return;Dx().write(x.text),this.dispatch("copy",{text:x.text})}#h0(){let x=this.getSelection();if(x===void 0)return;this.#D(),Dx().write(x.text),this.#P(),this.dispatch("cut",{text:x.text})}#B0(){let x=Dx().read();if(x.length===0)return;if(this.#X){let B="";for(let $ of x)if($>="0"&&$<="9")B+=$;else if($==="."&&!this.#Z.includes(".")&&!B.includes("."))B+=$;else if($==="-"&&B.length===0&&this.#_===0&&!this.#Z.includes("-"))B+=$;if(x=B,x.length===0)return}if(this.#D(),this.#P(),this.#J>0&&this.#Z.length>=this.#J)return;let F=this.#J===0?x.length:this.#J-this.#Z.length,h=x.slice(0,F);this.#Z=this.#Z.slice(0,this.#_)+h+this.#Z.slice(this.#_),this.#_+=[...h].length,this.#C(),this.dispatch("paste",{text:h}),this.dispatch("input",{value:this.#Z})}#D(){if(this.#L.length>=100)this.#L.shift();this.#L.push({value:this.#Z,cursorPos:this.#_,selectionAnchor:this.#q}),this.#O.length=0}#$0(){if(this.#L.length===0)return;this.#O.push({value:this.#Z,cursorPos:this.#_,selectionAnchor:this.#q});let x=this.#L.pop();this.#Z=x.value,this.#_=x.cursorPos,this.#q=x.selectionAnchor,this.#C(),this.dispatch("undo",{value:this.#Z}),this.dispatch("input",{value:this.#Z})}#Z0(){if(this.#O.length===0)return;this.#L.push({value:this.#Z,cursorPos:this.#_,selectionAnchor:this.#q});let x=this.#O.pop();this.#Z=x.value,this.#_=x.cursorPos,this.#q=x.selectionAnchor,this.#C(),this.dispatch("redo",{value:this.#Z}),this.dispatch("input",{value:this.#Z})}#Q0(x){if(x>="0"&&x<="9")this.#f(x);else if(x==="-"&&this.#_===0&&!this.#Z.includes("-"))this.#f(x);else if(x==="."&&!this.#Z.includes("."))this.#f(x)}#T(){let x=Number.parseFloat(this.#Z),F=Number.isNaN(x)?this.#I:x,h=Math.min(this.#H,F+this.#A),B=String(h);if(B!==this.#Z)this.#D(),this.#Z=B,this.#_=this.#Z.length,this.#q=void 0,this.#C(),this.dispatch("input",{value:this.#Z}),this.dispatch("change",{value:h})}#w(){let x=Number.parseFloat(this.#Z),F=Number.isNaN(x)?this.#H:x,h=Math.max(this.#I,F-this.#A),B=String(h);if(B!==this.#Z)this.#D(),this.#Z=B,this.#_=this.#Z.length,this.#q=void 0,this.#C(),this.dispatch("input",{value:this.#Z}),this.dispatch("change",{value:h})}#g(){let x=Number.parseFloat(this.#Z);if(Number.isNaN(x))this.#Z=String(this.#I);else{let F=Math.max(this.#I,Math.min(this.#H,x));this.#Z=String(F)}this.#_=this.#Z.length,this.#q=void 0,this.#C()}}function J1(x){let F=new _1({...xh(),...x});return u(F,eF,x??{},(h)=>{F.updateThemeColors(h)}),F}var Fh={colorFgNormal:"text",colorBgNormal:"surface",borderColorNormal:"border",borderStyleNormal:"border.normal",colorFgFocused:"text",colorBgFocused:"surfaceFocused",borderColorFocused:"borderFocused",borderStyleFocused:"border.focused",colorFgHovered:"text",colorBgHovered:"surfaceHover",borderColorHovered:"border",borderStyleHovered:"border.normal",colorFgPressed:"text",colorBgPressed:"surfacePressed",borderColorPressed:"borderFocused",borderStylePressed:"border.pressed",colorFgDisabled:"textMuted",colorBgDisabled:"surfaceDisabled",borderColorDisabled:"surfaceFocused",borderStyleDisabled:"border.disabled"};function hh(){return{x:0,y:0,width:10,height:3,value:"",...a(Fh),disabled:!1}}class U1 extends O{#F;#x;#h=!1;#B;constructor(x={}){super();let F={...hh(),...x};this.#F=this.initRect(F.x,F.y,F.width,F.height),this.#x=F.value,this.setDisabled(F.disabled),this.#B={normal:{fg:z(F.colorFgNormal),bg:z(F.colorBgNormal),borderColor:z(F.borderColorNormal),borderStyle:S(F.borderStyleNormal)},focused:{fg:z(F.colorFgFocused),bg:z(F.colorBgFocused),borderColor:z(F.borderColorFocused),borderStyle:S(F.borderStyleFocused)},hovered:{fg:z(F.colorFgHovered),bg:z(F.colorBgHovered),borderColor:z(F.borderColorHovered),borderStyle:S(F.borderStyleHovered)},pressed:{fg:z(F.colorFgPressed),bg:z(F.colorBgPressed),borderColor:z(F.borderColorPressed),borderStyle:S(F.borderStylePressed)},disabled:{fg:z(F.colorFgDisabled),bg:z(F.colorBgDisabled),borderColor:z(F.borderColorDisabled),borderStyle:S(F.borderStyleDisabled)}},this.on("mousedown",()=>{this.#h=!0}),this.on("mouseup",()=>{this.#h=!1})}blur(){this.#h=!1,super.blur()}handleActiveKey(x){if(x.key==="Enter"||x.key===" ")this.dispatch("click",void 0)}get value(){return this.#x}updateValue(x){this.#x=x}updateNormalStyle(x){if(x.colorFgNormal!==void 0)this.#B.normal.fg=z(x.colorFgNormal);if(x.colorBgNormal!==void 0)this.#B.normal.bg=z(x.colorBgNormal);if(x.borderColorNormal!==void 0)this.#B.normal.borderColor=z(x.borderColorNormal);if(x.borderStyleNormal!==void 0)this.#B.normal.borderStyle=S(x.borderStyleNormal)}updateHoveredStyle(x){if(x.colorFgHovered!==void 0)this.#B.hovered.fg=z(x.colorFgHovered);if(x.colorBgHovered!==void 0)this.#B.hovered.bg=z(x.colorBgHovered);if(x.borderColorHovered!==void 0)this.#B.hovered.borderColor=z(x.borderColorHovered);if(x.borderStyleHovered!==void 0)this.#B.hovered.borderStyle=S(x.borderStyleHovered)}updatePressedStyle(x){if(x.colorFgPressed!==void 0)this.#B.pressed.fg=z(x.colorFgPressed);if(x.colorBgPressed!==void 0)this.#B.pressed.bg=z(x.colorBgPressed);if(x.borderColorPressed!==void 0)this.#B.pressed.borderColor=z(x.borderColorPressed);if(x.borderStylePressed!==void 0)this.#B.pressed.borderStyle=S(x.borderStylePressed)}get rect(){return this.#F}intrinsicSize(){return{width:this.#F.width,height:this.#F.height}}updateRect(x){Object.assign(this.#F,x)}emitDrawCommands(x){let{x:F,y:h,width:B,height:$}=this.#F;if(B<=0||$<=0)return;x.pushClip(F,h,B,$);let Z=e(this.#B,{disabled:this.disabled,pressed:this.#h,hovered:this.hovered,focused:this.focused});if(x.drawRect({x:F,y:h,width:B,height:$,bgRgba:Z.bg}),this.#x.length>0){let Q=B-2,_=$-2,J=F+1+Math.max(0,Math.floor((Q-this.#x.length)/2)),N=h+1+Math.floor(_/2),K=this.#x.slice(0,Math.max(0,Q));x.drawText({x:J,y:N,text:K,fgRgba:Z.fg,bgRgba:0})}if(Z.borderStyle!==0)x.drawBorder({x:F,y:h,width:B,height:$,colorRgba:Z.borderColor,style:Z.borderStyle,sides:z0.All});x.popClip()}updateThemeColors(x){$0(this.#B,x)}}function R0(x){let F=new U1({...hh(),...x});return u(F,Fh,x??{},(h)=>{F.updateThemeColors(h)}),F}var Bh={colorFgNormal:"text",colorBgNormal:"surface",colorFgHovered:"text",colorBgHovered:"surfaceHover",colorFgFocused:"text",colorBgFocused:"surfaceFocused",colorFgDisabled:"textMuted",colorBgDisabled:"surfaceDisabled"};function $h(){return{x:0,y:0,width:10,height:1,label:"",checked:!1,indeterminate:!1,disabled:!1,...a(Bh)}}class z1 extends O{#F;#x;#h;#B;#$;constructor(x={}){super();let F={...$h(),...x};this.#F=this.initRect(F.x,F.y,F.width,F.height),this.#x=F.label,this.#h=F.checked,this.#B=F.indeterminate??!1,this.setDisabled(F.disabled),this.#$={normal:{fg:z(F.colorFgNormal),bg:z(F.colorBgNormal)},hovered:{fg:z(F.colorFgHovered),bg:z(F.colorBgHovered)},focused:{fg:z(F.colorFgFocused),bg:z(F.colorBgFocused)},disabled:{fg:z(F.colorFgDisabled),bg:z(F.colorBgDisabled)}},this.on("click",()=>{this.#Q()})}get checked(){return this.#h}get indeterminate(){return this.#B}get label(){return this.#x}get rect(){return this.#F}intrinsicSize(){return{width:this.#F.width,height:this.#F.height}}handleActiveKey(x){if(x.key==="Enter"||x.key===" ")this.#Q()}setChecked(x){this.#h=x}setIndeterminate(x){this.#B=x}setLabel(x){this.#x=x}updateRect(x){Object.assign(this.#F,x)}updateThemeColors(x){$0(this.#$,x)}emitDrawCommands(x){let{x:F,y:h,width:B,height:$}=this.#F;if(B<=0||$<=0)return;x.pushClip(F,h,B,$);let{fg:Z,bg:Q}=e(this.#$,{disabled:this.disabled,focused:this.focused,hovered:this.hovered});x.drawRect({x:F,y:h,width:B,height:$,bgRgba:Q});let _=this.#B?"[-]":this.#h?"[\u2713]":"[ ]",J=h+Math.floor($/2);if(x.drawText({x:F,y:J,text:_,fgRgba:Z,bgRgba:0}),this.#x.length>0){let N=F+_.length+1,K=B-_.length-1;if(K>0){let q=this.#x.slice(0,Math.max(0,K));x.drawText({x:N,y:J,text:q,fgRgba:Z,bgRgba:0})}}x.popClip()}#Q(){if(this.#B)this.#B=!1,this.#h=!0;else this.#h=!this.#h;this.dispatch("change",{checked:this.#h,indeterminate:this.#B})}}function N1(x){let F=new z1({...$h(),...x});return u(F,Bh,x??{},(h)=>{F.updateThemeColors(h)}),F}var Zh={colorFgNormal:"text",colorBgNormal:"surface",colorFgFocused:"text",colorBgFocused:"surfaceHover",colorFgDisabled:"textMuted",colorBgDisabled:"surfaceDisabled",colorFgSelected:"accent",colorBgSelected:"surfaceFocused"};function Qh(){return{x:0,y:0,width:20,height:3,options:[],value:-1,disabled:!1,...a(Zh)}}class q1 extends O{#F;#x;#h;#B=-1;#$=-1;#Q;constructor(x={}){super();let F={...Qh(),...x};this.#F=this.initRect(F.x,F.y,F.width,F.height),this.#x=F.options,this.#h=F.value,this.setDisabled(F.disabled),this.#Q={normal:{fg:z(F.colorFgNormal),bg:z(F.colorBgNormal)},focused:{fg:z(F.colorFgFocused),bg:z(F.colorBgFocused)},disabled:{fg:z(F.colorFgDisabled),bg:z(F.colorBgDisabled)},selected:{fg:z(F.colorFgSelected),bg:z(F.colorBgSelected)}},this.on("mousedown",(h)=>{let B=h.y-this.#F.y;if(B>=0&&B<this.#x.length)this.#B=B,this.#J(this.#B)}),this.on("mouseover",(h)=>{let B=h.y-this.#F.y;if(B>=0&&B<this.#x.length)this.#B=B}),this.on("mousemove",(h)=>{let B=h.y-this.#F.y;if(B>=0&&B<this.#x.length)this.#B=B}),this.on("mouseout",()=>{this.#B=-1})}handleActiveKey(x){if(this.#x.length===0)return;if(x.key==="ArrowUp"){if(this.#$<=0)this.#$=this.#x.length-1;else this.#$--;return}if(x.key==="ArrowDown"){this.#$=(this.#$+1)%this.#x.length;return}if(x.key==="Home"){this.#$=0;return}if(x.key==="End"){this.#$=this.#x.length-1;return}if((x.key==="Enter"||x.key===" ")&&this.#$>=0)this.#J(this.#$)}get value(){return this.#h}get selectedLabel(){if(this.#h<0||this.#h>=this.#x.length)return"";return this.#x[this.#h]??""}updateValue(x){this.#h=x}get options(){return this.#x}setOptions(x){if(this.#x=x,this.#h>=x.length)this.#h=-1;if(this.#B>=x.length)this.#B=Math.max(0,x.length-1);if(this.#$>=x.length)this.#$=Math.max(0,x.length-1)}get rect(){return this.#F}intrinsicSize(){return{width:this.#F.width,height:this.#F.height}}updateRect(x){Object.assign(this.#F,x)}updateThemeColors(x){$0(this.#Q,x)}emitDrawCommands(x){let{x:F,y:h,width:B,height:$}=this.#F;if(B<=0||$<=0)return;x.pushClip(F,h,B,$);let Z=e(this.#Q,{disabled:this.disabled});x.drawRect({x:F,y:h,width:B,height:$,bgRgba:Z.bg});let Q=Math.min(this.#x.length,$);for(let _=0;_<Q;_++){let J=this.#x[_],N=_===this.#h,K=_===this.#B,q=_===this.#$,G=h+_,Y=N?"(\u25CF)":"( )",E=e(this.#Q,{disabled:this.disabled,selected:N,hovered:K,focused:q});if(E.bg!==0)x.drawRect({x:F,y:G,width:B,height:1,bgRgba:E.bg});let H=B-Y.length-1,W=H>0?J.slice(0,Math.max(0,H)):"",I=`${Y} ${W}`;x.drawText({x:F,y:G,text:I,fgRgba:E.fg,bgRgba:0})}x.popClip()}#J(x){this.#h=x,this.dispatch("change",{value:this.#h,label:this.#x[this.#h]??""})}}function K1(x){let F=new q1({...Qh(),...x});return u(F,Zh,x??{},(h)=>{F.updateThemeColors(h)}),F}var _h={colorFgNormal:"textMuted",colorBgNormal:"surface",colorFgActive:"text",colorBgActive:"surfaceFocused",colorFgFocused:"accent",colorBgFocused:"surfaceHover",colorFgDisabled:"textMuted",colorBgDisabled:"surfaceDisabled",colorFgSeparator:"border"};function Jh(){return{x:0,y:0,width:0,height:1,options:[],value:void 0,disabled:!1,...a(_h)}}class C1 extends O{#F;#x;#h;#B=-1;#$;#Q;constructor(x={}){super();let F={...Jh(),...x};if(this.#F=this.initRect(F.x,F.y,F.width,F.height),this.#x=F.options,this.setDisabled(F.disabled),F.value===void 0)this.#h=this.#x.length>0?0:-1;else this.#h=this.#x.indexOf(F.value);this.#$={normal:{fg:z(F.colorFgNormal),bg:z(F.colorBgNormal)},active:{fg:z(F.colorFgActive),bg:z(F.colorBgActive)},focused:{fg:z(F.colorFgFocused),bg:z(F.colorBgFocused)},disabled:{fg:z(F.colorFgDisabled),bg:z(F.colorBgDisabled)}},this.#Q=z(F.colorFgSeparator),this.on("mousedown",(h)=>{let B=this.#z(h.x);if(B>=0)this.#N(B)}),this.on("mousemove",(h)=>{this.#B=this.#z(h.x)}),this.on("mouseover",(h)=>{this.#B=this.#z(h.x)}),this.on("mouseout",()=>{this.#B=-1})}blur(){this.#B=-1,super.blur()}handleActiveKey(x){if(this.#x.length===0||this.#h<0)return;if(x.key==="ArrowLeft"){let F=(this.#h-1+this.#x.length)%this.#x.length;this.#N(F);return}if(x.key==="ArrowRight"){let F=(this.#h+1)%this.#x.length;this.#N(F);return}if(x.key==="Home"){this.#N(0);return}if(x.key==="End")this.#N(this.#x.length-1)}get value(){return this.#h>=0?this.#x[this.#h]:void 0}get activeLabel(){if(this.#h<0||this.#h>=this.#x.length)return"";return String(this.#x[this.#h])}updateValue(x){let F=this.#x.indexOf(x);if(F!==-1)this.#h=F}intrinsicSize(){if(this.#x.length===0)return{width:0,height:this.#F.height};let x=this.#U();if(x.length===0)return{width:0,height:this.#F.height};let F=x.at(-1);return{width:F.x+F.width-this.#F.x,height:this.#F.height}}get options(){return this.#x}setOptions(x){let F=this.#h>=0?this.#x[this.#h]:void 0;if(this.#x=x,F===void 0)this.#h=x.length>0?0:-1;else{let h=x.indexOf(F);this.#h=h===-1?x.length>0?0:-1:h}}get rect(){return{x:this.#F.x,y:this.#F.y,width:this.#J(),height:this.#F.height}}updateRect(x){Object.assign(this.#F,x)}containsPoint(x,F){let h=this.#J();return x>=this.#F.x&&x<this.#F.x+h&&F>=this.#F.y&&F<this.#F.y+this.#F.height}updateThemeColors(x){if($0(this.#$,x),x.colorFgSeparator!==void 0)this.#Q=z(x.colorFgSeparator)}emitDrawCommands(x){let{x:F,y:h,height:B}=this.#F,$=this.#J();if($<=0||B<=0||this.#x.length===0)return;x.pushClip(F,h,$,B);let Z=e(this.#$,{disabled:this.disabled});x.drawRect({x:F,y:h,width:$,height:B,bgRgba:Z.bg});let Q=this.#U();for(let _=0;_<Q.length;_++){let{x:J,width:N,label:K}=Q[_],q=_===this.#h,G=_===this.#B,Y=e(this.#$,{disabled:this.disabled,focused:q?this.focused:G,active:q&&!this.focused});if(Y.bg!==Z.bg)x.drawRect({x:J,y:h,width:N,height:B,bgRgba:Y.bg});let H=` ${K} `.slice(0,Math.max(0,N));if(x.drawText({x:J,y:h,text:H,fgRgba:Y.fg,bgRgba:0}),_<Q.length-1){let W=J+N,I=this.disabled?Z.fg:this.#Q;x.drawText({x:W,y:h,text:"\u2502",fgRgba:I,bgRgba:0})}}x.popClip()}#J(){if(this.#F.width>0)return this.#F.width;return this.intrinsicSize()?.width??0}#U(){let x=[],F=this.#F.x;for(let h of this.#x){let B=String(h),$=B.length+2;x.push({x:F,width:$,label:B}),F+=$+1}return x}#z(x){let F=this.#U();for(let[h,B]of F.entries()){let{x:$,width:Z}=B;if(x>=$&&x<$+Z)return h}return-1}#N(x){if(x===this.#h)return;this.#h=x,this.dispatch("change",{value:this.#x[this.#h],label:String(this.#x[this.#h])})}}function j1(x){let F=new C1({...Jh(),...x});return u(F,_h,x??{},(h)=>{F.updateThemeColors(h)}),F}var G1,Uh;function zh(x){G1=x}function Y1(){if(!G1)throw Error("App not initialized");return G1}function Nh(x){Uh=x}function qh(){return Uh}var j=t1(g1(),1),L0=t1(g1(),1);import $x from"process";import J0 from"fs";import Bx from"path";import V3 from"fs";function F6(x){let F=V3.readFileSync(x,"utf-8"),h=JSON.parse(F);if(typeof h==="object"&&h!==null&&"version"in h){let{version:B}=h;if(typeof B==="string")return B}return}function O3(x){return Bx.resolve(import.meta.dir,"..","templates",x)}function h6(x,F,h){let B=J0.readdirSync(x,{withFileTypes:!0});for(let $ of B){let Z=Bx.join(x,$.name),Q=Bx.join(F,$.name);if($.isDirectory())J0.mkdirSync(Q,{recursive:!0}),h6(Z,Q,h);else{let J=J0.readFileSync(Z,"utf-8");for(let[N,K]of Object.entries(h))J=J.replaceAll(`{{${N}}}`,K);J0.writeFileSync(Q,J,"utf-8")}}}function B6(x,F,h="basic"){let B=Bx.resolve(F,x);if(J0.existsSync(B))throw Error(`Directory already exists: ${B}`);let $=O3(h);if(!J0.existsSync($))throw Error(`Template not found: ${h}`);J0.mkdirSync(B,{recursive:!0});let Z=F6(Bx.resolve(import.meta.dir,"..","package.json")),Q={name:x,version:Z??"latest"};try{h6($,B,Q)}catch(_){throw J0.rmSync(B,{recursive:!0,force:!0}),_}return B}function d1(x){if(J0.existsSync(x))J0.rmSync(x,{recursive:!0,force:!0})}import m3 from"process";import f3 from"fs";import S3 from"path";var T3=new Set(["con","prn","aux","nul","com1","com2","com3","com4","com5","com6","com7","com8","com9","lpt1","lpt2","lpt3","lpt4","lpt5","lpt6","lpt7","lpt8","lpt9"]),w3=/^(@[a-z\d][-a-z\d]*\/)?[a-z\d][-a-z\d_]*$/;function u1(x,F){let h=x.trim();if(!h)return"Project name is required";if(h.includes("..")||h.includes("/")||h.includes("\\"))return String.raw`Project name must not contain "..", "/", or "\"`;if(h.startsWith(".")||h.startsWith("-"))return"Project name must start with a letter or number";if(!w3.test(h))return"Project name must be a valid npm package name (lowercase, letters, digits, hyphens, underscores)";let $=h.split("/").at(-1)??h;if(m3.platform==="win32"&&T3.has($.toLowerCase()))return`"${$}" is a reserved name on Windows`;let Z=S3.resolve(F,h);if(f3.existsSync(Z))return`Directory already exists: ${h}`;return}function k3(x){let F=["basic","sfc","full"],h=["A minimal starting point with Box, Text, Button, and a clock demo.","SFC compiler + HMR hot reload + dev server setup.","All core widgets showcase with tabbed navigation and theme support."],B=L0.ref("Template"),$=L0.ref(qh()??"my-buntui-app"),Z=L0.ref(0),Q=L0.ref(!0),_=L0.ref(!1),J=L0.computed(()=>h[Z.value]??"");function N(){let l=$.value.trim(),Tx=u1(l,$x.cwd());if(Tx){b.logError(Tx);return}B.value="Features"}function K(){B.value="Template"}async function q(){if(_.value)return;let l=$.value.trim();if(u1(l,$x.cwd())){B.value="Template";return}let Z6=F[Z.value]??"basic";_.value=!0;let S0="";try{if(S0=B6(l,$x.cwd(),Z6),Q.value)await Bun.spawn(["git","init"],{cwd:S0,stdout:"ignore",stderr:"ignore"}).exited;let Qx=await Bun.spawn(["bun","install"],{cwd:S0,stdout:"inherit",stderr:"inherit"}).exited;if(Qx!==0){d1(S0),b.logError(`bun install failed (exit code ${Qx})`),_.value=!1;return}setTimeout(()=>{Y1().dispose(),$x.exit(0)},800)}catch(Zx){if(S0)d1(S0);let Qx=Zx instanceof Error?Zx.message:String(Zx);b.logError(Qx),_.value=!1}}function G(){Y1().dispose(),$x.exit(0)}let Y=N0({x:"25%",width:"50%",borderColor:"rgb(122, 162, 247)",borderStyle:"rounded",shadowColor:"rgb(10, 10, 18)",y:1,height:24,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,shadowOffsetX:2,shadowOffsetY:1});j.effect(()=>{Y.updateRect({y:1})}),j.effect(()=>{Y.updateRect({height:24})}),j.effect(()=>{Y.updatePadding({paddingTop:1})}),j.effect(()=>{Y.updatePadding({paddingBottom:1})}),j.effect(()=>{Y.updatePadding({paddingLeft:2})}),j.effect(()=>{Y.updatePadding({paddingRight:2})}),j.effect(()=>{Y.updateShadow({shadowOffsetX:2})}),j.effect(()=>{Y.updateShadow({shadowOffsetY:1})});let E=H0({width:"100%",value:"Create Buntui App",colorFg:"rgb(122, 162, 247)",styleModifier:"bold",height:1});j.effect(()=>{E.updateRect({height:1})}),Y.addChild(E);let H=j1({width:"100%",height:1,options:["Template","Features"],value:j.unref(B)});j.effect(()=>{H.updateRect({height:1})}),j.effect(()=>{H.setOptions(["Template","Features"])}),j.effect(()=>{H.updateValue(j.unref(B))}),H.on("change",(l)=>{B.value=l.value}),Y.addChild(H);let W=H0({width:"100%",overflow:"clip",height:1,value:"\u2500".repeat(40)});j.effect(()=>{W.updateRect({height:1})}),j.effect(()=>{W.updateValue("\u2500".repeat(40))}),Y.addChild(W);let I=null,P=null,R=null,L=null,X=null,M=null,i=null,g=null,s0=null;j.effect(()=>{if(j.unref(B)==="Template"){if(!I)I=N0({width:"100%",direction:"vertical",border:!1,gap:1}),P=J1({width:"100%",placeholder:"my-buntui-app",label:"Project name",value:j.unref($)}),R=H0({width:"100%",value:"Template:",height:1}),L=K1({width:"100%",height:3,options:["Basic","SFC","Full"],value:j.unref(Z)}),X=H0({width:"100%",overflow:"clip",height:1,value:j.unref(J)}),M=N0({width:"100%",direction:"horizontal",align:"center",height:3,border:!1,gap:2}),i=R0({value:"Next \u2192",colorFgNormal:"rgb(26, 27, 38)",colorBgNormal:"rgb(122, 162, 247)",borderColorNormal:"rgb(122, 162, 247)",borderStyleNormal:"rounded",colorFgFocused:"rgb(26, 27, 38)",colorBgFocused:"rgb(157, 122, 247)",borderColorFocused:"rgb(157, 122, 247)",borderStyleFocused:"rounded",colorFgPressed:"rgb(26, 27, 38)",colorBgPressed:"rgb(91, 110, 181)",borderColorPressed:"rgb(91, 110, 181)",borderStylePressed:"rounded",width:12,height:3}),g=R0({value:"Cancel",borderStyleNormal:"rounded",borderStyleFocused:"rounded",borderStylePressed:"rounded",width:12,height:3}),s0=H0({width:"100%",value:"Tab/\u2191\u2193 navigate \xB7 Enter next \xB7 Esc cancel",height:1}),I.addChild(P),I.addChild(R),I.addChild(L),I.addChild(X),I.addChild(M),M.addChild(i),M.addChild(g),I.addChild(s0),P.on("input",(l)=>{$.value=l.value}),P.on("submit",N),L.on("change",(l)=>{Z.value=l.value}),i.on("click",N),g.on("click",G),Y.addChild(I)}else if(I)Y.removeChild(I),I=null,P=null,R=null,L=null,X=null,M=null,i=null,g=null,s0=null}),j.effect(()=>{if(I)I.updateBorder({border:!1})}),j.effect(()=>{if(I)I.setGap(1)}),j.effect(()=>{if(P)P.updateValue(j.unref($))}),j.effect(()=>{if(R)R.updateRect({height:1})}),j.effect(()=>{if(L)L.updateRect({height:3})}),j.effect(()=>{if(L)L.setOptions(["Basic","SFC","Full"])}),j.effect(()=>{if(L)L.updateValue(j.unref(Z))}),j.effect(()=>{if(X)X.updateRect({height:1})}),j.effect(()=>{if(X)X.updateValue(j.unref(J))}),j.effect(()=>{if(M)M.updateRect({height:3})}),j.effect(()=>{if(M)M.updateBorder({border:!1})}),j.effect(()=>{if(M)M.setGap(2)}),j.effect(()=>{if(i)i.updateRect({width:12})}),j.effect(()=>{if(i)i.updateRect({height:3})}),j.effect(()=>{if(g)g.updateRect({width:12})}),j.effect(()=>{if(g)g.updateRect({height:3})}),j.effect(()=>{if(s0)s0.updateRect({height:1})});let d=null,G0=null,r=null,Y0=null,X0=null,I0=null,t0=null;return j.effect(()=>{if(j.unref(B)==="Features"){if(!d)d=N0({width:"100%",direction:"vertical",border:!1,gap:1,paddingTop:1}),G0=N1({width:"100%",label:"Initialize git repository",height:1,checked:j.unref(Q)}),r=N0({width:"100%",direction:"horizontal",align:"center",height:3,border:!1,gap:2}),Y0=R0({value:"\u2190 Back",borderStyleNormal:"rounded",borderStyleFocused:"rounded",borderStylePressed:"rounded",width:12,height:3}),X0=R0({value:"Create",colorFgNormal:"rgb(26, 27, 38)",colorBgNormal:"rgb(122, 162, 247)",borderColorNormal:"rgb(122, 162, 247)",borderStyleNormal:"rounded",colorFgFocused:"rgb(26, 27, 38)",colorBgFocused:"rgb(157, 122, 247)",borderColorFocused:"rgb(157, 122, 247)",borderStyleFocused:"rounded",colorFgPressed:"rgb(26, 27, 38)",colorBgPressed:"rgb(91, 110, 181)",borderColorPressed:"rgb(91, 110, 181)",borderStylePressed:"rounded",width:12,height:3}),I0=R0({value:"Cancel",borderStyleNormal:"rounded",borderStyleFocused:"rounded",borderStylePressed:"rounded",width:12,height:3}),t0=H0({width:"100%",value:"Tab navigate \xB7 Space toggle \xB7 Esc back",height:1}),d.addChild(G0),d.addChild(r),r.addChild(Y0),r.addChild(X0),r.addChild(I0),d.addChild(t0),G0.on("change",(l)=>{Q.value=l.checked}),Y0.on("click",K),X0.on("click",q),I0.on("click",G),Y.addChild(d)}else if(d)Y.removeChild(d),d=null,G0=null,r=null,Y0=null,X0=null,I0=null,t0=null}),j.effect(()=>{if(d)d.updateBorder({border:!1})}),j.effect(()=>{if(d)d.setGap(1)}),j.effect(()=>{if(d)d.updatePadding({paddingTop:1})}),j.effect(()=>{if(G0)G0.updateRect({height:1})}),j.effect(()=>{if(G0)G0.setChecked(j.unref(Q))}),j.effect(()=>{if(r)r.updateRect({height:3})}),j.effect(()=>{if(r)r.updateBorder({border:!1})}),j.effect(()=>{if(r)r.setGap(2)}),j.effect(()=>{if(Y0)Y0.updateRect({width:12})}),j.effect(()=>{if(Y0)Y0.updateRect({height:3})}),j.effect(()=>{if(X0)X0.updateRect({width:12})}),j.effect(()=>{if(X0)X0.updateRect({height:3})}),j.effect(()=>{if(I0)I0.updateRect({width:12})}),j.effect(()=>{if(I0)I0.updateRect({height:3})}),j.effect(()=>{if(t0)t0.updateRect({height:1})}),x.mount(Y),()=>{x.unmount(Y)}}var $6={setup:k3};var c3=n1.argv.slice(2),i3=c3[0];n1.on("SIGINT",()=>{n1.exit(0)});var y1=Z1({logLevel:"info",clearLog:!0});zh(y1);Nh(i3);y1.createScene($6,{visible:!0});y1.start();
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import {compile, CORE_REGISTRY} from '@buntui/compiler';
|
|
5
|
-
import {getBinaryPath} from '@buntui/native';
|
|
6
|
-
|
|
7
|
-
const result = await Bun.build({
|
|
8
|
-
entrypoints: ['src/main.ts'],
|
|
9
|
-
outdir: 'dist',
|
|
10
|
-
target: 'bun',
|
|
11
|
-
minify: true,
|
|
12
|
-
plugins: [
|
|
13
|
-
{
|
|
14
|
-
name: 'buntui-vue',
|
|
15
|
-
setup(build) {
|
|
16
|
-
build.onLoad({filter: /\.vue$/v}, async args => {
|
|
17
|
-
const source = await Bun.file(args.path).text();
|
|
18
|
-
const compiled = compile(source, {
|
|
19
|
-
filename: args.path,
|
|
20
|
-
registry: CORE_REGISTRY,
|
|
21
|
-
codegen: {
|
|
22
|
-
coreModuleId: '@buntui/core',
|
|
23
|
-
reactivityModuleId: '@vue/reactivity',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return {contents: compiled.code, loader: 'ts'};
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
if (!result.success) {
|
|
34
|
-
for (const error of result.logs) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
}
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
for (const output of result.outputs) {
|
|
41
|
-
console.log(`Built: ${output.path} (${(output.size / 1024).toFixed(1)} KB)`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function getBinaryExt(): string {
|
|
45
|
-
if (process.platform === 'win32') return 'dll';
|
|
46
|
-
if (process.platform === 'darwin') return 'dylib';
|
|
47
|
-
return 'so';
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const binaryName = `buntui.${getBinaryExt()}`;
|
|
51
|
-
const nativePath = getBinaryPath();
|
|
52
|
-
const dllSearchPaths = [
|
|
53
|
-
...(nativePath ? [nativePath] : []),
|
|
54
|
-
path.resolve(import.meta.dir, '..', 'node_modules', '@buntui', 'core', binaryName),
|
|
55
|
-
path.resolve(import.meta.dir, '..', binaryName),
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
for (const candidate of dllSearchPaths) {
|
|
59
|
-
if (fs.existsSync(candidate)) {
|
|
60
|
-
const dest = path.resolve(import.meta.dir, '..', 'dist', binaryName);
|
|
61
|
-
fs.copyFileSync(candidate, dest);
|
|
62
|
-
console.log(`Copied: ${binaryName} -> dist/`);
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import {createDevServer, CORE_REGISTRY, type DevServerOptions} from '@buntui/compiler';
|
|
3
|
-
import {ENTRY, run} from './main';
|
|
4
|
-
|
|
5
|
-
const {scene} = run();
|
|
6
|
-
|
|
7
|
-
const VUE_FILE = path.join(import.meta.dir, ENTRY);
|
|
8
|
-
|
|
9
|
-
createDevServer({
|
|
10
|
-
file: VUE_FILE,
|
|
11
|
-
compileOptions: {
|
|
12
|
-
registry: CORE_REGISTRY,
|
|
13
|
-
codegen: {
|
|
14
|
-
coreModuleId: '@buntui/core',
|
|
15
|
-
reactivityModuleId: '@vue/reactivity',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
onClear() {
|
|
19
|
-
scene.clearWidgets();
|
|
20
|
-
},
|
|
21
|
-
onReload(setupFn: (scene: unknown) => void) {
|
|
22
|
-
setupFn(scene);
|
|
23
|
-
},
|
|
24
|
-
onError(error: Error) {
|
|
25
|
-
console.error('[HMR]', error);
|
|
26
|
-
},
|
|
27
|
-
} satisfies DevServerOptions);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {createApp} from '@buntui/core';
|
|
2
|
-
import App from './App.vue';
|
|
3
|
-
|
|
4
|
-
export const ENTRY = 'App.vue';
|
|
5
|
-
|
|
6
|
-
export function run() {
|
|
7
|
-
const app = createApp({logLevel: 'info', clearLog: true, tickRate: 120, renderRate: 60});
|
|
8
|
-
const scene = app.createScene(App, {bgHexRgb: 0x1A_1B_26, visible: true});
|
|
9
|
-
app.start();
|
|
10
|
-
return {app, scene};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (import.meta.main) {
|
|
14
|
-
run();
|
|
15
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import {compile, CORE_REGISTRY} from '@buntui/compiler';
|
|
5
|
-
import {getBinaryPath} from '@buntui/native';
|
|
6
|
-
|
|
7
|
-
const result = await Bun.build({
|
|
8
|
-
entrypoints: ['src/main.ts'],
|
|
9
|
-
outdir: 'dist',
|
|
10
|
-
target: 'bun',
|
|
11
|
-
minify: true,
|
|
12
|
-
plugins: [
|
|
13
|
-
{
|
|
14
|
-
name: 'buntui-vue',
|
|
15
|
-
setup(build) {
|
|
16
|
-
build.onLoad({filter: /\.vue$/v}, async args => {
|
|
17
|
-
const source = await Bun.file(args.path).text();
|
|
18
|
-
const compiled = compile(source, {
|
|
19
|
-
filename: args.path,
|
|
20
|
-
registry: CORE_REGISTRY,
|
|
21
|
-
codegen: {
|
|
22
|
-
coreModuleId: '@buntui/core',
|
|
23
|
-
reactivityModuleId: '@vue/reactivity',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return {contents: compiled.code, loader: 'ts'};
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
if (!result.success) {
|
|
34
|
-
for (const error of result.logs) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
for (const output of result.outputs) {
|
|
42
|
-
console.log(`Built: ${output.path} (${(output.size / 1024).toFixed(1)} KB)`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getBinaryExt(): string {
|
|
46
|
-
if (process.platform === 'win32') return 'dll';
|
|
47
|
-
if (process.platform === 'darwin') return 'dylib';
|
|
48
|
-
return 'so';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const binaryName = `buntui.${getBinaryExt()}`;
|
|
52
|
-
const nativePath = getBinaryPath();
|
|
53
|
-
const dllSearchPaths = [
|
|
54
|
-
...(nativePath ? [nativePath] : []),
|
|
55
|
-
path.resolve(import.meta.dir, '..', 'node_modules', '@buntui', 'core', binaryName),
|
|
56
|
-
path.resolve(import.meta.dir, '..', binaryName),
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
for (const candidate of dllSearchPaths) {
|
|
60
|
-
if (fs.existsSync(candidate)) {
|
|
61
|
-
const dest = path.resolve(import.meta.dir, '..', 'dist', binaryName);
|
|
62
|
-
fs.copyFileSync(candidate, dest);
|
|
63
|
-
console.log(`Copied: ${binaryName} -> dist/`);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import {createDevServer, CORE_REGISTRY, type DevServerOptions} from '@buntui/compiler';
|
|
4
|
-
import {mountHmrErrorOverlay, type HmrErrorOverlayHandle} from '@buntui/extensions/hmr-error-overlay';
|
|
5
|
-
import {ENTRY, run} from './main';
|
|
6
|
-
|
|
7
|
-
const DEV_DIR = path.join(import.meta.dir, '.dev');
|
|
8
|
-
fs.mkdirSync(DEV_DIR, {recursive: true});
|
|
9
|
-
|
|
10
|
-
const {scene} = run({logFilePath: DEV_DIR});
|
|
11
|
-
|
|
12
|
-
const VUE_FILE = path.join(import.meta.dir, ENTRY);
|
|
13
|
-
|
|
14
|
-
let errorOverlay: HmrErrorOverlayHandle | undefined;
|
|
15
|
-
|
|
16
|
-
createDevServer({
|
|
17
|
-
file: VUE_FILE,
|
|
18
|
-
tempDir: DEV_DIR,
|
|
19
|
-
compileOptions: {
|
|
20
|
-
registry: CORE_REGISTRY,
|
|
21
|
-
codegen: {
|
|
22
|
-
coreModuleId: '@buntui/core',
|
|
23
|
-
reactivityModuleId: '@vue/reactivity',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
onClear() {
|
|
27
|
-
errorOverlay?.dismiss();
|
|
28
|
-
errorOverlay = undefined;
|
|
29
|
-
scene.clearWidgets();
|
|
30
|
-
},
|
|
31
|
-
onReload(setupFn: (scene: unknown) => void) {
|
|
32
|
-
errorOverlay?.dismiss();
|
|
33
|
-
errorOverlay = undefined;
|
|
34
|
-
setupFn(scene);
|
|
35
|
-
},
|
|
36
|
-
onError(error: Error) {
|
|
37
|
-
errorOverlay?.dismiss();
|
|
38
|
-
errorOverlay = mountHmrErrorOverlay(scene, error);
|
|
39
|
-
},
|
|
40
|
-
} satisfies DevServerOptions);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {createApp} from '@buntui/core';
|
|
2
|
-
import App from './App.vue';
|
|
3
|
-
|
|
4
|
-
export const ENTRY = 'App.vue';
|
|
5
|
-
|
|
6
|
-
export function run(devOptions: {logFilePath?: string} = {}) {
|
|
7
|
-
const app = createApp({
|
|
8
|
-
logLevel: 'info',
|
|
9
|
-
clearLog: true,
|
|
10
|
-
tickRate: 60,
|
|
11
|
-
renderRate: 24,
|
|
12
|
-
...devOptions,
|
|
13
|
-
});
|
|
14
|
-
const scene = app.createScene(App, {bgHexRgb: 0x1A_1B_26, visible: true});
|
|
15
|
-
app.start();
|
|
16
|
-
return {app, scene};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (import.meta.main) {
|
|
20
|
-
run();
|
|
21
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import {compile, CORE_REGISTRY} from '@buntui/compiler';
|
|
5
|
-
import {getBinaryPath} from '@buntui/native';
|
|
6
|
-
|
|
7
|
-
const result = await Bun.build({
|
|
8
|
-
entrypoints: ['src/main.ts'],
|
|
9
|
-
outdir: 'dist',
|
|
10
|
-
target: 'bun',
|
|
11
|
-
minify: true,
|
|
12
|
-
plugins: [
|
|
13
|
-
{
|
|
14
|
-
name: 'buntui-vue',
|
|
15
|
-
setup(build) {
|
|
16
|
-
build.onLoad({filter: /\.vue$/v}, async args => {
|
|
17
|
-
const source = await Bun.file(args.path).text();
|
|
18
|
-
const compiled = compile(source, {
|
|
19
|
-
filename: args.path,
|
|
20
|
-
registry: CORE_REGISTRY,
|
|
21
|
-
codegen: {
|
|
22
|
-
coreModuleId: '@buntui/core',
|
|
23
|
-
reactivityModuleId: '@vue/reactivity',
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return {contents: compiled.code, loader: 'ts'};
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
if (!result.success) {
|
|
34
|
-
for (const error of result.logs) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
for (const output of result.outputs) {
|
|
42
|
-
console.log(`Built: ${output.path} (${(output.size / 1024).toFixed(1)} KB)`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getBinaryExt(): string {
|
|
46
|
-
if (process.platform === 'win32') return 'dll';
|
|
47
|
-
if (process.platform === 'darwin') return 'dylib';
|
|
48
|
-
return 'so';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const binaryName = `buntui.${getBinaryExt()}`;
|
|
52
|
-
const nativePath = getBinaryPath();
|
|
53
|
-
const dllSearchPaths = [
|
|
54
|
-
...(nativePath ? [nativePath] : []),
|
|
55
|
-
path.resolve(import.meta.dir, '..', 'node_modules', '@buntui', 'core', binaryName),
|
|
56
|
-
path.resolve(import.meta.dir, '..', binaryName),
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
for (const candidate of dllSearchPaths) {
|
|
60
|
-
if (fs.existsSync(candidate)) {
|
|
61
|
-
const dest = path.resolve(import.meta.dir, '..', 'dist', binaryName);
|
|
62
|
-
fs.copyFileSync(candidate, dest);
|
|
63
|
-
console.log(`Copied: ${binaryName} -> dist/`);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|