@kitn.ai/ui 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{create-tween-vA7upv0h.js → create-tween-4z1XYLkR.js} +1 -1
- package/dist/{create-tween-CTT5l1bo.js → create-tween-B5Y4Im8G.js} +1 -1
- package/dist/{create-tween-BmBnlg25.js → create-tween-CUzOlaMS.js} +1 -1
- package/dist/elements/artifact.js +1 -1
- package/dist/elements/cards.js +1 -1
- package/dist/elements/chat-workspace.js +1 -1
- package/dist/elements/chat.js +1 -1
- package/dist/elements/choice.js +1 -1
- package/dist/elements/chunks/artifact-BSuPYFHY.js +1 -0
- package/dist/elements/chunks/{card-renderer-aNA0WRFH.js → card-renderer-CSoTL_e1.js} +1 -1
- package/dist/elements/chunks/card-routing-BK09BdmL.js +1 -0
- package/dist/elements/chunks/{chat-thread-DN9evldr.js → chat-thread-DxoKaStk.js} +1 -1
- package/dist/elements/chunks/{choice-card-kNsjU2m8.js → choice-card-CGMc3kek.js} +1 -1
- package/dist/elements/chunks/{confirm-card-CEvFmVhz.js → confirm-card-BWjf2-xo.js} +1 -1
- package/dist/elements/chunks/{form-lUuJjz6s.js → form-Cp8Y00Wn.js} +1 -1
- package/dist/elements/chunks/link-preview-Cf5KOP-i.js +1 -0
- package/dist/elements/chunks/link-preview-DNILK391.js +1 -0
- package/dist/elements/chunks/{markdown-BpAHnBJz.js → markdown-DbozyYqa.js} +16 -16
- package/dist/elements/chunks/{message-CoqLuLkd.js → message-CE4k-qaj.js} +1 -1
- package/dist/elements/chunks/{message-_oYx5mk1.js → message-DtXKPqiR.js} +1 -1
- package/dist/elements/chunks/{reasoning-D26Bb4p6.js → reasoning-BrxQfpfI.js} +1 -1
- package/dist/elements/chunks/source-w9V0NnBn.js +1 -0
- package/dist/elements/chunks/{tasks-card-CfqrkoVO.js → tasks-card-lPxoodlA.js} +1 -1
- package/dist/elements/compare.js +1 -1
- package/dist/elements/confirm-card.js +1 -1
- package/dist/elements/embed.js +1 -1
- package/dist/elements/form.js +1 -1
- package/dist/elements/link-preview.js +1 -1
- package/dist/elements/markdown.js +1 -1
- package/dist/elements/message.js +1 -1
- package/dist/elements/reasoning.js +1 -1
- package/dist/elements/remote.js +1 -1
- package/dist/elements/source.js +1 -1
- package/dist/elements/tasks.js +1 -1
- package/dist/elements/thread.js +1 -1
- package/dist/index.js +4011 -3936
- package/dist/index.server.js +3302 -3228
- package/dist/kai.es.js +1 -1
- package/dist/primitives/card-routing.d.ts +33 -0
- package/dist/{register-impl-C96AnOJn.js → register-impl-DGmGzrEM.js} +15 -15
- package/dist/{solid-C76UXJuy.js → solid-BMuDmFo_.js} +4427 -4352
- package/dist/{solid-BuqWLn6x.js → solid-CGYNdLRR.js} +3738 -3664
- package/dist/solid.js +1 -1
- package/dist/solid.server.js +1 -1
- package/dist/state/stream.d.ts +22 -4
- package/dist/{variant-aurora-CD35fdJF.js → variant-aurora-DwSOfraQ.js} +2 -2
- package/dist/{variant-aurora-Dau5Z4yR.js → variant-aurora-XEkPT0_z.js} +1 -1
- package/dist/{variant-aurora-Dc-2RVH9.js → variant-aurora-wKvAQ5wp.js} +2 -2
- package/dist/{variant-custom-CHr_jbMU.js → variant-custom-BhS9wIpU.js} +2 -2
- package/dist/{variant-custom-Df7QvXyZ.js → variant-custom-MkTNTycd.js} +1 -1
- package/dist/{variant-custom-Cyu8zx4A.js → variant-custom-eFIg2XWQ.js} +2 -2
- package/dist/{variant-wave-CXcaP_9W.js → variant-wave-BwzrHD1s.js} +1 -1
- package/dist/{variant-wave-BkVpxkVF.js → variant-wave-CUWGx9Bn.js} +2 -2
- package/dist/{variant-wave-DcGqjVnK.js → variant-wave-CbVsmgwT.js} +2 -2
- package/dist/wire.js +112 -105
- package/package.json +6 -6
- package/src/components/artifact.tsx +110 -24
- package/src/components/markdown.tsx +83 -5
- package/src/components/source.tsx +35 -3
- package/src/primitives/card-routing.ts +54 -2
- package/src/state/stream.ts +92 -3
- package/src/wire/formats/openai.ts +38 -2
- package/dist/elements/chunks/artifact-BhJIuh3D.js +0 -1
- package/dist/elements/chunks/card-routing-C986KuUA.js +0 -1
- package/dist/elements/chunks/link-preview-C9-jNJBf.js +0 -1
- package/dist/elements/chunks/source-eJurW_-L.js +0 -1
package/dist/kai.es.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const Sn={bash:()=>import("./bash-InADTalH.js"),javascript:()=>import("./javascript-C25yR2R2.js"),typescript:()=>import("./typescript-RycA9KXf.js"),tsx:()=>import("./tsx-B8rCNbgL.js"),html:()=>import("./html-CPZ3oZQ7.js"),css:()=>import("./css-M7EaDHN_.js"),json:()=>import("./json-DxJze_jm.js"),vue:()=>import("./vue-BmIZj4XD.js"),svelte:()=>import("./svelte--5p79yCD.js")},On={"github-dark-dimmed":()=>import("./github-dark-dimmed-DUshB20C.js"),"github-light":()=>import("./github-light-JYsPkUQd.js")},xn={js:"javascript",ts:"typescript",jsx:"tsx",sh:"bash",shell:"bash"},Nt="github-dark-dimmed";let Ot=!0,xt={...Sn},At={...On},kt={...xn},jt=null;const zt=new Set,Ft=new Set;function An(){return jt||(jt=(async()=>{const[{createHighlighterCore:t},{createJavaScriptRegexEngine:n}]=await Promise.all([import("./core-C8fzo39E.js"),import("./engine-javascript-C1x7zo1_.js")]);return t({themes:[],langs:[],engine:n()})})()),jt}function Lt(t){return kt[t]??t}async function kn(t,n){const e=Lt(n);if(zt.has(e))return!0;const r=xt[e];return r?(await t.loadLanguage(r()),zt.add(e),!0):!1}async function Rt(t,n){if(Ft.has(n))return!0;const e=At[n];return e?(await t.loadTheme(e()),Ft.add(n),!0):!1}function jn(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function lt(t){return`<pre><code>${jn(t)}</code></pre>`}async function Pn(t,n,e){if(!Ot||!t)return lt(t);try{const r=await An();if(!await kn(r,n))return lt(t);const o=await Rt(r,e)?e:await Rt(r,Nt)?Nt:null;return o?r.codeToHtml(t,{lang:Lt(n),theme:o}):lt(t)}catch{return lt(t)}}function _n(t){t.enabled!==void 0&&(Ot=t.enabled),t.languages&&(xt={...xt,...t.languages}),t.themes&&(At={...At,...t.themes}),t.aliases&&(kt={...kt,...t.aliases})}function qn(){return Ot}function Cn(t){const n=t.toLowerCase();return n?n.includes("bash")||n.includes("command")||n.includes("shell")||n.includes("terminal")||n.includes("exec")?"command":n.includes("edit")||n.includes("write")||n.includes("patch")||n.includes("replace")||n.includes("delete")?"file-change":n.includes("search")||n.includes("grep")||n.includes("glob")||n.includes("find")?"search":n.includes("fetch")||n.includes("http")||n.includes("browse")||n.includes("crawl")?"fetch":n.includes("mcp")?"mcp":n.includes("image")||n.includes("screenshot")||n.includes("vision")?"image":"generic":"generic"}const p={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Kt(this.context.count)},getNextContextId(){return Kt(this.context.count++)}};function Kt(t){const n=String(t),e=n.length-1;return p.context.id+(e?String.fromCharCode(96+e):"")+n}function Pt(t){p.context=t}function Vn(){return{...p.context,id:p.getNextContextId(),count:0}}const Oe=!1,En=(t,n)=>t===n,E=Symbol("solid-proxy"),Jt=typeof Proxy=="function",X=Symbol("solid-track"),xe=Symbol("solid-dev-component"),at={equals:En};let Y=null,Ut=en;const P=1,Z=2,Wt={owned:null,cleanups:null,context:null,owner:null},_t={};var f=null;let c=null,J=null,U=null,g=null,b=null,O=null,ft=0;function F(t,n){const e=g,r=f,o=t.length===0,s=n===void 0?r:n,i=o?Wt:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=o?t:()=>t(()=>m(()=>z(i)));f=i,g=null;try{return k(u,!0)}finally{g=e,f=r}}function M(t,n){n=n?Object.assign({},at,n):at;const e={value:t,observers:null,observerSlots:null,comparator:n.equals||void 0},r=o=>(typeof o=="function"&&(c&&c.running&&c.sources.has(e)?o=o(e.tValue):o=o(e.value)),tn(e,o));return[Zt.bind(e),r]}function Bt(t,n,e){const r=et(t,n,!0,P);J&&c&&c.running?b.push(r):W(r)}function Gt(t,n,e){const r=et(t,n,!1,P);J&&c&&c.running?b.push(r):W(r)}function Qt(t,n,e){Ut=Kn;const r=et(t,n,!1,P),o=nt&&Ct(nt);o&&(r.suspense=o),(!e||!e.render)&&(r.user=!0),O?O.push(r):W(r)}function A(t,n,e){e=e?Object.assign({},at,e):at;const r=et(t,n,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=e.equals||void 0,J&&c&&c.running?(r.tState=P,b.push(r)):W(r),Zt.bind(r)}function Mn(t){return t&&typeof t=="object"&&"then"in t}function $n(t,n,e){let r,o,s;typeof n=="function"?(r=t,o=n,s=e||{}):(r=!0,o=t,s=n||{});let i=null,u=_t,l=null,d=!1,h=!1,a="initialValue"in s,w=typeof r=="function"&&A(r);const S=new Set,[_,D]=(s.storage||M)(s.initialValue),[N,K]=M(void 0),[q,C]=M(void 0,{equals:!1}),[V,T]=M(a?"ready":"unresolved");p.context&&(l=p.getNextContextId(),s.ssrLoadFrom==="initial"?u=s.initialValue:p.load&&p.has(l)&&(u=p.load(l)));function H(y,v,$,x){return i===y&&(i=null,x!==void 0&&(a=!0),(y===u||v===u)&&s.onHydrated&&queueMicrotask(()=>s.onHydrated(x,{value:v})),u=_t,c&&y&&d?(c.promises.delete(y),d=!1,k(()=>{c.running=!0,Tt(v,$)},!1)):Tt(v,$)),v}function Tt(y,v){k(()=>{v===void 0&&D(()=>y),T(v!==void 0?"errored":a?"ready":"unresolved"),K(v);for(const $ of S.keys())$.decrement();S.clear()},!1)}function mt(){const y=nt&&Ct(nt),v=_(),$=N();if($!==void 0&&!i)throw $;return g&&!g.user&&y&&Bt(()=>{q(),i&&(y.resolved&&c&&d?c.promises.add(i):S.has(y)||(y.increment(),S.add(y)))}),v}function St(y=!0){if(y!==!1&&h)return;h=!1;const v=w?w():r;if(d=c&&c.running,v==null||v===!1){H(i,m(_));return}c&&i&&c.promises.delete(i);let $;const x=u!==_t?u:m(()=>{try{return o(v,{value:_(),refetching:y})}catch(Q){$=Q}});if($!==void 0){H(i,void 0,ht($),v);return}else if(!Mn(x))return H(i,x,void 0,v),x;return i=x,"v"in x?(x.s===1?H(i,x.v,void 0,v):H(i,void 0,ht(x.v),v),x):(h=!0,queueMicrotask(()=>h=!1),k(()=>{T(a?"refreshing":"pending"),C()},!1),x.then(Q=>H(x,Q,void 0,v),Q=>H(x,void 0,ht(Q),v)))}Object.defineProperties(mt,{state:{get:()=>V()},error:{get:()=>N()},loading:{get(){const y=V();return y==="pending"||y==="refreshing"}},latest:{get(){if(!a)return mt();const y=N();if(y&&!i)throw y;return _()}}});let Ht=f;return w?Bt(()=>(Ht=f,St(!1))):St(!1),[mt,{refetch:y=>Xt(Ht,()=>St(y)),mutate:D}]}function Dn(t){return k(t,!1)}function m(t){if(!U&&g===null)return t();const n=g;g=null;try{return U?U.untrack(t):t()}finally{g=n}}function In(t,n,e){const r=Array.isArray(t);let o,s=e&&e.defer;return i=>{let u;if(r){u=Array(t.length);for(let d=0;d<t.length;d++)u[d]=t[d]()}else u=t();if(s)return s=!1,i;const l=m(()=>n(u,o,i));return o=u,l}}function Tn(t){Qt(()=>m(t))}function tt(t){return f===null||(f.cleanups===null?f.cleanups=[t]:f.cleanups.push(t)),t}function Hn(t,n){Y||(Y=Symbol("error")),f=et(void 0,void 0,!0),f.context={...f.context,[Y]:[n]},c&&c.running&&c.sources.add(f);try{return t()}catch(e){ot(e)}finally{f=f.owner}}function qt(){return g}function Nn(){return f}function Xt(t,n){const e=f,r=g;f=t,g=null;try{return k(n,!0)}catch(o){ot(o)}finally{f=e,g=r}}function zn(t){if(c&&c.running)return t(),c.done;const n=g,e=f;return Promise.resolve().then(()=>{g=n,f=e;let r;return(J||nt)&&(r=c||(c={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(o=>r.resolve=o)),r.running=!0),k(t,!1),g=f=null,r?r.done:void 0})}const[Ae,Yt]=M(!1);function Fn(t,n){const e=Symbol("context");return{id:e,Provider:Jn(e),defaultValue:t}}function Ct(t){let n;return f&&f.context&&(n=f.context[t.id])!==void 0?n:t.defaultValue}function Vt(t){const n=A(t),e=A(()=>Et(n()));return e.toArray=()=>{const r=e();return Array.isArray(r)?r:r!=null?[r]:[]},e}let nt;function Zt(){const t=c&&c.running;if(this.sources&&(t?this.tState:this.state))if((t?this.tState:this.state)===P)W(this);else{const n=b;b=null,k(()=>dt(this),!1),b=n}if(g){const n=this.observers;if(!n||n[n.length-1]!==g){const e=n?n.length:0;g.sources?(g.sources.push(this),g.sourceSlots.push(e)):(g.sources=[this],g.sourceSlots=[e]),n?(n.push(g),this.observerSlots.push(g.sources.length-1)):(this.observers=[g],this.observerSlots=[g.sources.length-1])}}return t&&c.sources.has(this)?this.tValue:this.value}function tn(t,n,e){let r=c&&c.running&&c.sources.has(t)?t.tValue:t.value;if(!t.comparator||!t.comparator(r,n)){if(c){const o=c.running;(o||!e&&c.sources.has(t))&&(c.sources.add(t),t.tValue=n),o||(t.value=n)}else t.value=n;t.observers&&t.observers.length&&k(()=>{for(let o=0;o<t.observers.length;o+=1){const s=t.observers[o],i=c&&c.running;i&&c.disposed.has(s)||((i?!s.tState:!s.state)&&(s.pure?b.push(s):O.push(s),s.observers&&rn(s)),i?s.tState=P:s.state=P)}if(b.length>1e6)throw b=[],new Error},!1)}return n}function W(t){if(!t.fn)return;z(t);const n=ft;nn(t,c&&c.running&&c.sources.has(t)?t.tValue:t.value,n),c&&!c.running&&c.sources.has(t)&&queueMicrotask(()=>{k(()=>{c&&(c.running=!0),g=f=t,nn(t,t.tValue,n),g=f=null},!1)})}function nn(t,n,e){let r;const o=f,s=g;g=f=t;try{r=t.fn(n)}catch(i){return t.pure&&(c&&c.running?(t.tState=P,t.tOwned&&t.tOwned.forEach(z),t.tOwned=void 0):(t.state=P,t.owned&&t.owned.forEach(z),t.owned=null)),t.updatedAt=e+1,ot(i)}finally{g=s,f=o}(!t.updatedAt||t.updatedAt<=e)&&(t.updatedAt!=null&&"observers"in t?tn(t,r,!0):c&&c.running&&t.pure?(c.sources.has(t)||(t.value=r),c.sources.add(t),t.tValue=r):t.value=r,t.updatedAt=e)}function et(t,n,e,r=P,o){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:n,owner:f,context:f?f.context:null,pure:e};if(c&&c.running&&(s.state=0,s.tState=r),f===null||f!==Wt&&(c&&c.running&&f.pure?f.tOwned?f.tOwned.push(s):f.tOwned=[s]:f.owned?f.owned.push(s):f.owned=[s]),U&&s.fn){const i=s.fn,[u,l]=M(void 0,{equals:!1}),d=U.factory(i,l);tt(()=>d.dispose());let h;const a=()=>zn(l).then(()=>{h&&(h.dispose(),h=void 0)});s.fn=w=>(u(),c&&c.running?(h||(h=U.factory(i,a)),h.track(w)):d.track(w))}return s}function rt(t){const n=c&&c.running;if((n?t.tState:t.state)===0)return;if((n?t.tState:t.state)===Z)return dt(t);if(t.suspense&&m(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<ft);){if(n&&c.disposed.has(t))return;(n?t.tState:t.state)&&e.push(t)}for(let r=e.length-1;r>=0;r--){if(t=e[r],n){let o=t,s=e[r+1];for(;(o=o.owner)&&o!==s;)if(c.disposed.has(o))return}if((n?t.tState:t.state)===P)W(t);else if((n?t.tState:t.state)===Z){const o=b;b=null,k(()=>dt(t,e[0]),!1),b=o}}}function k(t,n){if(b)return t();let e=!1;n||(b=[]),O?e=!0:O=[],ft++;try{const r=t();return Ln(e),r}catch(r){e||(O=null),b=null,ot(r)}}function Ln(t){if(b&&(J&&c&&c.running?Rn(b):en(b),b=null),t)return;let n;if(c){if(!c.promises.size&&!c.queue.size){const r=c.sources,o=c.disposed;O.push.apply(O,c.effects),n=c.resolve;for(const s of O)"tState"in s&&(s.state=s.tState),delete s.tState;c=null,k(()=>{for(const s of o)z(s);for(const s of r){if(s.value=s.tValue,s.owned)for(let i=0,u=s.owned.length;i<u;i++)z(s.owned[i]);s.tOwned&&(s.owned=s.tOwned),delete s.tValue,delete s.tOwned,s.tState=0}Yt(!1)},!1)}else if(c.running){c.running=!1,c.effects.push.apply(c.effects,O),O=null,Yt(!0);return}}const e=O;O=null,e.length&&k(()=>Ut(e),!1),n&&n()}function en(t){for(let n=0;n<t.length;n++)rt(t[n])}function Rn(t){for(let n=0;n<t.length;n++){const e=t[n],r=c.queue;r.has(e)||(r.add(e),J(()=>{r.delete(e),k(()=>{c.running=!0,rt(e)},!1),c&&(c.running=!1)}))}}function Kn(t){let n,e=0;for(n=0;n<t.length;n++){const r=t[n];r.user?t[e++]=r:rt(r)}if(p.context){if(p.count){p.effects||(p.effects=[]),p.effects.push(...t.slice(0,e));return}Pt()}for(p.effects&&(p.done||!p.count)&&(t=[...p.effects,...t],e+=p.effects.length,delete p.effects),n=0;n<e;n++)rt(t[n])}function dt(t,n){const e=c&&c.running;e?t.tState=0:t.state=0;for(let r=0;r<t.sources.length;r+=1){const o=t.sources[r];if(o.sources){const s=e?o.tState:o.state;s===P?o!==n&&(!o.updatedAt||o.updatedAt<ft)&&rt(o):s===Z&&dt(o,n)}}}function rn(t){const n=c&&c.running;for(let e=0;e<t.observers.length;e+=1){const r=t.observers[e];(n?!r.tState:!r.state)&&(n?r.tState=Z:r.state=Z,r.pure?b.push(r):O.push(r),r.observers&&rn(r))}}function z(t){let n;if(t.sources)for(;t.sources.length;){const e=t.sources.pop(),r=t.sourceSlots.pop(),o=e.observers;if(o&&o.length){const s=o.pop(),i=e.observerSlots.pop();r<o.length&&(s.sourceSlots[i]=r,o[r]=s,e.observerSlots[r]=i)}}if(t.tOwned){for(n=t.tOwned.length-1;n>=0;n--)z(t.tOwned[n]);delete t.tOwned}if(c&&c.running&&t.pure)on(t,!0);else if(t.owned){for(n=t.owned.length-1;n>=0;n--)z(t.owned[n]);t.owned=null}if(t.cleanups){for(n=t.cleanups.length-1;n>=0;n--)t.cleanups[n]();t.cleanups=null}c&&c.running?t.tState=0:t.state=0}function on(t,n){if(n||(t.tState=0,c.disposed.add(t)),t.owned)for(let e=0;e<t.owned.length;e++)on(t.owned[e])}function ht(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function sn(t,n,e){try{for(const r of n)r(t)}catch(r){ot(r,e&&e.owner||null)}}function ot(t,n=f){const e=Y&&n&&n.context&&n.context[Y],r=ht(t);if(!e)throw r;O?O.push({fn(){sn(r,e,n)},state:P}):sn(r,e,n)}function Et(t){if(typeof t=="function"&&!t.length)return Et(t());if(Array.isArray(t)){const n=[];for(let e=0;e<t.length;e++){const r=Et(t[e]);if(Array.isArray(r))if(r.length<32768)n.push.apply(n,r);else for(let o=0;o<r.length;o++)n.push(r[o]);else n.push(r)}return n}return t}function Jn(t,n){return function(e){let r;return Gt(()=>r=m(()=>(f.context={...f.context,[t]:e.value},Vt(()=>e.children))),void 0),r}}const Mt=Symbol("fallback");function gt(t){for(let n=0;n<t.length;n++)t[n]()}function Un(t,n,e={}){let r=[],o=[],s=[],i=0,u=n.length>1?[]:null;return tt(()=>gt(s)),()=>{let l=t()||[],d=l.length,h,a;return l[X],m(()=>{let S,_,D,N,K,q,C,V,T;if(d===0)i!==0&&(gt(s),s=[],r=[],o=[],i=0,u&&(u=[])),e.fallback&&(r=[Mt],o[0]=F(H=>(s[0]=H,e.fallback())),i=1);else if(i===0){for(o=new Array(d),a=0;a<d;a++)r[a]=l[a],o[a]=F(w);i=d}else{for(D=new Array(d),N=new Array(d),u&&(K=new Array(d)),q=0,C=Math.min(i,d);q<C&&r[q]===l[q];q++);for(C=i-1,V=d-1;C>=q&&V>=q&&r[C]===l[V];C--,V--)D[V]=o[C],N[V]=s[C],u&&(K[V]=u[C]);for(S=new Map,_=new Array(V+1),a=V;a>=q;a--)T=l[a],h=S.get(T),_[a]=h===void 0?-1:h,S.set(T,a);for(h=q;h<=C;h++)T=r[h],a=S.get(T),a!==void 0&&a!==-1?(D[a]=o[h],N[a]=s[h],u&&(K[a]=u[h]),a=_[a],S.set(T,a)):s[h]();for(a=q;a<d;a++)a in D?(o[a]=D[a],s[a]=N[a],u&&(u[a]=K[a],u[a](a))):o[a]=F(w);o=o.slice(0,i=d),r=l.slice(0)}return o});function w(S){if(s[a]=S,u){const[_,D]=M(a);return u[a]=D,n(l[a],_)}return n(l[a])}}}function Wn(t,n,e={}){let r=[],o=[],s=[],i=[],u=0,l;return tt(()=>gt(s)),()=>{const d=t()||[],h=d.length;return d[X],m(()=>{if(h===0)return u!==0&&(gt(s),s=[],r=[],o=[],u=0,i=[]),e.fallback&&(r=[Mt],o[0]=F(w=>(s[0]=w,e.fallback())),u=1),o;for(r[0]===Mt&&(s[0](),s=[],r=[],o=[],u=0),l=0;l<h;l++)l<r.length&&r[l]!==d[l]?i[l](()=>d[l]):l>=r.length&&(o[l]=F(a));for(;l<r.length;l++)s[l]();return u=i.length=s.length=h,r=d.slice(0),o=o.slice(0,u)});function a(w){s[l]=w;const[S,_]=M(d[l]);return i[l]=_,n(S,l)}}}let un=!1;function Bn(){un=!0}function Gn(t,n){if(un&&p.context){const e=p.context;Pt(Vn());const r=m(()=>t(n||{}));return Pt(e),r}return m(()=>t(n||{}))}function pt(){return!0}const $t={get(t,n,e){return n===E?e:t.get(n)},has(t,n){return n===E?!0:t.has(n)},set:pt,deleteProperty:pt,getOwnPropertyDescriptor(t,n){return{configurable:!0,enumerable:!0,get(){return t.get(n)},set:pt,deleteProperty:pt}},ownKeys(t){return t.keys()}};function Dt(t){return(t=typeof t=="function"?t():t)?t:{}}function Qn(){for(let t=0,n=this.length;t<n;++t){const e=this[t]();if(e!==void 0)return e}}function Xn(...t){let n=!1;for(let i=0;i<t.length;i++){const u=t[i];n=n||!!u&&E in u,t[i]=typeof u=="function"?(n=!0,A(u)):u}if(Jt&&n)return new Proxy({get(i){for(let u=t.length-1;u>=0;u--){const l=Dt(t[u])[i];if(l!==void 0)return l}},has(i){for(let u=t.length-1;u>=0;u--)if(i in Dt(t[u]))return!0;return!1},keys(){const i=[];for(let u=0;u<t.length;u++)i.push(...Object.keys(Dt(t[u])));return[...new Set(i)]}},$t);const e={},r=Object.create(null);for(let i=t.length-1;i>=0;i--){const u=t[i];if(!u)continue;const l=Object.getOwnPropertyNames(u);for(let d=l.length-1;d>=0;d--){const h=l[d];if(h==="__proto__"||h==="constructor")continue;const a=Object.getOwnPropertyDescriptor(u,h);if(!r[h])r[h]=a.get?{enumerable:!0,configurable:!0,get:Qn.bind(e[h]=[a.get.bind(u)])}:a.value!==void 0?a:void 0;else{const w=e[h];w&&(a.get?w.push(a.get.bind(u)):a.value!==void 0&&w.push(()=>a.value))}}}const o={},s=Object.keys(r);for(let i=s.length-1;i>=0;i--){const u=s[i],l=r[u];l&&l.get?Object.defineProperty(o,u,l):o[u]=l?l.value:void 0}return o}function Yn(t,...n){const e=n.length;if(Jt&&E in t){const o=e>1?n.flat():n[0],s=n.map(i=>new Proxy({get(u){return i.includes(u)?t[u]:void 0},has(u){return i.includes(u)&&u in t},keys(){return i.filter(u=>u in t)}},$t));return s.push(new Proxy({get(i){return o.includes(i)?void 0:t[i]},has(i){return o.includes(i)?!1:i in t},keys(){return Object.keys(t).filter(i=>!o.includes(i))}},$t)),s}const r=[];for(let o=0;o<=e;o++)r[o]={};for(const o of Object.getOwnPropertyNames(t)){let s=e;for(let u=0;u<n.length;u++)if(n[u].includes(o)){s=u;break}const i=Object.getOwnPropertyDescriptor(t,o);!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable?r[s][o]=i.value:Object.defineProperty(r[s],o,i)}return r}let Zn=0;function te(){return p.context?p.getNextContextId():`cl-${Zn++}`}const cn=t=>`Stale read from <${t}>.`;function ne(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Un(()=>t.each,t.children,n||void 0))}function ee(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Wn(()=>t.each,t.children,n||void 0))}function re(t){const n=t.keyed,e=A(()=>t.when,void 0,void 0),r=n?e:A(e,void 0,{equals:(o,s)=>!o==!s});return A(()=>{const o=r();if(o){const s=t.children;return typeof s=="function"&&s.length>0?m(()=>s(n?o:()=>{if(!m(r))throw cn("Show");return e()})):s}return t.fallback},void 0,void 0)}function oe(t){const n=Vt(()=>t.children),e=A(()=>{const r=n(),o=Array.isArray(r)?r:[r];let s=()=>{};for(let i=0;i<o.length;i++){const u=i,l=o[i],d=s,h=A(()=>d()?void 0:l.when,void 0,void 0),a=l.keyed?h:A(h,void 0,{equals:(w,S)=>!w==!S});s=()=>d()||(a()?[u,h,l]:void 0)}return s});return A(()=>{const r=e()();if(!r)return t.fallback;const[o,s,i]=r,u=i.children;return typeof u=="function"&&u.length>0?m(()=>u(i.keyed?s():()=>{var l;if(((l=m(e)())==null?void 0:l[0])!==o)throw cn("Match");return s()})):u},void 0,void 0)}function se(t){return t}let yt;function ie(t){let n;p.context&&p.load&&(n=p.load(p.getContextId()));const[e,r]=M(n,void 0);return yt||(yt=new Set),yt.add(r),tt(()=>yt.delete(r)),A(()=>{let o;if(o=e()){const s=t.fallback;return typeof s=="function"&&s.length?m(()=>s(o,()=>r())):s}return Hn(()=>t.children,r)},void 0,void 0)}const vt=Symbol("store-raw"),L=Symbol("store-node"),I=Symbol("store-has"),ln=Symbol("store-self");function an(t){let n=t[E];if(!n&&(Object.defineProperty(t,E,{value:n=new Proxy(t,le)}),!Array.isArray(t))){const e=Object.keys(t),r=Object.getOwnPropertyDescriptors(t),o=Object.getPrototypeOf(t),s=o!==null&&t!==null&&typeof t=="object"&&!Array.isArray(t)&&o!==Object.prototype;if(s){const i=Object.getOwnPropertyDescriptors(o);e.push(...Object.keys(i)),Object.assign(r,i)}for(let i=0,u=e.length;i<u;i++){const l=e[i];s&&l==="constructor"||r[l].get&&Object.defineProperty(t,l,{configurable:!0,enumerable:r[l].enumerable,get:r[l].get.bind(n)})}}return n}function B(t){let n;return t!=null&&typeof t=="object"&&(t[E]||!(n=Object.getPrototypeOf(t))||n===Object.prototype||Array.isArray(t))}function R(t,n=new Set){let e,r,o,s;if(e=t!=null&&t[vt])return e;if(!B(t)||n.has(t))return t;if(Array.isArray(t)){Object.isFrozen(t)?t=t.slice(0):n.add(t);for(let i=0,u=t.length;i<u;i++)o=t[i],(r=R(o,n))!==o&&(t[i]=r)}else{Object.isFrozen(t)?t=Object.assign({},t):n.add(t);const i=Object.keys(t),u=Object.getOwnPropertyDescriptors(t);for(let l=0,d=i.length;l<d;l++)s=i[l],!u[s].get&&(o=t[s],(r=R(o,n))!==o&&(t[s]=r))}return t}function bt(t,n){let e=t[n];return e||Object.defineProperty(t,n,{value:e=Object.create(null)}),e}function st(t,n,e){if(t[n])return t[n];const[r,o]=M(e,{equals:!1,internal:!0});return r.$=o,t[n]=r}function ue(t,n){const e=Reflect.getOwnPropertyDescriptor(t,n);return!e||e.get||!e.configurable||n===E||n===L||(delete e.value,delete e.writable,e.get=()=>t[E][n]),e}function fn(t){qt()&&st(bt(t,L),ln)()}function ce(t){return fn(t),Reflect.ownKeys(t)}const le={get(t,n,e){if(n===vt)return t;if(n===E)return e;if(n===X)return fn(t),e;const r=bt(t,L),o=r[n];let s=o?o():t[n];if(n===L||n===I||n==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(t,n);qt()&&(typeof s!="function"||t.hasOwnProperty(n))&&!(i&&i.get)&&(s=st(r,n,s)())}return B(s)?an(s):s},has(t,n){return n===vt||n===E||n===X||n===L||n===I||n==="__proto__"?!0:(qt()&&st(bt(t,I),n)(),n in t)},set(){return!0},deleteProperty(){return!0},ownKeys:ce,getOwnPropertyDescriptor:ue};function G(t,n,e,r=!1){if(n==="__proto__"||!r&&t[n]===e)return;const o=t[n],s=t.length;e===void 0?(delete t[n],t[I]&&t[I][n]&&o!==void 0&&t[I][n].$()):(t[n]=e,t[I]&&t[I][n]&&o===void 0&&t[I][n].$());let i=bt(t,L),u;if((u=st(i,n,o))&&u.$(()=>e),Array.isArray(t)&&t.length!==s){for(let l=t.length;l<s;l++)(u=i[l])&&u.$();(u=st(i,"length",s))&&u.$(t.length)}(u=i[ln])&&u.$()}function dn(t,n){const e=Object.keys(n);for(let r=0;r<e.length;r+=1){const o=e[r];hn(o)||G(t,o,n[o])}}function hn(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function ae(t,n){if(typeof n=="function"&&(n=n(t)),n=R(n),Array.isArray(n)){if(t===n)return;let e=0,r=n.length;for(;e<r;e++){const o=n[e];t[e]!==o&&G(t,e,o)}G(t,"length",r)}else dn(t,n)}function it(t,n,e=[]){let r,o=t;if(n.length>1){r=n.shift();const i=typeof r,u=Array.isArray(t);if(i==="string"&&(r==="__proto__"||n.length>1&&hn(r)))return;if(Array.isArray(r)){for(let l=0;l<r.length;l++)it(t,[r[l]].concat(n),e);return}else if(u&&i==="function"){for(let l=0;l<t.length;l++)r(t[l],l)&&it(t,[l].concat(n),e);return}else if(u&&i==="object"){const{from:l=0,to:d=t.length-1,by:h=1}=r;for(let a=l;a<=d;a+=h)it(t,[a].concat(n),e);return}else if(n.length>1){it(t[r],n,[r].concat(e));return}o=t[r],e=[r].concat(e)}let s=n[0];typeof s=="function"&&(s=s(o,e),s===o)||r===void 0&&s==null||(s=R(s),r===void 0||B(o)&&B(s)&&!Array.isArray(s)?dn(o,s):G(t,r,s))}function gn(...[t,n]){const e=R(t||{}),r=Array.isArray(e),o=an(e);function s(...i){Dn(()=>{r&&i.length===1?ae(e,i[0]):it(e,i)})}return[o,s]}const ke=Symbol("store-root"),wt=new WeakMap,pn={get(t,n){if(n===vt)return t;const e=t[n];if(n===E||n===X||n===L||n===I||n==="__proto__")return e;let r;return B(e)?wt.get(e)||(wt.set(e,r=new Proxy(e,pn)),r):e},set(t,n,e){return G(t,n,R(e)),!0},deleteProperty(t,n){return G(t,n,void 0,!0),!0}};function yn(t){return n=>{if(B(n)){let e;(e=wt.get(n))||wt.set(n,e=new Proxy(n,pn)),t(e)}return n}}let j={};function vn(t){j.stack&&t.setAttribute("stack",j.stack),j.position&&t.setAttribute("position",j.position),j.max!==void 0&&t.setAttribute("max",String(j.max)),j.appearance&&t.setAttribute("appearance",j.appearance),j.inverse!==void 0&&(j.inverse?t.setAttribute("inverse",""):t.removeAttribute("inverse"))}function fe(t){j={...j,...t},!(typeof document>"u")&&document.querySelectorAll("kai-toast-region").forEach(n=>vn(n))}const de=5e3,he=7e3,{toasts:It,setToasts:ut,mounted:je,setMounted:ge}=F(()=>{const[t,n]=gn([]),[e,r]=M(!1);return{toasts:t,setToasts:n,mounted:e,setMounted:r}});let bn=0;function pe(){return bn+=1,`toast-${bn}`}function ye(t){const n=t.duration??de;return n===0?0:t.action?Math.max(n,he):n}const wn=new Map;function ve(t=null){if(typeof document>"u")return;const n=wn.get(t);if(n&&n.isConnected)return n;const e=document.createElement("kai-toast-region");return document.body.appendChild(e),e.toasts=It,t&&(e.target=t),vn(e),wn.set(t,e),ge(!0),e}function be(t){const n=It.findIndex(e=>e.id===t.id);n>=0?ut(n,t):ut(yn(e=>{e.push(t)}))}function mn(t){ut(n=>n.filter(e=>e.id!==t))}function we(t){return{id:t,dismiss:()=>mn(t),update:n=>{const e=It.findIndex(r=>r.id===t);e>=0&&ut(e,r=>({...r,...n}))}}}function ct(t,n,e){ve(n?.target??null);const r=n?.id??pe(),o={id:r,message:t,variant:n?.variant??e,appearance:n?.appearance??j.appearance??"pill",inverse:n?.inverse??j.inverse??!1,description:n?.description,action:n?.action,duration:n?.duration,dismissible:n?.dismissible,target:n?.target};return be(o),we(r)}const me=Object.assign((t,n)=>ct(t,n,"neutral"),{success:(t,n)=>ct(t,n,"success"),warning:(t,n)=>ct(t,n,"warning"),error:(t,n)=>ct(t,n,"error"),info:(t,n)=>ct(t,n,"info"),dismiss:mn,clear:()=>ut([])}),Se=typeof window<"u"&&typeof customElements<"u"?import("./register-impl-C96AnOJn.js").then(t=>t.r):Promise.resolve();export{ye as A,ie as E,ne as F,ee as I,se as M,re as S,F as a,Gt as b,A as c,Cn as classifyTool,_n as configureCodeHighlighting,fe as configureToasts,Qt as d,Bn as e,Se as elementsReady,M as f,Nn as g,Yn as h,Fn as i,qn as isCodeHighlightingEnabled,Gn as j,Ct as k,te as l,Xn as m,Tn as n,tt as o,In as p,$n as q,Xt as r,p as s,Pn as t,me as toast,m as u,oe as v,gn as w,yn as x,R as y,Vt as z};
|
|
1
|
+
const Sn={bash:()=>import("./bash-InADTalH.js"),javascript:()=>import("./javascript-C25yR2R2.js"),typescript:()=>import("./typescript-RycA9KXf.js"),tsx:()=>import("./tsx-B8rCNbgL.js"),html:()=>import("./html-CPZ3oZQ7.js"),css:()=>import("./css-M7EaDHN_.js"),json:()=>import("./json-DxJze_jm.js"),vue:()=>import("./vue-BmIZj4XD.js"),svelte:()=>import("./svelte--5p79yCD.js")},On={"github-dark-dimmed":()=>import("./github-dark-dimmed-DUshB20C.js"),"github-light":()=>import("./github-light-JYsPkUQd.js")},xn={js:"javascript",ts:"typescript",jsx:"tsx",sh:"bash",shell:"bash"},Nt="github-dark-dimmed";let Ot=!0,xt={...Sn},At={...On},kt={...xn},jt=null;const zt=new Set,Ft=new Set;function An(){return jt||(jt=(async()=>{const[{createHighlighterCore:t},{createJavaScriptRegexEngine:n}]=await Promise.all([import("./core-C8fzo39E.js"),import("./engine-javascript-C1x7zo1_.js")]);return t({themes:[],langs:[],engine:n()})})()),jt}function Lt(t){return kt[t]??t}async function kn(t,n){const e=Lt(n);if(zt.has(e))return!0;const r=xt[e];return r?(await t.loadLanguage(r()),zt.add(e),!0):!1}async function Rt(t,n){if(Ft.has(n))return!0;const e=At[n];return e?(await t.loadTheme(e()),Ft.add(n),!0):!1}function jn(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function lt(t){return`<pre><code>${jn(t)}</code></pre>`}async function Pn(t,n,e){if(!Ot||!t)return lt(t);try{const r=await An();if(!await kn(r,n))return lt(t);const o=await Rt(r,e)?e:await Rt(r,Nt)?Nt:null;return o?r.codeToHtml(t,{lang:Lt(n),theme:o}):lt(t)}catch{return lt(t)}}function _n(t){t.enabled!==void 0&&(Ot=t.enabled),t.languages&&(xt={...xt,...t.languages}),t.themes&&(At={...At,...t.themes}),t.aliases&&(kt={...kt,...t.aliases})}function qn(){return Ot}function Cn(t){const n=t.toLowerCase();return n?n.includes("bash")||n.includes("command")||n.includes("shell")||n.includes("terminal")||n.includes("exec")?"command":n.includes("edit")||n.includes("write")||n.includes("patch")||n.includes("replace")||n.includes("delete")?"file-change":n.includes("search")||n.includes("grep")||n.includes("glob")||n.includes("find")?"search":n.includes("fetch")||n.includes("http")||n.includes("browse")||n.includes("crawl")?"fetch":n.includes("mcp")?"mcp":n.includes("image")||n.includes("screenshot")||n.includes("vision")?"image":"generic":"generic"}const p={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Kt(this.context.count)},getNextContextId(){return Kt(this.context.count++)}};function Kt(t){const n=String(t),e=n.length-1;return p.context.id+(e?String.fromCharCode(96+e):"")+n}function Pt(t){p.context=t}function Vn(){return{...p.context,id:p.getNextContextId(),count:0}}const Oe=!1,En=(t,n)=>t===n,E=Symbol("solid-proxy"),Jt=typeof Proxy=="function",X=Symbol("solid-track"),xe=Symbol("solid-dev-component"),at={equals:En};let Y=null,Ut=en;const P=1,Z=2,Wt={owned:null,cleanups:null,context:null,owner:null},_t={};var f=null;let c=null,J=null,U=null,g=null,b=null,O=null,ft=0;function F(t,n){const e=g,r=f,o=t.length===0,s=n===void 0?r:n,i=o?Wt:{owned:null,cleanups:null,context:s?s.context:null,owner:s},u=o?t:()=>t(()=>m(()=>z(i)));f=i,g=null;try{return k(u,!0)}finally{g=e,f=r}}function M(t,n){n=n?Object.assign({},at,n):at;const e={value:t,observers:null,observerSlots:null,comparator:n.equals||void 0},r=o=>(typeof o=="function"&&(c&&c.running&&c.sources.has(e)?o=o(e.tValue):o=o(e.value)),tn(e,o));return[Zt.bind(e),r]}function Bt(t,n,e){const r=et(t,n,!0,P);J&&c&&c.running?b.push(r):W(r)}function Gt(t,n,e){const r=et(t,n,!1,P);J&&c&&c.running?b.push(r):W(r)}function Qt(t,n,e){Ut=Kn;const r=et(t,n,!1,P),o=nt&&Ct(nt);o&&(r.suspense=o),(!e||!e.render)&&(r.user=!0),O?O.push(r):W(r)}function A(t,n,e){e=e?Object.assign({},at,e):at;const r=et(t,n,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=e.equals||void 0,J&&c&&c.running?(r.tState=P,b.push(r)):W(r),Zt.bind(r)}function Mn(t){return t&&typeof t=="object"&&"then"in t}function $n(t,n,e){let r,o,s;typeof n=="function"?(r=t,o=n,s=e||{}):(r=!0,o=t,s=n||{});let i=null,u=_t,l=null,d=!1,h=!1,a="initialValue"in s,w=typeof r=="function"&&A(r);const S=new Set,[_,D]=(s.storage||M)(s.initialValue),[N,K]=M(void 0),[q,C]=M(void 0,{equals:!1}),[V,T]=M(a?"ready":"unresolved");p.context&&(l=p.getNextContextId(),s.ssrLoadFrom==="initial"?u=s.initialValue:p.load&&p.has(l)&&(u=p.load(l)));function H(y,v,$,x){return i===y&&(i=null,x!==void 0&&(a=!0),(y===u||v===u)&&s.onHydrated&&queueMicrotask(()=>s.onHydrated(x,{value:v})),u=_t,c&&y&&d?(c.promises.delete(y),d=!1,k(()=>{c.running=!0,Tt(v,$)},!1)):Tt(v,$)),v}function Tt(y,v){k(()=>{v===void 0&&D(()=>y),T(v!==void 0?"errored":a?"ready":"unresolved"),K(v);for(const $ of S.keys())$.decrement();S.clear()},!1)}function mt(){const y=nt&&Ct(nt),v=_(),$=N();if($!==void 0&&!i)throw $;return g&&!g.user&&y&&Bt(()=>{q(),i&&(y.resolved&&c&&d?c.promises.add(i):S.has(y)||(y.increment(),S.add(y)))}),v}function St(y=!0){if(y!==!1&&h)return;h=!1;const v=w?w():r;if(d=c&&c.running,v==null||v===!1){H(i,m(_));return}c&&i&&c.promises.delete(i);let $;const x=u!==_t?u:m(()=>{try{return o(v,{value:_(),refetching:y})}catch(Q){$=Q}});if($!==void 0){H(i,void 0,ht($),v);return}else if(!Mn(x))return H(i,x,void 0,v),x;return i=x,"v"in x?(x.s===1?H(i,x.v,void 0,v):H(i,void 0,ht(x.v),v),x):(h=!0,queueMicrotask(()=>h=!1),k(()=>{T(a?"refreshing":"pending"),C()},!1),x.then(Q=>H(x,Q,void 0,v),Q=>H(x,void 0,ht(Q),v)))}Object.defineProperties(mt,{state:{get:()=>V()},error:{get:()=>N()},loading:{get(){const y=V();return y==="pending"||y==="refreshing"}},latest:{get(){if(!a)return mt();const y=N();if(y&&!i)throw y;return _()}}});let Ht=f;return w?Bt(()=>(Ht=f,St(!1))):St(!1),[mt,{refetch:y=>Xt(Ht,()=>St(y)),mutate:D}]}function Dn(t){return k(t,!1)}function m(t){if(!U&&g===null)return t();const n=g;g=null;try{return U?U.untrack(t):t()}finally{g=n}}function In(t,n,e){const r=Array.isArray(t);let o,s=e&&e.defer;return i=>{let u;if(r){u=Array(t.length);for(let d=0;d<t.length;d++)u[d]=t[d]()}else u=t();if(s)return s=!1,i;const l=m(()=>n(u,o,i));return o=u,l}}function Tn(t){Qt(()=>m(t))}function tt(t){return f===null||(f.cleanups===null?f.cleanups=[t]:f.cleanups.push(t)),t}function Hn(t,n){Y||(Y=Symbol("error")),f=et(void 0,void 0,!0),f.context={...f.context,[Y]:[n]},c&&c.running&&c.sources.add(f);try{return t()}catch(e){ot(e)}finally{f=f.owner}}function qt(){return g}function Nn(){return f}function Xt(t,n){const e=f,r=g;f=t,g=null;try{return k(n,!0)}catch(o){ot(o)}finally{f=e,g=r}}function zn(t){if(c&&c.running)return t(),c.done;const n=g,e=f;return Promise.resolve().then(()=>{g=n,f=e;let r;return(J||nt)&&(r=c||(c={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(o=>r.resolve=o)),r.running=!0),k(t,!1),g=f=null,r?r.done:void 0})}const[Ae,Yt]=M(!1);function Fn(t,n){const e=Symbol("context");return{id:e,Provider:Jn(e),defaultValue:t}}function Ct(t){let n;return f&&f.context&&(n=f.context[t.id])!==void 0?n:t.defaultValue}function Vt(t){const n=A(t),e=A(()=>Et(n()));return e.toArray=()=>{const r=e();return Array.isArray(r)?r:r!=null?[r]:[]},e}let nt;function Zt(){const t=c&&c.running;if(this.sources&&(t?this.tState:this.state))if((t?this.tState:this.state)===P)W(this);else{const n=b;b=null,k(()=>dt(this),!1),b=n}if(g){const n=this.observers;if(!n||n[n.length-1]!==g){const e=n?n.length:0;g.sources?(g.sources.push(this),g.sourceSlots.push(e)):(g.sources=[this],g.sourceSlots=[e]),n?(n.push(g),this.observerSlots.push(g.sources.length-1)):(this.observers=[g],this.observerSlots=[g.sources.length-1])}}return t&&c.sources.has(this)?this.tValue:this.value}function tn(t,n,e){let r=c&&c.running&&c.sources.has(t)?t.tValue:t.value;if(!t.comparator||!t.comparator(r,n)){if(c){const o=c.running;(o||!e&&c.sources.has(t))&&(c.sources.add(t),t.tValue=n),o||(t.value=n)}else t.value=n;t.observers&&t.observers.length&&k(()=>{for(let o=0;o<t.observers.length;o+=1){const s=t.observers[o],i=c&&c.running;i&&c.disposed.has(s)||((i?!s.tState:!s.state)&&(s.pure?b.push(s):O.push(s),s.observers&&rn(s)),i?s.tState=P:s.state=P)}if(b.length>1e6)throw b=[],new Error},!1)}return n}function W(t){if(!t.fn)return;z(t);const n=ft;nn(t,c&&c.running&&c.sources.has(t)?t.tValue:t.value,n),c&&!c.running&&c.sources.has(t)&&queueMicrotask(()=>{k(()=>{c&&(c.running=!0),g=f=t,nn(t,t.tValue,n),g=f=null},!1)})}function nn(t,n,e){let r;const o=f,s=g;g=f=t;try{r=t.fn(n)}catch(i){return t.pure&&(c&&c.running?(t.tState=P,t.tOwned&&t.tOwned.forEach(z),t.tOwned=void 0):(t.state=P,t.owned&&t.owned.forEach(z),t.owned=null)),t.updatedAt=e+1,ot(i)}finally{g=s,f=o}(!t.updatedAt||t.updatedAt<=e)&&(t.updatedAt!=null&&"observers"in t?tn(t,r,!0):c&&c.running&&t.pure?(c.sources.has(t)||(t.value=r),c.sources.add(t),t.tValue=r):t.value=r,t.updatedAt=e)}function et(t,n,e,r=P,o){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:n,owner:f,context:f?f.context:null,pure:e};if(c&&c.running&&(s.state=0,s.tState=r),f===null||f!==Wt&&(c&&c.running&&f.pure?f.tOwned?f.tOwned.push(s):f.tOwned=[s]:f.owned?f.owned.push(s):f.owned=[s]),U&&s.fn){const i=s.fn,[u,l]=M(void 0,{equals:!1}),d=U.factory(i,l);tt(()=>d.dispose());let h;const a=()=>zn(l).then(()=>{h&&(h.dispose(),h=void 0)});s.fn=w=>(u(),c&&c.running?(h||(h=U.factory(i,a)),h.track(w)):d.track(w))}return s}function rt(t){const n=c&&c.running;if((n?t.tState:t.state)===0)return;if((n?t.tState:t.state)===Z)return dt(t);if(t.suspense&&m(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<ft);){if(n&&c.disposed.has(t))return;(n?t.tState:t.state)&&e.push(t)}for(let r=e.length-1;r>=0;r--){if(t=e[r],n){let o=t,s=e[r+1];for(;(o=o.owner)&&o!==s;)if(c.disposed.has(o))return}if((n?t.tState:t.state)===P)W(t);else if((n?t.tState:t.state)===Z){const o=b;b=null,k(()=>dt(t,e[0]),!1),b=o}}}function k(t,n){if(b)return t();let e=!1;n||(b=[]),O?e=!0:O=[],ft++;try{const r=t();return Ln(e),r}catch(r){e||(O=null),b=null,ot(r)}}function Ln(t){if(b&&(J&&c&&c.running?Rn(b):en(b),b=null),t)return;let n;if(c){if(!c.promises.size&&!c.queue.size){const r=c.sources,o=c.disposed;O.push.apply(O,c.effects),n=c.resolve;for(const s of O)"tState"in s&&(s.state=s.tState),delete s.tState;c=null,k(()=>{for(const s of o)z(s);for(const s of r){if(s.value=s.tValue,s.owned)for(let i=0,u=s.owned.length;i<u;i++)z(s.owned[i]);s.tOwned&&(s.owned=s.tOwned),delete s.tValue,delete s.tOwned,s.tState=0}Yt(!1)},!1)}else if(c.running){c.running=!1,c.effects.push.apply(c.effects,O),O=null,Yt(!0);return}}const e=O;O=null,e.length&&k(()=>Ut(e),!1),n&&n()}function en(t){for(let n=0;n<t.length;n++)rt(t[n])}function Rn(t){for(let n=0;n<t.length;n++){const e=t[n],r=c.queue;r.has(e)||(r.add(e),J(()=>{r.delete(e),k(()=>{c.running=!0,rt(e)},!1),c&&(c.running=!1)}))}}function Kn(t){let n,e=0;for(n=0;n<t.length;n++){const r=t[n];r.user?t[e++]=r:rt(r)}if(p.context){if(p.count){p.effects||(p.effects=[]),p.effects.push(...t.slice(0,e));return}Pt()}for(p.effects&&(p.done||!p.count)&&(t=[...p.effects,...t],e+=p.effects.length,delete p.effects),n=0;n<e;n++)rt(t[n])}function dt(t,n){const e=c&&c.running;e?t.tState=0:t.state=0;for(let r=0;r<t.sources.length;r+=1){const o=t.sources[r];if(o.sources){const s=e?o.tState:o.state;s===P?o!==n&&(!o.updatedAt||o.updatedAt<ft)&&rt(o):s===Z&&dt(o,n)}}}function rn(t){const n=c&&c.running;for(let e=0;e<t.observers.length;e+=1){const r=t.observers[e];(n?!r.tState:!r.state)&&(n?r.tState=Z:r.state=Z,r.pure?b.push(r):O.push(r),r.observers&&rn(r))}}function z(t){let n;if(t.sources)for(;t.sources.length;){const e=t.sources.pop(),r=t.sourceSlots.pop(),o=e.observers;if(o&&o.length){const s=o.pop(),i=e.observerSlots.pop();r<o.length&&(s.sourceSlots[i]=r,o[r]=s,e.observerSlots[r]=i)}}if(t.tOwned){for(n=t.tOwned.length-1;n>=0;n--)z(t.tOwned[n]);delete t.tOwned}if(c&&c.running&&t.pure)on(t,!0);else if(t.owned){for(n=t.owned.length-1;n>=0;n--)z(t.owned[n]);t.owned=null}if(t.cleanups){for(n=t.cleanups.length-1;n>=0;n--)t.cleanups[n]();t.cleanups=null}c&&c.running?t.tState=0:t.state=0}function on(t,n){if(n||(t.tState=0,c.disposed.add(t)),t.owned)for(let e=0;e<t.owned.length;e++)on(t.owned[e])}function ht(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function sn(t,n,e){try{for(const r of n)r(t)}catch(r){ot(r,e&&e.owner||null)}}function ot(t,n=f){const e=Y&&n&&n.context&&n.context[Y],r=ht(t);if(!e)throw r;O?O.push({fn(){sn(r,e,n)},state:P}):sn(r,e,n)}function Et(t){if(typeof t=="function"&&!t.length)return Et(t());if(Array.isArray(t)){const n=[];for(let e=0;e<t.length;e++){const r=Et(t[e]);if(Array.isArray(r))if(r.length<32768)n.push.apply(n,r);else for(let o=0;o<r.length;o++)n.push(r[o]);else n.push(r)}return n}return t}function Jn(t,n){return function(e){let r;return Gt(()=>r=m(()=>(f.context={...f.context,[t]:e.value},Vt(()=>e.children))),void 0),r}}const Mt=Symbol("fallback");function gt(t){for(let n=0;n<t.length;n++)t[n]()}function Un(t,n,e={}){let r=[],o=[],s=[],i=0,u=n.length>1?[]:null;return tt(()=>gt(s)),()=>{let l=t()||[],d=l.length,h,a;return l[X],m(()=>{let S,_,D,N,K,q,C,V,T;if(d===0)i!==0&&(gt(s),s=[],r=[],o=[],i=0,u&&(u=[])),e.fallback&&(r=[Mt],o[0]=F(H=>(s[0]=H,e.fallback())),i=1);else if(i===0){for(o=new Array(d),a=0;a<d;a++)r[a]=l[a],o[a]=F(w);i=d}else{for(D=new Array(d),N=new Array(d),u&&(K=new Array(d)),q=0,C=Math.min(i,d);q<C&&r[q]===l[q];q++);for(C=i-1,V=d-1;C>=q&&V>=q&&r[C]===l[V];C--,V--)D[V]=o[C],N[V]=s[C],u&&(K[V]=u[C]);for(S=new Map,_=new Array(V+1),a=V;a>=q;a--)T=l[a],h=S.get(T),_[a]=h===void 0?-1:h,S.set(T,a);for(h=q;h<=C;h++)T=r[h],a=S.get(T),a!==void 0&&a!==-1?(D[a]=o[h],N[a]=s[h],u&&(K[a]=u[h]),a=_[a],S.set(T,a)):s[h]();for(a=q;a<d;a++)a in D?(o[a]=D[a],s[a]=N[a],u&&(u[a]=K[a],u[a](a))):o[a]=F(w);o=o.slice(0,i=d),r=l.slice(0)}return o});function w(S){if(s[a]=S,u){const[_,D]=M(a);return u[a]=D,n(l[a],_)}return n(l[a])}}}function Wn(t,n,e={}){let r=[],o=[],s=[],i=[],u=0,l;return tt(()=>gt(s)),()=>{const d=t()||[],h=d.length;return d[X],m(()=>{if(h===0)return u!==0&&(gt(s),s=[],r=[],o=[],u=0,i=[]),e.fallback&&(r=[Mt],o[0]=F(w=>(s[0]=w,e.fallback())),u=1),o;for(r[0]===Mt&&(s[0](),s=[],r=[],o=[],u=0),l=0;l<h;l++)l<r.length&&r[l]!==d[l]?i[l](()=>d[l]):l>=r.length&&(o[l]=F(a));for(;l<r.length;l++)s[l]();return u=i.length=s.length=h,r=d.slice(0),o=o.slice(0,u)});function a(w){s[l]=w;const[S,_]=M(d[l]);return i[l]=_,n(S,l)}}}let un=!1;function Bn(){un=!0}function Gn(t,n){if(un&&p.context){const e=p.context;Pt(Vn());const r=m(()=>t(n||{}));return Pt(e),r}return m(()=>t(n||{}))}function pt(){return!0}const $t={get(t,n,e){return n===E?e:t.get(n)},has(t,n){return n===E?!0:t.has(n)},set:pt,deleteProperty:pt,getOwnPropertyDescriptor(t,n){return{configurable:!0,enumerable:!0,get(){return t.get(n)},set:pt,deleteProperty:pt}},ownKeys(t){return t.keys()}};function Dt(t){return(t=typeof t=="function"?t():t)?t:{}}function Qn(){for(let t=0,n=this.length;t<n;++t){const e=this[t]();if(e!==void 0)return e}}function Xn(...t){let n=!1;for(let i=0;i<t.length;i++){const u=t[i];n=n||!!u&&E in u,t[i]=typeof u=="function"?(n=!0,A(u)):u}if(Jt&&n)return new Proxy({get(i){for(let u=t.length-1;u>=0;u--){const l=Dt(t[u])[i];if(l!==void 0)return l}},has(i){for(let u=t.length-1;u>=0;u--)if(i in Dt(t[u]))return!0;return!1},keys(){const i=[];for(let u=0;u<t.length;u++)i.push(...Object.keys(Dt(t[u])));return[...new Set(i)]}},$t);const e={},r=Object.create(null);for(let i=t.length-1;i>=0;i--){const u=t[i];if(!u)continue;const l=Object.getOwnPropertyNames(u);for(let d=l.length-1;d>=0;d--){const h=l[d];if(h==="__proto__"||h==="constructor")continue;const a=Object.getOwnPropertyDescriptor(u,h);if(!r[h])r[h]=a.get?{enumerable:!0,configurable:!0,get:Qn.bind(e[h]=[a.get.bind(u)])}:a.value!==void 0?a:void 0;else{const w=e[h];w&&(a.get?w.push(a.get.bind(u)):a.value!==void 0&&w.push(()=>a.value))}}}const o={},s=Object.keys(r);for(let i=s.length-1;i>=0;i--){const u=s[i],l=r[u];l&&l.get?Object.defineProperty(o,u,l):o[u]=l?l.value:void 0}return o}function Yn(t,...n){const e=n.length;if(Jt&&E in t){const o=e>1?n.flat():n[0],s=n.map(i=>new Proxy({get(u){return i.includes(u)?t[u]:void 0},has(u){return i.includes(u)&&u in t},keys(){return i.filter(u=>u in t)}},$t));return s.push(new Proxy({get(i){return o.includes(i)?void 0:t[i]},has(i){return o.includes(i)?!1:i in t},keys(){return Object.keys(t).filter(i=>!o.includes(i))}},$t)),s}const r=[];for(let o=0;o<=e;o++)r[o]={};for(const o of Object.getOwnPropertyNames(t)){let s=e;for(let u=0;u<n.length;u++)if(n[u].includes(o)){s=u;break}const i=Object.getOwnPropertyDescriptor(t,o);!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable?r[s][o]=i.value:Object.defineProperty(r[s],o,i)}return r}let Zn=0;function te(){return p.context?p.getNextContextId():`cl-${Zn++}`}const cn=t=>`Stale read from <${t}>.`;function ne(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Un(()=>t.each,t.children,n||void 0))}function ee(t){const n="fallback"in t&&{fallback:()=>t.fallback};return A(Wn(()=>t.each,t.children,n||void 0))}function re(t){const n=t.keyed,e=A(()=>t.when,void 0,void 0),r=n?e:A(e,void 0,{equals:(o,s)=>!o==!s});return A(()=>{const o=r();if(o){const s=t.children;return typeof s=="function"&&s.length>0?m(()=>s(n?o:()=>{if(!m(r))throw cn("Show");return e()})):s}return t.fallback},void 0,void 0)}function oe(t){const n=Vt(()=>t.children),e=A(()=>{const r=n(),o=Array.isArray(r)?r:[r];let s=()=>{};for(let i=0;i<o.length;i++){const u=i,l=o[i],d=s,h=A(()=>d()?void 0:l.when,void 0,void 0),a=l.keyed?h:A(h,void 0,{equals:(w,S)=>!w==!S});s=()=>d()||(a()?[u,h,l]:void 0)}return s});return A(()=>{const r=e()();if(!r)return t.fallback;const[o,s,i]=r,u=i.children;return typeof u=="function"&&u.length>0?m(()=>u(i.keyed?s():()=>{var l;if(((l=m(e)())==null?void 0:l[0])!==o)throw cn("Match");return s()})):u},void 0,void 0)}function se(t){return t}let yt;function ie(t){let n;p.context&&p.load&&(n=p.load(p.getContextId()));const[e,r]=M(n,void 0);return yt||(yt=new Set),yt.add(r),tt(()=>yt.delete(r)),A(()=>{let o;if(o=e()){const s=t.fallback;return typeof s=="function"&&s.length?m(()=>s(o,()=>r())):s}return Hn(()=>t.children,r)},void 0,void 0)}const vt=Symbol("store-raw"),L=Symbol("store-node"),I=Symbol("store-has"),ln=Symbol("store-self");function an(t){let n=t[E];if(!n&&(Object.defineProperty(t,E,{value:n=new Proxy(t,le)}),!Array.isArray(t))){const e=Object.keys(t),r=Object.getOwnPropertyDescriptors(t),o=Object.getPrototypeOf(t),s=o!==null&&t!==null&&typeof t=="object"&&!Array.isArray(t)&&o!==Object.prototype;if(s){const i=Object.getOwnPropertyDescriptors(o);e.push(...Object.keys(i)),Object.assign(r,i)}for(let i=0,u=e.length;i<u;i++){const l=e[i];s&&l==="constructor"||r[l].get&&Object.defineProperty(t,l,{configurable:!0,enumerable:r[l].enumerable,get:r[l].get.bind(n)})}}return n}function B(t){let n;return t!=null&&typeof t=="object"&&(t[E]||!(n=Object.getPrototypeOf(t))||n===Object.prototype||Array.isArray(t))}function R(t,n=new Set){let e,r,o,s;if(e=t!=null&&t[vt])return e;if(!B(t)||n.has(t))return t;if(Array.isArray(t)){Object.isFrozen(t)?t=t.slice(0):n.add(t);for(let i=0,u=t.length;i<u;i++)o=t[i],(r=R(o,n))!==o&&(t[i]=r)}else{Object.isFrozen(t)?t=Object.assign({},t):n.add(t);const i=Object.keys(t),u=Object.getOwnPropertyDescriptors(t);for(let l=0,d=i.length;l<d;l++)s=i[l],!u[s].get&&(o=t[s],(r=R(o,n))!==o&&(t[s]=r))}return t}function bt(t,n){let e=t[n];return e||Object.defineProperty(t,n,{value:e=Object.create(null)}),e}function st(t,n,e){if(t[n])return t[n];const[r,o]=M(e,{equals:!1,internal:!0});return r.$=o,t[n]=r}function ue(t,n){const e=Reflect.getOwnPropertyDescriptor(t,n);return!e||e.get||!e.configurable||n===E||n===L||(delete e.value,delete e.writable,e.get=()=>t[E][n]),e}function fn(t){qt()&&st(bt(t,L),ln)()}function ce(t){return fn(t),Reflect.ownKeys(t)}const le={get(t,n,e){if(n===vt)return t;if(n===E)return e;if(n===X)return fn(t),e;const r=bt(t,L),o=r[n];let s=o?o():t[n];if(n===L||n===I||n==="__proto__")return s;if(!o){const i=Object.getOwnPropertyDescriptor(t,n);qt()&&(typeof s!="function"||t.hasOwnProperty(n))&&!(i&&i.get)&&(s=st(r,n,s)())}return B(s)?an(s):s},has(t,n){return n===vt||n===E||n===X||n===L||n===I||n==="__proto__"?!0:(qt()&&st(bt(t,I),n)(),n in t)},set(){return!0},deleteProperty(){return!0},ownKeys:ce,getOwnPropertyDescriptor:ue};function G(t,n,e,r=!1){if(n==="__proto__"||!r&&t[n]===e)return;const o=t[n],s=t.length;e===void 0?(delete t[n],t[I]&&t[I][n]&&o!==void 0&&t[I][n].$()):(t[n]=e,t[I]&&t[I][n]&&o===void 0&&t[I][n].$());let i=bt(t,L),u;if((u=st(i,n,o))&&u.$(()=>e),Array.isArray(t)&&t.length!==s){for(let l=t.length;l<s;l++)(u=i[l])&&u.$();(u=st(i,"length",s))&&u.$(t.length)}(u=i[ln])&&u.$()}function dn(t,n){const e=Object.keys(n);for(let r=0;r<e.length;r+=1){const o=e[r];hn(o)||G(t,o,n[o])}}function hn(t){return t==="__proto__"||t==="constructor"||t==="prototype"}function ae(t,n){if(typeof n=="function"&&(n=n(t)),n=R(n),Array.isArray(n)){if(t===n)return;let e=0,r=n.length;for(;e<r;e++){const o=n[e];t[e]!==o&&G(t,e,o)}G(t,"length",r)}else dn(t,n)}function it(t,n,e=[]){let r,o=t;if(n.length>1){r=n.shift();const i=typeof r,u=Array.isArray(t);if(i==="string"&&(r==="__proto__"||n.length>1&&hn(r)))return;if(Array.isArray(r)){for(let l=0;l<r.length;l++)it(t,[r[l]].concat(n),e);return}else if(u&&i==="function"){for(let l=0;l<t.length;l++)r(t[l],l)&&it(t,[l].concat(n),e);return}else if(u&&i==="object"){const{from:l=0,to:d=t.length-1,by:h=1}=r;for(let a=l;a<=d;a+=h)it(t,[a].concat(n),e);return}else if(n.length>1){it(t[r],n,[r].concat(e));return}o=t[r],e=[r].concat(e)}let s=n[0];typeof s=="function"&&(s=s(o,e),s===o)||r===void 0&&s==null||(s=R(s),r===void 0||B(o)&&B(s)&&!Array.isArray(s)?dn(o,s):G(t,r,s))}function gn(...[t,n]){const e=R(t||{}),r=Array.isArray(e),o=an(e);function s(...i){Dn(()=>{r&&i.length===1?ae(e,i[0]):it(e,i)})}return[o,s]}const ke=Symbol("store-root"),wt=new WeakMap,pn={get(t,n){if(n===vt)return t;const e=t[n];if(n===E||n===X||n===L||n===I||n==="__proto__")return e;let r;return B(e)?wt.get(e)||(wt.set(e,r=new Proxy(e,pn)),r):e},set(t,n,e){return G(t,n,R(e)),!0},deleteProperty(t,n){return G(t,n,void 0,!0),!0}};function yn(t){return n=>{if(B(n)){let e;(e=wt.get(n))||wt.set(n,e=new Proxy(n,pn)),t(e)}return n}}let j={};function vn(t){j.stack&&t.setAttribute("stack",j.stack),j.position&&t.setAttribute("position",j.position),j.max!==void 0&&t.setAttribute("max",String(j.max)),j.appearance&&t.setAttribute("appearance",j.appearance),j.inverse!==void 0&&(j.inverse?t.setAttribute("inverse",""):t.removeAttribute("inverse"))}function fe(t){j={...j,...t},!(typeof document>"u")&&document.querySelectorAll("kai-toast-region").forEach(n=>vn(n))}const de=5e3,he=7e3,{toasts:It,setToasts:ut,mounted:je,setMounted:ge}=F(()=>{const[t,n]=gn([]),[e,r]=M(!1);return{toasts:t,setToasts:n,mounted:e,setMounted:r}});let bn=0;function pe(){return bn+=1,`toast-${bn}`}function ye(t){const n=t.duration??de;return n===0?0:t.action?Math.max(n,he):n}const wn=new Map;function ve(t=null){if(typeof document>"u")return;const n=wn.get(t);if(n&&n.isConnected)return n;const e=document.createElement("kai-toast-region");return document.body.appendChild(e),e.toasts=It,t&&(e.target=t),vn(e),wn.set(t,e),ge(!0),e}function be(t){const n=It.findIndex(e=>e.id===t.id);n>=0?ut(n,t):ut(yn(e=>{e.push(t)}))}function mn(t){ut(n=>n.filter(e=>e.id!==t))}function we(t){return{id:t,dismiss:()=>mn(t),update:n=>{const e=It.findIndex(r=>r.id===t);e>=0&&ut(e,r=>({...r,...n}))}}}function ct(t,n,e){ve(n?.target??null);const r=n?.id??pe(),o={id:r,message:t,variant:n?.variant??e,appearance:n?.appearance??j.appearance??"pill",inverse:n?.inverse??j.inverse??!1,description:n?.description,action:n?.action,duration:n?.duration,dismissible:n?.dismissible,target:n?.target};return be(o),we(r)}const me=Object.assign((t,n)=>ct(t,n,"neutral"),{success:(t,n)=>ct(t,n,"success"),warning:(t,n)=>ct(t,n,"warning"),error:(t,n)=>ct(t,n,"error"),info:(t,n)=>ct(t,n,"info"),dismiss:mn,clear:()=>ut([])}),Se=typeof window<"u"&&typeof customElements<"u"?import("./register-impl-DGmGzrEM.js").then(t=>t.r):Promise.resolve();export{ye as A,ie as E,ne as F,ee as I,se as M,re as S,F as a,Gt as b,A as c,Cn as classifyTool,_n as configureCodeHighlighting,fe as configureToasts,Qt as d,Bn as e,Se as elementsReady,M as f,Nn as g,Yn as h,Fn as i,qn as isCodeHighlightingEnabled,Gn as j,Ct as k,te as l,Xn as m,Tn as n,tt as o,In as p,$n as q,Xt as r,p as s,Pn as t,me as toast,m as u,oe as v,gn as w,yn as x,R as y,Vt as z};
|
|
@@ -5,6 +5,39 @@ export declare const CARD_EVENT_NAME = "kai-card";
|
|
|
5
5
|
* routes. NB: this is deliberately different from defineWebComponent's built-in
|
|
6
6
|
* non-bubbling dispatch. */
|
|
7
7
|
export declare function emitCardEvent(element: HTMLElement, event: CardEvent): void;
|
|
8
|
+
/** True when `url` is safe to put in an href / hand to `window.open`.
|
|
9
|
+
*
|
|
10
|
+
* Exported so the MARKDOWN renderer and the ARTIFACT viewer reuse this exact
|
|
11
|
+
* guard rather than growing a second scheme list that can drift from this one.
|
|
12
|
+
*
|
|
13
|
+
* Resolving against a base is deliberate and is what makes it correct for
|
|
14
|
+
* markdown: a relative or fragment link (`/docs`, `#section`, `./rel`) is
|
|
15
|
+
* ordinary markdown, and resolving it inherits the base's `http:` so it
|
|
16
|
+
* passes, while `javascript:`/`data:`/`vbscript:` keep their own protocol and
|
|
17
|
+
* fail. It is correct for the artifact viewer for the same reason: a file with
|
|
18
|
+
* no `src` to resolve against yields a bare relative path (`docs/report.pdf`),
|
|
19
|
+
* which is a legitimate artifact address. Contrast `isRenderableLink` in
|
|
20
|
+
* `primitives/link-preview.ts`, which takes NO base and so demands an absolute
|
|
21
|
+
* http(s) URL: that is the right guard for a model-supplied citation -- a
|
|
22
|
+
* reference to a page on the public web -- this one for markdown body links and
|
|
23
|
+
* artifact file addresses. */
|
|
24
|
+
export declare function isSafeUrl(url: string): boolean;
|
|
25
|
+
/** True when navigating to `url` would EXECUTE it as script in the initiating
|
|
26
|
+
* document's origin.
|
|
27
|
+
*
|
|
28
|
+
* Strictly narrower than `!isSafeUrl(url)`, and not a competing policy: it
|
|
29
|
+
* answers a different question, for the one sink where the allowlist is the
|
|
30
|
+
* wrong tool. An `<iframe src>` legitimately takes `data:` and `blob:` (a
|
|
31
|
+
* `data:` blob artifact is a documented `<kai-artifact>` use -- it is what
|
|
32
|
+
* `displayUrl` exists for) and both get an OPAQUE origin in every modern
|
|
33
|
+
* browser, so neither can reach the host page. `javascript:`/`vbscript:` are
|
|
34
|
+
* the schemes that run in the EMBEDDER's origin, and they are the whole risk:
|
|
35
|
+
* the default sandbox (no `allow-same-origin`) already makes the browser refuse
|
|
36
|
+
* them, but a consumer who sets `allow-same-origin` turns a model-supplied
|
|
37
|
+
* `src` into host-origin script execution. The artifact viewer used to suggest
|
|
38
|
+
* that setting for "an artifact you trust"; it no longer does, and this guard
|
|
39
|
+
* is what protects the consumers who took the old advice. */
|
|
40
|
+
export declare function isScriptUrl(url: string): boolean;
|
|
8
41
|
/** Apply the contract's policy to one event. The ONE place routing lives. */
|
|
9
42
|
export declare function routeCardEvent(policy: CardPolicy | undefined, event: CardEvent): void;
|
|
10
43
|
/** Attach a host-level `kai-card` listener that routes every bubbling card event
|