@ai-matrx/coding-sessions 0.1.105 → 0.1.106

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-matrx/coding-sessions
2
2
 
3
+ ## 0.1.106
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/coding-sessions/v0.1.105..npm/coding-sessions/v0.1.106 -- apps/shared/coding-sessions`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.1.105
4
10
  ### Run inputs use the agents package's default humanizer
5
11
 
@@ -9,7 +9,7 @@ Error generating stack: `+e.message+`
9
9
  `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||un(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&un(e,``+r);else return;break;case`className`:Jt(e,`class`,r);break;case`tabIndex`:Jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Jt(e,n,r);break;case`style`:pn(e,r,o);return;case`data`:if(t!==`object`){Jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=vn);return;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=_n(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),qt(e,`popover`,r);break;case`xlinkActuate`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:qt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=hn.get(n)||n,qt(e,n,r);else return}Gt=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:pn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)un(e,r);else if(typeof r==`number`||typeof r==`bigint`)un(e,``+r);else return;break;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=vn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Rt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[St]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Gt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):qt(e,n,r)}return}Gt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}an(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&sn(e,!!r,n,!0):sn(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}ln(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)$(Rf[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(mn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Gt=!0),o=m;break;case`name`:m!==f&&(Gt=!0),a=m;break;case`checked`:m!==f&&(Gt=!0),u=m;break;case`defaultChecked`:m!==f&&(Gt=!0),d=m;break;case`value`:m!==f&&(Gt=!0),s=m;break;case`defaultValue`:m!==f&&(Gt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}rn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Gt=!0),p=o;break;case`defaultValue`:o!==l&&(Gt=!0),c=o;break;case`multiple`:o!==l&&(Gt=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?sn(e,!!n,n?[]:``,!1):sn(e,!!n,t,!0)):sn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Gt=!0),p=a;break;case`defaultValue`:a!==o&&(Gt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}cn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Gt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(mn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[xt]=r,n[St]=t,np(n,e,t),Ft(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=jt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(h(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];h(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),Zp(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),At(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Ot])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===vn&&(e.onclick=null),At(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);At(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=fe.d;fe.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Ld();return e||t}function Cm(e){var t=Mt(e);t!==null&&t.tag===5&&t.type===`form`?ec(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=nn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Ft(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+nn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+nn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+nn(n.imageSizes)+`"]`)):i+=`[href="`+nn(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[kt]=!0,o.onload=o.onerror=function(){It(o)}),Ft(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+nn(r)+`"][href="`+nn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Ft(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Pt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Ft(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Pt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ft(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Pt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Ft(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=xe.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Pt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Pt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Pt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+nn(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[kt]){r.loading=1;return}}else t=e.createElement(`link`),t[kt]=!0,t.onload=t.onerror=It.bind(null,t),np(t,`link`,n),Ft(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+nn(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+nn(n.href)+`"]`);if(r)return t.instance=r,Ft(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ft(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Ft(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Ft(a),a):(r=n,(a=vm.get(o))&&(r=D({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ft(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Ot]||a[xt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ft(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:F,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ut(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ut(0),this.hiddenUpdates=ut(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ji(3,null,null,t),e.current=a,a.stateNode=e,t=ka(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},fo(a),e}function uh(e){return e?(e=Ai,e):Ai}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=mo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ho(e,r,t),n!==null&&(Md(n,e,t),go(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Di(e,67108864);t!==null&&Md(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=kd();t=gt(t);var n=Di(e,t);n!==null&&Md(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=z.T;z.T=null;var a=fe.p;try{fe.p=2,yh(e,t,n,r)}finally{fe.p=a,z.T=i}}function vh(e,t,n,r){var i=z.T;z.T=null;var a=fe.p;try{fe.p=8,yh(e,t,n,r)}finally{fe.p=a,z.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=Mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=it(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ze(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Yu&6)&&(md=ze()+500,Ef(0,!1))}}break;case 31:case 13:s=Di(a,2),s!==null&&Md(s,a,2),Ld(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=bn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=jt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Be()){case Ve:return 2;case He:return 8;case Ue:case We:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Mt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=jt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,yt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,yt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yn=r,n.target.dispatchEvent(r),yn=null}else return t=Mt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=Mt(n);a!==null&&(e.splice(t,3),t-=3,Qs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[St]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[St]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,kd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Ld(),t[Ct]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.0`)throw Error(i(527,Kh,`19.3.0`));fe.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:z,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Je=Jh.inject(qh),Ye=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=xc,s=Sc,c=Cc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[Ct]=t.current,Uf(e),new Wh(t)}})),g=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g();function y(e){let t=`${e.url??(typeof location<`u`?`ws://${location.host}/ws`:`ws://127.0.0.1:4789/ws`)}?token=${encodeURIComponent(e.token)}`,n=new Set,r=new Set,i=new Map,a=[],o=null,s={state:`connecting`},c=1,l=500,u=!1;function d(e){s=e;for(let t of r)t(e)}function f(){d({state:`connecting`});let r=new WebSocket(t);o=r,r.onopen=()=>{for(u=!0,l=500,d({state:`open`});a.length>0;)r.send(a.shift())},r.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}if(t.event){for(let e of n)e(t.event);return}if(typeof t.id==`number`){let e=i.get(t.id);if(!e)return;i.delete(t.id),t.ok?e.resolve(t.result):e.reject(Error(t.error??`The request failed.`))}},r.onclose=()=>{o=null;for(let[,e]of i)e.reject(Error(`Lost the connection to the coding sessions host.`));i.clear(),d({state:`closed`,reason:u?`Lost the connection to the coding sessions host. Reconnecting…`:`Can't reach the coding sessions host. It may have stopped, or this link's access token is out of date.`});let t=e.maxBackoffMs??8e3;setTimeout(f,l),l=Math.min(t,l*2)}}return f(),{call(e,...t){let n=c++,r=JSON.stringify({id:n,method:e,args:t}),s=new Promise((e,t)=>{i.set(n,{resolve:e,reject:t})});return o&&o.readyState===WebSocket.OPEN?o.send(r):a.push(r),s},subscribe(e){return n.add(e),()=>{n.delete(e)}},status(){return s},onStatus(e){return r.add(e),()=>{r.delete(e)}}}}var b=0;function x(e){let t=globalThis.crypto;return typeof t?.randomUUID==`function`?`${e}_${t.randomUUID()}`:(b+=1,`${e}_${Date.now().toString(36)}_${b.toString(36)}_${Math.random().toString(36).slice(2,10)}`)}function S(e){return{id:e.id??x(`msg`),role:e.role,parts:e.parts??[],status:e.status??`complete`,metadata:{requestId:e.metadata?.requestId??null,serverMessageId:e.metadata?.serverMessageId??null,modelRef:e.metadata?.modelRef??null,createdAt:e.metadata?.createdAt??new Date().toISOString(),raw:e.metadata?.raw??null}}}function C(e){let t=``;for(let n of e.parts)n.type===`text`&&(t+=n.text);return t}var w=Object.freeze({sendKey:`enter`,density:`comfortable`,showReasoningByDefault:!1,expandToolCardsByDefault:!1,autoScroll:!0,readAloudAutoPlay:!1,retainDrafts:!0,sendWhileBusy:!1,hideArchivedConversations:!0,messageActions:!0,attachmentMaxBytes:26214400,reasoningSentinel:`split`,routing:`any`});function T(e={}){return{...w,...E(e.organization),...E(e.surface),...E(e.user)}}function E(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function D(){return{notify(e){let t=e.remedy?`[ai-matrx/chat] ${e.message} — ${e.remedy}`:`[ai-matrx/chat] ${e.message}`;e.level===`error`?console.error(t):e.level===`warning`?console.warn(t):console.info(t)}}}function O(e=D()){let t=new Map,n=!1,r=()=>{n||(n=!0,e.notify({level:`warning`,message:`Chat preferences and drafts are being kept in memory only, so they will be lost when this page reloads.`,remedy:"Give the chat a `prefs` port backed by localStorage (or your own store) to keep drafts across reloads."}))};return{get:e=>t.get(e)??null,set:(e,n)=>{r(),t.set(e,n)},remove:e=>{t.delete(e)}}}function k(e=D()){let t=O(e),n=null;try{if(n=globalThis.localStorage??null,n){let e=`__ai_matrx_chat_probe__`;n.setItem(e,`1`),n.removeItem(e)}}catch{n=null}if(!n)return t;let r=n;return{get:e=>{try{let t=r.getItem(e);if(t!==null)return t}catch{}return t.get(e)},set:(e,n)=>{try{r.setItem(e,n)}catch{t.set(e,n)}},remove:e=>{try{r.removeItem(e)}catch{}t.remove(e)}}}var A=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),j=o(((e,t)=>{t.exports=A()}))(),M=(0,_.createContext)(null),N=(0,_.createContext)({});function P({conversationId:e,children:t}){return(0,j.jsx)(N.Provider,{value:{conversationId:e??null},children:t})}function F(){return(0,_.useContext)(N)}var I={};function L(){return(0,_.useContext)(M)??I}var ee=(0,_.createContext)(null);function te(){return(0,_.useContext)(ee)}function ne(){let e=te();if(!e)throw Error(`[content-ir-react] No ContentIrRenderProvider above this component. Mount one at the app root with your host adapter (kind definitions, component resolver, renderBlock, renderValue, reportError).`);return e}var re=`__ir`,ie=`__kind`,ae=2166136261,oe=16777619;function se(e,t){let n=e>>>0;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=n+((n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24))>>>0;return n>>>0}function ce(){let e=ae,t=oe,n=0;return{push(r){e=se(e,r),t=se(t,r),n+=r.length},current(){return`${n.toString(36)}-${e.toString(36)}${t.toString(36)}`}}}function le(e){let t=ce();return t.push(e),t.current()}function ue(e,t,n){return{v:1,engine:`fe-kind-parser`,fingerprint:le(JSON.stringify(e)),root:{role:`structured`,kind:t,kindState:`resolved`,discriminator:n?.discriminator??{format:`json`,key:`__kind`},path:[],status:`complete`,value:e,residue:null}}}var R=new Set([`ID`,`URL`,`PDF`,`HTML`,`JSON`,`API`,`AI`,`UI`,`CSV`,`SMS`,`SEO`,`LLM`,`MCP`,`UUID`,`ISO`].map(e=>e.toLowerCase()));function de(e){return e.replace(/([a-z\d])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).split(/[_\-.\s]+/).filter(e=>e.length>0).map(e=>R.has(e.toLowerCase())?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}var z=`directive_v`;`${z}`;var fe=[`reference`,`view`,`create`,`update`,`delete`,`action`,`validation`,`secret`],pe={reference:`pure`,view:`pure`,validation:`pure`,secret:`sensitive`,create:`side_effect`,update:`side_effect`,delete:`side_effect`,action:`side_effect`},me=new Set(fe.filter(e=>pe[e]===`side_effect`)),he=new Set([`reference`,`secret`]);function ge(e){return typeof e==`string`&&Object.prototype.hasOwnProperty.call(pe,e)}function _e(e){return typeof e==`string`&&e.startsWith(`directive_v`)}function ve(e){return/^[a-z][a-z0-9_]*$/.test(e)}function ye(e,t,n=1){if(!ge(e))throw Error(`unknown directive class ${JSON.stringify(e)}; the vocabulary is CLOSED: ${fe.join(`, `)}.`);if(typeof t!=`string`||!ve(t))throw Error(`invalid directive noun ${JSON.stringify(t)} for class ${JSON.stringify(e)}: a noun is lowercase [a-z0-9_], starts with a letter, and is non-empty.`);return`${z}${n}_${e}_${t}`}function be(e){if(!_e(e))return null;let t=e.slice(11),n=t.indexOf(`_`);if(n<=0)return null;let r=t.slice(0,n);if(!/^[0-9]+$/.test(r))return null;let i=t.slice(n+1),a=i.indexOf(`_`);if(a<=0)return null;let o=i.slice(0,a),s=i.slice(a+1);return!ge(o)||!ve(s)?null:{slug:e,version:Number.parseInt(r,10),directiveClass:o,noun:s,capability:pe[o],executes:xe(o),inContent:Se(o)}}function xe(e){return ge(e)&&me.has(e)}function Se(e){return ge(e)&&he.has(e)}function Ce(e){let t=e.trimStart().match(/^\{\s*"__kind"\s*:\s*"([^"]*)/);return!!t&&_e(t[1])}var we=`matrx_version`,Te={reference:`reference`,secret:`secret`,validation:`validation`},Ee=new Set([`output_directive`,`function`]),De=/^(create|update|delete):([a-z][a-z0-9_]*)$/,Oe=Symbol.for(`ai-matrx.content-ir.legacy-shell-uses`),ke=globalThis[Oe]??={count:0};function Ae(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=e;if(!(we in t))return!1;let n=t.kind;return typeof n==`string`&&(n in Te||Ee.has(n))}function je(e,t){let n,r;if(Ee.has(e)){let e=De.exec(t);e?(n=e[1],r=e[2]):(n=`action`,r=t)}else{let i=Te[e];if(!i)return null;n=i,r=t}try{return ye(n,r)}catch{return null}}function Me(e){let t=e.kind,n=e.type;if(typeof t!=`string`||typeof n!=`string`)return null;let r=je(t,n);if(r===null)return null;let i=e.items;return ke.count+=1,{[ie]:r,items:Array.isArray(i)?[...i]:[]}}var Ne=class extends Error{constructor(e){super(e),this.name=`DirectiveDecodeError`}};function Pe(e){return typeof e!=`object`||!e||Array.isArray(e)?null:e}function Fe(e){let t=Pe(e);if(t===null)return null;let n=!1;if(Ae(t)){let e=Me(t);if(e===null)throw new Ne(`a retired 4-key shell with kind=${JSON.stringify(t.kind)} type=${JSON.stringify(t.type)} does not map onto the Kind Directives grammar. Emit the current shell: {"${ie}": "directive_v1_<class>_<noun>", "items": [...]}.`);t=e,n=!0}let r=t[ie];if(!_e(r))return null;let i=be(r);if(i===null)throw new Ne(`malformed directive slug ${JSON.stringify(r)} — it claims the reserved "directive_v" namespace but does not parse as directive_v<version>_<class>_<noun>.`);let a=t.items,o=Array.isArray(a)?a.filter(e=>Pe(e)!==null):[];return{parsed:i,slug:i.slug,directiveClass:i.directiveClass,noun:i.noun,items:o,shell:{[ie]:i.slug,items:o},legacyShell:n}}function Ie(e,t){try{return Fe(e)}catch(e){return t?.(e instanceof Error?e.message:`directive decode failed`),null}}function Le(e,t){if(typeof e!=`string`)return Ie(e,t);let n;try{n=JSON.parse(e)}catch{return null}return Ie(n,t)}function Re(e){return de(e)||e}var ze={reference:`Reference`,view:`View`,create:`Create`,update:`Update`,delete:`Delete`,action:`Run`,validation:`Validate`,secret:`Secret`};function Be(e,t){let n=t?.(e)?.label;return n&&n.length>0?n:Re(e)}function Ve(e,t){return t?.(e)?.family??``}function He(e,t){return t?.(e)?.titleColumn??null}function Ue(e,t,n){let r=Be(t,n),i=ze[e];return{noun:r,family:Ve(t,n),action:i,title:`${i} ${r}`}}var We=[`name`,`title`,`label`,`heading`,`slug`,`key`,`question`,`summary`],Ge=new Set([`__kind`,...We,`id`,`description`,`about`,`notes`,`content`,`text`,`body`,`organization_id`,`user_id`,`created_by`,`resource_type`]);function Ke(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return null}function qe(e,t,n,r){return((t?Ke(e,[t]):null)??Ke(e,We))||(r>1?`Item ${n+1} of ${r}`:`Item`)}function Je(e){return Ke(e,[`description`,`about`,`summary`,`doc`])}var Ye=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Xe={variable_definitions:`variables`,context_policies:`context`,custom_tools:`custom tools`};function Ze(e){return Xe[e]??e.replace(/_/g,` `)}function Qe(e,t=4){let n=[];for(let[r,i]of Object.entries(e)){if(n.length>=t)break;if(!Ge.has(r)){if(Array.isArray(i)){if(i.length===0)continue;n.push({key:r,label:Ze(r),value:String(i.length)});continue}if(typeof i==`string`){let e=i.trim();if(!e||e.length>40||Ye.test(e))continue;n.push({key:r,label:Ze(r),value:e});continue}(typeof i==`number`||typeof i==`boolean`)&&n.push({key:r,label:Ze(r),value:String(i)})}}return n}function $e(e,t){let n=e[ie],r=typeof n==`string`&&n?n:t;return r?{[ie]:r,...e}:null}var et=new Set([`markdown`,`md`,`mdx`]);function tt(e){return!!e&&et.has(e.toLowerCase())}function nt(e){return e!==void 0&&e!==``&&`
10
10
  \r\f\v`.includes(e)}function rt(e){let t=0,n=e.length;for(;t<n&&nt(e[t]);)t++;for(;n>t&&nt(e[n-1]);)n--;return t===0&&n===e.length?e:e.slice(t,n)}function it(e){return e!==void 0&&e!==``&&`
11
11
  \v\f\r \xA0            \u2028\u2029   `.includes(e)}function at(e){let t=0,n=e.length;for(;t<n&&it(e[t]);)t++;for(;n>t&&it(e[n-1]);)n--;let r=0;for(;t+r<n&&e[t+r]==="`";)r++;if(r<3||e.slice(t+r,n).includes("`"))return null;let i=t+r;for(;i<n&&it(e[i]);)i++;let a=i;for(;a<n&&!it(e[a]);)a++;return{ticks:r,lang:e.slice(i,a)}}function ot(e,t,n,r){let i=0;for(;i<e.length&&e[i]==="`";)i++;if(i<3)return`content`;let a=rt(e.slice(i));return a===``?i<t?`content`:n&&r>0?`close-nested`:`close-outer`:n&&i>=t&&!a.includes("`")?`open-nested`:`content`}function st(e){let t=e.trimStart();if(t.startsWith("```")){let e=at(t);return e?{char:"`",ticks:e.ticks,lang:e.lang}:null}if(e.length-t.length<=3&&t.startsWith(`~~~`)){let e=/^(~{3,})(.*)$/.exec(t);return e?{char:`~`,ticks:e[1].length,lang:e[2].trim().split(/\s/)[0]??``}:null}return null}function ct(e){return st(e)!==null}var lt=class{opener;state={inString:!1,escaped:!1};depth=0;sawNested=!1;isJson;nesting;tildeCloser;constructor(e,t={}){this.opener=e,this.isJson=e.char==="`"&&e.lang===`json`,this.nesting=e.char==="`"&&(t.nesting??tt(e.lang)),this.tildeCloser=e.char===`~`?RegExp(`^ {0,3}~{${e.ticks},}[ \\t]*$`):null}get nestedDepth(){return this.depth}feed(e){if(this.tildeCloser)return this.tildeCloser.test(e);let t=rt(e),n=e.indexOf("```");if(n===-1)return this.isJson&&(this.state=ft(e,0,e.length,this.state)),!1;if(this.isJson){let t=ft(e,0,n,this.state);if(t.inString)return this.state=ft(e,n,e.length,t),!1}if(t.startsWith("```")){let e=ot(t,this.opener.ticks,this.nesting,this.depth);if(e===`close-outer`)return!0;e===`open-nested`&&(this.depth++,this.sawNested=!0),e===`close-nested`&&this.depth--}else{let t=pt(e,n),r=rt(e.slice(n+t));if(t>=this.opener.ticks&&r===``&&this.depth===0)return!0}return this.isJson&&(this.state=ft(e,0,e.length,this.state)),!1}};function ut(e,t,n){let r=dt(e,t,new lt(n));if(r.closed||!r.reader.sawNested||r.reader.nestedDepth<=0)return{line:r.line,closed:r.closed};if(e.streaming)return{line:r.line,closed:!1};let i=dt(e,t,new lt(n,{nesting:!1}));return{line:i.line,closed:i.closed}}function dt(e,t,n){for(let r=t+1;r<e.count;r++){if(e.openTail?.(r))continue;let t=e.line(r);if(t===null)return{line:r-1,closed:!1,reader:n};if(n.feed(t))return{line:r,closed:!0,reader:n}}return{line:e.count-1,closed:!1,reader:n}}function ft(e,t,n,r){let{inString:i,escaped:a}=r;for(let r=t;r<n;r++){let t=e[r];if(a){a=!1;continue}if(t===`\\`&&i){a=!0;continue}t===`"`&&(i=!i)}return{inString:i,escaped:a}}function pt(e,t){let n=0;for(;t+n<e.length&&e[t+n]==="`";)n++;return n}function mt(e){let t=0,n=0;for(;;){let r=/^ {0,3}> ?/.exec(e.slice(n));if(!r)return{depth:t,offset:n};t++,n+=r[0].length}}function ht(e,t){let n=0;for(let r=0;r<t;r++){let t=/^ {0,3}> ?/.exec(e.slice(n));if(!t)return null;n+=t[0].length}return e.slice(n)}var gt=/^( *)([-*+]|\d{1,9}[.)])( +|\t|$)/;function _t(e){let t=0;for(;t<e.length&&e[t]===` `;)t++;return t}function vt(e){let t=[],n=[];for(let r=0;;){let i=e.indexOf(`
12
- `,r),a=i===-1?e.length:i;if(t.push(r),n.push(a>r&&e.charCodeAt(a-1)===13?a-1:a),i===-1)break;r=i+1}let r=t.length,i=r=>e.slice(t[r],n[r]),a={ranges:[],fences:[],paragraphs:[],endsInFence:!1,pendingPara:-1},o={count:r,line:i},s=0;for(let c=0;c<r;c++){let l=st(i(c));if(!l||l.char!=="`")continue;yt(e,t,n,i,s,c,a);let u=ut(o,c,l);a.ranges.push({start:t[c],end:n[u.line],kind:`fence`}),a.fences.push([c,u.line,u.closed]),a.pendingPara=-1,!u.closed&&u.line===r-1&&(a.endsInFence=!0),c=u.line,s=c+1}return yt(e,t,n,i,s,r,a),a}function yt(e,t,n,r,i,a,o){let s=-1,c=0,l=[],u=e=>{s!==-1&&o.paragraphs.push([s,e]),s=-1};for(let e=i;e<a;e++){let i=r(e),{depth:d,offset:f}=mt(i);d!==c&&(c=d,l=[]);let p=i.slice(f);if(p.trim()===``){u(t[e]),(e!==t.length-1||i!==``)&&(o.pendingPara=-1);continue}let m=_t(p);for(;l.length&&m<l[l.length-1];)l.pop();let h=gt.exec(p),g=l.length?l[l.length-1]:0;if(h){let e=h[3].length;g=h[1].length+h[2].length+(e>=1&&e<=4?e:1),l.push(g),p=p.slice(Math.min(g,p.length))}else p=p.slice(Math.min(m,g));let _=st(p);if(!_){s===-1&&(s=t[e]),o.pendingPara===-1&&(o.pendingPara=t[e]);continue}u(t[e]),o.pendingPara=-1;let v=g,y=ut({count:a,line:e=>{let t=ht(r(e),d);if(t===null)return null;if(_.char===`~`&&v>0){let e=_t(t);return t.trim()!==``&&e<v?null:t.slice(Math.min(e,v))}return t}},e,_);o.ranges.push({start:t[e],end:n[y.line],kind:`fence`}),o.fences.push([e,y.line,y.closed]),!y.closed&&y.line===t.length-1&&(o.endsInFence=!0),e=y.line}u(a<t.length?t[a]:e.length)}var bt=class{all=[];byLength=new Map;indexOf=new Map;constructor(e,t,n){for(let r=t;r<n;){if(e.charCodeAt(r)!==96){r++;continue}let t=1;for(;r+t<n&&e.charCodeAt(r+t)===96;)t++;this.indexOf.set(r,this.all.length),this.all.push([r,t]);let i=this.byLength.get(t);i?i.push(r):this.byLength.set(t,[r]),r+=t}}next(e,t){let n=this.byLength.get(e);if(!n)return-1;let r=0,i=n.length;for(;r<i;){let e=r+i>>>1;n[e]<t?r=e+1:i=e}return n[r]??-1}index(e){return this.indexOf.get(e)??-1}};function xt(e,t,n,r){let i=null;for(let a=t;a<n;){let o=e.charCodeAt(a);if(o===92){a+=2;continue}if(o!==96){a++;continue}let s=pt(e,a),c=Math.min(s,n-a);i??=new bt(e,t,n);let l=i.next(c,a+c);if(l===-1){a+=c;continue}r.push({start:a,end:l+c,kind:`span`}),a=l+c}}function St(e){let t=vt(e),n=[...t.ranges];for(let[r,i]of t.paragraphs)xt(e,r,i,n);return n.sort((e,t)=>e.start-t.start)}function Ct(e){let t=[],n=0;for(let r=0;r<e.length;r+=1){let i=e[r];if(i===`\\`){r+=1;continue}i===`|`&&(t.push(e.slice(n,r)),n=r+1)}return t.push(e.slice(n)),t}function wt(e){let t=Ct(e).map(e=>e.trim());return t.length>1&&t[0]===``&&t.shift(),(t.length>1&&t[t.length-1]===``||t.length===1&&t[0]===``&&!e.includes(`|`))&&t.pop(),t}function Tt(e){return e.replace(/\\\|/g,`|`)}var Et=/^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)|(?:-\s*){3,}$|(?:\*\s*){3,}$|(?:_\s*){3,}$|\[\^[^\]\s]+\]:)/,Dt=e=>Et.test(e)||ct(e)||Ft(e),Ot=/^<(?:script|pre|style|textarea)(?:[\s>]|$)/i,kt=/^(?:<!--|<\?|<![A-Za-z]|<!\[CDATA\[)/,At=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,jt=RegExp(`^</?(?:${At})(?:[\\s>]|/>|$)`,`i`),Mt=RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:\\s*=\\s*(?:[^\\s"'=<>\`]+|'[^']*'|"[^"]*"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*>)\\s*$`),Nt=RegExp(`^</?(?:address|article|aside|base|basefont|body|center|dialog|dir|fieldset|footer|form|frame|frameset|head|header|html|iframe|legend|link|main|menu|menuitem|nav|noframes|optgroup|option|param|search|title|track)(?:[\\s>]|/>|$)`,`i`);function Pt(e){return Nt.test(e)}[...At.replace(`h[1-6]`,`h1|h2|h3|h4|h5|h6`).split(`|`)];function Ft(e){return e.startsWith(`<`)?Ot.test(e)||kt.test(e)||jt.test(e)||Mt.test(e):!1}function It(e){let t=0;for(let n of e)if(n===` `)t+=1;else if(n===` `)t+=4-t%4;else break;return t}var Lt=/^([ \t]*)([-+*]|\d{1,9}[.)])([ \t]+|$)/;function Rt(e){let t=It(e[1]??``)+(e[2]??``).length,n=e[3]?It(` `.repeat(t)+e[3])-t:1;return t+(n>=1&&n<=4?n:1)}function zt(e,t){return Bt(e,t,!1)}function Bt(e,t,n){let r=n?Lt.exec(e[t]??``):null;if(r)return Rt(r);let i=It(e[t]??``);if(i===0)return 0;for(let n=t-1;n>=0;--n){let t=e[n]??``;if(!t.trim())continue;let r=It(t),a=Lt.exec(t);if(a&&r<i){let e=Rt(a);if(e<=i)return e;continue}if(r===0)return 0}return 0}var Vt=/^:?-+:?$/;function Ht(e){let t=e.trim();if(!t.includes(`|`))return!1;let n=wt(t);return n.length>0&&n.every(e=>Vt.test(e))}function Ut(e){let t=e.trim();return t.startsWith(`|`)&&t.includes(`|`,1)}function Wt(e){return e===void 0||!Ht(e)?!1:!Et.test(e.trim())}function Gt(e,t){let n=e.trim();return!n||Ut(n)||!n.startsWith(`|`)&&Dt(n)||!Wt(t)?!1:wt(n).length===wt(t.trim()).length}function Kt(e,t=0){let n=e.trim();return!n||It(e)-t>=4?!1:n.startsWith(`|`)||!Dt(n)}function qt(e,t){let n=e[t]??``;return!Ut(n)&&!Gt(n,e[t+1])?!1:!$t(e,t)&&!Qt(e,t)}var Jt=/^ {0,3}>/,Yt=/^(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,Xt=e=>/^#{1,6}(?:\s|$)/.test(e)||Yt.test(e)||ct(e)||Ft(e);function Zt(e){if(Ot.test(e))return/<\/(?:script|pre|style|textarea)>/i;if(e.startsWith(`<!--`))return/-->/;if(e.startsWith(`<?`))return/\?>/;if(e.startsWith(`<![CDATA[`))return/\]\]>/;if(/^<![A-Za-z]/.test(e))return/>/;if(jt.test(e)||Mt.test(e))return null}function Qt(e,t){let n=t;for(;n>0&&(e[n-1]??``).trim();)--n;let r,i=!1;for(let a=n;a<t;a+=1){let t=e[a]??``;if(r!==void 0){r&&r.test(t)&&(r=void 0);continue}let n=t.trim(),o=It(t)<4?Zt(n):void 0,s=o===null&&!jt.test(n);if(o===void 0||i&&s){i=!0;continue}i=!1,!Pt(n)&&(r=o&&o.test(n.slice(2))?void 0:o)}return r!==void 0}function $t(e,t){let n=e[t]??``,r=-1;for(let n=t-1;n>=0;--n){let t=e[n]??``,i=t.trim();if(!i||Xt(i))break;let a=Lt.exec(t);if(a){let e=t.slice(a[0].length).trim();if(!e||Xt(e))break;r=n;break}if(r=n,Jt.test(t))break}if(r<0)return!1;let i=e[r]??``;return Jt.test(i)?!Jt.test(n):It(n)<Bt(e,r,!0)}function en(e,t){let n=e[t]??``,r=e[t+1];return!qt(e,t)||!Wt(r)||wt(n).length!==wt(r).length?!1:It(n)-zt(e,t)<4}function tn(e,t){let n=zt(e,t),r=Math.min(e.length,t+2);for(;r<e.length&&Kt(e[r]??``,n);)r+=1;return r}var nn=`generic_structured`,rn=Symbol.for(`ai-matrx.content-ir-react.sourceless-db-row-reports`);globalThis[rn]??=new Set;var an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function on(e){return typeof e==`string`&&an.test(e)}var sn=new Set([`update`,`delete`]),cn=new Set([`__kind`,`id`]);function ln(e){let t=e.id;return typeof t==`string`&&t.trim()?t.trim():typeof t==`number`?String(t):null}function un(e){return de(e)||e}function dn(e,t){return t&&e===t?`Title`:un(e)}var fn=`None`;function pn(e,t){return`${e} ${on(t)?t.slice(0,8):t.length>12?`${t.slice(0,12)}…`:t}`}var mn={value:fn,full:fn,clears:!0};function hn(e,t){if(e==null)return mn;if(typeof e==`string`){let n=e.trim();if(!n)return mn;let r=t?.(n)??null;if(r)return{value:r,full:r,clears:!1};let i=n.replace(/\s+/g,` `);return{value:i.length>280?`${i.slice(0,279)}…`:i,full:n,clears:!1}}if(typeof e==`number`||typeof e==`boolean`)return{value:String(e),full:String(e),clears:!1};if(Array.isArray(e)){let t=e.length;return{value:t===0?fn:`${t} ${t===1?`entry`:`entries`}`,full:gn(e),clears:t===0}}let n=Object.keys(e).length;return{value:n===0?fn:`${n} ${n===1?`field`:`fields`}`,full:gn(e),clears:n===0}}function gn(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function _n(e,t){return e===t?!0:e==null||t==null?(e==null||e===``)&&(t==null||t===``):typeof e==`object`||typeof t==`object`?gn(e)===gn(t):!1}function vn(e,t,n={}){let r=[],i=n.titleColumn??null;for(let[a,o]of Object.entries(e)){if(cn.has(a))continue;let e=dn(a,i),s=n.valueWord,c=a===i||!s?void 0:e=>s(a,e),l={key:a,label:e,...hn(o,c)};t&&Object.prototype.hasOwnProperty.call(t,a)&&(l.before=hn(t[a],c),l.same=_n(t[a],o)),r.push(l)}return r}var yn=Symbol.for(`@ai-matrx/content-ir-react/record-revisions`);function bn(){let e=globalThis,t=e[yn];return t||(t={revisions:new Map,listeners:new Set},e[yn]=t),t}var{revisions:xn,listeners:Sn}=bn();function Cn(e){return xn.get(e)??0}function wn(e){if(e){xn.set(e,Cn(e)+1);for(let e of Sn)e()}}function Tn(e){return Sn.add(e),()=>{Sn.delete(e)}}function En(e){return(0,_.useSyncExternalStore)(Tn,()=>Cn(e),()=>0)}function Dn(e,t){let n=En(t?.id??``),r=t&&e?`${t.noun}:${t.id}#${n}`:``,[i,a]=(0,_.useState)({key:``,values:null,status:`idle`});return(0,_.useEffect)(()=>{if(!r||!e)return;let t=r.indexOf(`:`),n={noun:r.slice(0,t),id:r.slice(t+1,r.lastIndexOf(`#`))},i=!0;return a({key:r,values:null,status:`loading`}),e(n).then(e=>{i&&a({key:r,values:e,status:e?`ready`:`unavailable`})}).catch(()=>{i&&a({key:r,values:null,status:`unavailable`})}),()=>{i=!1}},[r,e]),r?i.key===r?{values:i.values,status:i.status}:{values:null,status:`loading`}:{values:null,status:`idle`}}var On={create:`created`,update:`updated`,delete:`deleted`};function kn(e){let t=On[e.directiveClass]??`applied`,n=e.nounLabel.trim().toLowerCase()||`item`;return e.failed&&e.total&&e.total>1?{what:`${e.failed} of ${e.total} weren't ${t}.`,next:`Retry to try those again.`}:{what:`The ${n} wasn't ${t}.`,next:`Try again in a moment.`}}function An(e,t){return t?.(e)??kn(e)}function jn({children:e,...t}){return(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t,children:e})}var Mn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`}),(0,j.jsx)(`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`}),(0,j.jsx)(`path`,{d:`M3 15h6`}),(0,j.jsx)(`path`,{d:`M6 12v6`})]}),Nn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M12 20h9`}),(0,j.jsx)(`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`})]}),Pn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M3 6h18`}),(0,j.jsx)(`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`}),(0,j.jsx)(`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`}),(0,j.jsx)(`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`}),(0,j.jsx)(`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`})]}),Fn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`polygon`,{points:`6 3 20 12 6 21 6 3`})}),In=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`}),(0,j.jsx)(`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.01-.4-2.96A4 4 0 0 1 14 5.5c.63.42 1.13 1 1.44 1.66`}),(0,j.jsx)(`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`})]}),Ln=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`}),(0,j.jsx)(`path`,{d:`m7 16.5-4.74-2.85`}),(0,j.jsx)(`path`,{d:`m7 16.5 5-3`}),(0,j.jsx)(`path`,{d:`M7 16.5v5.17`}),(0,j.jsx)(`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`}),(0,j.jsx)(`path`,{d:`m17 16.5-5-3`}),(0,j.jsx)(`path`,{d:`m17 16.5 4.74-2.85`}),(0,j.jsx)(`path`,{d:`M17 16.5v5.17`}),(0,j.jsx)(`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`}),(0,j.jsx)(`path`,{d:`M12 8 7.26 5.15`}),(0,j.jsx)(`path`,{d:`m12 8 4.74-2.85`}),(0,j.jsx)(`path`,{d:`M12 13.5V8`})]}),Rn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),zn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`path`,{d:`m9 18 6-6-6-6`})}),Bn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`polyline`,{points:`15 3 21 3 21 9`}),(0,j.jsx)(`polyline`,{points:`9 21 3 21 3 15`}),(0,j.jsx)(`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`}),(0,j.jsx)(`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`})]}),Vn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),Hn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,j.jsx)(`path`,{d:`M3 3v5h5`})]}),Un=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,j.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),Wn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`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`}),(0,j.jsx)(`path`,{d:`M12 9v4`}),(0,j.jsx)(`path`,{d:`M12 17h.01`})]}),Gn=new Set([`create_agent`,`create_agent_definition`,`agent`]);function Kn(e,t){if(e===`action`&&Gn.has(t))return In;switch(e){case`create`:return Mn;case`update`:return Nn;case`delete`:return Pn;default:return Fn}}function qn(e,t){if(sn.has(e.directiveClass))for(let e of t){let t=ln(e);t&&wn(t)}}var Jn=new WeakMap,Yn={},Xn=new Set;function Zn(e){let t=Jn.get(e);return t||(t=new Map,Jn.set(e,t)),t}function Qn(e,t,n){Zn(e).set(t,n);for(let e of Xn)e()}function $n(e){return Xn.add(e),()=>{Xn.delete(e)}}function er(e,t){return(0,_.useSyncExternalStore)($n,()=>Jn.get(e)?.get(t)??null,()=>null)}var tr=2e3,nr=30;function rr(e,t){return!!e.applyState&&!!e.confirm&&t.parsed.executes&&t.items.length>0}function ir({directive:e,label:t=`Apply`,itemCount:n,onApplied:r,onPhase:i,nothingToChange:a=!1}){let o=L(),s=F().conversationId||void 0,c=e.items,l=rr(o,e),u=l?{status:`checking`}:{status:`idle`},[d,f]=(0,_.useState)(u),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(!1),v=(0,_.useRef)(null),y=JSON.stringify([e.slug,c,s??null]),[b,x]=(0,_.useState)(y);b!==y&&(x(y),f(u),g(!1),m(0));let S=er(o.confirm??Yn,y),C=d.status===`asking`||!S?d:S,w=(0,_.useRef)(y);(0,_.useEffect)(()=>{w.current=y},[y]);let T=Be(e.noun,o.nouns),E=l?JSON.stringify([e.slug,c,s??null]):``,D=o.applyState,O=o.reportError;(0,_.useEffect)(()=>{if(!E||!D)return;let[e,t,n]=JSON.parse(E),r={__kind:e,items:t};n&&(r.conversationId=n);let i=!0,a=0,o=null,s=()=>{D(r).then(e=>{i&&(e.state===`applied`?f(n=>n.status===`checking`||n.status===`finishing`?{status:`applied`,applied:t.length,failed:0,message:e.message?.trim()?e.message.trim():null,records:e.records??[],copies:Math.max(1,e.copies??1),before:e.before??null}:n):e.state===`in_flight`&&a<nr?(a+=1,f(e=>e.status===`checking`||e.status===`finishing`?{status:`finishing`}:e),o=setTimeout(s,tr)):f(e=>e.status===`checking`||e.status===`finishing`?{status:`idle`}:e))}).catch(t=>{if(!i)return;let n=t instanceof Error&&t.message?t.message:String(t);(O??console.error)(`[kind-directives] Could not read whether ${e} was already applied: ${n}`),f(e=>e.status===`checking`||e.status===`finishing`?{status:`idle`}:e)})};return s(),()=>{i=!1,o&&clearTimeout(o)}},[E,D,O]);let k=C.status===`applied`&&C.failed===0?C:null,A=k?k.before:null,M=C.status===`checking`||C.status===`finishing`?`pending`:k?`applied:${JSON.stringify(A)}`:`open`;(0,_.useEffect)(()=>{i&&i(M===`pending`?{phase:`pending`}:M===`open`?{phase:`open`}:{phase:`applied`,before:A})},[M,i,A]);let N=C.status===`applying`?C.startedAt:null;if((0,_.useEffect)(()=>{if(N===null)return;v.current=N;let e=setInterval(()=>m(Math.round((Date.now()-(v.current??0))/1e3)),1e3);return()=>clearInterval(e)},[N]),!e.parsed.executes)return null;let P=o.confirm;if(!P)return null;async function I(t=!1){if(!P)return;let n=C,i=y,a=()=>w.current===i,l=C.status===`applied`?C.copies:0;if(o.ask){t?g(!0):f({status:`asking`});let r=!1;try{r=await o.ask({directive:e,items:c,nounLabel:T,...t?{again:!0}:{}})}catch(e){if(!a())return;g(!1),f({status:`error`,message:e instanceof Error&&e.message?e.message:`We could not ask you to confirm this, so nothing was done.`});return}if(!a())return;if(g(!1),!r){f(t?n:{status:`idle`});return}}m(0),f(e=>e.status===`asking`?{status:`idle`}:e),Qn(P,i,{status:`applying`,startedAt:Date.now()});try{let o={__kind:e.slug,items:c};s&&(o.conversationId=s),t&&(o.force=!0);let u;try{u=await P(o)}finally{qn(e,c)}for(let e of u.records??[])wn(e.id);Qn(P,i,{status:`applied`,applied:u.applied,failed:u.failed,message:u.message?.trim()?u.message.trim():null,records:u.records??[],copies:t?Math.max(1,l)+1:Math.max(1,l),before:t&&n.status===`applied`&&n.before?n.before:u.before??null}),a()&&r?.()}catch(e){Qn(P,i,{status:`error`,message:e instanceof Error&&e.message?e.message:`That couldn't be applied just now. Please try again.`})}}if(C.status===`applied`){let t=C.failed>0,n=e.directiveClass===`delete`,r=T,i=o.renderRecord?C.records:[];return(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs ${t?`text-destructive`:`text-primary`}`,"data-apply-state":`applied`,children:[(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 items-start gap-1`,children:[t?(0,j.jsx)(Wn,{className:`mt-px h-3.5 w-3.5 shrink-0`}):(0,j.jsx)(Un,{className:`mt-px h-3.5 w-3.5 shrink-0`}),t?(0,j.jsx)(ar,{words:An({raw:C.message??`${C.failed} failed`,directiveClass:e.directiveClass,noun:e.noun,nounLabel:T,failed:C.failed,total:C.applied+C.failed},o.explainFailure),raw:C.message}):(0,j.jsx)(`span`,{className:`min-w-0`,children:C.message??`Applied ${C.applied}`})]}),C.copies>1?(0,j.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,"data-apply-copies":C.copies,title:i.length>0?e.directiveClass===`create`?`Links to the latest copy.`:`Links to the latest run.`:void 0,children:e.directiveClass===`create`?`${C.copies} copies`:`Ran ${C.copies} times`}):null,i.map(e=>(0,j.jsx)(`span`,{className:`inline-flex min-w-0 items-center`,children:o.renderRecord?.({...e,fallback:pn(r,e.id),context:`applied`,trashed:n})},`${e.noun}:${e.id}`)),(0,j.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>void I(!t),className:`inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50`,"data-apply-action":t?`retry`:`run-again`,children:[(0,j.jsx)(Hn,{className:`h-3 w-3`}),t?`Retry`:`Run again`]})]})}if(C.status===`checking`)return(0,j.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center text-muted-foreground`,role:`status`,"aria-label":`Checking whether this already ran`,"data-apply-state":`checking`,children:(0,j.jsx)(Vn,{className:`h-3.5 w-3.5 animate-spin`})});if(C.status===`finishing`)return(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,role:`status`,"data-apply-state":`finishing`,children:[(0,j.jsx)(Vn,{className:`h-3.5 w-3.5 animate-spin`}),`Finishing…`]});let ee=e.directiveClass===`delete`,te=a&&C.status===`idle`;return(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[te?(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-apply-nothing":``,children:`Nothing to change`}):null,(0,j.jsxs)(`button`,{type:`button`,onClick:()=>void I(),disabled:C.status===`applying`||C.status===`asking`||c.length===0,"data-apply-tone":te?`muted`:ee?`destructive`:`default`,title:te?`It sets no fields, so applying it changes nothing.`:void 0,className:`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium disabled:opacity-50 ${te?`border-border/60 bg-background text-muted-foreground hover:bg-accent`:ee?`border-destructive/50 bg-background text-destructive hover:bg-destructive/10`:`border-border bg-background hover:bg-accent`}`,children:[C.status===`applying`?(0,j.jsx)(Vn,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(Fn,{className:`h-3.5 w-3.5`}),C.status===`applying`?`Applying${n?` ${n} ${n===1?`item`:`items`}`:``}…${p?` ${p}s`:``}`:t]}),C.status===`error`?(0,j.jsxs)(`span`,{className:`inline-flex max-w-sm items-start gap-1 text-xs text-destructive`,"data-apply-state":`error`,children:[(0,j.jsx)(Wn,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(ar,{words:An({raw:C.message,directiveClass:e.directiveClass,noun:e.noun,nounLabel:T},o.explainFailure),raw:C.message})]}):null]})}function ar({words:e,raw:t}){let[n,r]=(0,_.useState)(!1),i=t?.trim()??``;return(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,"data-apply-failure":!0,children:[(0,j.jsxs)(`span`,{className:`min-w-0`,children:[e.what,` `,e.next,i?(0,j.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`ml-1 underline underline-offset-2 hover:no-underline`,"data-apply-failure-details-toggle":!0,children:n?`Hide details`:`Details`}):null]}),n&&i?(0,j.jsx)(`span`,{className:`block max-w-sm select-text break-words font-mono text-[11px] text-muted-foreground`,"data-apply-failure-details":!0,children:i}):null]})}function or({directive:e,reason:t}){let n=L(),r=e.items.length,i=Ue(e.directiveClass,e.noun,n.nouns);return(0,j.jsxs)(`div`,{className:`my-3 inline-flex flex-wrap items-center gap-2 rounded-md border border-border bg-muted px-2.5 py-1 text-sm`,children:[(0,j.jsx)(Ln,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-foreground`,children:i.title}),i.family?(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,i.family]}):null,(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,r,` `,r===1?`item`:`items`]}),t?(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,t]}):null,(0,j.jsx)(ir,{directive:e})]})}var sr=/^\{\s*"__kind"\s*:\s*"([^"]+)"/;function cr(e){return e.trimStart().match(sr)?.[1]??null}function lr({content:e,streaming:t,className:n}){let r=L(),i=cr(e),a=i?be(i):null,o=a?Ue(a.directiveClass,a.noun,r.nouns):null,s=a?Kn(a.directiveClass,a.noun):Ln,c=o?.title??`Structured action`;return(0,j.jsxs)(`div`,{className:`my-3 rounded-md border border-border bg-card px-2.5 py-1.5${n?` ${n}`:``}`,"data-directive":i??void 0,"data-directive-state":t?`streaming`:`incomplete`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,j.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:c}),o?.family?(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o.family}):null,t?(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,role:`status`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`,"aria-hidden":!0}),`Writing…`]}):(0,j.jsx)(`span`,{className:`text-xs text-destructive`,role:`status`,children:`Cut off before it finished — nothing can be applied.`})]}),t?null:(0,j.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-foreground`,children:`Show what arrived`}),(0,j.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded bg-muted px-2 py-1 text-[11px]`,children:e})]})]})}var ur=Symbol.for(`ai-matrx.content-ir-react.directive-renderers`),dr=globalThis[ur]??={bySlug:new Map,byClass:new Map};function fr(e){return dr.bySlug.get(e.slug)??dr.byClass.get(e.directiveClass)??null}function pr(e,t){let n=e.valueLabel;return n?(e,r)=>n({noun:t,field:e,value:r}):null}function mr(e,t){let{[t]:n,...r}=e;return r}var hr=3;function gr({directive:e,item:t,index:n,total:r,phase:i}){let a=L(),o=sn.has(e.directiveClass)?ln(t):null;if(o)return(0,j.jsx)(vr,{directive:e,item:t,recordId:o,index:n,phase:i});let s=He(e.noun,a.nouns),c=qe(t,s,n,r),l=Je(t),u=pr(a,e.noun),d=Qe(s?mr(t,s):t).map(e=>({...e,label:dn(e.key,s),value:u?.(e.key,e.value)??e.value})),f=a.itemKind?.(e.slug)??null,p=Ue(e.directiveClass,e.noun,a.nouns),m=a.openItem,h=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`min-w-0 shrink-0 truncate font-medium text-foreground`,children:c}),(0,j.jsx)(`span`,{className:`hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex`,children:d.map(e=>(0,j.jsxs)(`span`,{className:`truncate text-[11px] text-muted-foreground`,"data-item-fact":e.key,children:[e.label,` `,(0,j.jsx)(`span`,{className:`text-foreground/80`,children:e.value})]},e.key))}),l&&d.length===0?(0,j.jsx)(`span`,{className:`hidden truncate text-[11px] text-muted-foreground sm:inline`,children:l}):null,m?(0,j.jsx)(Bn,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`}):null]});return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs`,children:[m?(0,j.jsx)(`button`,{type:`button`,onClick:()=>m({item:$e(t,f)??t,itemKind:f,title:c,subtitle:`${p.title} · item ${n+1} of ${r}`,directive:e,index:n,total:r}),className:`flex min-w-0 flex-1 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-accent hover:text-accent-foreground`,title:`Open to read it`,children:h}):(0,j.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5`,children:h}),a.renderCopy?.({label:c,value:t,kind:f,size:`xs`})]})}function _r({changes:e,className:t}){return e.length===0?(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground${t?` ${t}`:``}`,children:`Sets no fields — nothing would change.`}):(0,j.jsx)(`ul`,{className:`@container space-y-1${t?` ${t}`:``}`,"data-directive-changes":``,children:e.map(e=>{let t=e.before&&!e.same?e.before:null;return(0,j.jsxs)(`li`,{className:`flex min-w-0 flex-col text-[11px] @xs:flex-row @xs:flex-wrap @xs:items-baseline @xs:gap-x-1.5`,title:t?`${e.label}: ${t.full} → ${e.full}`:`${e.label} → ${e.full}`,"data-change-key":e.key,children:[(0,j.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.label}),t?(0,j.jsx)(`span`,{className:`min-w-0 text-muted-foreground line-through [overflow-wrap:anywhere]`,"data-change-before":``,children:t.value}):null,(0,j.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-foreground`,children:`→`}),(0,j.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere] ${e.clears?`italic text-muted-foreground`:`text-foreground`}`,"data-change-after":``,children:e.value}),e.same?(0,j.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`(no change)`}):null]})]},e.key)})})}function vr({directive:e,item:t,recordId:n,index:r,phase:i}){let a=L(),o=pn(Be(e.noun,a.nouns),n),s=e.directiveClass===`update`,c=s&&i.phase===`open`,l=Dn(c?a.readRecord:void 0,c?{noun:e.noun,id:n}:null),u=i.phase===`applied`?i.before?.[r]??null:c?l.values:null,d=s?vn(t,u,{titleColumn:He(e.noun,a.nouns),valueWord:pr(a,e.noun)}):[],f=a.renderRecord?a.renderRecord({noun:e.noun,id:n,fallback:o,context:`row`}):(0,j.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:o});return(0,j.jsxs)(`div`,{className:`py-1 text-xs`,"data-directive-target":n,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1 px-1`,children:f}),a.renderCopy?.({label:o,value:t,size:`xs`})]}),s?(0,j.jsx)(_r,{changes:d,className:`mt-0.5 px-1`}):null]})}function yr({directive:e}){let t=L(),[n,r]=(0,_.useState)(!1),i=e.items,a=i.length,o=Ue(e.directiveClass,e.noun,t.nouns),s=Kn(e.directiveClass,e.noun),[c,l]=(0,_.useState)(()=>rr(t,e)?{phase:`pending`}:{phase:`open`}),u=e.directiveClass===`update`&&a>0&&i.every(e=>vn(e).length===0),d=n?i:i.slice(0,hr),f=a-d.length;return(0,j.jsxs)(`div`,{className:`my-3 rounded-md border border-border bg-card px-2.5 py-1.5`,"data-directive":e.slug,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,j.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:o.title}),o.family?(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o.family}):null,(0,j.jsxs)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:[a,` `,a===1?`item`:`items`]}),(0,j.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[t.renderCopy?.({label:o.title,value:e.shell,size:`icon`}),(0,j.jsx)(ir,{directive:e,itemCount:a,onPhase:l,nothingToChange:u})]})]}),a===0?(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`No items — nothing would be written.`}):(0,j.jsx)(`div`,{className:`mt-0.5 divide-y divide-border/60`,children:d.map((t,n)=>(0,j.jsx)(gr,{directive:e,item:t,index:n,total:a,phase:c},n))}),f>0||n?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`mt-0.5 inline-flex items-center gap-1 rounded px-1 py-0.5 text-[11px] text-muted-foreground hover:text-foreground`,children:[n?(0,j.jsx)(Rn,{className:`h-3 w-3`}):(0,j.jsx)(zn,{className:`h-3 w-3`}),n?`Show less`:`Show ${f} more`]}):null]})}function br(e){try{return JSON.parse(e),!0}catch{return!1}}function xr({conversationId:e,...t}){return e===void 0?(0,j.jsx)(Sr,{...t}):(0,j.jsx)(P,{conversationId:e,children:(0,j.jsx)(Sr,{...t})})}function Sr({content:e,className:t,streaming:n}){let r=L(),i=Le(e,e=>{let t=`[kind-directives] ${e}`;r.reportError?r.reportError(t):console.error(t)});if(!i){if(typeof e==`string`&&Ce(e)&&!br(e))return(0,j.jsx)(lr,{content:e,streaming:n!==!1,className:t});let r=typeof e==`string`?e:JSON.stringify(e,null,2);return(0,j.jsx)(`pre`,{className:`my-3 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground${t?` ${t}`:``}`,children:r})}let a=fr(i);return a?(0,j.jsx)(a,{directive:i}):i.parsed.executes?(0,j.jsx)(yr,{directive:i}):(0,j.jsx)(or,{directive:i})}function Cr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wr(e,t){if(_e(e)||t.kinds.getDefinition(e)?.legacyBlockType)return!0;let n=t.components.resolve(e,t.platform,`output`);return n?.isActive?n.componentKey!==nn:!1}function Tr(e){return _e(e.kind)?(0,j.jsx)(xr,{content:e.value,...e.className===void 0?{}:{className:e.className}}):(0,j.jsx)(Er,{...e})}function Er({kind:e,value:t,showRoutingNote:n=!0,unroutableFallback:r,variant:i=`card`,className:a}){let o=ne(),[s,c]=(0,_.useState)(()=>wr(e,o)?`routable`:`checking`);(0,_.useEffect)(()=>{let t=!1,n=!1,r=()=>{t||c(wr(e,o)?`routable`:n?`unroutable`:`checking`)},i=o.components.subscribe(r);r(),o.components.requestComponent(e,o.platform,`output`);let a=o.components.getVersion()>0;return Promise.allSettled([o.kinds.ensureWarm(),o.components.ensureWarm()]).then(async()=>{n=!0,r(),a&&await o.components.refresh(),r()}),()=>{t=!0,i()}},[o,e]);let l=Cr(t)?{type:`code`,content:JSON.stringify(t,null,2),language:`json`,metadata:{[re]:ue(t,e)}}:null,u=i===`bare`?void 0:`rounded-md border border-border bg-card p-3`;if(s===`unroutable`&&r!==void 0)return(0,j.jsx)(j.Fragment,{children:r});let d=l===null||s===`unroutable`,f=`This shape has no custom component yet, so it renders through the universal viewer — exactly what production shows today.`;return(0,j.jsxs)(`div`,{className:a?`space-y-3 ${a}`:`space-y-3`,children:[n&&s===`unroutable`?o.renderNotice?.(f)??(0,j.jsx)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:f}):null,(0,j.jsx)(`div`,{className:u,children:d?o.renderValue({value:t,kind:e}):o.renderBlock(l)})]})}var Dr=/^(https?:|mailto:|tel:)/i,Or=/^([./#?]|[A-Za-z0-9_-]+\/)/;function kr(e){let t=e.trim();return t===``?null:Dr.test(t)?t:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)?null:Or.test(t)?t:null}function Ar(e){let t=e.trim();return/^https?:\/\//i.test(t)?t:null}var jr=400,Mr=["(`+)([^\\n]{0,400}?)\\1",`!\\[([^\\]\\n]*)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)\\)`,`\\[([^\\]\\n]+)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)\\)`,`(\\*\\*|__)(?=\\S)([^\\n]{0,400}?\\S)\\7`,`(\\*|_)(?=\\S)([^*_\\n]{0,400}?\\S)\\9`,`(~~)(?=\\S)([^\\n]{0,400}?\\S)\\11`,`(https?://[^\\s<>()]+)`].join(`|`);function Nr(e,t,n=0){if(n>6||e.length>jr*64)return[e];let r=[],i=new RegExp(Mr,`g`),a=0,o=0,s=i.exec(e);for(;s!==null;){s.index>a&&r.push(e.slice(a,s.index));let c=`${t}i${o}`;if(o+=1,s[1]!==void 0)r.push((0,j.jsx)(`code`,{children:s[2]??``},c));else if(s[4]!==void 0){let e=Ar(s[4]),t=s[3]??``;r.push(e===null?(0,j.jsx)(_.Fragment,{children:t===``?s[4]:t},c):(0,j.jsx)(`img`,{className:`mx-chat-md__image`,src:e,alt:t,loading:`lazy`,referrerPolicy:`no-referrer`},c))}else if(s[6]!==void 0){let e=kr(s[6]),t=s[5]??``;r.push(e===null?(0,j.jsx)(_.Fragment,{children:t},c):(0,j.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,children:Nr(t,`${c}-`,n+1)},c))}else s[8]===void 0?s[10]===void 0?s[12]===void 0?s[13]!==void 0&&r.push((0,j.jsx)(`a`,{href:s[13],target:`_blank`,rel:`noreferrer noopener`,children:s[13]},c)):r.push((0,j.jsx)(`del`,{children:Nr(s[12],`${c}-`,n+1)},c)):r.push((0,j.jsx)(`em`,{children:Nr(s[10],`${c}-`,n+1)},c)):r.push((0,j.jsx)(`strong`,{children:Nr(s[8],`${c}-`,n+1)},c));a=s.index+s[0].length,s=i.exec(e)}return a<e.length&&r.push(e.slice(a)),r}var Pr=/^\s{0,3}(`{3,}|~{3,})\s*([^\s`]*)/,Fr=/^(#{1,6})\s+(.*)$/,Ir=/^\s{0,3}[-*+]\s+(.*)$/,Lr=/^\s{0,3}\d{1,9}[.)]\s+(.*)$/,Rr=/^\s{0,3}>\s?(.*)$/,zr=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/;function Br(e){return wt(e).map(Tt)}function Vr(e){let t=e.split(`
12
+ `,r),a=i===-1?e.length:i;if(t.push(r),n.push(a>r&&e.charCodeAt(a-1)===13?a-1:a),i===-1)break;r=i+1}let r=t.length,i=r=>e.slice(t[r],n[r]),a={ranges:[],fences:[],paragraphs:[],endsInFence:!1,pendingPara:-1},o={count:r,line:i},s=0;for(let c=0;c<r;c++){let l=st(i(c));if(!l||l.char!=="`")continue;yt(e,t,n,i,s,c,a);let u=ut(o,c,l);a.ranges.push({start:t[c],end:n[u.line],kind:`fence`}),a.fences.push([c,u.line,u.closed]),a.pendingPara=-1,!u.closed&&u.line===r-1&&(a.endsInFence=!0),c=u.line,s=c+1}return yt(e,t,n,i,s,r,a),a}function yt(e,t,n,r,i,a,o){let s=-1,c=0,l=[],u=e=>{s!==-1&&o.paragraphs.push([s,e]),s=-1};for(let e=i;e<a;e++){let i=r(e),{depth:d,offset:f}=mt(i);d!==c&&(c=d,l=[]);let p=i.slice(f);if(p.trim()===``){u(t[e]),(e!==t.length-1||i!==``)&&(o.pendingPara=-1);continue}let m=_t(p);for(;l.length&&m<l[l.length-1];)l.pop();let h=gt.exec(p),g=l.length?l[l.length-1]:0;if(h){let e=h[3].length;g=h[1].length+h[2].length+(e>=1&&e<=4?e:1),l.push(g),p=p.slice(Math.min(g,p.length))}else p=p.slice(Math.min(m,g));let _=st(p);if(!_){s===-1&&(s=t[e]),o.pendingPara===-1&&(o.pendingPara=t[e]);continue}u(t[e]),o.pendingPara=-1;let v=g,y=ut({count:a,line:e=>{let t=ht(r(e),d);if(t===null)return null;if(_.char===`~`&&v>0){let e=_t(t);return t.trim()!==``&&e<v?null:t.slice(Math.min(e,v))}return t}},e,_);o.ranges.push({start:t[e],end:n[y.line],kind:`fence`}),o.fences.push([e,y.line,y.closed]),!y.closed&&y.line===t.length-1&&(o.endsInFence=!0),e=y.line}u(a<t.length?t[a]:e.length)}var bt=class{all=[];byLength=new Map;indexOf=new Map;constructor(e,t,n){for(let r=t;r<n;){if(e.charCodeAt(r)!==96){r++;continue}let t=1;for(;r+t<n&&e.charCodeAt(r+t)===96;)t++;this.indexOf.set(r,this.all.length),this.all.push([r,t]);let i=this.byLength.get(t);i?i.push(r):this.byLength.set(t,[r]),r+=t}}next(e,t){let n=this.byLength.get(e);if(!n)return-1;let r=0,i=n.length;for(;r<i;){let e=r+i>>>1;n[e]<t?r=e+1:i=e}return n[r]??-1}index(e){return this.indexOf.get(e)??-1}};function xt(e,t,n,r){let i=null;for(let a=t;a<n;){let o=e.charCodeAt(a);if(o===92){a+=2;continue}if(o!==96){a++;continue}let s=pt(e,a),c=Math.min(s,n-a);i??=new bt(e,t,n);let l=i.next(c,a+c);if(l===-1){a+=c;continue}r.push({start:a,end:l+c,kind:`span`}),a=l+c}}function St(e){let t=vt(e),n=[...t.ranges];for(let[r,i]of t.paragraphs)xt(e,r,i,n);return n.sort((e,t)=>e.start-t.start)}function Ct(e){let t=[],n=0;for(let r=0;r<e.length;r+=1){let i=e[r];if(i===`\\`){r+=1;continue}i===`|`&&(t.push(e.slice(n,r)),n=r+1)}return t.push(e.slice(n)),t}function wt(e){let t=Ct(e).map(e=>e.trim());return t.length>1&&t[0]===``&&t.shift(),(t.length>1&&t[t.length-1]===``||t.length===1&&t[0]===``&&!e.includes(`|`))&&t.pop(),t}function Tt(e){return e.replace(/\\\|/g,`|`)}var Et=/^(?:[-+*](?:\s|$)|\d{1,9}[.)](?:\s|$)|>|#{1,6}(?:\s|$)|(?:-\s*){3,}$|(?:\*\s*){3,}$|(?:_\s*){3,}$|\[\^[^\]\s]+\]:)/,Dt=e=>Et.test(e)||ct(e)||Ft(e),Ot=/^<(?:script|pre|style|textarea)(?:[\s>]|$)/i,kt=/^(?:<!--|<\?|<![A-Za-z]|<!\[CDATA\[)/,At=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,jt=RegExp(`^</?(?:${At})(?:[\\s>]|/>|$)`,`i`),Mt=RegExp(`^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:\\s*=\\s*(?:[^\\s"'=<>\`]+|'[^']*'|"[^"]*"))?)*\\s*/?>|</[A-Za-z][A-Za-z0-9-]*\\s*>)\\s*$`),Nt=RegExp(`^</?(?:address|article|aside|base|basefont|body|center|dialog|dir|fieldset|footer|form|frame|frameset|head|header|html|iframe|legend|link|main|menu|menuitem|nav|noframes|optgroup|option|param|search|title|track)(?:[\\s>]|/>|$)`,`i`);function Pt(e){return Nt.test(e)}[...At.replace(`h[1-6]`,`h1|h2|h3|h4|h5|h6`).split(`|`)];function Ft(e){return e.startsWith(`<`)?Ot.test(e)||kt.test(e)||jt.test(e)||Mt.test(e):!1}function It(e){let t=0;for(let n of e)if(n===` `)t+=1;else if(n===` `)t+=4-t%4;else break;return t}var Lt=/^([ \t]*)([-+*]|\d{1,9}[.)])([ \t]+|$)/;function Rt(e){let t=It(e[1]??``)+(e[2]??``).length,n=e[3]?It(` `.repeat(t)+e[3])-t:1;return t+(n>=1&&n<=4?n:1)}function zt(e,t){return Bt(e,t,!1)}function Bt(e,t,n){let r=n?Lt.exec(e[t]??``):null;if(r)return Rt(r);let i=It(e[t]??``);if(i===0)return 0;for(let n=t-1;n>=0;--n){let t=e[n]??``;if(!t.trim())continue;let r=It(t),a=Lt.exec(t);if(a&&r<i){let e=Rt(a);if(e<=i)return e;continue}if(r===0)return 0}return 0}var Vt=/^:?-+:?$/;function Ht(e){let t=e.trim();if(!t.includes(`|`))return!1;let n=wt(t);return n.length>0&&n.every(e=>Vt.test(e))}function Ut(e){let t=e.trim();return t.startsWith(`|`)&&t.includes(`|`,1)}function Wt(e){return e===void 0||!Ht(e)?!1:!Et.test(e.trim())}function Gt(e,t){let n=e.trim();return!n||Ut(n)||!n.startsWith(`|`)&&Dt(n)||!Wt(t)?!1:wt(n).length===wt(t.trim()).length}function Kt(e,t=0){let n=e.trim();return!n||It(e)-t>=4?!1:n.startsWith(`|`)||!Dt(n)}function qt(e,t){let n=e[t]??``;return!Ut(n)&&!Gt(n,e[t+1])?!1:!$t(e,t)&&!Qt(e,t)}var Jt=/^ {0,3}>/,Yt=/^(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,Xt=e=>/^#{1,6}(?:\s|$)/.test(e)||Yt.test(e)||ct(e)||Ft(e);function Zt(e){if(Ot.test(e))return/<\/(?:script|pre|style|textarea)>/i;if(e.startsWith(`<!--`))return/-->/;if(e.startsWith(`<?`))return/\?>/;if(e.startsWith(`<![CDATA[`))return/\]\]>/;if(/^<![A-Za-z]/.test(e))return/>/;if(jt.test(e)||Mt.test(e))return null}function Qt(e,t){let n=t;for(;n>0&&(e[n-1]??``).trim();)--n;let r,i=!1;for(let a=n;a<t;a+=1){let t=e[a]??``;if(r!==void 0){r&&r.test(t)&&(r=void 0);continue}let n=t.trim(),o=It(t)<4?Zt(n):void 0,s=o===null&&!jt.test(n);if(o===void 0||i&&s){i=!0;continue}i=!1,!Pt(n)&&(r=o&&o.test(n.slice(2))?void 0:o)}return r!==void 0}function $t(e,t){let n=e[t]??``,r=-1;for(let n=t-1;n>=0;--n){let t=e[n]??``,i=t.trim();if(!i||Xt(i))break;let a=Lt.exec(t);if(a){let e=t.slice(a[0].length).trim();if(!e||Xt(e))break;r=n;break}if(r=n,Jt.test(t))break}if(r<0)return!1;let i=e[r]??``;return Jt.test(i)?!Jt.test(n):It(n)<Bt(e,r,!0)}function en(e,t){let n=e[t]??``,r=e[t+1];return!qt(e,t)||!Wt(r)||wt(n).length!==wt(r).length?!1:It(n)-zt(e,t)<4}function tn(e,t){let n=zt(e,t),r=Math.min(e.length,t+2);for(;r<e.length&&Kt(e[r]??``,n);)r+=1;return r}var nn=`generic_structured`,rn=Symbol.for(`ai-matrx.content-ir-react.sourceless-db-row-reports`);globalThis[rn]??=new Set;var an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function on(e){return typeof e==`string`&&an.test(e)}var sn=new Set([`update`,`delete`]),cn=new Set([`__kind`,`id`]);function ln(e){let t=e.id;return typeof t==`string`&&t.trim()?t.trim():typeof t==`number`?String(t):null}function un(e){return de(e)||e}function dn(e,t){return t&&e===t?`Title`:un(e)}var fn=`None`;function pn(e,t){return`${e} ${on(t)?t.slice(0,8):t.length>12?`${t.slice(0,12)}…`:t}`}var mn={value:fn,full:fn,clears:!0};function hn(e,t){if(e==null)return mn;if(typeof e==`string`){let n=e.trim();if(!n)return mn;let r=t?.(n)??null;if(r)return{value:r,full:r,clears:!1};let i=n.replace(/\s+/g,` `);return{value:i.length>280?`${i.slice(0,279)}…`:i,full:n,clears:!1}}if(typeof e==`number`||typeof e==`boolean`)return{value:String(e),full:String(e),clears:!1};if(Array.isArray(e)){let t=e.length;return{value:t===0?fn:`${t} ${t===1?`entry`:`entries`}`,full:gn(e),clears:t===0}}let n=Object.keys(e).length;return{value:n===0?fn:`${n} ${n===1?`field`:`fields`}`,full:gn(e),clears:n===0}}function gn(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function _n(e,t){return e===t?!0:e==null||t==null?(e==null||e===``)&&(t==null||t===``):typeof e==`object`||typeof t==`object`?gn(e)===gn(t):!1}function vn(e,t,n={}){let r=[],i=n.titleColumn??null;for(let[a,o]of Object.entries(e)){if(cn.has(a))continue;let e=dn(a,i),s=n.valueWord,c=a===i||!s?void 0:e=>s(a,e),l={key:a,label:e,...hn(o,c)};t&&Object.prototype.hasOwnProperty.call(t,a)&&(l.before=hn(t[a],c),l.same=_n(t[a],o)),r.push(l)}return r}var yn=Symbol.for(`@ai-matrx/content-ir-react/record-revisions`);function bn(){let e=globalThis,t=e[yn];return t||(t={revisions:new Map,listeners:new Set},e[yn]=t),t}var{revisions:xn,listeners:Sn}=bn();function Cn(e){return xn.get(e)??0}function wn(e){if(e){xn.set(e,Cn(e)+1);for(let e of Sn)e()}}function Tn(e){return Sn.add(e),()=>{Sn.delete(e)}}function En(e){return(0,_.useSyncExternalStore)(Tn,()=>Cn(e),()=>0)}function Dn(e,t){let n=En(t?.id??``),r=t&&e?`${t.noun}:${t.id}#${n}`:``,[i,a]=(0,_.useState)({key:``,values:null,status:`idle`});return(0,_.useEffect)(()=>{if(!r||!e)return;let t=r.indexOf(`:`),n={noun:r.slice(0,t),id:r.slice(t+1,r.lastIndexOf(`#`))},i=!0;return a({key:r,values:null,status:`loading`}),e(n).then(e=>{i&&a({key:r,values:e,status:e?`ready`:`unavailable`})}).catch(()=>{i&&a({key:r,values:null,status:`unavailable`})}),()=>{i=!1}},[r,e]),r?i.key===r?{values:i.values,status:i.status}:{values:null,status:`loading`}:{values:null,status:`idle`}}var On={create:`created`,update:`updated`,delete:`deleted`};function kn(e){let t=On[e.directiveClass]??`applied`,n=e.nounLabel.trim().toLowerCase()||`item`;return e.failed&&e.total&&e.total>1?{what:`${e.failed} of ${e.total} weren't ${t}.`,next:`Retry to try those again.`}:{what:`The ${n} wasn't ${t}.`,next:`Try again in a moment.`}}function An(e,t){return t?.(e)??kn(e)}function jn({children:e,...t}){return(0,j.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t,children:e})}var Mn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`}),(0,j.jsx)(`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`}),(0,j.jsx)(`path`,{d:`M3 15h6`}),(0,j.jsx)(`path`,{d:`M6 12v6`})]}),Nn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M12 20h9`}),(0,j.jsx)(`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`})]}),Pn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M3 6h18`}),(0,j.jsx)(`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`}),(0,j.jsx)(`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`}),(0,j.jsx)(`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`}),(0,j.jsx)(`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`})]}),Fn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`polygon`,{points:`6 3 20 12 6 21 6 3`})}),In=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`}),(0,j.jsx)(`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.01-.4-2.96A4 4 0 0 1 14 5.5c.63.42 1.13 1 1.44 1.66`}),(0,j.jsx)(`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`})]}),Ln=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`}),(0,j.jsx)(`path`,{d:`m7 16.5-4.74-2.85`}),(0,j.jsx)(`path`,{d:`m7 16.5 5-3`}),(0,j.jsx)(`path`,{d:`M7 16.5v5.17`}),(0,j.jsx)(`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`}),(0,j.jsx)(`path`,{d:`m17 16.5-5-3`}),(0,j.jsx)(`path`,{d:`m17 16.5 4.74-2.85`}),(0,j.jsx)(`path`,{d:`M17 16.5v5.17`}),(0,j.jsx)(`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`}),(0,j.jsx)(`path`,{d:`M12 8 7.26 5.15`}),(0,j.jsx)(`path`,{d:`m12 8 4.74-2.85`}),(0,j.jsx)(`path`,{d:`M12 13.5V8`})]}),Rn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),zn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`path`,{d:`m9 18 6-6-6-6`})}),Bn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`polyline`,{points:`15 3 21 3 21 9`}),(0,j.jsx)(`polyline`,{points:`9 21 3 21 3 15`}),(0,j.jsx)(`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`}),(0,j.jsx)(`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`})]}),Vn=e=>(0,j.jsx)(jn,{...e,children:(0,j.jsx)(`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`})}),Hn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}),(0,j.jsx)(`path`,{d:`M3 3v5h5`})]}),Un=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,j.jsx)(`path`,{d:`m9 12 2 2 4-4`})]}),Wn=e=>(0,j.jsxs)(jn,{...e,children:[(0,j.jsx)(`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`}),(0,j.jsx)(`path`,{d:`M12 9v4`}),(0,j.jsx)(`path`,{d:`M12 17h.01`})]}),Gn=new Set([`create_agent`,`create_agent_definition`,`agent`]);function Kn(e,t){if(e===`action`&&Gn.has(t))return In;switch(e){case`create`:return Mn;case`update`:return Nn;case`delete`:return Pn;default:return Fn}}function qn(e,t){if(sn.has(e.directiveClass))for(let e of t){let t=ln(e);t&&wn(t)}}var Jn=new WeakMap,Yn={},Xn=new Set;function Zn(e){let t=Jn.get(e);return t||(t=new Map,Jn.set(e,t)),t}function Qn(e,t,n){Zn(e).set(t,n);for(let e of Xn)e()}function $n(e){return Xn.add(e),()=>{Xn.delete(e)}}function er(e,t){return(0,_.useSyncExternalStore)($n,()=>Jn.get(e)?.get(t)??null,()=>null)}var tr=2e3,nr=30;function rr(e,t){return!!e.applyState&&!!e.confirm&&t.parsed.executes&&t.items.length>0}function ir({directive:e,label:t=`Apply`,itemCount:n,onApplied:r,onPhase:i,nothingToChange:a=!1}){let o=L(),s=F().conversationId||void 0,c=e.items,l=rr(o,e),u=l?{status:`checking`}:{status:`idle`},[d,f]=(0,_.useState)(u),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(!1),v=(0,_.useRef)(null),y=JSON.stringify([e.slug,c,s??null]),[b,x]=(0,_.useState)(y);b!==y&&(x(y),f(u),g(!1),m(0));let S=er(o.confirm??Yn,y),C=d.status===`asking`||!S?d:S,w=(0,_.useRef)(y);(0,_.useEffect)(()=>{w.current=y},[y]);let T=Be(e.noun,o.nouns),E=l?JSON.stringify([e.slug,c,s??null]):``,D=o.applyState,O=o.reportError;(0,_.useEffect)(()=>{if(!E||!D)return;let[e,t,n]=JSON.parse(E),r={__kind:e,items:t};n&&(r.conversationId=n);let i=!0,a=0,o=null,s=()=>{D(r).then(e=>{i&&(e.state===`applied`?f(n=>n.status===`checking`||n.status===`finishing`?{status:`applied`,applied:t.length,failed:0,message:e.message?.trim()?e.message.trim():null,records:e.records??[],copies:Math.max(1,e.copies??1),before:e.before??null}:n):e.state===`in_flight`&&a<nr?(a+=1,f(e=>e.status===`checking`||e.status===`finishing`?{status:`finishing`}:e),o=setTimeout(s,tr)):f(e=>e.status===`checking`||e.status===`finishing`?{status:`idle`}:e))}).catch(t=>{if(!i)return;let n=t instanceof Error&&t.message?t.message:String(t);(O??console.error)(`[kind-directives] Could not read whether ${e} was already applied: ${n}`),f(e=>e.status===`checking`||e.status===`finishing`?{status:`idle`}:e)})};return s(),()=>{i=!1,o&&clearTimeout(o)}},[E,D,O]);let k=C.status===`applied`&&C.failed===0?C:null,A=k?k.before:null,M=C.status===`checking`||C.status===`finishing`?`pending`:k?`applied:${JSON.stringify(A)}`:`open`;(0,_.useEffect)(()=>{i&&i(M===`pending`?{phase:`pending`}:M===`open`?{phase:`open`}:{phase:`applied`,before:A})},[M,i,A]);let N=C.status===`applying`?C.startedAt:null;if((0,_.useEffect)(()=>{if(N===null)return;v.current=N;let e=setInterval(()=>m(Math.round((Date.now()-(v.current??0))/1e3)),1e3);return()=>clearInterval(e)},[N]),!e.parsed.executes)return null;let P=o.confirm;if(!P)return null;async function I(t=!1){if(!P)return;let n=C,i=y,a=()=>w.current===i,l=C.status===`applied`?C.copies:0;if(o.ask){t?g(!0):f({status:`asking`});let r=!1;try{r=await o.ask({directive:e,items:c,nounLabel:T,...t?{again:!0}:{}})}catch(e){if(!a())return;g(!1),f({status:`error`,message:e instanceof Error&&e.message?e.message:`We could not ask you to confirm this, so nothing was done.`});return}if(!a())return;if(g(!1),!r){f(t?n:{status:`idle`});return}}m(0),f(e=>e.status===`asking`?{status:`idle`}:e),Qn(P,i,{status:`applying`,startedAt:Date.now()});try{let o={__kind:e.slug,items:c};s&&(o.conversationId=s),t&&(o.force=!0);let u;try{u=await P(o)}finally{qn(e,c)}for(let e of u.records??[])wn(e.id);Qn(P,i,{status:`applied`,applied:u.applied,failed:u.failed,message:u.message?.trim()?u.message.trim():null,records:u.records??[],copies:t?Math.max(1,l)+1:Math.max(1,l),before:t&&n.status===`applied`&&n.before?n.before:u.before??null}),a()&&r?.()}catch(e){Qn(P,i,{status:`error`,message:e instanceof Error&&e.message?e.message:`That couldn't be applied just now. Please try again.`})}}if(C.status===`applied`){let t=C.failed>0,n=e.directiveClass===`delete`,r=T,i=o.renderRecord?C.records:[];return(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs ${t?`text-destructive`:`text-primary`}`,"data-apply-state":`applied`,children:[(0,j.jsxs)(`span`,{className:`inline-flex min-w-0 items-start gap-1`,children:[t?(0,j.jsx)(Wn,{className:`mt-px h-3.5 w-3.5 shrink-0`}):(0,j.jsx)(Un,{className:`mt-px h-3.5 w-3.5 shrink-0`}),t?(0,j.jsx)(ar,{words:An({raw:C.message??`${C.failed} failed`,directiveClass:e.directiveClass,noun:e.noun,nounLabel:T,failed:C.failed,total:C.applied+C.failed},o.explainFailure),raw:C.message}):(0,j.jsx)(`span`,{className:`min-w-0`,children:C.message??`Applied ${C.applied}`})]}),C.copies>1?(0,j.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,"data-apply-copies":C.copies,title:i.length>0?e.directiveClass===`create`?`Links to the latest copy.`:`Links to the latest run.`:void 0,children:e.directiveClass===`create`?`${C.copies} copies`:`Ran ${C.copies} times`}):null,i.map(e=>(0,j.jsx)(`span`,{className:`inline-flex min-w-0 items-center`,children:o.renderRecord?.({...e,fallback:pn(r,e.id),context:`applied`,trashed:n})},`${e.noun}:${e.id}`)),(0,j.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>void I(!t),className:`inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50`,"data-apply-action":t?`retry`:`run-again`,children:[(0,j.jsx)(Hn,{className:`h-3 w-3`}),t?`Retry`:`Run again`]})]})}if(C.status===`checking`)return(0,j.jsx)(`span`,{className:`inline-flex h-6 w-6 items-center justify-center text-muted-foreground`,role:`status`,"aria-label":`Checking whether this already ran`,"data-apply-state":`checking`,children:(0,j.jsx)(Vn,{className:`h-3.5 w-3.5 animate-spin`})});if(C.status===`finishing`)return(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted-foreground`,role:`status`,"data-apply-state":`finishing`,children:[(0,j.jsx)(Vn,{className:`h-3.5 w-3.5 animate-spin`}),`Finishing…`]});let ee=e.directiveClass===`delete`,te=a&&C.status===`idle`;return(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center justify-end gap-x-2 gap-y-1`,children:[te?(0,j.jsx)(`span`,{className:`min-w-0 text-xs text-muted-foreground`,"data-apply-nothing":``,children:`Nothing to change`}):null,(0,j.jsxs)(`button`,{type:`button`,onClick:()=>void I(),disabled:C.status===`applying`||C.status===`asking`||c.length===0,"data-apply-tone":te?`muted`:ee?`destructive`:`default`,title:te?`It sets no fields, so applying it changes nothing.`:void 0,className:`inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-md border px-2 py-1 text-xs font-medium disabled:opacity-50 ${te?`border-border/60 bg-background text-muted-foreground hover:bg-accent`:ee?`border-destructive/50 bg-background text-destructive hover:bg-destructive/10`:`border-border bg-background hover:bg-accent`}`,children:[C.status===`applying`?(0,j.jsx)(Vn,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(Fn,{className:`h-3.5 w-3.5`}),C.status===`applying`?`Applying${n?` ${n} ${n===1?`item`:`items`}`:``}…${p?` ${p}s`:``}`:t]}),C.status===`error`?(0,j.jsxs)(`span`,{className:`inline-flex max-w-sm items-start gap-1 text-xs text-destructive`,"data-apply-state":`error`,children:[(0,j.jsx)(Wn,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,j.jsx)(ar,{words:An({raw:C.message,directiveClass:e.directiveClass,noun:e.noun,nounLabel:T},o.explainFailure),raw:C.message})]}):null]})}function ar({words:e,raw:t}){let[n,r]=(0,_.useState)(!1),i=t?.trim()??``;return(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,"data-apply-failure":!0,children:[(0,j.jsxs)(`span`,{className:`min-w-0`,children:[e.what,` `,e.next,i?(0,j.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),"aria-expanded":n,className:`ml-1 whitespace-nowrap underline underline-offset-2 hover:no-underline`,"data-apply-failure-details-toggle":!0,children:n?`Hide details`:`Details`}):null]}),n&&i?(0,j.jsx)(`span`,{className:`block max-w-sm select-text break-words font-mono text-[11px] text-muted-foreground`,"data-apply-failure-details":!0,children:i}):null]})}function or({directive:e,reason:t}){let n=L(),r=e.items.length,i=Ue(e.directiveClass,e.noun,n.nouns);return(0,j.jsxs)(`div`,{className:`my-3 inline-flex flex-wrap items-center gap-2 rounded-md border border-border bg-muted px-2.5 py-1 text-sm`,children:[(0,j.jsx)(Ln,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-foreground`,children:i.title}),i.family?(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,i.family]}):null,(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,r,` `,r===1?`item`:`items`]}),t?(0,j.jsxs)(`span`,{className:`text-muted-foreground`,children:[`· `,t]}):null,(0,j.jsx)(ir,{directive:e})]})}var sr=/^\{\s*"__kind"\s*:\s*"([^"]+)"/;function cr(e){return e.trimStart().match(sr)?.[1]??null}function lr({content:e,streaming:t,className:n}){let r=L(),i=cr(e),a=i?be(i):null,o=a?Ue(a.directiveClass,a.noun,r.nouns):null,s=a?Kn(a.directiveClass,a.noun):Ln,c=o?.title??`Structured action`;return(0,j.jsxs)(`div`,{className:`my-3 rounded-md border border-border bg-card px-2.5 py-1.5${n?` ${n}`:``}`,"data-directive":i??void 0,"data-directive-state":t?`streaming`:`incomplete`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,j.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:c}),o?.family?(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o.family}):null,t?(0,j.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,role:`status`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-primary`,"aria-hidden":!0}),`Writing…`]}):(0,j.jsx)(`span`,{className:`text-xs text-destructive`,role:`status`,children:`Cut off before it finished — nothing can be applied.`})]}),t?null:(0,j.jsxs)(`details`,{className:`mt-1 text-xs text-muted-foreground`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer select-none hover:text-foreground`,children:`Show what arrived`}),(0,j.jsx)(`pre`,{className:`mt-1 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded bg-muted px-2 py-1 text-[11px]`,children:e})]})]})}var ur=Symbol.for(`ai-matrx.content-ir-react.directive-renderers`),dr=globalThis[ur]??={bySlug:new Map,byClass:new Map};function fr(e){return dr.bySlug.get(e.slug)??dr.byClass.get(e.directiveClass)??null}function pr(e,t){let n=e.valueLabel;return n?(e,r)=>n({noun:t,field:e,value:r}):null}function mr(e,t){let{[t]:n,...r}=e;return r}var hr=3;function gr({directive:e,item:t,index:n,total:r,phase:i}){let a=L(),o=sn.has(e.directiveClass)?ln(t):null;if(o)return(0,j.jsx)(vr,{directive:e,item:t,recordId:o,index:n,phase:i});let s=He(e.noun,a.nouns),c=qe(t,s,n,r),l=Je(t),u=pr(a,e.noun),d=Qe(s?mr(t,s):t).map(e=>({...e,label:dn(e.key,s),value:u?.(e.key,e.value)??e.value})),f=a.itemKind?.(e.slug)??null,p=Ue(e.directiveClass,e.noun,a.nouns),m=a.openItem,h=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{className:`min-w-0 shrink-0 truncate font-medium text-foreground`,children:c}),(0,j.jsx)(`span`,{className:`hidden min-w-0 flex-1 items-baseline gap-2 overflow-hidden sm:flex`,children:d.map(e=>(0,j.jsxs)(`span`,{className:`truncate text-[11px] text-muted-foreground`,"data-item-fact":e.key,children:[e.label,` `,(0,j.jsx)(`span`,{className:`text-foreground/80`,children:e.value})]},e.key))}),l&&d.length===0?(0,j.jsx)(`span`,{className:`hidden truncate text-[11px] text-muted-foreground sm:inline`,children:l}):null,m?(0,j.jsx)(Bn,{className:`ml-auto h-3 w-3 shrink-0 text-muted-foreground`}):null]});return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 py-1 text-xs`,children:[m?(0,j.jsx)(`button`,{type:`button`,onClick:()=>m({item:$e(t,f)??t,itemKind:f,title:c,subtitle:`${p.title} · item ${n+1} of ${r}`,directive:e,index:n,total:r}),className:`flex min-w-0 flex-1 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-accent hover:text-accent-foreground`,title:`Open to read it`,children:h}):(0,j.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 px-1 py-0.5`,children:h}),a.renderCopy?.({label:c,value:t,kind:f,size:`xs`})]})}function _r({changes:e,className:t}){return e.length===0?(0,j.jsx)(`p`,{className:`text-[11px] text-muted-foreground${t?` ${t}`:``}`,children:`Sets no fields — nothing would change.`}):(0,j.jsx)(`ul`,{className:`@container space-y-1${t?` ${t}`:``}`,"data-directive-changes":``,children:e.map(e=>{let t=e.before&&!e.same?e.before:null;return(0,j.jsxs)(`li`,{className:`flex min-w-0 flex-col text-[11px] @xs:flex-row @xs:flex-wrap @xs:items-baseline @xs:gap-x-1.5`,title:t?`${e.label}: ${t.full} → ${e.full}`:`${e.label} → ${e.full}`,"data-change-key":e.key,children:[(0,j.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.label}),t?(0,j.jsx)(`span`,{className:`min-w-0 text-muted-foreground line-through [overflow-wrap:anywhere]`,"data-change-before":``,children:t.value}):null,(0,j.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,j.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-muted-foreground`,children:`→`}),(0,j.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere] ${e.clears?`italic text-muted-foreground`:`text-foreground`}`,"data-change-after":``,children:e.value}),e.same?(0,j.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`(no change)`}):null]})]},e.key)})})}function vr({directive:e,item:t,recordId:n,index:r,phase:i}){let a=L(),o=pn(Be(e.noun,a.nouns),n),s=e.directiveClass===`update`,c=s&&i.phase===`open`,l=Dn(c?a.readRecord:void 0,c?{noun:e.noun,id:n}:null),u=i.phase===`applied`?i.before?.[r]??null:c?l.values:null,d=s?vn(t,u,{titleColumn:He(e.noun,a.nouns),valueWord:pr(a,e.noun)}):[],f=a.renderRecord?a.renderRecord({noun:e.noun,id:n,fallback:o,context:`row`}):(0,j.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:o});return(0,j.jsxs)(`div`,{className:`py-1 text-xs`,"data-directive-target":n,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1 px-1`,children:f}),a.renderCopy?.({label:`this ${Be(e.noun,a.nouns).toLowerCase()}`,value:t,size:`xs`,record:{noun:e.noun,id:n}})]}),s?(0,j.jsx)(_r,{changes:d,className:`mt-0.5 px-1`}):null]})}function yr({directive:e}){let t=L(),[n,r]=(0,_.useState)(!1),i=e.items,a=i.length,o=Ue(e.directiveClass,e.noun,t.nouns),s=Kn(e.directiveClass,e.noun),[c,l]=(0,_.useState)(()=>rr(t,e)?{phase:`pending`}:{phase:`open`}),u=e.directiveClass===`update`&&a>0&&i.every(e=>vn(e).length===0),d=n?i:i.slice(0,hr),f=a-d.length;return(0,j.jsxs)(`div`,{className:`my-3 rounded-md border border-border bg-card px-2.5 py-1.5`,"data-directive":e.slug,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,j.jsx)(s,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,j.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:o.title}),o.family?(0,j.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o.family}):null,(0,j.jsxs)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:[a,` `,a===1?`item`:`items`]}),(0,j.jsxs)(`div`,{className:`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1`,children:[t.renderCopy?.({label:o.title,value:e.shell,size:`icon`}),(0,j.jsx)(ir,{directive:e,itemCount:a,onPhase:l,nothingToChange:u})]})]}),a===0?(0,j.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`No items — nothing would be written.`}):(0,j.jsx)(`div`,{className:`mt-0.5 divide-y divide-border/60`,children:d.map((t,n)=>(0,j.jsx)(gr,{directive:e,item:t,index:n,total:a,phase:c},n))}),f>0||n?(0,j.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded px-1 py-0.5 text-[11px] text-muted-foreground hover:text-foreground`,children:[n?(0,j.jsx)(Rn,{className:`h-3 w-3`}):(0,j.jsx)(zn,{className:`h-3 w-3`}),n?`Show less`:`Show ${f} more`]}):null]})}function br(e){try{return JSON.parse(e),!0}catch{return!1}}function xr({conversationId:e,...t}){return e===void 0?(0,j.jsx)(Sr,{...t}):(0,j.jsx)(P,{conversationId:e,children:(0,j.jsx)(Sr,{...t})})}function Sr({content:e,className:t,streaming:n}){let r=L(),i=Le(e,e=>{let t=`[kind-directives] ${e}`;r.reportError?r.reportError(t):console.error(t)});if(!i){if(typeof e==`string`&&Ce(e)&&!br(e))return(0,j.jsx)(lr,{content:e,streaming:n!==!1,className:t});let r=typeof e==`string`?e:JSON.stringify(e,null,2);return(0,j.jsx)(`pre`,{className:`my-3 overflow-x-auto rounded-md border border-border bg-muted px-3 py-2 text-xs text-muted-foreground${t?` ${t}`:``}`,children:r})}let a=fr(i);return a?(0,j.jsx)(a,{directive:i}):i.parsed.executes?(0,j.jsx)(yr,{directive:i}):(0,j.jsx)(or,{directive:i})}function Cr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wr(e,t){if(_e(e)||t.kinds.getDefinition(e)?.legacyBlockType)return!0;let n=t.components.resolve(e,t.platform,`output`);return n?.isActive?n.componentKey!==nn:!1}function Tr(e){return _e(e.kind)?(0,j.jsx)(xr,{content:e.value,...e.className===void 0?{}:{className:e.className}}):(0,j.jsx)(Er,{...e})}function Er({kind:e,value:t,showRoutingNote:n=!0,unroutableFallback:r,variant:i=`card`,className:a}){let o=ne(),[s,c]=(0,_.useState)(()=>wr(e,o)?`routable`:`checking`);(0,_.useEffect)(()=>{let t=!1,n=!1,r=()=>{t||c(wr(e,o)?`routable`:n?`unroutable`:`checking`)},i=o.components.subscribe(r);r(),o.components.requestComponent(e,o.platform,`output`);let a=o.components.getVersion()>0;return Promise.allSettled([o.kinds.ensureWarm(),o.components.ensureWarm()]).then(async()=>{n=!0,r(),a&&await o.components.refresh(),r()}),()=>{t=!0,i()}},[o,e]);let l=Cr(t)?{type:`code`,content:JSON.stringify(t,null,2),language:`json`,metadata:{[re]:ue(t,e)}}:null,u=i===`bare`?void 0:`rounded-md border border-border bg-card p-3`;if(s===`unroutable`&&r!==void 0)return(0,j.jsx)(j.Fragment,{children:r});let d=l===null||s===`unroutable`,f=`This shape has no custom component yet, so it renders through the universal viewer — exactly what production shows today.`;return(0,j.jsxs)(`div`,{className:a?`space-y-3 ${a}`:`space-y-3`,children:[n&&s===`unroutable`?o.renderNotice?.(f)??(0,j.jsx)(`div`,{className:`rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:f}):null,(0,j.jsx)(`div`,{className:u,children:d?o.renderValue({value:t,kind:e}):o.renderBlock(l)})]})}var Dr=/^(https?:|mailto:|tel:)/i,Or=/^([./#?]|[A-Za-z0-9_-]+\/)/;function kr(e){let t=e.trim();return t===``?null:Dr.test(t)?t:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)?null:Or.test(t)?t:null}function Ar(e){let t=e.trim();return/^https?:\/\//i.test(t)?t:null}var jr=400,Mr=["(`+)([^\\n]{0,400}?)\\1",`!\\[([^\\]\\n]*)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)\\)`,`\\[([^\\]\\n]+)\\]\\(((?:[^()\\s]|\\([^()\\s]*\\))+)\\)`,`(\\*\\*|__)(?=\\S)([^\\n]{0,400}?\\S)\\7`,`(\\*|_)(?=\\S)([^*_\\n]{0,400}?\\S)\\9`,`(~~)(?=\\S)([^\\n]{0,400}?\\S)\\11`,`(https?://[^\\s<>()]+)`].join(`|`);function Nr(e,t,n=0){if(n>6||e.length>jr*64)return[e];let r=[],i=new RegExp(Mr,`g`),a=0,o=0,s=i.exec(e);for(;s!==null;){s.index>a&&r.push(e.slice(a,s.index));let c=`${t}i${o}`;if(o+=1,s[1]!==void 0)r.push((0,j.jsx)(`code`,{children:s[2]??``},c));else if(s[4]!==void 0){let e=Ar(s[4]),t=s[3]??``;r.push(e===null?(0,j.jsx)(_.Fragment,{children:t===``?s[4]:t},c):(0,j.jsx)(`img`,{className:`mx-chat-md__image`,src:e,alt:t,loading:`lazy`,referrerPolicy:`no-referrer`},c))}else if(s[6]!==void 0){let e=kr(s[6]),t=s[5]??``;r.push(e===null?(0,j.jsx)(_.Fragment,{children:t},c):(0,j.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer noopener`,children:Nr(t,`${c}-`,n+1)},c))}else s[8]===void 0?s[10]===void 0?s[12]===void 0?s[13]!==void 0&&r.push((0,j.jsx)(`a`,{href:s[13],target:`_blank`,rel:`noreferrer noopener`,children:s[13]},c)):r.push((0,j.jsx)(`del`,{children:Nr(s[12],`${c}-`,n+1)},c)):r.push((0,j.jsx)(`em`,{children:Nr(s[10],`${c}-`,n+1)},c)):r.push((0,j.jsx)(`strong`,{children:Nr(s[8],`${c}-`,n+1)},c));a=s.index+s[0].length,s=i.exec(e)}return a<e.length&&r.push(e.slice(a)),r}var Pr=/^\s{0,3}(`{3,}|~{3,})\s*([^\s`]*)/,Fr=/^(#{1,6})\s+(.*)$/,Ir=/^\s{0,3}[-*+]\s+(.*)$/,Lr=/^\s{0,3}\d{1,9}[.)]\s+(.*)$/,Rr=/^\s{0,3}>\s?(.*)$/,zr=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/;function Br(e){return wt(e).map(Tt)}function Vr(e){let t=e.split(`
13
13
  `),n=[];{let e=0;for(let r of t)n.push(e),e+=r.length+1}let r=[],i=0,a=0;for(;i<t.length;){let e=t[i]??``;if(e.trim()===``){i+=1;continue}a=i;let n=Pr.exec(e);if(n!==null){let e=n[1]??"```",a=n[2]??``,o=[];i+=1;let s=!1;for(;i<t.length;){let n=t[i]??``;if(n.trimStart().startsWith(e[0]??"`")&&n.trim().length>=3){let t=Pr.exec(n);if(t!==null&&(t[1]??``).length>=e.length){s=!0,i+=1;break}}o.push(n),i+=1}r.push({type:`code`,language:a,body:o.join(`
14
14
  `),closed:s});continue}let o=Fr.exec(e);if(o!==null){r.push({type:`heading`,level:(o[1]??`#`).length,body:o[2]??``}),i+=1;continue}if(zr.test(e)){r.push({type:`rule`}),i+=1;continue}if(Rr.test(e)){let e=[];for(;i<t.length;){let n=Rr.exec(t[i]??``);if(n===null)break;e.push(n[1]??``),i+=1}r.push({type:`quote`,body:e.join(`
15
15
  `)});continue}let s=Ir.exec(e),c=Lr.exec(e);if(s!==null||c!==null){let e=c!==null,n=[];for(;i<t.length;){let r=t[i]??``,a=e?Lr.exec(r):Ir.exec(r);if(a===null)break;n.push(a[1]??``),i+=1}r.push({type:`list`,ordered:e,items:n});continue}if(en(t,i)){let n=Br(e),a=tn(t,i);i+=2;let o=[];for(;i<a;){let e=Br(t[i]??``);o.push(n.map((t,n)=>e[n]??``)),i+=1}r.push({type:`table`,header:n,rows:o});continue}let l=[];for(;i<t.length;){let e=t[i]??``;if(e.trim()===``||Pr.test(e)||Fr.test(e)||Ir.test(e)||Lr.test(e)||Rr.test(e)||zr.test(e))break;l.push(e),i+=1}r.push({type:`paragraph`,body:l.join(`
@@ -7,7 +7,7 @@
7
7
  <meta name="color-scheme" content="light dark" />
8
8
  <title>Coding sessions</title>
9
9
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%23111'/%3E%3Cpath d='M11 11l-4 5 4 5M21 11l4 5-4 5' stroke='%23fff' stroke-width='2.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
10
- <script type="module" crossorigin src="./assets/index-dyTBAji7.js"></script>
10
+ <script type="module" crossorigin src="./assets/index-DeVRkW53.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-DWisp3cb.css">
12
12
  </head>
13
13
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/coding-sessions",
3
- "version": "0.1.105",
3
+ "version": "0.1.106",
4
4
  "description": "Drive the user's own Claude Code and Codex — on their own subscription logins, no API keys — from AI Matrx, and take over chats they started elsewhere. The engine wraps Paperclip's MIT driver packages with every fix the 2026-09-27 spike found (clean environment, no Paperclip prompt or skills, the user's own Codex home, host-side stop, no silent fresh-session resumes); the local host serves the screen on 127.0.0.1 behind a per-launch token; the React screen lists running, recent and existing chats, streams the transcript through @ai-matrx/chat, and never shows a terminal.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -83,10 +83,10 @@
83
83
  "@paperclipai/adapter-codex-local": "latest",
84
84
  "@paperclipai/adapter-utils": "latest",
85
85
  "ws": "^8.22.0",
86
- "@ai-matrx/agents": "latest",
87
- "@ai-matrx/data": "latest",
88
86
  "@ai-matrx/chat": "latest",
87
+ "@ai-matrx/data": "latest",
89
88
  "@ai-matrx/design-system": "latest",
89
+ "@ai-matrx/agents": "latest",
90
90
  "@ai-matrx/kit": "latest"
91
91
  },
92
92
  "devDependencies": {