@kitn.ai/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/bin/kai.js +160 -0
- package/bin/route.js +61 -0
- package/dist/assets/dev-C27Rnkul.js +668 -0
- package/dist/builder-page/assets/index-2uphF31h.js +72 -0
- package/dist/builder-page/assets/index-CMlatin-.css +1 -0
- package/dist/builder-page/index.html +20 -0
- package/dist/construct-cli.es.js +3128 -0
- package/dist/doctor.es.js +193 -0
- package/dist/theme-studio/assets/index-C4nWp3LE.js +538 -0
- package/dist/theme-studio/assets/index-CAlkHn6J.css +1 -0
- package/dist/theme-studio/index.html +17 -0
- package/package.json +74 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();const ve={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return zo(this.context.count)},getNextContextId(){return zo(this.context.count++)}};function zo(e){const t=String(e),n=t.length-1;return ve.context.id+(n?String.fromCharCode(96+n):"")+t}function ma(e){ve.context=e}const pa=!1,va=(e,t)=>e===t,Ve=Symbol("solid-proxy"),Hi=typeof Proxy=="function",qn=Symbol("solid-track"),Gn={equals:va};let Wi=Gi;const vt=1,Yn=2,Ki={owned:null,cleanups:null,context:null,owner:null};var le=null;let Or=null,ba=null,he=null,ze=null,st=null,hr=0;function Ft(e,t){const n=he,r=le,o=e.length===0,i=t===void 0?r:t,s=o?Ki:{owned:null,cleanups:null,context:i?i.context:null,owner:i},a=o?e:()=>e(()=>Ne(()=>yn(s)));le=s,he=null;try{return Tt(a,!0)}finally{he=n,le=r}}function J(e,t){t=t?Object.assign({},Gn,t):Gn;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=o=>(typeof o=="function"&&(o=o(n.value)),qi(n,o));return[Ji.bind(n),r]}function U(e,t,n){const r=eo(e,t,!1,vt);Cn(r)}function Oe(e,t,n){Wi=Aa;const r=eo(e,t,!1,vt);(!n||!n.render)&&(r.user=!0),st?st.push(r):Cn(r)}function je(e,t,n){n=n?Object.assign({},Gn,n):Gn;const r=eo(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Cn(r),Ji.bind(r)}function wa(e){return Tt(e,!1)}function Ne(e){if(he===null)return e();const t=he;he=null;try{return e()}finally{he=t}}function wn(e,t,n){const r=Array.isArray(e);let o,i=n&&n.defer;return s=>{let a;if(r){a=Array(e.length);for(let u=0;u<e.length;u++)a[u]=e[u]()}else a=e();if(i)return i=!1,s;const l=Ne(()=>t(a,o,s));return o=a,l}}function Co(e){Oe(()=>Ne(e))}function Pe(e){return le===null||(le.cleanups===null?le.cleanups=[e]:le.cleanups.push(e)),e}function jr(){return he}function Eo(){return le}function ya(e,t){const n=le,r=he;le=e,he=null;try{return Tt(t,!0)}catch(o){to(o)}finally{le=n,he=r}}function xa(e,t){const n=Symbol("context");return{id:n,Provider:Ca(n),defaultValue:e}}function ka(e){let t;return le&&le.context&&(t=le.context[e.id])!==void 0?t:e.defaultValue}function _a(e){const t=je(e),n=je(()=>Zr(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function Ji(){if(this.sources&&this.state)if(this.state===vt)Cn(this);else{const e=ze;ze=null,Tt(()=>Qn(this),!1),ze=e}if(he){const e=this.observers;if(!e||e[e.length-1]!==he){const t=e?e.length:0;he.sources?(he.sources.push(this),he.sourceSlots.push(t)):(he.sources=[this],he.sourceSlots=[t]),e?(e.push(he),this.observerSlots.push(he.sources.length-1)):(this.observers=[he],this.observerSlots=[he.sources.length-1])}}return this.value}function qi(e,t,n){let r=e.value;return(!e.comparator||!e.comparator(r,t))&&(e.value=t,e.observers&&e.observers.length&&Tt(()=>{for(let o=0;o<e.observers.length;o+=1){const i=e.observers[o],s=Or&&Or.running;s&&Or.disposed.has(i),(s?!i.tState:!i.state)&&(i.pure?ze.push(i):st.push(i),i.observers&&Yi(i)),s||(i.state=vt)}if(ze.length>1e6)throw ze=[],new Error},!1)),t}function Cn(e){if(!e.fn)return;yn(e);const t=hr;$a(e,e.value,t)}function $a(e,t,n){let r;const o=le,i=he;he=le=e;try{r=e.fn(t)}catch(s){return e.pure&&(e.state=vt,e.owned&&e.owned.forEach(yn),e.owned=null),e.updatedAt=n+1,to(s)}finally{he=i,le=o}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?qi(e,r):e.value=r,e.updatedAt=n)}function eo(e,t,n,r=vt,o){const i={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:le,context:le?le.context:null,pure:n};return le===null||le!==Ki&&(le.owned?le.owned.push(i):le.owned=[i]),i}function Xn(e){if(e.state===0)return;if(e.state===Yn)return Qn(e);if(e.suspense&&Ne(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<hr);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===vt)Cn(e);else if(e.state===Yn){const r=ze;ze=null,Tt(()=>Qn(e,t[0]),!1),ze=r}}function Tt(e,t){if(ze)return e();let n=!1;t||(ze=[]),st?n=!0:st=[],hr++;try{const r=e();return Sa(n),r}catch(r){n||(st=null),ze=null,to(r)}}function Sa(e){if(ze&&(Gi(ze),ze=null),e)return;const t=st;st=null,t.length&&Tt(()=>Wi(t),!1)}function Gi(e){for(let t=0;t<e.length;t++)Xn(e[t])}function Aa(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:Xn(r)}if(ve.context){if(ve.count){ve.effects||(ve.effects=[]),ve.effects.push(...e.slice(0,n));return}ma()}for(ve.effects&&!ve.count&&(e=[...ve.effects,...e],n+=ve.effects.length,delete ve.effects),t=0;t<n;t++)Xn(e[t])}function Qn(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const r=e.sources[n];if(r.sources){const o=r.state;o===vt?r!==t&&(!r.updatedAt||r.updatedAt<hr)&&Xn(r):o===Yn&&Qn(r,t)}}}function Yi(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Yn,n.pure?ze.push(n):st.push(n),n.observers&&Yi(n))}}function yn(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),o=n.observers;if(o&&o.length){const i=o.pop(),s=n.observerSlots.pop();r<o.length&&(i.sourceSlots[s]=r,o[r]=i,n.observerSlots[r]=s)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)yn(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)yn(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function za(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function to(e,t=le){throw za(e)}function Zr(e){if(typeof e=="function"&&!e.length)return Zr(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=Zr(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let o=0;o<r.length;o++)t.push(r[o]);else t.push(r)}return t}return e}function Ca(e,t){return function(r){let o;return U(()=>o=Ne(()=>(le.context={...le.context,[e]:r.value},_a(()=>r.children))),void 0),o}}const Ea=Symbol("fallback");function Oo(e){for(let t=0;t<e.length;t++)e[t]()}function Oa(e,t,n={}){let r=[],o=[],i=[],s=0,a=t.length>1?[]:null;return Pe(()=>Oo(i)),()=>{let l=e()||[],u=l.length,d,c;return l[qn],Ne(()=>{let h,p,v,b,y,z,k,T,D;if(u===0)s!==0&&(Oo(i),i=[],r=[],o=[],s=0,a&&(a=[])),n.fallback&&(r=[Ea],o[0]=Ft(E=>(i[0]=E,n.fallback())),s=1);else if(s===0){for(o=new Array(u),c=0;c<u;c++)r[c]=l[c],o[c]=Ft(f);s=u}else{for(v=new Array(u),b=new Array(u),a&&(y=new Array(u)),z=0,k=Math.min(s,u);z<k&&r[z]===l[z];z++);for(k=s-1,T=u-1;k>=z&&T>=z&&r[k]===l[T];k--,T--)v[T]=o[k],b[T]=i[k],a&&(y[T]=a[k]);for(h=new Map,p=new Array(T+1),c=T;c>=z;c--)D=l[c],d=h.get(D),p[c]=d===void 0?-1:d,h.set(D,c);for(d=z;d<=k;d++)D=r[d],c=h.get(D),c!==void 0&&c!==-1?(v[c]=o[d],b[c]=i[d],a&&(y[c]=a[d]),c=p[c],h.set(D,c)):i[d]();for(c=z;c<u;c++)c in v?(o[c]=v[c],i[c]=b[c],a&&(a[c]=y[c],a[c](c))):o[c]=Ft(f);o=o.slice(0,s=u),r=l.slice(0)}return o});function f(h){if(i[c]=h,a){const[p,v]=J(c);return a[c]=v,t(l[c],p)}return t(l[c])}}}function g(e,t){return Ne(()=>e(t||{}))}function Zn(){return!0}const Mr={get(e,t,n){return t===Ve?n:e.get(t)},has(e,t){return t===Ve?!0:e.has(t)},set:Zn,deleteProperty:Zn,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Zn,deleteProperty:Zn}},ownKeys(e){return e.keys()}};function Tr(e){return(e=typeof e=="function"?e():e)?e:{}}function Ta(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function oe(...e){let t=!1;for(let s=0;s<e.length;s++){const a=e[s];t=t||!!a&&Ve in a,e[s]=typeof a=="function"?(t=!0,je(a)):a}if(Hi&&t)return new Proxy({get(s){for(let a=e.length-1;a>=0;a--){const l=Tr(e[a])[s];if(l!==void 0)return l}},has(s){for(let a=e.length-1;a>=0;a--)if(s in Tr(e[a]))return!0;return!1},keys(){const s=[];for(let a=0;a<e.length;a++)s.push(...Object.keys(Tr(e[a])));return[...new Set(s)]}},Mr);const n={},r=Object.create(null);for(let s=e.length-1;s>=0;s--){const a=e[s];if(!a)continue;const l=Object.getOwnPropertyNames(a);for(let u=l.length-1;u>=0;u--){const d=l[u];if(d==="__proto__"||d==="constructor")continue;const c=Object.getOwnPropertyDescriptor(a,d);if(!r[d])r[d]=c.get?{enumerable:!0,configurable:!0,get:Ta.bind(n[d]=[c.get.bind(a)])}:c.value!==void 0?c:void 0;else{const f=n[d];f&&(c.get?f.push(c.get.bind(a)):c.value!==void 0&&f.push(()=>c.value))}}}const o={},i=Object.keys(r);for(let s=i.length-1;s>=0;s--){const a=i[s],l=r[a];l&&l.get?Object.defineProperty(o,a,l):o[a]=l?l.value:void 0}return o}function He(e,...t){const n=t.length;if(Hi&&Ve in e){const o=n>1?t.flat():t[0],i=t.map(s=>new Proxy({get(a){return s.includes(a)?e[a]:void 0},has(a){return s.includes(a)&&a in e},keys(){return s.filter(a=>a in e)}},Mr));return i.push(new Proxy({get(s){return o.includes(s)?void 0:e[s]},has(s){return o.includes(s)?!1:s in e},keys(){return Object.keys(e).filter(s=>!o.includes(s))}},Mr)),i}const r=[];for(let o=0;o<=n;o++)r[o]={};for(const o of Object.getOwnPropertyNames(e)){let i=n;for(let l=0;l<t.length;l++)if(t[l].includes(o)){i=l;break}const s=Object.getOwnPropertyDescriptor(e,o);!s.get&&!s.set&&s.enumerable&&s.writable&&s.configurable?r[i][o]=s.value:Object.defineProperty(r[i],o,s)}return r}let Pa=0;function Ie(){return ve.context?ve.getNextContextId():`cl-${Pa++}`}const Ia=e=>`Stale read from <${e}>.`;function ke(e){const t="fallback"in e&&{fallback:()=>e.fallback};return je(Oa(()=>e.each,e.children,t||void 0))}function Z(e){const t=e.keyed,n=je(()=>e.when,void 0,void 0),r=t?n:je(n,void 0,{equals:(o,i)=>!o==!i});return je(()=>{const o=r();if(o){const i=e.children;return typeof i=="function"&&i.length>0?Ne(()=>i(t?o:()=>{if(!Ne(r))throw Ia("Show");return n()})):i}return e.fallback},void 0,void 0)}const Ra=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],Na=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...Ra]),Da=new Set(["innerHTML","textContent","innerText","children"]),La=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ja=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function Za(e,t){const n=ja[e];return typeof n=="object"?n[t]?n.$:void 0:n}const Ma=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Fa=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","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","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Ua={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Re=e=>je(()=>e());function Ba(e,t,n){let r=n.length,o=t.length,i=r,s=0,a=0,l=t[o-1].nextSibling,u=null;for(;s<o||a<i;){if(t[s]===n[a]){s++,a++;continue}for(;t[o-1]===n[i-1];)o--,i--;if(o===s){const d=i<r?a?n[a-1].nextSibling:n[i-a]:l;for(;a<i;)e.insertBefore(n[a++],d)}else if(i===a)for(;s<o;)(!u||!u.has(t[s]))&&t[s].remove(),s++;else if(t[s]===n[i-1]&&n[a]===t[o-1]){const d=t[--o].nextSibling;e.insertBefore(n[a++],t[s++].nextSibling),e.insertBefore(n[--i],d),t[o]=n[i]}else{if(!u){u=new Map;let c=a;for(;c<i;)u.set(n[c],c++)}const d=u.get(t[s]);if(d!=null)if(a<d&&d<i){let c=s,f=1,h;for(;++c<o&&c<i&&!((h=u.get(t[c]))==null||h!==d+f);)f++;if(f>d-a){const p=t[s];for(;a<d;)e.insertBefore(n[a++],p)}else e.replaceChild(n[a++],t[s++])}else s++;else t[s++].remove()}}}const To="_$DX_DELEGATE";function Va(e,t,n,r={}){let o;return Ft(i=>{o=i,t===document?e():m(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{o(),t.textContent=""}}function x(e,t,n,r){let o;const i=()=>{const a=r?document.createElementNS("http://www.w3.org/1998/Math/MathML","template"):document.createElement("template");return a.innerHTML=e,n?a.content.firstChild.firstChild:r?a.firstChild:a.content.firstChild},s=t?()=>Ne(()=>document.importNode(o||(o=i()),!0)):()=>(o||(o=i())).cloneNode(!0);return s.cloneNode=s,s}function bt(e,t=window.document){const n=t[To]||(t[To]=new Set);for(let r=0,o=e.length;r<o;r++){const i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,Ya))}}function j(e,t,n){Pt(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Ha(e,t,n,r){Pt(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function Wa(e,t,n){Pt(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function ue(e,t){Pt(e)||(t==null?e.removeAttribute("class"):e.className=t)}function no(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const o=n[0];e.addEventListener(t,n[0]=i=>o.call(e,n[1],i))}else e.addEventListener(t,n,typeof n!="function"&&n)}function Ka(e,t,n={}){const r=Object.keys(t||{}),o=Object.keys(n);let i,s;for(i=0,s=o.length;i<s;i++){const a=o[i];!a||a==="undefined"||t[a]||(Po(e,a,!1),delete n[a])}for(i=0,s=r.length;i<s;i++){const a=r[i],l=!!t[a];!a||a==="undefined"||n[a]===l||!l||(Po(e,a,!0),n[a]=l)}return n}function P(e,t,n){if(!t)return n?j(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let o,i;for(i in n)t[i]==null&&r.removeProperty(i),delete n[i];for(i in t)o=t[i],o!==n[i]&&(r.setProperty(i,o),n[i]=o);return n}function At(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function ct(e,t={},n,r){const o={};return r||U(()=>o.children=xn(e,t.children,o.children)),U(()=>typeof t.ref=="function"&&Qe(t.ref,e)),U(()=>Ja(e,t,n,!0,o,!0)),o}function Qe(e,t,n){return Ne(()=>e(t,n))}function m(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return xn(e,t,r,n);U(o=>xn(e,t(),o,n),r)}function Ja(e,t,n,r,o={},i=!1){t||(t={});for(const s in o)if(!(s in t)){if(s==="children")continue;o[s]=Io(e,s,null,o[s],n,i,t)}for(const s in t){if(s==="children")continue;const a=t[s];o[s]=Io(e,s,a,o[s],n,i,t)}}function qa(e){let t,n;return!Pt()||!(t=ve.registry.get(n=Xa()))?e():(ve.completed&&ve.completed.add(t),ve.registry.delete(n),t)}function Pt(e){return!!ve.context&&!0&&(!e||e.isConnected)}function Ga(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Po(e,t,n){const r=t.trim().split(/\s+/);for(let o=0,i=r.length;o<i;o++)e.classList.toggle(r[o],n)}function Io(e,t,n,r,o,i,s){let a,l,u,d,c;if(t==="style")return P(e,n,r);if(t==="classList")return Ka(e,n,r);if(n===r)return r;if(t==="ref")i||n(e);else if(t.slice(0,3)==="on:"){const f=t.slice(3);r&&e.removeEventListener(f,r,typeof r!="function"&&r),n&&e.addEventListener(f,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const f=t.slice(10);r&&e.removeEventListener(f,r,!0),n&&e.addEventListener(f,n,!0)}else if(t.slice(0,2)==="on"){const f=t.slice(2).toLowerCase(),h=Ma.has(f);if(!h&&r){const p=Array.isArray(r)?r[0]:r;e.removeEventListener(f,p)}(h||n)&&(no(e,f,n,h),h&&bt([f]))}else if(t.slice(0,5)==="attr:")j(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Wa(e,t.slice(5),n);else if((c=t.slice(0,5)==="prop:")||(u=Da.has(t))||!o&&((d=Za(t,e.tagName))||(l=Na.has(t)))||(a=e.nodeName.includes("-")||"is"in s)){if(c)t=t.slice(5),l=!0;else if(Pt(e))return n;t==="class"||t==="className"?ue(e,n):a&&!l&&!u?e[Ga(t)]=n:e[d||t]=n}else{const f=o&&t.indexOf(":")>-1&&Ua[t.split(":")[0]];f?Ha(e,f,t,n):j(e,La[t]||t,n)}return n}function Ya(e){let t=e.target;const n=`$$${e.type}`,r=e.target,o=e.currentTarget,i=l=>Object.defineProperty(e,"target",{configurable:!0,value:l}),s=()=>{const l=t[n];if(l&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?l.call(t,u,e):l.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},a=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),e.composedPath){const l=e.composedPath();i(l[0]);for(let u=0;u<l.length-2&&(t=l[u],!!s());u++){if(t._$host){t=t._$host,a();break}if(t.parentNode===o)break}}else a();i(r)}function xn(e,t,n,r,o){const i=Pt(e);if(i){!n&&(n=[...e.childNodes]);let l=[];for(let u=0;u<n.length;u++){const d=n[u];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():l.push(d)}n=l}for(;typeof n=="function";)n=n();if(t===n)return n;const s=typeof t,a=r!==void 0;if(e=a&&n[0]&&n[0].parentNode||e,s==="string"||s==="number"){if(i||s==="number"&&(t=t.toString(),t===n))return n;if(a){let l=n[0];l&&l.nodeType===3?l.data!==t&&(l.data=t):l=document.createTextNode(t),n=Dt(e,n,r,l)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||s==="boolean"){if(i)return n;n=Dt(e,n,r)}else{if(s==="function")return U(()=>{let l=t();for(;typeof l=="function";)l=l();n=xn(e,l,n,r)}),()=>n;if(Array.isArray(t)){const l=[],u=n&&Array.isArray(n);if(Fr(l,t,n,o))return U(()=>n=xn(e,l,n,r,!0)),()=>n;if(i){if(!l.length)return n;if(r===void 0)return n=[...e.childNodes];let d=l[0];if(d.parentNode!==e)return n;const c=[d];for(;(d=d.nextSibling)!==r;)c.push(d);return n=c}if(l.length===0){if(n=Dt(e,n,r),a)return n}else u?n.length===0?Ro(e,l,r):Ba(e,n,l):(n&&Dt(e),Ro(e,l));n=l}else if(t.nodeType){if(i&&t.parentNode)return n=a?[t]:t;if(Array.isArray(n)){if(a)return n=Dt(e,n,r,t);Dt(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function Fr(e,t,n,r){let o=!1;for(let i=0,s=t.length;i<s;i++){let a=t[i],l=n&&n[e.length],u;if(!(a==null||a===!0||a===!1))if((u=typeof a)=="object"&&a.nodeType)e.push(a);else if(Array.isArray(a))o=Fr(e,a,l)||o;else if(u==="function")if(r){for(;typeof a=="function";)a=a();o=Fr(e,Array.isArray(a)?a:[a],Array.isArray(l)?l:[l])||o}else e.push(a),o=!0;else{const d=String(a);l&&l.nodeType===3&&l.data===d?e.push(l):e.push(document.createTextNode(d))}}return o}function Ro(e,t,n=null){for(let r=0,o=t.length;r<o;r++)e.insertBefore(t[r],n)}function Dt(e,t,n,r){if(n===void 0)return e.textContent="";const o=r||document.createTextNode("");if(t.length){let i=!1;for(let s=t.length-1;s>=0;s--){const a=t[s];if(o!==a){const l=a.parentNode===e;!i&&!s?l?e.replaceChild(o,a):e.insertBefore(o,n):l&&a.remove()}else i=!0}}else e.insertBefore(o,n);return[o]}function Xa(){return ve.getNextContextId()}const Qa="http://www.w3.org/2000/svg";function Xi(e,t=!1,n=void 0){return t?document.createElementNS(Qa,e):document.createElement(e,{is:n})}function Qi(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,o=Eo();let i,s=!!ve.context;return Oe(()=>{s&&(Eo().user=s=!1),i||(i=ya(o,()=>je(()=>e.children)));const a=r();if(a instanceof HTMLHeadElement){const[l,u]=J(!1),d=()=>u(!0);Ft(c=>m(a,()=>l()?c():i(),null)),Pe(d)}else{const l=Xi(e.isSVG?"g":"div",e.isSVG),u=t&&l.attachShadow?l.attachShadow({mode:"open"}):l;Object.defineProperty(l,"_$host",{get(){return n.parentNode},configurable:!0}),m(u,i),a.appendChild(l),e.ref&&e.ref(l),Pe(()=>a.removeChild(l))}},void 0,{render:!s}),n}function el(e,t){const n=je(e);return je(()=>{const r=n();switch(typeof r){case"function":return Ne(()=>r(t));case"string":const o=Fa.has(r),i=ve.context?qa():Xi(r,o,Ne(()=>t.is));return ct(i,t,o),i}})}function gr(e){const[,t]=He(e,["component"]);return el(()=>e.component,t)}/**
|
|
2
|
+
* @license lucide-solid v0.400.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/var tl={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"},Lt=tl,nl=x("<svg>"),rl=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ol=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" "),il=e=>{const[t,n]=He(e,["color","size","strokeWidth","children","class","name","iconNode","absoluteStrokeWidth"]);return(()=>{var r=nl();return ct(r,oe(Lt,{get width(){return t.size??Lt.width},get height(){return t.size??Lt.height},get stroke(){return t.color??Lt.stroke},get"stroke-width"(){return Re(()=>!!t.absoluteStrokeWidth)()?Number(t.strokeWidth??Lt["stroke-width"])*24/Number(t.size):Number(t.strokeWidth??Lt["stroke-width"])},get class(){return ol("lucide","lucide-icon",t.name!=null?`lucide-${rl(t==null?void 0:t.name)}`:void 0,t.class!=null?t.class:"")}},n),!0,!0),m(r,g(ke,{get each(){return t.iconNode},children:([o,i])=>g(gr,oe({component:o},i))})),r})()},$e=il,sl=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],al=e=>g($e,oe(e,{name:"Check",iconNode:sl})),ll=al,cl=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ul=e=>g($e,oe(e,{name:"ChevronDown",iconNode:cl})),es=ul,dl=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],fl=e=>g($e,oe(e,{name:"ChevronUp",iconNode:dl})),hl=fl,gl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ml=e=>g($e,oe(e,{name:"CircleX",iconNode:gl})),pl=ml,vl=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],bl=e=>g($e,oe(e,{name:"Copy",iconNode:vl})),ts=bl,wl=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],yl=e=>g($e,oe(e,{name:"FileWarning",iconNode:wl})),xl=yl,kl=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],_l=e=>g($e,oe(e,{name:"House",iconNode:kl})),$l=_l,Sl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Al=e=>g($e,oe(e,{name:"Info",iconNode:Sl})),zl=Al,Cl=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]],El=e=>g($e,oe(e,{name:"LayoutTemplate",iconNode:Cl})),Ol=El,Tl=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Pl=e=>g($e,oe(e,{name:"Moon",iconNode:Tl})),Il=Pl,Rl=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Nl=e=>g($e,oe(e,{name:"Pencil",iconNode:Rl})),Dl=Nl,Ll=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],jl=e=>g($e,oe(e,{name:"Plus",iconNode:Ll})),Zl=jl,Ml=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Fl=e=>g($e,oe(e,{name:"RefreshCw",iconNode:Ml})),Ul=Fl,Bl=[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]],Vl=e=>g($e,oe(e,{name:"SlidersHorizontal",iconNode:Bl})),Hl=Vl,Wl=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Kl=e=>g($e,oe(e,{name:"Sun",iconNode:Wl})),Jl=Kl,ql=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],Gl=e=>g($e,oe(e,{name:"ThumbsDown",iconNode:ql})),Yl=Gl,Xl=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],Ql=e=>g($e,oe(e,{name:"ThumbsUp",iconNode:Xl})),ec=Ql,tc=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],nc=e=>g($e,oe(e,{name:"TriangleAlert",iconNode:tc})),rc=nc,oc=[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]],ic=e=>g($e,oe(e,{name:"Volume2",iconNode:oc})),sc=ic,ac=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],lc=e=>g($e,oe(e,{name:"X",iconNode:ac})),Qt=lc;function ns(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=ns(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function rs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ns(e))&&(r&&(r+=" "),r+=t);return r}const cc="xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl|micro|caption|meta|compact|body|title",uc=/^(?:0|-?(?:\d+|\d*\.\d+)(?:px|em|rem|ex|ch|vw|vh|vmin|vmax|svw|svh|lvw|lvh|dvw|dvh|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|in|pt|pc|q|lh|rlh|cap|ic|%))$/,os=(e,t)=>e.charCodeAt(t)===91&&e.endsWith("]")?e.slice(t+1,-1):null,Fe=(e,t)=>{const n=os(e,t);if(n===null)return!1;if(n.startsWith("length:"))return!0;const r=n;return/^(?:calc|min|max|clamp)\(.*\)$/.test(r)?!0:r.split("_").every(o=>uc.test(o))},Mn=(e,t)=>{const n=os(e,t);return n!==null&&(n.includes("_")||/^(?:shadow|inset|color):/.test(n))},is=["x","y","t","r","b","l","s","e"],ss=["bs","be"],dc=["t","r","b","l","tl","tr","br","bl","s","e","ss","se","es","ee"],ro=(e,t)=>t.map(n=>`${e}${n}`),fc=ro("borderw-",[...is,...ss]),hc=ro("borderc-",[...is,...ss]),gc=ro("radius-",dc),mc=["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],Pr=e=>/^(?:\d+(?:\.\d+)?)$/.test(e)||Fe(e,0),pc=[[/^-?inset-shadow-(?:none|2xs|xs|sm|md|lg|xl|2xl)$/,"inset-shadow"],[/^-?inset-shadow$/,"inset-shadow"],[/^-?inset-shadow-\[/,(e,t)=>{const n=t.charCodeAt(0)===45?14:13;return Mn(t,n)?"inset-shadow":Fe(t,n)?"":"inset-shadow-color"}],[/^-?inset-shadow-/,"inset-shadow-color"],[/^-?inset-ring-(?:\d+(?:\.\d+)?)$/,"inset-ring-w"],[/^-?inset-ring$/,"inset-ring-w"],[/^-?inset-ring-\[/,(e,t)=>Fe(t,t.charCodeAt(0)===45?12:11)?"inset-ring-w":"inset-ring-color"],[/^-?inset-ring-/,"inset-ring-color"],[/^-?inset-(s|bs|e|be)-/,e=>e[1]==="s"?"start":e[1]==="e"?"end":`inset-${e[1]}`],[/^-?inset-x-/,"inset-x"],[/^-?inset-y-/,"inset-y"],[/^-?inset-/,"inset"],[/^-?(top|right|bottom|left|start|end)-/,e=>e[1]],[/^-?mx-/,"mx"],[/^-?my-/,"my"],[/^-?m-/,"m"],[/^-?m(bs|be)-/,e=>`m${e[1]}`],[/^-?(mt|mr|mb|ml|ms|me)-/,e=>e[1]],[/^px-/,"px"],[/^py-/,"py"],[/^p-/,"p"],[/^p(bs|be)-/,e=>`p${e[1]}`],[/^(pt|pr|pb|pl|ps|pe)-/,e=>e[1]],[/^size-/,"size"],[/^w-/,"w"],[/^h-/,"h"],[/^min-w-/,"min-w"],[/^min-h-/,"min-h"],[/^max-w-/,"max-w"],[/^max-h-/,"max-h"],[/^gap-x-/,"gap-x"],[/^gap-y-/,"gap-y"],[/^gap-/,"gap"],[/^divide-(x|y)-reverse$/,e=>`divide-${e[1]}-reverse`],[/^divide-(?:solid|dashed|dotted|double|hidden|none)$/,"divide-style"],[/^divide-[xy](-|$)/,(e,t)=>t.startsWith("divide-x")?"divide-x":"divide-y"],[/^divide-/,"divide-color"],[/^space-(x|y)-reverse$/,e=>`space-${e[1]}-reverse`],[/^space-x-/,"space-x"],[/^space-y-/,"space-y"],[/^border-(?:solid|dashed|dotted|double|none|hidden)$/,"border-style"],[/^border-(?:collapse|separate)$/,"border-collapse"],[/^border-spacing-x-/,"border-spacing-x"],[/^border-spacing-y-/,"border-spacing-y"],[/^border-spacing-/,"border-spacing"],[/^border(?:-[xytrblse])?$/,(e,t)=>t.length>6?`borderw-${t[7]}`:"borderw"],[/^border-(bs|be)$/,e=>`borderw-${e[1]}`],[/^border-(bs|be)-(.+)$/,e=>`${Pr(e[2])?"borderw":"borderc"}-${e[1]}`],[/^border-([xytrblse])-(.+)$/,e=>`${Pr(e[2])?"borderw":"borderc"}-${e[1]}`],[/^border-(.+)$/,e=>Pr(e[1])?"borderw":"borderc"],[/^rounded(?:-(tl|tr|br|bl|ss|se|es|ee|t|r|b|l|s|e))?$/,e=>e[1]?`radius-${e[1]}`:"radius"],[/^rounded(?:-(tl|tr|br|bl|ss|se|es|ee|t|r|b|l|s|e))?-/,e=>e[1]?`radius-${e[1]}`:"radius"],[/^bg-clip-/,"bg-clip"],[/^bg-(?:fixed|local|scroll)$/,"bg-attachment"],[/^bg-origin-/,"bg-origin"],[/^bg-(?:no-repeat|repeat|repeat-x|repeat-y|repeat-space|repeat-round)$/,"bg-repeat"],[/^bg-(?:top|bottom|left|right|center)(?:-(?:top|bottom|left|right))?$/,"bg-position"],[/^bg-\[position:/,"bg-position"],[/^bg-blend-/,"bg-blend"],[/^bg-(?:none|gradient-|linear-|radial|conic|\[(?:linear|radial|conic|url|image:))/,"bg-image"],[/^bg-(?:size-|\[length:|\[size:|auto$|cover$|contain$)/,"bg-size"],[/^bg-/,"bg-color"],[new RegExp(`^text-(?:${cc})$`),"font-size"],[/^text-\[/,(e,t)=>Fe(t,5)?"font-size":"text-color"],[/^text-(?:left|right|center|justify|start|end)$/,"text-align"],[/^text-(?:wrap|nowrap|balance|pretty)$/,"text-wrap-mode"],[/^text-(?:ellipsis|clip)$/,"text-overflow"],[/^text-shadow-(?:none|2xs|xs|sm|md|lg)$/,"text-shadow"],[/^text-shadow$/,"text-shadow"],[/^text-shadow-\[/,(e,t)=>Mn(t,12)?"text-shadow":Fe(t,12)?"":"text-shadow-color"],[/^text-shadow-/,"text-shadow-color"],[/^text-/,"text-color"],[/^font-(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/,"font-weight"],[/^font-(?:sans|serif|mono)$/,"font-family"],[/^font-\[/,(e,t)=>/^\[family-name:/.test(t.slice(5))?"font-family":"font-weight"],[/^font-\(/,"font-weight"],[/^leading-/,"leading"],[/^tracking-/,"tracking"],[/^line-clamp-(?:none|\d+(?:\.\d+)?)$/,"line-clamp"],[/^line-clamp-\[\d+\]$/,"line-clamp"],[/^line-clamp-\[(?:var\(|--)/,"line-clamp"],[/^truncate$/,"text-overflow"],[/^(?:uppercase|lowercase|capitalize|normal-case)$/,"text-transform"],[/^(?:italic|not-italic)$/,"font-style"],[/^(?:underline|line-through|no-underline|overline)$/,"text-decoration"],[/^underline-offset-/,"underline-offset"],[/^decoration-(?:solid|dashed|dotted|double|wavy)$/,"decoration-style"],[/^decoration-(?:from-font|auto|\d)/,"decoration-thickness"],[/^decoration-\[/,(e,t)=>Fe(t,11)?"decoration-thickness":"decoration-color"],[/^decoration-\(/,"decoration-thickness"],[/^decoration-/,"decoration-color"],[/^overflow-x-/,"overflow-x"],[/^overflow-y-/,"overflow-y"],[/^overflow-/,"overflow"],[/^(?:block|inline-block|inline-flex|inline-grid|inline-table|inline|flex|table-caption|table-cell|table-column|table-column-group|table-footer-group|table-header-group|table-row|table-row-group|table|grid|contents|list-item|flow-root|hidden)$/,"display"],[/^flex-(?:row-reverse|col-reverse|row|col)$/,"flex-flow"],[/^flex-(?:wrap-reverse|wrap|nowrap)$/,"flex-wrap"],[/^flex-(?:1|auto|initial|none|\[.*\])$/,"flex-shorthand"],[/^shrink-/,"shrink-factor"],[/^shrink$/,"shrink-factor"],[/^grow-/,"grow-factor"],[/^grow$/,"grow-factor"],[/^basis-/,"flex-basis"],[/^items-/,"items"],[/^justify-items-/,"justify-items"],[/^justify-self-/,"justify-self"],[/^justify-/,"justify"],[/^self-/,"self"],[/^place-items-/,"place-items"],[/^place-self-/,"place-self"],[/^place-content-/,"place-content"],[/^content-(?:normal|start|end|center|between|around|evenly|stretch|baseline|center-safe|end-safe)$/,"align-content"],[/^content-/,"content"],[/^grid-cols-/,"grid-cols"],[/^grid-rows-/,"grid-rows"],[/^col-(start|end)-/,e=>`col-${e[1]}`],[/^col-/,"grid-column"],[/^row-(start|end)-/,e=>`row-${e[1]}`],[/^row-/,"grid-row"],[/^(?:absolute|relative|fixed|sticky|static)$/,"position"],[/^z-/,"z"],[/^-?order-/,"order"],[/^shadow-(?:none|2xs|xs|sm|md|lg|xl|2xl)$/,"box-shadow"],[/^shadow$/,"box-shadow"],[/^shadow-\[/,(e,t)=>Mn(t,7)?"box-shadow":Fe(t,7)?"":"shadow-color"],[/^shadow-/,"shadow-color"],[/^opacity-/,"opacity"],[/^mix-blend-/,"mix-blend"],[/^filter(?:-none)?$/,"filter"],[/^\[filter:/,"filter"],[/^blur($|-)/,"blur"],[/^brightness-/,"brightness"],[/^contrast-/,"contrast"],[/^drop-shadow-(?:none|sm|md|lg|xl|2xl)$/,"drop-shadow"],[/^drop-shadow$/,"drop-shadow"],[/^drop-shadow-\[/,(e,t)=>Mn(t,12)?"drop-shadow":Fe(t,12)?"":"drop-shadow-color"],[/^drop-shadow-/,"drop-shadow-color"],[/^grayscale($|-)/,"grayscale"],[/^hue-rotate-/,"hue-rotate"],[/^invert($|-)/,"invert"],[/^saturate-/,"saturate"],[/^sepia($|-)/,"sepia"],[/^backdrop-(blur|brightness|contrast|grayscale|hue-rotate|invert|opacity|saturate|sepia)($|-)/,e=>`backdrop-${e[1]}`],[/^backdrop-filter(?:-none)?$/,"backdrop-filter"],[/^ring-offset-(?:\d+(?:\.\d+)?)$/,"ring-offset-w"],[/^ring-offset-\[/,(e,t)=>Fe(t,12)?"ring-offset-w":"ring-offset-color"],[/^ring-offset-/,"ring-offset-color"],[/^ring-inset$/,"ring-inset"],[/^ring$/,"ring-w"],[/^ring-(?:\d+(?:\.\d+)?)$/,"ring-w"],[/^ring-\[/,(e,t)=>Fe(t,5)?"ring-w":"ring-color"],[/^ring-/,"ring-color"],[/^-?outline-offset-/,"outline-offset"],[/^\[outline-style:/,"arb-outline-style"],[/^outline-(?:none|solid|dashed|dotted|double|hidden)$/,"outline-style"],[/^outline$/,"outline-w"],[/^outline-(?:\d+(?:\.\d+)?)$/,"outline-w"],[/^outline-\[/,(e,t)=>Fe(t,8)?"outline-w":"outline-color"],[/^outline-/,"outline-color"],[/^transition-(?:normal|discrete)$/,"transition-behavior"],[/^transition/,"transition-property"],[/^duration-/,"duration"],[/^delay-/,"delay"],[/^ease-/,"ease"],[/^animate-(?:none|spin|ping|pulse|bounce|\[)/,"animate"],[/^transform(?:-none|-gpu|-cpu)?$/,"transform-property"],[/^scale-3d$/,"scale-3d"],[/^scale-([xyz])-/,e=>`scale-${e[1]}`],[/^scale-/,"scale"],[/^-?rotate-([xyz])-/,e=>`rotate-${e[1]}`],[/^-?rotate-/,"rotate"],[/^-?translate-none$/,"translate-none"],[/^-?translate-([xyz])-/,e=>`translate-${e[1]}`],[/^-?translate-(?:full|\d|\[)/,"translate"],[/^origin-/,"transform-origin"],[/^appearance-/,"appearance"],[/^cursor-/,"cursor"],[/^pointer-events-/,"pointer-events"],[/^select-/,"user-select"],[/^resize/,"resize-mode"],[/^scroll-(m|p)(x|y|t|r|b|l|s|e|bs|be)-/,e=>`scroll-${e[1]}${e[2]}`],[/^scroll-(m|p)-/,e=>`scroll-${e[1]}`],[/^whitespace-/,"whitespace"],[/^break-(?:words|all|keep|normal)$/,"overflow-wrap"],[/^object-(?:contain|cover|fill|none|scale-down)$/,"object-fit"],[/^object-/,"object-position"],[/^fill-/,"fill"],[/^stroke-(?:\d+(?:\.\d+)?)$/,"stroke-w"],[/^stroke-\[/,(e,t)=>Fe(t,7)||/^\[\d+(?:\.\d+)?\]$/.test(t.slice(7))?"stroke-w":"stroke-color"],[/^stroke-/,"stroke-color"],[/^list-image-/,"list-image"],[/^list-(?:inside|outside)$/,"list-position"],[/^list-/,"list-type"],[/^align-/,"align"],[/^aspect-/,"aspect"],[/^(?:visible|invisible|collapse)$/,"visibility"],[/^(?:sr-only|not-sr-only)$/,"sr"],[/^(?:isolate|isolation-auto)$/,"isolation"],[/^(?:antialiased|subpixel-antialiased)$/,"font-smoothing"],[/^ordinal$/,"fvn-ordinal"],[/^slashed-zero$/,"fvn-slashed-zero"],[/^(?:lining|oldstyle)-nums$/,"fvn-figure"],[/^(?:proportional|tabular)-nums$/,"fvn-spacing"],[/^(?:diagonal|stacked)-fractions$/,"fvn-fraction"],[/^normal-nums$/,"fvn-normal"],[/^container$/,"container"],[/^container\//,"container"],[/^@container-(?:normal|size)$/,"container-type"],[/^@container$/,"container-type"],[/^@container\//,"container-named"],[/^will-change-/,"will-change"],[/^touch-(?:auto|none|manipulation)$/,"touch"],[/^touch-pan-(?:x|left|right)$/,"touch-x"],[/^touch-pan-(?:y|up|down)$/,"touch-y"],[/^touch-pinch-zoom$/,"touch-pinch"],[/^touch-(?!\[)/,"touch"],[/^overscroll-([xy])-/,e=>`overscroll-${e[1]}`],[/^overscroll-(?!\[)/,"overscroll"],[/^accent-/,"accent-color"],[/^caret-/,"caret-color"],[/^snap-(?:start|end|center|align-none)$/,"snap-align"],[/^snap-(?:mandatory|proximity)$/,"snap-strictness"],[/^snap-(?:normal|always)$/,"snap-stop"],[/^snap-(?:none|x|y|both)$/,"snap-type"],[/^columns-/,"columns"],[/^indent-/,"indent"]],vc={inset:["inset-x","inset-y","inset-bs","inset-be","top","right","bottom","left","start","end"],"inset-x":["left","right"],"inset-y":["top","bottom"],m:["mx","my","mt","mr","mb","ml","ms","me","mbs","mbe"],mx:["mr","ml"],my:["mt","mb"],p:["px","py","pt","pr","pb","pl","ps","pe","pbs","pbe"],px:["pr","pl"],py:["pt","pb"],size:["w","h"],gap:["gap-x","gap-y"],space:["space-x","space-y"],borderw:fc,borderc:hc,radius:gc,"font-size":["leading"],"fvn-normal":mc,"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"container-named":["container-type"],"radius-s":["radius-ss","radius-es"],"radius-e":["radius-se","radius-ee"],"radius-t":["radius-tl","radius-tr"],"radius-b":["radius-bl","radius-br"],"radius-r":["radius-tr","radius-br"],"radius-l":["radius-tl","radius-bl"],"borderw-x":["borderw-r","borderw-l"],"borderw-y":["borderw-t","borderw-b"],"borderc-x":["borderc-r","borderc-l"],"borderc-y":["borderc-t","borderc-b"],touch:["touch-x","touch-y","touch-pinch"],"touch-x":["touch"],"touch-y":["touch"],"touch-pinch":["touch"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"line-clamp":["display","overflow"],"scroll-m":["scroll-mx","scroll-my","scroll-mt","scroll-mr","scroll-mb","scroll-ml","scroll-ms","scroll-me","scroll-mbs","scroll-mbe"],"scroll-mx":["scroll-ml","scroll-mr"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-pt","scroll-pr","scroll-pb","scroll-pl","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe"],"scroll-px":["scroll-pl","scroll-pr"],"scroll-py":["scroll-pt","scroll-pb"],"flex-shorthand":["shrink-factor","grow-factor","flex-basis"],overflow:["overflow-x","overflow-y"],"border-spacing":["border-spacing-x","border-spacing-y"],overscroll:["overscroll-x","overscroll-y"]};function bc(e){let t=0,n=-1;const r=e.charCodeAt(0)===33?1:0;for(let o=r;o<e.length;o++){const i=e[o];i==="["||i==="("?t++:i==="]"||i===")"?t--:i===":"&&t===0&&(n=o)}return n===-1?[e.slice(0,r),e.slice(r)]:[e.slice(0,n+1),e.slice(n+1)]}function wc(e,t){for(const n of e){const r=t.match(n[0]);if(r){const o=typeof n[1]=="function"?n[1](r,t):n[1];return o===""?null:o}}return null}const Ir=4096;function yc(e,t){const n=new Map,r=new Map,o=new Map,i=a=>{const l=n.get(a);if(l!==void 0)return l;const[u,d]=bc(a),c={modifier:u,base:d,key:wc(e,d)};return n.size>=Ir&&n.clear(),n.set(a,c),c},s=a=>{const l=r.get(a);if(l!==void 0)return l;const u=new Set([a]),d=t[a];if(d)for(const c of d)u.add(c);return r.size>=Ir&&r.clear(),r.set(a,u),u};return a=>{const l=o.get(a);if(l!==void 0)return l;const u=[];for(const c of a.split(" ")){if(!c)continue;const f=i(c);if(f.key===null){u.push(c);continue}const h=s(f.key);for(let p=u.length-1;p>=0;p--){const v=i(u[p]);v.modifier===f.modifier&&v.key!==null&&h.has(v.key)&&u.splice(p,1)}u.push(c)}const d=u.join(" ");return o.size>=Ir&&o.clear(),o.set(a,d),d}}const xc=yc(pc,vc);function G(...e){return xc(rs(e))}const kc=["http:","https:","mailto:"];function _c(e){try{return new URL(e,"http://_invalid_base").protocol}catch{return}}function St(e){if(e==="")return!1;const t=_c(e);return t!==void 0&&kc.includes(t)}var No=x('<div class="min-w-0 flex-1">'),$c=x('<div class="-mt-1 shrink-0">'),Sc=x('<div part=header class="flex items-start justify-between gap-3">'),Ac=x('<div part=body class="min-w-0 text-sm">'),zc=x("<div class=kc-actions>"),Cc=x("<div part=footer>"),Ec=x('<div class="flex min-w-0 flex-1 flex-col"style=padding:var(--kai-card-spacing);gap:var(--kai-card-spacing)>'),Oc=x('<button type=button part=dismiss aria-label=Dismiss class="absolute right-2 top-2 z-10 shrink-0 rounded p-1 opacity-60 transition-opacity hover:opacity-100">'),Tc=x("<style>"),Pc=x("<div part=media class=kc-media>"),Ic=x("<div class=kc-layout>");const Rc={outlined:"border border-border bg-card text-card-foreground kai-elevation-sm",filled:"border border-transparent bg-surface-strong text-card-foreground",plain:"border border-transparent bg-transparent",accent:"border border-transparent bg-primary text-primary-foreground"};function as(e){const t=oe({appearance:"outlined",orientation:"vertical",collapse:"28rem",dense:!1},e),[n,r]=He(t,["appearance","orientation","collapse","dense","media","header","headerActions","footer","footerActions","hasBody","dismissible","onDismiss","href","target","rel","clickable","onCardClick","class","children"]),[o,i]=J(!0),s=E=>{var O;E.stopPropagation(),i(!1),(O=n.onDismiss)==null||O.call(n)},a=()=>n.href&&St(n.href)?n.href:void 0,l=()=>!!a(),u=()=>!n.href&&!!n.clickable,d=()=>l()||u(),c=/^[\d.]+(px|rem|em|ch|vw|vh|%)$/,f=()=>c.test(n.collapse)?n.collapse:"28rem",h=`kc-i-${Ie()}`,p=()=>{const E=f(),O=n.orientation==="horizontal",N=n.orientation==="responsive",Y=`.${h}`,M=`${Y} .kc-layout{display:flex;flex-direction:${O?"row":"column"}}${Y} .kc-media{overflow:hidden;${O?"flex-shrink:0;align-self:stretch":"width:100%"}}${Y} [part="footer"]{display:flex;flex-direction:column;gap:0.75rem}${Y} .kc-actions{display:flex;flex-direction:column-reverse;align-items:stretch;gap:0.5rem}`,W=`${Y} [part="footer"]{flex-direction:row;align-items:center}${Y} .kc-actions{flex-direction:row;align-items:center;margin-left:auto}`+(N?`${Y} .kc-layout{flex-direction:row}${Y} .kc-media{width:auto;flex-shrink:0;align-self:stretch}`:"");return`${M}@container (min-width:${E}){${W}}`},v=E=>{var O;return(O=n.onCardClick)==null?void 0:O.call(n,E)},b=E=>{u()&&(E.key==="Enter"||E.key===" "||E.key==="Spacebar")&&(E.preventDefault(),v(E))},y=()=>n.rel??(n.target==="_blank"?"noopener noreferrer":void 0),z=()=>!!n.header||!!n.headerActions,k=()=>!!n.footer||!!n.footerActions,T=()=>z()||n.hasBody||k(),D=(()=>{var E=Ec();return m(E,g(Z,{get when(){return z()},get children(){var O=Sc();return m(O,g(Z,{get when(){return n.header},get children(){var N=No();return m(N,()=>n.header),N}}),null),m(O,g(Z,{get when(){return n.headerActions},get children(){var N=$c();return m(N,()=>n.headerActions),N}}),null),O}}),null),m(E,g(Z,{get when(){return n.hasBody},get children(){var O=Ac();return m(O,()=>n.children),O}}),null),m(E,g(Z,{get when(){return k()},get children(){var O=Cc();return m(O,g(Z,{get when(){return n.footer},get children(){var N=No();return m(N,()=>n.footer),N}}),null),m(O,g(Z,{get when(){return n.footerActions},get children(){var N=zc();return m(N,()=>n.footerActions),N}}),null),O}}),null),E})();return g(Z,{get when(){return o()},get children(){return g(gr,oe({get component(){return l()?"a":"div"},part:"card",get href(){return Re(()=>!!l())()?a():void 0},get target(){return Re(()=>!!l())()?n.target:void 0},get rel(){return Re(()=>!!l())()?y():void 0},get role(){return u()?"button":void 0},get tabindex(){return u()?0:void 0},get onClick(){return d()?v:void 0},get onKeyDown(){return u()?b:void 0},get style(){return{"--kai-card-spacing":n.dense?"0.875rem":"1.25rem"}},get class(){return G("relative block overflow-hidden rounded-xl no-underline @container",h,Rc[n.appearance],d()&&"cursor-pointer transition-colors hover:border-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n.class)}},r,{get children(){return[g(Z,{get when(){return n.dismissible},get children(){var E=Oc();return E.$$click=s,m(E,g(Qt,{class:"size-3.5","aria-hidden":"true"})),E}}),(()=>{var E=Tc();return m(E,p),E})(),(()=>{var E=Ic();return m(E,g(Z,{get when(){return n.media},get children(){var O=Pc();return m(O,()=>n.media),O}}),null),m(E,g(Z,{get when(){return T()},children:D}),null),E})()]}}))}})}bt(["click"]);const En="https://ui.kitn.ai/schemas/construct/v1.json",an={id:"identity",paths:["name"]},ln={id:"theme",paths:["theme.accent","theme.mode","theme.unreadColor"]},Nc={id:"header",paths:["header.title"]},Fn={id:"header",paths:["header.title","header.themeToggle","header.actions"],hints:{"header.actions":"Each button dispatches `kai-header-action` for your app to handle — nothing happens until you listen."}},cn={id:"empty",paths:["empty.title","empty.description","empty.icon"]},Dc={id:"home",paths:["home"]},un={id:"capabilities",paths:["capabilities.starters","capabilities.attachments","capabilities.history","capabilities.conversations","capabilities.reasoning","capabilities.reasoningOpen"],hints:{"capabilities.history":"Endpoint needs a thread route you host. Local keeps history in this browser — no backend, nothing metered.","capabilities.reasoningOpen":"Off by owner ruling (2026-08-26): the thinking panel starts closed and opens on click."}},dn={id:"messageActions",paths:["capabilities.messageActions.user","capabilities.messageActions.assistant"]},Lc={id:"sources",paths:["capabilities.sources.strip"]},jc={id:"widget",paths:["widget.position","widget.launcherIcon","widget.defaultOpen"]},Zc={id:"aside",paths:["aside.position","aside.width"]},Mc={id:"workSurface",paths:["workSurface.kind","workSurface.url","workSurface.codeUrl","workSurface.chrome.deviceToggle","workSurface.chrome.urlBar","workSurface.chrome.openInNewTab","workSurface.chrome.expand","workSurface.chrome.codeView"],hints:{"workSurface.codeUrl":"The Code tab reads source from this URL. Leave it blank and the tab says so — it never frames a missing page.","workSurface.chrome.codeView":"Shows the Preview|Code toggle. Fine to switch on before you have a Code URL."}},Do={id:"composerTriggers",paths:["composer.triggers.slash","composer.triggers.mention"]},Lo={id:"shell",paths:["shell.commandPalette","shell.userMenu"]},Fc={id:"cards",paths:["cards"],hints:{cards:"Cards arrive as tool calls from a model. Declare one and the mock scripts a call to it, so it renders keylessly."}},fn={id:"provider",paths:["provider"],hints:{provider:"Endpoint needs your own chat route. Mock streams locally, with no key and no bill."}},Uc={$schema:En,name:"support-widget",layout:"widget",provider:{mode:"mock"},header:{title:"Support"},theme:{mode:"system"},empty:{title:"Hi, we're here to help",description:"Ask us about orders, refunds, and more."},home:{greeting:{title:"How can we help? 👋",subtitle:"Orders, refunds, anything."},recentConversation:!0,links:[{label:"Help center",href:"https://ui.kitn.ai",description:"Guides and FAQs",icon:"book-open"}]},widget:{position:"bottom-end"},capabilities:{starters:["Where's my order?","Request a refund"],attachments:{accept:["image/*","application/pdf"]},history:{persistence:"local"},conversations:!0,reasoning:"full",messageActions:{user:["edit"],assistant:["copy","like","dislike"]}}},Bc={$schema:En,name:"in-app-assistant",layout:"aside",provider:{mode:"mock"},header:{title:"Assistant",themeToggle:!0},theme:{mode:"dark"},aside:{position:"end",width:"380px"},empty:{title:"What can I help with?",description:"Ask about this page, or anything else."},composer:{triggers:{slash:[{id:"summarize",label:"summarize",description:"Summarize the thread so far"},{id:"explain",label:"explain",description:"Explain the current page"}],mention:[{id:"docs",label:"docs",description:"Search the documentation"},{id:"support",label:"support",description:"Hand off to a person"}]}},capabilities:{starters:["Deploy payments to production","Check the canary status"],attachments:{accept:["image/*","application/pdf"]},history:{persistence:"local"},conversations:!0,reasoning:"full",messageActions:{user:["edit"],assistant:["copy","like","dislike"]}}},Vc={$schema:En,name:"daily-assistant",layout:"fullscreen",provider:{mode:"mock"},header:{title:"Assistant",themeToggle:!0},theme:{mode:"dark"},shell:{commandPalette:!0,userMenu:{name:"Ada",plan:"Pro"}},empty:{title:"What can I help with?",description:"Ask anything, or start from a suggestion below."},capabilities:{starters:["Draft the Q3 board update","Summarize a document","Compare two options"],attachments:{accept:["image/*","application/pdf"]},history:{persistence:"local"},conversations:!0,reasoning:"full",messageActions:{user:["edit"],assistant:["copy","like","dislike"]}}},Hc={$schema:En,name:"research-assistant",layout:"fullscreen",provider:{mode:"mock"},header:{title:"Research",themeToggle:!0},theme:{mode:"dark"},empty:{title:"What do you want to know?",description:"Answers come back with their sources attached."},capabilities:{starters:["How does the wire adapter work?","What are message parts?"],attachments:{accept:["application/pdf"]},history:{persistence:"local"},conversations:!0,reasoning:"full",sources:{strip:!0},messageActions:{user:["edit"],assistant:["copy","like","dislike"]}}},Wc={triggers:{slash:[{id:"summarize",label:"summarize",description:"Summarize the thread so far"},{id:"translate",label:"translate",description:"Translate the last message"}],mention:[{id:"researcher",label:"researcher",description:"Hands off to the research agent"},{id:"coder",label:"coder",description:"Hands off to the coding agent"}]}},er={$schema:En,name:"build-workspace",layout:"split",provider:{mode:"mock"},header:{title:"Workspace",themeToggle:!0,actions:[{label:"Share",variant:"outline"},{label:"Deploy",variant:"default"}]},theme:{mode:"dark"},empty:{title:"What should we build?",description:"Describe it, and it takes shape in the work surface beside this chat."},workSurface:{kind:"artifact",url:"/work-surface.html",chrome:{deviceToggle:!1,urlBar:!1,openInNewTab:!1,expand:!0,codeView:!1}},shell:{commandPalette:!0,userMenu:{name:"Ada",plan:"Pro"}},composer:Wc,capabilities:{starters:["Build a pricing table","Add a dark mode toggle"],attachments:{accept:["image/*"]},history:{persistence:"local"},conversations:!0,reasoning:"full",messageActions:{user:["edit"],assistant:["copy","like","dislike"]}}},Kc={...er,name:"artifact-workspace",workSurface:{kind:"artifact",url:"/work-surface.html",chrome:{deviceToggle:!1,urlBar:!1,openInNewTab:!1,expand:!0,codeView:!1}}},Jc={...er,name:"app-workspace",workSurface:{kind:"preview",url:"/work-surface.html",chrome:{deviceToggle:!0,urlBar:!0,openInNewTab:!0,expand:!0,codeView:!0}},capabilities:{...er.capabilities,starters:["Build a landing page for a coffee shop","Make the hero work on mobile"]}},mr=[{id:"widget",name:"Support widget",description:"A floating chat that lives in the corner of your site.",availability:"buildable",starter:Uc,controls:[an,ln,Nc,cn,Dc,un,dn,jc,fn]},{id:"inAppAssistant",name:"In-app assistant",description:"An assistant docked inside your existing app.",availability:"buildable",starter:Bc,controls:[an,ln,Fn,cn,Zc,Do,un,dn,Fc,fn]},{id:"assistant",name:"Assistant",description:"A full-page assistant with a history of past conversations.",availability:"buildable",starter:Vc,controls:[an,ln,Fn,Lo,cn,un,dn,fn]},{id:"research",name:"Research",description:"Search-first answers with cited sources.",availability:"buildable",starter:Hc,controls:[an,ln,Fn,cn,un,Lc,dn,fn]},{id:"workspace",name:"Workspace",description:"Chat drives a live work surface: previews, code, and artifacts build beside the conversation.",availability:"buildable",starter:er,variants:[{id:"artifactPreview",name:"Artifact preview beside chat",description:"A code or rendered-output pane grows beside the conversation as you build.",starter:Kc},{id:"appPreview",name:"App preview with device toggles",description:"A full browser-chrome preview of the running app, with desktop, tablet, and mobile views.",starter:Jc}],controls:[an,ln,Fn,Mc,Lo,Do,un,dn,cn,fn]},{id:"voice",name:"Voice",description:"A voice-first assistant you talk to, push-to-talk and all.",availability:"story-only"}];function qc(){return mr.filter(e=>e.availability==="buildable")}function Gc(e){return mr.find(t=>t.id===e)}function Yc(e){var t;switch(e.layout){case"widget":return"widget";case"aside":return"inAppAssistant";case"split":return"workspace";case"fullscreen":return(t=e.capabilities)!=null&&t.sources?"research":"assistant";default:return}}var Xc=x('<style>[data-builder-start] [aria-pressed="true"]{--tw-ring-color:var(--color-primary) !important}'),Qc=x("<div data-builder-start>"),eu=x('<button type=button><span class="text-sm font-medium underline-offset-4 hover:underline">Start from scratch</span><span class=text-xs>A bare chat, everything off. You can switch to a template later.'),tu=x('<div class="flex flex-col gap-1"><h2 class="text-sm font-semibold text-foreground"></h2><p class="text-sm leading-snug text-muted-foreground">'),nu=x('<div class="flex h-44 items-center justify-center p-4">'),ru=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6 stroke-width=1.5></rect><line x1=16 y1=20 x2=88 y2=20 stroke-width=1.5 stroke-linecap=round></line><line x1=16 y1=30 x2=64 y2=30 stroke-width=1.5 stroke-linecap=round></line><rect x=92 y=30 width=56 height=48 rx=6 stroke-width=1.5></rect><line x1=100 y1=40 x2=130 y2=40 stroke-width=1.5 stroke-linecap=round></line><line x1=100 y1=48 x2=118 y2=48 stroke-width=1.5 stroke-linecap=round></line><circle cx=138 cy=88 r=7>'),ou=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6 stroke-width=1.5></rect><line x1=42 y1=4 x2=42 y2=96 stroke-width=1.5></line><line x1=14 y1=20 x2=34 y2=20 stroke-width=1.5 stroke-linecap=round></line><line x1=14 y1=30 x2=34 y2=30 stroke-width=1.5 stroke-linecap=round></line><line x1=14 y1=40 x2=34 y2=40 stroke-width=1.5 stroke-linecap=round></line><rect x=54 y=16 width=92 height=60 rx=6 stroke-width=1.5></rect><line x1=64 y1=28 x2=100 y2=28 stroke-width=1.5 stroke-linecap=round></line><line x1=64 y1=38 x2=112 y2=38 stroke-width=1.5 stroke-linecap=round></line><line x1=64 y1=48 x2=94 y2=48 stroke-width=1.5 stroke-linecap=round></line><rect x=64 y=60 width=72 height=8 rx=4 stroke-width=1.5>'),iu=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6 stroke-width=1.5></rect><rect x=16 y=14 width=128 height=12 rx=6 stroke-width=1.5></rect><rect x=16 y=34 width=94 height=52 rx=6 stroke-width=1.5></rect><line x1=24 y1=44 x2=92 y2=44 stroke-width=1.5 stroke-linecap=round></line><line x1=24 y1=52 x2=80 y2=52 stroke-width=1.5 stroke-linecap=round></line><line x1=24 y1=60 x2=88 y2=60 stroke-width=1.5 stroke-linecap=round></line><rect x=118 y=34 width=26 height=52 rx=6 stroke-width=1.5></rect><line x1=124 y1=42 x2=138 y2=42 stroke-width=1.5 stroke-linecap=round></line><line x1=124 y1=50 x2=138 y2=50 stroke-width=1.5 stroke-linecap=round></line><line x1=124 y1=58 x2=138 y2=58 stroke-width=1.5 stroke-linecap=round>'),su=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6 stroke-width=1.5></rect><rect x=12 y=12 width=44 height=76 rx=6 stroke-width=1.5></rect><line x1=20 y1=24 x2=48 y2=24 stroke-width=1.5 stroke-linecap=round></line><line x1=20 y1=32 x2=40 y2=32 stroke-width=1.5 stroke-linecap=round></line><line x1=20 y1=40 x2=44 y2=40 stroke-width=1.5 stroke-linecap=round></line><rect x=64 y=12 width=84 height=76 rx=6 stroke-width=1.5></rect><line x1=74 y1=24 x2=120 y2=24 stroke-width=1.5 stroke-linecap=round></line><line x1=74 y1=34 x2=138 y2=34 stroke-width=1.5 stroke-linecap=round></line><rect x=74 y=46 width=30 height=30 rx=4 stroke-width=1.5></rect><rect x=110 y=46 width=30 height=30 rx=4 stroke-width=1.5>'),au=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6 stroke-width=1.5></rect><line x1=16 y1=18 x2=80 y2=18 stroke-width=1.5 stroke-linecap=round></line><line x1=16 y1=28 x2=60 y2=28 stroke-width=1.5 stroke-linecap=round></line><rect x=16 y=42 width=52 height=38 rx=4 stroke-width=1.5></rect><rect x=112 y=4 width=44 height=92 rx=6 stroke-width=1.5></rect><line x1=120 y1=18 x2=146 y2=18 stroke-width=1.5 stroke-linecap=round></line><line x1=120 y1=28 x2=138 y2=28 stroke-width=1.5 stroke-linecap=round></line><line x1=120 y1=38 x2=142 y2=38 stroke-width=1.5 stroke-linecap=round></line><rect x=120 y=70 width=28 height=8 rx=4 stroke-width=1.5></rect><rect x=102 y=44 width=10 height=16 rx=3>'),lu=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><circle cx=80 cy=82 r=12 stroke-width=1.5></circle><circle cx=80 cy=82 r=4>'),cu=x("<svg><rect width=6 rx=3></svg>",!1,!0,!1);mr.map(({id:e,name:t,description:n})=>({id:e,name:t,description:n}));const Ur=mr.filter(e=>e.availability==="buildable").map(({id:e,name:t,description:n})=>({id:e,name:t,description:n})),ls={"background-image":"radial-gradient(circle, var(--color-border) 1px, transparent 1px)","background-size":"14px 14px"};function jo(e){const t=()=>e.value==="scratch";return[Xc(),(()=>{var n=Qc();return m(n,g(ke,{get each(){return e.templates??Ur},children:r=>{const o=()=>e.value===r.id,i=pu[r.id];return g(as,{appearance:"outlined",clickable:!0,get"aria-pressed"(){return o()},onCardClick:()=>e.onSelect(r.id),hasBody:!0,get class(){return G("text-left transition-shadow",o()?"border-primary ring-2 ring-primary":"hover:border-ring hover:shadow-md")},get media(){return(()=>{var s=nu();return m(s,g(i,{})),U(a=>P(s,ls,a)),s})()},get children(){var s=tu(),a=s.firstChild,l=a.nextSibling;return m(a,()=>r.name),m(l,()=>r.description),s}})}})),U(()=>ue(n,G("grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3",e.class))),n})(),(()=>{var n=eu();return n.$$click=()=>e.onSelect("scratch"),U(r=>{var o=t(),i=G("mx-auto mt-6 flex flex-col items-center gap-0.5 rounded text-center transition-colors",t()?"text-foreground":"text-muted-foreground hover:text-foreground");return o!==r.e&&j(n,"aria-pressed",r.e=o),i!==r.t&&ue(n,r.t=i),r},{e:void 0,t:void 0}),n})()]}const ye=1.5,X={stroke:"var(--color-muted-foreground)",fill:"none"},Te={stroke:"var(--color-border)",fill:"none"},De={stroke:"var(--color-primary)",fill:"none"},tr={stroke:"none",fill:"var(--color-primary)"};function uu(){return(()=>{var e=ru(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling;return U(l=>{var u=Te,d=X,c=X,f=De,h=De,p=X,v=tr;return l.e=P(t,u,l.e),l.t=P(n,d,l.t),l.a=P(r,c,l.a),l.o=P(o,f,l.o),l.i=P(i,h,l.i),l.n=P(s,p,l.n),l.s=P(a,v,l.s),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),e})()}function du(){return(()=>{var e=ou(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling;return U(c=>{var f=Te,h=Te,p=X,v=X,b=X,y=De,z=X,k=De,T=X,D=Te;return c.e=P(t,f,c.e),c.t=P(n,h,c.t),c.a=P(r,p,c.a),c.o=P(o,v,c.o),c.i=P(i,b,c.i),c.n=P(s,y,c.n),c.s=P(a,z,c.s),c.h=P(l,k,c.h),c.r=P(u,T,c.r),c.d=P(d,D,c.d),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),e})()}function fu(){return(()=>{var e=iu(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling;return U(c=>{var f=Te,h=De,p=De,v=X,b=X,y=X,z=Te,k=X,T=X,D=X;return c.e=P(t,f,c.e),c.t=P(n,h,c.t),c.a=P(r,p,c.a),c.o=P(o,v,c.o),c.i=P(i,b,c.i),c.n=P(s,y,c.n),c.s=P(a,z,c.s),c.h=P(l,k,c.h),c.r=P(u,T,c.r),c.d=P(d,D,c.d),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),e})()}function hu(){return(()=>{var e=su(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling;return U(c=>{var f=Te,h=De,p=X,v=De,b=X,y=Te,z=X,k=X,T=X,D=X;return c.e=P(t,f,c.e),c.t=P(n,h,c.t),c.a=P(r,p,c.a),c.o=P(o,v,c.o),c.i=P(i,b,c.i),c.n=P(s,y,c.n),c.s=P(a,z,c.s),c.h=P(l,k,c.h),c.r=P(u,T,c.r),c.d=P(d,D,c.d),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),e})()}function gu(){return(()=>{var e=au(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling;return U(c=>{var f=Te,h=X,p=X,v=X,b=De,y=X,z=De,k=X,T=Te,D=tr;return c.e=P(t,f,c.e),c.t=P(n,h,c.t),c.a=P(r,p,c.a),c.o=P(o,v,c.o),c.i=P(i,b,c.i),c.n=P(s,y,c.n),c.s=P(a,z,c.s),c.h=P(l,k,c.h),c.r=P(u,T,c.r),c.d=P(d,D,c.d),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),e})()}function mu(){const e=[18,32,46,60,40,54,24,44,30];return(()=>{var t=lu(),n=t.firstChild,r=n.nextSibling;return m(t,g(ke,{each:e,children:(o,i)=>{const s=20+i()*14,a=30-o/2+12;return(()=>{var l=cu();return j(l,"x",s),j(l,"y",a),j(l,"height",o),U(u=>P(l,i()%3===1?X:tr,u)),l})()}}),n),U(o=>{var i=De,s=tr;return o.e=P(n,i,o.e),o.t=P(r,s,o.t),o},{e:void 0,t:void 0}),t})()}const pu={widget:uu,inAppAssistant:gu,assistant:du,research:fu,workspace:hu,voice:mu};bt(["click"]);var vu=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6></rect><rect x=12 y=12 width=44 height=76 rx=6></rect><line x1=20 y1=24 x2=48 y2=24 stroke-linecap=round></line><line x1=20 y1=32 x2=40 y2=32 stroke-linecap=round></line><rect x=64 y=12 width=84 height=76 rx=6></rect><line x1=74 y1=24 x2=128 y2=24 stroke-linecap=round></line><line x1=74 y1=32 x2=112 y2=32 stroke-linecap=round></line><line x1=74 y1=40 x2=122 y2=40 stroke-linecap=round></line><line x1=74 y1=48 x2=100 y2=48 stroke-linecap=round></line><line x1=74 y1=56 x2=118 y2=56 stroke-linecap=round>'),bu=x('<svg viewBox="0 0 160 100"class="h-full w-full"aria-hidden=true><rect x=4 y=4 width=152 height=92 rx=6></rect><rect x=12 y=12 width=40 height=76 rx=6></rect><line x1=20 y1=24 x2=44 y2=24 stroke-linecap=round></line><rect x=60 y=12 width=88 height=76 rx=6></rect><line x1=60 y1=26 x2=148 y2=26></line><circle cx=68 cy=19 r=2></circle><circle cx=76 cy=19 r=2></circle><rect x=118 y=15 width=10 height=8 rx=2></rect><rect x=130 y=15 width=10 height=8 rx=2></rect><rect x=70 y=36 width=70 height=18 rx=3></rect><rect x=70 y=58 width=70 height=24 rx=3>'),wu=x(`<div data-builder-workspace-variants><button type=button class="flex w-fit items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground">← Back</button><div class="flex flex-col gap-1"><h2 class="text-lg font-semibold text-foreground">What kind of workspace?</h2><p class="text-sm text-muted-foreground">Both start from the same split shell. Pick the one closer to what you're building.</p></div><div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">`),yu=x('<div class="flex flex-col gap-1"><h3 class="text-sm font-semibold text-foreground"></h3><p class="text-sm leading-snug text-muted-foreground">'),xu=x('<div class="flex h-44 items-center justify-center p-4">');const ku=[{id:"artifactPreview",name:"Artifact preview beside chat",description:"A code or rendered-output pane grows beside the conversation as you build."},{id:"appPreview",name:"App preview with device toggles",description:"A full browser-chrome preview of the running app, with desktop, tablet, and mobile views."}];function _u(){return(()=>{var e=vu(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling;return j(t,"stroke-width",ye),j(n,"stroke-width",ye),j(r,"stroke-width",ye),j(o,"stroke-width",ye),j(i,"stroke-width",ye),j(s,"stroke-width",ye),j(a,"stroke-width",ye),j(l,"stroke-width",ye),j(u,"stroke-width",ye),j(d,"stroke-width",ye),U(c=>{var f=Te,h=De,p=X,v=De,b=Te,y=X,z=X,k=X,T=X,D=X;return c.e=P(t,f,c.e),c.t=P(n,h,c.t),c.a=P(r,p,c.a),c.o=P(o,v,c.o),c.i=P(i,b,c.i),c.n=P(s,y,c.n),c.s=P(a,z,c.s),c.h=P(l,k,c.h),c.r=P(u,T,c.r),c.d=P(d,D,c.d),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),e})()}function $u(){return(()=>{var e=bu(),t=e.firstChild,n=t.nextSibling,r=n.nextSibling,o=r.nextSibling,i=o.nextSibling,s=i.nextSibling,a=s.nextSibling,l=a.nextSibling,u=l.nextSibling,d=u.nextSibling,c=d.nextSibling;return j(t,"stroke-width",ye),j(n,"stroke-width",ye),j(r,"stroke-width",ye),j(o,"stroke-width",ye),j(i,"stroke-width",ye),j(s,"stroke-width",ye),j(a,"stroke-width",ye),j(l,"stroke-width",ye),j(u,"stroke-width",ye),j(d,"stroke-width",ye),j(c,"stroke-width",ye),U(f=>{var h=Te,p=De,v=X,b=Te,y=Te,z=X,k=X,T=X,D=X,E=X,O=X;return f.e=P(t,h,f.e),f.t=P(n,p,f.t),f.a=P(r,v,f.a),f.o=P(o,b,f.o),f.i=P(i,y,f.i),f.n=P(s,z,f.n),f.s=P(a,k,f.s),f.h=P(l,T,f.h),f.r=P(u,D,f.r),f.d=P(d,E,f.d),f.l=P(c,O,f.l),f},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),e})()}const Su={artifactPreview:_u,appPreview:$u};function Au(e){return(()=>{var t=wu(),n=t.firstChild,r=n.nextSibling,o=r.nextSibling;return no(n,"click",e.onBack,!0),m(o,g(ke,{each:ku,children:i=>{const s=()=>e.value===i.id,a=Su[i.id];return g(as,{appearance:"outlined",clickable:!0,get"aria-pressed"(){return s()},onCardClick:()=>e.onSelect(i.id),hasBody:!0,get class(){return G("text-left transition-shadow",s()?"border-primary ring-2 ring-primary":"hover:border-ring hover:shadow-md")},get media(){return(()=>{var l=xu();return m(l,g(a,{})),U(u=>P(l,ls,u)),l})()},get children(){var l=yu(),u=l.firstChild,d=u.nextSibling;return m(u,()=>i.name),m(d,()=>i.description),l}})}})),U(()=>ue(t,G("flex flex-col gap-6",e.class))),t})()}bt(["click"]);class Zo extends Error{}const Mo=64,zu=/[0-9]/u,Cu=/[\p{L}\p{N}]/u;function On(e){return e==="#"||e==="@"||e==="*"}function oo(e,t){return e==="#"?zu.test(t):Cu.test(t)}function Rr(e,t){if(e.length>Mo)throw new Zo(`format is ${e.length} characters; the maximum is ${Mo}`);if(t!==void 0&&t.length!==e.length)throw new Zo(`guide is ${t.length} characters but format is ${e.length}; they must align position for position`);const n=[];let r="";for(let o=0;o<e.length;o+=1){const i=e[o];On(i)?(n.push(o),r+=" "):r+=i}return{format:e,guide:t??r,fillIndexes:n,capacity:n.length}}function Eu(e,t){return t==="upper"?e.toUpperCase():t==="lower"?e.toLowerCase():e}function _t(e,t,n="preserve"){let r="",o=0,i=0;for(;i<e.format.length&&o<t.length;){const s=e.format[i];if(!On(s)){t[o].toLowerCase()===s.toLowerCase()&&(o+=1),i+=1;continue}const a=Eu(t[o],n);oo(s,a)&&(r+=a,i+=1),o+=1}return r}function gt(e,t){if(t.length===0)return"";let n="",r="",o=0;for(let i=0;i<e.format.length;i+=1)if(!On(e.format[i]))r+=e.format[i];else if(o<t.length)n+=r+t[o],r="",o+=1;else return n;return n+r}function Ou(e,t){let n="",r=0;for(let o=0;o<e.format.length;o+=1)On(e.format[o])&&r<t.length?(n+=t[r],r+=1):n+=e.guide[o]??"";return n}function Br(e,t){let n="";for(const r of e.fillIndexes){const o=t[r];if(o===void 0||!oo(e.format[r],o))break;n+=o}return n}function Tu(e,t,n){const r=Math.max(0,Math.min(n,t.length));let o=0;for(const i of e.fillIndexes){if(i>=r)break;const s=t[i];if(s===void 0||!oo(e.format[i],s))break;o+=1}return o}function Un(e,t,n){if(e.capacity===0)return Math.min(e.format.length,t.length);const r=Math.max(0,Math.min(n,e.capacity));if(r===0)return Math.min(e.fillIndexes[0],t.length);let o=e.fillIndexes[r-1]+1;for(;o<e.format.length&&!On(e.format[o]);)o+=1;return Math.min(o,t.length)}const Pu={spellcheck:!1,autocorrect:"off",autocapitalize:"off",canonical:"as-typed"};function Iu(e){switch(e){case"tel":return{inputmode:"tel",autocomplete:"tel",spellcheck:!1,autocorrect:"off",autocapitalize:"off",defaultFormat:"###-###-####",canonical:"digits"};case"ssn":return{inputmode:"numeric",autocomplete:"off",spellcheck:!1,autocorrect:"off",autocapitalize:"off",defaultFormat:"###-##-####",canonical:"digits"};case"credit-card":return{inputmode:"numeric",autocomplete:"cc-number",spellcheck:!1,autocorrect:"off",autocapitalize:"off",defaultFormat:"#### #### #### ####",canonical:"digits"};case"custom":return{spellcheck:!1,autocorrect:"off",autocapitalize:"off",canonical:"formatted"};default:return console.warn(`fieldSemantics: unrecognized semantic type ${JSON.stringify(e)}; falling back to unmasked text`),Pu}}function Fo(e,t,n){const r=Br(e,t);return r.length===0?"":n==="custom"?gt(e,r):r}const Ru=200,Nu="•",Du=new Set(["insertText","insertFromPaste","insertFromPasteAsQuotation","insertFromDrop","insertReplacementText","insertFromYank","insertTranspose"]),Lu=new Set(["deleteContent","deleteContentBackward","deleteContentForward","deleteWordBackward","deleteWordForward","deleteSoftLineBackward","deleteSoftLineForward","deleteHardLineBackward","deleteHardLineForward","deleteByDrag"]),ju=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]);function Zu(e,t){let n={...t},r=Rr(n.format,n.guide),o=n.guide!==void 0,i=n.caseMode??"preserve",s=n.semantic??"custom",a=n.obscure??!1,l="",u=r,d="";const c=[],f=[];let h=!1,p=!1,v=!1,b=!1,y=null;const z=C=>o?Ou(r,C):gt(r,C),k=C=>Math.min(Tu(r,l,C),d.length);function T(){const C=e.selectionStart??l.length,L=e.selectionEnd??l.length;return[k(C),k(Math.max(C,L))]}function D(C,L){v=!0;try{e.setSelectionRange(C,L)}catch{}finally{v=!1}}function E(C,L){var F;(F=n.onReject)==null||F.call(n,{reason:C,data:L})}function O(C,L,F){var ne;F.undo!=="none"&&((F.undo==="break"||!h)&&(c.push({formatted:l,pattern:u,selStart:e.selectionStart??l.length,selEnd:e.selectionEnd??l.length}),c.length>Ru&&c.shift()),h=F.undo==="run",f.length=0),l=C,u=r,d=F.raw,e.value=C;const q=Math.max(0,Math.min(L,C.length)),ie=Math.max(q,Math.min(F.selectionEnd??L,C.length));D(q,ie),F.notify!==!1&&((ne=n.onInput)==null||ne.call(n,{canonical:Dn(),formatted:l}))}function N(C,L,F){const q=z(C);O(q,Un(r,q,L),{...F,raw:C})}function Y(C){try{return Rr(r.format+"@".repeat(C))}catch{return null}}function M(C,L,F,q){const ie=r.capacity-(d.length-(L-C));if(F.length>0&&ie<=0)return E("full",F),!1;const ne=d.slice(0,C),Ae=gt(r,ne),rt=_t(r,Ae+F,i),ht=rt.slice(ne.length),Ln=d.slice(L),Nt=_t(r,gt(r,rt)+Ln,i);if(F.length>0&&ht.length===0)return E("wrong-class",F),!1;if(Nt===d)return!1;N(Nt,ne.length+ht.length,{undo:q==="insert"?"run":"break",notify:!0});const jn=Nt.length<rt.length+Ln.length,Er=rt.length===r.capacity&&ht.length<F.length&&W(Ae,F,rt.length);return(jn||Er)&&E("over-capacity",F),!0}function W(C,L,F){const q=Y(L.length);return q===null?!1:_t(q,C+L,i).length>F}function I(){const C=e.value,L=Math.min(C.length,l.length);let F=0;for(;F<L&&C[F]===l[F];)F+=1;let q=0;for(;q<L-F&&C[C.length-1-q]===l[l.length-1-q];)q+=1;const ie=C.slice(F,C.length-q),ne=k(F),Ae=Math.max(ne,k(l.length-q));M(ne,Ae,ie,"bulk"),e.value!==l&&O(l,Un(r,l,d.length),{undo:"none",raw:d,notify:!1})}function H(){return{formatted:l,pattern:u,selStart:e.selectionStart??l.length,selEnd:e.selectionEnd??l.length}}function _(C){if(h=!1,C.pattern===r){O(C.formatted,C.selStart,{undo:"none",selectionEnd:C.selEnd,raw:Br(r,C.formatted),notify:!0});return}const L=Br(C.pattern,C.formatted),F=_t(r,gt(C.pattern,L),i);N(F,F.length,{undo:"none",notify:!0})}function R(){const C=c.pop();C!==void 0&&(f.push(H()),_(C))}function B(){const C=f.pop();C!==void 0&&(c.push(H()),_(C))}function ee(C){const L=C.split("");for(let F=0;F<r.fillIndexes.length&&F<d.length;F+=1){const q=r.fillIndexes[F];r.format[q]==="*"&&q<L.length&&(L[q]=Nu)}return L.join("")}function re(){const C=e.selectionStart??0,L=e.selectionEnd??0;switch(se()){case"blocked":return"";case"formatted":return l.slice(C,L);case"obscured":return ee(l).slice(C,L);case"canonical":default:{const[F,q]=T();return F===0&&q===d.length?Fo(r,gt(r,d),s):d.slice(F,q)}}}function se(){return n.copyPolicy??(a?"obscured":"canonical")}function fe(C){var q;if(b||p)return;const L=C;if(!L.cancelable)return;const F=L.inputType;if(Du.has(F)){L.preventDefault();const ie=L.data??((q=L.dataTransfer)==null?void 0:q.getData("text/plain"))??"",[ne,Ae]=T();M(ne,Ae,ie,F==="insertText"?"insert":"bulk");return}if(Lu.has(F)){L.preventDefault();let[ie,ne]=T();if(ie===ne){if((e.selectionStart??0)!==(e.selectionEnd??0))return;const Ae=F.endsWith("Backward");if(/^delete(Word|SoftLine|HardLine)/.test(F))Ae?ie=0:ne=d.length;else if(Ae){if(ie===0)return;ie-=1}else{if(ne>=d.length)return;ne+=1}}M(ie,ne,"","bulk");return}if(F==="historyUndo"){L.preventDefault(),R();return}F==="historyRedo"&&(L.preventDefault(),B())}function dt(){b||p||e.value!==l&&I()}function xt(){b||(p=!0)}function Sr(){if(b)return;p=!1;const C=y;if(y=null,C!==null){C();return}e.value!==l&&I()}function In(C){if(p){y=C;return}C()}function Ar(C){if(b||p)return;const L=C,F=L.ctrlKey||L.metaKey,q=L.key.toLowerCase();if(F&&q==="z"){L.preventDefault(),L.shiftKey?B():R();return}if(F&&q==="y"){L.preventDefault(),B();return}ju.has(L.key)&&(h=!1)}function Rn(){h=!1}function on(){h=!1}function Rt(){return[Un(r,l,0),Un(r,l,d.length)]}function zr(){return e.getRootNode().activeElement===e}function ft(){if(b||p||v||!zr())return;const C=e.selectionStart,L=e.selectionEnd;if(C===null||L===null)return;const[F,q]=Rt();let ie=C,ne=L;C===L?ie=ne=Math.max(F,Math.min(C,q)):(ne=Math.min(L,q),ie=Math.min(Math.max(C,F),ne)),!(ie===C&&ne===L)&&D(ie,ne)}function Cr(C){var F;if(b)return;const L=C;L.preventDefault(),(F=L.clipboardData)==null||F.setData("text/plain",re())}function Nn(C){var ie;if(b)return;const L=C;L.preventDefault(),(ie=L.clipboardData)==null||ie.setData("text/plain",re());const[F,q]=T();F!==q&&(h=!1,M(F,q,"","bulk"))}function Dn(){return Fo(r,gt(r,d),s)}const kt=[["beforeinput",fe],["input",dt],["compositionstart",xt],["compositionend",Sr],["keydown",Ar],["mousedown",Rn],["keyup",ft],["mouseup",ft],["focus",ft],["blur",on],["copy",Cr],["cut",Nn]],nt=e.ownerDocument;for(const[C,L]of kt)e.addEventListener(C,L);nt.addEventListener("selectionchange",ft);{const C=_t(r,n.initialValue??e.value,i);N(C,C.length,{undo:"none",notify:!1})}return{setValue(C){In(()=>{const L=_t(r,C,i);N(L,L.length,{undo:"break",notify:!1})})},getRawValue:()=>d,getCanonicalValue:Dn,getFormattedValue:()=>l,setObscure(C){a=C},update(C){const L=gt(r,d),F=d,q=l,ie={...n,...C},ne=Rr(ie.format,ie.guide);n=ie,r=ne,o=ie.guide!==void 0,i=ie.caseMode??"preserve",s=ie.semantic??"custom",a=ie.obscure??!1,h=!1,f.length=0,In(()=>{const Ae=_t(r,L,i),ht=z(Ae)!==q;Ae.length<F.length&&E("format-change-clipped",L),N(Ae,Ae.length,{undo:"none",notify:ht})})},detach(){if(!b){b=!0,y=null;for(const[C,L]of kt)e.removeEventListener(C,L);nt.removeEventListener("selectionchange",ft)}}}}var Mu=x("<input>"),Fu=x('<label part=label class="text-sm font-medium text-foreground">'),Uo=x('<span class="flex shrink-0 items-center text-muted-foreground">'),Uu=x("<div part=field>"),Bu=x("<p part=hint>"),Vu=x('<div class="flex w-full flex-col gap-1.5">');const Bo="default",cs="w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:pointer-events-none",Hu="flex w-full items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm focus-within:outline-none focus-within:ring-2 focus-within:ring-ring",Wu="min-w-0 flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed",Vo="px-2.5 py-1",us="border-destructive dark:border-red-400/70",Ho=us,Ku="[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-cancel-button]:hidden";function Se(e){const[t,n]=He(e,["class","label","hint","error","size","invalid","leading","trailing","onValueInput","onValueChange","onBlur","id","disabled","format","guide","semantic","caseMode","copyPolicy","onMaskReject"]),r=t.id??Ie(),o=`${r}-hint`,i=()=>!!t.invalid||!!t.error,s=()=>!!t.error||!!t.hint,a=()=>t.leading!=null||t.trailing!=null,l=()=>t.semantic===void 0?void 0:Iu(t.semantic),u=new Set,d=(_,R)=>{u.has(_)||(u.add(_),console.warn(R))},c=_=>_.length<=32?_:`${_.slice(0,32)}… (${_.length} chars)`,f=()=>{var B;const _=t.format;if(_===void 0||_==="")return;if(_!==Bo)return _;const R=(B=l())==null?void 0:B.defaultFormat;return R===void 0&&d(`default:${String(t.semantic)}`,`Input: format=${Bo} resolves the default format of a semantic type, and semantic=${JSON.stringify(t.semantic)} has none. Rendering unmasked.`),R};let h,p,v,b;const y=()=>{v==null||v.detach(),v=void 0,b=void 0},z=(_,R,B)=>{const ee=R instanceof Error?R.message:String(R);d(`format:${_}`,`Input: format ${JSON.stringify(c(_))} did not compile (${ee}); `+(B?"the field keeps its previous format.":"rendering unmasked."))};Oe(()=>{const _=f(),R={guide:t.guide,semantic:t.semantic,caseMode:t.caseMode,copyPolicy:t.copyPolicy},B=a()?p:h;Ne(()=>{if(_===void 0||B===void 0){y();return}if(v!==void 0&&b===B){try{v.update({format:_,...R})}catch(re){z(_,re,!0)}return}const ee=(v==null?void 0:v.getFormattedValue())??B.value;y();try{v=Zu(B,{...R,format:_,initialValue:ee,onInput:({canonical:re})=>{var se;return(se=t.onValueInput)==null?void 0:se.call(t,re)},onReject:re=>{var se;return(se=t.onMaskReject)==null?void 0:se.call(t,re)}}),b=B}catch(re){z(_,re,!1)}})}),Pe(y);const k=()=>{var _;return n.inputmode??((_=l())==null?void 0:_.inputmode)},T=()=>{var _;return n.autocomplete??((_=l())==null?void 0:_.autocomplete)},D=()=>{const _=n.spellcheck;if(_!==void 0)return _===!0||_==="true"?"true":"false";const R=l();if(R!==void 0)return R.spellcheck?"true":"false"},E=()=>{var _;return n.autocorrect??((_=l())==null?void 0:_.autocorrect)},O=()=>{var _;return n.autocapitalize??((_=l())==null?void 0:_.autocapitalize)},N=(_,R,B)=>(()=>{var ee=Mu(),re=B;return typeof re=="function"?Qe(re,ee):B=ee,ct(ee,oe(n,{id:r,part:R,get disabled(){return t.disabled},get"aria-invalid"(){return i()?"true":void 0},get"aria-describedby"(){return s()?o:void 0},get inputmode(){return k()},get autocomplete(){return T()},get spellcheck(){return D()},get autocorrect(){return E()},get autocapitalize(){return O()},get class(){return G(Ku,_())},onInput:se=>{var fe;v===void 0&&((fe=t.onValueInput)==null||fe.call(t,se.currentTarget.value))},onBlur:se=>{var dt;const fe=t.onBlur;typeof fe=="function"&&fe(se),(dt=t.onValueChange)==null||dt.call(t,(v==null?void 0:v.getCanonicalValue())??se.currentTarget.value)}}),!1,!1),ee})(),Y=()=>G(cs,t.size==="sm"&&Vo,i()&&Ho,t.class);let M;const W=()=>M??(M=N(Y,"field input",_=>h=_));let I;const H=()=>I??(I=N(()=>Wu,"input",_=>p=_));return(()=>{var _=Vu();return m(_,g(Z,{get when(){return t.label},get children(){var R=Fu();return j(R,"for",r),m(R,()=>t.label),R}}),null),m(_,g(Z,{get when(){return a()},get fallback(){return W()},get children(){var R=Uu();return m(R,g(Z,{get when(){return t.leading},get children(){var B=Uo();return m(B,()=>t.leading),B}}),null),m(R,H,null),m(R,g(Z,{get when(){return t.trailing},get children(){var B=Uo();return m(B,()=>t.trailing),B}}),null),U(()=>ue(R,G(Hu,t.size==="sm"&&Vo,i()&&Ho,t.disabled&&"opacity-50 pointer-events-none",t.class))),R}}),null),m(_,g(Z,{get when(){return s()},get children(){var R=Bu();return j(R,"id",o),m(R,()=>t.error??t.hint),U(()=>ue(R,G("text-xs",t.error?"text-destructive":"text-muted-foreground"))),R}}),null),_})()}var Ju=x("<option value disabled>"),qu=x("<div><select>"),Gu=x("<option>");function kn(e){const[t,n]=He(e,["class","containerClass","options","value","placeholder","invalid","children","ref"]),r=()=>!!n.multiple,o=s=>{const a=t.value;return Array.isArray(a)?a.includes(s):a===s},i=()=>{const s=t.value;return Array.isArray(s)?s.length===0:s==null||s===""};return(()=>{var s=qu(),a=s.firstChild;return Qe(l=>{const u=t.ref;typeof u=="function"&&u(l),Oe(()=>{if(t.children===void 0)return;const d=t.value;if(d!=null)if(Array.isArray(d)){const c=new Set(d.map(String));for(const f of l.options)f.selected=c.has(f.value)}else l.value=String(d)})},a),ct(a,oe(n,{get class(){return G(cs,"peer",!r()&&"cursor-pointer appearance-none pr-9",t.invalid&&us,t.class)}}),!1,!0),m(a,g(Z,{get when(){return t.placeholder!==void 0},get children(){var l=Ju();return m(l,()=>t.placeholder),U(()=>l.selected=i()),l}}),null),m(a,g(ke,{get each(){return t.options},children:l=>(()=>{var u=Gu();return m(u,()=>l.label??String(l.value)),U(d=>{var c=l.disabled,f=o(l.value);return c!==d.e&&(u.disabled=d.e=c),f!==d.t&&(u.selected=d.t=f),d},{e:void 0,t:void 0}),U(()=>u.value=String(l.value)),u})()}),null),m(a,()=>t.children,null),m(s,g(Z,{get when(){return!r()},get children(){return g(es,{"aria-hidden":"true",class:"pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground peer-disabled:opacity-50"})}}),null),U(()=>ue(s,G("relative block w-full",t.containerClass))),s})()}var Yu=x("<button><span>"),Xu=x('<input type=checkbox aria-hidden=true tabindex=-1 style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap">');function Vt(e){const[t,n]=He(e,["checked","defaultChecked","disabled","label","name","value","onChange","buttonRef","class"]),[r,o]=J(t.defaultChecked??!1),i=()=>t.checked!==void 0,s=()=>i()?!!t.checked:r(),a=()=>{var u;if(t.disabled)return;const l=!s();i()||o(l),(u=t.onChange)==null||u.call(t,l)};return[Re(()=>Re(()=>t.name!=null)()&&(()=>{var l=Xu();return l.addEventListener("change",()=>{}),U(u=>{var d=t.name,c=t.disabled;return d!==u.e&&j(l,"name",u.e=d),c!==u.t&&(l.disabled=u.t=c),u},{e:void 0,t:void 0}),U(()=>l.value=t.value??"on"),U(()=>l.checked=s()),l})()),(()=>{var l=Yu(),u=l.firstChild,d=t.buttonRef;return typeof d=="function"?Qe(d,l):t.buttonRef=l,ct(l,oe(n,{type:"button",role:"switch",get"aria-checked"(){return s()},get"aria-label"(){return t.label},get disabled(){return t.disabled},onClick:a,onKeyDown:c=>{(c.key===" "||c.key==="Enter")&&(c.preventDefault(),a())},get class(){return G("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-pill border transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50",s()?"border-transparent bg-primary":"border-input bg-muted",t.class)}}),!1,!0),U(()=>ue(u,G("inline-block h-4 w-4 rounded-full shadow transition-transform",s()?"translate-x-4 bg-primary-foreground":"translate-x-0.5 bg-white"))),l})()]}const Wo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ko=rs,ds=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Ko(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],c=i==null?void 0:i[u];if(d===null)return null;const f=Wo(d)||Wo(c);return o[u][f]}),a=n&&Object.entries(n).reduce((u,d)=>{let[c,f]=d;return f===void 0||(u[c]=f),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:c,className:f,...h}=d;return Object.entries(h).every(p=>{let[v,b]=p;return Array.isArray(b)?b.includes({...i,...a}[v]):{...i,...a}[v]===b})?[...u,c,f]:u},[]);return Ko(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)};var Qu=x("<button>");const ed={default:"bg-primary text-primary-foreground hover:bg-primary/90",ghost:"hover:bg-muted text-foreground",subtle:"text-muted-foreground hover:bg-accent hover:text-foreground",outline:"bg-muted/50 text-foreground hover:bg-muted",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90"},td=ds("inline-flex items-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:ed,size:{sm:"h-8 px-3 text-xs rounded-md",md:"h-9 px-4 text-sm",lg:"h-10 px-6 text-sm",icon:"h-9 w-9","icon-sm":"h-7 w-7"},align:{start:"justify-start",center:"justify-center",end:"justify-end"}},defaultVariants:{variant:"default",size:"md",align:"center"}});function xe(e){const[t,n]=He(e,["variant","size","align","full","class","children"]);return(()=>{var r=Qu();return ct(r,oe({get class(){return G(td({variant:t.variant,size:t.size,align:t.align}),t.full&&"w-full",t.class)}},n),!1,!0),m(r,()=>t.children),r})()}var nd=x("<div><label><input type=color class=sr-only>");const rd=/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function od(e){return rd.test(e.trim())}function id(e){const t=e==null?void 0:e.trim();if(t===void 0)return"#000000";if(/^#[0-9a-fA-F]{6}$/.test(t))return t.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(t)){const[n,r,o]=t.slice(1).split("");return`#${n}${n}${r}${r}${o}${o}`.toLowerCase()}return"#000000"}function fs(e){const[t,n]=J(e.value??"");Oe(wn(()=>e.value,o=>n(o??""),{defer:!0}));const r=o=>{const i=o.trim();od(i)&&e.onChange(i)};return(()=>{var o=nd(),i=o.firstChild,s=i.firstChild;return s.$$input=a=>e.onChange(a.currentTarget.value),m(o,g(Se,{size:"sm",class:"flex-1",get value(){return t()},get placeholder(){return e.placeholder},get disabled(){return e.disabled},get"aria-label"(){return`${e.label} hex value`},onValueInput:n,onValueChange:r}),null),U(a=>{var l=G("flex items-center gap-2",e.class),u=G("relative inline-flex size-7 shrink-0 items-center justify-center rounded-md border border-border",e.disabled?"cursor-not-allowed opacity-50":"cursor-pointer","has-[:focus-visible]:outline-none has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring has-[:focus-visible]:ring-offset-2 has-[:focus-visible]:ring-offset-background"),d=e.value||"var(--color-muted)",c=e.disabled,f=e.label;return l!==a.e&&ue(o,a.e=l),u!==a.t&&ue(i,a.t=u),d!==a.a&&At(i,"background",a.a=d),c!==a.o&&(s.disabled=a.o=c),f!==a.i&&j(s,"aria-label",a.i=f),a},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),U(()=>s.value=id(e.value)),o})()}bt(["input"]);const hs=["default","ghost","subtle","outline","destructive"];function sd(e){const t=getComputedStyle(e);let n=parseFloat(t.lineHeight);Number.isNaN(n)&&(n=(parseFloat(t.fontSize)||14)*1.2);const r=(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0),o=(parseFloat(t.borderTopWidth)||0)+(parseFloat(t.borderBottomWidth)||0);return n+r+o}function ad(e={}){let t,n;function r(){if(!t||t.offsetParent===null)return;t.style.height="auto";const i=t.scrollHeight,s=e.minHeight??sd(t),a=Math.max(i,s);e.maxHeight&&a>e.maxHeight?(t.style.height=`${e.maxHeight}px`,t.style.overflowY="auto"):(t.style.height=`${a}px`,t.style.overflowY="hidden")}function o(i){t=i,i.addEventListener("input",r),requestAnimationFrame(r),typeof ResizeObserver<"u"&&(n=new ResizeObserver(()=>r()),n.observe(i)),Pe(()=>{i.removeEventListener("input",r),n==null||n.disconnect()})}return{ref:o,resize:r}}var ld=x("<textarea rows=1>");function cd(e){const[t,n]=He(e,["class","maxHeight","minHeight","autoResize","value"]),{ref:r,resize:o}=ad({maxHeight:t.maxHeight,minHeight:t.minHeight});return Oe(wn(()=>t.value,()=>o(),{defer:!0})),(()=>{var i=ld(),s=t.autoResize!==!1?r:void 0;return typeof s=="function"&&Qe(s,i),ct(i,oe({get class(){return G("w-full resize-none rounded-md bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t.class)},get value(){return t.value}},n),!1,!1),i})()}var ud=x("<button>");const dd=ds("inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-pill font-medium leading-none transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{pressed:{true:"bg-primary text-primary-foreground hover:bg-primary/90",false:"bg-muted/60 text-foreground hover:bg-muted"},size:{sm:"h-7 px-3 text-xs",md:"h-8 px-3.5 text-sm"}},defaultVariants:{pressed:!1,size:"sm"}});function fd(e){const[t,n]=He(e,["pressed","defaultPressed","disabled","size","onChange","class","children"]),[r,o]=J(t.defaultPressed??!1),i=()=>t.pressed!==void 0,s=()=>i()?!!t.pressed:r(),a=()=>{var u;if(t.disabled)return;const l=!s();i()||o(l),(u=t.onChange)==null||u.call(t,l)};return(()=>{var l=ud();return ct(l,oe(n,{type:"button",get"aria-pressed"(){return s()},get disabled(){return t.disabled},onClick:a,onKeyDown:u=>{(u.key===" "||u.key==="Enter")&&(u.preventDefault(),a())},get class(){return G(dd({pressed:s(),size:t.size}),t.class)}}),!1,!0),m(l,()=>t.children),l})()}var hd=x('<p class="text-xs text-muted-foreground">'),gd=x('<div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">'),md=x('<div class="flex items-center justify-between gap-3"><span>'),pd=x('<div class="flex flex-wrap gap-1.5">'),vd=x('<div class="flex flex-col gap-2"role=group><div class="flex items-center gap-2">'),bd=x('<span class="inline-flex items-center gap-1 rounded-pill bg-muted px-2 py-0.5 text-xs text-foreground">'),wd=x('<div class="flex flex-col gap-2"data-builder-accept-editor><div class="flex flex-wrap gap-1.5"role=group aria-label="Common file types"></div><details class=group><summary class="cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground">Advanced: exact MIME types</summary><div class="mt-2 flex flex-col gap-1.5"><p class="text-xs text-muted-foreground">One media type or glob per line — a chip above stays lit only while all of its patterns are here.'),yd=x('<div class="flex flex-col gap-2"data-builder-links>'),xd=x('<div class="flex flex-col gap-2 rounded-lg border border-border/70 bg-surface p-2.5"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Link ');const Vr=[{id:"images",label:"Images",patterns:["image/*"]},{id:"pdfs",label:"PDFs",patterns:["application/pdf"]},{id:"documents",label:"Documents",patterns:["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/plain","text/markdown"]},{id:"spreadsheets",label:"Spreadsheets",patterns:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]},{id:"audio",label:"Audio",patterns:["audio/*"]},{id:"video",label:"Video",patterns:["video/*"]}];var Bi,Vi;[...((Bi=Vr.find(e=>e.id==="images"))==null?void 0:Bi.patterns)??[],...((Vi=Vr.find(e=>e.id==="pdfs"))==null?void 0:Vi.patterns)??[]];function io(e){return(()=>{var t=gd(),n=t.firstChild;return m(n,()=>e.label),m(t,()=>e.children,null),m(t,g(Z,{get when(){return e.hint},get children(){var r=hd();return m(r,()=>e.hint),r}}),null),t})()}function _n(e){return(()=>{var t=md(),n=t.firstChild;return m(n,()=>e.label),m(t,()=>e.children,null),U(()=>ue(n,G("text-xs font-medium",e.muted?"text-muted-foreground":"text-foreground"))),t})()}function kd(e){const[t,n]=J(""),r=()=>{const i=t().trim();i&&(e.onChange([...e.tags,i]),n(""))},o=i=>e.onChange(e.tags.filter((s,a)=>a!==i));return(()=>{var i=vd(),s=i.firstChild;return m(i,g(Z,{get when(){return e.tags.length>0},get children(){var a=pd();return m(a,g(ke,{get each(){return e.tags},children:(l,u)=>(()=>{var d=bd();return m(d,l,null),m(d,g(xe,{type:"button",variant:"ghost",size:"icon-sm",class:"size-4 rounded-full p-0 text-muted-foreground hover:bg-transparent hover:text-foreground","aria-label":`Remove ${l}`,onClick:()=>o(u()),get children(){return g(Qt,{size:12,"aria-hidden":"true"})}}),null),d})()})),a}}),s),m(s,g(Se,{"data-control":!0,size:"sm",type:"text",get value(){return t()},get placeholder(){return e.placeholder??"Add…"},get"aria-label"(){return e.ariaLabel},onValueInput:n,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),r())}}),null),m(s,g(xe,{type:"button",variant:"outline",size:"sm",onClick:r,children:"Add"}),null),U(()=>j(i,"aria-label",e.ariaLabel)),i})()}function _d(e){const t=s=>s.patterns.every(a=>e.accept.includes(a)),n=s=>{if(t(s)){e.onChange(e.accept.filter(l=>!s.patterns.includes(l)));return}const a=e.accept.slice();for(const l of s.patterns)a.includes(l)||a.push(l);e.onChange(a)},[r,o]=J(e.accept.join(`
|
|
7
|
+
`));Oe(wn(()=>e.accept,s=>o(s.join(`
|
|
8
|
+
`)),{defer:!0}));const i=s=>{e.onChange(s.split(/[\n,]/).map(a=>a.trim()).filter(Boolean))};return(()=>{var s=wd(),a=s.firstChild,l=a.nextSibling,u=l.firstChild,d=u.nextSibling,c=d.firstChild;return m(a,g(ke,{each:Vr,children:f=>g(fd,{get pressed(){return t(f)},onChange:()=>n(f),get children(){return f.label}})})),m(d,g(cd,{"data-builder-accept-raw":!0,class:"rounded-md border border-input bg-background px-2.5 py-1.5 text-xs text-foreground",maxHeight:160,minHeight:46,get value(){return r()},placeholder:`image/*
|
|
9
|
+
application/pdf`,"aria-label":"Exact MIME types, one per line",onInput:f=>o(f.currentTarget.value),onBlur:f=>i(f.currentTarget.value)}),c),s})()}function $d(e){const t=(o,i)=>{const s=e.links.slice();s[o]={...s[o],...i},e.onChange(s)},n=()=>e.onChange([...e.links,{label:"New link"}]),r=o=>e.onChange(e.links.filter((i,s)=>s!==o));return(()=>{var o=yd();return m(o,g(ke,{get each(){return e.links},children:(i,s)=>(()=>{var a=xd(),l=a.firstChild,u=l.firstChild;return u.firstChild,m(u,()=>s()+1,null),m(l,g(xe,{type:"button",variant:"ghost",size:"icon-sm",get"aria-label"(){return`Remove link ${s()+1}`},onClick:()=>r(s()),get children(){return g(Qt,{size:14,"aria-hidden":"true"})}}),null),m(a,g(Se,{size:"sm",get value(){return i.label},placeholder:"Label",get"aria-label"(){return`Link ${s()+1} label`},onValueInput:d=>t(s(),{label:d})}),null),m(a,g(Se,{size:"sm",get value(){return i.href??""},placeholder:"https://…",get"aria-label"(){return`Link ${s()+1} href`},onValueInput:d=>t(s(),{href:d||void 0})}),null),m(a,g(Se,{size:"sm",get value(){return i.description??""},placeholder:"Description",get"aria-label"(){return`Link ${s()+1} description`},onValueInput:d=>t(s(),{description:d||void 0})}),null),a})()}),null),m(o,g(xe,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Add link"}),null),o})()}var Sd=x('<div class="flex flex-col gap-1"role=group>'),Ad=x('<div class="flex items-center gap-2 rounded-md border border-border/70 bg-surface px-2 py-1.5"><span class="flex-1 truncate text-xs font-medium text-foreground"></span><div class="flex shrink-0 items-center gap-0.5">');const zd=[{id:"edit",label:"Edit",icon:Dl},{id:"copy",label:"Copy",icon:ts}],Cd=[{id:"copy",label:"Copy",icon:ts},{id:"like",label:"Like",icon:ec},{id:"dislike",label:"Dislike",icon:Yl},{id:"regenerate",label:"Regenerate",icon:Ul},{id:"speak",label:"Read aloud",icon:sc}];function Ed(e){const t=o=>e.catalog.find(i=>i.id===o),n=(o,i)=>{const s=o+i;if(s<0||s>=e.rows.length)return;const a=e.rows.slice();[a[o],a[s]]=[a[s],a[o]],e.onChange(a)},r=(o,i)=>{const s=e.rows.slice();s[o]={...s[o],enabled:i},e.onChange(s)};return(()=>{var o=Sd();return m(o,g(ke,{get each(){return e.rows},children:(i,s)=>{const a=t(i.id),l=a==null?void 0:a.icon,u=(a==null?void 0:a.label)??i.id;return(()=>{var d=Ad(),c=d.firstChild,f=c.nextSibling;return m(d,l?g(l,{class:"size-3.5 shrink-0 text-muted-foreground"}):null,c),m(c,u),m(f,g(xe,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Move ${u} up`,get disabled(){return s()===0},onClick:()=>n(s(),-1),get children(){return g(hl,{size:12,"aria-hidden":"true"})}}),null),m(f,g(xe,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Move ${u} down`,get disabled(){return s()===e.rows.length-1},onClick:()=>n(s(),1),get children(){return g(es,{size:12,"aria-hidden":"true"})}}),null),m(d,g(Vt,{get checked(){return i.enabled},label:`Enable ${u}`,onChange:h=>r(s(),h)}),null),d})()}})),U(()=>j(o,"aria-label",e.legend)),o})()}var Jo;function $(e,t,n){function r(a,l){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,l);const u=s.prototype,d=Object.keys(u);for(let c=0;c<d.length;c++){const f=d[c];f in a||(a[f]=u[f].bind(a))}}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const u=n!=null&&n.Parent?new i:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,u;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Ut extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class gs extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Jo=globalThis).__zod_globalConfig??(Jo.__zod_globalConfig={});const so=globalThis.__zod_globalConfig;function at(e){return so}function ms(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Hr(e,t){return typeof t=="bigint"?t.toString():t}function pr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ao(e){return e==null}function lo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const qo=Symbol("evaluating");function ae(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==qo)return r===void 0&&(r=qo,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function It(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function wt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Go(e){return JSON.stringify(e)}function Od(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ps="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $n(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Td=pr(()=>{var e;if(so.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Ht(e){if($n(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!($n(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function vs(e){return Ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Pd=new Set(["string","number","symbol"]);function Wt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function yt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function V(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Id(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Rd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=wt(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return It(this,"shape",s),s},checks:[]});return yt(e,i)}function Nd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=wt(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return It(this,"shape",s),s},checks:[]});return yt(e,i)}function Dd(e,t){if(!Ht(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=wt(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return It(this,"shape",i),i}});return yt(e,o)}function Ld(e,t){if(!Ht(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=wt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return It(this,"shape",r),r}});return yt(e,n)}function jd(e,t){var r;if((r=e._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=wt(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return It(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return yt(e,n)}function Zd(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=wt(t._zod.def,{get shape(){const a=t._zod.def.shape,l={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(l[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)l[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return It(this,"shape",l),l},checks:[]});return yt(t,s)}function Md(e,t,n){const r=wt(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return It(this,"shape",i),i}});return yt(t,r)}function Zt(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Fd(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function Mt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Bn(e){return typeof e=="string"?e:e==null?void 0:e.message}function lt(e,t,n){var l,u,d,c,f,h;const r=e.message?e.message:Bn((d=(u=(l=e.inst)==null?void 0:l._zod.def)==null?void 0:u.error)==null?void 0:d.call(u,e))??Bn((c=t==null?void 0:t.error)==null?void 0:c.call(t,e))??Bn((f=n.customError)==null?void 0:f.call(n,e))??Bn((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input",{inst:o,continue:i,input:s,...a}=e;return a.path??(a.path=[]),a.message=r,t!=null&&t.reportInput&&(a.input=s),a}function co(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Sn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const bs=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Hr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ws=$("$ZodError",bs),ys=$("$ZodError",bs,{Parent:Error});function Ud(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Bd(e,t=n=>n.message){const n={_errors:[]},r=(o,i=[])=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{const a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let l=n,u=0;for(;u<a.length;){const d=a[u];u===a.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(t(s))):l[d]=l[d]||{_errors:[]},l=l[d],u++}}}};return r(e),n}const uo=e=>(t,n,r,o)=>{const i=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Ut;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>lt(l,i,at())));throw ps(a,o==null?void 0:o.callee),a}return s.value},fo=e=>async(t,n,r,o)=>{const i=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>lt(l,i,at())));throw ps(a,o==null?void 0:o.callee),a}return s.value},vr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Ut;return i.issues.length?{success:!1,error:new(e??ws)(i.issues.map(s=>lt(s,o,at())))}:{success:!0,data:i.value}},Vd=vr(ys),br=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>lt(s,o,at())))}:{success:!0,data:i.value}},Hd=br(ys),Wd=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return uo(e)(t,n,o)},Kd=e=>(t,n,r)=>uo(e)(t,n,r),Jd=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return fo(e)(t,n,o)},qd=e=>async(t,n,r)=>fo(e)(t,n,r),Gd=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return vr(e)(t,n,o)},Yd=e=>(t,n,r)=>vr(e)(t,n,r),Xd=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return br(e)(t,n,o)},Qd=e=>async(t,n,r)=>br(e)(t,n,r),ef=/^[cC][0-9a-z]{6,}$/,tf=/^[0-9a-z]+$/,nf=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rf=/^[0-9a-vA-V]{20}$/,of=/^[A-Za-z0-9]{27}$/,sf=/^[a-zA-Z0-9_-]{21}$/,af=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,lf=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Yo=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,cf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function df(){return new RegExp(uf,"u")}const ff=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,hf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gf=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,mf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,pf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,xs=/^[A-Za-z0-9_-]*$/,vf=/^https?$/,bf=/^\+[1-9]\d{6,14}$/,ks="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",wf=new RegExp(`^${ks}$`);function _s(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yf(e){return new RegExp(`^${_s(e)}$`)}function xf(e){const t=_s({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ks}T(?:${r})$`)}const kf=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_f=/^-?\d+(?:\.\d+)?$/,$f=/^(?:true|false)$/i,Sf=/^[^A-Z]*$/,Af=/^[^a-z]*$/,et=$("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zf=$("$ZodCheckMaxLength",(e,t)=>{var n;et.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ao(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=co(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Cf=$("$ZodCheckMinLength",(e,t)=>{var n;et.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ao(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=co(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ef=$("$ZodCheckLengthEquals",(e,t)=>{var n;et.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ao(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=co(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),wr=$("$ZodCheckStringFormat",(e,t)=>{var n,r;et.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Of=$("$ZodCheckRegex",(e,t)=>{wr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Tf=$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Sf),wr.init(e,t)}),Pf=$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Af),wr.init(e,t)}),If=$("$ZodCheckIncludes",(e,t)=>{et.init(e,t);const n=Wt(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Rf=$("$ZodCheckStartsWith",(e,t)=>{et.init(e,t);const n=new RegExp(`^${Wt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Nf=$("$ZodCheckEndsWith",(e,t)=>{et.init(e,t);const n=new RegExp(`.*${Wt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Df=$("$ZodCheckOverwrite",(e,t)=>{et.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Lf{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
10
|
+
`).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
11
|
+
`))}}const jf={major:4,minor:4,patch:3},be=$("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=jf;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(a,l,u)=>{let d=Zt(a),c;for(const f of l){if(f._zod.def.when){if(Fd(a)||!f._zod.def.when(a))continue}else if(d)continue;const h=a.issues.length,p=f._zod.check(a);if(p instanceof Promise&&(u==null?void 0:u.async)===!1)throw new Ut;if(c||p instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await p,a.issues.length!==h&&(d||(d=Zt(a,h)))});else{if(a.issues.length===h)continue;d||(d=Zt(a,h))}}return c?c.then(()=>a):a},s=(a,l,u)=>{if(Zt(a))return a.aborted=!0,a;const d=i(l,r,u);if(d instanceof Promise){if(u.async===!1)throw new Ut;return d.then(c=>e._zod.parse(c,u))}return e._zod.parse(d,u)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){const d=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return d instanceof Promise?d.then(c=>s(c,a,l)):s(d,a,l)}const u=e._zod.parse(a,l);if(u instanceof Promise){if(l.async===!1)throw new Ut;return u.then(d=>i(d,r,l))}return i(u,r,l)}}ae(e,"~standard",()=>({validate:i=>{var s;try{const a=Vd(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return Hd(e,i).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}))}),ho=$("$ZodString",(e,t)=>{var n;be.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??kf(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ge=$("$ZodStringFormat",(e,t)=>{wr.init(e,t),ho.init(e,t)}),Zf=$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lf),ge.init(e,t)}),Mf=$("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Yo(r))}else t.pattern??(t.pattern=Yo());ge.init(e,t)}),Ff=$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cf),ge.init(e,t)}),Uf=$("$ZodURL",(e,t)=>{ge.init(e,t),e._zod.check=n=>{var r;try{const o=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===vf.source&&!/^https?:\/\//i.test(o)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Bf=$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=df()),ge.init(e,t)}),Vf=$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sf),ge.init(e,t)}),Hf=$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ef),ge.init(e,t)}),Wf=$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tf),ge.init(e,t)}),Kf=$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nf),ge.init(e,t)}),Jf=$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rf),ge.init(e,t)}),qf=$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=of),ge.init(e,t)}),Gf=$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xf(t)),ge.init(e,t)}),Yf=$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=wf),ge.init(e,t)}),Xf=$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yf(t)),ge.init(e,t)}),Qf=$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=af),ge.init(e,t)}),eh=$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ff),ge.init(e,t),e._zod.bag.format="ipv4"}),th=$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=hf),ge.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),nh=$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gf),ge.init(e,t)}),rh=$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mf),ge.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function $s(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const oh=$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=pf),ge.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{$s(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function ih(e){if(!xs.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return $s(n)}const sh=$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=xs),ge.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{ih(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ah=$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=bf),ge.init(e,t)});function lh(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const ch=$("$ZodJWT",(e,t)=>{ge.init(e,t),e._zod.check=n=>{lh(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uh=$("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=$f,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),dh=$("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),fh=$("$ZodNever",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Xo(e,t,n){e.issues.length&&t.issues.push(...Mt(n,e.issues)),t.value[n]=e.value}const hh=$("$ZodArray",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(u=>Xo(u,n,s))):Xo(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function nr(e,t,n,r,o,i){const s=n in r;if(e.issues.length){if(o&&i&&!s)return;t.issues.push(...Mt(n,e.issues))}if(!s&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?s&&(t.value[n]=void 0):t.value[n]=e.value}function Ss(e){var r,o,i,s;const t=Object.keys(e.shape);for(const a of t)if(!((s=(i=(o=(r=e.shape)==null?void 0:r[a])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&s.has("$ZodType")))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=Id(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function As(e,t,n,r,o,i){const s=[],a=o.keySet,l=o.catchall._zod,u=l.def.type,d=l.optin==="optional",c=l.optout==="optional";for(const f in t){if(f==="__proto__"||a.has(f))continue;if(u==="never"){s.push(f);continue}const h=l.run({value:t[f],issues:[]},r);h instanceof Promise?e.push(h.then(p=>nr(p,n,f,t,d,c))):nr(h,n,f,t,d,c)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const gh=$("$ZodObject",(e,t)=>{be.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...a};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=pr(()=>Ss(t));ae(e._zod,"propValues",()=>{const a=t.shape,l={};for(const u in a){const d=a[u]._zod;if(d.values){l[u]??(l[u]=new Set);for(const c of d.values)l[u].add(c)}}return l});const o=$n,i=t.catchall;let s;e._zod.parse=(a,l)=>{s??(s=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const d=[],c=s.shape;for(const f of s.keys){const h=c[f],p=h._zod.optin==="optional",v=h._zod.optout==="optional",b=h._zod.run({value:u[f],issues:[]},l);b instanceof Promise?d.push(b.then(y=>nr(y,a,f,u,p,v))):nr(b,a,f,u,p,v)}return i?As(d,u,a,l,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),mh=$("$ZodObjectJIT",(e,t)=>{gh.init(e,t);const n=e._zod.parse,r=pr(()=>Ss(t)),o=f=>{var k,T;const h=new Lf(["shape","payload","ctx"]),p=r.value,v=D=>{const E=Go(D);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};h.write("const input = payload.value;");const b=Object.create(null);let y=0;for(const D of p.keys)b[D]=`key_${y++}`;h.write("const newResult = {};");for(const D of p.keys){const E=b[D],O=Go(D),N=f[D],Y=((k=N==null?void 0:N._zod)==null?void 0:k.optin)==="optional",M=((T=N==null?void 0:N._zod)==null?void 0:T.optout)==="optional";h.write(`const ${E} = ${v(D)};`),Y&&M?h.write(`
|
|
12
|
+
if (${E}.issues.length) {
|
|
13
|
+
if (${O} in input) {
|
|
14
|
+
payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
15
|
+
...iss,
|
|
16
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
17
|
+
})));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (${E}.value === undefined) {
|
|
22
|
+
if (${O} in input) {
|
|
23
|
+
newResult[${O}] = undefined;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
newResult[${O}] = ${E}.value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
`):Y?h.write(`
|
|
30
|
+
if (${E}.issues.length) {
|
|
31
|
+
payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (${E}.value === undefined) {
|
|
38
|
+
if (${O} in input) {
|
|
39
|
+
newResult[${O}] = undefined;
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
newResult[${O}] = ${E}.value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
`):h.write(`
|
|
46
|
+
const ${E}_present = ${O} in input;
|
|
47
|
+
if (${E}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
|
|
49
|
+
...iss,
|
|
50
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
if (!${E}_present && !${E}.issues.length) {
|
|
54
|
+
payload.issues.push({
|
|
55
|
+
code: "invalid_type",
|
|
56
|
+
expected: "nonoptional",
|
|
57
|
+
input: undefined,
|
|
58
|
+
path: [${O}]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (${E}_present) {
|
|
63
|
+
if (${E}.value === undefined) {
|
|
64
|
+
newResult[${O}] = undefined;
|
|
65
|
+
} else {
|
|
66
|
+
newResult[${O}] = ${E}.value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
`)}h.write("payload.value = newResult;"),h.write("return payload;");const z=h.compile();return(D,E)=>z(f,D,E)};let i;const s=$n,a=!so.jitless,u=a&&Td.value,d=t.catchall;let c;e._zod.parse=(f,h)=>{c??(c=r.value);const p=f.value;return s(p)?a&&u&&(h==null?void 0:h.async)===!1&&h.jitless!==!0?(i||(i=o(t.shape)),f=i(f,h),d?As([],p,f,h,c,e):f):n(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f)}});function Qo(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Zt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>lt(s,r,at())))}),t)}const zs=$("$ZodUnion",(e,t)=>{be.init(e,t),ae(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ae(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ae(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),ae(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>lo(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const s=[];for(const a of t.options){const l=a._zod.run({value:r.value,issues:[]},o);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}return i?Promise.all(s).then(a=>Qo(a,r,e,o)):Qo(s,r,e,o)}}),ph=$("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,zs.init(e,t);const n=e._zod.parse;ae(e._zod,"propValues",()=>{const o={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[a,l]of Object.entries(s)){o[a]||(o[a]=new Set);for(const u of l)o[a].add(u)}}return o});const r=pr(()=>{var s;const o=t.options,i=new Map;for(const a of o){const l=(s=a._zod.propValues)==null?void 0:s[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const u of l){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,a)}}return i});e._zod.parse=(o,i)=>{const s=o.value;if(!$n(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s==null?void 0:s[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:s,path:[t.discriminator],inst:e}),o)}}),vh=$("$ZodIntersection",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,u])=>ei(n,l,u)):ei(n,i,s)}});function Wr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ht(e)&&Ht(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=Wr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=Wr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ei(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const l of a.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(a);const i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),Zt(e))return e;const s=Wr(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const bh=$("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Ht(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>lt(h,r,at())),input:u,path:[u],inst:e});continue}const c=d.value,f=t.valueType._zod.run({value:o[u],issues:[]},r);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...Mt(u,h.issues)),n.value[c]=h.value})):(f.issues.length&&n.issues.push(...Mt(u,f.issues)),n.value[c]=f.value)}let l;for(const u in o)a.has(u)||(l=l??[],l.push(u));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&_f.test(a)&&l.issues.length){const c=t.keyType._zod.run({value:Number(a),issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");c.issues.length===0&&(l=c)}if(l.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(c=>lt(c,r,at())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?i.push(d.then(c=>{c.issues.length&&n.issues.push(...Mt(a,c.issues)),n.value[l.value]=c.value})):(d.issues.length&&n.issues.push(...Mt(a,d.issues)),n.value[l.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),wh=$("$ZodEnum",(e,t)=>{be.init(e,t);const n=ms(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Pd.has(typeof o)).map(o=>typeof o=="string"?Wt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),yh=$("$ZodLiteral",(e,t)=>{if(be.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Wt(r):r?Wt(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),xh=$("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new gs(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n.fallback=!0,n));if(o instanceof Promise)throw new Ut;return n.value=o,n.fallback=!0,n}});function ti(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Cs=$("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${lo(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(s=>ti(s,o)):ti(i,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),kh=$("$ZodExactOptional",(e,t)=>{Cs.init(e,t),ae(e._zod,"values",()=>t.innerType._zod.values),ae(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_h=$("$ZodNullable",(e,t)=>{be.init(e,t),ae(e._zod,"optin",()=>t.innerType._zod.optin),ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${lo(n.source)}|null)$`):void 0}),ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),$h=$("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ni(i,t)):ni(o,t)}});function ni(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Sh=$("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Ah=$("$ZodNonOptional",(e,t)=>{be.init(e,t),ae(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ri(i,e)):ri(o,e)}});function ri(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const zh=$("$ZodCatch",(e,t)=>{be.init(e,t),e._zod.optin="optional",ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>lt(s,r,at()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>lt(i,r,at()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Ch=$("$ZodPipe",(e,t)=>{be.init(e,t),ae(e._zod,"values",()=>t.in._zod.values),ae(e._zod,"optin",()=>t.in._zod.optin),ae(e._zod,"optout",()=>t.out._zod.optout),ae(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Vn(s,t.in,r)):Vn(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Vn(i,t.out,r)):Vn(o,t.out,r)}});function Vn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Eh=$("$ZodReadonly",(e,t)=>{be.init(e,t),ae(e._zod,"propValues",()=>t.innerType._zod.propValues),ae(e._zod,"values",()=>t.innerType._zod.values),ae(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ae(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(oi):oi(o)}});function oi(e){return e.value=Object.freeze(e.value),e}const Oh=$("$ZodCustom",(e,t)=>{et.init(e,t),be.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ii(i,n,r,e));ii(o,n,r,e)}});function ii(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Sn(o))}}var si;class Th{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ph(){return new Th}(si=globalThis).__zod_globalRegistry??(si.__zod_globalRegistry=Ph());const pn=globalThis.__zod_globalRegistry;function Ih(e,t){return new e({type:"string",...V(t)})}function Rh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...V(t)})}function ai(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...V(t)})}function Nh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...V(t)})}function Dh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...V(t)})}function Lh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...V(t)})}function jh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...V(t)})}function Zh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...V(t)})}function Mh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...V(t)})}function Fh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...V(t)})}function Uh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...V(t)})}function Bh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...V(t)})}function Vh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...V(t)})}function Hh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...V(t)})}function Wh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...V(t)})}function Kh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...V(t)})}function Jh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...V(t)})}function qh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...V(t)})}function Gh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...V(t)})}function Yh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...V(t)})}function Xh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...V(t)})}function Qh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...V(t)})}function eg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...V(t)})}function tg(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...V(t)})}function ng(e,t){return new e({type:"string",format:"date",check:"string_format",...V(t)})}function rg(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...V(t)})}function og(e,t){return new e({type:"string",format:"duration",check:"string_format",...V(t)})}function ig(e,t){return new e({type:"boolean",...V(t)})}function sg(e){return new e({type:"unknown"})}function ag(e,t){return new e({type:"never",...V(t)})}function Es(e,t){return new zf({check:"max_length",...V(t),maximum:e})}function rr(e,t){return new Cf({check:"min_length",...V(t),minimum:e})}function Os(e,t){return new Ef({check:"length_equals",...V(t),length:e})}function lg(e,t){return new Of({check:"string_format",format:"regex",...V(t),pattern:e})}function cg(e){return new Tf({check:"string_format",format:"lowercase",...V(e)})}function ug(e){return new Pf({check:"string_format",format:"uppercase",...V(e)})}function dg(e,t){return new If({check:"string_format",format:"includes",...V(t),includes:e})}function fg(e,t){return new Rf({check:"string_format",format:"starts_with",...V(t),prefix:e})}function hg(e,t){return new Nf({check:"string_format",format:"ends_with",...V(t),suffix:e})}function en(e){return new Df({check:"overwrite",tx:e})}function gg(e){return en(t=>t.normalize(e))}function mg(){return en(e=>e.trim())}function pg(){return en(e=>e.toLowerCase())}function vg(){return en(e=>e.toUpperCase())}function bg(){return en(e=>Od(e))}function wg(e,t,n){return new e({type:"array",element:t,...V(n)})}function yg(e,t,n){return new e({type:"custom",check:"custom",fn:t,...V(n)})}function xg(e,t){const n=kg(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Sn(o,r.value,n._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Sn(i))}},e(r.value,r)),t);return n}function kg(e,t){const n=new et({check:"custom",...V(t)});return n._zod.check=e,n}function Ts(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??pn,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function _e(e,t,n={path:[],schemaPath:[]}){var d,c;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=(c=(d=e._zod).toJSONSchema)==null?void 0:c.call(d);if(a)s.schema=a;else{const f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,f);else{const p=s.schema,v=t.processors[o.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);v(e,t,p,f)}const h=e._zod.parent;h&&(s.ref||(s.ref=h),_e(h,t,f),t.seen.get(h).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),t.io==="input"&&Ee(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Ps(e,t){var s,a,l,u;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of e.seen.entries()){const c=(s=e.metadataRegistry.get(d[0]))==null?void 0:s.id;if(c){const f=r.get(c);if(f&&f!==d[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,d[0])}}const o=d=>{var v;const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const b=(v=e.external.registry.get(d[0]))==null?void 0:v.id,y=e.external.uri??(k=>k);if(b)return{ref:y(b)};const z=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=z,{defId:z,ref:`${y("__shared")}#/${c}/${z}`}}if(d[1]===n)return{ref:"#"};const h=`#/${c}/`,p=d[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:h+p}},i=d=>{if(d[1].schema.$ref)return;const c=d[1],{ref:f,defId:h}=o(d);c.def={...c.schema},h&&(c.defId=h);const p=c.schema;for(const v in p)delete p[v];p.$ref=f};if(e.cycles==="throw")for(const d of e.seen.entries()){const c=d[1];if(c.cycle)throw new Error(`Cycle detected: #/${(a=c.cycle)==null?void 0:a.join("/")}/<root>
|
|
71
|
+
|
|
72
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const c=d[1];if(t===d[0]){i(d);continue}if(e.external){const h=(l=e.external.registry.get(d[0]))==null?void 0:l.id;if(t!==d[0]&&h){i(d);continue}}if((u=e.metadataRegistry.get(d[0]))==null?void 0:u.id){i(d);continue}if(c.cycle){i(d);continue}if(c.count>1&&e.reused==="ref"){i(d);continue}}}function Is(e,t){var a,l,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const f=e.seen.get(c);if(f.ref===null)return;const h=f.def??f.schema,p={...h},v=f.ref;if(f.ref=null,v){r(v);const y=e.seen.get(v),z=y.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(z)):Object.assign(h,z),Object.assign(h,p),c._zod.parent===v)for(const T in h)T==="$ref"||T==="allOf"||T in p||delete h[T];if(z.$ref&&y.def)for(const T in h)T==="$ref"||T==="allOf"||T in y.def&&JSON.stringify(h[T])===JSON.stringify(y.def[T])&&delete h[T]}const b=c._zod.parent;if(b&&b!==v){r(b);const y=e.seen.get(b);if(y!=null&&y.schema.$ref&&(h.$ref=y.schema.$ref,y.def))for(const z in h)z==="$ref"||z==="allOf"||z in y.def&&JSON.stringify(h[z])===JSON.stringify(y.def[z])&&delete h[z]}e.override({zodSchema:c,jsonSchema:h,path:f.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const c=(l=e.external.registry.get(t))==null?void 0:l.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,n.def??n.schema);const i=(u=e.metadataRegistry.get(t))==null?void 0:u.id;i!==void 0&&o.id===i&&delete o.id;const s=((d=e.external)==null?void 0:d.defs)??{};for(const c of e.seen.entries()){const f=c[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,s[f.defId]=f.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:or(t,"input",e.processors),output:or(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ee(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ee(r.element,n);if(r.type==="set")return Ee(r.valueType,n);if(r.type==="lazy")return Ee(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ee(r.innerType,n);if(r.type==="intersection")return Ee(r.left,n)||Ee(r.right,n);if(r.type==="record"||r.type==="map")return Ee(r.keyType,n)||Ee(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ee(r.in,n)||Ee(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ee(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ee(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ee(o,n))return!0;return!!(r.rest&&Ee(r.rest,n))}return!1}const _g=(e,t={})=>n=>{const r=Ts({...n,processors:t});return _e(e,r),Ps(r,e),Is(r,e)},or=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Ts({...o??{},target:i,io:t,processors:n});return _e(e,s),Ps(s,e),Is(s,e)},$g={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Sg=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:s,format:a,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=$g[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),l&&l.size>0){const d=[...l];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(c=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:c.source}))])}},Ag=(e,t,n,r)=>{n.type="boolean"},zg=(e,t,n,r)=>{n.not={}},Cg=(e,t,n,r)=>{},Eg=(e,t,n,r)=>{const o=e._zod.def,i=ms(o.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Og=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const s of o.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Tg=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Pg=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ig=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=_e(i.element,t,{...r,path:[...r.path,"items"]})},Rg=(e,t,n,r)=>{var u;const o=n,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const d in s)o.properties[d]=_e(s[d],t,{...r,path:[...r.path,"properties",d]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(d=>{const c=i.shape[d]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((u=i.catchall)==null?void 0:u._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=_e(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Ng=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,l)=>_e(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=s:n.anyOf=s},Dg=(e,t,n,r)=>{const o=e._zod.def,i=_e(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=_e(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,l=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=l},Lg=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const s=i.keyType,a=s._zod.bag,l=a==null?void 0:a.patterns;if(i.mode==="loose"&&l&&l.size>0){const d=_e(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const c of l)o.patternProperties[c.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=_e(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=_e(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=s._zod.values;if(u){const d=[...u].filter(c=>typeof c=="string"||typeof c=="number");d.length>0&&(o.required=d)}},jg=(e,t,n,r)=>{const o=e._zod.def,i=_e(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Zg=(e,t,n,r)=>{const o=e._zod.def;_e(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Mg=(e,t,n,r)=>{const o=e._zod.def;_e(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Fg=(e,t,n,r)=>{const o=e._zod.def;_e(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ug=(e,t,n,r)=>{const o=e._zod.def;_e(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Bg=(e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;_e(s,t,r);const a=t.seen.get(e);a.ref=s},Vg=(e,t,n,r)=>{const o=e._zod.def;_e(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Rs=(e,t,n,r)=>{const o=e._zod.def;_e(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Hg=$("ZodISODateTime",(e,t)=>{Gf.init(e,t),me.init(e,t)});function Wg(e){return tg(Hg,e)}const Kg=$("ZodISODate",(e,t)=>{Yf.init(e,t),me.init(e,t)});function Jg(e){return ng(Kg,e)}const qg=$("ZodISOTime",(e,t)=>{Xf.init(e,t),me.init(e,t)});function Gg(e){return rg(qg,e)}const Yg=$("ZodISODuration",(e,t)=>{Qf.init(e,t),me.init(e,t)});function Xg(e){return og(Yg,e)}const Qg=(e,t)=>{ws.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Bd(e,n)},flatten:{value:n=>Ud(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Hr,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Hr,2)}},isEmpty:{get(){return e.issues.length===0}}})},We=$("ZodError",Qg,{Parent:Error}),em=uo(We),tm=fo(We),nm=vr(We),rm=br(We),om=Wd(We),im=Kd(We),sm=Jd(We),am=qd(We),lm=Gd(We),cm=Yd(We),um=Xd(We),dm=Qd(We),li=new WeakMap;function yr(e,t,n){const r=Object.getPrototypeOf(e);let o=li.get(r);if(o||(o=new Set,li.set(r,o)),!o.has(t)){o.add(t);for(const i in n){const s=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const a=s.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const we=$("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:or(e,"input"),output:or(e,"output")}}),e.toJSONSchema=_g(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>em(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>nm(e,n,r),e.parseAsync=async(n,r)=>tm(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>rm(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>om(e,n,r),e.decode=(n,r)=>im(e,n,r),e.encodeAsync=async(n,r)=>sm(e,n,r),e.decodeAsync=async(n,r)=>am(e,n,r),e.safeEncode=(n,r)=>lm(e,n,r),e.safeDecode=(n,r)=>cm(e,n,r),e.safeEncodeAsync=async(n,r)=>um(e,n,r),e.safeDecodeAsync=async(n,r)=>dm(e,n,r),yr(e,"ZodType",{check(...n){const r=this.def;return this.clone(wt(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return yt(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Xm(n,r))},superRefine(n,r){return this.check(Qm(n,r))},overwrite(n){return this.check(en(n))},optional(){return di(this)},exactOptional(){return Mm(this)},nullable(){return fi(this)},nullish(){return di(fi(this))},nonoptional(n){return Hm(this,n)},array(){return Ke(this)},or(n){return Pm([this,n])},and(n){return Dm(this,n)},transform(n){return hi(this,jm(n))},default(n){return Um(this,n)},prefault(n){return Vm(this,n)},catch(n){return Km(this,n)},pipe(n){return hi(this,n)},readonly(){return Gm(this)},describe(n){const r=this.clone();return pn.add(r,{description:n}),r},meta(...n){if(n.length===0)return pn.get(this);const r=this.clone();return pn.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=pn.get(e))==null?void 0:n.description},configurable:!0}),e)),Ns=$("_ZodString",(e,t)=>{ho.init(e,t),we.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Sg(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,yr(e,"_ZodString",{regex(...r){return this.check(lg(...r))},includes(...r){return this.check(dg(...r))},startsWith(...r){return this.check(fg(...r))},endsWith(...r){return this.check(hg(...r))},min(...r){return this.check(rr(...r))},max(...r){return this.check(Es(...r))},length(...r){return this.check(Os(...r))},nonempty(...r){return this.check(rr(1,...r))},lowercase(r){return this.check(cg(r))},uppercase(r){return this.check(ug(r))},trim(){return this.check(mg())},normalize(...r){return this.check(gg(...r))},toLowerCase(){return this.check(pg())},toUpperCase(){return this.check(vg())},slugify(){return this.check(bg())}})}),Kr=$("ZodString",(e,t)=>{ho.init(e,t),Ns.init(e,t),e.email=n=>e.check(Rh(fm,n)),e.url=n=>e.check(Zh(hm,n)),e.jwt=n=>e.check(eg(Cm,n)),e.emoji=n=>e.check(Mh(gm,n)),e.guid=n=>e.check(ai(ci,n)),e.uuid=n=>e.check(Nh(Hn,n)),e.uuidv4=n=>e.check(Dh(Hn,n)),e.uuidv6=n=>e.check(Lh(Hn,n)),e.uuidv7=n=>e.check(jh(Hn,n)),e.nanoid=n=>e.check(Fh(mm,n)),e.guid=n=>e.check(ai(ci,n)),e.cuid=n=>e.check(Uh(pm,n)),e.cuid2=n=>e.check(Bh(vm,n)),e.ulid=n=>e.check(Vh(bm,n)),e.base64=n=>e.check(Yh(Sm,n)),e.base64url=n=>e.check(Xh(Am,n)),e.xid=n=>e.check(Hh(wm,n)),e.ksuid=n=>e.check(Wh(ym,n)),e.ipv4=n=>e.check(Kh(xm,n)),e.ipv6=n=>e.check(Jh(km,n)),e.cidrv4=n=>e.check(qh(_m,n)),e.cidrv6=n=>e.check(Gh($m,n)),e.e164=n=>e.check(Qh(zm,n)),e.datetime=n=>e.check(Wg(n)),e.date=n=>e.check(Jg(n)),e.time=n=>e.check(Gg(n)),e.duration=n=>e.check(Xg(n))});function Q(e){return Ih(Kr,e)}const me=$("ZodStringFormat",(e,t)=>{ge.init(e,t),Ns.init(e,t)}),fm=$("ZodEmail",(e,t)=>{Ff.init(e,t),me.init(e,t)}),ci=$("ZodGUID",(e,t)=>{Zf.init(e,t),me.init(e,t)}),Hn=$("ZodUUID",(e,t)=>{Mf.init(e,t),me.init(e,t)}),hm=$("ZodURL",(e,t)=>{Uf.init(e,t),me.init(e,t)}),gm=$("ZodEmoji",(e,t)=>{Bf.init(e,t),me.init(e,t)}),mm=$("ZodNanoID",(e,t)=>{Vf.init(e,t),me.init(e,t)}),pm=$("ZodCUID",(e,t)=>{Hf.init(e,t),me.init(e,t)}),vm=$("ZodCUID2",(e,t)=>{Wf.init(e,t),me.init(e,t)}),bm=$("ZodULID",(e,t)=>{Kf.init(e,t),me.init(e,t)}),wm=$("ZodXID",(e,t)=>{Jf.init(e,t),me.init(e,t)}),ym=$("ZodKSUID",(e,t)=>{qf.init(e,t),me.init(e,t)}),xm=$("ZodIPv4",(e,t)=>{eh.init(e,t),me.init(e,t)}),km=$("ZodIPv6",(e,t)=>{th.init(e,t),me.init(e,t)}),_m=$("ZodCIDRv4",(e,t)=>{nh.init(e,t),me.init(e,t)}),$m=$("ZodCIDRv6",(e,t)=>{rh.init(e,t),me.init(e,t)}),Sm=$("ZodBase64",(e,t)=>{oh.init(e,t),me.init(e,t)}),Am=$("ZodBase64URL",(e,t)=>{sh.init(e,t),me.init(e,t)}),zm=$("ZodE164",(e,t)=>{ah.init(e,t),me.init(e,t)}),Cm=$("ZodJWT",(e,t)=>{ch.init(e,t),me.init(e,t)}),Ds=$("ZodBoolean",(e,t)=>{uh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ag(e,n,r)});function it(e){return ig(Ds,e)}const Em=$("ZodUnknown",(e,t)=>{dh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cg()});function Jr(){return sg(Em)}const Om=$("ZodNever",(e,t)=>{fh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zg(e,n,r)});function Tm(e){return ag(Om,e)}const Ls=$("ZodArray",(e,t)=>{hh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ig(e,n,r,o),e.element=t.element,yr(e,"ZodArray",{min(n,r){return this.check(rr(n,r))},nonempty(n){return this.check(rr(1,n))},max(n,r){return this.check(Es(n,r))},length(n,r){return this.check(Os(n,r))},unwrap(){return this.element}})});function Ke(e,t){return wg(Ls,e,t)}const go=$("ZodObject",(e,t)=>{mh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rg(e,n,r,o),ae(e,"shape",()=>t.shape),yr(e,"ZodObject",{keyof(){return Ue(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Jr()})},loose(){return this.clone({...this._zod.def,catchall:Jr()})},strict(){return this.clone({...this._zod.def,catchall:Tm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Dd(this,n)},safeExtend(n){return Ld(this,n)},merge(n){return jd(this,n)},pick(n){return Rd(this,n)},omit(n){return Nd(this,n)},partial(...n){return Zd(mo,this,n[0])},required(...n){return Md(Us,this,n[0])}})});function ce(e,t){const n={type:"object",shape:e??{},...V(t)};return new go(n)}const js=$("ZodUnion",(e,t)=>{zs.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ng(e,n,r,o),e.options=t.options});function Pm(e,t){return new js({type:"union",options:e,...V(t)})}const Im=$("ZodDiscriminatedUnion",(e,t)=>{js.init(e,t),ph.init(e,t)});function Rm(e,t,n){return new Im({type:"union",options:t,discriminator:e,...V(n)})}const Nm=$("ZodIntersection",(e,t)=>{vh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dg(e,n,r,o)});function Dm(e,t){return new Nm({type:"intersection",left:e,right:t})}const ui=$("ZodRecord",(e,t)=>{bh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lg(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Zs(e,t,n){return!t||!t._zod?new ui({type:"record",keyType:Q(),valueType:e,...V(t)}):new ui({type:"record",keyType:e,valueType:t,...V(n)})}const ir=$("ZodEnum",(e,t)=>{wh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Eg(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ir({...t,checks:[],...V(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new ir({...t,checks:[],...V(o),entries:i})}});function Ue(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ir({type:"enum",entries:n,...V(t)})}const Ms=$("ZodLiteral",(e,t)=>{yh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Og(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function bn(e,t){return new Ms({type:"literal",values:Array.isArray(e)?e:[e],...V(t)})}const Lm=$("ZodTransform",(e,t)=>{xh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pg(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new gs(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Sn(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(Sn(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function jm(e){return new Lm({type:"transform",transform:e})}const mo=$("ZodOptional",(e,t)=>{Cs.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function di(e){return new mo({type:"optional",innerType:e})}const Zm=$("ZodExactOptional",(e,t)=>{kh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Mm(e){return new Zm({type:"optional",innerType:e})}const Fm=$("ZodNullable",(e,t)=>{_h.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fi(e){return new Fm({type:"nullable",innerType:e})}const Fs=$("ZodDefault",(e,t)=>{$h.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Um(e,t){return new Fs({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():vs(t)}})}const Bm=$("ZodPrefault",(e,t)=>{Sh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vm(e,t){return new Bm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():vs(t)}})}const Us=$("ZodNonOptional",(e,t)=>{Ah.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Hm(e,t){return new Us({type:"nonoptional",innerType:e,...V(t)})}const Wm=$("ZodCatch",(e,t)=>{zh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ug(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Km(e,t){return new Wm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Jm=$("ZodPipe",(e,t)=>{Ch.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bg(e,n,r,o),e.in=t.in,e.out=t.out});function hi(e,t){return new Jm({type:"pipe",in:e,out:t})}const qm=$("ZodReadonly",(e,t)=>{Eh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vg(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gm(e){return new qm({type:"readonly",innerType:e})}const Ym=$("ZodCustom",(e,t)=>{Oh.init(e,t),we.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tg(e,n)});function Xm(e,t={}){return yg(Ym,e,t)}function Qm(e,t){return xg(e,t)}const pe={custom:"custom"},gi=["copy","like","dislike","regenerate","edit","speak"],ep=[{name:"Surfaces",tokens:[{token:"--kai-color-background",label:"Background",hint:"App / chat surface"},{token:"--kai-color-foreground",label:"Foreground",hint:"Default text"},{token:"--kai-color-card",label:"Card",hint:"Bubbles, panels, cards"},{token:"--kai-color-card-foreground",label:"Card text",hint:"Text on cards"},{token:"--kai-color-popover",label:"Popover",hint:"Menus & popovers"},{token:"--kai-color-popover-foreground",label:"Popover text",hint:"Text in popovers"},{token:"--kai-color-sidebar",label:"Sidebar",hint:"Conversation sidebar"},{token:"--kai-color-surface",label:"Surface",hint:"Composer, chips, card headers"},{token:"--kai-color-surface-strong",label:"Surface strong",hint:"Raised / hover step of surface"},{token:"--kai-color-surface-sunken",label:"Surface sunken",hint:"Wells, recessed below surface"}]},{name:"Brand & actions",tokens:[{token:"--kai-color-primary",label:"Primary",hint:"Buttons, accents, send"},{token:"--kai-color-primary-foreground",label:"On primary",hint:"Text on primary"},{token:"--kai-color-ring",label:"Focus ring",hint:"Keyboard-focus outline"},{token:"--kai-color-accent",label:"Accent",hint:"Hover / accent surface"},{token:"--kai-color-accent-foreground",label:"On accent",hint:"Text on accent"},{token:"--kai-color-secondary",label:"Secondary",hint:"Secondary surface"},{token:"--kai-color-secondary-foreground",label:"On secondary",hint:"Text on secondary"}]},{name:"Muted text",tokens:[{token:"--kai-color-muted",label:"Muted",hint:"Subtle fills"},{token:"--kai-color-muted-foreground",label:"Muted text",hint:"Secondary text"}]},{name:"Inputs & borders",tokens:[{token:"--kai-color-border",label:"Border",hint:"Dividers & card outlines"},{token:"--kai-color-input",label:"Input",hint:"Control edge: inputs, selects, checks"}]},{name:"Status",tokens:[{token:"--kai-color-destructive",label:"Destructive",hint:"Danger / delete"},{token:"--kai-color-destructive-foreground",label:"On destructive",hint:"Text on danger"},{token:"--kai-color-destructive-text",label:"Destructive text",hint:"Error text — legible in both modes"},{token:"--kai-color-destructive-soft",label:"Destructive soft",hint:"Tinted danger callout"},{token:"--kai-color-success",label:"Success",hint:"Done / confirmed"},{token:"--kai-color-success-foreground",label:"On success",hint:"Text on success"},{token:"--kai-color-success-soft",label:"Success soft",hint:"Tinted success callout"},{token:"--kai-color-warning",label:"Warning",hint:"Caution / unsendable"},{token:"--kai-color-warning-foreground",label:"On warning",hint:"Text on warning"},{token:"--kai-color-warning-soft",label:"Warning soft",hint:"Tinted warning callout"},{token:"--kai-color-info",label:"Info",hint:"Informational toasts"},{token:"--kai-color-info-foreground",label:"On info",hint:"Text on info"},{token:"--kai-color-info-soft",label:"Info soft",hint:"Tinted info callout"}]},{name:"Interaction",tokens:[{token:"--kai-color-hover",label:"Hover",hint:"Row / control hover fill"},{token:"--kai-color-selected",label:"Selected",hint:"Selected row fill"},{token:"--kai-color-unread",label:"Unread",hint:"Unread dot & badge"},{token:"--kai-color-highlight",label:"Highlight",hint:"Marked keywords (composer highlights)"},{token:"--kai-color-selection",label:"Selection",hint:"Selected-text background"},{token:"--kai-color-selection-foreground",label:"On selection",hint:"Selected-text colour"}]},{name:"Code & tools",tokens:[{token:"--kai-color-code-foreground",label:"Code",hint:"Inline code accent"},{token:"--kai-color-tool-blue",label:"Tool blue",hint:"Tool / status chip"},{token:"--kai-color-tool-amber",label:"Tool amber",hint:"Tool / status chip"},{token:"--kai-color-tool-green",label:"Tool green",hint:"Tool / status chip"},{token:"--kai-color-tool-red",label:"Tool red",hint:"Tool / status chip"}]},{name:"Scrollbar",tokens:[{token:"--kai-color-scrollbar-thumb",label:"Scrollbar",hint:"Scrollbar thumb"},{token:"--kai-color-scrollbar-thumb-hover",label:"Scrollbar hover",hint:"Thumb on hover"}]}],tp=ep.flatMap(e=>e.tokens),np=[{token:"--kai-text-micro",label:"Micro",hint:"Badges, pills, eyebrows",min:.5,max:1},{token:"--kai-text-caption",label:"Caption",hint:"Sub-counts, xs code",min:.5,max:1.125},{token:"--kai-text-meta",label:"Meta",hint:"Controls, toggles, switchers",min:.5,max:1.25},{token:"--kai-text-compact",label:"Compact",hint:"Dense chrome & code",min:.5625,max:1.3125},{token:"--kai-text-body",label:"Body (default)",hint:"Primary reading text",min:.625,max:1.375},{token:"--kai-text-title",label:"Title",hint:"Emphasis & headers",min:.75,max:1.625},{token:"--kai-text-lg",label:"Large",hint:"Section headings, lg prose",min:.875,max:2}],rp=["--kai-radius","--kai-density","--kai-radius-pill","--kai-code-radius","--kai-shadow-strength","--kai-weight-normal","--kai-weight-medium","--kai-weight-semibold","--kai-weight-bold","--kai-font-base","--kai-font-code","--kai-tracking","--kai-shadow-color"];function op(){return new Set([...tp.map(e=>e.token),...np.map(e=>e.token),...rp])}const ip=op(),mi=256;function pi(e){if(e.length===0)return"must not be empty";if(e.length>mi)return`too long (${e.length} > ${mi} characters)`;if(!/^[\x20-\x7E]+$/.test(e))return"must be printable ASCII with no line breaks";if(/[{};\\]/.test(e))return"must not contain braces, semicolons or backslashes";if(e.includes("/*")||e.includes("*/"))return"must not contain CSS comment sequences";let t=0;for(const n of e)if(n==="(")t+=1;else if(n===")"&&(t-=1,t<0))return"unbalanced parentheses";return t!==0?"unbalanced parentheses":null}const sp=/^[a-z][a-z0-9]*-[a-z0-9-]+$/,vi=ce({id:Q().min(1),label:Q().min(1),description:Q().min(1).optional()}).strict(),Nr=Zs(Q(),Q()),ap=ce({light:Nr.optional(),dark:Nr.optional(),radius:Q().min(1).optional(),fonts:Nr.optional()}).strict().superRefine((e,t)=>{const n=(r,o,i)=>{for(const[s,a]of Object.entries(r??{})){ip.has(s)?i&&!s.startsWith(i.prefix)&&t.addIssue({code:pe.custom,path:[o,s],message:`"${s}" is not valid under "${o}" — ${i.reason}`}):t.addIssue({code:pe.custom,path:[o,s],message:`"${s}" is not a --kai-* knob the kit declares — see the theming guide for the token list`});const l=pi(a);l&&t.addIssue({code:pe.custom,path:[o,s],message:`value ${l}`})}};if(n(e.light,"light"),n(e.dark,"dark",{prefix:"--kai-color-",reason:'only --kai-color-* knobs have a dark-scope re-resolution in theme.css; a mode-less knob belongs in "light" (it applies in both modes)'}),n(e.fonts,"fonts",{prefix:"--kai-font-",reason:"only --kai-font-* knobs belong here"}),e.radius!==void 0){const r=pi(e.radius);r&&t.addIssue({code:pe.custom,path:["radius"],message:`value ${r}`})}}),lp=Rm("mode",[ce({mode:bn("mock")}).strict(),ce({mode:bn("endpoint"),url:Q().min(1),wire:Ue(["openai","anthropic"])}).strict()]),cp=ce({$schema:Q().optional(),name:Q().regex(sp,'must be a valid custom-element tag: lowercase, with a hyphen (e.g. "acme-support")'),layout:Ue(["widget","fullscreen","aside","split","custom"]),provider:lp,userId:Q().min(1).regex(/^[\x20-\x7E]+$/,"must be printable ASCII with no line breaks (it becomes an HTTP header value)").optional(),theme:ce({accent:Q().optional(),unreadColor:Q().optional(),mode:Ue(["light","dark","system"]).default("system"),tokens:ap.optional()}).strict().optional(),header:ce({title:Q().min(1).optional(),themeToggle:it().optional(),actions:Ke(ce({label:Q().min(1),variant:Ue(hs).optional()}).strict()).min(1).optional()}).strict().optional(),empty:ce({title:Q().min(1),description:Q().min(1).optional(),icon:Q().min(1).optional()}).strict().optional(),home:ce({greeting:ce({title:Q().min(1).optional(),subtitle:Q().min(1).optional()}).strict().optional(),recentConversation:bn(!0).optional(),newConversation:ce({label:Q().min(1).optional()}).strict().optional(),links:Ke(ce({label:Q().min(1),href:Q().min(1).optional(),description:Q().min(1).optional(),icon:Q().min(1).optional()}).strict()).optional()}).strict().optional(),capabilities:ce({starters:Ke(Q().min(1)).min(1).max(6).optional(),attachments:ce({accept:Ke(Q().min(1)).min(1)}).strict().optional(),history:ce({persistence:Ue(["none","local","endpoint"]),url:Q().min(1).optional()}).strict().optional(),reasoning:Ue(["full","compact","off"]).optional(),reasoningOpen:it().optional(),conversations:bn(!0).optional(),messageActions:ce({user:Ke(Ue(gi)).min(1).optional(),assistant:Ke(Ue(gi)).min(1).optional()}).strict().optional(),sources:ce({strip:it().optional()}).strict().optional()}).strict().optional(),cards:Ke(ce({name:Q().regex(/^[a-z][a-z0-9_]*$/),schema:Zs(Q(),Jr())}).strict()).min(1).optional(),slots:Ke(Q().regex(/^[a-z][a-z0-9-]*$/,"slot names must be kebab-case, starting with a letter")).min(1).max(8).optional(),widget:ce({position:Ue(["bottom-end","bottom-start","top-end","top-start"]).optional(),launcherIcon:Q().min(1).optional(),defaultOpen:it().optional()}).strict().optional(),aside:ce({position:Ue(["start","end"]).optional(),width:Q().min(1).optional()}).strict().optional(),workSurface:ce({kind:Ue(["artifact","preview"]),url:Q().min(1),codeUrl:Q().min(1).optional(),chrome:ce({deviceToggle:it().optional(),urlBar:it().optional(),openInNewTab:it().optional(),expand:it().optional(),codeView:it().optional()}).strict().optional()}).strict().optional(),shell:ce({commandPalette:bn(!0).optional(),userMenu:ce({name:Q().min(1),plan:Q().min(1).optional()}).strict().optional()}).strict().optional(),composer:ce({triggers:ce({slash:Ke(vi).min(1).optional(),mention:Ke(vi).min(1).optional()}).strict().optional()}).strict().optional()}).strict().superRefine((e,t)=>{for(const n of up)n.check(e,t)}),up=[{id:"slots-unique",paths:["slots"],check:(e,t)=>{if(!e.slots)return;const n=new Set;e.slots.forEach((r,o)=>{n.has(r)&&t.addIssue({code:pe.custom,path:["slots",o],message:`duplicate slot name "${r}"`}),n.add(r)})}},{id:"custom-layout-needs-slots",paths:["layout","slots"],check:(e,t)=>{e.layout==="custom"&&(!e.slots||e.slots.length===0)&&t.addIssue({code:pe.custom,path:["slots"],message:'"custom" layout requires at least one declared slot — custom IS the slots grain'})}},{id:"split-pane-slot-collision",paths:["layout","slots"],check:(e,t)=>{if(e.layout==="split"&&e.slots){const n=e.slots.indexOf("pane");n!==-1&&t.addIssue({code:pe.custom,path:["slots",n],message:`"pane" collides with the "split" layout's own fixed <slot name="pane"> — choose a different slot name`})}}},{id:"widget-layout-scope",paths:["layout","widget"],check:(e,t)=>{e.widget&&e.layout!=="widget"&&t.addIssue({code:pe.custom,path:["widget"],message:'"widget" is only valid on layout: "widget"'})}},{id:"aside-layout-scope",paths:["layout","aside"],check:(e,t)=>{e.aside&&e.layout!=="aside"&&t.addIssue({code:pe.custom,path:["aside"],message:'"aside" is only valid on layout: "aside"'})}},{id:"message-actions-unique",paths:["capabilities.messageActions.user","capabilities.messageActions.assistant"],check:(e,t)=>{var r;const n=(r=e.capabilities)==null?void 0:r.messageActions;if(n)for(const o of["user","assistant"]){const i=n[o];if(!i)continue;const s=new Set;i.forEach((a,l)=>{s.has(a)&&t.addIssue({code:pe.custom,path:["capabilities","messageActions",o,l],message:`duplicate action id "${a}"`}),s.add(a)})}}},{id:"launcher-icon-url",paths:["widget.launcherIcon"],check:(e,t)=>{var n;(n=e.widget)!=null&&n.launcherIcon&&!St(e.widget.launcherIcon)&&t.addIssue({code:pe.custom,path:["widget","launcherIcon"],message:"launcherIcon must be an http(s)/mailto or relative URL — no javascript:/data: schemes"})}},{id:"empty-icon-url",paths:["empty.icon"],check:(e,t)=>{var n;(n=e.empty)!=null&&n.icon&&!St(e.empty.icon)&&t.addIssue({code:pe.custom,path:["empty","icon"],message:"icon must be an http(s)/mailto or relative URL — no javascript:/data: schemes"})}},{id:"reasoning-open-scope",paths:["capabilities.reasoning","capabilities.reasoningOpen"],check:(e,t)=>{var o,i;const n=(o=e.capabilities)==null?void 0:o.reasoning;((i=e.capabilities)==null?void 0:i.reasoningOpen)!==void 0&&(n==="compact"||n==="off")&&t.addIssue({code:pe.custom,path:["capabilities","reasoningOpen"],message:'"reasoningOpen" only applies when reasoning is "full" or omitted — "compact"/"off" have no disclosure to open'})}},{id:"conversations-need-history",paths:["capabilities.conversations","capabilities.history"],check:(e,t)=>{var r,o;const n=(r=e.capabilities)==null?void 0:r.history;(o=e.capabilities)!=null&&o.conversations&&(!n||n.persistence==="none")&&t.addIssue({code:pe.custom,path:["capabilities","conversations"],message:'"conversations" requires capabilities.history.persistence to be "local" or "endpoint" — a conversation list needs somewhere to persist conversations'})}},{id:"home-link-urls",paths:["home.links"],check:(e,t)=>{var r;const n=/^[a-zA-Z][a-zA-Z0-9+.-]*:|^\/\//;for(const[o,i]of(((r=e.home)==null?void 0:r.links)??[]).entries())i.href&&!St(i.href)&&t.addIssue({code:pe.custom,path:["home","links",o,"href"],message:"href must be an http(s)/mailto or relative URL — no javascript:/data: schemes"}),i.icon&&n.test(i.icon)&&!St(i.icon)&&t.addIssue({code:pe.custom,path:["home","links",o,"icon"],message:"icon must be a kit icon name or an http(s)/relative URL — no javascript:/data: schemes"})}},{id:"history-endpoint-url",paths:["capabilities.history.persistence","capabilities.history.url"],check:(e,t)=>{var r;const n=(r=e.capabilities)==null?void 0:r.history;n&&(n.persistence==="endpoint"&&!n.url&&t.addIssue({code:pe.custom,path:["capabilities","history","url"],message:'"endpoint" persistence requires a url'}),n.persistence!=="endpoint"&&n.url!==void 0&&t.addIssue({code:pe.custom,path:["capabilities","history","url"],message:'url is only valid with "endpoint" persistence'}))}},{id:"work-surface-layout-scope",paths:["layout","workSurface"],check:(e,t)=>{e.workSurface&&e.layout!=="split"&&t.addIssue({code:pe.custom,path:["workSurface"],message:'"workSurface" is only valid on layout: "split"'})}},{id:"work-surface-url",paths:["workSurface.url"],check:(e,t)=>{e.workSurface&&!St(e.workSurface.url)&&t.addIssue({code:pe.custom,path:["workSurface","url"],message:"url must be an http(s)/mailto or relative URL — no javascript:/data: schemes"})}},{id:"work-surface-code-url",paths:["workSurface.codeUrl"],check:(e,t)=>{var r;const n=(r=e.workSurface)==null?void 0:r.codeUrl;n&&!St(n)&&t.addIssue({code:pe.custom,path:["workSurface","codeUrl"],message:"codeUrl must be an http(s)/mailto or relative URL — no javascript:/data: schemes"})}},{id:"work-surface-code-view",paths:["workSurface.codeUrl","workSurface.chrome.codeView"],check:(e,t)=>{var r;const n=e.workSurface;n&&n.codeUrl&&!((r=n.chrome)!=null&&r.codeView)&&t.addIssue({code:pe.custom,path:["workSurface","codeUrl"],message:'codeUrl is only valid with "chrome.codeView": true'})}}];function Le(e,t){let n=e;for(const r of t.split(".")){if(n===null||typeof n!="object")return;n=n[r]}return n}function dp(e){return e===void 0||e===""?!0:Array.isArray(e)?e.length===0:!1}function de(e,t,n){if(dp(n))return tn(e,t);const r=t.split("."),o=(i,s)=>{const a=r[s];if(s===r.length-1)return{...i,[a]:n};const l=i[a],u=l!==null&&typeof l=="object"&&!Array.isArray(l)?l:{};return{...i,[a]:o(u,s+1)}};return o(e,0)}function tn(e,t){const n=t.split("."),r=(i,s)=>{const a=n[s];if(!(a in i))return i;if(s===n.length-1){const{[a]:d,...c}=i;return Object.keys(c).length===0?void 0:c}const l=i[a];if(l===null||typeof l!="object"||Array.isArray(l))return i;const u=r(l,s+1);if(u===l)return i;if(u===void 0){const{[a]:d,...c}=i;return Object.keys(c).length===0?void 0:c}return{...i,[a]:u}};return r(e,0)??e}const fp=["capabilities.conversations","home.recentConversation","shell.commandPalette"];function Bs(e,t){return Le(e,t)===!0}function Vs(e,t,n){return n?de(e,t,!0):tn(e,t)}const Hs={"capabilities.sources.strip":!0};function hp(e,t){const n=Le(e,t);return typeof n=="boolean"?n:Hs[t]??!1}function gp(e,t,n){return de(e,t,n)}function qr(e){let t=e;for(;t instanceof mo||t instanceof Fs;)t=t.def.innerType;return t}function mp(e){let t=cp;for(const n of e.split(".")){if(!t)return;const r=qr(t);if(!(r instanceof go))return;t=r.shape[n]}return t}function pp(e){const t=qr(e);return t instanceof ir?{kind:"enum",options:t.options}:t instanceof Ds?{kind:"boolean"}:t instanceof Ms?{kind:"presence"}:t instanceof Kr?{kind:"string"}:t instanceof Ls?qr(t.def.element)instanceof Kr?{kind:"string-list"}:{kind:"complex"}:t instanceof go?{kind:"section",keys:Object.keys(t.shape)}:{kind:"complex"}}const bi={"slots-unique":{treatment:"reject-only"},"custom-layout-needs-slots":{treatment:"reject-only"},"split-pane-slot-collision":{treatment:"reject-only"},"widget-layout-scope":{treatment:"hide-section",section:"widget",layout:"widget"},"aside-layout-scope":{treatment:"hide-section",section:"aside",layout:"aside"},"message-actions-unique":{treatment:"reject-only"},"launcher-icon-url":{treatment:"reject-only"},"empty-icon-url":{treatment:"reject-only"},"reasoning-open-scope":{treatment:"disable-with-reason",path:"capabilities.reasoningOpen",reason:"Only applies while Reasoning is Full — Compact and Off have no disclosure to open."},"conversations-need-history":{treatment:"disable-with-reason",path:"capabilities.conversations",reason:"Needs History set to Local or Endpoint — a conversation list needs somewhere to persist conversations."},"home-link-urls":{treatment:"reject-only"},"history-endpoint-url":{treatment:"show-requires",path:"capabilities.history.url"},"work-surface-layout-scope":{treatment:"hide-section",section:"workSurface",layout:"split"},"work-surface-url":{treatment:"reject-only"},"work-surface-code-url":{treatment:"reject-only"},"work-surface-code-view":{treatment:"show-requires",path:"workSurface.codeUrl"}};var vp=x('<div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">History'),Ws=x('<div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Endpoint URL'),bp=x('<div class="flex flex-col gap-1.5"data-builder-cards-list>'),wp=x('<p class="mt-1.5 text-xs text-muted-foreground">Read-only for now — card editing is a later round.'),yp=x('<p class="text-xs text-muted-foreground">No cards declared.'),xp=x('<div class="rounded-lg border border-border/70 bg-surface px-2.5 py-1.5 text-xs text-foreground">'),kp=x('<div class="flex flex-col gap-1.5"><span class="text-xs font-medium text-foreground">'),_p=x('<div class="flex flex-col gap-2">'),$p=x('<div class="flex flex-col gap-2 rounded-lg border border-border/70 bg-surface p-2.5"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground"> '),Sp=x('<div class="flex flex-col gap-2"data-header-actions>'),Ap=x('<div class="flex flex-col gap-2 rounded-lg border border-border/70 bg-surface p-2.5"><div class="flex items-center justify-between"><span class="text-[11px] font-medium text-muted-foreground">Action '),zp=x('<div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Name</label></div><div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Plan'),Cp=x('<div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Greeting title</label></div><div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Greeting subtitle'),Ep=x('<div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Mode'),Op=x('<div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">Wire format'),wi=x('<div class="flex flex-col gap-1.5"><label class="text-xs font-medium text-foreground">'),Ks=x('<p class="text-xs text-muted-foreground">'),Tp=x("<div data-derived-panel>"),Pp=x('<section class="flex flex-col gap-3 border-b border-border p-4 last:border-b-0"><div class="flex min-h-5 items-center justify-between gap-2"><h3 class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">'),Ip=x('<p class="text-xs text-destructive"role=alert>: ');const Rp={name:"Name","aside.width":"Width","aside.position":"Position","header.title":"Header title","header.themeToggle":"Theme toggle","theme.mode":"Mode","theme.accent":"Accent","theme.unreadColor":"Unread color","capabilities.starters":"Starters","capabilities.reasoning":"Reasoning","capabilities.reasoningOpen":"Reasoning open","capabilities.conversations":"Conversations","capabilities.sources.strip":"Sources strip","shell.commandPalette":"Command palette","widget.position":"Position","widget.launcherIcon":"Launcher icon","widget.defaultOpen":"Open by default","home.recentConversation":"Recent conversation","workSurface.kind":"Pane kind","workSurface.url":"Preview URL","workSurface.codeUrl":"Code URL","workSurface.chrome.deviceToggle":"Device toggle","workSurface.chrome.urlBar":"URL bar","workSurface.chrome.openInNewTab":"Open in new tab","workSurface.chrome.expand":"Expand","workSurface.chrome.codeView":"Code view"};function po(e){const t=Rp[e];if(t)return t;const n=e.split(".").at(-1);return n.charAt(0).toUpperCase()+n.slice(1).replace(/([A-Z])/g," $1").toLowerCase()}function Np(e){return g(fs,{get label(){return po(e.path)},get value(){return Le(e.value,e.path)},onChange:t=>e.write(de(e.value,e.path,t||void 0))})}function Dp(e){return g(fs,{get label(){return po(e.path)},get value(){return Le(e.value,e.path)},onChange:t=>e.write(de(e.value,e.path,t||void 0))})}const Lp=["image/*","application/pdf"];function jp(e){const t=()=>Le(e.value,e.path),n=r=>{e.write(r?de(e.value,e.path,t()??{accept:Lp.slice()}):tn(e.value,e.path))};return[g(_n,{label:"Attachments",get children(){return g(Vt,{get checked(){return t()!==void 0},label:"Attachments",onChange:n})}}),g(Z,{get when(){return t()},children:r=>g(io,{label:"Accepted types",get children(){return g(_d,{get accept(){return r().accept??[]},onChange:o=>e.write(de(e.value,e.path,{accept:o}))})}})})]}const Zp=[{value:"none",label:"None — nothing saved"},{value:"local",label:"Local — this browser"},{value:"endpoint",label:"Endpoint — your backend"}];function Mp(e){const t=()=>Le(e.value,e.path),n=()=>{var i;return((i=t())==null?void 0:i.persistence)??"none"},r=Ie(),o=Ie();return[(()=>{var i=vp(),s=i.firstChild;return j(s,"for",r),m(i,g(kn,{id:r,options:Zp,get value(){return n()},onChange:a=>e.write(de(e.value,e.path,{persistence:a.currentTarget.value}))}),null),i})(),g(Z,{get when(){return n()==="endpoint"},get children(){var i=Ws(),s=i.firstChild;return j(s,"for",o),m(i,g(Se,{id:o,size:"sm",required:!0,get value(){var a;return((a=t())==null?void 0:a.url)??""},placeholder:"/api/history",onValueInput:a=>e.write(de(e.value,e.path,{...t(),url:a||void 0}))}),null),i}})]}function Fp(e){const t=()=>Le(e.value,e.path)??[];return g(Z,{get when(){return t().length>0},get fallback(){return yp()},get children(){return[(()=>{var n=bp();return m(n,g(ke,{get each(){return t()},children:r=>(()=>{var o=xp();return m(o,(()=>{var i=Re(()=>{var s;return typeof((s=r.schema)==null?void 0:s.title)=="string"});return()=>i()?r.schema.title:r.name})()),o})()})),n})(),wp()]}})}function Js(e){const t=e==="user"?zd:Cd,n=e==="user"?"Your messages":"Assistant messages";return function(o){const i=()=>Le(o.value,o.path)??[],s=()=>{const a=i(),l=a.map(d=>t.find(c=>c.id===d)).filter(d=>d!==void 0).map(d=>({id:d.id,enabled:!0})),u=t.filter(d=>!a.includes(d.id)).map(d=>({id:d.id,enabled:!1}));return[...l,...u]};return(()=>{var a=kp(),l=a.firstChild;return m(l,n),m(a,g(Ed,{legend:n,catalog:t,get rows(){return s()},onChange:u=>{const d=u.filter(c=>c.enabled).map(c=>c.id);o.write(de(o.value,o.path,d))}}),null),a})()}}const Up=Js("user"),Bp=Js("assistant");function yi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function qs(e){return function(n){const r=()=>Le(n.value,n.path)??[],o=(l,u)=>{const d=r().slice(),c={...d[l],...u};c.id=c.id||yi(c.label??""),d[l]=c,n.write(de(n.value,n.path,d))},i=()=>n.write(de(n.value,n.path,[...r(),{id:"new",label:"New"}])),s=l=>n.write(de(n.value,n.path,r().filter((u,d)=>d!==l))),a=e==="slash"?"slash command":"mention";return(()=>{var l=_p();return j(l,"data-trigger-entries",e),m(l,g(ke,{get each(){return r()},children:(u,d)=>(()=>{var c=$p(),f=c.firstChild,h=f.firstChild,p=h.firstChild;return m(h,a,p),m(h,()=>d()+1,null),m(f,g(xe,{type:"button",variant:"ghost",size:"icon-sm",get"aria-label"(){return`Remove ${a} ${d()+1}`},onClick:()=>s(d()),get children(){return g(Qt,{size:14,"aria-hidden":"true"})}}),null),m(c,g(Se,{size:"sm",get value(){return u.label},placeholder:"Label",get"aria-label"(){return`${a} ${d()+1} label`},onValueInput:v=>o(d(),{label:v,id:yi(v)})}),null),m(c,g(Se,{size:"sm",get value(){return u.id},placeholder:"id",get"aria-label"(){return`${a} ${d()+1} id`},onValueInput:v=>o(d(),{id:v})}),null),m(c,g(Se,{size:"sm",get value(){return u.description??""},placeholder:"Description",get"aria-label"(){return`${a} ${d()+1} description`},onValueInput:v=>o(d(),{description:v||void 0})}),null),c})()}),null),m(l,g(xe,{type:"button",variant:"outline",size:"sm",onClick:i,get children(){return["Add ",a]}}),null),l})()}}const Vp=qs("slash"),Hp=qs("mention");function Wp(e){const t=()=>Le(e.value,e.path)??[],n=(i,s)=>{const a=t().slice();a[i]={...a[i],...s},e.write(de(e.value,e.path,a))},r=()=>e.write(de(e.value,e.path,[...t(),{label:"New"}])),o=i=>e.write(de(e.value,e.path,t().filter((s,a)=>a!==i)));return(()=>{var i=Sp();return m(i,g(ke,{get each(){return t()},children:(s,a)=>(()=>{var l=Ap(),u=l.firstChild,d=u.firstChild;return d.firstChild,m(d,()=>a()+1,null),m(u,g(xe,{type:"button",variant:"ghost",size:"icon-sm",get"aria-label"(){return`Remove action ${a()+1}`},onClick:()=>o(a()),get children(){return g(Qt,{size:14,"aria-hidden":"true"})}}),null),m(l,g(Se,{size:"sm",get value(){return s.label},placeholder:"Label",get"aria-label"(){return`Action ${a()+1} label`},onValueInput:c=>n(a(),{label:c})}),null),m(l,g(kn,{get options(){return[{value:"",label:"Default"},...hs.map(c=>({value:c,label:c}))]},get value(){return s.variant??""},get"aria-label"(){return`Action ${a()+1} variant`},onChange:c=>n(a(),{variant:c.currentTarget.value||void 0})}),null),l})()}),null),m(i,g(xe,{type:"button",variant:"outline",size:"sm",onClick:r,children:"Add action"}),null),i})()}function Kp(e){const t=()=>Le(e.value,e.path),n=i=>{e.write(i?de(e.value,e.path,t()??{name:""}):tn(e.value,e.path))},r=Ie(),o=Ie();return[g(_n,{label:"User menu",get children(){return g(Vt,{get checked(){return t()!==void 0},label:"User menu",onChange:n})}}),g(Z,{get when(){return t()},children:i=>(()=>{var s=zp(),a=s.firstChild,l=a.firstChild,u=a.nextSibling,d=u.firstChild;return j(l,"for",r),m(a,g(Se,{id:r,size:"sm",required:!0,get value(){return i().name},onValueInput:c=>e.write(de(e.value,e.path,{...i(),name:c}))}),null),j(d,"for",o),m(u,g(Se,{id:o,size:"sm",get value(){return i().plan??""},onValueInput:c=>e.write(de(e.value,e.path,{...i(),plan:c||void 0}))}),null),s})()})]}function Jp(e){const t=()=>Le(e.value,e.path),n=i=>{e.write(i?de(e.value,e.path,t()??{}):tn(e.value,e.path))},r=Ie(),o=Ie();return[g(_n,{label:"Home tab",get children(){return g(Vt,{get checked(){return t()!==void 0},label:"Home tab",onChange:n})}}),g(Z,{get when(){return t()},children:i=>(()=>{var s=Cp(),a=s.firstChild,l=a.firstChild,u=a.nextSibling,d=u.firstChild;return j(l,"for",r),m(a,g(Se,{id:r,size:"sm",get value(){var c;return((c=i().greeting)==null?void 0:c.title)??""},onValueInput:c=>e.write(de(e.value,`${e.path}.greeting`,{...i().greeting,title:c||void 0}))}),null),j(d,"for",o),m(u,g(Se,{id:o,size:"sm",get value(){var c;return((c=i().greeting)==null?void 0:c.subtitle)??""},onValueInput:c=>e.write(de(e.value,`${e.path}.greeting`,{...i().greeting,subtitle:c||void 0}))}),null),m(s,g(_n,{label:"Recent conversation",get children(){return g(Vt,{get checked(){return Bs(e.value,`${e.path}.recentConversation`)},label:"Recent conversation",onChange:c=>e.write(Vs(e.value,`${e.path}.recentConversation`,c))})}}),null),m(s,g(io,{label:"Links",get children(){return g($d,{get links(){return i().links??[]},onChange:c=>e.write(de(e.value,`${e.path}.links`,c))})}}),null),s})()})]}const qp=[{value:"mock",label:"Mock — canned replies, no network calls"},{value:"endpoint",label:"Endpoint — your own chat route"}],Gp=[{value:"openai",label:"OpenAI-compatible"},{value:"anthropic",label:"Anthropic"}];function Yp(e){const t=()=>Le(e.value,e.path),n=Ie(),r=Ie(),o=Ie();return[(()=>{var i=Ep(),s=i.firstChild;return j(s,"for",n),m(i,g(kn,{id:n,options:qp,get value(){var a;return((a=t())==null?void 0:a.mode)??"mock"},onChange:a=>{const l=a.currentTarget.value;e.write(de(e.value,e.path,l==="mock"?{mode:"mock"}:{mode:"endpoint",url:"",wire:"openai"}))}}),null),i})(),g(Z,{get when(){var i;return((i=t())==null?void 0:i.mode)==="endpoint"},get children(){return[(()=>{var i=Ws(),s=i.firstChild;return j(s,"for",r),m(i,g(Se,{id:r,size:"sm",get value(){var a;return((a=t())==null?void 0:a.url)??""},placeholder:"/api/chat",onValueInput:a=>e.write(de(e.value,e.path,{...t(),url:a}))}),null),i})(),(()=>{var i=Op(),s=i.firstChild;return j(s,"for",o),m(i,g(kn,{id:o,options:Gp,get value(){var a;return((a=t())==null?void 0:a.wire)??"openai"},onChange:a=>e.write(de(e.value,e.path,{...t(),wire:a.currentTarget.value}))}),null),i})()]}})]}const Xp={"theme.accent":Np,"theme.unreadColor":Dp,"capabilities.attachments":jp,"capabilities.history":Mp,"capabilities.messageActions.user":Up,"capabilities.messageActions.assistant":Bp,"composer.triggers.slash":Vp,"composer.triggers.mention":Hp,"header.actions":Wp,"shell.userMenu":Kp,home:Jp,provider:Yp,cards:Fp};function Qp(e){const t=()=>mp(e.path),n=()=>t()?pp(t()):{kind:"complex"},r=Ie(),o=`${r}-reason`,i=po(e.path),s=()=>Le(e.value,e.path),a=d=>e.write(de(e.value,e.path,d)),l=()=>e.path in Hs,u=()=>fp.includes(e.path);return[g(Z,{get when(){return n().kind==="enum"},get children(){var d=wi(),c=d.firstChild;return j(c,"for",r),m(c,i),m(d,g(kn,{id:r,get options(){return n().options.map(f=>({value:f,label:f}))},get value(){return s()??""},onChange:f=>a(f.currentTarget.value||void 0)}),null),d}}),g(Z,{get when(){return n().kind==="boolean"||u()||l()},get children(){return[g(_n,{label:i,get muted(){return!!e.disabledReason},get children(){return g(Vt,{get checked(){return Re(()=>!!l())()?hp(e.value,e.path):Re(()=>!!u())()?Bs(e.value,e.path):s()===!0},get disabled(){return!!e.disabledReason},label:i,get"aria-describedby"(){return e.disabledReason?o:void 0},onChange:d=>e.write(l()?gp(e.value,e.path,d):u()?Vs(e.value,e.path,d):d?de(e.value,e.path,!0):tn(e.value,e.path))})}}),g(Z,{get when(){return e.disabledReason},get children(){var d=Ks();return j(d,"id",o),m(d,()=>e.disabledReason),d}})]}}),g(Z,{get when(){return n().kind==="string"},get children(){var d=wi(),c=d.firstChild;return j(c,"for",r),m(c,i),m(d,g(Se,{id:r,size:"sm",get value(){return s()??""},onValueInput:f=>a(f||void 0)}),null),d}}),g(Z,{get when(){return n().kind==="string-list"},get children(){return g(io,{label:i,get children(){return g(kd,{get tags(){return s()??[]},onChange:d=>a(d),ariaLabel:i})}})}})]}function ev(e){const t=()=>{const o=new Set;for(const[,i]of Object.entries(bi))i.treatment==="hide-section"&&e.value.layout!==i.layout&&o.add(i.section);return o},n=o=>{var i,s,a;for(const l of Object.values(bi))if(!(l.treatment!=="disable-with-reason"||l.path!==o)){if(o==="capabilities.conversations"){const u=(s=(i=e.value.capabilities)==null?void 0:i.history)==null?void 0:s.persistence;if(!u||u==="none")return l.reason}if(o==="capabilities.reasoningOpen"){const u=(a=e.value.capabilities)==null?void 0:a.reasoning;if(u==="compact"||u==="off")return l.reason}}},r=o=>(e.problems??[]).filter(i=>o.paths.some(s=>i.path===s||i.path.startsWith(`${s}.`)));return(()=>{var o=Tp();return m(o,g(ke,{get each(){return e.template.controls.filter(i=>!t().has(i.id))},children:i=>(()=>{var s=Pp(),a=s.firstChild,l=a.firstChild;return m(l,()=>nv(i.id)),m(a,()=>{var u;return(u=e.sectionActions)==null?void 0:u[i.id]},null),m(s,g(ke,{get each(){return i.paths},children:u=>{var f;const d=Xp[u],c=(f=i.hints)==null?void 0:f[u];return[d?g(gr,{component:d,path:u,get value(){return e.value},get write(){return e.onChange}}):g(Qp,{path:u,get value(){return e.value},get write(){return e.onChange},get disabledReason(){return n(u)}}),g(Z,{when:c,get children(){var h=Ks();return j(h,"data-derived-hint",u),m(h,c),h}})]}}),null),m(s,g(ke,{get each(){return r(i)},children:u=>(()=>{var d=Ip(),c=d.firstChild;return m(d,()=>u.path,c),m(d,()=>u.message,null),d})()}),null),U(()=>j(s,"data-derived-section",i.id)),s})()})),U(()=>ue(o,G("flex flex-col divide-y divide-border text-sm text-foreground",e.class))),o})()}const tv={identity:"Identity",theme:"Theme",header:"Header",empty:"Empty state",home:"Home",capabilities:"Capabilities",messageActions:"Message actions",sources:"Sources",widget:"Widget",aside:"Aside",composerTriggers:"Composer triggers",shell:"Shell",provider:"Provider",cards:"Cards",workSurface:"Work surface"};function nv(e){return tv[e]??e}var rv=x("<div role=separator>");function ov(e){const[t,n]=He(e,["orientation","class"]),r=()=>t.orientation==="vertical";return(()=>{var o=rv();return ct(o,oe({get class(){return G("shrink-0 bg-border",r()?"h-full w-px":"h-px w-full",t.class)}},n),!1,!1),o})()}const iv={proseSize:()=>"sm",codeTheme:()=>"github-dark-dimmed",portalMount:()=>{},codeHighlight:()=>!0},sv=xa(iv);function Gs(){return ka(sv)}const av=["top","right","bottom","left"],Kt=Math.min,zt=Math.max,sr=Math.round,Wn=Math.floor,Xe=e=>({x:e,y:e}),lv={left:"right",right:"left",bottom:"top",top:"bottom"};function Gr(e,t,n){return zt(e,Kt(t,n))}function nn(e,t){return typeof e=="function"?e(t):e}function Et(e){return e.split("-")[0]}function Tn(e){return e.split("-")[1]}function Ys(e){return e==="x"?"y":"x"}function vo(e){return e==="y"?"height":"width"}function mt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function bo(e){return Ys(mt(e))}function cv(e,t,n){n===void 0&&(n=!1);const r=Tn(e),o=bo(e),i=vo(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ar(s)),[s,ar(s)]}function uv(e){const t=ar(e);return[Yr(e),t,Yr(t)]}function Yr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const xi=["left","right"],ki=["right","left"],dv=["top","bottom"],fv=["bottom","top"];function hv(e,t,n){switch(e){case"top":case"bottom":return n?t?ki:xi:t?xi:ki;case"left":case"right":return t?dv:fv;default:return[]}}function gv(e,t,n,r){const o=Tn(e);let i=hv(Et(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Yr)))),i}function ar(e){const t=Et(e);return lv[t]+e.slice(t.length)}function mv(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xs(e){return typeof e!="number"?mv(e):{top:e,right:e,bottom:e,left:e}}function lr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function _i(e,t,n){let{reference:r,floating:o}=e;const i=mt(t),s=bo(t),a=vo(s),l=Et(t),u=i==="y",d=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-o.width,y:c};break;default:h={x:r.x,y:r.y}}switch(Tn(t)){case"start":h[s]-=f*(n&&u?-1:1);break;case"end":h[s]+=f*(n&&u?-1:1);break}return h}async function pv(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:c="floating",altBoundary:f=!1,padding:h=0}=nn(t,e),p=Xs(h),b=a[f?c==="floating"?"reference":"floating":c],y=lr(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:l})),z=c==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),T=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},D=lr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:z,offsetParent:k,strategy:l}):z);return{top:(y.top-D.top+p.top)/T.y,bottom:(D.bottom-y.bottom+p.bottom)/T.y,left:(y.left-D.left+p.left)/T.x,right:(D.right-y.right+p.right)/T.x}}const vv=50,bv=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=s.detectOverflow?s:{...s,detectOverflow:pv},l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:c}=_i(u,r,l),f=r,h=0;const p={};for(let v=0;v<i.length;v++){const b=i[v];if(!b)continue;const{name:y,fn:z}=b,{x:k,y:T,data:D,reset:E}=await z({x:d,y:c,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});d=k??d,c=T??c,p[y]={...p[y],...D},E&&h<vv&&(h++,typeof E=="object"&&(E.placement&&(f=E.placement),E.rects&&(u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:d,y:c}=_i(u,f,l)),v=-1)}return{x:d,y:c,placement:f,strategy:o,middlewareData:p}},wv=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=nn(e,t)||{};if(u==null)return{};const c=Xs(d),f={x:n,y:r},h=bo(o),p=vo(h),v=await s.getDimensions(u),b=h==="y",y=b?"top":"left",z=b?"bottom":"right",k=b?"clientHeight":"clientWidth",T=i.reference[p]+i.reference[h]-f[h]-i.floating[p],D=f[h]-i.reference[h],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let O=E?E[k]:0;(!O||!await(s.isElement==null?void 0:s.isElement(E)))&&(O=a.floating[k]||i.floating[p]);const N=T/2-D/2,Y=O/2-v[p]/2-1,M=Kt(c[y],Y),W=Kt(c[z],Y),I=M,H=O-v[p]-W,_=O/2-v[p]/2+N,R=Gr(I,_,H),B=!l.arrow&&Tn(o)!=null&&_!==R&&i.reference[p]/2-(_<I?M:W)-v[p]/2<0,ee=B?_<I?_-I:_-H:0;return{[h]:f[h]+ee,data:{[h]:R,centerOffset:_-R-ee,...B&&{alignmentOffset:ee}},reset:B}}}),yv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:v=!0,...b}=nn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Et(o),z=mt(a),k=Et(a)===a,T=await(l.isRTL==null?void 0:l.isRTL(u.floating)),D=f||(k||!v?[ar(a)]:uv(a)),E=p!=="none";!f&&E&&D.push(...gv(a,v,p,T));const O=[a,...D],N=await l.detectOverflow(t,b),Y=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&Y.push(N[y]),c){const _=cv(o,s,T);Y.push(N[_[0]],N[_[1]])}if(M=[...M,{placement:o,overflows:Y}],!Y.every(_=>_<=0)){var W,I;const _=(((W=i.flip)==null?void 0:W.index)||0)+1,R=O[_];if(R&&(!(c==="alignment"?z!==mt(R):!1)||M.every(re=>mt(re.placement)===z?re.overflows[0]>0:!0)))return{data:{index:_,overflows:M},reset:{placement:R}};let B=(I=M.filter(ee=>ee.overflows[0]<=0).sort((ee,re)=>ee.overflows[1]-re.overflows[1])[0])==null?void 0:I.placement;if(!B)switch(h){case"bestFit":{var H;const ee=(H=M.filter(re=>{if(E){const se=mt(re.placement);return se===z||se==="y"}return!0}).map(re=>[re.placement,re.overflows.filter(se=>se>0).reduce((se,fe)=>se+fe,0)]).sort((re,se)=>re[1]-se[1])[0])==null?void 0:H[0];ee&&(B=ee);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function $i(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Si(e){return av.some(t=>e[t]>=0)}const xv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=nn(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=$i(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Si(a)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),a=$i(s,n.floating);return{data:{escapedOffsets:a,escaped:Si(a)}}}default:return{}}}}},kv=new Set(["left","top"]);async function _v(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Et(n),a=Tn(n),l=mt(n)==="y",u=kv.has(s)?-1:1,d=i&&l?-1:1,c=nn(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*d,y:f*u}:{x:f*u,y:h*d}}const $v=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await _v(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},Sv=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:z,y:k}=y;return{x:z,y:k}}},...u}=nn(e,t),d={x:n,y:r},c=await i.detectOverflow(t,u),f=mt(Et(o)),h=Ys(f);let p=d[h],v=d[f];if(s){const y=h==="y"?"top":"left",z=h==="y"?"bottom":"right",k=p+c[y],T=p-c[z];p=Gr(k,p,T)}if(a){const y=f==="y"?"top":"left",z=f==="y"?"bottom":"right",k=v+c[y],T=v-c[z];v=Gr(k,v,T)}const b=l.fn({...t,[h]:p,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:s,[f]:a}}}}}};function xr(){return typeof window<"u"}function rn(e){return Qs(e)?(e.nodeName||"").toLowerCase():"#document"}function Ze(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function tt(e){var t;return(t=(Qs(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Qs(e){return xr()?e instanceof Node||e instanceof Ze(e).Node:!1}function Je(e){return xr()?e instanceof Element||e instanceof Ze(e).Element:!1}function ut(e){return xr()?e instanceof HTMLElement||e instanceof Ze(e).HTMLElement:!1}function Ai(e){return!xr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ze(e).ShadowRoot}function Pn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Av(e){return/^(table|td|th)$/.test(rn(e))}function kr(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const zv=/transform|translate|scale|rotate|perspective|filter/,Cv=/paint|layout|strict|content/,$t=e=>!!e&&e!=="none";let Dr;function wo(e){const t=Je(e)?qe(e):e;return $t(t.transform)||$t(t.translate)||$t(t.scale)||$t(t.rotate)||$t(t.perspective)||!yo()&&($t(t.backdropFilter)||$t(t.filter))||zv.test(t.willChange||"")||Cv.test(t.contain||"")}function Ev(e){let t=pt(e);for(;ut(t)&&!Jt(t);){if(wo(t))return t;if(kr(t))return null;t=pt(t)}return null}function yo(){return Dr==null&&(Dr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Dr}function Jt(e){return/^(html|body|#document)$/.test(rn(e))}function qe(e){return Ze(e).getComputedStyle(e)}function _r(e){return Je(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pt(e){if(rn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ai(e)&&e.host||tt(e);return Ai(t)?t.host:t}function ea(e){const t=pt(e);return Jt(t)?e.ownerDocument?e.ownerDocument.body:e.body:ut(t)&&Pn(t)?t:ea(t)}function qt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ea(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ze(o);if(i){const a=Xr(s);return t.concat(s,s.visualViewport||[],Pn(o)?o:[],a&&n?qt(a):[])}else return t.concat(o,qt(o,[],n))}function Xr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ta(e){const t=qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ut(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=sr(n)!==i||sr(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function xo(e){return Je(e)?e:e.contextElement}function Bt(e){const t=xo(e);if(!ut(t))return Xe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ta(t);let s=(i?sr(n.width):n.width)/r,a=(i?sr(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Ov=Xe(0);function na(e){const t=Ze(e);return!yo()||!t.visualViewport?Ov:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ze(e)?!1:t}function Ot(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=xo(e);let s=Xe(1);t&&(r?Je(r)&&(s=Bt(r)):s=Bt(e));const a=Tv(i,n,r)?na(i):Xe(0);let l=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,c=o.height/s.y;if(i){const f=Ze(i),h=r&&Je(r)?Ze(r):r;let p=f,v=Xr(p);for(;v&&r&&h!==p;){const b=Bt(v),y=v.getBoundingClientRect(),z=qe(v),k=y.left+(v.clientLeft+parseFloat(z.paddingLeft))*b.x,T=y.top+(v.clientTop+parseFloat(z.paddingTop))*b.y;l*=b.x,u*=b.y,d*=b.x,c*=b.y,l+=k,u+=T,p=Ze(v),v=Xr(p)}}return lr({width:d,height:c,x:l,y:u})}function $r(e,t){const n=_r(e).scrollLeft;return t?t.left+n:Ot(tt(e)).left+n}function ra(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-$r(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Pv(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=tt(r),a=t?kr(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Xe(1);const d=Xe(0),c=ut(r);if((c||!c&&!i)&&((rn(r)!=="body"||Pn(s))&&(l=_r(r)),c)){const h=Ot(r);u=Bt(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=s&&!c&&!i?ra(s,l):Xe(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-l.scrollTop*u.y+d.y+f.y}}function Iv(e){return Array.from(e.getClientRects())}function Rv(e){const t=tt(e),n=_r(e),r=e.ownerDocument.body,o=zt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=zt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+$r(e);const a=-n.scrollTop;return qe(r).direction==="rtl"&&(s+=zt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const zi=25;function Nv(e,t){const n=Ze(e),r=tt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const d=yo();(!d||d&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}const u=$r(r);if(u<=0){const d=r.ownerDocument,c=d.body,f=getComputedStyle(c),h=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-c.clientWidth-h);p<=zi&&(i-=p)}else u<=zi&&(i+=u);return{width:i,height:s,x:a,y:l}}function Dv(e,t){const n=Ot(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ut(e)?Bt(e):Xe(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,u=r*i.y;return{width:s,height:a,x:l,y:u}}function Ci(e,t,n){let r;if(t==="viewport")r=Nv(e,n);else if(t==="document")r=Rv(tt(e));else if(Je(t))r=Dv(t,n);else{const o=na(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return lr(r)}function oa(e,t){const n=pt(e);return n===t||!Je(n)||Jt(n)?!1:qe(n).position==="fixed"||oa(n,t)}function Lv(e,t){const n=t.get(e);if(n)return n;let r=qt(e,[],!1).filter(a=>Je(a)&&rn(a)!=="body"),o=null;const i=qe(e).position==="fixed";let s=i?pt(e):e;for(;Je(s)&&!Jt(s);){const a=qe(s),l=wo(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Pn(s)&&!l&&oa(e,s))?r=r.filter(d=>d!==s):o=a,s=pt(s)}return t.set(e,r),r}function jv(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?kr(t)?[]:Lv(t,this._c):[].concat(n),r],a=Ci(t,s[0],o);let l=a.top,u=a.right,d=a.bottom,c=a.left;for(let f=1;f<s.length;f++){const h=Ci(t,s[f],o);l=zt(h.top,l),u=Kt(h.right,u),d=Kt(h.bottom,d),c=zt(h.left,c)}return{width:u-c,height:d-l,x:c,y:l}}function Zv(e){const{width:t,height:n}=ta(e);return{width:t,height:n}}function Mv(e,t,n){const r=ut(t),o=tt(t),i=n==="fixed",s=Ot(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Xe(0);function u(){l.x=$r(o)}if(r||!r&&!i)if((rn(t)!=="body"||Pn(o))&&(a=_r(t)),r){const h=Ot(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&u();i&&!r&&o&&u();const d=o&&!r&&!i?ra(o,a):Xe(0),c=s.left+a.scrollLeft-l.x-d.x,f=s.top+a.scrollTop-l.y-d.y;return{x:c,y:f,width:s.width,height:s.height}}function Lr(e){return qe(e).position==="static"}function Ei(e,t){if(!ut(e)||qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return tt(e)===n&&(n=n.ownerDocument.body),n}function ia(e,t){const n=Ze(e);if(kr(e))return n;if(!ut(e)){let o=pt(e);for(;o&&!Jt(o);){if(Je(o)&&!Lr(o))return o;o=pt(o)}return n}let r=Ei(e,t);for(;r&&Av(r)&&Lr(r);)r=Ei(r,t);return r&&Jt(r)&&Lr(r)&&!wo(r)?n:r||Ev(e)||n}const Fv=async function(e){const t=this.getOffsetParent||ia,n=this.getDimensions,r=await n(e.floating);return{reference:Mv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uv(e){return qe(e).direction==="rtl"}const Bv={convertOffsetParentRelativeRectToViewportRelativeRect:Pv,getDocumentElement:tt,getClippingRect:jv,getOffsetParent:ia,getElementRects:Fv,getClientRects:Iv,getDimensions:Zv,getScale:Bt,isElement:Je,isRTL:Uv};function sa(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vv(e,t){let n=null,r;const o=tt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const u=e.getBoundingClientRect(),{left:d,top:c,width:f,height:h}=u;if(a||t(),!f||!h)return;const p=Wn(c),v=Wn(o.clientWidth-(d+f)),b=Wn(o.clientHeight-(c+h)),y=Wn(d),k={rootMargin:-p+"px "+-v+"px "+-b+"px "+-y+"px",threshold:zt(0,Kt(1,l))||1};let T=!0;function D(E){const O=E[0].intersectionRatio;if(O!==l){if(!T)return s();O?s(!1,O):r=setTimeout(()=>{s(!1,1e-7)},1e3)}O===1&&!sa(u,e.getBoundingClientRect())&&s(),T=!1}try{n=new IntersectionObserver(D,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,k)}n.observe(e)}return s(!0),i}function Hv(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=xo(e),d=o||i?[...u?qt(u):[],...t?qt(t):[]]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const c=u&&a?Vv(u,n):null;let f=-1,h=null;s&&(h=new ResizeObserver(y=>{let[z]=y;z&&z.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),u&&!l&&h.observe(u),t&&h.observe(t));let p,v=l?Ot(e):null;l&&b();function b(){const y=Ot(e);v&&!sa(v,y)&&n(),v=y,p=requestAnimationFrame(b)}return n(),()=>{var y;d.forEach(z=>{o&&z.removeEventListener("scroll",n),i&&z.removeEventListener("resize",n)}),c==null||c(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Wv=$v,Kv=Sv,Jv=yv,qv=xv,Gv=wv,Yv=(e,t,n)=>{const r=new Map,o={platform:Bv,...n},i={...o.platform,_c:r};return bv(e,t,{...o,platform:i})};function ko(e){const[t,n]=J(e()),[r,o]=J(e()?"open":"closed");let i,s=0;const a=l=>{i=l};return Oe(l=>{const u=e();if(u)s++,n(!0),o("open");else if(l){o("closed");const d=i,c=d&&(()=>{const p=getComputedStyle(d);return p.animationName!=="none"&&parseFloat(p.animationDuration||"0")>0})();if(!d||!c){const p=++s;return queueMicrotask(()=>{p===s&&n(!1)}),u}const f=d,h=p=>{p.target===f&&(f.removeEventListener("animationend",h),n(!1))};f.addEventListener("animationend",h),Pe(()=>f.removeEventListener("animationend",h))}return u}),{present:t,state:r,setRef:a}}function Xv(e){const[t,n]=He(e,["as"]);return typeof t.as=="function"?t.as(n):g(gr,oe({get component(){return t.as??"span"}},n))}function Qv(e){let t=e;for(;t;){if(t instanceof Element&&t.closest("[inert]"))return!0;const n=t.getRootNode();t=n instanceof ShadowRoot?n.host:null}return!1}function eb(e,t){if(typeof MutationObserver!="function")return()=>{};let n=!1;const r=()=>e.isConnected&&!Qv(e);let o=r();const i=()=>{if(!n){if(r()){o=!0;return}o&&(n=!0,s.disconnect(),t())}},s=new MutationObserver(i),a=new Set;typeof document<"u"&&a.add(document);const l=e.getRootNode();l&&a.add(l);for(const u of a)try{s.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["inert"]})}catch{}return()=>s.disconnect()}function tb(e,t,n={}){const[r,o]=J({x:0,y:0,placement:n.placement??"bottom"}),[i,s]=J({}),[a,l]=J(!1);return Oe(()=>{const u=e(),d=t();if(!u||!d)return;const c=()=>{var y;const v=[Wv(n.gutter??8),Jv(),Kv({padding:8})],b=(y=n.arrowEl)==null?void 0:y.call(n);b&&v.push(Gv({element:b})),v.push(qv()),Yv(u,d,{placement:n.placement??"bottom",strategy:"fixed",middleware:v}).then(({x:z,y:k,placement:T,middlewareData:D})=>{var E;o({x:z,y:k,placement:T}),D.arrow&&s({x:D.arrow.x,y:D.arrow.y}),l(!!((E=D.hide)!=null&&E.referenceHidden))})},f=Hv(u,d,c);let h;if(typeof ResizeObserver=="function"&&u instanceof Element){h=new ResizeObserver(c),h.observe(u);for(const v of qt(u))v instanceof Element&&h.observe(v)}const p=n.onDisconnect?eb(u,n.onDisconnect):void 0;Pe(()=>{f(),h==null||h.disconnect(),p==null||p()})}),{pos:r,arrowPos:i,hidden:a}}function nb(e){Oe(()=>{if(!e.enabled())return;const t=o=>{o.key==="Escape"&&e.onDismiss("escape")},n=o=>{const i=o.target;e.refs().some(a=>a&&a.contains(i))||e.onDismiss("outside")},r=document;r.addEventListener("keydown",t),r.addEventListener("pointerdown",n,!0),Pe(()=>{r.removeEventListener("keydown",t),r.removeEventListener("pointerdown",n,!0)})})}var rb=x("<div role=tooltip style=position:fixed;pointer-events:none>");function Oi(e){var E;const[t]=He(e,["content","children","class","openDelay","closeDelay","placement","defaultOpen","disabled","controllerRef","dismissOnClick"]),n=Gs(),r=Ie(),[o,i]=J(t.defaultOpen??!1),[s,a]=J(),[l,u]=J();(E=t.controllerRef)==null||E.call(t,{open:o,setOpen:O=>i(O&&!t.disabled)});let d,c=!1;const[f,h]=J(!1),[p,v]=J(!1),b=(O=0)=>{t.disabled||(clearTimeout(d),O?d=window.setTimeout(()=>i(!0),O):i(!0))},y=()=>{clearTimeout(d);const O=t.closeDelay??0;O?d=window.setTimeout(()=>i(!1),O):i(!1)},z=()=>{!f()&&!p()&&y()},k=()=>{t.dismissOnClick!==!1&&(h(!1),v(!1),y())};Pe(()=>clearTimeout(d));const T=ko(o),D=tb(s,l,{placement:t.placement??"top",gutter:6,onDisconnect:()=>i(!1)});return nb({enabled:o,onDismiss:y,refs:()=>[s(),l()]}),[g(Xv,{as:"span",class:"inline-flex",ref:a,get"aria-describedby"(){return o()?r:void 0},onPointerEnter:()=>{h(!0),b(t.openDelay??600)},onPointerLeave:()=>{h(!1),z()},onPointerDown:()=>{c=!0,k(),window.setTimeout(()=>{c=!1},0)},onClick:k,onFocusIn:()=>{v(!0),c||b()},onFocusOut:O=>{const N=s();N&&N.contains(O.relatedTarget)||(v(!1),z())},get children(){return t.children}}),g(Z,{get when(){return T.present()},get children(){return g(Qi,{get mount(){return n.portalMount()},get children(){var O=rb();return Qe(N=>{u(N),T.setRef(N)},O),j(O,"id",r),m(O,()=>t.content),U(N=>{var Y=T.state()==="open"?"":void 0,M=T.state()==="closed"?"":void 0,W=`${D.pos().x}px`,I=`${D.pos().y}px`,H=D.hidden()?"hidden":"visible",_=G("z-50 rounded-md bg-foreground px-2.5 py-1 text-xs text-background shadow-md","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",t.class);return Y!==N.e&&j(O,"data-expanded",N.e=Y),M!==N.t&&j(O,"data-closed",N.t=M),W!==N.a&&At(O,"left",N.a=W),I!==N.o&&At(O,"top",N.o=I),H!==N.i&&At(O,"visibility",N.i=H),_!==N.n&&ue(O,N.n=_),N},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),O}})}})]}var ob=x('<span class="truncate text-sm font-semibold text-foreground"data-kai-builder-header-title>'),ib=x('<span class="rounded-pill bg-muted px-2 py-0.5 text-xs text-muted-foreground">'),sb=x('<div class="flex items-center gap-1"data-kai-builder-header-utility>'),ab=x('<header data-kai-builder-header><div class="flex min-w-0 items-center gap-3"></div><div class="flex items-center gap-2">');function lb(e){const t=()=>!!e.onToggleCanvasDark,n=()=>t(),r=()=>!!e.onSave,o=()=>e.canvasDark?"Preview canvas: switch to light mode":"Preview canvas: switch to dark mode";return(()=>{var i=ab(),s=i.firstChild,a=s.nextSibling;return m(s,g(Z,{get when(){return e.onHome},get children(){return g(Oi,{content:"Your constructs",get children(){return g(xe,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Your constructs",onClick:()=>{var l;return(l=e.onHome)==null?void 0:l.call(e)},"data-kai-builder-header-home":!0,get children(){return g($l,{size:14,"aria-hidden":"true"})}})}})}}),null),m(s,g(Z,{get when(){return e.title},get children(){var l=ob();return m(l,()=>e.title),l}}),null),m(s,g(Z,{get when(){return e.status},get children(){var l=ib();return m(l,()=>e.status),l}}),null),m(s,g(Z,{get when(){return e.onSwitchTemplate},get children(){return g(xe,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=e.onSwitchTemplate)==null?void 0:l.call(e)},"data-kai-builder-header-switch":!0,get children(){return[g(Ol,{size:14,"aria-hidden":"true"}),"Switch template"]}})}}),null),m(a,g(Z,{get when(){return n()},get children(){var l=sb();return m(l,g(Z,{get when(){return t()},get children(){return g(Oi,{get content(){return o()},get children(){return g(xe,{type:"button",variant:"ghost",size:"icon-sm",get"aria-label"(){return o()},onClick:()=>{var u;return(u=e.onToggleCanvasDark)==null?void 0:u.call(e)},"data-kai-builder-header-canvas-toggle":!0,get children(){return Re(()=>!!e.canvasDark)()?g(Jl,{size:14,"aria-hidden":"true"}):g(Il,{size:14,"aria-hidden":"true"})}})}})}})),l}}),null),m(a,g(Z,{get when(){return Re(()=>!!n())()&&r()},get children(){return g(ov,{orientation:"vertical",class:"h-5"})}}),null),m(a,g(Z,{get when(){return r()},get children(){return g(xe,{type:"button",variant:"default",size:"sm",get disabled(){return e.saving||e.saved},onClick:()=>{var l;return(l=e.onSave)==null?void 0:l.call(e)},"data-kai-builder-header-save":!0,get children(){return Re(()=>!!e.saving)()?"Saving…":e.saved?"Saved":"Save"}})}}),null),U(()=>ue(i,G("flex h-12 shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-4",e.class))),i})()}var cb=x('<section class="flex flex-col gap-6"data-builder-home><div class="flex flex-col gap-1"><h1 class="text-xl font-semibold text-foreground">Your constructs</h1><p class="text-sm text-muted-foreground">Pick up where you left off, or start a new one. Each card is a construct file in this directory.</p></div><div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"><button type=button class="flex min-h-32 flex-col items-start gap-1 rounded-lg border border-border bg-card p-4 text-left transition-colors hover:border-primary/60 focus-visible:outline-2 focus-visible:outline-primary disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-border border-dashed"data-new-construct><span class="flex items-center gap-1.5 text-sm font-semibold text-foreground">New construct</span><span class="text-xs text-muted-foreground">Start from a template.'),ub=x('<span class="text-xs text-muted-foreground">'),db=x('<button type=button class="flex min-h-32 flex-col items-start gap-1 rounded-lg border border-border bg-card p-4 text-left transition-colors hover:border-primary/60 focus-visible:outline-2 focus-visible:outline-primary disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-border"><span class="font-mono text-sm font-semibold text-foreground"><<!>></span><span class="mt-auto text-xs text-muted-foreground">'),fb=x('<span class="flex items-center gap-1 text-xs text-destructive">invalid construct file — fix <!> by hand');function hb(e,t=Date.now()){const n=Date.parse(e);if(Number.isNaN(n))return"";const r=Math.max(0,Math.round((t-n)/1e3));if(r<60)return"just now";const o=Math.round(r/60);if(o<60)return`${o} min ago`;const i=Math.round(o/60);if(i<24)return`${i} h ago`;const s=Math.round(i/24);return s<30?`${s} d ago`:new Date(n).toLocaleDateString()}function gb(e){return(()=>{var t=cb(),n=t.firstChild,r=n.nextSibling,o=r.firstChild,i=o.firstChild,s=i.firstChild;return m(r,g(ke,{get each(){return e.constructs},children:a=>(()=>{var l=db(),u=l.firstChild,d=u.firstChild,c=d.nextSibling;c.nextSibling;var f=u.nextSibling;return l.$$click=()=>e.onOpen(a.file),m(u,()=>a.name,c),m(l,g(Z,{get when(){return a.valid},get fallback(){return(()=>{var h=fb(),p=h.firstChild,v=p.nextSibling;return v.nextSibling,m(h,g(xl,{size:12,"aria-hidden":"true"}),p),m(h,()=>a.file,v),h})()},get children(){var h=ub();return m(h,()=>a.templateName??"Custom"),h}}),f),m(f,(()=>{var h=Re(()=>e.opening===a.file);return()=>h()?"Opening…":`Edited ${hb(a.updatedAt)}`})()),U(h=>{var p=!a.valid||e.opening!==void 0,v=a.file,b=`Open ${a.name}`;return p!==h.e&&(l.disabled=h.e=p),v!==h.t&&j(l,"data-construct-card",h.t=v),b!==h.a&&j(l,"aria-label",h.a=b),h},{e:void 0,t:void 0,a:void 0}),l})()}),o),o.$$click=()=>e.onNew(),m(i,g(Zl,{size:16,"aria-hidden":"true"}),s),U(()=>o.disabled=e.opening!==void 0),t})()}bt(["click"]);function mb(e){let t=0;return async function(r){const o=++t;try{const i=await e(r);if(o!==t)return;if(i.status===422)return{problems:(await i.json()).problems??[],serverError:void 0};if(!i.ok)throw new Error(`POST /api/construct → ${i.status}`);return{problems:[],serverError:void 0}}catch{return o!==t?void 0:{problems:[],serverError:"save failed"}}}}const cr=Symbol("store-raw"),Ct=Symbol("store-node"),Ye=Symbol("store-has"),aa=Symbol("store-self");function la(e){let t=e[Ve];if(!t&&(Object.defineProperty(e,Ve,{value:t=new Proxy(e,bb)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),o=Object.getPrototypeOf(e),i=o!==null&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&o!==Object.prototype;if(i){const s=Object.getOwnPropertyDescriptors(o);n.push(...Object.keys(s)),Object.assign(r,s)}for(let s=0,a=n.length;s<a;s++){const l=n[s];i&&l==="constructor"||r[l].get&&Object.defineProperty(e,l,{configurable:!0,enumerable:r[l].enumerable,get:r[l].get.bind(t)})}}return t}function Gt(e){let t;return e!=null&&typeof e=="object"&&(e[Ve]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Yt(e,t=new Set){let n,r,o,i;if(n=e!=null&&e[cr])return n;if(!Gt(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let s=0,a=e.length;s<a;s++)o=e[s],(r=Yt(o,t))!==o&&(e[s]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const s=Object.keys(e),a=Object.getOwnPropertyDescriptors(e);for(let l=0,u=s.length;l<u;l++)i=s[l],!a[i].get&&(o=e[i],(r=Yt(o,t))!==o&&(e[i]=r))}return e}function ur(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function An(e,t,n){if(e[t])return e[t];const[r,o]=J(n,{equals:!1,internal:!0});return r.$=o,e[t]=r}function pb(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===Ve||t===Ct||(delete n.value,delete n.writable,n.get=()=>e[Ve][t]),n}function ca(e){jr()&&An(ur(e,Ct),aa)()}function vb(e){return ca(e),Reflect.ownKeys(e)}const bb={get(e,t,n){if(t===cr)return e;if(t===Ve)return n;if(t===qn)return ca(e),n;const r=ur(e,Ct),o=r[t];let i=o?o():e[t];if(t===Ct||t===Ye||t==="__proto__")return i;if(!o){const s=Object.getOwnPropertyDescriptor(e,t);jr()&&(typeof i!="function"||e.hasOwnProperty(t))&&!(s&&s.get)&&(i=An(r,t,i)())}return Gt(i)?la(i):i},has(e,t){return t===cr||t===Ve||t===qn||t===Ct||t===Ye||t==="__proto__"?!0:(jr()&&An(ur(e,Ye),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:vb,getOwnPropertyDescriptor:pb};function Xt(e,t,n,r=!1){if(t==="__proto__"||!r&&e[t]===n)return;const o=e[t],i=e.length;n===void 0?(delete e[t],e[Ye]&&e[Ye][t]&&o!==void 0&&e[Ye][t].$()):(e[t]=n,e[Ye]&&e[Ye][t]&&o===void 0&&e[Ye][t].$());let s=ur(e,Ct),a;if((a=An(s,t,o))&&a.$(()=>n),Array.isArray(e)&&e.length!==i){for(let l=e.length;l<i;l++)(a=s[l])&&a.$();(a=An(s,"length",i))&&a.$(e.length)}(a=s[aa])&&a.$()}function ua(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];da(o)||Xt(e,o,t[o])}}function da(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function wb(e,t){if(typeof t=="function"&&(t=t(e)),t=Yt(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){const o=t[n];e[n]!==o&&Xt(e,n,o)}Xt(e,"length",r)}else ua(e,t)}function vn(e,t,n=[]){let r,o=e;if(t.length>1){r=t.shift();const s=typeof r,a=Array.isArray(e);if(s==="string"&&(r==="__proto__"||t.length>1&&da(r)))return;if(Array.isArray(r)){for(let l=0;l<r.length;l++)vn(e,[r[l]].concat(t),n);return}else if(a&&s==="function"){for(let l=0;l<e.length;l++)r(e[l],l)&&vn(e,[l].concat(t),n);return}else if(a&&s==="object"){const{from:l=0,to:u=e.length-1,by:d=1}=r;for(let c=l;c<=u;c+=d)vn(e,[c].concat(t),n);return}else if(t.length>1){vn(e[r],t,[r].concat(n));return}o=e[r],n=[r].concat(n)}let i=t[0];typeof i=="function"&&(i=i(o,n),i===o)||r===void 0&&i==null||(i=Yt(i),r===void 0||Gt(o)&&Gt(i)&&!Array.isArray(i)?ua(o,i):Xt(e,r,i))}function yb(...[e,t]){const n=Yt(e||{}),r=Array.isArray(n),o=la(n);function i(...s){wa(()=>{r&&s.length===1?wb(n,s[0]):vn(n,s)})}return[o,i]}const dr=new WeakMap,fa={get(e,t){if(t===cr)return e;const n=e[t];if(t===Ve||t===qn||t===Ct||t===Ye||t==="__proto__")return n;let r;return Gt(n)?dr.get(n)||(dr.set(n,r=new Proxy(n,fa)),r):n},set(e,t,n){return Xt(e,t,Yt(n)),!0},deleteProperty(e,t){return Xt(e,t,void 0,!0),!0}};function xb(e){return t=>{if(Gt(t)){let n;(n=dr.get(t))||dr.set(t,n=new Proxy(t,fa)),e(n)}return t}}let Be={};function kb(e){Be.stack&&e.setAttribute("stack",Be.stack),Be.position&&e.setAttribute("position",Be.position),Be.max!==void 0&&e.setAttribute("max",String(Be.max)),Be.appearance&&e.setAttribute("appearance",Be.appearance),Be.inverse!==void 0&&(Be.inverse?e.setAttribute("inverse",""):e.removeAttribute("inverse"))}const _b=5e3,$b=7e3,{toasts:fr,setToasts:zn,mounted:dw,setMounted:Ti}=Ft(()=>{const[e,t]=yb([]),[n,r]=J(!1);return{toasts:e,setToasts:t,mounted:n,setMounted:r}});let Pi=0;function Sb(){return Pi+=1,`toast-${Pi}`}function Ii(e){const t=e.duration??_b;return t===0?0:e.action?Math.max(t,$b):t}const hn=new Map;let Ri=!1;function Ab(e){return e.target??null}function zb(e=null){if(typeof document>"u")return;const t=hn.get(e);if(t&&t.isConnected)return t;t&&hn.delete(e);const n=new Set(hn.values()),r=Array.from(document.querySelectorAll("kai-toast-region")).filter(s=>s.isConnected&&!n.has(s)&&Ab(s)===e);r.length>1&&!Ri&&(Ri=!0,console.warn(`[kitn] toast(): ${r.length} candidate <kai-toast-region> elements are in the document; adopting the first in document order. Keep one region per target so the imperative toast() API has an unambiguous home.`));const o=r[0];if(o)return o.toasts=fr,hn.set(e,o),Ti(!0),o;const i=document.createElement("kai-toast-region");return document.body.appendChild(i),i.toasts=fr,e&&(i.target=e),kb(i),hn.set(e,i),Ti(!0),i}function Cb(e){const t=fr.findIndex(n=>n.id===e.id);t>=0?zn(t,e):zn(xb(n=>{n.push(e)}))}function ha(e){zn(t=>t.filter(n=>n.id!==e))}function Eb(e){return{id:e,dismiss:()=>ha(e),update:t=>{const n=fr.findIndex(r=>r.id===e);n>=0&&zn(n,r=>({...r,...t}))}}}function gn(e,t,n){zb((t==null?void 0:t.target)??null);const r=(t==null?void 0:t.id)??Sb(),o={id:r,message:e,variant:(t==null?void 0:t.variant)??n,appearance:(t==null?void 0:t.appearance)??Be.appearance??"pill",inverse:(t==null?void 0:t.inverse)??Be.inverse??!1,description:t==null?void 0:t.description,action:t==null?void 0:t.action,duration:t==null?void 0:t.duration,dismissible:t==null?void 0:t.dismissible,target:t==null?void 0:t.target};return Cb(o),Eb(r)}Object.assign((e,t)=>gn(e,t,"neutral"),{success:(e,t)=>gn(e,t,"success"),warning:(e,t)=>gn(e,t,"warning"),error:(e,t)=>gn(e,t,"error"),info:(e,t)=>gn(e,t,"info"),dismiss:ha,clear:()=>zn([])});var Ob=x("<button type=button>"),Tb=x("<button type=button aria-label=Dismiss>"),Qr=x("<div>"),Pb=x('<div class="min-w-0 flex-1"><div class="font-medium leading-snug">'),Ib=x('<span class="min-w-0 flex-1 truncate">'),Rb=x('<div role=region aria-label=Notifications aria-live=polite data-stack=collapsed style="z-index:var(--kai-toast-z, 100)"><div class="pointer-events-auto relative transition-[height] duration-200 ease-out"style="min-width:16rem;max-width:min(30rem, calc(100vw - 2rem))">'),Nb=x('<div role=region aria-label=Notifications aria-live=polite data-stack=expanded style="z-index:var(--kai-toast-z, 100)">');function Db(){var n,r;const[e,t]=J(typeof window<"u"&&((n=window.matchMedia)==null?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches)===!0);if(typeof window<"u"&&window.matchMedia){const o=window.matchMedia("(prefers-reduced-motion: reduce)"),i=()=>t(o.matches);(r=o.addEventListener)==null||r.call(o,"change",i),Pe(()=>{var s;return(s=o.removeEventListener)==null?void 0:s.call(o,"change",i)})}return e}function Ni(e){const[t,n]=J(!0),r=ko(t),o=()=>e.item.variant??"neutral",i=()=>e.item.dismissible!==!1,s=()=>e.item.appearance??e.appearance??"pill",a=()=>e.item.inverse??e.inverse??!1,l=()=>a()?"bg-foreground text-background border-transparent":"bg-popover text-popover-foreground border-border",u=()=>a()?"text-background/70":"text-muted-foreground",d=()=>a()?"text-background hover:text-background/80":"text-primary hover:text-primary/80",c=()=>a()?"text-background/70 hover:text-background":"text-muted-foreground hover:text-foreground";let f=Ii(e.item),h=0,p,v="timeout";const b=()=>{p!==void 0&&(clearTimeout(p),p=void 0)},y=()=>{b(),!(f<=0)&&(h=Date.now(),p=setTimeout(()=>{v="timeout",n(!1)},f))},z=()=>{p!==void 0&&(b(),f-=Date.now()-h)},[k,T]=J(!1),D=()=>e.paused===!0||k();Oe(wn(()=>Ii(e.item),I=>{f=I,D()?b():y()})),Oe(wn(D,I=>{I?z():y()},{defer:!0})),Pe(b),Oe(()=>{!r.present()&&!t()&&e.onDismiss(v)});const E=()=>{b(),v="close",n(!1)},O=()=>{var _;const I=e.item.action;if(!I)return;(_=e.onAction)==null||_.call(e,I.label),I.onAction()===!1||(b(),v="action",n(!1))},N=()=>s()==="card"?"mt-0.5":void 0,Y=()=>[g(Z,{get when(){return o()==="success"},get children(){return g(ll,{get class(){return G("size-4 shrink-0 text-success",N())}})}}),g(Z,{get when(){return o()==="warning"},get children(){return g(rc,{get class(){return G("size-4 shrink-0 text-warning",N())}})}}),g(Z,{get when(){return o()==="error"},get children(){return g(pl,{get class(){return G("size-4 shrink-0 text-destructive",N())}})}}),g(Z,{get when(){return o()==="info"},get children(){return g(zl,{get class(){return G("size-4 shrink-0 text-info",N())}})}})],M=I=>g(Z,{get when(){return e.item.action},children:H=>(()=>{var _=Ob();return _.$$click=O,m(_,()=>H().label),U(()=>ue(_,G(s()==="card"?G("inline-flex shrink-0 items-center rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",a()?"border-background/30 text-background hover:bg-background/10":"border-border text-foreground hover:bg-accent"):G("shrink-0 rounded-md text-sm font-medium underline-offset-2 hover:underline",d()),I.class))),_})()}),W=()=>g(Z,{get when(){return i()},get children(){var I=Tb();return I.$$click=E,m(I,g(Qt,{class:"size-3.5"})),U(()=>ue(I,G("-mr-1 flex size-5 shrink-0 items-center justify-center rounded-md transition-colors",c()))),I}});return g(Z,{get when(){return r.present()},get children(){var I=Qr();I.addEventListener("pointerleave",()=>T(!1)),I.addEventListener("pointerenter",()=>T(!0));var H=r.setRef;return typeof H=="function"?Qe(H,I):r.setRef=I,m(I,g(Y,{}),null),m(I,g(Z,{get when(){return s()==="card"},get fallback(){return[(()=>{var _=Ib();return m(_,()=>e.item.message),_})(),g(M,{}),g(W,{})]},get children(){return[(()=>{var _=Pb(),R=_.firstChild;return m(R,()=>e.item.message),m(_,g(Z,{get when(){return e.item.description},get children(){var B=Qr();return m(B,()=>e.item.description),U(()=>ue(B,G("mt-1 line-clamp-2 text-xs leading-snug",u()))),B}}),null),m(_,g(M,{class:"mt-2"}),null),_})(),g(W,{})]}}),null),U(_=>{var R=o()==="error"?"alert":"status",B=s(),ee=a()?"":void 0,re=r.state()==="closed"?"":void 0,se=G("pointer-events-auto border text-sm shadow-lg",l(),"animate-in fade-in-0 slide-in-from-top-4","data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-top-2",s()==="card"?"flex min-w-[24rem] items-start gap-3 rounded-xl p-4 shadow-xl":"flex items-center gap-3 rounded-pill px-4 py-2.5");return R!==_.e&&j(I,"role",_.e=R),B!==_.t&&j(I,"data-appearance",_.t=B),ee!==_.a&&j(I,"data-inverse",_.a=ee),re!==_.o&&j(I,"data-closed",_.o=re),se!==_.i&&ue(I,_.i=se),_},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),I}})}const Di={"top-center":"top-4 left-1/2 -translate-x-1/2 items-center","top-right":"top-4 right-4 items-end","top-left":"top-4 left-4 items-start","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 items-center flex-col-reverse","bottom-right":"bottom-4 right-4 items-end flex-col-reverse","bottom-left":"bottom-4 left-4 items-start flex-col-reverse"},Lb={"top-center":"items-center","top-left":"items-start","top-right":"items-end","bottom-center":"items-center flex-col-reverse","bottom-left":"items-start flex-col-reverse","bottom-right":"items-end flex-col-reverse"},mn=12;function Li(e,t){const n=t.left+t.width/2,r=t.top+mn,o=t.bottom-mn,i=t.left+mn,s=t.right-mn,a=`${Math.max(0,t.width-mn*2)}px`;switch(e){case"top-left":return{top:`${r}px`,left:`${i}px`,transform:"none","max-width":a};case"top-right":return{top:`${r}px`,left:`${s}px`,transform:"translateX(-100%)","max-width":a};case"bottom-center":return{top:`${o}px`,left:`${n}px`,transform:"translate(-50%, -100%)","max-width":a};case"bottom-left":return{top:`${o}px`,left:`${i}px`,transform:"translateY(-100%)","max-width":a};case"bottom-right":return{top:`${o}px`,left:`${s}px`,transform:"translate(-100%, -100%)","max-width":a};case"top-center":default:return{top:`${r}px`,left:`${n}px`,transform:"translateX(-50%)","max-width":a}}}function jb(e){const t=()=>e.max??3,n=()=>e.position??"top-center",r=()=>e.stack??"expanded",o=Db(),i=()=>r()==="collapsed"&&!o(),[s,a]=J(!1),[l,u]=J(!1),d=()=>s()||l(),c=20,f=.05,h=48,p=8,v=()=>n().startsWith("bottom"),b=()=>v()?-1:1,[y,z]=J(h),k=M=>{if(!M||typeof window>"u")return;const W=()=>{const H=M.offsetHeight;H&&z(H)};if(W(),typeof ResizeObserver>"u")return;const I=new ResizeObserver(W);I.observe(M),Pe(()=>I.disconnect())},T=M=>d()?`translateY(${b()*(y()+p)*M}px) scale(1)`:`translateY(${b()*c*M}px) scale(${1-f*M})`,D=()=>{const M=O().length;return M?d()?M*y()+(M-1)*p:y()+(M-1)*c:0},E=je(()=>[...(e.toasts??[]).filter(M=>(M.target??void 0)===e.target)].reverse()),O=je(()=>E().slice(0,t())),[N,Y]=J(null);return Oe(()=>{const M=e.target;if(!M||typeof window>"u"){Y(null);return}const W=window,I=W.removeEventListener.bind(W),H=()=>{const R=M.getBoundingClientRect();Y({top:R.top,left:R.left,right:R.right,bottom:R.bottom,width:R.width})};H();const _=new ResizeObserver(H);_.observe(M),W.addEventListener("scroll",H,!0),W.addEventListener("resize",H),Pe(()=>{_.disconnect(),I("scroll",H,!0),I("resize",H)})}),g(Z,{get when(){return i()},get fallback(){return(()=>{var M=Nb();return m(M,g(ke,{get each(){return O()},children:W=>g(Ni,{item:W,get appearance(){return e.appearance},get inverse(){return e.inverse},onDismiss:I=>{var H;return(H=e.onDismiss)==null?void 0:H.call(e,W.id,I)},onAction:I=>{var H;return(H=e.onAction)==null?void 0:H.call(e,W.id,I)}})})),U(W=>{var I=G("pointer-events-none fixed flex flex-col gap-2",N()?Lb[n()]:G("max-w-[min(30rem,calc(100vw-2rem))]",Di[n()])),H={...N()?Li(n(),N()):void 0};return I!==W.e&&ue(M,W.e=I),W.t=P(M,H,W.t),W},{e:void 0,t:void 0}),M})()},get children(){var M=Rb(),W=M.firstChild;return M.$$focusout=()=>u(!1),M.$$focusin=()=>u(!0),M.addEventListener("pointerleave",()=>a(!1)),M.addEventListener("pointerenter",()=>a(!0)),m(W,g(ke,{get each(){return O()},children:(I,H)=>(()=>{var _=Qr();return Qe(R=>{H()===0&&k(R)},_),m(_,g(Ni,{item:I,get paused(){return d()},get appearance(){return e.appearance},get inverse(){return e.inverse},onDismiss:R=>{var B;return(B=e.onDismiss)==null?void 0:B.call(e,I.id,R)},onAction:R=>{var B;return(B=e.onAction)==null?void 0:B.call(e,I.id,R)}})),U(R=>{var B=H(),ee=G("absolute inset-x-0 flex transition-[transform,opacity] duration-200 ease-out",v()?"bottom-0 origin-bottom":"top-0 origin-top",n().endsWith("right")?"justify-end":n().endsWith("left")?"justify-start":"justify-center"),re=String(t()-H()),se=T(H());return B!==R.e&&j(_,"data-depth",R.e=B),ee!==R.t&&ue(_,R.t=ee),re!==R.a&&At(_,"z-index",R.a=re),se!==R.o&&At(_,"transform",R.o=se),R},{e:void 0,t:void 0,a:void 0,o:void 0}),_})()})),U(I=>{var H=d()?"":void 0,_=G("pointer-events-none fixed",!N()&&Di[n()]),R={...N()?Li(n(),N()):void 0},B=`${D()}px`;return H!==I.e&&j(M,"data-expanded",I.e=H),_!==I.t&&ue(M,I.t=_),I.a=P(M,R,I.a),B!==I.o&&At(W,"height",I.o=B),I},{e:void 0,t:void 0,a:void 0,o:void 0}),M}})}bt(["click","focusin","focusout"]);var Zb=x('<header part=header class="shrink-0 border-b border-border px-5 py-4 text-base font-semibold text-foreground">'),Mb=x('<footer part=footer class="flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-3">'),Fb=x('<div part=backdrop><div part=panel role=dialog aria-modal=true tabindex=-1><div part=body class="min-h-0 flex-1 overflow-auto px-5 py-4 text-sm text-foreground">');const ji=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])','[tabindex]:not([tabindex="-1"])'].join(",");function Ub(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&getComputedStyle(e).visibility!=="hidden"}function Bb(e){const t=[],n=r=>{for(const o of Array.from(r.children))if(o instanceof HTMLSlotElement)for(const i of o.assignedElements())i instanceof HTMLElement&&(i.matches(ji)&&t.push(i),n(i));else o instanceof HTMLElement&&(o.matches(ji)&&t.push(o),n(o))};return n(e),t.filter(Ub)}function Zi(){var t;let e=document.activeElement;for(;(t=e==null?void 0:e.shadowRoot)!=null&&t.activeElement;)e=e.shadowRoot.activeElement;return e}function Vb(e){var v;const t=Gs(),[n,r]=J(e.defaultOpen??!1),o=`kai-dialog-title-${Ie()}`,i=()=>e.open!==void 0,s=()=>i()?!!e.open:n(),a=b=>{var y;i()||r(b),(y=e.onOpenChange)==null||y.call(e,b)};(v=e.controllerRef)==null||v.call(e,{open:s,setOpen:a});const l=ko(s);let u,d,c=null,f=!1;Oe(b=>{const y=s();if(y&&!b)c=Zi(),queueMicrotask(()=>d==null?void 0:d.focus());else if(!y&&b){const z=c;c=null,z&&z.isConnected&&queueMicrotask(()=>z.focus())}return y},!1);const h=b=>{if(b.key==="Escape"){b.stopPropagation(),a(!1);return}if(b.key!=="Tab"||!d)return;const y=Bb(d);if(!y.length){b.preventDefault(),d.focus();return}const z=Zi(),k=z?y.indexOf(z):-1;b.shiftKey?k<=0&&(b.preventDefault(),y[y.length-1].focus()):(k===-1||k===y.length-1)&&(b.preventDefault(),y[0].focus())},p=b=>{f&&b.target===u&&a(!1),f=!1};return g(Z,{get when(){return l.present()},get children(){return g(Qi,{get mount(){return t.portalMount()},get children(){var b=Fb(),y=b.firstChild,z=y.firstChild;return b.$$keydown=h,b.$$click=p,b.$$pointerdown=k=>{f=k.target===k.currentTarget},Qe(k=>{u=k,l.setRef(k)},b),Qe(k=>{var T;d=k,(T=e.panelRef)==null||T.call(e,k)},y),m(y,g(Z,{get when(){return e.header},get children(){var k=Zb();return j(k,"id",o),m(k,()=>e.header),k}}),z),m(z,()=>e.children),m(y,g(Z,{get when(){return e.footer},get children(){var k=Mb();return m(k,()=>e.footer),k}}),null),U(k=>{var T=l.state()==="open"?"":void 0,D=l.state()==="closed"?"":void 0,E=G("fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4","animate-in fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0 motion-reduce:animate-none"),O=e.header?o:void 0,N=e.header?void 0:e["aria-label"],Y=l.state()==="open"?"":void 0,M=l.state()==="closed"?"":void 0,W=G("flex max-h-[85vh] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-border bg-background text-foreground shadow-xl outline-none","animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 motion-reduce:animate-none",e.class);return T!==k.e&&j(b,"data-expanded",k.e=T),D!==k.t&&j(b,"data-closed",k.t=D),E!==k.a&&ue(b,k.a=E),O!==k.o&&j(y,"aria-labelledby",k.o=O),N!==k.i&&j(y,"aria-label",k.i=N),Y!==k.n&&j(y,"data-expanded",k.n=Y),M!==k.s&&j(y,"data-closed",k.s=M),W!==k.h&&ue(y,k.h=W),k},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),b}})}})}bt(["pointerdown","click","keydown"]);var Hb=x('<iframe title=preview class="h-full w-full border-0">'),Wb=x('<p role=alert class="text-sm text-destructive dark:text-red-400">Preview failed to start — '),Kb=x('<p class="max-w-sm text-xs text-muted-foreground">Your construct file is safe on disk. Check the terminal running <code>kai dev --builder</code> for the full output.'),Jb=x('<div class="flex h-full flex-col items-center justify-center gap-2 p-8 text-center"data-preview-placeholder>'),qb=x('<p class="text-sm text-muted-foreground">Starting the preview — installing dependencies, this can take a minute on the first run.'),Gb=x('<p class="max-w-sm text-xs text-muted-foreground">Keep editing — every change is written to your construct file and shows up as soon as the preview is running.'),Yb=x('<div role=alert class="sticky top-0 z-10 border-b border-destructive/40 bg-destructive/10 px-4 py-2 text-center text-sm text-destructive dark:bg-destructive/15 dark:text-red-400">'),Xb=x("<main data-builder-step=home>"),Mi=x("<div>"),Qb=x('<main data-builder-step=start><div class="flex flex-col gap-1"><h1 class="text-xl font-semibold text-foreground">Start a construct</h1><p class="text-sm text-muted-foreground">Pick a template. You will get a live preview and a construct file you own.'),ew=x("<main data-builder-step=variant>"),tw=x('<div class="grid min-h-0 flex-1 grid-cols-[380px_1fr]"><div class="flex flex-col overflow-y-auto border-r border-border">'),nw=x('<div class="flex h-dvh flex-col">'),rw=x(`<p class="mb-4 text-sm text-muted-foreground">Switching resets this construct to the new template's starter. Your name is kept; everything else is replaced.`),ow=x('<div class="min-h-dvh bg-background text-foreground">'),Fi=x('<p role=alert class="text-xs text-destructive">: '),iw=x('<main data-builder-step=name><div class="flex flex-col gap-1"><h1 class="text-xl font-semibold text-foreground">Name your element</h1><p class="text-sm text-muted-foreground">The emitted custom-element tag: lowercase, with a hyphen (e.g. acme-support).</p></div><div class="flex flex-col gap-1.5"><label for=construct-name class="text-xs font-medium text-foreground">Element name</label></div><div class="flex gap-2">'),sw=x('<div class="grid min-h-0 flex-1 grid-cols-[420px_1fr]"><div class="min-h-0 border-r border-border"><iframe title="theme studio"src="/theme-studio/?embed=1"class="h-full w-full border-0">'),aw=x('<div class="flex min-h-0 flex-1 flex-col"data-theme-studio-takeover><div class="flex items-center justify-between border-b border-border px-4 py-2"><span class="text-sm font-medium">Theme builder</span><div class="flex items-center gap-2">'),lw=x(`<div class="flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center"><p class="text-sm text-muted-foreground">The theme studio isn't in this build yet.</p><p class="max-w-sm text-xs text-muted-foreground">Rebuild the kit and restart <code>kai dev --builder</code> — the studio is served at <code>/theme-studio/</code> on this same server once it ships.`),cw=x('<div class="flex flex-1 items-center justify-center"><p class="text-sm text-muted-foreground">Opening theme studio…');const jt={"--color-primary":"#EC2295","--color-primary-foreground":"hsl(45 4% 5%)"},Kn=e=>`mx-auto flex ${e} flex-col gap-6 py-10`,Jn={id:"assistant",name:"Scratch",description:"A bare chat, everything off.",availability:"buildable",starter:{name:"my-chat",layout:"fullscreen",provider:{mode:"mock"}},controls:[{id:"identity",paths:["name"]},{id:"theme",paths:["theme.accent","theme.mode","theme.unreadColor"]},{id:"header",paths:["header.title"]},{id:"capabilities",paths:["capabilities.starters","capabilities.attachments","capabilities.history","capabilities.conversations","capabilities.reasoning","capabilities.reasoningOpen"]},{id:"provider",paths:["provider"]}]};function Ui(e){try{return JSON.parse(e.data||"{}")}catch{return{}}}function uw(){var So;const[e,t]=J({step:"start"}),[n,r]=J(Jn),[o,i]=J(),[s,a]=J(),[l,u]=J(!1),[d,c]=J(),[f,h]=J(!1),[p,v]=J([]),[b,y]=J(),[z,k]=J(""),[T,D]=J([]),[E,O]=J(),[N,Y]=J(!1),[M,W]=J(!1),[I,H]=J(),[_,R]=J([]);let B=0;const ee=(A,w,S)=>{B+=1,R(K=>[...K,{id:`builder-toast-${B}`,message:A,variant:w,description:S,appearance:S?"card":"pill"}])},re=A=>{R(w=>w.filter(S=>S.id!==A))},[se,fe]=J();Co(async()=>{try{const w=await fetch("/api/state");if(!w.ok)throw new Error(`GET /api/state → ${w.status}`);const S=await w.json();if(S.phase==="panel"){const K=S.construct;i(K),a(S.previewUrl),u(!!S.previewPending),c(S.previewError),r(dt(K)),t({step:"panel"})}else S.phase==="home"&&(D(S.constructs??[]),t({step:"home"}));fe(void 0)}catch{fe("can't reach the builder server")}const A=new EventSource("/api/events");A.onopen=()=>fe(void 0),A.addEventListener("construct",async()=>{try{const w=await fetch("/api/construct");if(!w.ok)throw new Error(`GET /api/construct → ${w.status}`);const S=await w.json();S.problems?v(S.problems):(i(S),r(dt(S)),v([])),fe(void 0)}catch{fe("can't reach the builder server")}}),A.addEventListener("preview",w=>{const S=Ui(w).previewUrl;S&&(a(S),u(!1),c(void 0))}),A.addEventListener("preview-error",w=>{const S=Ui(w).message??"the preview server failed to start";u(!1),c(S),fe(`preview failed to start — ${S}`)}),A.onerror=()=>fe("can't reach the builder server"),Pe(()=>A.close())});const dt=A=>{const w=Yc(A);if(w){const S=Gc(w);if(S&&S.availability==="buildable")return S}return{...Jn,name:A.name}},xt=A=>A==="scratch"?Jn:qc().find(w=>w.id===A)??Jn,Sr=A=>{y(A),A==="workspace"?t({step:"variant",templateId:"workspace"}):(k(xt(A).starter.name),t({step:"name",templateId:A}))},In=async A=>{if(!f()){h(!0);try{const w=await fetch("/api/create",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({templateId:b(),variantId:A,name:z()})});if(w.status===422){v((await w.json()).problems??[]),fe(void 0);return}if(!w.ok)throw new Error(`POST /api/create → ${w.status}`);const S=await w.json();r(xt(b())),i(S.construct),a(S.previewUrl),u(!!S.previewPending),c(void 0),v([]),fe(void 0),t({step:"panel"})}catch{fe("save failed")}finally{h(!1)}}},Ar=async A=>{if(!E()){O(A);try{const w=await fetch("/api/open",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({file:A})});if(w.status===422||w.status===404){v((await w.json()).problems??[]),fe(void 0);return}if(!w.ok)throw new Error(`POST /api/open → ${w.status}`);const S=await w.json(),K=S.construct;i(K),r(dt(K)),a(S.previewUrl),u(!!S.previewPending),c(void 0),v([]),fe(void 0),t({step:"panel"})}catch{fe("can't reach the builder server")}finally{O(void 0)}}},Rn=async()=>{try{const A=await fetch("/api/constructs");if(!A.ok)throw new Error(`GET /api/constructs → ${A.status}`);D((await A.json()).constructs??[]),fe(void 0)}catch{fe("can't reach the builder server")}v([]),t({step:"home"})};let on,Rt;const[zr,ft]=J(!1),[Cr,Nn]=J(!1),Dn=mb(A=>fetch("/api/construct",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(A)}));let kt;const nt=async()=>{clearTimeout(on);const A=Rt;if(!A)return;Rt=void 0,Nn(!0);const w=await Dn(A);if(Nn(!1),!!w)return Rt===void 0&&ft(!1),v(w.problems),fe(w.serverError),kt=w,w},C=A=>{i(A),Rt=A,ft(!0),clearTimeout(on),on=setTimeout(()=>void nt(),300)},L=async A=>{var K;const w=xt(A).starter,S={...w,name:((K=o())==null?void 0:K.name)??w.name};r(xt(A)),Y(!1),C(S)},F=typeof window<"u"&&!!((So=window.matchMedia)!=null&&So.call(window,"(prefers-color-scheme: dark)").matches),q=()=>{var w,S;const A=((S=(w=o())==null?void 0:w.theme)==null?void 0:S.mode)??"system";return A==="dark"||A==="system"&&F},ie=()=>{const A=o();A&&C({...A,theme:{...A.theme,mode:q()?"light":"dark"}})};let ne;const Ae=async()=>{var w;const A=(w=o())==null?void 0:w.theme;if(ne={accent:A==null?void 0:A.accent,tokens:A==null?void 0:A.tokens},kt=void 0,W(!0),!I())try{const S=await fetch("/theme-studio/");H(S.ok)}catch{H(!1)}},rt=A=>{const w=A==null?void 0:A.theme,S=w==null?void 0:w.tokens;return S&&(S.light||S.dark||S.radius||S.fonts)?{light:{...S.light??{}},dark:{...S.dark??{}},...S.radius?{radius:S.radius}:{},...S.fonts?{fonts:S.fonts}:{}}:{light:w!=null&&w.accent?{"--kai-color-primary":w.accent}:{},dark:{}}},ht=(A,w)=>{var te,Ce;const S=(te=w.light)==null?void 0:te["--kai-color-primary"],K={...w.light&&Object.keys(w.light).length?{light:w.light}:{},...w.dark&&Object.keys(w.dark).length?{dark:w.dark}:{},...w.radius?{radius:w.radius}:{},...w.fonts&&Object.keys(w.fonts).length?{fonts:w.fonts}:{}};return{...A.theme,mode:((Ce=A.theme)==null?void 0:Ce.mode)??"system",...S?{accent:S}:{},tokens:K}},Ln=A=>{const w=o();if(!w||!M())return;const S=ht(w,A);ne&&JSON.stringify({a:S.accent,t:S.tokens})===JSON.stringify({a:ne.accent,t:ne.tokens})||C({...w,theme:S})},Nt=A=>!!A&&A.problems.length===0&&!A.serverError,jn=A=>A?A.problems.map(w=>`${w.path}: ${w.message}`).join("; ")||A.serverError||"the server rejected the write":"the write was superseded by a newer edit",Er=async A=>{var Ce,Me;const w=o();if(!w)return;const S=(Ce=A.light)==null?void 0:Ce["--kai-color-primary"];C({...w,theme:ht(w,A)});const K=await nt();if(Nt(K)){ee("Theme applied","success"),ne=void 0,W(!1);return}const te=jn(K);S?(C({...w,theme:{...w.theme,mode:((Me=w.theme)==null?void 0:Me.mode)??"system",accent:S}}),Nt(await nt())?(ee("Couldn't save the full palette — kept the accent color","warning",te),ne=void 0,W(!1)):ee("Theme not saved","error",te)):ee("Theme not saved","error",te)},ga=async()=>{const A=await nt()??kt;if(A&&(A.problems.length>0||A.serverError)){ee("Theme not saved","error",jn(A));return}A&&ee("Theme applied","success"),ne=void 0,kt=void 0,W(!1)},_o=async()=>{var te;W(!1);const A=ne;ne=void 0;const w=o();if(!w||!A)return;const S=w.theme;if(JSON.stringify({a:S==null?void 0:S.accent,t:S==null?void 0:S.tokens})===JSON.stringify({a:A.accent,t:A.tokens}))return;const K={...w.theme??{},mode:((te=w.theme)==null?void 0:te.mode)??"system"};A.accent===void 0?delete K.accent:K.accent=A.accent,A.tokens===void 0?delete K.tokens:K.tokens=A.tokens,C({...w,theme:K}),await nt(),ee("Theme changes discarded","info")};Co(()=>{const A=K=>{if(K.origin!==window.location.origin)return;const te=K.data;!te||typeof te!="object"||(te.type==="kai-theme-close"?_o():te.type==="kai-theme-apply"?Er(te):te.type==="kai-theme-change"&&Ln(te))},w=window,S=w.removeEventListener.bind(w);w.addEventListener("message",A),Pe(()=>S("message",A))});const $o=()=>g(Z,{get when(){return s()},get fallback(){return(()=>{var A=Jb();return m(A,g(Z,{get when(){return d()},get fallback(){return[qb(),Gb()]},get children(){return[(()=>{var w=Wb();return w.firstChild,m(w,d,null),w})(),Kb()]}})),A})()},get children(){var A=Hb();return U(()=>j(A,"src",s())),A}});return(()=>{var A=ow();return m(A,g(Z,{get when(){return se()},get children(){var w=Yb();return m(w,se),w}}),null),m(A,g(Z,{get when(){return e().step==="home"},get children(){var w=Xb();return m(w,g(gb,{get constructs(){return T()},get opening(){return E()},onOpen:S=>void Ar(S),onNew:()=>{v([]),t({step:"start"})}}),null),m(w,g(ke,{get each(){return p()},children:S=>(()=>{var K=Fi(),te=K.firstChild;return m(K,()=>S.path,te),m(K,()=>S.message,null),K})()}),null),U(S=>{var K=Kn("max-w-6xl"),te=jt;return K!==S.e&&ue(w,S.e=K),S.t=P(w,te,S.t),S},{e:void 0,t:void 0}),w}}),null),m(A,g(Z,{get when(){return e().step==="start"},get children(){var w=Qb(),S=w.firstChild,K=S.firstChild;return K.nextSibling,m(S,g(Z,{get when(){return T().length>0},get children(){var te=Mi();return m(te,g(xe,{variant:"ghost",size:"sm",class:"-ml-2 text-muted-foreground",onClick:()=>void Rn(),"data-builder-back-home":!0,children:"Back to your constructs"})),te}}),null),m(w,g(jo,{templates:Ur,get value(){return b()},onSelect:Sr}),null),U(te=>{var Ce=Kn("max-w-6xl"),Me=jt;return Ce!==te.e&&ue(w,te.e=Ce),te.t=P(w,Me,te.t),te},{e:void 0,t:void 0}),w}}),null),m(A,g(Z,{get when(){return e().step==="variant"},get children(){var w=ew();return m(w,g(Au,{onBack:()=>t({step:"start"}),onSelect:S=>{k(xt("workspace").starter.name),t({step:"name",templateId:"workspace",variantId:S})}})),U(S=>{var K=Kn("max-w-6xl"),te=jt;return K!==S.e&&ue(w,S.e=K),S.t=P(w,te,S.t),S},{e:void 0,t:void 0}),w}}),null),m(A,g(Z,{get when(){return e().step==="name"},children:w=>{const S=e();return(()=>{var K=iw(),te=K.firstChild,Ce=te.nextSibling;Ce.firstChild;var Me=Ce.nextSibling;return m(Ce,g(Se,{id:"construct-name",get value(){return z()},onValueInput:k,placeholder:"acme-support"}),null),m(K,g(ke,{get each(){return p()},children:Ge=>(()=>{var ot=Fi(),sn=ot.firstChild;return m(ot,()=>Ge.path,sn),m(ot,()=>Ge.message,null),ot})()}),Me),m(Me,g(xe,{variant:"outline",onClick:()=>t({step:"start"}),children:"Back"}),null),m(Me,g(xe,{get disabled(){return f()},onClick:()=>In(S.variantId),get children(){return f()?"Creating…":"Create"}}),null),U(Ge=>{var ot=Kn("max-w-md"),sn=jt;return ot!==Ge.e&&ue(K,Ge.e=ot),Ge.t=P(K,sn,Ge.t),Ge},{e:void 0,t:void 0}),K})()}}),null),m(A,g(Z,{get when(){return Re(()=>e().step==="panel")()&&o()},get children(){var w=nw();return m(w,g(lb,{onHome:()=>void Rn(),get title(){return n().name},get status(){return l()?"preview starting…":void 0},onSwitchTemplate:()=>Y(!0),get canvasDark(){return q()},onToggleCanvasDark:ie,onSave:()=>void nt(),get saving(){return Cr()},get saved(){return!zr()}}),null),m(w,g(Z,{get when(){return!M()},get fallback(){return(()=>{var S=aw(),K=S.firstChild,te=K.firstChild,Ce=te.nextSibling;return m(Ce,g(xe,{variant:"outline",size:"sm",onClick:()=>void _o(),children:"Cancel"}),null),m(Ce,g(xe,{size:"sm",onClick:()=>void ga(),children:"Done"}),null),m(S,g(Z,{get when(){return I()!==!1},get fallback(){return lw()},get children(){return g(Z,{get when(){return I()},get fallback(){return cw()},get children(){var Me=sw(),Ge=Me.firstChild,ot=Ge.firstChild;return no(ot,"load",sn=>{var Ao;return(Ao=sn.currentTarget.contentWindow)==null?void 0:Ao.postMessage({type:"kai-theme-init",theme:rt(o())},window.location.origin)}),m(Me,g($o,{}),null),Me}})}}),null),S})()},get children(){var S=tw(),K=S.firstChild;return m(K,g(ev,{get value(){return o()},onChange:C,get template(){return n()},get problems(){return p()},get sectionActions(){return{theme:g(xe,{type:"button",variant:"ghost",size:"sm",class:"-my-1 h-6 gap-1 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:()=>void Ae(),"data-builder-theme-advanced":!0,get children(){return[g(Hl,{size:12,"aria-hidden":"true"}),"Advanced"]}})}}})),m(S,g($o,{}),null),S}}),null),U(S=>P(w,jt,S)),w}}),null),m(A,g(Vb,{get open(){return N()},onOpenChange:Y,header:"Switch template",class:"max-w-5xl",get footer(){return g(xe,{variant:"outline",size:"sm",onClick:()=>Y(!1),children:"Cancel"})},get children(){return[rw(),(()=>{var w=Mi();return m(w,g(jo,{templates:Ur,onSelect:S=>L(S)})),U(S=>P(w,jt,S)),w})()]}}),null),m(A,g(jb,{get toasts(){return _()},position:"bottom-right",onDismiss:re}),null),A})()}Va(()=>g(uw,{}),document.getElementById("root"));
|