linear-grab 0.21.4 → 0.22.1

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.
@@ -1,4 +1,4 @@
1
- (function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),r=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},i={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return a(this.context.count)},getNextContextId(){return a(this.context.count++)}};function a(e){let t=String(e),n=t.length-1;return i.context.id+(n?String.fromCharCode(96+n):``)+t}function o(e){i.context=e}var s=(e,t)=>e===t,c=Symbol(`solid-proxy`),l=typeof Proxy==`function`,u=Symbol(`solid-track`),d={equals:s},f=null,p=Se,m=1,h=2,g={owned:null,cleanups:null,context:null,owner:null},_={},v=null,y=null,b=null,x=null,S=null,C=0;function w(e,t){let n=b,r=v,i=e.length===0,a=t===void 0?r:t,o=i?g:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>ne(()=>Ee(o)));v=o,b=null;try{return be(s,!0)}finally{b=n,v=r}}function T(e,t){t=t?Object.assign({},d,t):d;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[me.bind(n),e=>(typeof e==`function`&&(e=y&&y.running&&y.sources.has(n)?e(n.tValue):e(n.value)),he(n,e))]}function ee(e,t,n){ge(ve(e,t,!0,m))}function E(e,t,n){ge(ve(e,t,!1,m))}function D(e,t,n){p=Ce;let r=ve(e,t,!1,m),i=pe&&de(pe);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),S?S.push(r):ge(r)}function O(e,t,n){n=n?Object.assign({},d,n):d;let r=ve(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ge(r),me.bind(r)}function te(e){return e&&typeof e==`object`&&`then`in e}function k(e,t,n){let r,a,o;typeof t==`function`?(r=e,a=t,o=n||{}):(r=!0,a=e,o=t||{});let s=null,c=_,l=null,u=!1,d=!1,f=`initialValue`in o,p=typeof r==`function`&&O(r),m=new Set,[h,g]=(o.storage||T)(o.initialValue),[x,S]=T(void 0),[C,w]=T(void 0,{equals:!1}),[E,D]=T(f?`ready`:`unresolved`);v&&ae(()=>{for(let e of m.keys())e.decrement();m.clear(),y&&s&&y.promises.delete(s),s=null}),i.context&&(l=i.getNextContextId(),o.ssrLoadFrom===`initial`?c=o.initialValue:i.load&&i.has(l)&&(c=i.load(l)));function k(e,t,n,r){return s===e&&(s=null,r!==void 0&&(f=!0),(e===c||t===c)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(r,{value:t})),c=_,y&&e&&u?(y.promises.delete(e),u=!1,be(()=>{y.running=!0,A(t,n)},!1)):A(t,n)),t}function A(e,t){be(()=>{t===void 0&&g(()=>e),D(t===void 0?f?`ready`:`unresolved`:`errored`),S(t);for(let e of m.keys())e.decrement();m.clear()},!1)}function re(){let e=pe&&de(pe),t=h(),n=x();if(n!==void 0&&!s)throw n;return b&&!b.user&&e&&ee(()=>{C(),s&&(e.resolved&&y&&u?y.promises.add(s):m.has(e)||(e.increment(),m.add(e)))}),t}function ie(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():r;if(u=y&&y.running,t==null||t===!1){k(s,ne(h));return}y&&s&&y.promises.delete(s);let n,i=c===_?ne(()=>{try{return a(t,{value:h(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0){k(s,void 0,Oe(n),t);return}else if(!te(i))return k(s,i,void 0,t),i;return s=i,`v`in i?(i.s===1?k(s,i.v,void 0,t):k(s,void 0,Oe(i.v),t),i):(d=!0,queueMicrotask(()=>d=!1),be(()=>{D(f?`refreshing`:`pending`),w()},!1),i.then(e=>k(i,e,void 0,t),e=>k(i,void 0,Oe(e),t)))}Object.defineProperties(re,{state:{get:()=>E()},error:{get:()=>x()},loading:{get(){let e=E();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return re();let e=x();if(e&&!s)throw e;return h()}}});let oe=v;return p?ee(()=>(oe=v,ie(!1))):ie(!1),[re,{refetch:e=>se(oe,()=>ie(e)),mutate:g}]}function A(e){return be(e,!1)}function ne(e){if(b===null)return e();let t=b;b=null;try{return e()}finally{b=t}}function re(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=ne(()=>t(o,i,n));return i=o,s}}function ie(e){D(()=>ne(e))}function ae(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function oe(){return b}function se(e,t){let n=v,r=b;v=e,b=null;try{return be(t,!0)}catch(e){Ae(e)}finally{v=n,b=r}}var[ce,le]=T(!1);function ue(e,t){let n=Symbol(`context`);return{id:n,Provider:Me(n),defaultValue:e}}function de(e){let t;return v&&v.context&&(t=v.context[e.id])!==void 0?t:e.defaultValue}function fe(e){let t=O(e),n=O(()=>je(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var pe;function me(){let e=y&&y.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===m)ge(this);else{let e=x;x=null,be(()=>we(this),!1),x=e}if(b){let e=this.observers;if(!e||e[e.length-1]!==b){let t=e?e.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(t)):(b.sources=[this],b.sourceSlots=[t]),e?(e.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}}return e&&y.sources.has(this)?this.tValue:this.value}function he(e,t,n){let r=y&&y.running&&y.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(y){let r=y.running;(r||!n&&y.sources.has(e))&&(y.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&be(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=y&&y.running;r&&y.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?x.push(n):S.push(n),n.observers&&Te(n)),r?n.tState=m:n.state=m)}if(x.length>1e6)throw x=[],Error()},!1)}return t}function ge(e){if(!e.fn)return;Ee(e);let t=C;_e(e,y&&y.running&&y.sources.has(e)?e.tValue:e.value,t),y&&!y.running&&y.sources.has(e)&&queueMicrotask(()=>{be(()=>{y&&(y.running=!0),b=v=e,_e(e,e.tValue,t),b=v=null},!1)})}function _e(e,t,n){let r,i=v,a=b;b=v=e;try{r=e.fn(t)}catch(t){return e.pure&&(y&&y.running?(e.tState=m,e.tOwned&&e.tOwned.forEach(Ee),e.tOwned=void 0):(e.state=m,e.owned&&e.owned.forEach(Ee),e.owned=null)),e.updatedAt=n+1,Ae(t)}finally{b=a,v=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?he(e,r,!0):y&&y.running&&e.pure?(y.sources.has(e)||(e.value=r),y.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function ve(e,t,n,r=m,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};return y&&y.running&&(a.state=0,a.tState=r),v===null||v!==g&&(y&&y.running&&v.pure?v.tOwned?v.tOwned.push(a):v.tOwned=[a]:v.owned?v.owned.push(a):v.owned=[a]),a}function ye(e){let t=y&&y.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===h)return we(e);if(e.suspense&&ne(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<C);){if(t&&y.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(y.disposed.has(t))return}if((t?e.tState:e.state)===m)ge(e);else if((t?e.tState:e.state)===h){let t=x;x=null,be(()=>we(e,n[0]),!1),x=t}}}function be(e,t){if(x)return e();let n=!1;t||(x=[]),S?n=!0:S=[],C++;try{let t=e();return xe(n),t}catch(e){n||(S=null),x=null,Ae(e)}}function xe(e){if(x&&=(Se(x),null),e)return;let t;if(y){if(!y.promises.size&&!y.queue.size){let e=y.sources,n=y.disposed;S.push.apply(S,y.effects),t=y.resolve;for(let e of S)`tState`in e&&(e.state=e.tState),delete e.tState;y=null,be(()=>{for(let e of n)Ee(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)Ee(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}le(!1)},!1)}else if(y.running){y.running=!1,y.effects.push.apply(y.effects,S),S=null,le(!0);return}}let n=S;S=null,n.length&&be(()=>p(n),!1),t&&t()}function Se(e){for(let t=0;t<e.length;t++)ye(e[t])}function Ce(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:ye(r)}if(i.context){if(i.count){i.effects||=[],i.effects.push(...e.slice(0,n));return}o()}for(i.effects&&(i.done||!i.count)&&(e=[...i.effects,...e],n+=i.effects.length,delete i.effects),t=0;t<n;t++)ye(e[t])}function we(e,t){let n=y&&y.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===m?i!==t&&(!i.updatedAt||i.updatedAt<C)&&ye(i):e===h&&we(i,t)}}}function Te(e){let t=y&&y.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=h:r.state=h,r.pure?x.push(r):S.push(r),r.observers&&Te(r))}}function Ee(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ee(e.tOwned[t]);delete e.tOwned}if(y&&y.running&&e.pure)De(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}y&&y.running?e.tState=0:e.state=0}function De(e,t){if(t||(e.tState=0,y.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)De(e.owned[t])}function Oe(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ke(e,t,n){try{for(let n of t)n(e)}catch(e){Ae(e,n&&n.owner||null)}}function Ae(e,t=v){let n=f&&t&&t.context&&t.context[f],r=Oe(e);if(!n)throw r;S?S.push({fn(){ke(r,n,t)},state:m}):ke(r,n,t)}function je(e){if(typeof e==`function`&&!e.length)return je(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=je(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}return t}return e}function Me(e,t){return function(t){let n;return E(()=>n=ne(()=>(v.context={...v.context,[e]:t.value},fe(()=>t.children))),void 0),n}}var Ne=Symbol(`fallback`);function Pe(e){for(let t=0;t<e.length;t++)e[t]()}function Fe(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return ae(()=>Pe(a)),()=>{let c=e()||[],l=c.length,d,f;return c[u],ne(()=>{let e,t,u,m,h,g,_,v,y;if(l===0)o!==0&&(Pe(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),f=0;f<l;f++)r[f]=c[f],i[f]=w(p);o=l}else{for(u=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)u[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),f=v;f>=g;f--)y=c[f],d=e.get(y),t[f]=d===void 0?-1:d,e.set(y,f);for(d=g;d<=_;d++)y=r[d],f=e.get(y),f!==void 0&&f!==-1?(u[f]=i[d],m[f]=a[d],s&&(h[f]=s[d]),f=t[f],e.set(y,f)):a[d]();for(f=g;f<l;f++)f in u?(i[f]=u[f],a[f]=m[f],s&&(s[f]=h[f],s[f](f))):i[f]=w(p);i=i.slice(0,o=l),r=c.slice(0)}return i});function p(e){if(a[f]=e,s){let[e,n]=T(f);return s[f]=n,t(c[f],e)}return t(c[f])}}}function Ie(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return ae(()=>Pe(a)),()=>{let l=e()||[],d=l.length;return l[u],ne(()=>{if(d===0)return s!==0&&(Pe(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Ne&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<d;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=w(f));for(;c<r.length;c++)a[c]();return s=o.length=a.length=d,r=l.slice(0),i=i.slice(0,s)});function f(e){a[c]=e;let[n,r]=T(l[c]);return o[c]=r,t(n,c)}}}function j(e,t){return ne(()=>e(t||{}))}function Le(){return!0}var Re={get(e,t,n){return t===c?n:e.get(t)},has(e,t){return t===c||e.has(t)},set:Le,deleteProperty:Le,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Le,deleteProperty:Le}},ownKeys(e){return e.keys()}};function ze(e){return(e=typeof e==`function`?e():e)?e:{}}function Be(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function Ve(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&c in r,e[n]=typeof r==`function`?(t=!0,O(r)):r}if(l&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=ze(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ze(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ze(e[n])));return[...new Set(t)]}},Re);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Be.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function He(e,...t){let n=t.length;if(l&&c in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},Re));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Re)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var Ue=e=>`Stale read from <${e}>.`;function We(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return O(Fe(()=>e.each,e.children,t||void 0))}function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return O(Ie(()=>e.each,e.children,t||void 0))}function M(e){let t=e.keyed,n=O(()=>e.when,void 0,void 0),r=t?n:O(n,void 0,{equals:(e,t)=>!e==!t});return O(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?ne(()=>a(t?i:()=>{if(!ne(r))throw Ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var Ke=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),qe=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Je=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Ye=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function Xe(e,t){let n=Ye[e];return typeof n==`object`?n[t]?n.$:void 0:n}var Ze=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),Qe={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},$e=e=>O(()=>e());function et(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var tt=`_$DX_DELEGATE`;function nt(e,t,n,r={}){let i;return w(r=>{i=r,t===document?e():P(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function N(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>ne(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function rt(e,t=window.document){let n=t[tt]||(t[tt]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,yt))}}function it(e,t,n){ht(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function at(e,t,n,r){ht(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function ot(e,t,n){ht(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function st(e,t){ht(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function ct(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function lt(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(_t(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(_t(e,i,!0),n[i]=o)}return n}function ut(e,t,n){if(!t)return n?it(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function dt(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ft(e,t={},n,r){let i={};return r||E(()=>i.children=bt(e,t.children,i.children)),E(()=>typeof t.ref==`function`&&pt(t.ref,e)),E(()=>mt(e,t,n,!0,i,!0)),i}function pt(e,t,n){return ne(()=>e(t,n))}function P(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return bt(e,t,r,n);E(r=>bt(e,t(),r,n),r)}function mt(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=vt(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||bt(e,t.children);continue}let s=t[o];i[o]=vt(e,o,s,i[o],n,a,t)}}function ht(e){return!!i.context&&!i.done&&(!e||e.isConnected)}function gt(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function _t(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function vt(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return ut(e,n,r);if(t===`classList`)return lt(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=Ze.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(ct(e,i,n,a),a&&rt([i]))}else if(t.slice(0,5)===`attr:`)it(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)ot(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=qe.has(t))||!i&&((u=Xe(t,e.tagName))||(c=Ke.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(ht(e))return n;t===`class`||t===`className`?st(e,n):s&&!c&&!l?e[gt(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Qe[t.split(`:`)[0]];r?at(e,r,t,n):it(e,Je[t]||t,n)}return n}function yt(e){if(i.registry&&i.events&&i.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,a=e.currentTarget,o=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),s=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&o(t.host),!0},c=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),i.registry&&!i.done&&(i.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();o(n[0]);for(let e=0;e<n.length-2&&(t=n[e],s());e++){if(t._$host){t=t._$host,c();break}if(t.parentNode===a)break}}else c();o(r)}function bt(e,t,n,r,i){let a=ht(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Ct(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Ct(e,n,r)}else if(o===`function`)return E(()=>{let i=t();for(;typeof i==`function`;)i=i();n=bt(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(xt(o,t,n,i))return E(()=>n=bt(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Ct(e,n,r),s)return n}else c?n.length===0?St(e,o,r):et(e,n,o):(n&&Ct(e),St(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Ct(e,n,r,t);Ct(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function xt(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=xt(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=xt(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function St(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Ct(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var wt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tt=new class extends wt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Et={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Dt=new class{#e=Et;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ot(e){setTimeout(e,0)}var kt=typeof window>`u`||`Deno`in globalThis;function At(){}function jt(e,t){return typeof e==`function`?e(t):e}function Mt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Nt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e,t){return typeof e==`function`?e(t):e}function It(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Rt(o,t.options))return!1}else if(!Bt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Lt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zt(t.options.mutationKey)!==zt(a))return!1}else if(!Bt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Rt(e,t){return(t?.queryKeyHashFn||zt)(e)}function zt(e){return JSON.stringify(e,(e,t)=>Gt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Bt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Bt(e[n],t[n])):!1}var Vt=Object.prototype.hasOwnProperty;function Ht(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Wt(e)&&Wt(t);if(!r&&!(Gt(e)&&Gt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Vt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ht(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ut(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Wt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gt(e){if(!Kt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Kt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Kt(e){return Object.prototype.toString.call(e)===`[object Object]`}function qt(e){return new Promise(t=>{Dt.setTimeout(t,e)})}function Jt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ht(e,t)}function Yt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Xt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zt=Symbol();function Qt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Zt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $t(e,t){return typeof e==`function`?e(...t):!!e}function en(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tn=(()=>{let e=()=>kt;return{isServer(){return e()},setIsServer(t){e=t}}})();function nn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function rn(e){let t;if(e.then(e=>(t=e,e),At)?.catch(At),t!==void 0)return{data:t}}function an(e){return e}function on(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??an,o=t.mutations||[],s=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),s.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?rn(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(At)})}var sn=Ot;function cn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ln=cn(),un=new class extends wt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dn(e){return Math.min(1e3*2**e,3e4)}function fn(e){return(e??`online`)!==`online`||un.isOnline()}var pn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mn(e){let t=!1,n=0,r,i=nn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new pn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Tt.isFocused()&&(e.networkMode===`always`||un.isOnline())&&e.canRun(),u=()=>fn(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(tn.isServer()?0:3),o=e.retryDelay??dn,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),qt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var hn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mt(this.gcTime)&&(this.#e=Dt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Dt.clearTimeout(this.#e),this.#e=void 0)}};function gn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{en(e,()=>t.signal,()=>n=!0)},u=Qt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Xt:Yt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vn:_n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function _n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yn=class extends hn{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sn(this.options);e.data!==void 0&&(this.setState(xn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Jt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ft(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Pt(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Nt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Qt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=mn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pn&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pn){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ln.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cn=class extends wt{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=nn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return En(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return En(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ft(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ut(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||Pt(this.options.staleTime,this.#t)!==Pt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return kn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(At)),t}#g(){this.#b();let e=Pt(this.options.staleTime,this.#t);if(tn.isServer()||this.#r.isStale||!Mt(e))return;let t=Nt(this.#r.dataUpdatedAt,e)+1;this.#d=Dt.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(tn.isServer()||Ft(this.options.enabled,this.#t)===!1||!Mt(this.#p)||this.#p===0)&&(this.#f=Dt.setInterval(()=>{(this.options.refetchIntervalInBackground||Tt.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Dt.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Dt.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tn(e,t),o=i&&Dn(e,n,t,r);(a||o)&&(l={...l,...bn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Jt(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Jt(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:On(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ft(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=nn();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ut(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ln.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function wn(e,t){return Ft(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Ft(t.retryOnMount,e)===!1)}function Tn(e,t){return wn(e,t)||e.state.data!==void 0&&En(e,t,t.refetchOnMount)}function En(e,t,n){if(Ft(t.enabled,e)!==!1&&Pt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&On(e,t)}return!1}function Dn(e,t,n,r){return(e!==t||Ft(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&On(e,n)}function On(e,t){return Ft(t.enabled,e)!==!1&&e.isStaleByTime(Pt(t.staleTime,e))}function kn(e,t){return!Ut(e.getCurrentResult(),t)}var An=class extends hn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=mn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ln.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new An({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Nn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ln.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Lt(t,e))}findAll(e={}){return this.getAll().filter(t=>Lt(e,t))}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ln.batch(()=>Promise.all(e.map(e=>e.continue().catch(At))))}};function Nn(e){return e.options.scope?.id}var Pn=class extends wt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ut(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&zt(t.mutationKey)!==zt(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??jn();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ln.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Fn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Rt(r,t),a=this.get(i);return a||(a=new yn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ln.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>It(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>It(e,t)):t}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},In=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fn,this.#t=e.mutationCache||new Mn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Pt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=jt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ln.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ln.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ln.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(At).catch(At)}invalidateQueries(e,t={}){return ln.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ln.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(At)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(At)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Pt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return un.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Bt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Bt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Rt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Zt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ln=Symbol(`store-raw`),Rn=Symbol(`store-node`),zn=Symbol(`store-has`),Bn=Symbol(`store-self`);function Vn(e){let t=e[c];if(!t&&(Object.defineProperty(e,c,{value:t=new Proxy(e,Yn)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function Hn(e){let t;return typeof e==`object`&&!!e&&(e[c]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Un(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Ln])return n;if(!Hn(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Un(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=Un(i,t))!==i&&(e[a]=r))}return e}function Wn(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Gn(e,t,n){if(e[t])return e[t];let[r,i]=T(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Kn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===c||t===Rn?n:(delete n.value,delete n.writable,n.get=()=>e[c][t],n)}function qn(e){oe()&&Gn(Wn(e,Rn),Bn)()}function Jn(e){return qn(e),Reflect.ownKeys(e)}var Yn={get(e,t,n){if(t===Ln)return e;if(t===c)return n;if(t===u)return qn(e),n;let r=Wn(e,Rn),i=r[t],a=i?i():e[t];if(t===Rn||t===zn||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);oe()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Gn(r,t,a)())}return Hn(a)?Vn(a):a},has(e,t){return t===Ln||t===c||t===u||t===Rn||t===zn||t===`__proto__`?!0:(oe()&&Gn(Wn(e,zn),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Jn,getOwnPropertyDescriptor:Kn};function Xn(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[zn]&&e[zn][t]&&i!==void 0&&e[zn][t].$()):(e[t]=n,e[zn]&&e[zn][t]&&i===void 0&&e[zn][t].$());let o=Wn(e,Rn),s;if((s=Gn(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Gn(o,`length`,a))&&s.$(e.length)}(s=o[Bn])&&s.$()}function Zn(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];Qn(i)||Xn(e,i,t[i])}}function Qn(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function $n(e,t){if(typeof t==`function`&&(t=t(e)),t=Un(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&Xn(e,n,r)}Xn(e,`length`,r)}else Zn(e,t)}function er(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&Qn(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)er(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&er(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)er(e,[r].concat(t),n);return}else if(t.length>1){er(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=Un(a),r===void 0||Hn(i)&&Hn(a)&&!Array.isArray(a)?Zn(i,a):Xn(e,r,a))}function tr(...[e,t]){let n=Un(e||{}),r=Array.isArray(n),i=Vn(n);function a(...e){A(()=>{r&&e.length===1?$n(n,e[0]):er(n,e)})}return[i,a]}var nr=Symbol(`store-root`);function rr(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function ir(e,t,n,r,i){if(rr(n))return;let a=t[n];if(e===a)return;let o=Array.isArray(e);if(n!==nr&&(!Hn(e)||!Hn(a)||o!==Array.isArray(a)||i&&e[i]!==a[i])){Xn(t,n,e);return}if(o){if(e.length&&a.length&&(!r||i&&e[0]&&e[0][i]!=null)){let t,n,o,s,c,l,u,d;for(o=0,s=Math.min(a.length,e.length);o<s&&(a[o]===e[o]||i&&a[o]&&e[o]&&a[o][i]&&a[o][i]===e[o][i]);o++)ir(e[o],a,o,r,i);let f=Array(e.length),p=new Map;for(s=a.length-1,c=e.length-1;s>=o&&c>=o&&(a[s]===e[c]||i&&a[s]&&e[c]&&a[s][i]&&a[s][i]===e[c][i]);s--,c--)f[c]=a[s];if(o>c||o>s){for(n=o;n<=c;n++)Xn(a,n,e[n]);for(;n<e.length;n++)Xn(a,n,f[n]),ir(e[n],a,n,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}for(u=Array(c+1),n=c;n>=o;n--)l=e[n],d=i&&l?l[i]:l,t=p.get(d),u[n]=t===void 0?-1:t,p.set(d,n);for(t=o;t<=s;t++)l=a[t],d=i&&l?l[i]:l,n=p.get(d),n!==void 0&&n!==-1&&(f[n]=a[t],n=u[n],p.set(d,n));for(n=o;n<e.length;n++)n in f?(Xn(a,n,f[n]),ir(e[n],a,n,r,i)):Xn(a,n,e[n])}else for(let t=0,n=e.length;t<n;t++)ir(e[t],a,t,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}let s=Object.keys(e);for(let t=0,n=s.length;t<n;t++)rr(s[t])||ir(e[s[t]],a,s[t],r,i);let c=Object.keys(a);for(let t=0,n=c.length;t<n;t++)e[c[t]]===void 0&&Xn(a,c[t],void 0)}function ar(e,t={}){let{merge:n,key:r=`id`}=t,i=Un(e);return e=>{if(!Hn(e)||!Hn(i))return i;let t=ir(i,{[nr]:e},nr,n,r);return t===void 0?e:t}}var or=ue(void 0),sr=e=>{if(e)return e;let t=de(or);if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t()},cr=e=>(E(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),ae(()=>e.client.unmount()),j(or.Provider,{value:()=>e.client,get children(){return e.children}})),lr=ue(()=>!1),ur=()=>de(lr);lr.Provider;function dr(e,t,n,r){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let i=t.data;if(e.data===void 0)try{i=structuredClone(i)}catch{}let a=ar(i,{key:n})(e.data);return{...t,data:a}}var fr=(e,t)=>t;function pr(e,t,n){let r=O(()=>sr(n?.())),i=ur(),a=O(()=>{let t=r().defaultQueryOptions(e());return t._optimisticResults=i()?`isRestoring`:`optimistic`,t.structuralSharing=!1,t}),o=a(),[s,c]=T(new t(r(),a())),l=s().getOptimisticResult(a()),[u,d]=tr(l),f=()=>s().subscribe(e=>{l=e,queueMicrotask(()=>{h&&v()})});function p(e){let t=s().options,n=t.reconcile;d(r=>dr(r,e,n!==void 0&&n,t.queryHash))}function m(){return[()=>u,e=>{let t=Un(u);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}p(e)}]}let h=null,g=null,[_,{refetch:v}]=k(()=>{let e=s();return new Promise((t,n)=>{if(g=t,!h&&!i()&&(h=f()),e.updateResult(),l.isError&&!l.isFetching&&!i()&&$t(e.options.throwOnError,[l.error,e.getCurrentQuery()]))return p(l),n(l.error);if(!l.isLoading)return g=null,t(fr(e.getCurrentQuery(),l));p(l)})},{storage:m,get deferStream(){return e().deferStream},onHydrated(e,t){if(t.value&&`hydrationData`in t.value&&on(r(),{queries:[{...t.value.hydrationData}]}),h)return;let n={...o};(o.staleTime||!o.initialData)&&t.value&&(n.refetchOnMount=!1),s().setOptions(n),p(s().getOptimisticResult(n)),h=f()}});return ee(re(r,e=>{h&&h();let n=new t(e,a());h=f(),c(n)},{defer:!0})),ee(re(i,e=>{e||v()},{defer:!0})),ae(()=>{h&&=(h(),null),g&&=(g(l),null)}),ee(re([s,a],([e,t])=>{e.setOptions(t),p(e.getOptimisticResult(t)),v()},{defer:!0})),new Proxy(u,{get(e,t){return t===`data`?u.data===void 0?_()?.data:_.latest?.data:Reflect.get(e,t)}})}function mr(e,t){return pr(O(()=>e()),Cn,t)}function hr(e,t){let n=new Pn(O(()=>sr(t?.()))(),e()),r=(e,t)=>{n.mutate(e,t).catch(At)},[i,a]=tr({...n.getCurrentResult(),mutate:r,mutateAsync:n.getCurrentResult().mutate});return ee(()=>{n.setOptions(e())}),ee(re(()=>i.status,()=>{if(i.isError&&$t(n.options.throwOnError,[i.error]))throw i.error})),ae(n.subscribe(e=>{a({...e,mutate:r,mutateAsync:e.mutate})})),i}var gr=class extends In{constructor(e={}){super(e)}},_r=mr,vr=hr,yr=`linear-grab:ui:`;function br(e,t){let n=t;try{let t=sessionStorage.getItem(yr+e);t!=null&&(n=JSON.parse(t))}catch{}let[r,i]=T(n);return D(()=>{let t=r();try{t==null||t===``||t===0||t===!1||Array.isArray(t)&&t.length===0?sessionStorage.removeItem(yr+e):sessionStorage.setItem(yr+e,JSON.stringify(t))}catch{}}),[r,i]}var xr,Sr=t((()=>{xr=typeof chrome<`u`&&!!chrome.runtime?.id&&!!chrome.storage?.local}));function Cr(e){for(let t of Lr)t(e)}function wr(e,t){try{let n=e.getItem(t);return n?JSON.parse(n):null}catch{return null}}async function Tr(){return xr?(await chrome.storage.local.get(Nr))[Nr]??{}:wr(localStorage,Fr)??{}}async function Er(e){let t={...await Tr(),...e};return xr?await chrome.storage.local.set({[Nr]:t}):(localStorage.setItem(Fr,JSON.stringify(t)),Cr(`settings`)),t}async function Dr(){if(xr){let e=(await chrome.storage.session.get(Pr))[Pr]??null;if(!e?.length)return e;let t=await chrome.storage.session.get(e.map(e=>zr(e.grabbedAt)));return e.map(e=>({...e,screenshotDataUrl:t[zr(e.grabbedAt)]??void 0}))}let e=wr(sessionStorage,Ir);return e?.length?e.map(e=>({...e,screenshotDataUrl:sessionStorage.getItem(zr(e.grabbedAt))??void 0})):e}async function Or(e){let t=e.map(({screenshotDataUrl:e,...t})=>t);if(xr){let n={};for(let t of e)t.screenshotDataUrl&&(n[zr(t.grabbedAt)]=t.screenshotDataUrl);await chrome.storage.session.set({[Pr]:t,...n})}else{for(let t of e)if(t.screenshotDataUrl)try{sessionStorage.setItem(zr(t.grabbedAt),t.screenshotDataUrl)}catch{}let n=new Set(t.map(e=>zr(e.grabbedAt)));for(let e=sessionStorage.length-1;e>=0;e--){let t=sessionStorage.key(e);t?.startsWith(Rr)&&!n.has(t)&&sessionStorage.removeItem(t)}sessionStorage.setItem(Ir,JSON.stringify(t)),Cr(`grab`)}}async function kr(e){let t=[...await Dr()??[]];for(let n of e){let e=t.findIndex(e=>e.grabbedAt===n.grabbedAt);if(e>=0){t[e]={...t[e],...n,screenshotDataUrl:n.screenshotDataUrl??t[e].screenshotDataUrl,source:n.source??t[e].source};continue}let r=e=>`${e.source?.filePath??``}:${e.source?.lineNumber??``}|${e.tagName??``}|${(e.content??``).trim().slice(0,80)}`,i=t[t.length-1];if(n.source?.filePath&&i&&r(i)===r(n)){t[t.length-1]={...i,...n};continue}t.push(n)}await Or(t.slice(-8))}async function Ar(e){await Or((await Dr()??[]).filter(t=>t.grabbedAt!==e))}async function jr(){xr?await chrome.storage.session.remove(Pr):(sessionStorage.removeItem(Ir),Cr(`grab`))}function Mr(e){if(xr){let t=(t,n)=>{n===`local`&&e(`settings`),n===`session`&&e(`grab`)};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}return Lr.add(e),()=>Lr.delete(e)}var Nr,Pr,Fr,Ir,Lr,Rr,zr,Br=t((()=>{Sr(),Nr=`settings`,Pr=`lastGrab`,Fr=`linear-grab:settings`,Ir=`linear-grab:last-grab`,Lr=new Set,Rr=`linear-grab:shot:`,zr=e=>`${Rr}${e}`}));function Vr(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}function Hr(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(Hr):typeof e==`object`&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Hr(t)))}function Ur(e){return Array.isArray(e)&&e.every(Hr)}function Wr(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Hr(t)))}var Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga=t((()=>{Gr=`vercel.ai.error`,Kr=Symbol.for(Gr),Yr=class e extends (Jr=Error,qr=Kr,Jr){constructor({name:e,message:t,cause:n}){super(t),this[qr]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Gr)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Xr=`AI_APICallError`,Zr=`vercel.ai.error.${Xr}`,Qr=Symbol.for(Zr),ti=class extends (ei=Yr,$r=Qr,ei){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:Xr,message:e,cause:o}),this[$r]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return Yr.hasMarker(e,Zr)}},ni=`AI_EmptyResponseBodyError`,ri=`vercel.ai.error.${ni}`,ii=Symbol.for(ri),si=class extends (oi=Yr,ai=ii,oi){constructor({message:e=`Empty response body`}={}){super({name:ni,message:e}),this[ai]=!0}static isInstance(e){return Yr.hasMarker(e,ri)}},ci=`AI_InvalidArgumentError`,li=`vercel.ai.error.${ci}`,ui=Symbol.for(li),pi=class extends (fi=Yr,di=ui,fi){constructor({message:e,cause:t,argument:n}){super({name:ci,message:e,cause:t}),this[di]=!0,this.argument=n}static isInstance(e){return Yr.hasMarker(e,li)}},mi=`AI_InvalidPromptError`,hi=`vercel.ai.error.${mi}`,gi=Symbol.for(hi),yi=class extends (vi=Yr,_i=gi,vi){constructor({prompt:e,message:t,cause:n}){super({name:mi,message:`Invalid prompt: ${t}`,cause:n}),this[_i]=!0,this.prompt=e}static isInstance(e){return Yr.hasMarker(e,hi)}},bi=`AI_InvalidResponseDataError`,xi=`vercel.ai.error.${bi}`,Si=Symbol.for(xi),Ti=class extends (wi=Yr,Ci=Si,wi){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:bi,message:t}),this[Ci]=!0,this.data=e}static isInstance(e){return Yr.hasMarker(e,xi)}},Ei=`AI_JSONParseError`,Di=`vercel.ai.error.${Ei}`,Oi=Symbol.for(Di),ji=class extends (Ai=Yr,ki=Oi,Ai){constructor({text:e,cause:t}){super({name:Ei,message:`JSON parsing failed: Text: ${e}.
1
+ (function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),r=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},i={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return a(this.context.count)},getNextContextId(){return a(this.context.count++)}};function a(e){let t=String(e),n=t.length-1;return i.context.id+(n?String.fromCharCode(96+n):``)+t}function o(e){i.context=e}var s=(e,t)=>e===t,c=Symbol(`solid-proxy`),l=typeof Proxy==`function`,u=Symbol(`solid-track`),d={equals:s},f=null,p=Se,m=1,h=2,g={owned:null,cleanups:null,context:null,owner:null},_={},v=null,y=null,b=null,x=null,S=null,C=0;function w(e,t){let n=b,r=v,i=e.length===0,a=t===void 0?r:t,o=i?g:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>ne(()=>Ee(o)));v=o,b=null;try{return be(s,!0)}finally{b=n,v=r}}function T(e,t){t=t?Object.assign({},d,t):d;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[me.bind(n),e=>(typeof e==`function`&&(e=y&&y.running&&y.sources.has(n)?e(n.tValue):e(n.value)),he(n,e))]}function E(e,t,n){ge(ve(e,t,!0,m))}function D(e,t,n){ge(ve(e,t,!1,m))}function O(e,t,n){p=Ce;let r=ve(e,t,!1,m),i=pe&&de(pe);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),S?S.push(r):ge(r)}function k(e,t,n){n=n?Object.assign({},d,n):d;let r=ve(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,ge(r),me.bind(r)}function ee(e){return e&&typeof e==`object`&&`then`in e}function te(e,t,n){let r,a,o;typeof t==`function`?(r=e,a=t,o=n||{}):(r=!0,a=e,o=t||{});let s=null,c=_,l=null,u=!1,d=!1,f=`initialValue`in o,p=typeof r==`function`&&k(r),m=new Set,[h,g]=(o.storage||T)(o.initialValue),[x,S]=T(void 0),[C,w]=T(void 0,{equals:!1}),[D,O]=T(f?`ready`:`unresolved`);v&&ae(()=>{for(let e of m.keys())e.decrement();m.clear(),y&&s&&y.promises.delete(s),s=null}),i.context&&(l=i.getNextContextId(),o.ssrLoadFrom===`initial`?c=o.initialValue:i.load&&i.has(l)&&(c=i.load(l)));function te(e,t,n,r){return s===e&&(s=null,r!==void 0&&(f=!0),(e===c||t===c)&&o.onHydrated&&queueMicrotask(()=>o.onHydrated(r,{value:t})),c=_,y&&e&&u?(y.promises.delete(e),u=!1,be(()=>{y.running=!0,A(t,n)},!1)):A(t,n)),t}function A(e,t){be(()=>{t===void 0&&g(()=>e),O(t===void 0?f?`ready`:`unresolved`:`errored`),S(t);for(let e of m.keys())e.decrement();m.clear()},!1)}function re(){let e=pe&&de(pe),t=h(),n=x();if(n!==void 0&&!s)throw n;return b&&!b.user&&e&&E(()=>{C(),s&&(e.resolved&&y&&u?y.promises.add(s):m.has(e)||(e.increment(),m.add(e)))}),t}function ie(e=!0){if(e!==!1&&d)return;d=!1;let t=p?p():r;if(u=y&&y.running,t==null||t===!1){te(s,ne(h));return}y&&s&&y.promises.delete(s);let n,i=c===_?ne(()=>{try{return a(t,{value:h(),refetching:e})}catch(e){n=e}}):c;if(n!==void 0){te(s,void 0,Oe(n),t);return}else if(!ee(i))return te(s,i,void 0,t),i;return s=i,`v`in i?(i.s===1?te(s,i.v,void 0,t):te(s,void 0,Oe(i.v),t),i):(d=!0,queueMicrotask(()=>d=!1),be(()=>{O(f?`refreshing`:`pending`),w()},!1),i.then(e=>te(i,e,void 0,t),e=>te(i,void 0,Oe(e),t)))}Object.defineProperties(re,{state:{get:()=>D()},error:{get:()=>x()},loading:{get(){let e=D();return e===`pending`||e===`refreshing`}},latest:{get(){if(!f)return re();let e=x();if(e&&!s)throw e;return h()}}});let oe=v;return p?E(()=>(oe=v,ie(!1))):ie(!1),[re,{refetch:e=>se(oe,()=>ie(e)),mutate:g}]}function A(e){return be(e,!1)}function ne(e){if(b===null)return e();let t=b;b=null;try{return e()}finally{b=t}}function re(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=ne(()=>t(o,i,n));return i=o,s}}function ie(e){O(()=>ne(e))}function ae(e){return v===null||(v.cleanups===null?v.cleanups=[e]:v.cleanups.push(e)),e}function oe(){return b}function se(e,t){let n=v,r=b;v=e,b=null;try{return be(t,!0)}catch(e){Ae(e)}finally{v=n,b=r}}var[ce,le]=T(!1);function ue(e,t){let n=Symbol(`context`);return{id:n,Provider:Me(n),defaultValue:e}}function de(e){let t;return v&&v.context&&(t=v.context[e.id])!==void 0?t:e.defaultValue}function fe(e){let t=k(e),n=k(()=>je(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}var pe;function me(){let e=y&&y.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===m)ge(this);else{let e=x;x=null,be(()=>we(this),!1),x=e}if(b){let e=this.observers;if(!e||e[e.length-1]!==b){let t=e?e.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(t)):(b.sources=[this],b.sourceSlots=[t]),e?(e.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}}return e&&y.sources.has(this)?this.tValue:this.value}function he(e,t,n){let r=y&&y.running&&y.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(y){let r=y.running;(r||!n&&y.sources.has(e))&&(y.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&be(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=y&&y.running;r&&y.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?x.push(n):S.push(n),n.observers&&Te(n)),r?n.tState=m:n.state=m)}if(x.length>1e6)throw x=[],Error()},!1)}return t}function ge(e){if(!e.fn)return;Ee(e);let t=C;_e(e,y&&y.running&&y.sources.has(e)?e.tValue:e.value,t),y&&!y.running&&y.sources.has(e)&&queueMicrotask(()=>{be(()=>{y&&(y.running=!0),b=v=e,_e(e,e.tValue,t),b=v=null},!1)})}function _e(e,t,n){let r,i=v,a=b;b=v=e;try{r=e.fn(t)}catch(t){return e.pure&&(y&&y.running?(e.tState=m,e.tOwned&&e.tOwned.forEach(Ee),e.tOwned=void 0):(e.state=m,e.owned&&e.owned.forEach(Ee),e.owned=null)),e.updatedAt=n+1,Ae(t)}finally{b=a,v=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?he(e,r,!0):y&&y.running&&e.pure?(y.sources.has(e)||(e.value=r),y.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function ve(e,t,n,r=m,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:v,context:v?v.context:null,pure:n};return y&&y.running&&(a.state=0,a.tState=r),v===null||v!==g&&(y&&y.running&&v.pure?v.tOwned?v.tOwned.push(a):v.tOwned=[a]:v.owned?v.owned.push(a):v.owned=[a]),a}function ye(e){let t=y&&y.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===h)return we(e);if(e.suspense&&ne(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<C);){if(t&&y.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(y.disposed.has(t))return}if((t?e.tState:e.state)===m)ge(e);else if((t?e.tState:e.state)===h){let t=x;x=null,be(()=>we(e,n[0]),!1),x=t}}}function be(e,t){if(x)return e();let n=!1;t||(x=[]),S?n=!0:S=[],C++;try{let t=e();return xe(n),t}catch(e){n||(S=null),x=null,Ae(e)}}function xe(e){if(x&&=(Se(x),null),e)return;let t;if(y){if(!y.promises.size&&!y.queue.size){let e=y.sources,n=y.disposed;S.push.apply(S,y.effects),t=y.resolve;for(let e of S)`tState`in e&&(e.state=e.tState),delete e.tState;y=null,be(()=>{for(let e of n)Ee(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)Ee(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}le(!1)},!1)}else if(y.running){y.running=!1,y.effects.push.apply(y.effects,S),S=null,le(!0);return}}let n=S;S=null,n.length&&be(()=>p(n),!1),t&&t()}function Se(e){for(let t=0;t<e.length;t++)ye(e[t])}function Ce(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:ye(r)}if(i.context){if(i.count){i.effects||=[],i.effects.push(...e.slice(0,n));return}o()}for(i.effects&&(i.done||!i.count)&&(e=[...i.effects,...e],n+=i.effects.length,delete i.effects),t=0;t<n;t++)ye(e[t])}function we(e,t){let n=y&&y.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===m?i!==t&&(!i.updatedAt||i.updatedAt<C)&&ye(i):e===h&&we(i,t)}}}function Te(e){let t=y&&y.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=h:r.state=h,r.pure?x.push(r):S.push(r),r.observers&&Te(r))}}function Ee(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)Ee(e.tOwned[t]);delete e.tOwned}if(y&&y.running&&e.pure)De(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)Ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}y&&y.running?e.tState=0:e.state=0}function De(e,t){if(t||(e.tState=0,y.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)De(e.owned[t])}function Oe(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ke(e,t,n){try{for(let n of t)n(e)}catch(e){Ae(e,n&&n.owner||null)}}function Ae(e,t=v){let n=f&&t&&t.context&&t.context[f],r=Oe(e);if(!n)throw r;S?S.push({fn(){ke(r,n,t)},state:m}):ke(r,n,t)}function je(e){if(typeof e==`function`&&!e.length)return je(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=je(e[n]);if(Array.isArray(r))if(r.length<32768)t.push.apply(t,r);else for(let e=0;e<r.length;e++)t.push(r[e]);else t.push(r)}return t}return e}function Me(e,t){return function(t){let n;return D(()=>n=ne(()=>(v.context={...v.context,[e]:t.value},fe(()=>t.children))),void 0),n}}var Ne=Symbol(`fallback`);function Pe(e){for(let t=0;t<e.length;t++)e[t]()}function Fe(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return ae(()=>Pe(a)),()=>{let c=e()||[],l=c.length,d,f;return c[u],ne(()=>{let e,t,u,m,h,g,_,v,y;if(l===0)o!==0&&(Pe(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),f=0;f<l;f++)r[f]=c[f],i[f]=w(p);o=l}else{for(u=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)u[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),f=v;f>=g;f--)y=c[f],d=e.get(y),t[f]=d===void 0?-1:d,e.set(y,f);for(d=g;d<=_;d++)y=r[d],f=e.get(y),f!==void 0&&f!==-1?(u[f]=i[d],m[f]=a[d],s&&(h[f]=s[d]),f=t[f],e.set(y,f)):a[d]();for(f=g;f<l;f++)f in u?(i[f]=u[f],a[f]=m[f],s&&(s[f]=h[f],s[f](f))):i[f]=w(p);i=i.slice(0,o=l),r=c.slice(0)}return i});function p(e){if(a[f]=e,s){let[e,n]=T(f);return s[f]=n,t(c[f],e)}return t(c[f])}}}function Ie(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return ae(()=>Pe(a)),()=>{let l=e()||[],d=l.length;return l[u],ne(()=>{if(d===0)return s!==0&&(Pe(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Ne],i[0]=w(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Ne&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<d;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=w(f));for(;c<r.length;c++)a[c]();return s=o.length=a.length=d,r=l.slice(0),i=i.slice(0,s)});function f(e){a[c]=e;let[n,r]=T(l[c]);return o[c]=r,t(n,c)}}}function j(e,t){return ne(()=>e(t||{}))}function Le(){return!0}var Re={get(e,t,n){return t===c?n:e.get(t)},has(e,t){return t===c||e.has(t)},set:Le,deleteProperty:Le,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Le,deleteProperty:Le}},ownKeys(e){return e.keys()}};function ze(e){return(e=typeof e==`function`?e():e)?e:{}}function Be(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function Ve(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&c in r,e[n]=typeof r==`function`?(t=!0,k(r)):r}if(l&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=ze(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ze(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ze(e[n])));return[...new Set(t)]}},Re);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:Be.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function He(e,...t){let n=t.length;if(l&&c in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},Re));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Re)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}var Ue=e=>`Stale read from <${e}>.`;function We(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Fe(()=>e.each,e.children,t||void 0))}function Ge(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return k(Ie(()=>e.each,e.children,t||void 0))}function M(e){let t=e.keyed,n=k(()=>e.when,void 0,void 0),r=t?n:k(n,void 0,{equals:(e,t)=>!e==!t});return k(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?ne(()=>a(t?i:()=>{if(!ne(r))throw Ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var Ke=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),qe=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),Je=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),Ye=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}});function Xe(e,t){let n=Ye[e];return typeof n==`object`?n[t]?n.$:void 0:n}var Ze=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),Qe={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},$e=e=>k(()=>e());function et(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}var tt=`_$DX_DELEGATE`;function nt(e,t,n,r={}){let i;return w(r=>{i=r,t===document?e():P(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function N(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>ne(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function rt(e,t=window.document){let n=t[tt]||(t[tt]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,yt))}}function it(e,t,n){ht(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function at(e,t,n,r){ht(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function ot(e,t,n){ht(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function st(e,t){ht(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function ct(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function lt(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(_t(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(_t(e,i,!0),n[i]=o)}return n}function ut(e,t,n){if(!t)return n?it(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function dt(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ft(e,t={},n,r){let i={};return r||D(()=>i.children=bt(e,t.children,i.children)),D(()=>typeof t.ref==`function`&&pt(t.ref,e)),D(()=>mt(e,t,n,!0,i,!0)),i}function pt(e,t,n){return ne(()=>e(t,n))}function P(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return bt(e,t,r,n);D(r=>bt(e,t(),r,n),r)}function mt(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=vt(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||bt(e,t.children);continue}let s=t[o];i[o]=vt(e,o,s,i[o],n,a,t)}}function ht(e){return!!i.context&&!i.done&&(!e||e.isConnected)}function gt(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function _t(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function vt(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return ut(e,n,r);if(t===`classList`)return lt(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=Ze.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(ct(e,i,n,a),a&&rt([i]))}else if(t.slice(0,5)===`attr:`)it(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)ot(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=qe.has(t))||!i&&((u=Xe(t,e.tagName))||(c=Ke.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(ht(e))return n;t===`class`||t===`className`?st(e,n):s&&!c&&!l?e[gt(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&Qe[t.split(`:`)[0]];r?at(e,r,t,n):it(e,Je[t]||t,n)}return n}function yt(e){if(i.registry&&i.events&&i.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,a=e.currentTarget,o=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),s=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&o(t.host),!0},c=()=>{for(;s()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),i.registry&&!i.done&&(i.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();o(n[0]);for(let e=0;e<n.length-2&&(t=n[e],s());e++){if(t._$host){t=t._$host,c();break}if(t.parentNode===a)break}}else c();o(r)}function bt(e,t,n,r,i){let a=ht(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Ct(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Ct(e,n,r)}else if(o===`function`)return D(()=>{let i=t();for(;typeof i==`function`;)i=i();n=bt(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(xt(o,t,n,i))return D(()=>n=bt(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Ct(e,n,r),s)return n}else c?n.length===0?St(e,o,r):et(e,n,o):(n&&Ct(e),St(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Ct(e,n,r,t);Ct(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function xt(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=xt(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=xt(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function St(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Ct(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var wt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tt=new class extends wt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Et={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Dt=new class{#e=Et;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Ot(e){setTimeout(e,0)}var kt=typeof window>`u`||`Deno`in globalThis;function At(){}function jt(e,t){return typeof e==`function`?e(t):e}function Mt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Nt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Pt(e,t){return typeof e==`function`?e(t):e}function Ft(e,t){return typeof e==`function`?e(t):e}function It(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==Rt(o,t.options))return!1}else if(!Bt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function Lt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zt(t.options.mutationKey)!==zt(a))return!1}else if(!Bt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Rt(e,t){return(t?.queryKeyHashFn||zt)(e)}function zt(e){return JSON.stringify(e,(e,t)=>Gt(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Bt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Bt(e[n],t[n])):!1}var Vt=Object.prototype.hasOwnProperty;function Ht(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Wt(e)&&Wt(t);if(!r&&!(Gt(e)&&Gt(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:Vt.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=Ht(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function Ut(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function Wt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Gt(e){if(!Kt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Kt(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function Kt(e){return Object.prototype.toString.call(e)===`[object Object]`}function qt(e){return new Promise(t=>{Dt.setTimeout(t,e)})}function Jt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Ht(e,t)}function Yt(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Xt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Zt=Symbol();function Qt(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Zt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $t(e,t){return typeof e==`function`?e(...t):!!e}function en(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tn=(()=>{let e=()=>kt;return{isServer(){return e()},setIsServer(t){e=t}}})();function nn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}function rn(e){let t;if(e.then(e=>(t=e,e),At)?.catch(At),t!==void 0)return{data:t}}function an(e){return e}function on(e,t,n){if(typeof t!=`object`||!t)return;let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData??an,o=t.mutations||[],s=t.queries||[];o.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),s.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?rn(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a(f),m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(At)})}var sn=Ot;function cn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=sn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var ln=cn(),un=new class extends wt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function dn(e){return Math.min(1e3*2**e,3e4)}function fn(e){return(e??`online`)!==`online`||un.isOnline()}var pn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function mn(e){let t=!1,n=0,r,i=nn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new pn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Tt.isFocused()&&(e.networkMode===`always`||un.isOnline())&&e.canRun(),u=()=>fn(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(tn.isServer()?0:3),o=e.retryDelay??dn,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),qt(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var hn=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Mt(this.gcTime)&&(this.#e=Dt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(tn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Dt.clearTimeout(this.#e),this.#e=void 0)}};function gn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{en(e,()=>t.signal,()=>n=!0)},u=Qt(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?Xt:Yt;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?vn:_n,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:_n(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function _n(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function vn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var yn=class extends hn{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sn(this.options);e.data!==void 0&&(this.setState(xn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=Jt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(At).catch(At):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ft(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Zt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>Pt(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Nt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Qt(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?gn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=mn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof pn&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof pn){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),ln.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:fn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cn=class extends wt{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=nn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return En(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return En(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Ft(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Ut(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||Pt(this.options.staleTime,this.#t)!==Pt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Ft(this.options.enabled,this.#t)!==Ft(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return kn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(At)),t}#g(){this.#b();let e=Pt(this.options.staleTime,this.#t);if(tn.isServer()||this.#r.isStale||!Mt(e))return;let t=Nt(this.#r.dataUpdatedAt,e)+1;this.#d=Dt.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(tn.isServer()||Ft(this.options.enabled,this.#t)===!1||!Mt(this.#p)||this.#p===0)&&(this.#f=Dt.setInterval(()=>{(this.options.refetchIntervalInBackground||Tt.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Dt.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Dt.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tn(e,t),o=i&&Dn(e,n,t,r);(a||o)&&(l={...l,...bn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Jt(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Jt(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:On(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Ft(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=nn();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!Ut(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){ln.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function wn(e,t){return Ft(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Ft(t.retryOnMount,e)===!1)}function Tn(e,t){return wn(e,t)||e.state.data!==void 0&&En(e,t,t.refetchOnMount)}function En(e,t,n){if(Ft(t.enabled,e)!==!1&&Pt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&On(e,t)}return!1}function Dn(e,t,n,r){return(e!==t||Ft(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&On(e,n)}function On(e,t){return Ft(t.enabled,e)!==!1&&e.isStaleByTime(Pt(t.staleTime,e))}function kn(e,t){return!Ut(e.getCurrentResult(),t)}var An=class extends hn{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=mn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),ln.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new An({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Nn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ln.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Lt(t,e))}findAll(e={}){return this.getAll().filter(t=>Lt(e,t))}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ln.batch(()=>Promise.all(e.map(e=>e.continue().catch(At))))}};function Nn(e){return e.options.scope?.id}var Pn=class extends wt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),Ut(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&zt(t.mutationKey)!==zt(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??jn();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){ln.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Fn=class extends wt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Rt(r,t),a=this.get(i);return a||(a=new yn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ln.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>It(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>It(e,t)):t}notify(e){ln.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ln.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ln.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},In=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Fn,this.#t=e.mutationCache||new Mn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Tt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=un.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Pt(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=jt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ln.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ln.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ln.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=ln.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(At).catch(At)}invalidateQueries(e,t={}){return ln.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ln.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(At)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(At)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Pt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(At).catch(At)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(At).catch(At)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return un.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Bt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Bt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Rt(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Zt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ln=Symbol(`store-raw`),Rn=Symbol(`store-node`),zn=Symbol(`store-has`),Bn=Symbol(`store-self`);function Vn(e){let t=e[c];if(!t&&(Object.defineProperty(e,c,{value:t=new Proxy(e,Yn)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),i=Object.getPrototypeOf(e),a=i!==null&&typeof e==`object`&&!!e&&!Array.isArray(e)&&i!==Object.prototype;if(a){let e=Object.getOwnPropertyDescriptors(i);n.push(...Object.keys(e)),Object.assign(r,e)}for(let i=0,o=n.length;i<o;i++){let o=n[i];a&&o===`constructor`||r[o].get&&Object.defineProperty(e,o,{configurable:!0,enumerable:r[o].enumerable,get:r[o].get.bind(t)})}}return t}function Hn(e){let t;return typeof e==`object`&&!!e&&(e[c]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function Un(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[Ln])return n;if(!Hn(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=Un(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=Un(i,t))!==i&&(e[a]=r))}return e}function Wn(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function Gn(e,t,n){if(e[t])return e[t];let[r,i]=T(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function Kn(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===c||t===Rn?n:(delete n.value,delete n.writable,n.get=()=>e[c][t],n)}function qn(e){oe()&&Gn(Wn(e,Rn),Bn)()}function Jn(e){return qn(e),Reflect.ownKeys(e)}var Yn={get(e,t,n){if(t===Ln)return e;if(t===c)return n;if(t===u)return qn(e),n;let r=Wn(e,Rn),i=r[t],a=i?i():e[t];if(t===Rn||t===zn||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);oe()&&(typeof a!=`function`||Object.prototype.hasOwnProperty.call(e,t))&&!(n&&n.get)&&(a=Gn(r,t,a)())}return Hn(a)?Vn(a):a},has(e,t){return t===Ln||t===c||t===u||t===Rn||t===zn||t===`__proto__`?!0:(oe()&&Gn(Wn(e,zn),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:Jn,getOwnPropertyDescriptor:Kn};function Xn(e,t,n,r=!1){if(t===`__proto__`||!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[zn]&&e[zn][t]&&i!==void 0&&e[zn][t].$()):(e[t]=n,e[zn]&&e[zn][t]&&i===void 0&&e[zn][t].$());let o=Wn(e,Rn),s;if((s=Gn(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=Gn(o,`length`,a))&&s.$(e.length)}(s=o[Bn])&&s.$()}function Zn(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];Qn(i)||Xn(e,i,t[i])}}function Qn(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function $n(e,t){if(typeof t==`function`&&(t=t(e)),t=Un(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&Xn(e,n,r)}Xn(e,`length`,r)}else Zn(e,t)}function er(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(a===`string`&&(r===`__proto__`||t.length>1&&Qn(r)))return;if(Array.isArray(r)){for(let i=0;i<r.length;i++)er(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&er(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)er(e,[r].concat(t),n);return}else if(t.length>1){er(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=Un(a),r===void 0||Hn(i)&&Hn(a)&&!Array.isArray(a)?Zn(i,a):Xn(e,r,a))}function tr(...[e,t]){let n=Un(e||{}),r=Array.isArray(n),i=Vn(n);function a(...e){A(()=>{r&&e.length===1?$n(n,e[0]):er(n,e)})}return[i,a]}var nr=Symbol(`store-root`);function rr(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function ir(e,t,n,r,i){if(rr(n))return;let a=t[n];if(e===a)return;let o=Array.isArray(e);if(n!==nr&&(!Hn(e)||!Hn(a)||o!==Array.isArray(a)||i&&e[i]!==a[i])){Xn(t,n,e);return}if(o){if(e.length&&a.length&&(!r||i&&e[0]&&e[0][i]!=null)){let t,n,o,s,c,l,u,d;for(o=0,s=Math.min(a.length,e.length);o<s&&(a[o]===e[o]||i&&a[o]&&e[o]&&a[o][i]&&a[o][i]===e[o][i]);o++)ir(e[o],a,o,r,i);let f=Array(e.length),p=new Map;for(s=a.length-1,c=e.length-1;s>=o&&c>=o&&(a[s]===e[c]||i&&a[s]&&e[c]&&a[s][i]&&a[s][i]===e[c][i]);s--,c--)f[c]=a[s];if(o>c||o>s){for(n=o;n<=c;n++)Xn(a,n,e[n]);for(;n<e.length;n++)Xn(a,n,f[n]),ir(e[n],a,n,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}for(u=Array(c+1),n=c;n>=o;n--)l=e[n],d=i&&l?l[i]:l,t=p.get(d),u[n]=t===void 0?-1:t,p.set(d,n);for(t=o;t<=s;t++)l=a[t],d=i&&l?l[i]:l,n=p.get(d),n!==void 0&&n!==-1&&(f[n]=a[t],n=u[n],p.set(d,n));for(n=o;n<e.length;n++)n in f?(Xn(a,n,f[n]),ir(e[n],a,n,r,i)):Xn(a,n,e[n])}else for(let t=0,n=e.length;t<n;t++)ir(e[t],a,t,r,i);a.length>e.length&&Xn(a,`length`,e.length);return}let s=Object.keys(e);for(let t=0,n=s.length;t<n;t++)rr(s[t])||ir(e[s[t]],a,s[t],r,i);let c=Object.keys(a);for(let t=0,n=c.length;t<n;t++)e[c[t]]===void 0&&Xn(a,c[t],void 0)}function ar(e,t={}){let{merge:n,key:r=`id`}=t,i=Un(e);return e=>{if(!Hn(e)||!Hn(i))return i;let t=ir(i,{[nr]:e},nr,n,r);return t===void 0?e:t}}var or=ue(void 0),sr=e=>{if(e)return e;let t=de(or);if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t()},cr=e=>(D(t=>(t?.(),e.client.mount(),e.client.unmount.bind(e.client))),ae(()=>e.client.unmount()),j(or.Provider,{value:()=>e.client,get children(){return e.children}})),lr=ue(()=>!1),ur=()=>de(lr);lr.Provider;function dr(e,t,n,r){if(n===!1)return t;if(typeof n==`function`){let r=n(e.data,t.data);return{...t,data:r}}let i=t.data;if(e.data===void 0)try{i=structuredClone(i)}catch{}let a=ar(i,{key:n})(e.data);return{...t,data:a}}var fr=(e,t)=>t;function pr(e,t,n){let r=k(()=>sr(n?.())),i=ur(),a=k(()=>{let t=r().defaultQueryOptions(e());return t._optimisticResults=i()?`isRestoring`:`optimistic`,t.structuralSharing=!1,t}),o=a(),[s,c]=T(new t(r(),a())),l=s().getOptimisticResult(a()),[u,d]=tr(l),f=()=>s().subscribe(e=>{l=e,queueMicrotask(()=>{h&&v()})});function p(e){let t=s().options,n=t.reconcile;d(r=>dr(r,e,n!==void 0&&n,t.queryHash))}function m(){return[()=>u,e=>{let t=Un(u);if(typeof e==`function`&&(e=e(t)),e?.hydrationData){let{hydrationData:t,...n}=e;e=n}p(e)}]}let h=null,g=null,[_,{refetch:v}]=te(()=>{let e=s();return new Promise((t,n)=>{if(g=t,!h&&!i()&&(h=f()),e.updateResult(),l.isError&&!l.isFetching&&!i()&&$t(e.options.throwOnError,[l.error,e.getCurrentQuery()]))return p(l),n(l.error);if(!l.isLoading)return g=null,t(fr(e.getCurrentQuery(),l));p(l)})},{storage:m,get deferStream(){return e().deferStream},onHydrated(e,t){if(t.value&&`hydrationData`in t.value&&on(r(),{queries:[{...t.value.hydrationData}]}),h)return;let n={...o};(o.staleTime||!o.initialData)&&t.value&&(n.refetchOnMount=!1),s().setOptions(n),p(s().getOptimisticResult(n)),h=f()}});return E(re(r,e=>{h&&h();let n=new t(e,a());h=f(),c(n)},{defer:!0})),E(re(i,e=>{e||v()},{defer:!0})),ae(()=>{h&&=(h(),null),g&&=(g(l),null)}),E(re([s,a],([e,t])=>{e.setOptions(t),p(e.getOptimisticResult(t)),v()},{defer:!0})),new Proxy(u,{get(e,t){return t===`data`?u.data===void 0?_()?.data:_.latest?.data:Reflect.get(e,t)}})}function mr(e,t){return pr(k(()=>e()),Cn,t)}function hr(e,t){let n=new Pn(k(()=>sr(t?.()))(),e()),r=(e,t)=>{n.mutate(e,t).catch(At)},[i,a]=tr({...n.getCurrentResult(),mutate:r,mutateAsync:n.getCurrentResult().mutate});return E(()=>{n.setOptions(e())}),E(re(()=>i.status,()=>{if(i.isError&&$t(n.options.throwOnError,[i.error]))throw i.error})),ae(n.subscribe(e=>{a({...e,mutate:r,mutateAsync:e.mutate})})),i}var gr=class extends In{constructor(e={}){super(e)}},_r=mr,vr=hr,yr=`linear-grab:ui:`;function br(e,t){let n=t;try{let t=sessionStorage.getItem(yr+e);t!=null&&(n=JSON.parse(t))}catch{}let[r,i]=T(n);return O(()=>{let t=r();try{t==null||t===``||t===0||t===!1||Array.isArray(t)&&t.length===0?sessionStorage.removeItem(yr+e):sessionStorage.setItem(yr+e,JSON.stringify(t))}catch{}}),[r,i]}var xr,Sr=t((()=>{xr=typeof chrome<`u`&&!!chrome.runtime?.id&&!!chrome.storage?.local}));function Cr(e){for(let t of Lr)t(e)}function wr(e,t){try{let n=e.getItem(t);return n?JSON.parse(n):null}catch{return null}}async function Tr(){return xr?(await chrome.storage.local.get(Nr))[Nr]??{}:wr(localStorage,Fr)??{}}async function Er(e){let t={...await Tr(),...e};return xr?await chrome.storage.local.set({[Nr]:t}):(localStorage.setItem(Fr,JSON.stringify(t)),Cr(`settings`)),t}async function Dr(){if(xr){let e=(await chrome.storage.session.get(Pr))[Pr]??null;if(!e?.length)return e;let t=await chrome.storage.session.get(e.map(e=>zr(e.grabbedAt)));return e.map(e=>({...e,screenshotDataUrl:t[zr(e.grabbedAt)]??void 0}))}let e=wr(sessionStorage,Ir);return e?.length?e.map(e=>({...e,screenshotDataUrl:sessionStorage.getItem(zr(e.grabbedAt))??void 0})):e}async function Or(e){let t=e.map(({screenshotDataUrl:e,...t})=>t);if(xr){let n={};for(let t of e)t.screenshotDataUrl&&(n[zr(t.grabbedAt)]=t.screenshotDataUrl);await chrome.storage.session.set({[Pr]:t,...n})}else{for(let t of e)if(t.screenshotDataUrl)try{sessionStorage.setItem(zr(t.grabbedAt),t.screenshotDataUrl)}catch{}let n=new Set(t.map(e=>zr(e.grabbedAt)));for(let e=sessionStorage.length-1;e>=0;e--){let t=sessionStorage.key(e);t?.startsWith(Rr)&&!n.has(t)&&sessionStorage.removeItem(t)}sessionStorage.setItem(Ir,JSON.stringify(t)),Cr(`grab`)}}async function kr(e){let t=[...await Dr()??[]];for(let n of e){let e=t.findIndex(e=>e.grabbedAt===n.grabbedAt);if(e>=0){t[e]={...t[e],...n,screenshotDataUrl:n.screenshotDataUrl??t[e].screenshotDataUrl,source:n.source??t[e].source};continue}let r=e=>`${e.source?.filePath??``}:${e.source?.lineNumber??``}|${e.tagName??``}|${(e.content??``).trim().slice(0,80)}`,i=t[t.length-1];if(n.source?.filePath&&i&&r(i)===r(n)){t[t.length-1]={...i,...n};continue}t.push(n)}await Or(t.slice(-8))}async function Ar(e){await Or((await Dr()??[]).filter(t=>t.grabbedAt!==e))}async function jr(){xr?await chrome.storage.session.remove(Pr):(sessionStorage.removeItem(Ir),Cr(`grab`))}function Mr(e){if(xr){let t=(t,n)=>{n===`local`&&e(`settings`),n===`session`&&e(`grab`)};return chrome.storage.onChanged.addListener(t),()=>chrome.storage.onChanged.removeListener(t)}return Lr.add(e),()=>Lr.delete(e)}var Nr,Pr,Fr,Ir,Lr,Rr,zr,Br=t((()=>{Sr(),Nr=`settings`,Pr=`lastGrab`,Fr=`linear-grab:settings`,Ir=`linear-grab:last-grab`,Lr=new Set,Rr=`linear-grab:shot:`,zr=e=>`${Rr}${e}`}));function Vr(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.toString():JSON.stringify(e)}function Hr(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?!0:Array.isArray(e)?e.every(Hr):typeof e==`object`&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Hr(t)))}function Ur(e){return Array.isArray(e)&&e.every(Hr)}function Wr(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&(t===void 0||Hr(t)))}var Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga=t((()=>{Gr=`vercel.ai.error`,Kr=Symbol.for(Gr),Yr=class e extends (Jr=Error,qr=Kr,Jr){constructor({name:e,message:t,cause:n}){super(t),this[qr]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Gr)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}},Xr=`AI_APICallError`,Zr=`vercel.ai.error.${Xr}`,Qr=Symbol.for(Zr),ti=class extends (ei=Yr,$r=Qr,ei){constructor({message:e,url:t,requestBodyValues:n,statusCode:r,responseHeaders:i,responseBody:a,cause:o,isRetryable:s=r!=null&&(r===408||r===409||r===429||r>=500),data:c}){super({name:Xr,message:e,cause:o}),this[$r]=!0,this.url=t,this.requestBodyValues=n,this.statusCode=r,this.responseHeaders=i,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return Yr.hasMarker(e,Zr)}},ni=`AI_EmptyResponseBodyError`,ri=`vercel.ai.error.${ni}`,ii=Symbol.for(ri),si=class extends (oi=Yr,ai=ii,oi){constructor({message:e=`Empty response body`}={}){super({name:ni,message:e}),this[ai]=!0}static isInstance(e){return Yr.hasMarker(e,ri)}},ci=`AI_InvalidArgumentError`,li=`vercel.ai.error.${ci}`,ui=Symbol.for(li),pi=class extends (fi=Yr,di=ui,fi){constructor({message:e,cause:t,argument:n}){super({name:ci,message:e,cause:t}),this[di]=!0,this.argument=n}static isInstance(e){return Yr.hasMarker(e,li)}},mi=`AI_InvalidPromptError`,hi=`vercel.ai.error.${mi}`,gi=Symbol.for(hi),yi=class extends (vi=Yr,_i=gi,vi){constructor({prompt:e,message:t,cause:n}){super({name:mi,message:`Invalid prompt: ${t}`,cause:n}),this[_i]=!0,this.prompt=e}static isInstance(e){return Yr.hasMarker(e,hi)}},bi=`AI_InvalidResponseDataError`,xi=`vercel.ai.error.${bi}`,Si=Symbol.for(xi),Ti=class extends (wi=Yr,Ci=Si,wi){constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:bi,message:t}),this[Ci]=!0,this.data=e}static isInstance(e){return Yr.hasMarker(e,xi)}},Ei=`AI_JSONParseError`,Di=`vercel.ai.error.${Ei}`,Oi=Symbol.for(Di),ji=class extends (Ai=Yr,ki=Oi,Ai){constructor({text:e,cause:t}){super({name:Ei,message:`JSON parsing failed: Text: ${e}.
2
2
  Error message: ${Vr(t)}`,cause:t}),this[ki]=!0,this.text=e}static isInstance(e){return Yr.hasMarker(e,Di)}},Mi=`AI_LoadAPIKeyError`,Ni=`vercel.ai.error.${Mi}`,Pi=Symbol.for(Ni),Li=class extends (Ii=Yr,Fi=Pi,Ii){constructor({message:e}){super({name:Mi,message:e}),this[Fi]=!0}static isInstance(e){return Yr.hasMarker(e,Ni)}},Ri=`AI_LoadSettingError`,`${Ri}`,zi=`AI_NoContentGeneratedError`,`${zi}`,Bi=`AI_NoSuchModelError`,Vi=`vercel.ai.error.${Bi}`,Hi=Symbol.for(Vi),Gi=class extends (Wi=Yr,Ui=Hi,Wi){constructor({errorName:e=Bi,modelId:t,modelType:n,message:r=`No such ${n}: ${t}`}){super({name:e,message:r}),this[Ui]=!0,this.modelId=t,this.modelType=n}static isInstance(e){return Yr.hasMarker(e,Vi)}},Ki=`AI_NoSuchProviderReferenceError`,qi=`vercel.ai.error.${Ki}`,Ji=Symbol.for(qi),Zi=class extends (Xi=Yr,Yi=Ji,Xi){constructor({provider:e,reference:t,message:n=`No provider reference found for provider '${e}'. Available providers: ${Object.keys(t).join(`, `)}`}){super({name:Ki,message:n}),this[Yi]=!0,this.provider=e,this.reference=t}static isInstance(e){return Yr.hasMarker(e,qi)}},Qi=`AI_TooManyEmbeddingValuesForCallError`,$i=`vercel.ai.error.${Qi}`,ea=Symbol.for($i),ra=class extends (na=Yr,ta=ea,na){constructor(e){super({name:Qi,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[ta]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return Yr.hasMarker(e,$i)}},ia=`AI_TypeValidationError`,aa=`vercel.ai.error.${ia}`,oa=Symbol.for(aa),la=class e extends (ca=Yr,sa=oa,ca){constructor({value:e,cause:t,context:n}){let r=`Type validation failed`;if(n?.field&&(r+=` for ${n.field}`),n?.entityName||n?.entityId){r+=` (`;let e=[];n.entityName&&e.push(n.entityName),n.entityId&&e.push(`id: "${n.entityId}"`),r+=e.join(`, `),r+=`)`}super({name:ia,message:`${r}: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${Vr(t)}`,cause:t}),this[sa]=!0,this.value=e,this.context=n}static isInstance(e){return Yr.hasMarker(e,aa)}static wrap({value:t,cause:n,context:r}){return e.isInstance(n)&&n.value===t&&n.context?.field===r?.field&&n.context?.entityName===r?.entityName&&n.context?.entityId===r?.entityId?n:new e({value:t,cause:n,context:r})}},ua=`AI_UnsupportedFunctionalityError`,da=`vercel.ai.error.${ua}`,fa=Symbol.for(da),ha=class extends (ma=Yr,pa=fa,ma){constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:ua,message:t}),this[pa]=!0,this.functionality=e}static isInstance(e){return Yr.hasMarker(e,da)}}}));function F(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}function _a(e){return e&&Object.assign(ya,e),ya}var va,ya,ba=t((()=>{Object.freeze({status:`aborted`}),va=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ya={}}));function xa(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Sa(e,t){return typeof t==`bigint`?t.toString():t}function Ca(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function wa(e){return e==null}function Ta(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ea(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function Da(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Oa(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ka(e){return JSON.stringify(e)}function Aa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ja(e){if(Aa(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Aa(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ma(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Na(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Pa(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Fa(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}function Ia(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return Na(e,{...e._zod.def,shape:n,checks:[]})}function La(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return Na(e,{...e._zod.def,shape:n,checks:[]})}function Ra(e,t){if(!ja(t))throw Error(`Invalid input to extend: expected a plain object`);return Na(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Oa(this,`shape`,n),n},checks:[]})}function za(e,t){return Na(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Oa(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function Ba(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Na(t,{...t._zod.def,shape:i,checks:[]})}function Va(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Na(t,{...t._zod.def,shape:i,checks:[]})}function Ha(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ua(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Wa(e){return typeof e==`string`?e:e?.message}function Ga(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Wa(e.inst?._zod.def?.error?.(e))??Wa(t?.error?.(e))??Wa(n.customError?.(e))??Wa(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ka(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function qa(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ja,Ya,Xa,Za,Qa=t((()=>{Ja=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{},Ya=Ca(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),Xa=new Set([`string`,`number`,`symbol`]),Za={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}}));function $a(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function eo(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}var to,no,ro,io=t((()=>{ba(),Qa(),to=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Sa,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},no=F(`$ZodError`,to),ro=F(`$ZodError`,to,{Parent:Error})})),ao,oo,so,co,lo,uo,fo=t((()=>{ba(),io(),Qa(),ao=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new va;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ga(e,a,_a())));throw Ja(t,i?.callee),t}return o.value},oo=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>Ga(e,a,_a())));throw Ja(t,i?.callee),t}return o.value},so=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new va;return a.issues.length?{success:!1,error:new(e??no)(a.issues.map(e=>Ga(e,i,_a())))}:{success:!0,data:a.value}},co=so(ro),lo=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ga(e,i,_a())))}:{success:!0,data:a.value}},uo=lo(ro)}));function po(){return new RegExp(Do,`u`)}function mo(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ho(e){return RegExp(`^${mo(e)}$`)}function go(e){let t=mo({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Io}T(?:${r})$`)}var _o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go=t((()=>{_o=/^[cC][^\s-]{8,}$/,vo=/^[0-9a-z]+$/,yo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bo=/^[0-9a-vA-V]{20}$/,xo=/^[A-Za-z0-9]{27}$/,So=/^[a-zA-Z0-9_-]{21}$/,Co=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,wo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,To=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Eo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Do=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,Oo=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ko=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Ao=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jo=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mo=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,No=/^[A-Za-z0-9_-]*$/,Po=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Fo=/^\+(?:[0-9]){6,14}[0-9]$/,Io=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Lo=RegExp(`^${Io}$`),Ro=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},zo=/^\d+$/,Bo=/^-?\d+(?:\.\d+)?/i,Vo=/true|false/i,Ho=/null/i,Uo=/^[^A-Z]*$/,Wo=/^[^a-z]*$/})),Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls=t((()=>{ba(),Go(),Qa(),Ko=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qo={number:`number`,bigint:`bigint`,object:`date`},Jo=F(`$ZodCheckLessThan`,(e,t)=>{Ko.init(e,t);let n=qo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Yo=F(`$ZodCheckGreaterThan`,(e,t)=>{Ko.init(e,t);let n=qo[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xo=F(`$ZodCheckMultipleOf`,(e,t)=>{Ko.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ea(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Zo=F(`$ZodCheckNumberFormat`,(e,t)=>{Ko.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Za[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=zo)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),Qo=F(`$ZodCheckMaxLength`,(e,t)=>{var n;Ko.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ka(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$o=F(`$ZodCheckMinLength`,(e,t)=>{var n;Ko.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ka(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),es=F(`$ZodCheckLengthEquals`,(e,t)=>{var n;Ko.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wa(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ka(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ts=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Ko.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ns=F(`$ZodCheckRegex`,(e,t)=>{ts.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rs=F(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Uo,ts.init(e,t)}),is=F(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Wo,ts.init(e,t)}),as=F(`$ZodCheckIncludes`,(e,t)=>{Ko.init(e,t);let n=Ma(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),os=F(`$ZodCheckStartsWith`,(e,t)=>{Ko.init(e,t);let n=RegExp(`^${Ma(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ss=F(`$ZodCheckEndsWith`,(e,t)=>{Ko.init(e,t);let n=RegExp(`.*${Ma(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),cs=F(`$ZodCheckOverwrite`,(e,t)=>{Ko.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),us,ds=t((()=>{us=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
4
4
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
@@ -50,8 +50,8 @@ ${e}
50
50
 
51
51
  `;break}case`tool`:throw new ha({functionality:`tool messages`});default:throw Error(`Unsupported role: ${i}`)}return r+=`${n}:
52
52
  `,{prompt:r,stopSequences:[`
53
- ${t}:`]}}function __({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n==null?void 0:new Date(n*1e3)}}function v_(e){switch(e){case`stop`:return`stop`;case`length`:return`length`;case`content_filter`:return`content-filter`;case`function_call`:case`tool_calls`:return`tool-calls`;default:return`other`}}function y_(e){return!(`error`in e)&&e.choices.some(e=>e.text.length>0)}function b_(e){return Dv.some(t=>e.startsWith(t))}function x_(e,t,n){if(e==null)return{};let r={};if(e.image_tokens!=null){let i=Math.floor(e.image_tokens/n),a=e.image_tokens-i*(n-1);r.imageTokens=t===n-1?a:i}if(e.text_tokens!=null){let i=Math.floor(e.text_tokens/n),a=e.text_tokens-i*(n-1);r.textTokens=t===n-1?a:i}return r}async function S_(e){if(!e)return;if(e.type===`url`)return mm(e.url);let t=e.data instanceof Uint8Array?e.data:Kp(e.data);return new Blob([t],{type:e.mediaType})}function C_(e){let t=e,n=t.type;switch(n){case`session.created`:return{type:`session-created`,sessionId:t.session?.id,raw:e};case`session.updated`:return{type:`session-updated`,raw:e};case`input_audio_buffer.speech_started`:return{type:`speech-started`,itemId:t.item_id,raw:e};case`input_audio_buffer.speech_stopped`:return{type:`speech-stopped`,itemId:t.item_id,raw:e};case`input_audio_buffer.committed`:return{type:`audio-committed`,itemId:t.item_id,previousItemId:t.previous_item_id,raw:e};case`conversation.item.added`:return{type:`conversation-item-added`,itemId:t.item?.id??t.item_id,item:t.item,raw:e};case`conversation.item.input_audio_transcription.completed`:return{type:`input-transcription-completed`,itemId:t.item_id,transcript:t.transcript??``,raw:e};case`response.created`:return{type:`response-created`,responseId:t.response?.id??t.response_id,raw:e};case`response.done`:return{type:`response-done`,responseId:t.response?.id??t.response_id,status:t.response?.status??`completed`,raw:e};case`response.output_item.added`:return{type:`output-item-added`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.output_item.done`:return{type:`output-item-done`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.content_part.added`:return{type:`content-part-added`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.content_part.done`:return{type:`content-part-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio.delta`:return{type:`audio-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio.done`:return{type:`audio-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio_transcript.delta`:return{type:`audio-transcript-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio_transcript.done`:return{type:`audio-transcript-done`,responseId:t.response_id,itemId:t.item_id,transcript:t.transcript,raw:e};case`response.output_text.delta`:return{type:`text-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_text.done`:return{type:`text-done`,responseId:t.response_id,itemId:t.item_id,text:t.text,raw:e};case`response.function_call_arguments.delta`:return{type:`function-call-arguments-delta`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,delta:t.delta,raw:e};case`response.function_call_arguments.done`:return{type:`function-call-arguments-done`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,name:t.name,arguments:t.arguments,raw:e};case`error`:return{type:`error`,message:t.error?.message??t.message??`Unknown error`,code:t.error?.code??t.code,raw:e};default:return{type:`custom`,rawType:n,raw:e}}}function w_(e,t){switch(e.type){case`session-update`:return{type:`session.update`,session:T_(e.config,t)};case`input-audio-append`:return{type:`input_audio_buffer.append`,audio:e.audio};case`input-audio-commit`:return{type:`input_audio_buffer.commit`};case`input-audio-clear`:return{type:`input_audio_buffer.clear`};case`conversation-item-create`:{let t=e.item;switch(t.type){case`text-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_text`,text:t.text}]}};case`audio-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_audio`,audio:t.audio}]}};case`function-call-output`:return{type:`conversation.item.create`,item:{type:`function_call_output`,call_id:t.callId,output:t.output}}}break}case`conversation-item-truncate`:return{type:`conversation.item.truncate`,item_id:e.itemId,content_index:e.contentIndex,audio_end_ms:e.audioEndMs};case`response-create`:return{type:`response.create`,...e.options==null?{}:{response:{...e.options.modalities==null?{}:{output_modalities:e.options.modalities},...e.options.instructions==null?{}:{instructions:e.options.instructions},...e.options.metadata==null?{}:{metadata:e.options.metadata}}}};case`response-cancel`:return{type:`response.cancel`}}}function T_(e,t){let n={type:`realtime`,model:t};e.instructions!=null&&(n.instructions=e.instructions),e.outputModalities!=null&&(n.output_modalities=e.outputModalities);let r={};if(e.inputAudioFormat!=null||e.inputAudioTranscription!=null||e.turnDetection!=null){let t={};if(e.inputAudioFormat!=null&&(t.format={type:e.inputAudioFormat.type,...e.inputAudioFormat.rate==null?{}:{rate:e.inputAudioFormat.rate}}),e.turnDetection!=null)if(e.turnDetection.type===`disabled`)t.turn_detection=null;else{let n={type:e.turnDetection.type===`server-vad`?`server_vad`:`semantic_vad`};e.turnDetection.threshold!=null&&(n.threshold=e.turnDetection.threshold),e.turnDetection.silenceDurationMs!=null&&(n.silence_duration_ms=e.turnDetection.silenceDurationMs),e.turnDetection.prefixPaddingMs!=null&&(n.prefix_padding_ms=e.turnDetection.prefixPaddingMs),t.turn_detection=n}e.inputAudioTranscription!=null&&(t.transcription={model:e.inputAudioTranscription.model??`gpt-realtime-whisper`,...e.inputAudioTranscription.language==null?{}:{language:e.inputAudioTranscription.language},...e.inputAudioTranscription.prompt==null?{}:{prompt:e.inputAudioTranscription.prompt}}),r.input=t}if(e.outputAudioFormat!=null||e.voice!=null){let t={};e.outputAudioFormat!=null&&(t.format={type:e.outputAudioFormat.type,...e.outputAudioFormat.rate==null?{}:{rate:e.outputAudioFormat.rate}}),e.voice!=null&&(t.voice=e.voice),r.output=t}return Object.keys(r).length>0&&(n.audio=r),e.tools!=null&&e.tools.length>0&&(n.tools=e.tools.map(e=>({type:e.type,name:e.name,description:e.description,parameters:e.parameters})),n.tool_choice=`auto`),e.providerOptions!=null&&Object.assign(n,e.providerOptions),n}function E_(e){if(e==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let t=e.input_tokens,n=e.output_tokens,r=e.input_tokens_details?.cached_tokens??0,i=e.input_tokens_details?.cache_write_tokens??void 0,a=e.output_tokens_details?.reasoning_tokens??0;return{inputTokens:{total:t,noCache:t-r-(i??0),cacheRead:r,cacheWrite:i},outputTokens:{total:n,text:n-a,reasoning:a},raw:e}}function D_(e){return JSON.stringify(e===void 0?{}:e)}function O_(e,t){return e?.[t]?.promptCacheBreakpoint}function k_(e,t){return t?t.some(t=>e.startsWith(t)):!1}async function A_({prompt:e,toolNameMapping:t,systemMessageMode:n,providerOptionsName:r,fileIdPrefixes:i,passThroughUnsupportedFiles:a=!1,store:o,hasConversation:s=!1,hasPreviousResponseId:c=!1,hasLocalShellTool:l=!1,hasShellTool:u=!1,hasApplyPatchTool:d=!1,customProviderToolNames:f}){let p=[],m=[],h=new Set;for(let{role:g,content:_,providerOptions:v}of e)switch(g){case`system`:switch(n){case`system`:{let e=O_(v,r);p.push({role:`system`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`developer`:{let e=O_(v,r);p.push({role:`developer`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`remove`:m.push({type:`other`,message:`system messages are removed for this model`});break;default:throw Error(`Unsupported system message mode: ${n}`)}break;case`user`:p.push({role:`user`,content:_.map((e,t)=>{switch(e.type){case`text`:{let t=O_(e.providerOptions,r);return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}}}case`file`:{let n=O_(e.providerOptions,r);switch(e.data.type){case`reference`:{let t=Ih({reference:e.data.reference,provider:r});return rm(e.mediaType)===`image`?{type:`input_image`,file_id:t,detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}}:{type:`input_file`,file_id:t,...n!=null&&{prompt_cache_breakpoint:n}}}case`text`:throw new ha({functionality:`text file parts`});case`url`:case`data`:if(rm(e.mediaType)===`image`)return{type:`input_image`,...e.data.type===`url`?{image_url:e.data.url.toString()}:typeof e.data.data==`string`&&k_(e.data.data,i)?{file_id:e.data.data}:{image_url:`data:${Fh({part:e})};base64,${Jp(e.data.data)}`},detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}};{if(e.data.type===`url`)return{type:`input_file`,file_url:e.data.url.toString(),...n!=null&&{prompt_cache_breakpoint:n}};let r=Fh({part:e});if(r!==`application/pdf`&&!a)throw new ha({functionality:`file part media type ${r}`});return{type:`input_file`,...typeof e.data.data==`string`&&k_(e.data.data,i)?{file_id:e.data.data}:{filename:e.filename??(r===`application/pdf`?`part-${t}.pdf`:`part-${t}`),file_data:`data:${r};base64,${Jp(e.data.data)}`},...n!=null&&{prompt_cache_breakpoint:n}}}}}}})});break;case`assistant`:{let e={};for(let n of _)switch(n.type){case`text`:{let e=n.providerOptions?.[r],t=e?.itemId,i=e?.phase;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}p.push({role:`assistant`,content:[{type:`output_text`,text:n.text}],id:t,...i!=null&&{phase:i}});break}case`tool-call`:{let e=n.providerOptions?.[r]?.itemId??n.providerMetadata?.[r]?.itemId,i=n.providerOptions?.[r]?.namespace??n.providerMetadata?.[r]?.namespace;if(s&&e!=null)break;let a=t.toProviderToolName(n.toolName);if(a===`tool_search`){if(o&&e!=null){p.push({type:`item_reference`,id:e});break}let t=typeof n.input==`string`?await Eh({text:n.input,schema:oy}):await wh({value:n.input,schema:oy}),r=t.call_id==null?`server`:`client`;p.push({type:`tool_search_call`,id:e??n.toolCallId,execution:r,call_id:t.call_id??null,status:`completed`,arguments:t.arguments});break}if(n.providerExecuted){o&&e!=null&&p.push({type:`item_reference`,id:e});break}if(c&&o&&e!=null)break;let m=l&&a===`local_shell`||u&&a===`shell`||d&&a===`apply_patch`||(f?.has(a)??!1);if(o&&e!=null&&m){p.push({type:`item_reference`,id:e});break}if(l&&a===`local_shell`){let t=await wh({value:n.input,schema:Zv});p.push({type:`local_shell_call`,call_id:n.toolCallId,id:e,action:{type:`exec`,command:t.action.command,timeout_ms:t.action.timeoutMs,user:t.action.user,working_directory:t.action.workingDirectory,env:t.action.env}});break}if(u&&a===`shell`){let t=await wh({value:n.input,schema:ey});p.push({type:`shell_call`,call_id:n.toolCallId,id:e,status:`completed`,action:{commands:t.action.commands,timeout_ms:t.action.timeoutMs,max_output_length:t.action.maxOutputLength}});break}if(d&&a===`apply_patch`){let t=await wh({value:n.input,schema:Mv});p.push({type:`apply_patch_call`,call_id:t.callId,id:e,status:`completed`,operation:t.operation});break}if(f?.has(a)){p.push({type:`custom_tool_call`,call_id:n.toolCallId,name:a,input:typeof n.input==`string`?n.input:JSON.stringify(n.input),id:e});break}p.push({type:`function_call`,call_id:n.toolCallId,name:a,arguments:D_(n.input),...i!=null&&{namespace:i}});break}case`tool-result`:{if(n.output.type===`execution-denied`||n.output.type===`json`&&typeof n.output.value==`object`&&n.output.value!=null&&`type`in n.output.value&&n.output.value.type===`execution-denied`||s)break;let e=t.toProviderToolName(n.toolName);if(e===`tool_search`){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;if(o)p.push({type:`item_reference`,id:e});else if(n.output.type===`json`){let t=await wh({value:n.output.value,schema:sy});p.push({type:`tool_search_output`,id:e,execution:`server`,call_id:null,status:`completed`,tools:t.tools})}break}if(u&&e===`shell`){if(n.output.type===`json`){let e=await wh({value:n.output.value,schema:ty});p.push({type:`shell_call_output`,call_id:n.toolCallId,output:e.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))})}break}if(o){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;p.push({type:`item_reference`,id:e})}else m.push({type:`other`,message:`Results for OpenAI tool ${n.toolName} are not sent to the API when store is false`});break}case`reasoning`:{let t=await kh({provider:r,providerOptions:n.providerOptions,schema:xy}),i=t?.itemId;if((s||c)&&i!=null)break;if(i!=null){let r=e[i];if(o)r===void 0&&(p.push({type:`item_reference`,id:i}),e[i]={type:`reasoning`,id:i,summary:[]});else{let a=[];n.text.length>0?a.push({type:`summary_text`,text:n.text}):r!==void 0&&m.push({type:`other`,message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(n)}.`}),r===void 0?(e[i]={type:`reasoning`,id:i,encrypted_content:t?.reasoningEncryptedContent,summary:a},p.push(e[i])):(r.summary.push(...a),t?.reasoningEncryptedContent!=null&&(r.encrypted_content=t.reasoningEncryptedContent))}}else{let e=t?.reasoningEncryptedContent;if(e!=null){let t=[];n.text.length>0&&t.push({type:`summary_text`,text:n.text}),p.push({type:`reasoning`,encrypted_content:e,summary:t})}else m.push({type:`other`,message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(n)}.`})}break}case`custom`:if(n.kind===`openai.compaction`){let e=n.providerOptions?.[r],t=e?.itemId;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}let i=e?.encryptedContent;t!=null&&p.push({type:`compaction`,id:t,encrypted_content:i})}break}break}case`tool`:for(let e of _){if(e.type===`tool-approval-response`){let t=e;if(h.has(t.approvalId))continue;h.add(t.approvalId),o&&p.push({type:`item_reference`,id:t.approvalId}),p.push({type:`mcp_approval_response`,approval_request_id:t.approvalId,approve:t.approved});continue}let n=e.output;if(n.type===`execution-denied`&&n.providerOptions?.openai?.approvalId)continue;let i=t.toProviderToolName(e.toolName);if(i===`tool_search`&&n.type===`json`){let t=await wh({value:n.value,schema:sy});p.push({type:`tool_search_output`,execution:`client`,call_id:e.toolCallId,status:`completed`,tools:t.tools});continue}if(l&&i===`local_shell`&&n.type===`json`){let t=await wh({value:n.value,schema:Qv});p.push({type:`local_shell_call_output`,call_id:e.toolCallId,output:t.output});continue}if(u&&i===`shell`&&n.type===`json`){let t=await wh({value:n.value,schema:ty});p.push({type:`shell_call_output`,call_id:e.toolCallId,output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))});continue}if(d&&e.toolName===`apply_patch`&&n.type===`json`){let t=await wh({value:n.value,schema:Nv});p.push({type:`apply_patch_call_output`,call_id:e.toolCallId,status:t.status,output:t.output});continue}if(f?.has(i)){let t;switch(n.type){case`text`:case`error-text`:t=n.value;break;case`execution-denied`:t=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:t=JSON.stringify(n.value);break;case`content`:t=n.value.map(e=>{let t=O_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=rm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Fh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Jp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Jp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type}`});return}}).filter(Cm);break;default:t=``}p.push({type:`custom_tool_call_output`,call_id:e.toolCallId,output:t});continue}let a;switch(n.type){case`text`:case`error-text`:a=n.value;break;case`execution-denied`:a=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:a=JSON.stringify(n.value);break;case`content`:a=n.value.map(e=>{let t=O_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=rm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Fh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Jp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Jp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(Cm);break}p.push({type:`function_call_output`,call_id:e.toolCallId,output:a})}break;default:throw Error(`Unsupported role: ${g}`)}return!o&&p.some(e=>`type`in e&&e.type===`reasoning`&&e.encrypted_content==null)&&(m.push({type:`other`,message:`Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts.`}),p=p.filter(e=>!(`type`in e)||e.type!==`reasoning`||e.encrypted_content!=null)),{input:p,warnings:m}}function j_({finishReason:e,hasFunctionCall:t}){switch(e){case void 0:case null:return t?`tool-calls`:`stop`;case`max_output_tokens`:return`length`;case`content_filter`:return`content-filter`;default:return t?`tool-calls`:`other`}}async function M_({tools:e,toolChoice:t,allowedTools:n,toolNameMapping:r,customProviderToolNames:i}){e=e?.length?e:void 0;let a=[];if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:a};let o=[],s=new Map,c=i??new Set;for(let t of e)switch(t.type){case`function`:{let e=t.providerOptions?.openai,n=N_({tool:t,options:e}),r=e?.namespace;if(r==null)o.push(n);else{let e=s.get(r.name);if(e==null)e={type:`namespace`,name:r.name,description:r.description,tools:[]},s.set(r.name,e),o.push(e);else if(e.description!==r.description)throw new ha({functionality:`conflicting descriptions for OpenAI tool namespace "${r.name}"`});e.tools.push(n)}break}case`provider`:switch(t.id){case`openai.file_search`:{let e=await wh({value:t.args,schema:Gv});o.push({type:`file_search`,vector_store_ids:e.vectorStoreIds,max_num_results:e.maxNumResults,ranking_options:e.ranking?{ranker:e.ranking.ranker,score_threshold:e.ranking.scoreThreshold}:void 0,filters:e.filters});break}case`openai.local_shell`:o.push({type:`local_shell`});break;case`openai.shell`:{let e=await wh({value:t.args,schema:ry});o.push({type:`shell`,...e.environment&&{environment:P_(e.environment)}});break}case`openai.apply_patch`:o.push({type:`apply_patch`});break;case`openai.web_search_preview`:{let e=await wh({value:t.args,schema:py});o.push({type:`web_search_preview`,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.web_search`:{let e=await wh({value:t.args,schema:uy});o.push({type:`web_search`,filters:e.filters==null?void 0:{allowed_domains:e.filters.allowedDomains},external_web_access:e.externalWebAccess,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.code_interpreter`:{let e=await wh({value:t.args,schema:Lv});o.push({type:`code_interpreter`,container:e.container==null?{type:`auto`,file_ids:void 0}:typeof e.container==`string`?e.container:{type:`auto`,file_ids:e.container.fileIds}});break}case`openai.image_generation`:{let e=await wh({value:t.args,schema:Jv});o.push({type:`image_generation`,background:e.background,input_fidelity:e.inputFidelity,input_image_mask:e.inputImageMask?{file_id:e.inputImageMask.fileId,image_url:e.inputImageMask.imageUrl}:void 0,model:e.model,moderation:e.moderation,partial_images:e.partialImages,quality:e.quality,output_compression:e.outputCompression,output_format:e.outputFormat,size:e.size});break}case`openai.mcp`:{let e=await wh({value:t.args,schema:gy}),n=e=>({tool_names:e.toolNames}),r=e.requireApproval,i=r==null?void 0:typeof r==`string`?r:r.never==null?void 0:{never:n(r.never)};o.push({type:`mcp`,server_label:e.serverLabel,allowed_tools:Array.isArray(e.allowedTools)?e.allowedTools:e.allowedTools?{read_only:e.allowedTools.readOnly,tool_names:e.allowedTools.toolNames}:void 0,authorization:e.authorization,connector_id:e.connectorId,headers:e.headers,require_approval:i??`never`,server_description:e.serverDescription,server_url:e.serverUrl});break}case`openai.custom`:{let e=await wh({value:t.args,schema:Bv});o.push({type:`custom`,name:t.name,description:e.description,format:e.format}),c.add(t.name);break}case`openai.tool_search`:{let e=await wh({value:t.args,schema:ay});o.push({type:`tool_search`,...e.execution==null?{}:{execution:e.execution},...e.description==null?{}:{description:e.description},...e.parameters==null?{}:{parameters:e.parameters}});break}}break;default:a.push({type:`unsupported`,feature:`function tool ${t}`});break}if(n!=null)return{tools:o,toolChoice:{type:`allowed_tools`,mode:n.mode??`auto`,tools:n.toolNames.map(e=>({type:`function`,name:r?.toProviderToolName(e)??e}))},toolWarnings:a};if(t==null)return{tools:o,toolChoice:void 0,toolWarnings:a};let l=t.type;switch(l){case`auto`:case`none`:case`required`:return{tools:o,toolChoice:l,toolWarnings:a};case`tool`:{let e=r?.toProviderToolName(t.toolName)??t.toolName;return{tools:o,toolChoice:e===`code_interpreter`||e===`file_search`||e===`image_generation`||e===`web_search_preview`||e===`web_search`||e===`mcp`||e===`apply_patch`?{type:e}:c.has(e)?{type:`custom`,name:e}:{type:`function`,name:e},toolWarnings:a}}default:throw new ha({functionality:`tool choice type: ${l}`})}}function N_({tool:e,options:t}){let n=t?.deferLoading;return{type:`function`,name:e.name,description:e.description,parameters:e.inputSchema,...e.strict==null?{}:{strict:e.strict},...n==null?{}:{defer_loading:n}}}function P_(e){if(e.type===`containerReference`)return{type:`container_reference`,container_id:e.containerId};if(e.type===`containerAuto`){let t=e;return{type:`container_auto`,file_ids:t.fileIds,memory_limit:t.memoryLimit,network_policy:t.networkPolicy==null?void 0:t.networkPolicy.type===`disabled`?{type:`disabled`}:{type:`allowlist`,allowed_domains:t.networkPolicy.allowedDomains,domain_secrets:t.networkPolicy.domainSecrets},skills:F_(t.skills)}}return{type:`local`,skills:e.skills}}function F_(e){return e?.map(e=>e.type===`skillReference`?{type:`skill_reference`,skill_id:Ih({reference:e.providerReference??{},provider:`openai`}),version:e.version??`latest`}:{type:`inline`,name:e.name,description:e.description,source:{type:`base64`,media_type:e.source.mediaType,data:e.source.data}})}function I_(e){let t={};for(let n of e)if(n.role===`assistant`)for(let e of n.content){if(e.type!==`tool-call`)continue;let n=e.providerOptions?.openai?.approvalRequestId;n!=null&&(t[n]=e.toolCallId)}return t}function L_(e){return e.type===`response.output_text.delta`}function R_(e){let t=B_(e);return t!=null&&Array.isArray(t.choices)&&typeof t.type!=`string`}function z_({value:e,cause:t,url:n,requestBodyValues:r,responseHeaders:i}){return new ti({message:`Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.`,url:n,requestBodyValues:r,responseHeaders:i,responseBody:JSON.stringify(e),cause:t,data:e,isRetryable:!1})}function B_(e){return typeof e==`object`&&e?e:void 0}function V_(e){return e.type===`response.output_item.done`}function H_(e){return e.type===`response.completed`||e.type===`response.incomplete`}function U_(e){return e.type===`response.failed`}function W_(e){return e.type===`response.created`}function G_(e){return e.type===`response.function_call_arguments.delta`}function K_(e){return e.type===`response.custom_tool_call_input.delta`}function q_(e){return e.type===`response.image_generation_call.partial_image`}function J_(e){return e.type===`response.code_interpreter_call_code.delta`}function Y_(e){return e.type===`response.code_interpreter_call_code.done`}function X_(e){return e.type===`response.apply_patch_call_operation_diff.delta`}function Z_(e){return e.type===`response.apply_patch_call_operation_diff.done`}function Q_(e){return e.type===`response.output_item.added`}function $_(e){return e.type===`response.output_text.annotation.added`}function ev(e){return e.type===`error`}function tv(e){return!(e.type===`response.created`||e.type===`response.failed`||e.type===`error`||e.type===`unknown_chunk`)}function nv(e){if(e==null)return{};switch(e.type){case`search`:return{action:{type:`search`,query:e.query??void 0,...e.queries!=null&&{queries:e.queries}},...e.sources!=null&&{sources:e.sources}};case`open_page`:return{action:{type:`openPage`,url:e.url}};case`find_in_page`:return{action:{type:`findInPage`,url:e.url,pattern:e.pattern}}}}function rv(e){return JSON.stringify(e).slice(1,-1)}function iv(e){return e===`gpt-realtime-whisper`||e.startsWith(`gpt-realtime-whisper-`)}function av({webSocket:e,url:t,headers:n,sessionUpdate:r,language:i,warnings:a,audio:o,abortSignal:s,includeRawChunks:c}){let l=!1,u=()=>{};return new ReadableStream({start:d=>{let f=new(Hh(e))(t,sv(n),{headers:n}),p;u=e=>{s?.removeEventListener(`abort`,g),p?.cancel().catch(()=>{});try{f.close(e)}catch{}};let m=e=>{l||(l=!0,u(),d.error(e))},h=(e,t)=>{l||(l=!0,t!=null&&d.enqueue({type:`transcript-final`,id:t,text:e}),d.enqueue({type:`finish`,text:e,segments:[],language:i}),d.close(),u(1e3))},g=()=>{m(s?.reason??Error(`Aborted`))};if(s?.aborted){g();return}s?.addEventListener(`abort`,g,{once:!0});let _=async()=>{p=o.getReader();try{for(;;){let{done:e,value:t}=await p.read();if(e||l)break;f.send(JSON.stringify({type:`input_audio_buffer.append`,audio:Jp(t)}))}}finally{p.releaseLock()}l||f.send(JSON.stringify({type:`input_audio_buffer.commit`}))};f.onopen=()=>{d.enqueue({type:`stream-start`,warnings:a}),f.send(JSON.stringify(r)),_().catch(m)},f.onmessage=e=>{Wh(e.data).then(async e=>{let t=await Dh({text:e});if(!t.success)return;let n=t.value;switch(c&&d.enqueue({type:`raw`,rawValue:n}),n.type){case`conversation.item.input_audio_transcription.delta`:d.enqueue({type:`transcript-delta`,id:n.item_id,delta:n.delta??``});break;case`conversation.item.input_audio_transcription.completed`:h(n.transcript??``,n.item_id);break;case`error`:m(Error(n.error?.message??`OpenAI realtime error`));break}}).catch(m)},f.onerror=()=>{m(Error(`OpenAI realtime transcription error`))},f.onclose=()=>{l||(l=!0,u(),d.close())}},cancel:()=>{l||(l=!0,u())}})}function ov({modelId:e,inputAudioFormat:t,providerOptions:n}){return{type:`session.update`,session:{type:`transcription`,audio:{input:{format:{type:t.type,...t.rate==null?{}:{rate:t.rate}},transcription:{model:e,...n?.language==null?{}:{language:n.language},...n?.streaming?.delay==null?{}:{delay:n.streaming.delay}},turn_detection:null}},...n?.streaming?.include==null?{}:{include:n.streaming.include}}}}function sv(e){let t=e.Authorization??e.authorization,n=t?.startsWith(`Bearer `)?t.slice(7):void 0;return n==null?[`realtime`]:[`realtime`,`openai-insecure-api-key.${n}`]}function cv(e={}){let t=Gh(Dm({settingValue:e.baseURL,environmentVariableName:`OPENAI_BASE_URL`}))??`https://api.openai.com/v1`,n=e.name??`openai`,r=()=>xm({Authorization:`Bearer ${Em({apiKey:e.apiKey,environmentVariableName:`OPENAI_API_KEY`,description:`OpenAI`})}`,"OpenAI-Organization":e.organization,"OpenAI-Project":e.project,...e.headers},`ai-sdk/openai/${Ry}`),i=i=>new mv(i,{provider:`${n}.chat`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),a=i=>new vv(i,{provider:`${n}.completion`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),o=i=>new xv(i,{provider:`${n}.embedding`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),s=i=>new jv(i,{provider:`${n}.image`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),c=i=>new Fy(i,{provider:`${n}.transcription`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,webSocket:e.webSocket}),l=i=>new jy(i,{provider:`${n}.speech`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),u=()=>new wv({provider:`${n}.files`,baseURL:t,headers:r,fetch:e.fetch}),d=()=>new Ly({provider:`${n}.skills`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),f=e=>{if(new.target)throw Error(`The OpenAI model function cannot be called with the new keyword.`);return p(e)},p=i=>new ky(i,{provider:`${n}.responses`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,fileIdPrefixes:[`file-`]}),m=i=>new by(i,{provider:`${n}.realtime`,baseURL:t,headers:r,fetch:e.fetch}),h=Object.assign(e=>m(e),{getToken:async e=>{let t=await m(e.model).doCreateClientSecret({sessionConfig:e.sessionConfig,expiresAfterSeconds:e.expiresAfterSeconds});return{token:t.token,url:t.url,expiresAt:t.expiresAt}}}),g=function(e){return f(e)};return g.specificationVersion=`v4`,g.languageModel=f,g.chat=i,g.completion=a,g.responses=p,g.embedding=o,g.embeddingModel=o,g.textEmbedding=o,g.textEmbeddingModel=o,g.image=s,g.imageModel=s,g.transcription=c,g.transcriptionModel=c,g.speech=l,g.speechModel=l,g.files=u,g.skills=d,g.experimental_realtime=h,g.tools=yy,g}var lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy=t((()=>{Qg(),Fd(),ga(),lv=z({error:z({message:I(),type:I().nullish(),param:uu().nullish(),code:B([I(),L()]).nullish()})}),uv=Kg({errorSchema:lv,errorToMessage:e=>e.error.message}),dv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({message:z({role:H(`assistant`).nullish(),content:I().nullish(),tool_calls:R(z({id:I().nullish(),type:H(`function`),function:z({name:I(),arguments:I()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}),index:L(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}))),fv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({delta:z({role:V([`assistant`]).nullish(),content:I().nullish(),tool_calls:R(z({index:L(),id:I().nullish(),type:H(`function`).nullish(),function:z({name:I().nullish(),arguments:I().nullish()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}).nullish(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish(),index:L()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}),lv]))),pv=K(()=>q(z({logitBias:_u(jd(),L()).optional(),logprobs:B([cu(),L()]).optional(),parallelToolCalls:cu().optional(),user:I().optional(),reasoningEffort:V([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]).optional(),maxCompletionTokens:L().optional(),store:cu().optional(),metadata:_u(I().max(64),I().max(512)).optional(),prediction:_u(I(),uu()).optional(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).optional(),strictJsonSchema:cu().optional(),textVerbosity:V([`low`,`medium`,`high`]).optional(),promptCacheKey:I().optional(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).optional(),safetyIdentifier:I().optional(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:cu().optional()}))),mv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,seed:l,tools:u,toolChoice:d,reasoning:f,providerOptions:p}){let m=[],h=await kh({provider:`openai`,providerOptions:p,schema:pv})??{},g=$g(this.modelId),_=h.reasoningEffort??(Om(f)?f:void 0),v=h.forceReasoning??g.isReasoningModel;i!=null&&m.push({type:`unsupported`,feature:`topK`});let{messages:y,warnings:b}=u_({prompt:e,systemMessageMode:h.systemMessageMode??(v?`developer`:g.systemMessageMode)});m.push(...b);let x=h.strictJsonSchema??!0,S={model:this.modelId,logit_bias:h.logitBias,logprobs:h.logprobs===!0||typeof h.logprobs==`number`||void 0,top_logprobs:typeof h.logprobs==`number`?h.logprobs:typeof h.logprobs==`boolean`&&h.logprobs?0:void 0,user:h.user,parallel_tool_calls:h.parallelToolCalls,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,response_format:c?.type===`json`?c.schema==null?{type:`json_object`}:{type:`json_schema`,json_schema:{schema:c.schema,strict:x,name:c.name??`response`,description:c.description}}:void 0,stop:s,seed:l,verbosity:h.textVerbosity,max_completion_tokens:h.maxCompletionTokens,store:h.store,metadata:h.metadata,prediction:h.prediction,reasoning_effort:_,service_tier:h.serviceTier,prompt_cache_key:h.promptCacheKey,prompt_cache_options:h.promptCacheOptions,prompt_cache_retention:h.promptCacheRetention,safety_identifier:h.safetyIdentifier,messages:y};v?((_!==`none`||!g.supportsNonReasoningParameters)&&(S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),S.top_p!=null&&(S.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`})),S.logprobs!=null&&(S.logprobs=void 0,m.push({type:`other`,message:`logprobs is not supported for reasoning models`}))),S.frequency_penalty!=null&&(S.frequency_penalty=void 0,m.push({type:`unsupported`,feature:`frequencyPenalty`,details:`frequencyPenalty is not supported for reasoning models`})),S.presence_penalty!=null&&(S.presence_penalty=void 0,m.push({type:`unsupported`,feature:`presencePenalty`,details:`presencePenalty is not supported for reasoning models`})),S.logit_bias!=null&&(S.logit_bias=void 0,m.push({type:`other`,message:`logitBias is not supported for reasoning models`})),S.top_logprobs!=null&&(S.top_logprobs=void 0,m.push({type:`other`,message:`topLogprobs is not supported for reasoning models`})),S.max_tokens!=null&&(S.max_completion_tokens??=S.max_tokens,S.max_tokens=void 0)):(this.modelId.startsWith(`gpt-4o-search-preview`)||this.modelId.startsWith(`gpt-4o-mini-search-preview`))&&S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for the search preview models and has been removed.`})),h.serviceTier===`flex`&&!g.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),S.service_tier=void 0),h.serviceTier===`priority`&&!g.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),S.service_tier=void 0);let{tools:C,toolChoice:w,toolWarnings:T}=p_({tools:u,toolChoice:d});return{args:{...S,tools:C,tool_choice:w},warnings:[...m,...T]}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await Vg({url:this.config.url({path:`/chat/completions`,modelId:this.modelId}),headers:Gp((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:uv,successfulResponseHandler:Jg(dv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c=[],l=s.message.content;l!=null&&l.length>0&&c.push({type:`text`,text:l});for(let e of s.message.tool_calls??[])c.push({type:`tool-call`,toolCallId:e.id??ug(),toolName:e.function.name,input:e.function.arguments});for(let e of s.message.annotations??[])c.push({type:`source`,sourceType:`url`,id:ug(),url:e.url_citation.url,title:e.url_citation.title});let u=a.usage?.completion_tokens_details,d={openai:{}};return u?.accepted_prediction_tokens!=null&&(d.openai.acceptedPredictionTokens=u?.accepted_prediction_tokens),u?.rejected_prediction_tokens!=null&&(d.openai.rejectedPredictionTokens=u?.rejected_prediction_tokens),s.logprobs?.content!=null&&(d.openai.logprobs=s.logprobs.content),{content:c,finishReason:{unified:f_(s.finish_reason),raw:s.finish_reason??void 0},usage:s_(a.usage),request:{body:n},response:{...d_(a),headers:i,body:o},warnings:r,providerMetadata:d}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/chat/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await Vg({url:a,headers:Gp((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:uv,successfulResponseHandler:qg(fv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await e_({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:m_,url:a,requestBodyValues:i,responseHeaders:o}),l,u={unified:`other`,raw:void 0},d,f=!1,p=!1,m={openai:{}};return{stream:c.pipeThrough(new TransformStream({start(e){l=new Xg(e,{generateId:ug,typeValidation:`if-present`}),e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}if(!f){let e=d_(r);Object.values(e).some(Boolean)&&(f=!0,n.enqueue({type:`response-metadata`,...d_(r)}))}r.usage!=null&&(d=r.usage,r.usage.completion_tokens_details?.accepted_prediction_tokens!=null&&(m.openai.acceptedPredictionTokens=r.usage.completion_tokens_details?.accepted_prediction_tokens),r.usage.completion_tokens_details?.rejected_prediction_tokens!=null&&(m.openai.rejectedPredictionTokens=r.usage.completion_tokens_details?.rejected_prediction_tokens));let i=r.choices[0];if(i?.finish_reason!=null&&(u={unified:f_(i.finish_reason),raw:i.finish_reason}),i?.logprobs?.content!=null&&(m.openai.logprobs=i.logprobs.content),i?.delta==null)return;let a=i.delta;if(a.content!=null&&(p||=(n.enqueue({type:`text-start`,id:`0`}),!0),n.enqueue({type:`text-delta`,id:`0`,delta:a.content})),a.tool_calls!=null)for(let e of a.tool_calls)l.processDelta(e);if(a.annotations!=null)for(let e of a.annotations)n.enqueue({type:`source`,sourceType:`url`,id:ug(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){p&&e.enqueue({type:`text-end`,id:`0`}),l.flush(),e.enqueue({type:`finish`,finishReason:u,usage:s_(d),...m==null?{}:{providerMetadata:m}})}})),request:{body:i},response:{headers:o}}}},hv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(_u(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}))),gv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I().nullish(),index:L(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(_u(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}),lv]))),_v=K(()=>q(z({echo:cu().optional(),logitBias:_u(I(),L()).optional(),suffix:I().optional(),user:I().optional(),logprobs:B([cu(),L()]).optional()}))),vv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(`.`)[0].trim()}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,tools:l,toolChoice:u,seed:d,providerOptions:f}){let p=[],m={...await kh({provider:`openai`,providerOptions:f,schema:_v}),...await kh({provider:this.providerOptionsName,providerOptions:f,schema:_v})};i!=null&&p.push({type:`unsupported`,feature:`topK`}),l?.length&&p.push({type:`unsupported`,feature:`tools`}),u!=null&&p.push({type:`unsupported`,feature:`toolChoice`}),c!=null&&c.type!==`text`&&p.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format is not supported.`});let{prompt:h,stopSequences:g}=g_({prompt:e}),_=[...g??[],...s??[]];return{args:{model:this.modelId,echo:m.echo,logit_bias:m.logitBias,logprobs:m?.logprobs===!0?0:m?.logprobs===!1?void 0:m?.logprobs,suffix:m.suffix,user:m.user,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,seed:d,prompt:h,stop:_.length>0?_:void 0},warnings:p}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await Vg({url:this.config.url({path:`/completions`,modelId:this.modelId}),headers:Gp((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:uv,successfulResponseHandler:Jg(hv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c={openai:{}};return s.logprobs!=null&&(c.openai.logprobs=s.logprobs),{content:[{type:`text`,text:s.text}],usage:h_(a.usage),finishReason:{unified:v_(s.finish_reason),raw:s.finish_reason??void 0},request:{body:n},response:{...__(a),headers:i,body:o},providerMetadata:c,warnings:r}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await Vg({url:a,headers:Gp((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:uv,successfulResponseHandler:qg(gv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await e_({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:y_,url:a,requestBodyValues:i,responseHeaders:o}),l={unified:`other`,raw:void 0},u={openai:{}},d,f=!0;return{stream:c.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}f&&(f=!1,n.enqueue({type:`response-metadata`,...__(r)}),n.enqueue({type:`text-start`,id:`0`})),r.usage!=null&&(d=r.usage);let i=r.choices[0];i?.finish_reason!=null&&(l={unified:v_(i.finish_reason),raw:i.finish_reason}),i?.logprobs!=null&&(u.openai.logprobs=i.logprobs),i?.text!=null&&i.text.length>0&&n.enqueue({type:`text-delta`,id:`0`,delta:i.text})},flush(e){f||e.enqueue({type:`text-end`,id:`0`}),e.enqueue({type:`finish`,finishReason:l,providerMetadata:u,usage:h_(d)})}})),request:{body:i},response:{headers:o}}}},yv=K(()=>q(z({dimensions:L().optional(),user:I().optional()}))),bv=K(()=>q(z({data:R(z({embedding:R(L())})),usage:z({prompt_tokens:L()}).nullish()}))),xv=class e{constructor(e,t){this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=e,this.config=t}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){var i;if(e.length>this.maxEmbeddingsPerCall)throw new ra({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});let a=await kh({provider:`openai`,providerOptions:r,schema:yv})??{},{responseHeaders:o,value:s,rawValue:c}=await Vg({url:this.config.url({path:`/embeddings`,modelId:this.modelId}),headers:Gp((i=this.config).headers?.call(i),t),body:{model:this.modelId,input:e,encoding_format:`float`,dimensions:a.dimensions,user:a.user},failedResponseHandler:uv,successfulResponseHandler:Jg(bv),abortSignal:n,fetch:this.config.fetch});return{warnings:[],embeddings:s.data.map(e=>e.embedding),usage:s.usage?{tokens:s.usage.prompt_tokens}:void 0,response:{headers:o,body:c}}}},Sv=K(()=>q(z({id:I(),object:I().nullish(),bytes:L().nullish(),created_at:L().nullish(),filename:I().nullish(),purpose:I().nullish(),status:I().nullish(),expires_at:L().nullish()}))),Cv=K(()=>q(z({purpose:I().optional(),expiresAfter:L().optional()}))),wv=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n,providerOptions:r}){let i=await kh({provider:`openai`,providerOptions:r,schema:Cv}),a=Yp(e),o=new Blob([a],{type:t}),s=new FormData;n==null?s.append(`file`,o):s.append(`file`,o,n),s.append(`purpose`,i?.purpose??`assistants`),i?.expiresAfter!=null&&s.append(`expires_after`,String(i.expiresAfter));let{value:c}=await Hg({url:`${this.config.baseURL}/files`,headers:Gp(this.config.headers()),formData:s,failedResponseHandler:uv,successfulResponseHandler:Jg(Sv),fetch:this.config.fetch});return{warnings:[],providerReference:{openai:c.id},...c.filename??n?{filename:c.filename??n}:{},...t==null?{}:{mediaType:t},providerMetadata:{openai:{...c.filename==null?{}:{filename:c.filename},...c.purpose==null?{}:{purpose:c.purpose},...c.bytes==null?{}:{bytes:c.bytes},...c.created_at==null?{}:{createdAt:c.created_at},...c.status==null?{}:{status:c.status},...c.expires_at==null?{}:{expiresAt:c.expires_at}}}}}},Tv=K(()=>q(z({created:L().nullish(),data:R(z({b64_json:I(),revised_prompt:I().nullish()})),background:I().nullish(),output_format:I().nullish(),size:I().nullish(),quality:I().nullish(),usage:z({input_tokens:L().nullish(),output_tokens:L().nullish(),total_tokens:L().nullish(),input_tokens_details:z({image_tokens:L().nullish(),text_tokens:L().nullish()}).nullish()}).nullish()}))),Ev={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10,"gpt-image-1-mini":10,"gpt-image-1.5":10,"gpt-image-2":10,"chatgpt-image-latest":10},Dv=[`chatgpt-image-`,`gpt-image-1-mini`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-2`],Ov=z({quality:V([`standard`,`hd`,`low`,`medium`,`high`,`auto`]).optional(),background:V([`transparent`,`opaque`,`auto`]).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),outputCompression:L().int().min(0).max(100).optional(),user:I().optional()}),kv=K(()=>q(Ov.extend({style:V([`vivid`,`natural`]).optional(),moderation:V([`auto`,`low`]).optional()}))),Av=K(()=>q(Ov.extend({inputFidelity:V([`high`,`low`]).optional()}))),jv=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get maxImagesPerCall(){return Ev[this.modelId]??1}get provider(){return this.config.provider}async doGenerate({prompt:e,files:t,mask:n,n:r,size:i,aspectRatio:a,seed:o,providerOptions:s,headers:c,abortSignal:l}){var u,d,f;let p=[];a!=null&&p.push({type:`unsupported`,feature:`aspectRatio`,details:"This model does not support aspect ratio. Use `size` instead."}),o!=null&&p.push({type:`unsupported`,feature:`seed`});let m=((u=this.config._internal)?.currentDate)?.call(u)??new Date;if(t!=null){let a=await kh({provider:`openai`,providerOptions:s,schema:Av})??{},{value:o,responseHeaders:u}=await Hg({url:this.config.url({path:`/images/edits`,modelId:this.modelId}),headers:Gp((d=this.config).headers?.call(d),c),formData:Xp({model:this.modelId,prompt:e,image:await Promise.all(t.map(e=>e.type===`file`?new Blob([e.data instanceof Uint8Array?new Blob([e.data],{type:e.mediaType}):new Blob([Kp(e.data)],{type:e.mediaType})],{type:e.mediaType}):mm(e.url))),mask:n==null?void 0:await S_(n),n:r,size:i,quality:a.quality,background:a.background,output_format:a.outputFormat,output_compression:a.outputCompression,input_fidelity:a.inputFidelity,user:a.user}),failedResponseHandler:uv,successfulResponseHandler:Jg(Tv),abortSignal:l,fetch:this.config.fetch});return{images:o.data.map(e=>e.b64_json),warnings:p,usage:o.usage==null?void 0:{inputTokens:o.usage.input_tokens??void 0,outputTokens:o.usage.output_tokens??void 0,totalTokens:o.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:u},providerMetadata:{openai:{images:o.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:o.created??void 0,size:o.size??void 0,quality:o.quality??void 0,background:o.background??void 0,outputFormat:o.output_format??void 0,...x_(o.usage?.input_tokens_details,t,o.data.length)}))}}}}let h=await kh({provider:`openai`,providerOptions:s,schema:kv})??{},{value:g,responseHeaders:_}=await Vg({url:this.config.url({path:`/images/generations`,modelId:this.modelId}),headers:Gp((f=this.config).headers?.call(f),c),body:{model:this.modelId,prompt:e,n:r,size:i,quality:h.quality,style:h.style,background:h.background,moderation:h.moderation,output_format:h.outputFormat,output_compression:h.outputCompression,user:h.user,...b_(this.modelId)?{}:{response_format:`b64_json`}},failedResponseHandler:uv,successfulResponseHandler:Jg(Tv),abortSignal:l,fetch:this.config.fetch});return{images:g.data.map(e=>e.b64_json),warnings:p,usage:g.usage==null?void 0:{inputTokens:g.usage.input_tokens??void 0,outputTokens:g.usage.output_tokens??void 0,totalTokens:g.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:_},providerMetadata:{openai:{images:g.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:g.created??void 0,size:g.size??void 0,quality:g.quality??void 0,background:g.background??void 0,outputFormat:g.output_format??void 0,...x_(g.usage?.input_tokens_details,t,g.data.length)}))}}}}},Mv=K(()=>q(z({callId:I(),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}))),Nv=K(()=>q(z({status:V([`completed`,`failed`]),output:I().optional()}))),Pv=Mh({id:`openai.apply_patch`,inputSchema:Mv,outputSchema:Nv}),Fv=K(()=>q(z({code:I().nullish(),containerId:I()}))),Iv=K(()=>q(z({outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullish()}))),Lv=K(()=>q(z({container:B([I(),z({fileIds:R(I()).optional()})]).optional()}))),Rv=Nh({id:`openai.code_interpreter`,inputSchema:Fv,outputSchema:Iv}),zv=(e={})=>Rv(e),Bv=K(()=>q(z({description:I().optional(),format:B([z({type:H(`grammar`),syntax:V([`regex`,`lark`]),definition:I()}),z({type:H(`text`)})]).optional()}))),Vv=jh({id:`openai.custom`,inputSchema:K(()=>q(I()))}),Hv=e=>Vv(e),Uv=z({key:I(),type:V([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`]),value:B([I(),L(),cu(),R(I())])}),Wv=z({type:V([`and`,`or`]),filters:R(B([Uv,Du(()=>Wv)]))}),Gv=K(()=>q(z({vectorStoreIds:R(I()),maxNumResults:L().optional(),ranking:z({ranker:I().optional(),scoreThreshold:L().optional()}).optional(),filters:B([Uv,Wv]).optional()}))),Kv=K(()=>q(z({queries:R(I()),results:R(z({attributes:_u(I(),du()),fileId:I(),filename:I(),score:L(),text:I()})).nullable()}))),qv=Nh({id:`openai.file_search`,inputSchema:z({}),outputSchema:Kv}),Jv=K(()=>q(z({background:V([`auto`,`opaque`,`transparent`]).optional(),inputFidelity:V([`low`,`high`]).optional(),inputImageMask:z({fileId:I().optional(),imageUrl:I().optional()}).optional(),model:I().optional(),moderation:V([`auto`]).optional(),outputCompression:L().int().min(0).max(100).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),partialImages:L().int().min(0).max(3).optional(),quality:V([`auto`,`low`,`medium`,`high`]).optional(),size:V([`1024x1024`,`1024x1536`,`1536x1024`,`auto`]).optional()}).strict())),Yv=Nh({id:`openai.image_generation`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({result:I()})))}),Xv=(e={})=>Yv(e),Zv=K(()=>q(z({action:z({type:H(`exec`),command:R(I()),timeoutMs:L().optional(),user:I().optional(),workingDirectory:I().optional(),env:_u(I(),I()).optional()})}))),Qv=K(()=>q(z({output:I()}))),$v=Mh({id:`openai.local_shell`,inputSchema:Zv,outputSchema:Qv}),ey=K(()=>q(z({action:z({commands:R(I()),timeoutMs:L().optional(),maxOutputLength:L().optional()})}))),ty=K(()=>q(z({output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exitCode:L()})])}))}))),ny=R(mu(`type`,[z({type:H(`skillReference`),providerReference:_u(I(),I()),version:I().optional()}),z({type:H(`inline`),name:I(),description:I(),source:z({type:H(`base64`),mediaType:H(`application/zip`),data:I()})})])).optional(),ry=K(()=>q(z({environment:B([z({type:H(`containerAuto`),fileIds:R(I()).optional(),memoryLimit:V([`1g`,`4g`,`16g`,`64g`]).optional(),networkPolicy:mu(`type`,[z({type:H(`disabled`)}),z({type:H(`allowlist`),allowedDomains:R(I()),domainSecrets:R(z({domain:I(),name:I(),value:I()})).optional()})]).optional(),skills:ny}),z({type:H(`containerReference`),containerId:I()}),z({type:H(`local`).optional(),skills:R(z({name:I(),description:I(),path:I()})).optional()})]).optional()}))),iy=Mh({id:`openai.shell`,inputSchema:ey,outputSchema:ty}),ay=K(()=>q(z({execution:V([`server`,`client`]).optional(),description:I().optional(),parameters:_u(I(),du()).optional()}))),oy=K(()=>q(z({arguments:du().optional(),call_id:I().nullish()}))),sy=K(()=>q(z({tools:R(_u(I(),du()))}))),cy=Mh({id:`openai.tool_search`,inputSchema:oy,outputSchema:sy}),ly=(e={})=>cy(e),uy=K(()=>q(z({externalWebAccess:cu().optional(),filters:z({allowedDomains:R(I()).optional()}).optional(),searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),dy=Nh({id:`openai.web_search`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:mu(`type`,[z({type:H(`search`),query:I().optional(),queries:R(I()).optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional(),sources:R(mu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).optional()})))}),fy=(e={})=>dy(e),py=K(()=>q(z({searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),my=Nh({id:`openai.web_search_preview`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:mu(`type`,[z({type:H(`search`),query:I().optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional()})))}),hy=Du(()=>B([I(),L(),cu(),lu(),R(hy),_u(I(),hy)])),gy=K(()=>q(z({serverLabel:I(),allowedTools:B([R(I()),z({readOnly:cu().optional(),toolNames:R(I()).optional()})]).optional(),authorization:I().optional(),connectorId:I().optional(),headers:_u(I(),I()).optional(),requireApproval:B([V([`always`,`never`]),z({never:z({toolNames:R(I()).optional()}).optional()})]).optional(),serverDescription:I().optional(),serverUrl:I().optional()}).refine(e=>e.serverUrl!=null||e.connectorId!=null,`One of serverUrl or connectorId must be provided.`))),_y=Nh({id:`openai.mcp`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({type:H(`call`),serverLabel:I(),name:I(),arguments:I(),output:I().nullish(),error:B([I(),hy]).optional()})))}),vy=e=>_y(e),yy={applyPatch:Pv,customTool:Hv,codeInterpreter:zv,fileSearch:qv,imageGeneration:Xv,localShell:$v,shell:iy,webSearchPreview:my,webSearch:fy,mcp:vy,toolSearch:ly},by=class{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.provider=t.provider,this.config=t}async doCreateClientSecret(e){let t=this.config.fetch??fetch,n=`${this.config.baseURL}/realtime/client_secrets`,r=e.sessionConfig==null?{type:`realtime`,model:this.modelId}:T_(e.sessionConfig,this.modelId),i=await t(n,{method:`POST`,headers:{...this.config.headers(),"Content-Type":`application/json`},body:JSON.stringify({session:r,...e.expiresAfterSeconds==null?{}:{expires_after:{anchor:`created_at`,seconds:e.expiresAfterSeconds}}})});if(!i.ok){let e=await i.text();throw Error(`OpenAI realtime client secret request failed: ${i.status} ${e}`)}let a=await i.json();return{token:a.value,url:`wss://${new URL(this.config.baseURL).host}/v1/realtime?model=${encodeURIComponent(this.modelId)}`,expiresAt:a.expires_at}}getWebSocketConfig(e){return{url:e.url,protocols:[`realtime`,`openai-insecure-api-key.${e.token}`]}}parseServerEvent(e){return C_(e)}serializeClientEvent(e){return w_(e,this.modelId)}buildSessionConfig(e){return T_(e,this.modelId)}},xy=z({itemId:I().nullish(),reasoningEncryptedContent:I().nullish()}),Sy=Du(()=>B([I(),L(),cu(),lu(),R(Sy),_u(I(),Sy.optional())])),Cy=z({type:H(`error`),sequence_number:L(),error:z({type:I(),code:I(),message:I(),param:I().nullish()})}),wy=z({type:H(`error`),sequence_number:L(),code:I().nullish(),message:I(),param:I().nullish()}),Ty=K(()=>q(B([z({type:H(`response.output_text.delta`),item_id:I(),delta:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}),z({type:V([`response.completed`,`response.incomplete`]),response:z({incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.failed`),sequence_number:L(),response:z({error:z({code:I().nullish(),message:I()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).nullish(),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.created`),response:z({id:I(),created_at:L(),model:I(),service_tier:I().nullish()})}),z({type:H(`response.output_item.added`),output_index:L(),item:mu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),namespace:I().nullish()}),z({type:H(`web_search_call`),id:I(),status:I()}),z({type:H(`computer_call`),id:I(),status:I()}),z({type:H(`file_search_call`),id:I()}),z({type:H(`image_generation_call`),id:I()}),z({type:H(`code_interpreter_call`),id:I(),container_id:I(),code:I().nullable(),outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable(),status:I()}),z({type:H(`mcp_call`),id:I(),status:I(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I()}),z({type:H(`mcp_approval_request`),id:I()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I()}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I().nullish()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:du()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(_u(I(),Sy.optional()))})])}),z({type:H(`response.output_item.done`),output_index:L(),item:mu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),status:H(`completed`),namespace:I().nullish()}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I(),status:H(`completed`)}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`web_search_call`),id:I(),status:I(),action:mu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(mu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:_u(I(),B([I(),L(),cu()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:_u(I(),I()).optional()})}),z({type:H(`computer_call`),id:I(),status:H(`completed`)}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:uu(),annotations:_u(I(),du()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:du()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(_u(I(),Sy.optional()))})])}),z({type:H(`response.function_call_arguments.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.custom_tool_call_input.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.image_generation_call.partial_image`),item_id:I(),output_index:L(),partial_image_b64:I()}),z({type:H(`response.code_interpreter_call_code.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.code_interpreter_call_code.done`),item_id:I(),output_index:L(),code:I()}),z({type:H(`response.output_text.annotation.added`),annotation:mu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})])}),z({type:H(`response.reasoning_summary_part.added`),item_id:I(),summary_index:L()}),z({type:H(`response.reasoning_summary_text.delta`),item_id:I(),summary_index:L(),delta:I()}),z({type:H(`response.reasoning_summary_part.done`),item_id:I(),summary_index:L()}),z({type:H(`response.apply_patch_call_operation_diff.delta`),item_id:I(),output_index:L(),delta:I(),obfuscation:I().nullish()}),z({type:H(`response.apply_patch_call_operation_diff.done`),item_id:I(),output_index:L(),diff:I()}),Cy,wy,z({type:I()}).loose().transform(e=>({type:`unknown_chunk`,message:e.type}))]))),Ey=K(()=>q(z({id:I().optional(),created_at:L().optional(),error:z({message:I(),type:I(),param:I().nullish(),code:I()}).nullish(),model:I().optional(),output:R(mu(`type`,[z({type:H(`message`),role:H(`assistant`),id:I(),phase:V([`commentary`,`final_answer`]).nullish(),content:R(z({type:H(`output_text`),text:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish(),annotations:R(mu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})]))}))}),z({type:H(`web_search_call`),id:I(),status:I(),action:mu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(mu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:_u(I(),B([I(),L(),cu()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:_u(I(),I()).optional()})}),z({type:H(`function_call`),call_id:I(),name:I(),arguments:I(),id:I(),namespace:I().nullish()}),z({type:H(`custom_tool_call`),call_id:I(),name:I(),input:I(),id:I()}),z({type:H(`computer_call`),id:I(),status:I().optional()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish(),summary:R(z({type:H(`summary_text`),text:I()}))}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:uu(),annotations:_u(I(),du()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:du()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(_u(I(),Sy.optional()))})])).optional(),service_tier:I().nullish(),reasoning:z({context:I().nullish()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).optional()}))),Dy=20,Oy=K(()=>q(z({conversation:I().nullish(),include:R(V([`reasoning.encrypted_content`,`file_search_call.results`,`web_search_call.results`,`message.output_text.logprobs`])).nullish(),instructions:I().nullish(),logprobs:B([cu(),L().min(1).max(Dy)]).optional(),maxToolCalls:L().nullish(),metadata:uu().nullish(),parallelToolCalls:cu().nullish(),previousResponseId:I().nullish(),promptCacheKey:I().nullish(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).nullish(),reasoningEffort:I().nullish(),reasoningMode:V([`standard`,`pro`]).optional(),reasoningContext:V([`auto`,`current_turn`,`all_turns`]).optional(),reasoningSummary:I().nullish(),safetyIdentifier:I().nullish(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).nullish(),store:cu().nullish(),passThroughUnsupportedFiles:cu().optional(),strictJsonSchema:cu().nullish(),textVerbosity:V([`low`,`medium`,`high`]).nullish(),truncation:V([`auto`,`disabled`]).nullish(),user:I().nullish(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:cu().optional(),contextManagement:R(z({type:H(`compaction`),compactThreshold:L()})).nullish(),allowedTools:z({toolNames:R(I()).min(1),mode:V([`auto`,`required`]).optional()}).optional()}))),ky=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({maxOutputTokens:e,temperature:t,stopSequences:n,topP:r,topK:i,presencePenalty:a,frequencyPenalty:o,seed:s,prompt:c,reasoning:l,providerOptions:u,tools:d,toolChoice:f,responseFormat:p}){let m=[],h=$g(this.modelId);i!=null&&m.push({type:`unsupported`,feature:`topK`}),s!=null&&m.push({type:`unsupported`,feature:`seed`}),a!=null&&m.push({type:`unsupported`,feature:`presencePenalty`}),o!=null&&m.push({type:`unsupported`,feature:`frequencyPenalty`}),n!=null&&m.push({type:`unsupported`,feature:`stopSequences`});let g=this.config.provider.includes(`azure`)?`azure`:`openai`,_=await kh({provider:g,providerOptions:u,schema:Oy});_==null&&g!==`openai`&&(_=await kh({provider:`openai`,providerOptions:u,schema:Oy}));let v=_?.reasoningEffort??(Om(l)?l:void 0),y=_?.reasoningSummary===void 0?v!=null&&v!==`none`?`detailed`:void 0:_.reasoningSummary,b=_?.forceReasoning??h.isReasoningModel;_?.conversation&&_?.previousResponseId&&m.push({type:`unsupported`,feature:`conversation`,details:`conversation and previousResponseId cannot be used together`});let x=Zp({tools:d,providerToolNames:{"openai.code_interpreter":`code_interpreter`,"openai.file_search":`file_search`,"openai.image_generation":`image_generation`,"openai.local_shell":`local_shell`,"openai.shell":`shell`,"openai.web_search":`web_search`,"openai.web_search_preview":`web_search_preview`,"openai.mcp":`mcp`,"openai.apply_patch":`apply_patch`,"openai.tool_search":`tool_search`}}),S=new Set,{tools:C,toolChoice:w,toolWarnings:T}=await M_({tools:d,toolChoice:f,allowedTools:_?.allowedTools??void 0,toolNameMapping:x,customProviderToolNames:S}),{input:ee,warnings:E}=await A_({prompt:c,toolNameMapping:x,systemMessageMode:_?.systemMessageMode??(b?`developer`:h.systemMessageMode),providerOptionsName:g,fileIdPrefixes:this.config.fileIdPrefixes,passThroughUnsupportedFiles:_?.passThroughUnsupportedFiles??!1,store:_?.store??!0,hasConversation:_?.conversation!=null,hasPreviousResponseId:_?.previousResponseId!=null,hasLocalShellTool:k(`openai.local_shell`),hasShellTool:k(`openai.shell`),hasApplyPatchTool:k(`openai.apply_patch`),customProviderToolNames:S.size>0?S:void 0});m.push(...E);let D=_?.strictJsonSchema??!0,O=_?.include;function te(e){O==null?O=[e]:O.includes(e)||(O=[...O,e])}function k(e){return d?.find(t=>t.type===`provider`&&t.id===e)!=null}let A=typeof _?.logprobs==`number`?_?.logprobs:_?.logprobs===!0?Dy:void 0;A&&te(`message.output_text.logprobs`);let ne=d?.find(e=>e.type===`provider`&&(e.id===`openai.web_search`||e.id===`openai.web_search_preview`))?.name;ne&&te(`web_search_call.action.sources`),k(`openai.code_interpreter`)&&te(`code_interpreter_call.outputs`);let re=_?.store;re===!1&&b&&te(`reasoning.encrypted_content`);let ie={model:this.modelId,input:ee,temperature:t,top_p:r,max_output_tokens:e,...(p?.type===`json`||_?.textVerbosity)&&{text:{...p?.type===`json`&&{format:p.schema==null?{type:`json_object`}:{type:`json_schema`,strict:D,name:p.name??`response`,description:p.description,schema:p.schema}},..._?.textVerbosity&&{verbosity:_.textVerbosity}}},conversation:_?.conversation,max_tool_calls:_?.maxToolCalls,metadata:_?.metadata,parallel_tool_calls:_?.parallelToolCalls,previous_response_id:_?.previousResponseId,store:re,user:_?.user,instructions:_?.instructions,service_tier:_?.serviceTier,include:O,prompt_cache_key:_?.promptCacheKey,prompt_cache_options:_?.promptCacheOptions,prompt_cache_retention:_?.promptCacheRetention,safety_identifier:_?.safetyIdentifier,top_logprobs:A,truncation:_?.truncation,..._?.contextManagement&&{context_management:_.contextManagement.map(e=>({type:e.type,compact_threshold:e.compactThreshold}))},...b&&(v!=null||y!=null||_?.reasoningMode!=null||_?.reasoningContext!=null)&&{reasoning:{...v!=null&&{effort:v},...y!=null&&{summary:y},..._?.reasoningMode!=null&&{mode:_.reasoningMode},..._?.reasoningContext!=null&&{context:_.reasoningContext}}}};b?v===`none`&&h.supportsNonReasoningParameters||(ie.temperature!=null&&(ie.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),ie.top_p!=null&&(ie.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`}))):(_?.reasoningEffort!=null&&m.push({type:`unsupported`,feature:`reasoningEffort`,details:`reasoningEffort is not supported for non-reasoning models`}),_?.reasoningSummary!=null&&m.push({type:`unsupported`,feature:`reasoningSummary`,details:`reasoningSummary is not supported for non-reasoning models`}),_?.reasoningMode!=null&&m.push({type:`unsupported`,feature:`reasoningMode`,details:`reasoningMode is not supported for non-reasoning models`}),_?.reasoningContext!=null&&m.push({type:`unsupported`,feature:`reasoningContext`,details:`reasoningContext is not supported for non-reasoning models`})),_?.serviceTier===`flex`&&!h.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),delete ie.service_tier),_?.serviceTier===`priority`&&!h.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),delete ie.service_tier);let ae=d?.find(e=>e.type===`provider`&&e.id===`openai.shell`)?.args?.environment?.type,oe=ae===`containerAuto`||ae===`containerReference`;return{webSearchToolName:ne,args:{...ie,tools:C,tool_choice:w},warnings:[...m,...T],store:re,toolNameMapping:x,providerOptionsName:g,isShellProviderExecuted:oe}}async doGenerate(e){var t,n,r,i,a,o;let{args:s,warnings:c,webSearchToolName:l,toolNameMapping:u,providerOptionsName:d,isShellProviderExecuted:f}=await this.getArgs(e),p=this.config.url({path:`/responses`,modelId:this.modelId}),m=I_(e.prompt),{responseHeaders:h,value:g,rawValue:_}=await Vg({url:p,headers:Gp((t=this.config).headers?.call(t),e.headers),body:s,failedResponseHandler:uv,successfulResponseHandler:Jg(Ey),abortSignal:e.abortSignal,fetch:this.config.fetch});if(g.error)throw new ti({message:g.error.message,url:p,requestBodyValues:s,statusCode:400,responseHeaders:h,responseBody:_,isRetryable:!1});let v=[],y=[],b=!1,x=[];for(let t of g.output)switch(t.type){case`reasoning`:t.summary.length===0&&t.summary.push({type:`summary_text`,text:``});for(let e of t.summary)v.push({type:`reasoning`,text:e.text,providerMetadata:{[d]:{itemId:t.id,reasoningEncryptedContent:t.encrypted_content??null}}});break;case`image_generation_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),result:{result:t.result}});break;case`tool_search_call`:{let e=t.call_id??t.id,n=t.execution===`server`;n&&x.push(e),v.push({type:`tool-call`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),input:JSON.stringify({arguments:t.arguments,call_id:t.call_id}),...n?{providerExecuted:!0}:{},providerMetadata:{[d]:{itemId:t.id}}});break}case`tool_search_output`:{let e=t.call_id??x.shift()??t.id;v.push({type:`tool-result`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),result:{tools:t.tools},providerMetadata:{[d]:{itemId:t.id}}});break}case`local_shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`local_shell`),input:JSON.stringify({action:t.action}),providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:t.action.commands}}),...f&&{providerExecuted:!0},providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call_output`:v.push({type:`tool-result`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),result:{output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});break;case`message`:for(let o of t.content){e.providerOptions?.[d]?.logprobs&&o.logprobs&&y.push(o.logprobs);let s={itemId:t.id,...t.phase!=null&&{phase:t.phase},...o.annotations.length>0&&{annotations:o.annotations}};v.push({type:`text`,text:o.text,providerMetadata:{[d]:s}});for(let e of o.annotations)e.type===`url_citation`?v.push({type:`source`,sourceType:`url`,id:(n=this.config).generateId?.call(n)??ug(),url:e.url,title:e.title}):e.type===`file_citation`?v.push({type:`source`,sourceType:`document`,id:(r=this.config).generateId?.call(r)??ug(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}}):e.type===`container_file_citation`?v.push({type:`source`,sourceType:`document`,id:(i=this.config).generateId?.call(i)??ug(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,containerId:e.container_id}}}):e.type===`file_path`&&v.push({type:`source`,sourceType:`document`,id:(a=this.config).generateId?.call(a)??ug(),mediaType:`application/octet-stream`,title:e.file_id,filename:e.file_id,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}})}break;case`function_call`:b=!0,v.push({type:`tool-call`,toolCallId:t.call_id,toolName:t.name,input:t.arguments,providerMetadata:{[d]:{itemId:t.id,...t.namespace!=null&&{namespace:t.namespace}}}});break;case`custom_tool_call`:{b=!0;let e=u.toCustomToolName(t.name);v.push({type:`tool-call`,toolCallId:t.call_id,toolName:e,input:JSON.stringify(t.input),providerMetadata:{[d]:{itemId:t.id}}});break}case`web_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),input:JSON.stringify({}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),result:nv(t.action)});break;case`mcp_call`:{let e=t.approval_request_id==null?t.id:m[t.approval_request_id]??t.id,n=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:e,toolName:n,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-result`,toolCallId:e,toolName:n,result:{type:`call`,serverLabel:t.server_label,name:t.name,arguments:t.arguments,...t.output==null?{}:{output:t.output},...t.error==null?{}:{error:t.error}},providerMetadata:{[d]:{itemId:t.id}}});break}case`mcp_list_tools`:break;case`mcp_approval_request`:{let e=t.approval_request_id??t.id,n=(o=this.config).generateId?.call(o)??ug(),r=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:n,toolName:r,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-approval-request`,approvalId:e,toolCallId:n});break}case`computer_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:t.status||`completed`}});break;case`file_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),result:{queries:t.queries,results:t.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});break;case`code_interpreter_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:t.code,containerId:t.container_id}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),result:{outputs:t.outputs}});break;case`apply_patch_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:t.call_id,operation:t.operation}),providerMetadata:{[d]:{itemId:t.id}}});break;case`compaction`:v.push({type:`custom`,kind:`openai.compaction`,providerMetadata:{[d]:{type:`compaction`,itemId:t.id,encryptedContent:t.encrypted_content}}});break}let S={[d]:{responseId:g.id,...y.length>0?{logprobs:y}:{},...typeof g.service_tier==`string`?{serviceTier:g.service_tier}:{},...g.reasoning?.context==null?{}:{reasoningContext:g.reasoning.context}}},C=g.usage;return{content:v,finishReason:{unified:j_({finishReason:g.incomplete_details?.reason,hasFunctionCall:b}),raw:g.incomplete_details?.reason??void 0},usage:E_(C),request:{body:s},response:{id:g.id,timestamp:new Date(g.created_at*1e3),modelId:g.model,headers:h,body:_},providerMetadata:S,warnings:c}}async doStream(e){var t;let{args:n,warnings:r,webSearchToolName:i,toolNameMapping:a,store:o,providerOptionsName:s,isShellProviderExecuted:c}=await this.getArgs(e),l=this.config.url({path:`/responses`,modelId:this.modelId}),{responseHeaders:u,value:d}=await Vg({url:l,headers:Gp((t=this.config).headers?.call(t),e.headers),body:{...n,stream:!0},failedResponseHandler:uv,successfulResponseHandler:qg(Ty),abortSignal:e.abortSignal,fetch:this.config.fetch}),f=await e_({stream:d,getError:e=>ev(e)||U_(e)&&e.response.error!=null?e:void 0,isOutputChunk:tv,url:l,requestBodyValues:n,responseHeaders:u}),p=this,m=I_(e.prompt),h=new Map,g={unified:`other`,raw:void 0},_,v=[],y=null,b={},x=[],S,C=!1,w={},T,ee,E=[],D=!1;return{stream:f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,r){var d,f,O,te,k;if(e.includeRawChunks&&r.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){let e=R_(t.rawValue)?z_({value:t.rawValue,cause:t.error,url:l,requestBodyValues:n,responseHeaders:u}):t.error;g={unified:`error`,raw:void 0},r.enqueue({type:`error`,error:e});return}let A=t.value;if(Q_(A)){if(A.item.type===`function_call`)b[A.output_index]={toolName:A.item.name,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:A.item.name});else if(A.item.type===`custom_tool_call`){let e=a.toCustomToolName(A.item.name);b[A.output_index]={toolName:e,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:e})}else if(A.item.type===`web_search_call`)b[A.output_index]={toolName:a.toCustomToolName(i??`web_search`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(i??`web_search`),providerExecuted:!0}),r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),input:JSON.stringify({}),providerExecuted:!0});else if(A.item.type===`computer_call`)b[A.output_index]={toolName:a.toCustomToolName(`computer_use`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`computer_use`),providerExecuted:!0});else if(A.item.type===`code_interpreter_call`)b[A.output_index]={toolName:a.toCustomToolName(`code_interpreter`),toolCallId:A.item.id,codeInterpreter:{containerId:A.item.container_id}},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),providerExecuted:!0}),r.enqueue({type:`tool-input-delta`,id:A.item.id,delta:`{"containerId":"${A.item.container_id}","code":"`});else if(A.item.type===`file_search_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0});else if(A.item.type===`tool_search_call`){let e=A.item.id,t=a.toCustomToolName(`tool_search`),n=A.item.execution===`server`;b[A.output_index]={toolName:t,toolCallId:e,toolSearchExecution:A.item.execution??`server`},n&&r.enqueue({type:`tool-input-start`,id:e,toolName:t,providerExecuted:!0})}else if(A.item.type!==`tool_search_output`&&!(A.item.type===`mcp_call`||A.item.type===`mcp_list_tools`||A.item.type===`mcp_approval_request`))if(A.item.type===`apply_patch_call`){let{call_id:e,operation:t}=A.item;if(b[A.output_index]={toolName:a.toCustomToolName(`apply_patch`),toolCallId:e,applyPatch:{hasDiff:t.type===`delete_file`,endEmitted:t.type===`delete_file`}},r.enqueue({type:`tool-input-start`,id:e,toolName:a.toCustomToolName(`apply_patch`)}),t.type===`delete_file`){let n=JSON.stringify({callId:e,operation:t});r.enqueue({type:`tool-input-delta`,id:e,delta:n}),r.enqueue({type:`tool-input-end`,id:e})}else r.enqueue({type:`tool-input-delta`,id:e,delta:`{"callId":"${rv(e)}","operation":{"type":"${rv(t.type)}","path":"${rv(t.path)}","diff":"`})}else A.item.type===`shell_call`?b[A.output_index]={toolName:a.toCustomToolName(`shell`),toolCallId:A.item.call_id}:A.item.type===`shell_call_output`||(A.item.type===`message`?(x.splice(0,x.length),S=A.item.phase??void 0,r.enqueue({type:`text-start`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...A.item.phase!=null&&{phase:A.item.phase}}}})):Q_(A)&&A.item.type===`reasoning`&&(w[A.item.id]={encryptedContent:A.item.encrypted_content,summaryParts:{0:`active`}},r.enqueue({type:`reasoning-start`,id:`${A.item.id}:0`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}})))}else if(V_(A))if(A.item.type===`message`){let e=A.item.phase??S;S=void 0,r.enqueue({type:`text-end`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...e!=null&&{phase:e},...x.length>0&&{annotations:x}}}})}else if(A.item.type===`function_call`)b[A.output_index]=void 0,C=!0,r.enqueue({type:`tool-input-end`,id:A.item.call_id,...A.item.namespace!=null&&{providerMetadata:{[s]:{namespace:A.item.namespace}}}}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:A.item.name,input:A.item.arguments,providerMetadata:{[s]:{itemId:A.item.id,...A.item.namespace!=null&&{namespace:A.item.namespace}}}});else if(A.item.type===`custom_tool_call`){b[A.output_index]=void 0,C=!0;let e=a.toCustomToolName(A.item.name);r.enqueue({type:`tool-input-end`,id:A.item.call_id}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:e,input:JSON.stringify(A.item.input),providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`web_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),result:nv(A.item.action)});else if(A.item.type===`computer_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:A.item.status||`completed`}});else if(A.item.type===`file_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),result:{queries:A.item.queries,results:A.item.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});else if(A.item.type===`code_interpreter_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),result:{outputs:A.item.outputs}});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.item.result}});else if(A.item.type===`tool_search_call`){let e=b[A.output_index],t=A.item.execution===`server`;if(e!=null){let n=t?e.toolCallId:A.item.call_id??A.item.id;t?E.push(n):r.enqueue({type:`tool-input-start`,id:n,toolName:e.toolName}),r.enqueue({type:`tool-input-end`,id:n}),r.enqueue({type:`tool-call`,toolCallId:n,toolName:e.toolName,input:JSON.stringify({arguments:A.item.arguments,call_id:t?null:n}),...t?{providerExecuted:!0}:{},providerMetadata:{[s]:{itemId:A.item.id}}})}b[A.output_index]=void 0}else if(A.item.type===`tool_search_output`){let e=A.item.call_id??E.shift()??A.item.id;r.enqueue({type:`tool-result`,toolCallId:e,toolName:a.toCustomToolName(`tool_search`),result:{tools:A.item.tools},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_call`){b[A.output_index]=void 0;let e=A.item.approval_request_id??void 0,t=e==null?A.item.id:h.get(e)??m[e]??A.item.id,n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:t,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-result`,toolCallId:t,toolName:n,result:{type:`call`,serverLabel:A.item.server_label,name:A.item.name,arguments:A.item.arguments,...A.item.output==null?{}:{output:A.item.output},...A.item.error==null?{}:{error:A.item.error}},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_list_tools`)b[A.output_index]=void 0;else if(A.item.type===`apply_patch_call`){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&A.item.operation.type!==`delete_file`&&(e.applyPatch.hasDiff||r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.item.operation.diff)}),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0),e&&A.item.status===`completed`&&r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:A.item.call_id,operation:A.item.operation}),providerMetadata:{[s]:{itemId:A.item.id}}}),b[A.output_index]=void 0}else if(A.item.type===`mcp_approval_request`){b[A.output_index]=void 0;let e=(d=p.config).generateId?.call(d)??ug(),t=A.item.approval_request_id??A.item.id;h.set(t,e);let n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:e,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-approval-request`,approvalId:t,toolCallId:e})}else if(A.item.type===`local_shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`local_shell`),input:JSON.stringify({action:{type:`exec`,command:A.item.action.command,timeoutMs:A.item.action.timeout_ms,user:A.item.action.user,workingDirectory:A.item.action.working_directory,env:A.item.action.env}}),providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:A.item.action.commands}}),...c&&{providerExecuted:!0},providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call_output`)r.enqueue({type:`tool-result`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),result:{output:A.item.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});else if(A.item.type===`reasoning`){let e=w[A.item.id],t=Object.entries(e.summaryParts).filter(([e,t])=>t===`active`||t===`can-conclude`).map(([e])=>e);for(let e of t)r.enqueue({type:`reasoning-end`,id:`${A.item.id}:${e}`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}});delete w[A.item.id]}else A.item.type===`compaction`&&r.enqueue({type:`custom`,kind:`openai.compaction`,providerMetadata:{[s]:{type:`compaction`,itemId:A.item.id,encryptedContent:A.item.encrypted_content}}});else if(G_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(K_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(X_(A)){let e=b[A.output_index];e?.applyPatch&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.delta)}),e.applyPatch.hasDiff=!0)}else if(Z_(A)){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&(e.applyPatch.hasDiff||(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.diff)}),e.applyPatch.hasDiff=!0),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0)}else if(q_(A))r.enqueue({type:`tool-result`,toolCallId:A.item_id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.partial_image_b64},preliminary:!0});else if(J_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.delta)})}else if(Y_(A)){let e=b[A.output_index];e!=null&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:A.code,containerId:e.codeInterpreter.containerId}),providerExecuted:!0}))}else if(W_(A))y=A.response.id,r.enqueue({type:`response-metadata`,id:A.response.id,timestamp:new Date(A.response.created_at*1e3),modelId:A.response.model});else if(L_(A))r.enqueue({type:`text-delta`,id:A.item_id,delta:A.delta}),e.providerOptions?.[s]?.logprobs&&A.logprobs&&v.push(A.logprobs);else if(A.type===`response.reasoning_summary_part.added`){if(A.summary_index>0){let e=w[A.item_id];e.summaryParts[A.summary_index]=`active`;for(let t of Object.keys(e.summaryParts))e.summaryParts[t]===`can-conclude`&&(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${t}`,providerMetadata:{[s]:{itemId:A.item_id}}}),e.summaryParts[t]=`concluded`);r.enqueue({type:`reasoning-start`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id,reasoningEncryptedContent:w[A.item_id]?.encryptedContent??null}}})}}else if(A.type===`response.reasoning_summary_text.delta`)r.enqueue({type:`reasoning-delta`,id:`${A.item_id}:${A.summary_index}`,delta:A.delta,providerMetadata:{[s]:{itemId:A.item_id}}});else if(A.type===`response.reasoning_summary_part.done`)o?(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id}}}),w[A.item_id].summaryParts[A.summary_index]=`concluded`):w[A.item_id].summaryParts[A.summary_index]=`can-conclude`;else if(H_(A))g={unified:j_({finishReason:A.response.incomplete_details?.reason,hasFunctionCall:C}),raw:A.response.incomplete_details?.reason??void 0},_=A.response.usage,typeof A.response.service_tier==`string`&&(T=A.response.service_tier),A.response.reasoning?.context!=null&&(ee=A.response.reasoning.context);else if(U_(A)){let e=A.response.incomplete_details?.reason;g={unified:e?j_({finishReason:e,hasFunctionCall:C}):`error`,raw:e??`error`},_=A.response.usage??void 0,A.response.reasoning?.context!=null&&(ee=A.response.reasoning.context),!D&&A.response.error!=null&&(D=!0,r.enqueue({type:`error`,error:{type:`response.failed`,sequence_number:A.sequence_number,response:{error:A.response.error,incomplete_details:A.response.incomplete_details,service_tier:A.response.service_tier}}}))}else $_(A)?(x.push(A.annotation),A.annotation.type===`url_citation`?r.enqueue({type:`source`,sourceType:`url`,id:(f=p.config).generateId?.call(f)??ug(),url:A.annotation.url,title:A.annotation.title}):A.annotation.type===`file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(O=p.config).generateId?.call(O)??ug(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}}):A.annotation.type===`container_file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(te=p.config).generateId?.call(te)??ug(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,containerId:A.annotation.container_id}}}):A.annotation.type===`file_path`&&r.enqueue({type:`source`,sourceType:`document`,id:(k=p.config).generateId?.call(k)??ug(),mediaType:`application/octet-stream`,title:A.annotation.file_id,filename:A.annotation.file_id,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}})):ev(A)&&(D=!0,g={unified:`error`,raw:`error`},r.enqueue({type:`error`,error:A}))},flush(e){let t={[s]:{responseId:y,...v.length>0?{logprobs:v}:{},...T===void 0?{}:{serviceTier:T},...ee===void 0?{}:{reasoningContext:ee}}};e.enqueue({type:`finish`,finishReason:g,usage:E_(_),providerMetadata:t})}})),request:{body:n},response:{headers:u}}}},Ay=K(()=>q(z({instructions:I().nullish(),speed:L().min(.25).max(4).default(1).nullish()}))),jy=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({text:e,voice:t=`alloy`,outputFormat:n=`mp3`,speed:r,instructions:i,language:a,providerOptions:o}){let s=[],c=await kh({provider:`openai`,providerOptions:o,schema:Ay}),l={model:this.modelId,input:e,voice:t,response_format:`mp3`,speed:r,instructions:i};if(n&&([`mp3`,`opus`,`aac`,`flac`,`wav`,`pcm`].includes(n)?l.response_format=n:s.push({type:`unsupported`,feature:`outputFormat`,details:`Unsupported output format: ${n}. Using mp3 instead.`})),c){let e={};for(let t in e){let n=e[t];n!==void 0&&(l[t]=n)}}return a&&s.push({type:`unsupported`,feature:`language`,details:`OpenAI speech models do not support language selection. Language parameter "${a}" was ignored.`}),{requestBody:l,warnings:s}}async doGenerate(e){var t,n;let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{requestBody:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await Vg({url:this.config.url({path:`/audio/speech`,modelId:this.modelId}),headers:Gp((n=this.config).headers?.call(n),e.headers),body:i,failedResponseHandler:uv,successfulResponseHandler:Yg(),abortSignal:e.abortSignal,fetch:this.config.fetch});return{audio:o,warnings:a,request:{body:JSON.stringify(i)},response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}},My=K(()=>q(z({text:I(),language:I().nullish(),duration:L().nullish(),words:R(z({word:I(),start:L(),end:L()})).nullish(),segments:R(z({id:L(),seek:L(),start:L(),end:L(),text:I(),tokens:R(L()),temperature:L(),avg_logprob:L(),compression_ratio:L(),no_speech_prob:L()})).nullish()}))),Ny=K(()=>q(z({include:R(I()).optional(),language:I().optional(),prompt:I().optional(),temperature:L().min(0).max(1).default(0).optional(),timestampGranularities:R(V([`word`,`segment`])).default([`segment`]).optional(),streaming:z({delay:V([`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),include:R(I()).optional()}).optional()}))),Py={afrikaans:`af`,arabic:`ar`,armenian:`hy`,azerbaijani:`az`,belarusian:`be`,bosnian:`bs`,bulgarian:`bg`,catalan:`ca`,chinese:`zh`,croatian:`hr`,czech:`cs`,danish:`da`,dutch:`nl`,english:`en`,estonian:`et`,finnish:`fi`,french:`fr`,galician:`gl`,german:`de`,greek:`el`,hebrew:`he`,hindi:`hi`,hungarian:`hu`,icelandic:`is`,indonesian:`id`,italian:`it`,japanese:`ja`,kannada:`kn`,kazakh:`kk`,korean:`ko`,latvian:`lv`,lithuanian:`lt`,macedonian:`mk`,malay:`ms`,marathi:`mr`,maori:`mi`,nepali:`ne`,norwegian:`no`,persian:`fa`,polish:`pl`,portuguese:`pt`,romanian:`ro`,russian:`ru`,serbian:`sr`,slovak:`sk`,slovenian:`sl`,spanish:`es`,swahili:`sw`,swedish:`sv`,tagalog:`tl`,tamil:`ta`,thai:`th`,turkish:`tr`,ukrainian:`uk`,urdu:`ur`,vietnamese:`vi`,welsh:`cy`},Fy=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({audio:e,mediaType:t,providerOptions:n}){let r=[],i=await kh({provider:`openai`,providerOptions:n,schema:Ny}),a=new FormData,o=e instanceof Uint8Array?new Blob([e]):new Blob([Kp(e)]);a.append(`model`,this.modelId);let s=jm(t);if(a.append(`file`,new File([o],`audio`,{type:t}),`audio.${s}`),this.modelId===`whisper-1`&&a.append(`response_format`,`verbose_json`),i){let e=[`gpt-4o-transcribe`,`gpt-4o-mini-transcribe`].includes(this.modelId),t={include:i.include,language:i.language,prompt:i.prompt,...this.modelId!==`whisper-1`&&{response_format:e?`json`:`verbose_json`},temperature:i.temperature,timestamp_granularities:i.timestampGranularities};for(let[e,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let t of n)a.append(`${e}[]`,String(t));else a.append(e,String(n))}return{formData:a,warnings:r}}async doGenerate(e){var t,n;if(iv(this.modelId))throw new ha({functionality:`non-streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{formData:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await Hg({url:this.config.url({path:`/audio/transcriptions`,modelId:this.modelId}),headers:Gp((n=this.config).headers?.call(n),e.headers),formData:i,failedResponseHandler:uv,successfulResponseHandler:Jg(My),abortSignal:e.abortSignal,fetch:this.config.fetch}),l=o.language!=null&&o.language in Py?Py[o.language]:void 0;return{text:o.text,segments:o.segments?.map(e=>({text:e.text,startSecond:e.start,endSecond:e.end}))??o.words?.map(e=>({text:e.word,startSecond:e.start,endSecond:e.end}))??[],language:l,durationInSeconds:o.duration??void 0,warnings:a,response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}async doStream(e){var t,n;if(!iv(this.modelId))throw new ha({functionality:`streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,i=await kh({provider:`openai`,providerOptions:e.providerOptions,schema:Ny}),a=[],o=e.providerOptions?.openai??{};for(let e of[`include`,`prompt`,`temperature`,`timestampGranularities`])o[e]!=null&&a.push({type:`unsupported`,feature:`providerOptions.openai.${e}`,details:`OpenAI streaming transcription does not support ${e}.`});let s=Gp((n=this.config).headers?.call(n),e.headers),c=ov({modelId:this.modelId,inputAudioFormat:e.inputAudioFormat,providerOptions:i});return{request:{body:c},response:{timestamp:r,modelId:this.modelId},stream:av({webSocket:this.config.webSocket,url:Uh(this.config.url({path:`/realtime?intent=transcription`,modelId:this.modelId})),headers:s,sessionUpdate:c,language:i?.language,warnings:a,audio:e.audio,abortSignal:e.abortSignal,includeRawChunks:e.includeRawChunks})}}},Iy=K(()=>q(z({id:I(),name:I().nullish(),description:I().nullish(),default_version:I().nullish(),latest_version:I().nullish(),created_at:L(),updated_at:L().nullish()}))),Ly=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadSkill(e){let t=[];e.displayTitle!=null&&t.push({type:`unsupported`,feature:`displayTitle`});let n=new FormData;for(let t of e.files){let e=Yp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let{value:r}=await Hg({url:this.config.url({path:`/skills`}),headers:Gp(this.config.headers()),formData:n,failedResponseHandler:uv,successfulResponseHandler:Jg(Iy),fetch:this.config.fetch});return{providerReference:{openai:r.id},...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description},...r.latest_version==null?{}:{latestVersion:r.latest_version},providerMetadata:{openai:{...r.default_version==null?{}:{defaultVersion:r.default_version},...r.created_at==null?{}:{createdAt:r.created_at},...r.updated_at==null?{}:{updatedAt:r.updated_at}}},warnings:t}}},Ry=`4.0.11`,cv()}));function By(e){let t=e?.anthropic;return t?.cacheControl??t?.cache_control}async function Vy({tools:e,toolChoice:t,disableParallelToolUse:n,cacheControlValidator:r,supportsStructuredOutput:i,supportsStrictTools:a,defaultEagerInputStreaming:o=!1}){e=e?.length?e:void 0;let s=[],c=new Set,l=r||new Cb;if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};let u=[];for(let t of e)switch(t.type){case`function`:{let e=l.getCacheControl(t.providerOptions,{type:`tool definition`,canCache:!0}),n=t.providerOptions?.anthropic,r=n?.eagerInputStreaming??o,d=n?.deferLoading,f=n?.allowedCallers;!a&&t.strict!=null&&s.push({type:`unsupported`,feature:`strict`,details:`Tool '${t.name}' has strict: ${t.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`}),u.push({name:t.name,description:t.description,input_schema:t.inputSchema,cache_control:e,...r?{eager_input_streaming:!0}:{},...a===!0&&t.strict!=null?{strict:t.strict}:{},...d==null?{}:{defer_loading:d},...f==null?{}:{allowed_callers:f},...t.inputExamples==null?{}:{input_examples:t.inputExamples.map(e=>e.input)}}),i===!0&&c.add(`structured-outputs-2025-11-13`),(t.inputExamples!=null||f!=null)&&c.add(`advanced-tool-use-2025-11-20`);break}case`provider`:switch(t.id){case`anthropic.code_execution_20250522`:c.add(`code-execution-2025-05-22`),u.push({type:`code_execution_20250522`,name:`code_execution`,cache_control:void 0});break;case`anthropic.code_execution_20250825`:c.add(`code-execution-2025-08-25`),u.push({type:`code_execution_20250825`,name:`code_execution`});break;case`anthropic.code_execution_20260120`:u.push({type:`code_execution_20260120`,name:`code_execution`});break;case`anthropic.computer_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`computer`,type:`computer_20250124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.computer_20251124`:c.add(`computer-use-2025-11-24`),u.push({name:`computer`,type:`computer_20251124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,enable_zoom:t.args.enableZoom,cache_control:void 0});break;case`anthropic.computer_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`computer`,type:`computer_20241022`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.text_editor_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_editor`,type:`text_editor_20250124`,cache_control:void 0});break;case`anthropic.text_editor_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`str_replace_editor`,type:`text_editor_20241022`,cache_control:void 0});break;case`anthropic.text_editor_20250429`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250429`,cache_control:void 0});break;case`anthropic.text_editor_20250728`:{let e=await wh({value:t.args,schema:Ob});u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250728`,max_characters:e.maxCharacters,cache_control:void 0});break}case`anthropic.bash_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`bash`,type:`bash_20250124`,cache_control:void 0});break;case`anthropic.bash_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`bash`,type:`bash_20241022`,cache_control:void 0});break;case`anthropic.memory_20250818`:c.add(`context-management-2025-06-27`),u.push({name:`memory`,type:`memory_20250818`});break;case`anthropic.web_fetch_20250910`:{c.add(`web-fetch-2025-09-10`);let e=await wh({value:t.args,schema:Ub});u.push({type:`web_fetch_20250910`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_fetch_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await wh({value:t.args,schema:zb});u.push({type:`web_fetch_20260209`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_search_20250305`:{let e=await wh({value:t.args,schema:Fb});u.push({type:`web_search_20250305`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.web_search_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await wh({value:t.args,schema:jb});u.push({type:`web_search_20260209`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.tool_search_regex_20251119`:u.push({type:`tool_search_tool_regex_20251119`,name:`tool_search_tool_regex`});break;case`anthropic.tool_search_bm25_20251119`:u.push({type:`tool_search_tool_bm25_20251119`,name:`tool_search_tool_bm25`});break;case`anthropic.advisor_20260301`:{c.add(`advisor-tool-2026-03-01`);let e=await wh({value:t.args,schema:wb});u.push({type:`advisor_20260301`,name:`advisor`,model:e.model,...e.maxUses!==void 0&&{max_uses:e.maxUses},...e.caching!==void 0&&{caching:e.caching}});break}default:s.push({type:`unsupported`,feature:`provider-defined tool ${t.id}`});break}break;default:s.push({type:`unsupported`,feature:`tool ${t}`});break}if(t==null)return{tools:u,toolChoice:n?{type:`auto`,disable_parallel_tool_use:n}:void 0,toolWarnings:s,betas:c};let d=t.type;switch(d){case`auto`:return{tools:u,toolChoice:{type:`auto`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`required`:return{tools:u,toolChoice:{type:`any`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`none`:return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};case`tool`:return{tools:u,toolChoice:{type:`tool`,name:t.toolName,disable_parallel_tool_use:n},toolWarnings:s,betas:c};default:throw new ha({functionality:`tool choice type: ${d}`})}}function Hy({usage:e,rawUsage:t}){let n=e.cache_creation_input_tokens??0,r=e.cache_read_input_tokens??0,i,a,o=e.iterations?.some(e=>e.type===`fallback_message`);if(e.iterations&&e.iterations.length>0&&!o){let t=e.iterations.filter(e=>e.type===`compaction`||e.type===`message`);if(t.length>0){let e=t.reduce((e,t)=>({input:e.input+t.input_tokens,output:e.output+t.output_tokens}),{input:0,output:0});i=e.input,a=e.output}else i=e.input_tokens,a=e.output_tokens}else i=e.input_tokens,a=e.output_tokens;return{inputTokens:{total:i+n+r,noCache:i,cacheRead:r,cacheWrite:n},outputTokens:{total:a,text:void 0,reasoning:void 0},raw:t??e}}function Uy(e){return typeof e==`string`?new TextDecoder().decode(Kp(e)):new TextDecoder().decode(e)}function Wy(e){try{if(typeof e==`string`)return Pm(e);if(typeof e==`object`&&e)return e}catch{let t=e?.errorCode;return{errorCode:typeof t==`string`?t:`unavailable`}}return{}}async function Gy({prompt:e,sendReasoning:t,warnings:n,cacheControlValidator:r,toolNameMapping:i}){let a=new Set,o=Ky(e),s=r||new Cb,c,l=[];async function u(e){return(await kh({provider:`anthropic`,providerOptions:e,schema:bb}))?.citations?.enabled??!1}async function d(e){return(await kh({provider:`anthropic`,providerOptions:e,schema:bb}))?.containerUpload??!1}async function f(e){let t=await kh({provider:`anthropic`,providerOptions:e,schema:bb});return{title:t?.title,context:t?.context}}for(let e=0;e<o.length;e++){let r=o[e],p=e===o.length-1,m=r.type;switch(m){case`system`:{let e=r.messages.map(({content:e,providerOptions:t})=>({type:`text`,text:e,cache_control:s.getCacheControl(t,{type:`system message`,canCache:!0})}));c==null?c=e:(l.push({role:`system`,content:e}),a.add(`mid-conversation-system-2026-04-07`));break}case`user`:{let e=[];for(let t of r.messages){let{role:r,content:i}=t;switch(r){case`user`:for(let n=0;n<i.length;n++){let r=i[n],o=n===i.length-1,c=s.getCacheControl(r.providerOptions,{type:`user message part`,canCache:!0})??(o?s.getCacheControl(t.providerOptions,{type:`user message`,canCache:!0}):void 0);switch(r.type){case`text`:e.push({type:`text`,text:r.text,cache_control:c});break;case`file`:switch(r.data.type){case`reference`:{let t=Ih({reference:r.data.reference,provider:`anthropic`});a.add(`files-api-2025-04-14`),await d(r.providerOptions)?e.push({type:`container_upload`,file_id:t}):rm(r.mediaType)===`image`?e.push({type:`image`,source:{type:`file`,file_id:t},cache_control:c}):e.push({type:`document`,source:{type:`file`,file_id:t},cache_control:c});break}case`text`:{let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:{type:`text`,media_type:`text/plain`,data:r.data.text},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c});break}case`url`:case`data`:{let t=rm(r.mediaType);if(t===`image`)e.push({type:`image`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:Fh({part:r}),data:Jp(r.data.data)},cache_control:c});else if(t===`application`&&(r.data.type===`url`?r.mediaType===`application/pdf`:Fh({part:r})===`application/pdf`)){a.add(`pdfs-2024-09-25`);let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:`application/pdf`,data:Jp(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else if(r.mediaType===`text/plain`){let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`text`,media_type:`text/plain`,data:Uy(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else throw new ha({functionality:`media type: ${r.mediaType}`});break}}break}}break;case`tool`:for(let r=0;r<i.length;r++){let o=i[r];if(o.type===`tool-approval-response`)continue;let c=o.output,l=`providerOptions`in c?c.providerOptions:c.type===`content`?c.value.find(e=>e.providerOptions!=null)?.providerOptions:void 0,u=r===i.length-1,d=s.getCacheControl(o.providerOptions,{type:`tool result part`,canCache:!0})??s.getCacheControl(l,{type:`tool result output`,canCache:!0})??(u?s.getCacheControl(t.providerOptions,{type:`tool result message`,canCache:!0}):void 0),f;switch(c.type){case`content`:f=c.value.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.text};case`file`:{let t=rm(e.mediaType);if(e.data.type===`url`)return t===`image`?{type:`image`,source:{type:`url`,url:e.data.url.toString()}}:{type:`document`,source:{type:`url`,url:e.data.url.toString()}};if(e.data.type===`data`){if(t===`image`)return{type:`image`,source:{type:`base64`,media_type:Fh({part:e}),data:Jp(e.data.data)}};if(Fh({part:e})===`application/pdf`)return a.add(`pdfs-2024-09-25`),{type:`document`,source:{type:`base64`,media_type:`application/pdf`,data:Jp(e.data.data)}};n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with media type: ${e.mediaType}`});return}n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}case`custom`:{let t=e.providerOptions?.anthropic;if(t?.type===`tool-reference`)return{type:`tool_reference`,tool_name:t.toolName};n.push({type:`other`,message:`unsupported custom tool content part`});return}default:n.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(Cm);break;case`text`:case`error-text`:f=c.value;break;case`execution-denied`:f=c.reason??`Tool call execution denied.`;break;default:f=JSON.stringify(c.value);break}e.push({type:`tool_result`,tool_use_id:o.toolCallId,content:f,is_error:c.type===`error-text`||c.type===`error-json`||void 0,cache_control:d})}break;default:throw Error(`Unsupported role: ${r}`)}}l.push({role:`user`,content:e});break}case`assistant`:{let e=[],a=new Set;for(let o=0;o<r.messages.length;o++){let c=r.messages[o],l=o===r.messages.length-1,{content:u}=c;for(let r=0;r<u.length;r++){let o=u[r],d=r===u.length-1,f=s.getCacheControl(o.providerOptions,{type:`assistant message part`,canCache:!0})??(d?s.getCacheControl(c.providerOptions,{type:`assistant message`,canCache:!0}):void 0);switch(o.type){case`text`:o.providerOptions?.anthropic?.type===`compaction`?e.push({type:`compaction`,content:o.text,cache_control:f}):e.push({type:`text`,text:p&&l&&d?o.text.trim():o.text,cache_control:f});break;case`reasoning`:if(t){let t=await kh({provider:`anthropic`,providerOptions:o.providerOptions,schema:yb});t==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):t.signature==null?t.redactedData==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):(s.getCacheControl(o.providerOptions,{type:`redacted thinking block`,canCache:!1}),e.push({type:`redacted_thinking`,data:t.redactedData})):(s.getCacheControl(o.providerOptions,{type:`thinking block`,canCache:!1}),e.push({type:`thinking`,thinking:o.text,signature:t.signature}))}else n.push({type:`other`,message:`sending reasoning content is disabled for this model`});break;case`tool-call`:{if(o.providerExecuted){let t=i.toProviderToolName(o.toolName);if(o.providerOptions?.anthropic?.type===`mcp-tool-use`){a.add(o.toolCallId);let t=o.providerOptions?.anthropic?.serverName;if(t==null||typeof t!=`string`){n.push({type:`other`,message:`mcp tool use server name is required and must be a string`});break}e.push({type:`mcp_tool_use`,id:o.toolCallId,name:o.toolName,input:o.input,server_name:t,cache_control:f})}else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&typeof o.input.type==`string`&&(o.input.type===`bash_code_execution`||o.input.type===`text_editor_code_execution`))e.push({type:`server_tool_use`,id:o.toolCallId,name:o.input.type,input:o.input,cache_control:f});else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&o.input.type===`programmatic-tool-call`){let{type:t,...n}=o.input;e.push({type:`server_tool_use`,id:o.toolCallId,name:`code_execution`,input:n,cache_control:f})}else t===`code_execution`||t===`web_fetch`||t===`web_search`||t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`?e.push({type:`server_tool_use`,id:o.toolCallId,name:t,input:o.input,cache_control:f}):t===`advisor`?e.push({type:`server_tool_use`,id:o.toolCallId,name:`advisor`,input:{},cache_control:f}):n.push({type:`other`,message:`provider executed tool call for tool ${o.toolName} is not supported`});break}let t=o.providerOptions?.anthropic,r=t?.caller?(t.caller.type===`code_execution_20250825`||t.caller.type===`code_execution_20260120`)&&t.caller.toolId?{type:t.caller.type,tool_id:t.caller.toolId}:t.caller.type===`direct`?{type:`direct`}:void 0:void 0;e.push({type:`tool_use`,id:o.toolCallId,name:o.toolName,input:Jy(o.input),...r&&{caller:r},cache_control:f});break}case`tool-result`:{let t=i.toProviderToolName(o.toolName);if(a.has(o.toolCallId)){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}e.push({type:`mcp_tool_result`,tool_use_id:o.toolCallId,is_error:t.type===`error-json`,content:t.value,cache_control:f})}else if(t===`code_execution`){let t=o.output;if(t.type===`error-text`||t.type===`error-json`){let n={};try{typeof t.value==`string`?n=Pm(t.value):typeof t.value==`object`&&t.value!==null&&(n=t.value)}catch{}n.type===`code_execution_tool_result_error`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:`code_execution_tool_result_error`,error_code:n.errorCode??`unknown`},cache_control:f}):e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:{type:`bash_code_execution_tool_result_error`,error_code:n.errorCode??`unknown`}});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}if(t.value==null||typeof t.value!=`object`||!(`type`in t.value)||typeof t.value.type!=`string`){n.push({type:`other`,message:`provider executed tool result output value is not a valid code execution result for tool ${o.toolName}`});break}if(t.value.type===`code_execution_result`){let n=await wh({value:t.value,schema:qb});e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else if(t.value.type===`encrypted_code_execution_result`){let n=await wh({value:t.value,schema:$b});n.type===`encrypted_code_execution_result`&&e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,encrypted_stdout:n.encrypted_stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else{let n=await wh({value:t.value,schema:Xb});n.type===`code_execution_result`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f}):n.type===`bash_code_execution_result`||n.type===`bash_code_execution_tool_result_error`?e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n}):e.push({type:`text_editor_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n})}break}if(t===`web_fetch`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_tool_result_error`,error_code:Wy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await wh({value:t.value,schema:Wb});e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_result`,url:r.url,retrieved_at:r.retrievedAt,content:{type:`document`,title:r.content.title,citations:r.content.citations,source:{type:r.content.source.type,media_type:r.content.source.mediaType,data:r.content.source.data}}},cache_control:f});break}if(t===`web_search`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_search_tool_result_error`,error_code:Wy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await wh({value:t.value,schema:Ib});e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:r.map(e=>({url:e.url,title:e.title,page_age:e.pageAge,encrypted_content:e.encryptedContent,type:e.type})),cache_control:f});break}if(t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`){let t=o.output;if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=(await wh({value:t.value,schema:nx})).map(e=>({type:`tool_reference`,tool_name:e.toolName}));e.push({type:`tool_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`tool_search_tool_search_result`,tool_references:r},cache_control:f});break}if(t===`advisor`){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await wh({value:t.value,schema:Tb});r.type===`advisor_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_result`,text:r.text},cache_control:f}):r.type===`advisor_redacted_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_redacted_result`,encrypted_content:r.encryptedContent},cache_control:f}):e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_tool_result_error`,error_code:r.errorCode},cache_control:f});break}n.push({type:`other`,message:`provider executed tool result for tool ${o.toolName} is not supported`});break}}}}l.push({role:`assistant`,content:qy(e)});break}default:throw Error(`content type: ${m}`)}}return{prompt:{system:c,messages:l},betas:a}}function Ky(e){let t=[],n;for(let r of e){let{role:e}=r;switch(e){case`system`:n?.type!==`system`&&(n={type:`system`,messages:[]},t.push(n)),n.messages.push(r);break;case`assistant`:n?.type!==`assistant`&&(n={type:`assistant`,messages:[]},t.push(n)),n.messages.push(r);break;case`user`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;case`tool`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;default:throw Error(`Unsupported role: ${e}`)}}return t}function qy(e){let t=[],n=[];function r(){t.push(...n.filter(e=>e.type!==`tool_use`),...n.filter(e=>e.type===`tool_use`)),n=[]}for(let i of e)i.type===`thinking`||i.type===`redacted_thinking`?(r(),t.push(i)):n.push(i);return r(),t}function Jy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{rawInvalidInput:e}}function Yy({finishReason:e,isJsonResponseFromTool:t}){switch(e){case`pause_turn`:case`end_turn`:case`stop_sequence`:return`stop`;case`refusal`:return`content-filter`;case`tool_use`:return t?`stop`:`tool-calls`;case`max_tokens`:case`model_context_window_exceeded`:return`length`;case`compaction`:return`other`;default:return`other`}}function Xy(e){return Qy(e)}function Zy(e){return typeof e==`boolean`||!nb(e)?e:Qy(e)}function Qy(e){let t={},n=e;if(e.$ref!=null)return{$ref:e.$ref};if(e.$schema!=null&&(t.$schema=e.$schema),e.$id!=null&&(t.$id=e.$id),e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description),e.default!==void 0&&(t.default=e.default),e.const!==void 0&&(t.const=e.const),e.enum!=null&&(t.enum=e.enum),e.type!=null&&(t.type=e.type),e.anyOf==null?e.oneOf!=null&&(t.anyOf=e.oneOf.map(Zy)):t.anyOf=e.anyOf.map(Zy),e.allOf!=null&&(t.allOf=e.allOf.map(Zy)),e.definitions!=null&&(t.definitions=Object.fromEntries(Object.entries(e.definitions).map(([e,t])=>[e,Zy(t)]))),n.$defs!=null){let e=t;e.$defs=Object.fromEntries(Object.entries(n.$defs).map(([e,t])=>[e,Zy(t)]))}(e.type===`object`||e.properties!=null)&&(e.properties!=null&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,Zy(t)]))),t.additionalProperties=!1,e.required!=null&&(t.required=e.required)),e.items!=null&&(t.items=Array.isArray(e.items)?e.items.map(Zy):Zy(e.items)),typeof e.format==`string`&&ax.has(e.format)&&(t.format=e.format);let r=$y(e);return r!=null&&(t.description=t.description==null?r:`${t.description}
54
- ${r}`),t}function $y(e){let t=ox.flatMap(t=>{let n=e[t];return n==null||n===!1?[]:`${eb(t)}: ${tb(n)}`});return typeof e.format==`string`&&!ax.has(e.format)&&t.push(`format: ${e.format}`),t.length===0?void 0:`${t.join(`; `)}.`}function eb(e){return e.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}function tb(e){return typeof e==`string`?e:JSON.stringify(e)}function nb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rb(e,t,n){if(e.type===`web_search_result_location`)return{type:`source`,sourceType:`url`,id:n(),url:e.url,title:e.title,providerMetadata:{anthropic:{citedText:e.cited_text,encryptedIndex:e.encrypted_index}}};if(e.type!==`page_location`&&e.type!==`char_location`)return;let r=t[e.document_index];if(r)return{type:`source`,sourceType:`document`,id:n(),mediaType:r.mediaType,title:e.document_title??r.title,filename:r.filename,providerMetadata:{anthropic:e.type===`page_location`?{citedText:e.cited_text,startPageNumber:e.start_page_number,endPageNumber:e.end_page_number}:{citedText:e.cited_text,startCharIndex:e.start_char_index,endCharIndex:e.end_char_index}}}}function ib(e){return e.includes(`claude-opus-4-8`)||e.includes(`claude-opus-4-7`)||e.includes(`claude-fable-5`)||e.includes(`claude-sonnet-5`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!0,supportsXhighEffort:!0,isKnownModel:!0}:e.includes(`claude-sonnet-4-6`)||e.includes(`claude-opus-4-6`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-5`)||e.includes(`claude-opus-4-5`)||e.includes(`claude-haiku-4-5`)?{maxOutputTokens:64e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-1`)?{maxOutputTokens:32e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-`)?{maxOutputTokens:64e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-`)?{maxOutputTokens:32e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-3-haiku`)?{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!1}}function ab(e){if(!e)return!1;let t=!1,n=!1;for(let r of e){if(`type`in r&&(r.type===`web_fetch_20260209`||r.type===`web_search_20260209`)){t=!0;continue}if(r.name===`code_execution`){n=!0;break}}return t&&!n}function ob({reasoning:e,supportsAdaptiveThinking:t,supportsXhighEffort:n,maxOutputTokensForModel:r,warnings:i}){if(!Om(e))return;if(e===`none`)return{thinking:{type:`disabled`}};if(t)return{thinking:{type:`adaptive`},effort:km({reasoning:e,effortMap:{minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:n?`xhigh`:`max`},warnings:i})};let a=Am({reasoning:e,maxOutputTokens:r,maxReasoningBudget:r,warnings:i});if(a!=null)return{thinking:{type:`enabled`,budgetTokens:a}}}function sb(e){return e?{appliedEdits:e.applied_edits.map(e=>{switch(e.type){case`clear_tool_uses_20250919`:return{type:e.type,clearedToolUses:e.cleared_tool_uses,clearedInputTokens:e.cleared_input_tokens};case`clear_thinking_20251015`:return{type:e.type,clearedThinkingTurns:e.cleared_thinking_turns,clearedInputTokens:e.cleared_input_tokens};case`compact_20260112`:return{type:e.type}}}).filter(e=>e!==void 0)}:null}function cb(e){if(e!=null)return{type:e.type,...e.category==null?{}:{category:e.category},...e.explanation==null?{}:{explanation:e.explanation},...e.recommended_model==null?{}:{recommendedModel:e.recommended_model}}}function lb(e={}){let{execute:t,...n}=e;return cx(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function ub(e={}){let{execute:t,...n}=e;return lx(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function db(e){let t=Gh(e);return t===Tx?Ex:t}function fb(e={}){let t=db(Dm({settingValue:e.baseURL,environmentVariableName:`ANTHROPIC_BASE_URL`}))??Ex,n=e.name??`anthropic.messages`;if(e.apiKey&&e.authToken)throw new pi({argument:`apiKey/authToken`,message:`Both apiKey and authToken were provided. Please use only one authentication method.`});let r=()=>xm({"anthropic-version":`2023-06-01`,...e.authToken?{Authorization:`Bearer ${e.authToken}`}:{"x-api-key":Em({apiKey:e.apiKey,environmentVariableName:`ANTHROPIC_API_KEY`,description:`Anthropic`})},...e.headers},`ai-sdk/anthropic/${wx}`),i=i=>new sx(i,{provider:n,baseURL:t,headers:r,fetch:e.fetch,generateId:e.generateId??ug,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})}),a=()=>new Cx({provider:`${n.replace(`.messages`,``)}.skills`,baseURL:t,headers:r,fetch:e.fetch}),o=function(e){if(new.target)throw Error(`The Anthropic model function cannot be called with the new keyword.`);return i(e)};return o.specificationVersion=`v4`,o.languageModel=i,o.chat=i,o.messages=i,o.embeddingModel=e=>{throw new Gi({modelId:e,modelType:`embeddingModel`})},o.textEmbeddingModel=o.embeddingModel,o.imageModel=e=>{throw new Gi({modelId:e,modelType:`imageModel`})},o.files=()=>new hb({provider:n,baseURL:t,headers:r,fetch:e.fetch}),o.skills=a,o.tools=bx,o}var pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex,Dx=t((()=>{ga(),Qg(),Fd(),pb=Kg({errorSchema:K(()=>q(z({type:H(`error`),error:z({type:I(),message:I()})}))),errorToMessage:e=>e.error.message}),mb=K(()=>q(z({id:I(),type:H(`file`),filename:I(),mime_type:I(),size_bytes:L(),created_at:I(),downloadable:cu().nullish()}))),hb=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n}){let r=Yp(e),i=new Blob([r],{type:t}),a=new FormData;n==null?a.append(`file`,i):a.append(`file`,i,n);let{value:o}=await Hg({url:`${this.config.baseURL}/files`,headers:Gp(this.config.headers(),{"anthropic-beta":`files-api-2025-04-14`}),formData:a,failedResponseHandler:pb,successfulResponseHandler:Jg(mb),fetch:this.config.fetch});return{warnings:[],providerReference:{anthropic:o.id},mediaType:o.mime_type??t,filename:o.filename??n,providerMetadata:{anthropic:{filename:o.filename,mimeType:o.mime_type,sizeBytes:o.size_bytes,createdAt:o.created_at,...o.downloadable==null?{}:{downloadable:o.downloadable}}}}}},gb=z({type:I(),category:I().nullish(),explanation:I().nullish(),recommended_model:I().nullish()}),_b=K(()=>q(z({type:H(`message`),id:I().nullish(),model:I().nullish(),content:R(mu(`type`,[z({type:H(`text`),text:I(),citations:R(mu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])).optional()}),z({type:H(`thinking`),thinking:I(),signature:I()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:du(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:_u(I(),du()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:du(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:cu(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])),stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:gb.nullish(),usage:pu({input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish(),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}))),vb=K(()=>q(mu(`type`,[z({type:H(`message_start`),message:z({id:I().nullish(),model:I().nullish(),role:I().nullish(),usage:pu({input_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()}),content:R(mu(`type`,[z({type:H(`tool_use`),id:I(),name:I(),input:du(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()})])).nullish(),stop_reason:I().nullish(),container:z({expires_at:I(),id:I()}).nullish()})}),z({type:H(`content_block_start`),index:L(),content_block:mu(`type`,[z({type:H(`text`),text:I()}),z({type:H(`thinking`),thinking:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:_u(I(),du()).optional(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I().nullish()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:_u(I(),du()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:du(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:cu(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])}),z({type:H(`content_block_delta`),index:L(),delta:mu(`type`,[z({type:H(`input_json_delta`),partial_json:I()}),z({type:H(`text_delta`),text:I()}),z({type:H(`thinking_delta`),thinking:I()}),z({type:H(`signature_delta`),signature:I()}),z({type:H(`compaction_delta`),content:I().nullish()}),z({type:H(`citations_delta`),citation:mu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])})])}),z({type:H(`content_block_stop`),index:L()}),z({type:H(`error`),error:z({type:I(),message:I()})}),z({type:H(`message_delta`),delta:z({stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:gb.nullish(),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish()}),usage:pu({input_tokens:L().nullish(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}),z({type:H(`message_stop`)}),z({type:H(`ping`)})]))),yb=K(()=>q(z({signature:I().optional(),redactedData:I().optional()}))),bb=z({containerUpload:cu().optional(),citations:z({enabled:cu()}).optional(),title:I().optional(),context:I().optional()}),xb=z({sendReasoning:cu().optional(),structuredOutputMode:V([`outputFormat`,`jsonTool`,`auto`]).optional(),thinking:mu(`type`,[z({type:H(`adaptive`),display:V([`omitted`,`summarized`]).optional()}),z({type:H(`enabled`),budgetTokens:L().optional()}),z({type:H(`disabled`)})]).optional(),disableParallelToolUse:cu().optional(),cacheControl:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)]).optional()}).optional(),metadata:z({userId:I().optional()}).optional(),mcpServers:R(z({type:H(`url`),name:I(),url:I(),authorizationToken:I().nullish(),toolConfiguration:z({enabled:cu().nullish(),allowedTools:R(I()).nullish()}).nullish()})).optional(),container:z({id:I().optional(),skills:R(mu(`type`,[z({type:H(`anthropic`),skillId:I(),version:I().optional()}),z({type:H(`custom`),providerReference:_u(I(),I()),version:I().optional()})])).optional()}).optional(),toolStreaming:cu().optional(),effort:V([`low`,`medium`,`high`,`xhigh`,`max`]).optional(),taskBudget:z({type:H(`tokens`),total:L().int().min(2e4),remaining:L().int().min(0).optional()}).optional(),speed:V([`fast`,`standard`]).optional(),inferenceGeo:V([`us`,`global`]).optional(),fallbacks:R(z({model:I(),max_tokens:L().int().optional(),thinking:_u(I(),du()).optional(),output_config:_u(I(),du()).optional(),speed:V([`fast`,`standard`]).optional()})).optional(),anthropicBeta:R(I()).optional(),contextManagement:z({edits:R(mu(`type`,[z({type:H(`clear_tool_uses_20250919`),trigger:mu(`type`,[z({type:H(`input_tokens`),value:L()}),z({type:H(`tool_uses`),value:L()})]).optional(),keep:z({type:H(`tool_uses`),value:L()}).optional(),clearAtLeast:z({type:H(`input_tokens`),value:L()}).optional(),clearToolInputs:cu().optional(),excludeTools:R(I()).optional()}),z({type:H(`clear_thinking_20251015`),keep:B([H(`all`),z({type:H(`thinking_turns`),value:L()})]).optional()}),z({type:H(`compact_20260112`),trigger:z({type:H(`input_tokens`),value:L()}).optional(),pauseAfterCompaction:cu().optional(),instructions:I().optional()})]))}).optional()}),Sb=4,Cb=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(e,t){let n=By(e);if(n){if(!t.canCache){this.warnings.push({type:`unsupported`,feature:`cache_control on non-cacheable context`,details:`cache_control cannot be set on ${t.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>Sb){this.warnings.push({type:`unsupported`,feature:`cacheControl breakpoint limit`,details:`Maximum ${Sb} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return n}}getWarnings(){return this.warnings}},wb=K(()=>q(z({model:I(),maxUses:L().optional(),caching:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)])}).optional()}))),Tb=K(()=>q(mu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encryptedContent:I()}),z({type:H(`advisor_tool_result_error`),errorCode:I()})]))),Eb=Nh({id:`anthropic.advisor_20260301`,inputSchema:K(()=>q(z({}).strict())),outputSchema:Tb,supportsDeferredResults:!0}),Db=e=>Eb(e),Ob=K(()=>q(z({maxCharacters:L().optional()}))),kb=jh({id:`anthropic.text_editor_20250728`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),Ab=(e={})=>kb(e),jb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Mb=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),Nb=Nh({id:`anthropic.web_search_20260209`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Mb,supportsDeferredResults:!0}),Pb=(e={})=>Nb(e),Fb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Ib=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),Lb=Nh({id:`anthropic.web_search_20250305`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Ib,supportsDeferredResults:!0}),Rb=(e={})=>Lb(e),zb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:cu()}).optional(),maxContentTokens:L().optional()}))),Bb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),Vb=Nh({id:`anthropic.web_fetch_20260209`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Bb,supportsDeferredResults:!0}),Hb=(e={})=>Vb(e),Ub=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:cu()}).optional(),maxContentTokens:L().optional()}))),Wb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),Gb=Nh({id:`anthropic.web_fetch_20250910`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Wb,supportsDeferredResults:!0}),Kb=(e={})=>Gb(e),qb=K(()=>q(z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}))),Jb=Nh({id:`anthropic.code_execution_20250522`,inputSchema:K(()=>q(z({code:I()}))),outputSchema:qb}),Yb=(e={})=>Jb(e),Xb=K(()=>q(mu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),Zb=Nh({id:`anthropic.code_execution_20250825`,inputSchema:K(()=>q(mu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),mu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:Xb,supportsDeferredResults:!0}),Qb=(e={})=>Zb(e),$b=K(()=>q(mu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),ex=Nh({id:`anthropic.code_execution_20260120`,inputSchema:K(()=>q(mu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),mu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:$b,supportsDeferredResults:!0}),tx=(e={})=>ex(e),nx=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),rx=Nh({id:`anthropic.tool_search_regex_20251119`,inputSchema:K(()=>q(z({pattern:I(),limit:L().optional()}))),outputSchema:nx,supportsDeferredResults:!0}),ix=(e={})=>rx(e),ax=new Set([`date-time`,`time`,`date`,`duration`,`email`,`hostname`,`uri`,`ipv4`,`ipv6`,`uuid`]),ox=[`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`multipleOf`,`minLength`,`maxLength`,`pattern`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`,`not`],sx=class e{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.config=t,this.generateId=t.generateId??ug}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}supportsUrl(e){return e.protocol===`https:`}get provider(){return this.config.provider}get providerOptionsName(){let e=this.config.provider,t=e.indexOf(`.`);return t===-1?e:e.substring(0,t)}get supportedUrls(){var e;return(e=this.config).supportedUrls?.call(e)??{}}async getArgs({userSuppliedBetas:e,prompt:t,maxOutputTokens:n,temperature:r,topP:i,topK:a,frequencyPenalty:o,presencePenalty:s,stopSequences:c,responseFormat:l,seed:u,tools:d,toolChoice:f,reasoning:p,providerOptions:m,stream:h}){let g=[];o!=null&&g.push({type:`unsupported`,feature:`frequencyPenalty`}),s!=null&&g.push({type:`unsupported`,feature:`presencePenalty`}),u!=null&&g.push({type:`unsupported`,feature:`seed`}),r!=null&&r>1?(g.push({type:`unsupported`,feature:`temperature`,details:`${r} exceeds anthropic maximum of 1.0. clamped to 1.0`}),r=1):r!=null&&r<0&&(g.push({type:`unsupported`,feature:`temperature`,details:`${r} is below anthropic minimum of 0. clamped to 0`}),r=0),l?.type===`json`&&(l.schema??g.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format requires a schema. The response format is ignored.`}));let _=this.providerOptionsName,v=await kh({provider:`anthropic`,providerOptions:m,schema:xb}),y=_===`anthropic`?null:await kh({provider:_,providerOptions:m,schema:xb}),b=y!=null,x=Object.assign({},v??{},y??{}),{maxOutputTokens:S,supportsStructuredOutput:C,supportsAdaptiveThinking:w,rejectsSamplingParameters:T,supportsXhighEffort:ee,isKnownModel:E}=ib(this.modelId);T&&(r!=null&&(g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported by ${this.modelId} and will be ignored`}),r=void 0),a!=null&&(g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported by ${this.modelId} and will be ignored`}),a=void 0),i!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported by ${this.modelId} and will be ignored`}),i=void 0));let D=E||this.modelId.startsWith(`claude-`),O=(this.config.supportsNativeStructuredOutput??!0)&&C,te=(this.config.supportsStrictTools??!0)&&C,k=x?.structuredOutputMode??`auto`,A=k===`outputFormat`||k===`auto`&&O,ne=l?.type===`json`&&l.schema!=null&&!A?{type:`function`,name:`json`,description:`Respond with a JSON object.`,inputSchema:l.schema}:void 0,re=x?.contextManagement,ie=new Cb,ae=Zp({tools:d,providerToolNames:{"anthropic.code_execution_20250522":`code_execution`,"anthropic.code_execution_20250825":`code_execution`,"anthropic.code_execution_20260120":`code_execution`,"anthropic.computer_20241022":`computer`,"anthropic.computer_20250124":`computer`,"anthropic.text_editor_20241022":`str_replace_editor`,"anthropic.text_editor_20250124":`str_replace_editor`,"anthropic.text_editor_20250429":`str_replace_based_edit_tool`,"anthropic.text_editor_20250728":`str_replace_based_edit_tool`,"anthropic.bash_20241022":`bash`,"anthropic.bash_20250124":`bash`,"anthropic.memory_20250818":`memory`,"anthropic.web_search_20250305":`web_search`,"anthropic.web_search_20260209":`web_search`,"anthropic.web_fetch_20250910":`web_fetch`,"anthropic.web_fetch_20260209":`web_fetch`,"anthropic.tool_search_regex_20251119":`tool_search_tool_regex`,"anthropic.tool_search_bm25_20251119":`tool_search_tool_bm25`,"anthropic.advisor_20260301":`advisor`}}),{prompt:oe,betas:se}=await Gy({prompt:t,sendReasoning:x?.sendReasoning??!0,warnings:g,cacheControlValidator:ie,toolNameMapping:ae});if(Om(p)&&x?.effort==null){let e=ob({reasoning:p,supportsAdaptiveThinking:w,supportsXhighEffort:ee,maxOutputTokensForModel:S,warnings:g});e!=null&&(x.thinking??=e.thinking,e.effort!=null&&x.thinking?.type!==`disabled`&&(x.effort=e.effort))}let ce=x?.thinking?.type,le=ce===`enabled`||ce===`adaptive`,ue=le||ce===`disabled`,de=ce===`enabled`?x?.thinking?.budgetTokens:void 0,fe=ce===`adaptive`?x?.thinking?.display:void 0,pe=n??S,me={model:this.modelId,max_tokens:pe,temperature:r,top_k:a,top_p:i,stop_sequences:c,...ue&&{thinking:{type:ce,...de!=null&&{budget_tokens:de},...fe!=null&&{display:fe}}},...(x?.effort||x?.taskBudget||A&&l?.type===`json`&&l.schema!=null)&&{output_config:{...x?.effort&&{effort:x.effort},...x?.taskBudget&&{task_budget:{type:x.taskBudget.type,total:x.taskBudget.total,...x.taskBudget.remaining!=null&&{remaining:x.taskBudget.remaining}}},...A&&l?.type===`json`&&l.schema!=null&&{format:{type:`json_schema`,schema:Xy(l.schema)}}}},...x?.speed&&{speed:x.speed},...x?.inferenceGeo&&{inference_geo:x.inferenceGeo},...x?.fallbacks&&x.fallbacks.length>0&&{fallbacks:x.fallbacks},...x?.cacheControl&&{cache_control:x.cacheControl},...x?.metadata?.userId!=null&&{metadata:{user_id:x.metadata.userId}},...x?.mcpServers&&x.mcpServers.length>0&&{mcp_servers:x.mcpServers.map(e=>({type:e.type,name:e.name,url:e.url,authorization_token:e.authorizationToken,tool_configuration:e.toolConfiguration?{allowed_tools:e.toolConfiguration.allowedTools,enabled:e.toolConfiguration.enabled}:void 0}))},...x?.container&&{container:x.container.skills&&x.container.skills.length>0?{id:x.container.id,skills:x.container.skills.map(e=>({type:e.type,skill_id:e.type===`custom`?Ih({reference:e.providerReference,provider:`anthropic`}):e.skillId,version:e.version}))}:x.container.id},system:oe.system,messages:oe.messages,...re&&{context_management:{edits:re.edits.map(e=>{let t=e.type;switch(t){case`clear_tool_uses_20250919`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.keep!==void 0&&{keep:e.keep},...e.clearAtLeast!==void 0&&{clear_at_least:e.clearAtLeast},...e.clearToolInputs!==void 0&&{clear_tool_inputs:e.clearToolInputs},...e.excludeTools!==void 0&&{exclude_tools:e.excludeTools}};case`clear_thinking_20251015`:return{type:e.type,...e.keep!==void 0&&{keep:e.keep}};case`compact_20260112`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.pauseAfterCompaction!==void 0&&{pause_after_compaction:e.pauseAfterCompaction},...e.instructions!==void 0&&{instructions:e.instructions}};default:g.push({type:`other`,message:`Unknown context management strategy: ${t}`});return}}).filter(e=>e!==void 0)}}};le?(ce===`enabled`&&de==null&&(g.push({type:`compatibility`,feature:`extended thinking`,details:`thinking budget is required when thinking is enabled. using default budget of 1024 tokens.`}),me.thinking={type:`enabled`,budget_tokens:1024},de=1024),me.temperature!=null&&(me.temperature=void 0,g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported when thinking is enabled`})),a!=null&&(me.top_k=void 0,g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported when thinking is enabled`})),i!=null&&(me.top_p=void 0,g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when thinking is enabled`})),me.max_tokens=pe+(de??0)):D&&i!=null&&r!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when temperature is set. topP is ignored.`}),me.top_p=void 0),E&&me.max_tokens>S&&(n!=null&&g.push({type:`unsupported`,feature:`maxOutputTokens`,details:`${me.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${S} max output tokens. The max output tokens have been limited to ${S}.`}),me.max_tokens=S),x?.mcpServers&&x.mcpServers.length>0&&se.add(`mcp-client-2025-04-04`),re&&(se.add(`context-management-2025-06-27`),re.edits.some(e=>e.type===`compact_20260112`)&&se.add(`compact-2026-01-12`)),x?.container&&x.container.skills&&x.container.skills.length>0&&(se.add(`code-execution-2025-08-25`),se.add(`skills-2025-10-02`),se.add(`files-api-2025-04-14`),d?.some(e=>e.type===`provider`&&(e.id===`anthropic.code_execution_20250825`||e.id===`anthropic.code_execution_20260120`))||g.push({type:`other`,message:`code execution tool is required when using skills`})),x?.taskBudget&&se.add(`task-budgets-2026-03-13`),x?.speed===`fast`&&se.add(`fast-mode-2026-02-01`),x?.fallbacks&&x.fallbacks.length>0&&se.add(`server-side-fallback-2026-06-01`);let he=h&&(x?.toolStreaming??!0),{tools:ge,toolChoice:_e,toolWarnings:ve,betas:ye}=await Vy(ne==null?{tools:d??[],toolChoice:f,disableParallelToolUse:x?.disableParallelToolUse,cacheControlValidator:ie,supportsStructuredOutput:O,supportsStrictTools:te,defaultEagerInputStreaming:he}:{tools:[...d??[],ne],toolChoice:{type:`required`},disableParallelToolUse:!0,cacheControlValidator:ie,supportsStructuredOutput:!1,supportsStrictTools:te,defaultEagerInputStreaming:he}),be=ie.getWarnings();return{args:{...me,tools:ge,tool_choice:_e,stream:h===!0||void 0},warnings:[...g,...ve,...be],betas:new Set([...se,...ye,...e,...x?.anthropicBeta??[]]),usesJsonResponseTool:ne!=null,toolNameMapping:ae,providerOptionsName:_,usedCustomProviderKey:b}}async getHeaders({betas:e,headers:t}){return Gp(this.config.headers?await Ph(this.config.headers):void 0,t,e.size>0?{"anthropic-beta":Array.from(e).join(`,`)}:{})}async getBetasFromHeaders(e){let t=(this.config.headers?await Ph(this.config.headers):void 0)?.[`anthropic-beta`]??``,n=e?.[`anthropic-beta`]??``;return new Set([...t.toLowerCase().split(`,`),...n.toLowerCase().split(`,`)].map(e=>e.trim()).filter(e=>e!==``))}buildRequestUrl(e){var t;return(t=this.config).buildRequestUrl?.call(t,this.config.baseURL,e)??`${this.config.baseURL}/messages`}transformRequestBody(e,t){var n;return(n=this.config).transformRequestBody?.call(n,e,t)??e}extractCitationDocuments(e){return e.filter(e=>e.role===`user`).flatMap(e=>e.content).filter(e=>e.type!==`file`||e.mediaType!==`application/pdf`&&e.mediaType!==`text/plain`?!1:e.providerOptions?.anthropic?.citations?.enabled??!1).map(e=>{let t=e;return{title:t.filename??`Untitled Document`,filename:t.filename,mediaType:t.mediaType}})}async doGenerate(e){let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=ab(t.tools),{responseHeaders:u,value:d,rawValue:f}=await Vg({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:pb,successfulResponseHandler:Jg(_b),abortSignal:e.abortSignal,fetch:this.config.fetch}),p=[],m={},h={},g=!1;for(let e of d.content)switch(e.type){case`text`:if(!i&&(p.push({type:`text`,text:e.text}),e.citations))for(let t of e.citations){let e=rb(t,c,this.generateId);e&&p.push(e)}break;case`thinking`:p.push({type:`reasoning`,text:e.thinking,providerMetadata:{anthropic:{signature:e.signature}}});break;case`redacted_thinking`:p.push({type:`reasoning`,text:``,providerMetadata:{anthropic:{redactedData:e.data}}});break;case`compaction`:p.push({type:`text`,text:e.content,providerMetadata:{anthropic:{type:`compaction`}}});break;case`tool_use`:if(i&&e.name===`json`)g=!0,p.push({type:`text`,text:JSON.stringify(e.input)});else{let t=e.caller,n=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0;p.push({type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),...n&&{providerMetadata:{anthropic:{caller:n}}}})}break;case`server_tool_use`:if(e.name===`text_editor_code_execution`||e.name===`bash_code_execution`)p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`code_execution`),input:JSON.stringify({type:e.name,...e.input}),providerExecuted:!0,...l?{dynamic:!0}:{}});else if(e.name===`web_search`||e.name===`code_execution`||e.name===`web_fetch`){let t=e.name===`code_execution`&&e.input!=null&&typeof e.input==`object`&&`code`in e.input&&!(`type`in e.input)?{type:`programmatic-tool-call`,...e.input}:e.input;p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(t),providerExecuted:!0,...l&&e.name===`code_execution`?{dynamic:!0}:{}})}else e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`?(h[e.id]=e.name,p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(e.input),providerExecuted:!0})):e.name===`advisor`&&p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`advisor`),input:JSON.stringify(e.input),providerExecuted:!0});break;case`mcp_tool_use`:m[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},p.push(m[e.id]);break;case`mcp_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:m[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:m[e.tool_use_id].providerMetadata});break;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});break;case`web_search_tool_result`:if(Array.isArray(e.content)){p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)p.push({type:`source`,sourceType:`url`,id:this.generateId(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});break;case`code_execution_tool_result`:e.content.type===`code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});break;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});break;case`tool_search_tool_result`:{let t=h[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});break}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});break}case`fallback`:break}return{content:p,finishReason:{unified:Yy({finishReason:d.stop_reason,isJsonResponseFromTool:g}),raw:d.stop_reason??void 0},usage:Hy({usage:d.usage}),request:{body:t},response:{id:d.id??void 0,modelId:d.model??void 0,headers:u,body:f},warnings:n,providerMetadata:(()=>{let e=cb(d.stop_details),t={usage:d.usage,stopSequence:d.stop_sequence??null,...e==null?{}:{stopDetails:e},iterations:d.usage.iterations?d.usage.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:d.container?{expiresAt:d.container.expires_at,id:d.container.id,skills:d.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null}:null,contextManagement:sb(d.context_management)??null},n={anthropic:t};return s&&o!==`anthropic`&&(n[o]=t),n})()}}async doStream(e){"use step";let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=ab(t.tools),u=this.buildRequestUrl(!0),{responseHeaders:d,value:f}=await Vg({url:u,headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:pb,successfulResponseHandler:qg(vb),abortSignal:e.abortSignal,fetch:this.config.fetch}),p={unified:`other`,raw:void 0},m={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},h={},g={},_={},v=null,y,b=null,x,S=null,C=!1,w,T=this.generateId,[ee,E]=f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){n.enqueue({type:`error`,error:t.error});return}let r=t.value;switch(r.type){case`ping`:return;case`content_block_start`:{let e=r.content_block,t=e.type;if(t===`fallback`)return;switch(w=t,t){case`text`:if(i)return;h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});return;case`thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index)});return;case`redacted_thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index),providerMetadata:{anthropic:{redactedData:e.data}}});return;case`compaction`:h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index),providerMetadata:{anthropic:{type:`compaction`}}});return;case`tool_use`:if(i&&e.name===`json`)C=!0,h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});else{let t=e.caller,i=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0,a=e.input&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:a,firstDelta:a.length===0,...i&&{caller:i}},n.enqueue({type:`tool-input-start`,id:e.id,toolName:e.name})}return;case`server_tool_use`:if([`web_fetch`,`web_search`,`code_execution`,`text_editor_code_execution`,`bash_code_execution`].includes(e.name)){let t=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?`code_execution`:e.name,i=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?e.name:e.name===`code_execution`?`programmatic-tool-call`:void 0,o=a.toCustomToolName(t),s=e.input!=null&&typeof e.input==`object`&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:o,input:s,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{},firstDelta:s.length===0,providerToolName:t,providerToolInputType:i},n.enqueue({type:`tool-input-start`,id:e.id,toolName:o,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{}})}else if(e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`){_[e.id]=e.name;let t=a.toCustomToolName(e.name);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:``,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}else if(e.name===`advisor`){let t=a.toCustomToolName(`advisor`);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:`{}`,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}return;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});return;case`web_search_tool_result`:if(Array.isArray(e.content)){n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)n.enqueue({type:`source`,sourceType:`url`,id:T(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});return;case`code_execution_tool_result`:e.content.type===`code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});return;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});return;case`tool_search_tool_result`:{let t=_[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});return}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});return}case`mcp_tool_use`:g[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},n.enqueue(g[e.id]);return;case`mcp_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:g[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:g[e.tool_use_id].providerMetadata});return;default:throw Error(`Unsupported content block type: ${t}`)}}case`content_block_stop`:if(h[r.index]!=null){let e=h[r.index];switch(e.type){case`text`:n.enqueue({type:`text-end`,id:String(r.index)});break;case`reasoning`:n.enqueue({type:`reasoning-end`,id:String(r.index)});break;case`tool-call`:if(!(i&&e.toolName===`json`)){n.enqueue({type:`tool-input-end`,id:e.toolCallId});let t=e.input===``?`{}`:e.input;if(e.providerToolName===`code_execution`)try{let e=Pm(t);typeof e==`object`&&e&&`code`in e&&!(`type`in e)&&(t=JSON.stringify({type:`programmatic-tool-call`,...e}))}catch{}n.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:t,providerExecuted:e.providerExecuted,...l&&e.providerToolName===`code_execution`?{dynamic:!0}:{},...e.caller&&{providerMetadata:{anthropic:{caller:e.caller}}}})}break}delete h[r.index]}w=void 0;return;case`content_block_delta`:{let e=r.delta.type;switch(e){case`text_delta`:if(i)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.text});return;case`thinking_delta`:n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:r.delta.thinking});return;case`signature_delta`:w===`thinking`&&n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:``,providerMetadata:{anthropic:{signature:r.delta.signature}}});return;case`compaction_delta`:r.delta.content!=null&&n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.content});return;case`input_json_delta`:{let e=h[r.index],t=r.delta.partial_json;if(t.length===0)return;if(C){if(e?.type!==`text`)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:t})}else{if(e?.type!==`tool-call`)return;e.firstDelta&&e.providerToolInputType!=null&&(t=`{"type": "${e.providerToolInputType}",${t.substring(1)}`),n.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:t}),e.input+=t,e.firstDelta=!1}return}case`citations_delta`:{let e=r.delta.citation,t=rb(e,c,T);t&&n.enqueue(t);return}default:throw Error(`Unsupported delta type: ${e}`)}}case`message_start`:if(m.input_tokens=r.message.usage.input_tokens,m.cache_read_input_tokens=r.message.usage.cache_read_input_tokens??0,m.cache_creation_input_tokens=r.message.usage.cache_creation_input_tokens??0,y={...r.message.usage},r.message.container!=null&&(S={expiresAt:r.message.container.expires_at,id:r.message.container.id,skills:null}),r.message.stop_reason!=null&&(p={unified:Yy({finishReason:r.message.stop_reason,isJsonResponseFromTool:C}),raw:r.message.stop_reason}),n.enqueue({type:`response-metadata`,id:r.message.id??void 0,modelId:r.message.model??void 0}),r.message.content!=null)for(let e=0;e<r.message.content.length;e++){let t=r.message.content[e];if(t.type===`tool_use`){let e=t.caller,r=e?{type:e.type,toolId:`tool_id`in e?e.tool_id:void 0}:void 0;n.enqueue({type:`tool-input-start`,id:t.id,toolName:t.name});let i=JSON.stringify(t.input??{});n.enqueue({type:`tool-input-delta`,id:t.id,delta:i}),n.enqueue({type:`tool-input-end`,id:t.id}),n.enqueue({type:`tool-call`,toolCallId:t.id,toolName:t.name,input:i,...r&&{providerMetadata:{anthropic:{caller:r}}}})}}return;case`message_delta`:r.usage.input_tokens!=null&&m.input_tokens!==r.usage.input_tokens&&(m.input_tokens=r.usage.input_tokens),m.output_tokens=r.usage.output_tokens,r.usage.cache_read_input_tokens!=null&&(m.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.cache_creation_input_tokens!=null&&(m.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.iterations!=null&&(m.iterations=r.usage.iterations),p={unified:Yy({finishReason:r.delta.stop_reason,isJsonResponseFromTool:C}),raw:r.delta.stop_reason??void 0},b=r.delta.stop_sequence??null,x=cb(r.delta.stop_details),S=r.delta.container==null?null:{expiresAt:r.delta.container.expires_at,id:r.delta.container.id,skills:r.delta.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null},r.context_management&&(v=sb(r.context_management)),y={...y,...r.usage};return;case`message_stop`:{let e={usage:y??null,stopSequence:b,...x==null?{}:{stopDetails:x},iterations:m.iterations?m.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:S,contextManagement:v},t={anthropic:e};s&&o!==`anthropic`&&(t[o]=e),n.enqueue({type:`finish`,finishReason:p,usage:Hy({usage:m,rawUsage:y}),providerMetadata:t});return}case`error`:n.enqueue({type:`error`,error:r.error});return;default:throw Error(`Unsupported chunk type: ${r}`)}}})).tee(),D=ee.getReader();try{await D.read();let e=await D.read();if(e.value?.type===`raw`&&(e=await D.read()),e.value?.type===`error`){let n=e.value.error;throw new ti({message:n.message,url:u,requestBodyValues:t,statusCode:n.type===`overloaded_error`?529:500,responseHeaders:d,responseBody:JSON.stringify(n),isRetryable:n.type===`overloaded_error`})}}finally{D.cancel().catch(()=>{}),D.releaseLock()}return{stream:E,request:{body:t},response:{headers:d}}}},cx=jh({id:`anthropic.bash_20241022`,inputSchema:K(()=>q(z({command:I(),restart:cu().optional()})))}),lx=jh({id:`anthropic.bash_20250124`,inputSchema:K(()=>q(z({command:I(),restart:cu().optional()})))}),ux=jh({id:`anthropic.computer_20241022`,inputSchema:K(()=>q(z({action:V([`key`,`type`,`mouse_move`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`screenshot`,`cursor_position`]),coordinate:R(L().int()).optional(),text:I().optional()})))}),dx=jh({id:`anthropic.computer_20250124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`]),coordinate:gu([L().int(),L().int()]).optional(),duration:L().optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:gu([L().int(),L().int()]).optional(),text:I().optional()})))}),fx=jh({id:`anthropic.computer_20251124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`,`zoom`]),coordinate:gu([L().int(),L().int()]).optional(),duration:L().optional(),region:gu([L().int(),L().int(),L().int(),L().int()]).optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:gu([L().int(),L().int()]).optional(),text:I().optional()})))}),px=jh({id:`anthropic.memory_20250818`,inputSchema:K(()=>q(mu(`command`,[z({command:H(`view`),path:I(),view_range:gu([L(),L()]).optional()}),z({command:H(`create`),path:I(),file_text:I()}),z({command:H(`str_replace`),path:I(),old_str:I(),new_str:I()}),z({command:H(`insert`),path:I(),insert_line:L(),insert_text:I()}),z({command:H(`delete`),path:I()}),z({command:H(`rename`),old_path:I(),new_path:I()})])))}),mx=jh({id:`anthropic.text_editor_20241022`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),hx=jh({id:`anthropic.text_editor_20250124`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),gx=jh({id:`anthropic.text_editor_20250429`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),_x=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),vx=Nh({id:`anthropic.tool_search_bm25_20251119`,inputSchema:K(()=>q(z({query:I(),limit:L().optional()}))),outputSchema:_x,supportsDeferredResults:!0}),yx=(e={})=>vx(e),bx={advisor_20260301:Db,bash_20241022:lb,bash_20250124:ub,codeExecution_20250522:Yb,codeExecution_20250825:Qb,codeExecution_20260120:tx,computer_20241022:ux,computer_20250124:dx,computer_20251124:fx,memory_20250818:px,textEditor_20241022:mx,textEditor_20250124:hx,textEditor_20250429:gx,textEditor_20250728:Ab,webFetch_20250910:Kb,webFetch_20260209:Hb,webSearch_20250305:Rb,webSearch_20260209:Pb,toolSearchRegex_20251119:ix,toolSearchBm25_20251119:yx},xx=K(()=>q(z({id:I(),display_title:I().nullish(),name:I().nullish(),description:I().nullish(),latest_version:I().nullish(),source:I(),created_at:I(),updated_at:I()}))),Sx=K(()=>q(z({type:I(),skill_id:I(),name:I().nullish(),description:I().nullish()}))),Cx=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async getHeaders(){return Gp(await Ph(this.config.headers),{"anthropic-beta":`skills-2025-10-02`})}async fetchVersionMetadata({skillId:e,version:t,headers:n}){let{value:r}=await hg({url:`${this.config.baseURL}/skills/${e}/versions/${t}`,headers:n,failedResponseHandler:pb,successfulResponseHandler:Jg(Sx),fetch:this.config.fetch});return{...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description}}}async uploadSkill(e){let t=[],n=new FormData;e.displayTitle!=null&&n.append(`display_title`,e.displayTitle);for(let t of e.files){let e=Yp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let r=await this.getHeaders(),{value:i}=await Hg({url:`${this.config.baseURL}/skills`,headers:r,formData:n,failedResponseHandler:pb,successfulResponseHandler:Jg(xx),fetch:this.config.fetch}),a=i.latest_version==null?{}:await this.fetchVersionMetadata({skillId:i.id,version:i.latest_version,headers:r}),o=a.name??i.name,s=a.description??i.description;return{providerReference:{anthropic:i.id},...i.display_title==null?{}:{displayTitle:i.display_title},...o==null?{}:{name:o},...s==null?{}:{description:s},...i.latest_version==null?{}:{latestVersion:i.latest_version},providerMetadata:{anthropic:{...i.source==null?{}:{source:i.source},...i.created_at==null?{}:{createdAt:i.created_at},...i.updated_at==null?{}:{updatedAt:i.updated_at}}},warnings:t}}},wx=`4.0.12`,Tx=`https://api.anthropic.com`,Ex=`${Tx}/v1`,fb()}));function Ox(e,t){return t===`openai`?e.openaiKey:e.anthropicKey}function kx(e,t,n){let r=Nx[e][n];return{model:e===`openai`?cv({apiKey:t})(r):fb({apiKey:t,headers:xr?void 0:{"anthropic-dangerous-direct-browser-access":`true`}})(r),provider:e,modelId:r}}function Ax(e){let t=e.preferredProvider;return t&&Ox(e,t)?t:e.openaiKey?`openai`:e.anthropicKey?`anthropic`:null}async function jx(e){let t=await Tr(),n=Ax(t);if(!n)throw new Px;return kx(n,Ox(t,n),e)}async function Mx(e,t){let n=await Tr(),r=e===`openai`?`anthropic`:`openai`,i=Ox(n,r);return i?kx(r,i,t):null}var Nx,Px,Fx=t((()=>{zy(),Dx(),Sr(),Br(),Nx={openai:{fast:`gpt-5.4-nano`,best:`gpt-5.2`},anthropic:{fast:`claude-haiku-4-5`,best:`claude-opus-4-8`}},Px=class extends Error{constructor(){super(`No AI provider configured. Add an OpenAI or Anthropic API key in Settings.`),this.name=`NoProviderError`}}})),Ix=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),Lx=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),Rx=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>d.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>d.RefreshAccessTokenFailedError,getContext:()=>u.getContext,getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>p,getVercelToken:()=>m}),t.exports=c(l);var u=Ix(),d=Lx();async function f(){return``}function p(){return``}async function m(){throw Error(`getVercelToken is not supported in browser environments`)}0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken:f,getVercelOidcTokenSync:p,getVercelToken:m})}));function zx(e,t){let n=[nS,`${rS}${e}`];return t?.teamIdOrSlug&&n.push(`${iS}${Bx(t.teamIdOrSlug)}`),n}function Bx(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}async function Vx({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await Th({value:e,schema:aC});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new iC({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:a.error,cause:r,generationId:i})}let o=a.value,s=o.error.type,c=o.error.message,l=o.generationId??void 0;switch(s){case`authentication_error`:return mS.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new bS({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new ES({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await Th({value:o.error.param,schema:AS});return new NS({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new zS({message:c,statusCode:t,cause:r,generationId:l});case`failed_dependency`:return new GS({message:c,statusCode:t,cause:r,generationId:l});case`forbidden`:{let e=await Th({value:o.error.param,schema:YS});return new QS({message:c,statusCode:t,cause:r,generationId:l,ruleId:e.success?e.value.ruleId:void 0})}default:return new zS({message:c,statusCode:t,cause:r,generationId:l})}}function Hx(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return Pm(e.responseBody)}catch{return e.responseBody}return{}}function Ux(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`&&[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t)}async function Wx(e,t){return cS.isInstance(e)?e:Ux(e)?dC.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):ti.isInstance(e)?e.cause&&Ux(e.cause)?dC.createTimeoutError({originalMessage:e.message,cause:e}):await Vx({response:Hx(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await Vx({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}async function Gx(e){let t=await Th({value:e[fC],schema:mC});return t.success?t.value:void 0}function Kx(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function qx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:qp(e.data)}:e}function Jx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:qp(e.data)}:e}function Yx(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}async function Xx(){return(0,eS.getContext)().headers?.[`x-vercel-id`]}function Zx(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Gh(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>xm({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":rw,[fC]:t.authMethod,...e.teamIdOrSlug==null?{}:{[pC]:e.teamIdOrSlug},...e.headers},`ai-sdk/gateway/${nw}`),s=async()=>{try{return o(await Qx(e))}catch(e){throw mS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await Qx(e)}catch(e){throw mS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{$x();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await Vg({url:i,headers:r,body:{model:t.modelId,...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:Jg(iw),failedResponseHandler:Kg({errorSchema:uu(),errorToMessage:e=>e}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await Wx(e,await Gx(r))}},u=()=>{let e=Dm({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=Dm({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=Dm({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=Dm({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Xx();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},d=t=>new CC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),f=async()=>{var o;let c=((o=e._internal)?.currentDate)?.call(o).getTime()??Date.now();return(!t||c-i>r)&&(i=c,t=new gC({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await Wx(e,await Gx(await s()))})),n?Promise.resolve(n):t},p=async()=>new gC({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await Wx(e,await Gx(await s()))}),m=async t=>new yC({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await Wx(e,await Gx(await s()))}),h=async t=>new xC({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await Wx(e,await Gx(await s()))}),g=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return d(e)};g.specificationVersion=`v4`,g.getAvailableModels=f,g.getCredits=p,g.getSpendReport=m,g.getGenerationInfo=h,g.imageModel=t=>new DC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),g.languageModel=d;let _=t=>new wC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.embeddingModel=_,g.textEmbeddingModel=_,g.videoModel=t=>new MC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let v=t=>new LC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.rerankingModel=v,g.reranking=v;let y=t=>new BC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.speechModel=y,g.speech=y;let b=t=>new WC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.transcriptionModel=b,g.transcription=b;let x=t=>new JC(t,{provider:`gateway.realtime`,baseURL:a,teamIdOrSlug:e.teamIdOrSlug,createClientSecret:l});return g.experimental_realtime=Object.assign(e=>x(e),{getToken:async e=>{let{model:t,...n}=e,r=await x(t).doCreateClientSecret(n);return{token:r.token,url:r.url,...r.expiresAt!=null&&{expiresAt:r.expiresAt}}}}),g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=tw,g}async function Qx(e){let t=Dm({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,tS.getVercelOidcToken)(),authMethod:`oidc`}}function $x(){if(globalThis.window!==void 0)throw Error(`AI Gateway realtime client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() from your server and pass the returned token to the client.`)}var eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow=t((()=>{Qg(),Fd(),ga(),eS=Rx(),tS=Rx(),nS=`ai-gateway-realtime.v1`,rS=`ai-gateway-auth.`,iS=`ai-gateway-team.`,aS=Symbol.for(`vercel.ai.gateway.error`),cS=class e extends (sS=Error,oS=aS,sS){constructor({message:e,statusCode:t=500,cause:n,generationId:r,isRetryable:i=t!=null&&(t===408||t===409||t===429||t>=500)}){super(r?`${e} [${r}]`:e),this[oS]=!0,this.statusCode=t,this.cause=n,this.generationId=r,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&aS in e&&e[aS]===!0}},lS=`GatewayAuthenticationError`,uS=`vercel.ai.gateway.error.${lS}`,dS=Symbol.for(uS),mS=class e extends (pS=cS,fS=dS,pS){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[fS]=!0,this.name=lS,this.type=`authentication_error`}static isInstance(e){return cS.hasMarker(e)&&dS in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,statusCode:r=401,cause:i,generationId:a}){let o;return o=t?`AI Gateway authentication failed: Invalid API key or token.
53
+ ${t}:`]}}function __({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??void 0,timestamp:n==null?void 0:new Date(n*1e3)}}function v_(e){switch(e){case`stop`:return`stop`;case`length`:return`length`;case`content_filter`:return`content-filter`;case`function_call`:case`tool_calls`:return`tool-calls`;default:return`other`}}function y_(e){return!(`error`in e)&&e.choices.some(e=>e.text.length>0)}function b_(e){return Dv.some(t=>e.startsWith(t))}function x_(e,t,n){if(e==null)return{};let r={};if(e.image_tokens!=null){let i=Math.floor(e.image_tokens/n),a=e.image_tokens-i*(n-1);r.imageTokens=t===n-1?a:i}if(e.text_tokens!=null){let i=Math.floor(e.text_tokens/n),a=e.text_tokens-i*(n-1);r.textTokens=t===n-1?a:i}return r}async function S_(e){if(!e)return;if(e.type===`url`)return mm(e.url);let t=e.data instanceof Uint8Array?e.data:Kp(e.data);return new Blob([t],{type:e.mediaType})}function C_(e){let t=e,n=t.type;switch(n){case`session.created`:return{type:`session-created`,sessionId:t.session?.id,raw:e};case`session.updated`:return{type:`session-updated`,raw:e};case`input_audio_buffer.speech_started`:return{type:`speech-started`,itemId:t.item_id,raw:e};case`input_audio_buffer.speech_stopped`:return{type:`speech-stopped`,itemId:t.item_id,raw:e};case`input_audio_buffer.committed`:return{type:`audio-committed`,itemId:t.item_id,previousItemId:t.previous_item_id,raw:e};case`conversation.item.added`:return{type:`conversation-item-added`,itemId:t.item?.id??t.item_id,item:t.item,raw:e};case`conversation.item.input_audio_transcription.completed`:return{type:`input-transcription-completed`,itemId:t.item_id,transcript:t.transcript??``,raw:e};case`response.created`:return{type:`response-created`,responseId:t.response?.id??t.response_id,raw:e};case`response.done`:return{type:`response-done`,responseId:t.response?.id??t.response_id,status:t.response?.status??`completed`,raw:e};case`response.output_item.added`:return{type:`output-item-added`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.output_item.done`:return{type:`output-item-done`,responseId:t.response_id,itemId:t.item?.id??t.item_id,raw:e};case`response.content_part.added`:return{type:`content-part-added`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.content_part.done`:return{type:`content-part-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio.delta`:return{type:`audio-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio.done`:return{type:`audio-done`,responseId:t.response_id,itemId:t.item_id,raw:e};case`response.output_audio_transcript.delta`:return{type:`audio-transcript-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_audio_transcript.done`:return{type:`audio-transcript-done`,responseId:t.response_id,itemId:t.item_id,transcript:t.transcript,raw:e};case`response.output_text.delta`:return{type:`text-delta`,responseId:t.response_id,itemId:t.item_id,delta:t.delta,raw:e};case`response.output_text.done`:return{type:`text-done`,responseId:t.response_id,itemId:t.item_id,text:t.text,raw:e};case`response.function_call_arguments.delta`:return{type:`function-call-arguments-delta`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,delta:t.delta,raw:e};case`response.function_call_arguments.done`:return{type:`function-call-arguments-done`,responseId:t.response_id,itemId:t.item_id,callId:t.call_id,name:t.name,arguments:t.arguments,raw:e};case`error`:return{type:`error`,message:t.error?.message??t.message??`Unknown error`,code:t.error?.code??t.code,raw:e};default:return{type:`custom`,rawType:n,raw:e}}}function w_(e,t){switch(e.type){case`session-update`:return{type:`session.update`,session:T_(e.config,t)};case`input-audio-append`:return{type:`input_audio_buffer.append`,audio:e.audio};case`input-audio-commit`:return{type:`input_audio_buffer.commit`};case`input-audio-clear`:return{type:`input_audio_buffer.clear`};case`conversation-item-create`:{let t=e.item;switch(t.type){case`text-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_text`,text:t.text}]}};case`audio-message`:return{type:`conversation.item.create`,item:{type:`message`,role:t.role,content:[{type:`input_audio`,audio:t.audio}]}};case`function-call-output`:return{type:`conversation.item.create`,item:{type:`function_call_output`,call_id:t.callId,output:t.output}}}break}case`conversation-item-truncate`:return{type:`conversation.item.truncate`,item_id:e.itemId,content_index:e.contentIndex,audio_end_ms:e.audioEndMs};case`response-create`:return{type:`response.create`,...e.options==null?{}:{response:{...e.options.modalities==null?{}:{output_modalities:e.options.modalities},...e.options.instructions==null?{}:{instructions:e.options.instructions},...e.options.metadata==null?{}:{metadata:e.options.metadata}}}};case`response-cancel`:return{type:`response.cancel`}}}function T_(e,t){let n={type:`realtime`,model:t};e.instructions!=null&&(n.instructions=e.instructions),e.outputModalities!=null&&(n.output_modalities=e.outputModalities);let r={};if(e.inputAudioFormat!=null||e.inputAudioTranscription!=null||e.turnDetection!=null){let t={};if(e.inputAudioFormat!=null&&(t.format={type:e.inputAudioFormat.type,...e.inputAudioFormat.rate==null?{}:{rate:e.inputAudioFormat.rate}}),e.turnDetection!=null)if(e.turnDetection.type===`disabled`)t.turn_detection=null;else{let n={type:e.turnDetection.type===`server-vad`?`server_vad`:`semantic_vad`};e.turnDetection.threshold!=null&&(n.threshold=e.turnDetection.threshold),e.turnDetection.silenceDurationMs!=null&&(n.silence_duration_ms=e.turnDetection.silenceDurationMs),e.turnDetection.prefixPaddingMs!=null&&(n.prefix_padding_ms=e.turnDetection.prefixPaddingMs),t.turn_detection=n}e.inputAudioTranscription!=null&&(t.transcription={model:e.inputAudioTranscription.model??`gpt-realtime-whisper`,...e.inputAudioTranscription.language==null?{}:{language:e.inputAudioTranscription.language},...e.inputAudioTranscription.prompt==null?{}:{prompt:e.inputAudioTranscription.prompt}}),r.input=t}if(e.outputAudioFormat!=null||e.voice!=null){let t={};e.outputAudioFormat!=null&&(t.format={type:e.outputAudioFormat.type,...e.outputAudioFormat.rate==null?{}:{rate:e.outputAudioFormat.rate}}),e.voice!=null&&(t.voice=e.voice),r.output=t}return Object.keys(r).length>0&&(n.audio=r),e.tools!=null&&e.tools.length>0&&(n.tools=e.tools.map(e=>({type:e.type,name:e.name,description:e.description,parameters:e.parameters})),n.tool_choice=`auto`),e.providerOptions!=null&&Object.assign(n,e.providerOptions),n}function E_(e){if(e==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let t=e.input_tokens,n=e.output_tokens,r=e.input_tokens_details?.cached_tokens??0,i=e.input_tokens_details?.cache_write_tokens??void 0,a=e.output_tokens_details?.reasoning_tokens??0;return{inputTokens:{total:t,noCache:t-r-(i??0),cacheRead:r,cacheWrite:i},outputTokens:{total:n,text:n-a,reasoning:a},raw:e}}function D_(e){return JSON.stringify(e===void 0?{}:e)}function O_(e,t){return e?.[t]?.promptCacheBreakpoint}function k_(e,t){return t?t.some(t=>e.startsWith(t)):!1}async function A_({prompt:e,toolNameMapping:t,systemMessageMode:n,providerOptionsName:r,fileIdPrefixes:i,passThroughUnsupportedFiles:a=!1,store:o,hasConversation:s=!1,hasPreviousResponseId:c=!1,hasLocalShellTool:l=!1,hasShellTool:u=!1,hasApplyPatchTool:d=!1,customProviderToolNames:f}){let p=[],m=[],h=new Set;for(let{role:g,content:_,providerOptions:v}of e)switch(g){case`system`:switch(n){case`system`:{let e=O_(v,r);p.push({role:`system`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`developer`:{let e=O_(v,r);p.push({role:`developer`,content:e==null?_:[{type:`input_text`,text:_,prompt_cache_breakpoint:e}]});break}case`remove`:m.push({type:`other`,message:`system messages are removed for this model`});break;default:throw Error(`Unsupported system message mode: ${n}`)}break;case`user`:p.push({role:`user`,content:_.map((e,t)=>{switch(e.type){case`text`:{let t=O_(e.providerOptions,r);return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}}}case`file`:{let n=O_(e.providerOptions,r);switch(e.data.type){case`reference`:{let t=Ih({reference:e.data.reference,provider:r});return rm(e.mediaType)===`image`?{type:`input_image`,file_id:t,detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}}:{type:`input_file`,file_id:t,...n!=null&&{prompt_cache_breakpoint:n}}}case`text`:throw new ha({functionality:`text file parts`});case`url`:case`data`:if(rm(e.mediaType)===`image`)return{type:`input_image`,...e.data.type===`url`?{image_url:e.data.url.toString()}:typeof e.data.data==`string`&&k_(e.data.data,i)?{file_id:e.data.data}:{image_url:`data:${Fh({part:e})};base64,${Jp(e.data.data)}`},detail:e.providerOptions?.[r]?.imageDetail,...n!=null&&{prompt_cache_breakpoint:n}};{if(e.data.type===`url`)return{type:`input_file`,file_url:e.data.url.toString(),...n!=null&&{prompt_cache_breakpoint:n}};let r=Fh({part:e});if(r!==`application/pdf`&&!a)throw new ha({functionality:`file part media type ${r}`});return{type:`input_file`,...typeof e.data.data==`string`&&k_(e.data.data,i)?{file_id:e.data.data}:{filename:e.filename??(r===`application/pdf`?`part-${t}.pdf`:`part-${t}`),file_data:`data:${r};base64,${Jp(e.data.data)}`},...n!=null&&{prompt_cache_breakpoint:n}}}}}}})});break;case`assistant`:{let e={};for(let n of _)switch(n.type){case`text`:{let e=n.providerOptions?.[r],t=e?.itemId,i=e?.phase;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}p.push({role:`assistant`,content:[{type:`output_text`,text:n.text}],id:t,...i!=null&&{phase:i}});break}case`tool-call`:{let e=n.providerOptions?.[r]?.itemId??n.providerMetadata?.[r]?.itemId,i=n.providerOptions?.[r]?.namespace??n.providerMetadata?.[r]?.namespace;if(s&&e!=null)break;let a=t.toProviderToolName(n.toolName);if(a===`tool_search`){if(o&&e!=null){p.push({type:`item_reference`,id:e});break}let t=typeof n.input==`string`?await Eh({text:n.input,schema:oy}):await wh({value:n.input,schema:oy}),r=t.call_id==null?`server`:`client`;p.push({type:`tool_search_call`,id:e??n.toolCallId,execution:r,call_id:t.call_id??null,status:`completed`,arguments:t.arguments});break}if(n.providerExecuted){o&&e!=null&&p.push({type:`item_reference`,id:e});break}if(c&&o&&e!=null)break;let m=l&&a===`local_shell`||u&&a===`shell`||d&&a===`apply_patch`||(f?.has(a)??!1);if(o&&e!=null&&m){p.push({type:`item_reference`,id:e});break}if(l&&a===`local_shell`){let t=await wh({value:n.input,schema:Zv});p.push({type:`local_shell_call`,call_id:n.toolCallId,id:e,action:{type:`exec`,command:t.action.command,timeout_ms:t.action.timeoutMs,user:t.action.user,working_directory:t.action.workingDirectory,env:t.action.env}});break}if(u&&a===`shell`){let t=await wh({value:n.input,schema:ey});p.push({type:`shell_call`,call_id:n.toolCallId,id:e,status:`completed`,action:{commands:t.action.commands,timeout_ms:t.action.timeoutMs,max_output_length:t.action.maxOutputLength}});break}if(d&&a===`apply_patch`){let t=await wh({value:n.input,schema:Mv});p.push({type:`apply_patch_call`,call_id:t.callId,id:e,status:`completed`,operation:t.operation});break}if(f?.has(a)){p.push({type:`custom_tool_call`,call_id:n.toolCallId,name:a,input:typeof n.input==`string`?n.input:JSON.stringify(n.input),id:e});break}p.push({type:`function_call`,call_id:n.toolCallId,name:a,arguments:D_(n.input),...i!=null&&{namespace:i}});break}case`tool-result`:{if(n.output.type===`execution-denied`||n.output.type===`json`&&typeof n.output.value==`object`&&n.output.value!=null&&`type`in n.output.value&&n.output.value.type===`execution-denied`||s)break;let e=t.toProviderToolName(n.toolName);if(e===`tool_search`){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;if(o)p.push({type:`item_reference`,id:e});else if(n.output.type===`json`){let t=await wh({value:n.output.value,schema:sy});p.push({type:`tool_search_output`,id:e,execution:`server`,call_id:null,status:`completed`,tools:t.tools})}break}if(u&&e===`shell`){if(n.output.type===`json`){let e=await wh({value:n.output.value,schema:ty});p.push({type:`shell_call_output`,call_id:n.toolCallId,output:e.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))})}break}if(o){let e=n.providerOptions?.[r]?.itemId??n.toolCallId;p.push({type:`item_reference`,id:e})}else m.push({type:`other`,message:`Results for OpenAI tool ${n.toolName} are not sent to the API when store is false`});break}case`reasoning`:{let t=await kh({provider:r,providerOptions:n.providerOptions,schema:xy}),i=t?.itemId;if((s||c)&&i!=null)break;if(i!=null){let r=e[i];if(o)r===void 0&&(p.push({type:`item_reference`,id:i}),e[i]={type:`reasoning`,id:i,summary:[]});else{let a=[];n.text.length>0?a.push({type:`summary_text`,text:n.text}):r!==void 0&&m.push({type:`other`,message:`Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(n)}.`}),r===void 0?(e[i]={type:`reasoning`,id:i,encrypted_content:t?.reasoningEncryptedContent,summary:a},p.push(e[i])):(r.summary.push(...a),t?.reasoningEncryptedContent!=null&&(r.encrypted_content=t.reasoningEncryptedContent))}}else{let e=t?.reasoningEncryptedContent;if(e!=null){let t=[];n.text.length>0&&t.push({type:`summary_text`,text:n.text}),p.push({type:`reasoning`,encrypted_content:e,summary:t})}else m.push({type:`other`,message:`Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(n)}.`})}break}case`custom`:if(n.kind===`openai.compaction`){let e=n.providerOptions?.[r],t=e?.itemId;if(s&&t!=null)break;if(o&&t!=null){p.push({type:`item_reference`,id:t});break}let i=e?.encryptedContent;t!=null&&p.push({type:`compaction`,id:t,encrypted_content:i})}break}break}case`tool`:for(let e of _){if(e.type===`tool-approval-response`){let t=e;if(h.has(t.approvalId))continue;h.add(t.approvalId),o&&p.push({type:`item_reference`,id:t.approvalId}),p.push({type:`mcp_approval_response`,approval_request_id:t.approvalId,approve:t.approved});continue}let n=e.output;if(n.type===`execution-denied`&&n.providerOptions?.openai?.approvalId)continue;let i=t.toProviderToolName(e.toolName);if(i===`tool_search`&&n.type===`json`){let t=await wh({value:n.value,schema:sy});p.push({type:`tool_search_output`,execution:`client`,call_id:e.toolCallId,status:`completed`,tools:t.tools});continue}if(l&&i===`local_shell`&&n.type===`json`){let t=await wh({value:n.value,schema:Qv});p.push({type:`local_shell_call_output`,call_id:e.toolCallId,output:t.output});continue}if(u&&i===`shell`&&n.type===`json`){let t=await wh({value:n.value,schema:ty});p.push({type:`shell_call_output`,call_id:e.toolCallId,output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`timeout`?{type:`timeout`}:{type:`exit`,exit_code:e.outcome.exitCode}}))});continue}if(d&&e.toolName===`apply_patch`&&n.type===`json`){let t=await wh({value:n.value,schema:Nv});p.push({type:`apply_patch_call_output`,call_id:e.toolCallId,status:t.status,output:t.output});continue}if(f?.has(i)){let t;switch(n.type){case`text`:case`error-text`:t=n.value;break;case`execution-denied`:t=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:t=JSON.stringify(n.value);break;case`content`:t=n.value.map(e=>{let t=O_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=rm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Fh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Jp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Jp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported custom tool content part type: ${e.type}`});return}}).filter(Cm);break;default:t=``}p.push({type:`custom_tool_call_output`,call_id:e.toolCallId,output:t});continue}let a;switch(n.type){case`text`:case`error-text`:a=n.value;break;case`execution-denied`:a=n.reason??`Tool call execution denied.`;break;case`json`:case`error-json`:a=JSON.stringify(n.value);break;case`content`:a=n.value.map(e=>{let t=O_(e.providerOptions,r);switch(e.type){case`text`:return{type:`input_text`,text:e.text,...t!=null&&{prompt_cache_breakpoint:t}};case`file`:{let n=rm(e.mediaType),i=e.providerOptions?.[r]?.imageDetail;if(e.data.type===`data`){let r=Fh({part:e});return n===`image`?{type:`input_image`,image_url:`data:${r};base64,${Jp(e.data.data)}`,detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,filename:e.filename??`data`,file_data:`data:${r};base64,${Jp(e.data.data)}`,...t!=null&&{prompt_cache_breakpoint:t}}}if(e.data.type===`url`)return n===`image`?{type:`input_image`,image_url:e.data.url.toString(),detail:i,...t!=null&&{prompt_cache_breakpoint:t}}:{type:`input_file`,file_url:e.data.url.toString(),...t!=null&&{prompt_cache_breakpoint:t}};m.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}default:m.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(Cm);break}p.push({type:`function_call_output`,call_id:e.toolCallId,output:a})}break;default:throw Error(`Unsupported role: ${g}`)}return!o&&p.some(e=>`type`in e&&e.type===`reasoning`&&e.encrypted_content==null)&&(m.push({type:`other`,message:`Reasoning parts without encrypted content are not supported when store is false. Skipping reasoning parts.`}),p=p.filter(e=>!(`type`in e)||e.type!==`reasoning`||e.encrypted_content!=null)),{input:p,warnings:m}}function j_({finishReason:e,hasFunctionCall:t}){switch(e){case void 0:case null:return t?`tool-calls`:`stop`;case`max_output_tokens`:return`length`;case`content_filter`:return`content-filter`;default:return t?`tool-calls`:`other`}}async function M_({tools:e,toolChoice:t,allowedTools:n,toolNameMapping:r,customProviderToolNames:i}){e=e?.length?e:void 0;let a=[];if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:a};let o=[],s=new Map,c=i??new Set;for(let t of e)switch(t.type){case`function`:{let e=t.providerOptions?.openai,n=N_({tool:t,options:e}),r=e?.namespace;if(r==null)o.push(n);else{let e=s.get(r.name);if(e==null)e={type:`namespace`,name:r.name,description:r.description,tools:[]},s.set(r.name,e),o.push(e);else if(e.description!==r.description)throw new ha({functionality:`conflicting descriptions for OpenAI tool namespace "${r.name}"`});e.tools.push(n)}break}case`provider`:switch(t.id){case`openai.file_search`:{let e=await wh({value:t.args,schema:Gv});o.push({type:`file_search`,vector_store_ids:e.vectorStoreIds,max_num_results:e.maxNumResults,ranking_options:e.ranking?{ranker:e.ranking.ranker,score_threshold:e.ranking.scoreThreshold}:void 0,filters:e.filters});break}case`openai.local_shell`:o.push({type:`local_shell`});break;case`openai.shell`:{let e=await wh({value:t.args,schema:ry});o.push({type:`shell`,...e.environment&&{environment:P_(e.environment)}});break}case`openai.apply_patch`:o.push({type:`apply_patch`});break;case`openai.web_search_preview`:{let e=await wh({value:t.args,schema:py});o.push({type:`web_search_preview`,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.web_search`:{let e=await wh({value:t.args,schema:uy});o.push({type:`web_search`,filters:e.filters==null?void 0:{allowed_domains:e.filters.allowedDomains},external_web_access:e.externalWebAccess,search_context_size:e.searchContextSize,user_location:e.userLocation});break}case`openai.code_interpreter`:{let e=await wh({value:t.args,schema:Lv});o.push({type:`code_interpreter`,container:e.container==null?{type:`auto`,file_ids:void 0}:typeof e.container==`string`?e.container:{type:`auto`,file_ids:e.container.fileIds}});break}case`openai.image_generation`:{let e=await wh({value:t.args,schema:Jv});o.push({type:`image_generation`,background:e.background,input_fidelity:e.inputFidelity,input_image_mask:e.inputImageMask?{file_id:e.inputImageMask.fileId,image_url:e.inputImageMask.imageUrl}:void 0,model:e.model,moderation:e.moderation,partial_images:e.partialImages,quality:e.quality,output_compression:e.outputCompression,output_format:e.outputFormat,size:e.size});break}case`openai.mcp`:{let e=await wh({value:t.args,schema:gy}),n=e=>({tool_names:e.toolNames}),r=e.requireApproval,i=r==null?void 0:typeof r==`string`?r:r.never==null?void 0:{never:n(r.never)};o.push({type:`mcp`,server_label:e.serverLabel,allowed_tools:Array.isArray(e.allowedTools)?e.allowedTools:e.allowedTools?{read_only:e.allowedTools.readOnly,tool_names:e.allowedTools.toolNames}:void 0,authorization:e.authorization,connector_id:e.connectorId,headers:e.headers,require_approval:i??`never`,server_description:e.serverDescription,server_url:e.serverUrl});break}case`openai.custom`:{let e=await wh({value:t.args,schema:Bv});o.push({type:`custom`,name:t.name,description:e.description,format:e.format}),c.add(t.name);break}case`openai.tool_search`:{let e=await wh({value:t.args,schema:ay});o.push({type:`tool_search`,...e.execution==null?{}:{execution:e.execution},...e.description==null?{}:{description:e.description},...e.parameters==null?{}:{parameters:e.parameters}});break}}break;default:a.push({type:`unsupported`,feature:`function tool ${t}`});break}if(n!=null)return{tools:o,toolChoice:{type:`allowed_tools`,mode:n.mode??`auto`,tools:n.toolNames.map(e=>({type:`function`,name:r?.toProviderToolName(e)??e}))},toolWarnings:a};if(t==null)return{tools:o,toolChoice:void 0,toolWarnings:a};let l=t.type;switch(l){case`auto`:case`none`:case`required`:return{tools:o,toolChoice:l,toolWarnings:a};case`tool`:{let e=r?.toProviderToolName(t.toolName)??t.toolName;return{tools:o,toolChoice:e===`code_interpreter`||e===`file_search`||e===`image_generation`||e===`web_search_preview`||e===`web_search`||e===`mcp`||e===`apply_patch`?{type:e}:c.has(e)?{type:`custom`,name:e}:{type:`function`,name:e},toolWarnings:a}}default:throw new ha({functionality:`tool choice type: ${l}`})}}function N_({tool:e,options:t}){let n=t?.deferLoading;return{type:`function`,name:e.name,description:e.description,parameters:e.inputSchema,...e.strict==null?{}:{strict:e.strict},...n==null?{}:{defer_loading:n}}}function P_(e){if(e.type===`containerReference`)return{type:`container_reference`,container_id:e.containerId};if(e.type===`containerAuto`){let t=e;return{type:`container_auto`,file_ids:t.fileIds,memory_limit:t.memoryLimit,network_policy:t.networkPolicy==null?void 0:t.networkPolicy.type===`disabled`?{type:`disabled`}:{type:`allowlist`,allowed_domains:t.networkPolicy.allowedDomains,domain_secrets:t.networkPolicy.domainSecrets},skills:F_(t.skills)}}return{type:`local`,skills:e.skills}}function F_(e){return e?.map(e=>e.type===`skillReference`?{type:`skill_reference`,skill_id:Ih({reference:e.providerReference??{},provider:`openai`}),version:e.version??`latest`}:{type:`inline`,name:e.name,description:e.description,source:{type:`base64`,media_type:e.source.mediaType,data:e.source.data}})}function I_(e){let t={};for(let n of e)if(n.role===`assistant`)for(let e of n.content){if(e.type!==`tool-call`)continue;let n=e.providerOptions?.openai?.approvalRequestId;n!=null&&(t[n]=e.toolCallId)}return t}function L_(e){return e.type===`response.output_text.delta`}function R_(e){let t=B_(e);return t!=null&&Array.isArray(t.choices)&&typeof t.type!=`string`}function z_({value:e,cause:t,url:n,requestBodyValues:r,responseHeaders:i}){return new ti({message:`Received a Chat Completions stream while using the OpenAI Responses API. The default OpenAI provider model uses the Responses API. If your custom baseURL targets a Chat Completions-compatible endpoint, use openai.chat('model-id') or createOpenAI(...).chat('model-id') instead. You can also use @ai-sdk/openai-compatible for OpenAI-compatible providers.`,url:n,requestBodyValues:r,responseHeaders:i,responseBody:JSON.stringify(e),cause:t,data:e,isRetryable:!1})}function B_(e){return typeof e==`object`&&e?e:void 0}function V_(e){return e.type===`response.output_item.done`}function H_(e){return e.type===`response.completed`||e.type===`response.incomplete`}function U_(e){return e.type===`response.failed`}function W_(e){return e.type===`response.created`}function G_(e){return e.type===`response.function_call_arguments.delta`}function K_(e){return e.type===`response.custom_tool_call_input.delta`}function q_(e){return e.type===`response.image_generation_call.partial_image`}function J_(e){return e.type===`response.code_interpreter_call_code.delta`}function Y_(e){return e.type===`response.code_interpreter_call_code.done`}function X_(e){return e.type===`response.apply_patch_call_operation_diff.delta`}function Z_(e){return e.type===`response.apply_patch_call_operation_diff.done`}function Q_(e){return e.type===`response.output_item.added`}function $_(e){return e.type===`response.output_text.annotation.added`}function ev(e){return e.type===`error`}function tv(e){return!(e.type===`response.created`||e.type===`response.failed`||e.type===`error`||e.type===`unknown_chunk`)}function nv(e){if(e==null)return{};switch(e.type){case`search`:return{action:{type:`search`,query:e.query??void 0,...e.queries!=null&&{queries:e.queries}},...e.sources!=null&&{sources:e.sources}};case`open_page`:return{action:{type:`openPage`,url:e.url}};case`find_in_page`:return{action:{type:`findInPage`,url:e.url,pattern:e.pattern}}}}function rv(e){return JSON.stringify(e).slice(1,-1)}function iv(e){return e===`gpt-realtime-whisper`||e.startsWith(`gpt-realtime-whisper-`)}function av({webSocket:e,url:t,headers:n,sessionUpdate:r,language:i,warnings:a,audio:o,abortSignal:s,includeRawChunks:c}){let l=!1,u=()=>{};return new ReadableStream({start:d=>{let f=new(Hh(e))(t,sv(n),{headers:n}),p;u=e=>{s?.removeEventListener(`abort`,g),p?.cancel().catch(()=>{});try{f.close(e)}catch{}};let m=e=>{l||(l=!0,u(),d.error(e))},h=(e,t)=>{l||(l=!0,t!=null&&d.enqueue({type:`transcript-final`,id:t,text:e}),d.enqueue({type:`finish`,text:e,segments:[],language:i}),d.close(),u(1e3))},g=()=>{m(s?.reason??Error(`Aborted`))};if(s?.aborted){g();return}s?.addEventListener(`abort`,g,{once:!0});let _=async()=>{p=o.getReader();try{for(;;){let{done:e,value:t}=await p.read();if(e||l)break;f.send(JSON.stringify({type:`input_audio_buffer.append`,audio:Jp(t)}))}}finally{p.releaseLock()}l||f.send(JSON.stringify({type:`input_audio_buffer.commit`}))};f.onopen=()=>{d.enqueue({type:`stream-start`,warnings:a}),f.send(JSON.stringify(r)),_().catch(m)},f.onmessage=e=>{Wh(e.data).then(async e=>{let t=await Dh({text:e});if(!t.success)return;let n=t.value;switch(c&&d.enqueue({type:`raw`,rawValue:n}),n.type){case`conversation.item.input_audio_transcription.delta`:d.enqueue({type:`transcript-delta`,id:n.item_id,delta:n.delta??``});break;case`conversation.item.input_audio_transcription.completed`:h(n.transcript??``,n.item_id);break;case`error`:m(Error(n.error?.message??`OpenAI realtime error`));break}}).catch(m)},f.onerror=()=>{m(Error(`OpenAI realtime transcription error`))},f.onclose=()=>{l||(l=!0,u(),d.close())}},cancel:()=>{l||(l=!0,u())}})}function ov({modelId:e,inputAudioFormat:t,providerOptions:n}){return{type:`session.update`,session:{type:`transcription`,audio:{input:{format:{type:t.type,...t.rate==null?{}:{rate:t.rate}},transcription:{model:e,...n?.language==null?{}:{language:n.language},...n?.streaming?.delay==null?{}:{delay:n.streaming.delay}},turn_detection:null}},...n?.streaming?.include==null?{}:{include:n.streaming.include}}}}function sv(e){let t=e.Authorization??e.authorization,n=t?.startsWith(`Bearer `)?t.slice(7):void 0;return n==null?[`realtime`]:[`realtime`,`openai-insecure-api-key.${n}`]}function cv(e={}){let t=Gh(Dm({settingValue:e.baseURL,environmentVariableName:`OPENAI_BASE_URL`}))??`https://api.openai.com/v1`,n=e.name??`openai`,r=()=>xm({Authorization:`Bearer ${Em({apiKey:e.apiKey,environmentVariableName:`OPENAI_API_KEY`,description:`OpenAI`})}`,"OpenAI-Organization":e.organization,"OpenAI-Project":e.project,...e.headers},`ai-sdk/openai/${Ry}`),i=i=>new mv(i,{provider:`${n}.chat`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),a=i=>new vv(i,{provider:`${n}.completion`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),o=i=>new xv(i,{provider:`${n}.embedding`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),s=i=>new jv(i,{provider:`${n}.image`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),c=i=>new Fy(i,{provider:`${n}.transcription`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,webSocket:e.webSocket}),l=i=>new jy(i,{provider:`${n}.speech`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),u=()=>new wv({provider:`${n}.files`,baseURL:t,headers:r,fetch:e.fetch}),d=()=>new Ly({provider:`${n}.skills`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch}),f=e=>{if(new.target)throw Error(`The OpenAI model function cannot be called with the new keyword.`);return p(e)},p=i=>new ky(i,{provider:`${n}.responses`,url:({path:e})=>`${t}${e}`,headers:r,fetch:e.fetch,fileIdPrefixes:[`file-`]}),m=i=>new by(i,{provider:`${n}.realtime`,baseURL:t,headers:r,fetch:e.fetch}),h=Object.assign(e=>m(e),{getToken:async e=>{let t=await m(e.model).doCreateClientSecret({sessionConfig:e.sessionConfig,expiresAfterSeconds:e.expiresAfterSeconds});return{token:t.token,url:t.url,expiresAt:t.expiresAt}}}),g=function(e){return f(e)};return g.specificationVersion=`v4`,g.languageModel=f,g.chat=i,g.completion=a,g.responses=p,g.embedding=o,g.embeddingModel=o,g.textEmbedding=o,g.textEmbeddingModel=o,g.image=s,g.imageModel=s,g.transcription=c,g.transcriptionModel=c,g.speech=l,g.speechModel=l,g.files=u,g.skills=d,g.experimental_realtime=h,g.tools=yy,g}var lv,uv,dv,fv,pv,mv,hv,gv,_v,vv,yv,bv,xv,Sv,Cv,wv,Tv,Ev,Dv,Ov,kv,Av,jv,Mv,Nv,Pv,Fv,Iv,Lv,Rv,zv,Bv,Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv,$v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy,py,my,hy,gy,_y,vy,yy,by,xy,Sy,Cy,wy,Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy=t((()=>{Qg(),Fd(),ga(),lv=z({error:z({message:I(),type:I().nullish(),param:uu().nullish(),code:B([I(),L()]).nullish()})}),uv=Kg({errorSchema:lv,errorToMessage:e=>e.error.message}),dv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({message:z({role:H(`assistant`).nullish(),content:I().nullish(),tool_calls:R(z({id:I().nullish(),type:H(`function`),function:z({name:I(),arguments:I()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}),index:L(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}))),fv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({delta:z({role:V([`assistant`]).nullish(),content:I().nullish(),tool_calls:R(z({index:L(),id:I().nullish(),type:H(`function`).nullish(),function:z({name:I().nullish(),arguments:I().nullish()})})).nullish(),annotations:R(z({type:H(`url_citation`),url_citation:z({start_index:L(),end_index:L(),url:I(),title:I()})})).nullish()}).nullish(),logprobs:z({content:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}).nullish(),finish_reason:I().nullish(),index:L()})),usage:z({prompt_tokens:L().nullish(),completion_tokens:L().nullish(),total_tokens:L().nullish(),prompt_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish()}).nullish(),completion_tokens_details:z({reasoning_tokens:L().nullish(),accepted_prediction_tokens:L().nullish(),rejected_prediction_tokens:L().nullish()}).nullish()}).nullish()}),lv]))),pv=K(()=>q(z({logitBias:_u(jd(),L()).optional(),logprobs:B([cu(),L()]).optional(),parallelToolCalls:cu().optional(),user:I().optional(),reasoningEffort:V([`none`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]).optional(),maxCompletionTokens:L().optional(),store:cu().optional(),metadata:_u(I().max(64),I().max(512)).optional(),prediction:_u(I(),uu()).optional(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).optional(),strictJsonSchema:cu().optional(),textVerbosity:V([`low`,`medium`,`high`]).optional(),promptCacheKey:I().optional(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).optional(),safetyIdentifier:I().optional(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:cu().optional()}))),mv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,seed:l,tools:u,toolChoice:d,reasoning:f,providerOptions:p}){let m=[],h=await kh({provider:`openai`,providerOptions:p,schema:pv})??{},g=$g(this.modelId),_=h.reasoningEffort??(Om(f)?f:void 0),v=h.forceReasoning??g.isReasoningModel;i!=null&&m.push({type:`unsupported`,feature:`topK`});let{messages:y,warnings:b}=u_({prompt:e,systemMessageMode:h.systemMessageMode??(v?`developer`:g.systemMessageMode)});m.push(...b);let x=h.strictJsonSchema??!0,S={model:this.modelId,logit_bias:h.logitBias,logprobs:h.logprobs===!0||typeof h.logprobs==`number`||void 0,top_logprobs:typeof h.logprobs==`number`?h.logprobs:typeof h.logprobs==`boolean`&&h.logprobs?0:void 0,user:h.user,parallel_tool_calls:h.parallelToolCalls,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,response_format:c?.type===`json`?c.schema==null?{type:`json_object`}:{type:`json_schema`,json_schema:{schema:c.schema,strict:x,name:c.name??`response`,description:c.description}}:void 0,stop:s,seed:l,verbosity:h.textVerbosity,max_completion_tokens:h.maxCompletionTokens,store:h.store,metadata:h.metadata,prediction:h.prediction,reasoning_effort:_,service_tier:h.serviceTier,prompt_cache_key:h.promptCacheKey,prompt_cache_options:h.promptCacheOptions,prompt_cache_retention:h.promptCacheRetention,safety_identifier:h.safetyIdentifier,messages:y};v?((_!==`none`||!g.supportsNonReasoningParameters)&&(S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),S.top_p!=null&&(S.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`})),S.logprobs!=null&&(S.logprobs=void 0,m.push({type:`other`,message:`logprobs is not supported for reasoning models`}))),S.frequency_penalty!=null&&(S.frequency_penalty=void 0,m.push({type:`unsupported`,feature:`frequencyPenalty`,details:`frequencyPenalty is not supported for reasoning models`})),S.presence_penalty!=null&&(S.presence_penalty=void 0,m.push({type:`unsupported`,feature:`presencePenalty`,details:`presencePenalty is not supported for reasoning models`})),S.logit_bias!=null&&(S.logit_bias=void 0,m.push({type:`other`,message:`logitBias is not supported for reasoning models`})),S.top_logprobs!=null&&(S.top_logprobs=void 0,m.push({type:`other`,message:`topLogprobs is not supported for reasoning models`})),S.max_tokens!=null&&(S.max_completion_tokens??=S.max_tokens,S.max_tokens=void 0)):(this.modelId.startsWith(`gpt-4o-search-preview`)||this.modelId.startsWith(`gpt-4o-mini-search-preview`))&&S.temperature!=null&&(S.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for the search preview models and has been removed.`})),h.serviceTier===`flex`&&!g.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),S.service_tier=void 0),h.serviceTier===`priority`&&!g.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),S.service_tier=void 0);let{tools:C,toolChoice:w,toolWarnings:T}=p_({tools:u,toolChoice:d});return{args:{...S,tools:C,tool_choice:w},warnings:[...m,...T]}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await Vg({url:this.config.url({path:`/chat/completions`,modelId:this.modelId}),headers:Gp((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:uv,successfulResponseHandler:Jg(dv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c=[],l=s.message.content;l!=null&&l.length>0&&c.push({type:`text`,text:l});for(let e of s.message.tool_calls??[])c.push({type:`tool-call`,toolCallId:e.id??ug(),toolName:e.function.name,input:e.function.arguments});for(let e of s.message.annotations??[])c.push({type:`source`,sourceType:`url`,id:ug(),url:e.url_citation.url,title:e.url_citation.title});let u=a.usage?.completion_tokens_details,d={openai:{}};return u?.accepted_prediction_tokens!=null&&(d.openai.acceptedPredictionTokens=u?.accepted_prediction_tokens),u?.rejected_prediction_tokens!=null&&(d.openai.rejectedPredictionTokens=u?.rejected_prediction_tokens),s.logprobs?.content!=null&&(d.openai.logprobs=s.logprobs.content),{content:c,finishReason:{unified:f_(s.finish_reason),raw:s.finish_reason??void 0},usage:s_(a.usage),request:{body:n},response:{...d_(a),headers:i,body:o},warnings:r,providerMetadata:d}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/chat/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await Vg({url:a,headers:Gp((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:uv,successfulResponseHandler:qg(fv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await e_({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:m_,url:a,requestBodyValues:i,responseHeaders:o}),l,u={unified:`other`,raw:void 0},d,f=!1,p=!1,m={openai:{}};return{stream:c.pipeThrough(new TransformStream({start(e){l=new Xg(e,{generateId:ug,typeValidation:`if-present`}),e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){u={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}if(!f){let e=d_(r);Object.values(e).some(Boolean)&&(f=!0,n.enqueue({type:`response-metadata`,...d_(r)}))}r.usage!=null&&(d=r.usage,r.usage.completion_tokens_details?.accepted_prediction_tokens!=null&&(m.openai.acceptedPredictionTokens=r.usage.completion_tokens_details?.accepted_prediction_tokens),r.usage.completion_tokens_details?.rejected_prediction_tokens!=null&&(m.openai.rejectedPredictionTokens=r.usage.completion_tokens_details?.rejected_prediction_tokens));let i=r.choices[0];if(i?.finish_reason!=null&&(u={unified:f_(i.finish_reason),raw:i.finish_reason}),i?.logprobs?.content!=null&&(m.openai.logprobs=i.logprobs.content),i?.delta==null)return;let a=i.delta;if(a.content!=null&&(p||=(n.enqueue({type:`text-start`,id:`0`}),!0),n.enqueue({type:`text-delta`,id:`0`,delta:a.content})),a.tool_calls!=null)for(let e of a.tool_calls)l.processDelta(e);if(a.annotations!=null)for(let e of a.annotations)n.enqueue({type:`source`,sourceType:`url`,id:ug(),url:e.url_citation.url,title:e.url_citation.title})},flush(e){p&&e.enqueue({type:`text-end`,id:`0`}),l.flush(),e.enqueue({type:`finish`,finishReason:u,usage:s_(d),...m==null?{}:{providerMetadata:m}})}})),request:{body:i},response:{headers:o}}}},hv=K(()=>q(z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(_u(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}))),gv=K(()=>q(B([z({id:I().nullish(),created:L().nullish(),model:I().nullish(),choices:R(z({text:I(),finish_reason:I().nullish(),index:L(),logprobs:z({tokens:R(I()),token_logprobs:R(L()),top_logprobs:R(_u(I(),L())).nullish()}).nullish()})),usage:z({prompt_tokens:L(),completion_tokens:L(),total_tokens:L()}).nullish()}),lv]))),_v=K(()=>q(z({echo:cu().optional(),logitBias:_u(I(),L()).optional(),suffix:I().optional(),user:I().optional(),logprobs:B([cu(),L()]).optional()}))),vv=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={},this.modelId=e,this.config=t}get providerOptionsName(){return this.config.provider.split(`.`)[0].trim()}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:r,topK:i,frequencyPenalty:a,presencePenalty:o,stopSequences:s,responseFormat:c,tools:l,toolChoice:u,seed:d,providerOptions:f}){let p=[],m={...await kh({provider:`openai`,providerOptions:f,schema:_v}),...await kh({provider:this.providerOptionsName,providerOptions:f,schema:_v})};i!=null&&p.push({type:`unsupported`,feature:`topK`}),l?.length&&p.push({type:`unsupported`,feature:`tools`}),u!=null&&p.push({type:`unsupported`,feature:`toolChoice`}),c!=null&&c.type!==`text`&&p.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format is not supported.`});let{prompt:h,stopSequences:g}=g_({prompt:e}),_=[...g??[],...s??[]];return{args:{model:this.modelId,echo:m.echo,logit_bias:m.logitBias,logprobs:m?.logprobs===!0?0:m?.logprobs===!1?void 0:m?.logprobs,suffix:m.suffix,user:m.user,max_tokens:t,temperature:n,top_p:r,frequency_penalty:a,presence_penalty:o,seed:d,prompt:h,stop:_.length>0?_:void 0},warnings:p}}async doGenerate(e){var t;let{args:n,warnings:r}=await this.getArgs(e),{responseHeaders:i,value:a,rawValue:o}=await Vg({url:this.config.url({path:`/completions`,modelId:this.modelId}),headers:Gp((t=this.config).headers?.call(t),e.headers),body:n,failedResponseHandler:uv,successfulResponseHandler:Jg(hv),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=a.choices[0],c={openai:{}};return s.logprobs!=null&&(c.openai.logprobs=s.logprobs),{content:[{type:`text`,text:s.text}],usage:h_(a.usage),finishReason:{unified:v_(s.finish_reason),raw:s.finish_reason??void 0},request:{body:n},response:{...__(a),headers:i,body:o},providerMetadata:c,warnings:r}}async doStream(e){var t;let{args:n,warnings:r}=await this.getArgs(e),i={...n,stream:!0,stream_options:{include_usage:!0}},a=this.config.url({path:`/completions`,modelId:this.modelId}),{responseHeaders:o,value:s}=await Vg({url:a,headers:Gp((t=this.config).headers?.call(t),e.headers),body:i,failedResponseHandler:uv,successfulResponseHandler:qg(gv),abortSignal:e.abortSignal,fetch:this.config.fetch}),c=await e_({stream:s,getError:e=>`error`in e?e.error:void 0,isOutputChunk:y_,url:a,requestBodyValues:i,responseHeaders:o}),l={unified:`other`,raw:void 0},u={openai:{}},d,f=!0;return{stream:c.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:t.error});return}let r=t.value;if(`error`in r){l={unified:`error`,raw:void 0},n.enqueue({type:`error`,error:r.error});return}f&&(f=!1,n.enqueue({type:`response-metadata`,...__(r)}),n.enqueue({type:`text-start`,id:`0`})),r.usage!=null&&(d=r.usage);let i=r.choices[0];i?.finish_reason!=null&&(l={unified:v_(i.finish_reason),raw:i.finish_reason}),i?.logprobs!=null&&(u.openai.logprobs=i.logprobs),i?.text!=null&&i.text.length>0&&n.enqueue({type:`text-delta`,id:`0`,delta:i.text})},flush(e){f||e.enqueue({type:`text-end`,id:`0`}),e.enqueue({type:`finish`,finishReason:l,providerMetadata:u,usage:h_(d)})}})),request:{body:i},response:{headers:o}}}},yv=K(()=>q(z({dimensions:L().optional(),user:I().optional()}))),bv=K(()=>q(z({data:R(z({embedding:R(L())})),usage:z({prompt_tokens:L()}).nullish()}))),xv=class e{constructor(e,t){this.specificationVersion=`v4`,this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=e,this.config=t}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:n,providerOptions:r}){var i;if(e.length>this.maxEmbeddingsPerCall)throw new ra({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});let a=await kh({provider:`openai`,providerOptions:r,schema:yv})??{},{responseHeaders:o,value:s,rawValue:c}=await Vg({url:this.config.url({path:`/embeddings`,modelId:this.modelId}),headers:Gp((i=this.config).headers?.call(i),t),body:{model:this.modelId,input:e,encoding_format:`float`,dimensions:a.dimensions,user:a.user},failedResponseHandler:uv,successfulResponseHandler:Jg(bv),abortSignal:n,fetch:this.config.fetch});return{warnings:[],embeddings:s.data.map(e=>e.embedding),usage:s.usage?{tokens:s.usage.prompt_tokens}:void 0,response:{headers:o,body:c}}}},Sv=K(()=>q(z({id:I(),object:I().nullish(),bytes:L().nullish(),created_at:L().nullish(),filename:I().nullish(),purpose:I().nullish(),status:I().nullish(),expires_at:L().nullish()}))),Cv=K(()=>q(z({purpose:I().optional(),expiresAfter:L().optional()}))),wv=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n,providerOptions:r}){let i=await kh({provider:`openai`,providerOptions:r,schema:Cv}),a=Yp(e),o=new Blob([a],{type:t}),s=new FormData;n==null?s.append(`file`,o):s.append(`file`,o,n),s.append(`purpose`,i?.purpose??`assistants`),i?.expiresAfter!=null&&s.append(`expires_after`,String(i.expiresAfter));let{value:c}=await Hg({url:`${this.config.baseURL}/files`,headers:Gp(this.config.headers()),formData:s,failedResponseHandler:uv,successfulResponseHandler:Jg(Sv),fetch:this.config.fetch});return{warnings:[],providerReference:{openai:c.id},...c.filename??n?{filename:c.filename??n}:{},...t==null?{}:{mediaType:t},providerMetadata:{openai:{...c.filename==null?{}:{filename:c.filename},...c.purpose==null?{}:{purpose:c.purpose},...c.bytes==null?{}:{bytes:c.bytes},...c.created_at==null?{}:{createdAt:c.created_at},...c.status==null?{}:{status:c.status},...c.expires_at==null?{}:{expiresAt:c.expires_at}}}}}},Tv=K(()=>q(z({created:L().nullish(),data:R(z({b64_json:I(),revised_prompt:I().nullish()})),background:I().nullish(),output_format:I().nullish(),size:I().nullish(),quality:I().nullish(),usage:z({input_tokens:L().nullish(),output_tokens:L().nullish(),total_tokens:L().nullish(),input_tokens_details:z({image_tokens:L().nullish(),text_tokens:L().nullish()}).nullish()}).nullish()}))),Ev={"dall-e-3":1,"dall-e-2":10,"gpt-image-1":10,"gpt-image-1-mini":10,"gpt-image-1.5":10,"gpt-image-2":10,"chatgpt-image-latest":10},Dv=[`chatgpt-image-`,`gpt-image-1-mini`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-2`],Ov=z({quality:V([`standard`,`hd`,`low`,`medium`,`high`,`auto`]).optional(),background:V([`transparent`,`opaque`,`auto`]).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),outputCompression:L().int().min(0).max(100).optional(),user:I().optional()}),kv=K(()=>q(Ov.extend({style:V([`vivid`,`natural`]).optional(),moderation:V([`auto`,`low`]).optional()}))),Av=K(()=>q(Ov.extend({inputFidelity:V([`high`,`low`]).optional()}))),jv=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get maxImagesPerCall(){return Ev[this.modelId]??1}get provider(){return this.config.provider}async doGenerate({prompt:e,files:t,mask:n,n:r,size:i,aspectRatio:a,seed:o,providerOptions:s,headers:c,abortSignal:l}){var u,d,f;let p=[];a!=null&&p.push({type:`unsupported`,feature:`aspectRatio`,details:"This model does not support aspect ratio. Use `size` instead."}),o!=null&&p.push({type:`unsupported`,feature:`seed`});let m=((u=this.config._internal)?.currentDate)?.call(u)??new Date;if(t!=null){let a=await kh({provider:`openai`,providerOptions:s,schema:Av})??{},{value:o,responseHeaders:u}=await Hg({url:this.config.url({path:`/images/edits`,modelId:this.modelId}),headers:Gp((d=this.config).headers?.call(d),c),formData:Xp({model:this.modelId,prompt:e,image:await Promise.all(t.map(e=>e.type===`file`?new Blob([e.data instanceof Uint8Array?new Blob([e.data],{type:e.mediaType}):new Blob([Kp(e.data)],{type:e.mediaType})],{type:e.mediaType}):mm(e.url))),mask:n==null?void 0:await S_(n),n:r,size:i,quality:a.quality,background:a.background,output_format:a.outputFormat,output_compression:a.outputCompression,input_fidelity:a.inputFidelity,user:a.user}),failedResponseHandler:uv,successfulResponseHandler:Jg(Tv),abortSignal:l,fetch:this.config.fetch});return{images:o.data.map(e=>e.b64_json),warnings:p,usage:o.usage==null?void 0:{inputTokens:o.usage.input_tokens??void 0,outputTokens:o.usage.output_tokens??void 0,totalTokens:o.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:u},providerMetadata:{openai:{images:o.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:o.created??void 0,size:o.size??void 0,quality:o.quality??void 0,background:o.background??void 0,outputFormat:o.output_format??void 0,...x_(o.usage?.input_tokens_details,t,o.data.length)}))}}}}let h=await kh({provider:`openai`,providerOptions:s,schema:kv})??{},{value:g,responseHeaders:_}=await Vg({url:this.config.url({path:`/images/generations`,modelId:this.modelId}),headers:Gp((f=this.config).headers?.call(f),c),body:{model:this.modelId,prompt:e,n:r,size:i,quality:h.quality,style:h.style,background:h.background,moderation:h.moderation,output_format:h.outputFormat,output_compression:h.outputCompression,user:h.user,...b_(this.modelId)?{}:{response_format:`b64_json`}},failedResponseHandler:uv,successfulResponseHandler:Jg(Tv),abortSignal:l,fetch:this.config.fetch});return{images:g.data.map(e=>e.b64_json),warnings:p,usage:g.usage==null?void 0:{inputTokens:g.usage.input_tokens??void 0,outputTokens:g.usage.output_tokens??void 0,totalTokens:g.usage.total_tokens??void 0},response:{timestamp:m,modelId:this.modelId,headers:_},providerMetadata:{openai:{images:g.data.map((e,t)=>({...e.revised_prompt?{revisedPrompt:e.revised_prompt}:{},created:g.created??void 0,size:g.size??void 0,quality:g.quality??void 0,background:g.background??void 0,outputFormat:g.output_format??void 0,...x_(g.usage?.input_tokens_details,t,g.data.length)}))}}}}},Mv=K(()=>q(z({callId:I(),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}))),Nv=K(()=>q(z({status:V([`completed`,`failed`]),output:I().optional()}))),Pv=Mh({id:`openai.apply_patch`,inputSchema:Mv,outputSchema:Nv}),Fv=K(()=>q(z({code:I().nullish(),containerId:I()}))),Iv=K(()=>q(z({outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullish()}))),Lv=K(()=>q(z({container:B([I(),z({fileIds:R(I()).optional()})]).optional()}))),Rv=Nh({id:`openai.code_interpreter`,inputSchema:Fv,outputSchema:Iv}),zv=(e={})=>Rv(e),Bv=K(()=>q(z({description:I().optional(),format:B([z({type:H(`grammar`),syntax:V([`regex`,`lark`]),definition:I()}),z({type:H(`text`)})]).optional()}))),Vv=jh({id:`openai.custom`,inputSchema:K(()=>q(I()))}),Hv=e=>Vv(e),Uv=z({key:I(),type:V([`eq`,`ne`,`gt`,`gte`,`lt`,`lte`,`in`,`nin`]),value:B([I(),L(),cu(),R(I())])}),Wv=z({type:V([`and`,`or`]),filters:R(B([Uv,Du(()=>Wv)]))}),Gv=K(()=>q(z({vectorStoreIds:R(I()),maxNumResults:L().optional(),ranking:z({ranker:I().optional(),scoreThreshold:L().optional()}).optional(),filters:B([Uv,Wv]).optional()}))),Kv=K(()=>q(z({queries:R(I()),results:R(z({attributes:_u(I(),du()),fileId:I(),filename:I(),score:L(),text:I()})).nullable()}))),qv=Nh({id:`openai.file_search`,inputSchema:z({}),outputSchema:Kv}),Jv=K(()=>q(z({background:V([`auto`,`opaque`,`transparent`]).optional(),inputFidelity:V([`low`,`high`]).optional(),inputImageMask:z({fileId:I().optional(),imageUrl:I().optional()}).optional(),model:I().optional(),moderation:V([`auto`]).optional(),outputCompression:L().int().min(0).max(100).optional(),outputFormat:V([`png`,`jpeg`,`webp`]).optional(),partialImages:L().int().min(0).max(3).optional(),quality:V([`auto`,`low`,`medium`,`high`]).optional(),size:V([`1024x1024`,`1024x1536`,`1536x1024`,`auto`]).optional()}).strict())),Yv=Nh({id:`openai.image_generation`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({result:I()})))}),Xv=(e={})=>Yv(e),Zv=K(()=>q(z({action:z({type:H(`exec`),command:R(I()),timeoutMs:L().optional(),user:I().optional(),workingDirectory:I().optional(),env:_u(I(),I()).optional()})}))),Qv=K(()=>q(z({output:I()}))),$v=Mh({id:`openai.local_shell`,inputSchema:Zv,outputSchema:Qv}),ey=K(()=>q(z({action:z({commands:R(I()),timeoutMs:L().optional(),maxOutputLength:L().optional()})}))),ty=K(()=>q(z({output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exitCode:L()})])}))}))),ny=R(mu(`type`,[z({type:H(`skillReference`),providerReference:_u(I(),I()),version:I().optional()}),z({type:H(`inline`),name:I(),description:I(),source:z({type:H(`base64`),mediaType:H(`application/zip`),data:I()})})])).optional(),ry=K(()=>q(z({environment:B([z({type:H(`containerAuto`),fileIds:R(I()).optional(),memoryLimit:V([`1g`,`4g`,`16g`,`64g`]).optional(),networkPolicy:mu(`type`,[z({type:H(`disabled`)}),z({type:H(`allowlist`),allowedDomains:R(I()),domainSecrets:R(z({domain:I(),name:I(),value:I()})).optional()})]).optional(),skills:ny}),z({type:H(`containerReference`),containerId:I()}),z({type:H(`local`).optional(),skills:R(z({name:I(),description:I(),path:I()})).optional()})]).optional()}))),iy=Mh({id:`openai.shell`,inputSchema:ey,outputSchema:ty}),ay=K(()=>q(z({execution:V([`server`,`client`]).optional(),description:I().optional(),parameters:_u(I(),du()).optional()}))),oy=K(()=>q(z({arguments:du().optional(),call_id:I().nullish()}))),sy=K(()=>q(z({tools:R(_u(I(),du()))}))),cy=Mh({id:`openai.tool_search`,inputSchema:oy,outputSchema:sy}),ly=(e={})=>cy(e),uy=K(()=>q(z({externalWebAccess:cu().optional(),filters:z({allowedDomains:R(I()).optional()}).optional(),searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),dy=Nh({id:`openai.web_search`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:mu(`type`,[z({type:H(`search`),query:I().optional(),queries:R(I()).optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional(),sources:R(mu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).optional()})))}),fy=(e={})=>dy(e),py=K(()=>q(z({searchContextSize:V([`low`,`medium`,`high`]).optional(),userLocation:z({type:H(`approximate`),country:I().optional(),city:I().optional(),region:I().optional(),timezone:I().optional()}).optional()}))),my=Nh({id:`openai.web_search_preview`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({action:mu(`type`,[z({type:H(`search`),query:I().optional()}),z({type:H(`openPage`),url:I().nullish()}),z({type:H(`findInPage`),url:I().nullish(),pattern:I().nullish()})]).optional()})))}),hy=Du(()=>B([I(),L(),cu(),lu(),R(hy),_u(I(),hy)])),gy=K(()=>q(z({serverLabel:I(),allowedTools:B([R(I()),z({readOnly:cu().optional(),toolNames:R(I()).optional()})]).optional(),authorization:I().optional(),connectorId:I().optional(),headers:_u(I(),I()).optional(),requireApproval:B([V([`always`,`never`]),z({never:z({toolNames:R(I()).optional()}).optional()})]).optional(),serverDescription:I().optional(),serverUrl:I().optional()}).refine(e=>e.serverUrl!=null||e.connectorId!=null,`One of serverUrl or connectorId must be provided.`))),_y=Nh({id:`openai.mcp`,inputSchema:K(()=>q(z({}))),outputSchema:K(()=>q(z({type:H(`call`),serverLabel:I(),name:I(),arguments:I(),output:I().nullish(),error:B([I(),hy]).optional()})))}),vy=e=>_y(e),yy={applyPatch:Pv,customTool:Hv,codeInterpreter:zv,fileSearch:qv,imageGeneration:Xv,localShell:$v,shell:iy,webSearchPreview:my,webSearch:fy,mcp:vy,toolSearch:ly},by=class{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.provider=t.provider,this.config=t}async doCreateClientSecret(e){let t=this.config.fetch??fetch,n=`${this.config.baseURL}/realtime/client_secrets`,r=e.sessionConfig==null?{type:`realtime`,model:this.modelId}:T_(e.sessionConfig,this.modelId),i=await t(n,{method:`POST`,headers:{...this.config.headers(),"Content-Type":`application/json`},body:JSON.stringify({session:r,...e.expiresAfterSeconds==null?{}:{expires_after:{anchor:`created_at`,seconds:e.expiresAfterSeconds}}})});if(!i.ok){let e=await i.text();throw Error(`OpenAI realtime client secret request failed: ${i.status} ${e}`)}let a=await i.json();return{token:a.value,url:`wss://${new URL(this.config.baseURL).host}/v1/realtime?model=${encodeURIComponent(this.modelId)}`,expiresAt:a.expires_at}}getWebSocketConfig(e){return{url:e.url,protocols:[`realtime`,`openai-insecure-api-key.${e.token}`]}}parseServerEvent(e){return C_(e)}serializeClientEvent(e){return w_(e,this.modelId)}buildSessionConfig(e){return T_(e,this.modelId)}},xy=z({itemId:I().nullish(),reasoningEncryptedContent:I().nullish()}),Sy=Du(()=>B([I(),L(),cu(),lu(),R(Sy),_u(I(),Sy.optional())])),Cy=z({type:H(`error`),sequence_number:L(),error:z({type:I(),code:I(),message:I(),param:I().nullish()})}),wy=z({type:H(`error`),sequence_number:L(),code:I().nullish(),message:I(),param:I().nullish()}),Ty=K(()=>q(B([z({type:H(`response.output_text.delta`),item_id:I(),delta:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish()}),z({type:V([`response.completed`,`response.incomplete`]),response:z({incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.failed`),sequence_number:L(),response:z({error:z({code:I().nullish(),message:I()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).nullish(),reasoning:z({context:I().nullish()}).nullish(),service_tier:I().nullish()})}),z({type:H(`response.created`),response:z({id:I(),created_at:L(),model:I(),service_tier:I().nullish()})}),z({type:H(`response.output_item.added`),output_index:L(),item:mu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),namespace:I().nullish()}),z({type:H(`web_search_call`),id:I(),status:I()}),z({type:H(`computer_call`),id:I(),status:I()}),z({type:H(`file_search_call`),id:I()}),z({type:H(`image_generation_call`),id:I()}),z({type:H(`code_interpreter_call`),id:I(),container_id:I(),code:I().nullable(),outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable(),status:I()}),z({type:H(`mcp_call`),id:I(),status:I(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I()}),z({type:H(`mcp_approval_request`),id:I()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I()}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I().nullish()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:du()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(_u(I(),Sy.optional()))})])}),z({type:H(`response.output_item.done`),output_index:L(),item:mu(`type`,[z({type:H(`message`),id:I(),phase:V([`commentary`,`final_answer`]).nullish()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish()}),z({type:H(`function_call`),id:I(),call_id:I(),name:I(),arguments:I(),status:H(`completed`),namespace:I().nullish()}),z({type:H(`custom_tool_call`),id:I(),call_id:I(),name:I(),input:I(),status:H(`completed`)}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`web_search_call`),id:I(),status:I(),action:mu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(mu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:_u(I(),B([I(),L(),cu()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:_u(I(),I()).optional()})}),z({type:H(`computer_call`),id:I(),status:H(`completed`)}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:uu(),annotations:_u(I(),du()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:du()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(_u(I(),Sy.optional()))})])}),z({type:H(`response.function_call_arguments.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.custom_tool_call_input.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.image_generation_call.partial_image`),item_id:I(),output_index:L(),partial_image_b64:I()}),z({type:H(`response.code_interpreter_call_code.delta`),item_id:I(),output_index:L(),delta:I()}),z({type:H(`response.code_interpreter_call_code.done`),item_id:I(),output_index:L(),code:I()}),z({type:H(`response.output_text.annotation.added`),annotation:mu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})])}),z({type:H(`response.reasoning_summary_part.added`),item_id:I(),summary_index:L()}),z({type:H(`response.reasoning_summary_text.delta`),item_id:I(),summary_index:L(),delta:I()}),z({type:H(`response.reasoning_summary_part.done`),item_id:I(),summary_index:L()}),z({type:H(`response.apply_patch_call_operation_diff.delta`),item_id:I(),output_index:L(),delta:I(),obfuscation:I().nullish()}),z({type:H(`response.apply_patch_call_operation_diff.done`),item_id:I(),output_index:L(),diff:I()}),Cy,wy,z({type:I()}).loose().transform(e=>({type:`unknown_chunk`,message:e.type}))]))),Ey=K(()=>q(z({id:I().optional(),created_at:L().optional(),error:z({message:I(),type:I(),param:I().nullish(),code:I()}).nullish(),model:I().optional(),output:R(mu(`type`,[z({type:H(`message`),role:H(`assistant`),id:I(),phase:V([`commentary`,`final_answer`]).nullish(),content:R(z({type:H(`output_text`),text:I(),logprobs:R(z({token:I(),logprob:L(),top_logprobs:R(z({token:I(),logprob:L()}))})).nullish(),annotations:R(mu(`type`,[z({type:H(`url_citation`),start_index:L(),end_index:L(),url:I(),title:I()}),z({type:H(`file_citation`),file_id:I(),filename:I(),index:L()}),z({type:H(`container_file_citation`),container_id:I(),file_id:I(),filename:I(),start_index:L(),end_index:L()}),z({type:H(`file_path`),file_id:I(),index:L()})]))}))}),z({type:H(`web_search_call`),id:I(),status:I(),action:mu(`type`,[z({type:H(`search`),query:I().nullish(),queries:R(I()).nullish(),sources:R(mu(`type`,[z({type:H(`url`),url:I()}),z({type:H(`api`),name:I()})])).nullish()}),z({type:H(`open_page`),url:I().nullish()}),z({type:H(`find_in_page`),url:I().nullish(),pattern:I().nullish()})]).nullish()}),z({type:H(`file_search_call`),id:I(),queries:R(I()),results:R(z({attributes:_u(I(),B([I(),L(),cu()])),file_id:I(),filename:I(),score:L(),text:I()})).nullish()}),z({type:H(`code_interpreter_call`),id:I(),code:I().nullable(),container_id:I(),outputs:R(mu(`type`,[z({type:H(`logs`),logs:I()}),z({type:H(`image`),url:I()})])).nullable()}),z({type:H(`image_generation_call`),id:I(),result:I()}),z({type:H(`local_shell_call`),id:I(),call_id:I(),action:z({type:H(`exec`),command:R(I()),timeout_ms:L().optional(),user:I().optional(),working_directory:I().optional(),env:_u(I(),I()).optional()})}),z({type:H(`function_call`),call_id:I(),name:I(),arguments:I(),id:I(),namespace:I().nullish()}),z({type:H(`custom_tool_call`),call_id:I(),name:I(),input:I(),id:I()}),z({type:H(`computer_call`),id:I(),status:I().optional()}),z({type:H(`reasoning`),id:I(),encrypted_content:I().nullish(),summary:R(z({type:H(`summary_text`),text:I()}))}),z({type:H(`mcp_call`),id:I(),status:I(),arguments:I(),name:I(),server_label:I(),output:I().nullish(),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).nullish(),approval_request_id:I().nullish()}),z({type:H(`mcp_list_tools`),id:I(),server_label:I(),tools:R(z({name:I(),description:I().optional(),input_schema:uu(),annotations:_u(I(),du()).optional()})),error:B([I(),z({type:I().optional(),code:B([L(),I()]).optional(),message:I().optional()}).loose()]).optional()}),z({type:H(`mcp_approval_request`),id:I(),server_label:I(),name:I(),arguments:I(),approval_request_id:I().optional()}),z({type:H(`apply_patch_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`]),operation:mu(`type`,[z({type:H(`create_file`),path:I(),diff:I()}),z({type:H(`delete_file`),path:I()}),z({type:H(`update_file`),path:I(),diff:I()})])}),z({type:H(`shell_call`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),action:z({commands:R(I())})}),z({type:H(`compaction`),id:I(),encrypted_content:I()}),z({type:H(`shell_call_output`),id:I(),call_id:I(),status:V([`in_progress`,`completed`,`incomplete`]),output:R(z({stdout:I(),stderr:I(),outcome:mu(`type`,[z({type:H(`timeout`)}),z({type:H(`exit`),exit_code:L()})])}))}),z({type:H(`tool_search_call`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),arguments:du()}),z({type:H(`tool_search_output`),id:I(),execution:V([`server`,`client`]),call_id:I().nullable(),status:V([`in_progress`,`completed`,`incomplete`]),tools:R(_u(I(),Sy.optional()))})])).optional(),service_tier:I().nullish(),reasoning:z({context:I().nullish()}).nullish(),incomplete_details:z({reason:I()}).nullish(),usage:z({input_tokens:L(),input_tokens_details:z({cached_tokens:L().nullish(),cache_write_tokens:L().nullish(),orchestration_input_tokens:L().nullish(),orchestration_input_cached_tokens:L().nullish()}).nullish(),output_tokens:L(),output_tokens_details:z({reasoning_tokens:L().nullish(),orchestration_output_tokens:L().nullish()}).nullish()}).optional()}))),Dy=20,Oy=K(()=>q(z({conversation:I().nullish(),include:R(V([`reasoning.encrypted_content`,`file_search_call.results`,`web_search_call.results`,`message.output_text.logprobs`])).nullish(),instructions:I().nullish(),logprobs:B([cu(),L().min(1).max(Dy)]).optional(),maxToolCalls:L().nullish(),metadata:uu().nullish(),parallelToolCalls:cu().nullish(),previousResponseId:I().nullish(),promptCacheKey:I().nullish(),promptCacheOptions:z({mode:V([`implicit`,`explicit`]).optional(),ttl:H(`30m`).optional()}).optional(),promptCacheRetention:V([`in_memory`,`24h`]).nullish(),reasoningEffort:I().nullish(),reasoningMode:V([`standard`,`pro`]).optional(),reasoningContext:V([`auto`,`current_turn`,`all_turns`]).optional(),reasoningSummary:I().nullish(),safetyIdentifier:I().nullish(),serviceTier:V([`auto`,`flex`,`priority`,`default`]).nullish(),store:cu().nullish(),passThroughUnsupportedFiles:cu().optional(),strictJsonSchema:cu().nullish(),textVerbosity:V([`low`,`medium`,`high`]).nullish(),truncation:V([`auto`,`disabled`]).nullish(),user:I().nullish(),systemMessageMode:V([`system`,`developer`,`remove`]).optional(),forceReasoning:cu().optional(),contextManagement:R(z({type:H(`compaction`),compactThreshold:L()})).nullish(),allowedTools:z({toolNames:R(I()).min(1),mode:V([`auto`,`required`]).optional()}).optional()}))),ky=class e{constructor(e,t){this.specificationVersion=`v4`,this.supportedUrls={"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]},this.modelId=e,this.config=t}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({maxOutputTokens:e,temperature:t,stopSequences:n,topP:r,topK:i,presencePenalty:a,frequencyPenalty:o,seed:s,prompt:c,reasoning:l,providerOptions:u,tools:d,toolChoice:f,responseFormat:p}){let m=[],h=$g(this.modelId);i!=null&&m.push({type:`unsupported`,feature:`topK`}),s!=null&&m.push({type:`unsupported`,feature:`seed`}),a!=null&&m.push({type:`unsupported`,feature:`presencePenalty`}),o!=null&&m.push({type:`unsupported`,feature:`frequencyPenalty`}),n!=null&&m.push({type:`unsupported`,feature:`stopSequences`});let g=this.config.provider.includes(`azure`)?`azure`:`openai`,_=await kh({provider:g,providerOptions:u,schema:Oy});_==null&&g!==`openai`&&(_=await kh({provider:`openai`,providerOptions:u,schema:Oy}));let v=_?.reasoningEffort??(Om(l)?l:void 0),y=_?.reasoningSummary===void 0?v!=null&&v!==`none`?`detailed`:void 0:_.reasoningSummary,b=_?.forceReasoning??h.isReasoningModel;_?.conversation&&_?.previousResponseId&&m.push({type:`unsupported`,feature:`conversation`,details:`conversation and previousResponseId cannot be used together`});let x=Zp({tools:d,providerToolNames:{"openai.code_interpreter":`code_interpreter`,"openai.file_search":`file_search`,"openai.image_generation":`image_generation`,"openai.local_shell":`local_shell`,"openai.shell":`shell`,"openai.web_search":`web_search`,"openai.web_search_preview":`web_search_preview`,"openai.mcp":`mcp`,"openai.apply_patch":`apply_patch`,"openai.tool_search":`tool_search`}}),S=new Set,{tools:C,toolChoice:w,toolWarnings:T}=await M_({tools:d,toolChoice:f,allowedTools:_?.allowedTools??void 0,toolNameMapping:x,customProviderToolNames:S}),{input:E,warnings:D}=await A_({prompt:c,toolNameMapping:x,systemMessageMode:_?.systemMessageMode??(b?`developer`:h.systemMessageMode),providerOptionsName:g,fileIdPrefixes:this.config.fileIdPrefixes,passThroughUnsupportedFiles:_?.passThroughUnsupportedFiles??!1,store:_?.store??!0,hasConversation:_?.conversation!=null,hasPreviousResponseId:_?.previousResponseId!=null,hasLocalShellTool:te(`openai.local_shell`),hasShellTool:te(`openai.shell`),hasApplyPatchTool:te(`openai.apply_patch`),customProviderToolNames:S.size>0?S:void 0});m.push(...D);let O=_?.strictJsonSchema??!0,k=_?.include;function ee(e){k==null?k=[e]:k.includes(e)||(k=[...k,e])}function te(e){return d?.find(t=>t.type===`provider`&&t.id===e)!=null}let A=typeof _?.logprobs==`number`?_?.logprobs:_?.logprobs===!0?Dy:void 0;A&&ee(`message.output_text.logprobs`);let ne=d?.find(e=>e.type===`provider`&&(e.id===`openai.web_search`||e.id===`openai.web_search_preview`))?.name;ne&&ee(`web_search_call.action.sources`),te(`openai.code_interpreter`)&&ee(`code_interpreter_call.outputs`);let re=_?.store;re===!1&&b&&ee(`reasoning.encrypted_content`);let ie={model:this.modelId,input:E,temperature:t,top_p:r,max_output_tokens:e,...(p?.type===`json`||_?.textVerbosity)&&{text:{...p?.type===`json`&&{format:p.schema==null?{type:`json_object`}:{type:`json_schema`,strict:O,name:p.name??`response`,description:p.description,schema:p.schema}},..._?.textVerbosity&&{verbosity:_.textVerbosity}}},conversation:_?.conversation,max_tool_calls:_?.maxToolCalls,metadata:_?.metadata,parallel_tool_calls:_?.parallelToolCalls,previous_response_id:_?.previousResponseId,store:re,user:_?.user,instructions:_?.instructions,service_tier:_?.serviceTier,include:k,prompt_cache_key:_?.promptCacheKey,prompt_cache_options:_?.promptCacheOptions,prompt_cache_retention:_?.promptCacheRetention,safety_identifier:_?.safetyIdentifier,top_logprobs:A,truncation:_?.truncation,..._?.contextManagement&&{context_management:_.contextManagement.map(e=>({type:e.type,compact_threshold:e.compactThreshold}))},...b&&(v!=null||y!=null||_?.reasoningMode!=null||_?.reasoningContext!=null)&&{reasoning:{...v!=null&&{effort:v},...y!=null&&{summary:y},..._?.reasoningMode!=null&&{mode:_.reasoningMode},..._?.reasoningContext!=null&&{context:_.reasoningContext}}}};b?v===`none`&&h.supportsNonReasoningParameters||(ie.temperature!=null&&(ie.temperature=void 0,m.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported for reasoning models`})),ie.top_p!=null&&(ie.top_p=void 0,m.push({type:`unsupported`,feature:`topP`,details:`topP is not supported for reasoning models`}))):(_?.reasoningEffort!=null&&m.push({type:`unsupported`,feature:`reasoningEffort`,details:`reasoningEffort is not supported for non-reasoning models`}),_?.reasoningSummary!=null&&m.push({type:`unsupported`,feature:`reasoningSummary`,details:`reasoningSummary is not supported for non-reasoning models`}),_?.reasoningMode!=null&&m.push({type:`unsupported`,feature:`reasoningMode`,details:`reasoningMode is not supported for non-reasoning models`}),_?.reasoningContext!=null&&m.push({type:`unsupported`,feature:`reasoningContext`,details:`reasoningContext is not supported for non-reasoning models`})),_?.serviceTier===`flex`&&!h.supportsFlexProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`flex processing is only available for o3, o4-mini, and gpt-5 models`}),delete ie.service_tier),_?.serviceTier===`priority`&&!h.supportsPriorityProcessing&&(m.push({type:`unsupported`,feature:`serviceTier`,details:`priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported`}),delete ie.service_tier);let ae=d?.find(e=>e.type===`provider`&&e.id===`openai.shell`)?.args?.environment?.type,oe=ae===`containerAuto`||ae===`containerReference`;return{webSearchToolName:ne,args:{...ie,tools:C,tool_choice:w},warnings:[...m,...T],store:re,toolNameMapping:x,providerOptionsName:g,isShellProviderExecuted:oe}}async doGenerate(e){var t,n,r,i,a,o;let{args:s,warnings:c,webSearchToolName:l,toolNameMapping:u,providerOptionsName:d,isShellProviderExecuted:f}=await this.getArgs(e),p=this.config.url({path:`/responses`,modelId:this.modelId}),m=I_(e.prompt),{responseHeaders:h,value:g,rawValue:_}=await Vg({url:p,headers:Gp((t=this.config).headers?.call(t),e.headers),body:s,failedResponseHandler:uv,successfulResponseHandler:Jg(Ey),abortSignal:e.abortSignal,fetch:this.config.fetch});if(g.error)throw new ti({message:g.error.message,url:p,requestBodyValues:s,statusCode:400,responseHeaders:h,responseBody:_,isRetryable:!1});let v=[],y=[],b=!1,x=[];for(let t of g.output)switch(t.type){case`reasoning`:t.summary.length===0&&t.summary.push({type:`summary_text`,text:``});for(let e of t.summary)v.push({type:`reasoning`,text:e.text,providerMetadata:{[d]:{itemId:t.id,reasoningEncryptedContent:t.encrypted_content??null}}});break;case`image_generation_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`image_generation`),result:{result:t.result}});break;case`tool_search_call`:{let e=t.call_id??t.id,n=t.execution===`server`;n&&x.push(e),v.push({type:`tool-call`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),input:JSON.stringify({arguments:t.arguments,call_id:t.call_id}),...n?{providerExecuted:!0}:{},providerMetadata:{[d]:{itemId:t.id}}});break}case`tool_search_output`:{let e=t.call_id??x.shift()??t.id;v.push({type:`tool-result`,toolCallId:e,toolName:u.toCustomToolName(`tool_search`),result:{tools:t.tools},providerMetadata:{[d]:{itemId:t.id}}});break}case`local_shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`local_shell`),input:JSON.stringify({action:t.action}),providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:t.action.commands}}),...f&&{providerExecuted:!0},providerMetadata:{[d]:{itemId:t.id}}});break;case`shell_call_output`:v.push({type:`tool-result`,toolCallId:t.call_id,toolName:u.toCustomToolName(`shell`),result:{output:t.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});break;case`message`:for(let o of t.content){e.providerOptions?.[d]?.logprobs&&o.logprobs&&y.push(o.logprobs);let s={itemId:t.id,...t.phase!=null&&{phase:t.phase},...o.annotations.length>0&&{annotations:o.annotations}};v.push({type:`text`,text:o.text,providerMetadata:{[d]:s}});for(let e of o.annotations)e.type===`url_citation`?v.push({type:`source`,sourceType:`url`,id:(n=this.config).generateId?.call(n)??ug(),url:e.url,title:e.title}):e.type===`file_citation`?v.push({type:`source`,sourceType:`document`,id:(r=this.config).generateId?.call(r)??ug(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}}):e.type===`container_file_citation`?v.push({type:`source`,sourceType:`document`,id:(i=this.config).generateId?.call(i)??ug(),mediaType:`text/plain`,title:e.filename,filename:e.filename,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,containerId:e.container_id}}}):e.type===`file_path`&&v.push({type:`source`,sourceType:`document`,id:(a=this.config).generateId?.call(a)??ug(),mediaType:`application/octet-stream`,title:e.file_id,filename:e.file_id,providerMetadata:{[d]:{type:e.type,fileId:e.file_id,index:e.index}}})}break;case`function_call`:b=!0,v.push({type:`tool-call`,toolCallId:t.call_id,toolName:t.name,input:t.arguments,providerMetadata:{[d]:{itemId:t.id,...t.namespace!=null&&{namespace:t.namespace}}}});break;case`custom_tool_call`:{b=!0;let e=u.toCustomToolName(t.name);v.push({type:`tool-call`,toolCallId:t.call_id,toolName:e,input:JSON.stringify(t.input),providerMetadata:{[d]:{itemId:t.id}}});break}case`web_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),input:JSON.stringify({}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(l??`web_search`),result:nv(t.action)});break;case`mcp_call`:{let e=t.approval_request_id==null?t.id:m[t.approval_request_id]??t.id,n=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:e,toolName:n,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-result`,toolCallId:e,toolName:n,result:{type:`call`,serverLabel:t.server_label,name:t.name,arguments:t.arguments,...t.output==null?{}:{output:t.output},...t.error==null?{}:{error:t.error}},providerMetadata:{[d]:{itemId:t.id}}});break}case`mcp_list_tools`:break;case`mcp_approval_request`:{let e=t.approval_request_id??t.id,n=(o=this.config).generateId?.call(o)??ug(),r=`mcp.${t.name}`;v.push({type:`tool-call`,toolCallId:n,toolName:r,input:t.arguments,providerExecuted:!0,dynamic:!0}),v.push({type:`tool-approval-request`,approvalId:e,toolCallId:n});break}case`computer_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:t.status||`completed`}});break;case`file_search_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`file_search`),result:{queries:t.queries,results:t.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});break;case`code_interpreter_call`:v.push({type:`tool-call`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:t.code,containerId:t.container_id}),providerExecuted:!0}),v.push({type:`tool-result`,toolCallId:t.id,toolName:u.toCustomToolName(`code_interpreter`),result:{outputs:t.outputs}});break;case`apply_patch_call`:v.push({type:`tool-call`,toolCallId:t.call_id,toolName:u.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:t.call_id,operation:t.operation}),providerMetadata:{[d]:{itemId:t.id}}});break;case`compaction`:v.push({type:`custom`,kind:`openai.compaction`,providerMetadata:{[d]:{type:`compaction`,itemId:t.id,encryptedContent:t.encrypted_content}}});break}let S={[d]:{responseId:g.id,...y.length>0?{logprobs:y}:{},...typeof g.service_tier==`string`?{serviceTier:g.service_tier}:{},...g.reasoning?.context==null?{}:{reasoningContext:g.reasoning.context}}},C=g.usage;return{content:v,finishReason:{unified:j_({finishReason:g.incomplete_details?.reason,hasFunctionCall:b}),raw:g.incomplete_details?.reason??void 0},usage:E_(C),request:{body:s},response:{id:g.id,timestamp:new Date(g.created_at*1e3),modelId:g.model,headers:h,body:_},providerMetadata:S,warnings:c}}async doStream(e){var t;let{args:n,warnings:r,webSearchToolName:i,toolNameMapping:a,store:o,providerOptionsName:s,isShellProviderExecuted:c}=await this.getArgs(e),l=this.config.url({path:`/responses`,modelId:this.modelId}),{responseHeaders:u,value:d}=await Vg({url:l,headers:Gp((t=this.config).headers?.call(t),e.headers),body:{...n,stream:!0},failedResponseHandler:uv,successfulResponseHandler:qg(Ty),abortSignal:e.abortSignal,fetch:this.config.fetch}),f=await e_({stream:d,getError:e=>ev(e)||U_(e)&&e.response.error!=null?e:void 0,isOutputChunk:tv,url:l,requestBodyValues:n,responseHeaders:u}),p=this,m=I_(e.prompt),h=new Map,g={unified:`other`,raw:void 0},_,v=[],y=null,b={},x=[],S,C=!1,w={},T,E,D=[],O=!1;return{stream:f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:r})},transform(t,r){var d,f,k,ee,te;if(e.includeRawChunks&&r.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){let e=R_(t.rawValue)?z_({value:t.rawValue,cause:t.error,url:l,requestBodyValues:n,responseHeaders:u}):t.error;g={unified:`error`,raw:void 0},r.enqueue({type:`error`,error:e});return}let A=t.value;if(Q_(A)){if(A.item.type===`function_call`)b[A.output_index]={toolName:A.item.name,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:A.item.name});else if(A.item.type===`custom_tool_call`){let e=a.toCustomToolName(A.item.name);b[A.output_index]={toolName:e,toolCallId:A.item.call_id},r.enqueue({type:`tool-input-start`,id:A.item.call_id,toolName:e})}else if(A.item.type===`web_search_call`)b[A.output_index]={toolName:a.toCustomToolName(i??`web_search`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(i??`web_search`),providerExecuted:!0}),r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),input:JSON.stringify({}),providerExecuted:!0});else if(A.item.type===`computer_call`)b[A.output_index]={toolName:a.toCustomToolName(`computer_use`),toolCallId:A.item.id},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`computer_use`),providerExecuted:!0});else if(A.item.type===`code_interpreter_call`)b[A.output_index]={toolName:a.toCustomToolName(`code_interpreter`),toolCallId:A.item.id,codeInterpreter:{containerId:A.item.container_id}},r.enqueue({type:`tool-input-start`,id:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),providerExecuted:!0}),r.enqueue({type:`tool-input-delta`,id:A.item.id,delta:`{"containerId":"${A.item.container_id}","code":"`});else if(A.item.type===`file_search_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),input:`{}`,providerExecuted:!0});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),input:`{}`,providerExecuted:!0});else if(A.item.type===`tool_search_call`){let e=A.item.id,t=a.toCustomToolName(`tool_search`),n=A.item.execution===`server`;b[A.output_index]={toolName:t,toolCallId:e,toolSearchExecution:A.item.execution??`server`},n&&r.enqueue({type:`tool-input-start`,id:e,toolName:t,providerExecuted:!0})}else if(A.item.type!==`tool_search_output`&&!(A.item.type===`mcp_call`||A.item.type===`mcp_list_tools`||A.item.type===`mcp_approval_request`))if(A.item.type===`apply_patch_call`){let{call_id:e,operation:t}=A.item;if(b[A.output_index]={toolName:a.toCustomToolName(`apply_patch`),toolCallId:e,applyPatch:{hasDiff:t.type===`delete_file`,endEmitted:t.type===`delete_file`}},r.enqueue({type:`tool-input-start`,id:e,toolName:a.toCustomToolName(`apply_patch`)}),t.type===`delete_file`){let n=JSON.stringify({callId:e,operation:t});r.enqueue({type:`tool-input-delta`,id:e,delta:n}),r.enqueue({type:`tool-input-end`,id:e})}else r.enqueue({type:`tool-input-delta`,id:e,delta:`{"callId":"${rv(e)}","operation":{"type":"${rv(t.type)}","path":"${rv(t.path)}","diff":"`})}else A.item.type===`shell_call`?b[A.output_index]={toolName:a.toCustomToolName(`shell`),toolCallId:A.item.call_id}:A.item.type===`shell_call_output`||(A.item.type===`message`?(x.splice(0,x.length),S=A.item.phase??void 0,r.enqueue({type:`text-start`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...A.item.phase!=null&&{phase:A.item.phase}}}})):Q_(A)&&A.item.type===`reasoning`&&(w[A.item.id]={encryptedContent:A.item.encrypted_content,summaryParts:{0:`active`}},r.enqueue({type:`reasoning-start`,id:`${A.item.id}:0`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}})))}else if(V_(A))if(A.item.type===`message`){let e=A.item.phase??S;S=void 0,r.enqueue({type:`text-end`,id:A.item.id,providerMetadata:{[s]:{itemId:A.item.id,...e!=null&&{phase:e},...x.length>0&&{annotations:x}}}})}else if(A.item.type===`function_call`)b[A.output_index]=void 0,C=!0,r.enqueue({type:`tool-input-end`,id:A.item.call_id,...A.item.namespace!=null&&{providerMetadata:{[s]:{namespace:A.item.namespace}}}}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:A.item.name,input:A.item.arguments,providerMetadata:{[s]:{itemId:A.item.id,...A.item.namespace!=null&&{namespace:A.item.namespace}}}});else if(A.item.type===`custom_tool_call`){b[A.output_index]=void 0,C=!0;let e=a.toCustomToolName(A.item.name);r.enqueue({type:`tool-input-end`,id:A.item.call_id}),r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:e,input:JSON.stringify(A.item.input),providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`web_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(i??`web_search`),result:nv(A.item.action)});else if(A.item.type===`computer_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-input-end`,id:A.item.id}),r.enqueue({type:`tool-call`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),input:``,providerExecuted:!0}),r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`computer_use`),result:{type:`computer_use_tool_result`,status:A.item.status||`completed`}});else if(A.item.type===`file_search_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`file_search`),result:{queries:A.item.queries,results:A.item.results?.map(e=>({attributes:e.attributes,fileId:e.file_id,filename:e.filename,score:e.score,text:e.text}))??null}});else if(A.item.type===`code_interpreter_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`code_interpreter`),result:{outputs:A.item.outputs}});else if(A.item.type===`image_generation_call`)r.enqueue({type:`tool-result`,toolCallId:A.item.id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.item.result}});else if(A.item.type===`tool_search_call`){let e=b[A.output_index],t=A.item.execution===`server`;if(e!=null){let n=t?e.toolCallId:A.item.call_id??A.item.id;t?D.push(n):r.enqueue({type:`tool-input-start`,id:n,toolName:e.toolName}),r.enqueue({type:`tool-input-end`,id:n}),r.enqueue({type:`tool-call`,toolCallId:n,toolName:e.toolName,input:JSON.stringify({arguments:A.item.arguments,call_id:t?null:n}),...t?{providerExecuted:!0}:{},providerMetadata:{[s]:{itemId:A.item.id}}})}b[A.output_index]=void 0}else if(A.item.type===`tool_search_output`){let e=A.item.call_id??D.shift()??A.item.id;r.enqueue({type:`tool-result`,toolCallId:e,toolName:a.toCustomToolName(`tool_search`),result:{tools:A.item.tools},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_call`){b[A.output_index]=void 0;let e=A.item.approval_request_id??void 0,t=e==null?A.item.id:h.get(e)??m[e]??A.item.id,n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:t,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-result`,toolCallId:t,toolName:n,result:{type:`call`,serverLabel:A.item.server_label,name:A.item.name,arguments:A.item.arguments,...A.item.output==null?{}:{output:A.item.output},...A.item.error==null?{}:{error:A.item.error}},providerMetadata:{[s]:{itemId:A.item.id}}})}else if(A.item.type===`mcp_list_tools`)b[A.output_index]=void 0;else if(A.item.type===`apply_patch_call`){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&A.item.operation.type!==`delete_file`&&(e.applyPatch.hasDiff||r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.item.operation.diff)}),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0),e&&A.item.status===`completed`&&r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`apply_patch`),input:JSON.stringify({callId:A.item.call_id,operation:A.item.operation}),providerMetadata:{[s]:{itemId:A.item.id}}}),b[A.output_index]=void 0}else if(A.item.type===`mcp_approval_request`){b[A.output_index]=void 0;let e=(d=p.config).generateId?.call(d)??ug(),t=A.item.approval_request_id??A.item.id;h.set(t,e);let n=`mcp.${A.item.name}`;r.enqueue({type:`tool-call`,toolCallId:e,toolName:n,input:A.item.arguments,providerExecuted:!0,dynamic:!0}),r.enqueue({type:`tool-approval-request`,approvalId:t,toolCallId:e})}else if(A.item.type===`local_shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`local_shell`),input:JSON.stringify({action:{type:`exec`,command:A.item.action.command,timeoutMs:A.item.action.timeout_ms,user:A.item.action.user,workingDirectory:A.item.action.working_directory,env:A.item.action.env}}),providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call`)b[A.output_index]=void 0,r.enqueue({type:`tool-call`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),input:JSON.stringify({action:{commands:A.item.action.commands}}),...c&&{providerExecuted:!0},providerMetadata:{[s]:{itemId:A.item.id}}});else if(A.item.type===`shell_call_output`)r.enqueue({type:`tool-result`,toolCallId:A.item.call_id,toolName:a.toCustomToolName(`shell`),result:{output:A.item.output.map(e=>({stdout:e.stdout,stderr:e.stderr,outcome:e.outcome.type===`exit`?{type:`exit`,exitCode:e.outcome.exit_code}:{type:`timeout`}}))}});else if(A.item.type===`reasoning`){let e=w[A.item.id],t=Object.entries(e.summaryParts).filter(([e,t])=>t===`active`||t===`can-conclude`).map(([e])=>e);for(let e of t)r.enqueue({type:`reasoning-end`,id:`${A.item.id}:${e}`,providerMetadata:{[s]:{itemId:A.item.id,reasoningEncryptedContent:A.item.encrypted_content??null}}});delete w[A.item.id]}else A.item.type===`compaction`&&r.enqueue({type:`custom`,kind:`openai.compaction`,providerMetadata:{[s]:{type:`compaction`,itemId:A.item.id,encryptedContent:A.item.encrypted_content}}});else if(G_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(K_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:A.delta})}else if(X_(A)){let e=b[A.output_index];e?.applyPatch&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.delta)}),e.applyPatch.hasDiff=!0)}else if(Z_(A)){let e=b[A.output_index];e?.applyPatch&&!e.applyPatch.endEmitted&&(e.applyPatch.hasDiff||(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.diff)}),e.applyPatch.hasDiff=!0),r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),e.applyPatch.endEmitted=!0)}else if(q_(A))r.enqueue({type:`tool-result`,toolCallId:A.item_id,toolName:a.toCustomToolName(`image_generation`),result:{result:A.partial_image_b64},preliminary:!0});else if(J_(A)){let e=b[A.output_index];e!=null&&r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:rv(A.delta)})}else if(Y_(A)){let e=b[A.output_index];e!=null&&(r.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:`"}`}),r.enqueue({type:`tool-input-end`,id:e.toolCallId}),r.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:a.toCustomToolName(`code_interpreter`),input:JSON.stringify({code:A.code,containerId:e.codeInterpreter.containerId}),providerExecuted:!0}))}else if(W_(A))y=A.response.id,r.enqueue({type:`response-metadata`,id:A.response.id,timestamp:new Date(A.response.created_at*1e3),modelId:A.response.model});else if(L_(A))r.enqueue({type:`text-delta`,id:A.item_id,delta:A.delta}),e.providerOptions?.[s]?.logprobs&&A.logprobs&&v.push(A.logprobs);else if(A.type===`response.reasoning_summary_part.added`){if(A.summary_index>0){let e=w[A.item_id];e.summaryParts[A.summary_index]=`active`;for(let t of Object.keys(e.summaryParts))e.summaryParts[t]===`can-conclude`&&(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${t}`,providerMetadata:{[s]:{itemId:A.item_id}}}),e.summaryParts[t]=`concluded`);r.enqueue({type:`reasoning-start`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id,reasoningEncryptedContent:w[A.item_id]?.encryptedContent??null}}})}}else if(A.type===`response.reasoning_summary_text.delta`)r.enqueue({type:`reasoning-delta`,id:`${A.item_id}:${A.summary_index}`,delta:A.delta,providerMetadata:{[s]:{itemId:A.item_id}}});else if(A.type===`response.reasoning_summary_part.done`)o?(r.enqueue({type:`reasoning-end`,id:`${A.item_id}:${A.summary_index}`,providerMetadata:{[s]:{itemId:A.item_id}}}),w[A.item_id].summaryParts[A.summary_index]=`concluded`):w[A.item_id].summaryParts[A.summary_index]=`can-conclude`;else if(H_(A))g={unified:j_({finishReason:A.response.incomplete_details?.reason,hasFunctionCall:C}),raw:A.response.incomplete_details?.reason??void 0},_=A.response.usage,typeof A.response.service_tier==`string`&&(T=A.response.service_tier),A.response.reasoning?.context!=null&&(E=A.response.reasoning.context);else if(U_(A)){let e=A.response.incomplete_details?.reason;g={unified:e?j_({finishReason:e,hasFunctionCall:C}):`error`,raw:e??`error`},_=A.response.usage??void 0,A.response.reasoning?.context!=null&&(E=A.response.reasoning.context),!O&&A.response.error!=null&&(O=!0,r.enqueue({type:`error`,error:{type:`response.failed`,sequence_number:A.sequence_number,response:{error:A.response.error,incomplete_details:A.response.incomplete_details,service_tier:A.response.service_tier}}}))}else $_(A)?(x.push(A.annotation),A.annotation.type===`url_citation`?r.enqueue({type:`source`,sourceType:`url`,id:(f=p.config).generateId?.call(f)??ug(),url:A.annotation.url,title:A.annotation.title}):A.annotation.type===`file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(k=p.config).generateId?.call(k)??ug(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}}):A.annotation.type===`container_file_citation`?r.enqueue({type:`source`,sourceType:`document`,id:(ee=p.config).generateId?.call(ee)??ug(),mediaType:`text/plain`,title:A.annotation.filename,filename:A.annotation.filename,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,containerId:A.annotation.container_id}}}):A.annotation.type===`file_path`&&r.enqueue({type:`source`,sourceType:`document`,id:(te=p.config).generateId?.call(te)??ug(),mediaType:`application/octet-stream`,title:A.annotation.file_id,filename:A.annotation.file_id,providerMetadata:{[s]:{type:A.annotation.type,fileId:A.annotation.file_id,index:A.annotation.index}}})):ev(A)&&(O=!0,g={unified:`error`,raw:`error`},r.enqueue({type:`error`,error:A}))},flush(e){let t={[s]:{responseId:y,...v.length>0?{logprobs:v}:{},...T===void 0?{}:{serviceTier:T},...E===void 0?{}:{reasoningContext:E}}};e.enqueue({type:`finish`,finishReason:g,usage:E_(_),providerMetadata:t})}})),request:{body:n},response:{headers:u}}}},Ay=K(()=>q(z({instructions:I().nullish(),speed:L().min(.25).max(4).default(1).nullish()}))),jy=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({text:e,voice:t=`alloy`,outputFormat:n=`mp3`,speed:r,instructions:i,language:a,providerOptions:o}){let s=[],c=await kh({provider:`openai`,providerOptions:o,schema:Ay}),l={model:this.modelId,input:e,voice:t,response_format:`mp3`,speed:r,instructions:i};if(n&&([`mp3`,`opus`,`aac`,`flac`,`wav`,`pcm`].includes(n)?l.response_format=n:s.push({type:`unsupported`,feature:`outputFormat`,details:`Unsupported output format: ${n}. Using mp3 instead.`})),c){let e={};for(let t in e){let n=e[t];n!==void 0&&(l[t]=n)}}return a&&s.push({type:`unsupported`,feature:`language`,details:`OpenAI speech models do not support language selection. Language parameter "${a}" was ignored.`}),{requestBody:l,warnings:s}}async doGenerate(e){var t,n;let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{requestBody:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await Vg({url:this.config.url({path:`/audio/speech`,modelId:this.modelId}),headers:Gp((n=this.config).headers?.call(n),e.headers),body:i,failedResponseHandler:uv,successfulResponseHandler:Yg(),abortSignal:e.abortSignal,fetch:this.config.fetch});return{audio:o,warnings:a,request:{body:JSON.stringify(i)},response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}},My=K(()=>q(z({text:I(),language:I().nullish(),duration:L().nullish(),words:R(z({word:I(),start:L(),end:L()})).nullish(),segments:R(z({id:L(),seek:L(),start:L(),end:L(),text:I(),tokens:R(L()),temperature:L(),avg_logprob:L(),compression_ratio:L(),no_speech_prob:L()})).nullish()}))),Ny=K(()=>q(z({include:R(I()).optional(),language:I().optional(),prompt:I().optional(),temperature:L().min(0).max(1).default(0).optional(),timestampGranularities:R(V([`word`,`segment`])).default([`segment`]).optional(),streaming:z({delay:V([`minimal`,`low`,`medium`,`high`,`xhigh`]).optional(),include:R(I()).optional()}).optional()}))),Py={afrikaans:`af`,arabic:`ar`,armenian:`hy`,azerbaijani:`az`,belarusian:`be`,bosnian:`bs`,bulgarian:`bg`,catalan:`ca`,chinese:`zh`,croatian:`hr`,czech:`cs`,danish:`da`,dutch:`nl`,english:`en`,estonian:`et`,finnish:`fi`,french:`fr`,galician:`gl`,german:`de`,greek:`el`,hebrew:`he`,hindi:`hi`,hungarian:`hu`,icelandic:`is`,indonesian:`id`,italian:`it`,japanese:`ja`,kannada:`kn`,kazakh:`kk`,korean:`ko`,latvian:`lv`,lithuanian:`lt`,macedonian:`mk`,malay:`ms`,marathi:`mr`,maori:`mi`,nepali:`ne`,norwegian:`no`,persian:`fa`,polish:`pl`,portuguese:`pt`,romanian:`ro`,russian:`ru`,serbian:`sr`,slovak:`sk`,slovenian:`sl`,spanish:`es`,swahili:`sw`,swedish:`sv`,tagalog:`tl`,tamil:`ta`,thai:`th`,turkish:`tr`,ukrainian:`uk`,urdu:`ur`,vietnamese:`vi`,welsh:`cy`},Fy=class e{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion=`v4`}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}get provider(){return this.config.provider}async getArgs({audio:e,mediaType:t,providerOptions:n}){let r=[],i=await kh({provider:`openai`,providerOptions:n,schema:Ny}),a=new FormData,o=e instanceof Uint8Array?new Blob([e]):new Blob([Kp(e)]);a.append(`model`,this.modelId);let s=jm(t);if(a.append(`file`,new File([o],`audio`,{type:t}),`audio.${s}`),this.modelId===`whisper-1`&&a.append(`response_format`,`verbose_json`),i){let e=[`gpt-4o-transcribe`,`gpt-4o-mini-transcribe`].includes(this.modelId),t={include:i.include,language:i.language,prompt:i.prompt,...this.modelId!==`whisper-1`&&{response_format:e?`json`:`verbose_json`},temperature:i.temperature,timestamp_granularities:i.timestampGranularities};for(let[e,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let t of n)a.append(`${e}[]`,String(t));else a.append(e,String(n))}return{formData:a,warnings:r}}async doGenerate(e){var t,n;if(iv(this.modelId))throw new ha({functionality:`non-streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,{formData:i,warnings:a}=await this.getArgs(e),{value:o,responseHeaders:s,rawValue:c}=await Hg({url:this.config.url({path:`/audio/transcriptions`,modelId:this.modelId}),headers:Gp((n=this.config).headers?.call(n),e.headers),formData:i,failedResponseHandler:uv,successfulResponseHandler:Jg(My),abortSignal:e.abortSignal,fetch:this.config.fetch}),l=o.language!=null&&o.language in Py?Py[o.language]:void 0;return{text:o.text,segments:o.segments?.map(e=>({text:e.text,startSecond:e.start,endSecond:e.end}))??o.words?.map(e=>({text:e.word,startSecond:e.start,endSecond:e.end}))??[],language:l,durationInSeconds:o.duration??void 0,warnings:a,response:{timestamp:r,modelId:this.modelId,headers:s,body:c}}}async doStream(e){var t,n;if(!iv(this.modelId))throw new ha({functionality:`streaming transcription with ${this.modelId}`});let r=((t=this.config._internal)?.currentDate)?.call(t)??new Date,i=await kh({provider:`openai`,providerOptions:e.providerOptions,schema:Ny}),a=[],o=e.providerOptions?.openai??{};for(let e of[`include`,`prompt`,`temperature`,`timestampGranularities`])o[e]!=null&&a.push({type:`unsupported`,feature:`providerOptions.openai.${e}`,details:`OpenAI streaming transcription does not support ${e}.`});let s=Gp((n=this.config).headers?.call(n),e.headers),c=ov({modelId:this.modelId,inputAudioFormat:e.inputAudioFormat,providerOptions:i});return{request:{body:c},response:{timestamp:r,modelId:this.modelId},stream:av({webSocket:this.config.webSocket,url:Uh(this.config.url({path:`/realtime?intent=transcription`,modelId:this.modelId})),headers:s,sessionUpdate:c,language:i?.language,warnings:a,audio:e.audio,abortSignal:e.abortSignal,includeRawChunks:e.includeRawChunks})}}},Iy=K(()=>q(z({id:I(),name:I().nullish(),description:I().nullish(),default_version:I().nullish(),latest_version:I().nullish(),created_at:L(),updated_at:L().nullish()}))),Ly=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadSkill(e){let t=[];e.displayTitle!=null&&t.push({type:`unsupported`,feature:`displayTitle`});let n=new FormData;for(let t of e.files){let e=Yp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let{value:r}=await Hg({url:this.config.url({path:`/skills`}),headers:Gp(this.config.headers()),formData:n,failedResponseHandler:uv,successfulResponseHandler:Jg(Iy),fetch:this.config.fetch});return{providerReference:{openai:r.id},...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description},...r.latest_version==null?{}:{latestVersion:r.latest_version},providerMetadata:{openai:{...r.default_version==null?{}:{defaultVersion:r.default_version},...r.created_at==null?{}:{createdAt:r.created_at},...r.updated_at==null?{}:{updatedAt:r.updated_at}}},warnings:t}}},Ry=`4.0.11`,cv()}));function By(e){let t=e?.anthropic;return t?.cacheControl??t?.cache_control}async function Vy({tools:e,toolChoice:t,disableParallelToolUse:n,cacheControlValidator:r,supportsStructuredOutput:i,supportsStrictTools:a,defaultEagerInputStreaming:o=!1}){e=e?.length?e:void 0;let s=[],c=new Set,l=r||new Cb;if(e==null)return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};let u=[];for(let t of e)switch(t.type){case`function`:{let e=l.getCacheControl(t.providerOptions,{type:`tool definition`,canCache:!0}),n=t.providerOptions?.anthropic,r=n?.eagerInputStreaming??o,d=n?.deferLoading,f=n?.allowedCallers;!a&&t.strict!=null&&s.push({type:`unsupported`,feature:`strict`,details:`Tool '${t.name}' has strict: ${t.strict}, but strict mode is not supported by this provider. The strict property will be ignored.`}),u.push({name:t.name,description:t.description,input_schema:t.inputSchema,cache_control:e,...r?{eager_input_streaming:!0}:{},...a===!0&&t.strict!=null?{strict:t.strict}:{},...d==null?{}:{defer_loading:d},...f==null?{}:{allowed_callers:f},...t.inputExamples==null?{}:{input_examples:t.inputExamples.map(e=>e.input)}}),i===!0&&c.add(`structured-outputs-2025-11-13`),(t.inputExamples!=null||f!=null)&&c.add(`advanced-tool-use-2025-11-20`);break}case`provider`:switch(t.id){case`anthropic.code_execution_20250522`:c.add(`code-execution-2025-05-22`),u.push({type:`code_execution_20250522`,name:`code_execution`,cache_control:void 0});break;case`anthropic.code_execution_20250825`:c.add(`code-execution-2025-08-25`),u.push({type:`code_execution_20250825`,name:`code_execution`});break;case`anthropic.code_execution_20260120`:u.push({type:`code_execution_20260120`,name:`code_execution`});break;case`anthropic.computer_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`computer`,type:`computer_20250124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.computer_20251124`:c.add(`computer-use-2025-11-24`),u.push({name:`computer`,type:`computer_20251124`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,enable_zoom:t.args.enableZoom,cache_control:void 0});break;case`anthropic.computer_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`computer`,type:`computer_20241022`,display_width_px:t.args.displayWidthPx,display_height_px:t.args.displayHeightPx,display_number:t.args.displayNumber,cache_control:void 0});break;case`anthropic.text_editor_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_editor`,type:`text_editor_20250124`,cache_control:void 0});break;case`anthropic.text_editor_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`str_replace_editor`,type:`text_editor_20241022`,cache_control:void 0});break;case`anthropic.text_editor_20250429`:c.add(`computer-use-2025-01-24`),u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250429`,cache_control:void 0});break;case`anthropic.text_editor_20250728`:{let e=await wh({value:t.args,schema:Ob});u.push({name:`str_replace_based_edit_tool`,type:`text_editor_20250728`,max_characters:e.maxCharacters,cache_control:void 0});break}case`anthropic.bash_20250124`:c.add(`computer-use-2025-01-24`),u.push({name:`bash`,type:`bash_20250124`,cache_control:void 0});break;case`anthropic.bash_20241022`:c.add(`computer-use-2024-10-22`),u.push({name:`bash`,type:`bash_20241022`,cache_control:void 0});break;case`anthropic.memory_20250818`:c.add(`context-management-2025-06-27`),u.push({name:`memory`,type:`memory_20250818`});break;case`anthropic.web_fetch_20250910`:{c.add(`web-fetch-2025-09-10`);let e=await wh({value:t.args,schema:Ub});u.push({type:`web_fetch_20250910`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_fetch_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await wh({value:t.args,schema:zb});u.push({type:`web_fetch_20260209`,name:`web_fetch`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,citations:e.citations,max_content_tokens:e.maxContentTokens,cache_control:void 0});break}case`anthropic.web_search_20250305`:{let e=await wh({value:t.args,schema:Fb});u.push({type:`web_search_20250305`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.web_search_20260209`:{c.add(`code-execution-web-tools-2026-02-09`);let e=await wh({value:t.args,schema:jb});u.push({type:`web_search_20260209`,name:`web_search`,max_uses:e.maxUses,allowed_domains:e.allowedDomains,blocked_domains:e.blockedDomains,user_location:e.userLocation,cache_control:void 0});break}case`anthropic.tool_search_regex_20251119`:u.push({type:`tool_search_tool_regex_20251119`,name:`tool_search_tool_regex`});break;case`anthropic.tool_search_bm25_20251119`:u.push({type:`tool_search_tool_bm25_20251119`,name:`tool_search_tool_bm25`});break;case`anthropic.advisor_20260301`:{c.add(`advisor-tool-2026-03-01`);let e=await wh({value:t.args,schema:wb});u.push({type:`advisor_20260301`,name:`advisor`,model:e.model,...e.maxUses!==void 0&&{max_uses:e.maxUses},...e.caching!==void 0&&{caching:e.caching}});break}default:s.push({type:`unsupported`,feature:`provider-defined tool ${t.id}`});break}break;default:s.push({type:`unsupported`,feature:`tool ${t}`});break}if(t==null)return{tools:u,toolChoice:n?{type:`auto`,disable_parallel_tool_use:n}:void 0,toolWarnings:s,betas:c};let d=t.type;switch(d){case`auto`:return{tools:u,toolChoice:{type:`auto`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`required`:return{tools:u,toolChoice:{type:`any`,disable_parallel_tool_use:n},toolWarnings:s,betas:c};case`none`:return{tools:void 0,toolChoice:void 0,toolWarnings:s,betas:c};case`tool`:return{tools:u,toolChoice:{type:`tool`,name:t.toolName,disable_parallel_tool_use:n},toolWarnings:s,betas:c};default:throw new ha({functionality:`tool choice type: ${d}`})}}function Hy({usage:e,rawUsage:t}){let n=e.cache_creation_input_tokens??0,r=e.cache_read_input_tokens??0,i,a,o=e.iterations?.some(e=>e.type===`fallback_message`);if(e.iterations&&e.iterations.length>0&&!o){let t=e.iterations.filter(e=>e.type===`compaction`||e.type===`message`);if(t.length>0){let e=t.reduce((e,t)=>({input:e.input+t.input_tokens,output:e.output+t.output_tokens}),{input:0,output:0});i=e.input,a=e.output}else i=e.input_tokens,a=e.output_tokens}else i=e.input_tokens,a=e.output_tokens;return{inputTokens:{total:i+n+r,noCache:i,cacheRead:r,cacheWrite:n},outputTokens:{total:a,text:void 0,reasoning:void 0},raw:t??e}}function Uy(e){return typeof e==`string`?new TextDecoder().decode(Kp(e)):new TextDecoder().decode(e)}function Wy(e){try{if(typeof e==`string`)return Pm(e);if(typeof e==`object`&&e)return e}catch{let t=e?.errorCode;return{errorCode:typeof t==`string`?t:`unavailable`}}return{}}async function Gy({prompt:e,sendReasoning:t,warnings:n,cacheControlValidator:r,toolNameMapping:i}){let a=new Set,o=Ky(e),s=r||new Cb,c,l=[];async function u(e){return(await kh({provider:`anthropic`,providerOptions:e,schema:bb}))?.citations?.enabled??!1}async function d(e){return(await kh({provider:`anthropic`,providerOptions:e,schema:bb}))?.containerUpload??!1}async function f(e){let t=await kh({provider:`anthropic`,providerOptions:e,schema:bb});return{title:t?.title,context:t?.context}}for(let e=0;e<o.length;e++){let r=o[e],p=e===o.length-1,m=r.type;switch(m){case`system`:{let e=r.messages.map(({content:e,providerOptions:t})=>({type:`text`,text:e,cache_control:s.getCacheControl(t,{type:`system message`,canCache:!0})}));c==null?c=e:(l.push({role:`system`,content:e}),a.add(`mid-conversation-system-2026-04-07`));break}case`user`:{let e=[];for(let t of r.messages){let{role:r,content:i}=t;switch(r){case`user`:for(let n=0;n<i.length;n++){let r=i[n],o=n===i.length-1,c=s.getCacheControl(r.providerOptions,{type:`user message part`,canCache:!0})??(o?s.getCacheControl(t.providerOptions,{type:`user message`,canCache:!0}):void 0);switch(r.type){case`text`:e.push({type:`text`,text:r.text,cache_control:c});break;case`file`:switch(r.data.type){case`reference`:{let t=Ih({reference:r.data.reference,provider:`anthropic`});a.add(`files-api-2025-04-14`),await d(r.providerOptions)?e.push({type:`container_upload`,file_id:t}):rm(r.mediaType)===`image`?e.push({type:`image`,source:{type:`file`,file_id:t},cache_control:c}):e.push({type:`document`,source:{type:`file`,file_id:t},cache_control:c});break}case`text`:{let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:{type:`text`,media_type:`text/plain`,data:r.data.text},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c});break}case`url`:case`data`:{let t=rm(r.mediaType);if(t===`image`)e.push({type:`image`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:Fh({part:r}),data:Jp(r.data.data)},cache_control:c});else if(t===`application`&&(r.data.type===`url`?r.mediaType===`application/pdf`:Fh({part:r})===`application/pdf`)){a.add(`pdfs-2024-09-25`);let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`base64`,media_type:`application/pdf`,data:Jp(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else if(r.mediaType===`text/plain`){let t=await u(r.providerOptions),n=await f(r.providerOptions);e.push({type:`document`,source:r.data.type===`url`?{type:`url`,url:r.data.url.toString()}:{type:`text`,media_type:`text/plain`,data:Uy(r.data.data)},title:n.title??r.filename,...n.context&&{context:n.context},...t&&{citations:{enabled:!0}},cache_control:c})}else throw new ha({functionality:`media type: ${r.mediaType}`});break}}break}}break;case`tool`:for(let r=0;r<i.length;r++){let o=i[r];if(o.type===`tool-approval-response`)continue;let c=o.output,l=`providerOptions`in c?c.providerOptions:c.type===`content`?c.value.find(e=>e.providerOptions!=null)?.providerOptions:void 0,u=r===i.length-1,d=s.getCacheControl(o.providerOptions,{type:`tool result part`,canCache:!0})??s.getCacheControl(l,{type:`tool result output`,canCache:!0})??(u?s.getCacheControl(t.providerOptions,{type:`tool result message`,canCache:!0}):void 0),f;switch(c.type){case`content`:f=c.value.map(e=>{switch(e.type){case`text`:return{type:`text`,text:e.text};case`file`:{let t=rm(e.mediaType);if(e.data.type===`url`)return t===`image`?{type:`image`,source:{type:`url`,url:e.data.url.toString()}}:{type:`document`,source:{type:`url`,url:e.data.url.toString()}};if(e.data.type===`data`){if(t===`image`)return{type:`image`,source:{type:`base64`,media_type:Fh({part:e}),data:Jp(e.data.data)}};if(Fh({part:e})===`application/pdf`)return a.add(`pdfs-2024-09-25`),{type:`document`,source:{type:`base64`,media_type:`application/pdf`,data:Jp(e.data.data)}};n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with media type: ${e.mediaType}`});return}n.push({type:`other`,message:`unsupported tool content part type: ${e.type} with data type: ${e.data.type}`});return}case`custom`:{let t=e.providerOptions?.anthropic;if(t?.type===`tool-reference`)return{type:`tool_reference`,tool_name:t.toolName};n.push({type:`other`,message:`unsupported custom tool content part`});return}default:n.push({type:`other`,message:`unsupported tool content part type: ${e.type}`});return}}).filter(Cm);break;case`text`:case`error-text`:f=c.value;break;case`execution-denied`:f=c.reason??`Tool call execution denied.`;break;default:f=JSON.stringify(c.value);break}e.push({type:`tool_result`,tool_use_id:o.toolCallId,content:f,is_error:c.type===`error-text`||c.type===`error-json`||void 0,cache_control:d})}break;default:throw Error(`Unsupported role: ${r}`)}}l.push({role:`user`,content:e});break}case`assistant`:{let e=[],a=new Set;for(let o=0;o<r.messages.length;o++){let c=r.messages[o],l=o===r.messages.length-1,{content:u}=c;for(let r=0;r<u.length;r++){let o=u[r],d=r===u.length-1,f=s.getCacheControl(o.providerOptions,{type:`assistant message part`,canCache:!0})??(d?s.getCacheControl(c.providerOptions,{type:`assistant message`,canCache:!0}):void 0);switch(o.type){case`text`:o.providerOptions?.anthropic?.type===`compaction`?e.push({type:`compaction`,content:o.text,cache_control:f}):e.push({type:`text`,text:p&&l&&d?o.text.trim():o.text,cache_control:f});break;case`reasoning`:if(t){let t=await kh({provider:`anthropic`,providerOptions:o.providerOptions,schema:yb});t==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):t.signature==null?t.redactedData==null?n.push({type:`other`,message:`unsupported reasoning metadata`}):(s.getCacheControl(o.providerOptions,{type:`redacted thinking block`,canCache:!1}),e.push({type:`redacted_thinking`,data:t.redactedData})):(s.getCacheControl(o.providerOptions,{type:`thinking block`,canCache:!1}),e.push({type:`thinking`,thinking:o.text,signature:t.signature}))}else n.push({type:`other`,message:`sending reasoning content is disabled for this model`});break;case`tool-call`:{if(o.providerExecuted){let t=i.toProviderToolName(o.toolName);if(o.providerOptions?.anthropic?.type===`mcp-tool-use`){a.add(o.toolCallId);let t=o.providerOptions?.anthropic?.serverName;if(t==null||typeof t!=`string`){n.push({type:`other`,message:`mcp tool use server name is required and must be a string`});break}e.push({type:`mcp_tool_use`,id:o.toolCallId,name:o.toolName,input:o.input,server_name:t,cache_control:f})}else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&typeof o.input.type==`string`&&(o.input.type===`bash_code_execution`||o.input.type===`text_editor_code_execution`))e.push({type:`server_tool_use`,id:o.toolCallId,name:o.input.type,input:o.input,cache_control:f});else if(t===`code_execution`&&o.input!=null&&typeof o.input==`object`&&`type`in o.input&&o.input.type===`programmatic-tool-call`){let{type:t,...n}=o.input;e.push({type:`server_tool_use`,id:o.toolCallId,name:`code_execution`,input:n,cache_control:f})}else t===`code_execution`||t===`web_fetch`||t===`web_search`||t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`?e.push({type:`server_tool_use`,id:o.toolCallId,name:t,input:o.input,cache_control:f}):t===`advisor`?e.push({type:`server_tool_use`,id:o.toolCallId,name:`advisor`,input:{},cache_control:f}):n.push({type:`other`,message:`provider executed tool call for tool ${o.toolName} is not supported`});break}let t=o.providerOptions?.anthropic,r=t?.caller?(t.caller.type===`code_execution_20250825`||t.caller.type===`code_execution_20260120`)&&t.caller.toolId?{type:t.caller.type,tool_id:t.caller.toolId}:t.caller.type===`direct`?{type:`direct`}:void 0:void 0;e.push({type:`tool_use`,id:o.toolCallId,name:o.toolName,input:Jy(o.input),...r&&{caller:r},cache_control:f});break}case`tool-result`:{let t=i.toProviderToolName(o.toolName);if(a.has(o.toolCallId)){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}e.push({type:`mcp_tool_result`,tool_use_id:o.toolCallId,is_error:t.type===`error-json`,content:t.value,cache_control:f})}else if(t===`code_execution`){let t=o.output;if(t.type===`error-text`||t.type===`error-json`){let n={};try{typeof t.value==`string`?n=Pm(t.value):typeof t.value==`object`&&t.value!==null&&(n=t.value)}catch{}n.type===`code_execution_tool_result_error`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:`code_execution_tool_result_error`,error_code:n.errorCode??`unknown`},cache_control:f}):e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:{type:`bash_code_execution_tool_result_error`,error_code:n.errorCode??`unknown`}});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}if(t.value==null||typeof t.value!=`object`||!(`type`in t.value)||typeof t.value.type!=`string`){n.push({type:`other`,message:`provider executed tool result output value is not a valid code execution result for tool ${o.toolName}`});break}if(t.value.type===`code_execution_result`){let n=await wh({value:t.value,schema:qb});e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else if(t.value.type===`encrypted_code_execution_result`){let n=await wh({value:t.value,schema:$b});n.type===`encrypted_code_execution_result`&&e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,encrypted_stdout:n.encrypted_stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f})}else{let n=await wh({value:t.value,schema:Xb});n.type===`code_execution_result`?e.push({type:`code_execution_tool_result`,tool_use_id:o.toolCallId,content:{type:n.type,stdout:n.stdout,stderr:n.stderr,return_code:n.return_code,content:n.content??[]},cache_control:f}):n.type===`bash_code_execution_result`||n.type===`bash_code_execution_tool_result_error`?e.push({type:`bash_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n}):e.push({type:`text_editor_code_execution_tool_result`,tool_use_id:o.toolCallId,cache_control:f,content:n})}break}if(t===`web_fetch`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_tool_result_error`,error_code:Wy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await wh({value:t.value,schema:Wb});e.push({type:`web_fetch_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_fetch_result`,url:r.url,retrieved_at:r.retrievedAt,content:{type:`document`,title:r.content.title,citations:r.content.citations,source:{type:r.content.source.type,media_type:r.content.source.mediaType,data:r.content.source.data}}},cache_control:f});break}if(t===`web_search`){let t=o.output;if(t.type===`error-json`){e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`web_search_tool_result_error`,error_code:Wy(t.value).errorCode??`unavailable`},cache_control:f});break}if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await wh({value:t.value,schema:Ib});e.push({type:`web_search_tool_result`,tool_use_id:o.toolCallId,content:r.map(e=>({url:e.url,title:e.title,page_age:e.pageAge,encrypted_content:e.encryptedContent,type:e.type})),cache_control:f});break}if(t===`tool_search_tool_regex`||t===`tool_search_tool_bm25`){let t=o.output;if(t.type!==`json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=(await wh({value:t.value,schema:nx})).map(e=>({type:`tool_reference`,tool_name:e.toolName}));e.push({type:`tool_search_tool_result`,tool_use_id:o.toolCallId,content:{type:`tool_search_tool_search_result`,tool_references:r},cache_control:f});break}if(t===`advisor`){let t=o.output;if(t.type!==`json`&&t.type!==`error-json`){n.push({type:`other`,message:`provider executed tool result output type ${t.type} for tool ${o.toolName} is not supported`});break}let r=await wh({value:t.value,schema:Tb});r.type===`advisor_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_result`,text:r.text},cache_control:f}):r.type===`advisor_redacted_result`?e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_redacted_result`,encrypted_content:r.encryptedContent},cache_control:f}):e.push({type:`advisor_tool_result`,tool_use_id:o.toolCallId,content:{type:`advisor_tool_result_error`,error_code:r.errorCode},cache_control:f});break}n.push({type:`other`,message:`provider executed tool result for tool ${o.toolName} is not supported`});break}}}}l.push({role:`assistant`,content:qy(e)});break}default:throw Error(`content type: ${m}`)}}return{prompt:{system:c,messages:l},betas:a}}function Ky(e){let t=[],n;for(let r of e){let{role:e}=r;switch(e){case`system`:n?.type!==`system`&&(n={type:`system`,messages:[]},t.push(n)),n.messages.push(r);break;case`assistant`:n?.type!==`assistant`&&(n={type:`assistant`,messages:[]},t.push(n)),n.messages.push(r);break;case`user`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;case`tool`:n?.type!==`user`&&(n={type:`user`,messages:[]},t.push(n)),n.messages.push(r);break;default:throw Error(`Unsupported role: ${e}`)}}return t}function qy(e){let t=[],n=[];function r(){t.push(...n.filter(e=>e.type!==`tool_use`),...n.filter(e=>e.type===`tool_use`)),n=[]}for(let i of e)i.type===`thinking`||i.type===`redacted_thinking`?(r(),t.push(i)):n.push(i);return r(),t}function Jy(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{rawInvalidInput:e}}function Yy({finishReason:e,isJsonResponseFromTool:t}){switch(e){case`pause_turn`:case`end_turn`:case`stop_sequence`:return`stop`;case`refusal`:return`content-filter`;case`tool_use`:return t?`stop`:`tool-calls`;case`max_tokens`:case`model_context_window_exceeded`:return`length`;case`compaction`:return`other`;default:return`other`}}function Xy(e){return Qy(e)}function Zy(e){return typeof e==`boolean`||!nb(e)?e:Qy(e)}function Qy(e){let t={},n=e;if(e.$ref!=null)return{$ref:e.$ref};if(e.$schema!=null&&(t.$schema=e.$schema),e.$id!=null&&(t.$id=e.$id),e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description),e.default!==void 0&&(t.default=e.default),e.const!==void 0&&(t.const=e.const),e.enum!=null&&(t.enum=e.enum),e.type!=null&&(t.type=e.type),e.anyOf==null?e.oneOf!=null&&(t.anyOf=e.oneOf.map(Zy)):t.anyOf=e.anyOf.map(Zy),e.allOf!=null&&(t.allOf=e.allOf.map(Zy)),e.definitions!=null&&(t.definitions=Object.fromEntries(Object.entries(e.definitions).map(([e,t])=>[e,Zy(t)]))),n.$defs!=null){let e=t;e.$defs=Object.fromEntries(Object.entries(n.$defs).map(([e,t])=>[e,Zy(t)]))}(e.type===`object`||e.properties!=null)&&(e.properties!=null&&(t.properties=Object.fromEntries(Object.entries(e.properties).map(([e,t])=>[e,Zy(t)]))),t.additionalProperties=!1,e.required!=null&&(t.required=e.required)),e.items!=null&&(t.items=Array.isArray(e.items)?e.items.map(Zy):Zy(e.items)),typeof e.format==`string`&&ax.has(e.format)&&(t.format=e.format);let r=$y(e);return r!=null&&(t.description=t.description==null?r:`${t.description}
54
+ ${r}`),t}function $y(e){let t=ox.flatMap(t=>{let n=e[t];return n==null||n===!1?[]:`${eb(t)}: ${tb(n)}`});return typeof e.format==`string`&&!ax.has(e.format)&&t.push(`format: ${e.format}`),t.length===0?void 0:`${t.join(`; `)}.`}function eb(e){return e.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}function tb(e){return typeof e==`string`?e:JSON.stringify(e)}function nb(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rb(e,t,n){if(e.type===`web_search_result_location`)return{type:`source`,sourceType:`url`,id:n(),url:e.url,title:e.title,providerMetadata:{anthropic:{citedText:e.cited_text,encryptedIndex:e.encrypted_index}}};if(e.type!==`page_location`&&e.type!==`char_location`)return;let r=t[e.document_index];if(r)return{type:`source`,sourceType:`document`,id:n(),mediaType:r.mediaType,title:e.document_title??r.title,filename:r.filename,providerMetadata:{anthropic:e.type===`page_location`?{citedText:e.cited_text,startPageNumber:e.start_page_number,endPageNumber:e.end_page_number}:{citedText:e.cited_text,startCharIndex:e.start_char_index,endCharIndex:e.end_char_index}}}}function ib(e){return e.includes(`claude-opus-4-8`)||e.includes(`claude-opus-4-7`)||e.includes(`claude-fable-5`)||e.includes(`claude-sonnet-5`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!0,supportsXhighEffort:!0,isKnownModel:!0}:e.includes(`claude-sonnet-4-6`)||e.includes(`claude-opus-4-6`)?{maxOutputTokens:128e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!0,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-5`)||e.includes(`claude-opus-4-5`)||e.includes(`claude-haiku-4-5`)?{maxOutputTokens:64e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-1`)?{maxOutputTokens:32e3,supportsStructuredOutput:!0,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-sonnet-4-`)?{maxOutputTokens:64e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-opus-4-`)?{maxOutputTokens:32e3,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:e.includes(`claude-3-haiku`)?{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!0}:{maxOutputTokens:4096,supportsStructuredOutput:!1,supportsAdaptiveThinking:!1,rejectsSamplingParameters:!1,supportsXhighEffort:!1,isKnownModel:!1}}function ab(e){if(!e)return!1;let t=!1,n=!1;for(let r of e){if(`type`in r&&(r.type===`web_fetch_20260209`||r.type===`web_search_20260209`)){t=!0;continue}if(r.name===`code_execution`){n=!0;break}}return t&&!n}function ob({reasoning:e,supportsAdaptiveThinking:t,supportsXhighEffort:n,maxOutputTokensForModel:r,warnings:i}){if(!Om(e))return;if(e===`none`)return{thinking:{type:`disabled`}};if(t)return{thinking:{type:`adaptive`},effort:km({reasoning:e,effortMap:{minimal:`low`,low:`low`,medium:`medium`,high:`high`,xhigh:n?`xhigh`:`max`},warnings:i})};let a=Am({reasoning:e,maxOutputTokens:r,maxReasoningBudget:r,warnings:i});if(a!=null)return{thinking:{type:`enabled`,budgetTokens:a}}}function sb(e){return e?{appliedEdits:e.applied_edits.map(e=>{switch(e.type){case`clear_tool_uses_20250919`:return{type:e.type,clearedToolUses:e.cleared_tool_uses,clearedInputTokens:e.cleared_input_tokens};case`clear_thinking_20251015`:return{type:e.type,clearedThinkingTurns:e.cleared_thinking_turns,clearedInputTokens:e.cleared_input_tokens};case`compact_20260112`:return{type:e.type}}}).filter(e=>e!==void 0)}:null}function cb(e){if(e!=null)return{type:e.type,...e.category==null?{}:{category:e.category},...e.explanation==null?{}:{explanation:e.explanation},...e.recommended_model==null?{}:{recommendedModel:e.recommended_model}}}function lb(e={}){let{execute:t,...n}=e;return cx(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function ub(e={}){let{execute:t,...n}=e;return lx(t===void 0?{...n,execute:async({command:e},{abortSignal:t,experimental_sandbox:n})=>{if(!n)throw Error(`Sandbox session is not available`);return await n.run({command:e,abortSignal:t})}}:{...n,...t===null?{}:{execute:t}})}function db(e){let t=Gh(e);return t===Tx?Ex:t}function fb(e={}){let t=db(Dm({settingValue:e.baseURL,environmentVariableName:`ANTHROPIC_BASE_URL`}))??Ex,n=e.name??`anthropic.messages`;if(e.apiKey&&e.authToken)throw new pi({argument:`apiKey/authToken`,message:`Both apiKey and authToken were provided. Please use only one authentication method.`});let r=()=>xm({"anthropic-version":`2023-06-01`,...e.authToken?{Authorization:`Bearer ${e.authToken}`}:{"x-api-key":Em({apiKey:e.apiKey,environmentVariableName:`ANTHROPIC_API_KEY`,description:`Anthropic`})},...e.headers},`ai-sdk/anthropic/${wx}`),i=i=>new sx(i,{provider:n,baseURL:t,headers:r,fetch:e.fetch,generateId:e.generateId??ug,supportedUrls:()=>({"image/*":[/^https?:\/\/.*$/],"application/pdf":[/^https?:\/\/.*$/]})}),a=()=>new Cx({provider:`${n.replace(`.messages`,``)}.skills`,baseURL:t,headers:r,fetch:e.fetch}),o=function(e){if(new.target)throw Error(`The Anthropic model function cannot be called with the new keyword.`);return i(e)};return o.specificationVersion=`v4`,o.languageModel=i,o.chat=i,o.messages=i,o.embeddingModel=e=>{throw new Gi({modelId:e,modelType:`embeddingModel`})},o.textEmbeddingModel=o.embeddingModel,o.imageModel=e=>{throw new Gi({modelId:e,modelType:`imageModel`})},o.files=()=>new hb({provider:n,baseURL:t,headers:r,fetch:e.fetch}),o.skills=a,o.tools=bx,o}var pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex,Dx=t((()=>{ga(),Qg(),Fd(),pb=Kg({errorSchema:K(()=>q(z({type:H(`error`),error:z({type:I(),message:I()})}))),errorToMessage:e=>e.error.message}),mb=K(()=>q(z({id:I(),type:H(`file`),filename:I(),mime_type:I(),size_bytes:L(),created_at:I(),downloadable:cu().nullish()}))),hb=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async uploadFile({data:e,mediaType:t,filename:n}){let r=Yp(e),i=new Blob([r],{type:t}),a=new FormData;n==null?a.append(`file`,i):a.append(`file`,i,n);let{value:o}=await Hg({url:`${this.config.baseURL}/files`,headers:Gp(this.config.headers(),{"anthropic-beta":`files-api-2025-04-14`}),formData:a,failedResponseHandler:pb,successfulResponseHandler:Jg(mb),fetch:this.config.fetch});return{warnings:[],providerReference:{anthropic:o.id},mediaType:o.mime_type??t,filename:o.filename??n,providerMetadata:{anthropic:{filename:o.filename,mimeType:o.mime_type,sizeBytes:o.size_bytes,createdAt:o.created_at,...o.downloadable==null?{}:{downloadable:o.downloadable}}}}}},gb=z({type:I(),category:I().nullish(),explanation:I().nullish(),recommended_model:I().nullish()}),_b=K(()=>q(z({type:H(`message`),id:I().nullish(),model:I().nullish(),content:R(mu(`type`,[z({type:H(`text`),text:I(),citations:R(mu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])).optional()}),z({type:H(`thinking`),thinking:I(),signature:I()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:du(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:_u(I(),du()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:du(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:cu(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])),stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:gb.nullish(),usage:pu({input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish(),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}))),vb=K(()=>q(mu(`type`,[z({type:H(`message_start`),message:z({id:I().nullish(),model:I().nullish(),role:I().nullish(),usage:pu({input_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()}),content:R(mu(`type`,[z({type:H(`tool_use`),id:I(),name:I(),input:du(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()})])).nullish(),stop_reason:I().nullish(),container:z({expires_at:I(),id:I()}).nullish()})}),z({type:H(`content_block_start`),index:L(),content_block:mu(`type`,[z({type:H(`text`),text:I()}),z({type:H(`thinking`),thinking:I()}),z({type:H(`tool_use`),id:I(),name:I(),input:_u(I(),du()).optional(),caller:B([z({type:H(`code_execution_20250825`),tool_id:I()}),z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`redacted_thinking`),data:I()}),z({type:H(`compaction`),content:I().nullish()}),z({type:H(`server_tool_use`),id:I(),name:I(),input:_u(I(),du()).nullish(),caller:B([z({type:H(`code_execution_20260120`),tool_id:I()}),z({type:H(`direct`)})]).optional()}),z({type:H(`mcp_tool_use`),id:I(),name:I(),input:du(),server_name:I()}),z({type:H(`mcp_tool_result`),tool_use_id:I(),is_error:cu(),content:R(B([I(),z({type:H(`text`),text:I()})]))}),z({type:H(`web_fetch_tool_result`),tool_use_id:I(),content:B([z({type:H(`web_fetch_result`),url:I(),retrieved_at:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),media_type:H(`application/pdf`),data:I()}),z({type:H(`text`),media_type:H(`text/plain`),data:I()})])})}),z({type:H(`web_fetch_tool_result_error`),error_code:I()})])}),z({type:H(`web_search_tool_result`),tool_use_id:I(),content:B([R(z({type:H(`web_search_result`),url:I(),title:I(),encrypted_content:I(),page_age:I().nullish()})),z({type:H(`web_search_tool_result_error`),error_code:I()})])}),z({type:H(`code_execution_tool_result`),tool_use_id:I(),content:B([z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`bash_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()})])}),z({type:H(`text_editor_code_execution_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})])}),z({type:H(`tool_search_tool_result`),tool_use_id:I(),content:B([z({type:H(`tool_search_tool_search_result`),tool_references:R(z({type:H(`tool_reference`),tool_name:I()}))}),z({type:H(`tool_search_tool_result_error`),error_code:I()})])}),z({type:H(`advisor_tool_result`),tool_use_id:I(),content:mu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encrypted_content:I()}),z({type:H(`advisor_tool_result_error`),error_code:I()})])}),z({type:H(`fallback`)})])}),z({type:H(`content_block_delta`),index:L(),delta:mu(`type`,[z({type:H(`input_json_delta`),partial_json:I()}),z({type:H(`text_delta`),text:I()}),z({type:H(`thinking_delta`),thinking:I()}),z({type:H(`signature_delta`),signature:I()}),z({type:H(`compaction_delta`),content:I().nullish()}),z({type:H(`citations_delta`),citation:mu(`type`,[z({type:H(`web_search_result_location`),cited_text:I(),url:I(),title:I(),encrypted_index:I()}),z({type:H(`page_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_page_number:L(),end_page_number:L()}),z({type:H(`char_location`),cited_text:I(),document_index:L(),document_title:I().nullable(),start_char_index:L(),end_char_index:L()})])})])}),z({type:H(`content_block_stop`),index:L()}),z({type:H(`error`),error:z({type:I(),message:I()})}),z({type:H(`message_delta`),delta:z({stop_reason:I().nullish(),stop_sequence:I().nullish(),stop_details:gb.nullish(),container:z({expires_at:I(),id:I(),skills:R(z({type:B([H(`anthropic`),H(`custom`)]),skill_id:I(),version:I()})).nullish()}).nullish()}),usage:pu({input_tokens:L().nullish(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish(),iterations:R(z({type:B([H(`compaction`),H(`message`),H(`advisor_message`),H(`fallback_message`)]),model:I().nullish(),input_tokens:L(),output_tokens:L(),cache_creation_input_tokens:L().nullish(),cache_read_input_tokens:L().nullish()})).nullish()}),context_management:z({applied_edits:R(B([z({type:H(`clear_tool_uses_20250919`),cleared_tool_uses:L(),cleared_input_tokens:L()}),z({type:H(`clear_thinking_20251015`),cleared_thinking_turns:L(),cleared_input_tokens:L()}),z({type:H(`compact_20260112`)})]))}).nullish()}),z({type:H(`message_stop`)}),z({type:H(`ping`)})]))),yb=K(()=>q(z({signature:I().optional(),redactedData:I().optional()}))),bb=z({containerUpload:cu().optional(),citations:z({enabled:cu()}).optional(),title:I().optional(),context:I().optional()}),xb=z({sendReasoning:cu().optional(),structuredOutputMode:V([`outputFormat`,`jsonTool`,`auto`]).optional(),thinking:mu(`type`,[z({type:H(`adaptive`),display:V([`omitted`,`summarized`]).optional()}),z({type:H(`enabled`),budgetTokens:L().optional()}),z({type:H(`disabled`)})]).optional(),disableParallelToolUse:cu().optional(),cacheControl:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)]).optional()}).optional(),metadata:z({userId:I().optional()}).optional(),mcpServers:R(z({type:H(`url`),name:I(),url:I(),authorizationToken:I().nullish(),toolConfiguration:z({enabled:cu().nullish(),allowedTools:R(I()).nullish()}).nullish()})).optional(),container:z({id:I().optional(),skills:R(mu(`type`,[z({type:H(`anthropic`),skillId:I(),version:I().optional()}),z({type:H(`custom`),providerReference:_u(I(),I()),version:I().optional()})])).optional()}).optional(),toolStreaming:cu().optional(),effort:V([`low`,`medium`,`high`,`xhigh`,`max`]).optional(),taskBudget:z({type:H(`tokens`),total:L().int().min(2e4),remaining:L().int().min(0).optional()}).optional(),speed:V([`fast`,`standard`]).optional(),inferenceGeo:V([`us`,`global`]).optional(),fallbacks:R(z({model:I(),max_tokens:L().int().optional(),thinking:_u(I(),du()).optional(),output_config:_u(I(),du()).optional(),speed:V([`fast`,`standard`]).optional()})).optional(),anthropicBeta:R(I()).optional(),contextManagement:z({edits:R(mu(`type`,[z({type:H(`clear_tool_uses_20250919`),trigger:mu(`type`,[z({type:H(`input_tokens`),value:L()}),z({type:H(`tool_uses`),value:L()})]).optional(),keep:z({type:H(`tool_uses`),value:L()}).optional(),clearAtLeast:z({type:H(`input_tokens`),value:L()}).optional(),clearToolInputs:cu().optional(),excludeTools:R(I()).optional()}),z({type:H(`clear_thinking_20251015`),keep:B([H(`all`),z({type:H(`thinking_turns`),value:L()})]).optional()}),z({type:H(`compact_20260112`),trigger:z({type:H(`input_tokens`),value:L()}).optional(),pauseAfterCompaction:cu().optional(),instructions:I().optional()})]))}).optional()}),Sb=4,Cb=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(e,t){let n=By(e);if(n){if(!t.canCache){this.warnings.push({type:`unsupported`,feature:`cache_control on non-cacheable context`,details:`cache_control cannot be set on ${t.type}. It will be ignored.`});return}if(this.breakpointCount++,this.breakpointCount>Sb){this.warnings.push({type:`unsupported`,feature:`cacheControl breakpoint limit`,details:`Maximum ${Sb} cache breakpoints exceeded (found ${this.breakpointCount}). This breakpoint will be ignored.`});return}return n}}getWarnings(){return this.warnings}},wb=K(()=>q(z({model:I(),maxUses:L().optional(),caching:z({type:H(`ephemeral`),ttl:B([H(`5m`),H(`1h`)])}).optional()}))),Tb=K(()=>q(mu(`type`,[z({type:H(`advisor_result`),text:I()}),z({type:H(`advisor_redacted_result`),encryptedContent:I()}),z({type:H(`advisor_tool_result_error`),errorCode:I()})]))),Eb=Nh({id:`anthropic.advisor_20260301`,inputSchema:K(()=>q(z({}).strict())),outputSchema:Tb,supportsDeferredResults:!0}),Db=e=>Eb(e),Ob=K(()=>q(z({maxCharacters:L().optional()}))),kb=jh({id:`anthropic.text_editor_20250728`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),Ab=(e={})=>kb(e),jb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Mb=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),Nb=Nh({id:`anthropic.web_search_20260209`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Mb,supportsDeferredResults:!0}),Pb=(e={})=>Nb(e),Fb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),userLocation:z({type:H(`approximate`),city:I().optional(),region:I().optional(),country:I().optional(),timezone:I().optional()}).optional()}))),Ib=K(()=>q(R(z({url:I(),title:I().nullable(),pageAge:I().nullable(),encryptedContent:I(),type:H(`web_search_result`)})))),Lb=Nh({id:`anthropic.web_search_20250305`,inputSchema:K(()=>q(z({query:I()}))),outputSchema:Ib,supportsDeferredResults:!0}),Rb=(e={})=>Lb(e),zb=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:cu()}).optional(),maxContentTokens:L().optional()}))),Bb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),Vb=Nh({id:`anthropic.web_fetch_20260209`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Bb,supportsDeferredResults:!0}),Hb=(e={})=>Vb(e),Ub=K(()=>q(z({maxUses:L().optional(),allowedDomains:R(I()).optional(),blockedDomains:R(I()).optional(),citations:z({enabled:cu()}).optional(),maxContentTokens:L().optional()}))),Wb=K(()=>q(z({type:H(`web_fetch_result`),url:I(),content:z({type:H(`document`),title:I().nullable(),citations:z({enabled:cu()}).optional(),source:B([z({type:H(`base64`),mediaType:H(`application/pdf`),data:I()}),z({type:H(`text`),mediaType:H(`text/plain`),data:I()})])}),retrievedAt:I().nullable()}))),Gb=Nh({id:`anthropic.web_fetch_20250910`,inputSchema:K(()=>q(z({url:I()}))),outputSchema:Wb,supportsDeferredResults:!0}),Kb=(e={})=>Gb(e),qb=K(()=>q(z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}))),Jb=Nh({id:`anthropic.code_execution_20250522`,inputSchema:K(()=>q(z({code:I()}))),outputSchema:qb}),Yb=(e={})=>Jb(e),Xb=K(()=>q(mu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),Zb=Nh({id:`anthropic.code_execution_20250825`,inputSchema:K(()=>q(mu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),mu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:Xb,supportsDeferredResults:!0}),Qb=(e={})=>Zb(e),$b=K(()=>q(mu(`type`,[z({type:H(`code_execution_result`),stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`encrypted_code_execution_result`),encrypted_stdout:I(),stderr:I(),return_code:L(),content:R(z({type:H(`code_execution_output`),file_id:I()})).optional().default([])}),z({type:H(`bash_code_execution_result`),content:R(z({type:H(`bash_code_execution_output`),file_id:I()})),stdout:I(),stderr:I(),return_code:L()}),z({type:H(`bash_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_tool_result_error`),error_code:I()}),z({type:H(`text_editor_code_execution_view_result`),content:I(),file_type:I(),num_lines:L().nullable(),start_line:L().nullable(),total_lines:L().nullable()}),z({type:H(`text_editor_code_execution_create_result`),is_file_update:cu()}),z({type:H(`text_editor_code_execution_str_replace_result`),lines:R(I()).nullable(),new_lines:L().nullable(),new_start:L().nullable(),old_lines:L().nullable(),old_start:L().nullable()})]))),ex=Nh({id:`anthropic.code_execution_20260120`,inputSchema:K(()=>q(mu(`type`,[z({type:H(`programmatic-tool-call`),code:I()}),z({type:H(`bash_code_execution`),command:I()}),mu(`command`,[z({type:H(`text_editor_code_execution`),command:H(`view`),path:I()}),z({type:H(`text_editor_code_execution`),command:H(`create`),path:I(),file_text:I().nullish()}),z({type:H(`text_editor_code_execution`),command:H(`str_replace`),path:I(),old_str:I(),new_str:I()})])]))),outputSchema:$b,supportsDeferredResults:!0}),tx=(e={})=>ex(e),nx=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),rx=Nh({id:`anthropic.tool_search_regex_20251119`,inputSchema:K(()=>q(z({pattern:I(),limit:L().optional()}))),outputSchema:nx,supportsDeferredResults:!0}),ix=(e={})=>rx(e),ax=new Set([`date-time`,`time`,`date`,`duration`,`email`,`hostname`,`uri`,`ipv4`,`ipv6`,`uuid`]),ox=[`minimum`,`maximum`,`exclusiveMinimum`,`exclusiveMaximum`,`multipleOf`,`minLength`,`maxLength`,`pattern`,`minItems`,`maxItems`,`uniqueItems`,`minProperties`,`maxProperties`,`not`],sx=class e{constructor(e,t){this.specificationVersion=`v4`,this.modelId=e,this.config=t,this.generateId=t.generateId??ug}static[Vp](e){return Bh({modelId:e.modelId,config:e.config})}static[Hp](t){return new e(t.modelId,t.config)}supportsUrl(e){return e.protocol===`https:`}get provider(){return this.config.provider}get providerOptionsName(){let e=this.config.provider,t=e.indexOf(`.`);return t===-1?e:e.substring(0,t)}get supportedUrls(){var e;return(e=this.config).supportedUrls?.call(e)??{}}async getArgs({userSuppliedBetas:e,prompt:t,maxOutputTokens:n,temperature:r,topP:i,topK:a,frequencyPenalty:o,presencePenalty:s,stopSequences:c,responseFormat:l,seed:u,tools:d,toolChoice:f,reasoning:p,providerOptions:m,stream:h}){let g=[];o!=null&&g.push({type:`unsupported`,feature:`frequencyPenalty`}),s!=null&&g.push({type:`unsupported`,feature:`presencePenalty`}),u!=null&&g.push({type:`unsupported`,feature:`seed`}),r!=null&&r>1?(g.push({type:`unsupported`,feature:`temperature`,details:`${r} exceeds anthropic maximum of 1.0. clamped to 1.0`}),r=1):r!=null&&r<0&&(g.push({type:`unsupported`,feature:`temperature`,details:`${r} is below anthropic minimum of 0. clamped to 0`}),r=0),l?.type===`json`&&(l.schema??g.push({type:`unsupported`,feature:`responseFormat`,details:`JSON response format requires a schema. The response format is ignored.`}));let _=this.providerOptionsName,v=await kh({provider:`anthropic`,providerOptions:m,schema:xb}),y=_===`anthropic`?null:await kh({provider:_,providerOptions:m,schema:xb}),b=y!=null,x=Object.assign({},v??{},y??{}),{maxOutputTokens:S,supportsStructuredOutput:C,supportsAdaptiveThinking:w,rejectsSamplingParameters:T,supportsXhighEffort:E,isKnownModel:D}=ib(this.modelId);T&&(r!=null&&(g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported by ${this.modelId} and will be ignored`}),r=void 0),a!=null&&(g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported by ${this.modelId} and will be ignored`}),a=void 0),i!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported by ${this.modelId} and will be ignored`}),i=void 0));let O=D||this.modelId.startsWith(`claude-`),k=(this.config.supportsNativeStructuredOutput??!0)&&C,ee=(this.config.supportsStrictTools??!0)&&C,te=x?.structuredOutputMode??`auto`,A=te===`outputFormat`||te===`auto`&&k,ne=l?.type===`json`&&l.schema!=null&&!A?{type:`function`,name:`json`,description:`Respond with a JSON object.`,inputSchema:l.schema}:void 0,re=x?.contextManagement,ie=new Cb,ae=Zp({tools:d,providerToolNames:{"anthropic.code_execution_20250522":`code_execution`,"anthropic.code_execution_20250825":`code_execution`,"anthropic.code_execution_20260120":`code_execution`,"anthropic.computer_20241022":`computer`,"anthropic.computer_20250124":`computer`,"anthropic.text_editor_20241022":`str_replace_editor`,"anthropic.text_editor_20250124":`str_replace_editor`,"anthropic.text_editor_20250429":`str_replace_based_edit_tool`,"anthropic.text_editor_20250728":`str_replace_based_edit_tool`,"anthropic.bash_20241022":`bash`,"anthropic.bash_20250124":`bash`,"anthropic.memory_20250818":`memory`,"anthropic.web_search_20250305":`web_search`,"anthropic.web_search_20260209":`web_search`,"anthropic.web_fetch_20250910":`web_fetch`,"anthropic.web_fetch_20260209":`web_fetch`,"anthropic.tool_search_regex_20251119":`tool_search_tool_regex`,"anthropic.tool_search_bm25_20251119":`tool_search_tool_bm25`,"anthropic.advisor_20260301":`advisor`}}),{prompt:oe,betas:se}=await Gy({prompt:t,sendReasoning:x?.sendReasoning??!0,warnings:g,cacheControlValidator:ie,toolNameMapping:ae});if(Om(p)&&x?.effort==null){let e=ob({reasoning:p,supportsAdaptiveThinking:w,supportsXhighEffort:E,maxOutputTokensForModel:S,warnings:g});e!=null&&(x.thinking??=e.thinking,e.effort!=null&&x.thinking?.type!==`disabled`&&(x.effort=e.effort))}let ce=x?.thinking?.type,le=ce===`enabled`||ce===`adaptive`,ue=le||ce===`disabled`,de=ce===`enabled`?x?.thinking?.budgetTokens:void 0,fe=ce===`adaptive`?x?.thinking?.display:void 0,pe=n??S,me={model:this.modelId,max_tokens:pe,temperature:r,top_k:a,top_p:i,stop_sequences:c,...ue&&{thinking:{type:ce,...de!=null&&{budget_tokens:de},...fe!=null&&{display:fe}}},...(x?.effort||x?.taskBudget||A&&l?.type===`json`&&l.schema!=null)&&{output_config:{...x?.effort&&{effort:x.effort},...x?.taskBudget&&{task_budget:{type:x.taskBudget.type,total:x.taskBudget.total,...x.taskBudget.remaining!=null&&{remaining:x.taskBudget.remaining}}},...A&&l?.type===`json`&&l.schema!=null&&{format:{type:`json_schema`,schema:Xy(l.schema)}}}},...x?.speed&&{speed:x.speed},...x?.inferenceGeo&&{inference_geo:x.inferenceGeo},...x?.fallbacks&&x.fallbacks.length>0&&{fallbacks:x.fallbacks},...x?.cacheControl&&{cache_control:x.cacheControl},...x?.metadata?.userId!=null&&{metadata:{user_id:x.metadata.userId}},...x?.mcpServers&&x.mcpServers.length>0&&{mcp_servers:x.mcpServers.map(e=>({type:e.type,name:e.name,url:e.url,authorization_token:e.authorizationToken,tool_configuration:e.toolConfiguration?{allowed_tools:e.toolConfiguration.allowedTools,enabled:e.toolConfiguration.enabled}:void 0}))},...x?.container&&{container:x.container.skills&&x.container.skills.length>0?{id:x.container.id,skills:x.container.skills.map(e=>({type:e.type,skill_id:e.type===`custom`?Ih({reference:e.providerReference,provider:`anthropic`}):e.skillId,version:e.version}))}:x.container.id},system:oe.system,messages:oe.messages,...re&&{context_management:{edits:re.edits.map(e=>{let t=e.type;switch(t){case`clear_tool_uses_20250919`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.keep!==void 0&&{keep:e.keep},...e.clearAtLeast!==void 0&&{clear_at_least:e.clearAtLeast},...e.clearToolInputs!==void 0&&{clear_tool_inputs:e.clearToolInputs},...e.excludeTools!==void 0&&{exclude_tools:e.excludeTools}};case`clear_thinking_20251015`:return{type:e.type,...e.keep!==void 0&&{keep:e.keep}};case`compact_20260112`:return{type:e.type,...e.trigger!==void 0&&{trigger:e.trigger},...e.pauseAfterCompaction!==void 0&&{pause_after_compaction:e.pauseAfterCompaction},...e.instructions!==void 0&&{instructions:e.instructions}};default:g.push({type:`other`,message:`Unknown context management strategy: ${t}`});return}}).filter(e=>e!==void 0)}}};le?(ce===`enabled`&&de==null&&(g.push({type:`compatibility`,feature:`extended thinking`,details:`thinking budget is required when thinking is enabled. using default budget of 1024 tokens.`}),me.thinking={type:`enabled`,budget_tokens:1024},de=1024),me.temperature!=null&&(me.temperature=void 0,g.push({type:`unsupported`,feature:`temperature`,details:`temperature is not supported when thinking is enabled`})),a!=null&&(me.top_k=void 0,g.push({type:`unsupported`,feature:`topK`,details:`topK is not supported when thinking is enabled`})),i!=null&&(me.top_p=void 0,g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when thinking is enabled`})),me.max_tokens=pe+(de??0)):O&&i!=null&&r!=null&&(g.push({type:`unsupported`,feature:`topP`,details:`topP is not supported when temperature is set. topP is ignored.`}),me.top_p=void 0),D&&me.max_tokens>S&&(n!=null&&g.push({type:`unsupported`,feature:`maxOutputTokens`,details:`${me.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${S} max output tokens. The max output tokens have been limited to ${S}.`}),me.max_tokens=S),x?.mcpServers&&x.mcpServers.length>0&&se.add(`mcp-client-2025-04-04`),re&&(se.add(`context-management-2025-06-27`),re.edits.some(e=>e.type===`compact_20260112`)&&se.add(`compact-2026-01-12`)),x?.container&&x.container.skills&&x.container.skills.length>0&&(se.add(`code-execution-2025-08-25`),se.add(`skills-2025-10-02`),se.add(`files-api-2025-04-14`),d?.some(e=>e.type===`provider`&&(e.id===`anthropic.code_execution_20250825`||e.id===`anthropic.code_execution_20260120`))||g.push({type:`other`,message:`code execution tool is required when using skills`})),x?.taskBudget&&se.add(`task-budgets-2026-03-13`),x?.speed===`fast`&&se.add(`fast-mode-2026-02-01`),x?.fallbacks&&x.fallbacks.length>0&&se.add(`server-side-fallback-2026-06-01`);let he=h&&(x?.toolStreaming??!0),{tools:ge,toolChoice:_e,toolWarnings:ve,betas:ye}=await Vy(ne==null?{tools:d??[],toolChoice:f,disableParallelToolUse:x?.disableParallelToolUse,cacheControlValidator:ie,supportsStructuredOutput:k,supportsStrictTools:ee,defaultEagerInputStreaming:he}:{tools:[...d??[],ne],toolChoice:{type:`required`},disableParallelToolUse:!0,cacheControlValidator:ie,supportsStructuredOutput:!1,supportsStrictTools:ee,defaultEagerInputStreaming:he}),be=ie.getWarnings();return{args:{...me,tools:ge,tool_choice:_e,stream:h===!0||void 0},warnings:[...g,...ve,...be],betas:new Set([...se,...ye,...e,...x?.anthropicBeta??[]]),usesJsonResponseTool:ne!=null,toolNameMapping:ae,providerOptionsName:_,usedCustomProviderKey:b}}async getHeaders({betas:e,headers:t}){return Gp(this.config.headers?await Ph(this.config.headers):void 0,t,e.size>0?{"anthropic-beta":Array.from(e).join(`,`)}:{})}async getBetasFromHeaders(e){let t=(this.config.headers?await Ph(this.config.headers):void 0)?.[`anthropic-beta`]??``,n=e?.[`anthropic-beta`]??``;return new Set([...t.toLowerCase().split(`,`),...n.toLowerCase().split(`,`)].map(e=>e.trim()).filter(e=>e!==``))}buildRequestUrl(e){var t;return(t=this.config).buildRequestUrl?.call(t,this.config.baseURL,e)??`${this.config.baseURL}/messages`}transformRequestBody(e,t){var n;return(n=this.config).transformRequestBody?.call(n,e,t)??e}extractCitationDocuments(e){return e.filter(e=>e.role===`user`).flatMap(e=>e.content).filter(e=>e.type!==`file`||e.mediaType!==`application/pdf`&&e.mediaType!==`text/plain`?!1:e.providerOptions?.anthropic?.citations?.enabled??!1).map(e=>{let t=e;return{title:t.filename??`Untitled Document`,filename:t.filename,mediaType:t.mediaType}})}async doGenerate(e){let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!1,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=ab(t.tools),{responseHeaders:u,value:d,rawValue:f}=await Vg({url:this.buildRequestUrl(!1),headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:pb,successfulResponseHandler:Jg(_b),abortSignal:e.abortSignal,fetch:this.config.fetch}),p=[],m={},h={},g=!1;for(let e of d.content)switch(e.type){case`text`:if(!i&&(p.push({type:`text`,text:e.text}),e.citations))for(let t of e.citations){let e=rb(t,c,this.generateId);e&&p.push(e)}break;case`thinking`:p.push({type:`reasoning`,text:e.thinking,providerMetadata:{anthropic:{signature:e.signature}}});break;case`redacted_thinking`:p.push({type:`reasoning`,text:``,providerMetadata:{anthropic:{redactedData:e.data}}});break;case`compaction`:p.push({type:`text`,text:e.content,providerMetadata:{anthropic:{type:`compaction`}}});break;case`tool_use`:if(i&&e.name===`json`)g=!0,p.push({type:`text`,text:JSON.stringify(e.input)});else{let t=e.caller,n=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0;p.push({type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),...n&&{providerMetadata:{anthropic:{caller:n}}}})}break;case`server_tool_use`:if(e.name===`text_editor_code_execution`||e.name===`bash_code_execution`)p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`code_execution`),input:JSON.stringify({type:e.name,...e.input}),providerExecuted:!0,...l?{dynamic:!0}:{}});else if(e.name===`web_search`||e.name===`code_execution`||e.name===`web_fetch`){let t=e.name===`code_execution`&&e.input!=null&&typeof e.input==`object`&&`code`in e.input&&!(`type`in e.input)?{type:`programmatic-tool-call`,...e.input}:e.input;p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(t),providerExecuted:!0,...l&&e.name===`code_execution`?{dynamic:!0}:{}})}else e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`?(h[e.id]=e.name,p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(e.name),input:JSON.stringify(e.input),providerExecuted:!0})):e.name===`advisor`&&p.push({type:`tool-call`,toolCallId:e.id,toolName:a.toCustomToolName(`advisor`),input:JSON.stringify(e.input),providerExecuted:!0});break;case`mcp_tool_use`:m[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},p.push(m[e.id]);break;case`mcp_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:m[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:m[e.tool_use_id].providerMetadata});break;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});break;case`web_search_tool_result`:if(Array.isArray(e.content)){p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)p.push({type:`source`,sourceType:`url`,id:this.generateId(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});break;case`code_execution_tool_result`:e.content.type===`code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});break;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});break;case`tool_search_tool_result`:{let t=h[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});break}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):p.push({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});break}case`fallback`:break}return{content:p,finishReason:{unified:Yy({finishReason:d.stop_reason,isJsonResponseFromTool:g}),raw:d.stop_reason??void 0},usage:Hy({usage:d.usage}),request:{body:t},response:{id:d.id??void 0,modelId:d.model??void 0,headers:u,body:f},warnings:n,providerMetadata:(()=>{let e=cb(d.stop_details),t={usage:d.usage,stopSequence:d.stop_sequence??null,...e==null?{}:{stopDetails:e},iterations:d.usage.iterations?d.usage.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:d.container?{expiresAt:d.container.expires_at,id:d.container.id,skills:d.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null}:null,contextManagement:sb(d.context_management)??null},n={anthropic:t};return s&&o!==`anthropic`&&(n[o]=t),n})()}}async doStream(e){"use step";let{args:t,warnings:n,betas:r,usesJsonResponseTool:i,toolNameMapping:a,providerOptionsName:o,usedCustomProviderKey:s}=await this.getArgs({...e,stream:!0,userSuppliedBetas:await this.getBetasFromHeaders(e.headers)}),c=[...this.extractCitationDocuments(e.prompt)],l=ab(t.tools),u=this.buildRequestUrl(!0),{responseHeaders:d,value:f}=await Vg({url:u,headers:await this.getHeaders({betas:r,headers:e.headers}),body:this.transformRequestBody(t,r),failedResponseHandler:pb,successfulResponseHandler:qg(vb),abortSignal:e.abortSignal,fetch:this.config.fetch}),p={unified:`other`,raw:void 0},m={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,iterations:null},h={},g={},_={},v=null,y,b=null,x,S=null,C=!1,w,T=this.generateId,[E,D]=f.pipeThrough(new TransformStream({start(e){e.enqueue({type:`stream-start`,warnings:n})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:`raw`,rawValue:t.rawValue}),!t.success){n.enqueue({type:`error`,error:t.error});return}let r=t.value;switch(r.type){case`ping`:return;case`content_block_start`:{let e=r.content_block,t=e.type;if(t===`fallback`)return;switch(w=t,t){case`text`:if(i)return;h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});return;case`thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index)});return;case`redacted_thinking`:h[r.index]={type:`reasoning`},n.enqueue({type:`reasoning-start`,id:String(r.index),providerMetadata:{anthropic:{redactedData:e.data}}});return;case`compaction`:h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index),providerMetadata:{anthropic:{type:`compaction`}}});return;case`tool_use`:if(i&&e.name===`json`)C=!0,h[r.index]={type:`text`},n.enqueue({type:`text-start`,id:String(r.index)});else{let t=e.caller,i=t?{type:t.type,toolId:`tool_id`in t?t.tool_id:void 0}:void 0,a=e.input&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:a,firstDelta:a.length===0,...i&&{caller:i}},n.enqueue({type:`tool-input-start`,id:e.id,toolName:e.name})}return;case`server_tool_use`:if([`web_fetch`,`web_search`,`code_execution`,`text_editor_code_execution`,`bash_code_execution`].includes(e.name)){let t=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?`code_execution`:e.name,i=e.name===`text_editor_code_execution`||e.name===`bash_code_execution`?e.name:e.name===`code_execution`?`programmatic-tool-call`:void 0,o=a.toCustomToolName(t),s=e.input!=null&&typeof e.input==`object`&&Object.keys(e.input).length>0?JSON.stringify(e.input):``;h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:o,input:s,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{},firstDelta:s.length===0,providerToolName:t,providerToolInputType:i},n.enqueue({type:`tool-input-start`,id:e.id,toolName:o,providerExecuted:!0,...l&&t===`code_execution`?{dynamic:!0}:{}})}else if(e.name===`tool_search_tool_regex`||e.name===`tool_search_tool_bm25`){_[e.id]=e.name;let t=a.toCustomToolName(e.name);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:``,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}else if(e.name===`advisor`){let t=a.toCustomToolName(`advisor`);h[r.index]={type:`tool-call`,toolCallId:e.id,toolName:t,input:`{}`,providerExecuted:!0,firstDelta:!0,providerToolName:e.name},n.enqueue({type:`tool-input-start`,id:e.id,toolName:t,providerExecuted:!0})}return;case`web_fetch_tool_result`:e.content.type===`web_fetch_result`?(c.push({title:e.content.content.title??e.content.url,mediaType:e.content.content.source.media_type}),n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),result:{type:`web_fetch_result`,url:e.content.url,retrievedAt:e.content.retrieved_at,content:{type:e.content.content.type,title:e.content.content.title,citations:e.content.content.citations,source:{type:e.content.content.source.type,mediaType:e.content.content.source.media_type,data:e.content.content.source.data}}}})):e.content.type===`web_fetch_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_fetch`),isError:!0,result:{type:`web_fetch_tool_result_error`,errorCode:e.content.error_code}});return;case`web_search_tool_result`:if(Array.isArray(e.content)){n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),result:e.content.map(e=>({url:e.url,title:e.title,pageAge:e.page_age??null,encryptedContent:e.encrypted_content,type:e.type}))});for(let t of e.content)n.enqueue({type:`source`,sourceType:`url`,id:T(),url:t.url,title:t.title,providerMetadata:{anthropic:{pageAge:t.page_age??null}}})}else n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`web_search`),isError:!0,result:{type:`web_search_tool_result_error`,errorCode:e.content.error_code}});return;case`code_execution_tool_result`:e.content.type===`code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,stdout:e.content.stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`encrypted_code_execution_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:{type:e.content.type,encrypted_stdout:e.content.encrypted_stdout,stderr:e.content.stderr,return_code:e.content.return_code,content:e.content.content??[]}}):e.content.type===`code_execution_tool_result_error`&&n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),isError:!0,result:{type:`code_execution_tool_result_error`,errorCode:e.content.error_code}});return;case`bash_code_execution_tool_result`:case`text_editor_code_execution_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(`code_execution`),result:e.content});return;case`tool_search_tool_result`:{let t=_[e.tool_use_id];if(t==null){let e=a.toCustomToolName(`tool_search_tool_bm25`);a.toCustomToolName(`tool_search_tool_regex`),t=e===`tool_search_tool_bm25`?`tool_search_tool_regex`:`tool_search_tool_bm25`}e.content.type===`tool_search_tool_search_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),result:e.content.tool_references.map(e=>({type:e.type,toolName:e.tool_name}))}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:a.toCustomToolName(t),isError:!0,result:{type:`tool_search_tool_result_error`,errorCode:e.content.error_code}});return}case`advisor_tool_result`:{let t=a.toCustomToolName(`advisor`);e.content.type===`advisor_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_result`,text:e.content.text}}):e.content.type===`advisor_redacted_result`?n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,result:{type:`advisor_redacted_result`,encryptedContent:e.content.encrypted_content}}):n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:t,isError:!0,result:{type:`advisor_tool_result_error`,errorCode:e.content.error_code}});return}case`mcp_tool_use`:g[e.id]={type:`tool-call`,toolCallId:e.id,toolName:e.name,input:JSON.stringify(e.input),providerExecuted:!0,dynamic:!0,providerMetadata:{anthropic:{type:`mcp-tool-use`,serverName:e.server_name}}},n.enqueue(g[e.id]);return;case`mcp_tool_result`:n.enqueue({type:`tool-result`,toolCallId:e.tool_use_id,toolName:g[e.tool_use_id].toolName,isError:e.is_error,result:e.content,dynamic:!0,providerMetadata:g[e.tool_use_id].providerMetadata});return;default:throw Error(`Unsupported content block type: ${t}`)}}case`content_block_stop`:if(h[r.index]!=null){let e=h[r.index];switch(e.type){case`text`:n.enqueue({type:`text-end`,id:String(r.index)});break;case`reasoning`:n.enqueue({type:`reasoning-end`,id:String(r.index)});break;case`tool-call`:if(!(i&&e.toolName===`json`)){n.enqueue({type:`tool-input-end`,id:e.toolCallId});let t=e.input===``?`{}`:e.input;if(e.providerToolName===`code_execution`)try{let e=Pm(t);typeof e==`object`&&e&&`code`in e&&!(`type`in e)&&(t=JSON.stringify({type:`programmatic-tool-call`,...e}))}catch{}n.enqueue({type:`tool-call`,toolCallId:e.toolCallId,toolName:e.toolName,input:t,providerExecuted:e.providerExecuted,...l&&e.providerToolName===`code_execution`?{dynamic:!0}:{},...e.caller&&{providerMetadata:{anthropic:{caller:e.caller}}}})}break}delete h[r.index]}w=void 0;return;case`content_block_delta`:{let e=r.delta.type;switch(e){case`text_delta`:if(i)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.text});return;case`thinking_delta`:n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:r.delta.thinking});return;case`signature_delta`:w===`thinking`&&n.enqueue({type:`reasoning-delta`,id:String(r.index),delta:``,providerMetadata:{anthropic:{signature:r.delta.signature}}});return;case`compaction_delta`:r.delta.content!=null&&n.enqueue({type:`text-delta`,id:String(r.index),delta:r.delta.content});return;case`input_json_delta`:{let e=h[r.index],t=r.delta.partial_json;if(t.length===0)return;if(C){if(e?.type!==`text`)return;n.enqueue({type:`text-delta`,id:String(r.index),delta:t})}else{if(e?.type!==`tool-call`)return;e.firstDelta&&e.providerToolInputType!=null&&(t=`{"type": "${e.providerToolInputType}",${t.substring(1)}`),n.enqueue({type:`tool-input-delta`,id:e.toolCallId,delta:t}),e.input+=t,e.firstDelta=!1}return}case`citations_delta`:{let e=r.delta.citation,t=rb(e,c,T);t&&n.enqueue(t);return}default:throw Error(`Unsupported delta type: ${e}`)}}case`message_start`:if(m.input_tokens=r.message.usage.input_tokens,m.cache_read_input_tokens=r.message.usage.cache_read_input_tokens??0,m.cache_creation_input_tokens=r.message.usage.cache_creation_input_tokens??0,y={...r.message.usage},r.message.container!=null&&(S={expiresAt:r.message.container.expires_at,id:r.message.container.id,skills:null}),r.message.stop_reason!=null&&(p={unified:Yy({finishReason:r.message.stop_reason,isJsonResponseFromTool:C}),raw:r.message.stop_reason}),n.enqueue({type:`response-metadata`,id:r.message.id??void 0,modelId:r.message.model??void 0}),r.message.content!=null)for(let e=0;e<r.message.content.length;e++){let t=r.message.content[e];if(t.type===`tool_use`){let e=t.caller,r=e?{type:e.type,toolId:`tool_id`in e?e.tool_id:void 0}:void 0;n.enqueue({type:`tool-input-start`,id:t.id,toolName:t.name});let i=JSON.stringify(t.input??{});n.enqueue({type:`tool-input-delta`,id:t.id,delta:i}),n.enqueue({type:`tool-input-end`,id:t.id}),n.enqueue({type:`tool-call`,toolCallId:t.id,toolName:t.name,input:i,...r&&{providerMetadata:{anthropic:{caller:r}}}})}}return;case`message_delta`:r.usage.input_tokens!=null&&m.input_tokens!==r.usage.input_tokens&&(m.input_tokens=r.usage.input_tokens),m.output_tokens=r.usage.output_tokens,r.usage.cache_read_input_tokens!=null&&(m.cache_read_input_tokens=r.usage.cache_read_input_tokens),r.usage.cache_creation_input_tokens!=null&&(m.cache_creation_input_tokens=r.usage.cache_creation_input_tokens),r.usage.iterations!=null&&(m.iterations=r.usage.iterations),p={unified:Yy({finishReason:r.delta.stop_reason,isJsonResponseFromTool:C}),raw:r.delta.stop_reason??void 0},b=r.delta.stop_sequence??null,x=cb(r.delta.stop_details),S=r.delta.container==null?null:{expiresAt:r.delta.container.expires_at,id:r.delta.container.id,skills:r.delta.container.skills?.map(e=>({type:e.type,skillId:e.skill_id,version:e.version}))??null},r.context_management&&(v=sb(r.context_management)),y={...y,...r.usage};return;case`message_stop`:{let e={usage:y??null,stopSequence:b,...x==null?{}:{stopDetails:x},iterations:m.iterations?m.iterations.map(e=>({type:e.type,...e.model==null?{}:{model:e.model},inputTokens:e.input_tokens,outputTokens:e.output_tokens,...e.cache_creation_input_tokens?{cacheCreationInputTokens:e.cache_creation_input_tokens}:{},...e.cache_read_input_tokens?{cacheReadInputTokens:e.cache_read_input_tokens}:{}})):null,container:S,contextManagement:v},t={anthropic:e};s&&o!==`anthropic`&&(t[o]=e),n.enqueue({type:`finish`,finishReason:p,usage:Hy({usage:m,rawUsage:y}),providerMetadata:t});return}case`error`:n.enqueue({type:`error`,error:r.error});return;default:throw Error(`Unsupported chunk type: ${r}`)}}})).tee(),O=E.getReader();try{await O.read();let e=await O.read();if(e.value?.type===`raw`&&(e=await O.read()),e.value?.type===`error`){let n=e.value.error;throw new ti({message:n.message,url:u,requestBodyValues:t,statusCode:n.type===`overloaded_error`?529:500,responseHeaders:d,responseBody:JSON.stringify(n),isRetryable:n.type===`overloaded_error`})}}finally{O.cancel().catch(()=>{}),O.releaseLock()}return{stream:D,request:{body:t},response:{headers:d}}}},cx=jh({id:`anthropic.bash_20241022`,inputSchema:K(()=>q(z({command:I(),restart:cu().optional()})))}),lx=jh({id:`anthropic.bash_20250124`,inputSchema:K(()=>q(z({command:I(),restart:cu().optional()})))}),ux=jh({id:`anthropic.computer_20241022`,inputSchema:K(()=>q(z({action:V([`key`,`type`,`mouse_move`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`screenshot`,`cursor_position`]),coordinate:R(L().int()).optional(),text:I().optional()})))}),dx=jh({id:`anthropic.computer_20250124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`]),coordinate:gu([L().int(),L().int()]).optional(),duration:L().optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:gu([L().int(),L().int()]).optional(),text:I().optional()})))}),fx=jh({id:`anthropic.computer_20251124`,inputSchema:K(()=>q(z({action:V([`key`,`hold_key`,`type`,`cursor_position`,`mouse_move`,`left_mouse_down`,`left_mouse_up`,`left_click`,`left_click_drag`,`right_click`,`middle_click`,`double_click`,`triple_click`,`scroll`,`wait`,`screenshot`,`zoom`]),coordinate:gu([L().int(),L().int()]).optional(),duration:L().optional(),region:gu([L().int(),L().int(),L().int(),L().int()]).optional(),scroll_amount:L().optional(),scroll_direction:V([`up`,`down`,`left`,`right`]).optional(),start_coordinate:gu([L().int(),L().int()]).optional(),text:I().optional()})))}),px=jh({id:`anthropic.memory_20250818`,inputSchema:K(()=>q(mu(`command`,[z({command:H(`view`),path:I(),view_range:gu([L(),L()]).optional()}),z({command:H(`create`),path:I(),file_text:I()}),z({command:H(`str_replace`),path:I(),old_str:I(),new_str:I()}),z({command:H(`insert`),path:I(),insert_line:L(),insert_text:I()}),z({command:H(`delete`),path:I()}),z({command:H(`rename`),old_path:I(),new_path:I()})])))}),mx=jh({id:`anthropic.text_editor_20241022`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),hx=jh({id:`anthropic.text_editor_20250124`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`,`undo_edit`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),gx=jh({id:`anthropic.text_editor_20250429`,inputSchema:K(()=>q(z({command:V([`view`,`create`,`str_replace`,`insert`]),path:I(),file_text:I().optional(),insert_line:L().int().optional(),new_str:I().optional(),insert_text:I().optional(),old_str:I().optional(),view_range:R(L().int()).optional()})))}),_x=K(()=>q(R(z({type:H(`tool_reference`),toolName:I()})))),vx=Nh({id:`anthropic.tool_search_bm25_20251119`,inputSchema:K(()=>q(z({query:I(),limit:L().optional()}))),outputSchema:_x,supportsDeferredResults:!0}),yx=(e={})=>vx(e),bx={advisor_20260301:Db,bash_20241022:lb,bash_20250124:ub,codeExecution_20250522:Yb,codeExecution_20250825:Qb,codeExecution_20260120:tx,computer_20241022:ux,computer_20250124:dx,computer_20251124:fx,memory_20250818:px,textEditor_20241022:mx,textEditor_20250124:hx,textEditor_20250429:gx,textEditor_20250728:Ab,webFetch_20250910:Kb,webFetch_20260209:Hb,webSearch_20250305:Rb,webSearch_20260209:Pb,toolSearchRegex_20251119:ix,toolSearchBm25_20251119:yx},xx=K(()=>q(z({id:I(),display_title:I().nullish(),name:I().nullish(),description:I().nullish(),latest_version:I().nullish(),source:I(),created_at:I(),updated_at:I()}))),Sx=K(()=>q(z({type:I(),skill_id:I(),name:I().nullish(),description:I().nullish()}))),Cx=class{constructor(e){this.config=e,this.specificationVersion=`v4`}get provider(){return this.config.provider}async getHeaders(){return Gp(await Ph(this.config.headers),{"anthropic-beta":`skills-2025-10-02`})}async fetchVersionMetadata({skillId:e,version:t,headers:n}){let{value:r}=await hg({url:`${this.config.baseURL}/skills/${e}/versions/${t}`,headers:n,failedResponseHandler:pb,successfulResponseHandler:Jg(Sx),fetch:this.config.fetch});return{...r.name==null?{}:{name:r.name},...r.description==null?{}:{description:r.description}}}async uploadSkill(e){let t=[],n=new FormData;e.displayTitle!=null&&n.append(`display_title`,e.displayTitle);for(let t of e.files){let e=Yp(t.data);n.append(`files[]`,new Blob([e]),t.path)}let r=await this.getHeaders(),{value:i}=await Hg({url:`${this.config.baseURL}/skills`,headers:r,formData:n,failedResponseHandler:pb,successfulResponseHandler:Jg(xx),fetch:this.config.fetch}),a=i.latest_version==null?{}:await this.fetchVersionMetadata({skillId:i.id,version:i.latest_version,headers:r}),o=a.name??i.name,s=a.description??i.description;return{providerReference:{anthropic:i.id},...i.display_title==null?{}:{displayTitle:i.display_title},...o==null?{}:{name:o},...s==null?{}:{description:s},...i.latest_version==null?{}:{latestVersion:i.latest_version},providerMetadata:{anthropic:{...i.source==null?{}:{source:i.source},...i.created_at==null?{}:{createdAt:i.created_at},...i.updated_at==null?{}:{updatedAt:i.updated_at}}},warnings:t}}},wx=`4.0.12`,Tx=`https://api.anthropic.com`,Ex=`${Tx}/v1`,fb()}));function Ox(e,t){return t===`openai`?e.openaiKey:e.anthropicKey}function kx(e,t,n){let r=Nx[e][n];return{model:e===`openai`?cv({apiKey:t})(r):fb({apiKey:t,headers:xr?void 0:{"anthropic-dangerous-direct-browser-access":`true`}})(r),provider:e,modelId:r}}function Ax(e){let t=e.preferredProvider;return t&&Ox(e,t)?t:e.openaiKey?`openai`:e.anthropicKey?`anthropic`:null}async function jx(e){let t=await Tr(),n=Ax(t);if(!n)throw new Px;return kx(n,Ox(t,n),e)}async function Mx(e,t){let n=await Tr(),r=e===`openai`?`anthropic`:`openai`,i=Ox(n,r);return i?kx(r,i,t):null}var Nx,Px,Fx=t((()=>{zy(),Dx(),Sr(),Br(),Nx={openai:{fast:`gpt-5.4-nano`,best:`gpt-5.2`},anthropic:{fast:`claude-haiku-4-5`,best:`claude-opus-4-8`}},Px=class extends Error{constructor(){super(`No AI provider configured. Add an OpenAI or Anthropic API key in Settings.`),this.name=`NoProviderError`}}})),Ix=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);var u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),Lx=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>u,RefreshAccessTokenFailedError:()=>d}),t.exports=c(l);var u=class extends Error{constructor(){super(`No authentication found. Please log in with the Vercel CLI (vercel login).`),this.name=`AccessTokenMissingError`}},d=class extends Error{constructor(e){super(`Failed to refresh authentication token.`,{cause:e}),this.name=`RefreshAccessTokenFailedError`}};0&&(t.exports={AccessTokenMissingError:u,RefreshAccessTokenFailedError:d})})),Rx=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>d.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>d.RefreshAccessTokenFailedError,getContext:()=>u.getContext,getVercelOidcToken:()=>f,getVercelOidcTokenSync:()=>p,getVercelToken:()=>m}),t.exports=c(l);var u=Ix(),d=Lx();async function f(){return``}function p(){return``}async function m(){throw Error(`getVercelToken is not supported in browser environments`)}0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken:f,getVercelOidcTokenSync:p,getVercelToken:m})}));function zx(e,t){let n=[nS,`${rS}${e}`];return t?.teamIdOrSlug&&n.push(`${iS}${Bx(t.teamIdOrSlug)}`),n}function Bx(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/u,``)}async function Vx({response:e,statusCode:t,defaultMessage:n=`Gateway request failed`,cause:r,authMethod:i}){let a=await Th({value:e,schema:aC});if(!a.success){let i=typeof e==`object`&&e&&`generationId`in e?e.generationId:void 0;return new iC({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:a.error,cause:r,generationId:i})}let o=a.value,s=o.error.type,c=o.error.message,l=o.generationId??void 0;switch(s){case`authentication_error`:return mS.createContextualError({apiKeyProvided:i===`api-key`,oidcTokenProvided:i===`oidc`,statusCode:t,cause:r,generationId:l});case`invalid_request_error`:return new bS({message:c,statusCode:t,cause:r,generationId:l});case`rate_limit_exceeded`:return new ES({message:c,statusCode:t,cause:r,generationId:l});case`model_not_found`:{let e=await Th({value:o.error.param,schema:AS});return new NS({message:c,statusCode:t,modelId:e.success?e.value.modelId:void 0,cause:r,generationId:l})}case`internal_server_error`:return new zS({message:c,statusCode:t,cause:r,generationId:l});case`failed_dependency`:return new GS({message:c,statusCode:t,cause:r,generationId:l});case`forbidden`:{let e=await Th({value:o.error.param,schema:YS});return new QS({message:c,statusCode:t,cause:r,generationId:l,ruleId:e.success?e.value.ruleId:void 0})}default:return new zS({message:c,statusCode:t,cause:r,generationId:l})}}function Hx(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return Pm(e.responseBody)}catch{return e.responseBody}return{}}function Ux(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t==`string`&&[`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CONNECT_TIMEOUT`].includes(t)}async function Wx(e,t){return cS.isInstance(e)?e:Ux(e)?dC.createTimeoutError({originalMessage:e instanceof Error?e.message:`Unknown error`,cause:e}):ti.isInstance(e)?e.cause&&Ux(e.cause)?dC.createTimeoutError({originalMessage:e.message,cause:e}):await Vx({response:Hx(e),statusCode:e.statusCode??500,defaultMessage:`Gateway request failed`,cause:e,authMethod:t}):await Vx({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:`Unknown Gateway error`,cause:e,authMethod:t})}async function Gx(e){let t=await Th({value:e[fC],schema:mC});return t.success?t.value:void 0}function Kx(e){if(e.type===`data`){let t=e.data;if(t instanceof Uint8Array)return{...e,data:Buffer.from(t).toString(`base64`)}}return e}function qx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:qp(e.data)}:e}function Jx(e){return e.type===`file`&&e.data instanceof Uint8Array?{...e,data:qp(e.data)}:e}function Yx(e,t){let n=new URL(`${e.replace(/^http/,`ws`)}/realtime-model`);return n.searchParams.set(`ai-model-id`,t),n.toString()}async function Xx(){return(0,eS.getContext)().headers?.[`x-vercel-id`]}function Zx(e={}){let t=null,n=null,r=e.metadataCacheRefreshMillis??1e3*60*5,i=0,a=Gh(e.baseURL)??`https://ai-gateway.vercel.sh/v4/ai`,o=t=>xm({Authorization:`Bearer ${t.token}`,"ai-gateway-protocol-version":rw,[fC]:t.authMethod,...e.teamIdOrSlug==null?{}:{[pC]:e.teamIdOrSlug},...e.headers},`ai-sdk/gateway/${nw}`),s=async()=>{try{return o(await Qx(e))}catch(e){throw mS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},c=async()=>{try{return await Qx(e)}catch(e){throw mS.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:e})}},l=async t=>{$x();let n=await c(),r=o(n),i=new URL(`/v1/realtime/client-secrets`,a).toString();try{let{value:n}=await Vg({url:i,headers:r,body:{model:t.modelId,...t.expiresAfterSeconds!=null&&{expiresIn:t.expiresAfterSeconds}},successfulResponseHandler:Jg(iw),failedResponseHandler:Kg({errorSchema:uu(),errorToMessage:e=>e}),fetch:e.fetch});return{token:n.token,...n.expiresAt!=null&&{expiresAt:n.expiresAt}}}catch(e){throw await Wx(e,await Gx(r))}},u=()=>{let e=Dm({settingValue:void 0,environmentVariableName:`VERCEL_DEPLOYMENT_ID`}),t=Dm({settingValue:void 0,environmentVariableName:`VERCEL_ENV`}),n=Dm({settingValue:void 0,environmentVariableName:`VERCEL_REGION`}),r=Dm({settingValue:void 0,environmentVariableName:`VERCEL_PROJECT_ID`});return async()=>{let i=await Xx();return{...e&&{"ai-o11y-deployment-id":e},...t&&{"ai-o11y-environment":t},...n&&{"ai-o11y-region":n},...i&&{"ai-o11y-request-id":i},...r&&{"ai-o11y-project-id":r}}}},d=t=>new CC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),f=async()=>{var o;let c=((o=e._internal)?.currentDate)?.call(o).getTime()??Date.now();return(!t||c-i>r)&&(i=c,t=new gC({baseURL:a,headers:s,fetch:e.fetch}).getAvailableModels().then(e=>(n=e,e)).catch(async e=>{throw await Wx(e,await Gx(await s()))})),n?Promise.resolve(n):t},p=async()=>new gC({baseURL:a,headers:s,fetch:e.fetch}).getCredits().catch(async e=>{throw await Wx(e,await Gx(await s()))}),m=async t=>new yC({baseURL:a,headers:s,fetch:e.fetch}).getSpendReport(t).catch(async e=>{throw await Wx(e,await Gx(await s()))}),h=async t=>new xC({baseURL:a,headers:s,fetch:e.fetch}).getGenerationInfo(t).catch(async e=>{throw await Wx(e,await Gx(await s()))}),g=function(e){if(new.target)throw Error(`The Gateway Provider model function cannot be called with the new keyword.`);return d(e)};g.specificationVersion=`v4`,g.getAvailableModels=f,g.getCredits=p,g.getSpendReport=m,g.getGenerationInfo=h,g.imageModel=t=>new DC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()}),g.languageModel=d;let _=t=>new wC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.embeddingModel=_,g.textEmbeddingModel=_,g.videoModel=t=>new MC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});let v=t=>new LC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.rerankingModel=v,g.reranking=v;let y=t=>new BC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.speechModel=y,g.speech=y;let b=t=>new WC(t,{provider:`gateway`,baseURL:a,headers:s,fetch:e.fetch,o11yHeaders:u()});g.transcriptionModel=b,g.transcription=b;let x=t=>new JC(t,{provider:`gateway.realtime`,baseURL:a,teamIdOrSlug:e.teamIdOrSlug,createClientSecret:l});return g.experimental_realtime=Object.assign(e=>x(e),{getToken:async e=>{let{model:t,...n}=e,r=await x(t).doCreateClientSecret(n);return{token:r.token,url:r.url,...r.expiresAt!=null&&{expiresAt:r.expiresAt}}}}),g.chat=g.languageModel,g.embedding=g.embeddingModel,g.image=g.imageModel,g.video=g.videoModel,g.tools=tw,g}async function Qx(e){let t=Dm({settingValue:e.apiKey,environmentVariableName:`AI_GATEWAY_API_KEY`});return t?{token:t,authMethod:`api-key`}:{token:await(0,tS.getVercelOidcToken)(),authMethod:`oidc`}}function $x(){if(globalThis.window!==void 0)throw Error(`AI Gateway realtime client secrets must be minted server-side: minting needs your Gateway credential, which must never reach the browser. Call gateway.experimental_realtime.getToken() from your server and pass the returned token to the client.`)}var eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S,vS,yS,bS,xS,SS,CS,wS,TS,ES,DS,OS,kS,AS,jS,MS,NS,PS,FS,IS,LS,RS,zS,BS,VS,HS,US,WS,GS,KS,qS,JS,YS,XS,ZS,QS,$S,eC,tC,nC,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC,_C,vC,yC,bC,xC,SC,CC,wC,TC,EC,DC,OC,kC,AC,jC,MC,NC,PC,FC,IC,LC,RC,zC,BC,VC,HC,UC,WC,GC,KC,qC,JC,YC,XC,ZC,QC,$C,ew,tw,nw,rw,iw,aw,ow=t((()=>{Qg(),Fd(),ga(),eS=Rx(),tS=Rx(),nS=`ai-gateway-realtime.v1`,rS=`ai-gateway-auth.`,iS=`ai-gateway-team.`,aS=Symbol.for(`vercel.ai.gateway.error`),cS=class e extends (sS=Error,oS=aS,sS){constructor({message:e,statusCode:t=500,cause:n,generationId:r,isRetryable:i=t!=null&&(t===408||t===409||t===429||t>=500)}){super(r?`${e} [${r}]`:e),this[oS]=!0,this.statusCode=t,this.cause=n,this.generationId=r,this.isRetryable=i}static isInstance(t){return e.hasMarker(t)}static hasMarker(e){return typeof e==`object`&&!!e&&aS in e&&e[aS]===!0}},lS=`GatewayAuthenticationError`,uS=`vercel.ai.gateway.error.${lS}`,dS=Symbol.for(uS),mS=class e extends (pS=cS,fS=dS,pS){constructor({message:e=`Authentication failed`,statusCode:t=401,cause:n,generationId:r}={}){super({message:e,statusCode:t,cause:n,generationId:r}),this[fS]=!0,this.name=lS,this.type=`authentication_error`}static isInstance(e){return cS.hasMarker(e)&&dS in e}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,statusCode:r=401,cause:i,generationId:a}){let o;return o=t?`AI Gateway authentication failed: Invalid API key or token.
55
55
 
56
56
  Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
57
57
 
@@ -80,7 +80,7 @@ Alternatively, you can use a provider module instead of the AI Gateway.
80
80
 
81
81
  Learn more: \x1B[34m${n}\x1B[0m
82
82
 
83
- `),{name:`GatewayAuthenticationError`})}function Uw(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:Gw(e.inputTokens.total,e.outputTokens.total),raw:e.raw}}function Ww(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function Gw(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Kw(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function qw(e){await Promise.all(Wp(e.callbacks).map(async t=>{try{await t?.(e.event)}catch{}}))}function Jw({error:e,exponentialBackoffDelay:t}){let n=ti.isInstance(e)?e.responseHeaders:ti.isInstance(e.cause)?e.cause.responseHeaders:void 0;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||r<t)?r:t}function Yw({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new DT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new DT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:UE({maxRetries:n,abortSignal:t})}}function Xw(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function Zw(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Dh({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Dh({text:Xw(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function Qw(...e){return async t=>{await Promise.allSettled(e.map(async e=>{await e?.(t)}))}}function $w(){return typeof process<`u`&&process.release?.name===`node`}async function eT(){if($w())return ZE??=Promise.resolve(tT(`node:diagnostics_channel`)),ZE}function tT(e){let t=globalThis.process;try{return(t?.getBuiltinModule)?.call(t,e)}catch{return}}async function nT(e,t){let n=await eT(),r=(n?.tracingChannel)?.call(n,XE);if(r==null||r.hasSubscribers===!1)return await t();let i,a,o,s=!1,c=!1,l=()=>{try{i=Promise.resolve(t())}catch(e){i=Promise.reject(e)}return i=i.then(e=>(a=e,s=!0,e),e=>{throw o=e,c=!0,e}),i};try{return await r.tracePromise(l,e)}catch{if(c)throw o;return s?a:i==null?await t():await i}}function rT({message:e,completion:t}){if(!$w())return;let n=tT(`node:diagnostics_channel`),r=tT(`node:async_hooks`),i=(n?.tracingChannel)?.call(n,XE);if(i==null||i.hasSubscribers===!1||r==null){Promise.resolve(t).catch(()=>{});return}let a=e,o,s=!1,c=e=>{try{e()}catch{}},l=({result:e,error:t})=>{s||(s=!0,t!==void 0&&(a.error=t,c(()=>i.error.publish(a))),e!==void 0&&(a.result=e),c(()=>i.asyncEnd.publish(a)))};return c(()=>{i.start.runStores(a,()=>{o=new r.AsyncResource(`ai.telemetry`)})}),c(()=>i.end.publish(a)),Promise.resolve(t).then(e=>l({result:e}),e=>l({error:e})),{run:e=>o==null?e():o.runInAsyncScope(e)}}function iT(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function aT(e,t){return Object.assign(Object.create(Object.getPrototypeOf(e)),e,t)}function oT({telemetry:e}){if(e?.isEnabled===!1)return{};let t=e?.integrations,n=t==null?iT():Wp(t),r={recordInputs:e?.recordInputs,recordOutputs:e?.recordOutputs,functionId:e?.functionId},i=e=>{let t=Qw(...n.map(t=>t[e]?.bind(t)).filter(Boolean).map(e=>t=>e(aT(t,r))));return async e=>{await t(e)}},a=n.map(e=>e.executeLanguageModelCall?.bind(e)).filter(Boolean),o=n.map(e=>e.executeTool?.bind(e)).filter(Boolean);return{runInTracingChannelSpan:async({type:e,event:t,execute:n})=>await nT({type:e,event:aT(t,r)},n),startTracingChannelContext:({type:e,event:t,completion:n})=>rT({message:{type:e,event:aT(t,r)},completion:n}),onStart:i(`onStart`),onStepStart:i(`onStepStart`),onLanguageModelCallStart:i(`onLanguageModelCallStart`),onLanguageModelCallEnd:i(`onLanguageModelCallEnd`),onToolExecutionStart:i(`onToolExecutionStart`),onToolExecutionEnd:i(`onToolExecutionEnd`),onStepEnd:Qw(i(`onStepEnd`),i(`onStepFinish`)),onObjectStepStart:i(`onObjectStepStart`),onObjectStepEnd:i(`onObjectStepEnd`),onEmbedStart:i(`onEmbedStart`),onEmbedEnd:i(`onEmbedEnd`),onRerankStart:i(`onRerankStart`),onRerankEnd:i(`onRerankEnd`),onEnd:i(`onEnd`),onAbort:i(`onAbort`),onError:i(`onError`),executeLanguageModelCall:async({execute:e,...t})=>{let n=aT(t,r),i=e;for(let e of a){let t=i;i=()=>e({...n,execute:t})}return await nT({type:`languageModelCall`,event:n},i)},executeTool:async({execute:e,...t})=>{let n=aT(t,r),i=e;for(let e of o){let t=i;i=()=>e({...n,execute:t})}return await i()}}}function sT(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function cT({status:e,statusText:t,headers:n,stream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:sT(n,{"content-type":`text/plain; charset=utf-8`})})}function lT({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;let r=e.write(n),i=e.flush;typeof i==`function`&&i.call(e),r||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function uT({response:e,status:t,statusText:n,headers:r,stream:i}){lT({response:e,status:t,statusText:n,headers:Object.fromEntries(sT(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function dT(e){return fT(e.pipeThrough(new TransformStream))}function fT(e){return e[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},e}function pT(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function mT(){let e=[],t=null,n=!1,r=pT(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=pT(),await r.promise,await a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function hT({output:e,schema:t,enumValues:n}){switch(e){case`object`:return $E(yh(t));case`array`:return eD(yh(t));case`enum`:return tD(n);case`no-schema`:return QE;default:throw Error(`Unsupported output: ${e}`)}}async function gT(e,t,n){let r=await Dh({text:e});if(!r.success)throw new UT({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await t.validateFinalResult(r.value,{text:e,response:n.response,usage:n.usage});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}async function _T(e,t,n,r){try{return await gT(e,t,r)}catch(i){if(n!=null&&UT.isInstance(i)&&(ji.isInstance(i.cause)||la.isInstance(i.cause))){let a=await n({text:e,error:i.cause});if(a===null)throw i;return await gT(a,t,r)}throw i}}function vT({output:e,schema:t,schemaName:n,schemaDescription:r,enumValues:i}){if(e!=null&&e!==`object`&&e!==`array`&&e!==`enum`&&e!==`no-schema`)throw new DT({parameter:`output`,value:e,message:`Invalid output type.`});if(e===`no-schema`){if(t!=null)throw new DT({parameter:`schema`,value:t,message:`Schema is not supported for no-schema output.`});if(r!=null)throw new DT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for no-schema output.`});if(n!=null)throw new DT({parameter:`schemaName`,value:n,message:`Schema name is not supported for no-schema output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for no-schema output.`})}if(e===`object`){if(t==null)throw new DT({parameter:`schema`,value:t,message:`Schema is required for object output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for object output.`})}if(e===`array`){if(t==null)throw new DT({parameter:`schema`,value:t,message:`Element schema is required for array output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for array output.`})}if(e===`enum`){if(t!=null)throw new DT({parameter:`schema`,value:t,message:`Schema is not supported for enum output.`});if(r!=null)throw new DT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for enum output.`});if(n!=null)throw new DT({parameter:`schemaName`,value:n,message:`Schema name is not supported for enum output.`});if(i==null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are required for enum output.`});for(let e of i)if(typeof e!=`string`)throw new DT({parameter:`enumValues`,value:e,message:`Enum values must be strings.`})}}function yT(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!yT(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!yT(e[i],t[i]))return!1;return!0}function bT(e){let{model:t,output:n=`object`,instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,maxRetries:c,abortSignal:l,headers:u,experimental_repairText:d,experimental_telemetry:f,telemetry:p=f,experimental_download:m,providerOptions:h,onStart:g,experimental_onStart:_,onStepStart:v,experimental_onStepStart:y,onStepEnd:b,onStepFinish:x,onError:S=({error:e})=>{console.error(e)},onFinish:C,_internal:{generateId:w=nD,currentDate:T=()=>new Date,now:ee=Kw}={},...E}=e,D=`enum`in e&&e.enum?e.enum:void 0,{schema:O,schemaDescription:te,schemaName:k}=`schema`in e?e:{};return vT({output:n,schema:O,schemaName:k,schemaDescription:te,enumValues:D}),new rD({model:t,telemetry:p,headers:u,settings:E,maxRetries:c,abortSignal:l,outputStrategy:hT({output:n,schema:O,enumValues:D}),instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,schemaName:k,schemaDescription:te,providerOptions:h,repairText:d,onStart:g??_,onStepStart:v??y,onStepFinish:b??x,onError:S,onFinish:C,download:m,generateId:w,currentDate:T,now:ee})}var xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD,iD,aD=t((()=>{Qg(),ga(),ow(),Fd(),xT=Object.defineProperty,ST=(e,t)=>{for(var n in t)xT(e,n,{get:t[n],enumerable:!0})},CT=`AI_InvalidArgumentError`,wT=`vercel.ai.error.${CT}`,TT=Symbol.for(wT),DT=class extends Yr{constructor({parameter:e,value:t,message:n}){super({name:CT,message:`Invalid argument for parameter ${e}: ${n}`}),this[ET]=!0,this.parameter=e,this.value=t}static isInstance(e){return Yr.hasMarker(e,wT)}},ET=TT,OT=`AI_InvalidStreamPartError`,`${OT}`,kT=`AI_InvalidToolApprovalError`,`${kT}`,AT=`AI_InvalidToolApprovalSignatureError`,`${AT}`,jT=`AI_InvalidToolInputError`,`${jT}`,MT=`AI_ToolCallNotFoundForApprovalError`,`${MT}`,NT=`AI_MissingToolResultsError`,PT=`vercel.ai.error.${NT}`,FT=Symbol.for(PT),LT=class extends Yr{constructor({toolCallIds:e}){super({name:NT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[IT]=!0,this.toolCallIds=e}static isInstance(e){return Yr.hasMarker(e,PT)}},IT=FT,RT=`AI_NoImageGeneratedError`,`${RT}`,zT=`AI_NoObjectGeneratedError`,BT=`vercel.ai.error.${zT}`,VT=Symbol.for(BT),UT=class extends Yr{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:zT,message:e,cause:t}),this[HT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Yr.hasMarker(e,BT)}},HT=VT,WT=`AI_NoOutputGeneratedError`,`${WT}`,GT=`AI_NoSpeechGeneratedError`,`${GT}`,KT=`AI_NoTranscriptGeneratedError`,`${KT}`,qT=`AI_NoVideoGeneratedError`,`${qT}`,JT=`AI_NoSuchToolError`,`${JT}`,YT=`AI_ToolCallRepairError`,`${YT}`,XT=class extends Yr{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},ZT=`AI_UIMessageStreamError`,`${ZT}`,QT=`AI_InvalidDataContentError`,$T=`vercel.ai.error.${QT}`,eE=Symbol.for($T),nE=class extends Yr{constructor({content:e,cause:t,message:n=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:QT,message:n,cause:t}),this[tE]=!0,this.content=e}static isInstance(e){return Yr.hasMarker(e,$T)}},tE=eE,rE=`AI_InvalidMessageRoleError`,iE=`vercel.ai.error.${rE}`,aE=Symbol.for(iE),sE=class extends Yr{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:rE,message:t}),this[oE]=!0,this.role=e}static isInstance(e){return Yr.hasMarker(e,iE)}},oE=aE,cE=`AI_MessageConversionError`,`${cE}`,lE=`AI_RetryError`,uE=`vercel.ai.error.${lE}`,dE=Symbol.for(uE),pE=class extends Yr{constructor({message:e,reason:t,errors:n}){super({name:lE,message:e}),this[fE]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return Yr.hasMarker(e,uE)}},fE=dE,mE=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,hE=!1,gE=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}hE||(hE=!0,console.info(mE));for(let t of e.warnings){let n=sw({warning:t,provider:e.provider,model:e.model});typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(n,{type:t.type===`deprecated`?`DeprecationWarning`:`Warning`}):console.warn(n)}}},_E=`7.0.22`,vE=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();try{let e=await fm({url:r,headers:xm({},`ai-sdk/${_E}`,ym()),abortSignal:n});if(!e.ok)throw await am(e),new og({url:r,statusCode:e.status,statusText:e.statusText});return{data:await pm({response:e,url:r,maxBytes:t??cg}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw og.isInstance(e)?e:new og({url:r,cause:e})}},yE=(e=vE)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:await e(t))),bE={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,avif:`image/avif`,heic:`image/heic`,bmp:`image/bmp`,tiff:`image/tiff`,tif:`image/tiff`,pdf:`application/pdf`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`},xE=Du(()=>B([lu(),I(),L(),cu(),_u(I(),xE.optional()),R(xE)])),SE=_u(I(),_u(I(),xE.optional())),CE=B([I(),Mu(Uint8Array),Mu(ArrayBuffer),ku(Sm,{message:`Must be a Buffer`})]),wE=_u(I(),I()),TE=z({type:H(`text`),text:I(),providerOptions:SE.optional()}),EE=z({type:H(`image`),image:B([CE,Mu(URL),wE]),mediaType:I().optional(),providerOptions:SE.optional()}),DE=mu(`type`,[z({type:H(`data`),data:CE}),z({type:H(`url`),url:Mu(URL)}),z({type:H(`reference`),reference:wE}),z({type:H(`text`),text:I()})]),OE=mu(`type`,[z({type:H(`data`),data:CE}),z({type:H(`url`),url:Mu(URL)})]),kE=z({type:H(`file`),data:B([DE,CE,Mu(URL),wE]),filename:I().optional(),mediaType:I(),providerOptions:SE.optional()}),AE=z({type:H(`reasoning`),text:I(),providerOptions:SE.optional()}),jE=z({type:H(`custom`),kind:I().transform(e=>e),providerOptions:SE.optional()}),ME=z({type:H(`reasoning-file`),data:B([OE,CE,Mu(URL)]),mediaType:I(),providerOptions:SE.optional()}),NE=z({type:H(`tool-call`),toolCallId:I(),toolName:I(),input:du(),providerOptions:SE.optional(),providerExecuted:cu().optional()}),PE=mu(`type`,[z({type:H(`text`),value:I(),providerOptions:SE.optional()}),z({type:H(`json`),value:xE,providerOptions:SE.optional()}),z({type:H(`execution-denied`),reason:I().optional(),providerOptions:SE.optional()}),z({type:H(`error-text`),value:I(),providerOptions:SE.optional()}),z({type:H(`error-json`),value:xE,providerOptions:SE.optional()}),z({type:H(`content`),value:R(B([z({type:H(`text`),text:I(),providerOptions:SE.optional()}),z({type:H(`file`),data:DE,mediaType:I(),filename:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-data`),data:I(),mediaType:I(),filename:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-url`),url:I(),mediaType:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-id`),fileId:B([I(),_u(I(),I())]),providerOptions:SE.optional()}),z({type:H(`file-reference`),providerReference:_u(I(),I()),providerOptions:SE.optional()}),z({type:H(`image-data`),data:I(),mediaType:I(),providerOptions:SE.optional()}),z({type:H(`image-url`),url:I(),providerOptions:SE.optional()}),z({type:H(`image-file-id`),fileId:B([I(),_u(I(),I())]),providerOptions:SE.optional()}),z({type:H(`image-file-reference`),providerReference:_u(I(),I()),providerOptions:SE.optional()}),z({type:H(`custom`),providerOptions:SE.optional()})]))})]),FE=z({type:H(`tool-result`),toolCallId:I(),toolName:I(),output:PE,providerOptions:SE.optional()}),IE=z({type:H(`tool-approval-request`),approvalId:I(),toolCallId:I()}),LE=z({type:H(`tool-approval-response`),approvalId:I(),approved:cu(),reason:I().optional()}),RE=z({role:H(`system`),content:I(),providerOptions:SE.optional()}),zE=z({role:H(`user`),content:B([I(),R(B([TE,EE,kE]))]),providerOptions:SE.optional()}),BE=z({role:H(`assistant`),content:B([I(),R(B([TE,jE,kE,AE,ME,NE,FE,IE]))]),providerOptions:SE.optional()}),VE=z({role:H(`tool`),content:R(B([FE,LE])),providerOptions:SE.optional()}),HE=B([RE,zE,BE,VE]),UE=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r}={})=>Wg({maxRetries:e,initialDelayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:e=>e instanceof Error&&(ti.isInstance(e)&&e.isRetryable===!0||cS.isInstance(e)&&e.isRetryable===!0),getDelayInMs:({error:e,exponentialBackoffDelay:t})=>Jw({error:e,exponentialBackoffDelay:t}),createRetryError:({message:e,reason:t,errors:n})=>new pE({message:e,reason:t,errors:n})}),WE={},ST(WE,{array:()=>qE,choice:()=>JE,json:()=>YE,object:()=>KE,text:()=>GE}),GE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),KE=({schema:e,name:t,description:n})=>{let r=yh(e);return{name:`object`,responseFormat:Ph(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await Th({value:n.value,schema:r});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},qE=({element:e,name:t,description:n})=>{let r=yh(e);return{name:`array`,responseFormat:Ph(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new UT({message:`No object generated: response did not match schema.`,cause:new la({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let a=[];for(let n of i.elements){let i=await Th({value:n,schema:r});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});a.push(i.value)}return a},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await Th({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},JE=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await Dh({text:t});if(!r.success)throw new UT({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new UT({message:`No object generated: response did not match schema.`,cause:new la({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Zw(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),YE=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}}),XE=`ai:telemetry`,new TextEncoder,new TextEncoder,lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),TransformStream,_u(I(),xE.optional()),lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),_u(I(),xE.optional()),_u(I(),I()),lg({prefix:`call`,size:24}),lg({prefix:`call`,size:24}),QE={type:`no-schema`,jsonSchema:async()=>void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new UT({message:`No object generated: response did not match schema.`,text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new ha({functionality:`element streams in no-schema mode`})}},$E=e=>({type:`object`,jsonSchema:async()=>await e.jsonSchema,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(t){return Th({value:t,schema:e})},createElementStream(){throw new ha({functionality:`element streams in object mode`})}}),eD=e=>({type:`array`,jsonSchema:async()=>{let{$schema:t,...n}=await e.jsonSchema;return{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:n}},required:[`elements`],additionalProperties:!1}},async validatePartialResult({value:t,latestObject:n,isFirstDelta:r,isFinalDelta:i}){if(!Wr(t)||!Ur(t.elements))return{success:!1,error:new la({value:t,cause:`value must be an object that contains an array of elements`})};let a=t.elements,o=[];for(let t=0;t<a.length;t++){let n=a[t],r=await Th({value:n,schema:e});if(!(t===a.length-1&&!i)){if(!r.success)return r;o.push(r.value)}}let s=n?.length??0,c=``;return r&&(c+=`[`),s>0&&(c+=`,`),c+=o.slice(s).map(e=>JSON.stringify(e)).join(`,`),i&&(c+=`]`),{success:!0,value:{partial:o,textDelta:c}}},async validateFinalResult(t){if(!Wr(t)||!Ur(t.elements))return{success:!1,error:new la({value:t,cause:`value must be an object that contains an array of elements`})};let n=t.elements,r=[];for(let t of n){let n=await Th({value:t,schema:e});if(!n.success)return n;r.push(n.value)}return{success:!0,value:r}},createElementStream(e){let t=0;return dT(e.pipeThrough(new TransformStream({transform(e,n){switch(e.type){case`object`:{let r=e.object;for(;t<r.length;t++)n.enqueue(r[t]);break}case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}}),tD=e=>({type:`enum`,jsonSchema:async()=>({$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1}),async validateFinalResult(t){if(!Wr(t)||typeof t.result!=`string`)return{success:!1,error:new la({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let n=t.result;return e.includes(n)?{success:!0,value:n}:{success:!1,error:new la({value:t,cause:`value must be a string in the enum`})}},async validatePartialResult({value:t,textDelta:n}){if(!Wr(t)||typeof t.result!=`string`)return{success:!1,error:new la({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let r=t.result,i=e.filter(e=>e.startsWith(r));return t.result.length===0||i.length===0?{success:!1,error:new la({value:t,cause:`value must be a string in the enum`})}:{success:!0,value:{partial:i.length>1?r:i[0],textDelta:n}}},createElementStream(){throw new ha({functionality:`element streams in enum mode`})}}),lg({prefix:`aiobj`,size:24}),nD=lg({prefix:`aiobj`,size:24}),rD=class{constructor({model:e,headers:t,telemetry:n,settings:r,maxRetries:i,abortSignal:a,outputStrategy:o,instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d,schemaName:f,schemaDescription:p,providerOptions:m,repairText:h,onStart:g,onStepStart:_,onStepFinish:v,onError:y,onFinish:b,download:x,generateId:S,currentDate:C,now:w}){this._object=new Jh,this._usage=new Jh,this._providerMetadata=new Jh,this._warnings=new Jh,this._request=new Jh,this._response=new Jh,this._finishReason=new Jh;let T=Tw(e),{maxRetries:ee,retry:E}=Yw({maxRetries:i,abortSignal:a}),D=Bw(r),O=oT({telemetry:n}),te=this,k=mT(),A=new TransformStream({transform(e,t){t.enqueue(e),e.type===`error`&&y({error:Hw(e.error)})}});this.baseStream=k.stream.pipeThrough(A);let ne=S();(async()=>{let e=await o.jsonSchema();await qw({event:{callId:ne,operationId:`ai.streamObject`,provider:T.provider,modelId:T.modelId,system:s??c,prompt:l,messages:u,maxOutputTokens:D.maxOutputTokens,temperature:D.temperature,topP:D.topP,topK:D.topK,presencePenalty:D.presencePenalty,frequencyPenalty:D.frequencyPenalty,seed:D.seed,maxRetries:ee,headers:t,providerOptions:m,output:o.type,schema:e,schemaName:f,schemaDescription:p},callbacks:[g,O.onStart]});let n=await Vw({instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d}),i={responseFormat:{type:`json`,schema:e,name:f,description:p},...Bw(r),prompt:await Mw({prompt:n,supportedUrls:await T.supportedUrls,download:x,provider:T.provider.split(`.`)[0]}),providerOptions:m,abortSignal:a,headers:t,includeRawChunks:!1};await qw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,providerOptions:m,headers:t,promptMessages:i.prompt},callbacks:[_,O.onObjectStepStart]});let y={transform:(e,t)=>{switch(e.type){case`text-delta`:t.enqueue(e.delta);break;case`response-metadata`:case`finish`:case`error`:case`stream-start`:t.enqueue(e);break}}},A=w(),{stream:re,response:ie,request:ae}=await E(()=>T.doStream(i));te._request.resolve(ae??{});let oe,se=Ww(),ce,le,ue,de,fe,pe=``,me=``,he={id:S(),timestamp:C(),modelId:T.modelId},ge,_e,ve=!0,ye=!0,be=re.pipeThrough(new TransformStream(y)).pipeThrough(new TransformStream({async transform(e,t){if(typeof e==`object`&&e.type===`stream-start`){oe=e.warnings;return}if(ve&&=(fe=w()-A,!1),typeof e==`string`){pe+=e,me+=e;let{value:n,state:r}=await Zw(pe);if(n!==void 0&&!yT(ge,n)){let e=await o.validatePartialResult({value:n,textDelta:me,latestObject:_e,isFirstDelta:ye,isFinalDelta:r===`successful-parse`});e.success&&!yT(_e,e.value.partial)&&(ge=n,_e=e.value.partial,t.enqueue({type:`object`,object:_e}),t.enqueue({type:`text-delta`,textDelta:e.value.textDelta}),me=``,ye=!1)}return}switch(e.type){case`response-metadata`:he={id:e.id??he.id,timestamp:e.timestamp??he.timestamp,modelId:e.modelId??he.modelId};break;case`finish`:me!==``&&t.enqueue({type:`text-delta`,textDelta:me}),ce=e.finishReason.unified,se=Uw(e.usage),le=e.providerMetadata,t.enqueue({...e,finishReason:e.finishReason.unified,usage:se,response:he}),gE({warnings:oe??[],provider:T.provider,model:T.modelId}),te._usage.resolve(se),te._providerMetadata.resolve(le),te._warnings.resolve(oe),te._response.resolve({...he,headers:ie?.headers}),te._finishReason.resolve(ce??`other`);try{ue=await _T(pe,o,h,{response:he,usage:se,finishReason:ce}),te._object.resolve(ue)}catch(e){de=e,te._object.reject(e)}break;default:t.enqueue(e);break}},async flush(e){try{let e=se??{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};await qw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,finishReason:ce??`other`,usage:e,objectText:pe,msToFirstChunk:fe,reasoning:void 0,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[v,O.onObjectStepEnd]}),await qw({event:{callId:ne,object:ue,error:de,reasoning:void 0,finishReason:ce??`other`,usage:e,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[b,O.onEnd]})}catch(t){e.enqueue({type:`error`,error:t})}}}));k.addStream(be)})().catch(async e=>{await O.onError?.call(O,{callId:ne,error:e}),k.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}}))}).finally(()=>{k.close()}),this.outputStrategy=o}get object(){return this._object.promise}get usage(){return this._usage.promise}get providerMetadata(){return this._providerMetadata.promise}get warnings(){return this._warnings.promise}get request(){return this._request.promise}get response(){return this._response.promise}get finishReason(){return this._finishReason.promise}get partialObjectStream(){return dT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`object`:t.enqueue(e.object);break;case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get elementStream(){return this.outputStrategy.createElementStream(this.baseStream)}get textStream(){return dT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`text-delta`:t.enqueue(e.textDelta);break;case`object`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get fullStream(){return dT(this.baseStream)}pipeTextStreamToResponse(e,t){uT({response:e,stream:this.textStream,...t})}toTextStreamResponse(e){return cT({stream:this.textStream,...e})}},iD=`AI_NoSuchProviderError`,`${iD}`,lg({prefix:`call`,size:24})})),oD=t((()=>{Op(),Op()})),sD,cD=t((()=>{oD(),sD=Ep({title:Cp().describe(`Concise, specific issue title. Imperative or descriptive, no trailing period.`),description:Cp().describe(`Issue body in Linear markdown: a short problem summary and relevant context. Do NOT include repro steps, expected/actual, or source location — those are separate fields.`),reproSteps:Tp(Cp()).describe(`Ordered reproduction steps, each a single action.`),expected:Cp().describe(`Expected behavior, one or two sentences.`),actual:Cp().describe(`Actual (buggy) behavior, one or two sentences.`),impact:Cp().describe(`Who/what is affected and how badly, 1-2 sentences (e.g. "Cosmetic/UX polish issue — doesn't block anything but feels glitchy.").`),analysisNotes:Cp().describe(`Markdown bullet list ("- …") of likely root-cause analysis based on the source context. Empty string when there is nothing substantive to say.`),suggestedNextSteps:Cp().describe(`Markdown bullet list of concrete, actionable fix suggestions the coding agent should consider first.`),priority:wp().int().min(0).max(4).describe(`Linear priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.`),suggestedLabels:Tp(Cp()).describe(`0-3 suggested label names, e.g. "Bug", "UI".`)})}));function lD(e){let t=[e.issueTemplate?.trim()||hD],n=(e.skillPaths??``).split(`
83
+ `),{name:`GatewayAuthenticationError`})}function Uw(e){return{inputTokens:e.inputTokens.total,inputTokenDetails:{noCacheTokens:e.inputTokens.noCache,cacheReadTokens:e.inputTokens.cacheRead,cacheWriteTokens:e.inputTokens.cacheWrite},outputTokens:e.outputTokens.total,outputTokenDetails:{textTokens:e.outputTokens.text,reasoningTokens:e.outputTokens.reasoning},totalTokens:Gw(e.inputTokens.total,e.outputTokens.total),raw:e.raw}}function Ww(){return{inputTokens:void 0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokens:void 0,outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0},totalTokens:void 0,raw:void 0}}function Gw(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Kw(){return(globalThis==null?void 0:globalThis.performance)?.now()??Date.now()}async function qw(e){await Promise.all(Wp(e.callbacks).map(async t=>{try{await t?.(e.event)}catch{}}))}function Jw({error:e,exponentialBackoffDelay:t}){let n=ti.isInstance(e)?e.responseHeaders:ti.isInstance(e.cause)?e.cause.responseHeaders:void 0;if(!n)return t;let r,i=n[`retry-after-ms`];if(i){let e=parseFloat(i);Number.isNaN(e)||(r=e)}let a=n[`retry-after`];if(a&&r===void 0){let e=parseFloat(a);r=Number.isNaN(e)?Date.parse(a)-Date.now():e*1e3}return r!=null&&!Number.isNaN(r)&&0<=r&&(r<60*1e3||r<t)?r:t}function Yw({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new DT({parameter:`maxRetries`,value:e,message:`maxRetries must be an integer`});if(e<0)throw new DT({parameter:`maxRetries`,value:e,message:`maxRetries must be >= 0`})}let n=e??2;return{maxRetries:n,retry:UE({maxRetries:n,abortSignal:t})}}function Xw(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`);break}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop();break}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function Zw(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Dh({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Dh({text:Xw(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function Qw(...e){return async t=>{await Promise.allSettled(e.map(async e=>{await e?.(t)}))}}function $w(){return typeof process<`u`&&process.release?.name===`node`}async function eT(){if($w())return ZE??=Promise.resolve(tT(`node:diagnostics_channel`)),ZE}function tT(e){let t=globalThis.process;try{return(t?.getBuiltinModule)?.call(t,e)}catch{return}}async function nT(e,t){let n=await eT(),r=(n?.tracingChannel)?.call(n,XE);if(r==null||r.hasSubscribers===!1)return await t();let i,a,o,s=!1,c=!1,l=()=>{try{i=Promise.resolve(t())}catch(e){i=Promise.reject(e)}return i=i.then(e=>(a=e,s=!0,e),e=>{throw o=e,c=!0,e}),i};try{return await r.tracePromise(l,e)}catch{if(c)throw o;return s?a:i==null?await t():await i}}function rT({message:e,completion:t}){if(!$w())return;let n=tT(`node:diagnostics_channel`),r=tT(`node:async_hooks`),i=(n?.tracingChannel)?.call(n,XE);if(i==null||i.hasSubscribers===!1||r==null){Promise.resolve(t).catch(()=>{});return}let a=e,o,s=!1,c=e=>{try{e()}catch{}},l=({result:e,error:t})=>{s||(s=!0,t!==void 0&&(a.error=t,c(()=>i.error.publish(a))),e!==void 0&&(a.result=e),c(()=>i.asyncEnd.publish(a)))};return c(()=>{i.start.runStores(a,()=>{o=new r.AsyncResource(`ai.telemetry`)})}),c(()=>i.end.publish(a)),Promise.resolve(t).then(e=>l({result:e}),e=>l({error:e})),{run:e=>o==null?e():o.runInAsyncScope(e)}}function iT(){return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS??[]}function aT(e,t){return Object.assign(Object.create(Object.getPrototypeOf(e)),e,t)}function oT({telemetry:e}){if(e?.isEnabled===!1)return{};let t=e?.integrations,n=t==null?iT():Wp(t),r={recordInputs:e?.recordInputs,recordOutputs:e?.recordOutputs,functionId:e?.functionId},i=e=>{let t=Qw(...n.map(t=>t[e]?.bind(t)).filter(Boolean).map(e=>t=>e(aT(t,r))));return async e=>{await t(e)}},a=n.map(e=>e.executeLanguageModelCall?.bind(e)).filter(Boolean),o=n.map(e=>e.executeTool?.bind(e)).filter(Boolean);return{runInTracingChannelSpan:async({type:e,event:t,execute:n})=>await nT({type:e,event:aT(t,r)},n),startTracingChannelContext:({type:e,event:t,completion:n})=>rT({message:{type:e,event:aT(t,r)},completion:n}),onStart:i(`onStart`),onStepStart:i(`onStepStart`),onLanguageModelCallStart:i(`onLanguageModelCallStart`),onLanguageModelCallEnd:i(`onLanguageModelCallEnd`),onToolExecutionStart:i(`onToolExecutionStart`),onToolExecutionEnd:i(`onToolExecutionEnd`),onStepEnd:Qw(i(`onStepEnd`),i(`onStepFinish`)),onObjectStepStart:i(`onObjectStepStart`),onObjectStepEnd:i(`onObjectStepEnd`),onEmbedStart:i(`onEmbedStart`),onEmbedEnd:i(`onEmbedEnd`),onRerankStart:i(`onRerankStart`),onRerankEnd:i(`onRerankEnd`),onEnd:i(`onEnd`),onAbort:i(`onAbort`),onError:i(`onError`),executeLanguageModelCall:async({execute:e,...t})=>{let n=aT(t,r),i=e;for(let e of a){let t=i;i=()=>e({...n,execute:t})}return await nT({type:`languageModelCall`,event:n},i)},executeTool:async({execute:e,...t})=>{let n=aT(t,r),i=e;for(let e of o){let t=i;i=()=>e({...n,execute:t})}return await i()}}}function sT(e,t){let n=new Headers(e??{});for(let[e,r]of Object.entries(t))n.has(e)||n.set(e,r);return n}function cT({status:e,statusText:t,headers:n,stream:r}){return new Response(r.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:sT(n,{"content-type":`text/plain; charset=utf-8`})})}function lT({response:e,status:t,statusText:n,headers:r,stream:i}){let a=t??200;n===void 0?e.writeHead(a,r):e.writeHead(a,n,r);let o=i.getReader();(async()=>{try{for(;;){let{done:t,value:n}=await o.read();if(t)break;let r=e.write(n),i=e.flush;typeof i==`function`&&i.call(e),r||await new Promise(t=>{e.once(`drain`,t)})}}catch(e){throw e}finally{e.end()}})()}function uT({response:e,status:t,statusText:n,headers:r,stream:i}){lT({response:e,status:t,statusText:n,headers:Object.fromEntries(sT(r,{"content-type":`text/plain; charset=utf-8`}).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function dT(e){return fT(e.pipeThrough(new TransformStream))}function fT(e){return e[Symbol.asyncIterator]=function(){let e=this.getReader(),t=!1;async function n(n){if(!t){t=!0;try{n&&await e.cancel?.call(e)}finally{try{e.releaseLock()}catch{}}}}return{async next(){if(t)return{done:!0,value:void 0};let{done:r,value:i}=await e.read();return r?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(e){throw await n(!0),e}}},e}function pT(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function mT(){let e=[],t=null,n=!1,r=pT(),i=()=>{n=!0,r.resolve(),e.forEach(e=>e.cancel()),e=[],t?.close()},a=async()=>{if(n&&e.length===0){t?.close();return}if(e.length===0)return r=pT(),await r.promise,await a();try{let{value:r,done:i}=await e[0].read();i?(e.shift(),e.length===0&&n?t?.close():await a()):t?.enqueue(r)}catch(n){t?.error(n),e.shift(),i()}};return{stream:new ReadableStream({start(e){t=e},pull:a,async cancel(){for(let t of e)await t.cancel();e=[],n=!0}}),addStream:t=>{if(n)throw Error(`Cannot add inner stream: outer stream is closed`);e.push(t.getReader()),r.resolve()},close:()=>{n=!0,r.resolve(),e.length===0&&t?.close()},terminate:i}}function hT({output:e,schema:t,enumValues:n}){switch(e){case`object`:return $E(yh(t));case`array`:return eD(yh(t));case`enum`:return tD(n);case`no-schema`:return QE;default:throw Error(`Unsupported output: ${e}`)}}async function gT(e,t,n){let r=await Dh({text:e});if(!r.success)throw new UT({message:`No object generated: could not parse the response.`,cause:r.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=await t.validateFinalResult(r.value,{text:e,response:n.response,usage:n.usage});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.value}async function _T(e,t,n,r){try{return await gT(e,t,r)}catch(i){if(n!=null&&UT.isInstance(i)&&(ji.isInstance(i.cause)||la.isInstance(i.cause))){let a=await n({text:e,error:i.cause});if(a===null)throw i;return await gT(a,t,r)}throw i}}function vT({output:e,schema:t,schemaName:n,schemaDescription:r,enumValues:i}){if(e!=null&&e!==`object`&&e!==`array`&&e!==`enum`&&e!==`no-schema`)throw new DT({parameter:`output`,value:e,message:`Invalid output type.`});if(e===`no-schema`){if(t!=null)throw new DT({parameter:`schema`,value:t,message:`Schema is not supported for no-schema output.`});if(r!=null)throw new DT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for no-schema output.`});if(n!=null)throw new DT({parameter:`schemaName`,value:n,message:`Schema name is not supported for no-schema output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for no-schema output.`})}if(e===`object`){if(t==null)throw new DT({parameter:`schema`,value:t,message:`Schema is required for object output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for object output.`})}if(e===`array`){if(t==null)throw new DT({parameter:`schema`,value:t,message:`Element schema is required for array output.`});if(i!=null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are not supported for array output.`})}if(e===`enum`){if(t!=null)throw new DT({parameter:`schema`,value:t,message:`Schema is not supported for enum output.`});if(r!=null)throw new DT({parameter:`schemaDescription`,value:r,message:`Schema description is not supported for enum output.`});if(n!=null)throw new DT({parameter:`schemaName`,value:n,message:`Schema name is not supported for enum output.`});if(i==null)throw new DT({parameter:`enumValues`,value:i,message:`Enum values are required for enum output.`});for(let e of i)if(typeof e!=`string`)throw new DT({parameter:`enumValues`,value:e,message:`Enum values must be strings.`})}}function yT(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!yT(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!yT(e[i],t[i]))return!1;return!0}function bT(e){let{model:t,output:n=`object`,instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,maxRetries:c,abortSignal:l,headers:u,experimental_repairText:d,experimental_telemetry:f,telemetry:p=f,experimental_download:m,providerOptions:h,onStart:g,experimental_onStart:_,onStepStart:v,experimental_onStepStart:y,onStepEnd:b,onStepFinish:x,onError:S=({error:e})=>{console.error(e)},onFinish:C,_internal:{generateId:w=nD,currentDate:T=()=>new Date,now:E=Kw}={},...D}=e,O=`enum`in e&&e.enum?e.enum:void 0,{schema:k,schemaDescription:ee,schemaName:te}=`schema`in e?e:{};return vT({output:n,schema:k,schemaName:te,schemaDescription:ee,enumValues:O}),new rD({model:t,telemetry:p,headers:u,settings:D,maxRetries:c,abortSignal:l,outputStrategy:hT({output:n,schema:k,enumValues:O}),instructions:r,system:i,prompt:a,messages:o,allowSystemInMessages:s,schemaName:te,schemaDescription:ee,providerOptions:h,repairText:d,onStart:g??_,onStepStart:v??y,onStepFinish:b??x,onError:S,onFinish:C,download:m,generateId:w,currentDate:T,now:E})}var xT,ST,CT,wT,TT,ET,DT,OT,kT,AT,jT,MT,NT,PT,FT,IT,LT,RT,zT,BT,VT,HT,UT,WT,GT,KT,qT,JT,YT,XT,ZT,QT,$T,eE,tE,nE,rE,iE,aE,oE,sE,cE,lE,uE,dE,fE,pE,mE,hE,gE,_E,vE,yE,bE,xE,SE,CE,wE,TE,EE,DE,OE,kE,AE,jE,ME,NE,PE,FE,IE,LE,RE,zE,BE,VE,HE,UE,WE,GE,KE,qE,JE,YE,XE,ZE,QE,$E,eD,tD,nD,rD,iD,aD=t((()=>{Qg(),ga(),ow(),Fd(),xT=Object.defineProperty,ST=(e,t)=>{for(var n in t)xT(e,n,{get:t[n],enumerable:!0})},CT=`AI_InvalidArgumentError`,wT=`vercel.ai.error.${CT}`,TT=Symbol.for(wT),DT=class extends Yr{constructor({parameter:e,value:t,message:n}){super({name:CT,message:`Invalid argument for parameter ${e}: ${n}`}),this[ET]=!0,this.parameter=e,this.value=t}static isInstance(e){return Yr.hasMarker(e,wT)}},ET=TT,OT=`AI_InvalidStreamPartError`,`${OT}`,kT=`AI_InvalidToolApprovalError`,`${kT}`,AT=`AI_InvalidToolApprovalSignatureError`,`${AT}`,jT=`AI_InvalidToolInputError`,`${jT}`,MT=`AI_ToolCallNotFoundForApprovalError`,`${MT}`,NT=`AI_MissingToolResultsError`,PT=`vercel.ai.error.${NT}`,FT=Symbol.for(PT),LT=class extends Yr{constructor({toolCallIds:e}){super({name:NT,message:`Tool result${e.length>1?`s are`:` is`} missing for tool call${e.length>1?`s`:``} ${e.join(`, `)}.`}),this[IT]=!0,this.toolCallIds=e}static isInstance(e){return Yr.hasMarker(e,PT)}},IT=FT,RT=`AI_NoImageGeneratedError`,`${RT}`,zT=`AI_NoObjectGeneratedError`,BT=`vercel.ai.error.${zT}`,VT=Symbol.for(BT),UT=class extends Yr{constructor({message:e=`No object generated.`,cause:t,text:n,response:r,usage:i,finishReason:a}){super({name:zT,message:e,cause:t}),this[HT]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(e){return Yr.hasMarker(e,BT)}},HT=VT,WT=`AI_NoOutputGeneratedError`,`${WT}`,GT=`AI_NoSpeechGeneratedError`,`${GT}`,KT=`AI_NoTranscriptGeneratedError`,`${KT}`,qT=`AI_NoVideoGeneratedError`,`${qT}`,JT=`AI_NoSuchToolError`,`${JT}`,YT=`AI_ToolCallRepairError`,`${YT}`,XT=class extends Yr{constructor(e){super({name:`AI_UnsupportedModelVersionError`,message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},ZT=`AI_UIMessageStreamError`,`${ZT}`,QT=`AI_InvalidDataContentError`,$T=`vercel.ai.error.${QT}`,eE=Symbol.for($T),nE=class extends Yr{constructor({content:e,cause:t,message:n=`Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof e}.`}){super({name:QT,message:n,cause:t}),this[tE]=!0,this.content=e}static isInstance(e){return Yr.hasMarker(e,$T)}},tE=eE,rE=`AI_InvalidMessageRoleError`,iE=`vercel.ai.error.${rE}`,aE=Symbol.for(iE),sE=class extends Yr{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:rE,message:t}),this[oE]=!0,this.role=e}static isInstance(e){return Yr.hasMarker(e,iE)}},oE=aE,cE=`AI_MessageConversionError`,`${cE}`,lE=`AI_RetryError`,uE=`vercel.ai.error.${lE}`,dE=Symbol.for(uE),pE=class extends Yr{constructor({message:e,reason:t,errors:n}){super({name:lE,message:e}),this[fE]=!0,this.reason=t,this.errors=n,this.lastError=n[n.length-1]}static isInstance(e){return Yr.hasMarker(e,uE)}},fE=dE,mE=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,hE=!1,gE=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}hE||(hE=!0,console.info(mE));for(let t of e.warnings){let n=sw({warning:t,provider:e.provider,model:e.model});typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(n,{type:t.type===`deprecated`?`DeprecationWarning`:`Warning`}):console.warn(n)}}},_E=`7.0.22`,vE=async({url:e,maxBytes:t,abortSignal:n})=>{let r=e.toString();try{let e=await fm({url:r,headers:xm({},`ai-sdk/${_E}`,ym()),abortSignal:n});if(!e.ok)throw await am(e),new og({url:r,statusCode:e.status,statusText:e.statusText});return{data:await pm({response:e,url:r,maxBytes:t??cg}),mediaType:e.headers.get(`content-type`)??void 0}}catch(e){throw og.isInstance(e)?e:new og({url:r,cause:e})}},yE=(e=vE)=>t=>Promise.all(t.map(async t=>t.isUrlSupportedByModel?null:await e(t))),bE={jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,avif:`image/avif`,heic:`image/heic`,bmp:`image/bmp`,tiff:`image/tiff`,tif:`image/tiff`,pdf:`application/pdf`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`,ogg:`audio/ogg`},xE=Du(()=>B([lu(),I(),L(),cu(),_u(I(),xE.optional()),R(xE)])),SE=_u(I(),_u(I(),xE.optional())),CE=B([I(),Mu(Uint8Array),Mu(ArrayBuffer),ku(Sm,{message:`Must be a Buffer`})]),wE=_u(I(),I()),TE=z({type:H(`text`),text:I(),providerOptions:SE.optional()}),EE=z({type:H(`image`),image:B([CE,Mu(URL),wE]),mediaType:I().optional(),providerOptions:SE.optional()}),DE=mu(`type`,[z({type:H(`data`),data:CE}),z({type:H(`url`),url:Mu(URL)}),z({type:H(`reference`),reference:wE}),z({type:H(`text`),text:I()})]),OE=mu(`type`,[z({type:H(`data`),data:CE}),z({type:H(`url`),url:Mu(URL)})]),kE=z({type:H(`file`),data:B([DE,CE,Mu(URL),wE]),filename:I().optional(),mediaType:I(),providerOptions:SE.optional()}),AE=z({type:H(`reasoning`),text:I(),providerOptions:SE.optional()}),jE=z({type:H(`custom`),kind:I().transform(e=>e),providerOptions:SE.optional()}),ME=z({type:H(`reasoning-file`),data:B([OE,CE,Mu(URL)]),mediaType:I(),providerOptions:SE.optional()}),NE=z({type:H(`tool-call`),toolCallId:I(),toolName:I(),input:du(),providerOptions:SE.optional(),providerExecuted:cu().optional()}),PE=mu(`type`,[z({type:H(`text`),value:I(),providerOptions:SE.optional()}),z({type:H(`json`),value:xE,providerOptions:SE.optional()}),z({type:H(`execution-denied`),reason:I().optional(),providerOptions:SE.optional()}),z({type:H(`error-text`),value:I(),providerOptions:SE.optional()}),z({type:H(`error-json`),value:xE,providerOptions:SE.optional()}),z({type:H(`content`),value:R(B([z({type:H(`text`),text:I(),providerOptions:SE.optional()}),z({type:H(`file`),data:DE,mediaType:I(),filename:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-data`),data:I(),mediaType:I(),filename:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-url`),url:I(),mediaType:I().optional(),providerOptions:SE.optional()}),z({type:H(`file-id`),fileId:B([I(),_u(I(),I())]),providerOptions:SE.optional()}),z({type:H(`file-reference`),providerReference:_u(I(),I()),providerOptions:SE.optional()}),z({type:H(`image-data`),data:I(),mediaType:I(),providerOptions:SE.optional()}),z({type:H(`image-url`),url:I(),providerOptions:SE.optional()}),z({type:H(`image-file-id`),fileId:B([I(),_u(I(),I())]),providerOptions:SE.optional()}),z({type:H(`image-file-reference`),providerReference:_u(I(),I()),providerOptions:SE.optional()}),z({type:H(`custom`),providerOptions:SE.optional()})]))})]),FE=z({type:H(`tool-result`),toolCallId:I(),toolName:I(),output:PE,providerOptions:SE.optional()}),IE=z({type:H(`tool-approval-request`),approvalId:I(),toolCallId:I()}),LE=z({type:H(`tool-approval-response`),approvalId:I(),approved:cu(),reason:I().optional()}),RE=z({role:H(`system`),content:I(),providerOptions:SE.optional()}),zE=z({role:H(`user`),content:B([I(),R(B([TE,EE,kE]))]),providerOptions:SE.optional()}),BE=z({role:H(`assistant`),content:B([I(),R(B([TE,jE,kE,AE,ME,NE,FE,IE]))]),providerOptions:SE.optional()}),VE=z({role:H(`tool`),content:R(B([FE,LE])),providerOptions:SE.optional()}),HE=B([RE,zE,BE,VE]),UE=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:n=2,abortSignal:r}={})=>Wg({maxRetries:e,initialDelayInMs:t,backoffFactor:n,abortSignal:r,shouldRetry:e=>e instanceof Error&&(ti.isInstance(e)&&e.isRetryable===!0||cS.isInstance(e)&&e.isRetryable===!0),getDelayInMs:({error:e,exponentialBackoffDelay:t})=>Jw({error:e,exponentialBackoffDelay:t}),createRetryError:({message:e,reason:t,errors:n})=>new pE({message:e,reason:t,errors:n})}),WE={},ST(WE,{array:()=>qE,choice:()=>JE,json:()=>YE,object:()=>KE,text:()=>GE}),GE=()=>({name:`text`,responseFormat:Promise.resolve({type:`text`}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),KE=({schema:e,name:t,description:n})=>{let r=yh(e);return{name:`object`,responseFormat:Ph(r.jsonSchema).then(e=>({type:`json`,schema:e,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=await Th({value:n.value,schema:r});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return i.value},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return{partial:t.value}}},createElementStreamTransform(){}}},qE=({element:e,name:t,description:n})=>{let r=yh(e);return{name:`array`,responseFormat:Ph(r.jsonSchema).then(e=>{let{$schema:r,...i}=e;return{type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:i}},required:[`elements`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let i=n.value;if(typeof i!=`object`||!i||!(`elements`in i)||!Array.isArray(i.elements))throw new UT({message:`No object generated: response did not match schema.`,cause:new la({value:i,cause:`response must be an object with an elements array`}),text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});let a=[];for(let n of i.elements){let i=await Th({value:n,schema:r});if(!i.success)throw new UT({message:`No object generated: response did not match schema.`,cause:i.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});a.push(i.value)}return a},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let e=t.value;if(typeof e!=`object`||!e||!(`elements`in e)||!Array.isArray(e.elements))return;let n=t.state===`repaired-parse`&&e.elements.length>0?e.elements.slice(0,-1):e.elements,i=[];for(let e of n){let t=await Th({value:e,schema:r});t.success&&i.push(t.value)}return{partial:i}}}},createElementStreamTransform(){let e=0;return new TransformStream({transform({partialOutput:t},n){if(t!=null)for(;e<t.length;e++)n.enqueue(t[e])}})}}},JE=({options:e,name:t,description:n})=>({name:`choice`,responseFormat:Promise.resolve({type:`json`,schema:{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:t},n){let r=await Dh({text:t});if(!r.success)throw new UT({message:`No object generated: could not parse the response.`,cause:r.error,text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});let i=r.value;if(typeof i!=`object`||!i||!(`result`in i)||typeof i.result!=`string`||!e.includes(i.result))throw new UT({message:`No object generated: response did not match schema.`,cause:new la({value:i,cause:`response must be an object that contains a choice value.`}),text:t,response:n.response,usage:n.usage,finishReason:n.finishReason});return i.result},async parsePartialOutput({text:t}){let n=await Zw(t);switch(n.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:{let t=n.value;if(typeof t!=`object`||!t||!(`result`in t)||typeof t.result!=`string`)return;let r=e.filter(e=>e.startsWith(t.result));return n.state===`successful-parse`?r.includes(t.result)?{partial:t.result}:void 0:r.length===1?{partial:r[0]}:void 0}}},createElementStreamTransform(){}}),YE=({name:e,description:t}={})=>({name:`json`,responseFormat:Promise.resolve({type:`json`,...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:e},t){let n=await Dh({text:e});if(!n.success)throw new UT({message:`No object generated: could not parse the response.`,cause:n.error,text:e,response:t.response,usage:t.usage,finishReason:t.finishReason});return n.value},async parsePartialOutput({text:e}){let t=await Zw(e);switch(t.state){case`failed-parse`:case`undefined-input`:return;case`repaired-parse`:case`successful-parse`:return t.value===void 0?void 0:{partial:t.value}}},createElementStreamTransform(){}}),XE=`ai:telemetry`,new TextEncoder,new TextEncoder,lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),TransformStream,_u(I(),xE.optional()),lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),lg({prefix:`aitxt`,size:24}),lg({prefix:`call`,size:24}),_u(I(),xE.optional()),_u(I(),I()),lg({prefix:`call`,size:24}),lg({prefix:`call`,size:24}),QE={type:`no-schema`,jsonSchema:async()=>void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new UT({message:`No object generated: response did not match schema.`,text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new ha({functionality:`element streams in no-schema mode`})}},$E=e=>({type:`object`,jsonSchema:async()=>await e.jsonSchema,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(t){return Th({value:t,schema:e})},createElementStream(){throw new ha({functionality:`element streams in object mode`})}}),eD=e=>({type:`array`,jsonSchema:async()=>{let{$schema:t,...n}=await e.jsonSchema;return{$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{elements:{type:`array`,items:n}},required:[`elements`],additionalProperties:!1}},async validatePartialResult({value:t,latestObject:n,isFirstDelta:r,isFinalDelta:i}){if(!Wr(t)||!Ur(t.elements))return{success:!1,error:new la({value:t,cause:`value must be an object that contains an array of elements`})};let a=t.elements,o=[];for(let t=0;t<a.length;t++){let n=a[t],r=await Th({value:n,schema:e});if(!(t===a.length-1&&!i)){if(!r.success)return r;o.push(r.value)}}let s=n?.length??0,c=``;return r&&(c+=`[`),s>0&&(c+=`,`),c+=o.slice(s).map(e=>JSON.stringify(e)).join(`,`),i&&(c+=`]`),{success:!0,value:{partial:o,textDelta:c}}},async validateFinalResult(t){if(!Wr(t)||!Ur(t.elements))return{success:!1,error:new la({value:t,cause:`value must be an object that contains an array of elements`})};let n=t.elements,r=[];for(let t of n){let n=await Th({value:t,schema:e});if(!n.success)return n;r.push(n.value)}return{success:!0,value:r}},createElementStream(e){let t=0;return dT(e.pipeThrough(new TransformStream({transform(e,n){switch(e.type){case`object`:{let r=e.object;for(;t<r.length;t++)n.enqueue(r[t]);break}case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}}),tD=e=>({type:`enum`,jsonSchema:async()=>({$schema:`http://json-schema.org/draft-07/schema#`,type:`object`,properties:{result:{type:`string`,enum:e}},required:[`result`],additionalProperties:!1}),async validateFinalResult(t){if(!Wr(t)||typeof t.result!=`string`)return{success:!1,error:new la({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let n=t.result;return e.includes(n)?{success:!0,value:n}:{success:!1,error:new la({value:t,cause:`value must be a string in the enum`})}},async validatePartialResult({value:t,textDelta:n}){if(!Wr(t)||typeof t.result!=`string`)return{success:!1,error:new la({value:t,cause:`value must be an object that contains a string in the "result" property.`})};let r=t.result,i=e.filter(e=>e.startsWith(r));return t.result.length===0||i.length===0?{success:!1,error:new la({value:t,cause:`value must be a string in the enum`})}:{success:!0,value:{partial:i.length>1?r:i[0],textDelta:n}}},createElementStream(){throw new ha({functionality:`element streams in enum mode`})}}),lg({prefix:`aiobj`,size:24}),nD=lg({prefix:`aiobj`,size:24}),rD=class{constructor({model:e,headers:t,telemetry:n,settings:r,maxRetries:i,abortSignal:a,outputStrategy:o,instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d,schemaName:f,schemaDescription:p,providerOptions:m,repairText:h,onStart:g,onStepStart:_,onStepFinish:v,onError:y,onFinish:b,download:x,generateId:S,currentDate:C,now:w}){this._object=new Jh,this._usage=new Jh,this._providerMetadata=new Jh,this._warnings=new Jh,this._request=new Jh,this._response=new Jh,this._finishReason=new Jh;let T=Tw(e),{maxRetries:E,retry:D}=Yw({maxRetries:i,abortSignal:a}),O=Bw(r),k=oT({telemetry:n}),ee=this,te=mT(),A=new TransformStream({transform(e,t){t.enqueue(e),e.type===`error`&&y({error:Hw(e.error)})}});this.baseStream=te.stream.pipeThrough(A);let ne=S();(async()=>{let e=await o.jsonSchema();await qw({event:{callId:ne,operationId:`ai.streamObject`,provider:T.provider,modelId:T.modelId,system:s??c,prompt:l,messages:u,maxOutputTokens:O.maxOutputTokens,temperature:O.temperature,topP:O.topP,topK:O.topK,presencePenalty:O.presencePenalty,frequencyPenalty:O.frequencyPenalty,seed:O.seed,maxRetries:E,headers:t,providerOptions:m,output:o.type,schema:e,schemaName:f,schemaDescription:p},callbacks:[g,k.onStart]});let n=await Vw({instructions:s,system:c,prompt:l,messages:u,allowSystemInMessages:d}),i={responseFormat:{type:`json`,schema:e,name:f,description:p},...Bw(r),prompt:await Mw({prompt:n,supportedUrls:await T.supportedUrls,download:x,provider:T.provider.split(`.`)[0]}),providerOptions:m,abortSignal:a,headers:t,includeRawChunks:!1};await qw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,providerOptions:m,headers:t,promptMessages:i.prompt},callbacks:[_,k.onObjectStepStart]});let y={transform:(e,t)=>{switch(e.type){case`text-delta`:t.enqueue(e.delta);break;case`response-metadata`:case`finish`:case`error`:case`stream-start`:t.enqueue(e);break}}},A=w(),{stream:re,response:ie,request:ae}=await D(()=>T.doStream(i));ee._request.resolve(ae??{});let oe,se=Ww(),ce,le,ue,de,fe,pe=``,me=``,he={id:S(),timestamp:C(),modelId:T.modelId},ge,_e,ve=!0,ye=!0,be=re.pipeThrough(new TransformStream(y)).pipeThrough(new TransformStream({async transform(e,t){if(typeof e==`object`&&e.type===`stream-start`){oe=e.warnings;return}if(ve&&=(fe=w()-A,!1),typeof e==`string`){pe+=e,me+=e;let{value:n,state:r}=await Zw(pe);if(n!==void 0&&!yT(ge,n)){let e=await o.validatePartialResult({value:n,textDelta:me,latestObject:_e,isFirstDelta:ye,isFinalDelta:r===`successful-parse`});e.success&&!yT(_e,e.value.partial)&&(ge=n,_e=e.value.partial,t.enqueue({type:`object`,object:_e}),t.enqueue({type:`text-delta`,textDelta:e.value.textDelta}),me=``,ye=!1)}return}switch(e.type){case`response-metadata`:he={id:e.id??he.id,timestamp:e.timestamp??he.timestamp,modelId:e.modelId??he.modelId};break;case`finish`:me!==``&&t.enqueue({type:`text-delta`,textDelta:me}),ce=e.finishReason.unified,se=Uw(e.usage),le=e.providerMetadata,t.enqueue({...e,finishReason:e.finishReason.unified,usage:se,response:he}),gE({warnings:oe??[],provider:T.provider,model:T.modelId}),ee._usage.resolve(se),ee._providerMetadata.resolve(le),ee._warnings.resolve(oe),ee._response.resolve({...he,headers:ie?.headers}),ee._finishReason.resolve(ce??`other`);try{ue=await _T(pe,o,h,{response:he,usage:se,finishReason:ce}),ee._object.resolve(ue)}catch(e){de=e,ee._object.reject(e)}break;default:t.enqueue(e);break}},async flush(e){try{let e=se??{promptTokens:NaN,completionTokens:NaN,totalTokens:NaN};await qw({event:{callId:ne,stepNumber:0,provider:T.provider,modelId:T.modelId,finishReason:ce??`other`,usage:e,objectText:pe,msToFirstChunk:fe,reasoning:void 0,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[v,k.onObjectStepEnd]}),await qw({event:{callId:ne,object:ue,error:de,reasoning:void 0,finishReason:ce??`other`,usage:e,warnings:oe,request:ae??{},response:{...he,headers:ie?.headers},providerMetadata:le},callbacks:[b,k.onEnd]})}catch(t){e.enqueue({type:`error`,error:t})}}}));te.addStream(be)})().catch(async e=>{await k.onError?.call(k,{callId:ne,error:e}),te.addStream(new ReadableStream({start(t){t.enqueue({type:`error`,error:e}),t.close()}}))}).finally(()=>{te.close()}),this.outputStrategy=o}get object(){return this._object.promise}get usage(){return this._usage.promise}get providerMetadata(){return this._providerMetadata.promise}get warnings(){return this._warnings.promise}get request(){return this._request.promise}get response(){return this._response.promise}get finishReason(){return this._finishReason.promise}get partialObjectStream(){return dT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`object`:t.enqueue(e.object);break;case`text-delta`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get elementStream(){return this.outputStrategy.createElementStream(this.baseStream)}get textStream(){return dT(this.baseStream.pipeThrough(new TransformStream({transform(e,t){switch(e.type){case`text-delta`:t.enqueue(e.textDelta);break;case`object`:case`finish`:case`error`:break;default:throw Error(`Unsupported chunk type: ${e}`)}}})))}get fullStream(){return dT(this.baseStream)}pipeTextStreamToResponse(e,t){uT({response:e,stream:this.textStream,...t})}toTextStreamResponse(e){return cT({stream:this.textStream,...e})}},iD=`AI_NoSuchProviderError`,`${iD}`,lg({prefix:`call`,size:24})})),oD=t((()=>{Op(),Op()})),sD,cD=t((()=>{oD(),sD=Ep({title:Cp().describe(`Concise, specific issue title. Imperative or descriptive, no trailing period.`),description:Cp().describe(`Issue body in Linear markdown: a short problem summary and relevant context. Do NOT include repro steps, expected/actual, or source location — those are separate fields.`),reproSteps:Tp(Cp()).describe(`Ordered reproduction steps, each a single action.`),expected:Cp().describe(`Expected behavior, one or two sentences.`),actual:Cp().describe(`Actual (buggy) behavior, one or two sentences.`),impact:Cp().describe(`Who/what is affected and how badly, 1-2 sentences (e.g. "Cosmetic/UX polish issue — doesn't block anything but feels glitchy.").`),analysisNotes:Cp().describe(`Markdown bullet list ("- …") of likely root-cause analysis based on the source context. Empty string when there is nothing substantive to say.`),suggestedNextSteps:Cp().describe(`Markdown bullet list of concrete, actionable fix suggestions the coding agent should consider first.`),priority:wp().int().min(0).max(4).describe(`Linear priority: 0 none, 1 urgent, 2 high, 3 medium, 4 low.`),suggestedLabels:Tp(Cp()).describe(`0-3 suggested label names, e.g. "Bug", "UI".`)})}));function lD(e){let t=[e.issueTemplate?.trim()||hD],n=(e.skillPaths??``).split(`
84
84
  `).map(e=>e.trim()).filter(Boolean);if(n.length&&t.push(`**Project skills & memory — MANDATORY reading before implementing.** This repo ships maintained skills/memory files. Read each of these paths in your checkout and treat their guidance as authoritative for design, style, and architectural decisions:\n${n.map(e=>`- \`${e}\``).join(`
85
85
  `)}`),e.githubAssetsRepo?.trim()){let n=e.githubAssetsRepo.trim(),r=e.githubToken?.trim()?` Your environment's git identity may lack push access to this repo — use this fine-grained token (scoped to the assets repo only): \`${e.githubToken.trim()}\`. Push via \`https://x-access-token:<token>@github.com/${n}.git\` or \`gh api\` with it.`:``;t.push(`**Demo media hosting:** commit demo GIFs/videos to the PUBLIC assets repo \`${n}\` under \`linear-grab/\` (clone it or use \`gh api\`), and embed the raw.githubusercontent.com URL in BOTH the Linear comment and the PR body. Prefer GIF for short demos — it renders inline everywhere (Linear, GitHub, the panel); Linear-hosted uploads do NOT render on GitHub.${r}`)}e.shareLinearKey&&e.linearApiKey?.trim()&&t.push(`**Linear access — close out this issue YOURSELF via the raw GraphQL API** (do not rely on a Linear MCP; it is not authenticated in your environment):
86
86
  - Endpoint: \`POST https://api.linear.app/graphql\` with headers \`Authorization: ${e.linearApiKey.trim()}\` and \`Content-Type: application/json\`.
@@ -117,7 +117,7 @@ Summary (description field) → Steps to Reproduce (reproSteps) → Expected Beh
117
117
  (analysisNotes, markdown bullets grounded in the provided source context) →
118
118
  Suggested Next Steps (suggestedNextSteps, markdown bullets with concrete fixes).
119
119
  The Summary is a short plain-prose paragraph — no headings inside it, no repetition
120
- of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Live render telemetry (react-scan → linear-grab bridge): if `.lineargrab/scan.ndjson` exists in the repo, it holds the user's REAL interaction slowdowns — component render counts, self-times, change causes (`prop:x`/`state:i`/`context:y`), and interaction latencies, newest last. `curl -s http://127.0.0.1:4577/scan/report` returns an aggregated view. For any re-render/performance issue: read it BEFORE fixing (the evidence) and AFTER (the proof), and cite before→after numbers in your closeout.\n- Keep going until the code works and you're happy with the implementation.\n- MANDATORY COMPLETION GATE — the task is NOT complete (and you may not call it complete) until every step below is done, in order. Skipping any step silently is a FAILED task:\n 1. RUN the app and TEST your change hands-on (computer use / a real browser against the running app). Code reading alone does not count as verification.\n 2. RECORD a demo video or GIF showing the fix working (before → after where possible). If your environment genuinely cannot record media, capture before/after screenshots instead AND state explicitly in your closeout comment why video was not possible — never just omit the demo.\n 3. Open the PR, babysit it for the first set of review comments, and address them. If the repo has preview deployments (e.g. Vercel), wait for the preview to go green and include its URL — deep-linked to the changed page — in the PR body, the Linear closeout, and the announcement.\n 4. CLOSE OUT THE LINEAR ISSUE: post a completion comment (one-line fix summary + PR link), attach the demo media to the ISSUE itself (not only the PR), and move the issue to its review/done state."})),_D=r({describeAiError:()=>bD,executeDraft:()=>vD});async function vD(e,t,n){let r=await jx(e.tier);try{return await yD(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await Mx(r.provider,e.tier);if(!a)throw Error(bD(i));try{return await yD(a,e,t,n,!0)}catch(e){throw Error(bD(e))}}}async function yD(e,t,n,r,i){let a=bT({model:e.model,schema:sD,system:mD,prompt:dD(t),abortSignal:r});for await(let e of a.partialObjectStream)n(e);return{draft:await a.object,provider:e.provider,modelId:e.modelId,fellBack:i}}function bD(e){let t=e instanceof Error?e.message:String(e);return/401|unauthorized|invalid.*key/i.test(t)?`AI provider rejected the API key.`:/429|rate/i.test(t)?`AI provider rate limit hit — try again shortly.`:`Draft failed: ${t}`}var xD=t((()=>{aD(),cD(),gD(),Fx()}));Sr(),Fx();function SD(e,t){return xr?CD(e,t):wD(e,t)}function CD(e,t){let n=chrome.runtime.connect({name:`ai-draft`}),r=!1;return n.onMessage.addListener(e=>{e.type===`partial`?t.onPartial(e.draft):e.type===`done`?(r=!0,t.onDone(e),n.disconnect()):e.type===`error`&&(r=!0,t.onError(e.message,e.code===`no-provider`?`no-provider`:`unknown`),n.disconnect())}),n.onDisconnect.addListener(()=>{r||t.onError(`Draft stream disconnected.`)}),n.postMessage({type:`start`,input:e}),()=>{try{n.disconnect()}catch{}}}function wD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(xD(),_D));try{let i=await r(e,t.onPartial,n.signal);n.signal.aborted||t.onDone(i)}catch(e){if(n.signal.aborted)return;t.onError(e instanceof Error?e.message:String(e),e instanceof Px?`no-provider`:`unknown`)}})(),()=>n.abort()}var TD=n((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>te,applyPalette:()=>S,default:()=>le,nearestColor:()=>O,nearestColorIndex:()=>E,nearestColorIndexWithDistance:()=>D,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],ee=0;for(let e=f;e<65536;e*=2)++ee;ee=8-ee,c.writeByte(p),D(x);let E=n.length;for(let e=1;e<E;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<ee^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}D(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,D(x))}return D(T),D(S),c.writeByte(0),c.bytesView();function D(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var ee=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=ee));w=T)y[w]=C;y[w]=x}var E=b-t;for(x=0;x<E;){for(var D;;){var O=y[1];if(D=d[O],D.tm>=D.mtm&&d[D.nn].mtm<=D.tm)break;D.mtm==_?O=y[1]=y[y[0]--]:(m(d,O,!1),D.tm=x);var ee=d[O].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(ee<=d[C=y[T]].err));w=T)y[w]=C;y[w]=O}var te=d[D.nn],k=D.cnt,A=te.cnt,S=1/(k+A);u&&(D.ac=S*(k*D.ac+A*te.ac)),D.rc=S*(k*D.rc+A*te.rc),D.gc=S*(k*D.gc+A*te.gc),D.bc=S*(k*D.bc+A*te.bc),D.cnt+=te.cnt,D.mtm=++x,d[te.bk].fw=te.fw,d[te.fw].bk=te.bk,te.mtm=_}let ne=[];var re=0;for(x=0;;++re){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(ne,c)||ne.push(c),(x=d[x].fw)==0)break}return ne}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=ee(l-r);if(u>o)continue;let d=c[0];if(u+=ee(d-e),u>o)continue;let f=c[1];if(u+=ee(f-t),u>o)continue;let p=c[2];u+=ee(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=ee(c-e);if(l>a)continue;let u=s[1];if(l+=ee(u-t),l>a)continue;let d=s[2];l+=ee(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=D(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function ee(e){return e*e}function E(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function O(e,t,n=y){return e[E(e,t,n)]}function te(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);A(a,t,n,m,g),re(a,m),h>=0&&ne(a,h)}let y=Math.round(p/10);k(a,_,y,o,f);let b=!!m&&!v;ie(a,t,n,b?m:null),b&&re(a,m),ae(a,e,t,n,g,s,c,l)}};function d(){se(a,`GIF89a`)}}function k(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),oe(e,n),e.writeByte(i||0),e.writeByte(0)}function A(e,t,n,r,i=8){let a=ce(r.length)-1,o=i-1<<4|128|a;oe(e,t),oe(e,n),e.writeBytes([o,0,0])}function ne(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),se(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),oe(e,t),e.writeByte(0)}function re(e,t){let n=1<<ce(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function ie(e,t,n,r){if(e.writeByte(44),oe(e,0),oe(e,0),oe(e,t),oe(e,n),r){let t=ce(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function ae(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function oe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function se(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function ce(e){return Math.max(Math.ceil(Math.log2(e)),1)}var le=te}))(),ED="(function(){var e=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>A,applyPalette:()=>S,default:()=>B,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var A=d[O.nn],j=O.cnt,M=A.cnt,S=1/(j+M);u&&(O.ac=S*(j*O.ac+M*A.ac)),O.rc=S*(j*O.rc+M*A.rc),O.gc=S*(j*O.gc+M*A.gc),O.bc=S*(j*O.bc+M*A.bc),O.cnt+=A.cnt,O.mtm=++x,d[A.bk].fw=A.fw,d[A.fw].bk=A.bk,A.mtm=_}let N=[];var P=0;for(x=0;;++P){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(N,c)||N.push(c),(x=d[x].fw)==0)break}return N}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function A(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);M(a,t,n,m,g),P(a,m),h>=0&&N(a,h)}let y=Math.round(p/10);j(a,_,y,o,f);let b=!!m&&!v;F(a,t,n,b?m:null),b&&P(a,m),I(a,e,t,n,g,s,c,l)}};function d(){R(a,`GIF89a`)}}function j(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),L(e,n),e.writeByte(i||0),e.writeByte(0)}function M(e,t,n,r,i=8){let a=z(r.length)-1,o=i-1<<4|128|a;L(e,t),L(e,n),e.writeBytes([o,0,0])}function N(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),R(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),L(e,t),e.writeByte(0)}function P(e,t){let n=1<<z(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function F(e,t,n,r){if(e.writeByte(44),L(e,0),L(e,0),L(e,t),L(e,n),r){let t=z(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function I(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function L(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function R(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function z(e){return Math.max(Math.ceil(Math.log2(e)),1)}var B=A}))();let t=null,n=!0;self.onmessage=e=>{r(e.data).catch(t=>{e.data?.id!=null&&self.postMessage({id:e.data.id,type:`error`,message:t instanceof Error?t.message:String(t)})})};async function r(r){let a=(e,t=[])=>self.postMessage({id:r.id,...e},t);switch(r.type){case`encode-png`:{let e=r.bitmap,t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`OffscreenCanvas 2d unavailable`);n.drawImage(e,0,0),e.close();let o=await t.convertToBlob({type:`image/png`});o.size>18e5&&(o=await t.convertToBlob({type:`image/jpeg`,quality:.85})),a({type:`png`,dataUrl:await i(o)});return}case`gif-init`:t=(0,e.GIFEncoder)(),n=!0,a({type:`ok`});return;case`gif-frame`:{if(!t)return;let i=new Uint8ClampedArray(r.buffer),a=(0,e.quantize)(i,256,{format:`rgb565`}),o=(0,e.applyPalette)(i,a,`rgb565`);t.writeFrame(o,r.width,r.height,{palette:a,delay:r.delay,first:n,repeat:0}),n=!1;return}case`gif-finish`:{if(!t)throw Error(`No active GIF session`);t.finish();let e=t.bytes();t=null,a({type:`gif`,buffer:e.buffer},[e.buffer]);return}case`gif-abort`:t=null;return}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}})();",DD=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ED],{type:`text/javascript;charset=utf-8`});function OD(e){let t;try{if(t=DD&&(self.URL||self.webkitURL).createObjectURL(DD),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ED),{name:e?.name})}}var kD,AD=1,jD=new Map;function MD(){if(kD!==void 0)return kD;try{kD=new OD,kD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=jD.get(t);n&&(jD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},kD.onerror=()=>{for(let e of jD.values())e.reject(Error(`Image worker crashed`));jD.clear()}}catch{kD=null}return kD}function ND(e,t=[]){let n=MD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=AD++;return new Promise((i,a)=>{jD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function PD(e,t=[]){let n=MD();return n?(n.postMessage(e,t),!0):!1}var FD=6,ID=Math.round(1e3/FD),LD=3e4,RD=640,zD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},BD=new Set;function VD(e){zD={...zD,...e};for(let e of BD)e(zD)}function HD(){return zD}function UD(e){return BD.add(e),()=>BD.delete(e)}var WD=null,GD=null,KD=null,qD=null,JD=null,YD=null,XD=!1,ZD=0,QD=!0;async function $D(){if(zD.phase===`recording`||zD.phase===`processing`)return;tO();try{WD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:FD},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{VD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=WD.getVideoTracks()[0];if(!e){VD({phase:`error`,error:`No video track available.`}),iO();return}e.addEventListener(`ended`,()=>void eO()),GD=document.createElement(`video`),GD.muted=!0,GD.playsInline=!0,GD.srcObject=WD,await GD.play().catch(()=>{});let t=Date.now()+3e3;for(;!GD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!GD.videoWidth){VD({phase:`error`,error:`Could not read the capture stream.`}),iO();return}let n=Math.min(1,RD/GD.videoWidth),r=Math.round(GD.videoWidth*n),i=Math.round(GD.videoHeight*n);if(KD=document.createElement(`canvas`),KD.width=r,KD.height=i,qD=KD.getContext(`2d`,{willReadFrequently:!0}),!qD){VD({phase:`error`,error:`Canvas is unavailable.`}),iO();return}XD=await ND({type:`gif-init`}).then(()=>!0,()=>!1),YD=XD?null:(0,TD.GIFEncoder)(),ZD=0,QD=!0,VD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),JD=setInterval(()=>{if(!qD||!GD||!KD)return;let e=zD.startedAt??Date.now();if(Date.now()-e>=LD){eO();return}try{qD.drawImage(GD,0,0,KD.width,KD.height);let{data:e}=qD.getImageData(0,0,KD.width,KD.height);if(XD)PD({type:`gif-frame`,buffer:e.buffer,width:KD.width,height:KD.height,delay:ID},[e.buffer]);else if(YD){let t=(0,TD.quantize)(e,256,{format:`rgb565`}),n=(0,TD.applyPalette)(e,t,`rgb565`);YD.writeFrame(n,KD.width,KD.height,{palette:t,delay:ID,first:QD,repeat:0}),QD=!1}ZD++}catch{}},ID)}async function eO(){if(zD.phase!==`recording`)return;let e=zD.startedAt??Date.now();VD({phase:`processing`}),JD&&=(clearInterval(JD),null);let t=KD?.width??0,n=KD?.height??0,r=ZD,i=YD,a=XD;if(YD=null,XD=!1,iO(),!i&&!a||r===0){VD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await ND({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});VD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){VD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function tO(){zD.result?.url&&URL.revokeObjectURL(zD.result.url),iO(),JD&&=(clearInterval(JD),null),XD&&PD({type:`gif-abort`}),XD=!1,YD=null,ZD=0,VD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function nO(e){VD({attachOnCreate:e})}function rO(e){zD.result&&VD({result:{...zD.result,assetUrl:e}})}function iO(){WD?.getTracks().forEach(e=>e.stop()),WD=null,GD&&=(GD.srcObject=null,null),KD=null,qD=null}Br();var aO=`https://api.linear.app/graphql`,oO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},sO=class extends oO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function cO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Tr(),i=r?`Bearer ${r}`:n;if(!i)throw new sO;let a=await fetch(aO,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:i},body:JSON.stringify({query:e,variables:t})}),o=await a.json().catch(()=>null);if(!a.ok)throw new oO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new oO(o.errors[0].message);if(!o?.data)throw new oO(`Empty response from Linear`);return o.data}async function lO(){return(await cO(`query { viewer { id name email } }`)).viewer}async function uO(){return(await cO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function dO(){return(await cO(`query {
120
+ of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any path that doesn't exist):\n 1. Read `CLAUDE.md` and `AGENTS.md` at the repo root — the master map of product rules, architecture, and memory/skill pointers.\n 2. Skim `.claude/memory/MEMORY.md` (the index) to learn what project memory exists; load the specific `.claude/memory/*.md` files the map names for the surface you're touching.\n 3. Load the matching `.claude/skills/<name>/SKILL.md` files before designing, building UI, or animating (if skills are symlinked, follow them into `.agents/skills/`).\n Treat all of this as authoritative — it overrides your defaults.\n- Live render telemetry (react-scan → linear-grab bridge): if `.lineargrab/scan.ndjson` exists in the repo, it holds the user's REAL interaction slowdowns — component render counts, self-times, change causes (`prop:x`/`state:i`/`context:y`), and interaction latencies, newest last. `curl -s http://127.0.0.1:4577/scan/report` returns an aggregated view. For any re-render/performance issue: read it BEFORE fixing (the evidence) and AFTER (the proof), and cite before→after numbers in your closeout.\n- Keep going until the code works and you're happy with the implementation.\n- MANDATORY COMPLETION GATE — the task is NOT complete (and you may not call it complete) until every step below is done, in order. Skipping any step silently is a FAILED task:\n 1. RUN the app and TEST your change hands-on (computer use / a real browser against the running app). Code reading alone does not count as verification.\n 2. RECORD a demo video or GIF showing the fix working (before → after where possible). If your environment genuinely cannot record media, capture before/after screenshots instead AND state explicitly in your closeout comment why video was not possible — never just omit the demo.\n 3. Open the PR, babysit it for the first set of review comments, and address them. If the repo has preview deployments (e.g. Vercel), wait for the preview to go green and include its URL — deep-linked to the changed page — in the PR body, the Linear closeout, and the announcement.\n 4. CLOSE OUT THE LINEAR ISSUE: post a completion comment (one-line fix summary + PR link), attach the demo media to the ISSUE itself (not only the PR), and move the issue to its review/done state."})),_D=r({describeAiError:()=>bD,executeDraft:()=>vD});async function vD(e,t,n){let r=await jx(e.tier);try{return await yD(r,e,t,n,!1)}catch(i){if(n.aborted)throw i;let a=await Mx(r.provider,e.tier);if(!a)throw Error(bD(i));try{return await yD(a,e,t,n,!0)}catch(e){throw Error(bD(e))}}}async function yD(e,t,n,r,i){let a=bT({model:e.model,schema:sD,system:mD,prompt:dD(t),abortSignal:r});for await(let e of a.partialObjectStream)n(e);return{draft:await a.object,provider:e.provider,modelId:e.modelId,fellBack:i}}function bD(e){let t=e instanceof Error?e.message:String(e);return/401|unauthorized|invalid.*key/i.test(t)?`AI provider rejected the API key.`:/429|rate/i.test(t)?`AI provider rate limit hit — try again shortly.`:`Draft failed: ${t}`}var xD=t((()=>{aD(),cD(),gD(),Fx()}));Sr(),Fx();function SD(e,t){return xr?CD(e,t):wD(e,t)}function CD(e,t){let n=chrome.runtime.connect({name:`ai-draft`}),r=!1;return n.onMessage.addListener(e=>{e.type===`partial`?t.onPartial(e.draft):e.type===`done`?(r=!0,t.onDone(e),n.disconnect()):e.type===`error`&&(r=!0,t.onError(e.message,e.code===`no-provider`?`no-provider`:`unknown`),n.disconnect())}),n.onDisconnect.addListener(()=>{r||t.onError(`Draft stream disconnected.`)}),n.postMessage({type:`start`,input:e}),()=>{try{n.disconnect()}catch{}}}function wD(e,t){let n=new AbortController;return(async()=>{let{executeDraft:r}=await Promise.resolve().then(()=>(xD(),_D));try{let i=await r(e,t.onPartial,n.signal);n.signal.aborted||t.onDone(i)}catch(e){if(n.signal.aborted)return;t.onError(e instanceof Error?e.message:String(e),e instanceof Px?`no-provider`:`unknown`)}})(),()=>n.abort()}var TD=n((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>ee,applyPalette:()=>S,default:()=>le,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var ee=d[O.nn],te=O.cnt,A=ee.cnt,S=1/(te+A);u&&(O.ac=S*(te*O.ac+A*ee.ac)),O.rc=S*(te*O.rc+A*ee.rc),O.gc=S*(te*O.gc+A*ee.gc),O.bc=S*(te*O.bc+A*ee.bc),O.cnt+=ee.cnt,O.mtm=++x,d[ee.bk].fw=ee.fw,d[ee.fw].bk=ee.bk,ee.mtm=_}let ne=[];var re=0;for(x=0;;++re){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(ne,c)||ne.push(c),(x=d[x].fw)==0)break}return ne}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function ee(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);A(a,t,n,m,g),re(a,m),h>=0&&ne(a,h)}let y=Math.round(p/10);te(a,_,y,o,f);let b=!!m&&!v;ie(a,t,n,b?m:null),b&&re(a,m),ae(a,e,t,n,g,s,c,l)}};function d(){se(a,`GIF89a`)}}function te(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),oe(e,n),e.writeByte(i||0),e.writeByte(0)}function A(e,t,n,r,i=8){let a=ce(r.length)-1,o=i-1<<4|128|a;oe(e,t),oe(e,n),e.writeBytes([o,0,0])}function ne(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),se(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),oe(e,t),e.writeByte(0)}function re(e,t){let n=1<<ce(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function ie(e,t,n,r){if(e.writeByte(44),oe(e,0),oe(e,0),oe(e,t),oe(e,n),r){let t=ce(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function ae(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function oe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function se(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function ce(e){return Math.max(Math.ceil(Math.log2(e)),1)}var le=ee}))(),ED="(function(){var e=((e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports))((e=>{var t=Object.defineProperty;(e=>t(e,`__esModule`,{value:!0}))(e),((e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})})(e,{GIFEncoder:()=>A,applyPalette:()=>S,default:()=>B,nearestColor:()=>k,nearestColorIndex:()=>D,nearestColorIndexWithDistance:()=>O,prequantize:()=>x,quantize:()=>_,snapColorsToPalette:()=>T});var n={signature:`GIF`,version:`89a`,trailer:59,extensionIntroducer:33,applicationExtensionLabel:255,graphicControlExtensionLabel:249,imageSeparator:44,signatureSize:3,versionSize:3,globalColorTableFlagMask:128,colorResolutionMask:112,sortFlagMask:8,globalColorTableSizeMask:7,applicationIdentifierSize:8,applicationAuthCodeSize:3,disposalMethodMask:28,userInputFlagMask:2,transparentColorFlagMask:1,localColorTableFlagMask:128,interlaceFlagMask:64,idSortFlagMask:32,localColorTableSizeMask:7};function r(e=256){let t=0,n=new Uint8Array(e);return{get buffer(){return n.buffer},reset(){t=0},bytesView(){return n.subarray(0,t)},bytes(){return n.slice(0,t)},writeByte(e){r(t+1),n[t]=e,t++},writeBytes(e,i=0,a=e.length){r(t+a);for(let r=0;r<a;r++)n[t++]=e[r+i]},writeBytesView(e,i=0,a=e.byteLength){r(t+a),n.set(e.subarray(i,i+a),t),t+=a}};function r(e){var r=n.length;if(r>=e)return;e=Math.max(e,r*(r<1024*1024?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));let i=n;n=new Uint8Array(e),t>0&&n.set(i.subarray(0,t),0)}}var i=12,a=5003,o=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function s(e,t,n,s,c=r(512),l=new Uint8Array(256),u=new Int32Array(a),d=new Int32Array(a)){let f=u.length,p=Math.max(2,s);l.fill(0),d.fill(0),u.fill(-1);let m=0,h=0,g=p+1,_=g,v=!1,y=_,b=(1<<y)-1,x=1<<g-1,S=x+1,C=x+2,w=0,T=n[0],E=0;for(let e=f;e<65536;e*=2)++E;E=8-E,c.writeByte(p),O(x);let D=n.length;for(let e=1;e<D;e++)next_block:{let t=n[e],r=(t<<i)+T,a=t<<E^T;if(u[a]===r){T=d[a];break next_block}let o=a===0?1:f-a;for(;u[a]>=0;)if(a-=o,a<0&&(a+=f),u[a]===r){T=d[a];break next_block}O(T),T=t,C<1<<i?(d[a]=C++,u[a]=r):(u.fill(-1),C=x+2,v=!0,O(x))}return O(T),O(S),c.writeByte(0),c.bytesView();function O(e){for(m&=o[h],h>0?m|=e<<h:m=e,h+=y;h>=8;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;if((C>b||v)&&(v?(y=_,b=(1<<y)-1,v=!1):(++y,b=y===i?1<<y:(1<<y)-1)),e==S){for(;h>0;)l[w++]=m&255,w>=254&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0),m>>=8,h-=8;w>0&&(c.writeByte(w),c.writeBytesView(l,0,w),w=0)}}}var c=s;function l(e,t,n){return e<<8&63488|t<<2&992|n>>3}function u(e,t,n,r){return e>>4|t&240|(n&240)<<4|(r&240)<<8}function d(e,t,n){return e>>4<<8|t&240|n>>4}function f(e,t,n){return e<t?t:e>n?n:e}function p(e){return e*e}function m(e,t,n){var r=0,i=1e100;let a=e[t],o=a.cnt,s=a.ac,c=a.rc,l=a.gc,u=a.bc;for(var d=a.fw;d!=0;d=e[d].fw){let t=e[d],a=t.cnt,m=o*a/(o+a);if(!(m>=i)){var f=0;n&&(f+=m*p(t.ac-s),f>=i)||(f+=m*p(t.rc-c),!(f>=i)&&(f+=m*p(t.gc-l),!(f>=i)&&(f+=m*p(t.bc-u),!(f>=i)&&(i=f,r=d))))}}a.err=i,a.nn=r}function h(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function g(e,t){let n=Array(t===`rgb444`?4096:65536),r=e.length;if(t===`rgba4444`)for(let t=0;t<r;++t){let r=e[t],i=r>>24&255,a=r>>16&255,o=r>>8&255,s=r&255,c=u(s,o,a,i),l=c in n?n[c]:n[c]=h();l.rc+=s,l.gc+=o,l.bc+=a,l.ac+=i,l.cnt++}else if(t===`rgb444`)for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=d(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}else for(let t=0;t<r;++t){let r=e[t],i=r>>16&255,a=r>>8&255,o=r&255,s=l(o,a,i),c=s in n?n[s]:n[s]=h();c.rc+=o,c.gc+=a,c.bc+=i,c.cnt++}return n}function _(e,t,n={}){let{format:r=`rgb565`,clearAlpha:i=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:s=!1}=n;if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);let c=new Uint32Array(e.buffer),l=n.useSqrt!==!1,u=r===`rgba4444`,d=g(c,r),h=d.length,_=h-1,y=new Uint32Array(h+1);for(var b=0,x=0;x<h;++x){let e=d[x];if(e!=null){var S=1/e.cnt;u&&(e.ac*=S),e.rc*=S,e.gc*=S,e.bc*=S,d[b++]=e}}p(t)/b<.022&&(l=!1);for(var x=0;x<b-1;++x)d[x].fw=x+1,d[x+1].bk=x,l&&(d[x].cnt=Math.sqrt(d[x].cnt));l&&(d[x].cnt=Math.sqrt(d[x].cnt));var C,w,T;for(x=0;x<b;++x){m(d,x,!1);var E=d[x].err;for(w=++y[0];w>1&&(T=w>>1,!(d[C=y[T]].err<=E));w=T)y[w]=C;y[w]=x}var D=b-t;for(x=0;x<D;){for(var O;;){var k=y[1];if(O=d[k],O.tm>=O.mtm&&d[O.nn].mtm<=O.tm)break;O.mtm==_?k=y[1]=y[y[0]--]:(m(d,k,!1),O.tm=x);var E=d[k].err;for(w=1;(T=w+w)<=y[0]&&(T<y[0]&&d[y[T]].err>d[y[T+1]].err&&T++,!(E<=d[C=y[T]].err));w=T)y[w]=C;y[w]=k}var A=d[O.nn],j=O.cnt,M=A.cnt,S=1/(j+M);u&&(O.ac=S*(j*O.ac+M*A.ac)),O.rc=S*(j*O.rc+M*A.rc),O.gc=S*(j*O.gc+M*A.gc),O.bc=S*(j*O.bc+M*A.bc),O.cnt+=A.cnt,O.mtm=++x,d[A.bk].fw=A.fw,d[A.fw].bk=A.bk,A.mtm=_}let N=[];var P=0;for(x=0;;++P){let e=f(Math.round(d[x].rc),0,255),t=f(Math.round(d[x].gc),0,255),n=f(Math.round(d[x].bc),0,255),r=255;u&&(r=f(Math.round(d[x].ac),0,255),s&&(r=r<=(typeof s==`number`?s:127)?0:255),i&&r<=o&&(e=t=n=a,r=0));let c=u?[e,t,n,r]:[e,t,n];if(v(N,c)||N.push(c),(x=d[x].fw)==0)break}return N}function v(e,t){for(let n=0;n<e.length;n++){let r=e[n],i=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(i&&a)return!0}return!1}function y(e,t){var n=0,r;for(r=0;r<e.length;r++){let i=e[r]-t[r];n+=i*i}return n}function b(e,t){return t>1?Math.round(e/t)*t:e}function x(e,{roundRGB:t=5,roundAlpha:n=10,oneBitAlpha:r=null}={}){let i=new Uint32Array(e.buffer);for(let e=0;e<i.length;e++){let a=i[e],o=a>>24&255,s=a>>16&255,c=a>>8&255,l=a&255;o=b(o,n),r&&(o=o<=(typeof r==`number`?r:127)?0:255),l=b(l,t),c=b(c,t),s=b(s,t),i[e]=o<<24|s<<16|c<<8|l<<0}}function S(e,t,n=`rgb565`){if(!e||!e.buffer||!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw Error(`quantize() expected RGBA Uint8Array data`);if(t.length>256)throw Error(`applyPalette() only works with 256 colors or less`);let r=new Uint32Array(e.buffer),i=r.length,a=n===`rgb444`?4096:65536,o=new Uint8Array(i),s=Array(a);if(n===`rgba4444`)for(let e=0;e<i;e++){let n=r[e],i=n>>24&255,a=n>>16&255,c=n>>8&255,l=n&255,d=u(l,c,a,i);o[e]=d in s?s[d]:s[d]=C(l,c,a,i,t)}else{let e=n===`rgb444`?d:l;for(let n=0;n<i;n++){let i=r[n],a=i>>16&255,c=i>>8&255,l=i&255,u=e(l,c,a);o[n]=u in s?s[u]:s[u]=w(l,c,a,t)}}return o}function C(e,t,n,r,i){let a=0,o=1e100;for(let s=0;s<i.length;s++){let c=i[s],l=c[3],u=E(l-r);if(u>o)continue;let d=c[0];if(u+=E(d-e),u>o)continue;let f=c[1];if(u+=E(f-t),u>o)continue;let p=c[2];u+=E(p-n),!(u>o)&&(o=u,a=s)}return a}function w(e,t,n,r){let i=0,a=1e100;for(let o=0;o<r.length;o++){let s=r[o],c=s[0],l=E(c-e);if(l>a)continue;let u=s[1];if(l+=E(u-t),l>a)continue;let d=s[2];l+=E(d-n),!(l>a)&&(a=l,i=o)}return i}function T(e,t,n=5){if(!e.length||!t.length)return;let r=e.map(e=>e.slice(0,3)),i=n*n,a=e[0].length;for(let n=0;n<t.length;n++){let o=t[n];o=o.length<a?[o[0],o[1],o[2],255]:o.length>a?o.slice(0,3):o.slice();let s=O(r,o.slice(0,3),y),c=s[0],l=s[1];l>0&&l<=i&&(e[c]=o)}}function E(e){return e*e}function D(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return i}function O(e,t,n=y){let r=1/0,i=-1;for(let a=0;a<e.length;a++){let o=e[a],s=n(t,o);s<r&&(r=s,i=a)}return[i,r]}function k(e,t,n=y){return e[D(e,t,n)]}function A(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,a=r(t),o=5003,s=new Uint8Array(256),c=new Int32Array(o),l=new Int32Array(o),u=!1;return{reset(){a.reset(),u=!1},finish(){a.writeByte(n.trailer)},bytes(){return a.bytes()},bytesView(){return a.bytesView()},get buffer(){return a.buffer},get stream(){return a},writeHeader:d,writeFrame(e,t,n,r={}){let{transparent:o=!1,transparentIndex:f=0,delay:p=0,palette:m=null,repeat:h=0,colorDepth:g=8,dispose:_=-1}=r,v=!1;if(i?u||=(v=!0,d(),!0):v=!!r.first,t=Math.max(0,Math.floor(t)),n=Math.max(0,Math.floor(n)),v){if(!m)throw Error(`First frame must include a { palette } option`);M(a,t,n,m,g),P(a,m),h>=0&&N(a,h)}let y=Math.round(p/10);j(a,_,y,o,f);let b=!!m&&!v;F(a,t,n,b?m:null),b&&P(a,m),I(a,e,t,n,g,s,c,l)}};function d(){R(a,`GIF89a`)}}function j(e,t,n,r,i){e.writeByte(33),e.writeByte(249),e.writeByte(4),i<0&&(i=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(o|0|a),L(e,n),e.writeByte(i||0),e.writeByte(0)}function M(e,t,n,r,i=8){let a=z(r.length)-1,o=i-1<<4|128|a;L(e,t),L(e,n),e.writeBytes([o,0,0])}function N(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),R(e,`NETSCAPE2.0`),e.writeByte(3),e.writeByte(1),L(e,t),e.writeByte(0)}function P(e,t){let n=1<<z(t.length);for(let r=0;r<n;r++){let n=[0,0,0];r<t.length&&(n=t[r]),e.writeByte(n[0]),e.writeByte(n[1]),e.writeByte(n[2])}}function F(e,t,n,r){if(e.writeByte(44),L(e,0),L(e,0),L(e,t),L(e,n),r){let t=z(r.length)-1;e.writeByte(128|t)}else e.writeByte(0)}function I(e,t,n,r,i=8,a,o,s){c(n,r,t,i,e,a,o,s)}function L(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function R(e,t){for(var n=0;n<t.length;n++)e.writeByte(t.charCodeAt(n))}function z(e){return Math.max(Math.ceil(Math.log2(e)),1)}var B=A}))();let t=null,n=!0;self.onmessage=e=>{r(e.data).catch(t=>{e.data?.id!=null&&self.postMessage({id:e.data.id,type:`error`,message:t instanceof Error?t.message:String(t)})})};async function r(r){let a=(e,t=[])=>self.postMessage({id:r.id,...e},t);switch(r.type){case`encode-png`:{let e=r.bitmap,t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(`OffscreenCanvas 2d unavailable`);n.drawImage(e,0,0),e.close();let o=await t.convertToBlob({type:`image/png`});o.size>18e5&&(o=await t.convertToBlob({type:`image/jpeg`,quality:.85})),a({type:`png`,dataUrl:await i(o)});return}case`gif-init`:t=(0,e.GIFEncoder)(),n=!0,a({type:`ok`});return;case`gif-frame`:{if(!t)return;let i=new Uint8ClampedArray(r.buffer),a=(0,e.quantize)(i,256,{format:`rgb565`}),o=(0,e.applyPalette)(i,a,`rgb565`);t.writeFrame(o,r.width,r.height,{palette:a,delay:r.delay,first:n,repeat:0}),n=!1;return}case`gif-finish`:{if(!t)throw Error(`No active GIF session`);t.finish();let e=t.bytes();t=null,a({type:`gif`,buffer:e.buffer},[e.buffer]);return}case`gif-abort`:t=null;return}}function i(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}})();",DD=typeof self<`u`&&self.Blob&&new Blob([`(self.URL || self.webkitURL).revokeObjectURL(self.location.href);`,ED],{type:`text/javascript;charset=utf-8`});function OD(e){let t;try{if(t=DD&&(self.URL||self.webkitURL).createObjectURL(DD),!t)throw``;let n=new Worker(t,{name:e?.name});return n.addEventListener(`error`,()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),n}catch{return new Worker(`data:text/javascript;charset=utf-8,`+encodeURIComponent(ED),{name:e?.name})}}var kD,AD=1,jD=new Map;function MD(){if(kD!==void 0)return kD;try{kD=new OD,kD.onmessage=e=>{let t=e.data?.id;if(t==null)return;let n=jD.get(t);n&&(jD.delete(t),e.data.type===`error`?n.reject(Error(e.data.message??`Worker error`)):n.resolve(e.data))},kD.onerror=()=>{for(let e of jD.values())e.reject(Error(`Image worker crashed`));jD.clear()}}catch{kD=null}return kD}function ND(e,t=[]){let n=MD();if(!n)return Promise.reject(Error(`Image worker unavailable`));let r=AD++;return new Promise((i,a)=>{jD.set(r,{resolve:i,reject:a}),n.postMessage({...e,id:r},t)})}function PD(e,t=[]){let n=MD();return n?(n.postMessage(e,t),!0):!1}var FD=6,ID=Math.round(1e3/FD),LD=3e4,RD=640,zD={phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0},BD=new Set;function VD(e){zD={...zD,...e};for(let e of BD)e(zD)}function HD(){return zD}function UD(e){return BD.add(e),()=>BD.delete(e)}var WD=null,GD=null,KD=null,qD=null,JD=null,YD=null,XD=!1,ZD=0,QD=!0;async function $D(){if(zD.phase===`recording`||zD.phase===`processing`)return;tO();try{WD=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:FD},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`,surfaceSwitching:`exclude`,monitorTypeSurfaces:`exclude`,systemAudio:`exclude`})}catch{VD({phase:`error`,error:`Screen capture was denied or cancelled.`});return}let e=WD.getVideoTracks()[0];if(!e){VD({phase:`error`,error:`No video track available.`}),iO();return}e.addEventListener(`ended`,()=>void eO()),GD=document.createElement(`video`),GD.muted=!0,GD.playsInline=!0,GD.srcObject=WD,await GD.play().catch(()=>{});let t=Date.now()+3e3;for(;!GD.videoWidth&&Date.now()<t;)await new Promise(e=>setTimeout(e,50));if(!GD.videoWidth){VD({phase:`error`,error:`Could not read the capture stream.`}),iO();return}let n=Math.min(1,RD/GD.videoWidth),r=Math.round(GD.videoWidth*n),i=Math.round(GD.videoHeight*n);if(KD=document.createElement(`canvas`),KD.width=r,KD.height=i,qD=KD.getContext(`2d`,{willReadFrequently:!0}),!qD){VD({phase:`error`,error:`Canvas is unavailable.`}),iO();return}XD=await ND({type:`gif-init`}).then(()=>!0,()=>!1),YD=XD?null:(0,TD.GIFEncoder)(),ZD=0,QD=!0,VD({phase:`recording`,startedAt:Date.now(),error:null,result:null}),JD=setInterval(()=>{if(!qD||!GD||!KD)return;let e=zD.startedAt??Date.now();if(Date.now()-e>=LD){eO();return}try{qD.drawImage(GD,0,0,KD.width,KD.height);let{data:e}=qD.getImageData(0,0,KD.width,KD.height);if(XD)PD({type:`gif-frame`,buffer:e.buffer,width:KD.width,height:KD.height,delay:ID},[e.buffer]);else if(YD){let t=(0,TD.quantize)(e,256,{format:`rgb565`}),n=(0,TD.applyPalette)(e,t,`rgb565`);YD.writeFrame(n,KD.width,KD.height,{palette:t,delay:ID,first:QD,repeat:0}),QD=!1}ZD++}catch{}},ID)}async function eO(){if(zD.phase!==`recording`)return;let e=zD.startedAt??Date.now();VD({phase:`processing`}),JD&&=(clearInterval(JD),null);let t=KD?.width??0,n=KD?.height??0,r=ZD,i=YD,a=XD;if(YD=null,XD=!1,iO(),!i&&!a||r===0){VD({phase:`error`,error:`Nothing was captured.`});return}try{let o;if(a){let e=await ND({type:`gif-finish`});o=new Uint8Array(e.buffer)}else i.finish(),o=i.bytes();let s=new Blob([o.buffer],{type:`image/gif`});VD({phase:`ready`,result:{blob:s,url:URL.createObjectURL(s),width:t,height:n,frameCount:r,durationMs:Date.now()-e}})}catch(e){VD({phase:`error`,error:e instanceof Error?e.message:`GIF encoding failed.`})}}function tO(){zD.result?.url&&URL.revokeObjectURL(zD.result.url),iO(),JD&&=(clearInterval(JD),null),XD&&PD({type:`gif-abort`}),XD=!1,YD=null,ZD=0,VD({phase:`idle`,startedAt:null,result:null,error:null,attachOnCreate:!0})}function nO(e){VD({attachOnCreate:e})}function rO(e){zD.result&&VD({result:{...zD.result,assetUrl:e}})}function iO(){WD?.getTracks().forEach(e=>e.stop()),WD=null,GD&&=(GD.srcObject=null,null),KD=null,qD=null}Br();var aO=`https://api.linear.app/graphql`,oO=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`LinearError`}},sO=class extends oO{constructor(){super(`Not connected to Linear. Add an API key or connect OAuth in Settings.`),this.name=`LinearNotConnectedError`}};async function cO(e,t){let{linearApiKey:n,linearAccessToken:r}=await Tr(),i=r?`Bearer ${r}`:n;if(!i)throw new sO;let a=await fetch(aO,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:i},body:JSON.stringify({query:e,variables:t})}),o=await a.json().catch(()=>null);if(!a.ok)throw new oO(o?.errors?.[0]?.message??`Linear request failed (${a.status})`,a.status);if(o?.errors?.length)throw new oO(o.errors[0].message);if(!o?.data)throw new oO(`Empty response from Linear`);return o.data}async function lO(){return(await cO(`query { viewer { id name email } }`)).viewer}async function uO(){return(await cO(`query { teams(first: 50) { nodes { id key name } } }`)).teams.nodes}async function dO(){return(await cO(`query {
121
121
  users(filter: { app: { eq: true } }) {
122
122
  nodes { id name displayName url active }
123
123
  }
@@ -225,12 +225,12 @@ of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any
225
225
  `).slice(-n).join(`
226
226
  `).trim();return i.length>tk&&(i=`…\n${i.slice(i.length-tk)}`),i||null}finally{clearTimeout(i)}}var ik=50,ak=[],ok=!1;function sk(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e==`object`&&e)try{return JSON.stringify(e).slice(0,400)}catch{return String(e)}return String(e)}function ck(e,t){let n=t.map(sk).join(` `).slice(0,600);n.trim()&&(ak.push({at:Date.now(),level:e,text:n}),ak.length>ik&&ak.shift())}function lk(){if(ok||typeof window>`u`)return;ok=!0;let e=console.error.bind(console);console.error=(...t)=>{ck(`error`,t),e(...t)};let t=console.warn.bind(console);console.warn=(...e)=>{ck(`warn`,e),t(...e)},window.addEventListener(`error`,e=>{ck(`error`,[`${e.message}${e.filename?` (${e.filename}:${e.lineno})`:``}`])}),window.addEventListener(`unhandledrejection`,e=>{let t=e.reason;ck(`unhandled`,[t?.stack??String(e.reason??`unhandled rejection`)])})}function uk(e=30){return ak.slice(-e)}function dk(e=30){let t=uk(e);if(!t.length)return null;let n=t.map(e=>`[${new Date(e.at).toTimeString().slice(0,8)}] ${e.level.toUpperCase()}: ${e.text}`).join(`
227
227
  `);return n.length>8e3&&(n=`…\n${n.slice(n.length-8e3)}`),n}function fk(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}var pk=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function mk(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var hk=null;function gk(e={}){return hk||(e.includeStyleProperties?(hk=e.includeStyleProperties,hk):(hk=mk(window.getComputedStyle(document.documentElement)),hk))}function _k(e,t){let n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace(`px`,``)):0}function vk(e){let t=_k(e,`border-left-width`),n=_k(e,`border-right-width`);return e.clientWidth+t+n}function yk(e){let t=_k(e,`border-top-width`),n=_k(e,`border-bottom-width`);return e.clientHeight+t+n}function bk(e,t={}){return{width:t.width||vk(e),height:t.height||yk(e)}}function xk(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var Sk=16384;function Ck(e){(e.width>Sk||e.height>Sk)&&(e.width>Sk&&e.height>Sk?e.width>e.height?(e.height*=Sk/e.width,e.width=Sk):(e.width*=Sk/e.height,e.height=Sk):e.width>Sk?(e.height*=Sk/e.width,e.width=Sk):(e.width*=Sk/e.height,e.height=Sk))}function wk(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin=`anonymous`,r.decoding=`async`,r.src=e})}async function Tk(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Ek(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`),a=document.createElementNS(r,`foreignObject`);return i.setAttribute(`width`,`${t}`),i.setAttribute(`height`,`${n}`),i.setAttribute(`viewBox`,`0 0 ${t} ${n}`),a.setAttribute(`width`,`100%`),a.setAttribute(`height`,`100%`),a.setAttribute(`x`,`0`),a.setAttribute(`y`,`0`),a.setAttribute(`externalResourcesRequired`,`true`),i.appendChild(a),a.appendChild(e),Tk(i)}var Dk=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||Dk(n,t)};function Ok(e){let t=e.getPropertyValue(`content`);return`${e.cssText} content: '${t.replace(/'|"/g,``)}';`}function kk(e,t){return gk(t).map(t=>`${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t)?` !important`:``};`).join(` `)}function Ak(e,t,n,r){let i=`.${e}:${t}`,a=n.cssText?Ok(n):kk(n,r);return document.createTextNode(`${i}{${a}}`)}function jk(e,t,n,r){let i=window.getComputedStyle(e,n),a=i.getPropertyValue(`content`);if(a===``||a===`none`)return;let o=pk();try{t.className=`${t.className} ${o}`}catch{return}let s=document.createElement(`style`);s.appendChild(Ak(o,n,i,r)),t.appendChild(s)}function Mk(e,t,n){jk(e,t,`:before`,n),jk(e,t,`:after`,n)}var Nk=`application/font-woff`,Pk=`image/jpeg`,Fk={woff:Nk,woff2:Nk,ttf:`application/font-truetype`,eot:`application/vnd.ms-fontobject`,png:`image/png`,jpg:Pk,jpeg:Pk,gif:`image/gif`,tiff:`image/tiff`,svg:`image/svg+xml`,webp:`image/webp`};function Ik(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:``}function Lk(e){return Fk[Ik(e).toLowerCase()]||``}function Rk(e){return e.split(/,/)[1]}function zk(e){return e.search(/^(data:)/)!==-1}function Bk(e,t){return`data:${t};base64,${e}`}async function Vk(e,t,n){let r=await fetch(e,t);if(r.status===404)throw Error(`Resource "${r.url}" not found`);let i=await r.blob();return new Promise((e,t)=>{let a=new FileReader;a.onerror=t,a.onloadend=()=>{try{e(n({res:r,result:a.result}))}catch(e){t(e)}},a.readAsDataURL(i)})}var Hk={};function Uk(e,t,n){let r=e.replace(/\?.*/,``);return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,``)),t?`[${t}]${r}`:r}async function Wk(e,t,n){let r=Uk(e,t,n.includeQueryParams);if(Hk[r]!=null)return Hk[r];n.cacheBust&&(e+=(/\?/.test(e)?`&`:`?`)+new Date().getTime());let i;try{i=Bk(await Vk(e,n.fetchRequestInit,({res:e,result:n})=>(t||=e.headers.get(`Content-Type`)||``,Rk(n))),t)}catch(t){i=n.imagePlaceholder||``;let r=`Failed to fetch resource: ${e}`;t&&(r=typeof t==`string`?t:t.message),r&&console.warn(r)}return Hk[r]=i,i}async function Gk(e){let t=e.toDataURL();return t===`data:,`?e.cloneNode(!1):wk(t)}async function Kk(e,t){if(e.currentSrc){let t=document.createElement(`canvas`),n=t.getContext(`2d`);return t.width=e.clientWidth,t.height=e.clientHeight,n?.drawImage(e,0,0,t.width,t.height),wk(t.toDataURL())}let n=e.poster;return wk(await Wk(n,Lk(n),t))}async function qk(e,t){try{if(e?.contentDocument?.body)return await rA(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Jk(e,t){return Dk(e,HTMLCanvasElement)?Gk(e):Dk(e,HTMLVideoElement)?Kk(e,t):Dk(e,HTMLIFrameElement)?qk(e,t):e.cloneNode(Xk(e))}var Yk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SLOT`,Xk=e=>e.tagName!=null&&e.tagName.toUpperCase()===`SVG`;async function Zk(e,t,n){if(Xk(t))return t;let r=[];return r=Yk(e)&&e.assignedNodes?mk(e.assignedNodes()):Dk(e,HTMLIFrameElement)&&e.contentDocument?.body?mk(e.contentDocument.body.childNodes):mk((e.shadowRoot??e).childNodes),r.length===0||Dk(e,HTMLVideoElement)||await r.reduce((e,r)=>e.then(()=>rA(r,n)).then(e=>{e&&t.appendChild(e)}),Promise.resolve()),t}function Qk(e,t,n){let r=t.style;if(!r)return;let i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):gk(n).forEach(n=>{let a=i.getPropertyValue(n);n===`font-size`&&a.endsWith(`px`)&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),Dk(e,HTMLIFrameElement)&&n===`display`&&a===`inline`&&(a=`block`),n===`d`&&t.getAttribute(`d`)&&(a=`path(${t.getAttribute(`d`)})`),r.setProperty(n,a,i.getPropertyPriority(n))})}function $k(e,t){Dk(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),Dk(e,HTMLInputElement)&&t.setAttribute(`value`,e.value)}function eA(e,t){if(Dk(e,HTMLSelectElement)){let n=t,r=Array.from(n.children).find(t=>e.value===t.getAttribute(`value`));r&&r.setAttribute(`selected`,``)}}function tA(e,t,n){return Dk(t,Element)&&(Qk(e,t,n),Mk(e,t,n),$k(e,t),eA(e,t)),t}async function nA(e,t){let n=e.querySelectorAll?e.querySelectorAll(`use`):[];if(n.length===0)return e;let r={};for(let i=0;i<n.length;i++){let a=n[i].getAttribute(`xlink:href`);if(a){let n=e.querySelector(a),i=document.querySelector(a);!n&&i&&!r[a]&&(r[a]=await rA(i,t,!0))}}let i=Object.values(r);if(i.length){let t=`http://www.w3.org/1999/xhtml`,n=document.createElementNS(t,`svg`);n.setAttribute(`xmlns`,t),n.style.position=`absolute`,n.style.width=`0`,n.style.height=`0`,n.style.overflow=`hidden`,n.style.display=`none`;let r=document.createElementNS(t,`defs`);n.appendChild(r);for(let e=0;e<i.length;e++)r.appendChild(i[e]);e.appendChild(n)}return e}async function rA(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(e=>Jk(e,t)).then(n=>Zk(e,n,t)).then(n=>tA(e,n,t)).then(e=>nA(e,t))}var iA=/url\((['"]?)([^'"]+?)\1\)/g,aA=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,oA=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function sA(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,`\\$1`);return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,`g`)}function cA(e){let t=[];return e.replace(iA,(e,n,r)=>(t.push(r),e)),t.filter(e=>!zk(e))}async function lA(e,t,n,r,i){try{let a=n?fk(t,n):t,o=Lk(t),s;return s=i?Bk(await i(a),o):await Wk(a,o,r),e.replace(sA(t),`$1${s}$3`)}catch{}return e}function uA(e,{preferredFontFormat:t}){return t?e.replace(oA,e=>{for(;;){let[n,,r]=aA.exec(e)||[];if(!r)return``;if(r===t)return`src: ${n};`}}):e}function dA(e){return e.search(iA)!==-1}async function fA(e,t,n){if(!dA(e))return e;let r=uA(e,n);return cA(r).reduce((e,r)=>e.then(e=>lA(e,r,t,n)),Promise.resolve(r))}async function pA(e,t,n){let r=t.style?.getPropertyValue(e);if(r){let i=await fA(r,null,n);return t.style.setProperty(e,i,t.style.getPropertyPriority(e)),!0}return!1}async function mA(e,t){await pA(`background`,e,t)||await pA(`background-image`,e,t),await pA(`mask`,e,t)||await pA(`-webkit-mask`,e,t)||await pA(`mask-image`,e,t)||await pA(`-webkit-mask-image`,e,t)}async function hA(e,t){let n=Dk(e,HTMLImageElement);if(!(n&&!zk(e.src))&&!(Dk(e,SVGImageElement)&&!zk(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,i=await Wk(r,Lk(r),t);await new Promise((r,a)=>{e.onload=r,e.onerror=t.onImageErrorHandler?(...e)=>{try{r(t.onImageErrorHandler(...e))}catch(e){a(e)}}:a;let o=e;o.decode&&=r,o.loading===`lazy`&&(o.loading=`eager`),n?(e.srcset=``,e.src=i):e.href.baseVal=i})}async function gA(e,t){let n=mk(e.childNodes).map(e=>_A(e,t));await Promise.all(n).then(()=>e)}async function _A(e,t){Dk(e,Element)&&(await mA(e,t),await hA(e,t),await gA(e,t))}function vA(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(e=>{n[e]=r[e]}),e}var yA={};async function bA(e){let t=yA[e];return t??(t={url:e,cssText:await(await fetch(e)).text()},yA[e]=t,t)}async function xA(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,`$1`);return a.startsWith(`https://`)||(a=new URL(a,e.url).href),Vk(a,t.fetchRequestInit,({result:e})=>(n=n.replace(i,`url(${e})`),[i,e]))});return Promise.all(i).then(()=>n)}function SA(e){if(e==null)return[];let t=[],n=e.replace(/(\/\*[\s\S]*?\*\/)/gi,``),r=RegExp(`((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})`,`gi`);for(;;){let e=r.exec(n);if(e===null)break;t.push(e[0])}n=n.replace(r,``);let i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a=RegExp(`((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})`,`gi`);for(;;){let e=i.exec(n);if(e===null){if(e=a.exec(n),e===null)break;i.lastIndex=a.lastIndex}else a.lastIndex=i.lastIndex;t.push(e[0])}return t}async function CA(e,t){let n=[],r=[];return e.forEach(n=>{if(`cssRules`in n)try{mk(n.cssRules||[]).forEach((e,i)=>{if(e.type===CSSRule.IMPORT_RULE){let a=i+1,o=e.href,s=bA(o).then(e=>xA(e,t)).then(e=>SA(e).forEach(e=>{try{n.insertRule(e,e.startsWith(`@import`)?a+=1:n.cssRules.length)}catch(t){console.error(`Error inserting rule from remote css`,{rule:e,error:t})}})).catch(e=>{console.error(`Error loading remote css`,e.toString())});r.push(s)}})}catch(i){let a=e.find(e=>e.href==null)||document.styleSheets[0];n.href!=null&&r.push(bA(n.href).then(e=>xA(e,t)).then(e=>SA(e).forEach(e=>{a.insertRule(e,a.cssRules.length)})).catch(e=>{console.error(`Error loading remote stylesheet`,e)})),console.error(`Error inlining remote css file`,i)}}),Promise.all(r).then(()=>(e.forEach(e=>{if(`cssRules`in e)try{mk(e.cssRules||[]).forEach(e=>{n.push(e)})}catch(t){console.error(`Error while reading CSS rules from ${e.href}`,t)}}),n))}function wA(e){return e.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>dA(e.style.getPropertyValue(`src`)))}async function TA(e,t){if(e.ownerDocument==null)throw Error(`Provided element is not within a Document`);return wA(await CA(mk(e.ownerDocument.styleSheets),t))}function EA(e){return e.trim().replace(/["']/g,``)}function DA(e){let t=new Set;function n(e){(e.style.fontFamily||getComputedStyle(e).fontFamily).split(`,`).forEach(e=>{t.add(EA(e))}),Array.from(e.children).forEach(e=>{e instanceof HTMLElement&&n(e)})}return n(e),t}async function OA(e,t){let n=await TA(e,t),r=DA(e);return(await Promise.all(n.filter(e=>r.has(EA(e.style.fontFamily))).map(e=>{let n=e.parentStyleSheet?e.parentStyleSheet.href:null;return fA(e.cssText,n,t)}))).join(`
228
- `)}async function kA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await OA(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function AA(e,t={}){let{width:n,height:r}=bk(e,t),i=await rA(e,t,!0);return await kA(i,t),await _A(i,t),vA(i,t),await Ek(i,n,r)}async function jA(e,t={}){let{width:n,height:r}=bk(e,t),i=await wk(await AA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||xk(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||Ck(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function MA(e,t={}){return OA(e,t)}var NA=6,PA=class{last=performance.now();async tick(){performance.now()-this.last<=NA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},FA=null,IA=new Map;function LA(e){let t=IA.get(e);if(t)return t;if(!FA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),FA=e.contentDocument,!FA)return{}}let n=FA.createElement(e);FA.body.appendChild(n);let r=FA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),IA.set(e,i),i}function RA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])LA(e)}catch{}}function zA(e){if(e.id===`linear-grab-root`)return!0;let t=e.tagName?.toLowerCase()??``;return t===`overlay-canvas`||t.startsWith(`react-grab`)||t===`script`||t===`iframe`}function BA(e,t){try{let n=document.createElement(`canvas`);n.width=e.naturalWidth||e.width||1,n.height=e.naturalHeight||e.height||1,n.getContext(`2d`).drawImage(e,0,0),t.src=n.toDataURL(`image/png`)}catch{t.removeAttribute(`src`),t.setAttribute(`style`,`${t.getAttribute(`style`)??``}background:#8b8e9822;`)}}async function VA(e,t){if(zA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=LA(e.tagName.toLowerCase()),a=``;for(let e=0;e<r.length;e++){let t=r[e],n=r.getPropertyValue(t);n&&n!==i[t]&&(a+=`${t}:${n};`)}if(n.setAttribute(`style`,a),n.removeAttribute(`class`),e instanceof HTMLImageElement&&(BA(e,n),n.removeAttribute(`srcset`),n.removeAttribute(`sizes`)),(e instanceof HTMLVideoElement||e instanceof HTMLAudioElement)&&(n.removeAttribute(`src`),n.removeAttribute(`poster`)),e.tagName===`SOURCE`)return null;if(e instanceof HTMLCanvasElement)try{let t=document.createElement(`img`);return t.setAttribute(`style`,a),t.src=e.toDataURL(),t}catch{}e instanceof HTMLInputElement&&n.setAttribute(`value`,e.value),e instanceof HTMLTextAreaElement&&(n.textContent=e.value),await t.tick();for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)n.appendChild(r.cloneNode());else if(r.nodeType===Node.ELEMENT_NODE){let e=await VA(r,t);e&&n.appendChild(e)}return n}async function HA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await VA(e,new PA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=URL.createObjectURL(new Blob([o],{type:`image/svg+xml;charset=utf-8`})),c=new Image;c.decoding=`async`,c.src=s;try{await c.decode().catch(()=>{if(!c.complete||!c.naturalWidth)throw Error(`SVG rasterize failed — a subresource in the region could not load`)})}finally{URL.revokeObjectURL(s)}let l=8192,u=Math.min(window.devicePixelRatio||1,1.5,l/r,l/i),d=document.createElement(`canvas`);d.width=Math.max(1,Math.round(r*u)),d.height=Math.max(1,Math.round(i*u));let f=d.getContext(`2d`);if(!f)throw Error(`Canvas 2d unavailable`);return f.drawImage(c,0,0,d.width,d.height),d}var UA=null;function WA(e){return UA??=MA(e).catch(()=>``),UA}function GA(){`requestIdleCallback`in window?requestIdleCallback(()=>{RA(),WA(document.body)},{timeout:3e3}):setTimeout(()=>{RA(),WA(document.body)},1500)}var KA=4e3,qA=1e3;async function JA(e){try{if(await new Promise(e=>{requestAnimationFrame(()=>`requestIdleCallback`in window?requestIdleCallback(()=>e(void 0),{timeout:500}):setTimeout(e,80))}),!e.isConnected)return null;let t=QA(e),n=t.querySelectorAll(`*`).length;n>KA&&(t=e);let r;try{r=await HA(t,await WA(t))}catch{t!==e&&n>qA&&(t=e),r=await jA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await WA(t),filter:e=>{if(!(e instanceof Element))return!0;if(e.id===`linear-grab-root`)return!1;let t=e.tagName?.toLowerCase()??``;return!(t===`overlay-canvas`||t.startsWith(`react-grab`))}})}return t!==e&&$A(r,t,e),await ZA(r)}catch{return null}}async function YA(e){return Promise.race([XA(e),new Promise(e=>setTimeout(()=>{console.warn(`[linear-grab] region capture timed out after 15s`),e(null)},15e3))])}async function XA(e){try{let t=e.x+e.w/2,n=e.y+e.h/2,r=document.elementFromPoint(t,n)??document.body,i=t=>{let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.w&&n.bottom>=e.y+e.h};for(;r!==document.body&&(!i(r)||r.querySelectorAll(`*`).length<1);)r=r.parentElement??document.body;let a=await HA(r,await WA(r)),o=r.getBoundingClientRect(),s=a.width/o.width,c=a.height/o.height,l=document.createElement(`canvas`);l.width=Math.max(1,Math.round(e.w*s)),l.height=Math.max(1,Math.round(e.h*c));let u=l.getContext(`2d`);return u?(u.drawImage(a,(e.x-o.left+r.scrollLeft)*s,(e.y-o.top+r.scrollTop)*c,e.w*s,e.h*c,0,0,l.width,l.height),await ZA(l)):null}catch(e){return console.warn(`[linear-grab] region capture failed:`,e),null}}async function ZA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await ND({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return ej(e)}function QA(e){let t=window.innerWidth,n=window.innerHeight,r=t*n*1.7,i=e,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){let o=a.getBoundingClientRect();if(o.width*o.height>r||a!==e&&(a.scrollTop>0||a.scrollLeft>0)||(i=a,o.width>=t*.55&&o.height>=n*.35))break;a=a.parentElement}return i}function $A(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(!i.width||!i.height)return;let o=e.width/i.width,s=e.height/i.height,c=(a.left-i.left+t.scrollLeft)*o,l=(a.top-i.top+t.scrollTop)*s,u=a.width*o,d=a.height*s,f=Math.min(6*o,u/2,d/2);r.strokeStyle=`rgba(94, 106, 210, 0.35)`,r.lineWidth=8*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke(),r.strokeStyle=`#5e6ad2`,r.lineWidth=3*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke()}function ej(e){let t=e.toDataURL(`image/png`);return t.length<=25e5?t:e.toDataURL(`image/jpeg`,.85)}function tj(e){let[t,n]=e.split(`,`),r=t.match(/data:([^;]+)/)?.[1]??`image/png`,i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}var[nj,rj]=T(null),[ij,aj]=T(null);function oj(e,t){rj(e),aj(t??null)}function sj(){rj(null),aj(null)}var[cj,lj]=T(`capture`);function uj(e){lj(e)}var dj=N(`<span class="absolute inset-0 grid place-items-center">`),fj=N(`<button><span>`),pj=N(`<span role=status aria-label=Loading class="text-text-dim relative inline-block shrink-0">`),mj=N(`<span class="absolute top-0 left-1/2 rounded-full bg-current"style="animation:geist-spinner-fade 1.2s linear infinite;will-change:opacity">`),hj=N(`<input>`),gj=N(`<textarea>`),_j=N(`<select>`),vj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.9A3.2 3.2 0 0 1 11.5 12.5h-7Z">`),yj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><rect x=1.5 y=2.5 width=13 height=9 rx=1.5></rect><path d="M5.5 14h5M8 11.5V14">`),bj=N(`<a target=_blank rel="noopener noreferrer"><span class="min-w-0 truncate"></span><svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 11.5 11.5 4.5M5.5 4.5h6v6">`),xj=N(`<span class="text-text-faint text-[10.5px] leading-snug">`),Sj=N(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),Cj=N(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),wj=N(`<span>`),Tj=N(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),Ej=N(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),Dj=N(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),Oj={primary:`bg-accent hover:bg-accent-hover text-white border-transparent disabled:bg-surface-3 disabled:text-text-faint`,ghost:`bg-surface-2 hover:bg-surface-3 text-text border-border disabled:text-text-faint disabled:hover:bg-surface-2`,danger:`bg-danger-soft hover:bg-danger/30 text-danger border-transparent`};function kj(e){let[t,n]=He(e,[`variant`,`loading`,`children`,`class`,`disabled`,`title`]);return(()=>{var e=fj(),r=e.firstChild;return ft(e,Ve(n,{get"data-tip"(){return t.title||void 0},get"aria-label"(){return n[`aria-label`]??t.title},get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${Oj[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),P(r,()=>t.children),P(e,j(M,{get when(){return t.loading},get children(){var e=dj();return P(e,j(Aj,{})),e}}),null),E(()=>st(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function Aj(e){let t=()=>e.size??14,n=()=>Math.max(1,Math.round(t()*.09)),r=()=>Math.round(t()*.26);return(()=>{var e=pj();return P(e,j(We,{get each(){return Array.from({length:12},(e,t)=>t)},children:e=>(()=>{var i=mj();return dt(i,`transform`,`rotate(${e*30}deg)`),dt(i,`animation-delay`,`${(e-12)*.1}s`),E(e=>{var a=`${n()}px`,o=`${r()}px`,s=`-${n()/2}px`,c=`center ${t()/2}px`;return a!==e.e&&dt(i,`width`,e.e=a),o!==e.t&&dt(i,`height`,e.t=o),s!==e.a&&dt(i,`margin-left`,e.a=s),c!==e.o&&dt(i,`transform-origin`,e.o=c),e},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()})),E(n=>{var r=`${t()}px`,i=`${t()}px`;return r!==n.e&&dt(e,`width`,n.e=r),i!==n.t&&dt(e,`height`,n.t=i),n},{e:void 0,t:void 0}),e})()}function jj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=hj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function Mj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=gj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function Nj(e){let[t,n]=He(e,[`class`,`children`]);return(()=>{var e=_j();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),P(e,()=>t.children),e})()}function Pj(e){let t=e.size??11;return(()=>{var e=vj();return it(e,`width`,t),it(e,`height`,t),e})()}function Fj(e){let t=e.size??11;return(()=>{var e=yj();return it(e,`width`,t),it(e,`height`,t),e})()}function Ij(e){return(()=>{var t=bj(),n=t.firstChild;return P(n,()=>e.children),E(n=>{var r=e.href,i=e.title||void 0,a=`text-accent inline-flex min-w-0 items-center gap-1 text-[11px] underline-offset-2 hover:underline ${e.class??``}`;return r!==n.e&&it(t,`href`,n.e=r),i!==n.t&&it(t,`data-tip`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function Lj(e){return(()=>{var t=Sj(),n=t.firstChild;return P(n,()=>e.label),P(t,()=>e.children,null),P(t,j(M,{get when(){return e.hint},get children(){var t=xj();return P(t,()=>e.hint),t}}),null),t})()}function Rj(e){return(()=>{var t=Cj(),n=t.firstChild;return P(n,()=>e.title),P(t,()=>e.children,null),t})()}function zj(e){return(()=>{var t=wj();return P(t,()=>e.children),E(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0,a=e.title||void 0;return r!==n.e&&st(t,n.e=r),n.t=ut(t,i,n.t),a!==n.a&&it(t,`data-tip`,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function Bj(e){return(()=>{var t=Tj();return E(n=>dt(t,`background`,e.color)),t})()}function Vj(e){return(()=>{var t=Ej(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.title),P(r,()=>e.children),t})()}function Hj(e){return(()=>{var t=Dj();return P(t,()=>e.message),t})()}var Uj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function Wj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}Br(),Fx(),gD();var Gj=N(`<span class="truncate font-mono">`),Kj=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),qj=N(`<div class="flex flex-wrap gap-1.5"><span class="text-text-faint self-end text-[10.5px]">attached on create`),Jj=N(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),Yj=N(`<span class="inline-block min-w-[12ch] text-center">`),Xj=N(`<div class="flex justify-end">`),Zj=N(`<div class="flex flex-col gap-1.5">`),Qj=N(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),$j=N(`<div class="border-warn/40 bg-surface rounded-md border px-2.5 py-2"><p class="text-warn mb-1 text-[10.5px] font-semibold tracking-wide uppercase">Possibly related — check before creating`),eM=N(`<div class="flex flex-col gap-1">`),tM=N(`<option value>Select a team…`),nM=N(`<option value=cursor> — cloud agent`),rM=N(`<option value=local>Local Claude Code (bridge)`),iM=N(`<option value=none>No one — just create the issue`),aM=N(`<option value>Claude Code default`),oM=N(`<option value=fable>Fable 5`),sM=N(`<option value=opus>Opus`),cM=N(`<option value=sonnet>Sonnet`),lM=N(`<option value=haiku>Haiku`),uM=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Isolated worktree <span class=text-text-dim>— own branch, run agents in parallel safely`),dM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach console errors <span class="text-text-dim tabular-nums">(<!> captured)`),fM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),pM=N(`<p class="text-warn text-[11px] leading-snug">`),mM=N(`<span class="text-success text-[11px]">✓`),hM=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3"><div class="flex items-center gap-2">`),gM=N(`<div class="border-border relative overflow-hidden rounded-md border"><img alt="Pasted attachment"class="block h-16 w-16 object-cover"><button class="bg-bg/80 text-text-dim hover:text-danger absolute top-0.5 right-0.5 grid size-4 cursor-pointer place-items-center rounded text-[10px] leading-none"title=Remove aria-label="Remove pasted image">×`),_M=N(`<button>`),vM=N(`<div class="flex min-w-0 items-center gap-1.5 py-0.5"><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),yM=N(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),bM=N(`<option>`),xM=N(`<option>Loading teams…`),SM=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`),CM=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=8 height=8 rx=1.5></rect><path d="M10.5 5.5v-2a1.5 1.5 0 0 0-1.5-1.5H3.5A1.5 1.5 0 0 0 2 3.5V9a1.5 1.5 0 0 0 1.5 1.5h2">`);function wM(e){sr();let t=_r(()=>({queryKey:[`grab`],queryFn:Dr})),n=_r(()=>({queryKey:[`settings`],queryFn:Tr})),r=O(()=>n.data??{}),i=O(()=>t.data?.[0]??null),a=O(()=>!!(r().linearApiKey||r().linearAccessToken)),o=O(()=>Ax(r())),[s,c]=br(`draft:title`,``),[l,u]=br(`draft:description`,``),[d,f]=br(`draft:steps`,[]),[p,m]=br(`draft:expected`,``),[h,g]=br(`draft:actual`,``),[_,v]=br(`draft:impact`,``),[y,b]=br(`draft:analysis`,``),[x,S]=br(`draft:next-steps`,``),[C,w]=br(`draft:priority`,0),[ee,te]=T(r().defaultTeamId??``),[k,A]=T(r().defaultRepo??``),[ne,re]=br(`draft:target`,`none`),[ie,oe]=br(`draft:local-model`,``),[se,ce]=br(`draft:cloud-model`,``),[le,ue]=br(`draft:worktree`,!1),[de,fe]=T(!0),[pe,me]=T(uk().length);D(()=>{let e=setInterval(()=>me(uk().length),3e3);ae(()=>clearInterval(e))});let[he,ge]=T(``);D(()=>{let e=s().trim(),t=setTimeout(()=>ge(e.length>=8?e:``),600);ae(()=>clearTimeout(t))});let _e=_r(()=>({queryKey:[`dup-search`,he()],queryFn:()=>_O(he()),enabled:!!he()&&a(),staleTime:3e4})),[ve,ye]=br(`draft:note`,``),[be,xe]=T([]),Se=e=>{for(let t of Array.from(e.clipboardData?.items??[])){if(!t.type.startsWith(`image/`))continue;let e=t.getAsFile();if(!e||e.size>8e6)continue;let n=new FileReader;n.onload=()=>xe(e=>[...e,{id:Date.now()+Math.random(),dataUrl:n.result}].slice(-6)),n.readAsDataURL(e)}},[Ce,we]=T(`fast`),[Te,Ee]=T(!0),De=!1;D(()=>{let e=n.data;De||!e||(De=!0,te(e.defaultTeamId??``),A(e.defaultRepo??``),re(e.cursorAgentId?`cursor`:`none`))});let Oe=_r(()=>({queryKey:[`teams`],queryFn:uO,enabled:a()})),ke=O(()=>(Oe.data??[]).find(e=>e.id===ee())?.name),[Ae,je]=T(!1),Me=async()=>{let e=pD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[]}),n=`Fix this issue in the current repo. Test the change hands-on before calling it done.\n\n# ${s().trim()||`Issue`}\n\n${e}`;try{await navigator.clipboard.writeText(n),je(!0),setTimeout(()=>je(!1),1800)}catch{}},[Ne,Pe]=T(!1),[Fe,Ie]=T(null),[Le,Re]=T(null),ze=null,Be=()=>{ze?.(),ze=null};ae(Be);let Ve=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&w(e.priority)},He=async()=>{if(!o())return;Pe(!0),Ie(null),Re(null),Be();let e=r().logUrl&&Te()?await rk({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0,n=de()?dk(15):null,a=[e?`--- dev server ---\n${e}`:null,n?`--- browser console ---\n${n}`:null].filter(Boolean).join(`
228
+ `)}async function kA(e,t){let n=t.fontEmbedCSS==null?t.skipFonts?null:await OA(e,t):t.fontEmbedCSS;if(n){let t=document.createElement(`style`),r=document.createTextNode(n);t.appendChild(r),e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)}}async function AA(e,t={}){let{width:n,height:r}=bk(e,t),i=await rA(e,t,!0);return await kA(i,t),await _A(i,t),vA(i,t),await Ek(i,n,r)}async function jA(e,t={}){let{width:n,height:r}=bk(e,t),i=await wk(await AA(e,t)),a=document.createElement(`canvas`),o=a.getContext(`2d`),s=t.pixelRatio||xk(),c=t.canvasWidth||n,l=t.canvasHeight||r;return a.width=c*s,a.height=l*s,t.skipAutoScale||Ck(a),a.style.width=`${c}`,a.style.height=`${l}`,t.backgroundColor&&(o.fillStyle=t.backgroundColor,o.fillRect(0,0,a.width,a.height)),o.drawImage(i,0,0,a.width,a.height),a}async function MA(e,t={}){return OA(e,t)}var NA=6,PA=class{last=performance.now();async tick(){performance.now()-this.last<=NA||(await new Promise(e=>{`requestIdleCallback`in window?requestIdleCallback(()=>e(),{timeout:100}):setTimeout(e,0)}),this.last=performance.now())}},FA=null,IA=new Map;function LA(e){let t=IA.get(e);if(t)return t;if(!FA){let e=document.createElement(`iframe`);if(e.style.cssText=`position:absolute;width:0;height:0;border:0;visibility:hidden`,document.body.appendChild(e),FA=e.contentDocument,!FA)return{}}let n=FA.createElement(e);FA.body.appendChild(n);let r=FA.defaultView.getComputedStyle(n),i={};for(let e=0;e<r.length;e++){let t=r[e];i[t]=r.getPropertyValue(t)}return n.remove(),IA.set(e,i),i}function RA(){try{for(let e of[`div`,`span`,`p`,`a`,`button`,`img`,`ul`,`li`,`svg`])LA(e)}catch{}}function zA(e){if(e.id===`linear-grab-root`)return!0;let t=e.tagName?.toLowerCase()??``;return t===`overlay-canvas`||t.startsWith(`react-grab`)||t===`script`||t===`iframe`}function BA(e,t){try{let n=document.createElement(`canvas`);n.width=e.naturalWidth||e.width||1,n.height=e.naturalHeight||e.height||1,n.getContext(`2d`).drawImage(e,0,0),t.src=n.toDataURL(`image/png`)}catch{t.removeAttribute(`src`),t.setAttribute(`style`,`${t.getAttribute(`style`)??``}background:#8b8e9822;`)}}async function VA(e,t){if(zA(e))return null;if(e instanceof SVGSVGElement)return e.cloneNode(!0);let n=e.cloneNode(!1),r=getComputedStyle(e),i=LA(e.tagName.toLowerCase()),a=``;for(let e=0;e<r.length;e++){let t=r[e],n=r.getPropertyValue(t);n&&n!==i[t]&&(a+=`${t}:${n};`)}if(n.setAttribute(`style`,a),n.removeAttribute(`class`),e instanceof HTMLImageElement&&(BA(e,n),n.removeAttribute(`srcset`),n.removeAttribute(`sizes`)),(e instanceof HTMLVideoElement||e instanceof HTMLAudioElement)&&(n.removeAttribute(`src`),n.removeAttribute(`poster`)),e.tagName===`SOURCE`)return null;if(e instanceof HTMLCanvasElement)try{let t=document.createElement(`img`);return t.setAttribute(`style`,a),t.src=e.toDataURL(),t}catch{}e instanceof HTMLInputElement&&n.setAttribute(`value`,e.value),e instanceof HTMLTextAreaElement&&(n.textContent=e.value),await t.tick();for(let r of Array.from(e.childNodes))if(r.nodeType===Node.TEXT_NODE)n.appendChild(r.cloneNode());else if(r.nodeType===Node.ELEMENT_NODE){let e=await VA(r,t);e&&n.appendChild(e)}return n}async function HA(e,t){let n=e.getBoundingClientRect(),r=Math.max(1,Math.ceil(n.width)),i=Math.max(1,Math.ceil(n.height)),a=await VA(e,new PA);if(!a)throw Error(`Capture root was filtered`);a.style.margin=`0`;let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${i}"><style>${t}</style><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${new XMLSerializer().serializeToString(a)}</div></foreignObject></svg>`,s=URL.createObjectURL(new Blob([o],{type:`image/svg+xml;charset=utf-8`})),c=new Image;c.decoding=`async`,c.src=s;try{await c.decode().catch(()=>{if(!c.complete||!c.naturalWidth)throw Error(`SVG rasterize failed — a subresource in the region could not load`)})}finally{URL.revokeObjectURL(s)}let l=8192,u=Math.min(window.devicePixelRatio||1,1.5,l/r,l/i),d=document.createElement(`canvas`);d.width=Math.max(1,Math.round(r*u)),d.height=Math.max(1,Math.round(i*u));let f=d.getContext(`2d`);if(!f)throw Error(`Canvas 2d unavailable`);return f.drawImage(c,0,0,d.width,d.height),d}var UA=null;function WA(e){return UA??=MA(e).catch(()=>``),UA}function GA(){`requestIdleCallback`in window?requestIdleCallback(()=>{RA(),WA(document.body)},{timeout:3e3}):setTimeout(()=>{RA(),WA(document.body)},1500)}var KA=4e3,qA=1e3;async function JA(e){try{if(await new Promise(e=>{requestAnimationFrame(()=>`requestIdleCallback`in window?requestIdleCallback(()=>e(void 0),{timeout:500}):setTimeout(e,80))}),!e.isConnected)return null;let t=QA(e),n=t.querySelectorAll(`*`).length;n>KA&&(t=e);let r;try{r=await HA(t,await WA(t))}catch{t!==e&&n>qA&&(t=e),r=await jA(t,{pixelRatio:Math.min(window.devicePixelRatio||1,1.5),fontEmbedCSS:await WA(t),filter:e=>{if(!(e instanceof Element))return!0;if(e.id===`linear-grab-root`)return!1;let t=e.tagName?.toLowerCase()??``;return!(t===`overlay-canvas`||t.startsWith(`react-grab`))}})}return t!==e&&$A(r,t,e),await ZA(r)}catch{return null}}async function YA(e){return Promise.race([XA(e),new Promise(e=>setTimeout(()=>{console.warn(`[linear-grab] region capture timed out after 15s`),e(null)},15e3))])}async function XA(e){try{let t=e.x+e.w/2,n=e.y+e.h/2,r=document.elementFromPoint(t,n)??document.body,i=t=>{let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.w&&n.bottom>=e.y+e.h};for(;r!==document.body&&(!i(r)||r.querySelectorAll(`*`).length<1);)r=r.parentElement??document.body;let a=await HA(r,await WA(r)),o=r.getBoundingClientRect(),s=a.width/o.width,c=a.height/o.height,l=document.createElement(`canvas`);l.width=Math.max(1,Math.round(e.w*s)),l.height=Math.max(1,Math.round(e.h*c));let u=l.getContext(`2d`);return u?(u.drawImage(a,(e.x-o.left+r.scrollLeft)*s,(e.y-o.top+r.scrollTop)*c,e.w*s,e.h*c,0,0,l.width,l.height),await ZA(l)):null}catch(e){return console.warn(`[linear-grab] region capture failed:`,e),null}}async function ZA(e){try{if(typeof createImageBitmap==`function`&&typeof OffscreenCanvas<`u`){let t=await createImageBitmap(e);return(await ND({type:`encode-png`,bitmap:t},[t])).dataUrl}}catch{}return ej(e)}function QA(e){let t=window.innerWidth,n=window.innerHeight,r=t*n*1.7,i=e,a=e;for(;a&&a!==document.body&&a!==document.documentElement;){let o=a.getBoundingClientRect();if(o.width*o.height>r||a!==e&&(a.scrollTop>0||a.scrollLeft>0)||(i=a,o.width>=t*.55&&o.height>=n*.35))break;a=a.parentElement}return i}function $A(e,t,n){let r=e.getContext(`2d`);if(!r)return;let i=t.getBoundingClientRect(),a=n.getBoundingClientRect();if(!i.width||!i.height)return;let o=e.width/i.width,s=e.height/i.height,c=(a.left-i.left+t.scrollLeft)*o,l=(a.top-i.top+t.scrollTop)*s,u=a.width*o,d=a.height*s,f=Math.min(6*o,u/2,d/2);r.strokeStyle=`rgba(94, 106, 210, 0.35)`,r.lineWidth=8*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke(),r.strokeStyle=`#5e6ad2`,r.lineWidth=3*o,r.beginPath(),r.roundRect(c,l,u,d,f),r.stroke()}function ej(e){let t=e.toDataURL(`image/png`);return t.length<=25e5?t:e.toDataURL(`image/jpeg`,.85)}function tj(e){let[t,n]=e.split(`,`),r=t.match(/data:([^;]+)/)?.[1]??`image/png`,i=atob(n),a=new Uint8Array(i.length);for(let e=0;e<i.length;e++)a[e]=i.charCodeAt(e);return new Blob([a],{type:r})}var[nj,rj]=T(null),[ij,aj]=T(null);function oj(e,t){rj(e),aj(t??null)}function sj(){rj(null),aj(null)}var[cj,lj]=T(`capture`);function uj(e){lj(e)}var dj=N(`<span class="absolute inset-0 grid place-items-center">`),fj=N(`<button><span>`),pj=N(`<span role=status aria-label=Loading class="text-text-dim relative inline-block shrink-0">`),mj=N(`<span class="absolute top-0 left-1/2 rounded-full bg-current"style="animation:geist-spinner-fade 1.2s linear infinite;will-change:opacity">`),hj=N(`<input>`),gj=N(`<textarea>`),_j=N(`<select>`),vj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 12.5a3 3 0 0 1-.4-5.97 4 4 0 0 1 7.8-.9A3.2 3.2 0 0 1 11.5 12.5h-7Z">`),yj=N(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><rect x=1.5 y=2.5 width=13 height=9 rx=1.5></rect><path d="M5.5 14h5M8 11.5V14">`),bj=N(`<a target=_blank rel="noopener noreferrer"><span class="min-w-0 truncate"></span><svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=shrink-0><path d="M4.5 11.5 11.5 4.5M5.5 4.5h6v6">`),xj=N(`<span class="text-text-faint text-[10.5px] leading-snug">`),Sj=N(`<label class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">`),Cj=N(`<section class="flex flex-col gap-2.5"><h2 class="text-text-dim text-[11px] font-semibold tracking-wide uppercase">`),wj=N(`<span>`),Tj=N(`<span aria-hidden class="inline-block size-2 shrink-0 rounded-full">`),Ej=N(`<div class="flex flex-col items-center gap-1.5 px-4 py-10 text-center"><p class="text-text-dim text-[12px] font-medium"></p><div class="text-text-faint text-[11.5px] leading-relaxed">`),Dj=N(`<p class="bg-danger-soft text-danger rounded-md px-2.5 py-1.5 text-[11.5px] leading-snug break-words">`),Oj={primary:`bg-accent hover:bg-accent-hover text-white border-transparent disabled:bg-surface-3 disabled:text-text-faint`,ghost:`bg-surface-2 hover:bg-surface-3 text-text border-border disabled:text-text-faint disabled:hover:bg-surface-2`,danger:`bg-danger-soft hover:bg-danger/30 text-danger border-transparent`};function kj(e){let[t,n]=He(e,[`variant`,`loading`,`children`,`class`,`disabled`,`title`]);return(()=>{var e=fj(),r=e.firstChild;return ft(e,Ve(n,{get"data-tip"(){return t.title||void 0},get"aria-label"(){return n[`aria-label`]??t.title},get disabled(){return t.disabled||t.loading},get class(){return`relative inline-flex h-7 cursor-pointer items-center justify-center gap-1.5 rounded-md border px-3 text-[12px] font-medium transition-colors disabled:cursor-not-allowed ${Oj[t.variant??`ghost`]} ${t.class??``}`}}),!1,!0),P(r,()=>t.children),P(e,j(M,{get when(){return t.loading},get children(){var e=dj();return P(e,j(Aj,{})),e}}),null),D(()=>st(r,`inline-flex items-center gap-1.5 ${t.loading?`invisible`:``}`)),e})()}function Aj(e){let t=()=>e.size??14,n=()=>Math.max(1,Math.round(t()*.09)),r=()=>Math.round(t()*.26);return(()=>{var e=pj();return P(e,j(We,{get each(){return Array.from({length:12},(e,t)=>t)},children:e=>(()=>{var i=mj();return dt(i,`transform`,`rotate(${e*30}deg)`),dt(i,`animation-delay`,`${(e-12)*.1}s`),D(e=>{var a=`${n()}px`,o=`${r()}px`,s=`-${n()/2}px`,c=`center ${t()/2}px`;return a!==e.e&&dt(i,`width`,e.e=a),o!==e.t&&dt(i,`height`,e.t=o),s!==e.a&&dt(i,`margin-left`,e.a=s),c!==e.o&&dt(i,`transform-origin`,e.o=c),e},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()})),D(n=>{var r=`${t()}px`,i=`${t()}px`;return r!==n.e&&dt(e,`width`,n.e=r),i!==n.t&&dt(e,`height`,n.t=i),n},{e:void 0,t:void 0}),e})()}function jj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=hj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint h-7 w-full rounded-md border px-2 text-[12px] outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function Mj(e){let[t,n]=He(e,[`class`]);return(()=>{var e=gj();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent placeholder:text-text-faint w-full resize-y rounded-md border px-2 py-1.5 text-[12px] leading-relaxed outline-none transition-colors ${t.class??``}`}}),!1,!1),e})()}function Nj(e){let[t,n]=He(e,[`class`,`children`]);return(()=>{var e=_j();return ft(e,Ve(n,{get class(){return`bg-surface-2 border-border focus:border-accent h-7 w-full cursor-pointer rounded-md border px-1.5 text-[12px] outline-none ${t.class??``}`}}),!1,!0),P(e,()=>t.children),e})()}function Pj(e){let t=e.size??11;return(()=>{var e=vj();return it(e,`width`,t),it(e,`height`,t),e})()}function Fj(e){let t=e.size??11;return(()=>{var e=yj();return it(e,`width`,t),it(e,`height`,t),e})()}function Ij(e){return(()=>{var t=bj(),n=t.firstChild;return P(n,()=>e.children),D(n=>{var r=e.href,i=e.title||void 0,a=`text-accent inline-flex min-w-0 items-center gap-1 text-[11px] underline-offset-2 hover:underline ${e.class??``}`;return r!==n.e&&it(t,`href`,n.e=r),i!==n.t&&it(t,`data-tip`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function Lj(e){return(()=>{var t=Sj(),n=t.firstChild;return P(n,()=>e.label),P(t,()=>e.children,null),P(t,j(M,{get when(){return e.hint},get children(){var t=xj();return P(t,()=>e.hint),t}}),null),t})()}function Rj(e){return(()=>{var t=Cj(),n=t.firstChild;return P(n,()=>e.title),P(t,()=>e.children,null),t})()}function zj(e){return(()=>{var t=wj();return P(t,()=>e.children),D(n=>{var r=`bg-surface-3 text-text-dim inline-flex h-[18px] items-center gap-1 rounded-full px-2 text-[10.5px] font-medium whitespace-nowrap ${e.class??``}`,i=e.color?{color:e.color}:void 0,a=e.title||void 0;return r!==n.e&&st(t,n.e=r),n.t=ut(t,i,n.t),a!==n.a&&it(t,`data-tip`,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t})()}function Bj(e){return(()=>{var t=Tj();return D(n=>dt(t,`background`,e.color)),t})()}function Vj(e){return(()=>{var t=Ej(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.title),P(r,()=>e.children),t})()}function Hj(e){return(()=>{var t=Dj();return P(t,()=>e.message),t})()}var Uj={0:`No priority`,1:`Urgent`,2:`High`,3:`Medium`,4:`Low`};function Wj(e){let t=typeof e==`number`?e:Date.parse(e),n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}Br(),Fx(),gD();var Gj=N(`<span class="truncate font-mono">`),Kj=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M5.5 3.5 6.6 2h2.8l1.1 1.5H13A1.5 1.5 0 0 1 14.5 5v7A1.5 1.5 0 0 1 13 13.5H3A1.5 1.5 0 0 1 1.5 12V5A1.5 1.5 0 0 1 3 3.5h2.5Z"></path><circle cx=8 cy=8.2 r=2.4>`),qj=N(`<div class="flex flex-wrap gap-1.5"><span class="text-text-faint self-end text-[10.5px]">attached on create`),Jj=N(`<div class="flex items-center justify-between gap-1.5"><span class="text-text-faint text-[11px]">Model:</span><div class="flex rounded-md border border-border overflow-hidden">`),Yj=N(`<span class="inline-block min-w-[12ch] text-center">`),Xj=N(`<div class="flex justify-end">`),Zj=N(`<div class="flex flex-col gap-1.5">`),Qj=N(`<p class="text-text-faint text-[11px] leading-snug">Primary provider failed — drafted with <span class=text-text-dim></span> (<!>).`),$j=N(`<div class="border-warn/40 bg-surface rounded-md border px-2.5 py-2"><p class="text-warn mb-1 text-[10.5px] font-semibold tracking-wide uppercase">Possibly related — check before creating`),eM=N(`<div class="flex flex-col gap-1">`),tM=N(`<option value>Select a team…`),nM=N(`<option value=cursor> — cloud agent`),rM=N(`<option value=local>Local Claude Code (bridge)`),iM=N(`<option value=none>No one — just create the issue`),aM=N(`<option value>Claude Code default`),oM=N(`<option value=fable>Fable 5`),sM=N(`<option value=opus>Opus`),cM=N(`<option value=sonnet>Sonnet`),lM=N(`<option value=haiku>Haiku`),uM=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Isolated worktree <span class=text-text-dim>— own branch, run agents in parallel safely`),dM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach console errors <span class="text-text-dim tabular-nums">(<!> captured)`),fM=N(`<label class="flex items-center gap-2 cursor-pointer select-none"><input type=checkbox class="rounded accent-accent"><span class="text-[12px] text-text">Attach dev server logs <span class="text-text-dim tabular-nums">(last <!> lines)`),pM=N(`<p class="text-warn text-[11px] leading-snug">`),mM=N(`<span class="text-success text-[11px]">✓`),hM=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4"><div class="bg-surface border-border flex items-center gap-2 rounded-lg border px-2.5 py-2"><div class="flex min-w-0 flex-1 flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Attached context</span><div class="flex min-w-0 flex-wrap items-center gap-1.5"></div></div></div><div class="bg-bg border-border sticky bottom-0 z-10 -mb-4 flex flex-col gap-2 border-t pt-2.5 pb-3"><div class="flex items-center gap-2">`),gM=N(`<div class="border-border relative overflow-hidden rounded-md border"><img alt="Pasted attachment"class="block h-16 w-16 object-cover"><button class="bg-bg/80 text-text-dim hover:text-danger absolute top-0.5 right-0.5 grid size-4 cursor-pointer place-items-center rounded text-[10px] leading-none"title=Remove aria-label="Remove pasted image">×`),_M=N(`<button>`),vM=N(`<div class="flex min-w-0 items-center gap-1.5 py-0.5"><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),yM=N(`<div class="flex items-center gap-1"><span class="text-text-faint text-[11px] tabular-nums w-4 shrink-0 text-right">.</span><button class="text-text-faint hover:text-danger shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors cursor-pointer text-[12px] leading-none"aria-label="Remove step">×`),bM=N(`<option>`),xM=N(`<option>Loading teams…`),SM=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex items-center justify-between gap-2"><a target=_blank rel="noopener noreferrer"class="text-accent font-mono text-[12px] hover:underline">`),CM=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=8 height=8 rx=1.5></rect><path d="M10.5 5.5v-2a1.5 1.5 0 0 0-1.5-1.5H3.5A1.5 1.5 0 0 0 2 3.5V9a1.5 1.5 0 0 0 1.5 1.5h2">`);function wM(e){sr();let t=_r(()=>({queryKey:[`grab`],queryFn:Dr})),n=_r(()=>({queryKey:[`settings`],queryFn:Tr})),r=k(()=>n.data??{}),i=k(()=>t.data?.[0]??null),a=k(()=>!!(r().linearApiKey||r().linearAccessToken)),o=k(()=>Ax(r())),[s,c]=br(`draft:title`,``),[l,u]=br(`draft:description`,``),[d,f]=br(`draft:steps`,[]),[p,m]=br(`draft:expected`,``),[h,g]=br(`draft:actual`,``),[_,v]=br(`draft:impact`,``),[y,b]=br(`draft:analysis`,``),[x,S]=br(`draft:next-steps`,``),[C,w]=br(`draft:priority`,0),[E,ee]=T(r().defaultTeamId??``),[te,A]=T(r().defaultRepo??``),[ne,re]=br(`draft:target`,`none`),[ie,oe]=br(`draft:local-model`,``),[se,ce]=br(`draft:cloud-model`,``),[le,ue]=br(`draft:worktree`,!1),[de,fe]=T(!0),[pe,me]=T(uk().length);O(()=>{let e=setInterval(()=>me(uk().length),3e3);ae(()=>clearInterval(e))});let[he,ge]=T(``);O(()=>{let e=s().trim(),t=setTimeout(()=>ge(e.length>=8?e:``),600);ae(()=>clearTimeout(t))});let _e=_r(()=>({queryKey:[`dup-search`,he()],queryFn:()=>_O(he()),enabled:!!he()&&a(),staleTime:3e4})),[ve,ye]=br(`draft:note`,``),[be,xe]=T([]),Se=e=>{for(let t of Array.from(e.clipboardData?.items??[])){if(!t.type.startsWith(`image/`))continue;let e=t.getAsFile();if(!e||e.size>8e6)continue;let n=new FileReader;n.onload=()=>xe(e=>[...e,{id:Date.now()+Math.random(),dataUrl:n.result}].slice(-6)),n.readAsDataURL(e)}},[Ce,we]=T(`fast`),[Te,Ee]=T(!0),De=!1;O(()=>{let e=n.data;De||!e||(De=!0,ee(e.defaultTeamId??``),A(e.defaultRepo??``),re(e.cursorAgentId?`cursor`:`none`))});let Oe=_r(()=>({queryKey:[`teams`],queryFn:uO,enabled:a()})),ke=k(()=>(Oe.data??[]).find(e=>e.id===E())?.name),[Ae,je]=T(!1),Me=async()=>{let e=pD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[]}),n=`Fix this issue in the current repo. Test the change hands-on before calling it done.\n\n# ${s().trim()||`Issue`}\n\n${e}`;try{await navigator.clipboard.writeText(n),je(!0),setTimeout(()=>je(!1),1800)}catch{}},[Ne,Pe]=T(!1),[Fe,Ie]=T(null),[Le,Re]=T(null),ze=null,Be=()=>{ze?.(),ze=null};ae(Be);let Ve=e=>{e.title!==void 0&&c(e.title),e.description!==void 0&&u(e.description),e.reproSteps!==void 0&&f(e.reproSteps),e.expected!==void 0&&m(e.expected),e.actual!==void 0&&g(e.actual),e.impact!==void 0&&v(e.impact),e.analysisNotes!==void 0&&b(e.analysisNotes),e.suggestedNextSteps!==void 0&&S(e.suggestedNextSteps),e.priority!==void 0&&w(e.priority)},He=async()=>{if(!o())return;Pe(!0),Ie(null),Re(null),Be();let e=r().logUrl&&Te()?await rk({logUrl:r().logUrl,logLines:40}).catch(()=>void 0):void 0,n=de()?dk(15):null,a=[e?`--- dev server ---\n${e}`:null,n?`--- browser console ---\n${n}`:null].filter(Boolean).join(`
229
229
 
230
- `)||void 0;ze=SD({note:be().length?`${ve()}\n\n(${be().length} pasted screenshot(s) will be attached to the issue.)`:ve(),grabbed:i()??null,grabbedList:t.data??void 0,teamName:ke(),tier:Ce(),template:lD(r()),logs:a},{onPartial:Ve,onDone:e=>{Ve(e.draft),e.fellBack&&Re({provider:e.provider,modelId:e.modelId}),Pe(!1),ze=null},onError:(e,t)=>{Ie(t===`no-provider`?`No AI provider configured — add an OpenAI or Anthropic key in Settings.`:e),Pe(!1),ze=null}})},[Ue,Ke]=T(HD());ae(UD(Ke));let qe=async()=>{let e=HD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await DO(e.blob,`recording-${Date.now()}.gif`);return rO(t),t},[Je,Ye]=T(null),[Xe,Ze]=T(null),[Qe,et]=T(null),tt=vr(()=>({mutationFn:async()=>{let e=pD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[],repo:k(),model:se().trim()||r().cursorModel,agentInstructions:lD(r())});Ze(null);let n=[],i=HD();if(i.result&&i.attachOnCreate)try{let t=await qe();e+=`\n\n### Recording\n![Screen recording](${t})`}catch{n.push(`recording`)}let a=(t.data??[]).filter(e=>e.screenshotDataUrl).slice(0,3);for(let[t,r]of a.entries())try{let n=await DO(tj(r.screenshotDataUrl),`element-${Date.now()}-${t}.png`),i=r.componentName?`<${r.componentName}>`:r.tagName??`element`;e+=`\n\n### Element location${a.length>1?` — ${i}`:``}\n![Highlighted element in context](${n})`}catch{n.push(`screenshot${a.length>1?` ${t+1}`:``}`)}let o=be();for(let[t,r]of o.entries())try{let n=await DO(tj(r.dataUrl),`pasted-${Date.now()}-${t}.png`);e+=`${t===0?`
230
+ `)||void 0;ze=SD({note:be().length?`${ve()}\n\n(${be().length} pasted screenshot(s) will be attached to the issue.)`:ve(),grabbed:i()??null,grabbedList:t.data??void 0,teamName:ke(),tier:Ce(),template:lD(r()),logs:a},{onPartial:Ve,onDone:e=>{Ve(e.draft),e.fellBack&&Re({provider:e.provider,modelId:e.modelId}),Pe(!1),ze=null},onError:(e,t)=>{Ie(t===`no-provider`?`No AI provider configured — add an OpenAI or Anthropic key in Settings.`:e),Pe(!1),ze=null}})},[Ue,Ke]=T(HD());ae(UD(Ke));let qe=async()=>{let e=HD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await DO(e.blob,`recording-${Date.now()}.gif`);return rO(t),t},[Je,Ye]=T(null),[Xe,Ze]=T(null),[Qe,et]=T(null),tt=vr(()=>({mutationFn:async()=>{let e=pD({description:l(),reproSteps:d(),expected:p(),actual:h(),impact:_(),analysisNotes:y(),suggestedNextSteps:x(),grabs:t.data??[],repo:te(),model:se().trim()||r().cursorModel,agentInstructions:lD(r())});Ze(null);let n=[],i=HD();if(i.result&&i.attachOnCreate)try{let t=await qe();e+=`\n\n### Recording\n![Screen recording](${t})`}catch{n.push(`recording`)}let a=(t.data??[]).filter(e=>e.screenshotDataUrl).slice(0,3);for(let[t,r]of a.entries())try{let n=await DO(tj(r.screenshotDataUrl),`element-${Date.now()}-${t}.png`),i=r.componentName?`<${r.componentName}>`:r.tagName??`element`;e+=`\n\n### Element location${a.length>1?` — ${i}`:``}\n![Highlighted element in context](${n})`}catch{n.push(`screenshot${a.length>1?` ${t+1}`:``}`)}let o=be();for(let[t,r]of o.entries())try{let n=await DO(tj(r.dataUrl),`pasted-${Date.now()}-${t}.png`);e+=`${t===0?`
231
231
 
232
- ### Attachments`:``}\n![pasted screenshot ${t+1}](${n})`}catch{n.push(`pasted image ${t+1}`)}if(de()){let t=dk(30);t&&(e+=`\n\n### Console errors (client)\n\`\`\`\n${t}\n\`\`\``)}if(r().logUrl&&Te())try{let t=await rk(r());if(t){let n=Math.min(500,Math.max(10,r().logLines??100));e+=`\n\n### Dev server logs (last ${n} lines)\n\`\`\`\n${t}\n\`\`\``}}catch{n.push(`server logs (fetch failed — is the Log URL serving the file?)`)}if(n.length){let e=n.some(e=>!e.startsWith(`server logs`));Ze(`Skipped: ${n.join(`, `)} — issue created without ${n.length>1?`them`:`it`}.${e?" Real fix for uploads: run `npx linear-grab-bridge` in the repo (uploads relay through it) or set the GitHub fallback in Settings.":``}`)}let c=await SO({teamId:ee(),title:s(),description:e,priority:C(),delegateId:ne()===`cursor`?r().cursorAgentId:void 0,projectId:r().defaultProjectId||void 0,labelIds:r().defaultLabelIds?.length?r().defaultLabelIds:void 0}),u=!1;if(ne()===`local`)try{let t=[`You are delegated Linear issue ${c.identifier} (${c.url}).`,``,e,``,`## Closeout — do ALL of this autonomously when the fix is verified (permissions are granted):`,`1. Create a branch (e.g. fix/${c.identifier.toLowerCase()}-short-slug), commit, push.`,`2. Open a PR: \`gh pr create\` — reference ${c.identifier} and ${c.url} in the body so Linear links it.`,`3. Update the Linear issue via its GraphQL API (https://api.linear.app/graphql) using the LINEAR_API_KEY env var as the Authorization header:`,` - commentCreate on issue ${c.identifier}: one-line fix summary + root cause + the PR link.`,` - Move it to review: query the team's workflowStates, then issueUpdate with the review/'In Review' stateId.`,`4. Announce the finished fix on every channel whose token appears in the instructions above (Slack chat.postMessage + files upload, Telegram sendMessage/sendVideo) — include: what was broken, the one-line fix, the Linear issue link, the PR link, and the demo recording if you made one. End with "👉 Review the PR".`].join(`
233
- `);await FO(`${c.identifier} — ${s()}`,le()?`${t}\n\nNote: you are running in an ISOLATED git worktree on a dedicated branch (already checked out) — commit and push THAT branch for the PR; do not switch back to main.`:t,{model:ie()||void 0,permissionMode:`bypassPermissions`,worktree:le(),env:r().linearApiKey?{LINEAR_API_KEY:r().linearApiKey}:void 0}),u=!0;try{let e=(await vO(ee())).filter(e=>e.type===`started`).sort((e,t)=>e.position-t.position)[0];e&&await yO(c.id,e.id)}catch{}await CO(c.id,`🖥️ Delegated to **local Claude Code** on this machine (Linear Grab bridge). Live status, conversation, and steering in the panel's Local tab. The agent will post its fix summary + PR here and move this issue to review when done.`).catch(()=>{})}catch{Ze("Issue created, but the local bridge is unreachable — run `npx linear-grab-bridge` in the repo and re-delegate from the Local tab.")}let f=await $O(r(),{identifier:c.identifier,title:s(),url:c.url,summary:l(),impact:_(),repo:k()||r().defaultRepo,demoUrl:HD().result?.assetUrl,executor:ne()});return f.length&&Ze(`${f.join(` + `)} announcement failed — check the token/channel in Settings.`),{...c,localTask:u}},onSuccess:e=>{et({identifier:e.identifier,url:e.url}),Ye(null),Re(null),xe([]),ye(``),c(``),u(``),f([]),m(``),g(``),v(``),b(``),S(``),w(0),tO(),e.localTask&&oj(`local`)},onError:e=>{Ye(e.message)}})),nt=O(()=>!!s().trim()&&!!ee()&&a()),N=O(()=>{let e=o();return e?Nx[e][Ce()]:null}),rt=()=>f(e=>[...e,``]),at=e=>f(t=>t.filter((t,n)=>n!==e)),ot=(e,t)=>f(n=>n.map((n,r)=>r===e?t:n));return(()=>{var n=hM(),f=n.firstChild,T=f.firstChild.firstChild.nextSibling,D=f.nextSibling,O=D.firstChild;return P(T,j(M,{get when(){return i()},get fallback(){return j(zj,{class:`text-text-faint`,children:`No element`})},get children(){return j(zj,{class:`text-accent max-w-full`,get children(){var e=Gj();return P(e,(()=>{var e=$e(()=>!!i().componentName);return()=>e()?`<${i().componentName}>`:i().source?.filePath?.split(`/`).pop()??`element`})()),e}})}}),null),P(T,j(M,{get when(){return i()?.screenshotDataUrl},get children(){return j(zj,{class:`text-success`,children:`screenshot ✓`})}}),null),P(T,j(M,{get when(){return Ue().result},get children(){return j(zj,{get class(){return Ue().attachOnCreate?`text-success`:`text-text-faint`},get children(){return[`gif `,$e(()=>(Ue().result.durationMs/1e3).toFixed(0)),`s`,$e(()=>Ue().attachOnCreate?` ✓`:` (off)`)]}})}}),null),P(T,j(M,{get when(){return(t.data?.length??0)>1},get children(){return j(zj,{get children(){return[`+`,$e(()=>t.data.length-1),` more`]}})}}),null),P(T,j(M,{get when(){return Ue().phase===`recording`},get children(){return j(zj,{class:`text-danger`,children:`● recording…`})}}),null),P(f,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Manage in the Capture tab — elements, screenshots, recording`,"aria-label":`Open Capture tab`,onClick:()=>oj(`capture`),get children(){return Kj()}}),null),P(n,j(Rj,{title:`AI draft`,get children(){return[j(Lj,{label:`Your note`,get children(){return j(Mj,{rows:3,placeholder:`Describe the problem or change in your own words… (paste screenshots here too)`,get value(){return ve()},onInput:e=>ye(e.currentTarget.value),onPaste:Se})}}),j(M,{get when(){return be().length>0},get children(){var e=qj(),t=e.firstChild;return P(e,j(We,{get each(){return be()},children:e=>(()=>{var t=gM(),n=t.firstChild,r=n.nextSibling;return r.$$click=()=>xe(t=>t.filter(t=>t.id!==e.id)),E(()=>it(n,`src`,e.dataUrl)),t})()}),t),e}}),(()=>{var e=Jj(),t=e.firstChild.nextSibling;return P(t,()=>[`fast`,`best`].map(e=>(()=>{var t=_M();return t.$$click=()=>we(e),P(t,e===`fast`?`Fast`:`Best`),E(()=>st(t,`h-6 px-2.5 text-[11px] font-medium transition-colors cursor-pointer ${Ce()===e?`bg-accent text-white`:`bg-surface-2 text-text-dim hover:text-text`}`)),t})())),e})(),(()=>{var e=Zj();return P(e,j(M,{get when(){return o()},get fallback(){return j(kj,{variant:`ghost`,class:`w-full opacity-60 cursor-default`,disabled:!1,children:`Add an AI key in Settings`})},get children(){return j(kj,{variant:`primary`,class:`w-full`,get loading(){return Ne()},onClick:He,get disabled(){return Ne()},children:`Draft with AI`})}}),null),P(e,j(M,{get when(){return N()},get children(){var e=Xj();return P(e,j(zj,{get children(){var e=Yj();return P(e,N),e}})),e}}),null),e})(),j(M,{get when(){return Le()},get children(){var e=Qj(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return n.nextSibling,P(t,()=>Le().provider),P(e,()=>Le().modelId,n),e}}),j(M,{get when(){return Fe()},get children(){return j(Hj,{get message(){return Fe()}})}})]}}),D),P(n,j(Rj,{title:`Issue`,get children(){return[j(Lj,{label:`Title`,get children(){return j(jj,{class:`h-8 text-[13px] font-medium`,get value(){return s()},onInput:e=>c(e.currentTarget.value),placeholder:`Brief summary of the issue`})}}),j(M,{get when(){return(_e.data??[]).length>0},get children(){var e=$j();return e.firstChild,P(e,j(We,{get each(){return _e.data.slice(0,3)},children:e=>(()=>{var t=vM(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.identifier),P(r,()=>e.title),P(t,j(zj,{class:`ml-auto shrink-0`,get children(){return e.state.name}}),null),E(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),j(Lj,{label:`Description`,get children(){return j(Mj,{rows:6,get value(){return l()},onInput:e=>u(e.currentTarget.value),placeholder:`Markdown supported`})}}),j(Lj,{label:`Reproduction steps`,get children(){var e=eM();return P(e,j(Ge,{get each(){return d()},children:(e,t)=>(()=>{var n=yM(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return P(r,t+1,i),P(n,j(jj,{class:`flex-1`,get value(){return e()},onInput:e=>ot(t,e.currentTarget.value),placeholder:`Step ${t+1}`}),a),a.$$click=()=>at(t),n})()}),null),P(e,j(kj,{variant:`ghost`,class:`self-start h-6 px-2 text-[11px]`,onClick:rt,children:`+ Add step`}),null),e}}),j(Lj,{label:`Expected`,get children(){return j(Mj,{rows:2,get value(){return p()},onInput:e=>m(e.currentTarget.value),placeholder:`What should happen`})}}),j(Lj,{label:`Actual`,get children(){return j(Mj,{rows:2,get value(){return h()},onInput:e=>g(e.currentTarget.value),placeholder:`What actually happens`})}}),j(Lj,{label:`Impact`,get children(){return j(Mj,{rows:2,get value(){return _()},onInput:e=>v(e.currentTarget.value),placeholder:`Who/what is affected and how badly`})}}),j(Lj,{label:`Analysis / Notes`,get children(){return j(Mj,{rows:3,get value(){return y()},onInput:e=>b(e.currentTarget.value),placeholder:`- Likely root cause…`})}}),j(Lj,{label:`Suggested next steps`,get children(){return j(Mj,{rows:3,get value(){return x()},onInput:e=>S(e.currentTarget.value),placeholder:`- Concrete fix suggestion…`})}}),j(Lj,{label:`Priority`,get children(){return j(Nj,{get value(){return C()},onChange:e=>w(Number(e.currentTarget.value)),get children(){return j(We,{get each(){return Object.entries(Uj)},children:([e,t])=>(()=>{var n=bM();return n.value=e,P(n,t),n})()})}})}}),j(M,{get when(){return a()},get fallback(){return j(Hj,{message:`Connect Linear in Settings to create issues.`})},get children(){return j(Lj,{label:`Team`,get children(){return j(M,{get when(){return!Oe.isLoading},get fallback(){return j(Nj,{disabled:!0,get children(){return xM()}})},get children(){return j(Nj,{get value(){return ee()},onChange:e=>te(e.currentTarget.value),get children(){return[tM(),j(We,{get each(){return Oe.data??[]},children:e=>(()=>{var t=bM();return P(t,()=>e.name),E(()=>t.selected=e.id===ee()),E(()=>t.value=e.id),t})()})]}})}})}})}}),j(Lj,{label:`Repo`,hint:`Appended as [repo=…] so Cursor works in the right repository.`,get children(){return j(jj,{get value(){return k()},onInput:e=>A(e.currentTarget.value),placeholder:`owner/repository`})}}),j(Lj,{label:`Delegate to`,get hint(){return $e(()=>ne()===`local`)()?"Requires `npx linear-grab-bridge` running in the repo — track it in the Local tab.":ne()===`cursor`&&!r().cursorAgentId?`Pick the Cursor agent in Settings first.`:void 0},get children(){return j(Nj,{get value(){return ne()},onChange:e=>re(e.currentTarget.value),get children(){return[(()=>{var e=nM(),t=e.firstChild;return P(e,()=>r().cursorAgentName??`Cursor`,t),E(t=>{var n=!r().cursorAgentId,i=ne()===`cursor`;return n!==t.e&&(e.disabled=t.e=n),i!==t.t&&(e.selected=t.t=i),t},{e:void 0,t:void 0}),e})(),(()=>{var e=rM();return E(()=>e.selected=ne()===`local`),e})(),(()=>{var e=iM();return E(()=>e.selected=ne()===`none`),e})()]}})}}),j(M,{get when(){return ne()===`cursor`},get children(){return j(Lj,{label:`Cloud model`,get hint(){return`Sent as [model=…]. Empty = ${r().cursorModel?`your default (${r().cursorModel})`:`Cursor's default`}.`},get children(){return j(jj,{get placeholder(){return r().cursorModel||`Cursor's default — e.g. claude-opus-4-8, composer`},get value(){return se()},onInput:e=>ce(e.currentTarget.value)})}})}}),j(M,{get when(){return ne()===`local`},get children(){return[j(Lj,{label:`Local model`,hint:`Switchable while running from the Local tab.`,get children(){return j(Nj,{get value(){return ie()},onChange:e=>oe(e.currentTarget.value),get children(){return[(()=>{var e=aM();return E(()=>e.selected=ie()===``),e})(),(()=>{var e=oM();return E(()=>e.selected=ie()===`fable`),e})(),(()=>{var e=sM();return E(()=>e.selected=ie()===`opus`),e})(),(()=>{var e=cM();return E(()=>e.selected=ie()===`sonnet`),e})(),(()=>{var e=lM();return E(()=>e.selected=ie()===`haiku`),e})()]}})}}),(()=>{var e=uM(),t=e.firstChild;return t.addEventListener(`change`,e=>ue(e.currentTarget.checked)),E(()=>t.checked=le()),e})()]}}),j(M,{get when(){return pe()>0},get children(){var e=dM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,r=n.firstChild.nextSibling;return r.nextSibling,t.addEventListener(`change`,e=>fe(e.currentTarget.checked)),P(n,pe,r),E(()=>t.checked=de()),e}}),j(M,{get when(){return r().logUrl},get children(){var e=fM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,i=n.firstChild.nextSibling;return i.nextSibling,t.addEventListener(`change`,e=>Ee(e.currentTarget.checked)),P(n,()=>Math.min(500,Math.max(10,r().logLines??100)),i),E(()=>t.checked=Te()),e}})]}}),D),P(D,j(M,{get when(){return Je()},get children(){return j(Hj,{get message(){return Je()}})}}),O),P(D,j(M,{get when(){return Xe()},get children(){var e=pM();return P(e,Xe),e}}),O),P(D,j(M,{get when(){return Qe()},children:t=>(()=>{var n=SM(),r=n.firstChild;return P(r,()=>t().identifier),P(n,j(kj,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{et(null),Re(null),e.onCreated()},children:`View activity`}),null),E(()=>it(r,`href`,t().url)),n})()}),O),P(O,j(kj,{variant:`ghost`,class:`h-9 shrink-0 px-3`,get title(){return Ae()?`Copied!`:`Copy as a clean prompt — issue context only (no Slack/video/Linear closeout), paste into a local Claude Code session`},"aria-label":`Copy issue as prompt`,onClick:()=>void Me(),get children(){return j(M,{get when(){return Ae()},get fallback(){return CM()},get children(){return mM()}})}}),null),P(O,j(kj,{variant:`primary`,class:`h-9 min-w-0 flex-1`,get loading(){return tt.isPending},get disabled(){return!nt()},onClick:()=>tt.mutate(),children:`Create issue`}),null),n})()}rt([`click`]);function TM(e,t,n=!1){if(!e)return null;let r=t(e);if(r instanceof Promise)return(async()=>{if(await r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=await cP(i,t,n);if(e)return e;i=n?null:i.sibling}return null})();if(r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=sP(i,t,n);if(e)return e;i=n?null:i.sibling}return null}function EM(e,t){let n=0,r=0,i=0;do i=MP[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function DM(e,t){return e.pos>=t?!1:e.peek()!==kP}function OM(e){let{length:t}=e,n=new NP(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=EM(n,i),i<u&&(l=!1),u=i,DM(n,e)?(a=EM(n,a),o=EM(n,o),s=EM(n,s),DM(n,e)?(c=EM(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||kM(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function kM(e){e.sort(AM)}function AM(e,t){return e[0]-t[0]}var jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I,eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL,mL,hL,gL,_L,vL,yL,bL,xL,SL,CL,wL,TL,EL,DL,OL,kL,AL,jL,ML,NL,PL,FL,IL,LL,RL,zL,BL,VL,HL,UL,WL,GL,KL,qL,JL,YL,XL,ZL,QL,$L,eR,tR,nR,rR,iR,aR,oR,sR,cR,lR,uR,dR,fR,pR=t((()=>{jM=null,MM=()=>{if(jM!==null)return jM;try{jM=window.matchMedia(`(color-gamut: p3)`).matches}catch{jM=!1}return jM},NM=MM(),PM=e=>NM?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,FM=null,IM=e=>{FM=e},LM=()=>FM,RM=e=>!FM||e!==null&&FM.contains(e),zM=e=>e,BM=`data-react-grab`,VM=`0.1.48`,HM=`var(--rg-shadow)`,UM=-1e3,WM=.95,GM=1500,KM=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],qM=5e3,JM=8e3,YM=1e4,XM=2147483647,ZM=2147483645,QM=.7,$M=1e3/60,eN=.01,tN=PM(.4),nN=PM(.05),rN=PM(.5),iN=PM(.08),aN=PM(.15),oN=.2,sN=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],cN=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),lN=new Set([`a`,`code`,`pre`]),uN=new Set([`script`,`style`,`template`,`noscript`]),dN=[`Meta`,`Control`,`Shift`,`Alt`],fN=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),pN=`data-react-grab-frozen`,mN=.5,hN=`data-react-grab-input`,gN=.5,_N=`copy`,vN=`comment`,yN=`edit`,bN=`superellipse(1.25)`,xN=.01,SN=1e3,CN={left:-9999,top:-9999},wN={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},TN=1e3,EN=`#00000000`,DN=`transparent`,ON=2e3,kN=`cubic-bezier(0.34, 1.56, 0.64, 1)`,AN=12e3,jN=9e3,MN=1e4,NN=8e3,PN=5e3,FN=1e3,IN=1.2,LN=-9999,new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`)),RN=e=>(e.tagName||``).toLowerCase(),BN=()=>{if(zN!==void 0)return zN;let e=document.querySelector(`script[nonce], style[nonce]`),t=e?.nonce||e?.getAttribute(`nonce`)||null;return t&&(zN=t),t},VN=[[`data-rr-block`,``],[`data-rr-ignore`,``],[`data-rr-mask`,``],[`data-sentry-block`,``],[`data-sentry-ignore`,``],[`data-sentry-mask`,``],[`data-dd-privacy`,`hidden`],[`data-fs-exclude`,``],[`data-lr-exclude`,``],[`data-hj-suppress`,``],[`data-recording-disable`,``],[`data-clarity-mask`,`true`],[`data-heap-redact-text`,``]],HN=e=>{for(let[t,n]of VN)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},UN=`bippy-0.5.43`,WN=Object.defineProperty,GN=Object.prototype.hasOwnProperty,KN=()=>{},qN=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},JN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),YN=!1,ZN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>YN?!0:(e&&typeof e.inject==`function`&&(XN=e.inject.toString()),!!XN?.includes(`(injected)`)),QN=new Set,$N=new Set,eP=e=>{let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:UN,checkDCE:qN,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),$N.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,QN.forEach(e=>e())),i},on:KN,onCommitFiberRoot:KN,onCommitFiberUnmount:KN,onPostCommitFiberRoot:KN,renderers:t,supportsFiber:!0,supportsFlight:!0};try{WN(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{$N.add(e),t.renderers.set(n,e)}),tP(e))}}});let t=window.hasOwnProperty,n=!1;WN(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{tP(e)}return r},tP=e=>{e&&QN.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=qN,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=UN,t._instrumentationIsActive=!1;let e=JN(t);if(e||(t.on=KN),t.renderers.size){t._instrumentationIsActive=!0,QN.forEach(e=>e());return}let n=t.inject,r=ZN(t);r&&!e&&(YN=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return $N.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,QN.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||ZN())&&e?.()}catch{}},nP=()=>GN.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),rP=e=>nP()?(tP(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):eP(e),iP=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)),aP=()=>{try{iP()&&rP()}catch{}},oP=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},sP=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=sP(r,t,n);if(e)return e;r=n?null:r.sibling}return null},cP=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await cP(r,t,n);if(e)return e;r=n?null:r.sibling}return null},lP=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?lP(t.type||t.render):null},uP=e=>{let t=e;if(typeof t==`string`)return t;if(typeof t!=`function`&&!(typeof t==`object`&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=lP(t);return r&&(r.displayName||r.name)||null},dP=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||JN(e)||ZN(e)},fP=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){if(`_reactRootContainer`in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let t in e)if(t.startsWith(`__reactContainer$`)||t.startsWith(`__reactInternalInstance$`)||t.startsWith(`__reactFiber`))return e[t]||null}return null},pP=new Set,mP=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,hP=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],gP=[`<anonymous>`,`eval`,``],_P=/\.(jsx|tsx|ts|js)$/,vP=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,yP=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,bP=/\(at [^)]+\)$/,xP=/(^|@)\S+:\d+/,SP=/^\s*at .*(\S+:\d+|\(native\))/m,CP=/^(eval@)?(\[native code\])?$/,wP=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
232
+ ### Attachments`:``}\n![pasted screenshot ${t+1}](${n})`}catch{n.push(`pasted image ${t+1}`)}if(de()){let t=dk(30);t&&(e+=`\n\n### Console errors (client)\n\`\`\`\n${t}\n\`\`\``)}if(r().logUrl&&Te())try{let t=await rk(r());if(t){let n=Math.min(500,Math.max(10,r().logLines??100));e+=`\n\n### Dev server logs (last ${n} lines)\n\`\`\`\n${t}\n\`\`\``}}catch{n.push(`server logs (fetch failed — is the Log URL serving the file?)`)}if(n.length){let e=n.some(e=>!e.startsWith(`server logs`));Ze(`Skipped: ${n.join(`, `)} — issue created without ${n.length>1?`them`:`it`}.${e?" Real fix for uploads: run `npx linear-grab-bridge` in the repo (uploads relay through it) or set the GitHub fallback in Settings.":``}`)}let c=await SO({teamId:E(),title:s(),description:e,priority:C(),delegateId:ne()===`cursor`?r().cursorAgentId:void 0,projectId:r().defaultProjectId||void 0,labelIds:r().defaultLabelIds?.length?r().defaultLabelIds:void 0}),u=!1;if(ne()===`local`)try{let t=[`You are delegated Linear issue ${c.identifier} (${c.url}).`,``,e,``,`## Closeout — do ALL of this autonomously when the fix is verified (permissions are granted):`,`1. Create a branch (e.g. fix/${c.identifier.toLowerCase()}-short-slug), commit, push.`,`2. Open a PR: \`gh pr create\` — reference ${c.identifier} and ${c.url} in the body so Linear links it.`,`3. Update the Linear issue via its GraphQL API (https://api.linear.app/graphql) using the LINEAR_API_KEY env var as the Authorization header:`,` - commentCreate on issue ${c.identifier}: one-line fix summary + root cause + the PR link.`,` - Move it to review: query the team's workflowStates, then issueUpdate with the review/'In Review' stateId.`,`4. Announce the finished fix on every channel whose token appears in the instructions above (Slack chat.postMessage + files upload, Telegram sendMessage/sendVideo) — include: what was broken, the one-line fix, the Linear issue link, the PR link, and the demo recording if you made one. End with "👉 Review the PR".`].join(`
233
+ `);await FO(`${c.identifier} — ${s()}`,le()?`${t}\n\nNote: you are running in an ISOLATED git worktree on a dedicated branch (already checked out) — commit and push THAT branch for the PR; do not switch back to main.`:t,{model:ie()||void 0,permissionMode:`bypassPermissions`,worktree:le(),env:r().linearApiKey?{LINEAR_API_KEY:r().linearApiKey}:void 0}),u=!0;try{let e=(await vO(E())).filter(e=>e.type===`started`).sort((e,t)=>e.position-t.position)[0];e&&await yO(c.id,e.id)}catch{}await CO(c.id,`🖥️ Delegated to **local Claude Code** on this machine (Linear Grab bridge). Live status, conversation, and steering in the panel's Local tab. The agent will post its fix summary + PR here and move this issue to review when done.`).catch(()=>{})}catch{Ze("Issue created, but the local bridge is unreachable — run `npx linear-grab-bridge` in the repo and re-delegate from the Local tab.")}let f=await $O(r(),{identifier:c.identifier,title:s(),url:c.url,summary:l(),impact:_(),repo:te()||r().defaultRepo,demoUrl:HD().result?.assetUrl,executor:ne()});return f.length&&Ze(`${f.join(` + `)} announcement failed — check the token/channel in Settings.`),{...c,localTask:u}},onSuccess:e=>{et({identifier:e.identifier,url:e.url}),Ye(null),Re(null),xe([]),ye(``),c(``),u(``),f([]),m(``),g(``),v(``),b(``),S(``),w(0),tO(),e.localTask&&oj(`local`)},onError:e=>{Ye(e.message)}})),nt=k(()=>!!s().trim()&&!!E()&&a()),N=k(()=>{let e=o();return e?Nx[e][Ce()]:null}),rt=()=>f(e=>[...e,``]),at=e=>f(t=>t.filter((t,n)=>n!==e)),ot=(e,t)=>f(n=>n.map((n,r)=>r===e?t:n));return(()=>{var n=hM(),f=n.firstChild,T=f.firstChild.firstChild.nextSibling,O=f.nextSibling,k=O.firstChild;return P(T,j(M,{get when(){return i()},get fallback(){return j(zj,{class:`text-text-faint`,children:`No element`})},get children(){return j(zj,{class:`text-accent max-w-full`,get children(){var e=Gj();return P(e,(()=>{var e=$e(()=>!!i().componentName);return()=>e()?`<${i().componentName}>`:i().source?.filePath?.split(`/`).pop()??`element`})()),e}})}}),null),P(T,j(M,{get when(){return i()?.screenshotDataUrl},get children(){return j(zj,{class:`text-success`,children:`screenshot ✓`})}}),null),P(T,j(M,{get when(){return Ue().result},get children(){return j(zj,{get class(){return Ue().attachOnCreate?`text-success`:`text-text-faint`},get children(){return[`gif `,$e(()=>(Ue().result.durationMs/1e3).toFixed(0)),`s`,$e(()=>Ue().attachOnCreate?` ✓`:` (off)`)]}})}}),null),P(T,j(M,{get when(){return(t.data?.length??0)>1},get children(){return j(zj,{get children(){return[`+`,$e(()=>t.data.length-1),` more`]}})}}),null),P(T,j(M,{get when(){return Ue().phase===`recording`},get children(){return j(zj,{class:`text-danger`,children:`● recording…`})}}),null),P(f,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Manage in the Capture tab — elements, screenshots, recording`,"aria-label":`Open Capture tab`,onClick:()=>oj(`capture`),get children(){return Kj()}}),null),P(n,j(Rj,{title:`AI draft`,get children(){return[j(Lj,{label:`Your note`,get children(){return j(Mj,{rows:3,placeholder:`Describe the problem or change in your own words… (paste screenshots here too)`,get value(){return ve()},onInput:e=>ye(e.currentTarget.value),onPaste:Se})}}),j(M,{get when(){return be().length>0},get children(){var e=qj(),t=e.firstChild;return P(e,j(We,{get each(){return be()},children:e=>(()=>{var t=gM(),n=t.firstChild,r=n.nextSibling;return r.$$click=()=>xe(t=>t.filter(t=>t.id!==e.id)),D(()=>it(n,`src`,e.dataUrl)),t})()}),t),e}}),(()=>{var e=Jj(),t=e.firstChild.nextSibling;return P(t,()=>[`fast`,`best`].map(e=>(()=>{var t=_M();return t.$$click=()=>we(e),P(t,e===`fast`?`Fast`:`Best`),D(()=>st(t,`h-6 px-2.5 text-[11px] font-medium transition-colors cursor-pointer ${Ce()===e?`bg-accent text-white`:`bg-surface-2 text-text-dim hover:text-text`}`)),t})())),e})(),(()=>{var e=Zj();return P(e,j(M,{get when(){return o()},get fallback(){return j(kj,{variant:`ghost`,class:`w-full opacity-60 cursor-default`,disabled:!1,children:`Add an AI key in Settings`})},get children(){return j(kj,{variant:`primary`,class:`w-full`,get loading(){return Ne()},onClick:He,get disabled(){return Ne()},children:`Draft with AI`})}}),null),P(e,j(M,{get when(){return N()},get children(){var e=Xj();return P(e,j(zj,{get children(){var e=Yj();return P(e,N),e}})),e}}),null),e})(),j(M,{get when(){return Le()},get children(){var e=Qj(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return n.nextSibling,P(t,()=>Le().provider),P(e,()=>Le().modelId,n),e}}),j(M,{get when(){return Fe()},get children(){return j(Hj,{get message(){return Fe()}})}})]}}),O),P(n,j(Rj,{title:`Issue`,get children(){return[j(Lj,{label:`Title`,get children(){return j(jj,{class:`h-8 text-[13px] font-medium`,get value(){return s()},onInput:e=>c(e.currentTarget.value),placeholder:`Brief summary of the issue`})}}),j(M,{get when(){return(_e.data??[]).length>0},get children(){var e=$j();return e.firstChild,P(e,j(We,{get each(){return _e.data.slice(0,3)},children:e=>(()=>{var t=vM(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.identifier),P(r,()=>e.title),P(t,j(zj,{class:`ml-auto shrink-0`,get children(){return e.state.name}}),null),D(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),j(Lj,{label:`Description`,get children(){return j(Mj,{rows:6,get value(){return l()},onInput:e=>u(e.currentTarget.value),placeholder:`Markdown supported`})}}),j(Lj,{label:`Reproduction steps`,get children(){var e=eM();return P(e,j(Ge,{get each(){return d()},children:(e,t)=>(()=>{var n=yM(),r=n.firstChild,i=r.firstChild,a=r.nextSibling;return P(r,t+1,i),P(n,j(jj,{class:`flex-1`,get value(){return e()},onInput:e=>ot(t,e.currentTarget.value),placeholder:`Step ${t+1}`}),a),a.$$click=()=>at(t),n})()}),null),P(e,j(kj,{variant:`ghost`,class:`self-start h-6 px-2 text-[11px]`,onClick:rt,children:`+ Add step`}),null),e}}),j(Lj,{label:`Expected`,get children(){return j(Mj,{rows:2,get value(){return p()},onInput:e=>m(e.currentTarget.value),placeholder:`What should happen`})}}),j(Lj,{label:`Actual`,get children(){return j(Mj,{rows:2,get value(){return h()},onInput:e=>g(e.currentTarget.value),placeholder:`What actually happens`})}}),j(Lj,{label:`Impact`,get children(){return j(Mj,{rows:2,get value(){return _()},onInput:e=>v(e.currentTarget.value),placeholder:`Who/what is affected and how badly`})}}),j(Lj,{label:`Analysis / Notes`,get children(){return j(Mj,{rows:3,get value(){return y()},onInput:e=>b(e.currentTarget.value),placeholder:`- Likely root cause…`})}}),j(Lj,{label:`Suggested next steps`,get children(){return j(Mj,{rows:3,get value(){return x()},onInput:e=>S(e.currentTarget.value),placeholder:`- Concrete fix suggestion…`})}}),j(Lj,{label:`Priority`,get children(){return j(Nj,{get value(){return C()},onChange:e=>w(Number(e.currentTarget.value)),get children(){return j(We,{get each(){return Object.entries(Uj)},children:([e,t])=>(()=>{var n=bM();return n.value=e,P(n,t),n})()})}})}}),j(M,{get when(){return a()},get fallback(){return j(Hj,{message:`Connect Linear in Settings to create issues.`})},get children(){return j(Lj,{label:`Team`,get children(){return j(M,{get when(){return!Oe.isLoading},get fallback(){return j(Nj,{disabled:!0,get children(){return xM()}})},get children(){return j(Nj,{get value(){return E()},onChange:e=>ee(e.currentTarget.value),get children(){return[tM(),j(We,{get each(){return Oe.data??[]},children:e=>(()=>{var t=bM();return P(t,()=>e.name),D(()=>t.selected=e.id===E()),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(Lj,{label:`Repo`,hint:`Appended as [repo=…] so Cursor works in the right repository.`,get children(){return j(jj,{get value(){return te()},onInput:e=>A(e.currentTarget.value),placeholder:`owner/repository`})}}),j(Lj,{label:`Delegate to`,get hint(){return $e(()=>ne()===`local`)()?"Requires `npx linear-grab-bridge` running in the repo — track it in the Local tab.":ne()===`cursor`&&!r().cursorAgentId?`Pick the Cursor agent in Settings first.`:void 0},get children(){return j(Nj,{get value(){return ne()},onChange:e=>re(e.currentTarget.value),get children(){return[(()=>{var e=nM(),t=e.firstChild;return P(e,()=>r().cursorAgentName??`Cursor`,t),D(t=>{var n=!r().cursorAgentId,i=ne()===`cursor`;return n!==t.e&&(e.disabled=t.e=n),i!==t.t&&(e.selected=t.t=i),t},{e:void 0,t:void 0}),e})(),(()=>{var e=rM();return D(()=>e.selected=ne()===`local`),e})(),(()=>{var e=iM();return D(()=>e.selected=ne()===`none`),e})()]}})}}),j(M,{get when(){return ne()===`cursor`},get children(){return j(Lj,{label:`Cloud model`,get hint(){return`Sent as [model=…]. Empty = ${r().cursorModel?`your default (${r().cursorModel})`:`Cursor's default`}.`},get children(){return j(jj,{get placeholder(){return r().cursorModel||`Cursor's default — e.g. claude-opus-4-8, composer`},get value(){return se()},onInput:e=>ce(e.currentTarget.value)})}})}}),j(M,{get when(){return ne()===`local`},get children(){return[j(Lj,{label:`Local model`,hint:`Switchable while running from the Local tab.`,get children(){return j(Nj,{get value(){return ie()},onChange:e=>oe(e.currentTarget.value),get children(){return[(()=>{var e=aM();return D(()=>e.selected=ie()===``),e})(),(()=>{var e=oM();return D(()=>e.selected=ie()===`fable`),e})(),(()=>{var e=sM();return D(()=>e.selected=ie()===`opus`),e})(),(()=>{var e=cM();return D(()=>e.selected=ie()===`sonnet`),e})(),(()=>{var e=lM();return D(()=>e.selected=ie()===`haiku`),e})()]}})}}),(()=>{var e=uM(),t=e.firstChild;return t.addEventListener(`change`,e=>ue(e.currentTarget.checked)),D(()=>t.checked=le()),e})()]}}),j(M,{get when(){return pe()>0},get children(){var e=dM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,r=n.firstChild.nextSibling;return r.nextSibling,t.addEventListener(`change`,e=>fe(e.currentTarget.checked)),P(n,pe,r),D(()=>t.checked=de()),e}}),j(M,{get when(){return r().logUrl},get children(){var e=fM(),t=e.firstChild,n=t.nextSibling.firstChild.nextSibling,i=n.firstChild.nextSibling;return i.nextSibling,t.addEventListener(`change`,e=>Ee(e.currentTarget.checked)),P(n,()=>Math.min(500,Math.max(10,r().logLines??100)),i),D(()=>t.checked=Te()),e}})]}}),O),P(O,j(M,{get when(){return Je()},get children(){return j(Hj,{get message(){return Je()}})}}),k),P(O,j(M,{get when(){return Xe()},get children(){var e=pM();return P(e,Xe),e}}),k),P(O,j(M,{get when(){return Qe()},children:t=>(()=>{var n=SM(),r=n.firstChild;return P(r,()=>t().identifier),P(n,j(kj,{variant:`ghost`,class:`h-6 px-2 text-[11px]`,onClick:()=>{et(null),Re(null),e.onCreated()},children:`View activity`}),null),D(()=>it(r,`href`,t().url)),n})()}),k),P(k,j(kj,{variant:`ghost`,class:`h-9 shrink-0 px-3`,get title(){return Ae()?`Copied!`:`Copy as a clean prompt — issue context only (no Slack/video/Linear closeout), paste into a local Claude Code session`},"aria-label":`Copy issue as prompt`,onClick:()=>void Me(),get children(){return j(M,{get when(){return Ae()},get fallback(){return CM()},get children(){return mM()}})}}),null),P(k,j(kj,{variant:`primary`,class:`h-9 min-w-0 flex-1`,get loading(){return tt.isPending},get disabled(){return!nt()},onClick:()=>tt.mutate(),children:`Create issue`}),null),n})()}rt([`click`]);function TM(e,t,n=!1){if(!e)return null;let r=t(e);if(r instanceof Promise)return(async()=>{if(await r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=await cP(i,t,n);if(e)return e;i=n?null:i.sibling}return null})();if(r===!0)return e;let i=n?e.return:e.child;for(;i;){let e=sP(i,t,n);if(e)return e;i=n?null:i.sibling}return null}function EM(e,t){let n=0,r=0,i=0;do i=MP[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function DM(e,t){return e.pos>=t?!1:e.peek()!==kP}function OM(e){let{length:t}=e,n=new NP(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i=EM(n,i),i<u&&(l=!1),u=i,DM(n,e)?(a=EM(n,a),o=EM(n,o),s=EM(n,s),DM(n,e)?(c=EM(n,c),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||kM(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function kM(e){e.sort(AM)}function AM(e,t){return e[0]-t[0]}var jM,MM,NM,PM,FM,IM,LM,RM,zM,BM,VM,HM,UM,WM,GM,KM,qM,JM,YM,XM,ZM,QM,$M,eN,tN,nN,rN,iN,aN,oN,sN,cN,lN,uN,dN,fN,pN,mN,hN,gN,_N,vN,yN,bN,xN,SN,CN,wN,TN,EN,DN,ON,kN,AN,jN,MN,NN,PN,FN,IN,LN,RN,zN,BN,VN,HN,UN,WN,GN,KN,qN,JN,YN,XN,ZN,QN,$N,eP,tP,nP,rP,iP,aP,oP,sP,cP,lP,uP,dP,fP,pP,mP,hP,gP,_P,vP,yP,bP,xP,SP,CP,wP,TP,EP,DP,OP,kP,AP,jP,MP,NP,PP,FP,IP,LP,RP,zP,BP,VP,HP,UP,WP,GP,KP,qP,JP,YP,XP,ZP,QP,$P,eF,tF,nF,rF,iF,aF,oF,sF,cF,lF,uF,dF,fF,pF,mF,hF,gF,_F,vF,yF,bF,xF,SF,CF,wF,TF,EF,DF,OF,kF,AF,jF,MF,NF,PF,FF,IF,LF,RF,zF,BF,VF,HF,UF,WF,GF,KF,qF,JF,YF,XF,ZF,QF,$F,eI,tI,nI,rI,iI,aI,oI,sI,cI,lI,uI,dI,fI,pI,mI,hI,gI,_I,vI,yI,bI,xI,SI,CI,wI,TI,EI,DI,OI,kI,AI,jI,MI,NI,PI,FI,II,LI,RI,zI,BI,VI,HI,UI,WI,GI,KI,qI,JI,YI,XI,ZI,QI,$I,eL,tL,nL,rL,iL,aL,oL,sL,cL,lL,uL,dL,fL,pL,mL,hL,gL,_L,vL,yL,bL,xL,SL,CL,wL,TL,EL,DL,OL,kL,AL,jL,ML,NL,PL,FL,IL,LL,RL,zL,BL,VL,HL,UL,WL,GL,KL,qL,JL,YL,XL,ZL,QL,$L,eR,tR,nR,rR,iR,aR,oR,sR,cR,lR,uR,dR,fR,pR=t((()=>{jM=null,MM=()=>{if(jM!==null)return jM;try{jM=window.matchMedia(`(color-gamut: p3)`).matches}catch{jM=!1}return jM},NM=MM(),PM=e=>NM?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,FM=null,IM=e=>{FM=e},LM=()=>FM,RM=e=>!FM||e!==null&&FM.contains(e),zM=e=>e,BM=`data-react-grab`,VM=`0.1.48`,HM=`var(--rg-shadow)`,UM=-1e3,WM=.95,GM=1500,KM=[`/components/ui/`,`/packages/ui/`,`/design-system/`,`/design-systems/`,`/primitives/`],qM=5e3,JM=8e3,YM=1e4,XM=2147483647,ZM=2147483645,QM=.7,$M=1e3/60,eN=.01,tN=PM(.4),nN=PM(.05),rN=PM(.5),iN=PM(.08),aN=PM(.15),oN=.2,sN=[`id`,`class`,`aria-label`,`data-testid`,`role`,`name`,`title`],cN=new Set([`id`,`data-testid`,`aria-label`,`href`,`src`,`alt`,`type`,`name`,`placeholder`,`role`,`for`,`action`,`method`,`title`,`disabled`,`checked`,`readonly`,`required`,`selected`,`open`]),lN=new Set([`a`,`code`,`pre`]),uN=new Set([`script`,`style`,`template`,`noscript`]),dN=[`Meta`,`Control`,`Shift`,`Alt`],fN=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`]),pN=`data-react-grab-frozen`,mN=.5,hN=`data-react-grab-input`,gN=.5,_N=`copy`,vN=`comment`,yN=`edit`,bN=`superellipse(1.25)`,xN=.01,SN=1e3,CN={left:-9999,top:-9999},wN={left:`left center`,right:`right center`,top:`center top`,bottom:`center bottom`},TN=1e3,EN=`#00000000`,DN=`transparent`,ON=2e3,kN=`cubic-bezier(0.34, 1.56, 0.64, 1)`,AN=12e3,jN=9e3,MN=1e4,NN=8e3,PN=5e3,FN=1e3,IN=1.2,LN=-9999,new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`)),RN=e=>(e.tagName||``).toLowerCase(),BN=()=>{if(zN!==void 0)return zN;let e=document.querySelector(`script[nonce], style[nonce]`),t=e?.nonce||e?.getAttribute(`nonce`)||null;return t&&(zN=t),t},VN=[[`data-rr-block`,``],[`data-rr-ignore`,``],[`data-rr-mask`,``],[`data-sentry-block`,``],[`data-sentry-ignore`,``],[`data-sentry-mask`,``],[`data-dd-privacy`,`hidden`],[`data-fs-exclude`,``],[`data-lr-exclude`,``],[`data-hj-suppress`,``],[`data-recording-disable`,``],[`data-clarity-mask`,`true`],[`data-heap-redact-text`,``]],HN=e=>{for(let[t,n]of VN)e.setAttribute(t,n);e.setAttribute(`data-testid`,`react-grab-overlay`),e.classList.add(`ph-no-capture`)},UN=`bippy-0.5.43`,WN=Object.defineProperty,GN=Object.prototype.hasOwnProperty,KN=()=>{},qN=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},JN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),YN=!1,ZN=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>YN?!0:(e&&typeof e.inject==`function`&&(XN=e.inject.toString()),!!XN?.includes(`(injected)`)),QN=new Set,$N=new Set,eP=e=>{let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:UN,checkDCE:qN,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),$N.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,QN.forEach(e=>e())),i},on:KN,onCommitFiberRoot:KN,onCommitFiberUnmount:KN,onPostCommitFiberRoot:KN,renderers:t,supportsFiber:!0,supportsFlight:!0};try{WN(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{$N.add(e),t.renderers.set(n,e)}),tP(e))}}});let t=window.hasOwnProperty,n=!1;WN(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{tP(e)}return r},tP=e=>{e&&QN.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=qN,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=UN,t._instrumentationIsActive=!1;let e=JN(t);if(e||(t.on=KN),t.renderers.size){t._instrumentationIsActive=!0,QN.forEach(e=>e());return}let n=t.inject,r=ZN(t);r&&!e&&(YN=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return $N.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,QN.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||ZN())&&e?.()}catch{}},nP=()=>GN.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),rP=e=>nP()?(tP(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):eP(e),iP=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`)),aP=()=>{try{iP()&&rP()}catch{}},oP=e=>{switch(e.tag){case 1:case 11:case 0:case 14:case 15:return!0;default:return!1}},sP=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=sP(r,t,n);if(e)return e;r=n?null:r.sibling}return null},cP=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await cP(r,t,n);if(e)return e;r=n?null:r.sibling}return null},lP=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?lP(t.type||t.render):null},uP=e=>{let t=e;if(typeof t==`string`)return t;if(typeof t!=`function`&&!(typeof t==`object`&&t))return null;let n=t.displayName||t.name||null;if(n)return n;let r=lP(t);return r&&(r.displayName||r.name)||null},dP=()=>{let e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;return!!e?._instrumentationIsActive||JN(e)||ZN(e)},fP=e=>{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t?.renderers)for(let n of t.renderers.values())try{let t=n.findFiberByHostInstance?.(e);if(t)return t}catch{}if(typeof e==`object`&&e){if(`_reactRootContainer`in e)return e._reactRootContainer?._internalRoot?.current?.child;for(let t in e)if(t.startsWith(`__reactContainer$`)||t.startsWith(`__reactInternalInstance$`)||t.startsWith(`__reactFiber`))return e[t]||null}return null},pP=new Set,mP=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,hP=[`rsc://`,`file:///`,`webpack-internal://`,`webpack://`,`node:`,`turbopack://`,`metro://`,`/app-pages-browser/`,`/(app-pages-browser)/`],gP=[`<anonymous>`,`eval`,``],_P=/\.(jsx|tsx|ts|js)$/,vP=/(\.min|bundle|chunk|vendor|vendors|runtime|polyfill|polyfills)\.(js|mjs|cjs)$|(chunk|bundle|vendor|vendors|runtime|polyfill|polyfills|framework|app|main|index)[-_.][A-Za-z0-9_-]{4,}\.(js|mjs|cjs)$|[\da-f]{8,}\.(js|mjs|cjs)$|[-_.][\da-f]{20,}\.(js|mjs|cjs)$|\/dist\/|\/build\/|\/.next\/|\/out\/|\/node_modules\/|\.webpack\.|\.vite\.|\.turbopack\./i,yP=/^\?[\w~.-]+(?:=[^&#]*)?(?:&[\w~.-]+(?:=[^&#]*)?)*$/,bP=/\(at [^)]+\)$/,xP=/(^|@)\S+:\d+/,SP=/^\s*at .*(\S+:\d+|\(native\))/m,CP=/^(eval@)?(\[native code\])?$/,wP=(e,t)=>{if(t?.includeInElement!==!1){let n=e.split(`
234
234
  `),r=[];for(let e of n)if(/^\s*at\s+/.test(e)){let t=DP(e,void 0)[0];t&&r.push(t)}else if(/^\s*in\s+/.test(e)){let t=e.replace(/^\s*in\s+/,``).replace(/\s*\(at .*\)$/,``);r.push({functionName:t,source:e})}else if(e.match(xP)){let t=OP(e,void 0)[0];t&&r.push(t)}return EP(r,t)}return e.match(SP)?DP(e,t):OP(e,t)},TP=e=>{if(!e.includes(`:`))return[e,void 0,void 0];let t=e.startsWith(`(`)&&/:\d+\)$/.test(e)?e.slice(1,-1):e,n=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t);return n?[n[1],n[2]||void 0,n[3]||void 0]:[t,void 0,void 0]},EP=(e,t)=>t&&t.slice!=null?Array.isArray(t.slice)?e.slice(t.slice[0],t.slice[1]):e.slice(0,t.slice):e,DP=(e,t)=>EP(e.split(`
235
235
  `).filter(e=>!!e.match(SP)),t).map(e=>{let t=e;t.includes(`(eval `)&&(t=t.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let n=t.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),r=n.match(/ (\(.+\)$)/);n=r?n.replace(r[0],``):n;let i=TP(r?r[1]:n);return{functionName:r&&n||void 0,fileName:[`eval`,`<anonymous>`].includes(i[0])?void 0:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}),OP=(e,t)=>EP(e.split(`
236
236
  `).filter(e=>!e.match(CP)),t).map(e=>{let t=e;if(t.includes(` > eval`)&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!t.includes(`@`)&&!t.includes(`:`))return{functionName:t};{let e=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=t.match(e),r=n&&n[1]?n[1]:void 0,i=TP(t.replace(e,``));return{functionName:r,fileName:i[0],lineNumber:i[1]?+i[1]:void 0,columnNumber:i[2]?+i[2]:void 0,source:t}}}),kP=44,AP=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,jP=new Uint8Array(64),MP=new Uint8Array(128);for(let e=0;e<AP.length;e++){let t=AP.charCodeAt(e);jP[e]=t,MP[t]=e}NP=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}},PP=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,FP=/^data:application\/json[^,]+base64,/,IP=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/,LP=new Map,RP=new Map,zP=(e,t,n,r)=>{if(n<0||n>=e.length)return null;let i=e[n];if(!i||i.length===0)return null;let a=null;for(let e of i)if(e[0]<=r)a=e;else break;if(!a||a.length<4)return null;let[,o,s,c]=a;if(o===void 0||s===void 0||c===void 0)return null;let l=t[o];return l?{columnNumber:c,fileName:l,lineNumber:s+1}:null},BP=(e,t,n)=>{if(e.sections){let r=null;for(let i of e.sections)if(t>i.offset.line||t===i.offset.line&&n>=i.offset.column)r=i;else break;if(!r)return null;let i=t-r.offset.line,a=t===r.offset.line?n-r.offset.column:n;return zP(r.map.mappings,r.map.sources,i,a)}return zP(e.mappings,e.sources,t-1,n)},VP=(e,t)=>{let n=t.split(`
@@ -254,21 +254,22 @@ of the other sections.`,hD="- FIRST, self-orient in the repo checkout (skip any
254
254
  *, *::before, *::after {
255
255
  transition: none !important;
256
256
  }
257
- `;let e=[];for(let t of document.getAnimations())dL(t)||e.push(t);uL(e),eL=!1}else{for(let e of $I)try{e.finish()}catch{try{e.play()}catch{}}$I=[]}ZI.remove(),ZI=null,cL(QI),QI=[],GI()}},vL=[`mouseenter`,`mouseleave`,`mouseover`,`mouseout`,`pointerenter`,`pointerleave`,`pointerover`,`pointerout`],yL=[`focus`,`blur`,`focusin`,`focusout`],bL=[`background-color`,`color`,`border-color`,`box-shadow`,`transform`,`opacity`,`outline`,`filter`,`scale`,`visibility`],xL=[`background-color`,`color`,`border-color`,`box-shadow`,`outline`,`outline-offset`,`outline-width`,`outline-color`,`outline-style`,`filter`,`opacity`,`ring-color`,`ring-width`],SL=new Map,CL=new Map,wL=e=>{e.stopImmediatePropagation()},TL=e=>{e.preventDefault(),e.stopImmediatePropagation()},EL=(e,t)=>{let n=new Map;for(let r of t){let t=e.style.getPropertyValue(r);t&&n.set(r,t)}return n},DL=(e,t,n)=>{if(n?.has(e))return null;let r=getComputedStyle(e),i=e.style.cssText,a=EL(e,t);for(let e of t){let t=r.getPropertyValue(e);t&&(i+=`${e}: ${t} !important; `)}return{element:e,frozenStyles:i,originalPropertyValues:a}},OL=(e,t)=>{let n=[],r=document.elementFromPoint(e,t);for(;r&&r!==document.documentElement;)r instanceof HTMLElement&&n.push(r),r=r.parentElement;return n},kL=()=>{let e=[],t=document.activeElement;for(;t&&t!==document.body;)t instanceof HTMLElement&&e.push(t),t=t.shadowRoot?.activeElement??null;return e},AL=(e,t)=>{for(let{element:n,frozenStyles:r,originalPropertyValues:i}of e)t.set(n,i),n.style.cssText=r},jL=(e,t)=>{for(let[n,r]of e)for(let e of t){let t=r.get(e);t?n.style.setProperty(e,t):n.style.removeProperty(e)}e.clear()},ML=(e,t)=>{if(bI())return null;let n=[],r=e!==void 0&&t!==void 0&&e>=0&&t>=0&&e<window.innerWidth&&t<window.innerHeight?OL(e,t):Array.from(document.querySelectorAll(`:hover`)).filter(e=>e instanceof HTMLElement);for(let e of r){let t=DL(e,bL);t&&n.push(t)}let i=[];for(let e of kL()){let t=DL(e,xL,CL);t&&i.push(t)}return{hoverStates:n,focusStates:i}},NL=e=>{if(e){for(let e of vL)document.addEventListener(e,wL,!0);for(let e of yL)document.addEventListener(e,TL,!0);AL(e.hoverStates,SL),AL(e.focusStates,CL),xI()}},PL=()=>{PI();for(let e of vL)document.removeEventListener(e,wL,!0);for(let e of yL)document.removeEventListener(e,TL,!0);jL(SL,bL),jL(CL,xL),SI()},FL=(e,t)=>{let n=ML(e,t),r=hL();NL(n),gL(r)},IL=()=>{PL(),_L()},LL=!1,RL=(e,t,n)=>{let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i},zL=new WeakMap,BL=new WeakMap,VL=new WeakMap,HL=new Set,UL=[],WL=[],GL=new WeakMap,KL=new WeakMap,qL=new WeakSet,JL=pP,YL=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},XL=()=>{if(JL.size>0)return JL;let e=new Set,t=n=>{let r=fP(n);if(r){let t=YL(r);t&&e.add(t);return}for(let r of Array.from(n.children))if(t(r),e.size>0)return};return t(document.body),e},ZL=(e,t)=>{if(!e)return t;if(!t)return e;if(!e.next||!t.next)return t;let n=e.next,r=t.next,i=e===n,a=t===r;return i&&a?(e.next=t,t.next=e):i?(e.next=r,t.next=e):a?(t.next=n,e.next=t):(e.next=r,t.next=n),t},QL=e=>{if(!e||GL.has(e))return;let t={originalPendingDescriptor:Object.getOwnPropertyDescriptor(e,`pending`),pendingValueAtPause:e.pending,bufferedPending:null};typeof e.getSnapshot==`function`&&(t.originalGetSnapshot=e.getSnapshot,t.snapshotValueAtPause=e.getSnapshot(),e.getSnapshot=()=>LL?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,"pending",{configurable:!0,enumerable:!0,get:()=>LL?null:n,set:e=>{if(LL){e!==null&&(t.bufferedPending=ZL(t.bufferedPending??null,e));return}n=e}}),GL.set(e,t)},$L=e=>{if(!e)return[];let t=[],n=e.next;if(!n)return[];let r=n;do r&&=(t.push(r.action),r.next);while(r&&r!==n);return t},eR=e=>{let t=GL.get(e);if(!t)return;t.originalGetSnapshot&&(e.getSnapshot=t.originalGetSnapshot),t.originalPendingDescriptor?Object.defineProperty(e,"pending",t.originalPendingDescriptor):delete e.pending,e.pending=null;let n=e.dispatch;if(typeof n==`function`){let e=$L(t.pendingValueAtPause??null),r=$L(t.bufferedPending??null);for(let t of[...e,...r])WL.push(()=>n(t))}GL.delete(e)},tR=e=>{if(KL.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,`memoizedValue`),frozenValue:e.memoizedValue};Object.defineProperty(e,"memoizedValue",{configurable:!0,enumerable:!0,get(){return LL?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(e){if(LL){t.pendingValue=e,t.didReceivePendingValue=!0;return}t.originalDescriptor?.set?t.originalDescriptor.set.call(this,e):this._memoizedValue=e}}),t.originalDescriptor?.get||(e._memoizedValue=t.frozenValue),KL.set(e,t)},nR=e=>{let t=KL.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,"memoizedValue",t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),KL.delete(e))},rR=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&QL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)tR(n),n=n.next},iR=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&eR(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)nR(n),n=n.next},aR=e=>{let t=e;for(;t;){if(oP(t)&&rR(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},oR=e=>{let t=e;for(;t;){if(oP(t)&&iR(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},sR=e=>{if(zL.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};zL.set(e,n),t.useState=(...t)=>{let r=n.useState.apply(e,t);if(!LL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RL(BL,a,()=>(...e)=>{LL?WL.push(()=>a(...e)):a(...e)})]},t.useReducer=(...t)=>{let r=n.useReducer.apply(e,t);if(!LL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RL(BL,a,()=>(...e)=>{LL?WL.push(()=>a(...e)):a(...e)})]},t.useTransition=(...t)=>{let r=n.useTransition.apply(e,t);if(!LL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RL(VL,a,()=>e=>{LL?UL.push(()=>a(e)):a(e)})]},t.useSyncExternalStore=((e,t,r)=>LL?n.useSyncExternalStore(t=>e(()=>{LL?HL.add(t):t()}),t,r):n.useSyncExternalStore(e,t,r))},cR=e=>{let t=e.currentDispatcherRef;if(!t||typeof t!=`object`)return;let n=`H`in t?`H`:`current`,r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>(r&&typeof r==`object`&&sR(r),r),set:e=>{r=e}})},lR=e=>{queueMicrotask(()=>{try{for(let t of rP().renderers.values())if(typeof t.scheduleUpdate==`function`){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current)}catch{}}}catch{}})},uR=e=>{for(let t of e)try{t()}catch{}},dR=()=>{for(let e of rP().renderers.values())qL.has(e)||(cR(e),qL.add(e))},fR=()=>{if(LL)return()=>{};dR(),LL=!0;let e=XL();for(let t of e)aR(t.current);return()=>{if(LL)try{let e=XL();for(let t of e)oR(t.current);let t=Array.from(HL),n=UL.slice(),r=WL.slice();LL=!1,uR(t),uR(n),uR(r),lR(e)}finally{HL.clear(),UL.length=0,WL.length=0}}}}));function mR(e){let t=String(e),n=t.length-1;return Mz.context.id+(n?String.fromCharCode(96+n):``)+t}function hR(e){Mz.context=e}function gR(e,t){let n=Uz,r=Vz,i=e.length===0,a=t===void 0?r:t,o=i?zz:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>CR(()=>WR(o)));Vz=o,Uz=null;try{return RR(s,!0)}finally{Uz=n,Vz=r}}function J(e,t){t=t?Object.assign({},Lz,t):Lz;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[MR.bind(n),e=>(typeof e==`function`&&(e=Hz&&Hz.running&&Hz.sources.has(n)?e(n.tValue):e(n.value)),NR(n,e))]}function _R(e,t,n){PR(IR(e,t,!0,1))}function vR(e,t,n){PR(IR(e,t,!1,1))}function yR(e,t,n){Rz=VR;let r=IR(e,t,!1,1),i=Yz&&AR(Yz);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),Gz?Gz.push(r):PR(r)}function Y(e,t,n){n=n?Object.assign({},Lz,n):Lz;let r=IR(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,PR(r),MR.bind(r)}function bR(e){return e&&typeof e==`object`&&`then`in e}function xR(e,t,n){let r,i,a;typeof t==`function`?(r=e,i=t,a=n||{}):(r=!0,i=e,a=t||{});let o=null,s=Bz,c=null,l=!1,u=!1,d=`initialValue`in a,f=typeof r==`function`&&Y(r),p=new Set,[m,h]=(a.storage||J)(a.initialValue),[g,_]=J(void 0),[v,y]=J(void 0,{equals:!1}),[b,x]=J(d?`ready`:`unresolved`);Mz.context&&(c=Mz.getNextContextId(),a.ssrLoadFrom===`initial`?s=a.initialValue:Mz.load&&Mz.has(c)&&(s=Mz.load(c)));function S(e,t,n,r){return o===e&&(o=null,r!==void 0&&(d=!0),(e===s||t===s)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(r,{value:t})),s=Bz,Hz&&e&&l?(Hz.promises.delete(e),l=!1,RR(()=>{Hz.running=!0,C(t,n)},!1)):C(t,n)),t}function C(e,t){RR(()=>{t===void 0&&h(()=>e),x(t===void 0?d?`ready`:`unresolved`:`errored`),_(t);for(let e of p.keys())e.decrement();p.clear()},!1)}function w(){let e=Yz&&AR(Yz),t=m(),n=g();if(n!==void 0&&!o)throw n;return Uz&&!Uz.user&&e&&_R(()=>{v(),o&&(e.resolved&&Hz&&l?Hz.promises.add(o):p.has(e)||(e.increment(),p.add(e)))}),t}function T(e=!0){if(e!==!1&&u)return;u=!1;let t=f?f():r;if(l=Hz&&Hz.running,t==null||t===!1){S(o,CR(m));return}Hz&&o&&Hz.promises.delete(o);let n,a=s===Bz?CR(()=>{try{return i(t,{value:m(),refetching:e})}catch(e){n=e}}):s;if(n!==void 0){S(o,void 0,KR(n),t);return}else if(!bR(a))return S(o,a,void 0,t),a;return o=a,`v`in a?(a.s===1?S(o,a.v,void 0,t):S(o,void 0,KR(a.v),t),a):(u=!0,queueMicrotask(()=>u=!1),RR(()=>{x(d?`refreshing`:`pending`),y()},!1),a.then(e=>S(a,e,void 0,t),e=>S(a,void 0,KR(e),t)))}Object.defineProperties(w,{state:{get:()=>b()},error:{get:()=>g()},loading:{get(){let e=b();return e===`pending`||e===`refreshing`}},latest:{get(){if(!d)return w();let e=g();if(e&&!o)throw e;return m()}}});let ee=Vz;return f?_R(()=>(ee=Vz,T(!1))):T(!1),[w,{refetch:e=>OR(ee,()=>T(e)),mutate:h}]}function SR(e){return RR(e,!1)}function CR(e){if(Uz===null)return e();let t=Uz;Uz=null;try{return e()}finally{Uz=t}}function wR(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=CR(()=>t(o,i,n));return i=o,s}}function TR(e){yR(()=>CR(e))}function ER(e){return Vz===null||(Vz.cleanups===null?Vz.cleanups=[e]:Vz.cleanups.push(e)),e}function DR(){return Uz}function OR(e,t){let n=Vz,r=Uz;Vz=e,Uz=null;try{return RR(t,!0)}catch(e){qR(e)}finally{Vz=n,Uz=r}}function kR(e,t){let n=Symbol(`context`);return{id:n,Provider:YR(n),defaultValue:e}}function AR(e){let t;return Vz&&Vz.context&&(t=Vz.context[e.id])!==void 0?t:e.defaultValue}function jR(e){let t=Y(e),n=Y(()=>JR(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}function MR(){let e=Hz&&Hz.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===1)PR(this);else{let e=Wz;Wz=null,RR(()=>HR(this),!1),Wz=e}if(Uz){let e=this.observers?this.observers.length:0;Uz.sources?(Uz.sources.push(this),Uz.sourceSlots.push(e)):(Uz.sources=[this],Uz.sourceSlots=[e]),this.observers?(this.observers.push(Uz),this.observerSlots.push(Uz.sources.length-1)):(this.observers=[Uz],this.observerSlots=[Uz.sources.length-1])}return e&&Hz.sources.has(this)?this.tValue:this.value}function NR(e,t,n){let r=Hz&&Hz.running&&Hz.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(Hz){let r=Hz.running;(r||!n&&Hz.sources.has(e))&&(Hz.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&RR(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=Hz&&Hz.running;r&&Hz.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?Wz.push(n):Gz.push(n),n.observers&&UR(n)),r?n.tState=1:n.state=1)}if(Wz.length>1e6)throw Wz=[],Error()},!1)}return t}function PR(e){if(!e.fn)return;WR(e);let t=Kz;FR(e,Hz&&Hz.running&&Hz.sources.has(e)?e.tValue:e.value,t),Hz&&!Hz.running&&Hz.sources.has(e)&&queueMicrotask(()=>{RR(()=>{Hz&&(Hz.running=!0),Uz=Vz=e,FR(e,e.tValue,t),Uz=Vz=null},!1)})}function FR(e,t,n){let r,i=Vz,a=Uz;Uz=Vz=e;try{r=e.fn(t)}catch(t){return e.pure&&(Hz&&Hz.running?(e.tState=1,e.tOwned&&e.tOwned.forEach(WR),e.tOwned=void 0):(e.state=1,e.owned&&e.owned.forEach(WR),e.owned=null)),e.updatedAt=n+1,qR(t)}finally{Uz=a,Vz=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?NR(e,r,!0):Hz&&Hz.running&&e.pure?(Hz.sources.has(e)||(e.value=r),Hz.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function IR(e,t,n,r=1,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Vz,context:Vz?Vz.context:null,pure:n};return Hz&&Hz.running&&(a.state=0,a.tState=r),Vz===null||Vz!==zz&&(Hz&&Hz.running&&Vz.pure?Vz.tOwned?Vz.tOwned.push(a):Vz.tOwned=[a]:Vz.owned?Vz.owned.push(a):Vz.owned=[a]),a}function LR(e){let t=Hz&&Hz.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===2)return HR(e);if(e.suspense&&CR(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Kz);){if(t&&Hz.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(Hz.disposed.has(t))return}if((t?e.tState:e.state)===1)PR(e);else if((t?e.tState:e.state)===2){let t=Wz;Wz=null,RR(()=>HR(e,n[0]),!1),Wz=t}}}function RR(e,t){if(Wz)return e();let n=!1;t||(Wz=[]),Gz?n=!0:Gz=[],Kz++;try{let t=e();return zR(n),t}catch(e){n||(Gz=null),Wz=null,qR(e)}}function zR(e){if(Wz&&=(BR(Wz),null),e)return;let t;if(Hz){if(!Hz.promises.size&&!Hz.queue.size){let e=Hz.sources,n=Hz.disposed;Gz.push.apply(Gz,Hz.effects),t=Hz.resolve;for(let e of Gz)`tState`in e&&(e.state=e.tState),delete e.tState;Hz=null,RR(()=>{for(let e of n)WR(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)WR(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}Jz(!1)},!1)}else if(Hz.running){Hz.running=!1,Hz.effects.push.apply(Hz.effects,Gz),Gz=null,Jz(!0);return}}let n=Gz;Gz=null,n.length&&RR(()=>Rz(n),!1),t&&t()}function BR(e){for(let t=0;t<e.length;t++)LR(e[t])}function VR(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:LR(r)}if(Mz.context){if(Mz.count){Mz.effects||=[],Mz.effects.push(...e.slice(0,n));return}hR()}for(Mz.effects&&(Mz.done||!Mz.count)&&(e=[...Mz.effects,...e],n+=Mz.effects.length,delete Mz.effects),t=0;t<n;t++)LR(e[t])}function HR(e,t){let n=Hz&&Hz.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===1?i!==t&&(!i.updatedAt||i.updatedAt<Kz)&&LR(i):e===2&&HR(i,t)}}}function UR(e){let t=Hz&&Hz.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=2:r.state=2,r.pure?Wz.push(r):Gz.push(r),r.observers&&UR(r))}}function WR(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)WR(e.tOwned[t]);delete e.tOwned}if(Hz&&Hz.running&&e.pure)GR(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)WR(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}Hz&&Hz.running?e.tState=0:e.state=0}function GR(e,t){if(t||(e.tState=0,Hz.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)GR(e.owned[t])}function KR(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function qR(e,t=Vz){throw KR(e)}function JR(e){if(typeof e==`function`&&!e.length)return JR(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=JR(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function YR(e,t){return function(t){let n;return vR(()=>n=CR(()=>(Vz.context={...Vz.context,[e]:t.value},jR(()=>t.children))),void 0),n}}function XR(e){for(let t=0;t<e.length;t++)e[t]()}function ZR(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return ER(()=>XR(a)),()=>{let c=e()||[],l=c.length,u,d;return c[Iz],CR(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(XR(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Xz],i[0]=gR(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),d=0;d<l;d++)r[d]=c[d],i[d]=gR(f);o=l}else{for(p=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)p[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),d=v;d>=g;d--)y=c[d],u=e.get(y),t[d]=u===void 0?-1:u,e.set(y,d);for(u=g;u<=_;u++)y=r[u],d=e.get(y),d!==void 0&&d!==-1?(p[d]=i[u],m[d]=a[u],s&&(h[d]=s[u]),d=t[d],e.set(y,d)):a[u]();for(d=g;d<l;d++)d in p?(i[d]=p[d],a[d]=m[d],s&&(s[d]=h[d],s[d](d))):i[d]=gR(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=J(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function QR(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return ER(()=>XR(a)),()=>{let l=e()||[],u=l.length;return l[Iz],CR(()=>{if(u===0)return s!==0&&(XR(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Xz],i[0]=gR(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Xz&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<u;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=gR(d));for(;c<r.length;c++)a[c]();return s=o.length=a.length=u,r=l.slice(0),i=i.slice(0,s)});function d(e){a[c]=e;let[n,r]=J(l[c]);return o[c]=r,t(n,c)}}}function X(e,t){return CR(()=>e(t||{}))}function $R(){return!0}function ez(e){return(e=typeof e==`function`?e():e)?e:{}}function tz(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function nz(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&Pz in r,e[n]=typeof r==`function`?(t=!0,Y(r)):r}if(Fz&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=ez(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ez(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ez(e[n])));return[...new Set(t)]}},Zz);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:tz.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function rz(e,...t){let n=t.length;if(Fz&&Pz in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},Zz));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Zz)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}function iz(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(ZR(()=>e.each,e.children,t||void 0))}function az(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(QR(()=>e.each,e.children,t||void 0))}function oz(e){let t=e.keyed,n=Y(()=>e.when,void 0,void 0),r=t?n:Y(n,void 0,{equals:(e,t)=>!e==!t});return Y(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?CR(()=>a(t?i:()=>{if(!CR(r))throw Qz(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function sz(e){let t=jR(()=>e.children),n=Y(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=Y(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:Y(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return Y(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?CR(()=>o(a.keyed?i():()=>{if(CR(n)()?.[0]!==r)throw Qz(`Match`);return i()})):o},void 0,void 0)}function cz(e){return e}function lz(e,t){let n=nB[e];return typeof n==`object`?n[t]?n.$:void 0:n}function uz(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}function dz(e,t,n,r={}){let i;return gR(r=>{i=r,t===document?e():$(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function Z(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>CR(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function fz(e,t=window.document){let n=t[oB]||(t[oB]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,Dz))}}function Q(e,t,n){Cz(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function pz(e,t,n,r){Cz(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function mz(e,t,n){Cz(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function hz(e,t){Cz(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function gz(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function _z(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(Tz(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(Tz(e,i,!0),n[i]=o)}return n}function vz(e,t,n){if(!t)return n?Q(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function yz(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function bz(e,t={},n,r){let i={};return r||vR(()=>i.children=Oz(e,t.children,i.children)),vR(()=>typeof t.ref==`function`&&xz(t.ref,e)),vR(()=>Sz(e,t,n,!0,i,!0)),i}function xz(e,t,n){return CR(()=>e(t,n))}function $(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Oz(e,t,r,n);vR(r=>Oz(e,t(),r,n),r)}function Sz(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=Ez(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||Oz(e,t.children);continue}let s=t[o];i[o]=Ez(e,o,s,i[o],n,a,t)}}function Cz(e){return!!Mz.context&&!Mz.done&&(!e||e.isConnected)}function wz(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Tz(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function Ez(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return vz(e,n,r);if(t===`classList`)return _z(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=rB.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(gz(e,i,n,a),a&&fz([i]))}else if(t.slice(0,5)===`attr:`)Q(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)mz(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=eB.has(t))||!i&&((u=lz(t,e.tagName))||(c=$z.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(Cz(e))return n;t===`class`||t===`className`?hz(e,n):s&&!c&&!l?e[wz(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&iB[t.split(`:`)[0]];r?pz(e,r,t,n):Q(e,tB[t]||t,n)}return n}function Dz(e){if(Mz.registry&&Mz.events&&Mz.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),Mz.registry&&!Mz.done&&(Mz.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function Oz(e,t,n,r,i){let a=Cz(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=jz(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=jz(e,n,r)}else if(o===`function`)return vR(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Oz(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(kz(o,t,n,i))return vR(()=>n=Oz(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=jz(e,n,r),s)return n}else c?n.length===0?Az(e,o,r):uz(e,n,o):(n&&jz(e),Az(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=jz(e,n,r,t);jz(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function kz(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=kz(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=kz(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function Az(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function jz(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var Mz,Nz,Pz,Fz,Iz,Lz,Rz,zz,Bz,Vz,Hz,Uz,Wz,Gz,Kz,qz,Jz,Yz,Xz,Zz,Qz,$z,eB,tB,nB,rB,iB,aB,oB,sB,cB,lB,uB,dB,fB,pB,mB,hB,gB,_B,vB,yB,bB,xB,SB,CB,wB,TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB,IB,LB,RB,zB,BB,VB,HB,UB,WB,GB,KB,qB,JB,YB,XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV,oV,sV,cV,lV,uV,dV,fV,pV,mV,hV,gV,_V,vV,yV,bV,xV,SV,CV,wV,TV,EV,DV,OV,kV,AV,jV,MV,NV,PV,FV,IV,LV,RV,zV,BV,VV,HV,UV,WV,GV,KV=t((()=>{pR(),Mz={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return mR(this.context.count)},getNextContextId(){return mR(this.context.count++)}},Nz=(e,t)=>e===t,Pz=Symbol(`solid-proxy`),Fz=typeof Proxy==`function`,Iz=Symbol(`solid-track`),Lz={equals:Nz},Rz=BR,zz={owned:null,cleanups:null,context:null,owner:null},Bz={},Vz=null,Hz=null,Uz=null,Wz=null,Gz=null,Kz=0,[qz,Jz]=J(!1),Xz=Symbol(`fallback`),Zz={get(e,t,n){return t===Pz?n:e.get(t)},has(e,t){return t===Pz||e.has(t)},set:$R,deleteProperty:$R,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:$R,deleteProperty:$R}},ownKeys(e){return e.keys()}},Qz=e=>`Stale read from <${e}>.`,$z=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),eB=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),tB=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),nB=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}}),rB=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),iB={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},aB=e=>Y(()=>e()),oB=`_$DX_DELEGATE`,sB=e=>!!(e?.isConnected??e?.ownerDocument?.contains(e)),cB=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`,`combobox`],lB=e=>{if(e.composed){let t=e.composedPath()[0];if(t instanceof HTMLElement)return t}else if(e.target instanceof HTMLElement)return e.target},uB=e=>{if(document.designMode===`on`)return!0;let t=lB(e);if(!t)return!1;if(t.isContentEditable)return!0;let n=RN(t);return cB.some(e=>e===n||e===t.role)},dB=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){let e=t.selectionStart??0;return(t.selectionEnd??0)-e>0}return!1},fB=()=>{let e=window.getSelection();return e?e.toString().length>0:!1},pB=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/,mB=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`),hB=(e,t,n,r=1)=>{let i=mB(e),a=mB(t),o=mB(n);return r>=1?`#${i}${a}${o}`:`#${i}${a}${o}${mB(r*255)}`},gB=e=>{if(!e.startsWith(`#`))return null;let t=e.slice(1);if(t.length!==6&&t.length!==8)return null;let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=t.length===8?parseInt(t.slice(6,8),16)/255:1;return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)?null:{red:n,green:r,blue:i,alpha:a}},_B=e=>{let t=e.match(pB);if(!t)return null;let n=1;if(t[4]!==void 0){let e=t[4];n=e.endsWith(`%`)?Number(e.slice(0,-1))/100:Number(e)}return hB(Number(t[1]),Number(t[2]),Number(t[3]),n)},vB=e=>{let t=e.match(pB);return!t||t[4]===void 0?!1:(t[4].endsWith(`%`)?Number(t[4].slice(0,-1))/100:Number(t[4]))===0},yB=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,bB=e=>{let t=e.match(yB);if(!t)return null;let n=t[1];return n.length===3?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`:n.length===4?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:`#${n}`},xB=`rgba(0, 0, 0, 0)`,SB=/^oklch\(\s*([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+)(deg|grad|rad|turn)?(?:\s*\/\s*([+-]?\d*\.?\d+%?))?\s*\)$/i,CB=180/Math.PI,wB=(e,t)=>e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:Number(e),TB=(e,t)=>{let n=Number(e);return t===`grad`?n*.9:t===`rad`?n*CB:t===`turn`?n*360:n},EB=e=>{let t=Math.max(0,Math.min(1,e));return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255},DB=e=>{let t=e.match(SB);if(!t)return null;let n=wB(t[1],1),r=wB(t[2],.4),i=TB(t[3],t[4])*Math.PI/180,a=t[5]===void 0?1:wB(t[5],1);if(![n,r,i,a].every(Number.isFinite))return null;let o=r*Math.cos(i),s=r*Math.sin(i),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return hB(EB(m),EB(h),EB(g),Math.max(0,Math.min(1,a)))},OB=null,kB=()=>OB||(typeof document>`u`?null:(OB=document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0}),OB)),AB=(e,t)=>{e.clearRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let n=e.getImageData(0,0,1,1).data;return n[3]===0?EN:hB(n[0],n[1],n[2],n[3]/255)},jB=e=>{let t=e.trim();if(!t)return null;if(t.toLowerCase()===`transparent`)return EN;let n=bB(t);if(n)return n;let r=DB(t);if(r)return r;let i=kB();if(!i)return null;i.fillStyle=xB,i.fillStyle=t;let a=i.fillStyle;return typeof a==`string`?a.toLowerCase()===xB?t.toLowerCase().replace(/\s+/g,``)===`rgba(0,0,0,0)`?EN:null:a.startsWith(`#`)&&a.length===7?a:a.startsWith(`rgb`)?_B(a):AB(i,t):null},MB=(e,t,n)=>Math.max(t,Math.min(e,n)),NB=null,PB=()=>{if(typeof navigator>`u`||!(`userAgentData`in navigator))return null;let e=navigator.userAgentData;if(typeof e!=`object`||!e||!(`platform`in e))return null;let t=e.platform;return typeof t==`string`?t:null},FB=()=>{if(NB===null){if(typeof navigator>`u`)return NB=!1,NB;let e=navigator.platform??PB()??navigator.userAgent;NB=/Mac|iPhone|iPad|iPod/i.test(e)}return NB},IB=(e,t)=>{try{return e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute(t))}catch{return!1}},LB=`padding-top.padding-right.padding-bottom.padding-left.margin-top.margin-right.margin-bottom.margin-left.gap.row-gap.column-gap.font-size.line-height.letter-spacing.border-radius.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.opacity.width.height.min-width.min-height.max-width.max-height.top.right.bottom.left.z-index`.split(`.`),RB=-128,zB=-512,BB=-9999,VB=9999,HB=new Set([`letter-spacing`,`gap`,`row-gap`,`column-gap`]),UB=new Set([`z-index`]),WB=[{key:`padding`,label:`padding`,longhands:[`padding-top`,`padding-right`,`padding-bottom`,`padding-left`]},{key:`padding-top,padding-bottom`,label:`padding-y`,longhands:[`padding-top`,`padding-bottom`]},{key:`padding-left,padding-right`,label:`padding-x`,longhands:[`padding-left`,`padding-right`]},{key:`padding-top`,label:`padding top`,longhands:[`padding-top`]},{key:`padding-right`,label:`padding right`,longhands:[`padding-right`]},{key:`padding-bottom`,label:`padding bottom`,longhands:[`padding-bottom`]},{key:`padding-left`,label:`padding left`,longhands:[`padding-left`]}],GB=[{key:`margin`,label:`margin`,longhands:[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`]},{key:`margin-top,margin-bottom`,label:`margin-y`,longhands:[`margin-top`,`margin-bottom`]},{key:`margin-left,margin-right`,label:`margin-x`,longhands:[`margin-left`,`margin-right`]},{key:`margin-top`,label:`margin top`,longhands:[`margin-top`]},{key:`margin-right`,label:`margin right`,longhands:[`margin-right`]},{key:`margin-bottom`,label:`margin bottom`,longhands:[`margin-bottom`]},{key:`margin-left`,label:`margin left`,longhands:[`margin-left`]}],KB=[{key:`gap`,label:`gap`,longhands:[`row-gap`,`column-gap`]},{key:`row-gap`,label:`row gap`,longhands:[`row-gap`]},{key:`column-gap`,label:`column gap`,longhands:[`column-gap`]}],qB=[{key:`border-radius`,label:`border radius`,longhands:[`border-top-left-radius`,`border-top-right-radius`,`border-bottom-right-radius`,`border-bottom-left-radius`]},{key:`border-top-left-radius,border-top-right-radius`,label:`top corners`,longhands:[`border-top-left-radius`,`border-top-right-radius`]},{key:`border-bottom-left-radius,border-bottom-right-radius`,label:`bottom corners`,longhands:[`border-bottom-left-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius,border-bottom-left-radius`,label:`left corners`,longhands:[`border-top-left-radius`,`border-bottom-left-radius`]},{key:`border-top-right-radius,border-bottom-right-radius`,label:`right corners`,longhands:[`border-top-right-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius`,label:`top left radius`,longhands:[`border-top-left-radius`]},{key:`border-top-right-radius`,label:`top right radius`,longhands:[`border-top-right-radius`]},{key:`border-bottom-right-radius`,label:`bottom right radius`,longhands:[`border-bottom-right-radius`]},{key:`border-bottom-left-radius`,label:`bottom left radius`,longhands:[`border-bottom-left-radius`]}],JB=[{key:`top,right,bottom,left`,label:`inset`,longhands:[`top`,`right`,`bottom`,`left`]},{key:`top,bottom`,label:`inset-y`,longhands:[`top`,`bottom`]},{key:`left,right`,label:`inset-x`,longhands:[`left`,`right`]},{key:`top`,label:`top`,longhands:[`top`]},{key:`right`,label:`right`,longhands:[`right`]},{key:`bottom`,label:`bottom`,longhands:[`bottom`]},{key:`left`,label:`left`,longhands:[`left`]}],YB=new Set(JB.map(e=>e.key)),XB=[WB,GB,KB,qB,[{key:`border-width`,label:`border width`,longhands:[`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`]},{key:`border-top-width`,label:`border top width`,longhands:[`border-top-width`]},{key:`border-right-width`,label:`border right width`,longhands:[`border-right-width`]},{key:`border-bottom-width`,label:`border bottom width`,longhands:[`border-bottom-width`]},{key:`border-left-width`,label:`border left width`,longhands:[`border-left-width`]}],[{key:`width,height`,label:`size`,longhands:[`width`,`height`]},{key:`width`,label:`width`,longhands:[`width`]},{key:`height`,label:`height`,longhands:[`height`]}],JB],ZB=[{key:`font-size`,label:`font size`},{key:`line-height`,label:`line height`},{key:`letter-spacing`,label:`letter spacing`},{key:`min-width`,label:`min width`},{key:`min-height`,label:`min height`},{key:`max-width`,label:`max width`},{key:`max-height`,label:`max height`},{key:`z-index`,label:`z-index`},{key:`opacity`,label:`opacity`}],QB=[{key:`color`,label:`text color`,alwaysShow:!0},{key:`background-color`,label:`background`,alwaysShow:!0},{key:`border-color`,label:`border color`},{key:`fill`,label:`fill`},{key:`stroke`,label:`stroke`}],$B=[{value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,label:`sans`},{value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`,label:`serif`},{value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,label:`mono`},{value:`system-ui, sans-serif`,label:`system`},{value:`serif`,label:`serif`},{value:`monospace`,label:`mono`}],eV=e=>{let t=e.trim();return $B.some(e=>e.value===t)?$B:[{value:t,label:`current`},...$B]},tV={key:`font-family`,label:`font family`},nV=[{key:`display`,label:`display`,options:[{value:`block`,label:`block`},{value:`flex`,label:`flex`},{value:`inline-block`,label:`inline-block`},{value:`inline`,label:`inline`},{value:`grid`,label:`grid`},{value:`none`,label:`none`}]},{key:`text-align`,label:`text align`,options:[{value:`left`,label:`left`},{value:`center`,label:`center`},{value:`right`,label:`right`},{value:`justify`,label:`justify`}]},{key:`font-style`,label:`font style`,options:[{value:`normal`,label:`normal`},{value:`italic`,label:`italic`}]},{key:`text-transform`,label:`text transform`,options:[{value:`none`,label:`none`},{value:`uppercase`,label:`uppercase`},{value:`lowercase`,label:`lowercase`},{value:`capitalize`,label:`capitalize`}]},{key:`white-space`,label:`white space`,options:[{value:`normal`,label:`normal`},{value:`nowrap`,label:`nowrap`},{value:`pre`,label:`pre`},{value:`pre-wrap`,label:`pre-wrap`},{value:`pre-line`,label:`pre-line`},{value:`break-spaces`,label:`break-spaces`}]},{key:`word-break`,label:`word break`,options:[{value:`normal`,label:`normal`},{value:`break-all`,label:`break-all`},{value:`keep-all`,label:`keep-all`}]},{key:`overflow-wrap`,label:`wrap`,options:[{value:`normal`,label:`normal`},{value:`break-word`,label:`break-word`},{value:`anywhere`,label:`anywhere`}]},{key:`font-variant-numeric`,label:`number style`,options:[{value:`normal`,label:`normal`},{value:`tabular-nums`,label:`tabular`},{value:`proportional-nums`,label:`proportional`},{value:`lining-nums`,label:`lining`},{value:`oldstyle-nums`,label:`oldstyle`},{value:`slashed-zero`,label:`slashed zero`}]},{key:`text-decoration-line`,label:`decoration`,options:[{value:`none`,label:`none`},{value:`underline`,label:`underline`},{value:`line-through`,label:`strike`}]},{key:`border-style`,label:`border style`,options:[{value:`none`,label:`none`},{value:`solid`,label:`solid`},{value:`dashed`,label:`dashed`},{value:`dotted`,label:`dotted`}]},{key:`visibility`,label:`visibility`,options:[{value:`visible`,label:`visible`},{value:`hidden`,label:`hidden`}]},{key:`align-items`,label:`align items`,options:[{value:`stretch`,label:`stretch`},{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`baseline`,label:`baseline`}]},{key:`justify-content`,label:`justify content`,options:[{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`space-between`,label:`between`},{value:`space-around`,label:`around`},{value:`space-evenly`,label:`evenly`}]},{key:`font-weight`,label:`font weight`,options:[{value:`100`,label:`thin`},{value:`200`,label:`extra-light`},{value:`300`,label:`light`},{value:`400`,label:`normal`},{value:`500`,label:`medium`},{value:`600`,label:`semibold`},{value:`700`,label:`bold`},{value:`800`,label:`extra-bold`},{value:`900`,label:`black`}]}],rV=[...LB,`color`,`background-color`,`border-color`,`fill`,`stroke`,`font-family`,`display`,`text-align`,`font-style`,`text-transform`,`white-space`,`word-break`,`overflow-wrap`,`font-variant-numeric`,`text-decoration-line`,`border-style`,`visibility`,`align-items`,`justify-content`,`font-weight`],iV=e=>Number.isInteger(e)?e:Math.round(e*100)/100,aV=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),oV=e=>Number.isFinite(e)?aV(iV(e)):String(e),sV=e=>Math.round(e),cV=(e,t)=>{if(e.kind===`color`||e.kind===`enum`)return typeof t==`string`?t:e.value;let n=typeof t==`number`?t:e.value;return e.key===`opacity`&&e.unit===`%`?aV(iV(n/100)):`${aV(iV(n))}${e.unit}`},lV={slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#334155`,800:`#1e293b`,900:`#0f172a`,950:`#020617`},gray:{50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`},zinc:{50:`#fafafa`,100:`#f4f4f5`,200:`#e4e4e7`,300:`#d4d4d8`,400:`#a1a1aa`,500:`#71717a`,600:`#52525b`,700:`#3f3f46`,800:`#27272a`,900:`#18181b`,950:`#09090b`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},stone:{50:`#fafaf9`,100:`#f5f5f4`,200:`#e7e5e4`,300:`#d6d3d1`,400:`#a8a29e`,500:`#78716c`,600:`#57534e`,700:`#44403c`,800:`#292524`,900:`#1c1917`,950:`#0c0a09`},red:{50:`#fef2f2`,100:`#fee2e2`,200:`#fecaca`,300:`#fca5a5`,400:`#f87171`,500:`#ef4444`,600:`#dc2626`,700:`#b91c1c`,800:`#991b1b`,900:`#7f1d1d`,950:`#450a0a`},orange:{50:`#fff7ed`,100:`#ffedd5`,200:`#fed7aa`,300:`#fdba74`,400:`#fb923c`,500:`#f97316`,600:`#ea580c`,700:`#c2410c`,800:`#9a3412`,900:`#7c2d12`,950:`#431407`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#fbbf24`,500:`#f59e0b`,600:`#d97706`,700:`#b45309`,800:`#92400e`,900:`#78350f`,950:`#451a03`},yellow:{50:`#fefce8`,100:`#fef9c3`,200:`#fef08a`,300:`#fde047`,400:`#facc15`,500:`#eab308`,600:`#ca8a04`,700:`#a16207`,800:`#854d0e`,900:`#713f12`,950:`#422006`},lime:{50:`#f7fee7`,100:`#ecfccb`,200:`#d9f99d`,300:`#bef264`,400:`#a3e635`,500:`#84cc16`,600:`#65a30d`,700:`#4d7c0f`,800:`#3f6212`,900:`#365314`,950:`#1a2e05`},green:{50:`#f0fdf4`,100:`#dcfce7`,200:`#bbf7d0`,300:`#86efac`,400:`#4ade80`,500:`#22c55e`,600:`#16a34a`,700:`#15803d`,800:`#166534`,900:`#14532d`,950:`#052e16`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#10b981`,600:`#059669`,700:`#047857`,800:`#065f46`,900:`#064e3b`,950:`#022c22`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#14b8a6`,600:`#0d9488`,700:`#0f766e`,800:`#115e59`,900:`#134e4a`,950:`#042f2e`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#06b6d4`,600:`#0891b2`,700:`#0e7490`,800:`#155e75`,900:`#164e63`,950:`#083344`},sky:{50:`#f0f9ff`,100:`#e0f2fe`,200:`#bae6fd`,300:`#7dd3fc`,400:`#38bdf8`,500:`#0ea5e9`,600:`#0284c7`,700:`#0369a1`,800:`#075985`,900:`#0c4a6e`,950:`#082f49`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#3b82f6`,600:`#2563eb`,700:`#1d4ed8`,800:`#1e40af`,900:`#1e3a8a`,950:`#172554`},indigo:{50:`#eef2ff`,100:`#e0e7ff`,200:`#c7d2fe`,300:`#a5b4fc`,400:`#818cf8`,500:`#6366f1`,600:`#4f46e5`,700:`#4338ca`,800:`#3730a3`,900:`#312e81`,950:`#1e1b4b`},violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#8b5cf6`,600:`#7c3aed`,700:`#6d28d9`,800:`#5b21b6`,900:`#4c1d95`,950:`#2e1065`},purple:{50:`#faf5ff`,100:`#f3e8ff`,200:`#e9d5ff`,300:`#d8b4fe`,400:`#c084fc`,500:`#a855f7`,600:`#9333ea`,700:`#7e22ce`,800:`#6b21a8`,900:`#581c87`,950:`#3b0764`},fuchsia:{50:`#fdf4ff`,100:`#fae8ff`,200:`#f5d0fe`,300:`#f0abfc`,400:`#e879f9`,500:`#d946ef`,600:`#c026d3`,700:`#a21caf`,800:`#86198f`,900:`#701a75`,950:`#4a044e`},pink:{50:`#fdf2f8`,100:`#fce7f3`,200:`#fbcfe8`,300:`#f9a8d4`,400:`#f472b6`,500:`#ec4899`,600:`#db2777`,700:`#be185d`,800:`#9d174d`,900:`#831843`,950:`#500724`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#f43f5e`,600:`#e11d48`,700:`#be123c`,800:`#9f1239`,900:`#881337`,950:`#4c0519`}},uV={p:`padding`,px:`padding-left,padding-right`,py:`padding-top,padding-bottom`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,ps:`padding-left`,pe:`padding-right`,m:`margin`,mx:`margin-left,margin-right`,my:`margin-top,margin-bottom`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,ms:`margin-left`,me:`margin-right`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,leading:`line-height`,tracking:`letter-spacing`,rounded:`border-radius`,"rounded-t":`border-top-left-radius,border-top-right-radius`,"rounded-b":`border-bottom-left-radius,border-bottom-right-radius`,"rounded-l":`border-top-left-radius,border-bottom-left-radius`,"rounded-r":`border-top-right-radius,border-bottom-right-radius`,"rounded-tl":`border-top-left-radius`,"rounded-tr":`border-top-right-radius`,"rounded-bl":`border-bottom-left-radius`,"rounded-br":`border-bottom-right-radius`,border:`border-width`,"border-t":`border-top-width`,"border-r":`border-right-width`,"border-b":`border-bottom-width`,"border-l":`border-left-width`,w:`width`,h:`height`,size:`width,height`,"max-w":`max-width`,"max-h":`max-height`,"min-w":`min-width`,"min-h":`min-height`,opacity:`opacity`,inset:`top,right,bottom,left`,"inset-x":`left,right`,"inset-y":`top,bottom`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,z:`z-index`,items:`align-items`,justify:`justify-content`,font:`font-weight`,whitespace:`white-space`},dV={"font-size":[`font-size`,`font size`,`text-size`,`text size`],color:[`color`,`text-color`,`text color`,`text-colour`,`text colour`,`foreground`,`fg`],"background-color":[`background`,`background-color`,`background color`,`bg`,`bg-color`,`bg color`],"border-color":[`border-color`,`border color`],fill:[`fill`,`fill-color`,`fill color`],stroke:[`stroke`,`stroke-color`,`stroke color`],"font-family":[`font`,`font-sans`,`font-serif`,`font-mono`,`family`,`sans`,`serif`,`mono`],"font-style":[`italic`,`not-italic`],"text-align":[`text-left`,`text-center`,`text-right`,`text-justify`],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-decoration-line":[`underline`,`line-through`,`no-underline`],"white-space":[`whitespace`,`whitespace-normal`,`whitespace-nowrap`,`whitespace-pre`],"word-break":[`break-normal`,`break-all`,`break-keep`],"overflow-wrap":[`break-words`,`break-anywhere`],"font-variant-numeric":[`tabular-nums`,`proportional-nums`,`lining-nums`,`oldstyle-nums`],"border-style":[`border-solid`,`border-dashed`,`border-dotted`,`border-none`]},fV=(()=>{let e={};for(let[t,n]of Object.entries(uV))n!==void 0&&(e[n]??=new Set).add(t);let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=Array.from(r));for(let[e,n]of Object.entries(dV)){let r=new Set([...t[e]??[],...n]);t[e]=Array.from(r)}return t})(),pV={text:`color`,bg:`background-color`,border:`border-color`,"border-x":`border-color`,"border-y":`border-color`,"border-t":`border-color`,"border-r":`border-color`,"border-b":`border-color`,"border-l":`border-color`,"border-s":`border-color`,"border-e":`border-color`,fill:`fill`,stroke:`stroke`},mV=e=>uV[e]!==void 0||pV[e]!==void 0,hV=e=>{let t=0,n=-1;for(let r=0;r<e.length;r++){let i=e[r];i===`[`?t++:i===`]`?t--:i===`:`&&t===0&&(n=r)}let r=n>=0?e.slice(n+1):e;return r.startsWith(`!`)?r.slice(1):r},gV=e=>{let t=hV(e);if(!t)return null;let n=t.indexOf(`[`);if(n>0)return t.slice(0,n).replace(/-$/,``)||null;let r=t.split(`-`).filter(Boolean);if(r.length===0)return null;for(let e=r.length;e>=1;e--){let t=r.slice(0,e).join(`-`);if(mV(t))return t}return r[0]},_V=/-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone|black|white|transparent|current|inherit)\b/,vV=(e,t)=>e!==`text`&&e!==`bg`&&e!==`border`&&!e.startsWith(`border-`)?!1:_V.test(t),yV=new Set(`color.red.orange.amber.yellow.lime.green.emerald.teal.cyan.sky.blue.indigo.violet.purple.fuchsia.pink.rose.slate.gray.grey.zinc.neutral.stone.black.white.transparent.current.currentcolor.inherit.primary.secondary.accent.muted.foreground.background.destructive.success.warning.error.info.card.popover.input.ring`.split(`.`)),bV=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),xV=/^(#|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color:|color\(|var\(--.*color)/,SV=/^(-?\d|length:|size:)/,CV=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/([a-z])(\d)/g,`$1-$2`),wV=e=>xV.test(e)&&!SV.test(e),TV=(e,t)=>{if(e===t)return``;let n=`${t}-`;return e.startsWith(n)?e.slice(n.length):null},EV=e=>{let t=hV(CV(e)),n=gV(t);if(!n)return null;let r=pV[n];if(!r)return null;let i=t.indexOf(`[`);if(i>=0)return wV(t.slice(i+1).replace(/\]$/,``))?r:null;let a=TV(t,n);if(a===null)return null;if(n===`bg`&&a===``||(n===`fill`||n===`stroke`)&&a===``)return r;let o=a.split(`-`)[0];return n===`text`&&bV.has(o)?null:yV.has(o)?r:null},DV={black:`#000000`,white:`#ffffff`,transparent:EN},OV=e=>{let t=hV(CV(e)),n=gV(t);if(!n||pV[n]===void 0||t.includes(`[`))return null;let r=TV(t,n);if(!r)return null;let i=DV[r];if(i)return i;let a=r.lastIndexOf(`-`);if(a<0)return null;let o=r.slice(0,a),s=o===`grey`?`gray`:o,c=Number.parseInt(r.slice(a+1),10);return lV[s]?.[c]??null},kV=/^-?\d/,AV=(e,t)=>{if(t===``||t.startsWith(`[`)||kV.test(t))return!0;let n=t.split(`-`)[0];return e===`text`?bV.has(n):e===`font`||e===`border`||e.startsWith(`border-`)?!1:(e===`rounded`||e.startsWith(`rounded-`),!0)},jV={"font-sans":{property:`font-family`,value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`},"font-serif":{property:`font-family`,value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`},"font-mono":{property:`font-family`,value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`},"font-thin":{property:`font-weight`,value:`100`},"font-extralight":{property:`font-weight`,value:`200`},"font-light":{property:`font-weight`,value:`300`},"font-normal":{property:`font-weight`,value:`400`},"font-medium":{property:`font-weight`,value:`500`},"font-semibold":{property:`font-weight`,value:`600`},"font-bold":{property:`font-weight`,value:`700`},"font-extrabold":{property:`font-weight`,value:`800`},"font-black":{property:`font-weight`,value:`900`},"text-left":{property:`text-align`,value:`left`},"text-center":{property:`text-align`,value:`center`},"text-right":{property:`text-align`,value:`right`},"text-justify":{property:`text-align`,value:`justify`},italic:{property:`font-style`,value:`italic`},"not-italic":{property:`font-style`,value:`normal`},uppercase:{property:`text-transform`,value:`uppercase`},lowercase:{property:`text-transform`,value:`lowercase`},capitalize:{property:`text-transform`,value:`capitalize`},"normal-case":{property:`text-transform`,value:`none`},underline:{property:`text-decoration-line`,value:`underline`},"line-through":{property:`text-decoration-line`,value:`line-through`},"no-underline":{property:`text-decoration-line`,value:`none`},"whitespace-normal":{property:`white-space`,value:`normal`},"whitespace-nowrap":{property:`white-space`,value:`nowrap`},"whitespace-pre":{property:`white-space`,value:`pre`},"whitespace-pre-line":{property:`white-space`,value:`pre-line`},"whitespace-pre-wrap":{property:`white-space`,value:`pre-wrap`},"whitespace-break-spaces":{property:`white-space`,value:`break-spaces`},"break-normal":{property:`word-break`,value:`normal`},"break-all":{property:`word-break`,value:`break-all`},"break-keep":{property:`word-break`,value:`keep-all`},"break-words":{property:`overflow-wrap`,value:`break-word`},"break-anywhere":{property:`overflow-wrap`,value:`anywhere`},"tabular-nums":{property:`font-variant-numeric`,value:`tabular-nums`},"proportional-nums":{property:`font-variant-numeric`,value:`proportional-nums`},"lining-nums":{property:`font-variant-numeric`,value:`lining-nums`},"oldstyle-nums":{property:`font-variant-numeric`,value:`oldstyle-nums`},"slashed-zero":{property:`font-variant-numeric`,value:`slashed-zero`},"border-solid":{property:`border-style`,value:`solid`},"border-dashed":{property:`border-style`,value:`dashed`},"border-dotted":{property:`border-style`,value:`dotted`},"border-none":{property:`border-style`,value:`none`}},MV=e=>{let t=CV(e);if(!t)return[];let n=LV(t);if(n)return[n.property];let r=EV(t);return r?[r]:[]},NV=e=>{let t=CV(e);if(!t)return[];let n=gV(t);if(!n)return[];let r=TV(hV(t),n);if(r===null||!AV(n,r))return[];let i=IV(n);return i?[i]:[]},PV=e=>{let t=e.getAttribute(`class`);if(!t)return new Set;let n=t.split(/\s+/).filter(Boolean),r=new Set;for(let e of n){let t=gV(e);if(!t||vV(t,e))continue;let n=LV(e);if(n){r.add(n.property);continue}let i=IV(t);i&&r.add(i)}return r},FV=e=>fV[e]??[],IV=e=>{let t=uV[e];return t===void 0?null:t},LV=e=>{let t=jV[hV(e)];return t===void 0?null:t},RV=`react-grab-toolbar-state`,zV=()=>{try{let e=localStorage.getItem(RV);if(!e)return null;let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t,r=typeof n.collapsed==`boolean`&&n.collapsed;return{edge:n.edge===`top`||n.edge===`bottom`||n.edge===`left`||n.edge===`right`?n.edge:`bottom`,ratio:typeof n.ratio==`number`?n.ratio:gN,collapsed:r,enabled:!r,defaultAction:typeof n.defaultAction==`string`?n.defaultAction:_N}}catch(e){console.warn(`[react-grab] Failed to load toolbar state from localStorage:`,e)}return null},BV=e=>{try{localStorage.setItem(RV,JSON.stringify(e))}catch(e){console.warn(`[react-grab] Failed to save toolbar state to localStorage:`,e)}},VV=e=>{let[t,n]=J(!1);return TR(()=>{let t=zM(t=>n(e(t))),r=()=>n(!1);window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,t,{capture:!0}),window.addEventListener(`blur`,r),ER(()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,t,{capture:!0}),window.removeEventListener(`blur`,r)})}),t},HV=e=>e.key===`Enter`,UV=e=>e.metaKey||e.ctrlKey,WV=(e,t,n={})=>{if(!t.key)return null;if(HV(t))return e.find(e=>e.shortcut===`Enter`)??null;if(t.repeat)return null;let r=t.key.toLowerCase();return UV(t)?n.includeModifierShortcuts===!0?e.find(e=>e.shortcut!==void 0&&e.shortcut!==`Enter`&&e.shortcutModifier!==!1&&r===e.shortcut.toLowerCase())??null:null:e.find(e=>e.shortcut!==void 0&&e.shortcutModifier===!1&&r===e.shortcut.toLowerCase())??null},GV=()=>{let e=!1;return{arm:()=>{e=!0},clear:()=>{e=!1},consume:()=>e?(e=!1,!0):!1}}})),qV,JV,YV,XV,ZV,QV,$V,eH,tH,nH,rH,iH,aH,oH,sH,cH,lH,uH,dH,fH,pH,mH,hH,gH,_H,vH,yH,bH,xH,SH,CH,wH,TH,EH,DH,OH,kH,AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU,kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU,KU,qU,JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,iW=t((()=>{pR(),qV=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},JV=class extends qV{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},YV=class extends qV{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},XV=class extends qV{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},ZV=class extends qV{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}},QV=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),$V=e=>{try{return decodeURIComponent(e)}catch{return e}},eH=/(?:^|[/\\])node_modules[/\\]/,tH=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,nH=/\.[mc]?[jt]sx?$/i,rH=/^chunk-[A-Za-z0-9_-]+$/,iH=/[/\\]/,aH=/^(.+?)@v?\d/,oH=e=>e.split(iH).filter(Boolean),sH=e=>{let[t,n]=oH(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},cH=e=>{let t=oH(e)[0];if(!t)return null;let n=t.replace(nH,``);if(rH.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},lH=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},uH=e=>e?.match(aH)?.[1]??null,dH=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=oH(t.pathname).map($V);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=uH(n[e+1]);if(r)return`${t}/${r}`;continue}let r=uH(t);if(r)return r}return null},fH=e=>lH(e,tH,cH)??lH(e,eH,sH),pH=e=>{if(!e)return null;let t=hF(e);return t&&(fH($V(t))||dH(e))||null},mH=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,hH=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,gH=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),_H=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),vH=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},yH=e=>{let t=vH($V(hF(e)));if(t.startsWith(`/`))return null;let[n,r,...i]=oH(t);return!n||!r||i.length===0||!mH.test(n)||_H.has(n.slice(1))||!hH.test(r)||nH.test(r)||gH.has(r)?null:`${n}/${r}`},bH=e=>e?pH(e)??yH(e):null,xH=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=bH(e);return t?{origin:`package`,packageName:t}:gF(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},SH=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),CH=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},wH=(e,t)=>{let n=SH.has(e)||e.startsWith(`data-`)&&CH(e),r=CH(t)&&t.length<100||t.startsWith(`#`)&&CH(t.slice(1));return n&&r},TH=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},EH=e=>{let t=0;for(let n of e)t+=n.penalty;return t},DH=(e,t)=>EH(e)-EH(t),OH=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},kH=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,AH=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,jH=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&CH(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)CH(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=OH(e,i);a!==void 0&&n.push({name:AH(i,a),penalty:10});let o=OH(e);return o!==void 0&&n.push({name:kH(i,o),penalty:50}),n},MH=(e,t=YM,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...MH(e.slice(1),a,[...n,i]))}return r},NH=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},PH=(e,t)=>t.querySelectorAll(TH(e)).length===1,FH=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=OH(n,e);if(t===void 0)return;r.push({name:AH(e,t),penalty:10}),n=n.parentElement}return PH(r,t)?r:void 0},IH=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new JV;if(e.tagName.toLowerCase()===`html`)return`html`;let i=NH(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(jH(s,r)),s=s.parentElement,c++,c>=3){let t=MH(o);t.sort(DH);for(let r of t){if(Date.now()-a>n){let t=FH(e,i);if(!t)throw new YV(n);return TH(t)}if(PH(r,i)){l=r;break}}}if(!l&&c<3){let e=MH(o);e.sort(DH);for(let t of e){if(Date.now()-a>n)break;if(PH(t,i)){l=t;break}}}if(!l)throw new XV;return TH(l)},LH=e=>e.ownerDocument.body??e.ownerDocument.documentElement,RH=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),zH=e=>e.length>0&&e.length<=120,BH=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},VH=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(BH(e,t))return t}for(let t of RH){let n=e.getAttribute(t);if(!n||!zH(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(BH(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(BH(e,i))return i}return null},HH=e=>{let t=[],n=LH(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},UH=e=>{let t=VH(e);if(t)return t;try{let t=IH(e,LH(e),200,(e,t)=>wH(e,t)||RH.has(e)&&zH(t));if(t)return t}catch{}return HH(e)},WH=e=>{if(!e)return!1;let t=`/${JF(e)}/`.toLowerCase();return KM.some(e=>t.includes(e))},GH=e=>e.map(e=>`\n in ${e}`).join(``),KH=[`about://React/`,`rsc://React/`],qH=e=>KH.some(t=>e.startsWith(t)),JH=e=>{for(let t of KH){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return $V(i>r?e.slice(r,i):e.slice(r))}return e},YH=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},XH=async(e,t)=>{let n=[],r=[];for(let t=0;t<e.length;t++){let i=e[t];!i.isServer||!i.fileName||(n.push(t),r.push({file:JH(i.fileName),methodName:i.functionName??`<unknown>`,line1:i.lineNumber??null,column1:i.columnNumber??null,arguments:[]}))}if(r.length===0)return e;let i=new AbortController,a=setTimeout(()=>i.abort(),qM),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${QF()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:r,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:i.signal});if(!t.ok)return e;let a=await t.json();if(!Array.isArray(a))return e;let o=[...e];for(let t=0;t<n.length;t++){let r=YH(a[t]);if(!r)continue;let i=n[t];o[i]={...e[i],fileName:r.file,lineNumber:r.line1??void 0,columnNumber:r.column1??void 0,isSymbolicated:!0}}return o}catch{return e}finally{clearTimeout(a),t?.removeEventListener(`abort`,o)}},ZH=e=>{let t=new Map;return TM(e,e=>{if(!JP(e))return!1;let n=rF(e._debugStack.stack);if(!n)return!1;for(let e of wP(n))!e.functionName||!e.fileName||qH(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},QH=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=ZH(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})},$H=0,eU=[],tU=()=>$H<3?($H+=1,Promise.resolve()):new Promise(e=>{eU.push(e)}),nU=()=>{let e=eU.shift();if(e){e();return}--$H},rU=async(e,t,n=JM)=>{await tU();let r=new AbortController,i,a=new Promise(e=>{i=setTimeout(()=>{r.abort(),e(t)},n)}),o=e(r.signal);o.catch(()=>{});try{return await Promise.race([o,a])}finally{clearTimeout(i),nU()}},iU=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,aU=e=>e.startsWith(`data-react-grab-`),oU=e=>e.replace(/\s+/g,` `).trim(),sU=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=oU(n.textContent??``);e&&t.push(e)}return t.join(` `)},cU=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:uN.has(e.tagName.toLowerCase()),lU=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=oU(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||cU(e))return n;for(let r of e.childNodes)if(n=lU(r,t,n),n<=0)break;return n},uU=(e,t)=>{if(cU(e))return``;let n=sU(e);if(!lN.has(t)||n&&e.children.length===0)return n;let r=[];return lU(e,r,100),r.join(` `)},dU=e=>iU(e,15),fU=e=>{let t=[];for(let n of sN){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},pU=e=>e===`class`||e===`className`||e===`style`,mU=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!aU(i)){if(pU(i)){i!==`style`&&a&&(r=` class="${dU(a)}"`);continue}cN.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${dU(a)}"`)}return t.join(``)+n.join(``)+r},hU=e=>e.length===0?``:e.length<=2?e.map(e=>`<${RN(e)} ...>`).join(`
258
- `):`(${e.length} elements)`,gU=e=>{let t=RN(e);if(!(e instanceof HTMLElement))return`<${t}${fU(e)} />`;let n=mU(e),r=iU(uU(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},_U=e=>{let t=RN(e),n=mU(e),r=uU(e,t),i=[],a=[],o=!1;for(let t of e.childNodes)t.nodeType!==Node.COMMENT_NODE&&(t.nodeType===Node.TEXT_NODE?t.textContent&&t.textContent.trim().length>0&&(o=!0):t instanceof Element&&(o?a.push(t):i.push(t)));let s=r.length>0&&lN.has(t),c=``,l=hU(i);l&&!s&&(c+=`\n ${l}`),r&&(c+=`\n ${iU(r,100)}`);let u=hU(a);return u&&!s&&(c+=`\n ${u}`),c.length>0?`<${t}${n}>${c}\n</${t}>`:`<${t}${n} />`},vU=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),yU=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),bU=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),xU=new Set([`MotionDOMComponent`]),SU=e=>{if(yU.has(e)||bU.has(e)||xU.has(e))return!0;for(let t of vU)if(e.startsWith(t))return!0;return!1},CU=e=>!(!e||SU(e)||e===`SlotClone`||e===`Slot`),wU=e=>!(e.length<=1||SU(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),TU=e=>e&&wU(e)?e:null,EU=e=>{if(!dP())return e;let t=e;for(;t;){if(fP(t))return t;t=t.parentElement}return e},DU=e=>{if(!dP())return null;let t=fP(EU(e)),n=0;for(;t;){if(t.key)return t.key;if(oP(t)&&(n+=1,n===2))break;t=t.return}return null},OU=new WeakMap,kU=new WeakMap,AU=e=>t=>fetch(t,{signal:e,priority:`high`}),jU=e=>rU(async t=>{try{let n=fP(e);if(!n)return null;let r=await lF(n,!0,AU(t));return XF()?await XH(QH(n,r),t):r}catch{return null}},null),MU=e=>{if(!dP())return Promise.resolve([]);let t=EU(e),n=OU.get(t);if(n)return n;let r=jU(t).then(e=>(e===null&&OU.delete(t),e));return OU.set(t,r),r},NU=async e=>{if(!dP())return null;let t=await MU(e);if(!t)return null;for(let e of t){let t=TU(e.functionName);if(t)return t}return null},PU=e=>e.find(e=>!!TU(e.functionName))??e[0]??null,FU=e=>!e||!oP(e)?null:TU(uP(e.type)),IU=e=>rU(async t=>{let n=fP(EU(e));if(!n)return null;try{let e=await dF(n,!0,AU(t));return e?.fileName?{filePath:JF(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:TU(e.functionName)??FU(n._debugOwner),origin:xH(e.fileName).origin}:null}catch{return null}},null),LU=e=>{let t=EU(e),n=kU.get(t);if(n)return n;let r=IU(t).then(e=>(e||kU.delete(t),e));return kU.set(t,r),r},RU=[`app`,`package`],zU=(e,t)=>{for(let n of RU){if(e?.origin===n)return e;let r=PU(t.filter(e=>xH(e.fileName).origin===n));if(r?.fileName)return{filePath:JF(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:TU(r.functionName),origin:n}}return null},BU=async e=>{let t=await LU(e);return t?.origin===`app`?t:zU(t,await MU(e)??[])},VU=e=>HU(EU(e),1)[0]??null,HU=(e,t,n=()=>!0)=>{if(!dP())return[];let r=fP(e);if(!r)return[];let i=[];return TM(r,e=>{if(i.length>=t)return!0;if(oP(e)){let t=uP(e.type);t&&CU(t)&&n(t)&&i.push(t)}return!1},!0),i},UU=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],WU=(e,t)=>{let n=JF(e);if(!t||!n.startsWith(`/`))return n;for(let e of UU){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},GU=(e,t)=>{let n=WU(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},KU={isAppSource:!1,consumesBudget:!1},qU=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...KU}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...KU}:i?{text:`\n in ${i}`,...KU}:a?{text:GU({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!WH(a)}:null},JU=(e,t={},n=null)=>{let r=QV(t.maxLines),i=Math.max(r,20),a=XF(),o=[],s=new Set,c=null,l=!1,u=!1,d=!1,f=0,p=e=>{e&&s.add(e)};n&&(u=n.origin===`app`,WH(n.filePath)||(f+=1),p(n.componentName),o.push(GU(n,a)));for(let t of e){if(f>=r||o.length>=i)break;let e=xH(t.fileName),s=TU(t.functionName),m=e.packageName?`${e.packageName}:${s??``}:${t.isServer?`server`:`client`}`:null;if(m&&m===c)continue;if(!l&&s&&s===n?.componentName){l=!0;continue}let h=qU(t,e,s,a);h!==null&&h.text!==o[o.length-1]&&(h.isAppSource&&(u=!0),h.consumesBudget&&(f+=1,d=!0),p(s),o.push(h.text),c=m)}return{text:o.join(``),shouldAppendSelectorHint:!u,hasBudgetedStackFrame:d,renderedComponentNames:s}},YU=async e=>{let t=await LU(e);return t?.origin===`app`?t:null},XU=(e,t,n)=>{let r=HU(EU(e),n,e=>wU(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${GH(r)}`}},ZU=async(e,t={})=>{let n=await YU(e),r=await MU(e),i=QV(t.maxLines),a=JU(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:XU(e,a,i);let o=HU(EU(e),i);return{text:GH(o),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(o)}},QU=async(e,t={})=>(await ZU(e,t)).text,$U=(e,t)=>{let n=DU(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${UH(e)}`:``;return`${t.text}${r}${i}`},eW=async(e,t={})=>{let n=await ZU(e,t);return`${gU(e)}${$U(e,n).replace(/\n\s+/g,` `)}`},tW=async(e,t={})=>{let n=EU(e);return`${_U(n)}${$U(n,await ZU(n,t))}`},nW=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),rW=(e,t)=>{let n=t?.componentName??`div`,r={version:VM,content:e,entries:t?.entries??[{tagName:t?.tagName,componentName:n,content:e,commentText:t?.commentText}],timestamp:Date.now()},i=t=>{t.preventDefault(),t.clipboardData?.setData(`text/plain`,e),t.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${nW(e)}</code></pre>`),t.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(r))};document.addEventListener(`copy`,i);let a=document.createElement(`textarea`);a.value=e,a.style.position=`fixed`,a.style.left=`-9999px`,a.ariaHidden=`true`,document.body.appendChild(a),a.select();try{return typeof document.execCommand==`function`&&document.execCommand(`copy`)}finally{document.removeEventListener(`copy`,i),a.remove()}}})),aW=r({ReactGrabRenderer:()=>EJ}),oW,sW,cW,lW,uW,dW,fW,pW,mW,hW,gW,_W,vW,yW,bW,xW,SW,CW,wW,TW,EW,DW,OW,kW,AW,jW,MW,NW,PW,FW,IW,LW,RW,zW,BW,VW,HW,UW,WW,GW,KW,qW,JW,YW,XW,ZW,QW,$W,eG,tG,nG,rG,iG,aG,oG,sG,cG,lG,uG,dG,fG,pG,mG,hG,gG,_G,vG,yG,bG,xG,SG,CG,wG,TG,EG,DG,OG,kG,AG,jG,MG,NG,PG,FG,IG,LG,RG,zG,BG,VG,HG,UG,WG,GG,KG,qG,JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK,aK,oK,sK,cK,lK,uK,dK,fK,pK,mK,hK,gK,_K,vK,yK,bK,xK,SK,CK,wK,TK,EK,DK,OK,kK,AK,jK,MK,NK,PK,FK,IK,LK,RK,zK,BK,VK,HK,UK,WK,GK,KK,qK,JK,YK,XK,ZK,QK,$K,eq,tq,nq,rq,iq,aq,oq,sq,cq,lq,uq,dq,fq,pq,mq,hq,gq,_q,vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ=t((()=>{KV(),pR(),oW=(e,t,n)=>e+(t-e)*n,sW=(e,t)=>{let n=Math.max(t,1);return 1-(1-e)**(n/$M)},cW=Z(`<canvas data-react-grab-overlay-canvas style=position:fixed;top:0;left:0;pointer-events:none>`),lW={borderColor:rN,fillColor:iN,lerpFactor:WM},uW={drag:{borderColor:tN,fillColor:nN,lerpFactor:QM},selection:lW,grabbed:lW},dW=e=>{let t,n=null,r=0,i=0,a=1,o=null,s=null,c={drag:{canvas:null,context:null},selection:{canvas:null,context:null},grabbed:{canvas:null,context:null}},l=[],u=null,d=[],f=MM()?`display-p3`:`srgb`,p=(e,t,n)=>{let r=new OffscreenCanvas(e*n,t*n),i=r.getContext(`2d`,{colorSpace:f});return i&&i.scale(n,n),{canvas:r,context:i}},m=()=>{if(t){a=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,i=window.innerHeight,t.width=r*a,t.height=i*a,t.style.width=`${r}px`,t.style.height=`${i}px`,n=t.getContext(`2d`,{colorSpace:f}),n&&n.scale(a,a);for(let e of Object.keys(c))c[e]=p(r,i,a)}},h=e=>{if(!e)return 0;let t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):0},g=(e,t,n)=>({id:e,current:{x:t.x,y:t.y,width:t.width,height:t.height},target:{x:t.x,y:t.y,width:t.width,height:t.height},borderRadius:h(t.borderRadius),opacity:n?.opacity??1,targetOpacity:n?.targetOpacity??n?.opacity??1,createdAt:n?.createdAt,fadeStartTimestamp:null,isInitialized:!0}),_=(e,t,n)=>{let r=e.target;r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height,e.borderRadius=h(t.borderRadius),n!==void 0&&(e.targetOpacity=n)},v=e=>e.boundsMultiple??[e.bounds],y=(e,t,n,r,i,a,o,s,c=1)=>{if(r<=0||i<=0)return;let l=Math.min(r/2,i/2),u=Math.min(a,l),d=c!==1;d&&(e.globalAlpha=c),e.beginPath(),u>0?e.roundRect(t,n,r,i,u):e.rect(t,n,r,i),e.fillStyle=o,e.fill(),e.strokeStyle=s,e.lineWidth=1,e.stroke(),d&&(e.globalAlpha=1)},b=()=>{let t=c.drag;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.dragVisible||!u)return;let a=uW.drag;y(n,u.current.x,u.current.y,u.current.width,u.current.height,u.borderRadius,a.fillColor,a.borderColor)},x=()=>{let t=c.selection;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.selectionVisible)return;let a=uW.selection;for(let e of l)y(n,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,a.fillColor,a.borderColor,e.opacity)},S=(e,t)=>{let n=c[e];if(!n.context)return;let a=n.context;a.clearRect(0,0,r,i);let o=uW[e];for(let e of t)y(a,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,o.fillColor,o.borderColor,e.opacity)},C=()=>{if(!(!n||!t)&&!(r<=0||i<=0)){n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.setTransform(a,0,0,a,0,0),b(),x(),S(`grabbed`,d);for(let e of[`drag`,`selection`,`grabbed`]){let t=c[e];t.canvas&&n.drawImage(t.canvas,0,0,r,i)}}},w=(e,t,n)=>{let r=oW(e.current.x,e.target.x,t),i=oW(e.current.y,e.target.y,t),a=oW(e.current.width,e.target.width,t),o=oW(e.current.height,e.target.height,t),s=Math.abs(r-e.target.x)<.5&&Math.abs(i-e.target.y)<.5&&Math.abs(a-e.target.width)<.5&&Math.abs(o-e.target.height)<.5;e.current.x=s?e.target.x:r,e.current.y=s?e.target.y:i,e.current.width=s?e.target.width:a,e.current.height=s?e.target.height:o;let c=!0;if(n?.interpolateOpacity){let n=oW(e.opacity,e.targetOpacity,t);c=Math.abs(n-e.targetOpacity)<eN,e.opacity=c?e.targetOpacity:n}return!s||!c},T=()=>{let e=performance.now(),t=s===null?$M:e-s;s=e;let n=sW(uW.drag.lerpFactor,t),r=sW(uW.selection.lerpFactor,t),i=sW(uW.grabbed.lerpFactor,t),a=!1;u?.isInitialized&&w(u,n)&&(a=!0);for(let e of l)e.isInitialized&&w(e,r)&&(a=!0);let c=Date.now();d=d.filter(t=>{let n=t.id.startsWith(`label-`);if(t.isInitialized&&w(t,i)&&(a=!0),n&&t.targetOpacity===0){t.fadeStartTimestamp===null&&(t.fadeStartTimestamp=e);let n=e-t.fadeStartTimestamp,r=Math.min(1,n/125),i=1-(1-r)*(1-r);return t.opacity=Math.max(0,1-i),r>=1?!1:(a=!0,!0)}else n&&(t.fadeStartTimestamp=null);if(t.createdAt){let e=c-t.createdAt;if(e>=1625)return!1;if(e>1500){let n=Math.min(1,(e-GM)/125);t.opacity=1-(1-(1-n)*(1-n)),a=!0}return!0}return n?!0:t.opacity>0}),C(),a?o=nI(T):(o=null,s=null)},ee=()=>{o===null&&(o=nI(T))},E=()=>{m(),ee()};return yR(wR(()=>[e.selectionVisible,e.selectionBounds,e.selectionBoundsMultiple,e.selectionShouldSnap],([e,t,n,r])=>{if(!e||!t&&(!n||n.length===0)){l=[],ee();return}let i;i=n&&n.length>0?n:t?[t]:[];let a=new Map;for(let e of l)a.set(e.id,e);l=i.map((e,t)=>{let n=`selection-${t}`,i=a.get(n);return i?(_(i,e),r&&(i.current.x=i.target.x,i.current.y=i.target.y,i.current.width=i.target.width,i.current.height=i.target.height),i):g(n,e)}),ee()})),yR(wR(()=>[e.dragVisible,e.dragBounds],([e,t])=>{if(!e||!t){u=null,ee();return}u?_(u,t):u=g(`drag`,t),ee()})),yR(wR(()=>[e.grabbedBoxes,e.labelInstances],([e,t])=>{let n=e??[],r=t??[],i=new Map;for(let e of n)i.set(e.id,e);let a=new Map;for(let e of d)a.set(e.id,e);for(let e of n)if(!a.has(e.id)){let t=g(e.id,e.bounds,{createdAt:e.createdAt});d.push(t),a.set(e.id,t)}for(let e of d){let t=i.get(e.id);t&&_(e,t.bounds)}let o=new Set;for(let e of r){let t=v(e),n=e.status===`fading`?0:1;for(let r=0;r<t.length;r++){let i=t[r],s=`label-${e.id}-${r}`;o.add(s);let c=a.get(s);if(c)_(c,i,n);else{let e=g(s,i,{opacity:1,targetOpacity:n});d.push(e),a.set(s,e)}}}d=d.filter(e=>e.id.startsWith(`label-`)?o.has(e.id):i.has(e.id)),ee()})),TR(()=>{m(),ee(),window.addEventListener(`resize`,E);let e=null,t=()=>{Math.max(window.devicePixelRatio||1,2)!==a&&(E(),n())},n=()=>{e&&e.removeEventListener(`change`,t),e=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),e.addEventListener(`change`,t)};n(),ER(()=>{window.removeEventListener(`resize`,E),e&&e.removeEventListener(`change`,t),o!==null&&rI(o)})}),(()=>{var e=cW(),n=t;return typeof n==`function`?xz(n,e):t=e,vR(t=>yz(e,`z-index`,String(ZM))),e})()},fW=Z(`<div style=position:fixed;pointer-events:none;will-change:opacity;contain:strict;transform:translateZ(0)>`),pW=e=>{let t=LM(),n=t?getComputedStyle(t).borderRadius:`0px`,r=()=>t?.getBoundingClientRect()??null,[i,a]=J(r());if(t){let n=()=>a(r());TR(()=>{let e=new ResizeObserver(n);e.observe(t),window.addEventListener(`scroll`,n,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),ER(()=>{e.disconnect(),window.removeEventListener(`scroll`,n,{capture:!0}),window.removeEventListener(`resize`,n)})}),yR(()=>{e.visible&&n()})}let o=()=>{let e=i();return e?`${e.top}px`:`0`},s=()=>{let e=i();return e?`${e.left}px`:`0`},c=()=>{let e=i();return e?`${e.width}px`:`100%`},l=()=>{let e=i();return e?`${e.height}px`:`100%`};return(()=>{var t=fW();return yz(t,`border-radius`,n),yz(t,`z-index`,ZM),yz(t,`transition`,`opacity 125ms ease-out`),yz(t,`box-shadow`,`inset 0 0 50px ${aN}`),vR(n=>{var r=o(),i=s(),a=c(),u=l(),d=+!!e.visible;return r!==n.e&&yz(t,`top`,n.e=r),i!==n.t&&yz(t,`left`,n.t=i),a!==n.a&&yz(t,`width`,n.a=a),u!==n.o&&yz(t,`height`,n.o=u),d!==n.i&&yz(t,`opacity`,n.i=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()},mW=(e,t)=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`},hW=(e,t)=>{e&&e.focus(t)},gW=e=>{if(e<=0)return 8;let t=e*oN;return Math.round(Math.max(4,Math.min(8,t)))},_W=()=>{let e=LM();if(e){let t=e.getBoundingClientRect();return{width:t.width,height:t.height,offsetLeft:t.left,offsetTop:t.top}}let t=window.visualViewport;return t?{width:t.width,height:t.height,offsetLeft:t.offsetLeft,offsetTop:t.offsetTop}:{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0}},vW=e=>{if(typeof e==`string`||typeof e==`number`)return String(e);if(!e||typeof e!=`object`)return``;if(Array.isArray(e)){let t=``;for(let n of e){if(!n)continue;let e=vW(n);e&&(t=t?`${t} ${e}`:e)}return t}let t=``;for(let n in e)e[n]&&(t=t?`${t} ${n}`:n);return t},yW=(...e)=>{let t=``;for(let n of e){if(!n)continue;let e=vW(n);e&&(t=t?`${t} ${e}`:e)}return t},bW=e=>e.elementsCount&&e.elementsCount>1?{tagName:`${e.elementsCount} elements`,componentName:void 0}:{tagName:e.tagName||e.componentName||`element`,componentName:e.tagName?e.componentName:void 0},xW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M19.2929 12.7071C19.6834 13.0976 20.3166 13.0976 20.7071 12.7071C21.0976 12.3166 21.0976 11.6834 20.7071 11.2929L12.7071 3.29289C12.5196 3.10536 12.2652 3 12 3C11.7348 3 11.4804 3.10536 11.2929 3.29289L3.29289 11.2929C2.90237 11.6834 2.90237 12.3166 3.29289 12.7071C3.68342 13.0976 4.31658 13.0976 4.70711 12.7071L11 6.41421L11 20C11 20.5523 11.4477 21 12 21C12.5523 21 13 20.5523 13 20L13 6.41422L19.2929 12.7071Z">`),SW=e=>{let t=()=>e.size??10;return(()=>{var n=xW();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},CW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path class=icon-loader-bar d="M12 2v4"style=animation-delay:0ms></path><path class=icon-loader-bar d="M15 6.8l2-3.5"style=animation-delay:-42ms></path><path class=icon-loader-bar d="M17.2 9l3.5-2"style=animation-delay:-83ms></path><path class=icon-loader-bar d="M18 12h4"style=animation-delay:-125ms></path><path class=icon-loader-bar d="M17.2 15l3.5 2"style=animation-delay:-167ms></path><path class=icon-loader-bar d="M15 17.2l2 3.5"style=animation-delay:-208ms></path><path class=icon-loader-bar d="M12 18v4"style=animation-delay:-250ms></path><path class=icon-loader-bar d="M9 17.2l-2 3.5"style=animation-delay:-292ms></path><path class=icon-loader-bar d="M6.8 15l-3.5 2"style=animation-delay:-333ms></path><path class=icon-loader-bar d="M2 12h4"style=animation-delay:-375ms></path><path class=icon-loader-bar d="M6.8 9l-3.5-2"style=animation-delay:-417ms></path><path class=icon-loader-bar d="M9 6.8l-2-3.5"style=animation-delay:-458ms>`),wW=e=>{let t=()=>e.size??16;return(()=>{var n=CW();return n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling,vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},TW=Z(`<svg data-react-grab-arrow class="absolute block z-10"><path>`),EW=e=>{let t=()=>e.color??`var(--rg-panel-bg)`,n=()=>e.position===`bottom`,r=()=>gW(e.labelWidth??0),i=()=>r()*2,a=()=>r(),o=()=>{let e=i(),t=a(),r=1*Math.SQRT1_2,o=e/2,s=n()?t:0,c=n()?r:t-r,l=+!!n();return`M0 ${s} L${o-r} ${c} A1 1 0 0 ${l} ${o+r} ${c} L${e} ${s} Z`};return(()=>{var r=TW(),s=r.firstChild;return vR(c=>{var l=i(),u=a(),d=`0 0 ${i()} ${a()}`,f=`calc(${e.leftPercent}% + ${e.leftOffsetPx}px)`,p=n()?`0`:void 0,m=n()?void 0:`0`,h=n()?`translateX(-50%) translateY(calc(-100% + 1px))`:`translateX(-50%) translateY(calc(100% - 1px))`,g=o(),_=t();return l!==c.e&&Q(r,`width`,c.e=l),u!==c.t&&Q(r,`height`,c.t=u),d!==c.a&&Q(r,`viewBox`,c.a=d),f!==c.o&&yz(r,`left`,c.o=f),p!==c.i&&yz(r,`top`,c.i=p),m!==c.n&&yz(r,`bottom`,c.n=m),h!==c.s&&yz(r,`transform`,c.s=h),g!==c.h&&Q(s,`d`,c.h=g),_!==c.r&&Q(s,`fill`,c.r=_),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),r})()},DW=Z(`<span class=text-[var(--rg-text-primary)]>`),OW=Z(`<span class=text-[var(--rg-text-secondary)]>.`),kW=Z(`<span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),AW=Z(`<button type=button>`),jW=Z(`<div>`),MW=e=>{let t=()=>{e.onHoverChange?.(!0)},n=()=>{e.onHoverChange?.(!1)},r=()=>e.componentName?`${e.componentName}.${e.tagName}`:e.tagName,i=()=>(()=>{var t=kW();return $(t,X(oz,{get when(){return e.componentName},get children(){return[(()=>{var t=DW();return $(t,()=>e.componentName),t})(),(()=>{var t=OW();return t.firstChild,$(t,()=>e.tagName,null),t})()]}}),null),$(t,X(oz,{get when(){return!e.componentName},get children(){var t=DW();return $(t,()=>e.tagName),t}}),null),t})();return X(oz,{get when(){return e.isClickable},get fallback(){return(()=>{var r=jW();return gz(r,`click`,e.onClick,!0),r.addEventListener(`mouseleave`,n),r.addEventListener(`mouseenter`,t),$(r,i),vR(()=>hz(r,yW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden`,e.shrink&&`shrink-0`))),r})()},get children(){var a=AW();return gz(a,`click`,e.onClick,!0),a.addEventListener(`mouseleave`,n),a.addEventListener(`mouseenter`,t),$(a,i),vR(t=>{var n=`Open source for ${r()}`,i=yW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden cursor-pointer bg-transparent border-none p-0 m-0 text-left`,e.shrink&&`shrink-0`);return n!==t.e&&Q(a,`aria-label`,t.e=n),i!==t.t&&hz(a,t.t=i),t},{e:void 0,t:void 0}),a}})},fz([`click`]),NW=Z(`<div class="[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-auto h-fit self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased rounded-t-none rounded-b-[6px]">`),PW=e=>(()=>{var t=NW();return $(t,()=>e.children),t})(),FW=(e,t={})=>(n={})=>{let r=t.variants;if(!r)return e;let i=[e];for(let e in r){let a=n[e]??t.defaultVariants?.[e];if(a===void 0)continue;let o=r[e][String(a)];o&&i.push(o)}return yW(...i)},IW=Z(`<div>`),LW=FW(`contain-layout antialiased [font-synthesis:none] bg-[var(--rg-panel-bg)]`,{variants:{shape:{panel:`rounded-[14px] [corner-shape:superellipse(1.25)]`,pill:`rounded-full`}},defaultVariants:{shape:`panel`}}),RW=e=>{let[t,n]=rz(e,[`shape`,`class`]);return(()=>{var e=IW();return bz(e,nz({get class(){return yW(LW({shape:t.shape}),t.class)}},n),!1,!1),e})()},zW=null,BW={claim:e=>{zW=e},release:e=>{zW===e&&(zW=null)},isActive:e=>zW===e},VW=e=>{let t=Symbol(),n=zM(n=>{BW.isActive(t)&&(uB(n)||(n.code===`Enter`?e.onEnter?.(n):n.code===`Escape`&&e.onEscape?.(n)))});return TR(()=>{BW.claim(t),window.addEventListener(`keydown`,n,{capture:!0})}),ER(()=>{BW.release(t),window.removeEventListener(`keydown`,n,{capture:!0})}),{claimFocus:()=>BW.claim(t)}},HW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M10.7071 21.2071C10.3166 21.5976 9.68342 21.5976 9.29289 21.2071L3.29289 15.2071C2.90237 14.8166 2.90237 14.1834 3.29289 13.7929L9.29289 7.79289C9.68342 7.40237 10.3166 7.40237 10.7071 7.79289C11.0976 8.18342 11.0976 8.81658 10.7071 9.20711L6.41421 13.5H16C16.5523 13.5 17 13.0523 17 12.5V3.5C17 2.94772 17.4477 2.5 18 2.5C18.5523 2.5 19 2.94772 19 3.5V12.5C19 14.1569 17.6569 15.5 16 15.5H6.41421L10.7071 19.7929C11.0976 20.1834 11.0976 20.8166 10.7071 21.2071Z">`),UW=e=>{let t=()=>e.size??10;return(()=>{var n=HW();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},WW=Z(`<button>`),GW=FW(`contain-layout shrink-0 flex items-center justify-center cursor-pointer transition-all press-scale`,{variants:{variant:{chip:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-surface-hover)] [border-width:0.5px] border-solid border-[var(--rg-border-button)] hover:bg-[var(--rg-surface-active)] text-[var(--rg-text-primary)]`,destructive:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-error-bg)] hover:bg-[var(--rg-error-bg-hover)] text-[var(--rg-error-text)]`,ghost:`rounded-sm bg-transparent hover:bg-[var(--rg-surface-hover)] border-none outline-none p-0`}},defaultVariants:{variant:`chip`}}),KW=e=>{let[t,n]=rz(e,[`variant`,`class`,`type`]);return(()=>{var e=WW();return bz(e,nz({get type(){return t.type??`button`},get class(){return yW(GW({variant:t.variant}),t.class)}},n),!1,!1),e})()},qW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),JW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),YW=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),XW=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),ZW=Z(`<div data-react-grab-discard-prompt class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit">`),QW=e=>{let t=()=>e.showCancel??!0,{claimFocus:n}=VW({onEnter:t=>{t.preventDefault(),t.stopPropagation();let n=t.composedPath()[0],r=n instanceof HTMLElement?n:null;if(r?.closest(`[data-react-grab-discard-copy]`)){e.onCopy?.();return}if(r?.closest(`[data-react-grab-discard-no]`)){e.onCancel?.();return}if(r?.closest(`[data-react-grab-discard-yes]`)){e.onConfirm?.();return}e.onConfirm?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.cancelOnEscape?e.onCancel?.():e.onConfirm?.()}});return(()=>{var r=ZW(),i=r.firstChild.firstChild;return gz(r,`click`,n,!0),gz(r,`pointerdown`,n,!0),$(i,()=>e.label??`Discard?`),$(r,X(PW,{get children(){var n=XW();return $(n,X(oz,{get when(){return t()},get children(){return X(KW,{"data-react-grab-discard-no":!0,get onClick(){return e.onCancel},get children(){return qW()}})}}),null),$(n,X(oz,{get when(){return e.onCopy},get children(){return X(KW,{"data-react-grab-discard-copy":!0,get onClick(){return e.onCopy},get children(){return JW()}})}}),null),$(n,X(KW,{variant:`destructive`,class:`gap-0.5`,"data-react-grab-discard-yes":!0,get onClick(){return e.onConfirm},get children(){return[YW(),X(UW,{size:10,class:`text-[var(--rg-error-text)] opacity-50`})]}}),null),n}}),null),r})()},fz([`pointerdown`,`click`]),$W=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7 2C4.23858 2 2 4.23858 2 7V15C2 17.7614 4.23858 20 7 20H8C8.55228 20 9 19.5523 9 19C9 18.4477 8.55228 18 8 18H7C5.34315 18 4 16.6569 4 15V7C4 5.34315 5.34315 4 7 4H17C18.6569 4 20 5.34315 20 7V15C20 16.6569 18.6569 18 17 18H14.4142L16.2071 16.2071C16.5976 15.8166 16.5976 15.1834 16.2071 14.7929C15.8166 14.4024 15.1834 14.4024 14.7929 14.7929L11.2929 18.2929C11.197 18.3888 11.1247 18.4993 11.0759 18.6172C11.027 18.7351 11 18.8644 11 19C11 19.2728 11.1093 19.5201 11.2864 19.7005C11.2889 19.7031 11.2914 19.7056 11.2939 19.7081L14.7929 23.2071C15.1834 23.5976 15.8166 23.5976 16.2071 23.2071C16.5976 22.8166 16.5976 22.1834 16.2071 21.7929L14.4142 20H17C19.7614 20 22 17.7614 22 15V7C22 4.23858 19.7614 2 17 2H7Z">`),eG=e=>{let t=()=>e.size??12;return(()=>{var n=$W();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},tG=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Retry`),nG=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Ok`),rG=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),iG=Z(`<div data-react-grab-error role=alert aria-live=assertive class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-start gap-1 px-2 w-full h-fit"><span class="text-[var(--rg-error-text)] text-[13px] leading-4 font-sans font-medium overflow-hidden line-clamp-5">`),aG=e=>{let{claimFocus:t}=VW({onEnter:t=>{t.preventDefault(),t.stopPropagation(),e.onRetry?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onAcknowledge?.()}}),n=()=>!!(e.onRetry||e.onAcknowledge);return(()=>{var r=iG(),i=r.firstChild,a=i.firstChild;return gz(r,`click`,t,!0),gz(r,`pointerdown`,t,!0),$(a,()=>e.error),$(r,X(oz,{get when(){return n()},get children(){return X(PW,{get children(){var t=rG();return $(t,X(oz,{get when(){return e.onRetry},get children(){return X(KW,{"data-react-grab-retry":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,get onClick(){return e.onRetry},get children(){return[tG(),X(eG,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-text-secondary)]`})]}})}}),null),$(t,X(oz,{get when(){return e.onAcknowledge},get children(){return X(KW,{"data-react-grab-error-ok":!0,class:`gap-1`,"aria-keyshortcuts":`Escape`,get onClick(){return e.onAcknowledge},get children(){return nG()}})}}),null),t}})}}),null),vR(t=>{var r={"pt-1.5 pb-1":n(),"py-1.5":!n()},o=e.error;return t.e=_z(i,r,t.e),o!==t.t&&Q(a,`title`,t.t=o),t},{e:void 0,t:void 0}),r})()},fz([`pointerdown`,`click`]),oG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7.5 12C7.5 13.3807 6.38071 14.5 5 14.5C3.61929 14.5 2.5 13.3807 2.5 12C2.5 10.6193 3.61929 9.5 5 9.5C6.38071 9.5 7.5 10.6193 7.5 12ZM14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12ZM19 14.5C20.3807 14.5 21.5 13.3807 21.5 12C21.5 10.6193 20.3807 9.5 19 9.5C17.6193 9.5 16.5 10.6193 16.5 12C16.5 13.3807 17.6193 14.5 19 14.5Z">`),sG=e=>{let t=()=>e.size??14;return(()=>{var n=oG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},cG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM17.7071 10.7071C18.0976 10.3166 18.0976 9.68342 17.7071 9.29289C17.3166 8.90237 16.6834 8.90237 16.2929 9.29289L11 14.5858L8.70711 12.2929C8.31658 11.9024 7.68342 11.9024 7.29289 12.2929C6.90237 12.6834 6.90237 13.3166 7.29289 13.7071L10.2929 16.7071C10.6834 17.0976 11.3166 17.0976 11.7071 16.7071L17.7071 10.7071Z">`),lG=e=>{let t=()=>e.size??14;return(()=>{var n=cG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},uG=Z(`<button data-react-grab-ignore-events data-react-grab-more-options>`),dG=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Keep`),fG=Z(`<div class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0"></span><div class="contain-layout shrink-0 flex items-center gap-2 h-fit">`),pG=Z(`<div class="contain-layout shrink-0 flex items-center gap-0.5 py-1.5 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),mG=e=>(()=>{var t=uG();return gz(t,`click`,t=>{t.stopImmediatePropagation(),e.onClick()}),gz(t,`pointerdown`,e=>{e.stopImmediatePropagation()}),$(t,X(sG,{size:14,class:`opacity-50 group-hover:opacity-100 transition-opacity`})),vR(()=>hz(t,yW(GW({variant:`ghost`}),`group size-4 text-[var(--rg-text-secondary)] hover:text-[var(--rg-text-primary)]`))),t})(),hG=e=>{let t,n,[r,i]=J(!1),[a,o]=J(!1),s=()=>r()?`Copied`:e.statusText,c=()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n),o(!0),e.onFadingChange?.(!0),e.onShowContextMenu?.()},l=()=>{r()||(i(!0),t=window.setTimeout(()=>{o(!0),e.onFadingChange?.(!0),n=window.setTimeout(()=>{e.onDismiss?.()},125)},1375))},{claimFocus:u}=VW({onEnter:e=>{e.preventDefault(),e.stopPropagation(),l()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onDismiss?.()}});return ER(()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n)}),X(RW,{shape:`pill`,"data-react-grab-completion":!0,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,class:`shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px] transition-opacity duration-100 ease-out`,get style(){return{opacity:+!a()}},onPointerDown:u,onClick:u,get children(){return[X(oz,{get when(){return aB(()=>!r())()&&e.onDismiss},get children(){var t=fG(),n=t.firstChild,i=n.nextSibling;return $(n,s),$(i,X(oz,{get when(){return e.onShowContextMenu},get children(){return X(mG,{onClick:c})}}),null),$(i,X(oz,{get when(){return e.onDismiss},get children(){return X(KW,{"data-react-grab-dismiss":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,onClick:l,get disabled(){return r()},get"aria-disabled"(){return r()},get children(){return[dG(),X(oz,{get when(){return!r()},get children(){return X(UW,{size:10,class:`text-[var(--rg-text-secondary)]`})}})]}})}}),null),t}}),X(oz,{get when(){return r()||!e.onDismiss},get children(){var t=pG(),n=t.firstChild;return $(t,X(lG,{size:14,"aria-hidden":`true`,class:`text-[var(--rg-text-primary-85)] shrink-0`}),n),$(n,s),$(t,X(oz,{get when(){return e.onShowContextMenu},get children(){return X(mG,{onClick:c})}}),null),t}})]}})},gG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 py-1.5 px-2 w-full h-fit"><span class="shimmer-text text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap">`),_G=Z(`<div class="contain-layout shrink-0 flex flex-col items-start w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 w-fit h-fit px-2 py-1.5">`),vG=Z(`<button data-react-grab-submit type=button aria-label="Submit context"class="contain-layout shrink-0 flex items-center justify-center size-4 rounded-full bg-[var(--rg-submit-bg)] cursor-pointer ml-1 interactive-scale a11y-hitbox">`),yG=Z(`<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Add context for selected element"aria-keyshortcuts="Enter Escape"class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none flex-1 p-0 m-0 wrap-break-word overflow-y-auto"placeholder="Add context"rows=1 style=field-sizing:content;min-height:16px;scrollbar-width:none>`),bG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit min-w-[150px] max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2 max-w-full">`),xG=Z(`<div data-react-grab-ignore-events data-react-grab-selection-label>`),SG={left:LN,top:LN,arrowLeftPercent:50,arrowLeftOffset:0,edgeOffsetX:0},CG=e=>{let t,n,r,i=!1,[a,o]=J(0),[s,c]=J(0),[l,u]=J(0),[d,f]=J(0),[p,m]=J(!1),[h,g]=J(!1),_=()=>e.status!==`copying`&&e.status!==`copied`&&e.status!==`fading`&&e.status!==`error`,v=()=>e.status===`copied`||e.status===`fading`,y=()=>!!e.shouldToggleExpandOnClick&&!!e.onToggleExpand&&_()&&!e.discardPrompt&&!e.isPromptMode,b=()=>!!(e.isPromptMode||e.discardPrompt||y()||v()&&(e.onDismiss||e.onShowContextMenu)||e.status===`error`&&(e.onAcknowledgeError||e.onRetry)),x,S=e=>{i=e},C=()=>{f(e=>e+1)},w=zM(t=>{uB(t)||t.code===`Enter`&&!e.isPromptMode&&!e.discardPrompt&&_()&&(t.preventDefault(),t.stopImmediatePropagation(),e.onToggleExpand?.())});TR(()=>{let r=LM();if(x=new ResizeObserver(e=>{for(let a of e){let e=a.target.getBoundingClientRect();a.target===t&&!i?(o(e.width),c(e.height)):a.target===n?u(e.width):a.target===r&&C()}}),r&&x.observe(r),t){let e=t.getBoundingClientRect();o(e.width),c(e.height),x.observe(t)}n&&(u(n.getBoundingClientRect().width),x.observe(n)),window.addEventListener(`scroll`,C,!0),window.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`scroll`,C),e.onToggleExpand&&window.addEventListener(`keydown`,w,{capture:!0})}),ER(()=>{x?.disconnect(),window.removeEventListener(`scroll`,C,!0),window.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`scroll`,C),window.removeEventListener(`keydown`,w,{capture:!0})});let T=()=>`${e.tagName??``}:${e.componentName??``}`,ee=Y(t=>{d();let n=T(),r=n===t.elementIdentity?t:{position:SG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:n},i=e.selectionBounds,o=a(),c=s(),u=o>0&&c>0,f=i&&i.width>0&&i.height>0;if(!u||!f)return{position:r.hadValidBounds?r.position:SG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let p=_W(),m=p.offsetLeft,h=p.offsetTop,g=m+p.width,_=h+p.height;if(!(i.x+i.width>m&&i.x<g&&i.y+i.height>h&&i.y<_))return{position:SG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let v=i.x+i.width/2,y=e.mouseX??v,b=i.y+i.height,x=i.y,S=e.hideArrow?0:gW(l()),C=y,w=0,ee=b+S+4;if(o>0){let e=C-o/2,t=C+o/2;t>g-8&&(w=g-8-t),e+w<m+8&&(w=m+8-e)}let E=c+S+4,D=ee+c<=_-8;D||(ee=x-E),ee<h+8&&(ee=h+8);let O=o/2,te=O-w,k=Math.min(16,O),A=Math.max(o-16,O),ne=Math.max(k,Math.min(A,te))-O;return{position:{left:C,top:ee,arrowLeftPercent:50,arrowLeftOffset:ne,edgeOffsetX:w},computedArrowPosition:D?`bottom`:`top`,hadValidBounds:!0,elementIdentity:n}},{position:SG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:``}),E=()=>ee().computedArrowPosition??`bottom`,D=()=>ee().hadValidBounds;yR(wR(()=>e.selectionLabelShakeCount,()=>g(!0),{defer:!0}));let O=t=>{if(t.isComposing||t.keyCode===229)return;t.stopImmediatePropagation();let n=t.code===`Enter`&&!t.shiftKey,r=t.code===`Escape`;n?(t.preventDefault(),e.onSubmit?.()):r&&(t.preventDefault(),e.onConfirmDismiss?.())},te=t=>{let n=t.target;n instanceof HTMLTextAreaElement&&(mW(n,95),e.onInputChange?.(n.value))},k=()=>bW({tagName:e.tagName,componentName:e.componentName,elementsCount:e.elementsCount}),A=Y(()=>!(e.error||e.discardPrompt||_()&&e.isPromptMode)),ne=t=>{if(t.stopImmediatePropagation(),e.filePath&&e.onOpen){e.onOpen();return}y()&&e.onToggleExpand?.()},re=t=>{t.stopImmediatePropagation(),_()&&e.isPromptMode&&!e.discardPrompt&&e.onSubmit&&r&&hW(r,{preventScroll:!0})},ie=()=>D()&&(v()||e.status===`error`);return X(oz,{get when(){return aB(()=>e.visible!==!1)()&&(e.selectionBounds||ie())},get children(){var i=xG();i.addEventListener(`mouseleave`,()=>e.onHoverChange?.(!1)),i.addEventListener(`mouseenter`,()=>e.onHoverChange?.(!0)),i.$$click=e=>{e.stopImmediatePropagation()},i.$$pointerdown=re;var a=t;return typeof a==`function`?xz(a,i):t=i,yz(i,`z-index`,`${XM}`),yz(i,`transition`,`opacity 125ms ease-out, filter 125ms ease-out`),$(i,X(oz,{get when(){return!e.hideArrow},get children(){return X(EW,{get position(){return E()},get leftPercent(){return ee().position.arrowLeftPercent},get leftOffsetPx(){return ee().position.arrowLeftOffset},get labelWidth(){return l()}})}}),null),$(i,X(oz,{get when(){return aB(()=>!!v())()&&!e.error},get children(){return X(hG,{get statusText(){return e.statusText??`Copied`},get onDismiss(){return e.onDismiss},onFadingChange:m,get onShowContextMenu(){return e.onShowContextMenu}})}}),null),$(i,X(RW,{ref:e=>n=e,get shape(){return A()?`pill`:`panel`},get class(){return yW(`flex items-center gap-[5px] w-fit h-fit p-0`,h()&&`animate-shake`)},get style(){return{display:v()&&!e.error?`none`:void 0}},onAnimationEnd:()=>g(!1),get children(){return[X(oz,{get when(){return e.status===`copying`},get children(){var t=gG(),n=t.firstChild,r=n.firstChild;return $(n,X(wW,{size:13,class:`text-[var(--rg-text-secondary)] shrink-0`}),r),$(r,()=>e.statusText??`Grabbing…`),t}}),X(oz,{get when(){return aB(()=>!!(_()&&!e.isPromptMode))()&&!e.discardPrompt},get children(){var t=_G(),n=t.firstChild;return $(n,X(MW,{get tagName(){return k().tagName},get componentName(){return k().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S,shrink:!0})),t}}),X(oz,{get when(){return aB(()=>!!(_()&&e.isPromptMode))()&&!e.discardPrompt},get children(){var t=bG(),n=t.firstChild;return $(n,X(MW,{get tagName(){return k().tagName},get componentName(){return k().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S})),$(t,X(PW,{get children(){var t=yG(),n=t.firstChild;return n.$$keydown=O,n.$$input=te,xz(t=>{r=t,e.onSubmit&&queueMicrotask(()=>{hW(t,{preventScroll:!0}),mW(t,95)})},n),yz(n,`max-height`,`95px`),$(t,X(oz,{get when(){return e.onSubmit},get children(){var t=vG();return t.$$click=()=>e.onSubmit?.(),$(t,X(SW,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-submit-fg)]`})),t}}),null),vR(()=>n.readOnly=!e.onSubmit),vR(()=>n.value=e.inputValue??``),t}}),null),t}}),X(oz,{get when(){return e.discardPrompt},keyed:!0,children:e=>X(QW,{get label(){return aB(()=>!!e.isKeyboardSelection)()?`Discard selection?`:e.label},get showCancel(){return!e.isKeyboardSelection},get cancelOnEscape(){return e.cancelOnEscape},get onConfirm(){return e.onConfirm},get onCopy(){return e.onCopy},onCancel:()=>{e.isKeyboardSelection||e.onCancel?.(),hW(r,{preventScroll:!0})}})}),X(oz,{get when(){return e.error},get children(){return X(aG,{get error(){return e.error},get onAcknowledge(){return e.onAcknowledgeError},get onRetry(){return e.onRetry}})}})]}}),null),vR(t=>{var n=yW(`fixed font-sans text-[13px] antialiased select-none ease-out`),r=`${ee().position.top}px`,a=`${ee().position.left}px`,o=`translateX(calc(-50% + ${ee().position.edgeOffsetX}px))`,s=b()?`auto`:`none`,c=e.status===`fading`||p()?0:1,l=`drop-shadow(${HM}) blur(${e.status===`fading`||p()?`3px`:`0`})`;return n!==t.e&&hz(i,t.e=n),r!==t.t&&yz(i,`top`,t.t=r),a!==t.a&&yz(i,`left`,t.a=a),o!==t.o&&yz(i,`transform`,t.o=o),s!==t.i&&yz(i,`pointer-events`,t.i=s),c!==t.n&&yz(i,`opacity`,t.n=c),l!==t.s&&yz(i,`filter`,t.s=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),i}})},fz([`pointerdown`,`click`,`input`,`keydown`]),wG=Z(`<span style="transition-property:transform;transition-timing-function:cubic-bezier(0.32, 0.72, 0, 1)"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M20.8977 4.02356L21.8277 4.39121C22.3784 2.99813 21.0382 1.60206 19.6238 2.09546L3.47334 7.72936C1.38661 8.45728 1.49021 11.443 3.6224 12.0245L10.1289 13.799L11.2331 19.8724C11.638 22.0991 14.7072 22.4019 15.5393 20.2972L21.8277 4.39121L20.8977 4.02356Z">`),TG=e=>{let t=()=>e.size??14,n=()=>e.rotationDeg??0;return(()=>{var r=wG(),i=r.firstChild;return yz(r,`transition-duration`,`180ms`),vR(a=>{var o=yW(`inline-flex items-center justify-center will-change-transform`,e.class),s=`rotate(${n()}deg)`,c=t(),l=t();return o!==a.e&&hz(r,a.e=o),s!==a.t&&yz(r,`transform`,a.t=s),c!==a.a&&Q(i,`width`,a.a=c),l!==a.o&&Q(i,`height`,a.o=l),a},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()},EG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 12 12"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M1 6C1 3.239 3.239 1 6 1C8.761 1 11 3.239 11 6C11 8.761 8.761 11 6 11C5.103 11 4.261 10.764 3.532 10.35C2.959 10.759 2.257 11 1.5 11C1.376 11 1.253 10.993 1.132 10.981C0.923 10.959 0.75 10.809 0.699 10.605C0.648 10.402 0.729 10.188 0.903 10.07C1.347 9.768 1.688 9.328 1.865 8.812C1.319 8.011 1 7.042 1 6Z">`),DG=e=>{let t=()=>e.size??14;return(()=>{var n=EG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},OG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 13.867 20.345 14.992 18.77 14.992H16.029C14.739 14.992 13.823 16.248 14.218 17.476L14.48 18.295C14.751 19.139 14.643 20.041 14.211 20.751C13.769 21.479 12.985 22 12 22C6.477 22 2 17.523 2 12ZM12.21 6.783C12.416 7.585 11.933 8.403 11.131 8.609C10.328 8.815 9.511 8.332 9.305 7.529C9.099 6.727 9.582 5.909 10.384 5.703C11.187 5.497 12.004 5.981 12.21 6.783ZM7.59 9.207C8.388 9.43 8.853 10.258 8.63 11.055C8.407 11.853 7.579 12.319 6.782 12.096C5.984 11.873 5.518 11.045 5.741 10.247C5.964 9.449 6.792 8.983 7.59 9.207ZM9.497 14.446C8.918 13.854 7.968 13.844 7.376 14.423C6.784 15.002 6.773 15.952 7.353 16.544C7.932 17.136 8.882 17.147 9.474 16.567C10.066 15.988 10.076 15.039 9.497 14.446ZM16.624 9.575C16.032 10.155 15.082 10.144 14.503 9.552C13.923 8.96 13.934 8.01 14.526 7.431C15.118 6.852 16.068 6.862 16.647 7.454C17.226 8.046 17.216 8.996 16.624 9.575Z">`),kG=e=>{let t=()=>e.size??14;return(()=>{var n=OG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},AG=Z(`<div>`),jG=0,MG=()=>Date.now()-jG<800,NG=e=>{let[t,n]=J(!1),[r,i]=J(!0),a;yR(wR(()=>e.visible,e=>{a!==void 0&&(clearTimeout(a),a=void 0),e?MG()?(i(!1),n(!0)):(i(!0),a=setTimeout(()=>{n(!0)},400)):(t()&&(jG=Date.now()),n(!1))})),ER(()=>{a!==void 0&&clearTimeout(a),t()&&(jG=Date.now())});let o=()=>e.position===`top`||e.position===`bottom`?{left:`50%`,translate:`-50%`,"z-index":`${XM}`}:{top:`50%`,translate:`0 -50%`,"z-index":`${XM}`};return X(oz,{get when(){return t()},get children(){var t=AG();return $(t,()=>e.children),vR(n=>{var i=yW(`absolute whitespace-nowrap px-2 py-0.5 rounded-full text-[10px] font-sans font-medium leading-4 pointer-events-none`,`bg-[var(--rg-panel-bg)] text-[var(--rg-text-primary)] [box-shadow:var(--rg-shadow)]`,e.position===`top`&&`bottom-full mb-2.5`,e.position===`bottom`&&`top-full mt-2.5`,e.position===`left`&&`right-full mr-2.5`,e.position===`right`&&`left-full ml-2.5`,r()&&`animate-tooltip-fade-in`),a=o();return i!==n.e&&hz(t,n.e=i),n.t=vz(t,a,n.t),n},{e:void 0,t:void 0}),t}})},PG=Z(`<div><button data-react-grab-ignore-events type=button>`),FG=e=>(()=>{var t=PG(),n=t.firstChild;gz(n,`mouseleave`,e.onMouseLeave),gz(n,`mouseenter`,e.onMouseEnter),gz(n,`contextmenu`,t=>e.onContextMenu?.(t)),gz(n,`click`,e.onClick,!0);var r=e.ref;return typeof r==`function`?xz(r,n):e.ref=n,$(n,()=>e.icon),$(t,X(oz,{get when(){return e.tooltip},get children(){return X(NG,{get visible(){return!!e.tooltipVisible},get position(){return e.tooltipPosition??`top`},get children(){return e.tooltip}})}}),null),vR(r=>{var i=e.wrapperClass,a=e.isToggle?``:void 0,o=e.actionId,s=e.label,c=!!e.isActive,l=e.class;return i!==r.e&&hz(t,r.e=i),a!==r.t&&Q(n,`data-react-grab-toolbar-toggle`,r.t=a),o!==r.a&&Q(n,`data-react-grab-toolbar-action`,r.a=o),s!==r.o&&Q(n,`aria-label`,r.o=s),c!==r.i&&Q(n,`aria-pressed`,r.i=c),l!==r.n&&hz(n,r.n=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})(),fz([`click`]),IG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M9.29289 16.7071C8.90237 16.3166 8.90237 15.6834 9.29289 15.2929L12.5858 12L9.29289 8.70711C8.90237 8.31658 8.90237 7.68342 9.29289 7.29289C9.68342 6.90237 10.3166 6.90237 10.7071 7.29289L14.7071 11.2929C14.8946 11.4804 15 11.7348 15 12C15 12.2652 14.8946 12.5196 14.7071 12.7071L10.7071 16.7071C10.3166 17.0976 9.68342 17.0976 9.29289 16.7071Z">`),LG=e=>{let t=()=>e.size??14;return(()=>{var n=IG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},RG=Z(`<button data-react-grab-ignore-events data-react-grab-toolbar-collapse type=button class="group contain-layout shrink-0 flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox">`),zG=Z(`<div data-react-grab-toolbar-panel><div><div><div>`),BG=e=>{let t=()=>e.snapEdge??`bottom`,n=()=>t()===`left`||t()===`right`,r=()=>e.isCollapsed?`duration-140`:`duration-220`,i=()=>n()?`transition-[grid-template-rows] ${r()} ease-drawer`:`transition-[grid-template-columns] ${r()} ease-drawer`,a=()=>n()?`min-h-0`:`min-w-0`,o=()=>e.isCollapsed?`${{top:`rounded-t-none rounded-b-[10px]`,bottom:`rounded-b-none rounded-t-[10px]`,left:`rounded-l-none rounded-r-[10px]`,right:`rounded-r-none rounded-l-[10px]`}[t()]} ${n()?`px-0.25 py-2`:`px-2 py-0.25`}`:``,s=()=>{let n=e.isCollapsed;switch(t()){case`top`:return n?`rotate-90`:`-rotate-90`;case`bottom`:return n?`-rotate-90`:`rotate-90`;case`left`:return n?`rotate-0`:`rotate-180`;case`right`:return n?`rotate-180`:`rotate-0`;default:return`-rotate-90`}},c=()=>{if(e.isChevronPressed)return n()?`scale(0.97, 1)`:`scale(1, 0.97)`},l=()=>(()=>{var t=RG();return gz(t,`pointercancel`,e.onCollapsePointerLeave),gz(t,`pointerleave`,e.onCollapsePointerLeave),gz(t,`pointerup`,e.onCollapsePointerUp,!0),gz(t,`pointerdown`,e.onCollapsePointerDown),gz(t,`click`,e.onCollapseClick,!0),$(t,X(LG,{size:18,get class(){return yW(`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)] transition-[transform,color] duration-150 ease-drawer -m-0.5`,s())}})),vR(n=>{var r=e.isCollapsed?`Expand toolbar`:`Collapse toolbar`,i=!e.isCollapsed;return r!==n.e&&Q(t,`aria-label`,n.e=r),i!==n.t&&Q(t,`aria-expanded`,n.t=i),n},{e:void 0,t:void 0}),t})(),u=()=>e.isChevronPressed?`transition-[padding,border-radius,transform] duration-60 ease-[cubic-bezier(0,0,0.2,1)]`:`transition-[padding,border-radius,transform] ${r()} ease-drawer`;return(()=>{var t=zG(),r=t.firstChild,s=r.firstChild,d=s.firstChild;return gz(t,`click`,e.onPanelClick,!0),gz(t,`animationend`,e.onAnimationEnd),$(d,()=>e.actionButtons),$(t,l,null),vR(l=>{var f=yW(`flex items-center justify-center rounded-[13px] antialiased relative overflow-visible [font-synthesis:none]`,u(),n()&&`flex-col`,`bg-[var(--rg-panel-bg)] [box-shadow:var(--rg-shadow)]`,!e.isCollapsed&&(n()?`px-1.5 gap-0 py-2`:`py-1.5 gap-0 px-2`),o(),e.isShaking&&(n()?`animate-shake-vertical`:`animate-shake`)),p=e.transformOrigin,m=c(),h=yW(`grid relative overflow-visible`,i(),e.isCollapsed?n()?`grid-rows-[0fr] pointer-events-none`:`grid-cols-[0fr] pointer-events-none`:n()?`grid-rows-[1fr]`:`grid-cols-[1fr]`),g=yW(`flex`,n()?`flex-col items-center min-h-0`:`items-center min-w-0`,e.isCollapsed?`opacity-0`:`opacity-100`,e.isCollapsed?`transition-opacity duration-100 ease-drawer`:`transition-opacity duration-180 ease-drawer delay-[80ms]`),_=yW(`relative overflow-visible flex`,n()?`flex-col items-center`:`items-center`,a());return f!==l.e&&hz(t,l.e=f),p!==l.t&&yz(t,`transform-origin`,l.t=p),m!==l.a&&yz(t,`transform`,l.a=m),h!==l.o&&hz(r,l.o=h),g!==l.i&&hz(s,l.i=g),_!==l.n&&hz(d,l.n=_),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()},fz([`click`,`pointerup`]),VG=e=>e===`top`||e===`bottom`,HG=e=>{let t=VG(e);return{width:t?30:16,height:t?16:30}},UG=(e,t,n,r)=>{let i=_W(),a=i.width,o=i.height,s=i.offsetLeft+16,c=Math.max(s,i.offsetLeft+a-n-16),l=i.offsetTop+16,u=Math.max(l,i.offsetTop+o-r-16);if(e===`top`||e===`bottom`){let r=Math.max(0,a-n-32);return{x:Math.min(c,Math.max(s,i.offsetLeft+16+r*t)),y:e===`top`?l:u}}let d=Math.max(0,o-r-32),f=Math.min(u,Math.max(l,i.offsetTop+16+d*t));return{x:e===`left`?s:c,y:f}},WG=(e,t,n,r,i)=>{let a=_W(),o=a.width,s=a.height;if(e===`top`||e===`bottom`){let e=o-r-32;return e<=0?gN:Math.max(0,Math.min(1,(t-a.offsetLeft-16)/e))}let c=s-i-32;return c<=0?gN:Math.max(0,Math.min(1,(n-a.offsetTop-16)/c))},GG=(e,t,n,r,i)=>{let a=_W(),o=a.width,s=a.height,{width:c,height:l}=n,u;if(t===`top`||t===`bottom`){let n=(c-r)/2;u={x:MB(e.x-n,a.offsetLeft+16,a.offsetLeft+o-c-16),y:t===`top`?a.offsetTop+16:a.offsetTop+s-l-16}}else{let n=(l-i)/2,r=MB(e.y-n,a.offsetTop+16,a.offsetTop+s-l-16);u={x:t===`left`?a.offsetLeft+16:a.offsetLeft+o-c-16,y:r}}let d=WG(t,u.x,u.y,c,l);return{position:u,ratio:d}},KG=(e,t,n,r)=>{let i=_W(),{width:a,height:o}=n,{width:s,height:c}=r;switch(e){case`top`:case`bottom`:{let n=(a-s)/2;return{x:MB(t.x+n,i.offsetLeft,i.offsetLeft+i.width-s),y:e===`top`?i.offsetTop:i.offsetTop+i.height-c}}case`left`:case`right`:{let n=(o-c)/2,r=MB(t.y+n,i.offsetTop,i.offsetTop+i.height-c);return{x:e===`left`?i.offsetLeft:i.offsetLeft+i.width-s,y:r}}}},qG=(e,t,n,r,i,a)=>{let o=_W(),s=o.width,c=o.height,l=e+i*150,u=t+a*150,d=u-o.offsetTop+r/2,f=o.offsetTop+c-u-r/2,p=l-o.offsetLeft+n/2,m=o.offsetLeft+s-l-n/2,h=Math.min(d,f,p,m),g=e=>MB(e,o.offsetLeft+16,o.offsetLeft+s-n-16),_=e=>MB(e,o.offsetTop+16,o.offsetTop+c-r-16);return h===d?{edge:`top`,x:g(l),y:o.offsetTop+16}:h===p?{edge:`left`,x:o.offsetLeft+16,y:_(u)}:h===m?{edge:`right`,x:o.offsetLeft+s-n-16,y:_(u)}:{edge:`bottom`,x:g(l),y:o.offsetTop+c-r-16}},JG=e=>{let[t,n]=J(!1),[r,i]=J(!1),[a,o]=J(!1),[s,c]=J({x:0,y:0}),l={x:0,y:0},u={x:0,y:0,time:0},d={x:0,y:0},f=!1,p,m=null,h=()=>{m?.abort(),m=null},g=t=>{if(!a()){if(Math.hypot(t.clientX-d.x,t.clientY-d.y)<=5)return;o(!0),e.onDragStart()}let n=performance.now(),r=n-u.time;r>0&&c({x:(t.clientX-u.x)/r,y:(t.clientY-u.y)/r}),u={x:t.clientX,y:t.clientY,time:n};let i=t.clientX-l.x,s=t.clientY-l.y;e.onPositionUpdate({x:i,y:s})},_=()=>{h();let t=a();if(n(!1),!t)return;f=!0;let r=e.getContainerRef(),o=r?.getBoundingClientRect();if(!o)return;let c=s(),l=qG(o.left,o.top,o.width,o.height,c.x,c.y),u=WG(l.edge,l.x,l.y,o.width,o.height);e.onSnapEdgeChange(l.edge,u),i(!0),nI(()=>{let t=r?.getBoundingClientRect(),n=t?{width:t.width,height:t.height}:e.getExpandedDimensions();nI(()=>{let t=UG(l.edge,u,n.width,n.height);e.onSnapComplete({edge:l.edge,ratio:u,position:t,expandedDimensions:n}),p=setTimeout(()=>{i(!1),e.onSnapAnimationEnd?.()},300)})})},v=zM(t=>{if(t.button!==0||e.isCollapsed())return;let r=e.getContainerRef()?.getBoundingClientRect();if(!r)return;d={x:t.clientX,y:t.clientY},l={x:t.clientX-r.left,y:t.clientY-r.top},n(!0),o(!1),c({x:0,y:0}),u={x:t.clientX,y:t.clientY,time:performance.now()},h(),m=new AbortController;let{signal:i}=m;window.addEventListener(`pointermove`,g,{signal:i}),window.addEventListener(`pointerup`,_,{signal:i}),window.addEventListener(`pointercancel`,_,{signal:i})});return ER(()=>{h(),clearTimeout(p)}),{isDragging:t,isSnapping:r,handlePointerDown:v,createDragAwareHandler:e=>t=>{if(t.stopImmediatePropagation(),f){f=!1;return}e()}}},YG=(e,t)=>{let n=t-e;return e+(n-Math.round(n/360)*360)},XG=Z(`<div data-react-grab-ignore-events data-react-grab-toolbar>`),ZG=e=>{let t,n,r=null,i=zV(),[a,o]=J(!1),[s,c]=J(!1),[l,u]=J(!1),[d,f]=J(i?.edge??`bottom`),[p,m]=J(i?.ratio??.5),[h,g]=J({x:0,y:0}),[_,v]=J(!1),[y,b]=J(!1),[x,S]=J(!1),[C,w]=J(!1),[T,ee]=J(0),[E,D]=J(null),O=()=>{r?.(),r=null,e.isActive||IL()},te=JG({getContainerRef:()=>t,isCollapsed:s,getExpandedDimensions:()=>ce,onDragStart:()=>{D(null),r&&O()},onPositionUpdate:e=>g(e),onSnapEdgeChange:(e,t)=>{de(d(),e),f(e),m(t)},onSnapComplete:e=>{ce=e.expandedDimensions,g(e.position),Ae({edge:e.edge,ratio:e.ratio,collapsed:s(),enabled:!s()})}}),k=()=>d()===`left`||d()===`right`,A=()=>k()?`mb-1.5`:`mr-1.5`,ne=t=>e.activeActionId===t,re=()=>!!e.isActive&&(e.activeActionId??`copy`)===`copy`,ie=t=>E()===t&&!e.isActive&&!s()&&!te.isDragging()&&!te.isSnapping()&&!e.isContextMenuOpen,ae=()=>{switch(d()){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;default:return`top`}},oe=e=>{e.stopImmediatePropagation()},se=(t,n)=>({onMouseEnter:e=>{te.isDragging()||(D(t),n?.shouldFreezeInteractions!==!1&&!r&&(r=fR(),FL(e.clientX,e.clientY)),n?.onHoverChange?.(!0))},onMouseLeave:()=>{D(e=>e===t?null:e),n?.shouldFreezeInteractions!==!1&&!e.isActive&&!e.isContextMenuOpen&&O(),n?.onHoverChange?.(!1)}});yR(wR(()=>e.shakeCount,t=>{t&&!e.enabled&&v(!0)})),yR(wR(()=>[e.isActive,e.isContextMenuOpen],([e,t])=>{!e&&!t&&r&&(r(),r=null)})),yR(wR(()=>re(),e=>{if(!e){ee(e=>YG(e,0));return}let t=zM(e=>{if(!n)return;let t=n.getBoundingClientRect(),r=t.left+t.width/2,i=t.top+t.height/2,a=e.clientX-r,o=e.clientY-i;if(Math.hypot(a,o)<4)return;let s=Math.atan2(o,a)*180/Math.PI- -45;ee(e=>YG(e,s))});window.addEventListener(`pointermove`,t,{passive:!0}),ER(()=>{window.removeEventListener(`pointermove`,t)})}));let ce={width:78,height:28},[le,ue]=J(HG(d())),de=(e,t)=>{VG(e)!==VG(t)&&ue(HG(t))},fe=(e,n)=>{let r=t?.getBoundingClientRect(),i=HG(n);return GG(e,n,ce,r?.width??i.width,r?.height??i.height)},pe=()=>{g(UG(d(),p(),ce.width,ce.height))},me=te.createDragAwareHandler(()=>e.onToggle?.()),he=te.createDragAwareHandler(()=>e.onActivateAction?.(vN)),ge=te.createDragAwareHandler(()=>e.onActivateAction?.(yN)),_e=`group contain-layout flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox`,ve=()=>yW(`relative contain-layout flex items-center justify-center`,A()),ye=e=>e?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)]`,be=te.createDragAwareHandler(()=>{let e=t?.getBoundingClientRect(),n=s(),r=p();if(n){let{position:e,ratio:t}=fe(je(),d());r=t,g(e),m(r)}else e&&(ce={width:e.width,height:e.height});b(!0),c(e=>!e),Ae({edge:d(),ratio:r,collapsed:!n,enabled:n}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}),xe=()=>KG(d(),h(),ce,le()),Se,Ce,we=null,Te=()=>{let e=t?.getBoundingClientRect();!e||e.width===0||e.height===0||(s()?ue({width:e.width,height:e.height}):(ce={width:e.width,height:e.height},we={width:e.width,height:e.height}))},Ee=(e,t)=>{if(!(e===0||t===0)&&!(te.isDragging()||te.isSnapping())&&!y()){if(s()){let n=le();if(n.width===e&&n.height===t)return;ue({width:e,height:t});return}we&&we.width===e&&we.height===t||(we={width:e,height:t},ce={width:e,height:t},g(UG(d(),p(),e,t)))}},De=null,Oe=()=>{te.isDragging()||te.isSnapping()||De===null&&(De=nI(()=>{De=null,pe()}))},ke=()=>{te.isDragging()||(u(!0),pe(),Se&&clearTimeout(Se),Se=setTimeout(()=>{u(!1);let e=WG(d(),h().x,h().y,ce.width,ce.height);m(e),Ae({edge:d(),ratio:e,collapsed:s(),enabled:!s()})},500))},Ae=t=>{BV(t),e.onStateChange?.(t)};TR(()=>{t&&e.onContainerRef?.(t);let n=t?.getBoundingClientRect(),r=_W(),a=!!(n&&n.width>0&&n.height>0);i?(a&&n&&(ce={width:n.width,height:n.height}),c(i.collapsed),g(UG(i.edge,i.ratio,ce.width,ce.height))):a&&n?(ce={width:n.width,height:n.height},g({x:r.offsetLeft+(r.width-n.width)/2,y:r.offsetTop+r.height-n.height-16}),m(gN)):(g(UG(`bottom`,gN,ce.width,ce.height)),m(gN)),e.onSubscribeToStateChanges&&ER(e.onSubscribeToStateChanges(e=>{if(y()||!t?.getBoundingClientRect())return;let n=s()!==e.collapsed;if(de(d(),e.edge),f(e.edge),n&&!e.collapsed){let t=je();b(!0),c(e.collapsed);let{position:n,ratio:r}=fe(t,e.edge);g(n),m(r),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}else n&&(b(!0),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)),c(e.collapsed),g(UG(e.edge,e.ratio,ce.width,ce.height)),m(e.ratio)})),window.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`scroll`,ke);let l=LM();if(l&&(window.addEventListener(`scroll`,Oe,{passive:!0,capture:!0}),typeof ResizeObserver<`u`)){let e=new ResizeObserver(Oe);e.observe(l),ER(()=>e.disconnect())}if(typeof ResizeObserver<`u`&&t){let e=new ResizeObserver(e=>{let n=e[0];if(!n)return;let r=n.borderBoxSize?.[0],i,a;if(r)i=r.inlineSize,a=r.blockSize;else{let e=t?.getBoundingClientRect();if(!e)return;i=e.width,a=e.height}Ee(i,a)});e.observe(t),ER(()=>e.disconnect())}let u=setTimeout(()=>{o(!0)},500);ER(()=>{clearTimeout(u)})}),ER(()=>{window.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`scroll`,ke),window.removeEventListener(`scroll`,Oe,{capture:!0}),De!==null&&rI(De),clearTimeout(Se),clearTimeout(Ce),r&&O()});let je=()=>s()?xe():h(),Me=()=>s()?`cursor-pointer`:te.isDragging()?`cursor-grabbing`:`cursor-grab`,Ne=()=>C()||!!e.isContextMenuOpen||te.isDragging()||te.isSnapping()||y()||x(),Pe=()=>!!e.isActive&&!Ne(),Fe=()=>l()||te.isDragging()?``:te.isSnapping()?`transition-[transform,opacity] duration-300 ease-out`:y()?`transition-[transform,opacity] ${s()?`duration-140`:`duration-220`} ease-drawer`:`transition-[transform,opacity] duration-400 ease-drawer`,Ie=()=>{switch(d()){case`top`:return`center top`;case`bottom`:return`center bottom`;case`left`:return`left center`;case`right`:return`right center`;default:return`center center`}};return(()=>{var r=XG();r.addEventListener(`mouseleave`,()=>{w(!1),e.onSelectHoverChange?.(!1)}),r.addEventListener(`mouseenter`,()=>{w(!0),s()||e.onSelectHoverChange?.(!0)}),gz(r,`mousedown`,oe),gz(r,`pointerdown`,e=>{oe(e),te.handlePointerDown(e)});var i=t;return typeof i==`function`?xz(i,r):t=r,$(r,X(BG,{get isCollapsed(){return s()},get snapEdge(){return d()},get isShaking(){return _()},get isChevronPressed(){return x()},get transformOrigin(){return Ie()},onAnimationEnd:()=>v(!1),onCollapseClick:be,onCollapsePointerDown:()=>S(!0),onCollapsePointerUp:()=>S(!1),onCollapsePointerLeave:()=>S(!1),onPanelClick:e=>{if(s()){e.stopPropagation();let{position:t,ratio:n}=fe(je(),d());g(t),m(n),b(!0),c(!1),Ae({edge:d(),ratio:n,collapsed:!1,enabled:!0}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}},get actionButtons(){return[X(FG,nz({actionId:_N,isToggle:!0,ref:e=>n=e,get label(){return re()?`Stop selecting element`:`Copy element`},get isActive(){return re()},class:_e,get wrapperClass(){return ve()},onClick:me,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),D(null),e.onToggleToolbarMenu?.()}},()=>se(_N),{get icon(){return X(TG,{size:14,get rotationDeg(){return T()},get class(){return ye(re())}})},get tooltipVisible(){return ie(_N)},get tooltipPosition(){return ae()},tooltip:`Copy`})),X(FG,nz({actionId:vN,label:`Comment on element`,get isActive(){return ne(vN)},class:_e,get wrapperClass(){return ve()},onClick:he},()=>se(vN),{get icon(){return X(DG,{size:14,get class(){return ye(ne(vN))}})},get tooltipVisible(){return ie(vN)},get tooltipPosition(){return ae()},tooltip:`Comment`})),X(FG,nz({actionId:yN,label:`Style element`,get isActive(){return ne(yN)},class:_e,get wrapperClass(){return ve()},onClick:ge},()=>se(yN),{get icon(){return X(kG,{size:14,get class(){return ye(ne(yN))}})},get tooltipVisible(){return ie(yN)},get tooltipPosition(){return ae()},tooltip:`Style`}))]}})),vR(e=>{var t=yW(`fixed left-0 top-0 font-sans text-[13px] antialiased select-none`,Me(),Fe(),a()?`pointer-events-auto`:`pointer-events-none`),n=String(XM),i=`translate(${je().x}px, ${je().y}px) scale(${Pe()?.97:1})`,o=Ie(),s=a()?Pe()?.55:1:0;return t!==e.e&&hz(r,e.e=t),n!==e.t&&yz(r,`z-index`,e.t=n),i!==e.a&&yz(r,`transform`,e.a=i),o!==e.o&&yz(r,`transform-origin`,e.o=o),s!==e.i&&yz(r,`opacity`,e.i=s),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()},QG=kR(),$G=()=>{let e=AR(QG);if(!e)throw Error(`Menu subcomponents must be rendered inside <Menu.Provider>`);return e},eK=e=>X(QG.Provider,{get value(){return e.store},get children(){return e.children}}),tK=e=>X(RW,{get class(){return yW(`flex flex-col w-fit h-fit`,e.class)},get style(){return e.style},get children(){return e.children}}),nK=Z(`<div role=menu aria-orientation=vertical><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),rK=e=>{let t=$G();return(()=>{var n=nK(),r=n.firstChild;n.$$pointermove=()=>t.notePointerMove(),xz(n=>{t.setHighlightContainer(n),e.ref?.(n)},n);var i=t.setHighlightRail;return typeof i==`function`?xz(i,r):t.setHighlightRail=r,$(n,()=>e.children,null),vR(r=>{var i=e.label,a=t.keyboardNavigation?t.activeDescendantId():void 0,o=t.keyboardNavigation?-1:void 0,s=yW(`relative flex flex-col`,e.class);return i!==r.e&&Q(n,`aria-label`,r.e=i),a!==r.t&&Q(n,`aria-activedescendant`,r.t=a),o!==r.a&&Q(n,`tabindex`,r.a=o),s!==r.o&&hz(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()},fz([`pointermove`]),iK=Z(`<button data-react-grab-ignore-events type=button>`),aK=e=>{let t=$G(),n=t.createItemId(),r=e.value,i=()=>e.role??`menuitem`,a=()=>!e.disabled,o=()=>t.activeValue()===r,s;return TR(()=>{s&&(t.registerItem({value:r,domId:n,element:s,isEnabled:a,onSelect:()=>e.onSelect?.()}),ER(()=>t.unregisterItem(r)))}),(()=>{var c=iK();c.$$click=t=>{t.stopPropagation(),a()&&e.onSelect?.()},c.addEventListener(`pointerleave`,()=>{t.clearActiveOnPointerLeave&&t.setActiveItem(null)}),c.addEventListener(`pointerenter`,()=>{a()&&t.canActivateOnHover()&&t.setActiveItem(r)}),c.$$pointerdown=e=>e.stopPropagation();var l=s;return typeof l==`function`?xz(l,c):s=c,Q(c,`id`,n),$(c,()=>e.children),vR(n=>{var a=e.dataId??r,s=i(),l=i()===`menuitemradio`?!!e.checked:void 0,u=!!e.disabled,d=t.keyboardNavigation?o()?0:-1:void 0,f=e.disabled,p=yW(`relative z-1 contain-layout flex items-center justify-between w-full px-2 py-1 cursor-pointer text-left border-none bg-transparent disabled:opacity-40 disabled:cursor-default`,e.class);return a!==n.e&&Q(c,`data-react-grab-menu-item`,n.e=a),s!==n.t&&Q(c,`role`,n.t=s),l!==n.a&&Q(c,`aria-checked`,n.a=l),u!==n.o&&Q(c,`aria-disabled`,n.o=u),d!==n.i&&Q(c,`tabindex`,n.i=d),f!==n.n&&(c.disabled=n.n=f),p!==n.s&&hz(c,n.s=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),c})()},fz([`pointerdown`,`click`]),oK=Z(`<span>`),sK=e=>(()=>{var t=oK();return $(t,()=>e.children),vR(()=>hz(t,yW(`text-[13px] leading-4 font-sans font-medium`,e.class))),t})(),cK=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M6.5 5C5.67157 5 5 5.67157 5 6.5C5 7.32843 5.67157 8 6.5 8H8V6.5C8 5.67157 7.32843 5 6.5 5ZM10 8V6.5C10 4.567 8.433 3 6.5 3C4.567 3 3 4.567 3 6.5C3 8.433 4.567 10 6.5 10H8V14H6.5C4.567 14 3 15.567 3 17.5C3 19.433 4.567 21 6.5 21C8.433 21 10 19.433 10 17.5V16H14V17.5C14 19.433 15.567 21 17.5 21C19.433 21 21 19.433 21 17.5C21 15.567 19.433 14 17.5 14H16V10H17.5C19.433 10 21 8.433 21 6.5C21 4.567 19.433 3 17.5 3C15.567 3 14 4.567 14 6.5V8H10ZM10 10V14H14V10H10ZM16 8H17.5C18.3284 8 19 7.32843 19 6.5C19 5.67157 18.3284 5 17.5 5C16.6716 5 16 5.67157 16 6.5V8ZM16 16V17.5C16 18.3284 16.6716 19 17.5 19C18.3284 19 19 18.3284 19 17.5C19 16.6716 18.3284 16 17.5 16H16ZM8 16H6.5C5.67157 16 5 16.6716 5 17.5C5 18.3284 5.67157 19 6.5 19C7.32843 19 8 18.3284 8 17.5V16Z">`),lK=e=>{let t=()=>e.size??11;return(()=>{var n=cK();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},uK=Z(`<span>`),dK=Z(`<span style=display:inline-flex;align-items:center;gap:2px>`),fK=Z(`<span>Ctrl+`),pK=e=>{let t=()=>e.shortcut===`Enter`,n=()=>e.modifier!==!1,r=FB();return(()=>{var i=dK();return $(i,X(oz,{get when(){return t()},get children(){return X(UW,{size:8})}}),null),$(i,X(oz,{get when(){return!t()},get children(){return X(oz,{get when(){return n()},get fallback(){return(()=>{var t=uK();return $(t,()=>e.shortcut),t})()},get children(){return X(oz,{when:r,get fallback(){return(()=>{var t=fK();return t.firstChild,$(t,()=>e.shortcut,null),t})()},get children(){return[X(lK,{size:9}),(()=>{var t=uK();return $(t,()=>e.shortcut),t})()]}})}})}}),null),vR(()=>hz(i,e.class)),i})()},mK=e=>X(pK,{get shortcut(){return e.shortcut},get modifier(){return e.modifier},get class(){return yW(`text-[11px] font-sans text-[var(--rg-text-secondary)] ml-4`,e.class)}}),hK=({hiddenOpacity:e=`0`,visibleOpacity:t=`1`}={})=>{let n,r,i,a=e=>{r&&(r.style.opacity=t,r.style.top=`${e.offsetTop}px`,r.style.left=`${e.offsetLeft}px`,r.style.width=`${e.offsetWidth}px`,r.style.height=`${e.offsetHeight}px`)},o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(()=>{i&&a(i)});ER(()=>o?.disconnect());let s=()=>{i=void 0,o?.disconnect(),r&&(r.style.opacity=e)};return{containerRef:e=>{n=e},followerRef:e=>{r=e},followElement:e=>{if(!(!r||!n)){if(!e){s();return}i=e,a(e),o?.disconnect(),o?.observe(e),o?.observe(n)}},hideFollower:s}},gK=(e,t)=>e!==t&&e instanceof HTMLElement,_K=(e,t)=>{let n=[];for(let r of Array.from(e.children))gK(r,t)&&n.push(r);return n},vK=(e={})=>{let{topCornerRadiusPx:t,bottomCornerRadiusPx:n,cornerShape:r}=e,i=t!==void 0||n!==void 0,a,o=!1,s=e=>{if(!a||!i)return;let s=e.parentElement;if(!s)return;let c=_K(s,a),l=c[0]===e,u=c[c.length-1]===e,d=l&&t!==void 0?`${t}px`:`0px`,f=u&&n!==void 0?`${n}px`:`0px`;a.style.borderTopLeftRadius=d,a.style.borderTopRightRadius=d,a.style.borderBottomLeftRadius=f,a.style.borderBottomRightRadius=f,r&&!o&&(a.style.setProperty(`corner-shape`,r),o=!0)},{containerRef:c,followerRef:l,followElement:u,hideFollower:d}=hK();return{containerRef:c,highlightRef:e=>{a=e,o=!1,l(e)},updateHighlight:e=>{u(e),e&&s(e)},clearHighlight:d}},yK=(e={})=>{let t=new Map,n=[],r=`react-grab-menu-${Math.random().toString(36).slice(2,8)}`,i=0,a=!1,o=e.value!==void 0,[s,c]=J(null),[l,u]=J(0),d=Y(()=>o?e.value?.()??null:s()),f=t=>{if(o){e.onValueChange?.(t);return}c(t)},p=vK(e.highlight??{});yR(wR([d,l],([e])=>{if(e===null){p.clearHighlight();return}let n=t.get(e);n?p.updateHighlight(n.element):p.clearHighlight()}));let m=()=>n.filter(e=>t.get(e)?.isEnabled()),h=()=>{let e=m();e.length>0&&f(e[0])},g=()=>{let e=m();e.length>0&&f(e[e.length-1])},_=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?0:(t+1)%e.length])},v=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?e.length-1:(t-1+e.length)%e.length])},y=Y(()=>{l();let e=d();if(e!==null)return t.get(e)?.domId});return{keyboardNavigation:e.keyboardNavigation??!1,clearActiveOnPointerLeave:e.clearActiveOnPointerLeave??!1,activeValue:d,activeDescendantId:y,setActiveItem:f,createItemId:()=>`${r}-item-${i++}`,canActivateOnHover:()=>!(e.requirePointerMove??!1)||a,notePointerMove:()=>{a=!0},resetPointerMove:()=>{a=!1},registerItem:e=>{t.set(e.value,e),n.includes(e.value)||n.push(e.value),u(e=>e+1)},unregisterItem:e=>{t.delete(e);let r=n.indexOf(e);r!==-1&&n.splice(r,1),o||c(t=>t===e?null:t),u(e=>e+1)},getActiveItem:()=>{let e=d();return e===null?void 0:t.get(e)},selectFirst:h,selectLast:g,selectNext:_,selectPrevious:v,setHighlightContainer:p.containerRef,setHighlightRail:p.highlightRef}},bK={Provider:eK,Panel:tK,List:rK,Item:aK,Label:sK,Shortcut:mK},xK=e=>e??!0,SK=(e,t)=>typeof e.enabled==`function`?t?e.enabled(t):!1:xK(e.enabled),CK=e=>{e.type===`contextmenu`&&e.preventDefault(),e.stopImmediatePropagation()},wK=e=>{let t=zM(t=>{e.isOpen()&&(e.shouldIgnoreKeyboardEvent?.(t)||e.shouldIgnoreInputEvents&&uB(t)||t.code===`Escape`&&(t.preventDefault(),t.stopImmediatePropagation(),e.onDismiss(`keyboard`)))}),n=zM(t=>{e.isOpen()&&(IB(t,`data-react-grab-ignore-events`)||e.shouldIgnoreRightClick&&t instanceof MouseEvent&&t.button===2||e.onDismiss(`pointer`))}),r=nI(()=>{window.addEventListener(`mousedown`,n,{capture:!0}),window.addEventListener(`touchstart`,n,{capture:!0})});return window.addEventListener(`keydown`,t,{capture:!0}),()=>{rI(r),window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`mousedown`,n,{capture:!0}),window.removeEventListener(`touchstart`,n,{capture:!0})}},TK=Z(`<div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2">`),EK=Z(`<div data-react-grab-ignore-events data-react-grab-context-menu class="fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none"style=pointer-events:auto>`),DK=e=>{let t,n,r=null,i=yK({keyboardNavigation:!0,highlight:{bottomCornerRadiusPx:14,cornerShape:bN}}),[a,o]=J(0),[s,c]=J(0),l=Y(()=>e.position!==null),u=Y(()=>bW({tagName:e.tagName,componentName:e.componentName})),d=()=>{if(t){let e=t.getBoundingClientRect();o(e.width),c(e.height)}};yR(()=>{l()&&nI(d)});let f=Y(()=>{let t=e.selectionBounds,n=e.position,r=a(),i=s();if(r===0||i===0||!t||!n)return{left:CN.left,top:CN.top,arrowLeft:0,arrowPosition:`bottom`};let o=n.x??t.x+t.width/2,c=Math.max(4,Math.min(o-r/2,window.innerWidth-r-4)),l=Math.max(8,Math.min(o-c,r-8)),u=t.y+t.height+8+4,d=t.y-i-8-4,f=u+i>window.innerHeight,p=d>=0,m=f&&p,h=m?d:u,g=m?`top`:`bottom`;if(f&&!p){let e=n.y??t.y+t.height/2;h=Math.max(4,Math.min(e+4,window.innerHeight-i-4)),g=`top`}return{left:c,top:h,arrowLeft:l,arrowPosition:g}}),p=Y(()=>{let t=e.actions??[],n=e.actionContext;return t.map(e=>({id:e.id,label:e.label,action:()=>{n&&e.onAction(n)},enabled:SK(e,n),shortcut:e.shortcut,shortcutModifier:e.shortcutModifier}))});yR(wR(l,e=>{if(e){let e=t?.getRootNode(),i=e instanceof ShadowRoot?e.activeElement:null,a=document.activeElement;r=a instanceof HTMLElement&&i===null&&!(t instanceof Element&&t.contains(a))?a:null,n?.focus({preventScroll:!0});return}i.setActiveItem(null);let a=r;r=null,!(!(a instanceof HTMLElement)||!document.contains(a))&&nI(()=>{let e=document.activeElement;(e===null||e===document.body)&&a.focus({preventScroll:!0})})})),TR(()=>{d();let t=t=>{if(!l())return;let n=t.key===`ArrowDown`,r=t.key===`ArrowUp`,a=t.key===`Home`,o=t.key===`End`,s=t.key===`Tab`;if(n||r||a||o||s){t.preventDefault(),t.stopPropagation();let e=n||s&&!t.shiftKey;a?i.selectFirst():o?i.selectLast():e?i.selectNext():i.selectPrevious();return}let c=e.actions??[],u=e.actionContext,d=n=>{u&&SK(n,u)&&(t.preventDefault(),t.stopPropagation(),n.onAction(u),e.onHide())};if(t.key===`Enter`){let e=i.getActiveItem();if(e){t.preventDefault(),t.stopPropagation(),e.isEnabled()&&e.onSelect();return}}let f=WV(c,t,{includeModifierShortcuts:!0});f&&d(f)},n=wK({isOpen:l,onDismiss:e.onDismiss,shouldIgnoreRightClick:!0}),r=zM(t);window.addEventListener(`keydown`,r,{capture:!0}),ER(()=>{n(),window.removeEventListener(`keydown`,r,{capture:!0})})});let m=Y(()=>{let{tagName:e,componentName:t}=u();return`Actions for ${t?`${t}.${e}`:e}`});return X(oz,{get when(){return l()},get children(){var r=EK();gz(r,`contextmenu`,CK,!0),gz(r,`click`,CK,!0),gz(r,`mousedown`,CK,!0),gz(r,`pointerdown`,CK,!0);var a=t;return typeof a==`function`?xz(a,r):t=r,yz(r,`z-index`,`${XM}`),$(r,X(EW,{get position(){return f().arrowPosition},leftPercent:0,get leftOffsetPx(){return f().arrowLeft}}),null),$(r,X(bK.Panel,{class:`justify-center items-start min-w-[100px]`,get children(){return[(()=>{var t=TK();return $(t,X(MW,{get tagName(){return u().tagName},get componentName(){return u().componentName},get isClickable(){return e.hasFilePath},onClick:t=>{t.stopPropagation(),e.hasFilePath&&e.actionContext&&(e.actions?.find(e=>e.id===`open`))?.onAction(e.actionContext)},shrink:!0})),t})(),X(PW,{get children(){return X(bK.Provider,{store:i,get children(){return X(bK.List,{ref:e=>n=e,get label(){return m()},class:`w-[calc(100%+16px)] -mx-2 -my-1.5 outline-none`,get children(){return X(iz,{get each(){return p()},children:t=>X(bK.Item,{get value(){return t.id},get dataId(){return t.label.toLowerCase()},get disabled(){return!t.enabled},onSelect:()=>{t.action(),e.onHide()},get children(){return[X(bK.Label,{class:`text-[var(--rg-text-primary)]`,get children(){return t.label}}),X(oz,{get when(){return t.shortcut},children:e=>X(bK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})})}})}})}})]}}),null),vR(e=>{var t=`${f().top}px`,n=`${f().left}px`;return t!==e.e&&yz(r,`top`,e.e=t),n!==e.t&&yz(r,`left`,e.t=n),e},{e:void 0,t:void 0}),r}})},fz([`pointerdown`,`mousedown`,`click`,`contextmenu`]),OK=(e,t,n,r)=>Math.max(r,Math.min(e,n-t-r)),kK=({anchor:e,measuredWidth:t,measuredHeight:n,viewportLeft:r=0,viewportTop:i=0,viewportWidth:a,viewportHeight:o,anchorGapPx:s,viewportPaddingPx:c,offscreenPosition:l})=>{if(!e||t===0||n===0)return l;let u,d;return e.edge===`left`||e.edge===`right`?(u=e.edge===`left`?e.x+s:e.x-t-s,d=e.y-n/2):(u=e.x-t/2,d=e.edge===`top`?e.y+s:e.y-n-s),{left:r+OK(u-r,t,a,c),top:i+OK(d-i,n,o,c)}},AK=(e,t)=>{let[n,r]=J(0),[i,a]=J(0),[o,s]=J(!1),[c,l]=J(!1),[u,d]=J(0),[f,p]=J(`bottom`),m,h,g=()=>{clearTimeout(m),h!==void 0&&(rI(h),h=void 0)},_=()=>{let t=e();t&&(r(t.offsetWidth),a(t.offsetHeight))},v=()=>{SR(()=>{d(e=>e+1),_()})},y=Y(()=>t()!==null);return yR(()=>{let n=t();n?(p(n.edge),clearTimeout(m),s(!0),h!==void 0&&rI(h),h=nI(()=>{_(),e()?.offsetHeight,l(!0)})):(h!==void 0&&rI(h),l(!1),m=setTimeout(()=>{s(!1)},120)),ER(g)}),yR(()=>{if(!y())return;window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v);let e=LM(),t;e&&typeof ResizeObserver<`u`&&(t=new ResizeObserver(v),t.observe(e)),ER(()=>{window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v),t?.disconnect()})}),{shouldMount:o,isAnimatedIn:c,lastAnchorEdge:f,displayPosition:Y(e=>{u();let r=_W(),a=kK({anchor:t(),measuredWidth:n(),measuredHeight:i(),viewportLeft:r.offsetLeft,viewportTop:r.offsetTop,viewportWidth:r.width,viewportHeight:r.height,anchorGapPx:8,viewportPaddingPx:8,offscreenPosition:CN});return a.left===CN.left?e:a},CN),measure:_,clearAnimationHandles:g}},jK={padding:{prefix:`p`,scale:`spacing`},"padding-top,padding-bottom":{prefix:`py`,scale:`spacing`},"padding-left,padding-right":{prefix:`px`,scale:`spacing`},"padding-top":{prefix:`pt`,scale:`spacing`},"padding-right":{prefix:`pr`,scale:`spacing`},"padding-bottom":{prefix:`pb`,scale:`spacing`},"padding-left":{prefix:`pl`,scale:`spacing`},margin:{prefix:`m`,scale:`spacing`},"margin-top,margin-bottom":{prefix:`my`,scale:`spacing`},"margin-left,margin-right":{prefix:`mx`,scale:`spacing`},"margin-top":{prefix:`mt`,scale:`spacing`},"margin-right":{prefix:`mr`,scale:`spacing`},"margin-bottom":{prefix:`mb`,scale:`spacing`},"margin-left":{prefix:`ml`,scale:`spacing`},gap:{prefix:`gap`,scale:`spacing`},"column-gap":{prefix:`gap-x`,scale:`spacing`},"row-gap":{prefix:`gap-y`,scale:`spacing`},"width,height":{prefix:`size`,scale:`spacing`},width:{prefix:`w`,scale:`spacing`},height:{prefix:`h`,scale:`spacing`},"min-width":{prefix:`min-w`,scale:`spacing`},"max-width":{prefix:`max-w`,scale:`spacing`},"min-height":{prefix:`min-h`,scale:`spacing`},"max-height":{prefix:`max-h`,scale:`spacing`},"top,right,bottom,left":{prefix:`inset`,scale:`spacing`},"top,bottom":{prefix:`inset-y`,scale:`spacing`},"left,right":{prefix:`inset-x`,scale:`spacing`},top:{prefix:`top`,scale:`spacing`},right:{prefix:`right`,scale:`spacing`},bottom:{prefix:`bottom`,scale:`spacing`},left:{prefix:`left`,scale:`spacing`},"border-width":{prefix:`border`,scale:`border-width`},"border-top-width":{prefix:`border-t`,scale:`border-width`},"border-right-width":{prefix:`border-r`,scale:`border-width`},"border-bottom-width":{prefix:`border-b`,scale:`border-width`},"border-left-width":{prefix:`border-l`,scale:`border-width`},"z-index":{prefix:`z`,scale:`z-index`},opacity:{prefix:`opacity`,scale:`opacity`}},MK=(e,t)=>{let n=jK[e];if(!n)return null;let{prefix:r,scale:i}=n;if(i===`spacing`){if(t<0)return null;let e=t/4;return!Number.isInteger(e)||e>96?null:`${r}-${e}`}return i===`border-width`?!Number.isInteger(t)||t<0||t>8?null:t===1?r:`${r}-${t}`:i===`z-index`?!Number.isInteger(t)||t<0||t>50?null:`${r}-${t}`:!Number.isFinite(t)||t<0||t>100||t%5!=0?null:`${r}-${t}`},NK=e=>{let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement:e.ownerDocument?.activeElement??document.activeElement},PK=e=>e.toLowerCase()===`#00000000`?DN:e.toUpperCase(),FK=Z(`<input data-react-grab-ignore-events data-react-grab-input type=text autocapitalize=none autocorrect=off autocomplete=off>`),IK=e=>{let[t,n]=rz(e,[`class`,`ref`,`autoFocusSelect`]);return(()=>{var e=FK();return xz(e=>{t.autoFocusSelect&&queueMicrotask(()=>{e.focus(),e.select()}),t.ref?.(e)},e),Q(e,`spellcheck`,!1),bz(e,nz({get class(){return yW(`bg-transparent border-none outline-none text-[var(--rg-text-primary)] p-0 m-0`,t.class)}},n),!1,!1),e})()},LK=`text-[13px] leading-4 font-medium`,RK={position:`absolute`,opacity:0,"pointer-events":`none`,width:`0`,height:`0`,margin:`0`,padding:`0`,overflow:`hidden`},zK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="flex items-center gap-1 ml-auto shrink-0"><button type=button data-react-grab-ignore-events aria-label="Pick color"class="size-[16px] rounded-[4px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid p-0 m-0 cursor-pointer shrink-0"></button><input data-react-grab-ignore-events type=color aria-hidden=true tabindex=-1 class="absolute opacity-0 pointer-events-none size-0">`),BK=Z(`<span>`),VK=Z(`<span class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-text">`),HK=e=>e.length===9?e.slice(0,7):e,UK=e=>{let[t,n]=J(null),r=()=>t()!==null,i=()=>PK(e.value),a,o=!0;ER(()=>{o=!1}),TR(()=>{let t=e.onRegisterTrigger?.(()=>a?.click());ER(()=>t?.())});let s=()=>{let r=t();if(r===null)return;n(null);let i=jB(r);i?i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},c=()=>{r()&&(n(null),e.onEditComplete?.())},l=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),s();return}e.key===`Escape`&&(e.preventDefault(),c())}},u=t=>{t.preventDefault(),t.stopPropagation(),e.onInteract?.(),a?.click()};return(()=>{var c=zK(),d=c.firstChild,f=d.firstChild,p=f.nextSibling;$(c,X(oz,{get when(){return e.label},children:e=>(()=>{var t=BK();return hz(t,`${LK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),d),$(d,X(oz,{get when(){return r()},get fallback(){return(()=>{var e=VK();return e.$$click=e=>{e.preventDefault(),e.stopPropagation(),n(i())},e.$$pointerdown=e=>e.stopPropagation(),$(e,i),vR(()=>Q(e,`data-react-grab-value`,i())),e})()},get children(){return X(IK,{autoFocusSelect:!0,inputmode:`text`,"aria-label":`Style color hex`,class:`text-[12px] leading-4 font-medium tabular-nums text-right`,get style(){return{"field-sizing":`content`,"min-width":`32px`,"max-width":e.emphasized?`100px`:`72px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:l,onBlur:s,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),f),f.$$click=u,f.$$mousedown=e=>e.preventDefault(),f.$$pointerdown=e=>e.stopPropagation(),p.$$input=t=>{if(!o)return;let n=t.currentTarget.value,r=e.value.length===9?e.value.slice(7):``,i=n+(r.toLowerCase()===`00`?``:r);e.onInteract?.(),i&&i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`pointer`)};var m=a;return typeof m==`function`?xz(m,p):a=p,vR(t=>yz(f,`background-color`,e.value)),vR(()=>p.value=HK(e.value)),c})()},fz([`pointerdown`,`mousedown`,`click`,`input`]),WK=Z(`<svg width=1em height=1em viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg aria-hidden=true style=width:16px;height:16px;flex-shrink:0;cursor:pointer><path fill-rule=evenodd clip-rule=evenodd>`),GK=e=>{let t=()=>e.active?`var(--rg-text-primary)`:`var(--rg-text-secondary)`,n=()=>e.active?e.direction===`left`?-2:2:0,r=()=>e.active?1.12:1,i=()=>e.direction===`left`?`M2.54282 10.5427C1.76177 11.3238 1.76177 12.5901 2.54282 13.3712L9.70183 20.5302C11.1193 21.9476 13.5428 20.9437 13.5428 18.9392V16.9573H21.0428C22.1474 16.9573 23.0428 16.0619 23.0428 14.9573V8.95733C23.0428 7.85276 22.1474 6.95733 21.0428 6.95733L13.5428 6.95733V4.97473C13.5428 2.9702 11.1193 1.96631 9.70183 3.38373L2.54282 10.5427Z`:`M14.2983 20.5302L21.4573 13.3712C22.2383 12.5901 22.2383 11.3238 21.4573 10.5427L14.2983 3.38374C12.8808 1.96631 10.4573 2.97019 10.4573 4.97473V6.95659L3.95728 6.95659C2.85271 6.95659 1.95728 7.85202 1.95728 8.95659V14.9566C1.95728 16.0612 2.85271 16.9566 3.95727 16.9566H10.4573V18.9392C10.4573 20.9437 12.8808 21.9476 14.2983 20.5302Z`;return(()=>{var a=WK(),o=a.firstChild;return gz(a,`pointerdown`,e.onPointerDown,!0),vR(s=>{var c=`translateX(${n()}px) scale(${r()})`,l=e.active?`transform 30ms cubic-bezier(0, 0, 0.2, 1)`:`transform 450ms cubic-bezier(0.34, 1.8, 0.64, 1)`,u=i(),d=t(),f=e.active?`fill 50ms ease`:`fill 300ms ease`;return c!==s.e&&yz(a,`transform`,s.e=c),l!==s.t&&yz(a,`transition`,s.t=l),u!==s.a&&Q(o,`d`,s.a=u),d!==s.o&&Q(o,`fill`,s.o=d),f!==s.i&&yz(o,`transition`,s.i=f),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},fz([`pointerdown`]),KK=Z(`<span>`),qK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="ml-auto shrink-0 flex items-center gap-1"><span data-react-grab-ignore-events role=button tabindex=-1 class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-pointer select-none min-w-[36px] text-center">`),JK=e=>{let t=()=>e.options.find(t=>t.value===e.value)?.label??e.value;return(()=>{var n=qK(),r=n.firstChild,i=r.firstChild;return $(n,X(oz,{get when(){return e.label},get children(){var t=KK();return hz(t,`${LK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,()=>e.label),t}}),r),$(r,X(GK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),i),i.$$contextmenu=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(-1)},i.$$click=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(1)},i.$$mousedown=e=>e.preventDefault(),i.$$pointerdown=e=>e.stopPropagation(),$(i,t),$(r,X(GK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)}),null),vR(t=>{var n=`Cycle ${e.label??`value`}`,r=`Click to cycle (${e.options.length} options)`;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`title`,t.t=r),t},{e:void 0,t:void 0}),n})()},fz([`pointerdown`,`mousedown`,`click`,`contextmenu`]),YK=e=>e.kind===`numeric`?e:null,XK=e=>e.kind===`color`?e:null,ZK=e=>e.kind===`enum`?e:null,QK=/^[0-9]$/,$K=e=>{let t=Array.from(e),n=t.findIndex(e=>QK.test(e));if(n<0)return{prefixLiterals:t,rightAlignedSegments:[]};let r=t.slice(0,n),i=[],a=0;for(let e=t.length-1;e>=n;e--){let n=t[e],r=QK.test(n)?`digit`:`literal`;i.push({kind:r,value:n,digitDistanceFromRight:a}),r===`digit`&&(a+=1)}return{prefixLiterals:r,rightAlignedSegments:i}},eq=Z(`<span class=rg-slot-column aria-hidden=true><span class=rg-slot-sizer>0</span><span class=rg-slot-cell>`),tq=Z(`<span class="rg-slot-cell rg-slot-exit">`),nq=Z(`<span><span class=inline-flex style=flex-direction:row-reverse>`),rq=Z(`<span class="inline-block whitespace-pre"aria-hidden=true>`),iq=e=>typeof e==`number`?e:Number.parseFloat(String(e).replace(/[^0-9.-]/g,``))||0,aq=e=>{let t,[n,r]=J(null),i=null;yR(wR(()=>e.digit,(n,a)=>{a===void 0||n===a||(t&&(t.classList.remove(`rg-slot-enter`),t.offsetWidth,t.classList.add(`rg-slot-enter`)),r({digit:a,direction:e.direction}),i!==null&&clearTimeout(i),i=setTimeout(()=>r(null),350))},{defer:!0})),ER(()=>{i!==null&&clearTimeout(i)});let a=()=>({"animation-delay":`${e.delayMs}ms`});return(()=>{var r=eq(),i=r.firstChild.nextSibling,o=t;return typeof o==`function`?xz(o,i):t=i,$(i,()=>e.digit),$(r,X(oz,{get when(){return n()},keyed:!0,children:e=>(()=>{var t=tq();return $(t,()=>e.digit),vR(n=>{var r=String(e.direction),i=a();return r!==n.e&&Q(t,`data-dir`,n.e=r),n.t=vz(t,i,n.t),n},{e:void 0,t:void 0}),t})()}),null),vR(t=>{var n=String(e.direction),r=a();return n!==t.e&&Q(i,`data-dir`,t.e=n),t.t=vz(i,r,t.t),t},{e:void 0,t:void 0}),r})()},oq=e=>{let t=Y(()=>String(e.children??``)),n=Y(()=>$K(t())),r=Y(wR(()=>iq(e.children),(e,t)=>t===void 0||e===t?0:e>t?1:-1)),i=Y(()=>e.direction??r());return(()=>{var r=nq(),a=r.firstChild;return $(r,X(az,{get each(){return n().prefixLiterals},children:e=>(()=>{var t=rq();return $(t,e),t})()}),a),$(a,X(az,{get each(){return n().rightAlignedSegments},children:e=>X(oz,{get when(){return e().kind===`digit`},get fallback(){return(()=>{var t=rq();return $(t,()=>e().value),t})()},get children(){return X(aq,{get digit(){return Number(e().value)},get direction(){return i()},get delayMs(){return e().digitDistanceFromRight*18}})}})})),vR(n=>{var i=t(),a=`inline-flex ${e.class??``}`,o={...e.style,"--rg-slot-dur":`350ms`};return i!==n.e&&Q(r,`aria-label`,n.e=i),a!==n.t&&hz(r,n.t=a),n.a=vz(r,o,n.a),n},{e:void 0,t:void 0,a:void 0}),r})()},sq=Z(`<div data-react-grab-slider-base aria-hidden=true class="absolute inset-y-0 left-0 right-0 rounded-[6px] bg-[var(--rg-surface-active)] pointer-events-none">`),cq=Z(`<div class="flex items-center gap-1 w-full px-1"><div role=slider aria-keyshortcuts="ArrowLeft ArrowRight"tabindex=-1 class="relative flex-1 h-[20px] flex items-center overflow-hidden rounded-[6px]"><div data-react-grab-slider-fill aria-hidden=true class="absolute inset-y-0 left-0 bg-[var(--rg-surface-active)] pointer-events-none"></div><div aria-hidden=true class="absolute inset-0 pointer-events-none"></div><div data-react-grab-slider-handle aria-hidden=true class="absolute top-[2px] bottom-[2px] w-[2px] rounded-[1px] bg-[var(--rg-text-primary)] pointer-events-none"style="transition:opacity 120ms ease"></div><div class="relative z-10 flex items-center justify-between w-full px-2 pointer-events-none">`),lq=Z(`<div data-react-grab-slider-hash-mark class="absolute top-1/2 w-px h-[8px] rounded-[1px] bg-[var(--rg-text-secondary)]"style="transform:translate(-50%, -50%);transition:opacity 200ms ease">`),uq=Z(`<span>`),dq=Z(`<span class="ml-auto flex items-center gap-1 pointer-events-auto"><span data-react-grab-value-text class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)]"><span class="text-[9px] text-[var(--rg-text-secondary)] ml-px">`),fq=Z(`<span data-react-grab-tailwind-label aria-hidden=true class="text-[10px] leading-4 text-[var(--rg-text-secondary)] tabular-nums">`),pq=Array.from({length:9},(e,t)=>(t+1)*100/10),mq=/^(-?(?:\d+\.?\d*|\.\d+))\s*([a-zA-Z%]*)$/,hq=e=>{let[t,n]=J(null),[r,i]=J(0),[a,o]=J(!1),[s,c]=J(!1),l=()=>t()!==null,u,d=null,f=()=>{let t=e.max-e.min;return t<=0?0:(Math.max(e.min,Math.min(e.max,e.value))-e.min)/t*100},p=()=>{e.onCommitValue&&n(oV(e.value))},m=()=>!!e.onCommitValue,h=(t,n)=>{if(n.width<=0)return e.value;let r=Math.max(0,Math.min(1,(t-n.left)/n.width));return e.min+r*(e.max-e.min)},g=(t,n)=>{e.onCommitValue?.(h(t,n),`pointer`)},_=(e,t)=>{let n=Math.max(0,e-t.right)-Math.max(0,t.left-e),r=Math.max(0,Math.abs(n)-32),i=Math.sqrt(Math.min(r/200,1));return Math.sign(n)*8*i},v=t=>{if(!m()||l())return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=u,r=n!==void 0&&t.target instanceof Node&&n.contains(t.target);d={startX:t.clientX,isDragging:!1,startedOnValueText:r,trackRect:t.currentTarget.getBoundingClientRect()},o(!0),e.onInteract?.()},y=t=>{if(!d)return;let n=t.clientX-d.startX;!d.isDragging&&Math.abs(n)<3||(d.isDragging=!0,e.onInteract?.(),g(t.clientX,d.trackRect),i(_(t.clientX,d.trackRect)))},b=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d.isDragging||(d.startedOnValueText?p():g(d.startX,d.trackRect)),d=null,o(!1),i(0))},x=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d=null,o(!1),i(0))};TR(()=>{let e=()=>{d=null,o(!1),c(!1),i(0)};window.addEventListener(`blur`,e),ER(()=>window.removeEventListener(`blur`,e))});let S=()=>!!e.activeKey||a()||s(),C=()=>{let r=t();if(r===null)return;n(null);let i=r.trim().replace(/(\d),(\d)/g,`$1.$2`).match(mq);if(!i){e.onInvalidCommit?.(),e.onEditComplete?.();return}let a=i[2].toLowerCase();if(a&&a!==e.unit){e.onInvalidCommit?.(),e.onEditComplete?.();return}let o=Number.parseFloat(i[1]);Number.isFinite(o)?e.onCommitValue?.(o,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},w=()=>{l()&&(n(null),e.onEditComplete?.())},T=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),C();return}e.key===`Escape`&&(e.preventDefault(),w())}},ee=()=>{let t=r();return{cursor:m()&&!l()?`ew-resize`:`default`,"touch-action":m()?`none`:`auto`,"user-select":`none`,"-webkit-user-select":`none`,"min-width":e.emphasized?`96px`:void 0,transform:t===0?`translateX(0)`:`translateX(${t}px)`,transition:a()?`none`:`transform 350ms ${kN}`}};return(()=>{var r=cq(),i=r.firstChild,o=i.firstChild,d=o.nextSibling,p=d.nextSibling,m=p.nextSibling;return i.addEventListener(`lostpointercapture`,x),i.addEventListener(`pointercancel`,x),i.$$pointerup=b,i.addEventListener(`pointerleave`,()=>c(!1)),i.addEventListener(`pointerenter`,()=>c(!0)),i.$$pointermove=y,i.$$pointerdown=v,$(i,X(oz,{get when(){return e.emphasized},get children(){var e=sq();return vR(t=>yz(e,`opacity`,l()?0:.55)),e}}),o),$(d,X(az,{each:pq,children:e=>(()=>{var t=lq();return vR(n=>{var r=`${e()}%`,i=S()?.4:0;return r!==n.e&&yz(t,`left`,n.e=r),i!==n.t&&yz(t,`opacity`,n.t=i),n},{e:void 0,t:void 0}),t})()})),$(m,X(oz,{get when(){return e.label},children:e=>(()=>{var t=uq();return hz(t,`${LK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),null),$(m,X(oz,{get when(){return l()},get fallback(){return(()=>{var t=dq(),n=t.firstChild,r=n.firstChild,i=u;return typeof i==`function`?xz(i,t):u=t,$(t,X(oz,{get when(){return e.tailwindLabel},children:e=>(()=>{var t=fq();return $(t,e),t})()}),n),$(n,X(oq,{get children(){return oV(e.value)}}),r),$(r,()=>e.unit),vR(n=>{var r=`${oV(e.value)}${e.unit}`,i=e.onCommitValue?`text`:`default`;return r!==n.e&&Q(t,`data-react-grab-value`,n.e=r),i!==n.t&&yz(t,`cursor`,n.t=i),n},{e:void 0,t:void 0}),t})()},get children(){return X(IK,{autoFocusSelect:!0,inputmode:`decimal`,"aria-label":`Style value`,class:`text-[12px] leading-4 font-medium tabular-nums text-right pointer-events-auto ml-auto`,get style(){return{"field-sizing":`content`,"min-width":`16px`,"max-width":e.emphasized?`120px`:`60px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:T,onBlur:C,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),null),$(r,X(oz,{get when(){return e.emphasized},get children(){return[X(GK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),X(GK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)})]}}),null),vR(t=>{var n=e.label??`Value`,r=e.min,c=e.max,u=e.value,d=`${oV(e.value)}${e.unit}`,m=ee(),h=`${f()}%`,g=+!l(),_=`calc(${f()}% - 1px)`,v=e.activeKey?.9:a()||s()?.35:0;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`aria-valuemin`,t.t=r),c!==t.a&&Q(i,`aria-valuemax`,t.a=c),u!==t.o&&Q(i,`aria-valuenow`,t.o=u),d!==t.i&&Q(i,`aria-valuetext`,t.i=d),t.n=vz(i,m,t.n),h!==t.s&&yz(o,`width`,t.s=h),g!==t.h&&yz(o,`opacity`,t.h=g),_!==t.r&&yz(p,`left`,t.r=_),v!==t.d&&yz(p,`opacity`,t.d=v),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),r})()},fz([`pointerdown`,`pointermove`,`pointerup`]),gq=e=>X(sz,{get children(){return[X(cz,{get when(){return YK(e.property)},children:t=>X(hq,{get label(){return aB(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get min(){return t().min},get max(){return t().max},get unit(){return t().unit},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommitValue(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get tailwindLabel(){return e.tailwindLabel},get emphasized(){return e.emphasized}})}),X(cz,{get when(){return XK(e.property)},children:t=>X(UK,{get label(){return aB(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onRegisterTrigger(){return e.onColorPickerRegister},get onInteract(){return e.onInteract},get emphasized(){return e.emphasized}})}),X(cz,{get when(){return ZK(e.property)},children:t=>X(JK,{get label(){return aB(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get options(){return t().options},get activeKey(){return e.activeKey},get onStep(){return e.onStep}})})]}}),_q=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),vq=e=>X(KW,{"data-react-grab-ignore-events":!0,"data-react-grab-copy-button":!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.onCopy()},get children(){return _q()}}),yq=()=>{let[e,t]=J(!1),n,r=()=>{clearTimeout(n),t(!1)},i=()=>{t(!0),clearTimeout(n),n=setTimeout(()=>{t(!1)},ON)},a=()=>{clearTimeout(n)};return ER(a),{isPending:e,show:i,hide:r,cleanup:a}},bq=Z(`<div role=menu aria-orientation=vertical aria-label="Editable properties"class="relative flex flex-col w-full max-h-[var(--rg-edit-list-max-h)] overflow-y-auto outline-none no-scrollbar"><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),xq=Z(`<div class="flex items-center w-full h-[24px]">`),Sq=Z(`<button data-react-grab-ignore-events type=button role=menuitem tabindex=-1 class="relative z-1 contain-layout block w-full h-[24px] px-0 py-0 cursor-pointer text-left border-none bg-transparent">`),Cq=Z(`<div class="flex items-center justify-between w-full h-[24px] px-2 gap-2"><span class="text-[13px] leading-4 font-sans font-medium text-[var(--rg-text-primary)] truncate min-w-0">`),wq=Z(`<span class="font-sans text-[var(--rg-text-secondary)] tabular-nums shrink-0"><span class=text-[11px]></span><span class="text-[9px] ml-px">`),Tq=Z(`<span aria-hidden=true class="size-[12px] rounded-[3px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid shrink-0">`),Eq=Z(`<span class="text-[11px] font-sans text-[var(--rg-text-secondary)] shrink-0">`),Dq=e=>{let t=ZK(e);return t?t.options.find(e=>e.value===t.value)?.label??t.value:``},Oq=e=>{let t=[],n,r=!1,i=null,a=()=>{if(!n)return!1;let e=NK(n);return e instanceof HTMLElement&&e.matches(`input[data-react-grab-input]`)},o=(t,n)=>{n===`move`&&(r=!0);let o=a();if(r&&!o){if(e.isAdjusting()){i=t;return}i=null,t!==e.activeIndex&&e.onHoverIndex(t)}};yR(()=>{if(e.isAdjusting())return;let n=i;if(n===null)return;i=null;let o=t[n],s=a();r&&(s||o?.matches(`:hover`)&&n!==e.activeIndex&&e.onHoverIndex(n))});let{containerRef:s,highlightRef:c,updateHighlight:l,clearHighlight:u}=vK({});yR(()=>{t.length=e.properties.length});let d;return yR(()=>{let r=e.activeIndex,i=t[r];if(!i||r<0){u();return}if(l(i),d!==void 0&&cancelAnimationFrame(d),d=requestAnimationFrame(()=>{d=void 0;let e=t[r];e&&l(e)}),!n)return;let a=n.getBoundingClientRect(),o=i.getBoundingClientRect();(o.top<a.top||o.bottom>a.bottom)&&i.scrollIntoView({block:`nearest`})}),ER(()=>{d!==void 0&&cancelAnimationFrame(d)}),(()=>{var a=bq(),l=a.firstChild;return a.$$pointermove=()=>{r=!0},xz(e=>{n=e,s(e)},a),xz(c,l),$(a,X(az,{get each(){return e.properties},children:(r,a)=>{let s=()=>a===e.activeIndex;return(()=>{var c=Sq();return c.$$click=t=>{t.stopPropagation(),e.onSelect(a)},c.$$mousedown=e=>{let t=n?NK(n):null;t instanceof HTMLElement&&t.matches(`input[data-react-grab-input]`)&&t.blur(),e.preventDefault()},c.addEventListener(`pointerleave`,()=>{i===a&&(i=null)}),c.$$pointermove=()=>{o(a,`move`)},c.addEventListener(`pointerenter`,()=>{o(a,`enter`)}),xz(e=>{t[a]=e,ER(()=>{t[a]===e&&(t[a]=void 0)})},c),$(c,X(oz,{get when(){return s()},get fallback(){return(()=>{var e=Cq(),t=e.firstChild;return $(t,()=>r().label),$(e,X(sz,{get children(){return[X(cz,{get when(){return YK(r())},children:e=>(()=>{var t=wq(),n=t.firstChild,r=n.nextSibling;return $(n,()=>oV(e().value)),$(r,()=>e().unit),t})()}),X(cz,{get when(){return XK(r())},children:e=>(()=>{var t=Tq();return vR(n=>yz(t,`background-color`,e().value)),t})()}),X(cz,{get when(){return ZK(r())},children:e=>(()=>{var t=Eq();return $(t,()=>Dq(e())),t})()})]}}),null),e})()},get children(){var t=xq();return $(t,X(gq,{get property(){return r()},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get onColorPickerRegister(){return e.onColorPickerRegister},showLabel:!0,get tailwindLabel(){return e.activeTailwindLabel}})),t}})),vR(e=>{var t=r().key,n=s()?`true`:void 0;return t!==e.e&&Q(c,`data-react-grab-edit-property`,e.e=t),n!==e.t&&Q(c,`aria-current`,e.t=n),e},{e:void 0,t:void 0}),c})()}}),null),a})()},fz([`pointermove`,`mousedown`,`click`]),kq=(e,t,n)=>e.kind===`color`&&typeof t==`string`&&typeof n==`string`?t.toLowerCase()===n.toLowerCase():t===n,Aq=e=>e===`ArrowLeft`?-1:1,jq=e=>{let[t,n]=J(0),r=null,i=null,a=null,o=()=>{i!==null&&clearTimeout(i),a!==null&&clearInterval(a),i=null,a=null,r=null},s=()=>{o(),n(0)},c=t=>{o(),r=t;let n=Aq(t);i=setTimeout(()=>{a=setInterval(()=>{e.step(n,e.isShiftHeld(),e.isAltHeld(),!0)},60)},280)};return TR(()=>{window.addEventListener(`blur`,s),ER(()=>window.removeEventListener(`blur`,s))}),ER(s),{heldDirection:t,pressArrow:(t,r,i,a)=>{if(r)return;let o=Aq(t);c(t),n(o),e.step(o,i,a,!1)},releaseKey:e=>{e===r&&s()},cancelRepeat:s}},Mq=(e,t,n)=>{if(e.length===0)return null;let r=e.findIndex(e=>e.value===t),i=e[((r===-1?0:r)+n+e.length)%e.length];return!i||i.value===t?null:i},Nq=(e,t,n,r,i)=>{if(e.kind===`enum`)return Mq(e.options,e.value,t)?.value??null;if(e.kind!==`numeric`)return null;let a=Math.min(e.min,e.value),o=Math.max(e.max,e.value);if(!n&&!r&&e.unit===`px`&&i?.hasTokens){let n=i.stepLength(e.value,t,e.cssProperties[0]);if(n!==null){let t=sV(MB(n,a,o));if(t!==e.value)return t}}let s=n?10:1,c=sV(MB(e.value+t*s,a,o));return c===e.value?null:c},Pq=/^-?\d*\.?\d+$/,Fq=e=>Pq.test(e),Iq=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,``),Lq=e=>{if(e.kind!==`enum`)return[];let t=[];for(let n of e.options){let e=Iq(n.value),r=Iq(n.label);e&&t.push(e),r&&r!==e&&t.push(r)}return t},Rq=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(let e of r.tailwindAliases){let i=Iq(e);i&&t.push({property:r,originalIndex:n,kind:`alias`,term:i})}for(let e of Lq(r))t.push({property:r,originalIndex:n,kind:`enum-option`,term:e});let i=Iq(r.label);i&&t.push({property:r,originalIndex:n,kind:`name`,term:i});let a=Iq(r.key);a&&a!==i&&t.push({property:r,originalIndex:n,kind:`name`,term:a});let o=Iq(`${r.label} ${r.key}`);o&&t.push({property:r,originalIndex:n,kind:`label`,term:o})}return t},zq=(e,t)=>{if(t.kind===`alias`||t.kind===`enum-option`||t.kind===`name`)return e===t.term?MN+t.term.length:t.term.startsWith(e)||e.startsWith(t.term)?NN+Math.min(e.length,t.term.length):null;let n=t.term.indexOf(e);return n===-1?null:n===0?PN-t.term.length*1:FN-n*100-t.term.length*1},Bq=(e,t,n,r)=>{let i=e.get(t.key);i&&i.score>=r||e.set(t.key,{property:t,score:r,originalIndex:n})},Vq=e=>{let t=Rq(e),n=new Map;for(let t=0;t<e.length;t++)n.set(e[t].key,t);let r=(t,r,i)=>{for(let a=0;a<r.length;a++){let o=r[a],s=n.get(o);if(s===void 0)continue;let c=e[s];Bq(t,c,s,i-a)}};return{search:n=>{let i=Iq(n);if(!i||Fq(i))return e;let a=new Map;r(a,MV(n),AN),r(a,NV(n),jN);for(let e of t){let t=zq(i,e);t!==null&&Bq(a,e.property,e.originalIndex,t)}return Array.from(a.values()).sort((e,t)=>t.score===e.score?e.originalIndex-t.originalIndex:t.score-e.score).map(e=>e.property)}}},Hq=(e,t)=>e.kind===t.kind&&!kq(e,t.value,e.original),Uq=e=>{let{initialProperties:t,searchQuery:n}=e,[r,i]=J({}),a=Vq(t),o=Y(()=>{let e=n(),i=r(),o=e?t:t.filter(e=>e.isPrioritized||e.isCanonical&&!e.isDefault||i[e.key]!==void 0);return e?a.search(e):o.slice(0,40)}),s=new Map(t.map(e=>[e.key,e])),c=Y(()=>{let e=r(),t=Object.keys(e);if(t.length===0)return o();let n=new Map;for(let r of t){let t=e[r];if(t.kind!==`numeric`)continue;let i=s.get(r);if(i)for(let e of i.cssProperties)n.set(e,t.value)}return o().map(t=>{let r=e[t.key];if(r!==void 0)return l(t,r);if(t.kind!==`numeric`)return t;let i=n.get(t.cssProperties[0]);return i===void 0?t:t.cssProperties.every(e=>n.get(e)===i)?{...t,value:i}:t})}),l=(e,t)=>e.kind===`numeric`&&t.kind===`numeric`||e.kind===`color`&&t.kind===`color`||e.kind===`enum`&&t.kind===`enum`?{...e,value:t.value}:e;return{filteredProperties:c,applyStyle:(e,t)=>{let n;if(e.kind===`numeric`&&typeof t==`number`)n={kind:`numeric`,value:t};else if(e.kind===`color`&&typeof t==`string`)n={kind:`color`,value:t};else if(e.kind===`enum`&&typeof t==`string`)n={kind:`enum`,value:t};else return;i(t=>{let r=Object.keys(t);if(r[r.length-1]===e.key)return{...t,[e.key]:n};let i={};for(let n of r){if(n===e.key)continue;let r=s.get(n);r!==void 0&&r.cssProperties.every(t=>e.cssProperties.includes(t))||(i[n]=t[n])}return i[e.key]=n,i})},buildPendingEdits:()=>{let e=r(),t=[],n=new Set;for(let r of Object.keys(e)){let i=e[r],a=s.get(r);if(!a||a.kind!==i.kind)continue;let o=Hq(a,i),c=!o&&a.cssProperties.some(e=>n.has(e));if(!(!o&&!c)){if(o)for(let e of a.cssProperties)n.add(e);a.kind===`numeric`&&i.kind===`numeric`?t.push({kind:`numeric`,key:a.key,cssProperties:a.cssProperties,value:i.value,unit:a.unit}):a.kind===`color`&&i.kind===`color`?t.push({kind:`color`,key:a.key,cssProperties:a.cssProperties,value:i.value}):a.kind===`enum`&&i.kind===`enum`&&t.push({kind:`enum`,key:a.key,cssProperties:a.cssProperties,value:i.value})}}return t},hasPendingStyles:()=>{let e=r();for(let n of t){let t=e[n.key];if(t&&Hq(n,t))return!0}return!1},hasChangedStyleFor:e=>{let t=r()[e],n=s.get(e);return!!(t&&n&&Hq(n,t))}}},Wq=new Map;for(let e of XB)for(let t of e)Wq.set(t.key,t.longhands);Gq=e=>{if(e.includes(`,`))return e.split(`,`);let t=Wq.get(e);return t?[...t]:[e]},Kq=/^-?(?:\d+\.?|\d*\.\d*)?$/,qq=e=>Kq.test(e),Jq=e=>{let t=e.startsWith(`-`);return{isNegative:t,base:t?e.slice(1):e}},Yq=/^([a-z-]+)-(-?\d+(?:\.\d+)?)$/,Xq=/^(.+?)-\[(.+)]$/,Zq=/^(-?\d*\.?\d+)\s*([a-zA-Z%]*)$/,Qq=/^(-?\d*\.?\d+)(px|rem)?$/i,$q=/^(?:length|size):/i,eJ=new Set([`opacity`,`border-width`,`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`,`z-index`,`font-weight`]),tJ=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`numeric`)return n;return null},nJ=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`enum`)return n;return null},rJ=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`color`)return n;return null},iJ=e=>{let t=e.replace(/^(?:color|length|size):/i,``).trim();return/(?:var|url)\(/i.test(t)?t:t.replace(/_/g,` `)},aJ=e=>{let t=e.lastIndexOf(`:`),n=t>=0?e.slice(t+1):e;return(n.startsWith(`!`)?n.slice(1):n).toLowerCase()},oJ=(e,t)=>{let n=e.match(Qq);if(!n)return null;let r=n[2]?.toLowerCase();if(!r&&!t)return null;let i=Number.parseFloat(n[1]);return Number.isFinite(i)?r===`rem`?i*16:i:null},sJ=(e,t)=>{let n=Gq(t),r=new Map;for(let t of n)for(let n of e)n.kind===`numeric`&&n.cssProperties.includes(t)&&r.set(n.key,n);return Array.from(r.values())},cJ=(e,t)=>sV(MB(t,e.min,e.max)),lJ=e=>{let{initialProperties:t,searchQuery:n,isCompact:r,activeProperty:i,commit:a,setIsCompact:o}=e,s=e=>{for(let n of t)if(n.key===e&&(n.kind===`numeric`||n.kind===`enum`))return!0;return sJ(t,e).length>0},c=e=>{let t=e.trim().replace(/(\d),(\d)/g,`$1.$2`).match(Zq);if(!t)return null;let n=Number.parseFloat(t[1]);return Number.isFinite(n)?{value:n,unit:t[2].toLowerCase()}:null},l=(e,t)=>!e||t.toLowerCase().startsWith(e),u=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);return n?l(n.unit,t.unit):qq(e)},d=Y(()=>u(n())),f=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);if(!n)return!1;let o=t.unit.toLowerCase();if(n.unit!==``&&n.unit!==o)return l(n.unit,t.unit);let s=cJ(t,n.value);return s!==t.value&&a(t,s),!0},p=(e,n)=>{let r=tJ(t,e);if(r)return r.unit===`px`?(o(!0),a(r,cJ(r,n),{shouldCompact:!0}),!0):!1;let i=sJ(t,e);return i.length===0?!1:(o(!0),SR(()=>{for(let e of i)a(e,cJ(e,n),{shouldCompact:!0})}),!0)},m=(e,n)=>{let r=EV(e);if(!r)return!1;let i=rJ(t,r);if(!i)return!1;let s=n===null?OV(e):jB(n);return s?(o(!0),a(i,s,{shouldCompact:!0}),!0):!1},h=e=>{let t=e.trim(),n=t.match(Xq);if(!n)return!1;let r=n[2],i=iJ(r);if(m(t,i))return!0;let a=oJ(i,$q.test(r.trim()));if(a===null)return!1;let{isNegative:o,base:s}=Jq(n[1]),c=IV(aJ(s));return c?p(c,o?-a:a):!1},g=e=>{if(h(e))return;let n=CV(e),{isNegative:r,base:i}=Jq(n),c=i.replace(/-\d*$/,``).replace(/-$/,``),l=c?IV(c):null;if(l&&s(l)&&o(!0),!r){if(m(n,null))return;let e=LV(n);if(e){let n=nJ(t,e.property);if(!n)return;let r=n.options.find(t=>t.value===e.value);r&&(o(!0),a(n,r.value,{shouldCompact:!0}));return}}let u=i.match(Yq);if(!u)return;let d=IV(u[1]);if(!d)return;let f=Number.parseFloat(u[2]);if(!Number.isFinite(f))return;let p=r?-f:f,g=eJ.has(d)?p:p*4,_=tJ(t,d);if(_){a(_,cJ(_,g),{shouldCompact:!0});return}if(!r){let e=nJ(t,d);if(e){let t=String(f),n=e.options.find(e=>e.value===t);if(n){a(e,n.value,{shouldCompact:!0});return}}}let v=sJ(t,d);v.length!==0&&SR(()=>{for(let e of v)a(e,cJ(e,g),{shouldCompact:!0})})},_=e=>{if(LV(e))return!0;let{base:n}=Jq(e),r=n.match(Yq);if(!r)return!1;let i=IV(r[1]);return i?s(i)?!0:nJ(t,i)!==null:!1};return{isInlineNumericEdit:d,isInlineNumericDraft:u,tryApplyNumericValue:f,applyTailwindClass:e=>{let t=e.trim().replace(/^class\s*=\s*["']/,``).replace(/["']\s*$/,``).replace(/\s+\[/g,`-[`),n=CV(t),r=t.split(/\s+/).filter(Boolean);if(r.length>1&&!_(n)){for(let e of r)g(e);return}g(t)}}},uJ=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),dJ=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),fJ=Z(`<div role=alertdialog aria-modal=true aria-labelledby=rg-discard-prompt-title class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full self-stretch"><span id=rg-discard-prompt-title class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium">Discard edits?</span><div class="flex items-center gap-[5px]">`),pJ=Z(`<div><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Search properties"aria-keyshortcuts="Enter Escape ArrowUp ArrowDown ArrowLeft ArrowRight Tab"autocapitalize=none autocorrect=off autocomplete=off class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none w-full p-0 m-0 outline-none"rows=1 style=caret-color:var(--rg-text-primary);field-sizing:content;min-height:16px;max-height:16px;scrollbar-width:none>`),mJ=Z(`<div>`),hJ=Z(`<div role=dialog aria-modal=true aria-label="Style element"data-react-grab-ignore-events data-react-grab-edit-panel>`),gJ=Z(`<div class="flex items-center justify-center w-full px-3 py-1.5 min-h-[28px]">`),_J=e=>X(oz,{get when(){return e.state},children:t=>X(oz,{keyed:!0,get when(){return t().element},children:n=>X(vJ,{get state(){return t()},position:()=>e.position,get onDismiss(){return e.onDismiss},get onSubmit(){return e.onSubmit},get onPendingEditsChange(){return e.onPendingEditsChange},get onInteractingChange(){return e.onInteractingChange}})})}),vJ=e=>{let t=e.state.properties,n,r=e.state.preview,[i,a]=J(e.state.initialSearchQuery??``),[o,s]=J(null),[c,l]=J(null),u=Uq({initialProperties:t,searchQuery:()=>o()??i()}),d=()=>{let e=u.filteredProperties().findIndex(e=>e.kind===`numeric`);return e>0?e:0},[f,p]=J(d()),m=Y(()=>u.hasPendingStyles()),h=Y(()=>m()||!!e.state.hasSessionEdits),[g,_]=J(!1),v,y,b,x=!1,[S,C]=J(!1),w=Y(()=>S()||m()),[T,ee]=J(!1),E=GV(),D=Y(()=>bW({tagName:e.state.tagName,componentName:e.state.componentName})),O=Y(()=>{let e=u.filteredProperties();return e.length===0?null:e[Math.min(Math.max(0,f()),e.length-1)]}),te,k=AK(()=>te,e.position),A=e=>{l(e),clearTimeout(v),v=setTimeout(()=>{l(t=>t===e?null:t)},100)},ne=Y(()=>w()&&!T());yR(()=>{let t=ne();e.onInteractingChange?.(t)});let re=()=>{C(!0),clearTimeout(y),y=setTimeout(()=>{C(!1)},150)},ie=()=>{queueMicrotask(()=>{n&&NK(n)!==n&&hW(n,{preventScroll:!0})})},ae=()=>{o()===null&&s(i())},oe=()=>{x=!1,clearTimeout(b)},se=()=>{x=!1,clearTimeout(b),b=setTimeout(()=>{x=!0},500)},ce=e=>{let t=e.trim(),n=t.replace(/^-/,``).replace(`.`,``);/[a-z%]+$/i.test(t)||n.length>1?se():oe()},le=e=>{if(!x)return e;let t=i();if(!t||!e.startsWith(t))return oe(),e;let n=e.slice(t.length);return/^[-.\d]/.test(n)?(oe(),n):e},ue=e=>{if(!x||e.metaKey||e.ctrlKey||e.altKey||!/^[-.\d]$/.test(e.key))return!1;e.preventDefault(),e.stopImmediatePropagation(),oe();let t=e.key;return n&&(n.value=t),xe.tryApplyNumericValue(t)?(ae(),a(t),ce(t),ie(),!0):(a(t),ie(),!0)},de=()=>{oe(),s(null),_(!1)},fe=(t,n,i={})=>{u.applyStyle(t,n),r.apply(t.cssProperties,cV(t,n)),e.onPendingEditsChange?.(u.buildPendingEdits()),re(),i.isFromKeyRepeat||we.hide(),i.flashDirection&&A(i.flashDirection===1?`right`:`left`),i.shouldFocus&&ie(),i.shouldCompact&&_(!0),i.source===`keyboard`&&E.arm()},pe=VV(e=>e.shiftKey),me=VV(e=>e.altKey),he=(t,n,r,i,a)=>{let o=O();if(!o)return null;let s=Nq(o,t,n,r,e.state.designTokens);return s===null?(A(t===1?`right`:`left`),null):(fe(o,s,{flashDirection:t,shouldFocus:!0,isFromKeyRepeat:i,source:a}),o)},ge=(e,t,n,r)=>{he(e,t,n,r,`keyboard`)&&_(!0)},_e=e=>{he(e,!1,!1,!1,`pointer`)},ve=jq({step:ge,isShiftHeld:pe,isAltHeld:me}),ye=(e,t)=>{let n=O();if(n){if(n.kind===`numeric`&&typeof e==`number`){let r=sV(MB(e,n.min,n.max));r!==n.value&&fe(n,r,{source:t});return}typeof e==`string`&&(kq(n,e,n.value)||fe(n,e,{source:t}))}},be=Y(()=>{if(!pe())return null;let e=O();return!e||e.kind!==`numeric`?null:MK(e.key,e.value)}),xe=lJ({initialProperties:t,searchQuery:i,isCompact:g,activeProperty:O,commit:(e,t,n)=>{fe(e,t,{...n,source:`keyboard`})},setIsCompact:_}),Se=Y(()=>g()&&i()!==``&&xe.isInlineNumericEdit()),Ce=()=>{we.hide(),E.clear(),e.onSubmit(u.buildPendingEdits())},we=yq(),Te,Ee=()=>{Te&&(Te.classList.remove(`animate-shake`),Te.offsetWidth,Te.classList.add(`animate-shake`))},De=t=>{we.hide(),t===`discard`&&r.restore(),e.onDismiss()},Oe=e=>{if(ve.cancelRepeat(),e===`pointer`&&E.clear(),we.isPending()){De(`discard`);return}if(!h()){De(r.hasAppliedStyles()?`discard`:`preserve`);return}let t=g();de(),!(e===`keyboard`&&t)&&(we.show(),Ee())},ke=e=>{let t=u.filteredProperties();t.length!==0&&(p(n=>(n+e+t.length)%t.length),de())},Ae=()=>{E.clear(),we.hide()},je=[],Me=e=>(je.push(e),()=>{je=je.filter(t=>t!==e)}),Ne=()=>je[je.length-1]??null,Pe=(e,t)=>{if(O()?.kind===`color`){t.repeat||Ne()?.();return}ve.pressArrow(e,t.repeat,t.shiftKey,t.altKey)},Fe={ArrowUp:()=>ke(-1),ArrowDown:()=>ke(1),ArrowLeft:e=>Pe(`ArrowLeft`,e),ArrowRight:e=>Pe(`ArrowRight`,e),Tab:e=>ke(e.shiftKey?-1:1),Enter:()=>{if(we.isPending())return;let e=O(),t=Ne();if(e?.kind===`color`&&!u.hasChangedStyleFor(e.key)&&t&&!h()){t();return}Ce()},Escape:()=>Oe(`keyboard`)},Ie=e=>{if(e.isComposing||e.keyCode===229)return;if(we.isPending()){let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null&&(e.key===`Tab`||e.key===`Enter`))return;if(e.key===`Tab`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault(),e.stopImmediatePropagation();return}}let t=Fe[e.key];t&&(e.preventDefault(),e.stopImmediatePropagation(),t(e))};TR(()=>{queueMicrotask(()=>{if(hW(n,{preventScroll:!0}),n){let e=n.value.length;n.setSelectionRange(e,e)}}),k.measure();let e=i();e&&xe.applyTailwindClass(e);let t=wK({isOpen:()=>!0,onDismiss:Oe,shouldIgnoreKeyboardEvent:e=>{let t=e.composedPath()[0];return we.isPending()&&t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null},shouldIgnoreRightClick:!0,shouldIgnoreInputEvents:!0}),r=zM(e=>{IB(e,`data-react-grab-input`)||ue(e)||Ie(e)}),a=zM(e=>{ve.releaseKey(e.key)}),o=zM(e=>{e.pointerType===`mouse`&&(we.isPending()||E.consume()&&h()&&Oe(`pointer`))});window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`keyup`,a,{capture:!0}),window.addEventListener(`pointermove`,o,{capture:!0}),ER(()=>{t(),window.removeEventListener(`keydown`,r,{capture:!0}),window.removeEventListener(`keyup`,a,{capture:!0}),window.removeEventListener(`pointermove`,o,{capture:!0}),clearTimeout(v),clearTimeout(y),clearTimeout(b),we.cleanup(),k.clearAnimationHandles(),C(!1)})});let j=e=>{p(e),ie()};return X(oz,{get when(){return k.shouldMount()},get children(){var e=hJ();gz(e,`contextmenu`,CK,!0),gz(e,`click`,CK,!0),gz(e,`mousedown`,CK,!0),gz(e,`pointerdown`,CK,!0);var t=te;return typeof t==`function`?xz(t,e):te=e,yz(e,`z-index`,`${XM}`),yz(e,`--rg-edit-list-max-h`,`280px`),$(e,X(RW,{ref:e=>Te=e,class:`flex flex-col justify-center items-start overflow-hidden w-fit h-fit`,get style(){return{"min-width":g()?void 0:`200px`,"max-width":`320px`,transform:`translateX(${ve.heldDirection()*2}px)`,transition:`transform 280ms ${kN}`}},get children(){return[X(oz,{get when(){return we.isPending()},get fallback(){return X(oz,{get when(){return!g()},get children(){var e=mJ();return e.addEventListener(`mouseleave`,()=>ee(!1)),e.addEventListener(`mouseenter`,()=>ee(!0)),$(e,X(MW,{get tagName(){return D().tagName},get componentName(){return D().componentName},isClickable:!1,onClick:()=>{},shrink:!0}),null),$(e,X(oz,{get when(){return h()},get children(){return X(vq,{onCopy:Ce})}}),null),vR(()=>hz(e,yW(`contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 h-fit px-2`,h()?`w-full self-stretch justify-between`:`w-fit`))),e}})},get children(){var e=fJ(),t=e.firstChild.nextSibling;return $(t,X(KW,{"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`cancel`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Ae()},get children(){return uJ()}}),null),$(t,X(KW,{variant:`destructive`,"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`confirm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),De(`discard`)},get children(){return dJ()}}),null),e}}),(()=>{var e=pJ(),t=e.firstChild;return t.$$keydown=Ie,t.$$input=e=>{let t=le(e.currentTarget.value);if(t!==e.currentTarget.value&&(e.currentTarget.value=t),xe.tryApplyNumericValue(t)){ae(),a(t),ce(t),ie();return}if(oe(),xe.isInlineNumericDraft(t)){ae(),a(t),ie();return}a(t),s(null),p(t.trim()===``?d():0),de(),xe.applyTailwindClass(t)},xz(e=>{n=e},t),Q(t,`spellcheck`,!1),vR(n=>{var r=Se()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-full self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased`,i=Se()?RK:void 0,a=Se()?-1:0,o=g()?O()?.label??`Search property`:`Search property`;return r!==n.e&&hz(e,n.e=r),n.t=vz(e,i,n.t),a!==n.a&&Q(t,`tabindex`,n.a=a),o!==n.o&&Q(t,`placeholder`,n.o=o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),vR(()=>t.value=i()),e})(),X(oz,{get when(){return u.filteredProperties().length>0},get children(){var e=mJ();return $(e,X(Oq,{get properties(){return u.filteredProperties()},get activeIndex(){return f()},get activeKey(){return c()},onHoverIndex:p,onSelect:j,onStep:_e,onCommit:ye,onColorPickerRegister:Me,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,isAdjusting:S,get activeTailwindLabel(){return be()}})),vR(t=>{var n=g()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start w-full self-stretch antialiased`,r=g()?RK:void 0;return n!==t.e&&hz(e,t.e=n),t.t=vz(e,r,t.t),t},{e:void 0,t:void 0}),e}}),X(oz,{get when(){return aB(()=>!!g())()&&O()},children:e=>(()=>{var t=gJ();return t.$$mousedown=e=>e.preventDefault(),$(t,X(gq,{get property(){return e()},get activeKey(){return c()},onStep:_e,onCommit:ye,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,onColorPickerRegister:Me,showLabel:!1,get tailwindLabel(){return be()},emphasized:!0})),t})()})]}})),vR(t=>{var n=g()?`true`:`false`,r=yW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none`,k.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`),i=`${k.displayPosition().top}px`,a=`${k.displayPosition().left}px`,o=k.isAnimatedIn()?`auto`:`none`,s=wN[k.lastAnchorEdge()],c=k.isAnimatedIn()?`1`:`0`,l=k.isAnimatedIn()?`scale(1)`:`scale(0.92)`;return n!==t.e&&Q(e,`data-rg-compact`,t.e=n),r!==t.t&&hz(e,t.t=r),i!==t.a&&yz(e,`top`,t.a=i),a!==t.o&&yz(e,`left`,t.o=a),o!==t.i&&yz(e,`pointer-events`,t.i=o),s!==t.n&&yz(e,`transform-origin`,t.n=s),c!==t.s&&yz(e,`opacity`,t.s=c),l!==t.h&&yz(e,`transform`,t.h=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e}})},fz([`pointerdown`,`mousedown`,`click`,`contextmenu`,`input`,`keydown`]),yJ=Z(`<div data-react-grab-ignore-events>`),bJ=e=>{let t,n=()=>e.interactive!==!1,r=AK(()=>t,()=>e.position);return TR(()=>{r.measure();let t=e.onDismiss?wK({isOpen:()=>!!e.position,onDismiss:e.onDismiss}):void 0;ER(()=>{r.clearAnimationHandles(),t?.()})}),X(oz,{get when(){return r.shouldMount()},get children(){var i=yJ(),a=t;return typeof a==`function`?xz(a,i):t=i,bz(i,nz(()=>({[e.dataAttribute]:``}),{get class(){return yW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none will-change-[opacity,transform]`,r.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`)},get style(){return{top:`${r.displayPosition().top}px`,left:`${r.displayPosition().left}px`,"z-index":`${XM}`,"pointer-events":n()&&r.isAnimatedIn()?`auto`:`none`,"transform-origin":wN[r.lastAnchorEdge()],opacity:r.isAnimatedIn()?`1`:`0`,transform:r.isAnimatedIn()?`scale(1)`:`scale(0.92)`}},onPointerDown:CK,onMouseDown:CK,onClick:CK,onContextMenu:CK}),!1,!0),$(i,()=>e.children),i}})},xJ=e=>{let t=yK({clearActiveOnPointerLeave:!0,highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:bN}});return X(bJ,{get position(){return e.position},dataAttribute:`data-react-grab-toolbar-menu`,get onDismiss(){return e.onDismiss},get children(){return X(bK.Panel,{class:`overflow-hidden`,style:{"min-width":`100px`},get children(){return X(bK.Provider,{store:t,get children(){return X(bK.List,{label:`Default action`,get children(){return X(iz,{get each(){return e.actions},children:t=>{let n=()=>t.id===e.defaultActionId;return X(bK.Item,{get value(){return t.id},role:`menuitemradio`,get checked(){return n()},onSelect:()=>{e.onSetDefaultAction(t.id),e.onDismiss()},get children(){return[X(bK.Label,{get class(){return n()?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)]`},get children(){return t.label}}),X(oz,{get when(){return t.shortcut},children:e=>X(bK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})}})}})}})}})}})},SJ=Z(`<span aria-hidden=true class="shrink-0 font-mono text-[11px] leading-4 text-[var(--rg-text-secondary)] opacity-60 mr-1">`),CJ=Z(`<span class=text-[var(--rg-text-secondary)]>.`),wJ=Z(`<span class="flex items-center min-w-0 w-full"><span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0 transition-colors">`),TJ=e=>{let t=()=>e.state?.activeIndex??0,n=yK({value:()=>String(t()),highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:bN}});return X(bJ,{get position(){return e.position},dataAttribute:`data-react-grab-hierarchy-menu`,interactive:!1,get children(){return X(bK.Panel,{class:`overflow-hidden`,style:{"min-width":`160px`},get children(){return X(bK.Provider,{store:n,get children(){return X(bK.List,{label:`Navigate element hierarchy`,get children(){return X(iz,{get each(){return e.state?.items??[]},children:(e,n)=>X(bK.Item,{get value(){return String(n())},role:`menuitemradio`,get checked(){return n()===t()},get children(){var r=wJ(),i=r.firstChild;return $(r,X(oz,{get when(){return e.depth>0},get children(){var t=SJ();return $(t,()=>e.isLast?`└─`:`├─`),vR(n=>yz(t,`padding-left`,`${(e.depth-1)*12}px`)),t}}),i),$(i,X(oz,{get when(){return e.componentName},get children(){return[aB(()=>e.componentName),CJ()]}}),null),$(i,()=>e.tagName,null),vR(e=>{var r=n()===t(),a=n()!==t();return r!==e.e&&i.classList.toggle(`text-[var(--rg-text-primary)]`,e.e=r),a!==e.t&&i.classList.toggle(`text-[var(--rg-text-secondary)]`,e.t=a),e},{e:void 0,t:void 0}),r}})})}})}})}})}})},EJ=e=>[X(dW,{get selectionVisible(){return e.selectionVisible},get selectionBounds(){return e.selectionBounds},get selectionBoundsMultiple(){return e.selectionBoundsMultiple},get selectionShouldSnap(){return e.selectionShouldSnap},get dragVisible(){return e.dragVisible},get dragBounds(){return e.dragBounds},get grabbedBoxes(){return e.grabbedBoxes},get labelInstances(){return e.labelInstances}}),X(pW,{get visible(){return e.isFrozen??!1}}),X(oz,{get when(){return aB(()=>!!e.selectionLabelVisible)()&&(e.frozenLabelEntries?.length??0)>0},get children(){return X(az,{get each(){return e.frozenLabelEntries??[]},children:(t,n)=>X(CG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,shouldToggleExpandOnClick:n===0,get onToggleExpand(){return n===0?e.onToggleExpand:void 0}})})}}),X(oz,{get when(){return aB(()=>!!e.selectionLabelVisible)()&&e.pendingShiftPreviewEntry},children:e=>X(CG,{get tagName(){return e().tagName},get componentName(){return e().componentName},get selectionBounds(){return e().bounds},get mouseX(){return e().mouseX},visible:!0})}),X(oz,{get when(){return aB(()=>!!(e.selectionLabelVisible&&e.selectionBounds))()&&(e.frozenLabelEntries?.length??0)===0},get children(){return X(CG,{get tagName(){return e.selectionTagName},get componentName(){return e.selectionComponentName},get elementsCount(){return e.selectionElementsCount},get selectionBounds(){return e.selectionBounds},get mouseX(){return e.mouseX},get visible(){return e.selectionLabelVisible},get isPromptMode(){return e.isPromptMode},get inputValue(){return e.inputValue},get status(){return e.selectionLabelStatus},get filePath(){return e.selectionFilePath},get onInputChange(){return e.onInputChange},get onSubmit(){return e.onInputSubmit},get onToggleExpand(){return e.onToggleExpand},get selectionLabelShakeCount(){return e.selectionLabelShakeCount},get onConfirmDismiss(){return e.onConfirmDismiss},get discardPrompt(){return e.discardPrompt},onOpen:()=>{e.selectionFilePath&&II(e.selectionFilePath,e.selectionLineNumber)},get isContextMenuOpen(){return e.contextMenuPosition!==null}})}}),X(az,{get each(){return e.labelInstances??[]},children:t=>X(CG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get elementsCount(){return t().elementsCount},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,get status(){return t().status},get statusText(){return t().statusText},get isPromptMode(){return t().isPromptMode},get inputValue(){return t().inputValue},get error(){return t().errorMessage},get hideArrow(){return t().hideArrow},get onShowContextMenu(){let n=t();if(!(!(n.status===`copied`||n.status===`fading`)||!sB(n.element)))return()=>e.onShowContextMenuInstance?.(n.id)},onHoverChange:n=>e.onLabelInstanceHoverChange?.(t().id,n)})}),X(oz,{get when(){return e.toolbarVisible!==!1},get children(){return X(ZG,{get isActive(){return e.isActive},get isContextMenuOpen(){return e.contextMenuPosition!==null},get onToggle(){return e.onToggleActive},get onActivateAction(){return e.onActivateAction},get activeActionId(){return e.activeActionId},get enabled(){return e.enabled},get shakeCount(){return e.shakeCount},get onStateChange(){return e.onToolbarStateChange},get onSubscribeToStateChanges(){return e.onSubscribeToToolbarStateChanges},get onSelectHoverChange(){return e.onToolbarSelectHoverChange},get onContainerRef(){return e.onToolbarRef},get onToggleToolbarMenu(){return e.onToggleToolbarMenu}})}}),X(DK,{get position(){return e.contextMenuPosition??null},get selectionBounds(){return e.contextMenuBounds??null},get tagName(){return e.contextMenuTagName},get componentName(){return e.contextMenuComponentName},get hasFilePath(){return e.contextMenuHasFilePath??!1},get actions(){return e.actions},get actionContext(){return e.actionContext},get onDismiss(){return e.onContextMenuDismiss??(()=>{})},get onHide(){return e.onContextMenuHide??(()=>{})}}),X(xJ,{get position(){return e.toolbarMenuPosition??null},get actions(){return e.toolbarMenuActions??[]},get defaultActionId(){return e.defaultActionId??`copy`},get onSetDefaultAction(){return e.onSetDefaultAction??(()=>{})},get onDismiss(){return e.onToolbarMenuDismiss??(()=>{})}}),X(TJ,{get position(){return e.hierarchyMenuPosition??null},get state(){return e.hierarchyState}}),X(_J,{get state(){return e.editPanelState??null},get position(){return e.editPanelPosition??null},get onDismiss(){return e.onEditPanelDismiss??(()=>{})},get onSubmit(){return e.onEditPanelSubmit??(()=>{})},get onPendingEditsChange(){return e.onEditPanelPendingEditsChange},get onInteractingChange(){return e.onEditPanelInteractingChange}})]}));function OJ(e){let t=e[Pz];if(!t&&(Object.defineProperty(e,Pz,{value:t=new Proxy(e,qJ)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;i<a;i++){let a=n[i];r[a].get&&Object.defineProperty(e,a,{enumerable:r[a].enumerable,get:r[a].get.bind(t)})}}return t}function kJ(e){let t;return typeof e==`object`&&!!e&&(e[Pz]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function AJ(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[UJ])return n;if(!kJ(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=AJ(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=AJ(i,t))!==i&&(e[a]=r))}return e}function jJ(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function MJ(e,t,n){if(e[t])return e[t];let[r,i]=J(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function NJ(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===Pz||t===WJ?n:(delete n.value,delete n.writable,n.get=()=>e[Pz][t],n)}function PJ(e){DR()&&MJ(jJ(e,WJ),KJ)()}function FJ(e){return PJ(e),Reflect.ownKeys(e)}function IJ(e,t,n,r=!1){if(!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[GJ]&&e[GJ][t]&&i!==void 0&&e[GJ][t].$()):(e[t]=n,e[GJ]&&e[GJ][t]&&i===void 0&&e[GJ][t].$());let o=jJ(e,WJ),s;if((s=MJ(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=MJ(o,`length`,a))&&s.$(e.length)}(s=o[KJ])&&s.$()}function LJ(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];IJ(e,i,t[i])}}function RJ(e,t){if(typeof t==`function`&&(t=t(e)),t=AJ(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&IJ(e,n,r)}IJ(e,`length`,r)}else LJ(e,t)}function zJ(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)zJ(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&zJ(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)zJ(e,[r].concat(t),n);return}else if(t.length>1){zJ(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=AJ(a),r===void 0||kJ(i)&&kJ(a)&&!Array.isArray(a)?LJ(i,a):IJ(e,r,a))}function BJ(...[e,t]){let n=AJ(e||{}),r=Array.isArray(n),i=OJ(n);function a(...e){SR(()=>{r&&e.length===1?RJ(n,e[0]):zJ(n,e)})}return[i,a]}function VJ(e){return t=>{if(kJ(t)){let n;(n=JJ.get(t))||JJ.set(t,n=new Proxy(t,YJ)),e(n)}return t}}var HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ=t((()=>{KV(),pR(),iW(),HJ=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
257
+ `;let e=[];for(let t of document.getAnimations())dL(t)||e.push(t);uL(e),eL=!1}else{for(let e of $I)try{e.finish()}catch{try{e.play()}catch{}}$I=[]}ZI.remove(),ZI=null,cL(QI),QI=[],GI()}},vL=[`mouseenter`,`mouseleave`,`mouseover`,`mouseout`,`pointerenter`,`pointerleave`,`pointerover`,`pointerout`],yL=[`focus`,`blur`,`focusin`,`focusout`],bL=[`background-color`,`color`,`border-color`,`box-shadow`,`transform`,`opacity`,`outline`,`filter`,`scale`,`visibility`],xL=[`background-color`,`color`,`border-color`,`box-shadow`,`outline`,`outline-offset`,`outline-width`,`outline-color`,`outline-style`,`filter`,`opacity`,`ring-color`,`ring-width`],SL=new Map,CL=new Map,wL=e=>{e.stopImmediatePropagation()},TL=e=>{e.preventDefault(),e.stopImmediatePropagation()},EL=(e,t)=>{let n=new Map;for(let r of t){let t=e.style.getPropertyValue(r);t&&n.set(r,t)}return n},DL=(e,t,n)=>{if(n?.has(e))return null;let r=getComputedStyle(e),i=e.style.cssText,a=EL(e,t);for(let e of t){let t=r.getPropertyValue(e);t&&(i+=`${e}: ${t} !important; `)}return{element:e,frozenStyles:i,originalPropertyValues:a}},OL=(e,t)=>{let n=[],r=document.elementFromPoint(e,t);for(;r&&r!==document.documentElement;)r instanceof HTMLElement&&n.push(r),r=r.parentElement;return n},kL=()=>{let e=[],t=document.activeElement;for(;t&&t!==document.body;)t instanceof HTMLElement&&e.push(t),t=t.shadowRoot?.activeElement??null;return e},AL=(e,t)=>{for(let{element:n,frozenStyles:r,originalPropertyValues:i}of e)t.set(n,i),n.style.cssText=r},jL=(e,t)=>{for(let[n,r]of e)for(let e of t){let t=r.get(e);t?n.style.setProperty(e,t):n.style.removeProperty(e)}e.clear()},ML=(e,t)=>{if(bI())return null;let n=[],r=e!==void 0&&t!==void 0&&e>=0&&t>=0&&e<window.innerWidth&&t<window.innerHeight?OL(e,t):Array.from(document.querySelectorAll(`:hover`)).filter(e=>e instanceof HTMLElement);for(let e of r){let t=DL(e,bL);t&&n.push(t)}let i=[];for(let e of kL()){let t=DL(e,xL,CL);t&&i.push(t)}return{hoverStates:n,focusStates:i}},NL=e=>{if(e){for(let e of vL)document.addEventListener(e,wL,!0);for(let e of yL)document.addEventListener(e,TL,!0);AL(e.hoverStates,SL),AL(e.focusStates,CL),xI()}},PL=()=>{PI();for(let e of vL)document.removeEventListener(e,wL,!0);for(let e of yL)document.removeEventListener(e,TL,!0);jL(SL,bL),jL(CL,xL),SI()},FL=(e,t)=>{let n=ML(e,t),r=hL();NL(n),gL(r)},IL=()=>{PL(),_L()},LL=!1,RL=(e,t,n)=>{let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i},zL=new WeakMap,BL=new WeakMap,VL=new WeakMap,HL=new Set,UL=[],WL=[],GL=new WeakMap,KL=new WeakMap,qL=new WeakSet,JL=pP,YL=e=>{let t=e;for(;t.return;)t=t.return;return t.stateNode??null},XL=()=>{if(JL.size>0)return JL;let e=new Set,t=n=>{let r=fP(n);if(r){let t=YL(r);t&&e.add(t);return}for(let r of Array.from(n.children))if(t(r),e.size>0)return};return t(document.body),e},ZL=(e,t)=>{if(!e)return t;if(!t)return e;if(!e.next||!t.next)return t;let n=e.next,r=t.next,i=e===n,a=t===r;return i&&a?(e.next=t,t.next=e):i?(e.next=r,t.next=e):a?(t.next=n,e.next=t):(e.next=r,t.next=n),t},QL=e=>{if(!e||GL.has(e))return;let t={originalPendingDescriptor:Object.getOwnPropertyDescriptor(e,`pending`),pendingValueAtPause:e.pending,bufferedPending:null};typeof e.getSnapshot==`function`&&(t.originalGetSnapshot=e.getSnapshot,t.snapshotValueAtPause=e.getSnapshot(),e.getSnapshot=()=>LL?t.snapshotValueAtPause:t.originalGetSnapshot());let n=t.pendingValueAtPause;Object.defineProperty(e,"pending",{configurable:!0,enumerable:!0,get:()=>LL?null:n,set:e=>{if(LL){e!==null&&(t.bufferedPending=ZL(t.bufferedPending??null,e));return}n=e}}),GL.set(e,t)},$L=e=>{if(!e)return[];let t=[],n=e.next;if(!n)return[];let r=n;do r&&=(t.push(r.action),r.next);while(r&&r!==n);return t},eR=e=>{let t=GL.get(e);if(!t)return;t.originalGetSnapshot&&(e.getSnapshot=t.originalGetSnapshot),t.originalPendingDescriptor?Object.defineProperty(e,"pending",t.originalPendingDescriptor):delete e.pending,e.pending=null;let n=e.dispatch;if(typeof n==`function`){let e=$L(t.pendingValueAtPause??null),r=$L(t.bufferedPending??null);for(let t of[...e,...r])WL.push(()=>n(t))}GL.delete(e)},tR=e=>{if(KL.has(e))return;let t={originalDescriptor:Object.getOwnPropertyDescriptor(e,`memoizedValue`),frozenValue:e.memoizedValue};Object.defineProperty(e,"memoizedValue",{configurable:!0,enumerable:!0,get(){return LL?t.frozenValue:t.originalDescriptor?.get?t.originalDescriptor.get.call(this):this._memoizedValue},set(e){if(LL){t.pendingValue=e,t.didReceivePendingValue=!0;return}t.originalDescriptor?.set?t.originalDescriptor.set.call(this,e):this._memoizedValue=e}}),t.originalDescriptor?.get||(e._memoizedValue=t.frozenValue),KL.set(e,t)},nR=e=>{let t=KL.get(e);t&&(t.originalDescriptor?Object.defineProperty(e,"memoizedValue",t.originalDescriptor):delete e.memoizedValue,t.didReceivePendingValue&&(e.memoizedValue=t.pendingValue),KL.delete(e))},rR=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&QL(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)tR(n),n=n.next},iR=e=>{let t=e.memoizedState;for(;t;)t.queue&&typeof t.queue==`object`&&eR(t.queue),t=t.next;let n=e.dependencies?.firstContext;for(;n&&typeof n==`object`&&`memoizedValue`in n;)nR(n),n=n.next},aR=e=>{let t=e;for(;t;){if(oP(t)&&rR(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},oR=e=>{let t=e;for(;t;){if(oP(t)&&iR(t),t.child){t=t.child;continue}for(;t!==e&&!t.sibling;)if(t=t.return,!t)return;if(t===e)return;t=t.sibling}},sR=e=>{if(zL.has(e))return;let t=e,n={useState:t.useState,useReducer:t.useReducer,useTransition:t.useTransition,useSyncExternalStore:t.useSyncExternalStore};zL.set(e,n),t.useState=(...t)=>{let r=n.useState.apply(e,t);if(!LL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RL(BL,a,()=>(...e)=>{LL?WL.push(()=>a(...e)):a(...e)})]},t.useReducer=(...t)=>{let r=n.useReducer.apply(e,t);if(!LL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RL(BL,a,()=>(...e)=>{LL?WL.push(()=>a(...e)):a(...e)})]},t.useTransition=(...t)=>{let r=n.useTransition.apply(e,t);if(!LL||!Array.isArray(r)||typeof r[1]!=`function`)return r;let[i,a]=r;return[i,RL(VL,a,()=>e=>{LL?UL.push(()=>a(e)):a(e)})]},t.useSyncExternalStore=((e,t,r)=>LL?n.useSyncExternalStore(t=>e(()=>{LL?HL.add(t):t()}),t,r):n.useSyncExternalStore(e,t,r))},cR=e=>{let t=e.currentDispatcherRef;if(!t||typeof t!=`object`)return;let n=`H`in t?`H`:`current`,r=t[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get:()=>(r&&typeof r==`object`&&sR(r),r),set:e=>{r=e}})},lR=e=>{queueMicrotask(()=>{try{for(let t of rP().renderers.values())if(typeof t.scheduleUpdate==`function`){for(let n of e)if(n.current)try{t.scheduleUpdate(n.current)}catch{}}}catch{}})},uR=e=>{for(let t of e)try{t()}catch{}},dR=()=>{for(let e of rP().renderers.values())qL.has(e)||(cR(e),qL.add(e))},fR=()=>{if(LL)return()=>{};dR(),LL=!0;let e=XL();for(let t of e)aR(t.current);return()=>{if(LL)try{let e=XL();for(let t of e)oR(t.current);let t=Array.from(HL),n=UL.slice(),r=WL.slice();LL=!1,uR(t),uR(n),uR(r),lR(e)}finally{HL.clear(),UL.length=0,WL.length=0}}}}));function mR(e){let t=String(e),n=t.length-1;return Mz.context.id+(n?String.fromCharCode(96+n):``)+t}function hR(e){Mz.context=e}function gR(e,t){let n=Uz,r=Vz,i=e.length===0,a=t===void 0?r:t,o=i?zz:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(()=>CR(()=>WR(o)));Vz=o,Uz=null;try{return RR(s,!0)}finally{Uz=n,Vz=r}}function J(e,t){t=t?Object.assign({},Lz,t):Lz;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[MR.bind(n),e=>(typeof e==`function`&&(e=Hz&&Hz.running&&Hz.sources.has(n)?e(n.tValue):e(n.value)),NR(n,e))]}function _R(e,t,n){PR(IR(e,t,!0,1))}function vR(e,t,n){PR(IR(e,t,!1,1))}function yR(e,t,n){Rz=VR;let r=IR(e,t,!1,1),i=Yz&&AR(Yz);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),Gz?Gz.push(r):PR(r)}function Y(e,t,n){n=n?Object.assign({},Lz,n):Lz;let r=IR(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,PR(r),MR.bind(r)}function bR(e){return e&&typeof e==`object`&&`then`in e}function xR(e,t,n){let r,i,a;typeof t==`function`?(r=e,i=t,a=n||{}):(r=!0,i=e,a=t||{});let o=null,s=Bz,c=null,l=!1,u=!1,d=`initialValue`in a,f=typeof r==`function`&&Y(r),p=new Set,[m,h]=(a.storage||J)(a.initialValue),[g,_]=J(void 0),[v,y]=J(void 0,{equals:!1}),[b,x]=J(d?`ready`:`unresolved`);Mz.context&&(c=Mz.getNextContextId(),a.ssrLoadFrom===`initial`?s=a.initialValue:Mz.load&&Mz.has(c)&&(s=Mz.load(c)));function S(e,t,n,r){return o===e&&(o=null,r!==void 0&&(d=!0),(e===s||t===s)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(r,{value:t})),s=Bz,Hz&&e&&l?(Hz.promises.delete(e),l=!1,RR(()=>{Hz.running=!0,C(t,n)},!1)):C(t,n)),t}function C(e,t){RR(()=>{t===void 0&&h(()=>e),x(t===void 0?d?`ready`:`unresolved`:`errored`),_(t);for(let e of p.keys())e.decrement();p.clear()},!1)}function w(){let e=Yz&&AR(Yz),t=m(),n=g();if(n!==void 0&&!o)throw n;return Uz&&!Uz.user&&e&&_R(()=>{v(),o&&(e.resolved&&Hz&&l?Hz.promises.add(o):p.has(e)||(e.increment(),p.add(e)))}),t}function T(e=!0){if(e!==!1&&u)return;u=!1;let t=f?f():r;if(l=Hz&&Hz.running,t==null||t===!1){S(o,CR(m));return}Hz&&o&&Hz.promises.delete(o);let n,a=s===Bz?CR(()=>{try{return i(t,{value:m(),refetching:e})}catch(e){n=e}}):s;if(n!==void 0){S(o,void 0,KR(n),t);return}else if(!bR(a))return S(o,a,void 0,t),a;return o=a,`v`in a?(a.s===1?S(o,a.v,void 0,t):S(o,void 0,KR(a.v),t),a):(u=!0,queueMicrotask(()=>u=!1),RR(()=>{x(d?`refreshing`:`pending`),y()},!1),a.then(e=>S(a,e,void 0,t),e=>S(a,void 0,KR(e),t)))}Object.defineProperties(w,{state:{get:()=>b()},error:{get:()=>g()},loading:{get(){let e=b();return e===`pending`||e===`refreshing`}},latest:{get(){if(!d)return w();let e=g();if(e&&!o)throw e;return m()}}});let E=Vz;return f?_R(()=>(E=Vz,T(!1))):T(!1),[w,{refetch:e=>OR(E,()=>T(e)),mutate:h}]}function SR(e){return RR(e,!1)}function CR(e){if(Uz===null)return e();let t=Uz;Uz=null;try{return e()}finally{Uz=t}}function wR(e,t,n){let r=Array.isArray(e),i,a=n&&n.defer;return n=>{let o;if(r){o=Array(e.length);for(let t=0;t<e.length;t++)o[t]=e[t]()}else o=e();if(a)return a=!1,n;let s=CR(()=>t(o,i,n));return i=o,s}}function TR(e){yR(()=>CR(e))}function ER(e){return Vz===null||(Vz.cleanups===null?Vz.cleanups=[e]:Vz.cleanups.push(e)),e}function DR(){return Uz}function OR(e,t){let n=Vz,r=Uz;Vz=e,Uz=null;try{return RR(t,!0)}catch(e){qR(e)}finally{Vz=n,Uz=r}}function kR(e,t){let n=Symbol(`context`);return{id:n,Provider:YR(n),defaultValue:e}}function AR(e){let t;return Vz&&Vz.context&&(t=Vz.context[e.id])!==void 0?t:e.defaultValue}function jR(e){let t=Y(e),n=Y(()=>JR(t()));return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}function MR(){let e=Hz&&Hz.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===1)PR(this);else{let e=Wz;Wz=null,RR(()=>HR(this),!1),Wz=e}if(Uz){let e=this.observers?this.observers.length:0;Uz.sources?(Uz.sources.push(this),Uz.sourceSlots.push(e)):(Uz.sources=[this],Uz.sourceSlots=[e]),this.observers?(this.observers.push(Uz),this.observerSlots.push(Uz.sources.length-1)):(this.observers=[Uz],this.observerSlots=[Uz.sources.length-1])}return e&&Hz.sources.has(this)?this.tValue:this.value}function NR(e,t,n){let r=Hz&&Hz.running&&Hz.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(Hz){let r=Hz.running;(r||!n&&Hz.sources.has(e))&&(Hz.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&RR(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=Hz&&Hz.running;r&&Hz.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?Wz.push(n):Gz.push(n),n.observers&&UR(n)),r?n.tState=1:n.state=1)}if(Wz.length>1e6)throw Wz=[],Error()},!1)}return t}function PR(e){if(!e.fn)return;WR(e);let t=Kz;FR(e,Hz&&Hz.running&&Hz.sources.has(e)?e.tValue:e.value,t),Hz&&!Hz.running&&Hz.sources.has(e)&&queueMicrotask(()=>{RR(()=>{Hz&&(Hz.running=!0),Uz=Vz=e,FR(e,e.tValue,t),Uz=Vz=null},!1)})}function FR(e,t,n){let r,i=Vz,a=Uz;Uz=Vz=e;try{r=e.fn(t)}catch(t){return e.pure&&(Hz&&Hz.running?(e.tState=1,e.tOwned&&e.tOwned.forEach(WR),e.tOwned=void 0):(e.state=1,e.owned&&e.owned.forEach(WR),e.owned=null)),e.updatedAt=n+1,qR(t)}finally{Uz=a,Vz=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?NR(e,r,!0):Hz&&Hz.running&&e.pure?(Hz.sources.has(e)||(e.value=r),Hz.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function IR(e,t,n,r=1,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:Vz,context:Vz?Vz.context:null,pure:n};return Hz&&Hz.running&&(a.state=0,a.tState=r),Vz===null||Vz!==zz&&(Hz&&Hz.running&&Vz.pure?Vz.tOwned?Vz.tOwned.push(a):Vz.tOwned=[a]:Vz.owned?Vz.owned.push(a):Vz.owned=[a]),a}function LR(e){let t=Hz&&Hz.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===2)return HR(e);if(e.suspense&&CR(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Kz);){if(t&&Hz.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(Hz.disposed.has(t))return}if((t?e.tState:e.state)===1)PR(e);else if((t?e.tState:e.state)===2){let t=Wz;Wz=null,RR(()=>HR(e,n[0]),!1),Wz=t}}}function RR(e,t){if(Wz)return e();let n=!1;t||(Wz=[]),Gz?n=!0:Gz=[],Kz++;try{let t=e();return zR(n),t}catch(e){n||(Gz=null),Wz=null,qR(e)}}function zR(e){if(Wz&&=(BR(Wz),null),e)return;let t;if(Hz){if(!Hz.promises.size&&!Hz.queue.size){let e=Hz.sources,n=Hz.disposed;Gz.push.apply(Gz,Hz.effects),t=Hz.resolve;for(let e of Gz)`tState`in e&&(e.state=e.tState),delete e.tState;Hz=null,RR(()=>{for(let e of n)WR(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)WR(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}Jz(!1)},!1)}else if(Hz.running){Hz.running=!1,Hz.effects.push.apply(Hz.effects,Gz),Gz=null,Jz(!0);return}}let n=Gz;Gz=null,n.length&&RR(()=>Rz(n),!1),t&&t()}function BR(e){for(let t=0;t<e.length;t++)LR(e[t])}function VR(e){let t,n=0;for(t=0;t<e.length;t++){let r=e[t];r.user?e[n++]=r:LR(r)}if(Mz.context){if(Mz.count){Mz.effects||=[],Mz.effects.push(...e.slice(0,n));return}hR()}for(Mz.effects&&(Mz.done||!Mz.count)&&(e=[...Mz.effects,...e],n+=Mz.effects.length,delete Mz.effects),t=0;t<n;t++)LR(e[t])}function HR(e,t){let n=Hz&&Hz.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===1?i!==t&&(!i.updatedAt||i.updatedAt<Kz)&&LR(i):e===2&&HR(i,t)}}}function UR(e){let t=Hz&&Hz.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=2:r.state=2,r.pure?Wz.push(r):Gz.push(r),r.observers&&UR(r))}}function WR(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)WR(e.tOwned[t]);delete e.tOwned}if(Hz&&Hz.running&&e.pure)GR(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)WR(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}Hz&&Hz.running?e.tState=0:e.state=0}function GR(e,t){if(t||(e.tState=0,Hz.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)GR(e.owned[t])}function KR(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function qR(e,t=Vz){throw KR(e)}function JR(e){if(typeof e==`function`&&!e.length)return JR(e());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=JR(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function YR(e,t){return function(t){let n;return vR(()=>n=CR(()=>(Vz.context={...Vz.context,[e]:t.value},jR(()=>t.children))),void 0),n}}function XR(e){for(let t=0;t<e.length;t++)e[t]()}function ZR(e,t,n={}){let r=[],i=[],a=[],o=0,s=t.length>1?[]:null;return ER(()=>XR(a)),()=>{let c=e()||[],l=c.length,u,d;return c[Iz],CR(()=>{let e,t,p,m,h,g,_,v,y;if(l===0)o!==0&&(XR(a),a=[],r=[],i=[],o=0,s&&=[]),n.fallback&&(r=[Xz],i[0]=gR(e=>(a[0]=e,n.fallback())),o=1);else if(o===0){for(i=Array(l),d=0;d<l;d++)r[d]=c[d],i[d]=gR(f);o=l}else{for(p=Array(l),m=Array(l),s&&(h=Array(l)),g=0,_=Math.min(o,l);g<_&&r[g]===c[g];g++);for(_=o-1,v=l-1;_>=g&&v>=g&&r[_]===c[v];_--,v--)p[v]=i[_],m[v]=a[_],s&&(h[v]=s[_]);for(e=new Map,t=Array(v+1),d=v;d>=g;d--)y=c[d],u=e.get(y),t[d]=u===void 0?-1:u,e.set(y,d);for(u=g;u<=_;u++)y=r[u],d=e.get(y),d!==void 0&&d!==-1?(p[d]=i[u],m[d]=a[u],s&&(h[d]=s[u]),d=t[d],e.set(y,d)):a[u]();for(d=g;d<l;d++)d in p?(i[d]=p[d],a[d]=m[d],s&&(s[d]=h[d],s[d](d))):i[d]=gR(f);i=i.slice(0,o=l),r=c.slice(0)}return i});function f(e){if(a[d]=e,s){let[e,n]=J(d);return s[d]=n,t(c[d],e)}return t(c[d])}}}function QR(e,t,n={}){let r=[],i=[],a=[],o=[],s=0,c;return ER(()=>XR(a)),()=>{let l=e()||[],u=l.length;return l[Iz],CR(()=>{if(u===0)return s!==0&&(XR(a),a=[],r=[],i=[],s=0,o=[]),n.fallback&&(r=[Xz],i[0]=gR(e=>(a[0]=e,n.fallback())),s=1),i;for(r[0]===Xz&&(a[0](),a=[],r=[],i=[],s=0),c=0;c<u;c++)c<r.length&&r[c]!==l[c]?o[c](()=>l[c]):c>=r.length&&(i[c]=gR(d));for(;c<r.length;c++)a[c]();return s=o.length=a.length=u,r=l.slice(0),i=i.slice(0,s)});function d(e){a[c]=e;let[n,r]=J(l[c]);return o[c]=r,t(n,c)}}}function X(e,t){return CR(()=>e(t||{}))}function $R(){return!0}function ez(e){return(e=typeof e==`function`?e():e)?e:{}}function tz(){for(let e=0,t=this.length;e<t;++e){let t=this[e]();if(t!==void 0)return t}}function nz(...e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];t||=!!r&&Pz in r,e[n]=typeof r==`function`?(t=!0,Y(r)):r}if(Fz&&t)return new Proxy({get(t){for(let n=e.length-1;n>=0;n--){let r=ez(e[n])[t];if(r!==void 0)return r}},has(t){for(let n=e.length-1;n>=0;n--)if(t in ez(e[n]))return!0;return!1},keys(){let t=[];for(let n=0;n<e.length;n++)t.push(...Object.keys(ez(e[n])));return[...new Set(t)]}},Zz);let n={},r=Object.create(null);for(let t=e.length-1;t>=0;t--){let i=e[t];if(!i)continue;let a=Object.getOwnPropertyNames(i);for(let e=a.length-1;e>=0;e--){let t=a[e];if(t===`__proto__`||t===`constructor`)continue;let o=Object.getOwnPropertyDescriptor(i,t);if(!r[t])r[t]=o.get?{enumerable:!0,configurable:!0,get:tz.bind(n[t]=[o.get.bind(i)])}:o.value===void 0?void 0:o;else{let e=n[t];e&&(o.get?e.push(o.get.bind(i)):o.value!==void 0&&e.push(()=>o.value))}}}let i={},a=Object.keys(r);for(let e=a.length-1;e>=0;e--){let t=a[e],n=r[t];n&&n.get?Object.defineProperty(i,t,n):i[t]=n?n.value:void 0}return i}function rz(e,...t){let n=t.length;if(Fz&&Pz in e){let r=n>1?t.flat():t[0],i=t.map(t=>new Proxy({get(n){return t.includes(n)?e[n]:void 0},has(n){return t.includes(n)&&n in e},keys(){return t.filter(t=>t in e)}},Zz));return i.push(new Proxy({get(t){return r.includes(t)?void 0:e[t]},has(t){return!r.includes(t)&&t in e},keys(){return Object.keys(e).filter(e=>!r.includes(e))}},Zz)),i}let r=[];for(let e=0;e<=n;e++)r[e]={};for(let i of Object.getOwnPropertyNames(e)){let a=n;for(let e=0;e<t.length;e++)if(t[e].includes(i)){a=e;break}let o=Object.getOwnPropertyDescriptor(e,i);!o.get&&!o.set&&o.enumerable&&o.writable&&o.configurable?r[a][i]=o.value:Object.defineProperty(r[a],i,o)}return r}function iz(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(ZR(()=>e.each,e.children,t||void 0))}function az(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return Y(QR(()=>e.each,e.children,t||void 0))}function oz(e){let t=e.keyed,n=Y(()=>e.when,void 0,void 0),r=t?n:Y(n,void 0,{equals:(e,t)=>!e==!t});return Y(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?CR(()=>a(t?i:()=>{if(!CR(r))throw Qz(`Show`);return n()})):a}return e.fallback},void 0,void 0)}function sz(e){let t=jR(()=>e.children),n=Y(()=>{let e=t(),n=Array.isArray(e)?e:[e],r=()=>void 0;for(let e=0;e<n.length;e++){let t=e,i=n[e],a=r,o=Y(()=>a()?void 0:i.when,void 0,void 0),s=i.keyed?o:Y(o,void 0,{equals:(e,t)=>!e==!t});r=()=>a()||(s()?[t,o,i]:void 0)}return r});return Y(()=>{let t=n()();if(!t)return e.fallback;let[r,i,a]=t,o=a.children;return typeof o==`function`&&o.length>0?CR(()=>o(a.keyed?i():()=>{if(CR(n)()?.[0]!==r)throw Qz(`Match`);return i()})):o},void 0,void 0)}function cz(e){return e}function lz(e,t){let n=nB[e];return typeof n==`object`?n[t]?n.$:void 0:n}function uz(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null)if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&!((d=l.get(t[c]))==null||d!==r+u);)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++;else t[o++].remove()}}}function dz(e,t,n,r={}){let i;return gR(r=>{i=r,t===document?e():$(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function Z(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>CR(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function fz(e,t=window.document){let n=t[oB]||(t[oB]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,Dz))}}function Q(e,t,n){Cz(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function pz(e,t,n,r){Cz(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function mz(e,t,n){Cz(e)||(n?e.setAttribute(t,``):e.removeAttribute(t))}function hz(e,t){Cz(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function gz(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function _z(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(Tz(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(Tz(e,i,!0),n[i]=o)}return n}function vz(e,t,n){if(!t)return n?Q(e,`style`):t;let r=e.style;if(typeof t==`string`)return r.cssText=t;typeof n==`string`&&(r.cssText=n=void 0),n||={},t||={};let i,a;for(a in n)t[a]??r.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(r.setProperty(a,i),n[a]=i);return n}function yz(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function bz(e,t={},n,r){let i={};return r||vR(()=>i.children=Oz(e,t.children,i.children)),vR(()=>typeof t.ref==`function`&&xz(t.ref,e)),vR(()=>Sz(e,t,n,!0,i,!0)),i}function xz(e,t,n){return CR(()=>e(t,n))}function $(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Oz(e,t,r,n);vR(r=>Oz(e,t(),r,n),r)}function Sz(e,t,n,r,i={},a=!1){t||={};for(let r in i)if(!(r in t)){if(r===`children`)continue;i[r]=Ez(e,r,null,i[r],n,a,t)}for(let o in t){if(o===`children`){r||Oz(e,t.children);continue}let s=t[o];i[o]=Ez(e,o,s,i[o],n,a,t)}}function Cz(e){return!!Mz.context&&!Mz.done&&(!e||e.isConnected)}function wz(e){return e.toLowerCase().replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Tz(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function Ez(e,t,n,r,i,a,o){let s,c,l,u,d;if(t===`style`)return vz(e,n,r);if(t===`classList`)return _z(e,n,r);if(n===r)return r;if(t===`ref`)a||n(e);else if(t.slice(0,3)===`on:`){let i=t.slice(3);r&&e.removeEventListener(i,r,typeof r!=`function`&&r),n&&e.addEventListener(i,n,typeof n!=`function`&&n)}else if(t.slice(0,10)===`oncapture:`){let i=t.slice(10);r&&e.removeEventListener(i,r,!0),n&&e.addEventListener(i,n,!0)}else if(t.slice(0,2)===`on`){let i=t.slice(2).toLowerCase(),a=rB.has(i);if(!a&&r){let t=Array.isArray(r)?r[0]:r;e.removeEventListener(i,t)}(a||n)&&(gz(e,i,n,a),a&&fz([i]))}else if(t.slice(0,5)===`attr:`)Q(e,t.slice(5),n);else if(t.slice(0,5)===`bool:`)mz(e,t.slice(5),n);else if((d=t.slice(0,5)===`prop:`)||(l=eB.has(t))||!i&&((u=lz(t,e.tagName))||(c=$z.has(t)))||(s=e.nodeName.includes(`-`)||`is`in o)){if(d)t=t.slice(5),c=!0;else if(Cz(e))return n;t===`class`||t===`className`?hz(e,n):s&&!c&&!l?e[wz(t)]=n:e[u||t]=n}else{let r=i&&t.indexOf(`:`)>-1&&iB[t.split(`:`)[0]];r?pz(e,r,t,n):Q(e,tB[t]||t,n)}return n}function Dz(e){if(Mz.registry&&Mz.events&&Mz.events.find(([t,n])=>n===e))return;let t=e.target,n=`$$${e.type}`,r=e.target,i=e.currentTarget,a=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),o=()=>{let r=t[n];if(r&&!t.disabled){let i=t[`${n}Data`];if(i===void 0?r.call(t,e):r.call(t,i,e),e.cancelBubble)return}return t.host&&typeof t.host!=`string`&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},s=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),Mz.registry&&!Mz.done&&(Mz.done=_$HY.done=!0),e.composedPath){let n=e.composedPath();a(n[0]);for(let e=0;e<n.length-2&&(t=n[e],o());e++){if(t._$host){t=t._$host,s();break}if(t.parentNode===i)break}}else s();a(r)}function Oz(e,t,n,r,i){let a=Cz(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=jz(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=jz(e,n,r)}else if(o===`function`)return vR(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Oz(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(kz(o,t,n,i))return vR(()=>n=Oz(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=jz(e,n,r),s)return n}else c?n.length===0?Az(e,o,r):uz(e,n,o):(n&&jz(e),Az(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=jz(e,n,r,t);jz(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function kz(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=kz(e,o,s)||i;else if(c===`function`)if(r){for(;typeof o==`function`;)o=o();i=kz(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0;else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}return i}function Az(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function jz(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var Mz,Nz,Pz,Fz,Iz,Lz,Rz,zz,Bz,Vz,Hz,Uz,Wz,Gz,Kz,qz,Jz,Yz,Xz,Zz,Qz,$z,eB,tB,nB,rB,iB,aB,oB,sB,cB,lB,uB,dB,fB,pB,mB,hB,gB,_B,vB,yB,bB,xB,SB,CB,wB,TB,EB,DB,OB,kB,AB,jB,MB,NB,PB,FB,IB,LB,RB,zB,BB,VB,HB,UB,WB,GB,KB,qB,JB,YB,XB,ZB,QB,$B,eV,tV,nV,rV,iV,aV,oV,sV,cV,lV,uV,dV,fV,pV,mV,hV,gV,_V,vV,yV,bV,xV,SV,CV,wV,TV,EV,DV,OV,kV,AV,jV,MV,NV,PV,FV,IV,LV,RV,zV,BV,VV,HV,UV,WV,GV,KV=t((()=>{pR(),Mz={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return mR(this.context.count)},getNextContextId(){return mR(this.context.count++)}},Nz=(e,t)=>e===t,Pz=Symbol(`solid-proxy`),Fz=typeof Proxy==`function`,Iz=Symbol(`solid-track`),Lz={equals:Nz},Rz=BR,zz={owned:null,cleanups:null,context:null,owner:null},Bz={},Vz=null,Hz=null,Uz=null,Wz=null,Gz=null,Kz=0,[qz,Jz]=J(!1),Xz=Symbol(`fallback`),Zz={get(e,t,n){return t===Pz?n:e.get(t)},has(e,t){return t===Pz||e.has(t)},set:$R,deleteProperty:$R,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:$R,deleteProperty:$R}},ownKeys(e){return e.keys()}},Qz=e=>`Stale read from <${e}>.`,$z=new Set([`className`,`value`,`readOnly`,`noValidate`,`formNoValidate`,`isMap`,`noModule`,`playsInline`,`adAuctionHeaders`,`allowFullscreen`,`browsingTopics`,`defaultChecked`,`defaultMuted`,`defaultSelected`,`disablePictureInPicture`,`disableRemotePlayback`,`preservesPitch`,`shadowRootClonable`,`shadowRootCustomElementRegistry`,`shadowRootDelegatesFocus`,`shadowRootSerializable`,`sharedStorageWritable`,...`allowfullscreen.async.alpha.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.hidden.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.adauctionheaders.browsingtopics.credentialless.defaultchecked.defaultmuted.defaultselected.defer.disablepictureinpicture.disableremoteplayback.preservespitch.shadowrootclonable.shadowrootcustomelementregistry.shadowrootdelegatesfocus.shadowrootserializable.sharedstoragewritable`.split(`.`)]),eB=new Set([`innerHTML`,`textContent`,`innerText`,`children`]),tB=Object.assign(Object.create(null),{className:`class`,htmlFor:`for`}),nB=Object.assign(Object.create(null),{class:`className`,novalidate:{$:`noValidate`,FORM:1},formnovalidate:{$:`formNoValidate`,BUTTON:1,INPUT:1},ismap:{$:`isMap`,IMG:1},nomodule:{$:`noModule`,SCRIPT:1},playsinline:{$:`playsInline`,VIDEO:1},readonly:{$:`readOnly`,INPUT:1,TEXTAREA:1},adauctionheaders:{$:`adAuctionHeaders`,IFRAME:1},allowfullscreen:{$:`allowFullscreen`,IFRAME:1},browsingtopics:{$:`browsingTopics`,IMG:1},defaultchecked:{$:`defaultChecked`,INPUT:1},defaultmuted:{$:`defaultMuted`,AUDIO:1,VIDEO:1},defaultselected:{$:`defaultSelected`,OPTION:1},disablepictureinpicture:{$:`disablePictureInPicture`,VIDEO:1},disableremoteplayback:{$:`disableRemotePlayback`,AUDIO:1,VIDEO:1},preservespitch:{$:`preservesPitch`,AUDIO:1,VIDEO:1},shadowrootclonable:{$:`shadowRootClonable`,TEMPLATE:1},shadowrootdelegatesfocus:{$:`shadowRootDelegatesFocus`,TEMPLATE:1},shadowrootserializable:{$:`shadowRootSerializable`,TEMPLATE:1},sharedstoragewritable:{$:`sharedStorageWritable`,IFRAME:1,IMG:1}}),rB=new Set([`beforeinput`,`click`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`]),iB={xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`},aB=e=>Y(()=>e()),oB=`_$DX_DELEGATE`,sB=e=>!!(e?.isConnected??e?.ownerDocument?.contains(e)),cB=[`input`,`textarea`,`select`,`searchbox`,`slider`,`spinbutton`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`textbox`,`combobox`],lB=e=>{if(e.composed){let t=e.composedPath()[0];if(t instanceof HTMLElement)return t}else if(e.target instanceof HTMLElement)return e.target},uB=e=>{if(document.designMode===`on`)return!0;let t=lB(e);if(!t)return!1;if(t.isContentEditable)return!0;let n=RN(t);return cB.some(e=>e===n||e===t.role)},dB=e=>{let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement){let e=t.selectionStart??0;return(t.selectionEnd??0)-e>0}return!1},fB=()=>{let e=window.getSelection();return e?e.toString().length>0:!1},pB=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/,mB=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`),hB=(e,t,n,r=1)=>{let i=mB(e),a=mB(t),o=mB(n);return r>=1?`#${i}${a}${o}`:`#${i}${a}${o}${mB(r*255)}`},gB=e=>{if(!e.startsWith(`#`))return null;let t=e.slice(1);if(t.length!==6&&t.length!==8)return null;let n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=t.length===8?parseInt(t.slice(6,8),16)/255:1;return!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)?null:{red:n,green:r,blue:i,alpha:a}},_B=e=>{let t=e.match(pB);if(!t)return null;let n=1;if(t[4]!==void 0){let e=t[4];n=e.endsWith(`%`)?Number(e.slice(0,-1))/100:Number(e)}return hB(Number(t[1]),Number(t[2]),Number(t[3]),n)},vB=e=>{let t=e.match(pB);return!t||t[4]===void 0?!1:(t[4].endsWith(`%`)?Number(t[4].slice(0,-1))/100:Number(t[4]))===0},yB=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,bB=e=>{let t=e.match(yB);if(!t)return null;let n=t[1];return n.length===3?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`:n.length===4?`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`:`#${n}`},xB=`rgba(0, 0, 0, 0)`,SB=/^oklch\(\s*([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+%?)\s+([+-]?\d*\.?\d+)(deg|grad|rad|turn)?(?:\s*\/\s*([+-]?\d*\.?\d+%?))?\s*\)$/i,CB=180/Math.PI,wB=(e,t)=>e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:Number(e),TB=(e,t)=>{let n=Number(e);return t===`grad`?n*.9:t===`rad`?n*CB:t===`turn`?n*360:n},EB=e=>{let t=Math.max(0,Math.min(1,e));return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255},DB=e=>{let t=e.match(SB);if(!t)return null;let n=wB(t[1],1),r=wB(t[2],.4),i=TB(t[3],t[4])*Math.PI/180,a=t[5]===void 0?1:wB(t[5],1);if(![n,r,i,a].every(Number.isFinite))return null;let o=r*Math.cos(i),s=r*Math.sin(i),c=n+.3963377774*o+.2158037573*s,l=n-.1055613458*o-.0638541728*s,u=n-.0894841775*o-1.291485548*s,d=c**3,f=l**3,p=u**3,m=4.0767416621*d-3.3077115913*f+.2309699292*p,h=-1.2684380046*d+2.6097574011*f-.3413193965*p,g=-.0041960863*d-.7034186147*f+1.707614701*p;return hB(EB(m),EB(h),EB(g),Math.max(0,Math.min(1,a)))},OB=null,kB=()=>OB||(typeof document>`u`?null:(OB=document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0}),OB)),AB=(e,t)=>{e.clearRect(0,0,1,1),e.fillStyle=t,e.fillRect(0,0,1,1);let n=e.getImageData(0,0,1,1).data;return n[3]===0?EN:hB(n[0],n[1],n[2],n[3]/255)},jB=e=>{let t=e.trim();if(!t)return null;if(t.toLowerCase()===`transparent`)return EN;let n=bB(t);if(n)return n;let r=DB(t);if(r)return r;let i=kB();if(!i)return null;i.fillStyle=xB,i.fillStyle=t;let a=i.fillStyle;return typeof a==`string`?a.toLowerCase()===xB?t.toLowerCase().replace(/\s+/g,``)===`rgba(0,0,0,0)`?EN:null:a.startsWith(`#`)&&a.length===7?a:a.startsWith(`rgb`)?_B(a):AB(i,t):null},MB=(e,t,n)=>Math.max(t,Math.min(e,n)),NB=null,PB=()=>{if(typeof navigator>`u`||!(`userAgentData`in navigator))return null;let e=navigator.userAgentData;if(typeof e!=`object`||!e||!(`platform`in e))return null;let t=e.platform;return typeof t==`string`?t:null},FB=()=>{if(NB===null){if(typeof navigator>`u`)return NB=!1,NB;let e=navigator.platform??PB()??navigator.userAgent;NB=/Mac|iPhone|iPad|iPod/i.test(e)}return NB},IB=(e,t)=>{try{return e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute(t))}catch{return!1}},LB=`padding-top.padding-right.padding-bottom.padding-left.margin-top.margin-right.margin-bottom.margin-left.gap.row-gap.column-gap.font-size.line-height.letter-spacing.border-radius.border-top-left-radius.border-top-right-radius.border-bottom-right-radius.border-bottom-left-radius.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.opacity.width.height.min-width.min-height.max-width.max-height.top.right.bottom.left.z-index`.split(`.`),RB=-128,zB=-512,BB=-9999,VB=9999,HB=new Set([`letter-spacing`,`gap`,`row-gap`,`column-gap`]),UB=new Set([`z-index`]),WB=[{key:`padding`,label:`padding`,longhands:[`padding-top`,`padding-right`,`padding-bottom`,`padding-left`]},{key:`padding-top,padding-bottom`,label:`padding-y`,longhands:[`padding-top`,`padding-bottom`]},{key:`padding-left,padding-right`,label:`padding-x`,longhands:[`padding-left`,`padding-right`]},{key:`padding-top`,label:`padding top`,longhands:[`padding-top`]},{key:`padding-right`,label:`padding right`,longhands:[`padding-right`]},{key:`padding-bottom`,label:`padding bottom`,longhands:[`padding-bottom`]},{key:`padding-left`,label:`padding left`,longhands:[`padding-left`]}],GB=[{key:`margin`,label:`margin`,longhands:[`margin-top`,`margin-right`,`margin-bottom`,`margin-left`]},{key:`margin-top,margin-bottom`,label:`margin-y`,longhands:[`margin-top`,`margin-bottom`]},{key:`margin-left,margin-right`,label:`margin-x`,longhands:[`margin-left`,`margin-right`]},{key:`margin-top`,label:`margin top`,longhands:[`margin-top`]},{key:`margin-right`,label:`margin right`,longhands:[`margin-right`]},{key:`margin-bottom`,label:`margin bottom`,longhands:[`margin-bottom`]},{key:`margin-left`,label:`margin left`,longhands:[`margin-left`]}],KB=[{key:`gap`,label:`gap`,longhands:[`row-gap`,`column-gap`]},{key:`row-gap`,label:`row gap`,longhands:[`row-gap`]},{key:`column-gap`,label:`column gap`,longhands:[`column-gap`]}],qB=[{key:`border-radius`,label:`border radius`,longhands:[`border-top-left-radius`,`border-top-right-radius`,`border-bottom-right-radius`,`border-bottom-left-radius`]},{key:`border-top-left-radius,border-top-right-radius`,label:`top corners`,longhands:[`border-top-left-radius`,`border-top-right-radius`]},{key:`border-bottom-left-radius,border-bottom-right-radius`,label:`bottom corners`,longhands:[`border-bottom-left-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius,border-bottom-left-radius`,label:`left corners`,longhands:[`border-top-left-radius`,`border-bottom-left-radius`]},{key:`border-top-right-radius,border-bottom-right-radius`,label:`right corners`,longhands:[`border-top-right-radius`,`border-bottom-right-radius`]},{key:`border-top-left-radius`,label:`top left radius`,longhands:[`border-top-left-radius`]},{key:`border-top-right-radius`,label:`top right radius`,longhands:[`border-top-right-radius`]},{key:`border-bottom-right-radius`,label:`bottom right radius`,longhands:[`border-bottom-right-radius`]},{key:`border-bottom-left-radius`,label:`bottom left radius`,longhands:[`border-bottom-left-radius`]}],JB=[{key:`top,right,bottom,left`,label:`inset`,longhands:[`top`,`right`,`bottom`,`left`]},{key:`top,bottom`,label:`inset-y`,longhands:[`top`,`bottom`]},{key:`left,right`,label:`inset-x`,longhands:[`left`,`right`]},{key:`top`,label:`top`,longhands:[`top`]},{key:`right`,label:`right`,longhands:[`right`]},{key:`bottom`,label:`bottom`,longhands:[`bottom`]},{key:`left`,label:`left`,longhands:[`left`]}],YB=new Set(JB.map(e=>e.key)),XB=[WB,GB,KB,qB,[{key:`border-width`,label:`border width`,longhands:[`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`]},{key:`border-top-width`,label:`border top width`,longhands:[`border-top-width`]},{key:`border-right-width`,label:`border right width`,longhands:[`border-right-width`]},{key:`border-bottom-width`,label:`border bottom width`,longhands:[`border-bottom-width`]},{key:`border-left-width`,label:`border left width`,longhands:[`border-left-width`]}],[{key:`width,height`,label:`size`,longhands:[`width`,`height`]},{key:`width`,label:`width`,longhands:[`width`]},{key:`height`,label:`height`,longhands:[`height`]}],JB],ZB=[{key:`font-size`,label:`font size`},{key:`line-height`,label:`line height`},{key:`letter-spacing`,label:`letter spacing`},{key:`min-width`,label:`min width`},{key:`min-height`,label:`min height`},{key:`max-width`,label:`max width`},{key:`max-height`,label:`max height`},{key:`z-index`,label:`z-index`},{key:`opacity`,label:`opacity`}],QB=[{key:`color`,label:`text color`,alwaysShow:!0},{key:`background-color`,label:`background`,alwaysShow:!0},{key:`border-color`,label:`border color`},{key:`fill`,label:`fill`},{key:`stroke`,label:`stroke`}],$B=[{value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,label:`sans`},{value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`,label:`serif`},{value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,label:`mono`},{value:`system-ui, sans-serif`,label:`system`},{value:`serif`,label:`serif`},{value:`monospace`,label:`mono`}],eV=e=>{let t=e.trim();return $B.some(e=>e.value===t)?$B:[{value:t,label:`current`},...$B]},tV={key:`font-family`,label:`font family`},nV=[{key:`display`,label:`display`,options:[{value:`block`,label:`block`},{value:`flex`,label:`flex`},{value:`inline-block`,label:`inline-block`},{value:`inline`,label:`inline`},{value:`grid`,label:`grid`},{value:`none`,label:`none`}]},{key:`text-align`,label:`text align`,options:[{value:`left`,label:`left`},{value:`center`,label:`center`},{value:`right`,label:`right`},{value:`justify`,label:`justify`}]},{key:`font-style`,label:`font style`,options:[{value:`normal`,label:`normal`},{value:`italic`,label:`italic`}]},{key:`text-transform`,label:`text transform`,options:[{value:`none`,label:`none`},{value:`uppercase`,label:`uppercase`},{value:`lowercase`,label:`lowercase`},{value:`capitalize`,label:`capitalize`}]},{key:`white-space`,label:`white space`,options:[{value:`normal`,label:`normal`},{value:`nowrap`,label:`nowrap`},{value:`pre`,label:`pre`},{value:`pre-wrap`,label:`pre-wrap`},{value:`pre-line`,label:`pre-line`},{value:`break-spaces`,label:`break-spaces`}]},{key:`word-break`,label:`word break`,options:[{value:`normal`,label:`normal`},{value:`break-all`,label:`break-all`},{value:`keep-all`,label:`keep-all`}]},{key:`overflow-wrap`,label:`wrap`,options:[{value:`normal`,label:`normal`},{value:`break-word`,label:`break-word`},{value:`anywhere`,label:`anywhere`}]},{key:`font-variant-numeric`,label:`number style`,options:[{value:`normal`,label:`normal`},{value:`tabular-nums`,label:`tabular`},{value:`proportional-nums`,label:`proportional`},{value:`lining-nums`,label:`lining`},{value:`oldstyle-nums`,label:`oldstyle`},{value:`slashed-zero`,label:`slashed zero`}]},{key:`text-decoration-line`,label:`decoration`,options:[{value:`none`,label:`none`},{value:`underline`,label:`underline`},{value:`line-through`,label:`strike`}]},{key:`border-style`,label:`border style`,options:[{value:`none`,label:`none`},{value:`solid`,label:`solid`},{value:`dashed`,label:`dashed`},{value:`dotted`,label:`dotted`}]},{key:`visibility`,label:`visibility`,options:[{value:`visible`,label:`visible`},{value:`hidden`,label:`hidden`}]},{key:`align-items`,label:`align items`,options:[{value:`stretch`,label:`stretch`},{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`baseline`,label:`baseline`}]},{key:`justify-content`,label:`justify content`,options:[{value:`flex-start`,label:`start`},{value:`center`,label:`center`},{value:`flex-end`,label:`end`},{value:`space-between`,label:`between`},{value:`space-around`,label:`around`},{value:`space-evenly`,label:`evenly`}]},{key:`font-weight`,label:`font weight`,options:[{value:`100`,label:`thin`},{value:`200`,label:`extra-light`},{value:`300`,label:`light`},{value:`400`,label:`normal`},{value:`500`,label:`medium`},{value:`600`,label:`semibold`},{value:`700`,label:`bold`},{value:`800`,label:`extra-bold`},{value:`900`,label:`black`}]}],rV=[...LB,`color`,`background-color`,`border-color`,`fill`,`stroke`,`font-family`,`display`,`text-align`,`font-style`,`text-transform`,`white-space`,`word-break`,`overflow-wrap`,`font-variant-numeric`,`text-decoration-line`,`border-style`,`visibility`,`align-items`,`justify-content`,`font-weight`],iV=e=>Number.isInteger(e)?e:Math.round(e*100)/100,aV=e=>Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``),oV=e=>Number.isFinite(e)?aV(iV(e)):String(e),sV=e=>Math.round(e),cV=(e,t)=>{if(e.kind===`color`||e.kind===`enum`)return typeof t==`string`?t:e.value;let n=typeof t==`number`?t:e.value;return e.key===`opacity`&&e.unit===`%`?aV(iV(n/100)):`${aV(iV(n))}${e.unit}`},lV={slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#64748b`,600:`#475569`,700:`#334155`,800:`#1e293b`,900:`#0f172a`,950:`#020617`},gray:{50:`#f9fafb`,100:`#f3f4f6`,200:`#e5e7eb`,300:`#d1d5db`,400:`#9ca3af`,500:`#6b7280`,600:`#4b5563`,700:`#374151`,800:`#1f2937`,900:`#111827`,950:`#030712`},zinc:{50:`#fafafa`,100:`#f4f4f5`,200:`#e4e4e7`,300:`#d4d4d8`,400:`#a1a1aa`,500:`#71717a`,600:`#52525b`,700:`#3f3f46`,800:`#27272a`,900:`#18181b`,950:`#09090b`},neutral:{50:`#fafafa`,100:`#f5f5f5`,200:`#e5e5e5`,300:`#d4d4d4`,400:`#a3a3a3`,500:`#737373`,600:`#525252`,700:`#404040`,800:`#262626`,900:`#171717`,950:`#0a0a0a`},stone:{50:`#fafaf9`,100:`#f5f5f4`,200:`#e7e5e4`,300:`#d6d3d1`,400:`#a8a29e`,500:`#78716c`,600:`#57534e`,700:`#44403c`,800:`#292524`,900:`#1c1917`,950:`#0c0a09`},red:{50:`#fef2f2`,100:`#fee2e2`,200:`#fecaca`,300:`#fca5a5`,400:`#f87171`,500:`#ef4444`,600:`#dc2626`,700:`#b91c1c`,800:`#991b1b`,900:`#7f1d1d`,950:`#450a0a`},orange:{50:`#fff7ed`,100:`#ffedd5`,200:`#fed7aa`,300:`#fdba74`,400:`#fb923c`,500:`#f97316`,600:`#ea580c`,700:`#c2410c`,800:`#9a3412`,900:`#7c2d12`,950:`#431407`},amber:{50:`#fffbeb`,100:`#fef3c7`,200:`#fde68a`,300:`#fcd34d`,400:`#fbbf24`,500:`#f59e0b`,600:`#d97706`,700:`#b45309`,800:`#92400e`,900:`#78350f`,950:`#451a03`},yellow:{50:`#fefce8`,100:`#fef9c3`,200:`#fef08a`,300:`#fde047`,400:`#facc15`,500:`#eab308`,600:`#ca8a04`,700:`#a16207`,800:`#854d0e`,900:`#713f12`,950:`#422006`},lime:{50:`#f7fee7`,100:`#ecfccb`,200:`#d9f99d`,300:`#bef264`,400:`#a3e635`,500:`#84cc16`,600:`#65a30d`,700:`#4d7c0f`,800:`#3f6212`,900:`#365314`,950:`#1a2e05`},green:{50:`#f0fdf4`,100:`#dcfce7`,200:`#bbf7d0`,300:`#86efac`,400:`#4ade80`,500:`#22c55e`,600:`#16a34a`,700:`#15803d`,800:`#166534`,900:`#14532d`,950:`#052e16`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#10b981`,600:`#059669`,700:`#047857`,800:`#065f46`,900:`#064e3b`,950:`#022c22`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#14b8a6`,600:`#0d9488`,700:`#0f766e`,800:`#115e59`,900:`#134e4a`,950:`#042f2e`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#06b6d4`,600:`#0891b2`,700:`#0e7490`,800:`#155e75`,900:`#164e63`,950:`#083344`},sky:{50:`#f0f9ff`,100:`#e0f2fe`,200:`#bae6fd`,300:`#7dd3fc`,400:`#38bdf8`,500:`#0ea5e9`,600:`#0284c7`,700:`#0369a1`,800:`#075985`,900:`#0c4a6e`,950:`#082f49`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#3b82f6`,600:`#2563eb`,700:`#1d4ed8`,800:`#1e40af`,900:`#1e3a8a`,950:`#172554`},indigo:{50:`#eef2ff`,100:`#e0e7ff`,200:`#c7d2fe`,300:`#a5b4fc`,400:`#818cf8`,500:`#6366f1`,600:`#4f46e5`,700:`#4338ca`,800:`#3730a3`,900:`#312e81`,950:`#1e1b4b`},violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#8b5cf6`,600:`#7c3aed`,700:`#6d28d9`,800:`#5b21b6`,900:`#4c1d95`,950:`#2e1065`},purple:{50:`#faf5ff`,100:`#f3e8ff`,200:`#e9d5ff`,300:`#d8b4fe`,400:`#c084fc`,500:`#a855f7`,600:`#9333ea`,700:`#7e22ce`,800:`#6b21a8`,900:`#581c87`,950:`#3b0764`},fuchsia:{50:`#fdf4ff`,100:`#fae8ff`,200:`#f5d0fe`,300:`#f0abfc`,400:`#e879f9`,500:`#d946ef`,600:`#c026d3`,700:`#a21caf`,800:`#86198f`,900:`#701a75`,950:`#4a044e`},pink:{50:`#fdf2f8`,100:`#fce7f3`,200:`#fbcfe8`,300:`#f9a8d4`,400:`#f472b6`,500:`#ec4899`,600:`#db2777`,700:`#be185d`,800:`#9d174d`,900:`#831843`,950:`#500724`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#f43f5e`,600:`#e11d48`,700:`#be123c`,800:`#9f1239`,900:`#881337`,950:`#4c0519`}},uV={p:`padding`,px:`padding-left,padding-right`,py:`padding-top,padding-bottom`,pt:`padding-top`,pr:`padding-right`,pb:`padding-bottom`,pl:`padding-left`,ps:`padding-left`,pe:`padding-right`,m:`margin`,mx:`margin-left,margin-right`,my:`margin-top,margin-bottom`,mt:`margin-top`,mr:`margin-right`,mb:`margin-bottom`,ml:`margin-left`,ms:`margin-left`,me:`margin-right`,gap:`gap`,"gap-x":`column-gap`,"gap-y":`row-gap`,text:`font-size`,leading:`line-height`,tracking:`letter-spacing`,rounded:`border-radius`,"rounded-t":`border-top-left-radius,border-top-right-radius`,"rounded-b":`border-bottom-left-radius,border-bottom-right-radius`,"rounded-l":`border-top-left-radius,border-bottom-left-radius`,"rounded-r":`border-top-right-radius,border-bottom-right-radius`,"rounded-tl":`border-top-left-radius`,"rounded-tr":`border-top-right-radius`,"rounded-bl":`border-bottom-left-radius`,"rounded-br":`border-bottom-right-radius`,border:`border-width`,"border-t":`border-top-width`,"border-r":`border-right-width`,"border-b":`border-bottom-width`,"border-l":`border-left-width`,w:`width`,h:`height`,size:`width,height`,"max-w":`max-width`,"max-h":`max-height`,"min-w":`min-width`,"min-h":`min-height`,opacity:`opacity`,inset:`top,right,bottom,left`,"inset-x":`left,right`,"inset-y":`top,bottom`,top:`top`,right:`right`,bottom:`bottom`,left:`left`,z:`z-index`,items:`align-items`,justify:`justify-content`,font:`font-weight`,whitespace:`white-space`},dV={"font-size":[`font-size`,`font size`,`text-size`,`text size`],color:[`color`,`text-color`,`text color`,`text-colour`,`text colour`,`foreground`,`fg`],"background-color":[`background`,`background-color`,`background color`,`bg`,`bg-color`,`bg color`],"border-color":[`border-color`,`border color`],fill:[`fill`,`fill-color`,`fill color`],stroke:[`stroke`,`stroke-color`,`stroke color`],"font-family":[`font`,`font-sans`,`font-serif`,`font-mono`,`family`,`sans`,`serif`,`mono`],"font-style":[`italic`,`not-italic`],"text-align":[`text-left`,`text-center`,`text-right`,`text-justify`],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-decoration-line":[`underline`,`line-through`,`no-underline`],"white-space":[`whitespace`,`whitespace-normal`,`whitespace-nowrap`,`whitespace-pre`],"word-break":[`break-normal`,`break-all`,`break-keep`],"overflow-wrap":[`break-words`,`break-anywhere`],"font-variant-numeric":[`tabular-nums`,`proportional-nums`,`lining-nums`,`oldstyle-nums`],"border-style":[`border-solid`,`border-dashed`,`border-dotted`,`border-none`]},fV=(()=>{let e={};for(let[t,n]of Object.entries(uV))n!==void 0&&(e[n]??=new Set).add(t);let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=Array.from(r));for(let[e,n]of Object.entries(dV)){let r=new Set([...t[e]??[],...n]);t[e]=Array.from(r)}return t})(),pV={text:`color`,bg:`background-color`,border:`border-color`,"border-x":`border-color`,"border-y":`border-color`,"border-t":`border-color`,"border-r":`border-color`,"border-b":`border-color`,"border-l":`border-color`,"border-s":`border-color`,"border-e":`border-color`,fill:`fill`,stroke:`stroke`},mV=e=>uV[e]!==void 0||pV[e]!==void 0,hV=e=>{let t=0,n=-1;for(let r=0;r<e.length;r++){let i=e[r];i===`[`?t++:i===`]`?t--:i===`:`&&t===0&&(n=r)}let r=n>=0?e.slice(n+1):e;return r.startsWith(`!`)?r.slice(1):r},gV=e=>{let t=hV(e);if(!t)return null;let n=t.indexOf(`[`);if(n>0)return t.slice(0,n).replace(/-$/,``)||null;let r=t.split(`-`).filter(Boolean);if(r.length===0)return null;for(let e=r.length;e>=1;e--){let t=r.slice(0,e).join(`-`);if(mV(t))return t}return r[0]},_V=/-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone|black|white|transparent|current|inherit)\b/,vV=(e,t)=>e!==`text`&&e!==`bg`&&e!==`border`&&!e.startsWith(`border-`)?!1:_V.test(t),yV=new Set(`color.red.orange.amber.yellow.lime.green.emerald.teal.cyan.sky.blue.indigo.violet.purple.fuchsia.pink.rose.slate.gray.grey.zinc.neutral.stone.black.white.transparent.current.currentcolor.inherit.primary.secondary.accent.muted.foreground.background.destructive.success.warning.error.info.card.popover.input.ring`.split(`.`)),bV=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),xV=/^(#|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color:|color\(|var\(--.*color)/,SV=/^(-?\d|length:|size:)/,CV=e=>e.trim().toLowerCase().replace(/\s+/g,`-`).replace(/([a-z])(\d)/g,`$1-$2`),wV=e=>xV.test(e)&&!SV.test(e),TV=(e,t)=>{if(e===t)return``;let n=`${t}-`;return e.startsWith(n)?e.slice(n.length):null},EV=e=>{let t=hV(CV(e)),n=gV(t);if(!n)return null;let r=pV[n];if(!r)return null;let i=t.indexOf(`[`);if(i>=0)return wV(t.slice(i+1).replace(/\]$/,``))?r:null;let a=TV(t,n);if(a===null)return null;if(n===`bg`&&a===``||(n===`fill`||n===`stroke`)&&a===``)return r;let o=a.split(`-`)[0];return n===`text`&&bV.has(o)?null:yV.has(o)?r:null},DV={black:`#000000`,white:`#ffffff`,transparent:EN},OV=e=>{let t=hV(CV(e)),n=gV(t);if(!n||pV[n]===void 0||t.includes(`[`))return null;let r=TV(t,n);if(!r)return null;let i=DV[r];if(i)return i;let a=r.lastIndexOf(`-`);if(a<0)return null;let o=r.slice(0,a),s=o===`grey`?`gray`:o,c=Number.parseInt(r.slice(a+1),10);return lV[s]?.[c]??null},kV=/^-?\d/,AV=(e,t)=>{if(t===``||t.startsWith(`[`)||kV.test(t))return!0;let n=t.split(`-`)[0];return e===`text`?bV.has(n):e===`font`||e===`border`||e.startsWith(`border-`)?!1:(e===`rounded`||e.startsWith(`rounded-`),!0)},jV={"font-sans":{property:`font-family`,value:`ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`},"font-serif":{property:`font-family`,value:`ui-serif, Georgia, Cambria, "Times New Roman", Times, serif`},"font-mono":{property:`font-family`,value:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace`},"font-thin":{property:`font-weight`,value:`100`},"font-extralight":{property:`font-weight`,value:`200`},"font-light":{property:`font-weight`,value:`300`},"font-normal":{property:`font-weight`,value:`400`},"font-medium":{property:`font-weight`,value:`500`},"font-semibold":{property:`font-weight`,value:`600`},"font-bold":{property:`font-weight`,value:`700`},"font-extrabold":{property:`font-weight`,value:`800`},"font-black":{property:`font-weight`,value:`900`},"text-left":{property:`text-align`,value:`left`},"text-center":{property:`text-align`,value:`center`},"text-right":{property:`text-align`,value:`right`},"text-justify":{property:`text-align`,value:`justify`},italic:{property:`font-style`,value:`italic`},"not-italic":{property:`font-style`,value:`normal`},uppercase:{property:`text-transform`,value:`uppercase`},lowercase:{property:`text-transform`,value:`lowercase`},capitalize:{property:`text-transform`,value:`capitalize`},"normal-case":{property:`text-transform`,value:`none`},underline:{property:`text-decoration-line`,value:`underline`},"line-through":{property:`text-decoration-line`,value:`line-through`},"no-underline":{property:`text-decoration-line`,value:`none`},"whitespace-normal":{property:`white-space`,value:`normal`},"whitespace-nowrap":{property:`white-space`,value:`nowrap`},"whitespace-pre":{property:`white-space`,value:`pre`},"whitespace-pre-line":{property:`white-space`,value:`pre-line`},"whitespace-pre-wrap":{property:`white-space`,value:`pre-wrap`},"whitespace-break-spaces":{property:`white-space`,value:`break-spaces`},"break-normal":{property:`word-break`,value:`normal`},"break-all":{property:`word-break`,value:`break-all`},"break-keep":{property:`word-break`,value:`keep-all`},"break-words":{property:`overflow-wrap`,value:`break-word`},"break-anywhere":{property:`overflow-wrap`,value:`anywhere`},"tabular-nums":{property:`font-variant-numeric`,value:`tabular-nums`},"proportional-nums":{property:`font-variant-numeric`,value:`proportional-nums`},"lining-nums":{property:`font-variant-numeric`,value:`lining-nums`},"oldstyle-nums":{property:`font-variant-numeric`,value:`oldstyle-nums`},"slashed-zero":{property:`font-variant-numeric`,value:`slashed-zero`},"border-solid":{property:`border-style`,value:`solid`},"border-dashed":{property:`border-style`,value:`dashed`},"border-dotted":{property:`border-style`,value:`dotted`},"border-none":{property:`border-style`,value:`none`}},MV=e=>{let t=CV(e);if(!t)return[];let n=LV(t);if(n)return[n.property];let r=EV(t);return r?[r]:[]},NV=e=>{let t=CV(e);if(!t)return[];let n=gV(t);if(!n)return[];let r=TV(hV(t),n);if(r===null||!AV(n,r))return[];let i=IV(n);return i?[i]:[]},PV=e=>{let t=e.getAttribute(`class`);if(!t)return new Set;let n=t.split(/\s+/).filter(Boolean),r=new Set;for(let e of n){let t=gV(e);if(!t||vV(t,e))continue;let n=LV(e);if(n){r.add(n.property);continue}let i=IV(t);i&&r.add(i)}return r},FV=e=>fV[e]??[],IV=e=>{let t=uV[e];return t===void 0?null:t},LV=e=>{let t=jV[hV(e)];return t===void 0?null:t},RV=`react-grab-toolbar-state`,zV=()=>{try{let e=localStorage.getItem(RV);if(!e)return null;let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t,r=typeof n.collapsed==`boolean`&&n.collapsed;return{edge:n.edge===`top`||n.edge===`bottom`||n.edge===`left`||n.edge===`right`?n.edge:`bottom`,ratio:typeof n.ratio==`number`?n.ratio:gN,collapsed:r,enabled:!r,defaultAction:typeof n.defaultAction==`string`?n.defaultAction:_N}}catch(e){console.warn(`[react-grab] Failed to load toolbar state from localStorage:`,e)}return null},BV=e=>{try{localStorage.setItem(RV,JSON.stringify(e))}catch(e){console.warn(`[react-grab] Failed to save toolbar state to localStorage:`,e)}},VV=e=>{let[t,n]=J(!1);return TR(()=>{let t=zM(t=>n(e(t))),r=()=>n(!1);window.addEventListener(`keydown`,t,{capture:!0}),window.addEventListener(`keyup`,t,{capture:!0}),window.addEventListener(`blur`,r),ER(()=>{window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`keyup`,t,{capture:!0}),window.removeEventListener(`blur`,r)})}),t},HV=e=>e.key===`Enter`,UV=e=>e.metaKey||e.ctrlKey,WV=(e,t,n={})=>{if(!t.key)return null;if(HV(t))return e.find(e=>e.shortcut===`Enter`)??null;if(t.repeat)return null;let r=t.key.toLowerCase();return UV(t)?n.includeModifierShortcuts===!0?e.find(e=>e.shortcut!==void 0&&e.shortcut!==`Enter`&&e.shortcutModifier!==!1&&r===e.shortcut.toLowerCase())??null:null:e.find(e=>e.shortcut!==void 0&&e.shortcutModifier===!1&&r===e.shortcut.toLowerCase())??null},GV=()=>{let e=!1;return{arm:()=>{e=!0},clear:()=>{e=!1},consume:()=>e?(e=!1,!0):!1}}})),qV,JV,YV,XV,ZV,QV,$V,eH,tH,nH,rH,iH,aH,oH,sH,cH,lH,uH,dH,fH,pH,mH,hH,gH,_H,vH,yH,bH,xH,SH,CH,wH,TH,EH,DH,OH,kH,AH,jH,MH,NH,PH,FH,IH,LH,RH,zH,BH,VH,HH,UH,WH,GH,KH,qH,JH,YH,XH,ZH,QH,$H,eU,tU,nU,rU,iU,aU,oU,sU,cU,lU,uU,dU,fU,pU,mU,hU,gU,_U,vU,yU,bU,xU,SU,CU,wU,TU,EU,DU,OU,kU,AU,jU,MU,NU,PU,FU,IU,LU,RU,zU,BU,VU,HU,UU,WU,GU,KU,qU,JU,YU,XU,ZU,QU,$U,eW,tW,nW,rW,iW=t((()=>{pR(),qV=class extends Error{constructor(e){super(e),this.name=`ReactGrabError`}},JV=class extends qV{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},YV=class extends qV{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},XV=class extends qV{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},ZV=class extends qV{constructor(){super(`Failed to copy`),this.name=`CopyFailedError`}},QV=e=>e===void 0||!Number.isFinite(e)?3:Math.max(0,Math.floor(e)),$V=e=>{try{return decodeURIComponent(e)}catch{return e}},eH=/(?:^|[/\\])node_modules[/\\]/,tH=/[/\\]\.vite[/\\]deps[^/\\]*[/\\]/,nH=/\.[mc]?[jt]sx?$/i,rH=/^chunk-[A-Za-z0-9_-]+$/,iH=/[/\\]/,aH=/^(.+?)@v?\d/,oH=e=>e.split(iH).filter(Boolean),sH=e=>{let[t,n]=oH(e);return!t||t.startsWith(`.`)?null:t.startsWith(`@`)?n?`${t}/${n}`:null:t},cH=e=>{let t=oH(e)[0];if(!t)return null;let n=t.replace(nH,``);if(rH.test(n))return null;if(!n.startsWith(`@`))return n;let r=n.indexOf(`_`);return r===-1?null:`${n.slice(0,r)}/${n.slice(r+1)}`},lH=(e,t,n)=>{let r=e.split(t);return r.length>1?n(r[r.length-1]):null},uH=e=>e?.match(aH)?.[1]??null,dH=e=>{let t;try{t=new URL(e)}catch{return null}if(!t.hostname)return null;let n=oH(t.pathname).map($V);for(let[e,t]of n.entries()){if(t.startsWith(`@`)){let r=uH(n[e+1]);if(r)return`${t}/${r}`;continue}let r=uH(t);if(r)return r}return null},fH=e=>lH(e,tH,cH)??lH(e,eH,sH),pH=e=>{if(!e)return null;let t=hF(e);return t&&(fH($V(t))||dH(e))||null},mH=/^@[A-Za-z0-9][A-Za-z0-9._-]*$/,hH=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,gH=new Set([`app`,`web`,`website`,`frontend`,`client`,`src`]),_H=new Set([`app`,`src`,`components`,`pages`,`features`,`modules`,`hooks`,`lib`,`utils`,`ui`,`shared`,`common`,`core`,`styles`,`assets`]),vH=e=>{let t=e;for(;t.startsWith(`../`)||t.startsWith(`./`);)t=t.slice(t.startsWith(`../`)?3:2);return t},yH=e=>{let t=vH($V(hF(e)));if(t.startsWith(`/`))return null;let[n,r,...i]=oH(t);return!n||!r||i.length===0||!mH.test(n)||_H.has(n.slice(1))||!hH.test(r)||nH.test(r)||gH.has(r)?null:`${n}/${r}`},bH=e=>e?pH(e)??yH(e):null,xH=e=>{if(!e)return{origin:`unknown`,packageName:null};let t=bH(e);return t?{origin:`package`,packageName:t}:gF(e)?{origin:`app`,packageName:null}:{origin:`unknown`,packageName:null}},SH=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),CH=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},wH=(e,t)=>{let n=SH.has(e)||e.startsWith(`data-`)&&CH(e),r=CH(t)&&t.length<100||t.startsWith(`#`)&&CH(t.slice(1));return n&&r},TH=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},EH=e=>{let t=0;for(let n of e)t+=n.penalty;return t},DH=(e,t)=>EH(e)-EH(t),OH=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r instanceof Element&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},kH=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,AH=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,jH=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&CH(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)CH(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=OH(e,i);a!==void 0&&n.push({name:AH(i,a),penalty:10});let o=OH(e);return o!==void 0&&n.push({name:kH(i,o),penalty:50}),n},MH=(e,t=YM,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...MH(e.slice(1),a,[...n,i]))}return r},NH=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e instanceof Document?e:e.ownerDocument},PH=(e,t)=>t.querySelectorAll(TH(e)).length===1,FH=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=OH(n,e);if(t===void 0)return;r.push({name:AH(e,t),penalty:10}),n=n.parentElement}return PH(r,t)?r:void 0},IH=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new JV;if(e.tagName.toLowerCase()===`html`)return`html`;let i=NH(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(jH(s,r)),s=s.parentElement,c++,c>=3){let t=MH(o);t.sort(DH);for(let r of t){if(Date.now()-a>n){let t=FH(e,i);if(!t)throw new YV(n);return TH(t)}if(PH(r,i)){l=r;break}}}if(!l&&c<3){let e=MH(o);e.sort(DH);for(let t of e){if(Date.now()-a>n)break;if(PH(t,i)){l=t;break}}}if(!l)throw new XV;return TH(l)},LH=e=>e.ownerDocument.body??e.ownerDocument.documentElement,RH=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),zH=e=>e.length>0&&e.length<=120,BH=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},VH=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${CSS.escape(e.id)}`;if(BH(e,t))return t}for(let t of RH){let n=e.getAttribute(t);if(!n||!zH(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(BH(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(BH(e,i))return i}return null},HH=e=>{let t=[],n=LH(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${CSS.escape(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r)+1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${i})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},UH=e=>{let t=VH(e);if(t)return t;try{let t=IH(e,LH(e),200,(e,t)=>wH(e,t)||RH.has(e)&&zH(t));if(t)return t}catch{}return HH(e)},WH=e=>{if(!e)return!1;let t=`/${JF(e)}/`.toLowerCase();return KM.some(e=>t.includes(e))},GH=e=>e.map(e=>`\n in ${e}`).join(``),KH=[`about://React/`,`rsc://React/`],qH=e=>KH.some(t=>e.startsWith(t)),JH=e=>{for(let t of KH){if(!e.startsWith(t))continue;let n=e.indexOf(`/`,t.length);if(n===-1)continue;let r=n+1,i=e.lastIndexOf(`?`);return $V(i>r?e.slice(r,i):e.slice(r))}return e},YH=e=>{if(typeof e!=`object`||!e||!(`status`in e)||e.status!==`fulfilled`||!(`value`in e)||typeof e.value!=`object`||e.value===null||!(`originalStackFrame`in e.value))return null;let t=e.value.originalStackFrame;return typeof t!=`object`||!t||!(`file`in t)||typeof t.file!=`string`||!t.file||`ignored`in t&&t.ignored?null:{file:t.file,line1:`line1`in t&&typeof t.line1==`number`?t.line1:null,column1:`column1`in t&&typeof t.column1==`number`?t.column1:null}},XH=async(e,t)=>{let n=[],r=[];for(let t=0;t<e.length;t++){let i=e[t];!i.isServer||!i.fileName||(n.push(t),r.push({file:JH(i.fileName),methodName:i.functionName??`<unknown>`,line1:i.lineNumber??null,column1:i.columnNumber??null,arguments:[]}))}if(r.length===0)return e;let i=new AbortController,a=setTimeout(()=>i.abort(),qM),o=()=>i.abort();t?.aborted&&i.abort(),t?.addEventListener(`abort`,o);try{let t=await fetch(`${QF()}/__nextjs_original-stack-frames`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({frames:r,isServer:!0,isEdgeServer:!1,isAppDirectory:!0}),priority:`high`,signal:i.signal});if(!t.ok)return e;let a=await t.json();if(!Array.isArray(a))return e;let o=[...e];for(let t=0;t<n.length;t++){let r=YH(a[t]);if(!r)continue;let i=n[t];o[i]={...e[i],fileName:r.file,lineNumber:r.line1??void 0,columnNumber:r.column1??void 0,isSymbolicated:!0}}return o}catch{return e}finally{clearTimeout(a),t?.removeEventListener(`abort`,o)}},ZH=e=>{let t=new Map;return TM(e,e=>{if(!JP(e))return!1;let n=rF(e._debugStack.stack);if(!n)return!1;for(let e of wP(n))!e.functionName||!e.fileName||qH(e.fileName)&&(t.has(e.functionName)||t.set(e.functionName,{...e,isServer:!0}));return!1},!0),t},QH=(e,t)=>{if(!t.some(e=>e.isServer&&!e.fileName&&e.functionName))return t;let n=ZH(e);return n.size===0?t:t.map(e=>{if(!e.isServer||e.fileName||!e.functionName)return e;let t=n.get(e.functionName);return t?{...e,fileName:t.fileName,lineNumber:t.lineNumber,columnNumber:t.columnNumber}:e})},$H=0,eU=[],tU=()=>$H<3?($H+=1,Promise.resolve()):new Promise(e=>{eU.push(e)}),nU=()=>{let e=eU.shift();if(e){e();return}--$H},rU=async(e,t,n=JM)=>{await tU();let r=new AbortController,i,a=new Promise(e=>{i=setTimeout(()=>{r.abort(),e(t)},n)}),o=e(r.signal);o.catch(()=>{});try{return await Promise.race([o,a])}finally{clearTimeout(i),nU()}},iU=(e,t)=>e.length>t?`${e.slice(0,t)}...`:e,aU=e=>e.startsWith(`data-react-grab-`),oU=e=>e.replace(/\s+/g,` `).trim(),sU=e=>{let t=[];for(let n of e.childNodes){if(n.nodeType!==Node.TEXT_NODE)continue;let e=oU(n.textContent??``);e&&t.push(e)}return t.join(` `)},cU=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:uN.has(e.tagName.toLowerCase()),lU=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=oU(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!(e instanceof Element)||cU(e))return n;for(let r of e.childNodes)if(n=lU(r,t,n),n<=0)break;return n},uU=(e,t)=>{if(cU(e))return``;let n=sU(e);if(!lN.has(t)||n&&e.children.length===0)return n;let r=[];return lU(e,r,100),r.join(` `)},dU=e=>iU(e,15),fU=e=>{let t=[];for(let n of sN){let r=e.getAttribute(n);r&&t.push(`${n}="${r}"`)}return t.length>0?` ${t.join(` `)}`:``},pU=e=>e===`class`||e===`className`||e===`style`,mU=e=>{let t=[],n=[],r=``;for(let{name:i,value:a}of e.attributes)if(!aU(i)){if(pU(i)){i!==`style`&&a&&(r=` class="${dU(a)}"`);continue}cN.has(i)?t.push(a?` ${i}="${a}"`:` ${i}`):a&&n.push(` ${i}="${dU(a)}"`)}return t.join(``)+n.join(``)+r},hU=e=>e.length===0?``:e.length<=2?e.map(e=>`<${RN(e)} ...>`).join(`
258
+ `):`(${e.length} elements)`,gU=e=>{let t=RN(e);if(!(e instanceof HTMLElement))return`<${t}${fU(e)} />`;let n=mU(e),r=iU(uU(e,t),100);return r?`<${t}${n}>${r}</${t}>`:`<${t}${n} />`},_U=e=>{let t=RN(e),n=mU(e),r=uU(e,t),i=[],a=[],o=!1;for(let t of e.childNodes)t.nodeType!==Node.COMMENT_NODE&&(t.nodeType===Node.TEXT_NODE?t.textContent&&t.textContent.trim().length>0&&(o=!0):t instanceof Element&&(o?a.push(t):i.push(t)));let s=r.length>0&&lN.has(t),c=``,l=hU(i);l&&!s&&(c+=`\n ${l}`),r&&(c+=`\n ${iU(r,100)}`);let u=hU(a);return u&&!s&&(c+=`\n ${u}`),c.length>0?`<${t}${n}>${c}\n</${t}>`:`<${t}${n} />`},vU=new Set([`_`,`$`,`motion.`,`styled.`,`chakra.`,`ark.`,`Primitive.`,`Slot.`]),yU=new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),bU=new Set([`Suspense`,`Fragment`,`StrictMode`,`Profiler`,`SuspenseList`]),xU=new Set([`MotionDOMComponent`]),SU=e=>{if(yU.has(e)||bU.has(e)||xU.has(e))return!0;for(let t of vU)if(e.startsWith(t))return!0;return!1},CU=e=>!(!e||SU(e)||e===`SlotClone`||e===`Slot`),wU=e=>!(e.length<=1||SU(e)||e[0]!==e[0].toUpperCase()||e.endsWith(`Provider`)||e.endsWith(`Context`)),TU=e=>e&&wU(e)?e:null,EU=e=>{if(!dP())return e;let t=e;for(;t;){if(fP(t))return t;t=t.parentElement}return e},DU=e=>{if(!dP())return null;let t=fP(EU(e)),n=0;for(;t;){if(t.key)return t.key;if(oP(t)&&(n+=1,n===2))break;t=t.return}return null},OU=new WeakMap,kU=new WeakMap,AU=e=>t=>fetch(t,{signal:e,priority:`high`}),jU=e=>rU(async t=>{try{let n=fP(e);if(!n)return null;let r=await lF(n,!0,AU(t));return XF()?await XH(QH(n,r),t):r}catch{return null}},null),MU=e=>{if(!dP())return Promise.resolve([]);let t=EU(e),n=OU.get(t);if(n)return n;let r=jU(t).then(e=>(e===null&&OU.delete(t),e));return OU.set(t,r),r},NU=async e=>{if(!dP())return null;let t=await MU(e);if(!t)return null;for(let e of t){let t=TU(e.functionName);if(t)return t}return null},PU=e=>e.find(e=>!!TU(e.functionName))??e[0]??null,FU=e=>!e||!oP(e)?null:TU(uP(e.type)),IU=e=>rU(async t=>{let n=fP(EU(e));if(!n)return null;try{let e=await dF(n,!0,AU(t));return e?.fileName?{filePath:JF(e.fileName),lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:TU(e.functionName)??FU(n._debugOwner),origin:xH(e.fileName).origin}:null}catch{return null}},null),LU=e=>{let t=EU(e),n=kU.get(t);if(n)return n;let r=IU(t).then(e=>(e||kU.delete(t),e));return kU.set(t,r),r},RU=[`app`,`package`],zU=(e,t)=>{for(let n of RU){if(e?.origin===n)return e;let r=PU(t.filter(e=>xH(e.fileName).origin===n));if(r?.fileName)return{filePath:JF(r.fileName),lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null,componentName:TU(r.functionName),origin:n}}return null},BU=async e=>{let t=await LU(e);return t?.origin===`app`?t:zU(t,await MU(e)??[])},VU=e=>HU(EU(e),1)[0]??null,HU=(e,t,n=()=>!0)=>{if(!dP())return[];let r=fP(e);if(!r)return[];let i=[];return TM(r,e=>{if(i.length>=t)return!0;if(oP(e)){let t=uP(e.type);t&&CU(t)&&n(t)&&i.push(t)}return!1},!0),i},UU=[`/src/app/`,`/src/pages/`,`/app/`,`/pages/`],WU=(e,t)=>{let n=JF(e);if(!t||!n.startsWith(`/`))return n;for(let e of UU){let t=n.indexOf(e);if(t!==-1)return`/./${n.slice(t+1)}`}return n},GU=(e,t)=>{let n=WU(e.filePath,t),r=t&&e.lineNumber?`${n}:${e.lineNumber}${e.columnNumber?`:${e.columnNumber}`:``}`:n;return e.componentName?`\n in ${e.componentName} (at ${r})`:`\n in ${r}`},KU={isAppSource:!1,consumesBudget:!1},qU=(e,t,n,r)=>{let i=t.packageName,a=t.origin===`app`?e.fileName:null;if(e.isServer&&!a&&(n||!e.functionName)){let e=i?`${i} at Server`:`at Server`;return{text:`\n in ${n??`<anonymous>`} (${e})`,...KU}}return!a&&n?{text:i?`\n in ${n} (${i})`:`\n in ${n}`,...KU}:i?{text:`\n in ${i}`,...KU}:a?{text:GU({componentName:n,filePath:a,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null},r),isAppSource:!0,consumesBudget:!WH(a)}:null},JU=(e,t={},n=null)=>{let r=QV(t.maxLines),i=Math.max(r,20),a=XF(),o=[],s=new Set,c=null,l=!1,u=!1,d=!1,f=0,p=e=>{e&&s.add(e)};n&&(u=n.origin===`app`,WH(n.filePath)||(f+=1),p(n.componentName),o.push(GU(n,a)));for(let t of e){if(f>=r||o.length>=i)break;let e=xH(t.fileName),s=TU(t.functionName),m=e.packageName?`${e.packageName}:${s??``}:${t.isServer?`server`:`client`}`:null;if(m&&m===c)continue;if(!l&&s&&s===n?.componentName){l=!0;continue}let h=qU(t,e,s,a);h!==null&&h.text!==o[o.length-1]&&(h.isAppSource&&(u=!0),h.consumesBudget&&(f+=1,d=!0),p(s),o.push(h.text),c=m)}return{text:o.join(``),shouldAppendSelectorHint:!u,hasBudgetedStackFrame:d,renderedComponentNames:s}},YU=async e=>{let t=await LU(e);return t?.origin===`app`?t:null},XU=(e,t,n)=>{let r=HU(EU(e),n,e=>wU(e)&&!t.renderedComponentNames.has(e));return r.length===0?t:{...t,text:`${t.text}${GH(r)}`}},ZU=async(e,t={})=>{let n=await YU(e),r=await MU(e),i=QV(t.maxLines),a=JU(r??[],t,n);if(a.text)return a.hasBudgetedStackFrame?a:XU(e,a,i);let o=HU(EU(e),i);return{text:GH(o),shouldAppendSelectorHint:!0,hasBudgetedStackFrame:!1,renderedComponentNames:new Set(o)}},QU=async(e,t={})=>(await ZU(e,t)).text,$U=(e,t)=>{let n=DU(e),r=n===null?``:`\n key: "${n}"`,i=t.shouldAppendSelectorHint?`\n selector: ${UH(e)}`:``;return`${t.text}${r}${i}`},eW=async(e,t={})=>{let n=await ZU(e,t);return`${gU(e)}${$U(e,n).replace(/\n\s+/g,` `)}`},tW=async(e,t={})=>{let n=EU(e);return`${_U(n)}${$U(n,await ZU(n,t))}`},nW=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),rW=(e,t)=>{let n=t?.componentName??`div`,r={version:VM,content:e,entries:t?.entries??[{tagName:t?.tagName,componentName:n,content:e,commentText:t?.commentText}],timestamp:Date.now()},i=t=>{t.preventDefault(),t.clipboardData?.setData(`text/plain`,e),t.clipboardData?.setData(`text/html`,`<meta charset='utf-8'><pre><code>${nW(e)}</code></pre>`),t.clipboardData?.setData(`application/x-react-grab`,JSON.stringify(r))};document.addEventListener(`copy`,i);let a=document.createElement(`textarea`);a.value=e,a.style.position=`fixed`,a.style.left=`-9999px`,a.ariaHidden=`true`,document.body.appendChild(a),a.select();try{return typeof document.execCommand==`function`&&document.execCommand(`copy`)}finally{document.removeEventListener(`copy`,i),a.remove()}}})),aW=r({ReactGrabRenderer:()=>EJ}),oW,sW,cW,lW,uW,dW,fW,pW,mW,hW,gW,_W,vW,yW,bW,xW,SW,CW,wW,TW,EW,DW,OW,kW,AW,jW,MW,NW,PW,FW,IW,LW,RW,zW,BW,VW,HW,UW,WW,GW,KW,qW,JW,YW,XW,ZW,QW,$W,eG,tG,nG,rG,iG,aG,oG,sG,cG,lG,uG,dG,fG,pG,mG,hG,gG,_G,vG,yG,bG,xG,SG,CG,wG,TG,EG,DG,OG,kG,AG,jG,MG,NG,PG,FG,IG,LG,RG,zG,BG,VG,HG,UG,WG,GG,KG,qG,JG,YG,XG,ZG,QG,$G,eK,tK,nK,rK,iK,aK,oK,sK,cK,lK,uK,dK,fK,pK,mK,hK,gK,_K,vK,yK,bK,xK,SK,CK,wK,TK,EK,DK,OK,kK,AK,jK,MK,NK,PK,FK,IK,LK,RK,zK,BK,VK,HK,UK,WK,GK,KK,qK,JK,YK,XK,ZK,QK,$K,eq,tq,nq,rq,iq,aq,oq,sq,cq,lq,uq,dq,fq,pq,mq,hq,gq,_q,vq,yq,bq,xq,Sq,Cq,wq,Tq,Eq,Dq,Oq,kq,Aq,jq,Mq,Nq,Pq,Fq,Iq,Lq,Rq,zq,Bq,Vq,Hq,Uq,Wq,Gq,Kq,qq,Jq,Yq,Xq,Zq,Qq,$q,eJ,tJ,nJ,rJ,iJ,aJ,oJ,sJ,cJ,lJ,uJ,dJ,fJ,pJ,mJ,hJ,gJ,_J,vJ,yJ,bJ,xJ,SJ,CJ,wJ,TJ,EJ,DJ=t((()=>{KV(),pR(),oW=(e,t,n)=>e+(t-e)*n,sW=(e,t)=>{let n=Math.max(t,1);return 1-(1-e)**(n/$M)},cW=Z(`<canvas data-react-grab-overlay-canvas style=position:fixed;top:0;left:0;pointer-events:none>`),lW={borderColor:rN,fillColor:iN,lerpFactor:WM},uW={drag:{borderColor:tN,fillColor:nN,lerpFactor:QM},selection:lW,grabbed:lW},dW=e=>{let t,n=null,r=0,i=0,a=1,o=null,s=null,c={drag:{canvas:null,context:null},selection:{canvas:null,context:null},grabbed:{canvas:null,context:null}},l=[],u=null,d=[],f=MM()?`display-p3`:`srgb`,p=(e,t,n)=>{let r=new OffscreenCanvas(e*n,t*n),i=r.getContext(`2d`,{colorSpace:f});return i&&i.scale(n,n),{canvas:r,context:i}},m=()=>{if(t){a=Math.max(window.devicePixelRatio||1,2),r=window.innerWidth,i=window.innerHeight,t.width=r*a,t.height=i*a,t.style.width=`${r}px`,t.style.height=`${i}px`,n=t.getContext(`2d`,{colorSpace:f}),n&&n.scale(a,a);for(let e of Object.keys(c))c[e]=p(r,i,a)}},h=e=>{if(!e)return 0;let t=e.match(/^(\d+(?:\.\d+)?)/);return t?parseFloat(t[1]):0},g=(e,t,n)=>({id:e,current:{x:t.x,y:t.y,width:t.width,height:t.height},target:{x:t.x,y:t.y,width:t.width,height:t.height},borderRadius:h(t.borderRadius),opacity:n?.opacity??1,targetOpacity:n?.targetOpacity??n?.opacity??1,createdAt:n?.createdAt,fadeStartTimestamp:null,isInitialized:!0}),_=(e,t,n)=>{let r=e.target;r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height,e.borderRadius=h(t.borderRadius),n!==void 0&&(e.targetOpacity=n)},v=e=>e.boundsMultiple??[e.bounds],y=(e,t,n,r,i,a,o,s,c=1)=>{if(r<=0||i<=0)return;let l=Math.min(r/2,i/2),u=Math.min(a,l),d=c!==1;d&&(e.globalAlpha=c),e.beginPath(),u>0?e.roundRect(t,n,r,i,u):e.rect(t,n,r,i),e.fillStyle=o,e.fill(),e.strokeStyle=s,e.lineWidth=1,e.stroke(),d&&(e.globalAlpha=1)},b=()=>{let t=c.drag;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.dragVisible||!u)return;let a=uW.drag;y(n,u.current.x,u.current.y,u.current.width,u.current.height,u.borderRadius,a.fillColor,a.borderColor)},x=()=>{let t=c.selection;if(!t.context)return;let n=t.context;if(n.clearRect(0,0,r,i),!e.selectionVisible)return;let a=uW.selection;for(let e of l)y(n,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,a.fillColor,a.borderColor,e.opacity)},S=(e,t)=>{let n=c[e];if(!n.context)return;let a=n.context;a.clearRect(0,0,r,i);let o=uW[e];for(let e of t)y(a,e.current.x,e.current.y,e.current.width,e.current.height,e.borderRadius,o.fillColor,o.borderColor,e.opacity)},C=()=>{if(!(!n||!t)&&!(r<=0||i<=0)){n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,t.width,t.height),n.setTransform(a,0,0,a,0,0),b(),x(),S(`grabbed`,d);for(let e of[`drag`,`selection`,`grabbed`]){let t=c[e];t.canvas&&n.drawImage(t.canvas,0,0,r,i)}}},w=(e,t,n)=>{let r=oW(e.current.x,e.target.x,t),i=oW(e.current.y,e.target.y,t),a=oW(e.current.width,e.target.width,t),o=oW(e.current.height,e.target.height,t),s=Math.abs(r-e.target.x)<.5&&Math.abs(i-e.target.y)<.5&&Math.abs(a-e.target.width)<.5&&Math.abs(o-e.target.height)<.5;e.current.x=s?e.target.x:r,e.current.y=s?e.target.y:i,e.current.width=s?e.target.width:a,e.current.height=s?e.target.height:o;let c=!0;if(n?.interpolateOpacity){let n=oW(e.opacity,e.targetOpacity,t);c=Math.abs(n-e.targetOpacity)<eN,e.opacity=c?e.targetOpacity:n}return!s||!c},T=()=>{let e=performance.now(),t=s===null?$M:e-s;s=e;let n=sW(uW.drag.lerpFactor,t),r=sW(uW.selection.lerpFactor,t),i=sW(uW.grabbed.lerpFactor,t),a=!1;u?.isInitialized&&w(u,n)&&(a=!0);for(let e of l)e.isInitialized&&w(e,r)&&(a=!0);let c=Date.now();d=d.filter(t=>{let n=t.id.startsWith(`label-`);if(t.isInitialized&&w(t,i)&&(a=!0),n&&t.targetOpacity===0){t.fadeStartTimestamp===null&&(t.fadeStartTimestamp=e);let n=e-t.fadeStartTimestamp,r=Math.min(1,n/125),i=1-(1-r)*(1-r);return t.opacity=Math.max(0,1-i),r>=1?!1:(a=!0,!0)}else n&&(t.fadeStartTimestamp=null);if(t.createdAt){let e=c-t.createdAt;if(e>=1625)return!1;if(e>1500){let n=Math.min(1,(e-GM)/125);t.opacity=1-(1-(1-n)*(1-n)),a=!0}return!0}return n?!0:t.opacity>0}),C(),a?o=nI(T):(o=null,s=null)},E=()=>{o===null&&(o=nI(T))},D=()=>{m(),E()};return yR(wR(()=>[e.selectionVisible,e.selectionBounds,e.selectionBoundsMultiple,e.selectionShouldSnap],([e,t,n,r])=>{if(!e||!t&&(!n||n.length===0)){l=[],E();return}let i;i=n&&n.length>0?n:t?[t]:[];let a=new Map;for(let e of l)a.set(e.id,e);l=i.map((e,t)=>{let n=`selection-${t}`,i=a.get(n);return i?(_(i,e),r&&(i.current.x=i.target.x,i.current.y=i.target.y,i.current.width=i.target.width,i.current.height=i.target.height),i):g(n,e)}),E()})),yR(wR(()=>[e.dragVisible,e.dragBounds],([e,t])=>{if(!e||!t){u=null,E();return}u?_(u,t):u=g(`drag`,t),E()})),yR(wR(()=>[e.grabbedBoxes,e.labelInstances],([e,t])=>{let n=e??[],r=t??[],i=new Map;for(let e of n)i.set(e.id,e);let a=new Map;for(let e of d)a.set(e.id,e);for(let e of n)if(!a.has(e.id)){let t=g(e.id,e.bounds,{createdAt:e.createdAt});d.push(t),a.set(e.id,t)}for(let e of d){let t=i.get(e.id);t&&_(e,t.bounds)}let o=new Set;for(let e of r){let t=v(e),n=e.status===`fading`?0:1;for(let r=0;r<t.length;r++){let i=t[r],s=`label-${e.id}-${r}`;o.add(s);let c=a.get(s);if(c)_(c,i,n);else{let e=g(s,i,{opacity:1,targetOpacity:n});d.push(e),a.set(s,e)}}}d=d.filter(e=>e.id.startsWith(`label-`)?o.has(e.id):i.has(e.id)),E()})),TR(()=>{m(),E(),window.addEventListener(`resize`,D);let e=null,t=()=>{Math.max(window.devicePixelRatio||1,2)!==a&&(D(),n())},n=()=>{e&&e.removeEventListener(`change`,t),e=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),e.addEventListener(`change`,t)};n(),ER(()=>{window.removeEventListener(`resize`,D),e&&e.removeEventListener(`change`,t),o!==null&&rI(o)})}),(()=>{var e=cW(),n=t;return typeof n==`function`?xz(n,e):t=e,vR(t=>yz(e,`z-index`,String(ZM))),e})()},fW=Z(`<div style=position:fixed;pointer-events:none;will-change:opacity;contain:strict;transform:translateZ(0)>`),pW=e=>{let t=LM(),n=t?getComputedStyle(t).borderRadius:`0px`,r=()=>t?.getBoundingClientRect()??null,[i,a]=J(r());if(t){let n=()=>a(r());TR(()=>{let e=new ResizeObserver(n);e.observe(t),window.addEventListener(`scroll`,n,{capture:!0,passive:!0}),window.addEventListener(`resize`,n),ER(()=>{e.disconnect(),window.removeEventListener(`scroll`,n,{capture:!0}),window.removeEventListener(`resize`,n)})}),yR(()=>{e.visible&&n()})}let o=()=>{let e=i();return e?`${e.top}px`:`0`},s=()=>{let e=i();return e?`${e.left}px`:`0`},c=()=>{let e=i();return e?`${e.width}px`:`100%`},l=()=>{let e=i();return e?`${e.height}px`:`100%`};return(()=>{var t=fW();return yz(t,`border-radius`,n),yz(t,`z-index`,ZM),yz(t,`transition`,`opacity 125ms ease-out`),yz(t,`box-shadow`,`inset 0 0 50px ${aN}`),vR(n=>{var r=o(),i=s(),a=c(),u=l(),d=+!!e.visible;return r!==n.e&&yz(t,`top`,n.e=r),i!==n.t&&yz(t,`left`,n.t=i),a!==n.a&&yz(t,`width`,n.a=a),u!==n.o&&yz(t,`height`,n.o=u),d!==n.i&&yz(t,`opacity`,n.i=d),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),t})()},mW=(e,t)=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,t)}px`},hW=(e,t)=>{e&&e.focus(t)},gW=e=>{if(e<=0)return 8;let t=e*oN;return Math.round(Math.max(4,Math.min(8,t)))},_W=()=>{let e=LM();if(e){let t=e.getBoundingClientRect();return{width:t.width,height:t.height,offsetLeft:t.left,offsetTop:t.top}}let t=window.visualViewport;return t?{width:t.width,height:t.height,offsetLeft:t.offsetLeft,offsetTop:t.offsetTop}:{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0}},vW=e=>{if(typeof e==`string`||typeof e==`number`)return String(e);if(!e||typeof e!=`object`)return``;if(Array.isArray(e)){let t=``;for(let n of e){if(!n)continue;let e=vW(n);e&&(t=t?`${t} ${e}`:e)}return t}let t=``;for(let n in e)e[n]&&(t=t?`${t} ${n}`:n);return t},yW=(...e)=>{let t=``;for(let n of e){if(!n)continue;let e=vW(n);e&&(t=t?`${t} ${e}`:e)}return t},bW=e=>e.elementsCount&&e.elementsCount>1?{tagName:`${e.elementsCount} elements`,componentName:void 0}:{tagName:e.tagName||e.componentName||`element`,componentName:e.tagName?e.componentName:void 0},xW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M19.2929 12.7071C19.6834 13.0976 20.3166 13.0976 20.7071 12.7071C21.0976 12.3166 21.0976 11.6834 20.7071 11.2929L12.7071 3.29289C12.5196 3.10536 12.2652 3 12 3C11.7348 3 11.4804 3.10536 11.2929 3.29289L3.29289 11.2929C2.90237 11.6834 2.90237 12.3166 3.29289 12.7071C3.68342 13.0976 4.31658 13.0976 4.70711 12.7071L11 6.41421L11 20C11 20.5523 11.4477 21 12 21C12.5523 21 13 20.5523 13 20L13 6.41422L19.2929 12.7071Z">`),SW=e=>{let t=()=>e.size??10;return(()=>{var n=xW();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},CW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path class=icon-loader-bar d="M12 2v4"style=animation-delay:0ms></path><path class=icon-loader-bar d="M15 6.8l2-3.5"style=animation-delay:-42ms></path><path class=icon-loader-bar d="M17.2 9l3.5-2"style=animation-delay:-83ms></path><path class=icon-loader-bar d="M18 12h4"style=animation-delay:-125ms></path><path class=icon-loader-bar d="M17.2 15l3.5 2"style=animation-delay:-167ms></path><path class=icon-loader-bar d="M15 17.2l2 3.5"style=animation-delay:-208ms></path><path class=icon-loader-bar d="M12 18v4"style=animation-delay:-250ms></path><path class=icon-loader-bar d="M9 17.2l-2 3.5"style=animation-delay:-292ms></path><path class=icon-loader-bar d="M6.8 15l-3.5 2"style=animation-delay:-333ms></path><path class=icon-loader-bar d="M2 12h4"style=animation-delay:-375ms></path><path class=icon-loader-bar d="M6.8 9l-3.5-2"style=animation-delay:-417ms></path><path class=icon-loader-bar d="M9 6.8l-2-3.5"style=animation-delay:-458ms>`),wW=e=>{let t=()=>e.size??16;return(()=>{var n=CW();return n.firstChild.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling,vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},TW=Z(`<svg data-react-grab-arrow class="absolute block z-10"><path>`),EW=e=>{let t=()=>e.color??`var(--rg-panel-bg)`,n=()=>e.position===`bottom`,r=()=>gW(e.labelWidth??0),i=()=>r()*2,a=()=>r(),o=()=>{let e=i(),t=a(),r=1*Math.SQRT1_2,o=e/2,s=n()?t:0,c=n()?r:t-r,l=+!!n();return`M0 ${s} L${o-r} ${c} A1 1 0 0 ${l} ${o+r} ${c} L${e} ${s} Z`};return(()=>{var r=TW(),s=r.firstChild;return vR(c=>{var l=i(),u=a(),d=`0 0 ${i()} ${a()}`,f=`calc(${e.leftPercent}% + ${e.leftOffsetPx}px)`,p=n()?`0`:void 0,m=n()?void 0:`0`,h=n()?`translateX(-50%) translateY(calc(-100% + 1px))`:`translateX(-50%) translateY(calc(100% - 1px))`,g=o(),_=t();return l!==c.e&&Q(r,`width`,c.e=l),u!==c.t&&Q(r,`height`,c.t=u),d!==c.a&&Q(r,`viewBox`,c.a=d),f!==c.o&&yz(r,`left`,c.o=f),p!==c.i&&yz(r,`top`,c.i=p),m!==c.n&&yz(r,`bottom`,c.n=m),h!==c.s&&yz(r,`transform`,c.s=h),g!==c.h&&Q(s,`d`,c.h=g),_!==c.r&&Q(s,`fill`,c.r=_),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),r})()},DW=Z(`<span class=text-[var(--rg-text-primary)]>`),OW=Z(`<span class=text-[var(--rg-text-secondary)]>.`),kW=Z(`<span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),AW=Z(`<button type=button>`),jW=Z(`<div>`),MW=e=>{let t=()=>{e.onHoverChange?.(!0)},n=()=>{e.onHoverChange?.(!1)},r=()=>e.componentName?`${e.componentName}.${e.tagName}`:e.tagName,i=()=>(()=>{var t=kW();return $(t,X(oz,{get when(){return e.componentName},get children(){return[(()=>{var t=DW();return $(t,()=>e.componentName),t})(),(()=>{var t=OW();return t.firstChild,$(t,()=>e.tagName,null),t})()]}}),null),$(t,X(oz,{get when(){return!e.componentName},get children(){var t=DW();return $(t,()=>e.tagName),t}}),null),t})();return X(oz,{get when(){return e.isClickable},get fallback(){return(()=>{var r=jW();return gz(r,`click`,e.onClick,!0),r.addEventListener(`mouseleave`,n),r.addEventListener(`mouseenter`,t),$(r,i),vR(()=>hz(r,yW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden`,e.shrink&&`shrink-0`))),r})()},get children(){var a=AW();return gz(a,`click`,e.onClick,!0),a.addEventListener(`mouseleave`,n),a.addEventListener(`mouseenter`,t),$(a,i),vR(t=>{var n=`Open source for ${r()}`,i=yW(`contain-layout flex items-center gap-1 max-w-[280px] overflow-hidden cursor-pointer bg-transparent border-none p-0 m-0 text-left`,e.shrink&&`shrink-0`);return n!==t.e&&Q(a,`aria-label`,t.e=n),i!==t.t&&hz(a,t.t=i),t},{e:void 0,t:void 0}),a}})},fz([`click`]),NW=Z(`<div class="[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-auto h-fit self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased rounded-t-none rounded-b-[6px]">`),PW=e=>(()=>{var t=NW();return $(t,()=>e.children),t})(),FW=(e,t={})=>(n={})=>{let r=t.variants;if(!r)return e;let i=[e];for(let e in r){let a=n[e]??t.defaultVariants?.[e];if(a===void 0)continue;let o=r[e][String(a)];o&&i.push(o)}return yW(...i)},IW=Z(`<div>`),LW=FW(`contain-layout antialiased [font-synthesis:none] bg-[var(--rg-panel-bg)]`,{variants:{shape:{panel:`rounded-[14px] [corner-shape:superellipse(1.25)]`,pill:`rounded-full`}},defaultVariants:{shape:`panel`}}),RW=e=>{let[t,n]=rz(e,[`shape`,`class`]);return(()=>{var e=IW();return bz(e,nz({get class(){return yW(LW({shape:t.shape}),t.class)}},n),!1,!1),e})()},zW=null,BW={claim:e=>{zW=e},release:e=>{zW===e&&(zW=null)},isActive:e=>zW===e},VW=e=>{let t=Symbol(),n=zM(n=>{BW.isActive(t)&&(uB(n)||(n.code===`Enter`?e.onEnter?.(n):n.code===`Escape`&&e.onEscape?.(n)))});return TR(()=>{BW.claim(t),window.addEventListener(`keydown`,n,{capture:!0})}),ER(()=>{BW.release(t),window.removeEventListener(`keydown`,n,{capture:!0})}),{claimFocus:()=>BW.claim(t)}},HW=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M10.7071 21.2071C10.3166 21.5976 9.68342 21.5976 9.29289 21.2071L3.29289 15.2071C2.90237 14.8166 2.90237 14.1834 3.29289 13.7929L9.29289 7.79289C9.68342 7.40237 10.3166 7.40237 10.7071 7.79289C11.0976 8.18342 11.0976 8.81658 10.7071 9.20711L6.41421 13.5H16C16.5523 13.5 17 13.0523 17 12.5V3.5C17 2.94772 17.4477 2.5 18 2.5C18.5523 2.5 19 2.94772 19 3.5V12.5C19 14.1569 17.6569 15.5 16 15.5H6.41421L10.7071 19.7929C11.0976 20.1834 11.0976 20.8166 10.7071 21.2071Z">`),UW=e=>{let t=()=>e.size??10;return(()=>{var n=HW();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},WW=Z(`<button>`),GW=FW(`contain-layout shrink-0 flex items-center justify-center cursor-pointer transition-all press-scale`,{variants:{variant:{chip:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-surface-hover)] [border-width:0.5px] border-solid border-[var(--rg-border-button)] hover:bg-[var(--rg-surface-active)] text-[var(--rg-text-primary)]`,destructive:`px-[3px] py-px h-[17px] rounded-sm bg-[var(--rg-error-bg)] hover:bg-[var(--rg-error-bg-hover)] text-[var(--rg-error-text)]`,ghost:`rounded-sm bg-transparent hover:bg-[var(--rg-surface-hover)] border-none outline-none p-0`}},defaultVariants:{variant:`chip`}}),KW=e=>{let[t,n]=rz(e,[`variant`,`class`,`type`]);return(()=>{var e=WW();return bz(e,nz({get type(){return t.type??`button`},get class(){return yW(GW({variant:t.variant}),t.class)}},n),!1,!1),e})()},qW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),JW=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),YW=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),XW=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),ZW=Z(`<div data-react-grab-discard-prompt class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 shrink-0 font-sans font-medium w-fit h-fit">`),QW=e=>{let t=()=>e.showCancel??!0,{claimFocus:n}=VW({onEnter:t=>{t.preventDefault(),t.stopPropagation();let n=t.composedPath()[0],r=n instanceof HTMLElement?n:null;if(r?.closest(`[data-react-grab-discard-copy]`)){e.onCopy?.();return}if(r?.closest(`[data-react-grab-discard-no]`)){e.onCancel?.();return}if(r?.closest(`[data-react-grab-discard-yes]`)){e.onConfirm?.();return}e.onConfirm?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.cancelOnEscape?e.onCancel?.():e.onConfirm?.()}});return(()=>{var r=ZW(),i=r.firstChild.firstChild;return gz(r,`click`,n,!0),gz(r,`pointerdown`,n,!0),$(i,()=>e.label??`Discard?`),$(r,X(PW,{get children(){var n=XW();return $(n,X(oz,{get when(){return t()},get children(){return X(KW,{"data-react-grab-discard-no":!0,get onClick(){return e.onCancel},get children(){return qW()}})}}),null),$(n,X(oz,{get when(){return e.onCopy},get children(){return X(KW,{"data-react-grab-discard-copy":!0,get onClick(){return e.onCopy},get children(){return JW()}})}}),null),$(n,X(KW,{variant:`destructive`,class:`gap-0.5`,"data-react-grab-discard-yes":!0,get onClick(){return e.onConfirm},get children(){return[YW(),X(UW,{size:10,class:`text-[var(--rg-error-text)] opacity-50`})]}}),null),n}}),null),r})()},fz([`pointerdown`,`click`]),$W=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7 2C4.23858 2 2 4.23858 2 7V15C2 17.7614 4.23858 20 7 20H8C8.55228 20 9 19.5523 9 19C9 18.4477 8.55228 18 8 18H7C5.34315 18 4 16.6569 4 15V7C4 5.34315 5.34315 4 7 4H17C18.6569 4 20 5.34315 20 7V15C20 16.6569 18.6569 18 17 18H14.4142L16.2071 16.2071C16.5976 15.8166 16.5976 15.1834 16.2071 14.7929C15.8166 14.4024 15.1834 14.4024 14.7929 14.7929L11.2929 18.2929C11.197 18.3888 11.1247 18.4993 11.0759 18.6172C11.027 18.7351 11 18.8644 11 19C11 19.2728 11.1093 19.5201 11.2864 19.7005C11.2889 19.7031 11.2914 19.7056 11.2939 19.7081L14.7929 23.2071C15.1834 23.5976 15.8166 23.5976 16.2071 23.2071C16.5976 22.8166 16.5976 22.1834 16.2071 21.7929L14.4142 20H17C19.7614 20 22 17.7614 22 15V7C22 4.23858 19.7614 2 17 2H7Z">`),eG=e=>{let t=()=>e.size??12;return(()=>{var n=$W();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},tG=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Retry`),nG=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Ok`),rG=Z(`<div class="contain-layout shrink-0 flex items-center justify-end gap-[5px] w-full h-fit">`),iG=Z(`<div data-react-grab-error role=alert aria-live=assertive class="contain-layout shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-start gap-1 px-2 w-full h-fit"><span class="text-[var(--rg-error-text)] text-[13px] leading-4 font-sans font-medium overflow-hidden line-clamp-5">`),aG=e=>{let{claimFocus:t}=VW({onEnter:t=>{t.preventDefault(),t.stopPropagation(),e.onRetry?.()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onAcknowledge?.()}}),n=()=>!!(e.onRetry||e.onAcknowledge);return(()=>{var r=iG(),i=r.firstChild,a=i.firstChild;return gz(r,`click`,t,!0),gz(r,`pointerdown`,t,!0),$(a,()=>e.error),$(r,X(oz,{get when(){return n()},get children(){return X(PW,{get children(){var t=rG();return $(t,X(oz,{get when(){return e.onRetry},get children(){return X(KW,{"data-react-grab-retry":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,get onClick(){return e.onRetry},get children(){return[tG(),X(eG,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-text-secondary)]`})]}})}}),null),$(t,X(oz,{get when(){return e.onAcknowledge},get children(){return X(KW,{"data-react-grab-error-ok":!0,class:`gap-1`,"aria-keyshortcuts":`Escape`,get onClick(){return e.onAcknowledge},get children(){return nG()}})}}),null),t}})}}),null),vR(t=>{var r={"pt-1.5 pb-1":n(),"py-1.5":!n()},o=e.error;return t.e=_z(i,r,t.e),o!==t.t&&Q(a,`title`,t.t=o),t},{e:void 0,t:void 0}),r})()},fz([`pointerdown`,`click`]),oG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M7.5 12C7.5 13.3807 6.38071 14.5 5 14.5C3.61929 14.5 2.5 13.3807 2.5 12C2.5 10.6193 3.61929 9.5 5 9.5C6.38071 9.5 7.5 10.6193 7.5 12ZM14.5 12C14.5 13.3807 13.3807 14.5 12 14.5C10.6193 14.5 9.5 13.3807 9.5 12C9.5 10.6193 10.6193 9.5 12 9.5C13.3807 9.5 14.5 10.6193 14.5 12ZM19 14.5C20.3807 14.5 21.5 13.3807 21.5 12C21.5 10.6193 20.3807 9.5 19 9.5C17.6193 9.5 16.5 10.6193 16.5 12C16.5 13.3807 17.6193 14.5 19 14.5Z">`),sG=e=>{let t=()=>e.size??14;return(()=>{var n=oG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},cG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM17.7071 10.7071C18.0976 10.3166 18.0976 9.68342 17.7071 9.29289C17.3166 8.90237 16.6834 8.90237 16.2929 9.29289L11 14.5858L8.70711 12.2929C8.31658 11.9024 7.68342 11.9024 7.29289 12.2929C6.90237 12.6834 6.90237 13.3166 7.29289 13.7071L10.2929 16.7071C10.6834 17.0976 11.3166 17.0976 11.7071 16.7071L17.7071 10.7071Z">`),lG=e=>{let t=()=>e.size??14;return(()=>{var n=cG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},uG=Z(`<button data-react-grab-ignore-events data-react-grab-more-options>`),dG=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Keep`),fG=Z(`<div class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0"></span><div class="contain-layout shrink-0 flex items-center gap-2 h-fit">`),pG=Z(`<div class="contain-layout shrink-0 flex items-center gap-0.5 py-1.5 px-2 w-full h-fit"><span class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap min-w-0">`),mG=e=>(()=>{var t=uG();return gz(t,`click`,t=>{t.stopImmediatePropagation(),e.onClick()}),gz(t,`pointerdown`,e=>{e.stopImmediatePropagation()}),$(t,X(sG,{size:14,class:`opacity-50 group-hover:opacity-100 transition-opacity`})),vR(()=>hz(t,yW(GW({variant:`ghost`}),`group size-4 text-[var(--rg-text-secondary)] hover:text-[var(--rg-text-primary)]`))),t})(),hG=e=>{let t,n,[r,i]=J(!1),[a,o]=J(!1),s=()=>r()?`Copied`:e.statusText,c=()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n),o(!0),e.onFadingChange?.(!0),e.onShowContextMenu?.()},l=()=>{r()||(i(!0),t=window.setTimeout(()=>{o(!0),e.onFadingChange?.(!0),n=window.setTimeout(()=>{e.onDismiss?.()},125)},1375))},{claimFocus:u}=VW({onEnter:e=>{e.preventDefault(),e.stopPropagation(),l()},onEscape:t=>{t.preventDefault(),t.stopPropagation(),e.onDismiss?.()}});return ER(()=>{t!==void 0&&window.clearTimeout(t),n!==void 0&&window.clearTimeout(n)}),X(RW,{shape:`pill`,"data-react-grab-completion":!0,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,class:`shrink-0 flex flex-col justify-center items-end w-fit h-fit max-w-[280px] transition-opacity duration-100 ease-out`,get style(){return{opacity:+!a()}},onPointerDown:u,onClick:u,get children(){return[X(oz,{get when(){return aB(()=>!r())()&&e.onDismiss},get children(){var t=fG(),n=t.firstChild,i=n.nextSibling;return $(n,s),$(i,X(oz,{get when(){return e.onShowContextMenu},get children(){return X(mG,{onClick:c})}}),null),$(i,X(oz,{get when(){return e.onDismiss},get children(){return X(KW,{"data-react-grab-dismiss":!0,class:`gap-1`,"aria-keyshortcuts":`Enter`,onClick:l,get disabled(){return r()},get"aria-disabled"(){return r()},get children(){return[dG(),X(oz,{get when(){return!r()},get children(){return X(UW,{size:10,class:`text-[var(--rg-text-secondary)]`})}})]}})}}),null),t}}),X(oz,{get when(){return r()||!e.onDismiss},get children(){var t=pG(),n=t.firstChild;return $(t,X(lG,{size:14,"aria-hidden":`true`,class:`text-[var(--rg-text-primary-85)] shrink-0`}),n),$(n,s),$(t,X(oz,{get when(){return e.onShowContextMenu},get children(){return X(mG,{onClick:c})}}),null),t}})]}})},gG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 py-1.5 px-2 w-full h-fit"><span class="shimmer-text text-[13px] leading-4 font-sans font-medium h-fit tabular-nums overflow-hidden text-ellipsis whitespace-nowrap">`),_G=Z(`<div class="contain-layout shrink-0 flex flex-col items-start w-fit h-fit"><div class="contain-layout shrink-0 flex items-center gap-1 w-fit h-fit px-2 py-1.5">`),vG=Z(`<button data-react-grab-submit type=button aria-label="Submit context"class="contain-layout shrink-0 flex items-center justify-center size-4 rounded-full bg-[var(--rg-submit-bg)] cursor-pointer ml-1 interactive-scale a11y-hitbox">`),yG=Z(`<div class="shrink-0 flex justify-between items-end w-full min-h-4"><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Add context for selected element"aria-keyshortcuts="Enter Escape"class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none flex-1 p-0 m-0 wrap-break-word overflow-y-auto"placeholder="Add context"rows=1 style=field-sizing:content;min-height:16px;scrollbar-width:none>`),bG=Z(`<div class="contain-layout shrink-0 flex flex-col justify-center items-start w-fit h-fit min-w-[150px] max-w-[280px]"><div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2 max-w-full">`),xG=Z(`<div data-react-grab-ignore-events data-react-grab-selection-label>`),SG={left:LN,top:LN,arrowLeftPercent:50,arrowLeftOffset:0,edgeOffsetX:0},CG=e=>{let t,n,r,i=!1,[a,o]=J(0),[s,c]=J(0),[l,u]=J(0),[d,f]=J(0),[p,m]=J(!1),[h,g]=J(!1),_=()=>e.status!==`copying`&&e.status!==`copied`&&e.status!==`fading`&&e.status!==`error`,v=()=>e.status===`copied`||e.status===`fading`,y=()=>!!e.shouldToggleExpandOnClick&&!!e.onToggleExpand&&_()&&!e.discardPrompt&&!e.isPromptMode,b=()=>!!(e.isPromptMode||e.discardPrompt||y()||v()&&(e.onDismiss||e.onShowContextMenu)||e.status===`error`&&(e.onAcknowledgeError||e.onRetry)),x,S=e=>{i=e},C=()=>{f(e=>e+1)},w=zM(t=>{uB(t)||t.code===`Enter`&&!e.isPromptMode&&!e.discardPrompt&&_()&&(t.preventDefault(),t.stopImmediatePropagation(),e.onToggleExpand?.())});TR(()=>{let r=LM();if(x=new ResizeObserver(e=>{for(let a of e){let e=a.target.getBoundingClientRect();a.target===t&&!i?(o(e.width),c(e.height)):a.target===n?u(e.width):a.target===r&&C()}}),r&&x.observe(r),t){let e=t.getBoundingClientRect();o(e.width),c(e.height),x.observe(t)}n&&(u(n.getBoundingClientRect().width),x.observe(n)),window.addEventListener(`scroll`,C,!0),window.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`resize`,C),window.visualViewport?.addEventListener(`scroll`,C),e.onToggleExpand&&window.addEventListener(`keydown`,w,{capture:!0})}),ER(()=>{x?.disconnect(),window.removeEventListener(`scroll`,C,!0),window.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`resize`,C),window.visualViewport?.removeEventListener(`scroll`,C),window.removeEventListener(`keydown`,w,{capture:!0})});let T=()=>`${e.tagName??``}:${e.componentName??``}`,E=Y(t=>{d();let n=T(),r=n===t.elementIdentity?t:{position:SG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:n},i=e.selectionBounds,o=a(),c=s(),u=o>0&&c>0,f=i&&i.width>0&&i.height>0;if(!u||!f)return{position:r.hadValidBounds?r.position:SG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let p=_W(),m=p.offsetLeft,h=p.offsetTop,g=m+p.width,_=h+p.height;if(!(i.x+i.width>m&&i.x<g&&i.y+i.height>h&&i.y<_))return{position:SG,computedArrowPosition:r.computedArrowPosition,hadValidBounds:r.hadValidBounds,elementIdentity:n};let v=i.x+i.width/2,y=e.mouseX??v,b=i.y+i.height,x=i.y,S=e.hideArrow?0:gW(l()),C=y,w=0,E=b+S+4;if(o>0){let e=C-o/2,t=C+o/2;t>g-8&&(w=g-8-t),e+w<m+8&&(w=m+8-e)}let D=c+S+4,O=E+c<=_-8;O||(E=x-D),E<h+8&&(E=h+8);let k=o/2,ee=k-w,te=Math.min(16,k),A=Math.max(o-16,k),ne=Math.max(te,Math.min(A,ee))-k;return{position:{left:C,top:E,arrowLeftPercent:50,arrowLeftOffset:ne,edgeOffsetX:w},computedArrowPosition:O?`bottom`:`top`,hadValidBounds:!0,elementIdentity:n}},{position:SG,computedArrowPosition:null,hadValidBounds:!1,elementIdentity:``}),D=()=>E().computedArrowPosition??`bottom`,O=()=>E().hadValidBounds;yR(wR(()=>e.selectionLabelShakeCount,()=>g(!0),{defer:!0}));let k=t=>{if(t.isComposing||t.keyCode===229)return;t.stopImmediatePropagation();let n=t.code===`Enter`&&!t.shiftKey,r=t.code===`Escape`;n?(t.preventDefault(),e.onSubmit?.()):r&&(t.preventDefault(),e.onConfirmDismiss?.())},ee=t=>{let n=t.target;n instanceof HTMLTextAreaElement&&(mW(n,95),e.onInputChange?.(n.value))},te=()=>bW({tagName:e.tagName,componentName:e.componentName,elementsCount:e.elementsCount}),A=Y(()=>!(e.error||e.discardPrompt||_()&&e.isPromptMode)),ne=t=>{if(t.stopImmediatePropagation(),e.filePath&&e.onOpen){e.onOpen();return}y()&&e.onToggleExpand?.()},re=t=>{t.stopImmediatePropagation(),_()&&e.isPromptMode&&!e.discardPrompt&&e.onSubmit&&r&&hW(r,{preventScroll:!0})},ie=()=>O()&&(v()||e.status===`error`);return X(oz,{get when(){return aB(()=>e.visible!==!1)()&&(e.selectionBounds||ie())},get children(){var i=xG();i.addEventListener(`mouseleave`,()=>e.onHoverChange?.(!1)),i.addEventListener(`mouseenter`,()=>e.onHoverChange?.(!0)),i.$$click=e=>{e.stopImmediatePropagation()},i.$$pointerdown=re;var a=t;return typeof a==`function`?xz(a,i):t=i,yz(i,`z-index`,`${XM}`),yz(i,`transition`,`opacity 125ms ease-out, filter 125ms ease-out`),$(i,X(oz,{get when(){return!e.hideArrow},get children(){return X(EW,{get position(){return D()},get leftPercent(){return E().position.arrowLeftPercent},get leftOffsetPx(){return E().position.arrowLeftOffset},get labelWidth(){return l()}})}}),null),$(i,X(oz,{get when(){return aB(()=>!!v())()&&!e.error},get children(){return X(hG,{get statusText(){return e.statusText??`Copied`},get onDismiss(){return e.onDismiss},onFadingChange:m,get onShowContextMenu(){return e.onShowContextMenu}})}}),null),$(i,X(RW,{ref:e=>n=e,get shape(){return A()?`pill`:`panel`},get class(){return yW(`flex items-center gap-[5px] w-fit h-fit p-0`,h()&&`animate-shake`)},get style(){return{display:v()&&!e.error?`none`:void 0}},onAnimationEnd:()=>g(!1),get children(){return[X(oz,{get when(){return e.status===`copying`},get children(){var t=gG(),n=t.firstChild,r=n.firstChild;return $(n,X(wW,{size:13,class:`text-[var(--rg-text-secondary)] shrink-0`}),r),$(r,()=>e.statusText??`Grabbing…`),t}}),X(oz,{get when(){return aB(()=>!!(_()&&!e.isPromptMode))()&&!e.discardPrompt},get children(){var t=_G(),n=t.firstChild;return $(n,X(MW,{get tagName(){return te().tagName},get componentName(){return te().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S,shrink:!0})),t}}),X(oz,{get when(){return aB(()=>!!(_()&&e.isPromptMode))()&&!e.discardPrompt},get children(){var t=bG(),n=t.firstChild;return $(n,X(MW,{get tagName(){return te().tagName},get componentName(){return te().componentName},get isClickable(){return!!(e.filePath&&e.onOpen)},onClick:ne,onHoverChange:S})),$(t,X(PW,{get children(){var t=yG(),n=t.firstChild;return n.$$keydown=k,n.$$input=ee,xz(t=>{r=t,e.onSubmit&&queueMicrotask(()=>{hW(t,{preventScroll:!0}),mW(t,95)})},n),yz(n,`max-height`,`95px`),$(t,X(oz,{get when(){return e.onSubmit},get children(){var t=vG();return t.$$click=()=>e.onSubmit?.(),$(t,X(SW,{size:10,"aria-hidden":`true`,class:`text-[var(--rg-submit-fg)]`})),t}}),null),vR(()=>n.readOnly=!e.onSubmit),vR(()=>n.value=e.inputValue??``),t}}),null),t}}),X(oz,{get when(){return e.discardPrompt},keyed:!0,children:e=>X(QW,{get label(){return aB(()=>!!e.isKeyboardSelection)()?`Discard selection?`:e.label},get showCancel(){return!e.isKeyboardSelection},get cancelOnEscape(){return e.cancelOnEscape},get onConfirm(){return e.onConfirm},get onCopy(){return e.onCopy},onCancel:()=>{e.isKeyboardSelection||e.onCancel?.(),hW(r,{preventScroll:!0})}})}),X(oz,{get when(){return e.error},get children(){return X(aG,{get error(){return e.error},get onAcknowledge(){return e.onAcknowledgeError},get onRetry(){return e.onRetry}})}})]}}),null),vR(t=>{var n=yW(`fixed font-sans text-[13px] antialiased select-none ease-out`),r=`${E().position.top}px`,a=`${E().position.left}px`,o=`translateX(calc(-50% + ${E().position.edgeOffsetX}px))`,s=b()?`auto`:`none`,c=e.status===`fading`||p()?0:1,l=`drop-shadow(${HM}) blur(${e.status===`fading`||p()?`3px`:`0`})`;return n!==t.e&&hz(i,t.e=n),r!==t.t&&yz(i,`top`,t.t=r),a!==t.a&&yz(i,`left`,t.a=a),o!==t.o&&yz(i,`transform`,t.o=o),s!==t.i&&yz(i,`pointer-events`,t.i=s),c!==t.n&&yz(i,`opacity`,t.n=c),l!==t.s&&yz(i,`filter`,t.s=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),i}})},fz([`pointerdown`,`click`,`input`,`keydown`]),wG=Z(`<span style="transition-property:transform;transition-timing-function:cubic-bezier(0.32, 0.72, 0, 1)"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M20.8977 4.02356L21.8277 4.39121C22.3784 2.99813 21.0382 1.60206 19.6238 2.09546L3.47334 7.72936C1.38661 8.45728 1.49021 11.443 3.6224 12.0245L10.1289 13.799L11.2331 19.8724C11.638 22.0991 14.7072 22.4019 15.5393 20.2972L21.8277 4.39121L20.8977 4.02356Z">`),TG=e=>{let t=()=>e.size??14,n=()=>e.rotationDeg??0;return(()=>{var r=wG(),i=r.firstChild;return yz(r,`transition-duration`,`180ms`),vR(a=>{var o=yW(`inline-flex items-center justify-center will-change-transform`,e.class),s=`rotate(${n()}deg)`,c=t(),l=t();return o!==a.e&&hz(r,a.e=o),s!==a.t&&yz(r,`transform`,a.t=s),c!==a.a&&Q(i,`width`,a.a=c),l!==a.o&&Q(i,`height`,a.o=l),a},{e:void 0,t:void 0,a:void 0,o:void 0}),r})()},EG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 12 12"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M1 6C1 3.239 3.239 1 6 1C8.761 1 11 3.239 11 6C11 8.761 8.761 11 6 11C5.103 11 4.261 10.764 3.532 10.35C2.959 10.759 2.257 11 1.5 11C1.376 11 1.253 10.993 1.132 10.981C0.923 10.959 0.75 10.809 0.699 10.605C0.648 10.402 0.729 10.188 0.903 10.07C1.347 9.768 1.688 9.328 1.865 8.812C1.319 8.011 1 7.042 1 6Z">`),DG=e=>{let t=()=>e.size??14;return(()=>{var n=EG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},OG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 13.867 20.345 14.992 18.77 14.992H16.029C14.739 14.992 13.823 16.248 14.218 17.476L14.48 18.295C14.751 19.139 14.643 20.041 14.211 20.751C13.769 21.479 12.985 22 12 22C6.477 22 2 17.523 2 12ZM12.21 6.783C12.416 7.585 11.933 8.403 11.131 8.609C10.328 8.815 9.511 8.332 9.305 7.529C9.099 6.727 9.582 5.909 10.384 5.703C11.187 5.497 12.004 5.981 12.21 6.783ZM7.59 9.207C8.388 9.43 8.853 10.258 8.63 11.055C8.407 11.853 7.579 12.319 6.782 12.096C5.984 11.873 5.518 11.045 5.741 10.247C5.964 9.449 6.792 8.983 7.59 9.207ZM9.497 14.446C8.918 13.854 7.968 13.844 7.376 14.423C6.784 15.002 6.773 15.952 7.353 16.544C7.932 17.136 8.882 17.147 9.474 16.567C10.066 15.988 10.076 15.039 9.497 14.446ZM16.624 9.575C16.032 10.155 15.082 10.144 14.503 9.552C13.923 8.96 13.934 8.01 14.526 7.431C15.118 6.852 16.068 6.862 16.647 7.454C17.226 8.046 17.216 8.996 16.624 9.575Z">`),kG=e=>{let t=()=>e.size??14;return(()=>{var n=OG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},AG=Z(`<div>`),jG=0,MG=()=>Date.now()-jG<800,NG=e=>{let[t,n]=J(!1),[r,i]=J(!0),a;yR(wR(()=>e.visible,e=>{a!==void 0&&(clearTimeout(a),a=void 0),e?MG()?(i(!1),n(!0)):(i(!0),a=setTimeout(()=>{n(!0)},400)):(t()&&(jG=Date.now()),n(!1))})),ER(()=>{a!==void 0&&clearTimeout(a),t()&&(jG=Date.now())});let o=()=>e.position===`top`||e.position===`bottom`?{left:`50%`,translate:`-50%`,"z-index":`${XM}`}:{top:`50%`,translate:`0 -50%`,"z-index":`${XM}`};return X(oz,{get when(){return t()},get children(){var t=AG();return $(t,()=>e.children),vR(n=>{var i=yW(`absolute whitespace-nowrap px-2 py-0.5 rounded-full text-[10px] font-sans font-medium leading-4 pointer-events-none`,`bg-[var(--rg-panel-bg)] text-[var(--rg-text-primary)] [box-shadow:var(--rg-shadow)]`,e.position===`top`&&`bottom-full mb-2.5`,e.position===`bottom`&&`top-full mt-2.5`,e.position===`left`&&`right-full mr-2.5`,e.position===`right`&&`left-full ml-2.5`,r()&&`animate-tooltip-fade-in`),a=o();return i!==n.e&&hz(t,n.e=i),n.t=vz(t,a,n.t),n},{e:void 0,t:void 0}),t}})},PG=Z(`<div><button data-react-grab-ignore-events type=button>`),FG=e=>(()=>{var t=PG(),n=t.firstChild;gz(n,`mouseleave`,e.onMouseLeave),gz(n,`mouseenter`,e.onMouseEnter),gz(n,`contextmenu`,t=>e.onContextMenu?.(t)),gz(n,`click`,e.onClick,!0);var r=e.ref;return typeof r==`function`?xz(r,n):e.ref=n,$(n,()=>e.icon),$(t,X(oz,{get when(){return e.tooltip},get children(){return X(NG,{get visible(){return!!e.tooltipVisible},get position(){return e.tooltipPosition??`top`},get children(){return e.tooltip}})}}),null),vR(r=>{var i=e.wrapperClass,a=e.isToggle?``:void 0,o=e.actionId,s=e.label,c=!!e.isActive,l=e.class;return i!==r.e&&hz(t,r.e=i),a!==r.t&&Q(n,`data-react-grab-toolbar-toggle`,r.t=a),o!==r.a&&Q(n,`data-react-grab-toolbar-action`,r.a=o),s!==r.o&&Q(n,`aria-label`,r.o=s),c!==r.i&&Q(n,`aria-pressed`,r.i=c),l!==r.n&&hz(n,r.n=l),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})(),fz([`click`]),IG=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M9.29289 16.7071C8.90237 16.3166 8.90237 15.6834 9.29289 15.2929L12.5858 12L9.29289 8.70711C8.90237 8.31658 8.90237 7.68342 9.29289 7.29289C9.68342 6.90237 10.3166 6.90237 10.7071 7.29289L14.7071 11.2929C14.8946 11.4804 15 11.7348 15 12C15 12.2652 14.8946 12.5196 14.7071 12.7071L10.7071 16.7071C10.3166 17.0976 9.68342 17.0976 9.29289 16.7071Z">`),LG=e=>{let t=()=>e.size??14;return(()=>{var n=IG();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},RG=Z(`<button data-react-grab-ignore-events data-react-grab-toolbar-collapse type=button class="group contain-layout shrink-0 flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox">`),zG=Z(`<div data-react-grab-toolbar-panel><div><div><div>`),BG=e=>{let t=()=>e.snapEdge??`bottom`,n=()=>t()===`left`||t()===`right`,r=()=>e.isCollapsed?`duration-140`:`duration-220`,i=()=>n()?`transition-[grid-template-rows] ${r()} ease-drawer`:`transition-[grid-template-columns] ${r()} ease-drawer`,a=()=>n()?`min-h-0`:`min-w-0`,o=()=>e.isCollapsed?`${{top:`rounded-t-none rounded-b-[10px]`,bottom:`rounded-b-none rounded-t-[10px]`,left:`rounded-l-none rounded-r-[10px]`,right:`rounded-r-none rounded-l-[10px]`}[t()]} ${n()?`px-0.25 py-2`:`px-2 py-0.25`}`:``,s=()=>{let n=e.isCollapsed;switch(t()){case`top`:return n?`rotate-90`:`-rotate-90`;case`bottom`:return n?`-rotate-90`:`rotate-90`;case`left`:return n?`rotate-0`:`rotate-180`;case`right`:return n?`rotate-180`:`rotate-0`;default:return`-rotate-90`}},c=()=>{if(e.isChevronPressed)return n()?`scale(0.97, 1)`:`scale(1, 0.97)`},l=()=>(()=>{var t=RG();return gz(t,`pointercancel`,e.onCollapsePointerLeave),gz(t,`pointerleave`,e.onCollapsePointerLeave),gz(t,`pointerup`,e.onCollapsePointerUp,!0),gz(t,`pointerdown`,e.onCollapsePointerDown),gz(t,`click`,e.onCollapseClick,!0),$(t,X(LG,{size:18,get class(){return yW(`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)] transition-[transform,color] duration-150 ease-drawer -m-0.5`,s())}})),vR(n=>{var r=e.isCollapsed?`Expand toolbar`:`Collapse toolbar`,i=!e.isCollapsed;return r!==n.e&&Q(t,`aria-label`,n.e=r),i!==n.t&&Q(t,`aria-expanded`,n.t=i),n},{e:void 0,t:void 0}),t})(),u=()=>e.isChevronPressed?`transition-[padding,border-radius,transform] duration-60 ease-[cubic-bezier(0,0,0.2,1)]`:`transition-[padding,border-radius,transform] ${r()} ease-drawer`;return(()=>{var t=zG(),r=t.firstChild,s=r.firstChild,d=s.firstChild;return gz(t,`click`,e.onPanelClick,!0),gz(t,`animationend`,e.onAnimationEnd),$(d,()=>e.actionButtons),$(t,l,null),vR(l=>{var f=yW(`flex items-center justify-center rounded-[13px] antialiased relative overflow-visible [font-synthesis:none]`,u(),n()&&`flex-col`,`bg-[var(--rg-panel-bg)] [box-shadow:var(--rg-shadow)]`,!e.isCollapsed&&(n()?`px-1.5 gap-0 py-2`:`py-1.5 gap-0 px-2`),o(),e.isShaking&&(n()?`animate-shake-vertical`:`animate-shake`)),p=e.transformOrigin,m=c(),h=yW(`grid relative overflow-visible`,i(),e.isCollapsed?n()?`grid-rows-[0fr] pointer-events-none`:`grid-cols-[0fr] pointer-events-none`:n()?`grid-rows-[1fr]`:`grid-cols-[1fr]`),g=yW(`flex`,n()?`flex-col items-center min-h-0`:`items-center min-w-0`,e.isCollapsed?`opacity-0`:`opacity-100`,e.isCollapsed?`transition-opacity duration-100 ease-drawer`:`transition-opacity duration-180 ease-drawer delay-[80ms]`),_=yW(`relative overflow-visible flex`,n()?`flex-col items-center`:`items-center`,a());return f!==l.e&&hz(t,l.e=f),p!==l.t&&yz(t,`transform-origin`,l.t=p),m!==l.a&&yz(t,`transform`,l.a=m),h!==l.o&&hz(r,l.o=h),g!==l.i&&hz(s,l.i=g),_!==l.n&&hz(d,l.n=_),l},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()},fz([`click`,`pointerup`]),VG=e=>e===`top`||e===`bottom`,HG=e=>{let t=VG(e);return{width:t?30:16,height:t?16:30}},UG=(e,t,n,r)=>{let i=_W(),a=i.width,o=i.height,s=i.offsetLeft+16,c=Math.max(s,i.offsetLeft+a-n-16),l=i.offsetTop+16,u=Math.max(l,i.offsetTop+o-r-16);if(e===`top`||e===`bottom`){let r=Math.max(0,a-n-32);return{x:Math.min(c,Math.max(s,i.offsetLeft+16+r*t)),y:e===`top`?l:u}}let d=Math.max(0,o-r-32),f=Math.min(u,Math.max(l,i.offsetTop+16+d*t));return{x:e===`left`?s:c,y:f}},WG=(e,t,n,r,i)=>{let a=_W(),o=a.width,s=a.height;if(e===`top`||e===`bottom`){let e=o-r-32;return e<=0?gN:Math.max(0,Math.min(1,(t-a.offsetLeft-16)/e))}let c=s-i-32;return c<=0?gN:Math.max(0,Math.min(1,(n-a.offsetTop-16)/c))},GG=(e,t,n,r,i)=>{let a=_W(),o=a.width,s=a.height,{width:c,height:l}=n,u;if(t===`top`||t===`bottom`){let n=(c-r)/2;u={x:MB(e.x-n,a.offsetLeft+16,a.offsetLeft+o-c-16),y:t===`top`?a.offsetTop+16:a.offsetTop+s-l-16}}else{let n=(l-i)/2,r=MB(e.y-n,a.offsetTop+16,a.offsetTop+s-l-16);u={x:t===`left`?a.offsetLeft+16:a.offsetLeft+o-c-16,y:r}}let d=WG(t,u.x,u.y,c,l);return{position:u,ratio:d}},KG=(e,t,n,r)=>{let i=_W(),{width:a,height:o}=n,{width:s,height:c}=r;switch(e){case`top`:case`bottom`:{let n=(a-s)/2;return{x:MB(t.x+n,i.offsetLeft,i.offsetLeft+i.width-s),y:e===`top`?i.offsetTop:i.offsetTop+i.height-c}}case`left`:case`right`:{let n=(o-c)/2,r=MB(t.y+n,i.offsetTop,i.offsetTop+i.height-c);return{x:e===`left`?i.offsetLeft:i.offsetLeft+i.width-s,y:r}}}},qG=(e,t,n,r,i,a)=>{let o=_W(),s=o.width,c=o.height,l=e+i*150,u=t+a*150,d=u-o.offsetTop+r/2,f=o.offsetTop+c-u-r/2,p=l-o.offsetLeft+n/2,m=o.offsetLeft+s-l-n/2,h=Math.min(d,f,p,m),g=e=>MB(e,o.offsetLeft+16,o.offsetLeft+s-n-16),_=e=>MB(e,o.offsetTop+16,o.offsetTop+c-r-16);return h===d?{edge:`top`,x:g(l),y:o.offsetTop+16}:h===p?{edge:`left`,x:o.offsetLeft+16,y:_(u)}:h===m?{edge:`right`,x:o.offsetLeft+s-n-16,y:_(u)}:{edge:`bottom`,x:g(l),y:o.offsetTop+c-r-16}},JG=e=>{let[t,n]=J(!1),[r,i]=J(!1),[a,o]=J(!1),[s,c]=J({x:0,y:0}),l={x:0,y:0},u={x:0,y:0,time:0},d={x:0,y:0},f=!1,p,m=null,h=()=>{m?.abort(),m=null},g=t=>{if(!a()){if(Math.hypot(t.clientX-d.x,t.clientY-d.y)<=5)return;o(!0),e.onDragStart()}let n=performance.now(),r=n-u.time;r>0&&c({x:(t.clientX-u.x)/r,y:(t.clientY-u.y)/r}),u={x:t.clientX,y:t.clientY,time:n};let i=t.clientX-l.x,s=t.clientY-l.y;e.onPositionUpdate({x:i,y:s})},_=()=>{h();let t=a();if(n(!1),!t)return;f=!0;let r=e.getContainerRef(),o=r?.getBoundingClientRect();if(!o)return;let c=s(),l=qG(o.left,o.top,o.width,o.height,c.x,c.y),u=WG(l.edge,l.x,l.y,o.width,o.height);e.onSnapEdgeChange(l.edge,u),i(!0),nI(()=>{let t=r?.getBoundingClientRect(),n=t?{width:t.width,height:t.height}:e.getExpandedDimensions();nI(()=>{let t=UG(l.edge,u,n.width,n.height);e.onSnapComplete({edge:l.edge,ratio:u,position:t,expandedDimensions:n}),p=setTimeout(()=>{i(!1),e.onSnapAnimationEnd?.()},300)})})},v=zM(t=>{if(t.button!==0||e.isCollapsed())return;let r=e.getContainerRef()?.getBoundingClientRect();if(!r)return;d={x:t.clientX,y:t.clientY},l={x:t.clientX-r.left,y:t.clientY-r.top},n(!0),o(!1),c({x:0,y:0}),u={x:t.clientX,y:t.clientY,time:performance.now()},h(),m=new AbortController;let{signal:i}=m;window.addEventListener(`pointermove`,g,{signal:i}),window.addEventListener(`pointerup`,_,{signal:i}),window.addEventListener(`pointercancel`,_,{signal:i})});return ER(()=>{h(),clearTimeout(p)}),{isDragging:t,isSnapping:r,handlePointerDown:v,createDragAwareHandler:e=>t=>{if(t.stopImmediatePropagation(),f){f=!1;return}e()}}},YG=(e,t)=>{let n=t-e;return e+(n-Math.round(n/360)*360)},XG=Z(`<div data-react-grab-ignore-events data-react-grab-toolbar>`),ZG=e=>{let t,n,r=null,i=zV(),[a,o]=J(!1),[s,c]=J(!1),[l,u]=J(!1),[d,f]=J(i?.edge??`bottom`),[p,m]=J(i?.ratio??.5),[h,g]=J({x:0,y:0}),[_,v]=J(!1),[y,b]=J(!1),[x,S]=J(!1),[C,w]=J(!1),[T,E]=J(0),[D,O]=J(null),k=()=>{r?.(),r=null,e.isActive||IL()},ee=JG({getContainerRef:()=>t,isCollapsed:s,getExpandedDimensions:()=>ce,onDragStart:()=>{O(null),r&&k()},onPositionUpdate:e=>g(e),onSnapEdgeChange:(e,t)=>{de(d(),e),f(e),m(t)},onSnapComplete:e=>{ce=e.expandedDimensions,g(e.position),Ae({edge:e.edge,ratio:e.ratio,collapsed:s(),enabled:!s()})}}),te=()=>d()===`left`||d()===`right`,A=()=>te()?`mb-1.5`:`mr-1.5`,ne=t=>e.activeActionId===t,re=()=>!!e.isActive&&(e.activeActionId??`copy`)===`copy`,ie=t=>D()===t&&!e.isActive&&!s()&&!ee.isDragging()&&!ee.isSnapping()&&!e.isContextMenuOpen,ae=()=>{switch(d()){case`top`:return`bottom`;case`bottom`:return`top`;case`left`:return`right`;case`right`:return`left`;default:return`top`}},oe=e=>{e.stopImmediatePropagation()},se=(t,n)=>({onMouseEnter:e=>{ee.isDragging()||(O(t),n?.shouldFreezeInteractions!==!1&&!r&&(r=fR(),FL(e.clientX,e.clientY)),n?.onHoverChange?.(!0))},onMouseLeave:()=>{O(e=>e===t?null:e),n?.shouldFreezeInteractions!==!1&&!e.isActive&&!e.isContextMenuOpen&&k(),n?.onHoverChange?.(!1)}});yR(wR(()=>e.shakeCount,t=>{t&&!e.enabled&&v(!0)})),yR(wR(()=>[e.isActive,e.isContextMenuOpen],([e,t])=>{!e&&!t&&r&&(r(),r=null)})),yR(wR(()=>re(),e=>{if(!e){E(e=>YG(e,0));return}let t=zM(e=>{if(!n)return;let t=n.getBoundingClientRect(),r=t.left+t.width/2,i=t.top+t.height/2,a=e.clientX-r,o=e.clientY-i;if(Math.hypot(a,o)<4)return;let s=Math.atan2(o,a)*180/Math.PI- -45;E(e=>YG(e,s))});window.addEventListener(`pointermove`,t,{passive:!0}),ER(()=>{window.removeEventListener(`pointermove`,t)})}));let ce={width:78,height:28},[le,ue]=J(HG(d())),de=(e,t)=>{VG(e)!==VG(t)&&ue(HG(t))},fe=(e,n)=>{let r=t?.getBoundingClientRect(),i=HG(n);return GG(e,n,ce,r?.width??i.width,r?.height??i.height)},pe=()=>{g(UG(d(),p(),ce.width,ce.height))},me=ee.createDragAwareHandler(()=>e.onToggle?.()),he=ee.createDragAwareHandler(()=>e.onActivateAction?.(vN)),ge=ee.createDragAwareHandler(()=>e.onActivateAction?.(yN)),_e=`group contain-layout flex items-center justify-center cursor-pointer interactive-scale a11y-hitbox`,ve=()=>yW(`relative contain-layout flex items-center justify-center`,A()),ye=e=>e?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)] group-hover:text-[var(--rg-text-primary)]`,be=ee.createDragAwareHandler(()=>{let e=t?.getBoundingClientRect(),n=s(),r=p();if(n){let{position:e,ratio:t}=fe(je(),d());r=t,g(e),m(r)}else e&&(ce={width:e.width,height:e.height});b(!0),c(e=>!e),Ae({edge:d(),ratio:r,collapsed:!n,enabled:n}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}),xe=()=>KG(d(),h(),ce,le()),Se,Ce,we=null,Te=()=>{let e=t?.getBoundingClientRect();!e||e.width===0||e.height===0||(s()?ue({width:e.width,height:e.height}):(ce={width:e.width,height:e.height},we={width:e.width,height:e.height}))},Ee=(e,t)=>{if(!(e===0||t===0)&&!(ee.isDragging()||ee.isSnapping())&&!y()){if(s()){let n=le();if(n.width===e&&n.height===t)return;ue({width:e,height:t});return}we&&we.width===e&&we.height===t||(we={width:e,height:t},ce={width:e,height:t},g(UG(d(),p(),e,t)))}},De=null,Oe=()=>{ee.isDragging()||ee.isSnapping()||De===null&&(De=nI(()=>{De=null,pe()}))},ke=()=>{ee.isDragging()||(u(!0),pe(),Se&&clearTimeout(Se),Se=setTimeout(()=>{u(!1);let e=WG(d(),h().x,h().y,ce.width,ce.height);m(e),Ae({edge:d(),ratio:e,collapsed:s(),enabled:!s()})},500))},Ae=t=>{BV(t),e.onStateChange?.(t)};TR(()=>{t&&e.onContainerRef?.(t);let n=t?.getBoundingClientRect(),r=_W(),a=!!(n&&n.width>0&&n.height>0);i?(a&&n&&(ce={width:n.width,height:n.height}),c(i.collapsed),g(UG(i.edge,i.ratio,ce.width,ce.height))):a&&n?(ce={width:n.width,height:n.height},g({x:r.offsetLeft+(r.width-n.width)/2,y:r.offsetTop+r.height-n.height-16}),m(gN)):(g(UG(`bottom`,gN,ce.width,ce.height)),m(gN)),e.onSubscribeToStateChanges&&ER(e.onSubscribeToStateChanges(e=>{if(y()||!t?.getBoundingClientRect())return;let n=s()!==e.collapsed;if(de(d(),e.edge),f(e.edge),n&&!e.collapsed){let t=je();b(!0),c(e.collapsed);let{position:n,ratio:r}=fe(t,e.edge);g(n),m(r),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}else n&&(b(!0),clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)),c(e.collapsed),g(UG(e.edge,e.ratio,ce.width,ce.height)),m(e.ratio)})),window.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`resize`,ke),window.visualViewport?.addEventListener(`scroll`,ke);let l=LM();if(l&&(window.addEventListener(`scroll`,Oe,{passive:!0,capture:!0}),typeof ResizeObserver<`u`)){let e=new ResizeObserver(Oe);e.observe(l),ER(()=>e.disconnect())}if(typeof ResizeObserver<`u`&&t){let e=new ResizeObserver(e=>{let n=e[0];if(!n)return;let r=n.borderBoxSize?.[0],i,a;if(r)i=r.inlineSize,a=r.blockSize;else{let e=t?.getBoundingClientRect();if(!e)return;i=e.width,a=e.height}Ee(i,a)});e.observe(t),ER(()=>e.disconnect())}let u=setTimeout(()=>{o(!0)},500);ER(()=>{clearTimeout(u)})}),ER(()=>{window.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`resize`,ke),window.visualViewport?.removeEventListener(`scroll`,ke),window.removeEventListener(`scroll`,Oe,{capture:!0}),De!==null&&rI(De),clearTimeout(Se),clearTimeout(Ce),r&&k()});let je=()=>s()?xe():h(),Me=()=>s()?`cursor-pointer`:ee.isDragging()?`cursor-grabbing`:`cursor-grab`,Ne=()=>C()||!!e.isContextMenuOpen||ee.isDragging()||ee.isSnapping()||y()||x(),Pe=()=>!!e.isActive&&!Ne(),Fe=()=>l()||ee.isDragging()?``:ee.isSnapping()?`transition-[transform,opacity] duration-300 ease-out`:y()?`transition-[transform,opacity] ${s()?`duration-140`:`duration-220`} ease-drawer`:`transition-[transform,opacity] duration-400 ease-drawer`,Ie=()=>{switch(d()){case`top`:return`center top`;case`bottom`:return`center bottom`;case`left`:return`left center`;case`right`:return`right center`;default:return`center center`}};return(()=>{var r=XG();r.addEventListener(`mouseleave`,()=>{w(!1),e.onSelectHoverChange?.(!1)}),r.addEventListener(`mouseenter`,()=>{w(!0),s()||e.onSelectHoverChange?.(!0)}),gz(r,`mousedown`,oe),gz(r,`pointerdown`,e=>{oe(e),ee.handlePointerDown(e)});var i=t;return typeof i==`function`?xz(i,r):t=r,$(r,X(BG,{get isCollapsed(){return s()},get snapEdge(){return d()},get isShaking(){return _()},get isChevronPressed(){return x()},get transformOrigin(){return Ie()},onAnimationEnd:()=>v(!1),onCollapseClick:be,onCollapsePointerDown:()=>S(!0),onCollapsePointerUp:()=>S(!1),onCollapsePointerLeave:()=>S(!1),onPanelClick:e=>{if(s()){e.stopPropagation();let{position:t,ratio:n}=fe(je(),d());g(t),m(n),b(!0),c(!1),Ae({edge:d(),ratio:n,collapsed:!1,enabled:!0}),Ce&&clearTimeout(Ce),Ce=setTimeout(()=>{b(!1),Te()},260)}},get actionButtons(){return[X(FG,nz({actionId:_N,isToggle:!0,ref:e=>n=e,get label(){return re()?`Stop selecting element`:`Copy element`},get isActive(){return re()},class:_e,get wrapperClass(){return ve()},onClick:me,onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),O(null),e.onToggleToolbarMenu?.()}},()=>se(_N),{get icon(){return X(TG,{size:14,get rotationDeg(){return T()},get class(){return ye(re())}})},get tooltipVisible(){return ie(_N)},get tooltipPosition(){return ae()},tooltip:`Copy`})),X(FG,nz({actionId:vN,label:`Comment on element`,get isActive(){return ne(vN)},class:_e,get wrapperClass(){return ve()},onClick:he},()=>se(vN),{get icon(){return X(DG,{size:14,get class(){return ye(ne(vN))}})},get tooltipVisible(){return ie(vN)},get tooltipPosition(){return ae()},tooltip:`Comment`})),X(FG,nz({actionId:yN,label:`Style element`,get isActive(){return ne(yN)},class:_e,get wrapperClass(){return ve()},onClick:ge},()=>se(yN),{get icon(){return X(kG,{size:14,get class(){return ye(ne(yN))}})},get tooltipVisible(){return ie(yN)},get tooltipPosition(){return ae()},tooltip:`Style`}))]}})),vR(e=>{var t=yW(`fixed left-0 top-0 font-sans text-[13px] antialiased select-none`,Me(),Fe(),a()?`pointer-events-auto`:`pointer-events-none`),n=String(XM),i=`translate(${je().x}px, ${je().y}px) scale(${Pe()?.97:1})`,o=Ie(),s=a()?Pe()?.55:1:0;return t!==e.e&&hz(r,e.e=t),n!==e.t&&yz(r,`z-index`,e.t=n),i!==e.a&&yz(r,`transform`,e.a=i),o!==e.o&&yz(r,`transform-origin`,e.o=o),s!==e.i&&yz(r,`opacity`,e.i=s),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r})()},QG=kR(),$G=()=>{let e=AR(QG);if(!e)throw Error(`Menu subcomponents must be rendered inside <Menu.Provider>`);return e},eK=e=>X(QG.Provider,{get value(){return e.store},get children(){return e.children}}),tK=e=>X(RW,{get class(){return yW(`flex flex-col w-fit h-fit`,e.class)},get style(){return e.style},get children(){return e.children}}),nK=Z(`<div role=menu aria-orientation=vertical><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),rK=e=>{let t=$G();return(()=>{var n=nK(),r=n.firstChild;n.$$pointermove=()=>t.notePointerMove(),xz(n=>{t.setHighlightContainer(n),e.ref?.(n)},n);var i=t.setHighlightRail;return typeof i==`function`?xz(i,r):t.setHighlightRail=r,$(n,()=>e.children,null),vR(r=>{var i=e.label,a=t.keyboardNavigation?t.activeDescendantId():void 0,o=t.keyboardNavigation?-1:void 0,s=yW(`relative flex flex-col`,e.class);return i!==r.e&&Q(n,`aria-label`,r.e=i),a!==r.t&&Q(n,`aria-activedescendant`,r.t=a),o!==r.a&&Q(n,`tabindex`,r.a=o),s!==r.o&&hz(n,r.o=s),r},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()},fz([`pointermove`]),iK=Z(`<button data-react-grab-ignore-events type=button>`),aK=e=>{let t=$G(),n=t.createItemId(),r=e.value,i=()=>e.role??`menuitem`,a=()=>!e.disabled,o=()=>t.activeValue()===r,s;return TR(()=>{s&&(t.registerItem({value:r,domId:n,element:s,isEnabled:a,onSelect:()=>e.onSelect?.()}),ER(()=>t.unregisterItem(r)))}),(()=>{var c=iK();c.$$click=t=>{t.stopPropagation(),a()&&e.onSelect?.()},c.addEventListener(`pointerleave`,()=>{t.clearActiveOnPointerLeave&&t.setActiveItem(null)}),c.addEventListener(`pointerenter`,()=>{a()&&t.canActivateOnHover()&&t.setActiveItem(r)}),c.$$pointerdown=e=>e.stopPropagation();var l=s;return typeof l==`function`?xz(l,c):s=c,Q(c,`id`,n),$(c,()=>e.children),vR(n=>{var a=e.dataId??r,s=i(),l=i()===`menuitemradio`?!!e.checked:void 0,u=!!e.disabled,d=t.keyboardNavigation?o()?0:-1:void 0,f=e.disabled,p=yW(`relative z-1 contain-layout flex items-center justify-between w-full px-2 py-1 cursor-pointer text-left border-none bg-transparent disabled:opacity-40 disabled:cursor-default`,e.class);return a!==n.e&&Q(c,`data-react-grab-menu-item`,n.e=a),s!==n.t&&Q(c,`role`,n.t=s),l!==n.a&&Q(c,`aria-checked`,n.a=l),u!==n.o&&Q(c,`aria-disabled`,n.o=u),d!==n.i&&Q(c,`tabindex`,n.i=d),f!==n.n&&(c.disabled=n.n=f),p!==n.s&&hz(c,n.s=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),c})()},fz([`pointerdown`,`click`]),oK=Z(`<span>`),sK=e=>(()=>{var t=oK();return $(t,()=>e.children),vR(()=>hz(t,yW(`text-[13px] leading-4 font-sans font-medium`,e.class))),t})(),cK=Z(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor><path fill-rule=evenodd clip-rule=evenodd d="M6.5 5C5.67157 5 5 5.67157 5 6.5C5 7.32843 5.67157 8 6.5 8H8V6.5C8 5.67157 7.32843 5 6.5 5ZM10 8V6.5C10 4.567 8.433 3 6.5 3C4.567 3 3 4.567 3 6.5C3 8.433 4.567 10 6.5 10H8V14H6.5C4.567 14 3 15.567 3 17.5C3 19.433 4.567 21 6.5 21C8.433 21 10 19.433 10 17.5V16H14V17.5C14 19.433 15.567 21 17.5 21C19.433 21 21 19.433 21 17.5C21 15.567 19.433 14 17.5 14H16V10H17.5C19.433 10 21 8.433 21 6.5C21 4.567 19.433 3 17.5 3C15.567 3 14 4.567 14 6.5V8H10ZM10 10V14H14V10H10ZM16 8H17.5C18.3284 8 19 7.32843 19 6.5C19 5.67157 18.3284 5 17.5 5C16.6716 5 16 5.67157 16 6.5V8ZM16 16V17.5C16 18.3284 16.6716 19 17.5 19C18.3284 19 19 18.3284 19 17.5C19 16.6716 18.3284 16 17.5 16H16ZM8 16H6.5C5.67157 16 5 16.6716 5 17.5C5 18.3284 5.67157 19 6.5 19C7.32843 19 8 18.3284 8 17.5V16Z">`),lK=e=>{let t=()=>e.size??11;return(()=>{var n=cK();return vR(r=>{var i=t(),a=t(),o=e.class;return i!==r.e&&Q(n,`width`,r.e=i),a!==r.t&&Q(n,`height`,r.t=a),o!==r.a&&Q(n,`class`,r.a=o),r},{e:void 0,t:void 0,a:void 0}),n})()},uK=Z(`<span>`),dK=Z(`<span style=display:inline-flex;align-items:center;gap:2px>`),fK=Z(`<span>Ctrl+`),pK=e=>{let t=()=>e.shortcut===`Enter`,n=()=>e.modifier!==!1,r=FB();return(()=>{var i=dK();return $(i,X(oz,{get when(){return t()},get children(){return X(UW,{size:8})}}),null),$(i,X(oz,{get when(){return!t()},get children(){return X(oz,{get when(){return n()},get fallback(){return(()=>{var t=uK();return $(t,()=>e.shortcut),t})()},get children(){return X(oz,{when:r,get fallback(){return(()=>{var t=fK();return t.firstChild,$(t,()=>e.shortcut,null),t})()},get children(){return[X(lK,{size:9}),(()=>{var t=uK();return $(t,()=>e.shortcut),t})()]}})}})}}),null),vR(()=>hz(i,e.class)),i})()},mK=e=>X(pK,{get shortcut(){return e.shortcut},get modifier(){return e.modifier},get class(){return yW(`text-[11px] font-sans text-[var(--rg-text-secondary)] ml-4`,e.class)}}),hK=({hiddenOpacity:e=`0`,visibleOpacity:t=`1`}={})=>{let n,r,i,a=e=>{r&&(r.style.opacity=t,r.style.top=`${e.offsetTop}px`,r.style.left=`${e.offsetLeft}px`,r.style.width=`${e.offsetWidth}px`,r.style.height=`${e.offsetHeight}px`)},o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(()=>{i&&a(i)});ER(()=>o?.disconnect());let s=()=>{i=void 0,o?.disconnect(),r&&(r.style.opacity=e)};return{containerRef:e=>{n=e},followerRef:e=>{r=e},followElement:e=>{if(!(!r||!n)){if(!e){s();return}i=e,a(e),o?.disconnect(),o?.observe(e),o?.observe(n)}},hideFollower:s}},gK=(e,t)=>e!==t&&e instanceof HTMLElement,_K=(e,t)=>{let n=[];for(let r of Array.from(e.children))gK(r,t)&&n.push(r);return n},vK=(e={})=>{let{topCornerRadiusPx:t,bottomCornerRadiusPx:n,cornerShape:r}=e,i=t!==void 0||n!==void 0,a,o=!1,s=e=>{if(!a||!i)return;let s=e.parentElement;if(!s)return;let c=_K(s,a),l=c[0]===e,u=c[c.length-1]===e,d=l&&t!==void 0?`${t}px`:`0px`,f=u&&n!==void 0?`${n}px`:`0px`;a.style.borderTopLeftRadius=d,a.style.borderTopRightRadius=d,a.style.borderBottomLeftRadius=f,a.style.borderBottomRightRadius=f,r&&!o&&(a.style.setProperty(`corner-shape`,r),o=!0)},{containerRef:c,followerRef:l,followElement:u,hideFollower:d}=hK();return{containerRef:c,highlightRef:e=>{a=e,o=!1,l(e)},updateHighlight:e=>{u(e),e&&s(e)},clearHighlight:d}},yK=(e={})=>{let t=new Map,n=[],r=`react-grab-menu-${Math.random().toString(36).slice(2,8)}`,i=0,a=!1,o=e.value!==void 0,[s,c]=J(null),[l,u]=J(0),d=Y(()=>o?e.value?.()??null:s()),f=t=>{if(o){e.onValueChange?.(t);return}c(t)},p=vK(e.highlight??{});yR(wR([d,l],([e])=>{if(e===null){p.clearHighlight();return}let n=t.get(e);n?p.updateHighlight(n.element):p.clearHighlight()}));let m=()=>n.filter(e=>t.get(e)?.isEnabled()),h=()=>{let e=m();e.length>0&&f(e[0])},g=()=>{let e=m();e.length>0&&f(e[e.length-1])},_=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?0:(t+1)%e.length])},v=()=>{let e=m();if(e.length===0)return;let t=e.indexOf(d()??``);f(e[t===-1?e.length-1:(t-1+e.length)%e.length])},y=Y(()=>{l();let e=d();if(e!==null)return t.get(e)?.domId});return{keyboardNavigation:e.keyboardNavigation??!1,clearActiveOnPointerLeave:e.clearActiveOnPointerLeave??!1,activeValue:d,activeDescendantId:y,setActiveItem:f,createItemId:()=>`${r}-item-${i++}`,canActivateOnHover:()=>!(e.requirePointerMove??!1)||a,notePointerMove:()=>{a=!0},resetPointerMove:()=>{a=!1},registerItem:e=>{t.set(e.value,e),n.includes(e.value)||n.push(e.value),u(e=>e+1)},unregisterItem:e=>{t.delete(e);let r=n.indexOf(e);r!==-1&&n.splice(r,1),o||c(t=>t===e?null:t),u(e=>e+1)},getActiveItem:()=>{let e=d();return e===null?void 0:t.get(e)},selectFirst:h,selectLast:g,selectNext:_,selectPrevious:v,setHighlightContainer:p.containerRef,setHighlightRail:p.highlightRef}},bK={Provider:eK,Panel:tK,List:rK,Item:aK,Label:sK,Shortcut:mK},xK=e=>e??!0,SK=(e,t)=>typeof e.enabled==`function`?t?e.enabled(t):!1:xK(e.enabled),CK=e=>{e.type===`contextmenu`&&e.preventDefault(),e.stopImmediatePropagation()},wK=e=>{let t=zM(t=>{e.isOpen()&&(e.shouldIgnoreKeyboardEvent?.(t)||e.shouldIgnoreInputEvents&&uB(t)||t.code===`Escape`&&(t.preventDefault(),t.stopImmediatePropagation(),e.onDismiss(`keyboard`)))}),n=zM(t=>{e.isOpen()&&(IB(t,`data-react-grab-ignore-events`)||e.shouldIgnoreRightClick&&t instanceof MouseEvent&&t.button===2||e.onDismiss(`pointer`))}),r=nI(()=>{window.addEventListener(`mousedown`,n,{capture:!0}),window.addEventListener(`touchstart`,n,{capture:!0})});return window.addEventListener(`keydown`,t,{capture:!0}),()=>{rI(r),window.removeEventListener(`keydown`,t,{capture:!0}),window.removeEventListener(`mousedown`,n,{capture:!0}),window.removeEventListener(`touchstart`,n,{capture:!0})}},TK=Z(`<div class="contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 w-fit h-fit px-2">`),EK=Z(`<div data-react-grab-ignore-events data-react-grab-context-menu class="fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none"style=pointer-events:auto>`),DK=e=>{let t,n,r=null,i=yK({keyboardNavigation:!0,highlight:{bottomCornerRadiusPx:14,cornerShape:bN}}),[a,o]=J(0),[s,c]=J(0),l=Y(()=>e.position!==null),u=Y(()=>bW({tagName:e.tagName,componentName:e.componentName})),d=()=>{if(t){let e=t.getBoundingClientRect();o(e.width),c(e.height)}};yR(()=>{l()&&nI(d)});let f=Y(()=>{let t=e.selectionBounds,n=e.position,r=a(),i=s();if(r===0||i===0||!t||!n)return{left:CN.left,top:CN.top,arrowLeft:0,arrowPosition:`bottom`};let o=n.x??t.x+t.width/2,c=Math.max(4,Math.min(o-r/2,window.innerWidth-r-4)),l=Math.max(8,Math.min(o-c,r-8)),u=t.y+t.height+8+4,d=t.y-i-8-4,f=u+i>window.innerHeight,p=d>=0,m=f&&p,h=m?d:u,g=m?`top`:`bottom`;if(f&&!p){let e=n.y??t.y+t.height/2;h=Math.max(4,Math.min(e+4,window.innerHeight-i-4)),g=`top`}return{left:c,top:h,arrowLeft:l,arrowPosition:g}}),p=Y(()=>{let t=e.actions??[],n=e.actionContext;return t.map(e=>({id:e.id,label:e.label,action:()=>{n&&e.onAction(n)},enabled:SK(e,n),shortcut:e.shortcut,shortcutModifier:e.shortcutModifier}))});yR(wR(l,e=>{if(e){let e=t?.getRootNode(),i=e instanceof ShadowRoot?e.activeElement:null,a=document.activeElement;r=a instanceof HTMLElement&&i===null&&!(t instanceof Element&&t.contains(a))?a:null,n?.focus({preventScroll:!0});return}i.setActiveItem(null);let a=r;r=null,!(!(a instanceof HTMLElement)||!document.contains(a))&&nI(()=>{let e=document.activeElement;(e===null||e===document.body)&&a.focus({preventScroll:!0})})})),TR(()=>{d();let t=t=>{if(!l())return;let n=t.key===`ArrowDown`,r=t.key===`ArrowUp`,a=t.key===`Home`,o=t.key===`End`,s=t.key===`Tab`;if(n||r||a||o||s){t.preventDefault(),t.stopPropagation();let e=n||s&&!t.shiftKey;a?i.selectFirst():o?i.selectLast():e?i.selectNext():i.selectPrevious();return}let c=e.actions??[],u=e.actionContext,d=n=>{u&&SK(n,u)&&(t.preventDefault(),t.stopPropagation(),n.onAction(u),e.onHide())};if(t.key===`Enter`){let e=i.getActiveItem();if(e){t.preventDefault(),t.stopPropagation(),e.isEnabled()&&e.onSelect();return}}let f=WV(c,t,{includeModifierShortcuts:!0});f&&d(f)},n=wK({isOpen:l,onDismiss:e.onDismiss,shouldIgnoreRightClick:!0}),r=zM(t);window.addEventListener(`keydown`,r,{capture:!0}),ER(()=>{n(),window.removeEventListener(`keydown`,r,{capture:!0})})});let m=Y(()=>{let{tagName:e,componentName:t}=u();return`Actions for ${t?`${t}.${e}`:e}`});return X(oz,{get when(){return l()},get children(){var r=EK();gz(r,`contextmenu`,CK,!0),gz(r,`click`,CK,!0),gz(r,`mousedown`,CK,!0),gz(r,`pointerdown`,CK,!0);var a=t;return typeof a==`function`?xz(a,r):t=r,yz(r,`z-index`,`${XM}`),$(r,X(EW,{get position(){return f().arrowPosition},leftPercent:0,get leftOffsetPx(){return f().arrowLeft}}),null),$(r,X(bK.Panel,{class:`justify-center items-start min-w-[100px]`,get children(){return[(()=>{var t=TK();return $(t,X(MW,{get tagName(){return u().tagName},get componentName(){return u().componentName},get isClickable(){return e.hasFilePath},onClick:t=>{t.stopPropagation(),e.hasFilePath&&e.actionContext&&(e.actions?.find(e=>e.id===`open`))?.onAction(e.actionContext)},shrink:!0})),t})(),X(PW,{get children(){return X(bK.Provider,{store:i,get children(){return X(bK.List,{ref:e=>n=e,get label(){return m()},class:`w-[calc(100%+16px)] -mx-2 -my-1.5 outline-none`,get children(){return X(iz,{get each(){return p()},children:t=>X(bK.Item,{get value(){return t.id},get dataId(){return t.label.toLowerCase()},get disabled(){return!t.enabled},onSelect:()=>{t.action(),e.onHide()},get children(){return[X(bK.Label,{class:`text-[var(--rg-text-primary)]`,get children(){return t.label}}),X(oz,{get when(){return t.shortcut},children:e=>X(bK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})})}})}})}})]}}),null),vR(e=>{var t=`${f().top}px`,n=`${f().left}px`;return t!==e.e&&yz(r,`top`,e.e=t),n!==e.t&&yz(r,`left`,e.t=n),e},{e:void 0,t:void 0}),r}})},fz([`pointerdown`,`mousedown`,`click`,`contextmenu`]),OK=(e,t,n,r)=>Math.max(r,Math.min(e,n-t-r)),kK=({anchor:e,measuredWidth:t,measuredHeight:n,viewportLeft:r=0,viewportTop:i=0,viewportWidth:a,viewportHeight:o,anchorGapPx:s,viewportPaddingPx:c,offscreenPosition:l})=>{if(!e||t===0||n===0)return l;let u,d;return e.edge===`left`||e.edge===`right`?(u=e.edge===`left`?e.x+s:e.x-t-s,d=e.y-n/2):(u=e.x-t/2,d=e.edge===`top`?e.y+s:e.y-n-s),{left:r+OK(u-r,t,a,c),top:i+OK(d-i,n,o,c)}},AK=(e,t)=>{let[n,r]=J(0),[i,a]=J(0),[o,s]=J(!1),[c,l]=J(!1),[u,d]=J(0),[f,p]=J(`bottom`),m,h,g=()=>{clearTimeout(m),h!==void 0&&(rI(h),h=void 0)},_=()=>{let t=e();t&&(r(t.offsetWidth),a(t.offsetHeight))},v=()=>{SR(()=>{d(e=>e+1),_()})},y=Y(()=>t()!==null);return yR(()=>{let n=t();n?(p(n.edge),clearTimeout(m),s(!0),h!==void 0&&rI(h),h=nI(()=>{_(),e()?.offsetHeight,l(!0)})):(h!==void 0&&rI(h),l(!1),m=setTimeout(()=>{s(!1)},120)),ER(g)}),yR(()=>{if(!y())return;window.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`resize`,v),window.visualViewport?.addEventListener(`scroll`,v);let e=LM(),t;e&&typeof ResizeObserver<`u`&&(t=new ResizeObserver(v),t.observe(e)),ER(()=>{window.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`resize`,v),window.visualViewport?.removeEventListener(`scroll`,v),t?.disconnect()})}),{shouldMount:o,isAnimatedIn:c,lastAnchorEdge:f,displayPosition:Y(e=>{u();let r=_W(),a=kK({anchor:t(),measuredWidth:n(),measuredHeight:i(),viewportLeft:r.offsetLeft,viewportTop:r.offsetTop,viewportWidth:r.width,viewportHeight:r.height,anchorGapPx:8,viewportPaddingPx:8,offscreenPosition:CN});return a.left===CN.left?e:a},CN),measure:_,clearAnimationHandles:g}},jK={padding:{prefix:`p`,scale:`spacing`},"padding-top,padding-bottom":{prefix:`py`,scale:`spacing`},"padding-left,padding-right":{prefix:`px`,scale:`spacing`},"padding-top":{prefix:`pt`,scale:`spacing`},"padding-right":{prefix:`pr`,scale:`spacing`},"padding-bottom":{prefix:`pb`,scale:`spacing`},"padding-left":{prefix:`pl`,scale:`spacing`},margin:{prefix:`m`,scale:`spacing`},"margin-top,margin-bottom":{prefix:`my`,scale:`spacing`},"margin-left,margin-right":{prefix:`mx`,scale:`spacing`},"margin-top":{prefix:`mt`,scale:`spacing`},"margin-right":{prefix:`mr`,scale:`spacing`},"margin-bottom":{prefix:`mb`,scale:`spacing`},"margin-left":{prefix:`ml`,scale:`spacing`},gap:{prefix:`gap`,scale:`spacing`},"column-gap":{prefix:`gap-x`,scale:`spacing`},"row-gap":{prefix:`gap-y`,scale:`spacing`},"width,height":{prefix:`size`,scale:`spacing`},width:{prefix:`w`,scale:`spacing`},height:{prefix:`h`,scale:`spacing`},"min-width":{prefix:`min-w`,scale:`spacing`},"max-width":{prefix:`max-w`,scale:`spacing`},"min-height":{prefix:`min-h`,scale:`spacing`},"max-height":{prefix:`max-h`,scale:`spacing`},"top,right,bottom,left":{prefix:`inset`,scale:`spacing`},"top,bottom":{prefix:`inset-y`,scale:`spacing`},"left,right":{prefix:`inset-x`,scale:`spacing`},top:{prefix:`top`,scale:`spacing`},right:{prefix:`right`,scale:`spacing`},bottom:{prefix:`bottom`,scale:`spacing`},left:{prefix:`left`,scale:`spacing`},"border-width":{prefix:`border`,scale:`border-width`},"border-top-width":{prefix:`border-t`,scale:`border-width`},"border-right-width":{prefix:`border-r`,scale:`border-width`},"border-bottom-width":{prefix:`border-b`,scale:`border-width`},"border-left-width":{prefix:`border-l`,scale:`border-width`},"z-index":{prefix:`z`,scale:`z-index`},opacity:{prefix:`opacity`,scale:`opacity`}},MK=(e,t)=>{let n=jK[e];if(!n)return null;let{prefix:r,scale:i}=n;if(i===`spacing`){if(t<0)return null;let e=t/4;return!Number.isInteger(e)||e>96?null:`${r}-${e}`}return i===`border-width`?!Number.isInteger(t)||t<0||t>8?null:t===1?r:`${r}-${t}`:i===`z-index`?!Number.isInteger(t)||t<0||t>50?null:`${r}-${t}`:!Number.isFinite(t)||t<0||t>100||t%5!=0?null:`${r}-${t}`},NK=e=>{let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement:e.ownerDocument?.activeElement??document.activeElement},PK=e=>e.toLowerCase()===`#00000000`?DN:e.toUpperCase(),FK=Z(`<input data-react-grab-ignore-events data-react-grab-input type=text autocapitalize=none autocorrect=off autocomplete=off>`),IK=e=>{let[t,n]=rz(e,[`class`,`ref`,`autoFocusSelect`]);return(()=>{var e=FK();return xz(e=>{t.autoFocusSelect&&queueMicrotask(()=>{e.focus(),e.select()}),t.ref?.(e)},e),Q(e,`spellcheck`,!1),bz(e,nz({get class(){return yW(`bg-transparent border-none outline-none text-[var(--rg-text-primary)] p-0 m-0`,t.class)}},n),!1,!1),e})()},LK=`text-[13px] leading-4 font-medium`,RK={position:`absolute`,opacity:0,"pointer-events":`none`,width:`0`,height:`0`,margin:`0`,padding:`0`,overflow:`hidden`},zK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="flex items-center gap-1 ml-auto shrink-0"><button type=button data-react-grab-ignore-events aria-label="Pick color"class="size-[16px] rounded-[4px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid p-0 m-0 cursor-pointer shrink-0"></button><input data-react-grab-ignore-events type=color aria-hidden=true tabindex=-1 class="absolute opacity-0 pointer-events-none size-0">`),BK=Z(`<span>`),VK=Z(`<span class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-text">`),HK=e=>e.length===9?e.slice(0,7):e,UK=e=>{let[t,n]=J(null),r=()=>t()!==null,i=()=>PK(e.value),a,o=!0;ER(()=>{o=!1}),TR(()=>{let t=e.onRegisterTrigger?.(()=>a?.click());ER(()=>t?.())});let s=()=>{let r=t();if(r===null)return;n(null);let i=jB(r);i?i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},c=()=>{r()&&(n(null),e.onEditComplete?.())},l=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),s();return}e.key===`Escape`&&(e.preventDefault(),c())}},u=t=>{t.preventDefault(),t.stopPropagation(),e.onInteract?.(),a?.click()};return(()=>{var c=zK(),d=c.firstChild,f=d.firstChild,p=f.nextSibling;$(c,X(oz,{get when(){return e.label},children:e=>(()=>{var t=BK();return hz(t,`${LK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),d),$(d,X(oz,{get when(){return r()},get fallback(){return(()=>{var e=VK();return e.$$click=e=>{e.preventDefault(),e.stopPropagation(),n(i())},e.$$pointerdown=e=>e.stopPropagation(),$(e,i),vR(()=>Q(e,`data-react-grab-value`,i())),e})()},get children(){return X(IK,{autoFocusSelect:!0,inputmode:`text`,"aria-label":`Style color hex`,class:`text-[12px] leading-4 font-medium tabular-nums text-right`,get style(){return{"field-sizing":`content`,"min-width":`32px`,"max-width":e.emphasized?`100px`:`72px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:l,onBlur:s,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),f),f.$$click=u,f.$$mousedown=e=>e.preventDefault(),f.$$pointerdown=e=>e.stopPropagation(),p.$$input=t=>{if(!o)return;let n=t.currentTarget.value,r=e.value.length===9?e.value.slice(7):``,i=n+(r.toLowerCase()===`00`?``:r);e.onInteract?.(),i&&i.toLowerCase()!==e.value.toLowerCase()&&e.onCommit(i,`pointer`)};var m=a;return typeof m==`function`?xz(m,p):a=p,vR(t=>yz(f,`background-color`,e.value)),vR(()=>p.value=HK(e.value)),c})()},fz([`pointerdown`,`mousedown`,`click`,`input`]),WK=Z(`<svg width=1em height=1em viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg aria-hidden=true style=width:16px;height:16px;flex-shrink:0;cursor:pointer><path fill-rule=evenodd clip-rule=evenodd>`),GK=e=>{let t=()=>e.active?`var(--rg-text-primary)`:`var(--rg-text-secondary)`,n=()=>e.active?e.direction===`left`?-2:2:0,r=()=>e.active?1.12:1,i=()=>e.direction===`left`?`M2.54282 10.5427C1.76177 11.3238 1.76177 12.5901 2.54282 13.3712L9.70183 20.5302C11.1193 21.9476 13.5428 20.9437 13.5428 18.9392V16.9573H21.0428C22.1474 16.9573 23.0428 16.0619 23.0428 14.9573V8.95733C23.0428 7.85276 22.1474 6.95733 21.0428 6.95733L13.5428 6.95733V4.97473C13.5428 2.9702 11.1193 1.96631 9.70183 3.38373L2.54282 10.5427Z`:`M14.2983 20.5302L21.4573 13.3712C22.2383 12.5901 22.2383 11.3238 21.4573 10.5427L14.2983 3.38374C12.8808 1.96631 10.4573 2.97019 10.4573 4.97473V6.95659L3.95728 6.95659C2.85271 6.95659 1.95728 7.85202 1.95728 8.95659V14.9566C1.95728 16.0612 2.85271 16.9566 3.95727 16.9566H10.4573V18.9392C10.4573 20.9437 12.8808 21.9476 14.2983 20.5302Z`;return(()=>{var a=WK(),o=a.firstChild;return gz(a,`pointerdown`,e.onPointerDown,!0),vR(s=>{var c=`translateX(${n()}px) scale(${r()})`,l=e.active?`transform 30ms cubic-bezier(0, 0, 0.2, 1)`:`transform 450ms cubic-bezier(0.34, 1.8, 0.64, 1)`,u=i(),d=t(),f=e.active?`fill 50ms ease`:`fill 300ms ease`;return c!==s.e&&yz(a,`transform`,s.e=c),l!==s.t&&yz(a,`transition`,s.t=l),u!==s.a&&Q(o,`d`,s.a=u),d!==s.o&&Q(o,`fill`,s.o=d),f!==s.i&&yz(o,`transition`,s.i=f),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a})()},fz([`pointerdown`]),KK=Z(`<span>`),qK=Z(`<div class="flex items-center gap-2 w-full px-2 h-[20px]"><div class="ml-auto shrink-0 flex items-center gap-1"><span data-react-grab-ignore-events role=button tabindex=-1 class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)] cursor-pointer select-none min-w-[36px] text-center">`),JK=e=>{let t=()=>e.options.find(t=>t.value===e.value)?.label??e.value;return(()=>{var n=qK(),r=n.firstChild,i=r.firstChild;return $(n,X(oz,{get when(){return e.label},get children(){var t=KK();return hz(t,`${LK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,()=>e.label),t}}),r),$(r,X(GK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),i),i.$$contextmenu=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(-1)},i.$$click=t=>{t.preventDefault(),t.stopPropagation(),e.onStep(1)},i.$$mousedown=e=>e.preventDefault(),i.$$pointerdown=e=>e.stopPropagation(),$(i,t),$(r,X(GK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)}),null),vR(t=>{var n=`Cycle ${e.label??`value`}`,r=`Click to cycle (${e.options.length} options)`;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`title`,t.t=r),t},{e:void 0,t:void 0}),n})()},fz([`pointerdown`,`mousedown`,`click`,`contextmenu`]),YK=e=>e.kind===`numeric`?e:null,XK=e=>e.kind===`color`?e:null,ZK=e=>e.kind===`enum`?e:null,QK=/^[0-9]$/,$K=e=>{let t=Array.from(e),n=t.findIndex(e=>QK.test(e));if(n<0)return{prefixLiterals:t,rightAlignedSegments:[]};let r=t.slice(0,n),i=[],a=0;for(let e=t.length-1;e>=n;e--){let n=t[e],r=QK.test(n)?`digit`:`literal`;i.push({kind:r,value:n,digitDistanceFromRight:a}),r===`digit`&&(a+=1)}return{prefixLiterals:r,rightAlignedSegments:i}},eq=Z(`<span class=rg-slot-column aria-hidden=true><span class=rg-slot-sizer>0</span><span class=rg-slot-cell>`),tq=Z(`<span class="rg-slot-cell rg-slot-exit">`),nq=Z(`<span><span class=inline-flex style=flex-direction:row-reverse>`),rq=Z(`<span class="inline-block whitespace-pre"aria-hidden=true>`),iq=e=>typeof e==`number`?e:Number.parseFloat(String(e).replace(/[^0-9.-]/g,``))||0,aq=e=>{let t,[n,r]=J(null),i=null;yR(wR(()=>e.digit,(n,a)=>{a===void 0||n===a||(t&&(t.classList.remove(`rg-slot-enter`),t.offsetWidth,t.classList.add(`rg-slot-enter`)),r({digit:a,direction:e.direction}),i!==null&&clearTimeout(i),i=setTimeout(()=>r(null),350))},{defer:!0})),ER(()=>{i!==null&&clearTimeout(i)});let a=()=>({"animation-delay":`${e.delayMs}ms`});return(()=>{var r=eq(),i=r.firstChild.nextSibling,o=t;return typeof o==`function`?xz(o,i):t=i,$(i,()=>e.digit),$(r,X(oz,{get when(){return n()},keyed:!0,children:e=>(()=>{var t=tq();return $(t,()=>e.digit),vR(n=>{var r=String(e.direction),i=a();return r!==n.e&&Q(t,`data-dir`,n.e=r),n.t=vz(t,i,n.t),n},{e:void 0,t:void 0}),t})()}),null),vR(t=>{var n=String(e.direction),r=a();return n!==t.e&&Q(i,`data-dir`,t.e=n),t.t=vz(i,r,t.t),t},{e:void 0,t:void 0}),r})()},oq=e=>{let t=Y(()=>String(e.children??``)),n=Y(()=>$K(t())),r=Y(wR(()=>iq(e.children),(e,t)=>t===void 0||e===t?0:e>t?1:-1)),i=Y(()=>e.direction??r());return(()=>{var r=nq(),a=r.firstChild;return $(r,X(az,{get each(){return n().prefixLiterals},children:e=>(()=>{var t=rq();return $(t,e),t})()}),a),$(a,X(az,{get each(){return n().rightAlignedSegments},children:e=>X(oz,{get when(){return e().kind===`digit`},get fallback(){return(()=>{var t=rq();return $(t,()=>e().value),t})()},get children(){return X(aq,{get digit(){return Number(e().value)},get direction(){return i()},get delayMs(){return e().digitDistanceFromRight*18}})}})})),vR(n=>{var i=t(),a=`inline-flex ${e.class??``}`,o={...e.style,"--rg-slot-dur":`350ms`};return i!==n.e&&Q(r,`aria-label`,n.e=i),a!==n.t&&hz(r,n.t=a),n.a=vz(r,o,n.a),n},{e:void 0,t:void 0,a:void 0}),r})()},sq=Z(`<div data-react-grab-slider-base aria-hidden=true class="absolute inset-y-0 left-0 right-0 rounded-[6px] bg-[var(--rg-surface-active)] pointer-events-none">`),cq=Z(`<div class="flex items-center gap-1 w-full px-1"><div role=slider aria-keyshortcuts="ArrowLeft ArrowRight"tabindex=-1 class="relative flex-1 h-[20px] flex items-center overflow-hidden rounded-[6px]"><div data-react-grab-slider-fill aria-hidden=true class="absolute inset-y-0 left-0 bg-[var(--rg-surface-active)] pointer-events-none"></div><div aria-hidden=true class="absolute inset-0 pointer-events-none"></div><div data-react-grab-slider-handle aria-hidden=true class="absolute top-[2px] bottom-[2px] w-[2px] rounded-[1px] bg-[var(--rg-text-primary)] pointer-events-none"style="transition:opacity 120ms ease"></div><div class="relative z-10 flex items-center justify-between w-full px-2 pointer-events-none">`),lq=Z(`<div data-react-grab-slider-hash-mark class="absolute top-1/2 w-px h-[8px] rounded-[1px] bg-[var(--rg-text-secondary)]"style="transform:translate(-50%, -50%);transition:opacity 200ms ease">`),uq=Z(`<span>`),dq=Z(`<span class="ml-auto flex items-center gap-1 pointer-events-auto"><span data-react-grab-value-text class="text-[12px] leading-4 font-medium tabular-nums text-[var(--rg-text-primary)]"><span class="text-[9px] text-[var(--rg-text-secondary)] ml-px">`),fq=Z(`<span data-react-grab-tailwind-label aria-hidden=true class="text-[10px] leading-4 text-[var(--rg-text-secondary)] tabular-nums">`),pq=Array.from({length:9},(e,t)=>(t+1)*100/10),mq=/^(-?(?:\d+\.?\d*|\.\d+))\s*([a-zA-Z%]*)$/,hq=e=>{let[t,n]=J(null),[r,i]=J(0),[a,o]=J(!1),[s,c]=J(!1),l=()=>t()!==null,u,d=null,f=()=>{let t=e.max-e.min;return t<=0?0:(Math.max(e.min,Math.min(e.max,e.value))-e.min)/t*100},p=()=>{e.onCommitValue&&n(oV(e.value))},m=()=>!!e.onCommitValue,h=(t,n)=>{if(n.width<=0)return e.value;let r=Math.max(0,Math.min(1,(t-n.left)/n.width));return e.min+r*(e.max-e.min)},g=(t,n)=>{e.onCommitValue?.(h(t,n),`pointer`)},_=(e,t)=>{let n=Math.max(0,e-t.right)-Math.max(0,t.left-e),r=Math.max(0,Math.abs(n)-32),i=Math.sqrt(Math.min(r/200,1));return Math.sign(n)*8*i},v=t=>{if(!m()||l())return;t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId);let n=u,r=n!==void 0&&t.target instanceof Node&&n.contains(t.target);d={startX:t.clientX,isDragging:!1,startedOnValueText:r,trackRect:t.currentTarget.getBoundingClientRect()},o(!0),e.onInteract?.()},y=t=>{if(!d)return;let n=t.clientX-d.startX;!d.isDragging&&Math.abs(n)<3||(d.isDragging=!0,e.onInteract?.(),g(t.clientX,d.trackRect),i(_(t.clientX,d.trackRect)))},b=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d.isDragging||(d.startedOnValueText?p():g(d.startX,d.trackRect)),d=null,o(!1),i(0))},x=e=>{let t=e.currentTarget;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),d&&(d=null,o(!1),i(0))};TR(()=>{let e=()=>{d=null,o(!1),c(!1),i(0)};window.addEventListener(`blur`,e),ER(()=>window.removeEventListener(`blur`,e))});let S=()=>!!e.activeKey||a()||s(),C=()=>{let r=t();if(r===null)return;n(null);let i=r.trim().replace(/(\d),(\d)/g,`$1.$2`).match(mq);if(!i){e.onInvalidCommit?.(),e.onEditComplete?.();return}let a=i[2].toLowerCase();if(a&&a!==e.unit){e.onInvalidCommit?.(),e.onEditComplete?.();return}let o=Number.parseFloat(i[1]);Number.isFinite(o)?e.onCommitValue?.(o,`keyboard`):e.onInvalidCommit?.(),e.onEditComplete?.()},w=()=>{l()&&(n(null),e.onEditComplete?.())},T=e=>{if(!(e.isComposing||e.keyCode===229)){if(e.stopImmediatePropagation(),e.key===`Enter`){e.preventDefault(),C();return}e.key===`Escape`&&(e.preventDefault(),w())}},E=()=>{let t=r();return{cursor:m()&&!l()?`ew-resize`:`default`,"touch-action":m()?`none`:`auto`,"user-select":`none`,"-webkit-user-select":`none`,"min-width":e.emphasized?`96px`:void 0,transform:t===0?`translateX(0)`:`translateX(${t}px)`,transition:a()?`none`:`transform 350ms ${kN}`}};return(()=>{var r=cq(),i=r.firstChild,o=i.firstChild,d=o.nextSibling,p=d.nextSibling,m=p.nextSibling;return i.addEventListener(`lostpointercapture`,x),i.addEventListener(`pointercancel`,x),i.$$pointerup=b,i.addEventListener(`pointerleave`,()=>c(!1)),i.addEventListener(`pointerenter`,()=>c(!0)),i.$$pointermove=y,i.$$pointerdown=v,$(i,X(oz,{get when(){return e.emphasized},get children(){var e=sq();return vR(t=>yz(e,`opacity`,l()?0:.55)),e}}),o),$(d,X(az,{each:pq,children:e=>(()=>{var t=lq();return vR(n=>{var r=`${e()}%`,i=S()?.4:0;return r!==n.e&&yz(t,`left`,n.e=r),i!==n.t&&yz(t,`opacity`,n.t=i),n},{e:void 0,t:void 0}),t})()})),$(m,X(oz,{get when(){return e.label},children:e=>(()=>{var t=uq();return hz(t,`${LK} text-[var(--rg-text-primary)] truncate min-w-0`),$(t,e),t})()}),null),$(m,X(oz,{get when(){return l()},get fallback(){return(()=>{var t=dq(),n=t.firstChild,r=n.firstChild,i=u;return typeof i==`function`?xz(i,t):u=t,$(t,X(oz,{get when(){return e.tailwindLabel},children:e=>(()=>{var t=fq();return $(t,e),t})()}),n),$(n,X(oq,{get children(){return oV(e.value)}}),r),$(r,()=>e.unit),vR(n=>{var r=`${oV(e.value)}${e.unit}`,i=e.onCommitValue?`text`:`default`;return r!==n.e&&Q(t,`data-react-grab-value`,n.e=r),i!==n.t&&yz(t,`cursor`,n.t=i),n},{e:void 0,t:void 0}),t})()},get children(){return X(IK,{autoFocusSelect:!0,inputmode:`decimal`,"aria-label":`Style value`,class:`text-[12px] leading-4 font-medium tabular-nums text-right pointer-events-auto ml-auto`,get style(){return{"field-sizing":`content`,"min-width":`16px`,"max-width":e.emphasized?`120px`:`60px`}},get value(){return t()??``},onInput:e=>n(e.currentTarget.value),onKeyDown:T,onBlur:C,onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()})}}),null),$(r,X(oz,{get when(){return e.emphasized},get children(){return[X(GK,{direction:`left`,get active(){return e.activeKey===`left`},onPointerDown:()=>e.onStep(-1)}),X(GK,{direction:`right`,get active(){return e.activeKey===`right`},onPointerDown:()=>e.onStep(1)})]}}),null),vR(t=>{var n=e.label??`Value`,r=e.min,c=e.max,u=e.value,d=`${oV(e.value)}${e.unit}`,m=E(),h=`${f()}%`,g=+!l(),_=`calc(${f()}% - 1px)`,v=e.activeKey?.9:a()||s()?.35:0;return n!==t.e&&Q(i,`aria-label`,t.e=n),r!==t.t&&Q(i,`aria-valuemin`,t.t=r),c!==t.a&&Q(i,`aria-valuemax`,t.a=c),u!==t.o&&Q(i,`aria-valuenow`,t.o=u),d!==t.i&&Q(i,`aria-valuetext`,t.i=d),t.n=vz(i,m,t.n),h!==t.s&&yz(o,`width`,t.s=h),g!==t.h&&yz(o,`opacity`,t.h=g),_!==t.r&&yz(p,`left`,t.r=_),v!==t.d&&yz(p,`opacity`,t.d=v),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),r})()},fz([`pointerdown`,`pointermove`,`pointerup`]),gq=e=>X(sz,{get children(){return[X(cz,{get when(){return YK(e.property)},children:t=>X(hq,{get label(){return aB(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get min(){return t().min},get max(){return t().max},get unit(){return t().unit},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommitValue(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get tailwindLabel(){return e.tailwindLabel},get emphasized(){return e.emphasized}})}),X(cz,{get when(){return XK(e.property)},children:t=>X(UK,{get label(){return aB(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onRegisterTrigger(){return e.onColorPickerRegister},get onInteract(){return e.onInteract},get emphasized(){return e.emphasized}})}),X(cz,{get when(){return ZK(e.property)},children:t=>X(JK,{get label(){return aB(()=>!!e.showLabel)()?t().label:void 0},get value(){return t().value},get options(){return t().options},get activeKey(){return e.activeKey},get onStep(){return e.onStep}})})]}}),_q=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">Copy`),vq=e=>X(KW,{"data-react-grab-ignore-events":!0,"data-react-grab-copy-button":!0,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.onCopy()},get children(){return _q()}}),yq=()=>{let[e,t]=J(!1),n,r=()=>{clearTimeout(n),t(!1)},i=()=>{t(!0),clearTimeout(n),n=setTimeout(()=>{t(!1)},ON)},a=()=>{clearTimeout(n)};return ER(a),{isPending:e,show:i,hide:r,cleanup:a}},bq=Z(`<div role=menu aria-orientation=vertical aria-label="Editable properties"class="relative flex flex-col w-full max-h-[var(--rg-edit-list-max-h)] overflow-y-auto outline-none no-scrollbar"><div aria-hidden=true class="pointer-events-none absolute opacity-0 transition-[top,left,width,height,opacity,border-radius] duration-75 ease-out bg-[var(--rg-surface-hover)]">`),xq=Z(`<div class="flex items-center w-full h-[24px]">`),Sq=Z(`<button data-react-grab-ignore-events type=button role=menuitem tabindex=-1 class="relative z-1 contain-layout block w-full h-[24px] px-0 py-0 cursor-pointer text-left border-none bg-transparent">`),Cq=Z(`<div class="flex items-center justify-between w-full h-[24px] px-2 gap-2"><span class="text-[13px] leading-4 font-sans font-medium text-[var(--rg-text-primary)] truncate min-w-0">`),wq=Z(`<span class="font-sans text-[var(--rg-text-secondary)] tabular-nums shrink-0"><span class=text-[11px]></span><span class="text-[9px] ml-px">`),Tq=Z(`<span aria-hidden=true class="size-[12px] rounded-[3px] border-[var(--rg-border-button)] [border-width:0.5px] border-solid shrink-0">`),Eq=Z(`<span class="text-[11px] font-sans text-[var(--rg-text-secondary)] shrink-0">`),Dq=e=>{let t=ZK(e);return t?t.options.find(e=>e.value===t.value)?.label??t.value:``},Oq=e=>{let t=[],n,r=!1,i=null,a=()=>{if(!n)return!1;let e=NK(n);return e instanceof HTMLElement&&e.matches(`input[data-react-grab-input]`)},o=(t,n)=>{n===`move`&&(r=!0);let o=a();if(r&&!o){if(e.isAdjusting()){i=t;return}i=null,t!==e.activeIndex&&e.onHoverIndex(t)}};yR(()=>{if(e.isAdjusting())return;let n=i;if(n===null)return;i=null;let o=t[n],s=a();r&&(s||o?.matches(`:hover`)&&n!==e.activeIndex&&e.onHoverIndex(n))});let{containerRef:s,highlightRef:c,updateHighlight:l,clearHighlight:u}=vK({});yR(()=>{t.length=e.properties.length});let d;return yR(()=>{let r=e.activeIndex,i=t[r];if(!i||r<0){u();return}if(l(i),d!==void 0&&cancelAnimationFrame(d),d=requestAnimationFrame(()=>{d=void 0;let e=t[r];e&&l(e)}),!n)return;let a=n.getBoundingClientRect(),o=i.getBoundingClientRect();(o.top<a.top||o.bottom>a.bottom)&&i.scrollIntoView({block:`nearest`})}),ER(()=>{d!==void 0&&cancelAnimationFrame(d)}),(()=>{var a=bq(),l=a.firstChild;return a.$$pointermove=()=>{r=!0},xz(e=>{n=e,s(e)},a),xz(c,l),$(a,X(az,{get each(){return e.properties},children:(r,a)=>{let s=()=>a===e.activeIndex;return(()=>{var c=Sq();return c.$$click=t=>{t.stopPropagation(),e.onSelect(a)},c.$$mousedown=e=>{let t=n?NK(n):null;t instanceof HTMLElement&&t.matches(`input[data-react-grab-input]`)&&t.blur(),e.preventDefault()},c.addEventListener(`pointerleave`,()=>{i===a&&(i=null)}),c.$$pointermove=()=>{o(a,`move`)},c.addEventListener(`pointerenter`,()=>{o(a,`enter`)}),xz(e=>{t[a]=e,ER(()=>{t[a]===e&&(t[a]=void 0)})},c),$(c,X(oz,{get when(){return s()},get fallback(){return(()=>{var e=Cq(),t=e.firstChild;return $(t,()=>r().label),$(e,X(sz,{get children(){return[X(cz,{get when(){return YK(r())},children:e=>(()=>{var t=wq(),n=t.firstChild,r=n.nextSibling;return $(n,()=>oV(e().value)),$(r,()=>e().unit),t})()}),X(cz,{get when(){return XK(r())},children:e=>(()=>{var t=Tq();return vR(n=>yz(t,`background-color`,e().value)),t})()}),X(cz,{get when(){return ZK(r())},children:e=>(()=>{var t=Eq();return $(t,()=>Dq(e())),t})()})]}}),null),e})()},get children(){var t=xq();return $(t,X(gq,{get property(){return r()},get activeKey(){return e.activeKey},get onStep(){return e.onStep},get onCommit(){return e.onCommit},get onEditComplete(){return e.onEditComplete},get onInvalidCommit(){return e.onInvalidCommit},get onInteract(){return e.onInteract},get onColorPickerRegister(){return e.onColorPickerRegister},showLabel:!0,get tailwindLabel(){return e.activeTailwindLabel}})),t}})),vR(e=>{var t=r().key,n=s()?`true`:void 0;return t!==e.e&&Q(c,`data-react-grab-edit-property`,e.e=t),n!==e.t&&Q(c,`aria-current`,e.t=n),e},{e:void 0,t:void 0}),c})()}}),null),a})()},fz([`pointermove`,`mousedown`,`click`]),kq=(e,t,n)=>e.kind===`color`&&typeof t==`string`&&typeof n==`string`?t.toLowerCase()===n.toLowerCase():t===n,Aq=e=>e===`ArrowLeft`?-1:1,jq=e=>{let[t,n]=J(0),r=null,i=null,a=null,o=()=>{i!==null&&clearTimeout(i),a!==null&&clearInterval(a),i=null,a=null,r=null},s=()=>{o(),n(0)},c=t=>{o(),r=t;let n=Aq(t);i=setTimeout(()=>{a=setInterval(()=>{e.step(n,e.isShiftHeld(),e.isAltHeld(),!0)},60)},280)};return TR(()=>{window.addEventListener(`blur`,s),ER(()=>window.removeEventListener(`blur`,s))}),ER(s),{heldDirection:t,pressArrow:(t,r,i,a)=>{if(r)return;let o=Aq(t);c(t),n(o),e.step(o,i,a,!1)},releaseKey:e=>{e===r&&s()},cancelRepeat:s}},Mq=(e,t,n)=>{if(e.length===0)return null;let r=e.findIndex(e=>e.value===t),i=e[((r===-1?0:r)+n+e.length)%e.length];return!i||i.value===t?null:i},Nq=(e,t,n,r,i)=>{if(e.kind===`enum`)return Mq(e.options,e.value,t)?.value??null;if(e.kind!==`numeric`)return null;let a=Math.min(e.min,e.value),o=Math.max(e.max,e.value);if(!n&&!r&&e.unit===`px`&&i?.hasTokens){let n=i.stepLength(e.value,t,e.cssProperties[0]);if(n!==null){let t=sV(MB(n,a,o));if(t!==e.value)return t}}let s=n?10:1,c=sV(MB(e.value+t*s,a,o));return c===e.value?null:c},Pq=/^-?\d*\.?\d+$/,Fq=e=>Pq.test(e),Iq=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,``),Lq=e=>{if(e.kind!==`enum`)return[];let t=[];for(let n of e.options){let e=Iq(n.value),r=Iq(n.label);e&&t.push(e),r&&r!==e&&t.push(r)}return t},Rq=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(let e of r.tailwindAliases){let i=Iq(e);i&&t.push({property:r,originalIndex:n,kind:`alias`,term:i})}for(let e of Lq(r))t.push({property:r,originalIndex:n,kind:`enum-option`,term:e});let i=Iq(r.label);i&&t.push({property:r,originalIndex:n,kind:`name`,term:i});let a=Iq(r.key);a&&a!==i&&t.push({property:r,originalIndex:n,kind:`name`,term:a});let o=Iq(`${r.label} ${r.key}`);o&&t.push({property:r,originalIndex:n,kind:`label`,term:o})}return t},zq=(e,t)=>{if(t.kind===`alias`||t.kind===`enum-option`||t.kind===`name`)return e===t.term?MN+t.term.length:t.term.startsWith(e)||e.startsWith(t.term)?NN+Math.min(e.length,t.term.length):null;let n=t.term.indexOf(e);return n===-1?null:n===0?PN-t.term.length*1:FN-n*100-t.term.length*1},Bq=(e,t,n,r)=>{let i=e.get(t.key);i&&i.score>=r||e.set(t.key,{property:t,score:r,originalIndex:n})},Vq=e=>{let t=Rq(e),n=new Map;for(let t=0;t<e.length;t++)n.set(e[t].key,t);let r=(t,r,i)=>{for(let a=0;a<r.length;a++){let o=r[a],s=n.get(o);if(s===void 0)continue;let c=e[s];Bq(t,c,s,i-a)}};return{search:n=>{let i=Iq(n);if(!i||Fq(i))return e;let a=new Map;r(a,MV(n),AN),r(a,NV(n),jN);for(let e of t){let t=zq(i,e);t!==null&&Bq(a,e.property,e.originalIndex,t)}return Array.from(a.values()).sort((e,t)=>t.score===e.score?e.originalIndex-t.originalIndex:t.score-e.score).map(e=>e.property)}}},Hq=(e,t)=>e.kind===t.kind&&!kq(e,t.value,e.original),Uq=e=>{let{initialProperties:t,searchQuery:n}=e,[r,i]=J({}),a=Vq(t),o=Y(()=>{let e=n(),i=r(),o=e?t:t.filter(e=>e.isPrioritized||e.isCanonical&&!e.isDefault||i[e.key]!==void 0);return e?a.search(e):o.slice(0,40)}),s=new Map(t.map(e=>[e.key,e])),c=Y(()=>{let e=r(),t=Object.keys(e);if(t.length===0)return o();let n=new Map;for(let r of t){let t=e[r];if(t.kind!==`numeric`)continue;let i=s.get(r);if(i)for(let e of i.cssProperties)n.set(e,t.value)}return o().map(t=>{let r=e[t.key];if(r!==void 0)return l(t,r);if(t.kind!==`numeric`)return t;let i=n.get(t.cssProperties[0]);return i===void 0?t:t.cssProperties.every(e=>n.get(e)===i)?{...t,value:i}:t})}),l=(e,t)=>e.kind===`numeric`&&t.kind===`numeric`||e.kind===`color`&&t.kind===`color`||e.kind===`enum`&&t.kind===`enum`?{...e,value:t.value}:e;return{filteredProperties:c,applyStyle:(e,t)=>{let n;if(e.kind===`numeric`&&typeof t==`number`)n={kind:`numeric`,value:t};else if(e.kind===`color`&&typeof t==`string`)n={kind:`color`,value:t};else if(e.kind===`enum`&&typeof t==`string`)n={kind:`enum`,value:t};else return;i(t=>{let r=Object.keys(t);if(r[r.length-1]===e.key)return{...t,[e.key]:n};let i={};for(let n of r){if(n===e.key)continue;let r=s.get(n);r!==void 0&&r.cssProperties.every(t=>e.cssProperties.includes(t))||(i[n]=t[n])}return i[e.key]=n,i})},buildPendingEdits:()=>{let e=r(),t=[],n=new Set;for(let r of Object.keys(e)){let i=e[r],a=s.get(r);if(!a||a.kind!==i.kind)continue;let o=Hq(a,i),c=!o&&a.cssProperties.some(e=>n.has(e));if(!(!o&&!c)){if(o)for(let e of a.cssProperties)n.add(e);a.kind===`numeric`&&i.kind===`numeric`?t.push({kind:`numeric`,key:a.key,cssProperties:a.cssProperties,value:i.value,unit:a.unit}):a.kind===`color`&&i.kind===`color`?t.push({kind:`color`,key:a.key,cssProperties:a.cssProperties,value:i.value}):a.kind===`enum`&&i.kind===`enum`&&t.push({kind:`enum`,key:a.key,cssProperties:a.cssProperties,value:i.value})}}return t},hasPendingStyles:()=>{let e=r();for(let n of t){let t=e[n.key];if(t&&Hq(n,t))return!0}return!1},hasChangedStyleFor:e=>{let t=r()[e],n=s.get(e);return!!(t&&n&&Hq(n,t))}}},Wq=new Map;for(let e of XB)for(let t of e)Wq.set(t.key,t.longhands);Gq=e=>{if(e.includes(`,`))return e.split(`,`);let t=Wq.get(e);return t?[...t]:[e]},Kq=/^-?(?:\d+\.?|\d*\.\d*)?$/,qq=e=>Kq.test(e),Jq=e=>{let t=e.startsWith(`-`);return{isNegative:t,base:t?e.slice(1):e}},Yq=/^([a-z-]+)-(-?\d+(?:\.\d+)?)$/,Xq=/^(.+?)-\[(.+)]$/,Zq=/^(-?\d*\.?\d+)\s*([a-zA-Z%]*)$/,Qq=/^(-?\d*\.?\d+)(px|rem)?$/i,$q=/^(?:length|size):/i,eJ=new Set([`opacity`,`border-width`,`border-top-width`,`border-right-width`,`border-bottom-width`,`border-left-width`,`z-index`,`font-weight`]),tJ=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`numeric`)return n;return null},nJ=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`enum`)return n;return null},rJ=(e,t)=>{for(let n of e)if(n.key===t&&n.kind===`color`)return n;return null},iJ=e=>{let t=e.replace(/^(?:color|length|size):/i,``).trim();return/(?:var|url)\(/i.test(t)?t:t.replace(/_/g,` `)},aJ=e=>{let t=e.lastIndexOf(`:`),n=t>=0?e.slice(t+1):e;return(n.startsWith(`!`)?n.slice(1):n).toLowerCase()},oJ=(e,t)=>{let n=e.match(Qq);if(!n)return null;let r=n[2]?.toLowerCase();if(!r&&!t)return null;let i=Number.parseFloat(n[1]);return Number.isFinite(i)?r===`rem`?i*16:i:null},sJ=(e,t)=>{let n=Gq(t),r=new Map;for(let t of n)for(let n of e)n.kind===`numeric`&&n.cssProperties.includes(t)&&r.set(n.key,n);return Array.from(r.values())},cJ=(e,t)=>sV(MB(t,e.min,e.max)),lJ=e=>{let{initialProperties:t,searchQuery:n,isCompact:r,activeProperty:i,commit:a,setIsCompact:o}=e,s=e=>{for(let n of t)if(n.key===e&&(n.kind===`numeric`||n.kind===`enum`))return!0;return sJ(t,e).length>0},c=e=>{let t=e.trim().replace(/(\d),(\d)/g,`$1.$2`).match(Zq);if(!t)return null;let n=Number.parseFloat(t[1]);return Number.isFinite(n)?{value:n,unit:t[2].toLowerCase()}:null},l=(e,t)=>!e||t.toLowerCase().startsWith(e),u=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);return n?l(n.unit,t.unit):qq(e)},d=Y(()=>u(n())),f=e=>{if(!r())return!1;let t=i();if(t?.kind!==`numeric`)return!1;let n=c(e);if(!n)return!1;let o=t.unit.toLowerCase();if(n.unit!==``&&n.unit!==o)return l(n.unit,t.unit);let s=cJ(t,n.value);return s!==t.value&&a(t,s),!0},p=(e,n)=>{let r=tJ(t,e);if(r)return r.unit===`px`?(o(!0),a(r,cJ(r,n),{shouldCompact:!0}),!0):!1;let i=sJ(t,e);return i.length===0?!1:(o(!0),SR(()=>{for(let e of i)a(e,cJ(e,n),{shouldCompact:!0})}),!0)},m=(e,n)=>{let r=EV(e);if(!r)return!1;let i=rJ(t,r);if(!i)return!1;let s=n===null?OV(e):jB(n);return s?(o(!0),a(i,s,{shouldCompact:!0}),!0):!1},h=e=>{let t=e.trim(),n=t.match(Xq);if(!n)return!1;let r=n[2],i=iJ(r);if(m(t,i))return!0;let a=oJ(i,$q.test(r.trim()));if(a===null)return!1;let{isNegative:o,base:s}=Jq(n[1]),c=IV(aJ(s));return c?p(c,o?-a:a):!1},g=e=>{if(h(e))return;let n=CV(e),{isNegative:r,base:i}=Jq(n),c=i.replace(/-\d*$/,``).replace(/-$/,``),l=c?IV(c):null;if(l&&s(l)&&o(!0),!r){if(m(n,null))return;let e=LV(n);if(e){let n=nJ(t,e.property);if(!n)return;let r=n.options.find(t=>t.value===e.value);r&&(o(!0),a(n,r.value,{shouldCompact:!0}));return}}let u=i.match(Yq);if(!u)return;let d=IV(u[1]);if(!d)return;let f=Number.parseFloat(u[2]);if(!Number.isFinite(f))return;let p=r?-f:f,g=eJ.has(d)?p:p*4,_=tJ(t,d);if(_){a(_,cJ(_,g),{shouldCompact:!0});return}if(!r){let e=nJ(t,d);if(e){let t=String(f),n=e.options.find(e=>e.value===t);if(n){a(e,n.value,{shouldCompact:!0});return}}}let v=sJ(t,d);v.length!==0&&SR(()=>{for(let e of v)a(e,cJ(e,g),{shouldCompact:!0})})},_=e=>{if(LV(e))return!0;let{base:n}=Jq(e),r=n.match(Yq);if(!r)return!1;let i=IV(r[1]);return i?s(i)?!0:nJ(t,i)!==null:!1};return{isInlineNumericEdit:d,isInlineNumericDraft:u,tryApplyNumericValue:f,applyTailwindClass:e=>{let t=e.trim().replace(/^class\s*=\s*["']/,``).replace(/["']\s*$/,``).replace(/\s+\[/g,`-[`),n=CV(t),r=t.split(/\s+/).filter(Boolean);if(r.length>1&&!_(n)){for(let e of r)g(e);return}g(t)}}},uJ=Z(`<span class="text-[var(--rg-text-primary)] text-[13px] leading-3.5 font-sans font-medium">No`),dJ=Z(`<span class="text-[var(--rg-error-text)] text-[13px] leading-3.5 font-sans font-medium">Yes`),fJ=Z(`<div role=alertdialog aria-modal=true aria-labelledby=rg-discard-prompt-title class="contain-layout shrink-0 flex items-center justify-between gap-2 pt-1.5 pb-1 px-2 w-full self-stretch"><span id=rg-discard-prompt-title class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-sans font-medium">Discard edits?</span><div class="flex items-center gap-[5px]">`),pJ=Z(`<div><textarea data-react-grab-ignore-events data-react-grab-input aria-label="Search properties"aria-keyshortcuts="Enter Escape ArrowUp ArrowDown ArrowLeft ArrowRight Tab"autocapitalize=none autocorrect=off autocomplete=off class="text-[var(--rg-text-primary)] text-[13px] leading-4 font-medium bg-transparent border-none resize-none w-full p-0 m-0 outline-none"rows=1 style=caret-color:var(--rg-text-primary);field-sizing:content;min-height:16px;max-height:16px;scrollbar-width:none>`),mJ=Z(`<div>`),hJ=Z(`<div role=dialog aria-modal=true aria-label="Style element"data-react-grab-ignore-events data-react-grab-edit-panel>`),gJ=Z(`<div class="flex items-center justify-center w-full px-3 py-1.5 min-h-[28px]">`),_J=e=>X(oz,{get when(){return e.state},children:t=>X(oz,{keyed:!0,get when(){return t().element},children:n=>X(vJ,{get state(){return t()},position:()=>e.position,get onDismiss(){return e.onDismiss},get onSubmit(){return e.onSubmit},get onPendingEditsChange(){return e.onPendingEditsChange},get onInteractingChange(){return e.onInteractingChange}})})}),vJ=e=>{let t=e.state.properties,n,r=e.state.preview,[i,a]=J(e.state.initialSearchQuery??``),[o,s]=J(null),[c,l]=J(null),u=Uq({initialProperties:t,searchQuery:()=>o()??i()}),d=()=>{let e=u.filteredProperties().findIndex(e=>e.kind===`numeric`);return e>0?e:0},[f,p]=J(d()),m=Y(()=>u.hasPendingStyles()),h=Y(()=>m()||!!e.state.hasSessionEdits),[g,_]=J(!1),v,y,b,x=!1,[S,C]=J(!1),w=Y(()=>S()||m()),[T,E]=J(!1),D=GV(),O=Y(()=>bW({tagName:e.state.tagName,componentName:e.state.componentName})),k=Y(()=>{let e=u.filteredProperties();return e.length===0?null:e[Math.min(Math.max(0,f()),e.length-1)]}),ee,te=AK(()=>ee,e.position),A=e=>{l(e),clearTimeout(v),v=setTimeout(()=>{l(t=>t===e?null:t)},100)},ne=Y(()=>w()&&!T());yR(()=>{let t=ne();e.onInteractingChange?.(t)});let re=()=>{C(!0),clearTimeout(y),y=setTimeout(()=>{C(!1)},150)},ie=()=>{queueMicrotask(()=>{n&&NK(n)!==n&&hW(n,{preventScroll:!0})})},ae=()=>{o()===null&&s(i())},oe=()=>{x=!1,clearTimeout(b)},se=()=>{x=!1,clearTimeout(b),b=setTimeout(()=>{x=!0},500)},ce=e=>{let t=e.trim(),n=t.replace(/^-/,``).replace(`.`,``);/[a-z%]+$/i.test(t)||n.length>1?se():oe()},le=e=>{if(!x)return e;let t=i();if(!t||!e.startsWith(t))return oe(),e;let n=e.slice(t.length);return/^[-.\d]/.test(n)?(oe(),n):e},ue=e=>{if(!x||e.metaKey||e.ctrlKey||e.altKey||!/^[-.\d]$/.test(e.key))return!1;e.preventDefault(),e.stopImmediatePropagation(),oe();let t=e.key;return n&&(n.value=t),xe.tryApplyNumericValue(t)?(ae(),a(t),ce(t),ie(),!0):(a(t),ie(),!0)},de=()=>{oe(),s(null),_(!1)},fe=(t,n,i={})=>{u.applyStyle(t,n),r.apply(t.cssProperties,cV(t,n)),e.onPendingEditsChange?.(u.buildPendingEdits()),re(),i.isFromKeyRepeat||we.hide(),i.flashDirection&&A(i.flashDirection===1?`right`:`left`),i.shouldFocus&&ie(),i.shouldCompact&&_(!0),i.source===`keyboard`&&D.arm()},pe=VV(e=>e.shiftKey),me=VV(e=>e.altKey),he=(t,n,r,i,a)=>{let o=k();if(!o)return null;let s=Nq(o,t,n,r,e.state.designTokens);return s===null?(A(t===1?`right`:`left`),null):(fe(o,s,{flashDirection:t,shouldFocus:!0,isFromKeyRepeat:i,source:a}),o)},ge=(e,t,n,r)=>{he(e,t,n,r,`keyboard`)&&_(!0)},_e=e=>{he(e,!1,!1,!1,`pointer`)},ve=jq({step:ge,isShiftHeld:pe,isAltHeld:me}),ye=(e,t)=>{let n=k();if(n){if(n.kind===`numeric`&&typeof e==`number`){let r=sV(MB(e,n.min,n.max));r!==n.value&&fe(n,r,{source:t});return}typeof e==`string`&&(kq(n,e,n.value)||fe(n,e,{source:t}))}},be=Y(()=>{if(!pe())return null;let e=k();return!e||e.kind!==`numeric`?null:MK(e.key,e.value)}),xe=lJ({initialProperties:t,searchQuery:i,isCompact:g,activeProperty:k,commit:(e,t,n)=>{fe(e,t,{...n,source:`keyboard`})},setIsCompact:_}),Se=Y(()=>g()&&i()!==``&&xe.isInlineNumericEdit()),Ce=()=>{we.hide(),D.clear(),e.onSubmit(u.buildPendingEdits())},we=yq(),Te,Ee=()=>{Te&&(Te.classList.remove(`animate-shake`),Te.offsetWidth,Te.classList.add(`animate-shake`))},De=t=>{we.hide(),t===`discard`&&r.restore(),e.onDismiss()},Oe=e=>{if(ve.cancelRepeat(),e===`pointer`&&D.clear(),we.isPending()){De(`discard`);return}if(!h()){De(r.hasAppliedStyles()?`discard`:`preserve`);return}let t=g();de(),!(e===`keyboard`&&t)&&(we.show(),Ee())},ke=e=>{let t=u.filteredProperties();t.length!==0&&(p(n=>(n+e+t.length)%t.length),de())},Ae=()=>{D.clear(),we.hide()},je=[],Me=e=>(je.push(e),()=>{je=je.filter(t=>t!==e)}),Ne=()=>je[je.length-1]??null,Pe=(e,t)=>{if(k()?.kind===`color`){t.repeat||Ne()?.();return}ve.pressArrow(e,t.repeat,t.shiftKey,t.altKey)},Fe={ArrowUp:()=>ke(-1),ArrowDown:()=>ke(1),ArrowLeft:e=>Pe(`ArrowLeft`,e),ArrowRight:e=>Pe(`ArrowRight`,e),Tab:e=>ke(e.shiftKey?-1:1),Enter:()=>{if(we.isPending())return;let e=k(),t=Ne();if(e?.kind===`color`&&!u.hasChangedStyleFor(e.key)&&t&&!h()){t();return}Ce()},Escape:()=>Oe(`keyboard`)},Ie=e=>{if(e.isComposing||e.keyCode===229)return;if(we.isPending()){let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null&&(e.key===`Tab`||e.key===`Enter`))return;if(e.key===`Tab`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`){e.preventDefault(),e.stopImmediatePropagation();return}}let t=Fe[e.key];t&&(e.preventDefault(),e.stopImmediatePropagation(),t(e))};TR(()=>{queueMicrotask(()=>{if(hW(n,{preventScroll:!0}),n){let e=n.value.length;n.setSelectionRange(e,e)}}),te.measure();let e=i();e&&xe.applyTailwindClass(e);let t=wK({isOpen:()=>!0,onDismiss:Oe,shouldIgnoreKeyboardEvent:e=>{let t=e.composedPath()[0];return we.isPending()&&t instanceof HTMLElement&&t.closest(`[data-react-grab-discard-button]`)!==null},shouldIgnoreRightClick:!0,shouldIgnoreInputEvents:!0}),r=zM(e=>{IB(e,`data-react-grab-input`)||ue(e)||Ie(e)}),a=zM(e=>{ve.releaseKey(e.key)}),o=zM(e=>{e.pointerType===`mouse`&&(we.isPending()||D.consume()&&h()&&Oe(`pointer`))});window.addEventListener(`keydown`,r,{capture:!0}),window.addEventListener(`keyup`,a,{capture:!0}),window.addEventListener(`pointermove`,o,{capture:!0}),ER(()=>{t(),window.removeEventListener(`keydown`,r,{capture:!0}),window.removeEventListener(`keyup`,a,{capture:!0}),window.removeEventListener(`pointermove`,o,{capture:!0}),clearTimeout(v),clearTimeout(y),clearTimeout(b),we.cleanup(),te.clearAnimationHandles(),C(!1)})});let j=e=>{p(e),ie()};return X(oz,{get when(){return te.shouldMount()},get children(){var e=hJ();gz(e,`contextmenu`,CK,!0),gz(e,`click`,CK,!0),gz(e,`mousedown`,CK,!0),gz(e,`pointerdown`,CK,!0);var t=ee;return typeof t==`function`?xz(t,e):ee=e,yz(e,`z-index`,`${XM}`),yz(e,`--rg-edit-list-max-h`,`280px`),$(e,X(RW,{ref:e=>Te=e,class:`flex flex-col justify-center items-start overflow-hidden w-fit h-fit`,get style(){return{"min-width":g()?void 0:`200px`,"max-width":`320px`,transform:`translateX(${ve.heldDirection()*2}px)`,transition:`transform 280ms ${kN}`}},get children(){return[X(oz,{get when(){return we.isPending()},get fallback(){return X(oz,{get when(){return!g()},get children(){var e=mJ();return e.addEventListener(`mouseleave`,()=>E(!1)),e.addEventListener(`mouseenter`,()=>E(!0)),$(e,X(MW,{get tagName(){return O().tagName},get componentName(){return O().componentName},isClickable:!1,onClick:()=>{},shrink:!0}),null),$(e,X(oz,{get when(){return h()},get children(){return X(vq,{onCopy:Ce})}}),null),vR(()=>hz(e,yW(`contain-layout shrink-0 flex items-center gap-1 pt-1.5 pb-1 h-fit px-2`,h()?`w-full self-stretch justify-between`:`w-fit`))),e}})},get children(){var e=fJ(),t=e.firstChild.nextSibling;return $(t,X(KW,{"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`cancel`,onClick:e=>{e.preventDefault(),e.stopPropagation(),Ae()},get children(){return uJ()}}),null),$(t,X(KW,{variant:`destructive`,"data-react-grab-ignore-events":!0,"data-react-grab-discard-button":`confirm`,onClick:e=>{e.preventDefault(),e.stopPropagation(),De(`discard`)},get children(){return dJ()}}),null),e}}),(()=>{var e=pJ(),t=e.firstChild;return t.$$keydown=Ie,t.$$input=e=>{let t=le(e.currentTarget.value);if(t!==e.currentTarget.value&&(e.currentTarget.value=t),xe.tryApplyNumericValue(t)){ae(),a(t),ce(t),ie();return}if(oe(),xe.isInlineNumericDraft(t)){ae(),a(t),ie();return}a(t),s(null),p(t.trim()===``?d():0),de(),xe.applyTailwindClass(t)},xz(e=>{n=e},t),Q(t,`spellcheck`,!1),vR(n=>{var r=Se()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start px-2 py-1.5 w-full self-stretch [border-top-width:0.5px] border-t-solid border-t-[var(--rg-border-subtle)] antialiased`,i=Se()?RK:void 0,a=Se()?-1:0,o=g()?k()?.label??`Search property`:`Search property`;return r!==n.e&&hz(e,n.e=r),n.t=vz(e,i,n.t),a!==n.a&&Q(t,`tabindex`,n.a=a),o!==n.o&&Q(t,`placeholder`,n.o=o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),vR(()=>t.value=i()),e})(),X(oz,{get when(){return u.filteredProperties().length>0},get children(){var e=mJ();return $(e,X(Oq,{get properties(){return u.filteredProperties()},get activeIndex(){return f()},get activeKey(){return c()},onHoverIndex:p,onSelect:j,onStep:_e,onCommit:ye,onColorPickerRegister:Me,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,isAdjusting:S,get activeTailwindLabel(){return be()}})),vR(t=>{var n=g()?``:`[font-synthesis:none] contain-layout shrink-0 flex flex-col items-start w-full self-stretch antialiased`,r=g()?RK:void 0;return n!==t.e&&hz(e,t.e=n),t.t=vz(e,r,t.t),t},{e:void 0,t:void 0}),e}}),X(oz,{get when(){return aB(()=>!!g())()&&k()},children:e=>(()=>{var t=gJ();return t.$$mousedown=e=>e.preventDefault(),$(t,X(gq,{get property(){return e()},get activeKey(){return c()},onStep:_e,onCommit:ye,onEditComplete:ie,onInvalidCommit:Ee,onInteract:re,onColorPickerRegister:Me,showLabel:!1,get tailwindLabel(){return be()},emphasized:!0})),t})()})]}})),vR(t=>{var n=g()?`true`:`false`,r=yW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none`,te.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`),i=`${te.displayPosition().top}px`,a=`${te.displayPosition().left}px`,o=te.isAnimatedIn()?`auto`:`none`,s=wN[te.lastAnchorEdge()],c=te.isAnimatedIn()?`1`:`0`,l=te.isAnimatedIn()?`scale(1)`:`scale(0.92)`;return n!==t.e&&Q(e,`data-rg-compact`,t.e=n),r!==t.t&&hz(e,t.t=r),i!==t.a&&yz(e,`top`,t.a=i),a!==t.o&&yz(e,`left`,t.o=a),o!==t.i&&yz(e,`pointer-events`,t.i=o),s!==t.n&&yz(e,`transform-origin`,t.n=s),c!==t.s&&yz(e,`opacity`,t.s=c),l!==t.h&&yz(e,`transform`,t.h=l),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),e}})},fz([`pointerdown`,`mousedown`,`click`,`contextmenu`,`input`,`keydown`]),yJ=Z(`<div data-react-grab-ignore-events>`),bJ=e=>{let t,n=()=>e.interactive!==!1,r=AK(()=>t,()=>e.position);return TR(()=>{r.measure();let t=e.onDismiss?wK({isOpen:()=>!!e.position,onDismiss:e.onDismiss}):void 0;ER(()=>{r.clearAnimationHandles(),t?.()})}),X(oz,{get when(){return r.shouldMount()},get children(){var i=yJ(),a=t;return typeof a==`function`?xz(a,i):t=i,bz(i,nz(()=>({[e.dataAttribute]:``}),{get class(){return yW(`fixed font-sans text-[13px] antialiased [filter:var(--rg-drop-shadow)] select-none will-change-[opacity,transform]`,r.isAnimatedIn()?`transition-[opacity,transform] duration-220 ease-spring`:`transition-[opacity,transform] duration-120 ease-drawer`)},get style(){return{top:`${r.displayPosition().top}px`,left:`${r.displayPosition().left}px`,"z-index":`${XM}`,"pointer-events":n()&&r.isAnimatedIn()?`auto`:`none`,"transform-origin":wN[r.lastAnchorEdge()],opacity:r.isAnimatedIn()?`1`:`0`,transform:r.isAnimatedIn()?`scale(1)`:`scale(0.92)`}},onPointerDown:CK,onMouseDown:CK,onClick:CK,onContextMenu:CK}),!1,!0),$(i,()=>e.children),i}})},xJ=e=>{let t=yK({clearActiveOnPointerLeave:!0,highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:bN}});return X(bJ,{get position(){return e.position},dataAttribute:`data-react-grab-toolbar-menu`,get onDismiss(){return e.onDismiss},get children(){return X(bK.Panel,{class:`overflow-hidden`,style:{"min-width":`100px`},get children(){return X(bK.Provider,{store:t,get children(){return X(bK.List,{label:`Default action`,get children(){return X(iz,{get each(){return e.actions},children:t=>{let n=()=>t.id===e.defaultActionId;return X(bK.Item,{get value(){return t.id},role:`menuitemradio`,get checked(){return n()},onSelect:()=>{e.onSetDefaultAction(t.id),e.onDismiss()},get children(){return[X(bK.Label,{get class(){return n()?`text-[var(--rg-text-primary)]`:`text-[var(--rg-text-secondary)]`},get children(){return t.label}}),X(oz,{get when(){return t.shortcut},children:e=>X(bK.Shortcut,{get shortcut(){return e()},get modifier(){return t.shortcutModifier}})})]}})}})}})}})}})}})},SJ=Z(`<span aria-hidden=true class="shrink-0 font-mono text-[11px] leading-4 text-[var(--rg-text-secondary)] opacity-60 mr-1">`),CJ=Z(`<span class=text-[var(--rg-text-secondary)]>.`),wJ=Z(`<span class="flex items-center min-w-0 w-full"><span class="text-[13px] leading-4 h-fit font-medium overflow-hidden text-ellipsis whitespace-nowrap min-w-0 transition-colors">`),TJ=e=>{let t=()=>e.state?.activeIndex??0,n=yK({value:()=>String(t()),highlight:{topCornerRadiusPx:14,bottomCornerRadiusPx:14,cornerShape:bN}});return X(bJ,{get position(){return e.position},dataAttribute:`data-react-grab-hierarchy-menu`,interactive:!1,get children(){return X(bK.Panel,{class:`overflow-hidden`,style:{"min-width":`160px`},get children(){return X(bK.Provider,{store:n,get children(){return X(bK.List,{label:`Navigate element hierarchy`,get children(){return X(iz,{get each(){return e.state?.items??[]},children:(e,n)=>X(bK.Item,{get value(){return String(n())},role:`menuitemradio`,get checked(){return n()===t()},get children(){var r=wJ(),i=r.firstChild;return $(r,X(oz,{get when(){return e.depth>0},get children(){var t=SJ();return $(t,()=>e.isLast?`└─`:`├─`),vR(n=>yz(t,`padding-left`,`${(e.depth-1)*12}px`)),t}}),i),$(i,X(oz,{get when(){return e.componentName},get children(){return[aB(()=>e.componentName),CJ()]}}),null),$(i,()=>e.tagName,null),vR(e=>{var r=n()===t(),a=n()!==t();return r!==e.e&&i.classList.toggle(`text-[var(--rg-text-primary)]`,e.e=r),a!==e.t&&i.classList.toggle(`text-[var(--rg-text-secondary)]`,e.t=a),e},{e:void 0,t:void 0}),r}})})}})}})}})}})},EJ=e=>[X(dW,{get selectionVisible(){return e.selectionVisible},get selectionBounds(){return e.selectionBounds},get selectionBoundsMultiple(){return e.selectionBoundsMultiple},get selectionShouldSnap(){return e.selectionShouldSnap},get dragVisible(){return e.dragVisible},get dragBounds(){return e.dragBounds},get grabbedBoxes(){return e.grabbedBoxes},get labelInstances(){return e.labelInstances}}),X(pW,{get visible(){return e.isFrozen??!1}}),X(oz,{get when(){return aB(()=>!!e.selectionLabelVisible)()&&(e.frozenLabelEntries?.length??0)>0},get children(){return X(az,{get each(){return e.frozenLabelEntries??[]},children:(t,n)=>X(CG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,shouldToggleExpandOnClick:n===0,get onToggleExpand(){return n===0?e.onToggleExpand:void 0}})})}}),X(oz,{get when(){return aB(()=>!!e.selectionLabelVisible)()&&e.pendingShiftPreviewEntry},children:e=>X(CG,{get tagName(){return e().tagName},get componentName(){return e().componentName},get selectionBounds(){return e().bounds},get mouseX(){return e().mouseX},visible:!0})}),X(oz,{get when(){return aB(()=>!!(e.selectionLabelVisible&&e.selectionBounds))()&&(e.frozenLabelEntries?.length??0)===0},get children(){return X(CG,{get tagName(){return e.selectionTagName},get componentName(){return e.selectionComponentName},get elementsCount(){return e.selectionElementsCount},get selectionBounds(){return e.selectionBounds},get mouseX(){return e.mouseX},get visible(){return e.selectionLabelVisible},get isPromptMode(){return e.isPromptMode},get inputValue(){return e.inputValue},get status(){return e.selectionLabelStatus},get filePath(){return e.selectionFilePath},get onInputChange(){return e.onInputChange},get onSubmit(){return e.onInputSubmit},get onToggleExpand(){return e.onToggleExpand},get selectionLabelShakeCount(){return e.selectionLabelShakeCount},get onConfirmDismiss(){return e.onConfirmDismiss},get discardPrompt(){return e.discardPrompt},onOpen:()=>{e.selectionFilePath&&II(e.selectionFilePath,e.selectionLineNumber)},get isContextMenuOpen(){return e.contextMenuPosition!==null}})}}),X(az,{get each(){return e.labelInstances??[]},children:t=>X(CG,{get tagName(){return t().tagName},get componentName(){return t().componentName},get elementsCount(){return t().elementsCount},get selectionBounds(){return t().bounds},get mouseX(){return t().mouseX},visible:!0,get status(){return t().status},get statusText(){return t().statusText},get isPromptMode(){return t().isPromptMode},get inputValue(){return t().inputValue},get error(){return t().errorMessage},get hideArrow(){return t().hideArrow},get onShowContextMenu(){let n=t();if(!(!(n.status===`copied`||n.status===`fading`)||!sB(n.element)))return()=>e.onShowContextMenuInstance?.(n.id)},onHoverChange:n=>e.onLabelInstanceHoverChange?.(t().id,n)})}),X(oz,{get when(){return e.toolbarVisible!==!1},get children(){return X(ZG,{get isActive(){return e.isActive},get isContextMenuOpen(){return e.contextMenuPosition!==null},get onToggle(){return e.onToggleActive},get onActivateAction(){return e.onActivateAction},get activeActionId(){return e.activeActionId},get enabled(){return e.enabled},get shakeCount(){return e.shakeCount},get onStateChange(){return e.onToolbarStateChange},get onSubscribeToStateChanges(){return e.onSubscribeToToolbarStateChanges},get onSelectHoverChange(){return e.onToolbarSelectHoverChange},get onContainerRef(){return e.onToolbarRef},get onToggleToolbarMenu(){return e.onToggleToolbarMenu}})}}),X(DK,{get position(){return e.contextMenuPosition??null},get selectionBounds(){return e.contextMenuBounds??null},get tagName(){return e.contextMenuTagName},get componentName(){return e.contextMenuComponentName},get hasFilePath(){return e.contextMenuHasFilePath??!1},get actions(){return e.actions},get actionContext(){return e.actionContext},get onDismiss(){return e.onContextMenuDismiss??(()=>{})},get onHide(){return e.onContextMenuHide??(()=>{})}}),X(xJ,{get position(){return e.toolbarMenuPosition??null},get actions(){return e.toolbarMenuActions??[]},get defaultActionId(){return e.defaultActionId??`copy`},get onSetDefaultAction(){return e.onSetDefaultAction??(()=>{})},get onDismiss(){return e.onToolbarMenuDismiss??(()=>{})}}),X(TJ,{get position(){return e.hierarchyMenuPosition??null},get state(){return e.hierarchyState}}),X(_J,{get state(){return e.editPanelState??null},get position(){return e.editPanelPosition??null},get onDismiss(){return e.onEditPanelDismiss??(()=>{})},get onSubmit(){return e.onEditPanelSubmit??(()=>{})},get onPendingEditsChange(){return e.onEditPanelPendingEditsChange},get onInteractingChange(){return e.onEditPanelInteractingChange}})]}));function OJ(e){let t=e[Pz];if(!t&&(Object.defineProperty(e,Pz,{value:t=new Proxy(e,qJ)}),!Array.isArray(e))){let n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let i=0,a=n.length;i<a;i++){let a=n[i];r[a].get&&Object.defineProperty(e,a,{enumerable:r[a].enumerable,get:r[a].get.bind(t)})}}return t}function kJ(e){let t;return typeof e==`object`&&!!e&&(e[Pz]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function AJ(e,t=new Set){let n,r,i,a;if(n=e!=null&&e[UJ])return n;if(!kJ(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let n=0,a=e.length;n<a;n++)i=e[n],(r=AJ(i,t))!==i&&(e[n]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);let n=Object.keys(e),o=Object.getOwnPropertyDescriptors(e);for(let s=0,c=n.length;s<c;s++)a=n[s],!o[a].get&&(i=e[a],(r=AJ(i,t))!==i&&(e[a]=r))}return e}function jJ(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function MJ(e,t,n){if(e[t])return e[t];let[r,i]=J(n,{equals:!1,internal:!0});return r.$=i,e[t]=r}function NJ(e,t){let n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===Pz||t===WJ?n:(delete n.value,delete n.writable,n.get=()=>e[Pz][t],n)}function PJ(e){DR()&&MJ(jJ(e,WJ),KJ)()}function FJ(e){return PJ(e),Reflect.ownKeys(e)}function IJ(e,t,n,r=!1){if(!r&&e[t]===n)return;let i=e[t],a=e.length;n===void 0?(delete e[t],e[GJ]&&e[GJ][t]&&i!==void 0&&e[GJ][t].$()):(e[t]=n,e[GJ]&&e[GJ][t]&&i===void 0&&e[GJ][t].$());let o=jJ(e,WJ),s;if((s=MJ(o,t,i))&&s.$(()=>n),Array.isArray(e)&&e.length!==a){for(let t=e.length;t<a;t++)(s=o[t])&&s.$();(s=MJ(o,`length`,a))&&s.$(e.length)}(s=o[KJ])&&s.$()}function LJ(e,t){let n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];IJ(e,i,t[i])}}function RJ(e,t){if(typeof t==`function`&&(t=t(e)),t=AJ(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){let r=t[n];e[n]!==r&&IJ(e,n,r)}IJ(e,`length`,r)}else LJ(e,t)}function zJ(e,t,n=[]){let r,i=e;if(t.length>1){r=t.shift();let a=typeof r,o=Array.isArray(e);if(Array.isArray(r)){for(let i=0;i<r.length;i++)zJ(e,[r[i]].concat(t),n);return}else if(o&&a===`function`){for(let i=0;i<e.length;i++)r(e[i],i)&&zJ(e,[i].concat(t),n);return}else if(o&&a===`object`){let{from:i=0,to:a=e.length-1,by:o=1}=r;for(let r=i;r<=a;r+=o)zJ(e,[r].concat(t),n);return}else if(t.length>1){zJ(e[r],t,[r].concat(n));return}i=e[r],n=[r].concat(n)}let a=t[0];typeof a==`function`&&(a=a(i,n),a===i)||r===void 0&&a==null||(a=AJ(a),r===void 0||kJ(i)&&kJ(a)&&!Array.isArray(a)?LJ(i,a):IJ(e,r,a))}function BJ(...[e,t]){let n=AJ(e||{}),r=Array.isArray(n),i=OJ(n);function a(...e){SR(()=>{r&&e.length===1?RJ(n,e[0]):zJ(n,e)})}return[i,a]}function VJ(e){return t=>{if(kJ(t)){let n;(n=JJ.get(t))||JJ.set(t,n=new Proxy(t,YJ)),e(n)}return t}}var HJ,UJ,WJ,GJ,KJ,qJ,JJ,YJ,XJ,ZJ,QJ,$J,eY,tY,nY,rY,iY,aY,oY,sY,cY,lY,uY,dY,fY,pY,mY,hY,gY,_Y,vY,yY,bY,xY,SY,CY,wY,TY,EY,DY,OY,kY,AY,jY,MY,NY,PY,FY,IY,LY,RY,zY,BY,VY,HY,UY,WY,GY,KY,qY,JY,YY,XY,ZY,QY,$Y,eX,tX,nX,rX,iX,aX,oX,sX,cX,lX,uX,dX,fX,pX,mX,hX,gX,_X,vX,yX,bX,xX,SX,CX,wX,TX,EX,DX,OX,kX,AX,jX,MX,NX,PX,FX,IX,LX,RX,zX,BX,VX,HX,UX,WX,GX,KX,qX,JX,YX,XX,ZX,QX,$X,eZ,tZ,nZ,rZ,iZ,aZ,oZ,sZ,cZ,lZ,uZ,dZ,fZ,pZ,mZ,hZ,gZ,_Z,vZ,yZ,bZ,xZ,SZ,CZ,wZ,TZ,EZ,DZ,OZ,kZ=t((()=>{KV(),pR(),iW(),HJ=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
259
259
  @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Geist", ui-sans-serif, system-ui, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500:oklch(63.7% .237 25.331);--spacing:4px;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--radius-sm:4px;--ease-out:cubic-bezier(0, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--ease-drawer:cubic-bezier(.32, .72, 0, 1);--ease-spring:cubic-bezier(.34, 1.56, .64, 1)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.a11y-hitbox{position:relative}.a11y-hitbox:before{content:"";pointer-events:auto;width:100%;min-width:24px;height:100%;min-height:24px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-full{right:100%}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.left-0{left:calc(var(--spacing) * 0)}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:calc(var(--spacing) * 0)}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.-mt-\\[8px\\]{margin-top:-8px}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.no-scrollbar::-webkit-scrollbar{width:0;height:0;display:none}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.size-0{width:calc(var(--spacing) * 0);height:calc(var(--spacing) * 0)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[28px\\]{min-height:28px}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.flex-shrink,.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.interactive-scale{transition:transform .4s cubic-bezier(.34,1.56,.64,1)}@media (hover:hover) and (pointer:fine){.interactive-scale:hover{transform:scale(1.05)}}.interactive-scale:active{transition:transform 60ms cubic-bezier(0,0,.2,1);transform:scale(.96)}.press-scale{transition:transform .4s cubic-bezier(.34,1.56,.64,1)}.press-scale:active{transition:transform 60ms cubic-bezier(0,0,.2,1);transform:scale(.97)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:calc(var(--spacing) * 0)}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-\\[5px\\]{gap:5px}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:4px}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:4px;border-bottom-left-radius:4px}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:4px}.rounded-r{border-top-right-radius:4px;border-bottom-right-radius:4px}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:4px}.rounded-b{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:4px}.rounded-bl{border-bottom-left-radius:4px}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.bg-\\[\\#f00\\]{background-color:red}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-red-500{background-color:var(--color-red-500)}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:calc(var(--spacing) * 0)}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-px{padding-block:1px}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-1{padding-bottom:calc(var(--spacing) * 1)}.text-center{text-align:center}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-drawer{--tw-ease:var(--ease-drawer);transition-timing-function:var(--ease-drawer)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.ease-spring{--tw-ease:var(--ease-spring);transition-timing-function:var(--ease-spring)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:opacity-40:disabled{opacity:.4}}:host{all:initial;direction:ltr}:host,[data-rg-theme=dark]{--rg-panel-bg:#161616;--rg-text-primary:#fff;--rg-text-secondary:#a7a7a7;--rg-surface-hover:#ffffff1a;--rg-surface-active:#ffffff26;--rg-border-subtle:#ffffff1a;--rg-border-button:#fff3;--rg-submit-bg:#fff;--rg-submit-fg:#161616;--rg-error-text:#f87171;--rg-error-bg:#3d1515;--rg-error-bg-hover:#4d1f1f;--rg-shadow:0 2px 8px #00000014;--rg-drop-shadow:drop-shadow(0px 2px 8px #00000014);--rg-shimmer-from:#a1a1aa;--rg-shimmer-to:#d4d4d8;--rg-text-primary-85:#ffffffd9}@media (prefers-color-scheme:dark){:host:not([data-rg-theme]){--rg-panel-bg:#fff;--rg-text-primary:#171717;--rg-text-secondary:#737373;--rg-surface-hover:#0000000d;--rg-surface-active:#00000014;--rg-border-subtle:#00000014;--rg-border-button:#00000026;--rg-submit-bg:#171717;--rg-submit-fg:#fff;--rg-error-text:#dc2626;--rg-error-bg:#fee2e2;--rg-error-bg-hover:#fecaca;--rg-shadow:0 2px 12px #0000001a;--rg-drop-shadow:drop-shadow(0px 2px 12px #0000001a);--rg-shimmer-from:#71717a;--rg-shimmer-to:#a1a1aa;--rg-text-primary-85:#171717d9}}:host([data-rg-theme=light]),[data-rg-theme=light]{--rg-panel-bg:#fff;--rg-text-primary:#171717;--rg-text-secondary:#737373;--rg-surface-hover:#0000000d;--rg-surface-active:#00000014;--rg-border-subtle:#00000014;--rg-border-button:#00000026;--rg-submit-bg:#171717;--rg-submit-fg:#fff;--rg-error-text:#dc2626;--rg-error-bg:#fee2e2;--rg-error-bg-hover:#fecaca;--rg-shadow:0 2px 12px #0000001a;--rg-drop-shadow:drop-shadow(0px 2px 12px #0000001a);--rg-shimmer-from:#71717a;--rg-shimmer-to:#a1a1aa;--rg-text-primary-85:#171717d9}@keyframes rg-slot-enter-up{0%{filter:blur(2px);opacity:0;transform:translateY(.5em)scale(.5)}to{filter:blur();opacity:1;transform:translateY(0)scale(1)}}@keyframes rg-slot-exit-up{0%{filter:blur();opacity:1;transform:translateY(0)scale(1)}to{filter:blur(2px);opacity:0;transform:translateY(-.5em)scale(.5)}}@keyframes rg-slot-enter-down{0%{filter:blur(2px);opacity:0;transform:translateY(-.5em)scale(.5)}to{filter:blur();opacity:1;transform:translateY(0)scale(1)}}@keyframes rg-slot-exit-down{0%{filter:blur();opacity:1;transform:translateY(0)scale(1)}to{filter:blur(2px);opacity:0;transform:translateY(.5em)scale(.5)}}@keyframes rg-slot-enter-fade{0%{filter:blur(2px);opacity:0;transform:scale(.5)}to{filter:blur();opacity:1;transform:scale(1)}}@keyframes rg-slot-exit-fade{0%{filter:blur();opacity:1;transform:scale(1)}to{filter:blur(2px);opacity:0;transform:scale(.5)}}.rg-slot-column{vertical-align:top;display:inline-block;position:relative}.rg-slot-sizer{visibility:hidden;white-space:pre;display:inline-block}.rg-slot-cell{white-space:pre;will-change:transform, filter, opacity;animation-duration:var(--rg-slot-dur,.35s);animation-timing-function:var(--rg-slot-ease,cubic-bezier(.34, 1.56, .64, 1));animation-fill-mode:both;display:inline-block;position:absolute;top:0;left:0}.rg-slot-cell.rg-slot-enter[data-dir="1"]{animation-name:rg-slot-enter-up}.rg-slot-cell.rg-slot-enter[data-dir="-1"]{animation-name:rg-slot-enter-down}.rg-slot-cell.rg-slot-enter[data-dir="0"]{animation-name:rg-slot-enter-fade}.rg-slot-cell.rg-slot-exit[data-dir="1"]{animation-name:rg-slot-exit-up}.rg-slot-cell.rg-slot-exit[data-dir="-1"]{animation-name:rg-slot-exit-down}.rg-slot-cell.rg-slot-exit[data-dir="0"]{animation-name:rg-slot-exit-fade}@media (prefers-reduced-motion:reduce){:host,:host *,:host :before,:host :after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}:host :focus,:host :focus-visible{box-shadow:none!important;outline:none!important}@keyframes shake{0%,to{translate:0}15%,45%{translate:calc(-3px * var(--rg-shake-x,1)) calc(-3px * var(--rg-shake-y,0))}30%,60%{translate:calc(3px * var(--rg-shake-x,1)) calc(3px * var(--rg-shake-y,0))}75%{translate:calc(-2px * var(--rg-shake-x,1)) calc(-2px * var(--rg-shake-y,0))}90%{translate:calc(2px * var(--rg-shake-x,1)) calc(2px * var(--rg-shake-y,0))}}@keyframes icon-loader-spin{0%{opacity:1}50%{opacity:.5}to{opacity:.2}}.icon-loader-bar{animation:.5s linear infinite icon-loader-spin}@keyframes shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}.shimmer-text{background:linear-gradient(90deg, var(--rg-shimmer-from) 0%, var(--rg-shimmer-to) 25%, var(--rg-shimmer-from) 50%, var(--rg-shimmer-to) 75%, var(--rg-shimmer-from) 100%);color:#0000;background-size:200% 100%;-webkit-background-clip:text;background-clip:text;animation:2.5s linear infinite shimmer}.animate-shake,.animate-shake-vertical{will-change:translate;animation:.3s ease-out shake}@keyframes tooltip-fade-in{0%{opacity:0;transform:scale(.97)}to{opacity:1;transform:scale(1)}}.animate-tooltip-fade-in{will-change:transform, opacity;animation:.1s ease-out tooltip-fade-in}.animate-shake-vertical{--rg-shake-x:0;--rg-shake-y:1}@supports (-webkit-touch-callout:none){textarea[data-react-grab-input]{font-size:16px}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}`,UJ=Symbol(`store-raw`),WJ=Symbol(`store-node`),GJ=Symbol(`store-has`),KJ=Symbol(`store-self`),qJ={get(e,t,n){if(t===UJ)return e;if(t===Pz)return n;if(t===Iz)return PJ(e),n;let r=jJ(e,WJ),i=r[t],a=i?i():e[t];if(t===WJ||t===GJ||t===`__proto__`)return a;if(!i){let n=Object.getOwnPropertyDescriptor(e,t);DR()&&(typeof a!=`function`||e.hasOwnProperty(t))&&!(n&&n.get)&&(a=MJ(r,t,a)())}return kJ(a)?OJ(a):a},has(e,t){return t===UJ||t===Pz||t===Iz||t===WJ||t===GJ||t===`__proto__`?!0:(DR()&&MJ(jJ(e,GJ),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:FJ,getOwnPropertyDescriptor:NJ},JJ=new WeakMap,YJ={get(e,t){if(t===UJ)return e;let n=e[t],r;return kJ(n)?JJ.get(n)||(JJ.set(n,r=new Proxy(n,YJ)),r):n},set(e,t,n){return IJ(e,t,AJ(n)),!0},deleteProperty(e,t){return IJ(e,t,void 0,!0),!0}},XJ=new WeakMap,ZJ=new WeakMap,QJ=()=>{XJ=new WeakMap,ZJ=new WeakMap},$J=(e,t,n)=>{let r=ZJ.get(e);if(r&&n-r.timestamp<200)return r.borderRadius;let i=(t??window.getComputedStyle(e)).borderRadius||`0px`;return ZJ.set(e,{borderRadius:i,timestamp:n}),i},eY=e=>{let t=performance.now(),n=XJ.get(e);if(n&&t-n.timestamp<16)return n.bounds;let r=e.getBoundingClientRect(),i={borderRadius:$J(e,null,t),height:r.height,width:r.width,x:r.left,y:r.top};return XJ.set(e,{bounds:i,timestamp:t}),i},tY=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),nY=e=>({selectionInteractionLockDepth:0,wasActivatedByToggle:!1,pendingCommentMode:!1,keyHoldDuration:e.keyHoldDuration,dragStart:{x:UM,y:UM},copyStart:{x:UM,y:UM},copyOffsetFromCenterX:0,detectedElement:null,frozenElement:null,frozenElements:[],frozenDragRect:null,lastGrabbedElement:null,selectionFilePath:null,selectionLineNumber:null,inputText:``,grabbedBoxes:[],labelInstances:[],isTouchMode:!1,activationTimestamp:null,previouslyFocusedElement:null,contextMenuPosition:null,contextMenuElement:null,contextMenuClickOffset:null}),rY=e=>{let[t,n]=BJ(nY(e)),[r,i]=J({x:UM,y:UM}),[a,o]=J(0),[s,c]=J({state:`idle`}),l=e=>{n(VJ(t=>{e(t),t.frozenElement=t.frozenElements.length>0?t.frozenElements[0]:null,t.frozenDragRect=null}))},u=()=>{l(e=>{e.frozenElements=[]})},d=e=>{c(t=>t.state===`active`?{...t,phase:e}:t)},f={startHold:e=>{e!==void 0&&n(`keyHoldDuration`,e),c({state:`holding`,startedAt:Date.now()})},releaseHold:()=>{s().state===`holding`&&c({state:`idle`})},activate:()=>{SR(()=>{c({state:`active`,phase:`hovering`,isPromptMode:!1,isPendingDismiss:!1}),n(`activationTimestamp`,Date.now()),n(`previouslyFocusedElement`,document.activeElement)})},deactivate:()=>{SR(()=>{c({state:`idle`}),n(VJ(e=>{e.wasActivatedByToggle=!1,e.pendingCommentMode=!1,e.inputText=``,e.frozenElement=null,e.frozenElements=[],e.frozenDragRect=null,e.activationTimestamp=null,e.previouslyFocusedElement=null,e.contextMenuPosition=null,e.contextMenuElement=null,e.contextMenuClickOffset=null,e.isTouchMode&&(e.detectedElement=null)}))})},toggle:()=>{t.activationTimestamp===null?(n(`wasActivatedByToggle`,!0),f.activate()):f.deactivate()},freeze:()=>{if(s().state===`active`){let e=t.frozenElement??t.detectedElement;e&&n(`frozenElement`,e),d(`frozen`)}},unfreeze:()=>{s().state===`active`&&SR(()=>{n(VJ(e=>{e.frozenElement=null,e.frozenElements=[],e.frozenDragRect=null})),d(`hovering`)})},startDrag:(e,t)=>{s().state===`active`&&SR(()=>{t||u(),n(`dragStart`,{x:e.x+window.scrollX,y:e.y+window.scrollY}),d(`dragging-select`)})},startDragReposition:()=>{let e=s();e.state===`active`&&e.phase===`dragging-select`&&d(`dragging-reposition`)},stopDragReposition:()=>{let e=s();e.state===`active`&&e.phase===`dragging-reposition`&&d(`dragging-select`)},shiftDragStart:e=>{let t=s();t.state===`active`&&t.phase===`dragging-reposition`&&n(`dragStart`,t=>({x:t.x+e.x,y:t.y+e.y}))},endDrag:()=>{let e=s();e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)&&SR(()=>{n(`dragStart`,{x:-1e3,y:-1e3}),d(`justDragged`)})},cancelDrag:()=>{let e=s();e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)&&SR(()=>{n(`dragStart`,{x:-1e3,y:-1e3}),d(`hovering`)})},finishJustDragged:()=>{let e=s();e.state===`active`&&e.phase===`justDragged`&&d(`hovering`)},startCopy:()=>{let e=s().state===`active`;c({state:`copying`,startedAt:Date.now(),wasActive:e})},completeCopy:()=>{let e=s(),t=e.state===`copying`&&e.wasActive;c({state:`justCopied`,copiedAt:Date.now(),wasActive:t})},finishJustCopied:()=>{let e=s();e.state===`justCopied`&&(e.wasActive&&!t.wasActivatedByToggle?SR(()=>{u(),c({state:`active`,phase:`hovering`,isPromptMode:!1,isPendingDismiss:!1})}):f.deactivate())},enterPromptMode:(e,t)=>{let{x:r}=tY(eY(t));SR(()=>{n(`copyStart`,e),n(`copyOffsetFromCenterX`,e.x-r),i(e),n(`frozenElement`,t),n(`wasActivatedByToggle`,!0),s().state===`active`?c(e=>e.state===`active`?{...e,isPromptMode:!0,phase:`frozen`}:e):(c({state:`active`,phase:`frozen`,isPromptMode:!0,isPendingDismiss:!1}),n(`activationTimestamp`,Date.now()),n(`previouslyFocusedElement`,document.activeElement))})},exitPromptMode:()=>{c(e=>e.state===`active`?{...e,isPromptMode:!1,isPendingDismiss:!1}:e)},setInputText:e=>{n(`inputText`,e)},clearInputText:()=>{n(`inputText`,``)},setPendingDismiss:e=>{c(t=>t.state===`active`?{...t,isPendingDismiss:e}:t)},setPointer:e=>{i(t=>t.x===e.x&&t.y===e.y?t:e)},setDetectedElement:e=>{n(`detectedElement`,e)},setFrozenElement:e=>{l(t=>{t.frozenElements=[e]})},setFrozenElements:e=>{l(t=>{t.frozenElements=e})},toggleFrozenElement:e=>{l(t=>{let n=t.frozenElements.indexOf(e);n>=0?t.frozenElements.splice(n,1):t.frozenElements.push(e)})},addFrozenElements:e=>{l(t=>{for(let n of e)t.frozenElements.includes(n)||t.frozenElements.push(n)})},setFrozenDragRect:e=>{n(`frozenDragRect`,e)},setCopyStart:(e,t)=>{let{x:r}=tY(eY(t));n(`copyStart`,e),n(`copyOffsetFromCenterX`,e.x-r)},setLastGrabbed:e=>{n(`lastGrabbedElement`,e)},setWasActivatedByToggle:e=>{n(`wasActivatedByToggle`,e)},setPendingCommentMode:e=>{n(`pendingCommentMode`,e)},setTouchMode:e=>{n(`isTouchMode`,e)},incrementSelectionInteractionLockDepth:()=>{n(`selectionInteractionLockDepth`,e=>e+1)},decrementSelectionInteractionLockDepth:()=>{n(`selectionInteractionLockDepth`,e=>Math.max(0,e-1))},setSelectionSource:(e,t)=>{SR(()=>{n(`selectionFilePath`,e),n(`selectionLineNumber`,t)})},incrementViewportVersion:()=>{o(e=>e+1)},addGrabbedBox:e=>{n(`grabbedBoxes`,t=>[...t,e])},removeGrabbedBox:e=>{n(`grabbedBoxes`,t=>t.filter(t=>t.id!==e))},clearGrabbedBoxes:()=>{n(`grabbedBoxes`,[])},addLabelInstance:e=>{n(`labelInstances`,t=>[...t,e])},updateLabelInstance:(e,r,i)=>{let a=t.labelInstances.findIndex(t=>t.id===e);a!==-1&&SR(()=>{n(`labelInstances`,a,`status`,r),i!==void 0&&n(`labelInstances`,a,`errorMessage`,i)})},removeLabelInstance:e=>{n(`labelInstances`,t=>t.filter(t=>t.id!==e))},clearLabelInstances:()=>{n(`labelInstances`,[])},showContextMenu:(e,t)=>{let{x:r,y:i}=tY(eY(t));SR(()=>{n(`contextMenuPosition`,e),n(`contextMenuElement`,t),n(`contextMenuClickOffset`,{x:e.x-r,y:e.y-i})})},hideContextMenu:()=>{SR(()=>{n(`contextMenuPosition`,null),n(`contextMenuElement`,null),n(`contextMenuClickOffset`,null)})},updateContextMenuPosition:()=>{let e=t.contextMenuElement,r=t.contextMenuClickOffset;if(!e||!r||!sB(e))return;let{x:i,y:a}=tY(eY(e));n(`contextMenuPosition`,{x:i+r.x,y:a+r.y})}};return{store:t,actions:f,pointer:r,viewportVersion:a,current:s}},iY=e=>{if(!document.body)return;let t=document.querySelectorAll(`[${BM}]`);for(let n of t)n!==e&&n.parentNode!==e&&(n.shadowRoot||n.remove());document.body.appendChild(e)},aY=e=>{if(document.body){iY(e);return}let t=()=>{document.removeEventListener(`DOMContentLoaded`,t),iY(e)};document.addEventListener(`DOMContentLoaded`,t,{once:!0})},oY=e=>{let t=document.querySelectorAll(`[${BM}]`);for(let e of t){let t=e.shadowRoot?.querySelector(`[${BM}]`);if(t instanceof HTMLDivElement)return{root:t,host:e};e.remove()}let n=document.createElement(`div`);n.setAttribute(BM,`true`),HN(n),n.style.zIndex=String(XM),n.style.position=`fixed`,n.style.inset=`0`,n.style.pointerEvents=`none`,n.style.contain=`strict`;let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`),a=BN();a&&(i.nonce=a),i.textContent=`@import url("https://fonts.googleapis.com/css2?family=Geist:wght@500&display=swap");\n${e??``}`,r.appendChild(i);let o=document.createElement(`div`);return o.setAttribute(BM,`true`),r.appendChild(o),aY(n),setTimeout(()=>{iY(n)},SN),{root:o,host:n}},sY=e=>{let[t,n]=J(void 0),r=0;return yR(wR(e,e=>{let t=++r;if(!e){n(void 0);return}let i=VU(e)??void 0;n(i),NU(e).then(e=>{r===t&&n(e??i)}).catch(()=>{r===t&&n(i)})})),[t,n]},cY=[`data-theme`,`data-mode`,`data-color-scheme`,`data-bs-theme`,`data-mui-color-scheme`,`data-mantine-color-scheme`],lY=[{attribute:`data-dark`,theme:`dark`},{attribute:`data-light`,theme:`light`}],uY=(e,t,n)=>{let[r,i,a]=[e,t,n].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a},dY=(e,t=0)=>{let n=jB(e),r=n?gB(n):null;return!r||r.alpha<=t?null:uY(r.red,r.green,r.blue)},fY=e=>{let t=dY(e);return t===null?null:t<.18?`dark`:`light`},pY=e=>fY(getComputedStyle(e).backgroundColor),mY=()=>{let e=dY(getComputedStyle(document.documentElement).color,mN);return e===null?null:e>.6?`dark`:null},hY=()=>{let e=document.createElement(`div`);e.style.cssText=`position:fixed;width:0;height:0;background-color:Canvas!important`,document.documentElement.appendChild(e);let t=fY(getComputedStyle(e).backgroundColor);return e.remove(),t},gY=e=>{let t=e.toLowerCase();return t===`dark`?`dark`:t===`light`?`light`:null},_Y=e=>{let t=e.style.colorScheme||getComputedStyle(e).colorScheme;return t?t.trim().toLowerCase().split(/\s+/):[]},vY=e=>{let t=_Y(e),n=t.includes(`dark`);return n===t.includes(`light`)?null:n?`dark`:`light`},yY=e=>{if(e.classList.contains(`dark`))return`dark`;if(e.classList.contains(`light`))return`light`;for(let t of cY){let n=e.getAttribute(t);if(!n)continue;let r=gY(n);if(r)return r}for(let{attribute:t,theme:n}of lY)if(e.hasAttribute(t))return n;return null},bY=(e,t)=>{for(let n of e){if(!n)continue;let e=t(n);if(e)return e}return null},xY=()=>{let e=[document.documentElement,document.body],t=[document.body,document.documentElement];return bY(e,yY)??bY(e,vY)??bY(t,pY)??mY()??hY()??`light`},SY=e=>e===`dark`?`light`:`dark`,CY=()=>{let e=[];for(let t of[document.documentElement,document.body]){if(!t)continue;e.push(t.className);for(let n of cY)e.push(t.getAttribute(n)??``);for(let{attribute:n}of lY)e.push(t.hasAttribute(n)?`1`:``);let n=t.style;e.push(n.colorScheme,n.backgroundColor,n.color);for(let t=0;t<n.length;t++){let r=n[t];r.startsWith(`--`)&&e.push(`${r}:${n.getPropertyValue(r)}`)}}return e.join(`|`)},wY={attributes:!0,attributeFilter:[`class`,`style`,...cY,...lY.map(({attribute:e})=>e)]},TY=(e,t)=>{let n=null,r=null,i=null,a=()=>{let i=CY();if(i===r&&n!==null)return getComputedStyle(document.body??document.documentElement).backgroundColor,n;r=i;let a=SY(xY());return a!==n&&(n=a,e.setAttribute(`data-rg-theme`,a),t?.(a)),a},o=()=>{i===null&&(i=nI(()=>{i=null,a()}))},s=a(),c=new MutationObserver(o);c.observe(document.documentElement,wY);let l=null;document.body?c.observe(document.body,wY):(l=new MutationObserver(()=>{document.body&&(l.disconnect(),l=null,c.observe(document.body,wY),a())}),l.observe(document.documentElement,{childList:!0}));let u=()=>{r=null,o()},d=window.matchMedia(`(prefers-color-scheme: dark)`);return d.addEventListener(`change`,u),{theme:s,cleanup:()=>{l?.disconnect(),c.disconnect(),d.removeEventListener(`change`,u),i!==null&&rI(i)}}},EY=()=>{},DY=()=>({activate:EY,deactivate:EY,toggle:EY,comment:EY,isActive:()=>!1,isEnabled:()=>!1,setEnabled:EY,getToolbarState:()=>null,setToolbarState:EY,onToolbarStateChange:()=>EY,reset:EY,dispose:EY,copyElement:()=>Promise.resolve(!1),getSource:()=>Promise.resolve(null),getStackContext:()=>Promise.resolve(``),getState:()=>({isActive:!1,isDragging:!1,isCopying:!1,isPromptMode:!1,isSelectionBoxVisible:!1,isDragBoxVisible:!1,targetElement:null,dragBounds:null,grabbedBoxes:[],labelInstances:[],selectionFilePath:null,toolbarState:null}),setOptions:EY,registerPlugin:EY,unregisterPlugin:EY,getPlugins:()=>[],getDisplayName:()=>null}),OY=()=>{let e=new AbortController;return{signal:e.signal,abort:()=>e.abort(),addWindowListener:(t,n,r={})=>{window.addEventListener(t,n,{...r,signal:e.signal})},addDocumentListener:(t,n,r={})=>{document.addEventListener(t,n,{...r,signal:e.signal})}}},kY=(e,t=`Unknown error`)=>e instanceof Error&&e.message?e.message:t,AY=e=>e instanceof Error?e:Error(String(e)),jY=e=>({functionName:e.functionName,fileName:e.fileName,lineNumber:e.lineNumber,columnNumber:e.columnNumber,isServer:e.isServer,isSymbolicated:e.isSymbolicated}),MY=async(e,t)=>{let n={maxLines:t},[r,i,a,o]=await Promise.all([eW(e,n),QU(e,n),BU(e),MU(e)]);return{tagName:RN(e),componentName:a?.componentName??void 0,content:`[${r}]`,source:a,stackContext:i,frames:(o??[]).map(jY)}},NY=async(e,t)=>{let n=await Promise.all(e.map(e=>MY(e,t))),r=new Map;for(let e of n)r.has(e.content)||r.set(e.content,e);let i=[...r.values()];return i.length>0?{content:i.map(e=>e.content).join(`
260
260
  `),entries:i}:null},PY=(e,t,n)=>{if(e?.entries)return t===e.content?e.entries:e.entries.length===1?[{...e.entries[0],content:t,commentText:n}]:e.entries.map(e=>({...e,commentText:n}))},FY=async(e,t,n,r)=>{await t.onBeforeCopy(n);let i=!1,a=``;try{let o=e.getContent?{content:await e.getContent(n)}:await NY(n,e.maxContextLines),s=o?.content;if(s?.trim()){let c=await t.transformCopyContent(s,n);a=r?`${r}\n${c}`:c,i=rW(a,{componentName:e.componentName,entries:PY(o,a,r)})}}catch(e){t.onCopyError(AY(e))}return i&&t.onCopySuccess(n,a),t.onAfterCopy(n,i),i},IY=(e,t)=>{let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return Math.max(0,i-n)*Math.max(0,a-r)},LY=(e,t)=>e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top,RY=e=>e.sort((e,t)=>{if(e===t)return 0;let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}),zY=e=>{if(e.width<=0||e.height<=0)return[];let t=window.innerWidth,n=window.innerHeight,r=e.x,i=e.y,a=e.x+e.width,o=e.y+e.height,s=r+e.width/2,c=i+e.height/2,l=MB(Math.ceil(e.width/32),3,20),u=MB(Math.ceil(e.height/32),3,20),d=l*u,f=d>100?Math.sqrt(100/d):1,p=MB(Math.floor(l*f),3,20),m=MB(Math.floor(u*f),3,20),h=new Set,g=[],_=(e,r)=>{let i=MB(Math.round(e),0,t-1),a=MB(Math.round(r),0,n-1),o=`${i}:${a}`;h.has(o)||(h.add(o),g.push({x:i,y:a}))};_(r+1,i+1),_(a-1,i+1),_(r+1,o-1),_(a-1,o-1),_(s,i+1),_(s,o-1),_(r+1,c),_(a-1,c),_(s,c);for(let t=0;t<p;t+=1){let n=r+(t+.5)/p*e.width;for(let t=0;t<m;t+=1)_(n,i+(t+.5)/m*e.height)}return g},BY=(e,t,n)=>{let r={left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height},i=new Set,a=zY(e);CI();try{for(let e of a){let t=document.elementsFromPoint(e.x,e.y);for(let e of t)i.add(e)}}finally{wI()}let o=[];for(let e of i)!n&&oI(e)||RM(e)&&t(e)&&o.push(e);let s=new Map;for(let e of o)s.set(e,e.getBoundingClientRect());let c=[];for(let e of o){let t=s.get(e);if(t.width<=0||t.height<=0)continue;let i={left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height};if(n){let n=IY(r,i),a=t.width*t.height;a>0&&n/a>=.75&&c.push(e)}else LY(i,r)&&c.push(e)}return RY(c)},VY=e=>{let t=new Set(e);return e.filter(e=>{for(let n=e.parentElement;n;n=n.parentElement)if(t.has(n))return!1;return!0})},HY=(e,t,n=!0)=>VY(BY(e,t,n)),UY=(e,t)=>e.width<=0?0:MB((t.x-e.x)/e.width,0,1),WY=()=>{QJ(),PI(),hI()},GY=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.pageX-window.scrollX,y:e.pageY-window.scrollY}),KY=e=>({pageX:e.x+window.scrollX,pageY:e.y+window.scrollY,width:e.width,height:e.height}),qY=e=>({borderRadius:`0px`,height:e.height,width:e.width,x:e.x,y:e.y}),JY=(e,t,n)=>{let r=(e,t,n,r)=>{let i=[],a=e,o=0;for(;a&&i.length<n&&o<100;)r(a)&&i.push(a),a=t(a),o+=1;return i},i=r(e.parentElement,e=>e.parentElement,6,t);i.reverse();let a=i.map((e,t)=>({element:e,depth:t,isLast:!0})),o=i.length,s=r(e.previousElementSibling,e=>e.previousElementSibling,7,n),c=r(e.nextElementSibling,e=>e.nextElementSibling,7,n),l=Math.min(s.length,Math.max(3,7-c.length)),u=Math.min(c.length,7-l),d=[...s.slice(0,l).reverse(),e,...c.slice(0,u)],f=r(e.firstElementChild,e=>e.nextElementSibling,6,t),p=d.length-1,m=f.length-1;return d.forEach((t,n)=>{a.push({element:t,depth:o,isLast:n===p}),t===e&&f.forEach((e,t)=>{a.push({element:e,depth:o+1,isLast:t===m})})}),a},YY=e=>e instanceof SVGElement&&!(e instanceof SVGSVGElement),XY=e=>{let t=e.getBoundingClientRect();return t.width>=16||t.height>=16},ZY=(e,t)=>t(e)&&!YY(e)&&XY(e),QY=new Set([`c`,`C`,`с`,`С`,`ȼ`,`Ȼ`,`ↄ`,`Ↄ`,`ᴄ`,`ᶜ`,`ⱼ`,`ⅽ`,`Ⅽ`,`ç`,`Ç`,`ć`,`Ć`,`č`,`Č`,`ĉ`,`Ĉ`,`ċ`,`Ċ`]),$Y=(e,t)=>t===`KeyC`?!0:!e||e.length!==1?!1:QY.has(e),eX=(e,t)=>{if(!e||!t)return!1;let n=e.toLowerCase();return t===`Space`?n===`space`||n===` `:t.startsWith(`Key`)?t.slice(3).toLowerCase()===n:t.startsWith(`Digit`)?t.slice(5)===n:!1},tX={meta:`metaKey`,cmd:`metaKey`,command:`metaKey`,win:`metaKey`,windows:`metaKey`,ctrl:`ctrlKey`,control:`ctrlKey`,shift:`shiftKey`,alt:`altKey`,option:`altKey`,opt:`altKey`},nX=e=>{let t=e.split(`+`).map(e=>e.trim().toLowerCase()),n={metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1,key:null};for(let e of t){let t=tX[e];t?n[t]=!0:n.key=e}return n},rX=e=>{if(typeof e==`function`)return e;let t=nX(e),n=t.key;return e=>{if(n===null){let n=!t.metaKey||e.metaKey||e.key===`Meta`,r=!t.ctrlKey||e.ctrlKey||e.key===`Control`,i=!t.shiftKey||e.shiftKey||e.key===`Shift`,a=!t.altKey||e.altKey||e.key===`Alt`,o=n&&r&&i&&a,s=[t.metaKey,t.ctrlKey,t.shiftKey,t.altKey].filter(Boolean).length,c=[e.metaKey||e.key===`Meta`,e.ctrlKey||e.key===`Control`,e.shiftKey||e.key===`Shift`,e.altKey||e.key===`Alt`].filter(Boolean).length;return o&&c>=s}let r=e.key?.toLowerCase()===n||eX(n,e.code),i=t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?(!t.metaKey||e.metaKey)&&(!t.ctrlKey||e.ctrlKey)&&(!t.shiftKey||e.shiftKey)&&(!t.altKey||e.altKey):!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey;return r&&i}},iX=e=>!e||typeof e==`function`?{metaKey:FB(),ctrlKey:!FB(),shiftKey:!1,altKey:!1,key:null}:nX(e),aX=(e,t)=>{if(t.activationKey)return rX(t.activationKey)(e);let n=(FB()?e.metaKey:e.ctrlKey)&&!e.shiftKey&&!e.altKey;return!!(e.key&&n&&$Y(e.key,e.code))},oX=e=>{if(e.length===0)return{x:0,y:0,width:0,height:0};if(e.length===1)return e[0];let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height);return{x:t,y:n,width:r-t,height:i-n}},sX=e=>{let t=getComputedStyle(e),n={};for(let e of LB)n[e]=t.getPropertyValue(e);return n},cX=e=>{let t={};for(let n of rV)t[n]=e.getPropertyValue(n);return t},lX=e=>{try{let t=e.parentElement;if(!t)return null;let n=e.namespaceURI,r=e.tagName.toLowerCase(),i=n&&n!==`http://www.w3.org/1999/xhtml`?e.ownerDocument.createElementNS(n,r):e.ownerDocument.createElement(r),a=`style`in i?i.style:null;a instanceof CSSStyleDeclaration&&a.setProperty(`display`,`none`,`important`),t.appendChild(i);try{return cX(getComputedStyle(i))}finally{i.remove()}}catch{return null}},uX=new Set([`display`,`width`,`height`]),dX=(e,t,n)=>e.kind===`color`?!1:e.cssProperties.some(e=>uX.has(e))?fX(e):e.cssProperties.every(e=>{let r=t[e],i=n[e];return r===void 0||i===void 0?!1:r===i}),fX=e=>{if(e.kind===`color`)return!1;if(e.kind===`enum`)return e.key===`font-weight`?e.original===`400`:e.options[0]?.value===e.original;let{key:t,original:n}=e;return t.startsWith(`padding`)||t.startsWith(`margin`)||t.includes(`gap`)||t===`border-width`||t.endsWith(`-radius`)||t===`border-radius`?n===0:t===`opacity`?n===100:t===`letter-spacing`||t===`z-index`?n===0:!YB.has(t)&&!!(t===`width`||t===`height`||t===`width,height`||t.startsWith(`max-`)||t.startsWith(`min-`)||t===`line-height`)},pX=e=>{let t=e.trim();if(!t||t===`auto`||t===`normal`||t===`none`)return null;let n=Number.parseFloat(t);return Number.isFinite(n)?t.endsWith(`%`)?{value:n,unit:`%`}:t.endsWith(`rem`)||t.endsWith(`em`)?{value:n*16,unit:`px`}:t.endsWith(`px`)?{value:n,unit:`px`}:{value:n,unit:``}:null},mX=(e,t)=>{let n=pX(e[t]);if(n)return n;if(t===`line-height`){let t=pX(e[`font-size`]);return t?{value:sV(t.value*IN),unit:t.unit||`px`}:null}return HB.has(t)?{value:0,unit:`px`}:null},hX=(e,t)=>{let n=mX(e,t[0]);if(!n)return null;for(let r=1;r<t.length;r++){let i=mX(e,t[r]);if(!i||i.unit!==n.unit||Math.abs(i.value-n.value)>=.5)return null}return n},gX=(e,t)=>e===`opacity`?{value:Math.round(t.value*100),unit:`%`}:UB.has(e)?{value:sV(t.value),unit:``}:{value:sV(t.value),unit:t.unit||`px`},_X=e=>e!==null,vX=(e,t)=>{let n=t.map(t=>{let n=t.longhands.length===1?mX(e,t.longhands[0]):hX(e,t.longhands);return n?{definition:t,value:n}:null}).filter(_X),r=new Map;for(let e of n)for(let t of e.definition.longhands){let n=r.get(t);(!n||e.definition.longhands.length>n.definition.longhands.length)&&r.set(t,e)}let i=new Set(r.values());return n.map(e=>({...e,isCanonical:i.has(e)}))},yX=(e,t,n)=>e===`opacity`?{min:0,max:100}:e===`z-index`?{min:BB,max:VB}:e===`letter-spacing`?{min:-10,max:20}:e===`font-size`?{min:8,max:96}:e===`line-height`?{min:0,max:120}:e.includes(`radius`)?{min:0,max:96}:e===`width`||e===`height`||e===`width,height`||e.startsWith(`min-`)||e.startsWith(`max-`)?{min:0,max:Math.max(512,Math.ceil(t*2))}:YB.has(e)?{min:zB,max:512}:n===`%`?{min:0,max:100}:{min:e.startsWith(`margin`)?RB:0,max:384},bX=(e,t,n)=>{let r=gX(e.key,t),i=r.unit===`px`&&Math.abs(r.value)>1e7,a=yX(e.key,i?0:r.value,r.unit),o=r.value<0?a.min:a.max,s=i?o:r.value;return{kind:`numeric`,key:e.key,label:e.label,cssProperties:e.longhands,min:a.min,max:a.max,value:s,original:s,unit:r.unit,tailwindAliases:FV(e.key),isPrioritized:!1,isDefault:!1,isCanonical:n}},xX=(e,t,n,r=!1)=>{let i=jB(n),a=i?gB(i):null,o=a!==null&&a.alpha!==0;if(!o&&!r)return null;let s=o&&i?i:EN;return{kind:`color`,key:e,label:t,cssProperties:[e],value:s,original:s,tailwindAliases:FV(e),isPrioritized:r,isDefault:!1,isCanonical:!0}},SX=(e,t,n)=>{let r=t.trim(),i=n??e.options;return!i||!i.some(e=>e.value===r)?null:{kind:`enum`,key:e.key,label:e.label,cssProperties:[e.key],value:r,original:r,options:i,tailwindAliases:FV(e.key),isPrioritized:!1,isDefault:!1,isCanonical:!0}},CX=new Map(`background-color.color.padding.padding-left,padding-right.padding-top,padding-bottom.padding-top.padding-right.padding-bottom.padding-left.margin.margin-left,margin-right.margin-top,margin-bottom.margin-top.margin-right.margin-bottom.margin-left.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-transform.text-align.text-decoration-line.white-space.word-break.overflow-wrap.font-variant-numeric.border-radius.border-top-left-radius,border-top-right-radius.border-bottom-left-radius,border-bottom-right-radius.border-top-left-radius,border-bottom-left-radius.border-top-right-radius,border-bottom-right-radius.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.width,height.width.height.max-width.max-height.min-width.min-height.opacity.gap.row-gap.column-gap.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.border-color.align-items.justify-content.top,right,bottom,left.left,right.top,bottom.top.right.bottom.left.z-index`.split(`.`).map((e,t)=>[e,t])),wX=e=>CX.get(e.key)??1/0,TX=e=>e.map((e,t)=>({property:e,index:t})).sort((e,t)=>{let n=wX(e.property)-wX(t.property);return n===0?e.index-t.index:n}).map(e=>e.property),EX=e=>{let t=sX(e),n=getComputedStyle(e),r=cX(n),i=lX(e),a=[],o=new Set,s=e=>{o.has(e.key)||(a.push(e),o.add(e.key))};for(let e of XB)for(let n of vX(t,e))s(bX(n.definition,n.value,n.isCanonical));for(let e of ZB){let n=mX(t,e.key);n&&s(bX({key:e.key,label:e.label,longhands:[e.key]},n,!0))}for(let{key:e,label:t,alwaysShow:r}of QB){let i=n.getPropertyValue(e);if(!r&&(!i||vB(i)))continue;let a=xX(e,t,i,r);a&&s(a)}let c=n.getPropertyValue(tV.key);if(c){let e=SX(tV,c,eV(c));e&&s(e)}for(let e of nV){let t=n.getPropertyValue(e.key);if(!t)continue;let r=SX(e,t);r&&s(r)}return DX(a,PV(e),r,i)},DX=(e,t,n,r)=>{let i=[],a=[];for(let o of e)if(o.isPrioritized||t.has(o.key))i.push({...o,isPrioritized:!0,isDefault:!1});else{let e=r?dX(o,n,r):fX(o);a.push({...o,isDefault:e})}return[...TX(i),...TX(a)]},OX=[{keyword:`letter`,family:`letter-spacing`},{keyword:`tracking`,family:`letter-spacing`},{keyword:`leading`,family:`line-height`},{keyword:`line-height`,family:`line-height`},{keyword:`lineheight`,family:`line-height`},{keyword:`radius`,family:`radius`},{keyword:`rounded`,family:`radius`},{keyword:`corner`,family:`radius`},{keyword:`font-size`,family:`font-size`},{keyword:`fontsize`,family:`font-size`},{keyword:`text`,family:`font-size`},{keyword:`stroke`,family:`border-width`},{keyword:`border-width`,family:`border-width`},{keyword:`borderwidth`,family:`border-width`},{keyword:`space`,family:`spacing`},{keyword:`gap`,family:`spacing`},{keyword:`gutter`,family:`spacing`},{keyword:`inset`,family:`spacing`},{keyword:`padding`,family:`spacing`},{keyword:`margin`,family:`spacing`},{keyword:`size`,family:`size`},{keyword:`width`,family:`size`},{keyword:`height`,family:`size`}],kX=e=>{let t=e.toLowerCase();for(let{keyword:e,family:n}of OX)if(t.includes(e))return n;return null},AX=e=>e.includes(`radius`)?`radius`:e.endsWith(`-width`)&&e.includes(`border`)?`border-width`:e===`font-size`?`font-size`:e===`line-height`?`line-height`:e===`letter-spacing`?`letter-spacing`:e.startsWith(`padding`)||e.startsWith(`margin`)||e.endsWith(`gap`)||e===`top`||e===`right`||e===`bottom`||e===`left`||e.startsWith(`inset`)?`spacing`:e===`width`||e===`height`||e.startsWith(`min-`)||e.startsWith(`max-`)?`size`:null,jX=e=>{let t=pX(e);return!t||t.unit!==`px`?null:sV(t.value)},MX=(e,t)=>t===null?!0:e.length===t.length?e<t:e.length<t.length,NX=(e,t,n)=>{if(n===1){for(let n of e)if(n>t)return n;return null}for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null},PX=(e,t,n)=>{let r=(t===1?Math.floor(e/n)+1:Math.ceil(e/n)-1)*n;return r<0?null:r},FX=null,IX=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),LX=()=>{let e=Array.from(document.adoptedStyleSheets??[]),t=document.styleSheets.length;if(FX&&FX.documentSheetCount===t&&IX(FX.adoptedSheets,e))return FX.names;let n=new Set;for(let t of[...document.styleSheets,...e]){let e;try{e=t.cssRules}catch{continue}RX(e,n)}return FX={documentSheetCount:t,adoptedSheets:e,names:n},n},RX=(e,t)=>{for(let n of Array.from(e))if(n instanceof CSSStyleRule){let e=n.style;for(let n=0;n<e.length;n++){let r=e.item(n);r.startsWith(`--`)&&t.add(r)}}else n instanceof CSSGroupingRule&&RX(n.cssRules,t)},zX={hasTokens:!1,matchColor:()=>null,matchLength:()=>null,stepLength:()=>null},BX=e=>{if(typeof document>`u`)return zX;let t=LX();if(t.size===0)return zX;let n=getComputedStyle(e),r=new Map,i=new Map,a=new Map,o=null;for(let e of t){let t=n.getPropertyValue(e).trim();if(!t)continue;let s=jX(t);if(s!==null){e===`--spacing`&&s>0&&(o=s);let t=kX(e);if(t!==null){let n=i.get(s);n?n.push({name:e,family:t}):i.set(s,[{name:e,family:t}]);let r=a.get(t);r?r.add(s):a.set(t,new Set([s]))}continue}let c=jB(t);if(c){let t=c.toLowerCase();MX(e,r.get(t)??null)&&r.set(t,e)}}if(r.size===0&&i.size===0)return zX;let s=new Map;for(let[e,t]of a)s.set(e,Array.from(t).sort((e,t)=>e-t));return{hasTokens:!0,matchColor:e=>{let t=jB(e)?.toLowerCase();return t?r.get(t)??null:null},matchLength:(e,t)=>{let n=AX(t);if(n===null)return null;let r=i.get(Math.round(e));if(!r)return null;let a=null;for(let e of r)e.family===n&&MX(e.name,a)&&(a=e.name);return a},stepLength:(e,t,n)=>{let r=AX(n);if(r===null)return null;let i=Math.round(e),a=s.get(r);return a&&a.length>=2?NX(a,i,t):(r===`spacing`||r===`size`)&&o?PX(i,t,o):a?NX(a,i,t):null}}},VX=e=>e.kind===`color`||e.kind===`enum`?e.value:e.key===`opacity`&&e.unit===`%`?oV(e.value/100):`${oV(e.value)}${e.unit}`,HX=(e,t,n)=>{if(!n?.hasTokens)return null;let{edit:r}=t;return r.kind===`color`?n.matchColor(r.value):r.kind===`numeric`&&r.unit===`px`?n.matchLength(r.value,e):null},UX=e=>{let t=new Map;for(let n of e.edits){let e=VX(n);for(let r of n.cssProperties)t.set(r,{edit:n,cssValue:e})}let n=!1;return{lines:Array.from(t,([t,r])=>{let i=HX(t,r,e.designTokens);i&&(n=!0);let a=i?` /* var(${i}) */`:``;return`${t}: ${r.cssValue};${a}`}),usesToken:n}},WX=e=>e.filePath?`${e.filePath}:${e.lineNumber}`:``,GX=e=>["```css",...e,"```"].join(`
261
261
  `),KX=e=>{if(e.length===0)return``;let t=e.map(e=>{let{lines:t,usesToken:n}=UX(e);return{header:WX(e),cssLines:t,usesToken:n}}),n=[`Apply these style changes canonically (CSS = visual intent; choose the source change that best expresses the underlying layout intent):`];if(t.some(e=>e.usesToken)&&n.push("Prefer the design token shown in each `/* var(--token) */` comment over the raw value when it matches the project's intent."),t.length===1){let[e]=t;return e.header&&n.push(`\n${e.header}`),n.push(GX(e.cssLines)),n.join(`
262
262
  `)}for(let e of t)n.push(e.header?`\n${e.header}`:``),n.push(GX(e.cssLines));return n.join(`
263
- `)},qX=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,JX=e=>{let t=new Map,n=qX(e)?e:null;return{apply:(e,r)=>{if(n)for(let i of e)t.has(i)||t.set(i,{value:n.style.getPropertyValue(i),priority:n.style.getPropertyPriority(i)}),n.style.setProperty(i,r)},restore:()=>{if(!n){t.clear();return}for(let[e,{value:r,priority:i}]of t)r?n.style.setProperty(e,r,i):n.style.removeProperty(e);t.clear()},hasAppliedStyles:()=>t.size>0}},YX=(e,t)=>{for(let n of t){let t=e.edits.findIndex(e=>e.key===n.key);t>=0?e.edits[t]=n:e.edits.push(n)}},XX=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),ZX=e=>{let[t,n]=J(null),[r,i]=J(!1),a=[],o=[],s=e=>{o=e},c=()=>{let r=t()!==null;n(null),i(!1),a=[],o=[],r&&e.onClose?.()},l=()=>{t()?.preview.restore();for(let e=a.length-1;e>=0;e--)a[e].preview.restore();c()},u=e=>{NU(e).then(t=>{t&&n(n=>!n||n.element!==e||n.componentName?n:{...n,componentName:t})})},d=(r,i,a={})=>{if(t()!==null)return!1;let o=EX(r);if(o.length===0)return!1;let s=a.filePath??e.store.selectionFilePath??void 0,c=a.lineNumber??e.store.selectionLineNumber??void 0;return n({element:r,position:i,selectionBounds:eY(r),properties:o,preview:JX(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??RN(r),initialSearchQuery:a.initialSearchQuery,designTokens:BX(r)}),u(r),e.isActivated()||e.activateRenderer(),e.actions.setPointer(i),e.actions.setFrozenElement(r),e.actions.freeze(),e.onOpen?.(),!0},f=(r,i)=>{let s=t();if(!s||s.element===r)return!1;let c=EX(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(XX(s,o)),o=[],n({element:r,position:i,selectionBounds:eY(r),properties:c,preview:JX(r),tagName:RN(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:BX(r)}),BU(r).then(e=>{if(e){for(let t of a)t.element===r&&!t.filePath&&(t.filePath=e.filePath,t.lineNumber=e.lineNumber??0);n(t=>!t||t.element!==r||t.filePath?t:{...t,filePath:e.filePath,lineNumber:e.lineNumber??void 0})}}).catch(()=>void 0),u(r),e.actions.setPointer(i),e.actions.setFrozenElement(r),!0)},p=(e,t)=>[...a,XX(e,t)],m=e=>{let t=new Map;for(let n of e){if(n.edits.length===0)continue;let e=t.get(n.element);if(e){!e.filePath&&n.filePath&&(e.filePath=n.filePath,e.lineNumber=n.lineNumber),YX(e,n.edits);continue}t.set(n.element,{filePath:n.filePath,lineNumber:n.lineNumber,edits:[...n.edits],designTokens:n.designTokens})}return Array.from(t.values())},h=e=>{let t=new Set;for(let n of e)n.edits.length>0&&t.add(n.element);for(let n=e.length-1;n>=0;n--){let r=e[n];r.edits.length===0&&!t.has(r.element)&&r.preview.restore()}};return{state:t,trigger:d,switchToElement:f,setPendingEdits:s,dismiss:()=>{t()!==null&&(l(),e.store.wasActivatedByToggle?e.deactivateRenderer():e.actions.unfreeze())},closePreservingRenderer:()=>{t()!==null&&(l(),e.actions.unfreeze())},submit:n=>{let r=t();if(!r)return;let i=r.element,a=p(r,n),o=KX(m(a));h(a),c(),e.store.wasActivatedByToggle||e.actions.unfreeze(),e.performCopyWithLabel({element:i,cursorX:r.position.x,extraPrompt:o||void 0,shouldDeactivateAfter:e.store.wasActivatedByToggle})},resetWithDiscard:l,isOpen:()=>t()!==null,isInteracting:r,setInteracting:i}},QX={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},$X=(e,t)=>({enabled:t.enabled??e.enabled,hue:t.hue??e.hue,selectionBox:{enabled:t.selectionBox?.enabled??e.selectionBox.enabled},dragBox:{enabled:t.dragBox?.enabled??e.dragBox.enabled},grabbedBoxes:{enabled:t.grabbedBoxes?.enabled??e.grabbedBoxes.enabled},elementLabel:{enabled:t.elementLabel?.enabled??e.elementLabel.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),eZ={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},tZ=(e={})=>{let t=new Map,n={},[r,i]=BJ({theme:QX,options:{...eZ,...e},actions:[]}),a=()=>{let r=QX,a={...eZ,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=$X(r,e.theme)),e.options&&(a={...a,...e.options}),e.actions)for(let t of e.actions)o.push(t);a={...a,...n},i(`theme`,r),i(`options`,a),i(`actions`,o)},o=(e,t)=>{n[e]=t,i(`options`,e,t)},s=[`activationMode`,`keyHoldDuration`,`allowActivationInsideInput`,`activationKey`,`getContent`,`maxContextLines`,`freezeReactUpdates`],c=e=>{for(let t of s)e[t]!==void 0&&o(t,e[t])},l=(e,n)=>{t.has(e.name)&&u(e.name);let r=e.setup?.(n,_)??{};e.theme&&(r.theme=r.theme?$X($X(QX,e.theme),r.theme):e.theme),e.actions&&(r.actions=[...e.actions,...r.actions??[]]),e.hooks&&(r.hooks=r.hooks?{...e.hooks,...r.hooks}:e.hooks),e.options&&(r.options=r.options?{...e.options,...r.options}:e.options),t.set(e.name,{plugin:e,config:r}),a()},u=e=>{let n=t.get(e);n&&(n.config.cleanup&&n.config.cleanup(),t.delete(e),a())},d=()=>Array.from(t.keys()),f=(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&t(...n)}},p=(e,...n)=>{let r=!1;for(let{config:i}of t.values()){let t=i.hooks?.[e];t&&t(...n)===!0&&(r=!0)}return r},m=async(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&await t(...n)}},h=async(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=await t(i,...r))}return i},g=(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=t(i,...r))}return i},_={onActivate:()=>f(`onActivate`),onDeactivate:()=>f(`onDeactivate`),onElementHover:e=>f(`onElementHover`,e),onElementSelect:e=>{let n=!1,r;for(let{config:i}of t.values()){let t=i.hooks?.onElementSelect;if(t){let i=t(e);i===!0?n=!0:i instanceof Promise&&(n=!0,r=i)}}return{wasIntercepted:n,pendingResult:r}},onDragStart:(e,t)=>f(`onDragStart`,e,t),onDragEnd:(e,t)=>f(`onDragEnd`,e,t),onBeforeCopy:async e=>m(`onBeforeCopy`,e),transformCopyContent:async(e,t)=>h(`transformCopyContent`,e,t),onAfterCopy:(e,t)=>f(`onAfterCopy`,e,t),onCopySuccess:(e,t)=>f(`onCopySuccess`,e,t),onCopyError:e=>f(`onCopyError`,e),onStateChange:e=>f(`onStateChange`,e),onPromptModeChange:(e,t)=>f(`onPromptModeChange`,e,t),onSelectionBox:(e,t,n)=>f(`onSelectionBox`,e,t,n),onDragBox:(e,t)=>f(`onDragBox`,e,t),onGrabbedBox:(e,t)=>f(`onGrabbedBox`,e,t),onElementLabel:(e,t,n)=>f(`onElementLabel`,e,t,n),onContextMenu:(e,t)=>f(`onContextMenu`,e,t),onOpenFile:(e,t)=>p(`onOpenFile`,e,t),transformHtmlContent:async(e,t)=>h(`transformHtmlContent`,e,t),transformAgentContext:async(e,t)=>h(`transformAgentContext`,e,t),transformActionContext:e=>g(`transformActionContext`,e),transformOpenFileUrl:(e,t,n)=>g(`transformOpenFileUrl`,e,t,n)};return{register:l,unregister:u,getPluginNames:d,setOptions:c,store:r,hooks:_}},nZ=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,rZ=e=>{let t=e.bounds.x+e.bounds.width/2,n=e.bounds.width/2,r=e.mouseX===void 0?void 0:e.mouseX-t;return{id:nZ(`label`),bounds:e.bounds,boundsMultiple:e.boundsMultiple,tagName:e.tagName,componentName:e.componentName,status:e.status,createdAt:Date.now(),element:e.element,elements:e.elements,mouseX:e.mouseX,mouseXOffsetFromCenter:r,mouseXOffsetRatio:r!==void 0&&n>0?r/n:void 0,hideArrow:e.hideArrow}},iZ=(e,t)=>{let n=new Map,r=e=>{let t=n.get(e);t!==void 0&&(window.clearTimeout(t),n.delete(e))},i=()=>{for(let e of n.values())window.clearTimeout(e);n.clear()},a=()=>{i(),e.clearLabelInstances()},o=t=>{r(t);let i=window.setTimeout(()=>{e.updateLabelInstance(t,`fading`);let r=window.setTimeout(()=>{n.delete(t),e.removeLabelInstance(t)},125);n.set(t,r)},GM);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=rZ({bounds:t,tagName:n,componentName:r,status:i,element:o?.element,mouseX:o?.mouseX,elements:o?.elements,boundsMultiple:o?.boundsMultiple,hideArrow:o?.hideArrow});return e.addLabelInstance(s),s.id},createPerElementInstances:(t,n)=>{a();let r=[];for(let i of t){let t=rZ({bounds:eY(i.element),tagName:i.tagName,componentName:i.componentName,status:n,element:i.element,mouseX:i.mouseX});e.addLabelInstance(t),r.push(t.id)}return r},updateAfterCopy:(t,n,r)=>{n?e.updateLabelInstance(t,`copied`):e.updateLabelInstance(t,`error`,r||`Unknown error`),o(t)},cancelAllFades:i,clearAll:a,handleHoverChange:(e,n)=>{if(n){r(e);return}let i=t().find(t=>t.id===e);i&&(i.status===`copied`||i.status===`error`||i.status===`fading`)&&o(e)}}},aZ=e=>{let t=window.innerWidth,n=window.innerHeight,r=Math.max(0,e.x),i=Math.min(t,e.x+e.width),a=Math.max(0,e.y),o=Math.min(n,e.y+e.height);return{x:(r+i)/2,y:(a+o)/2}},oZ=(e,t,n)=>{let r=[],i=(t,r)=>{let i=aZ(n(t)),a=MI(i.x,i.y).filter(e),o=a.indexOf(t);return o===-1?null:a[o+r]??null},a=e=>{let t=i(e,1);return t&&(r.push(e),r.length>50&&(r=r.slice(-50))),t},o=e=>{if(r.length>0){let e=r.pop();if(sB(e))return e}return i(e,-1)},s=(e,n)=>{let i=e=>n?e.nextElementSibling:e.previousElementSibling,a=i(e);for(;a;){if(t(a))return r=[],a;a=i(a)}return null};return{findNext:(e,t)=>{switch(e){case`ArrowUp`:return a(t);case`ArrowDown`:return o(t);case`ArrowRight`:return s(t,!0);case`ArrowLeft`:return s(t,!1);default:return null}},clearHistory:()=>{r=[]}}},sZ=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=iX(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},cZ=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,`key`),n=!1;if(t?.get&&!t.get.__reactGrabPatched){n=!0;let r=t.get,i=function(){return e.has(this)?``:r.call(this)};i.__reactGrabPatched=!0,Object.defineProperty(KeyboardEvent.prototype,"key",{get:i,configurable:!0})}return{claimedEvents:e,originalKeyDescriptor:t,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t)}}},lZ=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),uZ=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=lZ(o.x,o.y),c=0,l=0;if(s.top&&(l-=10),s.bottom&&(l+=10),s.left&&(c-=10),s.right&&(c+=10),c!==0||l!==0){let e=window.scrollX,t=window.scrollY;window.scrollBy(c,l);let r=window.scrollX-e,i=window.scrollY-t;(r!==0||i!==0)&&n?.({x:r,y:i})}r=s.top||s.bottom||s.left||s.right?nI(i):null},a=()=>{r!==null&&(rI(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},dZ=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},fZ=e=>{try{let t=`0.1.48`,n=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 294 294"><path fill="#ff40e0" d="M145 47c25-20 50-27 67-17 16 9 23 30 20 60 0 2-1 5-1 7l-2 13h-1l-12-4c-8-3-17-5-25-6l-17-3c-10-1-20-1-29-1-10 0-20 0-29 1-6 8-11 16-16 24-5 9-9 17-13 26 4 9 8 18 13 26s10 16 16 24l11 14c5 7 11 13 18 19l10 8s-1 0 0 0l-11 9c-17 14-35 22-49 22-6 0-13-2-18-5-16-9-23-30-20-59 1-3 1-5 1-8-30-12-48-29-48-50 0-18 14-35 41-47 2-1 5-2 7-3 0-2 0-5-1-7-3-30 4-51 20-60 18-10 42-3 68 17M71 201c-1 2-1 4-1 5-2 24 3 41 13 47h1c11 7 30 1 51-15-10-9-18-18-26-29-13-1-26-4-38-8m9-38c-3 9-5 17-7 26 8 2 17 4 25 6-3-5-6-10-9-16-3-5-6-10-9-16m-19-53c-2 1-3 1-5 2-21 10-34 23-34 35 0 13 14 27 39 37 3-12 7-25 12-37-5-12-9-24-12-37m37-10c-8 1-17 3-25 6 2 8 4 16 7 25 3-5 6-11 9-16zm-3-61c-4-1-8 0-12 2-10 7-15 24-13 47 0 2 0 3 1 5 12-4 25-6 38-8 8-10 16-20 26-29-15-11-29-17-40-17m111 2c-4-2-8-3-12-2-11 0-25 5-40 17 10 9 19 19 26 29 13 2 26 4 39 8v-5c3-23-2-40-13-47m-61 23c-7 6-13 13-19 19h37c-6-6-12-13-18-19"/><mask id="a"><path fill="#fff" d="m235 85-133 27 28 133 133-27Z"/></mask><path fill="#ff40e0" d="m137 130 76 11c8 1 9 11 3 15l-28 16-4 32c-1 8-10 10-14 4l-41-66c-3-6 1-13 8-12" mask="url(#a)"/></svg>`)}`;console.log(`%cReact Grab${` v${t}`}%c\nhttps://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${n}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,``),e&&navigator.onLine&&!dZ()&&fetch(`https://www.react-grab.com/api/version?source=browser&v=${t}&t=${Date.now()}`,{referrerPolicy:`origin`,keepalive:!0,priority:`low`,cache:`no-store`}).then(e=>e.text()).then(e=>{e&&e!==t&&console.warn(`[React Grab] v${t} is outdated (latest: v${e}). Run \`npx grab@latest upgrade\` to upgrade.`)}).catch(()=>null)}catch{}},pZ=e=>typeof e==`object`&&!!e,mZ=e=>{if(!pZ(e))return null;let t={};return typeof e.enabled==`boolean`&&(t.enabled=e.enabled),(e.activationMode===`toggle`||e.activationMode===`hold`)&&(t.activationMode=e.activationMode),typeof e.keyHoldDuration==`number`&&Number.isFinite(e.keyHoldDuration)&&(t.keyHoldDuration=e.keyHoldDuration),typeof e.allowActivationInsideInput==`boolean`&&(t.allowActivationInsideInput=e.allowActivationInsideInput),typeof e.activationKey==`string`&&(t.activationKey=e.activationKey),typeof e.maxContextLines==`number`&&Number.isFinite(e.maxContextLines)&&(t.maxContextLines=e.maxContextLines),typeof e.freezeReactUpdates==`boolean`&&(t.freezeReactUpdates=e.freezeReactUpdates),typeof e.telemetry==`boolean`&&(t.telemetry=e.telemetry),Object.keys(t).length===0?null:t},hZ=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?mZ(JSON.parse(e)):null}catch{return null}},gZ=e=>e===`Enter`||e===`NumpadEnter`,_Z=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,vZ=(e=>({name:e.name,setup:(t,n)=>({actions:[typeof e.contextMenuAction==`function`?e.contextMenuAction(t,n):e.contextMenuAction],cleanup:e.cleanup})}))({name:`copy`,contextMenuAction:{id:`copy`,label:`Copy`,shortcut:`C`,showInToolbarMenu:!0,onAction:e=>{e.copy?.()}}}),yZ={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},bZ={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},xZ={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||II(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},SZ=e=>{let t=e.left+e.width/2,n=e.top+e.height/2,r=n,i=window.innerHeight-n,a=t,o=window.innerWidth-t,s=Math.min(r,i,a,o);return s===r?`top`:s===a?`left`:s===o?`right`:`bottom`},CZ=()=>{let[e,t]=J(!1),[n,r]=J(null),i=GV(),a=()=>{let e=n();return sB(e)?e:null},o=()=>{r(null),i.clear(),t(!1)};return{selectedElement:a,isPendingDismiss:e,select:(e,n)=>{r(e),t(!1),n?.shouldPromptBeforeMouseHandoff?i.arm():i.clear()},clear:o,consumeMouseHandoff:()=>i.consume()&&a()!==null,showDismissPrompt:()=>a()?e()?!1:(t(!0),!0):(o(),!1),takeSelection:e=>{let t=a()??(sB(e)?e:null);return o(),t}}},wZ=async(e,t={})=>(await Promise.allSettled(e.map(e=>tW(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),TZ=[vZ,bZ,yZ,xZ],EZ=!1,DZ=new Set,OZ=e=>{if(typeof window>`u`)return DY();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...hZ(),...e};if(t.enabled===!1||EZ)return DY();EZ=!0,IM(t.container??null),fZ(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return gR(e=>{let t=!1,n,r=tZ(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=rY({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=Y(()=>l().state===`holding`),d=Y(()=>l().state===`active`),f=Y(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=Y(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=Y(()=>{if(!p())return!1;let e=Math.abs(s().x+window.scrollX-i.dragStart.x),t=Math.abs(s().y+window.scrollY-i.dragStart.y);return e>2||t>2}),h=Y(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=Y(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=Y(()=>l().state===`copying`),v=Y(()=>i.selectionInteractionLockDepth>0),y=Y(()=>l().state===`justCopied`),b=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=Y(()=>i.pendingCommentMode||b()),S=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),C=(e,t)=>{document.body.style[e]=t};yR(wR(d,(e,t)=>{e&&!t?(FL(s().x,s().y),C(`touchAction`,`none`)):!e&&t&&(IL(),C(`touchAction`,``))}));let w=zV(),[T,ee]=J(!w||!w.collapsed),[E,D]=J(0),[O,te]=J(0),[k,A]=J(w),[ne,re]=J(!1),ie=VV(e=>e.shiftKey),[ae,oe]=J(null),[se,ce]=J(null),[le,ue]=J(null),de=ZX({store:i,actions:o,isActivated:d,activateRenderer:()=>Gt(),deactivateRenderer:()=>Kt(),performCopyWithLabel:e=>dt(e),onOpen:()=>{kr(),ge?.(),ge=Or(Dr,ce)},onClose:()=>{ge?.(),ge=null,ce(null)}}),fe=Y(()=>i.contextMenuPosition!==null||de.isOpen()),pe=Y(()=>fe()||ae()!==null),me,he=null,ge=null,_e=!1,ve=new WeakMap,ye=CZ(),be=()=>!T()||b()||v()||fe()||ye.isPendingDismiss(),xe=()=>{ve=new WeakMap},Se=()=>{Le(!1),xe()},Ce=e=>{let t=k()??zV(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};BV(n),A(n);for(let e of DZ)e(n)},we=()=>{Fe.timerId!==null&&(clearTimeout(Fe.timerId),Fe.timerId=null)},Te=()=>{Fe.copyWaiting=!1,Fe.holdTimerFired=!1,Fe.startTimestamp=null};yR(()=>{if(l().state!==`holding`){we();return}Fe.startTimestamp=Date.now(),Fe.timerId=window.setTimeout(()=>{if(Fe.timerId=null,Fe.copyWaiting){Fe.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),ER(we)}),yR(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},GM);ER(()=>clearTimeout(t))}),yR(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},GM);ER(()=>clearTimeout(e))}),yR(wR(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let Ee=(e,t,n)=>{Oe(e,t,n),o.clearInputText()},De=()=>{let e=i.frozenElement||pt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},Oe=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},ke={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},Ae=null,[je,Me]=J(null),Ne=(e,t)=>{Ae!==null&&clearTimeout(Ae),Me(null),Ae=window.setTimeout(()=>{Me({x:e,y:t}),Ae=null},32)},Pe=null,Fe={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Ie=null,[j,Le]=J(!1),Re=0,ze=!1,Be=null,Ve=()=>{ze=!0,Be!==null&&window.clearTimeout(Be),Be=window.setTimeout(()=>{ze=!1,Be=null},GM)},He=()=>{Be!==null&&(window.clearTimeout(Be),Be=null),ze=!1},Ue=0,We=null,Ge=null,[M,Ke]=J(!1),[qe,Je]=J(null),[Ye,Xe]=J(null),[Ze,Qe]=sY(Ye),$e=Y(()=>de.isOpen()?yN:x()?vN:M()?qe():d()?_N:null),et=e=>ZY(e,gI),tt=oZ(gI,et,eY),nt=uZ(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Ie){Ie={x:Ie.x+e.x,y:Ie.y+e.y};return}let{pageX:t,pageY:n}=Et(s().x,s().y);Ie={x:t,y:n}}}),N=Y(()=>d()&&!_()),rt=new Map,it=(e,t)=>{let n=nZ(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{rt.delete(n),o.removeGrabbedBox(n)},GM+125);rt.set(n,a)},at=async e=>{let t=await Promise.all(e.map(async e=>{let t=await BU(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=VU(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:RN(e),id:e.id||void 0,className:e.getAttribute(`class`)||void 0,textContent:o,componentName:n??void 0,filePath:r,lineNumber:i,columnNumber:a}}));window.dispatchEvent(new CustomEvent(`react-grab:element-selected`,{detail:{elements:t}}))},ot=iZ(o,()=>i.labelInstances),st=async(e,t,n)=>{He(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=kY(e,`Action failed`)}if(t)for(let e of t)ot.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?Kt():r?(o.activate(),Ve()):o.unfreeze())},ct=(e,t,n)=>{let i=e[0],a=n??(i?VU(i):null),o=i?RN(i):null,s=a??o??void 0;return FY({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},lt=async(e,t,n)=>{if(e.length===0)return!1;let i=[],a=[];for(let t of e){let{wasIntercepted:e,pendingResult:n}=r.hooks.onElementSelect(t);e||i.push(t),n&&a.push(n),r.store.theme.grabbedBoxes.enabled&&it(eY(t),t)}await iI();let o=!0;if(i.length>0&&(o=await ct(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new ZV;return at(e),o},ut=e=>{NU(e.primaryElement).then(async t=>{await st(()=>lt(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=kY(t,`Action failed`);for(let t of e.labelInstanceIds)ot.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},dt=e=>{let{element:t,cursorX:n,selectedElements:r,extraPrompt:a,shouldDeactivateAfter:s,onComplete:c,dragRect:l}=e,u=r??[t],d=l??i.frozenDragRect,f=u.length>1,p=!f&&t===yt()?Tt():void 0,m=d&&f?GY(d):p??eY(t),h=f?m.x+m.width/2:n,g=RN(t);He(),o.startCopy();let _=g?ot.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;ut({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},ft=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];He(),o.startCopy(),ut({primaryElement:a,targetElements:t,labelInstanceIds:ot.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},pt=Y(()=>{if(c(),!N()||m()||v()||ye.isPendingDismiss())return null;let e=i.detectedElement;return sB(e)?e:null}),P=Y(()=>i.frozenElement||(f()?null:pt())),mt=Y(()=>!d()||b()||j()||_()||pe()||ye.isPendingDismiss()?null:ie()?f()?P():pt()??i.frozenElement:ye.selectedElement()),ht=Y(()=>{let e=mt();return e?JY(e,gI,et):[]}),gt=Y(()=>{let e=mt();return e?Math.max(0,ht().findIndex(t=>t.element===e)):0}),_t=Y(()=>mt()!==null);yR(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{sB(e)||o.setDetectedElement(null)},100);ER(()=>clearInterval(t))}),yR(wR(P,e=>{if(We!==null&&(clearTimeout(We),We=null),!e){Xe(null);return}We=window.setTimeout(()=>{We=null,Xe(e)},100)})),ER(()=>{We!==null&&(clearTimeout(We),We=null)}),yR(()=>{let e=i.frozenElements;ER(mL(e))}),yR(wR(d,e=>{e&&r.store.options.freezeReactUpdates&&ER(fR())}));let vt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||oI(e)?void 0:e}let e=P();if(!(!e||oI(e)))return e},yt=Y(()=>vt()),bt=()=>yt()?i.isTouchMode&&p()?N():N()&&!m():!1,xt=ZR(()=>i.frozenElements,e=>Y(()=>(c(),eY(e)))),St=Y(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[GY(t)]:xt().map(e=>e())}),Ct=Y(()=>{if(!j()||i.pendingCommentMode||M())return null;let e=i.detectedElement;return!sB(e)||oI(e)||i.frozenElements.includes(e)?null:e}),wt=Y(()=>{c();let e=Ct();if(e)return eY(e)}),Tt=Y(()=>{c();let e=i.frozenElements;if(e.length>0){let t=St();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??GY(n):qY(oX(t))}let t=yt();if(t)return eY(t)}),Et=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Dt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},Ot=Y(()=>{if(!p())return!1;let e=Dt(s().x,s().y);return e.x>2||e.y>2}),kt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t),a=Math.min(i.dragStart.x,n),o=Math.min(i.dragStart.y,r),s=Math.abs(n-i.dragStart.x),c=Math.abs(r-i.dragStart.y);return{x:a-window.scrollX,y:o-window.scrollY,width:s,height:c}},At=e=>e.code===`Space`||e.key===` `,jt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Et(s().x,s().y);Ie={x:e,y:t}},Mt=()=>{o.stopDragReposition(),Ie=null},Nt=Y(()=>{if(c(),Ot())return qY(kt(s().x,s().y))}),Pt=Y(()=>{if(c(),!Ot())return[];let e=je();if(!e)return[];let t=kt(e.x,e.y),n=HY(t,gI);return(n.length>0?n:HY(t,gI,!1)).map(e=>eY(e))}),Ft=Y(()=>{let e=Pt();if(e.length>0)return e;let t=wt();return t?[...St(),t]:St()}),It=ZR(()=>i.frozenElements,e=>{let t=RN(e)||`element`,n=VU(e)??void 0;return Y(()=>{if(c(),!sB(e))return null;let r=eY(e),i=ve.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Lt=Y(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of It()){let n=t();n!==null&&e.push(n)}return e}),Rt=Y(()=>{if(b())return null;let e=Ct();return e?(c(),{tagName:RN(e)||`element`,componentName:VU(e)??void 0,bounds:eY(e),mouseX:s().x}):null}),zt=Y(()=>{if(_()||b()){c();let e=i.frozenElement||pt();return e?{x:tY(eY(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Bt=Y(()=>{if(!j()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!sB(e))return;let t=ve.get(e);if(t===void 0)return;let n=eY(e);return n.x+n.width*t});yR(wR(()=>[pt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),yR(wR(()=>pt(),e=>{let t=++Ue,n=()=>{Ue===t&&o.setSelectionSource(null,null)};if(!e){n();return}BU(e).then(e=>{if(Ue===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{Ue===t&&o.setSelectionSource(null,null)})}));let Vt=Y(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ht=Y(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));yR(wR(Y(()=>{let e=d(),t=p(),n=_(),a=b(),o=pt(),s=Nt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=Ot(),m=P(),h=y();return{isActive:e,isDragging:t,isCopying:n,isPromptMode:a,isSelectionBoxVisible:!!(c&&l&&e&&!n&&!h&&!t&&m!=null),isDragBoxVisible:!!(c&&u&&e&&!n&&f),targetElement:o,dragBounds:s?{x:s.x,y:s.y,width:s.width,height:s.height}:null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:k()}}),e=>{r.hooks.onStateChange(e)})),yR(wR(()=>{let e=b();return{inputMode:e,position:e?s():CR(s),target:e?pt():CR(pt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),yR(wR(()=>[ar(),Tt(),pt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),yR(wR(()=>[fr(),Nt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),yR(wR(()=>{let e=mr();return[e,pr(),e?zt():CR(zt),e?pt():CR(pt),i.selectionFilePath,i.selectionLineNumber]},([e,t,n,i,a,o])=>{r.hooks.onElementLabel(e,t,{x:n.x,y:n.y,content:``,element:i??void 0,tagName:i&&RN(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Ut=null,Wt=e=>{if(e){if(!Ut){Ut=document.createElement(`style`),Ut.setAttribute(`data-react-grab-cursor`,``);let e=BN();e&&(Ut.nonce=e),HN(Ut),document.head.appendChild(Ut)}Ut.textContent=`* { cursor: ${e} !important; }`}else Ut&&=(Ut.remove(),null)};yR(wR(()=>[d(),_(),b()],([e,t,n])=>{Wt(t?`progress`:e&&!n?`crosshair`:null)}));let Gt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},Kt=()=>{let e=p(),t=i.previouslyFocusedElement;Mt(),o.deactivate(),de.resetWithDiscard(),kr(),Se(),wn(),ye.clear(),Ke(!1),Je(null),e&&C(`userSelect`,``),Pe&&window.clearTimeout(Pe),nt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&sB(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},qt=()=>{u()&&o.releaseHold(),d()&&Kt(),He()},Jt=()=>{o.setWasActivatedByToggle(!0),Gt()},Yt=()=>{let e=[...i.frozenElements],t=i.frozenElement||pt(),n=b()?i.inputText.trim():``;if(!t){Kt();return}let r=e.length>0?e:[t],a=r.map(e=>eY(e))[0],{x:s,y:c}=tY(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),dt({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Xt=()=>{if(b()){if(S()){o.clearInputText(),Kt();return}o.setPendingDismiss(!0),te(e=>e+1)}},Zt=()=>{if(ye.isPendingDismiss()){Dn();return}o.clearInputText(),Kt()},Qt=()=>{o.setPendingDismiss(!1)},$t=()=>{if(de.isOpen()){de.dismiss();return}let e=i.frozenElement||pt();e&&en(e,{x:s().x,y:s().y})},en=(e,t,n={})=>de.trigger(e,t,n),tn=(e,t)=>{if(!de.isOpen()||i.contextMenuPosition!==null)return!1;let n=MI(e,t).find(gI);if(!n)return!1;let r=de.switchToElement(n,{x:e,y:t});return r&&fL([n]),r},nn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Ze(),tagName:RN(e)||void 0}),rn=()=>{Ge=null,Ke(!1),o.setPendingCommentMode(!1),Je(null)},an=e=>{let t=i.frozenElement||pt();if(!t)return!1;let n={x:s().x,y:s().y},a=r.store.actions.find(t=>t.id===e);return a?e===`edit`?en(t,n,nn(t))?(o.clearInputText(),o.exitPromptMode(),rn(),!0):!0:(o.clearInputText(),o.exitPromptMode(),rn(),a.onAction(Nn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),rn(),Mr(_N),ln(t,n),!0)},on=e=>{if(d()){if($e()!==e&&b()&&an(e))return;if($e()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ge=e,Je(e),Ke(!0);return}if($e()!==e&&M()){Ge=e,Je(e);return}Kt();return}T()&&(Ge=e,Je(e),Ke(!0),Jt())},sn=()=>{on(k()?.defaultAction??`copy`)},cn=(e,t,n)=>{rn(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},ln=(e,t)=>{Se(),Ar(),o.showContextMenu(t,e),wn(),r.hooks.onContextMenu(e,t)},un=(e,t)=>{let n=Ge;if(Ge=null,Je(null),!n)return;if(n===`edit`){en(e,t,nn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Mr(_N),ln(e,t);return}i.onAction(Nn(e,t))},dn=()=>{if(T()){if(d()&&x()){Kt();return}o.setPendingCommentMode(!0),d()||Jt()}},fn=(e,t,n)=>{let r=n&&j()&&!p()&&!i.pendingCommentMode&&!M();if(be()||f()&&!r)return;if(o.setPointer({x:e,y:t}),ke.latestPointerX=e,ke.latestPointerY=t,r){let n=NI(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=ke.pendingDetectionScheduledAt>0&&a-ke.pendingDetectionScheduledAt<200;if(a-ke.lastDetectionTimestamp>=32&&!s&&(ke.lastDetectionTimestamp=a,ke.pendingDetectionScheduledAt=a,setTimeout(()=>{if(be()){ke.pendingDetectionScheduledAt=0;return}let e=NI(ke.latestPointerX,ke.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),ke.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Et(e,t);Ie&&o.shiftDragStart({x:n-Ie.x,y:r-Ie.y}),Ie={x:n,y:r}}Ne(e,t);let n=lZ(e,t),r=n.top||n.bottom||n.left||n.right;r&&!nt.isActive()?nt.start():!r&&nt.isActive()&&nt.stop()}},pn=(e,t,n)=>{if(!N()||v())return!1;!n&&j()&&Se();let i=ye.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),C(`userSelect`,`none`),Ne(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},mn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=UY(eY(e),t);ve.set(e,n),r&&Qe(VU(e)??void 0)}o.toggleFrozenElement(e),PI();let a=i.frozenElements.includes(e);if(a||ve.delete(e),i.frozenElements.length===0){Se(),o.unfreeze();return}fL(i.frozenElements),Le(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),wn()},hn=()=>{let e=i.frozenElements.filter(sB),t=e.map(e=>{let t=RN(e)||`element`,n=VU(e)??void 0,r=ve.get(e),i=eY(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Se(),e.length===0){o.unfreeze();return}if(e.length===1){dt({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}ft({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},gn=(e,t,n)=>{let a=HY(e,gI),s=a.length>0?a:HY(e,gI,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!M();if(c&&o.addFrozenElements(s),fL(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Le(!0),PI(),o.setPointer(tY(eY(e))),o.setLastGrabbed(e),o.freeze(),wn();return}let l=s[0],u=tY(eY(l));o.setPointer(u),o.setFrozenElements(s);let d=KY(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){cn(l,u.x,u.y);return}if(M()){Ke(!1),Ge?un(l,u):ln(l,u);return}let f=i.wasActivatedByToggle&&!t;dt({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},_n=e=>{for(let t of i.frozenElements)if(sB(t)&&_Z(e,eY(t)))return t;return null},vn=(e,t,n,a)=>{let c=sB(i.frozenElement)?i.frozenElement:null,l=ye.selectedElement(),u=()=>MI(e,t).find(gI)??null;if(a&&!i.pendingCommentMode&&!M()){let n=u();n!==null&&mn(n,{x:e,y:t});return}let d=u()??(sB(i.detectedElement)?i.detectedElement:null),f=l??d??c;if(!f)return;let p,m,h=d===null&&c===f,g=l===f;if(h)p=s().x,m=s().y;else if(g){let e=tY(eY(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){cn(f,p,m),ye.clear();return}if(M()){Ke(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;ye.clear(),fL([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ge?un(f,t):ln(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),dt({element:f,cursorX:p,shouldDeactivateAfter:_}),ye.clear()},yn=()=>{p()&&(Mt(),o.cancelDrag(),nt.stop(),C(`userSelect`,``))},bn=(e,t,n,r)=>{if(!p())return;Ae!==null&&(clearTimeout(Ae),Ae=null),Me(null);let i=Dt(e,t),a=i.x>2||i.y>2,s=a?kt(e,t):null;a?o.endDrag():o.cancelDrag(),Mt(),nt.stop(),C(`userSelect`,``),s?gn(s,n,r):vn(e,t,n,r)},xn=OY(),Sn=cZ(),Cn=e=>{let t;try{t=Sn.originalKeyDescriptor?.get?Sn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||gZ(e.code),r=d()||u();return n&&r&&!b()&&!ye.isPendingDismiss()&&!i.wasActivatedByToggle?IB(e,`data-react-grab-input`)?!1:(Sn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};xn.addDocumentListener(`keydown`,zM(Cn),{capture:!0}),xn.addDocumentListener(`keyup`,zM(Cn),{capture:!0}),xn.addDocumentListener(`keypress`,zM(Cn),{capture:!0});let wn=()=>{tt.clearHistory(),ye.clear()},Tn=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),ye.select(e,{shouldPromptBeforeMouseHandoff:t});let n=tY(eY(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},En=()=>{ye.showDismissPrompt()&&te(e=>e+1)},Dn=()=>{ye.clear(),o.unfreeze(),wn()},On=()=>{let e=ye.takeSelection(i.frozenElement);if(!e){Dn();return}let t=tY(eY(e));wn(),o.setLastGrabbed(e),dt({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},kn=e=>fN.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,An=(e,t={})=>{if(!d()||b()||j()||ye.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=kn(e);if(!n||pe())return!1;let r=P(),i=!r;if(!r){let e=LM()?.getBoundingClientRect();r=e?NI(e.left+e.width/2,e.top+e.height/2):NI(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=tt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),Tn(s,!0),!0},jn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||uB(e)||!d()||_()||v()||pe()?null:i.frozenElement||pt(),Mn=e=>{let t=jn(e);if(!t)return null;let n=WV(r.store.actions,e);return n?{element:t,action:n}:null},Nn=(e,t)=>{let n=eY(e);return Cr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:RN(e)||void 0,componentName:Ze(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Pn=/^[a-zA-Z0-9-]$/,Fn=e=>{if(!e.key||e.key.length!==1||!Pn.test(e.key))return!1;let t=jn(e);return!t||!de.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(rn(),e.preventDefault(),e.stopImmediatePropagation(),!0)},In=e=>{let t=Mn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return an(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Nn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Ln=e=>{if(e.key?.toLowerCase()!==`o`||!d()||!(e.metaKey||e.ctrlKey))return!1;let t=i.selectionFilePath,n=i.selectionLineNumber;return t?(e.preventDefault(),e.stopPropagation(),r.hooks.onOpenFile(t,n??void 0)||II(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},Rn=e=>{if(!d()||_()||i.contextMenuPosition!==null||de.isOpen())return!1;let t=e.key===`F10`&&e.shiftKey,n=e.key===`ContextMenu`;if(!t&&!n)return!1;let r=i.frozenElements,a=r.length>1,s=(a?r[0]:null)||i.frozenElement||pt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=tY(eY(s));return a?fL(r):(fL([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),ln(s,c),!0},zn=Y(()=>ht().map(e=>({tagName:RN(e.element)||`element`,componentName:VU(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Bn=Y(()=>({items:zn(),activeIndex:gt()})),Vn=e=>{if(!(!r.store.options.allowActivationInsideInput&&uB(e))&&!(!aX(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!dN.includes(e.key)&&!gZ(e.code)&&(d()&&!i.wasActivatedByToggle?Kt():u()&&(we(),Te(),o.releaseHold())),!gZ(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),gZ(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Pe!==null&&window.clearTimeout(Pe),Pe=window.setTimeout(()=>{Kt()},200);return}if(u()&&e.repeat){if(Fe.copyWaiting){let e=Fe.holdTimerFired;Te(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;uB(e)?dB(e)?t+=600:t+=400:fB()&&(t+=600),Te(),o.startHold(t)}}},Hn=e=>{if(!ye.isPendingDismiss())return!1;if(gZ(e.code))return!0;let t=fN.has(e.key),n=Mn(e)!==null;return!t&&!n?!1:t?An(e,{allowPendingKeyboardSelection:!0}):In(e)?(wn(),!0):!1};xn.addWindowListener(`keydown`,zM(e=>{if(kn(e)&&uB(e)||Hn(e))return;if(Cn(e),!T()){aX(e,r.store.options)&&!e.repeat&&D(e=>e+1);return}let t=gZ(e.code)&&u()&&!b(),n=IB(e,hN);if(b()&&aX(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Xt();return}if(e.key===`Escape`&&pe()){ae()!==null&&kr();return}let a=IB(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&In(e)||(e.key===`Escape`&&(b()?Xt():i.wasActivatedByToggle&&Kt()),a&&fN.has(e.key)&&An(e)),void 0;if(p()&&At(e)){e.repeat||jt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){Kt();return}d()&&!dN.includes(e.key)&&e.preventDefault();let o=Date.now()-Re<200;An(e)||Ln(e)||Rn(e)||In(e)||Fn(e)||o||Vn(e)}),{capture:!0}),xn.addWindowListener(`keyup`,zM(e=>{if(Cn(e))return;if(At(e)&&h()&&(Mt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&j()){p()&&yn(),hn();return}if(IB(e,`data-react-grab-ignore-events`))return;let t=sZ(r.store.options),n=t.metaKey||t.ctrlKey?FB()?!e.metaKey:!e.ctrlKey:t.shiftKey&&!e.shiftKey||t.altKey&&!e.altKey,a=r.store.options.activationKey?typeof r.store.options.activationKey==`function`?r.store.options.activationKey(e):rX(r.store.options.activationKey)(e):$Y(e.key,e.code);if(y()||ze){(a||n)&&(He(),Kt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=fe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;Kt()}else if(c&&a){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),e||l)return;Kt()}else!s&&a&&Pe!==null&&(window.clearTimeout(Pe),Pe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Fe.holdTimerFired&&n){we();let t=(Fe.startTimestamp?Date.now()-Fe.startTimestamp:0)>=200,n=Fe.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!uB(e));Te(),n?o.activate():o.releaseHold()}else Kt()}}),{capture:!0}),xn.addDocumentListener(`copy`,()=>{u()&&(Fe.copyWaiting=!0)}),xn.addWindowListener(`keypress`,zM(Cn),{capture:!0}),xn.addWindowListener(`pointermove`,zM(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!IB(e,`data-react-grab-ignore-events`)&&!be()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!j()){if(ye.consumeMouseHandoff()){En();return}o.unfreeze(),wn()}fn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),xn.addWindowListener(`pointerdown`,zM(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),_e=!1,!IB(e,`data-react-grab-ignore-events`))){if(fe()){tn(e.clientX,e.clientY)&&(_e=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Tt();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Yt():Xt();return}if(ye.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}pn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),xn.addWindowListener(`pointerup`,zM(e=>{if(e.button!==0||!e.isPrimary||IB(e,`data-react-grab-ignore-events`)||fe())return;let t=N()||v()||p(),n=e.metaKey||e.ctrlKey;bn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),xn.addWindowListener(`contextmenu`,zM(e=>{if(!N()||_()||b()||de.isOpen())return;let t=IB(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?_n(n):null,a=ye.isPendingDismiss();if(t&&!r&&!a&&!_t())return;if(fe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??NI(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?fL(c):(fL([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),ln(s,n)}),{capture:!0}),xn.addWindowListener(`pointercancel`,zM(e=>{e.isPrimary&&yn()})),xn.addWindowListener(`click`,zM(e=>{if(!IB(e,`data-react-grab-ignore-events`)){if(_e){_e=!1,e.preventDefault(),e.stopImmediatePropagation();return}fe()||(N()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):Kt()))}}),{capture:!0}),xn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&Kt()}}),xn.addWindowListener(`blur`,()=>{yn(),u()&&(we(),o.releaseHold(),Te()),Se()}),xn.addWindowListener(`focus`,()=>{Re=Date.now()}),xn.addWindowListener(`focusin`,e=>{IB(e,BM)&&e.stopPropagation()},{capture:!0});let Un=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!be()&&!f()&&!p()&&i.frozenElements.length===0){let e=NI(s().x,s().y);o.setDetectedElement(e)}},Wn=null,Gn=null,Kn=()=>{WY(),Un(),o.incrementViewportVersion(),o.updateContextMenuPosition()};xn.addWindowListener(`scroll`,Kn,{capture:!0});let qn=window.innerWidth,Jn=window.innerHeight;xn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(qn>0&&Jn>0){let n=e/qn,r=t/Jn,i=Math.abs(n-r)<xN,a=Math.abs(n-1)>xN;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}qn=e,Jn=t,Kn()});let Yn=window.visualViewport;if(Yn){let{signal:e}=xn;Yn.addEventListener(`resize`,Kn,{signal:e}),Yn.addEventListener(`scroll`,Kn,{signal:e})}let Xn=()=>{Gn===null&&(Gn=nI(()=>{Gn=null,o.incrementViewportVersion()}))};yR(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Wn!==null)return;Wn=window.setInterval(()=>{Xn()},100);return}Wn!==null&&(window.clearInterval(Wn),Wn=null),Gn!==null&&(rI(Gn),Gn=null)}),ER(()=>{Wn!==null&&window.clearInterval(Wn),Gn!==null&&rI(Gn)}),xn.addDocumentListener(`copy`,zM(e=>{b()||IB(e,`data-react-grab-ignore-events`)||N()&&e.preventDefault()}),{capture:!0}),ER(()=>{xn.abort(),Ae!==null&&window.clearTimeout(Ae),Pe&&window.clearTimeout(Pe),He(),he?.(),he=null,ge?.(),ge=null,rt.forEach(e=>window.clearTimeout(e)),rt.clear(),ot.cancelAllFades(),nt.stop(),C(`userSelect`,``),C(`touchAction`,``),Wt(null),Sn.restore(),IM(null)});let{root:Zn,host:Qn}=oY(HJ);ER(TY(Qn).cleanup);let $n=Y(()=>r.store.theme.enabled),er=Y(()=>r.store.theme.selectionBox.enabled),tr=Y(()=>r.store.theme.elementLabel.enabled),nr=Y(()=>r.store.theme.dragBox.enabled),rr=Y(()=>y()||ne()&&!f()||de.isInteracting()),ir=Y(()=>Pt().length>0),ar=Y(()=>!$n()||!er()||rr()?!1:ir()?!0:bt()),or=Y(()=>{let e=yt();if(e)return RN(e)||void 0}),sr=Y(()=>!$n()||fe()||!tr()||rr()?!1:bt()),cr=new Map,lr=e=>{let t=e.elements?.filter(sB)??[],n=e.element,r=null;t.length>0?r=t.map(eY):n&&sB(n)&&(r=[eY(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?qY(oX(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=cr.get(e.id),s=o?.boundsMultiple,c=s===a||s!==void 0&&a!==void 0&&s.length===a.length&&s.every((e,t)=>e.x===a[t].x&&e.y===a[t].y&&e.width===a[t].width&&e.height===a[t].height);if(o&&o.status===e.status&&o.errorMessage===e.errorMessage&&o.bounds.x===i.x&&o.bounds.y===i.y&&o.bounds.width===i.width&&o.bounds.height===i.height&&c)return o;let l=i.x+i.width/2,u=i.width/2,d;d=e.mouseXOffsetRatio!==void 0&&u>0?l+e.mouseXOffsetRatio*u:e.mouseXOffsetFromCenter===void 0?e.mouseX??l:l+e.mouseXOffsetFromCenter;let f={...e,bounds:i,boundsMultiple:a,mouseX:d};return cr.set(e.id,f),f},ur=Y(()=>{if(!$n()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of cr.keys())e.has(t)||cr.delete(t);return i.labelInstances.map(lr)}),dr=Y(()=>!$n()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:eY(e.element)}))),fr=Y(()=>$n()&&nr()&&N()&&Ot()),pr=Y(()=>_()?`processing`:`hover`),mr=Y(()=>{if(!$n())return!1;let e=tr(),t=b(),n=_(),r=N(),i=p(),a=!!P(),o=ne(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),hr=Y(()=>{c();let e=i.contextMenuElement;return e?eY(e):null}),gr=Y(()=>(c(),i.contextMenuPosition)),_r=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:RN(e)||void 0}),[vr]=sY(()=>i.frozenElements.length>1?null:i.contextMenuElement),[yr]=xR(()=>i.contextMenuElement,async e=>e?BU(e):null),br=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},xr=(e,t,n,r,a)=>async c=>{await br(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=St(),p=hr()??l,m=t.length>1,h=m?qY(oX(f)):p,g=i.wasActivatedByToggle,_;if(_=m?f:p?[p]:u,o.hideContextMenu(),h){let i=m?h.x+h.width/2:d.x,a=ot.createInstance(h,n||`element`,r,`copying`,{element:e,mouseX:i,elements:m?t:void 0,boundsMultiple:_}),o=!1,s;try{o=await c(),o||(s=`Failed to copy`)}catch(e){s=kY(e,`Action failed`)}ot.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?Kt():o.unfreeze()})},Sr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},Cr=e=>{let{element:t,filePath:n,lineNumber:a,tagName:s,componentName:c,position:l,performWithFeedbackOptions:u,shouldDeferHideContextMenu:f,onBeforeCopy:p,onBeforePrompt:m,customEnterPromptMode:h}=e,g=i.frozenElements.length>0?i.frozenElements:[t],_=f?Sr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{ot.clearAll(),rn(),m?.(),Ee(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),De(),d()||Gt(),_()}),enterEditMode:()=>{en(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&rn(),_()},copy:()=>{rn(),p?.(),dt({element:t,cursorX:l.x,selectedElements:g.length>1?g:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),_()},hooks:{transformHtmlContent:r.hooks.transformHtmlContent,onOpenFile:r.hooks.onOpenFile,transformOpenFileUrl:r.hooks.transformOpenFileUrl},performWithFeedback:xr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?Kt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},wr=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=yr(),n=i.contextMenuPosition??s();return Cr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:_r(),componentName:vr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{ye.clear()},customEnterPromptMode:()=>{ot.clearAll(),rn(),o.clearInputText(),o.enterPromptMode(n,e),Sr()}})}),Tr=()=>{setTimeout(()=>{o.hideContextMenu(),Kt()},0)},Er=()=>{if(!me)return null;let e=me.getBoundingClientRect(),t=SZ(e);return t===`left`||t===`right`?{x:t===`left`?e.right:e.left,y:e.top+e.height/2,edge:t}:{x:e.left+e.width/2,y:t===`top`?e.bottom:e.top,edge:t}},Dr=()=>{let e=Er();if(e)return e;let t=de.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},Or=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=nI(r)};return r(),()=>{n!==null&&(rI(n),n=null)}};yR(()=>{if(!_t())return;let e=Or(Er,ue);ER(()=>{e(),ue(null)})});let kr=()=>{he?.(),he=null,oe(null)},Ar=()=>{o.hideContextMenu(),kr(),de.dismiss()},jr=()=>{ae()===null?(o.hideContextMenu(),de.isOpen()&&de.closePreservingRenderer(),he?.(),he=Or(Er,oe)):kr()},Mr=e=>{Ce({defaultAction:e})},Nr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!sB(t.element))return;let n=t.element,r=tY(eY(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>sB(e)):[n];setTimeout(()=>{kr(),de.isOpen()&&de.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Gt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(KY(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};yR(()=>{let e=r.store.theme.hue;e===0?Zn.style.filter=``:Zn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(DJ(),aW)).then(({ReactGrabRenderer:e})=>{t||(n=dz(()=>X(e,{get selectionVisible(){return ar()},get selectionBounds(){return Tt()},get selectionBoundsMultiple(){return Ft()},get selectionShouldSnap(){return i.frozenElements.length>0||Pt().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Lt()},get pendingShiftPreviewEntry(){return Rt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return or()},get selectionComponentName(){return Ze()},get selectionLabelVisible(){return sr()},selectionLabelStatus:`idle`,get hierarchyState(){return Bn()},get hierarchyMenuPosition(){return le()},get labelInstances(){return ur()},get dragVisible(){return fr()},get dragBounds(){return Nt()},get grabbedBoxes(){return dr()},get mouseX(){return aB(()=>i.frozenElements.length>1)()?void 0:Bt()??zt().x},get isFrozen(){return f()||d()||ne()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Nr,get onLabelInstanceHoverChange(){return ot.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Yt(),onToggleExpand:$t,get selectionLabelShakeCount(){return O()},onConfirmDismiss:Zt,get discardPrompt(){return aB(()=>!!ye.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Zt,onCopy:On}:S()?{onConfirm:Zt,onCancel:Qt}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:sn,onActivateAction:on,get activeActionId(){return $e()},get enabled(){return T()},get shakeCount(){return E()},onToolbarStateChange:e=>{A(e),e.enabled!==T()&&(ee(e.enabled),e.enabled||(qt(),Ar())),DZ.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(DZ.add(e),()=>{DZ.delete(e)}),onToolbarSelectHoverChange:re,onToolbarRef:e=>{me=e},get contextMenuPosition(){return gr()},get contextMenuBounds(){return hr()},get contextMenuTagName(){return _r()},get contextMenuComponentName(){return vr()},get contextMenuHasFilePath(){return!!yr()?.filePath},get actions(){return r.store.actions},get actionContext(){return wr()},onContextMenuDismiss:Tr,onContextMenuHide:Sr,get toolbarMenuPosition(){return ae()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return k()?.defaultAction??`copy`},onSetDefaultAction:Mr,onToggleToolbarMenu:jr,onToolbarMenuDismiss:kr,get editPanelState(){return de.state()},get editPanelPosition(){return se()},get onEditPanelDismiss(){return de.dismiss},get onEditPanelSubmit(){return de.submit},get onEditPanelPendingEditsChange(){return de.setPendingEdits},get onEditPanelInteractingChange(){return de.setInteracting}}),Zn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Pr={activate:()=>{o.setPendingCommentMode(!1),!d()&&T()&&Jt()},deactivate:()=>{(d()||_())&&Kt()},toggle:()=>{d()?Kt():T()&&Jt()},comment:dn,isActive:()=>d(),isEnabled:()=>T(),setEnabled:e=>{e!==T()&&(ee(e),Ce({enabled:e,collapsed:!e}),e||(qt(),Ar()))},getToolbarState:()=>k()??zV(),setToolbarState:e=>{let t=k()??zV(),n=e.collapsed??t?.collapsed??!1,r={edge:e.edge??t?.edge??`bottom`,ratio:e.ratio??t?.ratio??.5,collapsed:n,enabled:e.enabled??!n,defaultAction:e.defaultAction??t?.defaultAction??`copy`};BV(r),A(r),r.enabled!==T()&&(ee(r.enabled),r.enabled||(qt(),Ar())),DZ.forEach(e=>e(r))},onToolbarStateChange:e=>(DZ.add(e),()=>{DZ.delete(e)}),reset:()=>{qt(),Ar(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,EZ=!1,n?.(),he?.(),he=null,ge?.(),ge=null,DZ.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await ct(t)},getSource:async e=>{let t=await BU(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>QU(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!ar(),isDragBoxVisible:!!fr(),targetElement:pt(),dragBounds:Nt()??null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:k()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Pr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:VU};for(let e of TZ)r.register(e,Pr);return setTimeout(()=>{XF(!0)},TN),Pr})}})),AZ=r({DEFAULT_THEME:()=>QX,commentPlugin:()=>yZ,formatElementInfo:()=>tW,generateSnippet:()=>wZ,getGlobalApi:()=>MZ,getStack:()=>MU,init:()=>OZ,isInstrumentationActive:()=>dP,openPlugin:()=>xZ,registerPlugin:()=>IZ,setGlobalApi:()=>NZ,unregisterPlugin:()=>LZ}),jZ,MZ,NZ,PZ,FZ,IZ,LZ,RZ=t((()=>{kZ(),pR(),iW(),jZ=null,MZ=()=>typeof window>`u`?jZ:window.__REACT_GRAB__??jZ??null,NZ=e=>{jZ=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},PZ=[],FZ=e=>{for(;PZ.length>0;){let t=PZ.shift();t&&e.registerPlugin(t)}},IZ=e=>{let t=MZ();if(t){t.registerPlugin(e);return}PZ.push(e)},LZ=e=>{let t=MZ();if(t){t.unregisterPlugin(e);return}let n=PZ.findIndex(t=>t.name===e);n!==-1&&PZ.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?jZ=window.__REACT_GRAB__:(jZ=OZ(),window.__REACT_GRAB__=jZ),FZ(jZ),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:jZ})))}));Sr(),Br(),gD();var zZ=`linear-grab:context-copied`,BZ=`linear-grab:picker-activated`,VZ=`linear-grab:picker-finished`,HZ=0,UZ=null;function WZ(e){!e||e.grabbedAt===HZ||Tr().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===HZ)return;let n=()=>{HZ=e.grabbedAt,navigator.clipboard.writeText(fD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(zZ))).catch(()=>{HZ=0})};e.source?.filePath?(UZ&&clearTimeout(UZ),UZ=null,n()):(UZ&&clearTimeout(UZ),UZ=setTimeout(n,900))})}function GZ(e,t=Date.now()){return{tagName:e.tagName||void 0,componentName:e.componentName||void 0,content:e.textContent?e.textContent.slice(0,500):``,source:e.filePath?{filePath:e.filePath,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:e.componentName??null}:null,stackContext:void 0,pageUrl:location.href,grabbedAt:t}}function KZ(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Tr().then(e=>e.captureShots?JA(i):null);let a=t?.(),o={tagName:i.tagName?.toLowerCase()||void 0,componentName:a?.getDisplayName?.(i)||void 0,content:(i.textContent??``).slice(0,500),source:null,stackContext:void 0,pageUrl:location.href,grabbedAt:r};e([o]);try{a?.getSource?.(i)?.then(t=>{t?.filePath&&e([{...o,source:{filePath:t.filePath,lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:t.componentName??o.componentName??null}}])})}catch{}}}},handleSelection(t){let i=r&&Date.now()-r<4e3?r:Date.now(),a=t.map((e,t)=>GZ(e,i+t));if(!a.length)return;e(a);let o=n;n=null,o&&o.then(t=>{t&&e([{...a[0],screenshotDataUrl:t},...a.slice(1)])})}}}var qZ=!1;async function JZ(){if(xr||qZ)return;qZ=!0;let e=await Promise.resolve().then(()=>(RZ(),AZ));try{e.init()}catch{qZ=!1;return}let t=KZ(e=>{kr(e),WZ(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),GA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function YZ(){if(xr){let e=await chrome.runtime.sendMessage({type:`grab/activate`});if(e&&e.ok===!1)throw Error(e.error??`Cannot activate the picker on this page.`);return}await JZ();let e=await Promise.resolve().then(()=>(RZ(),AZ));window.dispatchEvent(new CustomEvent(BZ));let t=e.getGlobalApi();if(t?.activate?.(),typeof t?.isActive==`function`){let e=!1,n=0,r=setInterval(()=>{n+=1;let i=!1;try{i=t.isActive()}catch{}if(i){e=!0;return}(e||n>=8)&&(clearInterval(r),window.dispatchEvent(new CustomEvent(VZ)))},250);setTimeout(()=>clearInterval(r),3e5)}}function XZ(e){if(!xr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}var ZZ=2500;function QZ(e){let t=e.x+e.w/2,n=e.y+e.h/2,r=document.elementFromPoint(t,n)??document.body,i=t=>{let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.w&&n.bottom>=e.y+e.h};for(;r!==document.body&&!i(r);)r=r.parentElement??document.body;return r}async function $Z(e){let t=null,n=document.createElement(`video`);try{t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`}),n.srcObject=t,n.muted=!0,n.playsInline=!0,await n.play(),await new Promise(e=>setTimeout(e,250));let r=n.videoWidth/window.innerWidth,i=n.videoHeight/window.innerHeight;if(!n.videoWidth||r<=0||i<=0)return null;let a=document.createElement(`canvas`);a.width=Math.max(1,Math.round(e.w*r)),a.height=Math.max(1,Math.round(e.h*i));let o=a.getContext(`2d`);return o?(o.drawImage(n,e.x*r,e.y*i,e.w*r,e.h*i,0,0,a.width,a.height),a.toDataURL(`image/png`)):null}catch(e){return console.warn(`[linear-grab] tab-frame region capture failed:`,e),null}finally{n.srcObject=null,t?.getTracks().forEach(e=>e.stop())}}function eQ(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:crosshair;user-select:none;`;let n=document.createElement(`div`);n.style.cssText=`position:fixed;display:none;border:2px solid #5e6ad2;border-radius:4px;box-shadow:0 0 0 100000px rgba(0,0,0,0.35);pointer-events:none;`,t.appendChild(n),document.body.appendChild(t);let r=0,i=0,a=!1,o=e=>({x:Math.min(r,e.clientX),y:Math.min(i,e.clientY),w:Math.abs(e.clientX-r),h:Math.abs(e.clientY-i)}),s=()=>{t.remove(),window.removeEventListener(`keydown`,l,!0)},c=()=>{s(),e(null)},l=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};window.addEventListener(`keydown`,l,!0),t.addEventListener(`pointerdown`,e=>{a=!0,r=e.clientX,i=e.clientY,t.setPointerCapture(e.pointerId)}),t.addEventListener(`pointermove`,e=>{if(!a)return;let t=o(e);n.style.display=`block`,n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.w}px`,n.style.height=`${t.h}px`}),t.addEventListener(`pointerup`,t=>{let n=o(t);if(s(),n.w<8||n.h<8)return e(null);(QZ(n).querySelectorAll(`*`).length>ZZ?$Z(n):Promise.race([YA(n),new Promise(e=>setTimeout(()=>{console.warn(`[linear-grab] region capture timed out after 4s — trying a tab frame`),e(null)},4e3))]).then(e=>e??$Z(n))).then(t=>{if(!t)return e(null);e({tagName:`region`,componentName:void 0,content:`Region capture ${Math.round(n.w)}×${Math.round(n.h)}`,source:null,stackContext:void 0,screenshotDataUrl:t,pageUrl:location.href,grabbedAt:Date.now()})})})})}Br(),Sr(),gD();var tQ=N(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),nQ=N(`<details open class=group><summary class="text-text-dim hover:text-text flex cursor-pointer items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase select-none"><span aria-hidden class="text-text-faint inline-block w-3 text-center transition-transform group-open:rotate-90">›</span></summary><div class="flex flex-col gap-2 pt-2 pl-4">`),rQ=N(`<p class="text-warn text-[10.5px] leading-snug">Several captures resolve to the same source — this page region likely renders inside an iframe/canvas the picker can't see into. Use <b>Capture region</b> for visual pointers there.`),iQ=N(`<span class="inline-block min-w-[8ch] text-center">`),aQ=N(`<div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">All elements post into ONE issue. Shift+click / drag selects several at once.</span><div class="flex items-center justify-end gap-1.5">`),oQ=N(`<div class="flex flex-col gap-1.5"><div class="flex gap-1.5">`),sQ=N(`<span class=text-danger>●`),cQ=N(`<div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">Captures your screen as a looping GIF (max 30s) the coding agent can watch. Pick this tab in the share dialog, then reproduce the issue.`),lQ=N(`<span class="inline-block min-w-[4ch] text-center">Stop`),uQ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full"></span><span class="text-text min-w-[5ch] text-[12px] tabular-nums"></span><span class="text-text-faint text-[10.5px]">max 0:30`),dQ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span class="text-text-dim text-[12px]">Encoding GIF…`),fQ=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),pQ=N(`<span class="text-success text-[12px] leading-none">✓`),mQ=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M4 4l8 8M12 4l-8 8">`),hQ=N(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),gQ=N(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),_Q=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex items-center justify-between gap-2"><span class="font-mono text-accent min-w-0 truncate text-[12px]"></span><div class="flex shrink-0 items-center gap-1">`),vQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),yQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><rect x=2 y=2.5 width=12 height=11 rx=1.5></rect><path d="m2 10.5 3.5-3 3 2.5 3-2 2.5 2"></path><circle cx=6 cy=6 r=1 fill=currentColor stroke=none>`),bQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),xQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1.5 1.5 0 0 0 1.5 1.4h3.6A1.5 1.5 0 0 0 11.3 13l.7-9M6.5 7v4.5M9.5 7v4.5">`),SQ=N(`<div class="bg-surface border-border flex flex-col gap-2 rounded-lg border p-2.5"><img alt="Screen recording preview"class="border-border bg-bg max-h-44 w-full rounded-md border object-contain"><span class="text-text-faint text-[10.5px] tabular-nums"> KB · <!>s · <!>×</span><label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Attach to issue on create</span></label><div class="flex items-center gap-1">`),CQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M6.5 9.5 9.5 6.5M7.5 4.5 9 3a2.5 2.5 0 0 1 3.5 3.5L11 8M8.5 11.5 7 13a2.5 2.5 0 0 1-3.5-3.5L5 8">`);function wQ(e){return(()=>{var t=nQ(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return P(n,()=>e.title,null),P(n,j(M,{get when(){return e.badge},get children(){var t=tQ();return P(t,()=>e.badge),t}}),null),P(r,()=>e.children),t})()}function TQ(){let e=sr(),t=_r(()=>({queryKey:[`grab`],queryFn:Dr})),n=_r(()=>({queryKey:[`settings`],queryFn:Tr})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=T(null),s=()=>{o(null),YZ().catch(e=>{o(e instanceof Error&&e.message?e.message:`Cannot activate the picker — open your dev app in the active tab first.`)})},c=async()=>{await jr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=T(!1),d=async()=>{let e=(r()??[]).map(e=>`- <${e.componentName??e.tagName??`element`}>${e.source?.filePath?` — ${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}`:``}${e.screenshotDataUrl?` (screenshot captured — use Copy PNG to paste it)`:``}`),t=`Captured on ${r()?.[0]?.pageUrl??location.href}:\n${e.join(`
264
- `)}`;try{await navigator.clipboard.writeText(t),u(!0),setTimeout(()=>u(!1),1800)}catch{}},[f,p]=T(null),m=async(e,t)=>{try{await navigator.clipboard.write([new ClipboardItem({"image/png":tj(t)})]),p(e),setTimeout(()=>p(null),1800)}catch{}},[h,g]=T(null),_=async e=>{try{await navigator.clipboard.writeText(fD(e,n.data??{})),g(e.grabbedAt),setTimeout(()=>g(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},v=async t=>{await Ar(t),e.invalidateQueries({queryKey:[`grab`]})},[y,b]=T(!1),x=async()=>{o(null),b(!0),window.dispatchEvent(new CustomEvent(BZ));try{let e=await eQ();e?await kr([e]):o(`Region capture failed or was cancelled. On heavy pages a "share this tab" prompt appears — pick THIS tab to capture. Details in the console ([linear-grab]).`)}finally{b(!1),window.dispatchEvent(new CustomEvent(`linear-grab:picker-finished`))}},[S,C]=T(HD());ae(UD(C));let[w,ee]=T(0);D(()=>{if(S().phase!==`recording`)return;let e=setInterval(()=>ee(Date.now()-(HD().startedAt??Date.now())),250);ae(()=>clearInterval(e))});let O=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[te,k]=T(`idle`),[A,ne]=T(null),re=async()=>{let e=HD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await Promise.race([DO(e.blob,`recording-${Date.now()}.gif`),new Promise((e,t)=>setTimeout(()=>t(Error(`upload timed out`)),6e4))]);return rO(t),t},ie=async()=>{ne(null),k(`busy`);try{let e=re().then(e=>new Blob([`![Screen recording](${e})`],{type:`text/plain`}));try{await navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}catch{let t=await e;await navigator.clipboard.writeText(await t.text())}k(`copied`),setTimeout(()=>k(`idle`),2e3)}catch{k(`idle`),await le(),ne(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},oe=()=>{let e=S().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[se,ce]=T(`idle`),le=async()=>{let e=S().result;if(e){ne(null),ce(`busy`);try{try{await navigator.clipboard.write([new ClipboardItem({"image/gif":e.blob})])}catch{let t=await createImageBitmap(e.blob),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0);let r=await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`));await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),ne(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}ce(`copied`),setTimeout(()=>ce(`idle`),2e3)}catch(e){ce(`idle`),ne(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=fQ();return P(e,j(wQ,{title:`Captured elements`,get badge(){return $e(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[j(M,{get when(){return r().length>0},get fallback(){return j(Vj,{title:`No elements captured`,children:`Click "Pick element" below, then use the react-grab overlay on your dev app. Every pick ADDS to this list — Shift+click or drag in the overlay selects several at once. Source info needs a dev build.`})},get children(){var e=aQ(),t=e.firstChild,n=t.firstChild.nextSibling;return P(e,j(We,{get each(){return r()},children:e=>(()=>{var t=_Q(),n=t.firstChild.firstChild,r=n.nextSibling;return P(n,(()=>{var t=$e(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:$e(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),P(r,j(kj,{class:`size-7 px-0`,variant:`ghost`,title:`Copy context for a local agent (Claude Code / Cursor) — includes skills & memory paths`,"aria-label":`Copy context`,onClick:()=>void _(e),get children(){return j(M,{get when(){return h()===e.grabbedAt},get fallback(){return vQ()},get children(){return pQ()}})}}),null),P(r,j(M,{get when(){return e.screenshotDataUrl},get children(){return j(kj,{class:`size-7 px-0`,variant:`ghost`,get title(){return f()===e.grabbedAt?`Copied!`:`Copy PNG — paste into Claude Code, Linear, Slack…`},"aria-label":`Copy capture as PNG`,onClick:()=>void m(e.grabbedAt,e.screenshotDataUrl),get children(){return j(M,{get when(){return f()===e.grabbedAt},get fallback(){return yQ()},get children(){return pQ()}})}})}}),null),P(r,j(kj,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void v(e.grabbedAt),get children(){return mQ()}}),null),P(t,j(M,{get when(){return e.source?.filePath},get children(){var t=hQ();return P(t,()=>e.source.filePath,null),P(t,(()=>{var t=$e(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),P(t,j(M,{get when(){return e.screenshotDataUrl},get children(){var t=gQ();return E(()=>it(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),P(e,j(M,{get when(){return new Set(r().filter(e=>e.source?.filePath).map(e=>`${e.source.filePath}:${e.source.lineNumber??``}`)).size<r().filter(e=>e.source?.filePath).length},get children(){return rQ()}}),t),P(n,j(kj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,title:`Copy all captures as plain text — paste into a Claude Code session`,onClick:()=>void d(),get children(){var e=iQ();return P(e,()=>l()?`Copied ✓`:`Copy all`),e}}),null),P(n,j(kj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=oQ(),t=e.firstChild;return P(t,j(kj,{variant:`primary`,class:`min-w-0 flex-1`,onClick:s,children:`Pick element`}),null),P(t,j(M,{when:!xr,get children(){return j(kj,{variant:`ghost`,class:`min-w-0 flex-1`,get loading(){return y()},title:`Drag a rectangle over any part of the page — the shot attaches to the issue`,onClick:()=>void x(),children:`Capture region`})}}),null),P(e,j(M,{get when(){return a()},get children(){return j(Hj,{get message(){return a()}})}}),null),e})()]}}),null),P(e,j(wQ,{title:`Recording`,get badge(){return $e(()=>!!S().result)()?`${(S().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[j(M,{get when(){return S().phase===`idle`||S().phase===`error`},get children(){var e=cQ(),t=e.firstChild;return P(e,j(kj,{variant:`ghost`,onClick:()=>void $D(),get children(){return[sQ(),` Record interaction`]}}),t),P(e,j(M,{get when(){return $e(()=>S().phase===`error`)()&&S().error},get children(){return j(Hj,{get message(){return S().error}})}}),null),e}}),j(M,{get when(){return S().phase===`recording`},get children(){var e=uQ(),t=e.firstChild.nextSibling;return t.nextSibling,P(t,()=>O(w())),P(e,j(kj,{variant:`primary`,class:`ml-auto`,onClick:()=>void eO(),get children(){return lQ()}}),null),e}}),j(M,{get when(){return S().phase===`processing`},get children(){var e=dQ(),t=e.firstChild;return P(e,j(Aj,{}),t),e}}),j(M,{get when(){return $e(()=>S().phase===`ready`)()&&S().result},children:e=>(()=>{var t=SQ(),n=t.firstChild,r=n.nextSibling,a=r.firstChild,o=a.nextSibling,s=o.nextSibling.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,u=c.nextSibling;return P(r,()=>(e().blob.size/1024).toFixed(0),a),P(r,()=>(e().durationMs/1e3).toFixed(1),o),P(r,()=>e().width,s),P(r,()=>e().height,null),l.addEventListener(`change`,e=>nO(e.currentTarget.checked)),P(u,j(kj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return te()===`busy`},get disabled(){return!i()},get title(){return i()?`Copy markdown — uploads to Linear, copies embeddable link`:`Connect Linear in Settings first`},"aria-label":`Copy markdown`,onClick:()=>void ie(),get children(){return j(M,{get when(){return te()===`copied`},get fallback(){return CQ()},get children(){return pQ()}})}}),null),P(u,j(kj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return se()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void le(),get children(){return j(M,{get when(){return se()===`copied`},get fallback(){return vQ()},get children(){return pQ()}})}}),null),P(u,j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:oe,get children(){return bQ()}}),null),P(u,j(kj,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:tO,get children(){return xQ()}}),null),P(t,j(M,{get when(){return A()},get children(){return j(Hj,{get message(){return A()}})}}),null),E(()=>it(n,`src`,e().url)),E(()=>l.checked=S().attachOnCreate),t})()})]}}),null),e})()}function EQ(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function DQ(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function OQ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var kQ=(e,t)=>Math.abs(e-t)<1.01,AQ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},jQ,MQ=()=>{if(jQ!==void 0)return jQ;if(typeof navigator>`u`)return jQ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return jQ=!0;let e=navigator.maxTouchPoints;return jQ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},NQ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},PQ=e=>e,FQ=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},IQ=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(NQ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(NQ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},LQ={passive:!0},RQ=typeof window>`u`||`onscrollend`in window,zQ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&RQ,o=0,s=a?null:AQ(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,LQ),a&&r.addEventListener(`scrollend`,u,LQ),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},BQ=(e,t)=>zQ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),VQ=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},HQ=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},UQ=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:PQ,rangeExtractor:FQ,onChange:()=>{},measureElement:VQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=DQ(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!MQ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,LQ),e.addEventListener(`touchend`,n,LQ),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(MQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=DQ(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=DQ(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=EQ(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=DQ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=KQ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=DQ(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=DQ(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return OQ(t[WQ(0,t.length-1,r?e=>n[e*2]:e=>OQ(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(MQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&kQ(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},WQ=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function GQ(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function KQ(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=GQ(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=WQ(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}function qQ(e){let t=Ve(e),n=new UQ(t),[r,i]=tr(n.getVirtualItems()),[a,o]=T(n.getTotalSize()),s=new Proxy(n,{get(e,t){switch(t){case`getVirtualItems`:return()=>r;case`getTotalSize`:return()=>a();default:return Reflect.get(e,t)}}});return s.setOptions(t),ie(()=>{let e=s._didMount();s._willUpdate(),ae(e)}),ee(()=>{s.setOptions(Ve(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(ar(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(ar(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function JQ(e){return qQ(Ve({observeElementRect:IQ,observeElementOffset:BQ,scrollToFn:HQ},e))}Br();var YQ=3e4,XQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,ZQ={running:[],review:[]},QQ=null,$Q=new Set;function e$(e){return $Q.add(e),QQ||(QQ=setInterval(()=>void r$(),YQ),r$()),()=>{$Q.delete(e),!$Q.size&&QQ&&(clearInterval(QQ),QQ=null)}}function t$(){r$()}function n$(e){return{id:e.id,identifier:e.identifier,title:e.title,stateName:e.state.name,stateColor:e.state.color,delegateName:e.delegate?.displayName??`Agent`,updatedAt:e.updatedAt,prUrl:e.attachments?.find(e=>XQ.test(e.url))?.url}}async function r$(){try{let e=await Tr();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await fO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(n$);ZQ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of $Q)e(ZQ)}catch{}}var i$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M2.5 8a5.5 5.5 0 1 1 1.6 3.9"></path><path d="M2.5 12.5V8.9h3.6">`),a$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="m2.5 4 3.5 4-3.5 4M8 12.5h5.5">`),o$=N(`<pre class="font-mono max-h-56 overflow-auto px-2.5 py-2 pr-3 text-[10px] leading-relaxed whitespace-pre-wrap"style=background:#0b0c0e;color:#8b8e98>`),s$=N(`<div class="border-border overflow-clip rounded-lg border"><div class="bg-surface-2 flex h-8 items-center gap-2 pl-2.5 pr-1.5"><span class="text-[11px] font-medium"></span><span class="text-text-faint font-mono text-[10px]"></span><span class=ml-auto>`),c$=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),l$=N(`<p class="text-text-faint px-2.5 py-2 text-[10.5px]">No deployment URL yet — logs appear once Vercel picks up the branch.`);function u$(e){let t=sr(),n=_r(()=>({queryKey:[`stage-status`,e.url,e.base],queryFn:()=>WO(e.url,e.base),refetchInterval:e=>e.state.data?.state===`success`||e.state.data?.state===`failure`||e.state.data?.state===`error`?!1:8e3,retry:0})),r=()=>![`success`,`failure`,`error`].includes(n.data?.state??`pending`),[i,a]=T(!1),o=_r(()=>({queryKey:[`deploy-logs`,n.data?.url??e.url],queryFn:()=>GO(n.data.url),enabled:i()&&!!n.data?.url,refetchInterval:()=>r()?1e4:!1,retry:0})),s,c=!0;D(()=>{o.data?.logs,!(!s||!c)&&requestAnimationFrame(()=>{s&&(s.scrollTop=s.scrollHeight)})});let l=vr(()=>({mutationFn:()=>KO(e.url,e.base),onSuccess:()=>void t.invalidateQueries({queryKey:[`stage-status`,e.url,e.base]})})),u=()=>{let e=n.data?.state;return e===`success`?{label:`Ready`,color:`var(--color-success)`}:e===`failure`||e===`error`?{label:`Failed`,color:`var(--color-danger)`}:e===`none`||e===`unknown`?{label:`Waiting for deploy…`,color:`var(--color-text-dim)`}:{label:`Building…`,color:`var(--color-accent)`}};return(()=>{var t=s$(),d=t.firstChild,f=d.firstChild,p=f.nextSibling;return p.nextSibling,P(d,j(M,{get when(){return r()},get fallback(){return(()=>{var e=c$();return E(t=>dt(e,`background`,u().color)),e})()},get children(){return j(Aj,{size:11})}}),f),P(f,()=>u().label),P(p,()=>e.base,null),P(p,(()=>{var e=$e(()=>!!n.data?.sha);return()=>e()?` @ ${n.data.sha}`:``})(),null),P(d,j(M,{get when(){return $e(()=>n.data?.state===`success`)()&&n.data?.url},get children(){return j(Ij,{get href(){return n.data.url},class:`shrink-0`,title:`Open the staging deployment`,children:`Open`})}}),null),P(d,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get loading(){return l.isPending},get title(){return`Reset ${e.base} — delete + recreate from the default branch (drifted or conflicted staging)`},"aria-label":`Reset staging branch`,onClick:()=>l.mutate(),get children(){return i$()}}),null),P(d,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return i()?`Hide build logs`:`Show build logs (vercel inspect --logs via the bridge)`},get"aria-label"(){return i()?`Hide build logs`:`Show build logs`},onClick:()=>a(e=>!e),get children(){return a$()}}),null),P(t,j(M,{get when(){return i()},get children(){return j(M,{get when(){return n.data?.url},get fallback(){return l$()},get children(){var e=o$();e.addEventListener(`scroll`,()=>{s&&(c=s.scrollTop+s.clientHeight>=s.scrollHeight-40)});var t=s;return typeof t==`function`?pt(t,e):s=e,P(e,j(M,{get when(){return o.data},get fallback(){return j(Aj,{size:12})},get children(){return o.data.logs||`No log output.`}})),e}})}}),null),E(e=>dt(f,`color`,u().color)),t})()}Br();function d$(e,t=6e3){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(`upload timeout`)),t))])}async function f$(){let e=[],t=[];for(let n of await Dr()??[]){let r=n.source?.filePath?` — \`${n.source.filePath}${n.source.lineNumber==null?``:`:${n.source.lineNumber}`}\``:``;if(e.push(`- \`<${n.componentName??n.tagName??`element`}>\`${r}`),n.screenshotDataUrl)try{let t=await d$(DO(tj(n.screenshotDataUrl),`capture-${n.grabbedAt}.png`),15e3);e.push(` ![capture](${t})`)}catch{t.push(`element screenshot upload failed — the ref line still landed`)}}let n=HD();if(n.result)try{let t=n.result.assetUrl??await d$(DO(n.result.blob,`recording-${Date.now()}.gif`),6e4);rO(t),e.push(`![recording](${t})`)}catch(e){t.push(`recording upload failed (${e instanceof Error?e.message:`error`}) — Copy GIF from the Capture tab and paste it instead`)}return{block:e.length?`Captured context:\n${e.join(`
263
+ `)},qX=e=>`style`in e&&e.style instanceof CSSStyleDeclaration,JX=e=>{let t=new Map,n=qX(e)?e:null;return{apply:(e,r)=>{if(n)for(let i of e)t.has(i)||t.set(i,{value:n.style.getPropertyValue(i),priority:n.style.getPropertyPriority(i)}),n.style.setProperty(i,r)},restore:()=>{if(!n){t.clear();return}for(let[e,{value:r,priority:i}]of t)r?n.style.setProperty(e,r,i):n.style.removeProperty(e);t.clear()},hasAppliedStyles:()=>t.size>0}},YX=(e,t)=>{for(let n of t){let t=e.edits.findIndex(e=>e.key===n.key);t>=0?e.edits[t]=n:e.edits.push(n)}},XX=(e,t)=>({element:e.element,preview:e.preview,filePath:e.filePath??``,lineNumber:e.lineNumber??0,edits:t,designTokens:e.designTokens}),ZX=e=>{let[t,n]=J(null),[r,i]=J(!1),a=[],o=[],s=e=>{o=e},c=()=>{let r=t()!==null;n(null),i(!1),a=[],o=[],r&&e.onClose?.()},l=()=>{t()?.preview.restore();for(let e=a.length-1;e>=0;e--)a[e].preview.restore();c()},u=e=>{NU(e).then(t=>{t&&n(n=>!n||n.element!==e||n.componentName?n:{...n,componentName:t})})},d=(r,i,a={})=>{if(t()!==null)return!1;let o=EX(r);if(o.length===0)return!1;let s=a.filePath??e.store.selectionFilePath??void 0,c=a.lineNumber??e.store.selectionLineNumber??void 0;return n({element:r,position:i,selectionBounds:eY(r),properties:o,preview:JX(r),filePath:s,lineNumber:c,componentName:a.componentName,tagName:a.tagName??RN(r),initialSearchQuery:a.initialSearchQuery,designTokens:BX(r)}),u(r),e.isActivated()||e.activateRenderer(),e.actions.setPointer(i),e.actions.setFrozenElement(r),e.actions.freeze(),e.onOpen?.(),!0},f=(r,i)=>{let s=t();if(!s||s.element===r)return!1;let c=EX(r);return c.length===0?!1:((o.length>0||s.preview.hasAppliedStyles())&&a.push(XX(s,o)),o=[],n({element:r,position:i,selectionBounds:eY(r),properties:c,preview:JX(r),tagName:RN(r),hasSessionEdits:a.some(e=>e.edits.length>0),designTokens:BX(r)}),BU(r).then(e=>{if(e){for(let t of a)t.element===r&&!t.filePath&&(t.filePath=e.filePath,t.lineNumber=e.lineNumber??0);n(t=>!t||t.element!==r||t.filePath?t:{...t,filePath:e.filePath,lineNumber:e.lineNumber??void 0})}}).catch(()=>void 0),u(r),e.actions.setPointer(i),e.actions.setFrozenElement(r),!0)},p=(e,t)=>[...a,XX(e,t)],m=e=>{let t=new Map;for(let n of e){if(n.edits.length===0)continue;let e=t.get(n.element);if(e){!e.filePath&&n.filePath&&(e.filePath=n.filePath,e.lineNumber=n.lineNumber),YX(e,n.edits);continue}t.set(n.element,{filePath:n.filePath,lineNumber:n.lineNumber,edits:[...n.edits],designTokens:n.designTokens})}return Array.from(t.values())},h=e=>{let t=new Set;for(let n of e)n.edits.length>0&&t.add(n.element);for(let n=e.length-1;n>=0;n--){let r=e[n];r.edits.length===0&&!t.has(r.element)&&r.preview.restore()}};return{state:t,trigger:d,switchToElement:f,setPendingEdits:s,dismiss:()=>{t()!==null&&(l(),e.store.wasActivatedByToggle?e.deactivateRenderer():e.actions.unfreeze())},closePreservingRenderer:()=>{t()!==null&&(l(),e.actions.unfreeze())},submit:n=>{let r=t();if(!r)return;let i=r.element,a=p(r,n),o=KX(m(a));h(a),c(),e.store.wasActivatedByToggle||e.actions.unfreeze(),e.performCopyWithLabel({element:i,cursorX:r.position.x,extraPrompt:o||void 0,shouldDeactivateAfter:e.store.wasActivatedByToggle})},resetWithDiscard:l,isOpen:()=>t()!==null,isInteracting:r,setInteracting:i}},QX={enabled:!0,hue:0,selectionBox:{enabled:!0},dragBox:{enabled:!0},grabbedBoxes:{enabled:!0},elementLabel:{enabled:!0},toolbar:{enabled:!0}},$X=(e,t)=>({enabled:t.enabled??e.enabled,hue:t.hue??e.hue,selectionBox:{enabled:t.selectionBox?.enabled??e.selectionBox.enabled},dragBox:{enabled:t.dragBox?.enabled??e.dragBox.enabled},grabbedBoxes:{enabled:t.grabbedBoxes?.enabled??e.grabbedBoxes.enabled},elementLabel:{enabled:t.elementLabel?.enabled??e.elementLabel.enabled},toolbar:{enabled:t.toolbar?.enabled??e.toolbar.enabled}}),eZ={activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,activationKey:void 0,getContent:void 0,maxContextLines:3,freezeReactUpdates:!0},tZ=(e={})=>{let t=new Map,n={},[r,i]=BJ({theme:QX,options:{...eZ,...e},actions:[]}),a=()=>{let r=QX,a={...eZ,...e},o=[];for(let{config:e}of t.values())if(e.theme&&(r=$X(r,e.theme)),e.options&&(a={...a,...e.options}),e.actions)for(let t of e.actions)o.push(t);a={...a,...n},i(`theme`,r),i(`options`,a),i(`actions`,o)},o=(e,t)=>{n[e]=t,i(`options`,e,t)},s=[`activationMode`,`keyHoldDuration`,`allowActivationInsideInput`,`activationKey`,`getContent`,`maxContextLines`,`freezeReactUpdates`],c=e=>{for(let t of s)e[t]!==void 0&&o(t,e[t])},l=(e,n)=>{t.has(e.name)&&u(e.name);let r=e.setup?.(n,_)??{};e.theme&&(r.theme=r.theme?$X($X(QX,e.theme),r.theme):e.theme),e.actions&&(r.actions=[...e.actions,...r.actions??[]]),e.hooks&&(r.hooks=r.hooks?{...e.hooks,...r.hooks}:e.hooks),e.options&&(r.options=r.options?{...e.options,...r.options}:e.options),t.set(e.name,{plugin:e,config:r}),a()},u=e=>{let n=t.get(e);n&&(n.config.cleanup&&n.config.cleanup(),t.delete(e),a())},d=()=>Array.from(t.keys()),f=(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&t(...n)}},p=(e,...n)=>{let r=!1;for(let{config:i}of t.values()){let t=i.hooks?.[e];t&&t(...n)===!0&&(r=!0)}return r},m=async(e,...n)=>{for(let{config:r}of t.values()){let t=r.hooks?.[e];t&&await t(...n)}},h=async(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=await t(i,...r))}return i},g=(e,n,...r)=>{let i=n;for(let{config:n}of t.values()){let t=n.hooks?.[e];t&&(i=t(i,...r))}return i},_={onActivate:()=>f(`onActivate`),onDeactivate:()=>f(`onDeactivate`),onElementHover:e=>f(`onElementHover`,e),onElementSelect:e=>{let n=!1,r;for(let{config:i}of t.values()){let t=i.hooks?.onElementSelect;if(t){let i=t(e);i===!0?n=!0:i instanceof Promise&&(n=!0,r=i)}}return{wasIntercepted:n,pendingResult:r}},onDragStart:(e,t)=>f(`onDragStart`,e,t),onDragEnd:(e,t)=>f(`onDragEnd`,e,t),onBeforeCopy:async e=>m(`onBeforeCopy`,e),transformCopyContent:async(e,t)=>h(`transformCopyContent`,e,t),onAfterCopy:(e,t)=>f(`onAfterCopy`,e,t),onCopySuccess:(e,t)=>f(`onCopySuccess`,e,t),onCopyError:e=>f(`onCopyError`,e),onStateChange:e=>f(`onStateChange`,e),onPromptModeChange:(e,t)=>f(`onPromptModeChange`,e,t),onSelectionBox:(e,t,n)=>f(`onSelectionBox`,e,t,n),onDragBox:(e,t)=>f(`onDragBox`,e,t),onGrabbedBox:(e,t)=>f(`onGrabbedBox`,e,t),onElementLabel:(e,t,n)=>f(`onElementLabel`,e,t,n),onContextMenu:(e,t)=>f(`onContextMenu`,e,t),onOpenFile:(e,t)=>p(`onOpenFile`,e,t),transformHtmlContent:async(e,t)=>h(`transformHtmlContent`,e,t),transformAgentContext:async(e,t)=>h(`transformAgentContext`,e,t),transformActionContext:e=>g(`transformActionContext`,e),transformOpenFileUrl:(e,t,n)=>g(`transformOpenFileUrl`,e,t,n)};return{register:l,unregister:u,getPluginNames:d,setOptions:c,store:r,hooks:_}},nZ=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,rZ=e=>{let t=e.bounds.x+e.bounds.width/2,n=e.bounds.width/2,r=e.mouseX===void 0?void 0:e.mouseX-t;return{id:nZ(`label`),bounds:e.bounds,boundsMultiple:e.boundsMultiple,tagName:e.tagName,componentName:e.componentName,status:e.status,createdAt:Date.now(),element:e.element,elements:e.elements,mouseX:e.mouseX,mouseXOffsetFromCenter:r,mouseXOffsetRatio:r!==void 0&&n>0?r/n:void 0,hideArrow:e.hideArrow}},iZ=(e,t)=>{let n=new Map,r=e=>{let t=n.get(e);t!==void 0&&(window.clearTimeout(t),n.delete(e))},i=()=>{for(let e of n.values())window.clearTimeout(e);n.clear()},a=()=>{i(),e.clearLabelInstances()},o=t=>{r(t);let i=window.setTimeout(()=>{e.updateLabelInstance(t,`fading`);let r=window.setTimeout(()=>{n.delete(t),e.removeLabelInstance(t)},125);n.set(t,r)},GM);n.set(t,i)};return{createInstance:(t,n,r,i,o)=>{a();let s=rZ({bounds:t,tagName:n,componentName:r,status:i,element:o?.element,mouseX:o?.mouseX,elements:o?.elements,boundsMultiple:o?.boundsMultiple,hideArrow:o?.hideArrow});return e.addLabelInstance(s),s.id},createPerElementInstances:(t,n)=>{a();let r=[];for(let i of t){let t=rZ({bounds:eY(i.element),tagName:i.tagName,componentName:i.componentName,status:n,element:i.element,mouseX:i.mouseX});e.addLabelInstance(t),r.push(t.id)}return r},updateAfterCopy:(t,n,r)=>{n?e.updateLabelInstance(t,`copied`):e.updateLabelInstance(t,`error`,r||`Unknown error`),o(t)},cancelAllFades:i,clearAll:a,handleHoverChange:(e,n)=>{if(n){r(e);return}let i=t().find(t=>t.id===e);i&&(i.status===`copied`||i.status===`error`||i.status===`fading`)&&o(e)}}},aZ=e=>{let t=window.innerWidth,n=window.innerHeight,r=Math.max(0,e.x),i=Math.min(t,e.x+e.width),a=Math.max(0,e.y),o=Math.min(n,e.y+e.height);return{x:(r+i)/2,y:(a+o)/2}},oZ=(e,t,n)=>{let r=[],i=(t,r)=>{let i=aZ(n(t)),a=MI(i.x,i.y).filter(e),o=a.indexOf(t);return o===-1?null:a[o+r]??null},a=e=>{let t=i(e,1);return t&&(r.push(e),r.length>50&&(r=r.slice(-50))),t},o=e=>{if(r.length>0){let e=r.pop();if(sB(e))return e}return i(e,-1)},s=(e,n)=>{let i=e=>n?e.nextElementSibling:e.previousElementSibling,a=i(e);for(;a;){if(t(a))return r=[],a;a=i(a)}return null};return{findNext:(e,t)=>{switch(e){case`ArrowUp`:return a(t);case`ArrowDown`:return o(t);case`ArrowRight`:return s(t,!0);case`ArrowLeft`:return s(t,!1);default:return null}},clearHistory:()=>{r=[]}}},sZ=e=>{let{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}=iX(e.activationKey);return{metaKey:t,ctrlKey:n,shiftKey:r,altKey:i}},cZ=()=>{let e=new WeakSet,t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,`key`),n=!1;if(t?.get&&!t.get.__reactGrabPatched){n=!0;let r=t.get,i=function(){return e.has(this)?``:r.call(this)};i.__reactGrabPatched=!0,Object.defineProperty(KeyboardEvent.prototype,"key",{get:i,configurable:!0})}return{claimedEvents:e,originalKeyDescriptor:t,restore:()=>{n&&t&&Object.defineProperty(KeyboardEvent.prototype,"key",t)}}},lZ=(e,t)=>({top:t<25,bottom:t>window.innerHeight-25,left:e<25,right:e>window.innerWidth-25}),uZ=(e,t,n)=>{let r=null,i=()=>{if(!t()){a();return}let o=e(),s=lZ(o.x,o.y),c=0,l=0;if(s.top&&(l-=10),s.bottom&&(l+=10),s.left&&(c-=10),s.right&&(c+=10),c!==0||l!==0){let e=window.scrollX,t=window.scrollY;window.scrollBy(c,l);let r=window.scrollX-e,i=window.scrollY-t;(r!==0||i!==0)&&n?.({x:r,y:i})}r=s.top||s.bottom||s.left||s.right?nI(i):null},a=()=>{r!==null&&(rI(r),r=null)};return{start:i,stop:a,isActive:()=>r!==null}},dZ=()=>{let e=globalThis;return!!(e.chrome?.runtime?.id||e.browser?.runtime?.id)},fZ=e=>{try{let t=`0.1.48`,n=`data:image/svg+xml;base64,${btoa(`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 294 294"><path fill="#ff40e0" d="M145 47c25-20 50-27 67-17 16 9 23 30 20 60 0 2-1 5-1 7l-2 13h-1l-12-4c-8-3-17-5-25-6l-17-3c-10-1-20-1-29-1-10 0-20 0-29 1-6 8-11 16-16 24-5 9-9 17-13 26 4 9 8 18 13 26s10 16 16 24l11 14c5 7 11 13 18 19l10 8s-1 0 0 0l-11 9c-17 14-35 22-49 22-6 0-13-2-18-5-16-9-23-30-20-59 1-3 1-5 1-8-30-12-48-29-48-50 0-18 14-35 41-47 2-1 5-2 7-3 0-2 0-5-1-7-3-30 4-51 20-60 18-10 42-3 68 17M71 201c-1 2-1 4-1 5-2 24 3 41 13 47h1c11 7 30 1 51-15-10-9-18-18-26-29-13-1-26-4-38-8m9-38c-3 9-5 17-7 26 8 2 17 4 25 6-3-5-6-10-9-16-3-5-6-10-9-16m-19-53c-2 1-3 1-5 2-21 10-34 23-34 35 0 13 14 27 39 37 3-12 7-25 12-37-5-12-9-24-12-37m37-10c-8 1-17 3-25 6 2 8 4 16 7 25 3-5 6-11 9-16zm-3-61c-4-1-8 0-12 2-10 7-15 24-13 47 0 2 0 3 1 5 12-4 25-6 38-8 8-10 16-20 26-29-15-11-29-17-40-17m111 2c-4-2-8-3-12-2-11 0-25 5-40 17 10 9 19 19 26 29 13 2 26 4 39 8v-5c3-23-2-40-13-47m-61 23c-7 6-13 13-19 19h37c-6-6-12-13-18-19"/><mask id="a"><path fill="#fff" d="m235 85-133 27 28 133 133-27Z"/></mask><path fill="#ff40e0" d="m137 130 76 11c8 1 9 11 3 15l-28 16-4 32c-1 8-10 10-14 4l-41-66c-3-6 1-13 8-12" mask="url(#a)"/></svg>`)}`;console.log(`%cReact Grab${` v${t}`}%c\nhttps://react-grab.com`,`background: #330039; color: #ffffff; border: 1px solid #d75fcb; padding: 4px 4px 4px 24px; border-radius: 4px; background-image: url("${n}"); background-size: 16px 16px; background-repeat: no-repeat; background-position: 4px center; display: inline-block; margin-bottom: 4px;`,``),e&&navigator.onLine&&!dZ()&&fetch(`https://www.react-grab.com/api/version?source=browser&v=${t}&t=${Date.now()}`,{referrerPolicy:`origin`,keepalive:!0,priority:`low`,cache:`no-store`}).then(e=>e.text()).then(e=>{e&&e!==t&&console.warn(`[React Grab] v${t} is outdated (latest: v${e}). Run \`npx grab@latest upgrade\` to upgrade.`)}).catch(()=>null)}catch{}},pZ=e=>typeof e==`object`&&!!e,mZ=e=>{if(!pZ(e))return null;let t={};return typeof e.enabled==`boolean`&&(t.enabled=e.enabled),(e.activationMode===`toggle`||e.activationMode===`hold`)&&(t.activationMode=e.activationMode),typeof e.keyHoldDuration==`number`&&Number.isFinite(e.keyHoldDuration)&&(t.keyHoldDuration=e.keyHoldDuration),typeof e.allowActivationInsideInput==`boolean`&&(t.allowActivationInsideInput=e.allowActivationInsideInput),typeof e.activationKey==`string`&&(t.activationKey=e.activationKey),typeof e.maxContextLines==`number`&&Number.isFinite(e.maxContextLines)&&(t.maxContextLines=e.maxContextLines),typeof e.freezeReactUpdates==`boolean`&&(t.freezeReactUpdates=e.freezeReactUpdates),typeof e.telemetry==`boolean`&&(t.telemetry=e.telemetry),Object.keys(t).length===0?null:t},hZ=()=>{if(typeof window>`u`)return null;try{let e=(document.currentScript instanceof HTMLScriptElement?document.currentScript:null)?.getAttribute(`data-options`);return e?mZ(JSON.parse(e)):null}catch{return null}},gZ=e=>e===`Enter`||e===`NumpadEnter`,_Z=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height,vZ=(e=>({name:e.name,setup:(t,n)=>({actions:[typeof e.contextMenuAction==`function`?e.contextMenuAction(t,n):e.contextMenuAction],cleanup:e.cleanup})}))({name:`copy`,contextMenuAction:{id:`copy`,label:`Copy`,shortcut:`C`,showInToolbarMenu:!0,onAction:e=>{e.copy?.()}}}),yZ={name:`comment`,setup:()=>({actions:[{id:`comment`,label:`Comment`,shortcut:`Enter`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterPromptMode?.()}}]})},bZ={name:`edit`,setup:()=>({actions:[{id:`edit`,label:`Style`,shortcut:`S`,shortcutModifier:!1,showInToolbarMenu:!0,onAction:e=>{e.enterEditMode?.()}}]})},xZ={name:`open`,actions:[{id:`open`,label:`Open`,shortcut:`O`,enabled:e=>!!e.filePath,onAction:e=>{e.filePath&&(e.hooks.onOpenFile(e.filePath,e.lineNumber)||II(e.filePath,e.lineNumber,e.hooks.transformOpenFileUrl),e.hideContextMenu(),e.cleanup())}}]},SZ=e=>{let t=e.left+e.width/2,n=e.top+e.height/2,r=n,i=window.innerHeight-n,a=t,o=window.innerWidth-t,s=Math.min(r,i,a,o);return s===r?`top`:s===a?`left`:s===o?`right`:`bottom`},CZ=()=>{let[e,t]=J(!1),[n,r]=J(null),i=GV(),a=()=>{let e=n();return sB(e)?e:null},o=()=>{r(null),i.clear(),t(!1)};return{selectedElement:a,isPendingDismiss:e,select:(e,n)=>{r(e),t(!1),n?.shouldPromptBeforeMouseHandoff?i.arm():i.clear()},clear:o,consumeMouseHandoff:()=>i.consume()&&a()!==null,showDismissPrompt:()=>a()?e()?!1:(t(!0),!0):(o(),!1),takeSelection:e=>{let t=a()??(sB(e)?e:null);return o(),t}}},wZ=async(e,t={})=>(await Promise.allSettled(e.map(e=>tW(e,t)))).map(e=>e.status===`fulfilled`?e.value:``),TZ=[vZ,bZ,yZ,xZ],EZ=!1,DZ=new Set,OZ=e=>{if(typeof window>`u`)return DY();let t={enabled:!0,activationMode:`toggle`,keyHoldDuration:100,allowActivationInsideInput:!0,...hZ(),...e};if(t.enabled===!1||EZ)return DY();EZ=!0,IM(t.container??null),fZ(t.telemetry!==!1);let{enabled:n,telemetry:r,container:i,...a}=t;return gR(e=>{let t=!1,n,r=tZ(a),{store:i,actions:o,pointer:s,viewportVersion:c,current:l}=rY({keyHoldDuration:r.store.options.keyHoldDuration??100}),u=Y(()=>l().state===`holding`),d=Y(()=>l().state===`active`),f=Y(()=>{let e=l();return e.state===`active`&&e.phase===`frozen`}),p=Y(()=>{let e=l();return e.state===`active`&&(e.phase===`dragging-select`||e.phase===`dragging-reposition`)}),m=Y(()=>{if(!p())return!1;let e=Math.abs(s().x+window.scrollX-i.dragStart.x),t=Math.abs(s().y+window.scrollY-i.dragStart.y);return e>2||t>2}),h=Y(()=>{let e=l();return e.state===`active`&&e.phase===`dragging-reposition`}),g=Y(()=>{let e=l();return e.state===`active`&&e.phase===`justDragged`}),_=Y(()=>l().state===`copying`),v=Y(()=>i.selectionInteractionLockDepth>0),y=Y(()=>l().state===`justCopied`),b=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode}),x=Y(()=>i.pendingCommentMode||b()),S=Y(()=>{let e=l();return e.state===`active`&&!!e.isPromptMode&&!!e.isPendingDismiss}),C=(e,t)=>{document.body.style[e]=t};yR(wR(d,(e,t)=>{e&&!t?(FL(s().x,s().y),C(`touchAction`,`none`)):!e&&t&&(IL(),C(`touchAction`,``))}));let w=zV(),[T,E]=J(!w||!w.collapsed),[D,O]=J(0),[k,ee]=J(0),[te,A]=J(w),[ne,re]=J(!1),ie=VV(e=>e.shiftKey),[ae,oe]=J(null),[se,ce]=J(null),[le,ue]=J(null),de=ZX({store:i,actions:o,isActivated:d,activateRenderer:()=>Gt(),deactivateRenderer:()=>Kt(),performCopyWithLabel:e=>dt(e),onOpen:()=>{kr(),ge?.(),ge=Or(Dr,ce)},onClose:()=>{ge?.(),ge=null,ce(null)}}),fe=Y(()=>i.contextMenuPosition!==null||de.isOpen()),pe=Y(()=>fe()||ae()!==null),me,he=null,ge=null,_e=!1,ve=new WeakMap,ye=CZ(),be=()=>!T()||b()||v()||fe()||ye.isPendingDismiss(),xe=()=>{ve=new WeakMap},Se=()=>{Le(!1),xe()},Ce=e=>{let t=te()??zV(),n={edge:t?.edge??`bottom`,ratio:t?.ratio??.5,collapsed:t?.collapsed??!1,enabled:t?.enabled??!0,defaultAction:t?.defaultAction??`copy`,...e};BV(n),A(n);for(let e of DZ)e(n)},we=()=>{Fe.timerId!==null&&(clearTimeout(Fe.timerId),Fe.timerId=null)},Te=()=>{Fe.copyWaiting=!1,Fe.holdTimerFired=!1,Fe.startTimestamp=null};yR(()=>{if(l().state!==`holding`){we();return}Fe.startTimestamp=Date.now(),Fe.timerId=window.setTimeout(()=>{if(Fe.timerId=null,Fe.copyWaiting){Fe.holdTimerFired=!0;return}o.activate()},i.keyHoldDuration),ER(we)}),yR(()=>{let e=l();if(e.state!==`active`||e.phase!==`justDragged`)return;let t=setTimeout(()=>{o.finishJustDragged()},GM);ER(()=>clearTimeout(t))}),yR(()=>{if(l().state!==`justCopied`)return;let e=setTimeout(()=>{o.finishJustCopied()},GM);ER(()=>clearTimeout(e))}),yR(wR(u,(e,t=!1)=>{!t||e||!d()||(r.store.options.activationMode!==`hold`&&o.setWasActivatedByToggle(!0),r.hooks.onActivate())}));let Ee=(e,t,n)=>{Oe(e,t,n),o.clearInputText()},De=()=>{let e=i.frozenElement||pt();e&&o.enterPromptMode({x:s().x,y:s().y},e)},Oe=(e,t,n)=>{o.setCopyStart({x:t,y:n},e)},ke={lastDetectionTimestamp:0,pendingDetectionScheduledAt:0,latestPointerX:0,latestPointerY:0},Ae=null,[je,Me]=J(null),Ne=(e,t)=>{Ae!==null&&clearTimeout(Ae),Me(null),Ae=window.setTimeout(()=>{Me({x:e,y:t}),Ae=null},32)},Pe=null,Fe={timerId:null,startTimestamp:null,copyWaiting:!1,holdTimerFired:!1},Ie=null,[j,Le]=J(!1),Re=0,ze=!1,Be=null,Ve=()=>{ze=!0,Be!==null&&window.clearTimeout(Be),Be=window.setTimeout(()=>{ze=!1,Be=null},GM)},He=()=>{Be!==null&&(window.clearTimeout(Be),Be=null),ze=!1},Ue=0,We=null,Ge=null,[M,Ke]=J(!1),[qe,Je]=J(null),[Ye,Xe]=J(null),[Ze,Qe]=sY(Ye),$e=Y(()=>de.isOpen()?yN:x()?vN:M()?qe():d()?_N:null),et=e=>ZY(e,gI),tt=oZ(gI,et,eY),nt=uZ(s,()=>p(),e=>{if(h()){if(o.shiftDragStart(e),Ie){Ie={x:Ie.x+e.x,y:Ie.y+e.y};return}let{pageX:t,pageY:n}=Et(s().x,s().y);Ie={x:t,y:n}}}),N=Y(()=>d()&&!_()),rt=new Map,it=(e,t)=>{let n=nZ(`grabbed`),i={id:n,bounds:e,createdAt:Date.now(),element:t};o.addGrabbedBox(i),r.hooks.onGrabbedBox(e,t);let a=window.setTimeout(()=>{rt.delete(n),o.removeGrabbedBox(n)},GM+125);rt.set(n,a)},at=async e=>{let t=await Promise.all(e.map(async e=>{let t=await BU(e),n=t?.componentName??null,r=t?.filePath,i=t?.lineNumber??void 0,a=t?.columnNumber??void 0;n||=VU(e);let o=e instanceof HTMLElement?e.innerText?.slice(0,100):void 0;return{tagName:RN(e),id:e.id||void 0,className:e.getAttribute(`class`)||void 0,textContent:o,componentName:n??void 0,filePath:r,lineNumber:i,columnNumber:a}}));window.dispatchEvent(new CustomEvent(`react-grab:element-selected`,{detail:{elements:t}}))},ot=iZ(o,()=>i.labelInstances),st=async(e,t,n)=>{He(),l().state!==`copying`&&o.startCopy();let r=!1,i;try{r=await e(),r||(i=`Failed to copy`)}catch(e){i=kY(e,`Action failed`)}if(t)for(let e of t)ot.updateAfterCopy(e,r,i);l().state===`copying`&&(r&&o.completeCopy(),n?Kt():r?(o.activate(),Ve()):o.unfreeze())},ct=(e,t,n)=>{let i=e[0],a=n??(i?VU(i):null),o=i?RN(i):null,s=a??o??void 0;return FY({getContent:r.store.options.getContent,componentName:s,maxContextLines:r.store.options.maxContextLines},r.hooks,e,t)},lt=async(e,t,n)=>{if(e.length===0)return!1;let i=[],a=[];for(let t of e){let{wasIntercepted:e,pendingResult:n}=r.hooks.onElementSelect(t);e||i.push(t),n&&a.push(n),r.store.theme.grabbedBoxes.enabled&&it(eY(t),t)}await iI();let o=!0;if(i.length>0&&(o=await ct(i,t,n)),a.length>0&&!(await Promise.all(a)).every(Boolean))throw new ZV;return at(e),o},ut=e=>{NU(e.primaryElement).then(async t=>{await st(()=>lt(e.targetElements,e.extraPrompt,t??void 0),e.labelInstanceIds.length>0?e.labelInstanceIds:null,e.shouldDeactivateAfter),e.onComplete?.()}).catch(t=>{let n=kY(t,`Action failed`);for(let t of e.labelInstanceIds)ot.updateAfterCopy(t,!1,n);l().state===`copying`&&o.unfreeze()})},dt=e=>{let{element:t,cursorX:n,selectedElements:r,extraPrompt:a,shouldDeactivateAfter:s,onComplete:c,dragRect:l}=e,u=r??[t],d=l??i.frozenDragRect,f=u.length>1,p=!f&&t===yt()?Tt():void 0,m=d&&f?GY(d):p??eY(t),h=f?m.x+m.width/2:n,g=RN(t);He(),o.startCopy();let _=g?ot.createInstance(m,g,void 0,`copying`,{element:t,mouseX:h,elements:r}):null;ut({primaryElement:t,targetElements:u,labelInstanceIds:_?[_]:[],extraPrompt:a,shouldDeactivateAfter:s,onComplete:c})},ft=e=>{let{elements:t,labelEntries:n,shouldDeactivateAfter:r,onComplete:i}=e,a=t[0];He(),o.startCopy(),ut({primaryElement:a,targetElements:t,labelInstanceIds:ot.createPerElementInstances(n,`copying`),shouldDeactivateAfter:r,onComplete:i})},pt=Y(()=>{if(c(),!N()||m()||v()||ye.isPendingDismiss())return null;let e=i.detectedElement;return sB(e)?e:null}),P=Y(()=>i.frozenElement||(f()?null:pt())),mt=Y(()=>!d()||b()||j()||_()||pe()||ye.isPendingDismiss()?null:ie()?f()?P():pt()??i.frozenElement:ye.selectedElement()),ht=Y(()=>{let e=mt();return e?JY(e,gI,et):[]}),gt=Y(()=>{let e=mt();return e?Math.max(0,ht().findIndex(t=>t.element===e)):0}),_t=Y(()=>mt()!==null);yR(()=>{let e=i.detectedElement;if(!e)return;let t=setInterval(()=>{sB(e)||o.setDetectedElement(null)},100);ER(()=>clearInterval(t))}),yR(wR(P,e=>{if(We!==null&&(clearTimeout(We),We=null),!e){Xe(null);return}We=window.setTimeout(()=>{We=null,Xe(e)},100)})),ER(()=>{We!==null&&(clearTimeout(We),We=null)}),yR(()=>{let e=i.frozenElements;ER(mL(e))}),yR(wR(d,e=>{e&&r.store.options.freezeReactUpdates&&ER(fR())}));let vt=()=>{if(i.isTouchMode&&p()){let e=i.detectedElement;return!e||oI(e)?void 0:e}let e=P();if(!(!e||oI(e)))return e},yt=Y(()=>vt()),bt=()=>yt()?i.isTouchMode&&p()?N():N()&&!m():!1,xt=ZR(()=>i.frozenElements,e=>Y(()=>(c(),eY(e)))),St=Y(()=>{let e=i.frozenElements;if(e.length===0)return[];let t=i.frozenDragRect;return t&&e.length>1?[GY(t)]:xt().map(e=>e())}),Ct=Y(()=>{if(!j()||i.pendingCommentMode||M())return null;let e=i.detectedElement;return!sB(e)||oI(e)||i.frozenElements.includes(e)?null:e}),wt=Y(()=>{c();let e=Ct();if(e)return eY(e)}),Tt=Y(()=>{c();let e=i.frozenElements;if(e.length>0){let t=St();if(e.length===1){let e=t[0];if(e)return e}let n=i.frozenDragRect;return n?t[0]??GY(n):qY(oX(t))}let t=yt();if(t)return eY(t)}),Et=(e,t)=>({pageX:e+window.scrollX,pageY:t+window.scrollY}),Dt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t);return{x:Math.abs(n-i.dragStart.x),y:Math.abs(r-i.dragStart.y)}},Ot=Y(()=>{if(!p())return!1;let e=Dt(s().x,s().y);return e.x>2||e.y>2}),kt=(e,t)=>{let{pageX:n,pageY:r}=Et(e,t),a=Math.min(i.dragStart.x,n),o=Math.min(i.dragStart.y,r),s=Math.abs(n-i.dragStart.x),c=Math.abs(r-i.dragStart.y);return{x:a-window.scrollX,y:o-window.scrollY,width:s,height:c}},At=e=>e.code===`Space`||e.key===` `,jt=()=>{if(!p())return;o.startDragReposition();let{pageX:e,pageY:t}=Et(s().x,s().y);Ie={x:e,y:t}},Mt=()=>{o.stopDragReposition(),Ie=null},Nt=Y(()=>{if(c(),Ot())return qY(kt(s().x,s().y))}),Pt=Y(()=>{if(c(),!Ot())return[];let e=je();if(!e)return[];let t=kt(e.x,e.y),n=HY(t,gI);return(n.length>0?n:HY(t,gI,!1)).map(e=>eY(e))}),Ft=Y(()=>{let e=Pt();if(e.length>0)return e;let t=wt();return t?[...St(),t]:St()}),It=ZR(()=>i.frozenElements,e=>{let t=RN(e)||`element`,n=VU(e)??void 0;return Y(()=>{if(c(),!sB(e))return null;let r=eY(e),i=ve.get(e);return{tagName:t,componentName:n,bounds:r,mouseX:i===void 0?void 0:r.x+r.width*i}})}),Lt=Y(()=>{if(b()||i.frozenElements.length<2)return[];let e=[];for(let t of It()){let n=t();n!==null&&e.push(n)}return e}),Rt=Y(()=>{if(b())return null;let e=Ct();return e?(c(),{tagName:RN(e)||`element`,componentName:VU(e)??void 0,bounds:eY(e),mouseX:s().x}):null}),zt=Y(()=>{if(_()||b()){c();let e=i.frozenElement||pt();return e?{x:tY(eY(e)).x+i.copyOffsetFromCenterX,y:i.copyStart.y}:{x:i.copyStart.x,y:i.copyStart.y}}return{x:s().x,y:s().y}}),Bt=Y(()=>{if(!j()||i.frozenElements.length!==1)return;c();let e=i.frozenElements[0];if(!sB(e))return;let t=ve.get(e);if(t===void 0)return;let n=eY(e);return n.x+n.width*t});yR(wR(()=>[pt(),i.lastGrabbedElement],([e,t])=>{t&&e&&t!==e&&o.setLastGrabbed(null),e&&r.hooks.onElementHover(e)})),yR(wR(()=>pt(),e=>{let t=++Ue,n=()=>{Ue===t&&o.setSelectionSource(null,null)};if(!e){n();return}BU(e).then(e=>{if(Ue===t){if(!e){n();return}o.setSelectionSource(e.filePath,e.lineNumber)}}).catch(()=>{Ue===t&&o.setSelectionSource(null,null)})}));let Vt=Y(()=>i.grabbedBoxes.map(e=>({id:e.id,bounds:e.bounds,createdAt:e.createdAt}))),Ht=Y(()=>i.labelInstances.map(e=>({id:e.id,status:e.status,tagName:e.tagName,componentName:e.componentName,createdAt:e.createdAt})));yR(wR(Y(()=>{let e=d(),t=p(),n=_(),a=b(),o=pt(),s=Nt(),c=r.store.theme.enabled,l=r.store.theme.selectionBox.enabled,u=r.store.theme.dragBox.enabled,f=Ot(),m=P(),h=y();return{isActive:e,isDragging:t,isCopying:n,isPromptMode:a,isSelectionBoxVisible:!!(c&&l&&e&&!n&&!h&&!t&&m!=null),isDragBoxVisible:!!(c&&u&&e&&!n&&f),targetElement:o,dragBounds:s?{x:s.x,y:s.y,width:s.width,height:s.height}:null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}}),e=>{r.hooks.onStateChange(e)})),yR(wR(()=>{let e=b();return{inputMode:e,position:e?s():CR(s),target:e?pt():CR(pt)}},({inputMode:e,position:t,target:n})=>{r.hooks.onPromptModeChange(e,{x:t.x,y:t.y,targetElement:n})})),yR(wR(()=>[ar(),Tt(),pt()],([e,t,n])=>{r.hooks.onSelectionBox(!!e,t??null,n)})),yR(wR(()=>[fr(),Nt()],([e,t])=>{r.hooks.onDragBox(!!e,t??null)})),yR(wR(()=>{let e=mr();return[e,pr(),e?zt():CR(zt),e?pt():CR(pt),i.selectionFilePath,i.selectionLineNumber]},([e,t,n,i,a,o])=>{r.hooks.onElementLabel(e,t,{x:n.x,y:n.y,content:``,element:i??void 0,tagName:i&&RN(i)||void 0,filePath:a??void 0,lineNumber:o??void 0})}));let Ut=null,Wt=e=>{if(e){if(!Ut){Ut=document.createElement(`style`),Ut.setAttribute(`data-react-grab-cursor`,``);let e=BN();e&&(Ut.nonce=e),HN(Ut),document.head.appendChild(Ut)}Ut.textContent=`* { cursor: ${e} !important; }`}else Ut&&=(Ut.remove(),null)};yR(wR(()=>[d(),_(),b()],([e,t,n])=>{Wt(t?`progress`:e&&!n?`crosshair`:null)}));let Gt=()=>{let e=u();o.activate(),e||r.hooks.onActivate()},Kt=()=>{let e=p(),t=i.previouslyFocusedElement;Mt(),o.deactivate(),de.resetWithDiscard(),kr(),Se(),wn(),ye.clear(),Ke(!1),Je(null),e&&C(`userSelect`,``),Pe&&window.clearTimeout(Pe),nt.stop(),t instanceof HTMLElement&&t!==document.body&&t!==document.activeElement&&sB(t)&&t.focus({preventScroll:!0}),r.hooks.onDeactivate()},qt=()=>{u()&&o.releaseHold(),d()&&Kt(),He()},Jt=()=>{o.setWasActivatedByToggle(!0),Gt()},Yt=()=>{let e=[...i.frozenElements],t=i.frozenElement||pt(),n=b()?i.inputText.trim():``;if(!t){Kt();return}let r=e.length>0?e:[t],a=r.map(e=>eY(e))[0],{x:s,y:c}=tY(a),l=s+i.copyOffsetFromCenterX;o.setPointer({x:s,y:c}),o.exitPromptMode(),o.clearInputText(),dt({element:t,cursorX:l,selectedElements:r,extraPrompt:n||void 0,shouldDeactivateAfter:!0})},Xt=()=>{if(b()){if(S()){o.clearInputText(),Kt();return}o.setPendingDismiss(!0),ee(e=>e+1)}},Zt=()=>{if(ye.isPendingDismiss()){Dn();return}o.clearInputText(),Kt()},Qt=()=>{o.setPendingDismiss(!1)},$t=()=>{if(de.isOpen()){de.dismiss();return}let e=i.frozenElement||pt();e&&en(e,{x:s().x,y:s().y})},en=(e,t,n={})=>de.trigger(e,t,n),tn=(e,t)=>{if(!de.isOpen()||i.contextMenuPosition!==null)return!1;let n=MI(e,t).find(gI);if(!n)return!1;let r=de.switchToElement(n,{x:e,y:t});return r&&fL([n]),r},nn=e=>({filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,componentName:Ze(),tagName:RN(e)||void 0}),rn=()=>{Ge=null,Ke(!1),o.setPendingCommentMode(!1),Je(null)},an=e=>{let t=i.frozenElement||pt();if(!t)return!1;let n={x:s().x,y:s().y},a=r.store.actions.find(t=>t.id===e);return a?e===`edit`?en(t,n,nn(t))?(o.clearInputText(),o.exitPromptMode(),rn(),!0):!0:(o.clearInputText(),o.exitPromptMode(),rn(),a.onAction(Nn(t,n)),!0):(o.clearInputText(),o.exitPromptMode(),rn(),Mr(_N),ln(t,n),!0)},on=e=>{if(d()){if($e()!==e&&b()&&an(e))return;if($e()!==e&&i.pendingCommentMode){o.setPendingCommentMode(!1),Ge=e,Je(e),Ke(!0);return}if($e()!==e&&M()){Ge=e,Je(e);return}Kt();return}T()&&(Ge=e,Je(e),Ke(!0),Jt())},sn=()=>{on(te()?.defaultAction??`copy`)},cn=(e,t,n)=>{rn(),o.clearInputText(),o.enterPromptMode({x:t,y:n},e)},ln=(e,t)=>{Se(),Ar(),o.showContextMenu(t,e),wn(),r.hooks.onContextMenu(e,t)},un=(e,t)=>{let n=Ge;if(Ge=null,Je(null),!n)return;if(n===`edit`){en(e,t,nn(e));return}let i=r.store.actions.find(e=>e.id===n);if(!i){Mr(_N),ln(e,t);return}i.onAction(Nn(e,t))},dn=()=>{if(T()){if(d()&&x()){Kt();return}o.setPendingCommentMode(!0),d()||Jt()}},fn=(e,t,n)=>{let r=n&&j()&&!p()&&!i.pendingCommentMode&&!M();if(be()||f()&&!r)return;if(o.setPointer({x:e,y:t}),ke.latestPointerX=e,ke.latestPointerY=t,r){let n=NI(e,t);n!==i.detectedElement&&o.setDetectedElement(n);return}let a=performance.now(),s=ke.pendingDetectionScheduledAt>0&&a-ke.pendingDetectionScheduledAt<200;if(a-ke.lastDetectionTimestamp>=32&&!s&&(ke.lastDetectionTimestamp=a,ke.pendingDetectionScheduledAt=a,setTimeout(()=>{if(be()){ke.pendingDetectionScheduledAt=0;return}let e=NI(ke.latestPointerX,ke.latestPointerY);e!==i.detectedElement&&o.setDetectedElement(e),ke.pendingDetectionScheduledAt=0})),p()){if(h()){let{pageX:n,pageY:r}=Et(e,t);Ie&&o.shiftDragStart({x:n-Ie.x,y:r-Ie.y}),Ie={x:n,y:r}}Ne(e,t);let n=lZ(e,t),r=n.top||n.bottom||n.left||n.right;r&&!nt.isActive()?nt.start():!r&&nt.isActive()&&nt.stop()}},pn=(e,t,n)=>{if(!N()||v())return!1;!n&&j()&&Se();let i=ye.selectedElement()!==null;return o.startDrag({x:e,y:t},n||i),o.setPointer({x:e,y:t}),C(`userSelect`,`none`),Ne(e,t),r.hooks.onDragStart(e+window.scrollX,t+window.scrollY),!0},mn=(e,t)=>{let n=i.frozenElements.includes(e),r=i.frozenElements.length===0;if(!n){let n=UY(eY(e),t);ve.set(e,n),r&&Qe(VU(e)??void 0)}o.toggleFrozenElement(e),PI();let a=i.frozenElements.includes(e);if(a||ve.delete(e),i.frozenElements.length===0){Se(),o.unfreeze();return}fL(i.frozenElements),Le(!0),o.setPointer(t),o.setLastGrabbed(a?e:i.frozenElements[i.frozenElements.length-1]),o.freeze(),wn()},hn=()=>{let e=i.frozenElements.filter(sB),t=e.map(e=>{let t=RN(e)||`element`,n=VU(e)??void 0,r=ve.get(e),i=eY(e);return{element:e,tagName:t,componentName:n,mouseX:r===void 0?i.x+i.width/2:i.x+i.width*r}});if(Se(),e.length===0){o.unfreeze();return}if(e.length===1){dt({element:e[0],cursorX:t[0].mouseX,selectedElements:e,shouldDeactivateAfter:i.wasActivatedByToggle});return}ft({elements:e,labelEntries:t,shouldDeactivateAfter:i.wasActivatedByToggle})},gn=(e,t,n)=>{let a=HY(e,gI),s=a.length>0?a:HY(e,gI,!1);if(s.length===0)return;let c=n&&!i.pendingCommentMode&&!M();if(c&&o.addFrozenElements(s),fL(c?i.frozenElements:s),r.hooks.onDragEnd(s,e),c){let e=s[s.length-1];Le(!0),PI(),o.setPointer(tY(eY(e))),o.setLastGrabbed(e),o.freeze(),wn();return}let l=s[0],u=tY(eY(l));o.setPointer(u),o.setFrozenElements(s);let d=KY(e);if(o.setFrozenDragRect(d),o.freeze(),o.setLastGrabbed(l),i.pendingCommentMode){cn(l,u.x,u.y);return}if(M()){Ke(!1),Ge?un(l,u):ln(l,u);return}let f=i.wasActivatedByToggle&&!t;dt({element:l,cursorX:u.x,selectedElements:s,shouldDeactivateAfter:f,dragRect:d})},_n=e=>{for(let t of i.frozenElements)if(sB(t)&&_Z(e,eY(t)))return t;return null},vn=(e,t,n,a)=>{let c=sB(i.frozenElement)?i.frozenElement:null,l=ye.selectedElement(),u=()=>MI(e,t).find(gI)??null;if(a&&!i.pendingCommentMode&&!M()){let n=u();n!==null&&mn(n,{x:e,y:t});return}let d=u()??(sB(i.detectedElement)?i.detectedElement:null),f=l??d??c;if(!f)return;let p,m,h=d===null&&c===f,g=l===f;if(h)p=s().x,m=s().y;else if(g){let e=tY(eY(f));p=e.x,m=e.y}else p=e,m=t;if(i.pendingCommentMode){cn(f,p,m),ye.clear();return}if(M()){Ke(!1);let{wasIntercepted:e}=r.hooks.onElementSelect(f);if(e)return;ye.clear(),fL([f]),o.setFrozenElement(f);let t={x:p,y:m};o.setPointer(t),o.freeze(),Ge?un(f,t):ln(f,t);return}let _=i.wasActivatedByToggle&&!n;o.setLastGrabbed(f),dt({element:f,cursorX:p,shouldDeactivateAfter:_}),ye.clear()},yn=()=>{p()&&(Mt(),o.cancelDrag(),nt.stop(),C(`userSelect`,``))},bn=(e,t,n,r)=>{if(!p())return;Ae!==null&&(clearTimeout(Ae),Ae=null),Me(null);let i=Dt(e,t),a=i.x>2||i.y>2,s=a?kt(e,t):null;a?o.endDrag():o.cancelDrag(),Mt(),nt.stop(),C(`userSelect`,``),s?gn(s,n,r):vn(e,t,n,r)},xn=OY(),Sn=cZ(),Cn=e=>{let t;try{t=Sn.originalKeyDescriptor?.get?Sn.originalKeyDescriptor.get.call(e):e.key}catch{return!1}let n=t===`Enter`||gZ(e.code),r=d()||u();return n&&r&&!b()&&!ye.isPendingDismiss()&&!i.wasActivatedByToggle?IB(e,`data-react-grab-input`)?!1:(Sn.claimedEvents.add(e),e.preventDefault(),e.stopImmediatePropagation(),!0):!1};xn.addDocumentListener(`keydown`,zM(Cn),{capture:!0}),xn.addDocumentListener(`keyup`,zM(Cn),{capture:!0}),xn.addDocumentListener(`keypress`,zM(Cn),{capture:!0});let wn=()=>{tt.clearHistory(),ye.clear()},Tn=(e,t=!1)=>{o.setFrozenElement(e),o.freeze(),ye.select(e,{shouldPromptBeforeMouseHandoff:t});let n=tY(eY(e));o.setPointer(n),i.contextMenuPosition!==null&&o.showContextMenu(n,e)},En=()=>{ye.showDismissPrompt()&&ee(e=>e+1)},Dn=()=>{ye.clear(),o.unfreeze(),wn()},On=()=>{let e=ye.takeSelection(i.frozenElement);if(!e){Dn();return}let t=tY(eY(e));wn(),o.setLastGrabbed(e),dt({element:e,cursorX:t.x,shouldDeactivateAfter:i.wasActivatedByToggle})},kn=e=>fN.has(e.key)?e.key:e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:null,An=(e,t={})=>{if(!d()||b()||j()||ye.isPendingDismiss()&&!t.allowPendingKeyboardSelection)return!1;let n=kn(e);if(!n||pe())return!1;let r=P(),i=!r;if(!r){let e=LM()?.getBoundingClientRect();r=e?NI(e.left+e.width/2,e.top+e.height/2):NI(window.innerWidth/2,window.innerHeight/2)}if(!r)return!1;let a=n===`ArrowUp`||n===`ArrowDown`,o=tt.findNext(n,r);if(!o&&!a&&!i)return!1;let s=o??r;return e.preventDefault(),e.stopPropagation(),Tn(s,!0),!0},jn=e=>e.metaKey||e.ctrlKey||e.altKey||e.repeat||uB(e)||!d()||_()||v()||pe()?null:i.frozenElement||pt(),Mn=e=>{let t=jn(e);if(!t)return null;let n=WV(r.store.actions,e);return n?{element:t,action:n}:null},Nn=(e,t)=>{let n=eY(e);return Cr({element:e,filePath:i.selectionFilePath??void 0,lineNumber:i.selectionLineNumber??void 0,tagName:RN(e)||void 0,componentName:Ze(),position:t,shouldDeferHideContextMenu:!1,performWithFeedbackOptions:{fallbackBounds:n,fallbackSelectionBounds:[n],position:t}})},Pn=/^[a-zA-Z0-9-]$/,Fn=e=>{if(!e.key||e.key.length!==1||!Pn.test(e.key))return!1;let t=jn(e);return!t||!de.trigger(t,{x:s().x,y:s().y},{initialSearchQuery:e.key})?!1:(rn(),e.preventDefault(),e.stopImmediatePropagation(),!0)},In=e=>{let t=Mn(e);if(!t)return!1;let{element:n,action:r}=t;if(b())return an(r.id)?(e.preventDefault(),e.stopImmediatePropagation(),!0):!1;let i={x:s().x,y:s().y};return r.onAction(Nn(n,i)),e.preventDefault(),e.stopImmediatePropagation(),!0},Ln=e=>{if(e.key?.toLowerCase()!==`o`||!d()||!(e.metaKey||e.ctrlKey))return!1;let t=i.selectionFilePath,n=i.selectionLineNumber;return t?(e.preventDefault(),e.stopPropagation(),r.hooks.onOpenFile(t,n??void 0)||II(t,n??void 0,r.hooks.transformOpenFileUrl),!0):!1},Rn=e=>{if(!d()||_()||i.contextMenuPosition!==null||de.isOpen())return!1;let t=e.key===`F10`&&e.shiftKey,n=e.key===`ContextMenu`;if(!t&&!n)return!1;let r=i.frozenElements,a=r.length>1,s=(a?r[0]:null)||i.frozenElement||pt();if(!s)return!1;e.preventDefault(),e.stopPropagation();let c=tY(eY(s));return a?fL(r):(fL([s]),o.setFrozenElement(s)),o.setPointer(c),o.freeze(),ln(s,c),!0},zn=Y(()=>ht().map(e=>({tagName:RN(e.element)||`element`,componentName:VU(e.element)??void 0,depth:e.depth,isLast:e.isLast}))),Bn=Y(()=>({items:zn(),activeIndex:gt()})),Vn=e=>{if(!(!r.store.options.allowActivationInsideInput&&uB(e))&&!(!aX(e,r.store.options)&&((e.metaKey||e.ctrlKey)&&!dN.includes(e.key)&&!gZ(e.code)&&(d()&&!i.wasActivatedByToggle?Kt():u()&&(we(),Te(),o.releaseHold())),!gZ(e.code)||!u()))){if((d()||u())&&!b()&&(e.preventDefault(),gZ(e.code)&&e.stopImmediatePropagation()),d()){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e.repeat)return;Pe!==null&&window.clearTimeout(Pe),Pe=window.setTimeout(()=>{Kt()},200);return}if(u()&&e.repeat){if(Fe.copyWaiting){let e=Fe.holdTimerFired;Te(),e&&o.activate()}return}if(!(_()||y())&&!u()){let t=r.store.options.keyHoldDuration??100;uB(e)?dB(e)?t+=600:t+=400:fB()&&(t+=600),Te(),o.startHold(t)}}},Hn=e=>{if(!ye.isPendingDismiss())return!1;if(gZ(e.code))return!0;let t=fN.has(e.key),n=Mn(e)!==null;return!t&&!n?!1:t?An(e,{allowPendingKeyboardSelection:!0}):In(e)?(wn(),!0):!1};xn.addWindowListener(`keydown`,zM(e=>{if(kn(e)&&uB(e)||Hn(e))return;if(Cn(e),!T()){aX(e,r.store.options)&&!e.repeat&&O(e=>e+1);return}let t=gZ(e.code)&&u()&&!b(),n=IB(e,hN);if(b()&&aX(e,r.store.options)&&!e.repeat&&!n){e.preventDefault(),e.stopPropagation(),Xt();return}if(e.key===`Escape`&&pe()){ae()!==null&&kr();return}let a=IB(e,`data-react-grab-ignore-events`)&&!t;if(b()||a)return b()&&!n&&In(e)||(e.key===`Escape`&&(b()?Xt():i.wasActivatedByToggle&&Kt()),a&&fN.has(e.key)&&An(e)),void 0;if(p()&&At(e)){e.repeat||jt(),e.preventDefault(),e.stopPropagation();return}if(e.key===`Escape`&&(u()||i.wasActivatedByToggle)){Kt();return}d()&&!dN.includes(e.key)&&e.preventDefault();let o=Date.now()-Re<200;An(e)||Ln(e)||Rn(e)||In(e)||Fn(e)||o||Vn(e)}),{capture:!0}),xn.addWindowListener(`keyup`,zM(e=>{if(Cn(e))return;if(At(e)&&h()&&(Mt(),e.preventDefault(),e.stopPropagation()),e.key===`Shift`&&j()){p()&&yn(),hn();return}if(IB(e,`data-react-grab-ignore-events`))return;let t=sZ(r.store.options),n=t.metaKey||t.ctrlKey?FB()?!e.metaKey:!e.ctrlKey:t.shiftKey&&!e.shiftKey||t.altKey&&!e.altKey,a=r.store.options.activationKey?typeof r.store.options.activationKey==`function`?r.store.options.activationKey(e):rX(r.store.options.activationKey)(e):$Y(e.key,e.code);if(y()||ze){(a||n)&&(He(),Kt());return}if(!u()&&!d()||b())return;let s=!!r.store.options.activationKey,c=r.store.options.activationMode===`hold`,l=p();if(d()){let e=fe();if(n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`||e)return;Kt()}else if(c&&a){if(Pe!==null&&(window.clearTimeout(Pe),Pe=null),e||l)return;Kt()}else!s&&a&&Pe!==null&&(window.clearTimeout(Pe),Pe=null);return}if(a||n){if(i.wasActivatedByToggle&&r.store.options.activationMode!==`hold`)return;if(u()||Fe.holdTimerFired&&n){we();let t=(Fe.startTimestamp?Date.now()-Fe.startTimestamp:0)>=200,n=Fe.holdTimerFired&&t&&(r.store.options.allowActivationInsideInput||!uB(e));Te(),n?o.activate():o.releaseHold()}else Kt()}}),{capture:!0}),xn.addDocumentListener(`copy`,()=>{u()&&(Fe.copyWaiting=!0)}),xn.addWindowListener(`keypress`,zM(Cn),{capture:!0}),xn.addWindowListener(`pointermove`,zM(e=>{if(!e.isPrimary)return;let t=e.pointerType===`touch`;if(o.setTouchMode(t),!IB(e,`data-react-grab-ignore-events`)&&!be()&&!(t&&!u()&&!d())){if((t?u():d())&&!b()&&f()&&!e.shiftKey&&!j()){if(ye.consumeMouseHandoff()){En();return}o.unfreeze(),wn()}fn(e.clientX,e.clientY,e.shiftKey)}}),{passive:!0}),xn.addWindowListener(`pointerdown`,zM(e=>{if(e.button===0&&e.isPrimary&&(o.setTouchMode(e.pointerType===`touch`),_e=!1,!IB(e,`data-react-grab-ignore-events`))){if(fe()){tn(e.clientX,e.clientY)&&(_e=!0,e.preventDefault(),e.stopImmediatePropagation());return}if(b()){let t=Tt();t&&e.clientX>=t.x&&e.clientX<=t.x+t.width&&e.clientY>=t.y&&e.clientY<=t.y+t.height?Yt():Xt();return}if(ye.isPendingDismiss()){e.preventDefault(),e.stopImmediatePropagation();return}if(v()){e.preventDefault(),e.stopImmediatePropagation();return}pn(e.clientX,e.clientY,e.shiftKey)&&(e.pointerId!==void 0&&document.documentElement.setPointerCapture(e.pointerId),e.preventDefault(),e.stopImmediatePropagation())}}),{capture:!0}),xn.addWindowListener(`pointerup`,zM(e=>{if(e.button!==0||!e.isPrimary||IB(e,`data-react-grab-ignore-events`)||fe())return;let t=N()||v()||p(),n=e.metaKey||e.ctrlKey;bn(e.clientX,e.clientY,n,e.shiftKey),t&&(e.preventDefault(),e.stopImmediatePropagation())}),{capture:!0}),xn.addWindowListener(`contextmenu`,zM(e=>{if(!N()||_()||b()||de.isOpen())return;let t=IB(e,`data-react-grab-ignore-events`),n={x:e.clientX,y:e.clientY},r=t&&i.frozenElements.length>1?_n(n):null,a=ye.isPendingDismiss();if(t&&!r&&!a&&!_t())return;if(fe()){e.preventDefault();return}e.preventDefault(),e.stopPropagation();let s=r??NI(e.clientX,e.clientY);if(!s)return;let c=i.frozenElements;c.length>1&&c.includes(s)?fL(c):(fL([s]),o.setFrozenElement(s)),o.setPointer(n),o.freeze(),ln(s,n)}),{capture:!0}),xn.addWindowListener(`pointercancel`,zM(e=>{e.isPrimary&&yn()})),xn.addWindowListener(`click`,zM(e=>{if(!IB(e,`data-react-grab-ignore-events`)){if(_e){_e=!1,e.preventDefault(),e.stopImmediatePropagation();return}fe()||(N()||g())&&(e.preventDefault(),e.stopImmediatePropagation(),i.wasActivatedByToggle&&!b()&&!e.shiftKey&&(u()?o.setWasActivatedByToggle(!1):Kt()))}}),{capture:!0}),xn.addDocumentListener(`visibilitychange`,()=>{if(document.hidden){o.clearGrabbedBoxes();let e=i.activationTimestamp;d()&&!b()&&e!==null&&Date.now()-e>500&&Kt()}}),xn.addWindowListener(`blur`,()=>{yn(),u()&&(we(),o.releaseHold(),Te()),Se()}),xn.addWindowListener(`focus`,()=>{Re=Date.now()}),xn.addWindowListener(`focusin`,e=>{IB(e,BM)&&e.stopPropagation()},{capture:!0});let Un=()=>{if(!(i.isTouchMode&&!u()&&!d())&&!be()&&!f()&&!p()&&i.frozenElements.length===0){let e=NI(s().x,s().y);o.setDetectedElement(e)}},Wn=null,Gn=null,Kn=()=>{WY(),Un(),o.incrementViewportVersion(),o.updateContextMenuPosition()};xn.addWindowListener(`scroll`,Kn,{capture:!0});let qn=window.innerWidth,Jn=window.innerHeight;xn.addWindowListener(`resize`,()=>{let e=window.innerWidth,t=window.innerHeight;if(qn>0&&Jn>0){let n=e/qn,r=t/Jn,i=Math.abs(n-r)<xN,a=Math.abs(n-1)>xN;i&&a&&o.setPointer({x:s().x*n,y:s().y*r})}qn=e,Jn=t,Kn()});let Yn=window.visualViewport;if(Yn){let{signal:e}=xn;Yn.addEventListener(`resize`,Kn,{signal:e}),Yn.addEventListener(`scroll`,Kn,{signal:e})}let Xn=()=>{Gn===null&&(Gn=nI(()=>{Gn=null,o.incrementViewportVersion()}))};yR(()=>{if(r.store.theme.enabled&&(d()||_()||i.labelInstances.length>0||i.grabbedBoxes.length>0)){if(Wn!==null)return;Wn=window.setInterval(()=>{Xn()},100);return}Wn!==null&&(window.clearInterval(Wn),Wn=null),Gn!==null&&(rI(Gn),Gn=null)}),ER(()=>{Wn!==null&&window.clearInterval(Wn),Gn!==null&&rI(Gn)}),xn.addDocumentListener(`copy`,zM(e=>{b()||IB(e,`data-react-grab-ignore-events`)||N()&&e.preventDefault()}),{capture:!0}),ER(()=>{xn.abort(),Ae!==null&&window.clearTimeout(Ae),Pe&&window.clearTimeout(Pe),He(),he?.(),he=null,ge?.(),ge=null,rt.forEach(e=>window.clearTimeout(e)),rt.clear(),ot.cancelAllFades(),nt.stop(),C(`userSelect`,``),C(`touchAction`,``),Wt(null),Sn.restore(),IM(null)});let{root:Zn,host:Qn}=oY(HJ);ER(TY(Qn).cleanup);let $n=Y(()=>r.store.theme.enabled),er=Y(()=>r.store.theme.selectionBox.enabled),tr=Y(()=>r.store.theme.elementLabel.enabled),nr=Y(()=>r.store.theme.dragBox.enabled),rr=Y(()=>y()||ne()&&!f()||de.isInteracting()),ir=Y(()=>Pt().length>0),ar=Y(()=>!$n()||!er()||rr()?!1:ir()?!0:bt()),or=Y(()=>{let e=yt();if(e)return RN(e)||void 0}),sr=Y(()=>!$n()||fe()||!tr()||rr()?!1:bt()),cr=new Map,lr=e=>{let t=e.elements?.filter(sB)??[],n=e.element,r=null;t.length>0?r=t.map(eY):n&&sB(n)&&(r=[eY(n)]);let i=e.bounds,a=e.boundsMultiple;r&&(i=r.length>1?qY(oX(r)):r[0],e.boundsMultiple!==void 0&&(a=e.boundsMultiple.length>1&&e.boundsMultiple.length===e.elements?.length?r:[i]));let o=cr.get(e.id),s=o?.boundsMultiple,c=s===a||s!==void 0&&a!==void 0&&s.length===a.length&&s.every((e,t)=>e.x===a[t].x&&e.y===a[t].y&&e.width===a[t].width&&e.height===a[t].height);if(o&&o.status===e.status&&o.errorMessage===e.errorMessage&&o.bounds.x===i.x&&o.bounds.y===i.y&&o.bounds.width===i.width&&o.bounds.height===i.height&&c)return o;let l=i.x+i.width/2,u=i.width/2,d;d=e.mouseXOffsetRatio!==void 0&&u>0?l+e.mouseXOffsetRatio*u:e.mouseXOffsetFromCenter===void 0?e.mouseX??l:l+e.mouseXOffsetFromCenter;let f={...e,bounds:i,boundsMultiple:a,mouseX:d};return cr.set(e.id,f),f},ur=Y(()=>{if(!$n()||!r.store.theme.grabbedBoxes.enabled)return[];c();let e=new Set(i.labelInstances.map(e=>e.id));for(let t of cr.keys())e.has(t)||cr.delete(t);return i.labelInstances.map(lr)}),dr=Y(()=>!$n()||!r.store.theme.grabbedBoxes.enabled?[]:(c(),i.grabbedBoxes.map(e=>!e.element||!document.body.contains(e.element)?e:{...e,bounds:eY(e.element)}))),fr=Y(()=>$n()&&nr()&&N()&&Ot()),pr=Y(()=>_()?`processing`:`hover`),mr=Y(()=>{if(!$n())return!1;let e=tr(),t=b(),n=_(),r=N(),i=p(),a=!!P(),o=ne(),s=f();return!e||t||o&&!s?!1:n?!0:r&&!i&&a}),hr=Y(()=>{c();let e=i.contextMenuElement;return e?eY(e):null}),gr=Y(()=>(c(),i.contextMenuPosition)),_r=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=i.frozenElements.length;return t>1?`${t} elements`:RN(e)||void 0}),[vr]=sY(()=>i.frozenElements.length>1?null:i.contextMenuElement),[yr]=xR(()=>i.contextMenuElement,async e=>e?BU(e):null),br=async e=>{o.incrementSelectionInteractionLockDepth();try{return await e()}finally{o.decrementSelectionInteractionLockDepth()}},xr=(e,t,n,r,a)=>async c=>{await br(async()=>{let l=a?.fallbackBounds??null,u=a?.fallbackSelectionBounds??[],d=a?.position??i.contextMenuPosition??s(),f=St(),p=hr()??l,m=t.length>1,h=m?qY(oX(f)):p,g=i.wasActivatedByToggle,_;if(_=m?f:p?[p]:u,o.hideContextMenu(),h){let i=m?h.x+h.width/2:d.x,a=ot.createInstance(h,n||`element`,r,`copying`,{element:e,mouseX:i,elements:m?t:void 0,boundsMultiple:_}),o=!1,s;try{o=await c(),o||(s=`Failed to copy`)}catch(e){s=kY(e,`Action failed`)}ot.updateAfterCopy(a,o,s)}else try{await c()}catch{}g?Kt():o.unfreeze()})},Sr=()=>{setTimeout(()=>{o.hideContextMenu()},0)},Cr=e=>{let{element:t,filePath:n,lineNumber:a,tagName:s,componentName:c,position:l,performWithFeedbackOptions:u,shouldDeferHideContextMenu:f,onBeforeCopy:p,onBeforePrompt:m,customEnterPromptMode:h}=e,g=i.frozenElements.length>0?i.frozenElements:[t],_=f?Sr:o.hideContextMenu,v={element:t,elements:g,filePath:n,lineNumber:a,componentName:c,tagName:s,enterPromptMode:h??(()=>{ot.clearAll(),rn(),m?.(),Ee(t,l.x,l.y),o.setPointer({x:l.x,y:l.y}),o.setFrozenElement(t),De(),d()||Gt(),_()}),enterEditMode:()=>{en(t,l,{filePath:n,lineNumber:a,componentName:c,tagName:s})&&rn(),_()},copy:()=>{rn(),p?.(),dt({element:t,cursorX:l.x,selectedElements:g.length>1?g:void 0,shouldDeactivateAfter:i.wasActivatedByToggle}),_()},hooks:{transformHtmlContent:r.hooks.transformHtmlContent,onOpenFile:r.hooks.onOpenFile,transformOpenFileUrl:r.hooks.transformOpenFileUrl},performWithFeedback:xr(t,g,s,c,u),hideContextMenu:_,cleanup:()=>{i.wasActivatedByToggle?Kt():o.unfreeze()}},y=r.hooks.transformActionContext(v);return{...v,...y}},wr=Y(()=>{let e=i.contextMenuElement;if(!e)return;let t=yr(),n=i.contextMenuPosition??s();return Cr({element:e,filePath:t?.filePath,lineNumber:t?.lineNumber??void 0,tagName:_r(),componentName:vr(),position:n,shouldDeferHideContextMenu:!0,onBeforeCopy:()=>{ye.clear()},customEnterPromptMode:()=>{ot.clearAll(),rn(),o.clearInputText(),o.enterPromptMode(n,e),Sr()}})}),Tr=()=>{setTimeout(()=>{o.hideContextMenu(),Kt()},0)},Er=()=>{if(!me)return null;let e=me.getBoundingClientRect(),t=SZ(e);return t===`left`||t===`right`?{x:t===`left`?e.right:e.left,y:e.top+e.height/2,edge:t}:{x:e.left+e.width/2,y:t===`top`?e.bottom:e.top,edge:t}},Dr=()=>{let e=Er();if(e)return e;let t=de.state();return t?{x:t.position.x,y:t.position.y,edge:`bottom`}:null},Or=(e,t)=>{let n=null,r=()=>{let i=e();i&&t(i),n=nI(r)};return r(),()=>{n!==null&&(rI(n),n=null)}};yR(()=>{if(!_t())return;let e=Or(Er,ue);ER(()=>{e(),ue(null)})});let kr=()=>{he?.(),he=null,oe(null)},Ar=()=>{o.hideContextMenu(),kr(),de.dismiss()},jr=()=>{ae()===null?(o.hideContextMenu(),de.isOpen()&&de.closePreservingRenderer(),he?.(),he=Or(Er,oe)):kr()},Mr=e=>{Ce({defaultAction:e})},Nr=e=>{let t=i.labelInstances.find(t=>t.id===e);if(!t?.element||!sB(t.element))return;let n=t.element,r=tY(eY(n)),a={x:t.mouseX??r.x,y:r.y},s=t.elements&&t.elements.length>0?t.elements.filter(e=>sB(e)):[n];setTimeout(()=>{kr(),de.isOpen()&&de.closePreservingRenderer(),d()||(o.setWasActivatedByToggle(!0),Gt()),o.setPointer(a),o.setFrozenElements(s),s.length>1&&t.bounds&&o.setFrozenDragRect(KY(t.bounds)),o.freeze(),o.showContextMenu(a,n)},0)};yR(()=>{let e=r.store.theme.hue;e===0?Zn.style.filter=``:Zn.style.filter=`hue-rotate(${e}deg)`}),r.store.theme.enabled&&Promise.resolve().then(()=>(DJ(),aW)).then(({ReactGrabRenderer:e})=>{t||(n=dz(()=>X(e,{get selectionVisible(){return ar()},get selectionBounds(){return Tt()},get selectionBoundsMultiple(){return Ft()},get selectionShouldSnap(){return i.frozenElements.length>0||Pt().length>0},get selectionElementsCount(){return i.frozenElements.length},get frozenLabelEntries(){return Lt()},get pendingShiftPreviewEntry(){return Rt()??void 0},get selectionFilePath(){return i.selectionFilePath??void 0},get selectionLineNumber(){return i.selectionLineNumber??void 0},get selectionTagName(){return or()},get selectionComponentName(){return Ze()},get selectionLabelVisible(){return sr()},selectionLabelStatus:`idle`,get hierarchyState(){return Bn()},get hierarchyMenuPosition(){return le()},get labelInstances(){return ur()},get dragVisible(){return fr()},get dragBounds(){return Nt()},get grabbedBoxes(){return dr()},get mouseX(){return aB(()=>i.frozenElements.length>1)()?void 0:Bt()??zt().x},get isFrozen(){return f()||d()||ne()},get inputValue(){return i.inputText},get isPromptMode(){return b()},onShowContextMenuInstance:Nr,get onLabelInstanceHoverChange(){return ot.handleHoverChange},get onInputChange(){return o.setInputText},onInputSubmit:()=>void Yt(),onToggleExpand:$t,get selectionLabelShakeCount(){return k()},onConfirmDismiss:Zt,get discardPrompt(){return aB(()=>!!ye.isPendingDismiss())()?{isKeyboardSelection:!0,onConfirm:Zt,onCopy:On}:S()?{onConfirm:Zt,onCancel:Qt}:void 0},get toolbarVisible(){return r.store.theme.toolbar.enabled},get isActive(){return d()},onToggleActive:sn,onActivateAction:on,get activeActionId(){return $e()},get enabled(){return T()},get shakeCount(){return D()},onToolbarStateChange:e=>{A(e),e.enabled!==T()&&(E(e.enabled),e.enabled||(qt(),Ar())),DZ.forEach(t=>t(e))},onSubscribeToToolbarStateChanges:e=>(DZ.add(e),()=>{DZ.delete(e)}),onToolbarSelectHoverChange:re,onToolbarRef:e=>{me=e},get contextMenuPosition(){return gr()},get contextMenuBounds(){return hr()},get contextMenuTagName(){return _r()},get contextMenuComponentName(){return vr()},get contextMenuHasFilePath(){return!!yr()?.filePath},get actions(){return r.store.actions},get actionContext(){return wr()},onContextMenuDismiss:Tr,onContextMenuHide:Sr,get toolbarMenuPosition(){return ae()},get toolbarMenuActions(){return r.store.actions.filter(e=>e.showInToolbarMenu===!0)},get defaultActionId(){return te()?.defaultAction??`copy`},onSetDefaultAction:Mr,onToggleToolbarMenu:jr,onToolbarMenuDismiss:kr,get editPanelState(){return de.state()},get editPanelPosition(){return se()},get onEditPanelDismiss(){return de.dismiss},get onEditPanelSubmit(){return de.submit},get onEditPanelPendingEditsChange(){return de.setPendingEdits},get onEditPanelInteractingChange(){return de.setInteracting}}),Zn))}).catch(e=>{console.warn(`[react-grab] Failed to load renderer:`,e)});let Pr={activate:()=>{o.setPendingCommentMode(!1),!d()&&T()&&Jt()},deactivate:()=>{(d()||_())&&Kt()},toggle:()=>{d()?Kt():T()&&Jt()},comment:dn,isActive:()=>d(),isEnabled:()=>T(),setEnabled:e=>{e!==T()&&(E(e),Ce({enabled:e,collapsed:!e}),e||(qt(),Ar()))},getToolbarState:()=>te()??zV(),setToolbarState:e=>{let t=te()??zV(),n=e.collapsed??t?.collapsed??!1,r={edge:e.edge??t?.edge??`bottom`,ratio:e.ratio??t?.ratio??.5,collapsed:n,enabled:e.enabled??!n,defaultAction:e.defaultAction??t?.defaultAction??`copy`};BV(r),A(r),r.enabled!==T()&&(E(r.enabled),r.enabled||(qt(),Ar())),DZ.forEach(e=>e(r))},onToolbarStateChange:e=>(DZ.add(e),()=>{DZ.delete(e)}),reset:()=>{qt(),Ar(),o.clearGrabbedBoxes(),o.clearLabelInstances(),o.setSelectionSource(null,null)},dispose:()=>{t=!0,EZ=!1,n?.(),he?.(),he=null,ge?.(),ge=null,DZ.clear(),e()},copyElement:async e=>{let t=Array.isArray(e)?e:[e];return t.length!==0&&await ct(t)},getSource:async e=>{let t=await BU(e);return t?{filePath:t.filePath,lineNumber:t.lineNumber,componentName:t.componentName}:null},getStackContext:e=>QU(e,{maxLines:r.store.options.maxContextLines}),getState:()=>({isActive:d(),isDragging:p(),isCopying:_(),isPromptMode:b(),isSelectionBoxVisible:!!ar(),isDragBoxVisible:!!fr(),targetElement:pt(),dragBounds:Nt()??null,grabbedBoxes:[...Vt()],labelInstances:[...Ht()],selectionFilePath:i.selectionFilePath,toolbarState:te()}),setOptions:e=>{r.setOptions(e)},registerPlugin:e=>{r.register(e,Pr)},unregisterPlugin:e=>{r.unregister(e)},getPlugins:()=>r.getPluginNames(),getDisplayName:VU};for(let e of TZ)r.register(e,Pr);return setTimeout(()=>{XF(!0)},TN),Pr})}})),AZ=r({DEFAULT_THEME:()=>QX,commentPlugin:()=>yZ,formatElementInfo:()=>tW,generateSnippet:()=>wZ,getGlobalApi:()=>MZ,getStack:()=>MU,init:()=>OZ,isInstrumentationActive:()=>dP,openPlugin:()=>xZ,registerPlugin:()=>IZ,setGlobalApi:()=>NZ,unregisterPlugin:()=>LZ}),jZ,MZ,NZ,PZ,FZ,IZ,LZ,RZ=t((()=>{kZ(),pR(),iW(),jZ=null,MZ=()=>typeof window>`u`?jZ:window.__REACT_GRAB__??jZ??null,NZ=e=>{jZ=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},PZ=[],FZ=e=>{for(;PZ.length>0;){let t=PZ.shift();t&&e.registerPlugin(t)}},IZ=e=>{let t=MZ();if(t){t.registerPlugin(e);return}PZ.push(e)},LZ=e=>{let t=MZ();if(t){t.unregisterPlugin(e);return}let n=PZ.findIndex(t=>t.name===e);n!==-1&&PZ.splice(n,1)},typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?jZ=window.__REACT_GRAB__:(jZ=OZ(),window.__REACT_GRAB__=jZ),FZ(jZ),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:jZ})))}));Sr(),Br(),gD();var zZ=`linear-grab:context-copied`,BZ=`linear-grab:picker-activated`,VZ=`linear-grab:picker-finished`,HZ=0,UZ=null;function WZ(e){!e||e.grabbedAt===HZ||Tr().then(t=>{if(t.workflowMode!==`local`||e.grabbedAt===HZ)return;let n=()=>{HZ=e.grabbedAt,navigator.clipboard.writeText(fD(e,t)).then(()=>window.dispatchEvent(new CustomEvent(zZ))).catch(()=>{HZ=0})};e.source?.filePath?(UZ&&clearTimeout(UZ),UZ=null,n()):(UZ&&clearTimeout(UZ),UZ=setTimeout(n,900))})}function GZ(e,t=Date.now()){return{tagName:e.tagName||void 0,componentName:e.componentName||void 0,content:e.textContent?e.textContent.slice(0,500):``,source:e.filePath?{filePath:e.filePath,lineNumber:e.lineNumber??null,columnNumber:e.columnNumber??null,componentName:e.componentName??null}:null,stackContext:void 0,pageUrl:location.href,grabbedAt:t}}function KZ(e,t){let n=null,r=0;return{plugin:{name:`linear-grab`,hooks:{onElementSelect:i=>{r=Date.now(),n=Tr().then(e=>e.captureShots?JA(i):null);let a=t?.(),o={tagName:i.tagName?.toLowerCase()||void 0,componentName:a?.getDisplayName?.(i)||void 0,content:(i.textContent??``).slice(0,500),source:null,stackContext:void 0,pageUrl:location.href,grabbedAt:r};e([o]);try{a?.getSource?.(i)?.then(t=>{t?.filePath&&e([{...o,source:{filePath:t.filePath,lineNumber:t.lineNumber??null,columnNumber:t.columnNumber??null,componentName:t.componentName??o.componentName??null}}])})}catch{}}}},handleSelection(t){let i=r&&Date.now()-r<4e3?r:Date.now(),a=t.map((e,t)=>GZ(e,i+t));if(!a.length)return;e(a);let o=n;n=null,o&&o.then(t=>{t&&e([{...a[0],screenshotDataUrl:t},...a.slice(1)])})}}}var qZ=!1;async function JZ(){if(xr||qZ)return;qZ=!0;let e=await Promise.resolve().then(()=>(RZ(),AZ));try{e.init()}catch{qZ=!1;return}let t=KZ(e=>{kr(e),WZ(e[0])},()=>e.getGlobalApi());e.registerPlugin(t.plugin),GA(),window.addEventListener(`react-grab:element-selected`,e=>{t.handleSelection(e.detail.elements??[])})}async function YZ(){if(xr){let e=await chrome.runtime.sendMessage({type:`grab/activate`});if(e&&e.ok===!1)throw Error(e.error??`Cannot activate the picker on this page.`);return}await JZ();let e=await Promise.resolve().then(()=>(RZ(),AZ));window.dispatchEvent(new CustomEvent(BZ));let t=e.getGlobalApi();if(t?.activate?.(),typeof t?.isActive==`function`){let e=!1,n=0,r=setInterval(()=>{n+=1;let i=!1;try{i=t.isActive()}catch{}if(i){e=!0;return}(e||n>=8)&&(clearInterval(r),window.dispatchEvent(new CustomEvent(VZ)))},250);setTimeout(()=>clearInterval(r),3e5)}}function XZ(e){if(!xr)return()=>{};let t=t=>{t?.type===`grab/updated`&&e()};return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)}var ZZ=2500;function QZ(e){let t=e.x+e.w/2,n=e.y+e.h/2,r=document.elementFromPoint(t,n)??document.body,i=t=>{let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.w&&n.bottom>=e.y+e.h};for(;r!==document.body&&!i(r);)r=r.parentElement??document.body;return r}async function $Z(e){let t=null,n=document.createElement(`video`);try{t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:`browser`},audio:!1,preferCurrentTab:!0,selfBrowserSurface:`include`}),n.srcObject=t,n.muted=!0,n.playsInline=!0,await n.play(),await new Promise(e=>setTimeout(e,250));let r=n.videoWidth/window.innerWidth,i=n.videoHeight/window.innerHeight;if(!n.videoWidth||r<=0||i<=0)return null;let a=document.createElement(`canvas`);a.width=Math.max(1,Math.round(e.w*r)),a.height=Math.max(1,Math.round(e.h*i));let o=a.getContext(`2d`);return o?(o.drawImage(n,e.x*r,e.y*i,e.w*r,e.h*i,0,0,a.width,a.height),a.toDataURL(`image/png`)):null}catch(e){return console.warn(`[linear-grab] tab-frame region capture failed:`,e),null}finally{n.srcObject=null,t?.getTracks().forEach(e=>e.stop())}}function eQ(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;inset:0;z-index:2147483647;cursor:crosshair;user-select:none;`;let n=document.createElement(`div`);n.style.cssText=`position:fixed;display:none;border:2px solid #5e6ad2;border-radius:4px;box-shadow:0 0 0 100000px rgba(0,0,0,0.35);pointer-events:none;`,t.appendChild(n),document.body.appendChild(t);let r=0,i=0,a=!1,o=e=>({x:Math.min(r,e.clientX),y:Math.min(i,e.clientY),w:Math.abs(e.clientX-r),h:Math.abs(e.clientY-i)}),s=()=>{t.remove(),window.removeEventListener(`keydown`,l,!0)},c=()=>{s(),e(null)},l=e=>{e.key===`Escape`&&(e.stopPropagation(),c())};window.addEventListener(`keydown`,l,!0),t.addEventListener(`pointerdown`,e=>{a=!0,r=e.clientX,i=e.clientY,t.setPointerCapture(e.pointerId)}),t.addEventListener(`pointermove`,e=>{if(!a)return;let t=o(e);n.style.display=`block`,n.style.left=`${t.x}px`,n.style.top=`${t.y}px`,n.style.width=`${t.w}px`,n.style.height=`${t.h}px`}),t.addEventListener(`pointerup`,t=>{let n=o(t);if(s(),n.w<8||n.h<8)return e(null);(QZ(n).querySelectorAll(`*`).length>ZZ?$Z(n):Promise.race([YA(n),new Promise(e=>setTimeout(()=>{console.warn(`[linear-grab] region capture timed out after 4s — trying a tab frame`),e(null)},4e3))]).then(e=>e??$Z(n))).then(t=>{if(!t)return e(null);e({tagName:`region`,componentName:void 0,content:`Region capture ${Math.round(n.w)}×${Math.round(n.h)}`,source:null,stackContext:void 0,screenshotDataUrl:t,pageUrl:location.href,grabbedAt:Date.now()})})})})}Br(),Sr(),gD();var tQ=N(`<span class="text-text-faint ml-auto text-[10.5px] font-normal normal-case tabular-nums">`),nQ=N(`<details open class=group><summary class="text-text-dim hover:text-text flex cursor-pointer items-center gap-1.5 text-[11px] font-semibold tracking-wide uppercase select-none"><span aria-hidden class="text-text-faint inline-block w-3 text-center transition-transform group-open:rotate-90">›</span></summary><div class="flex flex-col gap-2 pt-2 pl-4">`),rQ=N(`<p class="text-warn text-[10.5px] leading-snug">Several captures resolve to the same source — this page region likely renders inside an iframe/canvas the picker can't see into. Use <b>Capture region</b> for visual pointers there.`),iQ=N(`<span class="inline-block min-w-[8ch] text-center">`),aQ=N(`<div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">All elements post into ONE issue. Shift+click / drag selects several at once.</span><div class="flex items-center justify-end gap-1.5">`),oQ=N(`<div class="flex flex-col gap-1.5"><div class="flex gap-1.5">`),sQ=N(`<span class=text-danger>●`),cQ=N(`<div class="flex flex-col gap-1.5"><span class="text-text-faint text-[10.5px] leading-snug">Captures your screen as a looping GIF (max 30s) the coding agent can watch. Pick this tab in the share dialog, then reproduce the issue.`),lQ=N(`<span class="inline-block min-w-[4ch] text-center">Stop`),uQ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full"></span><span class="text-text min-w-[5ch] text-[12px] tabular-nums"></span><span class="text-text-faint text-[10.5px]">max 0:30`),dQ=N(`<div class="bg-surface border-border flex items-center gap-2 rounded-lg border p-2.5"><span class="text-text-dim text-[12px]">Encoding GIF…`),fQ=N(`<div class="flex h-full flex-col gap-4 overflow-y-auto pt-3 pb-4 pl-3 pr-4">`),pQ=N(`<span class="text-success text-[12px] leading-none">✓`),mQ=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M4 4l8 8M12 4l-8 8">`),hQ=N(`<span class="font-mono text-text-dim break-all text-[11px] leading-snug">`),gQ=N(`<img alt="Element location screenshot"class="border-border bg-bg max-h-32 w-full rounded-md border object-contain">`),_Q=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex items-center justify-between gap-2"><span class="font-mono text-accent min-w-0 truncate text-[12px]"></span><div class="flex shrink-0 items-center gap-1">`),vQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),yQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><rect x=2 y=2.5 width=12 height=11 rx=1.5></rect><path d="m2 10.5 3.5-3 3 2.5 3-2 2.5 2"></path><circle cx=6 cy=6 r=1 fill=currentColor stroke=none>`),bQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2.5v8M4.5 7.5 8 11l3.5-3.5M2.5 13.5h11">`),xQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M2.5 4h11M6.5 4V2.5h3V4M4 4l.7 9a1.5 1.5 0 0 0 1.5 1.4h3.6A1.5 1.5 0 0 0 11.3 13l.7-9M6.5 7v4.5M9.5 7v4.5">`),SQ=N(`<div class="bg-surface border-border flex flex-col gap-2 rounded-lg border p-2.5"><img alt="Screen recording preview"class="border-border bg-bg max-h-44 w-full rounded-md border object-contain"><span class="text-text-faint text-[10.5px] tabular-nums"> KB · <!>s · <!>×</span><label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Attach to issue on create</span></label><div class="flex items-center gap-1">`),CQ=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M6.5 9.5 9.5 6.5M7.5 4.5 9 3a2.5 2.5 0 0 1 3.5 3.5L11 8M8.5 11.5 7 13a2.5 2.5 0 0 1-3.5-3.5L5 8">`);function wQ(e){return(()=>{var t=nQ(),n=t.firstChild;n.firstChild;var r=n.nextSibling;return P(n,()=>e.title,null),P(n,j(M,{get when(){return e.badge},get children(){var t=tQ();return P(t,()=>e.badge),t}}),null),P(r,()=>e.children),t})()}function TQ(){let e=sr(),t=_r(()=>({queryKey:[`grab`],queryFn:Dr})),n=_r(()=>({queryKey:[`settings`],queryFn:Tr})),r=()=>t.data??[],i=()=>!!(n.data?.linearApiKey||n.data?.linearAccessToken),[a,o]=T(null),s=()=>{o(null),YZ().catch(e=>{o(e instanceof Error&&e.message?e.message:`Cannot activate the picker — open your dev app in the active tab first.`)})},c=async()=>{await jr(),e.invalidateQueries({queryKey:[`grab`]})},[l,u]=T(!1),d=async()=>{let e=(r()??[]).map(e=>`- <${e.componentName??e.tagName??`element`}>${e.source?.filePath?` — ${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}`:``}${e.screenshotDataUrl?` (screenshot captured — use Copy PNG to paste it)`:``}`),t=`Captured on ${r()?.[0]?.pageUrl??location.href}:\n${e.join(`
264
+ `)}`;try{await navigator.clipboard.writeText(t),u(!0),setTimeout(()=>u(!1),1800)}catch{}},[f,p]=T(null),m=async(e,t)=>{try{await navigator.clipboard.write([new ClipboardItem({"image/png":tj(t)})]),p(e),setTimeout(()=>p(null),1800)}catch{}},[h,g]=T(null),_=async e=>{try{await navigator.clipboard.writeText(fD(e,n.data??{})),g(e.grabbedAt),setTimeout(()=>g(null),1800)}catch{o(`Clipboard was blocked — click the button again.`)}},v=async t=>{await Ar(t),e.invalidateQueries({queryKey:[`grab`]})},[y,b]=T(!1),x=async()=>{o(null),b(!0),window.dispatchEvent(new CustomEvent(BZ));try{let e=await eQ();e?await kr([e]):o(`Region capture failed or was cancelled. On heavy pages a "share this tab" prompt appears — pick THIS tab to capture. Details in the console ([linear-grab]).`)}finally{b(!1),window.dispatchEvent(new CustomEvent(`linear-grab:picker-finished`))}},[S,C]=T(HD());ae(UD(C));let[w,E]=T(0);O(()=>{if(S().phase!==`recording`)return;let e=setInterval(()=>E(Date.now()-(HD().startedAt??Date.now())),250);ae(()=>clearInterval(e))});let k=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[ee,te]=T(`idle`),[A,ne]=T(null),re=async()=>{let e=HD().result;if(!e)throw Error(`No recording available.`);if(e.assetUrl)return e.assetUrl;let t=await Promise.race([DO(e.blob,`recording-${Date.now()}.gif`),new Promise((e,t)=>setTimeout(()=>t(Error(`upload timed out`)),6e4))]);return rO(t),t},ie=async()=>{ne(null),te(`busy`);try{let e=re().then(e=>new Blob([`![Screen recording](${e})`],{type:`text/plain`}));try{await navigator.clipboard.write([new ClipboardItem({"text/plain":e})])}catch{let t=await e;await navigator.clipboard.writeText(await t.text())}te(`copied`),setTimeout(()=>te(`idle`),2e3)}catch{te(`idle`),await le(),ne(`Direct upload is blocked in this browser — copied the GIF instead. Paste it into a Linear comment and Linear uploads it.`)}},oe=()=>{let e=S().result;if(!e)return;let t=document.createElement(`a`);t.href=e.url,t.download=`linear-grab-recording.gif`,t.click()},[se,ce]=T(`idle`),le=async()=>{let e=S().result;if(e){ne(null),ce(`busy`);try{try{await navigator.clipboard.write([new ClipboardItem({"image/gif":e.blob})])}catch{let t=await createImageBitmap(e.blob),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height,n.getContext(`2d`).drawImage(t,0,0);let r=await new Promise((e,t)=>n.toBlob(n=>n?e(n):t(Error(`PNG encode failed`)),`image/png`));await navigator.clipboard.write([new ClipboardItem({"image/png":r})]),ne(`Browser blocks GIF clipboard — copied the first frame as PNG. Use Download for the animation.`)}ce(`copied`),setTimeout(()=>ce(`idle`),2e3)}catch(e){ce(`idle`),ne(e instanceof Error?e.message:`Copy failed.`)}}};return(()=>{var e=fQ();return P(e,j(wQ,{title:`Captured elements`,get badge(){return $e(()=>!!r().length)()?`${r().length}/8`:void 0},get children(){return[j(M,{get when(){return r().length>0},get fallback(){return j(Vj,{title:`No elements captured`,children:`Click "Pick element" below, then use the react-grab overlay on your dev app. Every pick ADDS to this list — Shift+click or drag in the overlay selects several at once. Source info needs a dev build.`})},get children(){var e=aQ(),t=e.firstChild,n=t.firstChild.nextSibling;return P(e,j(We,{get each(){return r()},children:e=>(()=>{var t=_Q(),n=t.firstChild.firstChild,r=n.nextSibling;return P(n,(()=>{var t=$e(()=>!!e.componentName);return()=>t()?`<${e.componentName}>`:$e(()=>!!e.tagName)()?`<${e.tagName}>`:`Element`})()),P(r,j(kj,{class:`size-7 px-0`,variant:`ghost`,title:`Copy context for a local agent (Claude Code / Cursor) — includes skills & memory paths`,"aria-label":`Copy context`,onClick:()=>void _(e),get children(){return j(M,{get when(){return h()===e.grabbedAt},get fallback(){return vQ()},get children(){return pQ()}})}}),null),P(r,j(M,{get when(){return e.screenshotDataUrl},get children(){return j(kj,{class:`size-7 px-0`,variant:`ghost`,get title(){return f()===e.grabbedAt?`Copied!`:`Copy PNG — paste into Claude Code, Linear, Slack…`},"aria-label":`Copy capture as PNG`,onClick:()=>void m(e.grabbedAt,e.screenshotDataUrl),get children(){return j(M,{get when(){return f()===e.grabbedAt},get fallback(){return yQ()},get children(){return pQ()}})}})}}),null),P(r,j(kj,{class:`size-7 px-0`,variant:`ghost`,title:`Remove this element`,"aria-label":`Remove element`,onClick:()=>void v(e.grabbedAt),get children(){return mQ()}}),null),P(t,j(M,{get when(){return e.source?.filePath},get children(){var t=hQ();return P(t,()=>e.source.filePath,null),P(t,(()=>{var t=$e(()=>e.source?.lineNumber!=null);return()=>t()?`:${e.source.lineNumber}`:``})(),null),t}}),null),P(t,j(M,{get when(){return e.screenshotDataUrl},get children(){var t=gQ();return D(()=>it(t,`src`,e.screenshotDataUrl)),t}}),null),t})()}),t),P(e,j(M,{get when(){return new Set(r().filter(e=>e.source?.filePath).map(e=>`${e.source.filePath}:${e.source.lineNumber??``}`)).size<r().filter(e=>e.source?.filePath).length},get children(){return rQ()}}),t),P(n,j(kj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,title:`Copy all captures as plain text — paste into a Claude Code session`,onClick:()=>void d(),get children(){var e=iQ();return P(e,()=>l()?`Copied ✓`:`Copy all`),e}}),null),P(n,j(kj,{class:`h-6 shrink-0 px-2 text-[11px]`,variant:`ghost`,onClick:c,children:`Clear all`}),null),e}}),(()=>{var e=oQ(),t=e.firstChild;return P(t,j(kj,{variant:`primary`,class:`min-w-0 flex-1`,onClick:s,children:`Pick element`}),null),P(t,j(M,{when:!xr,get children(){return j(kj,{variant:`ghost`,class:`min-w-0 flex-1`,get loading(){return y()},title:`Drag a rectangle over any part of the page — the shot attaches to the issue`,onClick:()=>void x(),children:`Capture region`})}}),null),P(e,j(M,{get when(){return a()},get children(){return j(Hj,{get message(){return a()}})}}),null),e})()]}}),null),P(e,j(wQ,{title:`Recording`,get badge(){return $e(()=>!!S().result)()?`${(S().result.durationMs/1e3).toFixed(1)}s`:void 0},get children(){return[j(M,{get when(){return S().phase===`idle`||S().phase===`error`},get children(){var e=cQ(),t=e.firstChild;return P(e,j(kj,{variant:`ghost`,onClick:()=>void $D(),get children(){return[sQ(),` Record interaction`]}}),t),P(e,j(M,{get when(){return $e(()=>S().phase===`error`)()&&S().error},get children(){return j(Hj,{get message(){return S().error}})}}),null),e}}),j(M,{get when(){return S().phase===`recording`},get children(){var e=uQ(),t=e.firstChild.nextSibling;return t.nextSibling,P(t,()=>k(w())),P(e,j(kj,{variant:`primary`,class:`ml-auto`,onClick:()=>void eO(),get children(){return lQ()}}),null),e}}),j(M,{get when(){return S().phase===`processing`},get children(){var e=dQ(),t=e.firstChild;return P(e,j(Aj,{}),t),e}}),j(M,{get when(){return $e(()=>S().phase===`ready`)()&&S().result},children:e=>(()=>{var t=SQ(),n=t.firstChild,r=n.nextSibling,a=r.firstChild,o=a.nextSibling,s=o.nextSibling.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,u=c.nextSibling;return P(r,()=>(e().blob.size/1024).toFixed(0),a),P(r,()=>(e().durationMs/1e3).toFixed(1),o),P(r,()=>e().width,s),P(r,()=>e().height,null),l.addEventListener(`change`,e=>nO(e.currentTarget.checked)),P(u,j(kj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return ee()===`busy`},get disabled(){return!i()},get title(){return i()?`Copy markdown — uploads to Linear, copies embeddable link`:`Connect Linear in Settings first`},"aria-label":`Copy markdown`,onClick:()=>void ie(),get children(){return j(M,{get when(){return ee()===`copied`},get fallback(){return CQ()},get children(){return pQ()}})}}),null),P(u,j(kj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return se()===`busy`},title:`Copy GIF — paste into a Linear comment and Linear uploads it`,"aria-label":`Copy GIF`,onClick:()=>void le(),get children(){return j(M,{get when(){return se()===`copied`},get fallback(){return vQ()},get children(){return pQ()}})}}),null),P(u,j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Download GIF`,"aria-label":`Download GIF`,onClick:oe,get children(){return bQ()}}),null),P(u,j(kj,{variant:`danger`,class:`ml-auto size-7 px-0`,title:`Discard recording`,"aria-label":`Discard recording`,onClick:tO,get children(){return xQ()}}),null),P(t,j(M,{get when(){return A()},get children(){return j(Hj,{get message(){return A()}})}}),null),D(()=>it(n,`src`,e().url)),D(()=>l.checked=S().attachOnCreate),t})()})]}}),null),e})()}function EQ(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function DQ(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function OQ(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var kQ=(e,t)=>Math.abs(e-t)<1.01,AQ=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},jQ,MQ=()=>{if(jQ!==void 0)return jQ;if(typeof navigator>`u`)return jQ=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return jQ=!0;let e=navigator.maxTouchPoints;return jQ=navigator.platform===`MacIntel`&&e!==void 0&&e>0},NQ=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},PQ=e=>e,FQ=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},IQ=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(NQ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(NQ(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},LQ={passive:!0},RQ=typeof window>`u`||`onscrollend`in window,zQ=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&RQ,o=0,s=a?null:AQ(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,LQ),a&&r.addEventListener(`scrollend`,u,LQ),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},BQ=(e,t)=>zQ(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),VQ=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},HQ=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},UQ=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:PQ,rangeExtractor:FQ,onChange:()=>{},measureElement:VQ,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=DQ(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!MQ()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,LQ),e.addEventListener(`touchend`,n,LQ),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(MQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=DQ(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=DQ(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=EQ(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=DQ(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=KQ(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=DQ(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=DQ(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return OQ(t[WQ(0,t.length-1,r?e=>n[e*2]:e=>OQ(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(MQ()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&kQ(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},WQ=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function GQ(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function KQ(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=GQ(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=WQ(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}function qQ(e){let t=Ve(e),n=new UQ(t),[r,i]=tr(n.getVirtualItems()),[a,o]=T(n.getTotalSize()),s=new Proxy(n,{get(e,t){switch(t){case`getVirtualItems`:return()=>r;case`getTotalSize`:return()=>a();default:return Reflect.get(e,t)}}});return s.setOptions(t),ie(()=>{let e=s._didMount();s._willUpdate(),ae(e)}),E(()=>{s.setOptions(Ve(t,e,{onChange:(t,n)=>{var r;t._willUpdate(),i(ar(t.getVirtualItems(),{key:`index`})),o(t.getTotalSize()),(r=e.onChange)==null||r.call(e,t,n)}})),s._willUpdate(),i(ar(n.getVirtualItems(),{key:`index`})),o(n.getTotalSize())}),s}function JQ(e){return qQ(Ve({observeElementRect:IQ,observeElementOffset:BQ,scrollToFn:HQ},e))}Br();var YQ=3e4,XQ=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,ZQ={running:[],review:[]},QQ=null,$Q=new Set;function e$(e){return $Q.add(e),QQ||(QQ=setInterval(()=>void r$(),YQ),r$()),()=>{$Q.delete(e),!$Q.size&&QQ&&(clearInterval(QQ),QQ=null)}}function t$(){r$()}function n$(e){return{id:e.id,identifier:e.identifier,title:e.title,stateName:e.state.name,stateColor:e.state.color,delegateName:e.delegate?.displayName??`Agent`,updatedAt:e.updatedAt,prUrl:e.attachments?.find(e=>XQ.test(e.url))?.url}}async function r$(){try{let e=await Tr();if(!e.linearApiKey&&!e.linearAccessToken)return;let t=(await fO()).filter(e=>!!e.delegate&&e.state.type===`started`).map(n$);ZQ={running:t.filter(e=>!e.prUrl),review:t.filter(e=>!!e.prUrl)};for(let e of $Q)e(ZQ)}catch{}}var i$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M2.5 8a5.5 5.5 0 1 1 1.6 3.9"></path><path d="M2.5 12.5V8.9h3.6">`),a$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="m2.5 4 3.5 4-3.5 4M8 12.5h5.5">`),o$=N(`<pre class="font-mono max-h-56 overflow-auto px-2.5 py-2 pr-3 text-[10px] leading-relaxed whitespace-pre-wrap"style=background:#0b0c0e;color:#8b8e98>`),s$=N(`<div class="border-border overflow-clip rounded-lg border"><div class="bg-surface-2 flex h-8 items-center gap-2 pl-2.5 pr-1.5"><span class="text-[11px] font-medium"></span><span class="text-text-faint font-mono text-[10px]"></span><span class=ml-auto>`),c$=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),l$=N(`<p class="text-text-faint px-2.5 py-2 text-[10.5px]">No deployment URL yet — logs appear once Vercel picks up the branch.`);function u$(e){let t=sr(),n=_r(()=>({queryKey:[`stage-status`,e.url,e.base],queryFn:()=>WO(e.url,e.base),refetchInterval:e=>e.state.data?.state===`success`||e.state.data?.state===`failure`||e.state.data?.state===`error`?!1:8e3,retry:0})),r=()=>![`success`,`failure`,`error`].includes(n.data?.state??`pending`),[i,a]=T(!1),o=_r(()=>({queryKey:[`deploy-logs`,n.data?.url??e.url],queryFn:()=>GO(n.data.url),enabled:i()&&!!n.data?.url,refetchInterval:()=>r()?1e4:!1,retry:0})),s,c=!0;O(()=>{o.data?.logs,!(!s||!c)&&requestAnimationFrame(()=>{s&&(s.scrollTop=s.scrollHeight)})});let l=vr(()=>({mutationFn:()=>KO(e.url,e.base),onSuccess:()=>void t.invalidateQueries({queryKey:[`stage-status`,e.url,e.base]})})),u=()=>{let e=n.data?.state;return e===`success`?{label:`Ready`,color:`var(--color-success)`}:e===`failure`||e===`error`?{label:`Failed`,color:`var(--color-danger)`}:e===`none`||e===`unknown`?{label:`Waiting for deploy…`,color:`var(--color-text-dim)`}:{label:`Building…`,color:`var(--color-accent)`}};return(()=>{var t=s$(),d=t.firstChild,f=d.firstChild,p=f.nextSibling;return p.nextSibling,P(d,j(M,{get when(){return r()},get fallback(){return(()=>{var e=c$();return D(t=>dt(e,`background`,u().color)),e})()},get children(){return j(Aj,{size:11})}}),f),P(f,()=>u().label),P(p,()=>e.base,null),P(p,(()=>{var e=$e(()=>!!n.data?.sha);return()=>e()?` @ ${n.data.sha}`:``})(),null),P(d,j(M,{get when(){return $e(()=>n.data?.state===`success`)()&&n.data?.url},get children(){return j(Ij,{get href(){return n.data.url},class:`shrink-0`,title:`Open the staging deployment`,children:`Open`})}}),null),P(d,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get loading(){return l.isPending},get title(){return`Reset ${e.base} — delete + recreate from the default branch (drifted or conflicted staging)`},"aria-label":`Reset staging branch`,onClick:()=>l.mutate(),get children(){return i$()}}),null),P(d,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return i()?`Hide build logs`:`Show build logs (vercel inspect --logs via the bridge)`},get"aria-label"(){return i()?`Hide build logs`:`Show build logs`},onClick:()=>a(e=>!e),get children(){return a$()}}),null),P(t,j(M,{get when(){return i()},get children(){return j(M,{get when(){return n.data?.url},get fallback(){return l$()},get children(){var e=o$();e.addEventListener(`scroll`,()=>{s&&(c=s.scrollTop+s.clientHeight>=s.scrollHeight-40)});var t=s;return typeof t==`function`?pt(t,e):s=e,P(e,j(M,{get when(){return o.data},get fallback(){return j(Aj,{size:12})},get children(){return o.data.logs||`No log output.`}})),e}})}}),null),D(e=>dt(f,`color`,u().color)),t})()}Br();function d$(e,t=6e3){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error(`upload timeout`)),t))])}async function f$(){let e=[],t=[];for(let n of await Dr()??[]){let r=n.source?.filePath?` — \`${n.source.filePath}${n.source.lineNumber==null?``:`:${n.source.lineNumber}`}\``:``;if(e.push(`- \`<${n.componentName??n.tagName??`element`}>\`${r}`),n.screenshotDataUrl)try{let t=await d$(DO(tj(n.screenshotDataUrl),`capture-${n.grabbedAt}.png`),15e3);e.push(` ![capture](${t})`)}catch{t.push(`element screenshot upload failed — the ref line still landed`)}}let n=HD();if(n.result)try{let t=n.result.assetUrl??await d$(DO(n.result.blob,`recording-${Date.now()}.gif`),6e4);rO(t),e.push(`![recording](${t})`)}catch(e){t.push(`recording upload failed (${e instanceof Error?e.message:`error`}) — Copy GIF from the Capture tab and paste it instead`)}return{block:e.length?`Captured context:\n${e.join(`
265
265
  `)}`:null,failed:t}}function p$(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}var m$=/^(https?:\/\/|mailto:)/i,h$=/\.(mp4|mov|webm|m4v)(\?|#|$)/i,g$=/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/i,_$=class extends HTMLElement{objectUrl=null;connectedCallback(){let e=this.getAttribute(`src`)??``,t=this.getAttribute(`alt`)??``;(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(String(n.status));let r=await n.blob();if(this.objectUrl=URL.createObjectURL(r),this.textContent=``,r.type.startsWith(`video/`)){let e=document.createElement(`video`);e.controls=!0,e.preload=`metadata`,e.src=this.objectUrl,this.appendChild(e)}else{let e=document.createElement(`img`);e.src=this.objectUrl,e.alt=t,this.appendChild(e)}}catch{this.textContent=``;let e=document.createElement(`span`);e.textContent=`🖼 ${t||`media`} — start the bridge (npx linear-grab-bridge) to view Linear-hosted media here`,e.style.cssText=`font-size:10.5px;color:var(--color-text-faint);`,this.appendChild(e)}})()}disconnectedCallback(){this.objectUrl&&URL.revokeObjectURL(this.objectUrl)}};typeof customElements<`u`&&!customElements.get(`lg-media`)&&customElements.define(`lg-media`,_$);var v$=null;function y$(e){v$=e?e.replace(/\/$/,``):null}function b$(e){try{if(v$&&new URL(e).hostname.endsWith(`uploads.linear.app`))return`${v$}/fetch?url=${encodeURIComponent(e)}`}catch{}return e}function x$(e){let t=e;return t=t.replace(/`([^`]+)`/g,(e,t)=>`<code>${t}</code>`),t=t.replace(/!\[([^\]]*)\]\((?:&lt;)?([^()\s]+?)(?:&gt;)?\)/g,(e,t,n)=>{if(!m$.test(n))return t;let r=b$(n);return h$.test(n)?`<video controls preload="metadata" src="${r}"></video>`:r!==n&&!g$.test(n)?`<lg-media src="${r}" alt="${t}"></lg-media>`:`<img src="${r}" alt="${t}" loading="lazy" />`}),t=t.replace(/\[([^\]]+)\]\((?:&lt;)?([^()\s]+?)(?:&gt;)?\)/g,(e,t,n)=>m$.test(n)?`<a href="${n}" target="_blank" rel="noopener noreferrer">${t}</a>`:t),t=t.replace(/&lt;(https?:\/\/[^\s&]+)&gt;/g,`<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>`),t=t.replace(/(^|[\s(])((?:https?:\/\/)[^\s<>()"']+)/g,(e,t,n)=>`${t}<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`),t=t.replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`),t=t.replace(/(^|\W)\*([^*\n]+)\*(?=\W|$)/g,`$1<em>$2</em>`),t}function S$(e){let t=p$(e.trim()).split(`
266
266
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r++;continue}if(e.startsWith("```")){let e=[];for(r++;r<t.length&&!t[r].startsWith("```");)e.push(t[r++]);r++,n.push(`<pre><code>${e.join(`
267
- `)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${x$(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${x$(t[r].replace(/^\s*[-*]\s+/,``))}</li>`),r++;n.push(`<ul>${e.join(``)}</ul>`);continue}if(/^\s*\d+[.)]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*\d+[.)]\s+/.test(t[r]);)e.push(`<li>${x$(t[r].replace(/^\s*\d+[.)]\s+/,``))}</li>`),r++;n.push(`<ol>${e.join(``)}</ol>`);continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^(#{1,6}\s|```|\s*[-*]\s+|\s*\d+[.)]\s+)/.test(t[r]);)a.push(t[r]),r++;n.push(`<p>${x$(a.join(`<br />`))}</p>`)}return n.join(``)}Br();var C$=N(`<div class="lg-md text-text text-[12px] leading-relaxed break-words">`),w$=N(`<div class="flex h-full flex-col">`),T$=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),E$=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),D$=N(`<div class="flex-1 overflow-y-auto">`),O$=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),k$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">My issues</span><div class="flex items-center gap-2"></div></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5">`),A$=N(`<button>`),j$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),M$=N(`<button class="w-full cursor-pointer rounded-md px-2 py-1.5 text-left hover:bg-surface-2 transition-colors"><div class="flex items-center gap-1.5 min-w-0"><span class="font-mono text-[11px] text-text-dim shrink-0"></span><span class="truncate text-[12.5px] text-text"></span></div><div class="mt-0.5 flex items-center gap-1.5"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),N$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M10.5 3.5 6 8l4.5 4.5">`),P$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),F$=N(`<span class="truncate text-[12px] font-medium text-text">`),I$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),L$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),R$=N(`<div class="flex flex-col gap-2">`),z$=N(`<div class="flex flex-col gap-1"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Attachments</span><div class="flex flex-col gap-1">`),B$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),V$=N(`<option value=local>Message local Claude Code session`),H$=N(`<option value=new>Start NEW agent (@<!>)`),U$=N(`<option value=comment>Comment only`),W$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),G$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),K$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),q$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),J$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 flex-col gap-1 border-b px-3 py-2"><div class="flex items-center gap-2"></div></div><div class="min-h-0 flex-1 overflow-y-auto pl-3 pr-4 py-3 flex flex-col gap-3"></div><div class="border-border shrink-0 border-t p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-2">`),Y$=N(`<option selected>`),X$=N(`<svg width=10 height=10 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),Z$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),Q$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="m2.5 4 3.5 4-3.5 4M8 12.5h5.5">`),$$=N(`<div class="bg-surface border-border overflow-clip rounded-lg border"><div class="border-border flex h-9 min-w-0 items-center justify-between gap-2 border-b px-3"><div class="flex min-w-0 items-center gap-1.5 text-[11.5px] font-medium"><span aria-hidden class="text-text-dim inline-flex"></span><span class="text-text shrink-0">Local Claude Code</span><span class="text-text-dim shrink-0">started by you</span><span class="text-text-faint shrink-0 tabular-nums">· </span></div></div><div class="flex h-9 items-center gap-1 pr-2"><button class="hover:bg-surface-2 flex h-full min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-3 text-left transition-colors"title="Open the live thread in the Local tab"><span></span><span class="text-text-faint min-w-0 flex-1 truncate text-[11.5px]"></span><svg width=14 height=14 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class="text-text-dim shrink-0"><path d="m6 3.5 4.5 4.5L6 12.5">`),e1=N(`<option>`),t1=N(`<div class="flex flex-col gap-1.5">`),n1=N(`<span class="text-success text-[11px]">✓`),r1=N(`<span class="inline-block min-w-[6ch] text-center">Merge`),i1=N(`<div class="flex min-w-0 items-center gap-1.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11.5px] hover:underline">`),a1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2 14 5.5 8 9 2 5.5 8 2Z"></path><path d="M2 10.5 8 14l6-3.5">`),o1=N(`<div class="flex flex-col gap-0.5"><div class="flex items-center gap-1.5"><span class="text-[11px] font-medium text-text-dim"></span><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),s1=N(`<option>Steer running agent<!> · `),c1=N(`<span class="bg-danger inline-block size-2.5 rounded-full"aria-hidden>`),l1=N(`<span class="text-[11px] text-text-dim">`),u1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=transition-transform><path d="m3.5 6.5 4.5 4 4.5-4">`),d1=N(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),f1=N(`<div class="border-border mt-0.5 flex flex-col gap-1 overflow-y-auto border-t pt-1.5 pl-0.5 pr-3">`),p1=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-1.5 flex-wrap"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),m1=N(`<p class="font-mono text-text-faint text-[10.5px] leading-relaxed break-words">→ <!> `),h1=N(`<div>`);function g1(e){let t=O(()=>S$(e.text));return(()=>{var e=C$();return E(()=>e.innerHTML=t()),e})()}function _1(){let[e,t]=T(null);return D(()=>{let e=ij();e&&(t(e),sj())}),(()=>{var n=w$();return P(n,j(M,{get when(){return e()===null},get fallback(){return j(b1,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return j(v1,{onSelect:e=>t(e)})}})),n})()}function v1(e){let t,n=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:12e3})),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:1e4,retry:0})),i=e=>(r.data??[]).some(t=>t.title.startsWith(e.identifier)),a=e=>e.state.type===`started`&&e.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url)),o=[{id:`all`,label:`All`},{id:`active`,label:`In Progress`},{id:`review`,label:`Review`},{id:`done`,label:`Done`},{id:`cloud`,label:`Cloud`},{id:`local`,label:`Local`}],[s,c]=br(`issues:filter`,`all`),[l,u]=br(`issues:search`,``),d=O(()=>{let e=l().trim().toLowerCase();return(n.data??[]).filter(t=>{if(e&&!`${t.identifier} ${t.title}`.toLowerCase().includes(e))return!1;switch(s()){case`active`:return t.state.type===`started`;case`review`:return!!a(t);case`done`:return t.state.type===`completed`;case`cloud`:return!!t.delegate;case`local`:return i(t);default:return!0}})}),f=JQ({get count(){return d().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var r=k$(),a=r.firstChild,p=a.firstChild.nextSibling,m=a.nextSibling;return P(p,j(M,{get when(){return n.dataUpdatedAt>0},get children(){var e=T$();return e.firstChild,P(e,()=>Wj(n.dataUpdatedAt),null),e}}),null),P(p,j(kj,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return E$()}}),null),P(m,j(We,{each:o,children:e=>(()=>{var t=A$();return t.$$click=()=>c(e.id),P(t,()=>e.label),E(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${s()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(m,j(jj,{class:`ml-auto h-6 w-28 text-[11px]`,placeholder:`Search…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(r,j(M,{get when(){return n.isError},get children(){var e=D$();return P(e,j(Vj,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),P(r,j(M,{get when(){return $e(()=>!n.isError&&!n.isPending)()&&d().length===0},get children(){var e=D$();return P(e,j(Vj,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),P(r,j(M,{get when(){return $e(()=>!n.isError)()&&d().length>0},get children(){var n=O$(),r=n.firstChild,a=t;return typeof a==`function`?pt(a,n):t=n,P(r,j(We,{get each(){return f.getVirtualItems()},children:t=>{let n=O(()=>d()[t.index]);return j(M,{get when(){return n()},get children(){var r=j$();return P(r,j(y1,{get issue(){return n()},get local(){return i(n())},get onSelect(){return e.onSelect}})),E(e=>dt(r,`transform`,`translateY(${t.start}px)`)),r}})}})),E(e=>dt(r,`height`,`${f.getTotalSize()}px`)),n}}),null),r})()}function y1(e){return(()=>{var t=M$(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.firstChild;return t.$$click=()=>e.onSelect(e.issue.id),P(n,j(Bj,{get color(){return e.issue.state.color}}),r),P(r,()=>e.issue.identifier),P(i,()=>e.issue.title),P(a,j(zj,{get children(){return e.issue.state.name}}),o),P(a,j(M,{get when(){return e.issue.delegate},get children(){return j(zj,{class:`text-accent`,get children(){return[j(Pj,{}),` `,$e(()=>e.issue.delegate.displayName)]}})}}),o),P(a,j(M,{get when(){return e.local},get children(){return j(zj,{class:`text-accent`,get children(){return[j(Fj,{}),` local`]}})}}),o),P(a,j(M,{get when(){return $e(()=>!!(e.issue.state.type===`started`&&e.issue.delegate))()&&e.issue.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url))},get children(){return j(zj,{color:`var(--color-warn)`,children:`needs review`})}}),o),P(o,()=>Wj(e.issue.updatedAt)),t})()}function b1(e){let t=sr(),n=_r(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>pO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=_r(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>hO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=_r(()=>({queryKey:[`settings`],queryFn:Tr})),a=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:5e3,retry:0})),o=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}],s=vr(()=>({mutationFn:async t=>{let r=n.data?.attachments.find(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url)),i=r?se.data?.previews[r.url]:void 0,a=[...t.activities].reverse().find(e=>e.content.__typename===`AgentActivityResponseContent`)?.content.body,o=[`✅ **Closeout** (posted from the panel — one-click acceptance)`,``,`**Fix:** ${(t.summary??a??`Fix complete — see the PR.`).slice(0,600)}`,``,...r?[`**PR:** ${r.url}`]:[],...i?[`**Deploy preview:** ${i}`]:[],``,`**DEFINITION OF DONE — acceptance checklist**`,`- [x] PR opened and linked${r?` — ${r.url}`:``}`,i?`- [x] Deploy-preview URL included (above)`:`- [ ] Deploy-preview URL — none found on the PR`,`- [x] Issue moved to review state (this action)`,`- [ ] Demo media on the issue — attach from the PR/agent artifacts if recorded`];await CO(e.issueId,o.join(`
268
- `),t.comment?.id??void 0);let s=n.data?.team?.id;if(s){let t=await vO(s),n=t.find(e=>e.type===`started`&&/review/i.test(e.name))??t.filter(e=>e.type===`completed`).sort((e,t)=>e.position-t.position)[0];n&&await yO(e.issueId,n.id)}},onSuccess:()=>{t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`sessions`,e.issueId]})}})),c=vr(()=>({mutationFn:e=>LO(e.id,e.model),onSuccess:e=>{t.setQueryData([`bridge-tasks`],t=>t?.map(t=>t.id===e.id?e:t))}})),l=vr(()=>({mutationFn:e=>IO(e,`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`),onSuccess:()=>void t.invalidateQueries({queryKey:[`bridge-tasks`]})})),u=vr(()=>({mutationFn:e=>RO(e),onSuccess:()=>void t.invalidateQueries({queryKey:[`bridge-tasks`]})})),[d,f]=T(!1),p=async e=>{try{await navigator.clipboard.writeText(YO(e)),f(!0),setTimeout(()=>f(!1),1800)}catch{}},m=O(()=>{let e=n.data?.identifier;return e?a.data?.find(t=>t.title.startsWith(e)):void 0}),h=e=>e.status===`running`?{word:`Working…`,cls:`text-accent`}:e.status===`done`?{word:`Finished`,cls:`text-success`}:e.status===`stopped`?{word:`Stopped`,cls:`text-warn`}:{word:`Error`,cls:`text-danger`},[g,_]=br(`activity-reply:${e.issueId}`,``),[v,y]=T(null),[b,x]=T(0),S=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:cj()===`composer`})),[C,w]=T(!1),ee=async()=>{w(!0),y(null);try{let{block:e,failed:t}=await f$();e?_(t=>`${t?`${t}\n`:``}${e}\n`):t.length||y(`Nothing captured yet — pick an element, capture a region, or record first.`),t.length&&y(t.join(` · `))}catch(e){y(e instanceof Error?e.message:`Attach failed.`)}finally{w(!1)}},te=()=>{if(cj()===`composer`){uj(`capture`);return}x(Date.now()),uj(`composer`),YZ().catch(()=>uj(`capture`))};D(()=>{if(cj()!==`composer`)return;let e=(S.data??[]).filter(e=>e.grabbedAt>b());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
269
- `);_(e=>`${e?`${e}\n`:``}${t}\n`),x(Math.max(...e.map(e=>e.grabbedAt)))});let[k,A]=T(HD());ae(UD(A));let ne=!1;D(()=>{k().phase===`ready`&&ne&&(ne=!1,ee())});let re=()=>{k().phase===`recording`?eO():(ne=!0,$D())},ie=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,oe=O(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>ie.test(e))),se=_r(()=>({queryKey:[`pr-status`,oe().sort().join(`|`)],queryFn:()=>HO(oe()),refetchInterval:3e4,retry:0,enabled:oe().length>0})),ce=e=>_e().has(e)?`MERGED`:se.data?.statuses[e],[le,ue]=T(null),de=()=>i.data?.stagingBranch?.trim()||`staging`,[fe,pe]=T(null),[me,he]=T(new Set),ge=async e=>{pe(e);try{await UO(e,de()),he(t=>new Set(t).add(e))}catch{}finally{pe(null)}},[_e,ve]=T(new Set),[ye,be]=T(null),xe=async n=>{be(null),ue(n);try{await qO(n),ve(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),t$()}catch(e){be(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{ue(null)}},Se=O(()=>{let e=n.data?TO(n.data.comments):[],t=new Set(e.map(e=>e.id));return[...(r.data??[]).filter(e=>e.comment?.id&&!t.has(e.comment.id)).map(e=>({id:e.comment.id,createdAt:e.updatedAt,body:``,user:{displayName:e.appUser?.displayName??`agent`,app:!0},parent:null})),...e]}),[Ce,we]=T(`comment`),Te=!1,Ee=!1;D(()=>{if(Ee||!n.data||!i.data)return;Ee=!0;let e=Se();e.length?we(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&we(`new`)}),D(()=>{Te||m()&&(Ce()===`comment`||Ce()===`new`)&&we(`local`)}),D(()=>{if(Te)return;let e=Se();e.length&&(Ce()===`comment`||Ce()===`new`)&&we(`thread:${e[0].id}`)});let De=vr(()=>({mutationFn:async()=>{let t=g().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=Ce();if(r===`local`){let n=m();if(!n)throw Error(`Local session not found — is the bridge running?`);await IO(n.id,t),await CO(e.issueId,`🖥️ **→ local agent:** ${t}`).catch(()=>{})}else r.startsWith(`thread:`)?await CO(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await wO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await CO(e.issueId,t)},onSuccess:()=>{_(``),y(null),uj(`capture`),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t$()},onError:e=>{y(e.message??`Failed to send`)}})),Oe=O(()=>n.data),ke=O(()=>r.data??[]);return(()=>{var t=J$(),r=t.firstChild,a=r.firstChild,f=r.nextSibling,y=f.nextSibling,b=y.firstChild;return P(a,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Back to issues`,"aria-label":`Back to issues`,"data-tip-pos":`right bottom`,get onClick(){return e.onBack},get children(){return N$()}}),null),P(a,j(M,{get when(){return Oe()},get children(){return[(()=>{var e=P$();return P(e,()=>Oe().identifier),e})(),(()=>{var e=F$();return P(e,()=>Oe().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!Oe()},get children(){return I$()}}),null),P(r,j(M,{get when(){return Oe()},get children(){var e=L$(),t=e.firstChild;return P(e,j(Bj,{get color(){return Oe().state.color}}),t),P(t,()=>Oe().state.name),P(e,j(Ij,{get href(){return Oe().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(f,j(M,{get when(){return m()},children:e=>{let t=()=>h(e());return(()=>{var n=$$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var s=r.nextSibling,f=s.firstChild,m=f.firstChild,h=m.nextSibling;return P(i,j(Fj,{size:12})),P(a,()=>Wj(e().startedAt),null),P(r,j(Nj,{class:`h-6 w-auto max-w-[110px] shrink-0 text-[10.5px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>c.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:o,children:t=>(()=>{var n=e1();return P(n,()=>t.label),E(()=>n.selected=(e().pendingModel??e().model??``)===t.id),E(()=>n.value=t.id),n})()}),j(M,{get when(){return!o.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=Y$();return P(t,()=>e().pendingModel??e().model),E(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),f.$$click=()=>oj(`local`),P(f,j(M,{get when(){return e().status===`running`},get children(){return j(Aj,{size:12})}}),m),P(m,()=>t().word),P(h,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),P(s,j(M,{get when(){return e().status===`running`},get children(){return j(kj,{variant:`danger`,class:`size-6 shrink-0 px-0`,get loading(){return u.isPending},title:`Stop the session — resumable afterwards`,"aria-label":`Stop session`,onClick:()=>u.mutate(e().id),get children(){return X$()}})}}),null),P(s,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get loading(){return l.isPending},get title(){return`Run again — resumes this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>l.mutate(e().id),get children(){return Z$()}})}}),null),P(s,j(M,{get when(){return e().sessionId},get children(){return j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return d()?`Copied!`:`Copy terminal resume command (claude --resume …)`},"aria-label":`Copy resume command`,onClick:()=>void p(e()),get children(){return Q$()}})}}),null),E(()=>st(m,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(f,j(M,{get when(){return ke().length>0},get children(){var e=R$();return P(e,j(We,{get each(){return ke()},children:e=>(()=>{var t=t1();return P(t,j(x1,{session:e}),null),P(t,j(M,{get when(){return $e(()=>!!(/complete/i.test(e.status)&&n.data?.state.type===`started`))()&&!/review/i.test(n.data?.state.name??``)},get children(){return j(kj,{variant:`primary`,class:`self-start`,get loading(){return s.isPending},title:`Post the acceptance comment (fix summary, PR, preview, checklist) in the agent thread and move the issue to review`,onClick:()=>s.mutate(e),children:`Post closeout to Linear`})}}),null),t})()})),e}}),null),P(f,j(M,{get when(){return $e(()=>!!Oe())()&&Oe().attachments.length>0},get children(){var e=z$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return Oe().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return[(()=>{var n=i1(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return t&&se.data?.previews[e.url]},get children(){return j(Ij,{get href(){return se.data.previews[e.url]},class:`shrink-0`,title:`Vercel deploy preview of this PR's branch`,children:`Preview`})}}),null),P(n,j(M,{get when(){return $e(()=>!!(t&&ce(e.url)))()&&ce(e.url)!==`OPEN`},get children(){return j(zj,{get class(){return`ml-auto shrink-0 ${ce(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return ce(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!ce(e.url)||ce(e.url)===`OPEN`)},get children(){return[j(kj,{variant:`ghost`,class:`ml-auto size-6 shrink-0 px-0`,get loading(){return fe()===e.url},get disabled(){return me().has(e.url)},get title(){return $e(()=>!!me().has(e.url))()?`On ${de()} — staging preview deploying`:`Merge into ${de()} — deploys the staging preview domain`},"aria-label":`Merge to staging`,onClick:()=>void ge(e.url),get children(){return j(M,{get when(){return me().has(e.url)},get fallback(){return a1()},get children(){return n1()}})}}),j(kj,{variant:`primary`,class:`h-6 shrink-0 px-2 text-[11px]`,get loading(){return le()===e.url},get title(){return se.isError?`PR state unknown — restart the bridge (npx linear-grab-bridge) for live merge status`:`Squash-merge this PR via the bridge gh — reviewed the demo? Ship it.`},onClick:()=>void xe(e.url),get children(){return r1()}})]}}),null),E(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),n})(),j(M,{get when(){return me().has(e.url)},get children(){return j(u$,{get url(){return e.url},get base(){return de()}})}})]}}),null),P(t,j(M,{get when(){return ye()},get children(){return j(Hj,{get message(){return ye()}})}}),null),e}}),null),P(f,j(M,{get when(){return $e(()=>!!Oe())()&&Oe().comments.length>0},get children(){var e=B$();return e.firstChild,P(e,j(Ge,{get each(){return Oe().comments},children:e=>{let t=e();return(()=>{var e=o1(),n=e.firstChild,r=n.firstChild,i=r.nextSibling;return P(r,()=>t.user?.displayName??t.user?.name??`Unknown`),P(n,j(M,{get when(){return t.user?.app},get children(){return j(zj,{children:`agent`})}}),i),P(i,()=>Wj(t.createdAt)),P(e,j(g1,{get text(){return t.body}}),null),e})()}}),null),e}}),null),P(f,j(M,{get when(){return $e(()=>!!(Oe()&&Oe().comments.length===0))()&&ke().length===0},get children(){return j(Vj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(f,j(M,{get when(){return $e(()=>!!n.isError)()&&!Oe()},get children(){return j(Vj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(y,j(M,{get when(){return v()},get children(){return j(Hj,{get message(){return v()}})}}),b),P(y,j(Mj,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return g()},onInput:e=>_(e.target.value),get disabled(){return De.isPending}}),b),P(b,j(Nj,{class:`min-w-0 flex-1`,get value(){return Ce()},onChange:e=>{Te=!0,we(e.currentTarget.value)},get children(){return[j(M,{get when(){return m()},get children(){var e=V$();return E(()=>e.selected=Ce()===`local`),e}}),j(We,{get each(){return Se()},children:(e,t)=>(()=>{var n=s1(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>Se().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Wj(e.createdAt),null),E(()=>n.selected=Ce()===`thread:${e.id}`),E(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=H$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),E(()=>e.selected=Ce()===`new`),e}}),(()=>{var e=U$();return E(()=>e.selected=Ce()===`comment`),e})()]}}),null),P(b,j(kj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${cj()===`composer`?`text-accent`:``}`},get title(){return cj()===`composer`?`Pick mode ON — every pick appends here. Click to stop.`:`Pick elements — refs append to this reply (stays on until toggled off or sent)`},"aria-label":`Pick element for reply`,onClick:te,get children(){return W$()}}),null),P(b,j(kj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${k().phase===`recording`?`text-danger`:``}`},get title(){return k().phase===`recording`?`Stop recording — the GIF auto-attaches to this reply`:`Record a GIF from this thread (auto-attaches when done)`},"aria-label":`Record GIF`,onClick:re,get children(){return j(M,{get when(){return k().phase===`recording`},get fallback(){return c1()},get children(){return G$()}})}}),null),P(b,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return C()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void ee(),get children(){return K$()}}),null),P(b,j(kj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return De.isPending},get disabled(){return g().trim().length===0},onClick:()=>De.mutate(),get children(){return q$()}}),null),t})()}function x1(e){let t=O(()=>{let t=e.session.status;return/complete|done/i.test(t)?`var(--color-success)`:/await|pending|elicit/i.test(t)?`var(--color-warn)`:`var(--color-accent)`}),n=O(()=>{let t=e.session.status;return/active/i.test(t)?`Working…`:/awaitingInput|elicit/i.test(t)?`Needs input`:/complete/i.test(t)?`Complete`:/error/i.test(t)?`Error`:/pending/i.test(t)?`Queued`:t}),r=O(()=>e.session.activities.filter(e=>e.content?.body||e.content?.action).slice(-15)),[i,a]=T(!1),o,s=!0,c=()=>{o&&(s=o.scrollTop+o.clientHeight>=o.scrollHeight-40)};return D(()=>{let e=r().length;!o||!e||!s||requestAnimationFrame(()=>{o&&(o.scrollTop=o.scrollHeight)})}),(()=>{var s=p1(),l=s.firstChild,u=l.firstChild;return P(l,j(M,{get when(){return/active|pending/i.test(e.session.status)},get children(){return j(Aj,{size:12})}}),u),P(l,j(zj,{get color(){return t()},get children(){return n()}}),u),P(l,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=l1();return P(t,()=>e.session.appUser.displayName),t}}),u),P(u,()=>Wj(e.session.updatedAt)),P(l,j(M,{get when(){return e.session.externalLinks?.[0]},children:e=>j(Ij,{get href(){return e().url},class:`shrink-0`,title:`Open this run on the agent's site`,get children(){return e().label||`Cursor`}})}),null),P(l,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return i()?`Collapse to a window`:`Expand — show the whole session feed`},get"aria-label"(){return i()?`Collapse feed`:`Expand feed`},onClick:()=>a(e=>!e),get children(){var e=u1();return E(t=>dt(e,`transform`,i()?`rotate(180deg)`:`none`)),e}}),null),P(s,j(M,{get when(){return e.session.summary},get children(){var t=d1();return P(t,()=>e.session.summary),t}}),null),P(s,j(M,{get when(){return r().length>0},get children(){var e=f1();e.addEventListener(`scroll`,c);var t=o;return typeof t==`function`?pt(t,e):o=e,P(e,j(Ge,{get each(){return r()},children:e=>j(M,{get when(){return e().content.action},get fallback(){return(()=>{var t=h1();return P(t,j(g1,{get text(){return e().content.body??``}})),E(()=>st(t,`lg-md text-[11.5px] leading-relaxed break-words ${e().content.__typename===`AgentActivityErrorContent`?`text-danger`:`text-text`}`)),t})()},get children(){var t=m1(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>e().content.action,n),P(t,()=>e().content.parameter,null),t}})})),E(()=>e.classList.toggle(`max-h-64`,!i())),e}}),null),s})()}rt([`click`]);var S1=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),C1=N(`<div class="flex flex-col gap-1.5">`),w1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text inline-flex items-center gap-1.5 text-[12px] font-semibold"> Cloud agents</span><span class="text-text-faint text-[10.5px] tabular-nums"> working · updated </span></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5"></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),T1=N(`<button>`),E1=N(`<div class="grid place-items-center py-10">`),D1=N(`<button class="flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left"title="View the thread here"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text hover:text-accent min-w-0 truncate text-[12.5px] font-medium transition-colors">`),O1=N(`<p class="text-text-dim line-clamp-2 cursor-pointer text-[11.5px] leading-snug break-words">`),k1=N(`<span class="text-text-dim text-[11px]">`),A1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),j1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 items-center gap-1.5"><span class=ml-auto>`),M1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),N1=N(`<span class="text-text-dim text-[12.5px]">Conversation session`);function P1(){let e=_r(()=>({queryKey:[`cloud-sessions`],queryFn:gO,refetchInterval:12e3})),t=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`input`,label:`Needs input`},{id:`done`,label:`Done`}],[n,r]=br(`cloud:filter`,`all`),i=O(()=>(e.data??[]).filter(e=>{switch(n()){case`working`:return/active|pending/i.test(e.status);case`input`:return/awaitingInput|elicit/i.test(e.status);case`done`:return/complete/i.test(e.status);default:return!0}})),a=e=>/active/i.test(e)?{word:`Working…`,color:`var(--color-accent)`}:/awaitingInput|elicit/i.test(e)?{word:`Needs input`,color:`var(--color-warn)`}:/complete/i.test(e)?{word:`Complete`,color:`var(--color-success)`}:/error/i.test(e)?{word:`Error`,color:`var(--color-danger)`}:{word:e,color:`var(--color-text-dim)`},o=e=>{let t=[...e.activities].reverse().find(e=>e.content?.body||e.content?.action);return t?t.content.action?`→ ${t.content.action} ${t.content.parameter??``}`:t.content.body??``:e.summary??``},s=O(()=>(e.data??[]).filter(e=>/active|pending/i.test(e.status)).length),[c,l]=T(null);return j(M,{get when(){return!c()},get fallback(){return j(b1,{get issueId(){return c()},onBack:()=>l(null)})},get children(){var c=w1(),u=c.firstChild,d=u.firstChild,f=d.firstChild,p=d.nextSibling,m=p.firstChild,h=u.nextSibling,g=h.nextSibling;return P(d,j(Pj,{size:13}),f),P(p,s,m),P(p,()=>Wj(e.dataUpdatedAt||Date.now()),null),P(h,j(We,{each:t,children:e=>(()=>{var t=T1();return t.$$click=()=>r(e.id),P(t,()=>e.label),E(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${n()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(h,j(kj,{class:`ml-auto size-6 px-0`,get loading(){return e.isFetching},title:`Refresh`,"aria-label":`Refresh sessions`,onClick:()=>void e.refetch(),get children(){return S1()}}),null),P(g,j(M,{get when(){return i().length>0},get fallback(){return j(M,{get when(){return!e.isPending},get fallback(){return(()=>{var e=E1();return P(e,j(Aj,{})),e})()},get children(){return j(Vj,{title:`No cloud agent sessions`,children:`Delegate an issue to Cursor from the Draft tab and its live session appears here.`})}})},get children(){var e=C1();return P(e,j(Ge,{get each(){return i()},children:e=>(()=>{var t=j1(),n=t.firstChild,r=n.firstChild,i=n.nextSibling,s=i.firstChild;return P(n,j(M,{get when(){return/active|pending/i.test(e().status)},get fallback(){return(()=>{var t=M1();return E(n=>dt(t,`background`,a(e().status).color)),t})()},get children(){return j(Aj,{})}}),r),P(n,j(M,{get when(){return e().issue},get fallback(){return N1()},get children(){var t=D1(),n=t.firstChild,r=n.nextSibling;return t.$$click=()=>l(e().issue.id),P(n,()=>e().issue.identifier),P(r,()=>e().issue.title),t}}),r),P(r,()=>Wj(e().updatedAt)),P(t,j(M,{get when(){return o(e())},get children(){var t=O1();return t.$$click=()=>e().issue&&l(e().issue.id),P(t,()=>o(e())),t}}),i),P(i,j(zj,{get color(){return a(e().status).color},get children(){return a(e().status).word}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(Bj,{get color(){return e().issue.state.color}}),(()=>{var t=k1();return P(t,()=>e().issue.state.name),t})()]}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,title:`Open the thread — steer this agent`,"aria-label":`Open thread`,onClick:()=>l(e().issue.id),get children(){return A1()}}),j(Ij,{get href(){return e().issue.url},class:`shrink-0`,children:`Linear`})]}}),null),t})()})),e}})),c}})}rt([`click`]);var F1=N(`<div class="flex flex-col gap-1.5">`),I1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Running now</span><span class="text-text-faint text-[10.5px] tabular-nums"> agent<!> active</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),L1=N(`<span class="font-mono text-text-dim shrink-0 text-[11px]">`),R1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),z1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><button class="flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left"><span class="text-text hover:text-accent min-w-0 truncate text-[12.5px] font-medium transition-colors"></span></button><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim line-clamp-2 text-[11.5px] leading-snug break-words"></p><div class="flex min-w-0 items-center gap-1.5"><span class=ml-auto>`);function B1(){let e=_r(()=>({queryKey:[`cloud-sessions`],queryFn:gO,refetchInterval:12e3})),t=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:3e4})),r=O(()=>{let r=(e.data??[]).filter(e=>/active|pending|awaitingInput|elicit/i.test(e.status)).map(e=>({kind:`cloud`,at:Date.parse(e.updatedAt),session:e})),i=(t.data??[]).filter(e=>e.status===`running`).map(e=>({kind:`local`,at:e.startedAt,task:e,issueId:(n.data??[]).find(t=>e.title.startsWith(t.identifier))?.id}));return[...r,...i].sort((e,t)=>t.at-e.at)}),[i,a]=T(null),o=e=>/awaitingInput|elicit/i.test(e)?{word:`Needs input`,color:`var(--color-warn)`}:{word:`Working…`,color:`var(--color-accent)`},s=e=>{let t=[...e.activities].reverse().find(e=>e.content?.body||e.content?.action);return t?t.content.action?`→ ${t.content.action} ${t.content.parameter??``}`:t.content.body??``:e.summary??``};return j(M,{get when(){return!i()},get fallback(){return j(b1,{get issueId(){return i()},onBack:()=>a(null)})},get children(){var e=I1(),t=e.firstChild,n=t.firstChild.nextSibling,i=n.firstChild,c=i.nextSibling;c.nextSibling;var l=t.nextSibling;return P(n,()=>r().length,i),P(n,()=>r().length===1?``:`s`,c),P(l,j(M,{get when(){return r().length>0},get fallback(){return j(Vj,{title:`Nothing running`,children:`Delegate an issue from the Draft tab — cloud (Cursor) and local (Claude Code) agents working right now appear here together.`})},get children(){var e=F1();return P(e,j(Ge,{get each(){return r()},children:e=>(()=>{var t=z1(),n=t.firstChild,r=n.firstChild,i=r.firstChild,c=r.nextSibling,l=n.nextSibling,u=l.nextSibling,d=u.firstChild;return P(n,j(Aj,{size:12}),r),P(n,j(zj,{get title(){return e().kind===`cloud`?`Cursor cloud agent`:`Local Claude Code`},get children(){return[$e(()=>$e(()=>e().kind===`cloud`)()?j(Pj,{}):j(Fj,{})),$e(()=>e().kind===`cloud`?`cloud`:`local`)]}}),r),r.$$click=()=>{let t=e();t.kind===`cloud`&&t.session.issue?a(t.session.issue.id):t.kind===`local`&&oj(`local`)},P(r,j(M,{get when(){return e().kind===`cloud`},get children(){var t=L1();return P(t,()=>e().session.issue?.identifier),t}}),i),P(i,(()=>{var t=$e(()=>e().kind===`cloud`);return()=>t()?e().session.issue?.title??`Conversation session`:e().task.title})()),P(c,()=>Wj(e().at)),P(l,(()=>{var t=$e(()=>e().kind===`cloud`);return()=>t()?s(e().session):e().task.lastText})()),P(u,j(M,{get when(){return e().kind===`cloud`},get fallback(){return j(zj,{color:`var(--color-accent)`,children:`Working…`})},get children(){return j(zj,{get color(){return o(e().session.status).color},get children(){return o(e().session.status).word}})}}),d),P(u,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return e().kind===`cloud`?`Open the thread — steer this agent`:`Open the live session in the Local tab`},"aria-label":`Open thread`,onClick:()=>{let t=e();t.kind===`cloud`&&t.session.issue?a(t.session.issue.id):t.kind===`local`&&oj(`local`)},get children(){return R1()}}),null),E(()=>it(r,`title`,e().kind===`cloud`?`View the thread here`:`Open the Local tab`)),t})()})),e}})),e}})}rt([`click`]),Br();var V1=N(`<div class="border-accent/40 bg-accent-soft self-end rounded-lg border px-2.5 py-1.5"><p class="text-accent mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase">You</p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),H1=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),U1=N(`<p>`),W1=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running<!> · `),G1=N(`<div class="flex flex-col gap-1.5">`),K1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Local Claude Code</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),q1=N(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-[11px] select-all">npx linear-grab-bridge`),J1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),Y1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),X1=N(`<option selected>`),Z1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),Q1=N(`<span class="text-success text-[12px] leading-none">✓`),$1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><path d="M14 10a2 2 0 0 1-2 2H6l-3.5 2.5V4a2 2 0 0 1 2-2H12a2 2 0 0 1 2 2v6Z">`),e0=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),t0=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),n0=N(`<div class="border-border bg-bg flex flex-col gap-1 rounded-md border p-2"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-dim text-[10.5px] font-semibold tracking-wide uppercase">Changes</span><span class="ml-auto shrink-0 text-[10.5px] tabular-nums"><span class=text-success>+</span> <span class=text-danger>−`),r0=N(`<div class="border-border bg-bg flex max-h-80 flex-col gap-1.5 overflow-y-auto rounded-md border py-2 pl-2 pr-3">`),i0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),a0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),o0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M8 2v4M8 10v4M2 8h4M10 8h4M4.5 4.5 6 6M11.5 11.5 10 10M11.5 4.5 10 6M4.5 11.5 6 10">`),s0=N(`<span class="inline-block min-w-[4ch] text-center">Send`),c0=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center gap-1"><span class="text-text-faint min-w-0 flex-1 truncate text-[10.5px]">`),l0=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text min-w-0 truncate text-[12.5px] font-medium"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim text-[11.5px] leading-snug break-words"></p><div class="flex flex-wrap items-center gap-1.5"></div><div class="flex items-center gap-1">`),u0=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),d0=N(`<div class="flex min-w-0 items-center gap-1.5">`),f0=N(`<option>`),p0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),m0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M2.5 3.5 6 7 2.5 10.5M7.5 12.5h6">`),h0=N(`<span class=text-success>+`),g0=N(`<span class=text-danger>−`),_0=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="shrink-0 text-[10px] tabular-nums">`),v0=N(`<span class=text-text-faint>bin`),y0=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="text-success shrink-0 text-[10px]">new`),b0=N(`<div class="flex min-w-0 items-center gap-1.5 pt-0.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),x0=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),S0=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}];function C0(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)<(r[e]??0);return!1}var w0=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function T0(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:MO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:fO,staleTime:15e3})),o=e=>{let t=e.title.match(/^([A-Z][A-Z0-9]*-\d+)/)?.[1];return t?a.data?.find(e=>e.identifier===t):void 0},s=_r(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>PO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>BO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>RO(e),onSuccess:l})),[d,f]=br(`local:message`,``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:cj()===`local`})),v=()=>{g(Date.now()),uj(`local`),YZ().catch(()=>uj(`capture`))};D(()=>{if(cj()!==`local`)return;let e=(_.data??[]).filter(e=>e.grabbedAt>=h());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
270
- `);f(e=>`${e?`${e}\n`:``}${t}\n`),uj(`capture`)});let y=async()=>{m(!0);try{let{block:e,failed:t}=await f$();e&&f(t=>`${t?`${t}\n`:``}${e}\n`),t.length&&f(e=>`${e}\n<!-- upload issues: ${t.join(` · `)} -->\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>IO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>LO(e.id,e.model),onSuccess:t=>{e.setQueryData([`bridge-tasks`],e=>e?.map(e=>e.id===t.id?t:e)),l()}})),S=vr(()=>({mutationFn:e=>zO(e),onSuccess:l})),C,w=!0,ee=()=>{C&&(w=C.scrollTop+C.clientHeight>=C.scrollHeight-48)};D(()=>{let e=s.data?.tail?.length??0;r(),!(!C||!e||!w)&&requestAnimationFrame(()=>{C&&(C.scrollTop=C.scrollHeight)})});let[te,k]=T(null),A=async e=>{try{await navigator.clipboard.writeText(YO(e)),k(e.id),setTimeout(()=>k(null),1800)}catch{}},ne=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`,re=e=>{let t=e.line.kind,n=O(()=>S$(e.line.text));return t===`user`?(()=>{var e=V1(),t=e.firstChild.nextSibling;return E(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=H1(),r=e.firstChild,i=r.nextSibling;return st(e,`bg-surface rounded-lg border px-2.5 py-1.5 ${t===`result`?`border-success/40`:`border-border`}`),st(r,`mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase ${t===`result`?`text-success`:`text-text-faint`}`),P(r,t===`result`?`Result`:`Claude`),E(()=>i.innerHTML=n()),e})():(()=>{var n=U1();return st(n,`font-mono px-1 text-[10px] leading-relaxed break-words ${t===`subagent`?`text-warn`:t===`stderr`?`text-danger`:`text-text-faint`}`),P(n,()=>e.line.text),n})()};return(()=>{var e=K1(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(zj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return C0(t.data.version,`0.15.1`)},get children(){return j(zj,{class:`text-warn`,title:`Ctrl+C the old process, then: npx linear-grab-bridge`,get children(){return[`v`,$e(()=>t.data.version),` outdated — restart`]}})}}),(()=>{var e=W1(),r=e.firstChild,i=r.nextSibling;return i.nextSibling,P(e,()=>t.data.active,r),P(e,()=>{let e=(n.data??[]).reduce((e,t)=>e+(t.usage?.costUsd??0),0);return e>0?` · Σ $${e.toFixed(2)}`:``},i),P(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),E(()=>it(e,`title`,t.data?.cwd)),e})()]}}),null),P(l,j(M,{get when(){return t.data?.ok},get fallback(){return j(Vj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,q1(),`Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. Sessions stay interactive — send follow-ups, switch models, interrupt, resume in your terminal. History persists across restarts.`]}})},get children(){return j(M,{get when(){return(n.data??[]).length>0},get fallback(){return j(Vj,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status and a conversation view.`})},get children(){var e=G1();return P(e,j(Ge,{get each(){return n.data},children:e=>(()=>{var t=l0(),n=t.firstChild,a=n.firstChild,l=a.nextSibling,m=n.nextSibling,h=m.nextSibling,g=h.nextSibling;return P(n,j(M,{get when(){return e().status===`running`},get fallback(){return(()=>{var t=u0();return E(n=>dt(t,`background`,ne(e().status))),t})()},get children(){return j(Aj,{})}}),a),P(a,()=>e().title),P(l,()=>Wj(e().startedAt)),P(m,()=>e().lastText),P(h,j(zj,{get color(){return ne(e().status)},get children(){return e().status}}),null),P(h,j(zj,{get children(){return e().model??`default model`}}),null),P(h,j(M,{get when(){return e().pendingModel},get children(){return j(zj,{class:`text-warn`,get children(){return[`→ `,$e(()=>e().pendingModel),` next msg`]}})}}),null),P(h,j(M,{get when(){return e().subagents>0},get children(){return j(zj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e().subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e().usage},get children(){var t=J1(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>w0(e().usage.contextTokens),n),P(t,()=>w0(e().usage.outputTokens),null),P(t,(()=>{var t=$e(()=>!!e().usage.costUsd);return()=>t()?` · $${e().usage.costUsd.toFixed(2)}`:``})(),null),t}}),null),P(t,j(M,{get when(){return o(e())},children:e=>(()=>{var t=d0();return P(t,j(zj,{get children(){return e().state.name}}),null),P(t,j(Ij,{get href(){return e().url},children:`Open in Linear`}),null),t})()}),g),P(t,j(M,{get when(){return $e(()=>!!e().worktree)()&&!e().worktree.removed},get children(){var t=Y1(),n=t.firstChild;return P(t,j(zj,{class:`text-warn`,children:`⎇ worktree`}),n),P(n,()=>e().worktree.branch),P(t,j(M,{get when(){return e().status!==`running`},get children(){return j(kj,{variant:`ghost`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return S.isPending},get title(){return`Remove the worktree at ${e().worktree.path} — the branch (and PR) survive`},onClick:()=>S.mutate(e().id),children:`Remove`})}}),null),E(()=>it(n,`title`,e().worktree.path)),t}}),g),P(g,j(Nj,{class:`h-7 w-auto min-w-0 flex-1 text-[11px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>x.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:S0,children:t=>(()=>{var n=f0();return P(n,()=>t.label),E(()=>n.selected=(e().pendingModel??e().model??``)===t.id),E(()=>n.value=t.id),n})()}),j(M,{get when(){return!S0.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=X1();return P(t,()=>e().pendingModel??e().model),E(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),P(g,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(kj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return b.isPending},get title(){return`Resume — continues this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>b.mutate({id:e().id,text:`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`}),get children(){return Z1()}})}}),null),P(g,j(M,{get when(){return o(e())},children:e=>j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>oj(`activity`,e().id),get children(){return p0()}})}),null),P(g,j(kj,{variant:`ghost`,class:`size-7 px-0`,get disabled(){return!e().sessionId},get title(){return $e(()=>!!e().sessionId)()?`Copy resume command · session ${e().sessionId.slice(0,8)}…`:`No session yet`},onClick:()=>void A(e()),get children(){return j(M,{get when(){return te()===e().id},get fallback(){return m0()},get children(){return Q1()}})}}),null),P(g,j(kj,{variant:`ghost`,class:`size-7 px-0`,get title(){return r()===e().id?`Hide thread`:`Open thread — chat & changes`},onClick:()=>i(r()===e().id?null:e().id),get children(){return $1()}}),null),P(g,j(M,{get when(){return e().status===`running`},get children(){return j(kj,{variant:`danger`,class:`size-7 px-0`,get loading(){return u.isPending},title:`Interrupt — the session stays resumable`,onClick:()=>u.mutate(e().id),get children(){return e0()}})}}),null),P(t,j(M,{get when(){return r()===e().id},get children(){return[j(M,{get when(){return $e(()=>!!c.data)()&&(c.data.files.length||c.data.untracked.length||c.data.prs.length)},get children(){var e=n0(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.firstChild;r.firstChild;var i=r.nextSibling.nextSibling;return i.firstChild,P(t,j(M,{get when(){return c.data.branch},get children(){var e=t0();return P(e,()=>c.data.branch),e}}),n),P(r,()=>c.data.totalAdded,null),P(i,()=>c.data.totalDeleted,null),P(e,j(We,{get each(){return c.data.files},children:e=>(()=>{var t=_0(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return v0()},get children(){return[(()=>{var t=h0();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=g0();return t.firstChild,P(t,()=>e.deleted,null),t})()]}})),E(()=>it(n,`title`,e.path)),t})()}),null),P(e,j(We,{get each(){return c.data.untracked},children:e=>(()=>{var t=y0(),n=t.firstChild;return it(n,`title`,e),P(n,e),t})()}),null),P(e,j(We,{get each(){return c.data.prs},children:e=>(()=>{var t=b0(),n=t.firstChild;return P(t,j(zj,{class:`text-accent`,get children(){return[`PR · `,$e(()=>e.state.toLowerCase())]}}),n),P(n,()=>e.title),E(t=>{var r=e.url,i=e.title;return r!==t.e&&it(n,`href`,t.e=r),i!==t.t&&it(n,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),(()=>{var e=r0();return e.addEventListener(`scroll`,ee),pt(e=>{C=e,w=!0},e),P(e,j(M,{get when(){return(s.data?.tail??[]).length>0},get fallback(){return x0()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=c0(),n=t.firstChild,r=n.firstChild;return P(t,j(Mj,{rows:2,get placeholder(){return e().status===`running`?`Message the working agent — it queues into the live session…`:`Follow-up — resumes the session…`},get value(){return d()},onInput:e=>f(e.currentTarget.value)}),n),P(r,(()=>{var t=$e(()=>!!e().alive);return()=>t()?`live session`:e().sessionId?`resumes on send`:`no session`})()),P(n,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — refs drop into this message`,"aria-label":`Pick element`,onClick:v,get children(){return i0()}}),null),P(n,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return p()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void y(),get children(){return a0()}}),null),P(n,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get disabled(){return $e(()=>!e().alive)()&&!e().sessionId},title:`Compact the session — frees context (sends /compact)`,"aria-label":`Compact session`,onClick:()=>b.mutate({id:e().id,text:`/compact`}),get children(){return o0()}}),null),P(n,j(kj,{variant:`primary`,class:`shrink-0`,get loading(){return b.isPending},get disabled(){return!d().trim()||!e().alive&&!e().sessionId},onClick:()=>b.mutate({id:e().id,text:d().trim()}),get children(){return s0()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}Br();var E0=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),D0=N(`<div class="flex flex-col gap-1.5">`),O0=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Pull requests</span></div><div class="border-border flex shrink-0 items-center gap-1.5 border-b px-3 py-1.5"><div class="bg-surface-2 border-border flex shrink-0 rounded-md border p-0.5"></div></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),k0=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),A0=N(`<button>`),j0=N(`<span class="text-success text-[11px]">✓`),M0=N(`<span class="text-[12px] leading-none">✓`),N0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),P0=N(`<span class="text-success text-[12px] leading-none">✓`),F0=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><a target=_blank rel=noreferrer class="text-accent truncate text-[12.5px] font-medium hover:underline"></a><div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text-dim truncate text-[11.5px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 flex-wrap items-center gap-1.5"><div class="ml-auto flex shrink-0 items-center gap-1">`),I0=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2 14 5.5 8 9 2 5.5 8 2Z"></path><path d="M2 10.5 8 14l6-3.5">`),L0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=4 cy=3.5 r=1.5></circle><circle cx=4 cy=12.5 r=1.5></circle><circle cx=12 cy=8 r=1.5></circle><path d="M4 5v6M4 6.5c0 2 2 3 4.5 3h2">`),R0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),z0=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function B0(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:15e3})),n=O(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>z0.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>HO(n().map(e=>e.attachment.url)),refetchInterval:3e4,retry:0,enabled:n().length>0})),[a,o]=T(new Set),s=e=>a().has(e.attachment.url)?`MERGED`:i.data?.statuses[e.attachment.url],c=e=>!!r.data?.some(t=>t.title.startsWith(e.issue.identifier)),[l,u]=T(`all`),[d,f]=T(``),p=O(()=>{let e=d().trim().toLowerCase();return n().filter(t=>{let n=t.issue.state.type,r=s(t);return!(l()===`review`&&(n!==`started`||r===`MERGED`||r===`CLOSED`)||l()===`open`&&(r===`MERGED`||r===`CLOSED`||!(n===`started`||n===`unstarted`||n===`backlog`))||l()===`done`&&!(n===`completed`||r===`MERGED`||r===`CLOSED`)||e&&![t.attachment.title,t.issue.title,t.issue.identifier].join(` `).toLowerCase().includes(e))})}),m=_r(()=>({queryKey:[`settings`],queryFn:Tr})),h=()=>m.data?.stagingBranch?.trim()||`staging`,[g,_]=T(null),[v,y]=T(new Set),[b,x]=T(null),S=async e=>{_(e),x(null);try{await UO(e,h()),y(t=>new Set(t).add(e))}catch(e){x(e instanceof Error?e.message:String(e))}finally{_(null)}},[C,w]=T(null),[ee,D]=T(null),te=async e=>{D(e);try{await qO(e),o(t=>new Set(t).add(e))}catch{}finally{D(null)}},k=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),w(e.attachment.id),setTimeout(()=>w(null),1500)}catch{}};return(()=>{var r=O0(),o=r.firstChild;o.firstChild;var m=o.nextSibling,_=m.firstChild,y=m.nextSibling;return P(o,j(M,{get when(){return!i.isError},get fallback(){return k0()},get children(){var e=E0(),t=e.firstChild,r=t.nextSibling;return r.nextSibling,P(e,()=>p().length,t),P(e,()=>n().length,r),e}}),null),P(_,j(We,{each:[{id:`all`,label:`All`},{id:`review`,label:`Review`},{id:`open`,label:`Open`},{id:`done`,label:`Done`}],children:e=>(()=>{var t=A0();return t.$$click=()=>u(e.id),P(t,()=>e.label),E(()=>st(t,`rounded-[5px] px-2 py-0.5 text-[11px] font-medium transition-colors ${l()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),P(m,j(jj,{class:`h-6 min-w-0 flex-1 text-[11px]`,placeholder:`Search PRs…`,get value(){return d()},onInput:e=>f(e.currentTarget.value)}),null),P(y,j(M,{get when(){return p().length>0},get fallback(){return j(Vj,{title:`No PRs yet`,get children(){return $e(()=>!!t.isError)()?`Connect Linear in Settings.`:n().length>0?`No PRs match the current filter.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=D0();return P(t,j(We,{get each(){return p()},children:t=>(()=>{var n=F0(),r=n.firstChild,o=r.nextSibling,l=o.firstChild,u=l.nextSibling,d=u.nextSibling,f=o.nextSibling,p=f.firstChild;return P(r,()=>t.attachment.title||t.attachment.url),P(n,j(M,{get when(){return i.data?.previews[t.attachment.url]},get children(){return j(Ij,{get href(){return i.data.previews[t.attachment.url]},class:`shrink-0 self-start`,title:`Vercel deploy preview of this PR's branch`,children:`Preview`})}}),o),P(o,j(Bj,{get color(){return t.issue.state.color}}),l),P(l,()=>t.issue.identifier),P(u,()=>t.issue.title),P(d,()=>Wj(t.issue.updatedAt)),P(f,j(zj,{get children(){return t.issue.state.name}}),p),P(f,j(M,{get when(){return t.issue.delegate},get children(){return j(zj,{class:`text-accent`,get children(){return[j(Pj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),p),P(f,j(M,{get when(){return c(t)},get children(){return j(zj,{class:`text-warn`,get children(){return[j(Fj,{}),` local`]}})}}),p),P(f,j(Ij,{get href(){return t.issue.url},class:`shrink-0`,title:`Open the issue in Linear`,children:`Linear`}),p),P(p,j(M,{get when(){return $e(()=>!!s(t))()&&s(t)!==`OPEN`},get children(){return j(zj,{get class(){return s(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return s(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(p,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return g()===t.attachment.url},get disabled(){return v().has(t.attachment.url)},get title(){return $e(()=>!!v().has(t.attachment.url))()?`On ${h()} — staging preview deploying`:`Merge into ${h()} — deploys the staging preview domain`},"aria-label":`Merge to staging`,onClick:()=>void S(t.attachment.url),get children(){return j(M,{get when(){return v().has(t.attachment.url)},get fallback(){return I0()},get children(){return j0()}})}}),null),P(p,j(kj,{variant:`primary`,class:`size-7 px-0`,get classList(){return{hidden:!!s(t)&&s(t)!==`OPEN`}},get loading(){return ee()===t.attachment.url},get disabled(){return a().has(t.attachment.url)},get title(){return a().has(t.attachment.url)?`Merged`:`Squash-merge this PR (bridge gh)`},"aria-label":`Merge PR`,onClick:()=>void te(t.attachment.url),get children(){return j(M,{get when(){return a().has(t.attachment.url)},get fallback(){return L0()},get children(){return M0()}})}}),null),P(p,j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{oj(`activity`,t.issue.id),e.onOpenIssue()},get children(){return N0()}}),null),P(p,j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Copy PR URL`,"aria-label":`Copy PR URL`,onClick:()=>void k(t),get children(){return j(M,{get when(){return C()===t.attachment.id},get fallback(){return R0()},get children(){return P0()}})}}),null),P(f,j(M,{get when(){return v().has(t.attachment.url)},get children(){return j(u$,{get url(){return t.attachment.url},get base(){return h()}})}}),null),E(e=>{var n=t.attachment.url,i=t.attachment.title;return n!==e.e&&it(r,`href`,e.e=n),i!==e.t&&it(r,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()})),t}})),r})()}rt([`click`]);var V0=[`defaultTeamId`,`defaultProjectId`,`defaultLabelIds`,`defaultRepo`,`workflowMode`,`cursorModel`,`stagingBranch`,`githubAssetsRepo`,`skillPaths`,`logUrl`,`logLines`,`issueTemplate`,`testUsername`];function H0(e){let t={};for(let n of V0){let r=e[n];r!==void 0&&r!==``&&!(Array.isArray(r)&&r.length===0)&&(t[n]=r)}return t}function U0(e,t){let n={};for(let r of V0)e[r]===void 0&&t[r]!==void 0&&(n[r]=t[r]);return Object.keys(n).length?n:null}Br();function W0(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function G0(e){let t=W0(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=W0(new Uint8Array(n)),i=W0(crypto.getRandomValues(new Uint8Array(16))),a=chrome.identity.getRedirectURL(),o=new URL(`https://linear.app/oauth/authorize`);o.searchParams.set(`client_id`,e),o.searchParams.set(`redirect_uri`,a),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`scope`,`read,write`),o.searchParams.set(`state`,i),o.searchParams.set(`code_challenge`,r),o.searchParams.set(`code_challenge_method`,`S256`);let s=await chrome.identity.launchWebAuthFlow({url:o.toString(),interactive:!0});if(!s)throw Error(`OAuth flow was cancelled`);let c=new URL(s).searchParams;if(c.get(`state`)!==i)throw Error(`OAuth state mismatch`);let l=c.get(`code`);if(!l)throw Error(c.get(`error_description`)??`No authorization code returned`);let u=await fetch(`https://api.linear.app/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,code:l,redirect_uri:a,client_id:e,code_verifier:t})}),d=await u.json().catch(()=>null);if(!u.ok||!d?.access_token)throw Error(`Token exchange failed — check the OAuth app callback URL and client id`);await Er({linearAccessToken:d.access_token,linearOauthClientId:e})}async function K0(){await Er({linearAccessToken:void 0,linearApiKey:void 0})}Br(),Sr(),Fx(),gD();var q0=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),J0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft &amp; delegate to the Cursor agent. Local (react-grab style): picking auto-copies the element's context — source, stack, and your skills/memory paths — straight to the clipboard for a local Claude Code or Cursor session; the panel stays out of the way. Both share the same picker; switch anytime.`),Y0=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Element screenshots`),X0=N(`<span class="text-text-faint text-[10.5px] leading-snug">Captures a highlighted screenshot of each picked element and attaches it to the issue. Costs a beat on huge pages — with this off, picking is instant (pure react-grab speed).`),Z0=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),Q0=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),$0=N(`<option value>Select a team…`),e2=N(`<option value>No project`),t2=N(`<div class="flex flex-wrap gap-1">`),n2=N(`<label class="flex items-start gap-2"><input type=checkbox class="accent-accent mt-0.5"><span class="flex flex-col gap-0.5"><span class=text-[12px]>Let agents close out Linear themselves</span><span class="text-text-faint text-[10.5px] leading-snug">Embeds your Linear API key + raw GraphQL closeout recipes in every issue's Agent instructions — cloud agent VMs have no authenticated Linear MCP, so without this they can't comment, attach media, or move the issue. The key is visible to anyone who can read the issue.`),r2=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),i2=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),a2=N(`<div class="flex flex-col gap-1.5">`),o2=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Mode</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">Beside page squeezes the app next to the panel, DevTools-style — nothing gets covered. Also toggleable from the dock icon in the panel header.`),s2=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Dock side</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">The launcher pill is draggable — park it anywhere it doesn't cover your app.`),c2=N(`<p class="text-text-faint text-[10.5px] leading-snug">A committed <code>.lineargrab.json</code> at the repo root (where the bridge runs) shares team/project/labels, skills, staging branch, and workflow defaults with every machine and teammate — it seeds any setting you haven't set locally. Secrets never belong in it.`),l2=N(`<span class="inline-block min-w-[10ch] text-center">`),u2=N(`<div class="flex items-center gap-2">`),d2=N(`<option value>Select a channel…`),f2=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Announce new issues on create`),p2=N(`<span class="text-text-faint text-[10.5px] leading-snug">⚠️ Tokens are embedded in issue Agent-instructions so agents can post the finished demo — everyone who can read the issue can read them. Use single-channel-scoped bots.`),m2=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Provider preference</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"><button>Auto</button><button>OpenAI</button><button>Anthropic`),h2=N(`<p class="text-text-dim text-[11px]">`),g2=N(`<div class=min-h-[2lh]>`),_2=N(`<ol class="text-text-faint flex list-decimal flex-col gap-1 pl-4 text-[11px] leading-relaxed"><li>Pick an element on your running dev app.</li><li>Draft the issue (AI optional).</li><li>Create + delegate — Cursor's cloud agent fixes it and opens a PR.</li><li>Track and steer it from Activity.`),v2=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),y2=N(`<button>`),b2=N(`<div class="flex gap-1.5">`),x2=N(`<p class="text-text-faint text-center text-[10.5px]">or`),S2=N(`<span class="text-text-faint text-[10.5px] leading-snug">Register this callback URL in your Linear OAuth app config:<br><span class="font-mono text-[10.5px] break-all">`),C2=N(`<div class="flex flex-col gap-3">`),w2=N(`<span class=text-text-dim>Connected — verifying…`),T2=N(`<option> (<!>)`),E2=N(`<option>`),D2=N(`<button type=button><span class="mr-1 inline-block size-2 rounded-full align-middle">`),O2=N(`<option value>Select the agent…`),k2=N(`<option>#`),A2=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function j2(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Tr,staleTime:0})),n=O(()=>t.data??{});async function r(t,n=!1){await Er(t),await e.invalidateQueries({queryKey:[`settings`]}),n&&(await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]}))}let i=O(()=>!!(n().linearApiKey||n().linearAccessToken)),a=_r(()=>({queryKey:[`viewer`],queryFn:lO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:uO,enabled:i()})),s=_r(()=>({queryKey:[`linear-projects`],queryFn:bO,enabled:i()})),c=_r(()=>({queryKey:[`bridge-health`],queryFn:MO,retry:0})),[l,u]=T(!1),d=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(H0(n()),null,2)+`
271
- `),u(!0),setTimeout(()=>u(!1),1800)}catch{}},f=()=>{let e=c.data?.projectConfig;if(!e)return;let t={};for(let n of V0)e[n]!==void 0&&(t[n]=e[n]);r(t)},p=_r(()=>({queryKey:[`linear-labels`],queryFn:xO,enabled:i()})),m=_r(()=>({queryKey:[`agents`],queryFn:dO,enabled:i()})),[h,g]=T(``),[_,v]=T(!1),[y,b]=T(``);async function x(){let e=h().trim();if(e){v(!0),b(``);try{await r({linearApiKey:e},!0),await lO(),g(``)}catch{b(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{v(!1)}}}let[S,C]=T(``),[w,ee]=T(!1),[D,te]=T(``);async function k(){let t=(S()||n().linearOauthClientId||``).trim();if(!t){te(`Enter an OAuth client ID first.`);return}ee(!0),te(``);try{await G0(t),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}catch(e){te(e instanceof Error?e.message:`OAuth flow failed.`)}finally{ee(!1)}}let[A,ne]=T(!1);async function re(){ne(!0);try{await K0(),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}finally{ne(!1)}}let ie=xr?chrome.identity.getRedirectURL():null,ae=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>ek(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),oe=O(()=>Ax(n())),se=O(()=>{let e=oe();return e?`Drafting with ${e} — ${Nx[e].fast} (fast) / ${Nx[e].best} (best)`:null});return(()=>{var e=v2();return P(e,j(Rj,{title:`Workflow`,get children(){return[(()=>{var e=q0();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=y2();return t.$$click=()=>void r({workflowMode:e.id}),P(t,()=>e.label),E(()=>st(t,`flex-1 rounded-[5px] px-2 py-1 text-[11.5px] font-medium transition-colors ${(n().workflowMode??`cloud`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),J0()]}}),null),P(e,j(Rj,{title:`Capture`,get children(){return[(()=>{var e=Y0(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),E(()=>t.checked=!!n().captureShots),e})(),X0()]}}),null),P(e,j(Rj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=C2();return P(e,j(Lj,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=b2();return P(e,j(jj,{type:`password`,placeholder:`lin_api_…`,get value(){return h()},onInput:e=>g(e.currentTarget.value),"on:keydown":e=>{e.key===`Enter`&&x()}}),null),P(e,j(kj,{variant:`primary`,get loading(){return _()},get disabled(){return!h().trim()},onClick:()=>void x(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return y()},get children(){return j(Hj,{get message(){return y()}})}})]}}),null),P(e,j(M,{when:xr,get children(){return[x2(),j(Lj,{label:`OAuth client ID`,get children(){return[(()=>{var e=b2();return P(e,j(jj,{placeholder:`your-client-id`,get value(){return S()||n().linearOauthClientId||``},onInput:e=>C(e.currentTarget.value)}),null),P(e,j(kj,{variant:`ghost`,get loading(){return w()},onClick:()=>void k(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return D()},get children(){return j(Hj,{get message(){return D()}})}}),(()=>{var e=S2(),t=e.firstChild.nextSibling.nextSibling;return P(t,ie),e})()]}})]}}),null),e})()},get children(){var e=Q0(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return w2()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return w2()},get children(){return j(Hj,{message:`Key rejected — reconnect`})}})},get children(){var e=Z0(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(kj,{variant:`ghost`,get loading(){return A()},onClick:()=>void re(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Rj,{title:`Workspace`,get children(){return[j(Lj,{label:`Default team`,get children(){return j(Nj,{get value(){return n().defaultTeamId??``},onChange:e=>{let t=e.currentTarget.value;r({defaultTeamId:t||void 0})},get disabled(){return o.isLoading},get children(){return[$0(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=T2(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,P(t,()=>e.name,r),P(t,()=>e.key,i),E(()=>t.selected=e.id===n().defaultTeamId),E(()=>t.value=e.id),t})()})}})]}})}}),j(Lj,{label:`Default project`,hint:`Every issue created from the panel is filed into this project.`,get children(){return j(Nj,{get value(){return n().defaultProjectId??``},onChange:e=>void r({defaultProjectId:e.currentTarget.value||void 0}),get disabled(){return s.isLoading},get children(){return[(()=>{var e=e2();return E(()=>e.selected=!n().defaultProjectId),e})(),j(We,{get each(){return s.data??[]},children:e=>(()=>{var t=E2();return P(t,()=>e.name),E(()=>t.selected=e.id===n().defaultProjectId),E(()=>t.value=e.id),t})()})]}})}}),j(Lj,{label:`Default labels`,hint:`Applied to every issue created from the panel.`,get children(){var e=t2();return P(e,j(We,{get each(){return p.data??[]},children:e=>{let t=()=>(n().defaultLabelIds??[]).includes(e.id);return(()=>{var i=D2(),a=i.firstChild;return i.$$click=()=>{let i=n().defaultLabelIds??[];r({defaultLabelIds:t()?i.filter(t=>t!==e.id):[...i,e.id]})},P(i,()=>e.name,null),E(n=>{var r=`h-6 cursor-pointer rounded-full border px-2.5 text-[11px] font-medium transition-colors ${t()?`bg-accent-soft text-accent border-accent/40`:`bg-surface-2 text-text-dim border-border hover:bg-surface-3`}`,o=e.color;return r!==n.e&&st(i,n.e=r),o!==n.t&&dt(a,`background`,n.t=o),n},{e:void 0,t:void 0}),i})()}})),e}}),(()=>{var e=n2(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({shareLinearKey:e.currentTarget.checked})),E(()=>t.checked=!!n().shareLinearKey),e})(),j(Lj,{label:`Staging branch`,hint:`Stage buttons on PRs merge the PR branch here — point your staging domain (e.g. preview.ahmedbanihani.com) at this branch in Vercel.`,get children(){return j(jj,{get value(){return n().stagingBranch??``},placeholder:`staging`,onChange:e=>void r({stagingBranch:e.currentTarget.value.trim()||void 0})})}}),j(Lj,{label:`Cursor agent`,hint:`App users in your workspace. Pick Cursor — requires the Cursor integration installed in Linear (workspace admin) with usage-based pricing enabled in Cursor.`,get children(){return j(M,{get when(){return $e(()=>!!m.data)()&&m.data.length===0},get fallback(){return j(Nj,{get value(){return n().cursorAgentId??``},onChange:e=>{let t=e.currentTarget.value;if(!t){r({cursorAgentId:void 0,cursorAgentName:void 0,cursorAgentUrl:void 0});return}let n=m.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return m.isLoading},get children(){return[O2(),j(M,{get when(){return m.data},get children(){return j(We,{get each(){return m.data},children:e=>(()=>{var t=E2();return P(t,()=>e.displayName),E(()=>t.selected=e.id===n().cursorAgentId),E(()=>t.value=e.id),t})()})}})]}})},get children(){return r2()}})}}),j(Lj,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(jj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Cursor cloud model`,hint:`Appended as [model=…] — e.g. claude-opus-4-8, gpt-5.2, composer. Empty = Cursor's default.`,get children(){return j(jj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Agent instructions`,hint:`Appended to every issue as '### Agent instructions' and given to the AI draft. Add demo credentials (username/password) so the agent can log in, test, and record its video. Careful: credentials become visible to everyone who can read the issue.`,get children(){return[j(Mj,{rows:5,placeholder:hD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),i2()]}}),j(Lj,{label:`Dev server log URL`,hint:`Tail of your dev-server log attached to issues (and fed to AI drafts). Serve the log over HTTP: "dev:http": "next dev 2>&1 | tee public/dev-server.log" (gitignore it), then use /dev-server.log here. Empty = disabled.`,get children(){return j(jj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(jj,{type:`number`,min:`10`,max:`500`,placeholder:`100`,get value(){return n().logLines??``},onBlur:e=>{let t=Number(e.currentTarget.value);r({logLines:Number.isFinite(t)&&t>0?Math.min(500,Math.max(10,Math.round(t))):void 0})}})}}),j(Lj,{label:`Skills & memory paths`,hint:`One path per line. The cloud agent works in a full repo checkout, so committed paths (e.g. .claude/skills/apple-hig-design-principles) are readable directly — every issue gets a MANDATORY-reading section pointing at them. Repo-relative for cloud agents; absolute paths also work when you paste the issue into a local Claude Code session. Per project: these settings live per dev origin.`,get children(){return j(Mj,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
267
+ `)}</code></pre>`);continue}let i=e.match(/^(#{1,6})\s+(.*)$/);if(i){n.push(`<h4>${x$(i[2])}</h4>`),r++;continue}if(/^\s*[-*]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*[-*]\s+/.test(t[r]);)e.push(`<li>${x$(t[r].replace(/^\s*[-*]\s+/,``))}</li>`),r++;n.push(`<ul>${e.join(``)}</ul>`);continue}if(/^\s*\d+[.)]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s*\d+[.)]\s+/.test(t[r]);)e.push(`<li>${x$(t[r].replace(/^\s*\d+[.)]\s+/,``))}</li>`),r++;n.push(`<ol>${e.join(``)}</ol>`);continue}let a=[];for(;r<t.length&&t[r].trim()&&!/^(#{1,6}\s|```|\s*[-*]\s+|\s*\d+[.)]\s+)/.test(t[r]);)a.push(t[r]),r++;n.push(`<p>${x$(a.join(`<br />`))}</p>`)}return n.join(``)}Br();var C$=N(`<div class="lg-md text-text text-[12px] leading-relaxed break-words">`),w$=N(`<div class="flex h-full flex-col">`),T$=N(`<span class="tabular-nums text-[10.5px] text-text-faint">live · updated `),E$=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),D$=N(`<div class="flex-1 overflow-y-auto">`),O$=N(`<div class="min-h-0 flex-1 overflow-y-auto pl-2 pr-3"><div style=position:relative>`),k$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">My issues</span><div class="flex items-center gap-2"></div></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5">`),A$=N(`<button>`),j$=N(`<div style=position:absolute;top:0;left:0;width:100%>`),M$=N(`<button class="w-full cursor-pointer rounded-md px-2 py-1.5 text-left hover:bg-surface-2 transition-colors"><div class="flex items-center gap-1.5 min-w-0"><span class="font-mono text-[11px] text-text-dim shrink-0"></span><span class="truncate text-[12.5px] text-text"></span></div><div class="mt-0.5 flex items-center gap-1.5"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),N$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M10.5 3.5 6 8l4.5 4.5">`),P$=N(`<span class="font-mono text-[11px] text-text-dim shrink-0">`),F$=N(`<span class="truncate text-[12px] font-medium text-text">`),I$=N(`<span class="text-[11.5px] text-text-faint">Loading…`),L$=N(`<div class="flex items-center gap-2"><span class="text-[11px] text-text-dim">`),R$=N(`<div class="flex flex-col gap-2">`),z$=N(`<div class="flex flex-col gap-1"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Attachments</span><div class="flex flex-col gap-1">`),B$=N(`<div class="flex flex-col gap-2.5"><span class="text-[10.5px] font-semibold uppercase tracking-wide text-text-dim">Comments`),V$=N(`<option value=local>Message local Claude Code session`),H$=N(`<option value=new>Start NEW agent (@<!>)`),U$=N(`<option value=comment>Comment only`),W$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),G$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),K$=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),q$=N(`<span class="inline-block min-w-[4ch] text-left">Send`),J$=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 flex-col gap-1 border-b px-3 py-2"><div class="flex items-center gap-2"></div></div><div class="min-h-0 flex-1 overflow-y-auto pl-3 pr-4 py-3 flex flex-col gap-3"></div><div class="border-border shrink-0 border-t p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-2">`),Y$=N(`<option selected>`),X$=N(`<svg width=10 height=10 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),Z$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),Q$=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="m2.5 4 3.5 4-3.5 4M8 12.5h5.5">`),$$=N(`<div class="bg-surface border-border overflow-clip rounded-lg border"><div class="border-border flex h-9 min-w-0 items-center justify-between gap-2 border-b px-3"><div class="flex min-w-0 items-center gap-1.5 text-[11.5px] font-medium"><span aria-hidden class="text-text-dim inline-flex"></span><span class="text-text shrink-0">Local Claude Code</span><span class="text-text-dim shrink-0">started by you</span><span class="text-text-faint shrink-0 tabular-nums">· </span></div></div><div class="flex h-9 items-center gap-1 pr-2"><button class="hover:bg-surface-2 flex h-full min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-3 text-left transition-colors"title="Open the live thread in the Local tab"><span></span><span class="text-text-faint min-w-0 flex-1 truncate text-[11.5px]"></span><svg width=14 height=14 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class="text-text-dim shrink-0"><path d="m6 3.5 4.5 4.5L6 12.5">`),e1=N(`<option>`),t1=N(`<div class="flex flex-col gap-1.5">`),n1=N(`<span class="text-success text-[11px]">✓`),r1=N(`<span class="inline-block min-w-[6ch] text-center">Merge`),i1=N(`<div class="flex min-w-0 items-center gap-1.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11.5px] hover:underline">`),a1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2 14 5.5 8 9 2 5.5 8 2Z"></path><path d="M2 10.5 8 14l6-3.5">`),o1=N(`<div class="flex flex-col gap-0.5"><div class="flex items-center gap-1.5"><span class="text-[11px] font-medium text-text-dim"></span><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),s1=N(`<option>Steer running agent<!> · `),c1=N(`<span class="bg-danger inline-block size-2.5 rounded-full"aria-hidden>`),l1=N(`<span class="text-[11px] text-text-dim">`),u1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden class=transition-transform><path d="m3.5 6.5 4.5 4 4.5-4">`),d1=N(`<p class="text-[12px] text-text leading-relaxed whitespace-pre-wrap break-words">`),f1=N(`<div class="border-border mt-0.5 flex flex-col gap-1 overflow-y-auto border-t pt-1.5 pl-0.5 pr-3">`),p1=N(`<div class="bg-surface border-border rounded-lg border p-2.5 flex flex-col gap-1.5"><div class="flex items-center gap-1.5 flex-wrap"><span class="ml-auto tabular-nums text-[10.5px] text-text-faint">`),m1=N(`<p class="font-mono text-text-faint text-[10.5px] leading-relaxed break-words">→ <!> `),h1=N(`<div>`);function g1(e){let t=k(()=>S$(e.text));return(()=>{var e=C$();return D(()=>e.innerHTML=t()),e})()}function _1(){let[e,t]=T(null);return O(()=>{let e=ij();e&&(t(e),sj())}),(()=>{var n=w$();return P(n,j(M,{get when(){return e()===null},get fallback(){return j(b1,{get issueId(){return e()},onBack:()=>t(null)})},get children(){return j(v1,{onSelect:e=>t(e)})}})),n})()}function v1(e){let t,n=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:12e3})),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:1e4,retry:0})),i=e=>(r.data??[]).some(t=>t.title.startsWith(e.identifier)),a=e=>e.state.type===`started`&&e.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url)),o=[{id:`all`,label:`All`},{id:`active`,label:`In Progress`},{id:`review`,label:`Review`},{id:`done`,label:`Done`},{id:`cloud`,label:`Cloud`},{id:`local`,label:`Local`}],[s,c]=br(`issues:filter`,`all`),[l,u]=br(`issues:search`,``),d=k(()=>{let e=l().trim().toLowerCase();return(n.data??[]).filter(t=>{if(e&&!`${t.identifier} ${t.title}`.toLowerCase().includes(e))return!1;switch(s()){case`active`:return t.state.type===`started`;case`review`:return!!a(t);case`done`:return t.state.type===`completed`;case`cloud`:return!!t.delegate;case`local`:return i(t);default:return!0}})}),f=JQ({get count(){return d().length},getScrollElement:()=>t,estimateSize:()=>56,overscan:5});return(()=>{var r=k$(),a=r.firstChild,p=a.firstChild.nextSibling,m=a.nextSibling;return P(p,j(M,{get when(){return n.dataUpdatedAt>0},get children(){var e=T$();return e.firstChild,P(e,()=>Wj(n.dataUpdatedAt),null),e}}),null),P(p,j(kj,{class:`size-7 px-0`,get loading(){return n.isFetching},onClick:()=>void n.refetch(),title:`Refresh`,"aria-label":`Refresh issues`,get children(){return E$()}}),null),P(m,j(We,{each:o,children:e=>(()=>{var t=A$();return t.$$click=()=>c(e.id),P(t,()=>e.label),D(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${s()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(m,j(jj,{class:`ml-auto h-6 w-28 text-[11px]`,placeholder:`Search…`,get value(){return l()},onInput:e=>u(e.currentTarget.value)}),null),P(r,j(M,{get when(){return n.isError},get children(){var e=D$();return P(e,j(Vj,{title:`Connect Linear in Settings`,get children(){return n.error?.message??`Unable to load issues.`}})),e}}),null),P(r,j(M,{get when(){return $e(()=>!n.isError&&!n.isPending)()&&d().length===0},get children(){var e=D$();return P(e,j(Vj,{title:`No issues found`,children:`Issues you create will appear here.`})),e}}),null),P(r,j(M,{get when(){return $e(()=>!n.isError)()&&d().length>0},get children(){var n=O$(),r=n.firstChild,a=t;return typeof a==`function`?pt(a,n):t=n,P(r,j(We,{get each(){return f.getVirtualItems()},children:t=>{let n=k(()=>d()[t.index]);return j(M,{get when(){return n()},get children(){var r=j$();return P(r,j(y1,{get issue(){return n()},get local(){return i(n())},get onSelect(){return e.onSelect}})),D(e=>dt(r,`transform`,`translateY(${t.start}px)`)),r}})}})),D(e=>dt(r,`height`,`${f.getTotalSize()}px`)),n}}),null),r})()}function y1(e){return(()=>{var t=M$(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling,o=a.firstChild;return t.$$click=()=>e.onSelect(e.issue.id),P(n,j(Bj,{get color(){return e.issue.state.color}}),r),P(r,()=>e.issue.identifier),P(i,()=>e.issue.title),P(a,j(zj,{get children(){return e.issue.state.name}}),o),P(a,j(M,{get when(){return e.issue.delegate},get children(){return j(zj,{class:`text-accent`,get children(){return[j(Pj,{}),` `,$e(()=>e.issue.delegate.displayName)]}})}}),o),P(a,j(M,{get when(){return e.local},get children(){return j(zj,{class:`text-accent`,get children(){return[j(Fj,{}),` local`]}})}}),o),P(a,j(M,{get when(){return $e(()=>!!(e.issue.state.type===`started`&&e.issue.delegate))()&&e.issue.attachments?.some(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url))},get children(){return j(zj,{color:`var(--color-warn)`,children:`needs review`})}}),o),P(o,()=>Wj(e.issue.updatedAt)),t})()}function b1(e){let t=sr(),n=_r(()=>({queryKey:[`issue`,e.issueId],queryFn:()=>pO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),r=_r(()=>({queryKey:[`sessions`,e.issueId],queryFn:()=>hO(e.issueId),refetchInterval:8e3,enabled:!!e.issueId})),i=_r(()=>({queryKey:[`settings`],queryFn:Tr})),a=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:5e3,retry:0})),o=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}],s=vr(()=>({mutationFn:async t=>{let r=n.data?.attachments.find(e=>/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url)),i=r?se.data?.previews[r.url]:void 0,a=[...t.activities].reverse().find(e=>e.content.__typename===`AgentActivityResponseContent`)?.content.body,o=[`✅ **Closeout** (posted from the panel — one-click acceptance)`,``,`**Fix:** ${(t.summary??a??`Fix complete — see the PR.`).slice(0,600)}`,``,...r?[`**PR:** ${r.url}`]:[],...i?[`**Deploy preview:** ${i}`]:[],``,`**DEFINITION OF DONE — acceptance checklist**`,`- [x] PR opened and linked${r?` — ${r.url}`:``}`,i?`- [x] Deploy-preview URL included (above)`:`- [ ] Deploy-preview URL — none found on the PR`,`- [x] Issue moved to review state (this action)`,`- [ ] Demo media on the issue — attach from the PR/agent artifacts if recorded`];await CO(e.issueId,o.join(`
268
+ `),t.comment?.id??void 0);let s=n.data?.team?.id;if(s){let t=await vO(s),n=t.find(e=>e.type===`started`&&/review/i.test(e.name))??t.filter(e=>e.type===`completed`).sort((e,t)=>e.position-t.position)[0];n&&await yO(e.issueId,n.id)}},onSuccess:()=>{t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`sessions`,e.issueId]})}})),c=vr(()=>({mutationFn:e=>LO(e.id,e.model),onSuccess:e=>{t.setQueryData([`bridge-tasks`],t=>t?.map(t=>t.id===e.id?e:t))}})),l=vr(()=>({mutationFn:e=>IO(e,`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`),onSuccess:()=>void t.invalidateQueries({queryKey:[`bridge-tasks`]})})),u=vr(()=>({mutationFn:e=>RO(e),onSuccess:()=>void t.invalidateQueries({queryKey:[`bridge-tasks`]})})),[d,f]=T(!1),p=async e=>{try{await navigator.clipboard.writeText(YO(e)),f(!0),setTimeout(()=>f(!1),1800)}catch{}},m=k(()=>{let e=n.data?.identifier;return e?a.data?.find(t=>t.title.startsWith(e)):void 0}),h=e=>e.status===`running`?{word:`Working…`,cls:`text-accent`}:e.status===`done`?{word:`Finished`,cls:`text-success`}:e.status===`stopped`?{word:`Stopped`,cls:`text-warn`}:{word:`Error`,cls:`text-danger`},[g,_]=br(`activity-reply:${e.issueId}`,``),[v,y]=T(null),[b,x]=T(0),S=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:cj()===`composer`})),[C,w]=T(!1),E=async()=>{w(!0),y(null);try{let{block:e,failed:t}=await f$();e?_(t=>`${t?`${t}\n`:``}${e}\n`):t.length||y(`Nothing captured yet — pick an element, capture a region, or record first.`),t.length&&y(t.join(` · `))}catch(e){y(e instanceof Error?e.message:`Attach failed.`)}finally{w(!1)}},ee=()=>{if(cj()===`composer`){uj(`capture`);return}x(Date.now()),uj(`composer`),YZ().catch(()=>uj(`capture`))};O(()=>{if(cj()!==`composer`)return;let e=(S.data??[]).filter(e=>e.grabbedAt>b());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
269
+ `);_(e=>`${e?`${e}\n`:``}${t}\n`),x(Math.max(...e.map(e=>e.grabbedAt)))});let[te,A]=T(HD());ae(UD(A));let ne=!1;O(()=>{te().phase===`ready`&&ne&&(ne=!1,E())});let re=()=>{te().phase===`recording`?eO():(ne=!0,$D())},ie=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i,oe=k(()=>(n.data?.attachments??[]).map(e=>e.url).filter(e=>ie.test(e))),se=_r(()=>({queryKey:[`pr-status`,oe().sort().join(`|`)],queryFn:()=>HO(oe()),refetchInterval:3e4,retry:0,enabled:oe().length>0})),ce=e=>_e().has(e)?`MERGED`:se.data?.statuses[e],[le,ue]=T(null),de=()=>i.data?.stagingBranch?.trim()||`staging`,[fe,pe]=T(null),[me,he]=T(new Set),ge=async e=>{pe(e);try{await UO(e,de()),he(t=>new Set(t).add(e))}catch{}finally{pe(null)}},[_e,ve]=T(new Set),[ye,be]=T(null),xe=async n=>{be(null),ue(n);try{await qO(n),ve(e=>new Set(e).add(n)),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t.invalidateQueries({queryKey:[`my-issues`]}),t$()}catch(e){be(e instanceof Error?`${e.message} (bridge must be running; gh needs merge rights)`:`Merge failed.`)}finally{ue(null)}},Se=k(()=>{let e=n.data?TO(n.data.comments):[],t=new Set(e.map(e=>e.id));return[...(r.data??[]).filter(e=>e.comment?.id&&!t.has(e.comment.id)).map(e=>({id:e.comment.id,createdAt:e.updatedAt,body:``,user:{displayName:e.appUser?.displayName??`agent`,app:!0},parent:null})),...e]}),[Ce,we]=T(`comment`),Te=!1,Ee=!1;O(()=>{if(Ee||!n.data||!i.data)return;Ee=!0;let e=Se();e.length?we(`thread:${e[0].id}`):n.data.delegate&&i.data.cursorAgentId&&we(`new`)}),O(()=>{Te||m()&&(Ce()===`comment`||Ce()===`new`)&&we(`local`)}),O(()=>{if(Te)return;let e=Se();e.length&&(Ce()===`comment`||Ce()===`new`)&&we(`thread:${e[0].id}`)});let De=vr(()=>({mutationFn:async()=>{let t=g().trim();if(!t)throw Error(`Message is empty`);let n=i.data??{},r=Ce();if(r===`local`){let n=m();if(!n)throw Error(`Local session not found — is the bridge running?`);await IO(n.id,t),await CO(e.issueId,`🖥️ **→ local agent:** ${t}`).catch(()=>{})}else r.startsWith(`thread:`)?await CO(e.issueId,t,r.slice(7)):r===`new`&&n.cursorAgentId?await wO(e.issueId,t,{name:n.cursorAgentName,displayName:n.cursorAgentName??`Cursor`,url:n.cursorAgentUrl}):await CO(e.issueId,t)},onSuccess:()=>{_(``),y(null),uj(`capture`),t.invalidateQueries({queryKey:[`issue`,e.issueId]}),t$()},onError:e=>{y(e.message??`Failed to send`)}})),Oe=k(()=>n.data),ke=k(()=>r.data??[]);return(()=>{var t=J$(),r=t.firstChild,a=r.firstChild,f=r.nextSibling,y=f.nextSibling,b=y.firstChild;return P(a,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Back to issues`,"aria-label":`Back to issues`,"data-tip-pos":`right bottom`,get onClick(){return e.onBack},get children(){return N$()}}),null),P(a,j(M,{get when(){return Oe()},get children(){return[(()=>{var e=P$();return P(e,()=>Oe().identifier),e})(),(()=>{var e=F$();return P(e,()=>Oe().title),e})()]}}),null),P(a,j(M,{get when(){return $e(()=>!!n.isPending)()&&!Oe()},get children(){return I$()}}),null),P(r,j(M,{get when(){return Oe()},get children(){var e=L$(),t=e.firstChild;return P(e,j(Bj,{get color(){return Oe().state.color}}),t),P(t,()=>Oe().state.name),P(e,j(Ij,{get href(){return Oe().url},class:`ml-auto shrink-0`,children:`Open in Linear`}),null),e}}),null),P(f,j(M,{get when(){return m()},children:e=>{let t=()=>h(e());return(()=>{var n=$$(),r=n.firstChild,i=r.firstChild.firstChild,a=i.nextSibling.nextSibling.nextSibling;a.firstChild;var s=r.nextSibling,f=s.firstChild,m=f.firstChild,h=m.nextSibling;return P(i,j(Fj,{size:12})),P(a,()=>Wj(e().startedAt),null),P(r,j(Nj,{class:`h-6 w-auto max-w-[110px] shrink-0 text-[10.5px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>c.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:o,children:t=>(()=>{var n=e1();return P(n,()=>t.label),D(()=>n.selected=(e().pendingModel??e().model??``)===t.id),D(()=>n.value=t.id),n})()}),j(M,{get when(){return!o.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=Y$();return P(t,()=>e().pendingModel??e().model),D(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),f.$$click=()=>oj(`local`),P(f,j(M,{get when(){return e().status===`running`},get children(){return j(Aj,{size:12})}}),m),P(m,()=>t().word),P(h,(()=>{var t=$e(()=>e().status===`done`);return()=>t()?e().result??e().lastText:e().lastText})()),P(s,j(M,{get when(){return e().status===`running`},get children(){return j(kj,{variant:`danger`,class:`size-6 shrink-0 px-0`,get loading(){return u.isPending},title:`Stop the session — resumable afterwards`,"aria-label":`Stop session`,onClick:()=>u.mutate(e().id),get children(){return X$()}})}}),null),P(s,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get loading(){return l.isPending},get title(){return`Run again — resumes this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>l.mutate(e().id),get children(){return Z$()}})}}),null),P(s,j(M,{get when(){return e().sessionId},get children(){return j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return d()?`Copied!`:`Copy terminal resume command (claude --resume …)`},"aria-label":`Copy resume command`,onClick:()=>void p(e()),get children(){return Q$()}})}}),null),D(()=>st(m,`shrink-0 text-[11.5px] font-medium ${t().cls}`)),n})()}}),null),P(f,j(M,{get when(){return ke().length>0},get children(){var e=R$();return P(e,j(We,{get each(){return ke()},children:e=>(()=>{var t=t1();return P(t,j(x1,{session:e}),null),P(t,j(M,{get when(){return $e(()=>!!(/complete/i.test(e.status)&&n.data?.state.type===`started`))()&&!/review/i.test(n.data?.state.name??``)},get children(){return j(kj,{variant:`primary`,class:`self-start`,get loading(){return s.isPending},title:`Post the acceptance comment (fix summary, PR, preview, checklist) in the agent thread and move the issue to review`,onClick:()=>s.mutate(e),children:`Post closeout to Linear`})}}),null),t})()})),e}}),null),P(f,j(M,{get when(){return $e(()=>!!Oe())()&&Oe().attachments.length>0},get children(){var e=z$(),t=e.firstChild.nextSibling;return P(t,j(We,{get each(){return Oe().attachments},children:e=>{let t=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i.test(e.url);return[(()=>{var n=i1(),r=n.firstChild;return P(r,()=>e.title),P(n,j(M,{get when(){return t&&se.data?.previews[e.url]},get children(){return j(Ij,{get href(){return se.data.previews[e.url]},class:`shrink-0`,title:`Vercel deploy preview of this PR's branch`,children:`Preview`})}}),null),P(n,j(M,{get when(){return $e(()=>!!(t&&ce(e.url)))()&&ce(e.url)!==`OPEN`},get children(){return j(zj,{get class(){return`ml-auto shrink-0 ${ce(e.url)===`MERGED`?`text-success`:`text-text-faint`}`},get children(){return ce(e.url)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(n,j(M,{get when(){return t&&(!ce(e.url)||ce(e.url)===`OPEN`)},get children(){return[j(kj,{variant:`ghost`,class:`ml-auto size-6 shrink-0 px-0`,get loading(){return fe()===e.url},get disabled(){return me().has(e.url)},get title(){return $e(()=>!!me().has(e.url))()?`On ${de()} — staging preview deploying`:`Merge into ${de()} — deploys the staging preview domain`},"aria-label":`Merge to staging`,onClick:()=>void ge(e.url),get children(){return j(M,{get when(){return me().has(e.url)},get fallback(){return a1()},get children(){return n1()}})}}),j(kj,{variant:`primary`,class:`h-6 shrink-0 px-2 text-[11px]`,get loading(){return le()===e.url},get title(){return se.isError?`PR state unknown — restart the bridge (npx linear-grab-bridge) for live merge status`:`Squash-merge this PR via the bridge gh — reviewed the demo? Ship it.`},onClick:()=>void xe(e.url),get children(){return r1()}})]}}),null),D(t=>{var n=e.url,i=e.title;return n!==t.e&&it(r,`href`,t.e=n),i!==t.t&&it(r,`title`,t.t=i),t},{e:void 0,t:void 0}),n})(),j(M,{get when(){return me().has(e.url)},get children(){return j(u$,{get url(){return e.url},get base(){return de()}})}})]}}),null),P(t,j(M,{get when(){return ye()},get children(){return j(Hj,{get message(){return ye()}})}}),null),e}}),null),P(f,j(M,{get when(){return $e(()=>!!Oe())()&&Oe().comments.length>0},get children(){var e=B$();return e.firstChild,P(e,j(Ge,{get each(){return Oe().comments},children:e=>{let t=e();return(()=>{var e=o1(),n=e.firstChild,r=n.firstChild,i=r.nextSibling;return P(r,()=>t.user?.displayName??t.user?.name??`Unknown`),P(n,j(M,{get when(){return t.user?.app},get children(){return j(zj,{children:`agent`})}}),i),P(i,()=>Wj(t.createdAt)),P(e,j(g1,{get text(){return t.body}}),null),e})()}}),null),e}}),null),P(f,j(M,{get when(){return $e(()=>!!(Oe()&&Oe().comments.length===0))()&&ke().length===0},get children(){return j(Vj,{title:`No activity yet`,children:`Comments and agent sessions will appear here.`})}}),null),P(f,j(M,{get when(){return $e(()=>!!n.isError)()&&!Oe()},get children(){return j(Vj,{title:`Failed to load issue`,get children(){return n.error?.message??`Unknown error`}})}}),null),P(y,j(M,{get when(){return v()},get children(){return j(Hj,{get message(){return v()}})}}),b),P(y,j(Mj,{rows:2,placeholder:`Reply — steer the agent or add context…`,get value(){return g()},onInput:e=>_(e.target.value),get disabled(){return De.isPending}}),b),P(b,j(Nj,{class:`min-w-0 flex-1`,get value(){return Ce()},onChange:e=>{Te=!0,we(e.currentTarget.value)},get children(){return[j(M,{get when(){return m()},get children(){var e=V$();return D(()=>e.selected=Ce()===`local`),e}}),j(We,{get each(){return Se()},children:(e,t)=>(()=>{var n=s1(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,(()=>{var e=$e(()=>Se().length>1);return()=>e()?` #${t()+1}`:``})(),r),P(n,()=>Wj(e.createdAt),null),D(()=>n.selected=Ce()===`thread:${e.id}`),D(()=>n.value=`thread:${e.id}`),n})()}),j(M,{get when(){return i.data?.cursorAgentId},get children(){var e=H$(),t=e.firstChild.nextSibling;return t.nextSibling,P(e,()=>i.data?.cursorAgentName??`Cursor`,t),D(()=>e.selected=Ce()===`new`),e}}),(()=>{var e=U$();return D(()=>e.selected=Ce()===`comment`),e})()]}}),null),P(b,j(kj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${cj()===`composer`?`text-accent`:``}`},get title(){return cj()===`composer`?`Pick mode ON — every pick appends here. Click to stop.`:`Pick elements — refs append to this reply (stays on until toggled off or sent)`},"aria-label":`Pick element for reply`,onClick:ee,get children(){return W$()}}),null),P(b,j(kj,{variant:`ghost`,get class(){return`size-7 shrink-0 px-0 ${te().phase===`recording`?`text-danger`:``}`},get title(){return te().phase===`recording`?`Stop recording — the GIF auto-attaches to this reply`:`Record a GIF from this thread (auto-attaches when done)`},"aria-label":`Record GIF`,onClick:re,get children(){return j(M,{get when(){return te().phase===`recording`},get fallback(){return c1()},get children(){return G$()}})}}),null),P(b,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return C()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void E(),get children(){return K$()}}),null),P(b,j(kj,{class:`min-w-[52px] shrink-0`,variant:`primary`,get loading(){return De.isPending},get disabled(){return g().trim().length===0},onClick:()=>De.mutate(),get children(){return q$()}}),null),t})()}function x1(e){let t=k(()=>{let t=e.session.status;return/complete|done/i.test(t)?`var(--color-success)`:/await|pending|elicit/i.test(t)?`var(--color-warn)`:`var(--color-accent)`}),n=k(()=>{let t=e.session.status;return/active/i.test(t)?`Working…`:/awaitingInput|elicit/i.test(t)?`Needs input`:/complete/i.test(t)?`Complete`:/error/i.test(t)?`Error`:/pending/i.test(t)?`Queued`:t}),r=k(()=>e.session.activities.filter(e=>e.content?.body||e.content?.action).slice(-15)),[i,a]=T(!1),o,s=!0,c=()=>{o&&(s=o.scrollTop+o.clientHeight>=o.scrollHeight-40)};return O(()=>{let e=r().length;!o||!e||!s||requestAnimationFrame(()=>{o&&(o.scrollTop=o.scrollHeight)})}),(()=>{var s=p1(),l=s.firstChild,u=l.firstChild;return P(l,j(M,{get when(){return/active|pending/i.test(e.session.status)},get children(){return j(Aj,{size:12})}}),u),P(l,j(zj,{get color(){return t()},get children(){return n()}}),u),P(l,j(M,{get when(){return e.session.appUser?.displayName},get children(){var t=l1();return P(t,()=>e.session.appUser.displayName),t}}),u),P(u,()=>Wj(e.session.updatedAt)),P(l,j(M,{get when(){return e.session.externalLinks?.[0]},children:e=>j(Ij,{get href(){return e().url},class:`shrink-0`,title:`Open this run on the agent's site`,get children(){return e().label||`Cursor`}})}),null),P(l,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return i()?`Collapse to a window`:`Expand — show the whole session feed`},get"aria-label"(){return i()?`Collapse feed`:`Expand feed`},onClick:()=>a(e=>!e),get children(){var e=u1();return D(t=>dt(e,`transform`,i()?`rotate(180deg)`:`none`)),e}}),null),P(s,j(M,{get when(){return e.session.summary},get children(){var t=d1();return P(t,()=>e.session.summary),t}}),null),P(s,j(M,{get when(){return r().length>0},get children(){var e=f1();e.addEventListener(`scroll`,c);var t=o;return typeof t==`function`?pt(t,e):o=e,P(e,j(Ge,{get each(){return r()},children:e=>j(M,{get when(){return e().content.action},get fallback(){return(()=>{var t=h1();return P(t,j(g1,{get text(){return e().content.body??``}})),D(()=>st(t,`lg-md text-[11.5px] leading-relaxed break-words ${e().content.__typename===`AgentActivityErrorContent`?`text-danger`:`text-text`}`)),t})()},get children(){var t=m1(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>e().content.action,n),P(t,()=>e().content.parameter,null),t}})})),D(()=>e.classList.toggle(`max-h-64`,!i())),e}}),null),s})()}rt([`click`]);var S1=N(`<svg aria-hidden width=11 height=11 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M1 4.5A7 7 0 0 1 13.5 3"></path><path d="M15 11.5A7 7 0 0 1 2.5 13"></path><polyline points="1 1 1 5 5 5"></polyline><polyline points="15 11 15 15 11 15">`),C1=N(`<div class="flex flex-col gap-1.5">`),w1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text inline-flex items-center gap-1.5 text-[12px] font-semibold"> Cloud agents</span><span class="text-text-faint text-[10.5px] tabular-nums"> working · updated </span></div><div class="border-border flex shrink-0 items-center gap-1 border-b px-3 py-1.5"></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),T1=N(`<button>`),E1=N(`<div class="grid place-items-center py-10">`),D1=N(`<button class="flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left"title="View the thread here"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text hover:text-accent min-w-0 truncate text-[12.5px] font-medium transition-colors">`),O1=N(`<p class="text-text-dim line-clamp-2 cursor-pointer text-[11.5px] leading-snug break-words">`),k1=N(`<span class="text-text-dim text-[11px]">`),A1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),j1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 items-center gap-1.5"><span class=ml-auto>`),M1=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),N1=N(`<span class="text-text-dim text-[12.5px]">Conversation session`);function P1(){let e=_r(()=>({queryKey:[`cloud-sessions`],queryFn:gO,refetchInterval:12e3})),t=[{id:`all`,label:`All`},{id:`working`,label:`Working`},{id:`input`,label:`Needs input`},{id:`done`,label:`Done`}],[n,r]=br(`cloud:filter`,`all`),i=k(()=>(e.data??[]).filter(e=>{switch(n()){case`working`:return/active|pending/i.test(e.status);case`input`:return/awaitingInput|elicit/i.test(e.status);case`done`:return/complete/i.test(e.status);default:return!0}})),a=e=>/active/i.test(e)?{word:`Working…`,color:`var(--color-accent)`}:/awaitingInput|elicit/i.test(e)?{word:`Needs input`,color:`var(--color-warn)`}:/complete/i.test(e)?{word:`Complete`,color:`var(--color-success)`}:/error/i.test(e)?{word:`Error`,color:`var(--color-danger)`}:{word:e,color:`var(--color-text-dim)`},o=e=>{let t=[...e.activities].reverse().find(e=>e.content?.body||e.content?.action);return t?t.content.action?`→ ${t.content.action} ${t.content.parameter??``}`:t.content.body??``:e.summary??``},s=k(()=>(e.data??[]).filter(e=>/active|pending/i.test(e.status)).length),[c,l]=T(null);return j(M,{get when(){return!c()},get fallback(){return j(b1,{get issueId(){return c()},onBack:()=>l(null)})},get children(){var c=w1(),u=c.firstChild,d=u.firstChild,f=d.firstChild,p=d.nextSibling,m=p.firstChild,h=u.nextSibling,g=h.nextSibling;return P(d,j(Pj,{size:13}),f),P(p,s,m),P(p,()=>Wj(e.dataUpdatedAt||Date.now()),null),P(h,j(We,{each:t,children:e=>(()=>{var t=T1();return t.$$click=()=>r(e.id),P(t,()=>e.label),D(()=>st(t,`h-6 shrink-0 cursor-pointer rounded-md px-2 text-[11px] font-medium transition-colors ${n()===e.id?`bg-accent-soft text-accent`:`text-text-dim hover:bg-surface-2`}`)),t})()}),null),P(h,j(kj,{class:`ml-auto size-6 px-0`,get loading(){return e.isFetching},title:`Refresh`,"aria-label":`Refresh sessions`,onClick:()=>void e.refetch(),get children(){return S1()}}),null),P(g,j(M,{get when(){return i().length>0},get fallback(){return j(M,{get when(){return!e.isPending},get fallback(){return(()=>{var e=E1();return P(e,j(Aj,{})),e})()},get children(){return j(Vj,{title:`No cloud agent sessions`,children:`Delegate an issue to Cursor from the Draft tab and its live session appears here.`})}})},get children(){var e=C1();return P(e,j(Ge,{get each(){return i()},children:e=>(()=>{var t=j1(),n=t.firstChild,r=n.firstChild,i=n.nextSibling,s=i.firstChild;return P(n,j(M,{get when(){return/active|pending/i.test(e().status)},get fallback(){return(()=>{var t=M1();return D(n=>dt(t,`background`,a(e().status).color)),t})()},get children(){return j(Aj,{})}}),r),P(n,j(M,{get when(){return e().issue},get fallback(){return N1()},get children(){var t=D1(),n=t.firstChild,r=n.nextSibling;return t.$$click=()=>l(e().issue.id),P(n,()=>e().issue.identifier),P(r,()=>e().issue.title),t}}),r),P(r,()=>Wj(e().updatedAt)),P(t,j(M,{get when(){return o(e())},get children(){var t=O1();return t.$$click=()=>e().issue&&l(e().issue.id),P(t,()=>o(e())),t}}),i),P(i,j(zj,{get color(){return a(e().status).color},get children(){return a(e().status).word}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(Bj,{get color(){return e().issue.state.color}}),(()=>{var t=k1();return P(t,()=>e().issue.state.name),t})()]}}),s),P(i,j(M,{get when(){return e().issue},get children(){return[j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,title:`Open the thread — steer this agent`,"aria-label":`Open thread`,onClick:()=>l(e().issue.id),get children(){return A1()}}),j(Ij,{get href(){return e().issue.url},class:`shrink-0`,children:`Linear`})]}}),null),t})()})),e}})),c}})}rt([`click`]);var F1=N(`<div class="flex flex-col gap-1.5">`),I1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Running now</span><span class="text-text-faint text-[10.5px] tabular-nums"> agent<!> active</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),L1=N(`<span class="font-mono text-text-dim shrink-0 text-[11px]">`),R1=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),z1=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><button class="flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 text-left"><span class="text-text hover:text-accent min-w-0 truncate text-[12.5px] font-medium transition-colors"></span></button><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim line-clamp-2 text-[11.5px] leading-snug break-words"></p><div class="flex min-w-0 items-center gap-1.5"><span class=ml-auto>`);function B1(){let e=_r(()=>({queryKey:[`cloud-sessions`],queryFn:gO,refetchInterval:12e3})),t=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:3e4})),r=k(()=>{let r=(e.data??[]).filter(e=>/active|pending|awaitingInput|elicit/i.test(e.status)).map(e=>({kind:`cloud`,at:Date.parse(e.updatedAt),session:e})),i=(t.data??[]).filter(e=>e.status===`running`).map(e=>({kind:`local`,at:e.startedAt,task:e,issueId:(n.data??[]).find(t=>e.title.startsWith(t.identifier))?.id}));return[...r,...i].sort((e,t)=>t.at-e.at)}),[i,a]=T(null),o=e=>/awaitingInput|elicit/i.test(e)?{word:`Needs input`,color:`var(--color-warn)`}:{word:`Working…`,color:`var(--color-accent)`},s=e=>{let t=[...e.activities].reverse().find(e=>e.content?.body||e.content?.action);return t?t.content.action?`→ ${t.content.action} ${t.content.parameter??``}`:t.content.body??``:e.summary??``};return j(M,{get when(){return!i()},get fallback(){return j(b1,{get issueId(){return i()},onBack:()=>a(null)})},get children(){var e=I1(),t=e.firstChild,n=t.firstChild.nextSibling,i=n.firstChild,c=i.nextSibling;c.nextSibling;var l=t.nextSibling;return P(n,()=>r().length,i),P(n,()=>r().length===1?``:`s`,c),P(l,j(M,{get when(){return r().length>0},get fallback(){return j(Vj,{title:`Nothing running`,children:`Delegate an issue from the Draft tab — cloud (Cursor) and local (Claude Code) agents working right now appear here together.`})},get children(){var e=F1();return P(e,j(Ge,{get each(){return r()},children:e=>(()=>{var t=z1(),n=t.firstChild,r=n.firstChild,i=r.firstChild,c=r.nextSibling,l=n.nextSibling,u=l.nextSibling,d=u.firstChild;return P(n,j(Aj,{size:12}),r),P(n,j(zj,{get title(){return e().kind===`cloud`?`Cursor cloud agent`:`Local Claude Code`},get children(){return[$e(()=>$e(()=>e().kind===`cloud`)()?j(Pj,{}):j(Fj,{})),$e(()=>e().kind===`cloud`?`cloud`:`local`)]}}),r),r.$$click=()=>{let t=e();t.kind===`cloud`&&t.session.issue?a(t.session.issue.id):t.kind===`local`&&oj(`local`)},P(r,j(M,{get when(){return e().kind===`cloud`},get children(){var t=L1();return P(t,()=>e().session.issue?.identifier),t}}),i),P(i,(()=>{var t=$e(()=>e().kind===`cloud`);return()=>t()?e().session.issue?.title??`Conversation session`:e().task.title})()),P(c,()=>Wj(e().at)),P(l,(()=>{var t=$e(()=>e().kind===`cloud`);return()=>t()?s(e().session):e().task.lastText})()),P(u,j(M,{get when(){return e().kind===`cloud`},get fallback(){return j(zj,{color:`var(--color-accent)`,children:`Working…`})},get children(){return j(zj,{get color(){return o(e().session.status).color},get children(){return o(e().session.status).word}})}}),d),P(u,j(kj,{variant:`ghost`,class:`size-6 shrink-0 px-0`,get title(){return e().kind===`cloud`?`Open the thread — steer this agent`:`Open the live session in the Local tab`},"aria-label":`Open thread`,onClick:()=>{let t=e();t.kind===`cloud`&&t.session.issue?a(t.session.issue.id):t.kind===`local`&&oj(`local`)},get children(){return R1()}}),null),D(()=>it(r,`title`,e().kind===`cloud`?`View the thread here`:`Open the Local tab`)),t})()})),e}})),e}})}rt([`click`]),Br();var V1=N(`<div class="border-accent/40 bg-accent-soft self-end rounded-lg border px-2.5 py-1.5"><p class="text-accent mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase">You</p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),H1=N(`<div><p></p><div class="lg-md text-text text-[11.5px] leading-relaxed break-words">`),U1=N(`<p>`),W1=N(`<span class="text-text-faint max-w-[55%] truncate text-[10.5px] tabular-nums"> running<!> · `),G1=N(`<div class="flex flex-col gap-1.5">`),K1=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Local Claude Code</span></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),q1=N(`<span class="bg-surface-2 border-border font-mono mt-2 block rounded-md border px-2 py-1.5 text-[11px] select-all">npx linear-grab-bridge`),J1=N(`<span class="text-text-faint text-[10.5px] tabular-nums">ctx <!> · out `),Y1=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),X1=N(`<option selected>`),Z1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=currentColor aria-hidden><path d="M4.5 2.8a.8.8 0 0 1 1.22-.68l8 5.2a.8.8 0 0 1 0 1.36l-8 5.2a.8.8 0 0 1-1.22-.68V2.8Z">`),Q1=N(`<span class="text-success text-[12px] leading-none">✓`),$1=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><path d="M14 10a2 2 0 0 1-2 2H6l-3.5 2.5V4a2 2 0 0 1 2-2H12a2 2 0 0 1 2 2v6Z">`),e0=N(`<svg width=11 height=11 viewBox="0 0 16 16"fill=currentColor aria-hidden><rect x=3 y=3 width=10 height=10 rx=1.5>`),t0=N(`<span class="font-mono text-text-faint min-w-0 truncate text-[10.5px]">`),n0=N(`<div class="border-border bg-bg flex flex-col gap-1 rounded-md border p-2"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text-dim text-[10.5px] font-semibold tracking-wide uppercase">Changes</span><span class="ml-auto shrink-0 text-[10.5px] tabular-nums"><span class=text-success>+</span> <span class=text-danger>−`),r0=N(`<div class="border-border bg-bg flex max-h-80 flex-col gap-1.5 overflow-y-auto rounded-md border py-2 pl-2 pr-3">`),i0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=2.2></circle><path d="M8 1v3M8 12v3M1 8h3M12 8h3">`),a0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M13 7.5 8.2 12.3a3.2 3.2 0 0 1-4.5-4.5L8.9 2.6a2.1 2.1 0 0 1 3 3L7.1 10.4a1 1 0 0 1-1.5-1.5l4.3-4.3">`),o0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><path d="M8 2v4M8 10v4M2 8h4M10 8h4M4.5 4.5 6 6M11.5 11.5 10 10M11.5 4.5 10 6M4.5 11.5 6 10">`),s0=N(`<span class="inline-block min-w-[4ch] text-center">Send`),c0=N(`<div class="flex flex-col gap-1.5"><div class="flex items-center gap-1"><span class="text-text-faint min-w-0 flex-1 truncate text-[10.5px]">`),l0=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><div class="flex min-w-0 items-center gap-1.5"><span class="text-text min-w-0 truncate text-[12.5px] font-medium"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><p class="text-text-dim text-[11.5px] leading-snug break-words"></p><div class="flex flex-wrap items-center gap-1.5"></div><div class="flex items-center gap-1">`),u0=N(`<span aria-hidden class="size-2 shrink-0 rounded-full">`),d0=N(`<div class="flex min-w-0 items-center gap-1.5">`),f0=N(`<option>`),p0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),m0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M2.5 3.5 6 7 2.5 10.5M7.5 12.5h6">`),h0=N(`<span class=text-success>+`),g0=N(`<span class=text-danger>−`),_0=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="shrink-0 text-[10px] tabular-nums">`),v0=N(`<span class=text-text-faint>bin`),y0=N(`<div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim min-w-0 flex-1 truncate text-[10.5px]"></span><span class="text-success shrink-0 text-[10px]">new`),b0=N(`<div class="flex min-w-0 items-center gap-1.5 pt-0.5"><a target=_blank rel=noreferrer class="text-accent min-w-0 truncate text-[11px] hover:underline">`),x0=N(`<p class="text-text-faint text-[11px]">Waiting for output…`),S0=[{id:``,label:`Default model`},{id:`fable`,label:`Fable 5`},{id:`opus`,label:`Opus`},{id:`sonnet`,label:`Sonnet`},{id:`haiku`,label:`Haiku`}];function C0(e,t){let n=e.split(`.`).map(Number),r=t.split(`.`).map(Number);for(let e=0;e<3;e++)if((n[e]??0)!==(r[e]??0))return(n[e]??0)<(r[e]??0);return!1}var w0=e=>e==null?`–`:e>=1e3?`${(e/1e3).toFixed(e>=1e5?0:1)}k`:String(e);function T0(){let e=sr(),t=_r(()=>({queryKey:[`bridge-health`],queryFn:MO,refetchInterval:5e3,retry:0})),n=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:3e3,enabled:!!t.data?.ok})),[r,i]=T(null),a=_r(()=>({queryKey:[`my-issues`],queryFn:fO,staleTime:15e3})),o=e=>{let t=e.title.match(/^([A-Z][A-Z0-9]*-\d+)/)?.[1];return t?a.data?.find(e=>e.identifier===t):void 0},s=_r(()=>({queryKey:[`bridge-task`,r()],queryFn:()=>PO(r()),refetchInterval:1500,enabled:!!r()&&!!t.data?.ok})),c=_r(()=>({queryKey:[`bridge-diff`,r()],queryFn:()=>BO(r()),refetchInterval:6e3,enabled:!!r()&&!!t.data?.ok})),l=()=>{e.invalidateQueries({queryKey:[`bridge-tasks`]}),e.invalidateQueries({queryKey:[`bridge-task`,r()]})},u=vr(()=>({mutationFn:e=>RO(e),onSuccess:l})),[d,f]=br(`local:message`,``),[p,m]=T(!1),[h,g]=T(0),_=_r(()=>({queryKey:[`grab`],queryFn:Dr,enabled:cj()===`local`})),v=()=>{g(Date.now()),uj(`local`),YZ().catch(()=>uj(`capture`))};O(()=>{if(cj()!==`local`)return;let e=(_.data??[]).filter(e=>e.grabbedAt>=h());if(!e.length)return;let t=e.map(e=>{let t=e.source?.filePath?` — \`${e.source.filePath}${e.source.lineNumber==null?``:`:${e.source.lineNumber}`}\``:``;return`- \`<${e.componentName??e.tagName??`element`}>\`${t}`}).join(`
270
+ `);f(e=>`${e?`${e}\n`:``}${t}\n`),uj(`capture`)});let y=async()=>{m(!0);try{let{block:e,failed:t}=await f$();e&&f(t=>`${t?`${t}\n`:``}${e}\n`),t.length&&f(e=>`${e}\n<!-- upload issues: ${t.join(` · `)} -->\n`)}finally{m(!1)}},b=vr(()=>({mutationFn:e=>IO(e.id,e.text),onSuccess:()=>{f(``),l()}})),x=vr(()=>({mutationFn:e=>LO(e.id,e.model),onSuccess:t=>{e.setQueryData([`bridge-tasks`],e=>e?.map(e=>e.id===t.id?t:e)),l()}})),S=vr(()=>({mutationFn:e=>zO(e),onSuccess:l})),C,w=!0,E=()=>{C&&(w=C.scrollTop+C.clientHeight>=C.scrollHeight-48)};O(()=>{let e=s.data?.tail?.length??0;r(),!(!C||!e||!w)&&requestAnimationFrame(()=>{C&&(C.scrollTop=C.scrollHeight)})});let[ee,te]=T(null),A=async e=>{try{await navigator.clipboard.writeText(YO(e)),te(e.id),setTimeout(()=>te(null),1800)}catch{}},ne=e=>e===`running`?`var(--color-accent)`:e===`done`?`var(--color-success)`:e===`stopped`?`var(--color-warn)`:`var(--color-danger)`,re=e=>{let t=e.line.kind,n=k(()=>S$(e.line.text));return t===`user`?(()=>{var e=V1(),t=e.firstChild.nextSibling;return D(()=>t.innerHTML=n()),e})():t===`assistant`||t===`result`?(()=>{var e=H1(),r=e.firstChild,i=r.nextSibling;return st(e,`bg-surface rounded-lg border px-2.5 py-1.5 ${t===`result`?`border-success/40`:`border-border`}`),st(r,`mb-0.5 text-[9.5px] font-semibold tracking-wide uppercase ${t===`result`?`text-success`:`text-text-faint`}`),P(r,t===`result`?`Result`:`Claude`),D(()=>i.innerHTML=n()),e})():(()=>{var n=U1();return st(n,`font-mono px-1 text-[10px] leading-relaxed break-words ${t===`subagent`?`text-warn`:t===`stderr`?`text-danger`:`text-text-faint`}`),P(n,()=>e.line.text),n})()};return(()=>{var e=K1(),a=e.firstChild;a.firstChild;var l=a.nextSibling;return P(a,j(M,{get when(){return t.data?.ok},get fallback(){return j(zj,{class:`text-danger`,children:`bridge offline`})},get children(){return[j(M,{get when(){return C0(t.data.version,`0.15.1`)},get children(){return j(zj,{class:`text-warn`,title:`Ctrl+C the old process, then: npx linear-grab-bridge`,get children(){return[`v`,$e(()=>t.data.version),` outdated — restart`]}})}}),(()=>{var e=W1(),r=e.firstChild,i=r.nextSibling;return i.nextSibling,P(e,()=>t.data.active,r),P(e,()=>{let e=(n.data??[]).reduce((e,t)=>e+(t.usage?.costUsd??0),0);return e>0?` · Σ $${e.toFixed(2)}`:``},i),P(e,()=>t.data.cwd.split(`/`).slice(-2).join(`/`),null),D(()=>it(e,`title`,t.data?.cwd)),e})()]}}),null),P(l,j(M,{get when(){return t.data?.ok},get fallback(){return j(Vj,{title:`Bridge not running`,get children(){return[`Start it in your repo's terminal:`,q1(),`Then delegate from the Draft tab ("Local Claude Code") or watch tasks here. Sessions stay interactive — send follow-ups, switch models, interrupt, resume in your terminal. History persists across restarts.`]}})},get children(){return j(M,{get when(){return(n.data??[]).length>0},get fallback(){return j(Vj,{title:`No local tasks yet`,children:`Create an issue in Draft with "Delegate to → Local Claude Code", and it appears here with live status and a conversation view.`})},get children(){var e=G1();return P(e,j(Ge,{get each(){return n.data},children:e=>(()=>{var t=l0(),n=t.firstChild,a=n.firstChild,l=a.nextSibling,m=n.nextSibling,h=m.nextSibling,g=h.nextSibling;return P(n,j(M,{get when(){return e().status===`running`},get fallback(){return(()=>{var t=u0();return D(n=>dt(t,`background`,ne(e().status))),t})()},get children(){return j(Aj,{})}}),a),P(a,()=>e().title),P(l,()=>Wj(e().startedAt)),P(m,()=>e().lastText),P(h,j(zj,{get color(){return ne(e().status)},get children(){return e().status}}),null),P(h,j(zj,{get children(){return e().model??`default model`}}),null),P(h,j(M,{get when(){return e().pendingModel},get children(){return j(zj,{class:`text-warn`,get children(){return[`→ `,$e(()=>e().pendingModel),` next msg`]}})}}),null),P(h,j(M,{get when(){return e().subagents>0},get children(){return j(zj,{class:`text-warn`,get children(){return[`⛓ `,$e(()=>e().subagents),` subagents`]}})}}),null),P(h,j(M,{get when(){return e().usage},get children(){var t=J1(),n=t.firstChild.nextSibling;return n.nextSibling,P(t,()=>w0(e().usage.contextTokens),n),P(t,()=>w0(e().usage.outputTokens),null),P(t,(()=>{var t=$e(()=>!!e().usage.costUsd);return()=>t()?` · $${e().usage.costUsd.toFixed(2)}`:``})(),null),t}}),null),P(t,j(M,{get when(){return o(e())},children:e=>(()=>{var t=d0();return P(t,j(zj,{get children(){return e().state.name}}),null),P(t,j(Ij,{get href(){return e().url},children:`Open in Linear`}),null),t})()}),g),P(t,j(M,{get when(){return $e(()=>!!e().worktree)()&&!e().worktree.removed},get children(){var t=Y1(),n=t.firstChild;return P(t,j(zj,{class:`text-warn`,children:`⎇ worktree`}),n),P(n,()=>e().worktree.branch),P(t,j(M,{get when(){return e().status!==`running`},get children(){return j(kj,{variant:`ghost`,class:`ml-auto h-6 shrink-0 px-2 text-[11px]`,get loading(){return S.isPending},get title(){return`Remove the worktree at ${e().worktree.path} — the branch (and PR) survive`},onClick:()=>S.mutate(e().id),children:`Remove`})}}),null),D(()=>it(n,`title`,e().worktree.path)),t}}),g),P(g,j(Nj,{class:`h-7 w-auto min-w-0 flex-1 text-[11px]`,get value(){return e().pendingModel??e().model??``},onChange:t=>x.mutate({id:e().id,model:t.currentTarget.value}),title:`Model — applies from the next message`,get children(){return[j(We,{each:S0,children:t=>(()=>{var n=f0();return P(n,()=>t.label),D(()=>n.selected=(e().pendingModel??e().model??``)===t.id),D(()=>n.value=t.id),n})()}),j(M,{get when(){return!S0.some(t=>t.id===(e().pendingModel??e().model??``))},get children(){var t=X1();return P(t,()=>e().pendingModel??e().model),D(()=>t.value=e().pendingModel??e().model??``),t}})]}}),null),P(g,j(M,{get when(){return $e(()=>e().status!==`running`)()&&e().sessionId},get children(){return j(kj,{variant:`ghost`,class:`size-7 px-0`,get loading(){return b.isPending},get title(){return`Resume — continues this session${e().pendingModel?` on ${e().pendingModel}`:``}`},"aria-label":`Resume session`,onClick:()=>b.mutate({id:e().id,text:`Continue where you left off. If the work is already complete, finish any remaining closeout steps (PR, Linear update, announcement).`}),get children(){return Z1()}})}}),null),P(g,j(M,{get when(){return o(e())},children:e=>j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,onClick:()=>oj(`activity`,e().id),get children(){return p0()}})}),null),P(g,j(kj,{variant:`ghost`,class:`size-7 px-0`,get disabled(){return!e().sessionId},get title(){return $e(()=>!!e().sessionId)()?`Copy resume command · session ${e().sessionId.slice(0,8)}…`:`No session yet`},onClick:()=>void A(e()),get children(){return j(M,{get when(){return ee()===e().id},get fallback(){return m0()},get children(){return Q1()}})}}),null),P(g,j(kj,{variant:`ghost`,class:`size-7 px-0`,get title(){return r()===e().id?`Hide thread`:`Open thread — chat & changes`},onClick:()=>i(r()===e().id?null:e().id),get children(){return $1()}}),null),P(g,j(M,{get when(){return e().status===`running`},get children(){return j(kj,{variant:`danger`,class:`size-7 px-0`,get loading(){return u.isPending},title:`Interrupt — the session stays resumable`,onClick:()=>u.mutate(e().id),get children(){return e0()}})}}),null),P(t,j(M,{get when(){return r()===e().id},get children(){return[j(M,{get when(){return $e(()=>!!c.data)()&&(c.data.files.length||c.data.untracked.length||c.data.prs.length)},get children(){var e=n0(),t=e.firstChild,n=t.firstChild.nextSibling,r=n.firstChild;r.firstChild;var i=r.nextSibling.nextSibling;return i.firstChild,P(t,j(M,{get when(){return c.data.branch},get children(){var e=t0();return P(e,()=>c.data.branch),e}}),n),P(r,()=>c.data.totalAdded,null),P(i,()=>c.data.totalDeleted,null),P(e,j(We,{get each(){return c.data.files},children:e=>(()=>{var t=_0(),n=t.firstChild,r=n.nextSibling;return P(n,()=>e.path),P(r,j(M,{get when(){return!e.binary},get fallback(){return v0()},get children(){return[(()=>{var t=h0();return t.firstChild,P(t,()=>e.added,null),t})(),` `,(()=>{var t=g0();return t.firstChild,P(t,()=>e.deleted,null),t})()]}})),D(()=>it(n,`title`,e.path)),t})()}),null),P(e,j(We,{get each(){return c.data.untracked},children:e=>(()=>{var t=y0(),n=t.firstChild;return it(n,`title`,e),P(n,e),t})()}),null),P(e,j(We,{get each(){return c.data.prs},children:e=>(()=>{var t=b0(),n=t.firstChild;return P(t,j(zj,{class:`text-accent`,get children(){return[`PR · `,$e(()=>e.state.toLowerCase())]}}),n),P(n,()=>e.title),D(t=>{var r=e.url,i=e.title;return r!==t.e&&it(n,`href`,t.e=r),i!==t.t&&it(n,`title`,t.t=i),t},{e:void 0,t:void 0}),t})()}),null),e}}),(()=>{var e=r0();return e.addEventListener(`scroll`,E),pt(e=>{C=e,w=!0},e),P(e,j(M,{get when(){return(s.data?.tail??[]).length>0},get fallback(){return x0()},get children(){return j(Ge,{get each(){return s.data?.tail??[]},children:e=>j(re,{get line(){return e()}})})}})),e})(),(()=>{var t=c0(),n=t.firstChild,r=n.firstChild;return P(t,j(Mj,{rows:2,get placeholder(){return e().status===`running`?`Message the working agent — it queues into the live session…`:`Follow-up — resumes the session…`},get value(){return d()},onInput:e=>f(e.currentTarget.value)}),n),P(r,(()=>{var t=$e(()=>!!e().alive);return()=>t()?`live session`:e().sessionId?`resumes on send`:`no session`})()),P(n,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,title:`Pick elements on the page — refs drop into this message`,"aria-label":`Pick element`,onClick:v,get children(){return i0()}}),null),P(n,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return p()},title:`Attach captures — element refs, screenshots, region shots, recording GIF`,"aria-label":`Attach captures`,onClick:()=>void y(),get children(){return a0()}}),null),P(n,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get disabled(){return $e(()=>!e().alive)()&&!e().sessionId},title:`Compact the session — frees context (sends /compact)`,"aria-label":`Compact session`,onClick:()=>b.mutate({id:e().id,text:`/compact`}),get children(){return o0()}}),null),P(n,j(kj,{variant:`primary`,class:`shrink-0`,get loading(){return b.isPending},get disabled(){return!d().trim()||!e().alive&&!e().sessionId},onClick:()=>b.mutate({id:e().id,text:d().trim()}),get children(){return s0()}}),null),t})()]}}),null),t})()})),e}})}})),e})()}Br();var E0=N(`<span class="text-text-faint text-[10.5px] tabular-nums">/<!> from your issues`),D0=N(`<div class="flex flex-col gap-1.5">`),O0=N(`<div class="flex h-full flex-col"><div class="border-border flex shrink-0 items-center justify-between border-b px-3 py-2"><span class="text-text text-[12px] font-semibold">Pull requests</span></div><div class="border-border flex shrink-0 items-center gap-1.5 border-b px-3 py-1.5"><div class="bg-surface-2 border-border flex shrink-0 rounded-md border p-0.5"></div></div><div class="min-h-0 flex-1 overflow-y-auto pt-2 pb-3 pl-2 pr-3">`),k0=N(`<span class="text-warn text-[10.5px]"title="Merge states come from gh via the bridge">states unknown — restart the bridge`),A0=N(`<button>`),j0=N(`<span class="text-success text-[11px]">✓`),M0=N(`<span class="text-[12px] leading-none">✓`),N0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=8 cy=8 r=6></circle><circle cx=8 cy=8 r=1.6 fill=currentColor stroke=none>`),P0=N(`<span class="text-success text-[12px] leading-none">✓`),F0=N(`<div class="bg-surface border-border flex flex-col gap-1.5 rounded-lg border p-2.5"><a target=_blank rel=noreferrer class="text-accent truncate text-[12.5px] font-medium hover:underline"></a><div class="flex min-w-0 items-center gap-1.5"><span class="font-mono text-text-dim shrink-0 text-[11px]"></span><span class="text-text-dim truncate text-[11.5px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"></span></div><div class="flex min-w-0 flex-wrap items-center gap-1.5"><div class="ml-auto flex shrink-0 items-center gap-1">`),I0=N(`<svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden><path d="M8 2 14 5.5 8 9 2 5.5 8 2Z"></path><path d="M2 10.5 8 14l6-3.5">`),L0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round aria-hidden><circle cx=4 cy=3.5 r=1.5></circle><circle cx=4 cy=12.5 r=1.5></circle><circle cx=12 cy=8 r=1.5></circle><path d="M4 5v6M4 6.5c0 2 2 3 4.5 3h2">`),R0=N(`<svg width=13 height=13 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 stroke-linejoin=round aria-hidden><rect x=5.5 y=5.5 width=9 height=9 rx=1.5></rect><path d="M10.5 5.5v-2a2 2 0 0 0-2-2h-5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h2">`),z0=/github\.com\/[^/]+\/[^/]+\/pull\/\d+/i;function B0(e){let t=_r(()=>({queryKey:[`my-issues`],queryFn:fO,refetchInterval:15e3})),n=k(()=>(t.data??[]).flatMap(e=>(e.attachments??[]).filter(e=>z0.test(e.url)).map(t=>({issue:e,attachment:t})))),r=_r(()=>({queryKey:[`bridge-tasks`],queryFn:NO,refetchInterval:1e4,retry:0})),i=_r(()=>({queryKey:[`pr-status`,n().map(e=>e.attachment.url).sort().join(`|`)],queryFn:()=>HO(n().map(e=>e.attachment.url)),refetchInterval:3e4,retry:0,enabled:n().length>0})),[a,o]=T(new Set),s=e=>a().has(e.attachment.url)?`MERGED`:i.data?.statuses[e.attachment.url],c=e=>!!r.data?.some(t=>t.title.startsWith(e.issue.identifier)),[l,u]=T(`all`),[d,f]=T(``),p=k(()=>{let e=d().trim().toLowerCase();return n().filter(t=>{let n=t.issue.state.type,r=s(t);return!(l()===`review`&&(n!==`started`||r===`MERGED`||r===`CLOSED`)||l()===`open`&&(r===`MERGED`||r===`CLOSED`||!(n===`started`||n===`unstarted`||n===`backlog`))||l()===`done`&&!(n===`completed`||r===`MERGED`||r===`CLOSED`)||e&&![t.attachment.title,t.issue.title,t.issue.identifier].join(` `).toLowerCase().includes(e))})}),m=_r(()=>({queryKey:[`settings`],queryFn:Tr})),h=()=>m.data?.stagingBranch?.trim()||`staging`,[g,_]=T(null),[v,y]=T(new Set),[b,x]=T(null),S=async e=>{_(e),x(null);try{await UO(e,h()),y(t=>new Set(t).add(e))}catch(e){x(e instanceof Error?e.message:String(e))}finally{_(null)}},[C,w]=T(null),[E,O]=T(null),ee=async e=>{O(e);try{await qO(e),o(t=>new Set(t).add(e))}catch{}finally{O(null)}},te=async e=>{try{await navigator.clipboard.writeText(e.attachment.url),w(e.attachment.id),setTimeout(()=>w(null),1500)}catch{}};return(()=>{var r=O0(),o=r.firstChild;o.firstChild;var m=o.nextSibling,_=m.firstChild,y=m.nextSibling;return P(o,j(M,{get when(){return!i.isError},get fallback(){return k0()},get children(){var e=E0(),t=e.firstChild,r=t.nextSibling;return r.nextSibling,P(e,()=>p().length,t),P(e,()=>n().length,r),e}}),null),P(_,j(We,{each:[{id:`all`,label:`All`},{id:`review`,label:`Review`},{id:`open`,label:`Open`},{id:`done`,label:`Done`}],children:e=>(()=>{var t=A0();return t.$$click=()=>u(e.id),P(t,()=>e.label),D(()=>st(t,`rounded-[5px] px-2 py-0.5 text-[11px] font-medium transition-colors ${l()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),P(m,j(jj,{class:`h-6 min-w-0 flex-1 text-[11px]`,placeholder:`Search PRs…`,get value(){return d()},onInput:e=>f(e.currentTarget.value)}),null),P(y,j(M,{get when(){return p().length>0},get fallback(){return j(Vj,{title:`No PRs yet`,get children(){return $e(()=>!!t.isError)()?`Connect Linear in Settings.`:n().length>0?`No PRs match the current filter.`:`PRs opened by delegated agents appear here as soon as they link back to your issues.`}})},get children(){var t=D0();return P(t,j(We,{get each(){return p()},children:t=>(()=>{var n=F0(),r=n.firstChild,o=r.nextSibling,l=o.firstChild,u=l.nextSibling,d=u.nextSibling,f=o.nextSibling,p=f.firstChild;return P(r,()=>t.attachment.title||t.attachment.url),P(n,j(M,{get when(){return i.data?.previews[t.attachment.url]},get children(){return j(Ij,{get href(){return i.data.previews[t.attachment.url]},class:`shrink-0 self-start`,title:`Vercel deploy preview of this PR's branch`,children:`Preview`})}}),o),P(o,j(Bj,{get color(){return t.issue.state.color}}),l),P(l,()=>t.issue.identifier),P(u,()=>t.issue.title),P(d,()=>Wj(t.issue.updatedAt)),P(f,j(zj,{get children(){return t.issue.state.name}}),p),P(f,j(M,{get when(){return t.issue.delegate},get children(){return j(zj,{class:`text-accent`,get children(){return[j(Pj,{}),` `,$e(()=>t.issue.delegate.displayName)]}})}}),p),P(f,j(M,{get when(){return c(t)},get children(){return j(zj,{class:`text-warn`,get children(){return[j(Fj,{}),` local`]}})}}),p),P(f,j(Ij,{get href(){return t.issue.url},class:`shrink-0`,title:`Open the issue in Linear`,children:`Linear`}),p),P(p,j(M,{get when(){return $e(()=>!!s(t))()&&s(t)!==`OPEN`},get children(){return j(zj,{get class(){return s(t)===`MERGED`?`text-success`:`text-text-faint`},get children(){return s(t)===`MERGED`?`✓ merged`:`closed`}})}}),null),P(p,j(kj,{variant:`ghost`,class:`size-7 shrink-0 px-0`,get loading(){return g()===t.attachment.url},get disabled(){return v().has(t.attachment.url)},get title(){return $e(()=>!!v().has(t.attachment.url))()?`On ${h()} — staging preview deploying`:`Merge into ${h()} — deploys the staging preview domain`},"aria-label":`Merge to staging`,onClick:()=>void S(t.attachment.url),get children(){return j(M,{get when(){return v().has(t.attachment.url)},get fallback(){return I0()},get children(){return j0()}})}}),null),P(p,j(kj,{variant:`primary`,class:`size-7 px-0`,get classList(){return{hidden:!!s(t)&&s(t)!==`OPEN`}},get loading(){return E()===t.attachment.url},get disabled(){return a().has(t.attachment.url)},get title(){return a().has(t.attachment.url)?`Merged`:`Squash-merge this PR (bridge gh)`},"aria-label":`Merge PR`,onClick:()=>void ee(t.attachment.url),get children(){return j(M,{get when(){return a().has(t.attachment.url)},get fallback(){return L0()},get children(){return M0()}})}}),null),P(p,j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Open the issue's Activity thread`,"aria-label":`Open issue activity`,onClick:()=>{oj(`activity`,t.issue.id),e.onOpenIssue()},get children(){return N0()}}),null),P(p,j(kj,{variant:`ghost`,class:`size-7 px-0`,title:`Copy PR URL`,"aria-label":`Copy PR URL`,onClick:()=>void te(t),get children(){return j(M,{get when(){return C()===t.attachment.id},get fallback(){return R0()},get children(){return P0()}})}}),null),P(f,j(M,{get when(){return v().has(t.attachment.url)},get children(){return j(u$,{get url(){return t.attachment.url},get base(){return h()}})}}),null),D(e=>{var n=t.attachment.url,i=t.attachment.title;return n!==e.e&&it(r,`href`,e.e=n),i!==e.t&&it(r,`title`,e.t=i),e},{e:void 0,t:void 0}),n})()})),t}})),r})()}rt([`click`]);var V0=[`display`,`align-items`,`justify-content`,`gap`,`padding`,`margin`,`width`,`height`,`font-size`,`font-weight`,`line-height`,`letter-spacing`,`color`,`background-color`,`border-radius`,`border-width`,`border-color`,`box-shadow`,`opacity`,`transform`,`transition-property`,`transition-duration`],H0=new Set([`color`,`background-color`,`border-color`]),U0={margin:new Set([`0px`]),padding:new Set([`0px`]),gap:new Set([`normal`,`0px`]),"box-shadow":new Set([`none`]),transform:new Set([`none`]),"border-width":new Set([`0px`]),"border-radius":new Set([`0px`]),"letter-spacing":new Set([`normal`]),opacity:new Set([`1`]),"transition-property":new Set([`all`,`none`]),"transition-duration":new Set([`0s`]),width:new Set([`auto`]),height:new Set([`auto`])},W0=null;function G0(e){try{return W0||(W0=document.createElement(`span`),W0.style.display=`none`,document.body.appendChild(W0)),W0.style.color=``,W0.style.color=e,W0.style.color?getComputedStyle(W0).color:null}catch{return null}}var K0=null;function q0(){if(K0)return K0;let e=new Map,t=getComputedStyle(document.documentElement),n=new Set;for(let r of Array.from(document.styleSheets)){let i;try{i=r.cssRules}catch{continue}for(let r of Array.from(i)){let i=r.style;if(i)for(let r=0;r<i.length;r++){let a=i.item(r);if(!a.startsWith(`--`)||n.has(a))continue;n.add(a);let o=t.getPropertyValue(a).trim()||i.getPropertyValue(a).trim();if(!o||o.length>80)continue;let s=G0(o);s&&!e.has(s)&&e.set(s,a)}}}return K0=e,e}function J0(e){let t=e.getBoundingClientRect();if(t.width<2&&t.height<2)return!1;let n=getComputedStyle(e);return n.display!==`none`&&n.visibility!==`hidden`}function Y0(e){let t=[],n=e.getAttribute(`role`);n&&t.push(n);for(let n of[`data-state`,`data-highlighted`,`aria-expanded`,`aria-selected`,`data-active`]){let r=e.getAttribute(n);r!=null&&t.push(`${n.replace(/^(data|aria)-/,``)}=${r||`true`}`)}return t.join(` `)}async function X0(){try{return(await Promise.resolve().then(()=>(RZ(),AZ))).getGlobalApi()?.getDisplayName??null}catch{return null}}function Z0(e,t){let n=null;try{n=t?.(e)??null}catch{}let r=Y0(e),i=n||e.tagName.toLowerCase();return r?`${i} [${r}]`:i}function Q0(e,t){let n=getComputedStyle(e),r={},i={};for(let e of V0){let a=n.getPropertyValue(e).trim();if(!(!a||U0[e]?.has(a)))if(H0.has(e)){let n=G0(a);if(n===`rgba(0, 0, 0, 0)`)continue;let o=n?t.get(n):void 0;o&&(i[e]=o),r[e]=a}else r[e]=a}return{styles:r,tok:i}}var $0=40;async function e2(e){let t=q0(),n=await X0(),r=[],i=new Map,a=e=>{if(r.length>=$0||!J0(e))return;let o=typeof e.className==`string`?e.className:``,s=`${e.tagName}|${o}`,c=i.get(s);if(c)c.count+=1;else{let{styles:a,tok:c}=Q0(e,t),l={label:Z0(e,n),count:1,classes:o,styles:a,tokens:c};i.set(s,l),r.push(l)}for(let t of Array.from(e.children))a(t)};return a(e),{title:r[0]?.label??e.tagName.toLowerCase(),pageUrl:location.href,extractedAt:Date.now(),nodes:r,states:[]}}async function t2(e,t,n){let r=q0(),i=await X0(),a=[],o=new Set,s=new Map,c=e=>Q0(e,r).styles,l=e=>{if(!(s.size>=120)){s.set(e,c(e));for(let t of Array.from(e.children))l(t)}};l(e);let u=(e,t)=>{let n=s.get(e);if(!n)return;let r=c(e),l={};for(let e of new Set([...Object.keys(n),...Object.keys(r)])){let t=n[e]??`(unset)`,i=r[e]??`(unset)`;t!==i&&(l[e]={from:t,to:i})}if(Object.keys(l).length===0)return;let u=Z0(e,i),d=`${t}|${u}|${Object.keys(l).join(`,`)}`;o.has(d)||(o.add(d),a.push({trigger:t,label:u,changed:l}))},d=e=>{let t=e.target;t instanceof Element&&s.has(t)&&setTimeout(()=>u(t,`hover`),50)},f=e=>{let t=e.target;t instanceof Element&&s.has(t)&&setTimeout(()=>u(t,`focus`),50)};e.addEventListener(`pointerover`,d,!0),e.addEventListener(`focusin`,f,!0);let p=new MutationObserver(e=>{for(let t of e){if(t.type!==`attributes`||!(t.target instanceof Element))continue;let e=t.target,n=t.attributeName??``,r=e.getAttribute(n)??``;setTimeout(()=>u(e,`attr:${n}=${r||`true`}`),50)}});p.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`class`,`data-state`,`data-highlighted`,`aria-expanded`,`aria-selected`,`open`]});let m=new MutationObserver(t=>{for(let n of t)for(let t of Array.from(n.addedNodes))!(t instanceof Element)||e.contains(t)||t.id===`linear-grab-root`||t.closest?.(`#linear-grab-root`)||setTimeout(()=>{if(!t.isConnected||!J0(t))return;let{styles:e}=Q0(t,r);if(Object.keys(e).length===0)return;let n=Z0(t,i),s=`appeared|${n}`;if(o.has(s))return;o.add(s);let c={};for(let[t,n]of Object.entries(e))c[t]={from:`(absent)`,to:n};a.push({trigger:`appeared (portal/open)`,label:n,changed:c})},50)});m.observe(document.body,{childList:!0,subtree:!1});let h=setInterval(()=>{let e=t-(Date.now()-g);n?.(Math.max(0,e))},250),g=Date.now();return await new Promise(e=>setTimeout(e,t)),clearInterval(h),e.removeEventListener(`pointerover`,d,!0),e.removeEventListener(`focusin`,f,!0),p.disconnect(),m.disconnect(),a}function n2(e){let t=[`# Design genome: ${e.title}`,`Extracted from ${e.pageUrl}`,``,`## Structure`];for(let n of e.nodes){t.push(`### ${n.label}${n.count>1?` ×${n.count}`:``}`),n.classes&&t.push(`classes: \`${n.classes}\``);let e=Object.entries(n.styles).map(([e,t])=>{let r=n.tokens[e];return`${e}: ${t}${r?` ← var(${r})`:``}`});e.length&&t.push("```",...e,"```")}if(e.states.length){t.push(``,`## Interaction states`);for(let n of e.states)t.push(`### ${n.label} — ${n.trigger}`),t.push("```",...Object.entries(n.changed).map(([e,t])=>`${e}: ${t.from} → ${t.to}`),"```")}return t.join(`
271
+ `)}function r2(){return new Promise(e=>{let t=document.createElement(`div`);t.style.cssText=`position:fixed;z-index:2147483647;pointer-events:none;border:1.5px solid #5e6ad2;border-radius:4px;background:rgba(94,106,210,0.08);display:none;`,document.body.appendChild(t);let n=null,r=e=>{let t=document.elementFromPoint(e.clientX,e.clientY);return!t||t.closest(`#linear-grab-root`)?null:t},i=e=>{let i=r(e);if(n=i,!i){t.style.display=`none`;return}let a=i.getBoundingClientRect();t.style.display=`block`,t.style.left=`${a.left-2}px`,t.style.top=`${a.top-2}px`,t.style.width=`${a.width+4}px`,t.style.height=`${a.height+4}px`},a=n=>{t.remove(),window.removeEventListener(`mousemove`,i,!0),window.removeEventListener(`click`,o,!0),window.removeEventListener(`keydown`,s,!0),e(n)},o=e=>{e.preventDefault(),e.stopPropagation(),a(n)},s=e=>{e.key===`Escape`&&(e.stopPropagation(),a(null))};window.addEventListener(`mousemove`,i,!0),window.addEventListener(`click`,o,!0),window.addEventListener(`keydown`,s,!0)})}var i2=N(`<span class="inline-block min-w-[7ch] text-center">Extract`),a2=N(`<p class="text-warn px-1 text-[11px] font-medium">Recording interactions — hover / open the component now… <span class=tabular-nums>s`),o2=N(`<div class="relative flex flex-col gap-2 pl-4"><div class="bg-border absolute top-1 bottom-1 left-[5px] w-px"aria-hidden>`),s2=N(`<div class="flex h-full flex-col gap-3 overflow-y-auto pt-3 pb-4 pr-3 pl-2"><div class="flex items-center justify-between gap-2 px-1"><div class=min-w-0><p class="text-text text-[12.5px] font-semibold">Design genomes</p><p class="text-text-faint text-[10.5px] leading-snug">Point at a component → get its structure, tokens and interaction states as a spec you can hand to an agent.`),c2=N(`<p class="text-text mt-1 text-[11px] font-semibold">Interaction states`),l2=N(`<span class="inline-block min-w-[8ch] text-center">`),u2=N(`<div class="border-border flex flex-col gap-2 border-t px-2.5 py-2"><p class="text-text-faint truncate text-[10px]"></p><div class="flex max-h-64 flex-col gap-2 overflow-y-auto pr-2"></div><div class="flex items-center gap-1.5">`),d2=N(`<div class=relative><span class="border-border bg-surface absolute top-3 -left-[13.5px] size-[9px] rounded-full border"aria-hidden></span><div class="bg-surface border-border flex flex-col rounded-lg border"><button class="flex w-full cursor-pointer items-center gap-2 px-2.5 py-2 text-left"><span class="text-accent min-w-0 truncate font-mono text-[12px]"></span><span class="text-text-faint ml-auto shrink-0 text-[10.5px] tabular-nums"> roles<!> · </span><svg width=10 height=10 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 class="text-text-faint shrink-0 transition-transform"aria-hidden><path d="m4 6 4 4 4-4">`),f2=N(`<span class=text-text-faint> ×`),p2=N(`<div class="flex flex-col gap-0.5"><p class="text-text text-[11px] font-medium">`),m2=N(`<span class=text-accent> ← var(<!>)`),h2=N(`<p class="text-text-dim font-mono text-[10px] leading-snug break-all">: `),g2=N(`<div class="flex flex-col gap-0.5"><p class="text-warn text-[10.5px] font-medium"> — `),_2=N(`<p class="text-text-dim font-mono text-[10px] leading-snug break-all">: <!> → `),v2=`linear-grab:genomes:v1`,y2=30;function b2(){try{return JSON.parse(localStorage.getItem(v2)??`[]`)}catch{return[]}}function x2(e){try{localStorage.setItem(v2,JSON.stringify(e.slice(0,y2)))}catch{}}var S2=new Map;function C2(){let[e,t]=T(b2()),[n,r]=T(null),[i,a]=T(null),[o,s]=T(null),[c,l]=T(null),[u,d]=T(null),f=e=>{t(e),x2(e)},p=async()=>{l(null),a(`extract`),window.dispatchEvent(new CustomEvent(BZ));try{let t=await r2();if(!t)return;let n=await e2(t),i=Date.now();S2.set(i,new WeakRef(t)),f([{id:i,genome:n},...e()]),r(i)}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(null),window.dispatchEvent(new CustomEvent(VZ))}},m=async t=>{l(null),a(t.id),window.dispatchEvent(new CustomEvent(BZ));try{let n=S2.get(t.id)?.deref()??null;if(!n||!n.isConnected){if(n=await r2(),!n)return;S2.set(t.id,new WeakRef(n))}let r=await t2(n,8e3,e=>s(Math.ceil(e/1e3)));r.length===0&&l(`No state changes captured — hover/open the component while the 8s window runs.`),f(e().map(e=>e.id===t.id?{...e,genome:{...e.genome,states:[...e.genome.states,...r]}}:e))}catch(e){l(e instanceof Error?e.message:String(e))}finally{a(null),s(null),window.dispatchEvent(new CustomEvent(VZ))}},h=async e=>{try{await navigator.clipboard.writeText(n2(e.genome)),d(e.id),setTimeout(()=>d(null),1600)}catch{l(`Clipboard was blocked — click Copy again.`)}},g=t=>{S2.delete(t),f(e().filter(e=>e.id!==t))};return(()=>{var t=s2(),a=t.firstChild;return a.firstChild,P(a,j(kj,{variant:`primary`,class:`h-7 shrink-0 px-2.5 text-[11.5px]`,get loading(){return i()===`extract`},onClick:()=>void p(),get children(){return i2()}}),null),P(t,j(M,{get when(){return o()!==null},get children(){var e=a2(),t=e.firstChild.nextSibling,n=t.firstChild;return P(t,o,n),e}}),null),P(t,j(M,{get when(){return c()},get children(){return j(Hj,{get message(){return c()}})}}),null),P(t,j(M,{get when(){return e().length>0},get fallback(){return j(Vj,{title:`No genomes yet`,children:`Click Extract and pick any component on the page — a dropdown, a card, a sidebar row. Then "Capture states" while you hover/open it to record the styles that only exist during interaction.`})},get children(){var t=o2();return t.firstChild,P(t,j(We,{get each(){return e()},children:e=>{let t=()=>n()===e.id;return(()=>{var n=d2(),a=n.firstChild,o=a.nextSibling,s=o.firstChild,c=s.firstChild,l=c.nextSibling,d=l.firstChild,f=d.nextSibling;f.nextSibling;var p=l.nextSibling;return s.$$click=()=>r(t()?null:e.id),P(c,()=>e.genome.title),P(l,()=>e.genome.nodes.length,d),P(l,(()=>{var t=$e(()=>!!e.genome.states.length);return()=>t()?` · ${e.genome.states.length} states`:``})(),f),P(l,()=>Wj(e.genome.extractedAt),null),P(o,j(M,{get when(){return t()},get children(){var t=u2(),n=t.firstChild,r=n.nextSibling,a=r.nextSibling;return P(n,()=>e.genome.pageUrl),P(r,j(We,{get each(){return e.genome.nodes},children:e=>(()=>{var t=p2(),n=t.firstChild;return P(n,()=>e.label,null),P(n,j(M,{get when(){return e.count>1},get children(){var t=f2();return t.firstChild,P(t,()=>e.count,null),t}}),null),P(t,j(We,{get each(){return Object.entries(e.styles)},children:([t,n])=>(()=>{var r=h2(),i=r.firstChild;return P(r,t,i),P(r,n,null),P(r,j(M,{get when(){return e.tokens[t]},get children(){var n=m2(),r=n.firstChild.nextSibling;return r.nextSibling,P(n,()=>e.tokens[t],r),n}}),null),r})()}),null),t})()}),null),P(r,j(M,{get when(){return e.genome.states.length>0},get children(){return[c2(),j(We,{get each(){return e.genome.states},children:e=>(()=>{var t=g2(),n=t.firstChild,r=n.firstChild;return P(n,()=>e.label,r),P(n,()=>e.trigger,null),P(t,j(We,{get each(){return Object.entries(e.changed)},children:([e,t])=>(()=>{var n=_2(),r=n.firstChild,i=r.nextSibling;return i.nextSibling,P(n,e,r),P(n,()=>t.from,i),P(n,()=>t.to,null),n})()}),null),t})()})]}}),null),P(a,j(kj,{class:`h-6 px-2 text-[11px]`,variant:`ghost`,get loading(){return i()===e.id},title:`Record hover/focus/open styles for 8 seconds while you interact`,onClick:()=>void m(e),children:`Capture states`}),null),P(a,j(kj,{class:`h-6 px-2 text-[11px]`,variant:`ghost`,title:`Copy the genome as a markdown spec — paste to an agent or issue`,onClick:()=>void h(e),get children(){var t=l2();return P(t,()=>u()===e.id?`Copied ✓`:`Copy spec`),t}}),null),P(a,j(kj,{class:`text-danger ml-auto h-6 px-2 text-[11px]`,variant:`ghost`,onClick:()=>g(e.id),children:`Delete`}),null),t}}),null),D(e=>{var n={"bg-accent border-accent":t()},r=!!t();return e.e=lt(a,n,e.e),r!==e.t&&p.classList.toggle(`rotate-180`,e.t=r),e},{e:void 0,t:void 0}),n})()}}),null),t}}),null),t})()}rt([`click`]);var w2=[`defaultTeamId`,`defaultProjectId`,`defaultLabelIds`,`defaultRepo`,`workflowMode`,`cursorModel`,`stagingBranch`,`githubAssetsRepo`,`skillPaths`,`logUrl`,`logLines`,`issueTemplate`,`testUsername`];function T2(e){let t={};for(let n of w2){let r=e[n];r!==void 0&&r!==``&&!(Array.isArray(r)&&r.length===0)&&(t[n]=r)}return t}function E2(e,t){let n={};for(let r of w2)e[r]===void 0&&t[r]!==void 0&&(n[r]=t[r]);return Object.keys(n).length?n:null}Br();function D2(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function O2(e){let t=D2(crypto.getRandomValues(new Uint8Array(32))),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t)),r=D2(new Uint8Array(n)),i=D2(crypto.getRandomValues(new Uint8Array(16))),a=chrome.identity.getRedirectURL(),o=new URL(`https://linear.app/oauth/authorize`);o.searchParams.set(`client_id`,e),o.searchParams.set(`redirect_uri`,a),o.searchParams.set(`response_type`,`code`),o.searchParams.set(`scope`,`read,write`),o.searchParams.set(`state`,i),o.searchParams.set(`code_challenge`,r),o.searchParams.set(`code_challenge_method`,`S256`);let s=await chrome.identity.launchWebAuthFlow({url:o.toString(),interactive:!0});if(!s)throw Error(`OAuth flow was cancelled`);let c=new URL(s).searchParams;if(c.get(`state`)!==i)throw Error(`OAuth state mismatch`);let l=c.get(`code`);if(!l)throw Error(c.get(`error_description`)??`No authorization code returned`);let u=await fetch(`https://api.linear.app/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({grant_type:`authorization_code`,code:l,redirect_uri:a,client_id:e,code_verifier:t})}),d=await u.json().catch(()=>null);if(!u.ok||!d?.access_token)throw Error(`Token exchange failed — check the OAuth app callback URL and client id`);await Er({linearAccessToken:d.access_token,linearOauthClientId:e})}async function k2(){await Er({linearAccessToken:void 0,linearApiKey:void 0})}Br(),Sr(),Fx(),gD();var A2=N(`<div class="bg-surface-2 border-border flex rounded-md border p-0.5">`),j2=N(`<span class="text-text-faint text-[10.5px] leading-snug">Cloud: picking an element opens the panel to draft &amp; delegate to the Cursor agent. Local (react-grab style): picking auto-copies the element's context — source, stack, and your skills/memory paths — straight to the clipboard for a local Claude Code or Cursor session; the panel stays out of the way. Both share the same picker; switch anytime.`),M2=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Element screenshots`),N2=N(`<span class="text-text-faint text-[10.5px] leading-snug">Captures a highlighted screenshot of each picked element and attaches it to the issue. Costs a beat on huge pages — with this off, picking is instant (pure react-grab speed).`),P2=N(`<span class=text-text>Connected as <span class=font-medium></span> · <span class=text-text-dim>`),F2=N(`<div class="bg-surface border-border flex items-center justify-between rounded-lg border p-2.5"><span class="text-text text-[12px]">`),I2=N(`<option value>Select a team…`),L2=N(`<option value>No project`),R2=N(`<div class="flex flex-wrap gap-1">`),z2=N(`<label class="flex items-start gap-2"><input type=checkbox class="accent-accent mt-0.5"><span class="flex flex-col gap-0.5"><span class=text-[12px]>Let agents close out Linear themselves</span><span class="text-text-faint text-[10.5px] leading-snug">Embeds your Linear API key + raw GraphQL closeout recipes in every issue's Agent instructions — cloud agent VMs have no authenticated Linear MCP, so without this they can't comment, attach media, or move the issue. The key is visible to anyone who can read the issue.`),B2=N(`<p class="text-text-dim text-[11px]">No agents found — install the Cursor integration in Linear first.`),V2=N(`<span class="text-text-faint text-[10.5px] leading-snug">Empty = the default above (computer-use testing, video demo, PR + review babysitting).`),H2=N(`<div class="flex flex-col gap-1.5">`),U2=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Mode</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">Beside page squeezes the app next to the panel, DevTools-style — nothing gets covered. Also toggleable from the dock icon in the panel header.`),W2=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Dock side</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"></div><span class="text-text-faint text-[10.5px] leading-snug">The launcher pill is draggable — park it anywhere it doesn't cover your app.`),G2=N(`<p class="text-text-faint text-[10.5px] leading-snug">A committed <code>.lineargrab.json</code> at the repo root (where the bridge runs) shares team/project/labels, skills, staging branch, and workflow defaults with every machine and teammate — it seeds any setting you haven't set locally. Secrets never belong in it.`),K2=N(`<span class="inline-block min-w-[10ch] text-center">`),q2=N(`<div class="flex items-center gap-2">`),J2=N(`<option value>Select a channel…`),Y2=N(`<label class="flex cursor-pointer items-center gap-2 select-none"><input type=checkbox class="accent-accent rounded"><span class="text-text text-[12px]">Announce new issues on create`),X2=N(`<span class="text-text-faint text-[10.5px] leading-snug">⚠️ Tokens are embedded in issue Agent-instructions so agents can post the finished demo — everyone who can read the issue can read them. Use single-channel-scoped bots.`),Z2=N(`<div class="flex flex-col gap-1"><span class="text-text-dim text-[11px] font-medium">Provider preference</span><div class="bg-surface-2 border-border flex rounded-md border p-0.5"><button>Auto</button><button>OpenAI</button><button>Anthropic`),Q2=N(`<p class="text-text-dim text-[11px]">`),$2=N(`<div class=min-h-[2lh]>`),e4=N(`<ol class="text-text-faint flex list-decimal flex-col gap-1 pl-4 text-[11px] leading-relaxed"><li>Pick an element on your running dev app.</li><li>Draft the issue (AI optional).</li><li>Create + delegate — Cursor's cloud agent fixes it and opens a PR.</li><li>Track and steer it from Activity.`),t4=N(`<div class="flex h-full flex-col gap-5 overflow-y-auto pt-3 pb-6 pl-3 pr-4">`),n4=N(`<button>`),r4=N(`<div class="flex gap-1.5">`),i4=N(`<p class="text-text-faint text-center text-[10.5px]">or`),a4=N(`<span class="text-text-faint text-[10.5px] leading-snug">Register this callback URL in your Linear OAuth app config:<br><span class="font-mono text-[10.5px] break-all">`),o4=N(`<div class="flex flex-col gap-3">`),s4=N(`<span class=text-text-dim>Connected — verifying…`),c4=N(`<option> (<!>)`),l4=N(`<option>`),u4=N(`<button type=button><span class="mr-1 inline-block size-2 rounded-full align-middle">`),d4=N(`<option value>Select the agent…`),f4=N(`<option>#`),p4=N(`<p class="text-text-dim text-[11px]">No key set — AI drafting disabled, manual drafting still works.`);function m4(){let e=sr(),t=_r(()=>({queryKey:[`settings`],queryFn:Tr,staleTime:0})),n=k(()=>t.data??{});async function r(t,n=!1){await Er(t),await e.invalidateQueries({queryKey:[`settings`]}),n&&(await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]}))}let i=k(()=>!!(n().linearApiKey||n().linearAccessToken)),a=_r(()=>({queryKey:[`viewer`],queryFn:lO,enabled:i(),retry:0})),o=_r(()=>({queryKey:[`teams`],queryFn:uO,enabled:i()})),s=_r(()=>({queryKey:[`linear-projects`],queryFn:bO,enabled:i()})),c=_r(()=>({queryKey:[`bridge-health`],queryFn:MO,retry:0})),[l,u]=T(!1),d=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(T2(n()),null,2)+`
272
+ `),u(!0),setTimeout(()=>u(!1),1800)}catch{}},f=()=>{let e=c.data?.projectConfig;if(!e)return;let t={};for(let n of w2)e[n]!==void 0&&(t[n]=e[n]);r(t)},p=_r(()=>({queryKey:[`linear-labels`],queryFn:xO,enabled:i()})),m=_r(()=>({queryKey:[`agents`],queryFn:dO,enabled:i()})),[h,g]=T(``),[_,v]=T(!1),[y,b]=T(``);async function x(){let e=h().trim();if(e){v(!0),b(``);try{await r({linearApiKey:e},!0),await lO(),g(``)}catch{b(`Key rejected — could not verify. Check the key and try again.`),await r({linearApiKey:void 0},!0)}finally{v(!1)}}}let[S,C]=T(``),[w,E]=T(!1),[O,ee]=T(``);async function te(){let t=(S()||n().linearOauthClientId||``).trim();if(!t){ee(`Enter an OAuth client ID first.`);return}E(!0),ee(``);try{await O2(t),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}catch(e){ee(e instanceof Error?e.message:`OAuth flow failed.`)}finally{E(!1)}}let[A,ne]=T(!1);async function re(){ne(!0);try{await k2(),await e.invalidateQueries({queryKey:[`settings`]}),await e.invalidateQueries({queryKey:[`viewer`]}),await e.invalidateQueries({queryKey:[`teams`]}),await e.invalidateQueries({queryKey:[`agents`]}),await e.invalidateQueries({queryKey:[`my-issues`]})}finally{ne(!1)}}let ie=xr?chrome.identity.getRedirectURL():null,ae=_r(()=>({queryKey:[`slack-channels`,n().slackToken],queryFn:()=>ek(n().slackToken),enabled:!!n().slackToken,retry:0,staleTime:6e4})),oe=k(()=>Ax(n())),se=k(()=>{let e=oe();return e?`Drafting with ${e} — ${Nx[e].fast} (fast) / ${Nx[e].best} (best)`:null});return(()=>{var e=t4();return P(e,j(Rj,{title:`Workflow`,get children(){return[(()=>{var e=A2();return P(e,j(We,{each:[{id:`cloud`,label:`Cloud · Linear + Cursor`},{id:`local`,label:`Local · clipboard`}],children:e=>(()=>{var t=n4();return t.$$click=()=>void r({workflowMode:e.id}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-1 text-[11.5px] font-medium transition-colors ${(n().workflowMode??`cloud`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),j2()]}}),null),P(e,j(Rj,{title:`Capture`,get children(){return[(()=>{var e=M2(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({captureShots:e.currentTarget.checked||void 0})),D(()=>t.checked=!!n().captureShots),e})(),N2()]}}),null),P(e,j(Rj,{title:`Linear`,get children(){return j(M,{get when(){return i()},get fallback(){return(()=>{var e=o4();return P(e,j(Lj,{label:`Personal API key`,hint:`Create one at linear.app → Settings → API — fastest path.`,get children(){return[(()=>{var e=r4();return P(e,j(jj,{type:`password`,placeholder:`lin_api_…`,get value(){return h()},onInput:e=>g(e.currentTarget.value),"on:keydown":e=>{e.key===`Enter`&&x()}}),null),P(e,j(kj,{variant:`primary`,get loading(){return _()},get disabled(){return!h().trim()},onClick:()=>void x(),class:`shrink-0`,children:`Connect`}),null),e})(),j(M,{get when(){return y()},get children(){return j(Hj,{get message(){return y()}})}})]}}),null),P(e,j(M,{when:xr,get children(){return[i4(),j(Lj,{label:`OAuth client ID`,get children(){return[(()=>{var e=r4();return P(e,j(jj,{placeholder:`your-client-id`,get value(){return S()||n().linearOauthClientId||``},onInput:e=>C(e.currentTarget.value)}),null),P(e,j(kj,{variant:`ghost`,get loading(){return w()},onClick:()=>void te(),class:`shrink-0 whitespace-nowrap`,children:`Connect with OAuth`}),null),e})(),j(M,{get when(){return O()},get children(){return j(Hj,{get message(){return O()}})}}),(()=>{var e=a4(),t=e.firstChild.nextSibling.nextSibling;return P(t,ie),e})()]}})]}}),null),e})()},get children(){var e=F2(),t=e.firstChild;return P(t,j(M,{get when(){return!a.isLoading},get fallback(){return s4()},get children(){return j(M,{get when(){return a.data},get fallback(){return j(M,{get when(){return a.isError},get fallback(){return s4()},get children(){return j(Hj,{message:`Key rejected — reconnect`})}})},get children(){var e=P2(),t=e.firstChild.nextSibling,n=t.nextSibling.nextSibling;return P(t,()=>a.data.name),P(n,()=>a.data.email),e}})}})),P(e,j(kj,{variant:`ghost`,get loading(){return A()},onClick:()=>void re(),class:`ml-2 shrink-0`,children:`Disconnect`}),null),e}})}}),null),P(e,j(M,{get when(){return i()},get children(){return j(Rj,{title:`Workspace`,get children(){return[j(Lj,{label:`Default team`,get children(){return j(Nj,{get value(){return n().defaultTeamId??``},onChange:e=>{let t=e.currentTarget.value;r({defaultTeamId:t||void 0})},get disabled(){return o.isLoading},get children(){return[I2(),j(M,{get when(){return o.data},get children(){return j(We,{get each(){return o.data},children:e=>(()=>{var t=c4(),r=t.firstChild,i=r.nextSibling;return i.nextSibling,P(t,()=>e.name,r),P(t,()=>e.key,i),D(()=>t.selected=e.id===n().defaultTeamId),D(()=>t.value=e.id),t})()})}})]}})}}),j(Lj,{label:`Default project`,hint:`Every issue created from the panel is filed into this project.`,get children(){return j(Nj,{get value(){return n().defaultProjectId??``},onChange:e=>void r({defaultProjectId:e.currentTarget.value||void 0}),get disabled(){return s.isLoading},get children(){return[(()=>{var e=L2();return D(()=>e.selected=!n().defaultProjectId),e})(),j(We,{get each(){return s.data??[]},children:e=>(()=>{var t=l4();return P(t,()=>e.name),D(()=>t.selected=e.id===n().defaultProjectId),D(()=>t.value=e.id),t})()})]}})}}),j(Lj,{label:`Default labels`,hint:`Applied to every issue created from the panel.`,get children(){var e=R2();return P(e,j(We,{get each(){return p.data??[]},children:e=>{let t=()=>(n().defaultLabelIds??[]).includes(e.id);return(()=>{var i=u4(),a=i.firstChild;return i.$$click=()=>{let i=n().defaultLabelIds??[];r({defaultLabelIds:t()?i.filter(t=>t!==e.id):[...i,e.id]})},P(i,()=>e.name,null),D(n=>{var r=`h-6 cursor-pointer rounded-full border px-2.5 text-[11px] font-medium transition-colors ${t()?`bg-accent-soft text-accent border-accent/40`:`bg-surface-2 text-text-dim border-border hover:bg-surface-3`}`,o=e.color;return r!==n.e&&st(i,n.e=r),o!==n.t&&dt(a,`background`,n.t=o),n},{e:void 0,t:void 0}),i})()}})),e}}),(()=>{var e=z2(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({shareLinearKey:e.currentTarget.checked})),D(()=>t.checked=!!n().shareLinearKey),e})(),j(Lj,{label:`Staging branch`,hint:`Stage buttons on PRs merge the PR branch here — point your staging domain (e.g. preview.ahmedbanihani.com) at this branch in Vercel.`,get children(){return j(jj,{get value(){return n().stagingBranch??``},placeholder:`staging`,onChange:e=>void r({stagingBranch:e.currentTarget.value.trim()||void 0})})}}),j(Lj,{label:`Cursor agent`,hint:`App users in your workspace. Pick Cursor — requires the Cursor integration installed in Linear (workspace admin) with usage-based pricing enabled in Cursor.`,get children(){return j(M,{get when(){return $e(()=>!!m.data)()&&m.data.length===0},get fallback(){return j(Nj,{get value(){return n().cursorAgentId??``},onChange:e=>{let t=e.currentTarget.value;if(!t){r({cursorAgentId:void 0,cursorAgentName:void 0,cursorAgentUrl:void 0});return}let n=m.data?.find(e=>e.id===t);n&&r({cursorAgentId:n.id,cursorAgentName:n.displayName,cursorAgentUrl:n.url??void 0})},get disabled(){return m.isLoading},get children(){return[d4(),j(M,{get when(){return m.data},get children(){return j(We,{get each(){return m.data},children:e=>(()=>{var t=l4();return P(t,()=>e.displayName),D(()=>t.selected=e.id===n().cursorAgentId),D(()=>t.value=e.id),t})()})}})]}})},get children(){return B2()}})}}),j(Lj,{label:`Default repository`,hint:`Appended to delegated issues as [repo=…] so Cursor picks the right repo.`,get children(){return j(jj,{placeholder:`owner/repository`,get value(){return n().defaultRepo??``},onBlur:e=>{r({defaultRepo:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Cursor cloud model`,hint:`Appended as [model=…] — e.g. claude-opus-4-8, gpt-5.2, composer. Empty = Cursor's default.`,get children(){return j(jj,{placeholder:`Cursor's default`,get value(){return n().cursorModel??``},onBlur:e=>{r({cursorModel:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Agent instructions`,hint:`Appended to every issue as '### Agent instructions' and given to the AI draft. Add demo credentials (username/password) so the agent can log in, test, and record its video. Careful: credentials become visible to everyone who can read the issue.`,get children(){return[j(Mj,{rows:5,placeholder:hD,get value(){return n().issueTemplate??``},onBlur:e=>{r({issueTemplate:e.currentTarget.value.trim()||void 0})}}),V2()]}}),j(Lj,{label:`Dev server log URL`,hint:`Tail of your dev-server log attached to issues (and fed to AI drafts). Serve the log over HTTP: "dev:http": "next dev 2>&1 | tee public/dev-server.log" (gitignore it), then use /dev-server.log here. Empty = disabled.`,get children(){return j(jj,{placeholder:`/dev-server.log`,get value(){return n().logUrl??``},onBlur:e=>{r({logUrl:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Log lines to attach`,hint:`Trailing lines included in the issue (10–500).`,get children(){return j(jj,{type:`number`,min:`10`,max:`500`,placeholder:`100`,get value(){return n().logLines??``},onBlur:e=>{let t=Number(e.currentTarget.value);r({logLines:Number.isFinite(t)&&t>0?Math.min(500,Math.max(10,Math.round(t))):void 0})}})}}),j(Lj,{label:`Skills & memory paths`,hint:`One path per line. The cloud agent works in a full repo checkout, so committed paths (e.g. .claude/skills/apple-hig-design-principles) are readable directly — every issue gets a MANDATORY-reading section pointing at them. Repo-relative for cloud agents; absolute paths also work when you paste the issue into a local Claude Code session. Per project: these settings live per dev origin.`,get children(){return j(Mj,{rows:4,placeholder:`.claude/skills/apple-hig-design-principles
272
273
  .claude/CLAUDE.md
273
- docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Test account`,hint:`The cloud agent logs into the app with this while testing and recording its demo. Added to every issue's Agent instructions. Use a throwaway account — it's visible to everyone who can read the issue.`,get children(){var e=a2();return P(e,j(jj,{placeholder:`Username or email (e.g. demo@yourapp.com)`,get value(){return n().testUsername??``},onBlur:e=>{r({testUsername:e.currentTarget.value.trim()||void 0})}}),null),P(e,j(jj,{type:`password`,placeholder:`Password`,get value(){return n().testPassword??``},onBlur:e=>{r({testPassword:e.currentTarget.value.trim()||void 0})}}),null),e}})]}})}}),null),P(e,j(M,{when:!xr,get children(){return j(Rj,{title:`Panel`,get children(){return[(()=>{var e=o2(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=y2();return t.$$click=()=>void r({panelMode:e.id,panelPos:void 0}),P(t,()=>e.label),E(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelMode??`overlay`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),(()=>{var e=s2(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[`left`,`right`],children:e=>(()=>{var t=y2();return t.$$click=()=>void r({panelSide:e}),P(t,e===`left`?`Left`:`Right`),E(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelSide??`right`)===e?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})()]}})}}),null),P(e,j(Rj,{title:`Local Claude Code`,get children(){return j(Lj,{label:`Bridge URL`,hint:'Run `npx linear-grab-bridge` in your repo\'s terminal (binds localhost only). Enables "Delegate to → Local Claude Code" in Draft, the Local tab, and relays blocked uploads to Linear storage.',get children(){return j(jj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Rj,{title:`Project config (.lineargrab.json)`,get children(){return[c2(),(()=>{var e=u2();return P(e,j(M,{get when(){return c.data?.projectConfig},get fallback(){return j(zj,{title:`No .lineargrab.json found at the bridge's cwd (or bridge offline / outdated)`,children:`not detected`})},get children(){return[j(zj,{class:`text-success`,children:`detected`}),j(kj,{variant:`ghost`,class:`h-7 px-2 text-[11px]`,title:`Overwrite your local settings with every value from the repo's config`,onClick:f,children:`Apply all`})]}}),null),P(e,j(kj,{variant:`ghost`,class:`h-7 px-2 text-[11px]`,get title(){return l()?`Copied!`:`Copy your current shareable settings as .lineargrab.json — commit it to the repo root`},onClick:()=>void d(),get children(){var e=l2();return P(e,()=>l()?`Copied ✓`:`Copy config`),e}}),null),e})()]}}),null),P(e,j(Rj,{title:`Asset uploads`,get children(){return[j(Lj,{label:`GitHub token`,hint:`Linear's storage blocks browser uploads in some browsers (Safari). With this set, GIFs/screenshots upload to your GitHub repo instead and embed automatically. Fine-grained PAT with Contents read/write on the assets repo.`,get children(){return j(jj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Assets repository`,hint:`owner/repo — must be PUBLIC so Linear (and agents) can render the images. Files land under linear-grab/.`,get children(){return j(jj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Rj,{title:`Notifications`,get children(){return[j(Lj,{label:`Slack bot token`,hint:`Bot token (xoxb-…) with chat:write + channels:read + files:write. New issues get announced with links + demo, and the AGENT receives the token to post its finished demo video itself.`,get children(){return j(jj,{type:`password`,placeholder:`xoxb-…`,get value(){return n().slackToken??``},onBlur:e=>{r({slackToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().slackToken},get children(){return j(Lj,{label:`Slack channel`,get children(){return j(M,{get when(){return!ae.isError},get fallback(){return j(Hj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Nj,{get value(){return n().slackChannelId??``},get disabled(){return ae.isLoading},onChange:e=>{let t=e.currentTarget.value,n=ae.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[d2(),j(We,{get each(){return ae.data??[]},children:e=>(()=>{var t=k2();return t.firstChild,P(t,()=>e.name,null),E(()=>t.selected=e.id===n().slackChannelId),E(()=>t.value=e.id),t})()})]}})}})}})}}),j(Lj,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(jj,{type:`password`,placeholder:`123456:ABC-…`,get value(){return n().telegramToken??``},onBlur:e=>{r({telegramToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().telegramToken},get children(){return j(Lj,{label:`Telegram chat ID`,hint:`Add the bot to your group/channel, send a message, then read the chat id from api.telegram.org/bot<token>/getUpdates.`,get children(){return j(jj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=f2(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),E(()=>t.checked=n().notifyOnCreate!==!1),e})(),p2()]}}),null),P(e,j(Rj,{title:`AI providers`,get children(){return[j(Lj,{label:`OpenAI API key`,get children(){return j(jj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Anthropic API key`,get children(){return j(jj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=m2(),t=e.firstChild.nextSibling.firstChild,i=t.nextSibling,a=i.nextSibling;return t.$$click=()=>void r({preferredProvider:void 0}),i.$$click=()=>void r({preferredProvider:`openai`}),a.$$click=()=>void r({preferredProvider:`anthropic`}),E(e=>{var r=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${n().preferredProvider===void 0?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`,o=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`openai`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,s=!n().openaiKey,c=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`anthropic`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,l=!n().anthropicKey;return r!==e.e&&st(t,e.e=r),o!==e.t&&st(i,e.t=o),s!==e.a&&(i.disabled=e.a=s),c!==e.o&&st(a,e.o=c),l!==e.i&&(a.disabled=e.i=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=g2();return P(e,j(M,{get when(){return se()},get fallback(){return A2()},get children(){var e=h2();return P(e,se),e}})),e})()]}}),null),P(e,j(Rj,{title:`How it works`,get children(){return _2()}}),null),e})()}rt([`click`]);var M2=`linear-grab`,N2=`queries`,P2=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function F2(){return new Promise(e=>{try{let t=indexedDB.open(M2,1);t.onupgradeneeded=()=>t.result.createObjectStore(N2),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function I2(e){return typeof e[0]==`string`&&P2.includes(e[0])}async function L2(e){let t=await F2();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(N2,`readonly`).objectStore(N2).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;I2(n)&&e.getQueryData(n)===void 0&&e.setQueryData(n,r,{updatedAt:0})}catch{}t.continue()},r.onerror=()=>n()}catch{n()}});let n=new Map,r=e.getQueryCache().subscribe(r=>{if(r.type!==`updated`||r.action.type!==`success`)return;let{queryKey:i,queryHash:a}=r.query;if(!I2(i))return;let o=n.get(a);o&&clearTimeout(o),n.set(a,setTimeout(()=>{n.delete(a);try{let n=e.getQueryData(i);if(n===void 0)return;t.transaction(N2,`readwrite`).objectStore(N2).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Br();var R2=N(`<svg viewBox="0 0 100 100"fill=currentColor aria-hidden><path d="M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3541-.0443L12.6587 18.074Z">`),z2=N(`<button><svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><rect x=1.5 y=2.5 width=13 height=11 rx=1.5></rect><path d="M10 2.5v11">`),B2=N(`<button aria-label="Minimize to launcher"title="Minimize to launcher"class="text-text-dim hover:text-text hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-[15px] leading-none transition-colors">–`),V2=N(`<div class="bg-bg text-text flex h-full flex-col"><header><span class="text-accent mr-0.5 inline-flex shrink-0"title="Linear Grab"></span><div class="no-scrollbar flex min-w-0 flex-1 items-center gap-1 overflow-x-auto"></div></header><main class="min-h-0 flex-1"><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full>`),H2=N(`<button>`),U2=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`running`,label:`Running`},{id:`cloud`,label:`Cloud`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`settings`,label:`Settings`}],W2=new Set;function G2(e,t,n){if(W2.has(e)||typeof Notification>`u`)return;W2.add(e);let r=()=>new Notification(t,{body:n});Notification.permission===`granted`?r():Notification.permission==="default"&&Notification.requestPermission().then(e=>e===`granted`&&r())}function K2(){setInterval(()=>{NO().then(e=>{for(let t of e){if(t.status!==`running`)continue;let e=t.lastEventAt??t.startedAt;Date.now()-e>10*6e4&&G2(`local-stuck:${t.id}:${e}`,`Local agent may be stuck`,`${t.title.slice(0,80)} — no output for ${Math.round((Date.now()-e)/6e4)}m. Nudge or interrupt it in the Local tab.`)}}).catch(()=>{}),gO().then(e=>{for(let t of e)/awaitingInput|elicit/i.test(t.status)&&G2(`cloud-input:${t.id}`,`Cloud agent needs input`,`${t.issue?.identifier??`Session`} — ${t.issue?.title?.slice(0,80)??`a Cursor agent`} is waiting for you.`)}).catch(()=>{})},6e4)}K2();var q2=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function J2(e){return(()=>{var t=R2();return E(n=>{var r=e.size??14,i=e.size??14;return r!==n.e&&it(t,`width`,n.e=r),i!==n.t&&it(t,`height`,n.t=i),n},{e:void 0,t:void 0}),t})()}function Y2(e){let[t,n]=T(`draft`),r=()=>{q2.invalidateQueries({queryKey:[`grab`]}),cj()===`capture`&&n(`capture`),e.onGrab?.()};return D(()=>{let e=nj();e&&n(e)}),ie(()=>{let e=L2(q2),t=XZ(r),n=()=>{JO().then(y$),VO(),MO().then(async e=>{if(!e.projectConfig)return;let t=U0(await Tr(),e.projectConfig);t&&await Er(t)}).catch(()=>{})};n();let i=Mr(e=>{e===`settings`&&(q2.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:q2,get children(){var r=V2(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling.firstChild,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling,m=p.nextSibling;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(J2,{size:14})),P(o,j(We,{each:U2,children:e=>(()=>{var r=H2();return r.$$click=()=>n(e.id),P(r,()=>e.label),E(()=>st(r,`h-6 shrink-0 rounded-md px-2 text-[12px] font-medium whitespace-nowrap transition-colors ${t()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),r})()})),P(i,j(M,{get when(){return e.onTogglePin},get children(){var t=z2();return t.$$click=()=>e.onTogglePin?.(),E(n=>{var r=e.pinned?`Switch to overlay`:`Dock beside page`,i=e.pinned?`Overlay the page`:`Dock beside page (squeezes the app, DevTools-style)`,a=`hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md transition-colors ${e.pinned?`text-accent`:`text-text-dim hover:text-text`}`;return r!==n.e&&it(t,`aria-label`,n.e=r),i!==n.t&&it(t,`title`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),null),P(i,j(M,{get when(){return e.onClose},get children(){var t=B2();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(wM,{onCreated:()=>n(`activity`)})),P(c,j(TQ,{})),P(l,j(_1,{})),P(u,j(B1,{})),P(d,j(P1,{})),P(f,j(T0,{})),P(p,j(B0,{onOpenIssue:()=>n(`activity`)})),P(m,j(j2,{})),E(n=>{var r=`border-border bg-surface flex shrink-0 items-center gap-1 border-b px-2 py-1.5 select-none ${e.onHeaderPointerDown?`cursor-grab active:cursor-grabbing`:``}`,a=t()!==`draft`,o=t()!==`capture`,h=t()!==`activity`,g=t()!==`running`,_=t()!==`cloud`,v=t()!==`local`,y=t()!==`prs`,b=t()!==`settings`;return r!==n.e&&st(i,n.e=r),a!==n.t&&s.classList.toggle(`hidden`,n.t=a),o!==n.a&&c.classList.toggle(`hidden`,n.a=o),h!==n.o&&l.classList.toggle(`hidden`,n.o=h),g!==n.i&&u.classList.toggle(`hidden`,n.i=g),_!==n.n&&d.classList.toggle(`hidden`,n.n=_),v!==n.s&&f.classList.toggle(`hidden`,n.s=v),y!==n.h&&p.classList.toggle(`hidden`,n.h=y),b!==n.r&&m.classList.toggle(`hidden`,n.r=b),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),r}})}rt([`pointerdown`,`click`]);var X2=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
274
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, "SF Mono", Menlo, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-white:#fff;--spacing:.25rem;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:6px;--radius-lg:10px;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#0b0c0e;--color-surface:#141517;--color-surface-2:#1c1d21;--color-surface-3:#24262b;--color-border:#26282d;--color-border-strong:#34363d;--color-text:#e8e9eb;--color-text-dim:#8b8e98;--color-text-faint:#5c5f6a;--color-accent:#5e6ad2;--color-accent-hover:#6e79e0;--color-accent-soft:#5e6ad226;--color-success:#4cb782;--color-warn:#f2c94c;--color-danger:#eb5757;--color-danger-soft:#eb575726}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\\/2{top:50%}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:0}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-4{right:calc(var(--spacing) * 4)}.right-full{right:100%}.bottom-0{bottom:0}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:var(--spacing)}.left-1\\/2{left:50%}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.z-\\[2147483645\\]{z-index:2147483645}.z-\\[2147483646\\]{z-index:2147483646}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-m-0{margin:0}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:0}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1{margin-block:calc(var(--spacing) * -1)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.mt-0{margin-top:0}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-px{margin-top:1px}.mr-0{margin-right:0}.mr-0\\.5{margin-right:calc(var(--spacing) * .5)}.mr-1{margin-right:var(--spacing)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-0{margin-bottom:0}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-0{width:0;height:0}.size-1{width:var(--spacing);height:var(--spacing)}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[18px\\]{height:18px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-44{max-height:calc(var(--spacing) * 44)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:0}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[2lh\\]{min-height:2lh}.min-h-\\[28px\\]{min-height:28px}.w-1{width:var(--spacing)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-16{width:calc(var(--spacing) * 16)}.w-28{width:calc(var(--spacing) * 28)}.w-72{width:calc(var(--spacing) * 72)}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[55\\%\\]{max-width:55%}.max-w-\\[100vw\\]{max-width:100vw}.max-w-\\[110px\\]{max-width:110px}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-\\[3\\.5ch\\]{min-width:3.5ch}.min-w-\\[4ch\\]{min-width:4ch}.min-w-\\[5ch\\]{min-width:5ch}.min-w-\\[6ch\\]{min-width:6ch}.min-w-\\[8ch\\]{min-width:8ch}.min-w-\\[10ch\\]{min-width:10ch}.min-w-\\[12ch\\]{min-width:12ch}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[52px\\]{min-width:52px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-decimal{list-style-type:decimal}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-\\[5px\\]{gap:5px}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-accent{border-color:var(--color-accent)}.border-accent\\/40{border-color:#5e6ad266}@supports (color:color-mix(in lab, red, red)){.border-accent\\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-border{border-color:var(--color-border)}.border-success{border-color:var(--color-success)}.border-success\\/40{border-color:#4cb78266}@supports (color:color-mix(in lab, red, red)){.border-success\\/40{border-color:color-mix(in oklab, var(--color-success) 40%, transparent)}}.border-text-dim{border-color:var(--color-text-dim)}.border-transparent{border-color:#0000}.border-warn{border-color:var(--color-warn)}.border-warn\\/40{border-color:#f2c94c66}@supports (color:color-mix(in lab, red, red)){.border-warn\\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.border-t-transparent{border-top-color:#0000}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-accent{background-color:var(--color-accent)}.bg-accent-soft{background-color:var(--color-accent-soft)}.bg-bg{background-color:var(--color-bg)}.bg-bg\\/80{background-color:#0b0c0ecc}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--color-danger)}.bg-danger-soft{background-color:var(--color-danger-soft)}.bg-red-500{background-color:var(--color-red-500)}.bg-success{background-color:var(--color-success)}.bg-surface{background-color:var(--color-surface)}.bg-surface-2{background-color:var(--color-surface-2)}.bg-surface-3{background-color:var(--color-surface-3)}.bg-text-faint{background-color:var(--color-text-faint)}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-px{padding-block:1px}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-1\\.5{padding-right:calc(var(--spacing) * 1.5)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-0{padding-left:0}.pl-0\\.5{padding-left:calc(var(--spacing) * .5)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-2\\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-end{text-align:end}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.text-start{text-align:start}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9\\.5px\\]{font-size:9.5px}.text-\\[9px\\]{font-size:9px}.text-\\[10\\.5px\\]{font-size:10.5px}.text-\\[10px\\]{font-size:10px}.text-\\[11\\.5px\\]{font-size:11.5px}.text-\\[11px\\]{font-size:11px}.text-\\[12\\.5px\\]{font-size:12.5px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.leading-3{--tw-leading:calc(var(--spacing) * 3);line-height:calc(var(--spacing) * 3)}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.text-accent{color:var(--color-accent)}.text-danger{color:var(--color-danger)}.text-success{color:var(--color-success)}.text-text{color:var(--color-text)}.text-text-dim{color:var(--color-text-dim)}.text-text-faint{color:var(--color-text-faint)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}.group-open\\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-text-faint::placeholder{color:var(--color-text-faint)}@media (hover:hover){.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:bg-accent-hover:hover{background-color:var(--color-accent-hover)}.hover\\:bg-accent\\/50:hover{background-color:#5e6ad280}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\\:bg-danger\\/30:hover{background-color:#eb57574d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-danger\\/30:hover{background-color:color-mix(in oklab, var(--color-danger) 30%, transparent)}}.hover\\:bg-surface-2:hover{background-color:var(--color-surface-2)}.hover\\:bg-surface-3:hover{background-color:var(--color-surface-3)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}.hover\\:text-accent:hover{color:var(--color-accent)}.hover\\:text-danger:hover{color:var(--color-danger)}.hover\\:text-text:hover{color:var(--color-text)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-80:hover{opacity:.8}}.focus\\:border-accent:focus{border-color:var(--color-accent)}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-accent:active{background-color:var(--color-accent)}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-surface-3:disabled{background-color:var(--color-surface-3)}.disabled\\:text-text-faint:disabled{color:var(--color-text-faint)}.disabled\\:opacity-40:disabled{opacity:.4}@media (hover:hover){.disabled\\:hover\\:bg-surface-2:disabled:hover{background-color:var(--color-surface-2)}}}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}[data-theme=light],:host([data-theme=light]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:light){:root:not([data-theme=dark]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}}body{background-color:var(--color-bg);font-family:var(--font-sans);color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:320px;margin:0;font-size:13px}@keyframes geist-spinner-fade{0%{opacity:1}to{opacity:.15}}[data-tip]{position:relative}[data-tip]:hover:after{content:attr(data-tip);color:#fff;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;z-index:60;background:#1b1c20;border-radius:6px;max-width:260px;padding:3px 8px;font-size:10.5px;font-weight:500;line-height:1.35;position:absolute;bottom:calc(100% + 6px);left:50%;overflow:hidden;transform:translate(-50%);box-shadow:0 4px 12px #0000004d}[data-tip][data-tip-pos~=right]:hover:after{left:0;transform:none}[data-tip][data-tip-pos~=left]:hover:after{left:auto;right:0;transform:none}[data-tip][data-tip-pos~=bottom]:hover:after{top:calc(100% + 6px);bottom:auto}.no-scrollbar{scrollbar-width:none}.no-scrollbar::-webkit-scrollbar{display:none}.lg-md p{margin:0 0 6px}.lg-md p:last-child{margin-bottom:0}.lg-md a{color:var(--color-accent);word-break:break-all;text-decoration:none}.lg-md a:hover{text-decoration:underline}.lg-md code{background:var(--color-surface-2);border:1px solid var(--color-border);font-family:var(--font-mono);border-radius:4px;padding:0 4px;font-size:11px}.lg-md pre{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:6px;margin:6px 0;padding:8px;overflow-x:auto}.lg-md pre code{white-space:pre;background:0 0;border:none;padding:0;font-size:11px}.lg-md ul,.lg-md ol{flex-direction:column;gap:2px;margin:4px 0 6px;padding-left:18px;display:flex}.lg-md ul{list-style:outside}.lg-md ol{list-style:decimal}.lg-md h4{margin:8px 0 4px;font-size:12px;font-weight:600}.lg-md lg-media{display:block}.lg-md lg-media img,.lg-md lg-media video{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md video{border:1px solid var(--color-border);background:#000;border-radius:6px;max-width:100%;margin:4px 0}.lg-md img{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md strong{font-weight:600}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--color-border-strong);border-radius:4px}::-webkit-scrollbar-track{background:0 0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;Br();var Z2=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),Q2=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),$2=N(`<button class="bg-accent hover:bg-accent-hover h-7 cursor-pointer rounded-full px-2.5 text-[11px] font-medium text-white transition-colors"><span class="inline-block min-w-[4ch] text-center">Stop`),e4=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),t4=N(`<div><p class="text-text-dim px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Running agents`),n4=N(`<div class="fixed z-[2147483646] select-none"><div class="bg-surface border-border text-text flex h-9 cursor-grab items-center gap-1 rounded-full border py-1 pr-1 pl-2.5 font-sans shadow-lg active:cursor-grabbing">`),r4=N(`<div><div title="Drag to resize">`),i4=N(`<button title="Open Linear Grab"aria-label="Open Linear Grab"class="text-accent hover:opacity-80 inline-flex cursor-pointer items-center gap-1.5">`),a4=N(`<span class="bg-border h-4 w-px"aria-hidden>`),o4=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),s4=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),c4=N(`<button title="Running agents"aria-label="Running agents"class="hover:bg-surface-2 flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 transition-colors"><span aria-hidden></span><span>`),l4=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),u4=N(`<button class="hover:bg-surface-2 flex w-full cursor-pointer flex-col gap-0.5 rounded-md px-1.5 py-1.5 text-left transition-colors"><span class="flex min-w-0 items-center gap-1.5"><span aria-hidden class="size-1.5 shrink-0 rounded-full"></span><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><span class="text-text truncate text-[11.5px]"></span></span><span class="text-text-faint pl-3 text-[10.5px] tabular-nums"> · <!> · `);function d4(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{lk(),JZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=e=>{let n=e.composedPath();if(!n.includes(t))return;e.stopImmediatePropagation();let r=n[0];e instanceof KeyboardEvent&&r&&r!==t&&r.dispatchEvent(new KeyboardEvent(e.type,{key:e.key,code:e.code,location:e.location,repeat:e.repeat,isComposing:e.isComposing,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:!1,cancelable:!1}))};for(let e of[`keydown`,`keyup`,`keypress`])window.addEventListener(e,n,{capture:!0});let r=t.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=X2,r.appendChild(i);let a=document.createElement(`div`);r.appendChild(a);let o=()=>a.setAttribute(`data-theme`,f4());o(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,o),nt(()=>j(v4,{get defaultOpen(){return e.defaultOpen??!1}}),a)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function f4(){try{let e=[document.body,document.documentElement];for(let t of e){let e=getComputedStyle(t).backgroundColor.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+))?/);if(!(!e||e[4]!==void 0&&Number(e[4])===0))return .2126*e[1]+.7152*e[2]+.0722*e[3]>140?`light`:`dark`}}catch{}return matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}var p4=130,m4=36,h4=380,g4=280,_4=720;function v4(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-p4-24),y:Math.max(8,window.innerHeight-m4-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(HD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(HD().startedAt??Date.now()))},250);ae(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=T(null),b=e=>({x:Math.min(Math.max(8,e.x),window.innerWidth-p4-8),y:Math.min(Math.max(8,e.y),window.innerHeight-m4-8)}),x=e=>({x:Math.min(Math.max(8-(k()-80),e.x),window.innerWidth-80),y:Math.min(Math.max(0,e.y),window.innerHeight-80)}),[S,C]=T(!1),[w,ee]=T(`cloud`),[O,te]=T(!1),[k,A]=T(h4),ne=e=>Math.min(_4,Math.max(g4,Math.min(e,window.innerWidth-60)));D(()=>{let e=document.documentElement,n=t()&&S();e.style.transition=`margin 0.2s ease`,e.style.marginRight=n&&r()===`right`?`${k()}px`:``,e.style.marginLeft=n&&r()===`left`?`${k()}px`:``}),ae(()=>{document.documentElement.style.marginRight=``,document.documentElement.style.marginLeft=``});let re=()=>{let e=!S();C(e),e&&y(null),Er({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Tr().then(e=>{e.panelSide&&i(e.panelSide),e.launcherPos&&o(b(e.launcherPos)),e.panelPos&&y(x(e.panelPos)),e.panelWidth&&A(ne(e.panelWidth)),C(e.panelMode===`pinned`),ee(e.workflowMode??`cloud`)});let e=Mr(e=>{e===`settings`&&Tr().then(e=>{i(e.panelSide??`right`),C(e.panelMode===`pinned`),ee(e.workflowMode??`cloud`)}),e===`grab`&&w()!==`local`&&n(!0)}),t=()=>{te(!0),setTimeout(()=>te(!1),1600)};window.addEventListener(zZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(BZ,r);let s=()=>n(!0);window.addEventListener(`linear-grab:picker-finished`,s),ae(()=>{window.removeEventListener(zZ,t),window.removeEventListener(BZ,r),window.removeEventListener(`linear-grab:picker-finished`,s)});let l=e$(c),u=HD().phase,d=UD(e=>{m(e.phase),e.phase===`recording`&&u!==`recording`&&!S()&&n(!1),e.phase===`ready`&&u!==`ready`&&(oj(`capture`),n(!0)),u=e.phase}),p=()=>{o(b(a()));let e=v();e&&y(x(e))};window.addEventListener(`resize`,p),ae(()=>{e(),l(),d(),window.removeEventListener(`resize`,p)})});let oe=!1,se=e=>{if(e.button!==0)return;let t={x:e.clientX,y:e.clientY},n=a();oe=!1;let r=e=>{let r=e.clientX-t.x,i=e.clientY-t.y;Math.abs(r)+Math.abs(i)>4&&(oe=!0),oe&&o(b({x:n.x+r,y:n.y+i}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),oe&&Er({launcherPos:a()}),setTimeout(()=>{oe=!1},0)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),oj(`activity`,e),n(!0)},ue=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=e.clientX,n=k(),i=v(),a=e=>{let a=e.clientX-t,o=r()===`right`?-a:a,s=ne(n+o);A(s),i&&r()===`right`&&y(x({x:i.x+(n-s),y:i.y}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),Er({panelWidth:k(),...v()?{panelPos:v()}:{}})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},de=e=>{if(e.button!==0)return;if(e.detail===2){y(null),Er({panelPos:void 0});return}let t={x:e.clientX,y:e.clientY},n=v()??{x:r()===`right`?window.innerWidth-k():0,y:0},i=!1,a=e=>{let r=e.clientX-t.x,a=e.clientY-t.y;Math.abs(r)+Math.abs(a)>4&&(i=!0),i&&y(x({x:n.x+r,y:n.y+a}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o);let e=v();i&&e&&Er({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=n4(),t=e.firstChild;return t.$$click=()=>{oe||p()===`recording`||(f(!1),n(!0))},t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=i4();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(J2,{size:13})),e})(),a4(),(()=>{var e=c4(),t=e.firstChild,n=t.nextSibling;return e.$$click=e=>{e.stopPropagation(),!oe&&f(e=>!e)},P(n,(()=>{var e=$e(()=>!!O());return()=>e()?`Copied ✓`:`${l().length} run`})()),P(e,j(M,{get when(){return $e(()=>!O())()&&u().length>0},get children(){return[o4(),(()=>{var e=s4(),t=e.firstChild;return P(e,()=>u().length,t),e})()]}}),null),E(e=>{var r=`size-2 rounded-full ${O()?`bg-success`:l().length?`bg-success animate-pulse`:`bg-text-faint`}`,i=`min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums ${O()?`text-success`:`text-text-dim`}`;return r!==e.e&&st(t,e.e=r),i!==e.t&&st(n,e.t=i),e},{e:void 0,t:void 0}),e})()]},get children(){return[Z2(),(()=>{var e=Q2();return P(e,()=>_(h())),e})(),(()=>{var e=$2();return e.$$click=()=>{oe||eO()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=t4(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[e4(),j(We,{get each(){return u()},children:e=>j(y4,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return l4()},get children(){return j(We,{get each(){return l()},children:e=>j(y4,{agent:e,onOpen:le})})}}),null),E(()=>st(e,`bg-surface border-border absolute w-72 rounded-lg border p-1.5 font-sans shadow-2xl ${ce()?`bottom-full mb-2`:`top-full mt-2`} ${a().x>window.innerWidth-300?`right-0`:`left-0`}`)),e}}),null),E(t=>{var n=`${a().x}px`,r=`${a().y}px`;return n!==t.e&&dt(e,`left`,t.e=n),r!==t.t&&dt(e,`top`,t.t=r),t},{e:void 0,t:void 0}),e}}),j(M,{get when(){return t()},get children(){var e=r4(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(Y2,{onGrab:()=>n(!0),onClose:()=>n(!1),get onHeaderPointerDown(){return S()?void 0:de},get pinned(){return S()},onTogglePin:re}),null),E(n=>{var i=`bg-bg text-text border-border fixed z-[2147483645] flex max-w-[100vw] flex-col overflow-hidden font-sans text-[13px] antialiased ${S()?``:`shadow-2xl`} ${!S()&&v()?`rounded-xl border`:r()===`right`?`top-0 right-0 h-screen border-l`:`top-0 left-0 h-screen border-r`}`,a={width:`${k()}px`,...!S()&&v()?{left:`${v().x}px`,top:`${v().y}px`,height:`${Math.min(680,window.innerHeight-16)}px`}:{}},o=`hover:bg-accent/50 active:bg-accent absolute top-0 z-10 h-full w-1 cursor-col-resize transition-colors ${r()===`right`?`left-0`:`right-0`}`;return i!==n.e&&st(e,n.e=i),n.t=ut(e,a,n.t),o!==n.a&&st(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}})]}function y4(e){return(()=>{var t=u4(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=n.nextSibling,s=o.firstChild,c=s.nextSibling;return c.nextSibling,t.$$click=()=>e.onOpen(e.agent.id),P(i,()=>e.agent.identifier),P(a,()=>e.agent.title),P(o,(()=>{var t=$e(()=>!!e.review);return()=>t()?`PR ready · needs review`:e.agent.stateName})(),s),P(o,()=>e.agent.delegateName,c),P(o,()=>b4(e.agent.updatedAt),null),E(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function b4(e){let t=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}rt([`pointerdown`,`click`]),d4()})();
274
+ docs/design-tokens.md`,get value(){return n().skillPaths??``},onBlur:e=>{r({skillPaths:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Test account`,hint:`The cloud agent logs into the app with this while testing and recording its demo. Added to every issue's Agent instructions. Use a throwaway account — it's visible to everyone who can read the issue.`,get children(){var e=H2();return P(e,j(jj,{placeholder:`Username or email (e.g. demo@yourapp.com)`,get value(){return n().testUsername??``},onBlur:e=>{r({testUsername:e.currentTarget.value.trim()||void 0})}}),null),P(e,j(jj,{type:`password`,placeholder:`Password`,get value(){return n().testPassword??``},onBlur:e=>{r({testPassword:e.currentTarget.value.trim()||void 0})}}),null),e}})]}})}}),null),P(e,j(M,{when:!xr,get children(){return j(Rj,{title:`Panel`,get children(){return[(()=>{var e=U2(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[{id:`overlay`,label:`Overlay`},{id:`pinned`,label:`Beside page`}],children:e=>(()=>{var t=n4();return t.$$click=()=>void r({panelMode:e.id,panelPos:void 0}),P(t,()=>e.label),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelMode??`overlay`)===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})(),(()=>{var e=W2(),t=e.firstChild.nextSibling;return P(t,j(We,{each:[`left`,`right`],children:e=>(()=>{var t=n4();return t.$$click=()=>void r({panelSide:e}),P(t,e===`left`?`Left`:`Right`),D(()=>st(t,`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${(n().panelSide??`right`)===e?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),t})()})),e})()]}})}}),null),P(e,j(Rj,{title:`Local Claude Code`,get children(){return j(Lj,{label:`Bridge URL`,hint:'Run `npx linear-grab-bridge` in your repo\'s terminal (binds localhost only). Enables "Delegate to → Local Claude Code" in Draft, the Local tab, and relays blocked uploads to Linear storage.',get children(){return j(jj,{placeholder:`http://localhost:4577`,get value(){return n().bridgeUrl??``},onBlur:e=>{r({bridgeUrl:e.currentTarget.value.trim()||void 0})}})}})}}),null),P(e,j(Rj,{title:`Project config (.lineargrab.json)`,get children(){return[G2(),(()=>{var e=q2();return P(e,j(M,{get when(){return c.data?.projectConfig},get fallback(){return j(zj,{title:`No .lineargrab.json found at the bridge's cwd (or bridge offline / outdated)`,children:`not detected`})},get children(){return[j(zj,{class:`text-success`,children:`detected`}),j(kj,{variant:`ghost`,class:`h-7 px-2 text-[11px]`,title:`Overwrite your local settings with every value from the repo's config`,onClick:f,children:`Apply all`})]}}),null),P(e,j(kj,{variant:`ghost`,class:`h-7 px-2 text-[11px]`,get title(){return l()?`Copied!`:`Copy your current shareable settings as .lineargrab.json — commit it to the repo root`},onClick:()=>void d(),get children(){var e=K2();return P(e,()=>l()?`Copied ✓`:`Copy config`),e}}),null),e})()]}}),null),P(e,j(Rj,{title:`Asset uploads`,get children(){return[j(Lj,{label:`GitHub token`,hint:`Linear's storage blocks browser uploads in some browsers (Safari). With this set, GIFs/screenshots upload to your GitHub repo instead and embed automatically. Fine-grained PAT with Contents read/write on the assets repo.`,get children(){return j(jj,{type:`password`,placeholder:`github_pat_…`,get value(){return n().githubToken??``},onBlur:e=>{r({githubToken:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Assets repository`,hint:`owner/repo — must be PUBLIC so Linear (and agents) can render the images. Files land under linear-grab/.`,get children(){return j(jj,{placeholder:`ahmedbanihanibh/linear-grab-assets`,get value(){return n().githubAssetsRepo??``},onBlur:e=>{r({githubAssetsRepo:e.currentTarget.value.trim()||void 0})}})}})]}}),null),P(e,j(Rj,{title:`Notifications`,get children(){return[j(Lj,{label:`Slack bot token`,hint:`Bot token (xoxb-…) with chat:write + channels:read + files:write. New issues get announced with links + demo, and the AGENT receives the token to post its finished demo video itself.`,get children(){return j(jj,{type:`password`,placeholder:`xoxb-…`,get value(){return n().slackToken??``},onBlur:e=>{r({slackToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().slackToken},get children(){return j(Lj,{label:`Slack channel`,get children(){return j(M,{get when(){return!ae.isError},get fallback(){return j(Hj,{message:`Couldn't list channels — check the token scopes (channels:read).`})},get children(){return j(Nj,{get value(){return n().slackChannelId??``},get disabled(){return ae.isLoading},onChange:e=>{let t=e.currentTarget.value,n=ae.data?.find(e=>e.id===t);r({slackChannelId:t||void 0,slackChannelName:n?.name})},get children(){return[J2(),j(We,{get each(){return ae.data??[]},children:e=>(()=>{var t=f4();return t.firstChild,P(t,()=>e.name,null),D(()=>t.selected=e.id===n().slackChannelId),D(()=>t.value=e.id),t})()})]}})}})}})}}),j(Lj,{label:`Telegram bot token`,hint:`From @BotFather. The agent also receives it to send the demo video (sendVideo).`,get children(){return j(jj,{type:`password`,placeholder:`123456:ABC-…`,get value(){return n().telegramToken??``},onBlur:e=>{r({telegramToken:e.currentTarget.value.trim()||void 0})}})}}),j(M,{get when(){return n().telegramToken},get children(){return j(Lj,{label:`Telegram chat ID`,hint:`Add the bot to your group/channel, send a message, then read the chat id from api.telegram.org/bot<token>/getUpdates.`,get children(){return j(jj,{placeholder:`-1001234567890`,get value(){return n().telegramChatId??``},onBlur:e=>{r({telegramChatId:e.currentTarget.value.trim()||void 0})}})}})}}),(()=>{var e=Y2(),t=e.firstChild;return t.addEventListener(`change`,e=>void r({notifyOnCreate:e.currentTarget.checked?void 0:!1})),D(()=>t.checked=n().notifyOnCreate!==!1),e})(),X2()]}}),null),P(e,j(Rj,{title:`AI providers`,get children(){return[j(Lj,{label:`OpenAI API key`,get children(){return j(jj,{type:`password`,placeholder:`sk-…`,get value(){return n().openaiKey??``},onBlur:e=>{r({openaiKey:e.currentTarget.value.trim()||void 0})}})}}),j(Lj,{label:`Anthropic API key`,get children(){return j(jj,{type:`password`,placeholder:`sk-ant-…`,get value(){return n().anthropicKey??``},onBlur:e=>{r({anthropicKey:e.currentTarget.value.trim()||void 0})}})}}),(()=>{var e=Z2(),t=e.firstChild.nextSibling.firstChild,i=t.nextSibling,a=i.nextSibling;return t.$$click=()=>void r({preferredProvider:void 0}),i.$$click=()=>void r({preferredProvider:`openai`}),a.$$click=()=>void r({preferredProvider:`anthropic`}),D(e=>{var r=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors ${n().preferredProvider===void 0?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`,o=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`openai`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,s=!n().openaiKey,c=`flex-1 rounded-[5px] px-2 py-0.5 text-[11.5px] font-medium transition-colors disabled:cursor-not-allowed ${n().preferredProvider===`anthropic`?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer disabled:text-text-faint`}`,l=!n().anthropicKey;return r!==e.e&&st(t,e.e=r),o!==e.t&&st(i,e.t=o),s!==e.a&&(i.disabled=e.a=s),c!==e.o&&st(a,e.o=c),l!==e.i&&(a.disabled=e.i=l),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),e})(),(()=>{var e=$2();return P(e,j(M,{get when(){return se()},get fallback(){return p4()},get children(){var e=Q2();return P(e,se),e}})),e})()]}}),null),P(e,j(Rj,{title:`How it works`,get children(){return e4()}}),null),e})()}rt([`click`]);var h4=`linear-grab`,g4=`queries`,_4=[`my-issues`,`issue`,`sessions`,`teams`,`agents`];function v4(){return new Promise(e=>{try{let t=indexedDB.open(h4,1);t.onupgradeneeded=()=>t.result.createObjectStore(g4),t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}function y4(e){return typeof e[0]==`string`&&_4.includes(e[0])}async function b4(e){let t=await v4();if(!t)return()=>{};await new Promise(n=>{try{let r=t.transaction(g4,`readonly`).objectStore(g4).openCursor();r.onsuccess=()=>{let t=r.result;if(!t)return n();try{let{queryKey:n,data:r}=t.value;y4(n)&&e.getQueryData(n)===void 0&&e.setQueryData(n,r,{updatedAt:0})}catch{}t.continue()},r.onerror=()=>n()}catch{n()}});let n=new Map,r=e.getQueryCache().subscribe(r=>{if(r.type!==`updated`||r.action.type!==`success`)return;let{queryKey:i,queryHash:a}=r.query;if(!y4(i))return;let o=n.get(a);o&&clearTimeout(o),n.set(a,setTimeout(()=>{n.delete(a);try{let n=e.getQueryData(i);if(n===void 0)return;t.transaction(g4,`readwrite`).objectStore(g4).put({queryKey:i,data:n},a)}catch{}},400))});return()=>{r();for(let e of n.values())clearTimeout(e);t.close()}}Br();var x4=N(`<svg viewBox="0 0 100 100"fill=currentColor aria-hidden><path d="M1.22541 61.5228c-.2225-.9485.90748-1.5459 1.59638-.857L39.3342 97.1782c.6889.6889.0915 1.8189-.857 1.5964C20.0515 94.4522 5.54779 79.9485 1.22541 61.5228ZM.00189135 46.8891c-.01764375.2833.08887215.5599.28957165.7606L52.3503 99.7085c.2007.2007.4773.3075.7606.2896 2.3692-.1476 4.6938-.46 6.9624-.9259.7645-.157 1.0301-1.0963.4782-1.6481L2.57595 39.4485c-.55186-.5519-1.49117-.2863-1.648174.4782-.465915 2.2686-.77832 4.5932-.92588465 6.9624ZM4.21093 29.7054c-.16649.3738-.08169.8106.20765 1.1l64.77602 64.776c.2894.2894.7262.3742 1.1.2077 1.7861-.7956 3.5171-1.6927 5.1855-2.684.5521-.328.6373-1.0867.1832-1.5407L8.43566 24.3367c-.45409-.4541-1.21271-.3689-1.54074.1832-.99132 1.6684-1.88843 3.3994-2.68399 5.1855ZM12.6587 18.074c-.3701-.3701-.393-.9637-.0443-1.3541C21.7795 6.45931 35.1114 0 49.9519 0 77.5927 0 100 22.4073 100 50.0481c0 14.8405-6.4593 28.1724-16.7199 37.3375-.3903.3487-.984.3258-1.3541-.0443L12.6587 18.074Z">`),S4=N(`<button><svg width=12 height=12 viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=1.5 aria-hidden><rect x=1.5 y=2.5 width=13 height=11 rx=1.5></rect><path d="M10 2.5v11">`),C4=N(`<button aria-label="Minimize to launcher"title="Minimize to launcher"class="text-text-dim hover:text-text hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-[15px] leading-none transition-colors">–`),w4=N(`<div class="bg-bg text-text flex h-full flex-col"><header><span class="text-accent mr-0.5 inline-flex shrink-0"title="Linear Grab"></span><div class="no-scrollbar flex min-w-0 flex-1 items-center gap-1 overflow-x-auto"></div></header><main class="min-h-0 flex-1"><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full></div><div class=h-full>`),T4=N(`<button>`),E4=[{id:`draft`,label:`Draft`},{id:`capture`,label:`Capture`},{id:`activity`,label:`Activity`},{id:`running`,label:`Running`},{id:`cloud`,label:`Cloud`},{id:`local`,label:`Local`},{id:`prs`,label:`PRs`},{id:`design`,label:`Design`},{id:`settings`,label:`Settings`}],D4=new Set;function O4(e,t,n){if(D4.has(e)||typeof Notification>`u`)return;D4.add(e);let r=()=>new Notification(t,{body:n});Notification.permission===`granted`?r():Notification.permission==="default"&&Notification.requestPermission().then(e=>e===`granted`&&r())}function k4(){setInterval(()=>{NO().then(e=>{for(let t of e){if(t.status!==`running`)continue;let e=t.lastEventAt??t.startedAt;Date.now()-e>10*6e4&&O4(`local-stuck:${t.id}:${e}`,`Local agent may be stuck`,`${t.title.slice(0,80)} — no output for ${Math.round((Date.now()-e)/6e4)}m. Nudge or interrupt it in the Local tab.`)}}).catch(()=>{}),gO().then(e=>{for(let t of e)/awaitingInput|elicit/i.test(t.status)&&O4(`cloud-input:${t.id}`,`Cloud agent needs input`,`${t.issue?.identifier??`Session`} — ${t.issue?.title?.slice(0,80)??`a Cursor agent`} is waiting for you.`)}).catch(()=>{})},6e4)}k4();var A4=new gr({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});function j4(e){return(()=>{var t=x4();return D(n=>{var r=e.size??14,i=e.size??14;return r!==n.e&&it(t,`width`,n.e=r),i!==n.t&&it(t,`height`,n.t=i),n},{e:void 0,t:void 0}),t})()}function M4(e){let[t,n]=T(`draft`),r=()=>{A4.invalidateQueries({queryKey:[`grab`]}),cj()===`capture`&&n(`capture`),e.onGrab?.()};return O(()=>{let e=nj();e&&n(e)}),ie(()=>{let e=b4(A4),t=XZ(r),n=()=>{JO().then(y$),VO(),MO().then(async e=>{if(!e.projectConfig)return;let t=E2(await Tr(),e.projectConfig);t&&await Er(t)}).catch(()=>{})};n();let i=Mr(e=>{e===`settings`&&(A4.invalidateQueries({queryKey:[`settings`]}),n()),e===`grab`&&r()});ae(()=>{t(),i(),e.then(e=>e())})}),j(cr,{client:A4,get children(){var r=w4(),i=r.firstChild,a=i.firstChild,o=a.nextSibling,s=i.nextSibling.firstChild,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling,m=p.nextSibling,h=m.nextSibling;return i.$$pointerdown=t=>e.onHeaderPointerDown?.(t),P(a,j(j4,{size:14})),P(o,j(We,{each:E4,children:e=>(()=>{var r=T4();return r.$$click=()=>n(e.id),P(r,()=>e.label),D(()=>st(r,`h-6 shrink-0 rounded-md px-2 text-[12px] font-medium whitespace-nowrap transition-colors ${t()===e.id?`bg-surface-3 text-text`:`text-text-dim hover:text-text cursor-pointer`}`)),r})()})),P(i,j(M,{get when(){return e.onTogglePin},get children(){var t=S4();return t.$$click=()=>e.onTogglePin?.(),D(n=>{var r=e.pinned?`Switch to overlay`:`Dock beside page`,i=e.pinned?`Overlay the page`:`Dock beside page (squeezes the app, DevTools-style)`,a=`hover:bg-surface-3 grid size-6 shrink-0 cursor-pointer place-items-center rounded-md transition-colors ${e.pinned?`text-accent`:`text-text-dim hover:text-text`}`;return r!==n.e&&it(t,`aria-label`,n.e=r),i!==n.t&&it(t,`title`,n.t=i),a!==n.a&&st(t,n.a=a),n},{e:void 0,t:void 0,a:void 0}),t}}),null),P(i,j(M,{get when(){return e.onClose},get children(){var t=C4();return t.$$click=()=>e.onClose?.(),t}}),null),P(s,j(wM,{onCreated:()=>n(`activity`)})),P(c,j(TQ,{})),P(l,j(_1,{})),P(u,j(B1,{})),P(d,j(P1,{})),P(f,j(T0,{})),P(p,j(B0,{onOpenIssue:()=>n(`activity`)})),P(m,j(C2,{})),P(h,j(m4,{})),D(n=>{var r=`border-border bg-surface flex shrink-0 items-center gap-1 border-b px-2 py-1.5 select-none ${e.onHeaderPointerDown?`cursor-grab active:cursor-grabbing`:``}`,a=t()!==`draft`,o=t()!==`capture`,g=t()!==`activity`,_=t()!==`running`,v=t()!==`cloud`,y=t()!==`local`,b=t()!==`prs`,x=t()!==`design`,S=t()!==`settings`;return r!==n.e&&st(i,n.e=r),a!==n.t&&s.classList.toggle(`hidden`,n.t=a),o!==n.a&&c.classList.toggle(`hidden`,n.a=o),g!==n.o&&l.classList.toggle(`hidden`,n.o=g),_!==n.i&&u.classList.toggle(`hidden`,n.i=_),v!==n.n&&d.classList.toggle(`hidden`,n.n=v),y!==n.s&&f.classList.toggle(`hidden`,n.s=y),b!==n.h&&p.classList.toggle(`hidden`,n.h=b),x!==n.r&&m.classList.toggle(`hidden`,n.r=x),S!==n.d&&h.classList.toggle(`hidden`,n.d=S),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0}),r}})}rt([`pointerdown`,`click`]);var N4=`/*! tailwindcss v4.3.2 | MIT License | https://tailwindcss.com */
275
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, "SF Mono", Menlo, monospace;--color-red-500:oklch(63.7% .237 25.331);--color-white:#fff;--spacing:.25rem;--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-wide:.025em;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:4px;--radius-md:6px;--radius-lg:10px;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-bg:#0b0c0e;--color-surface:#141517;--color-surface-2:#1c1d21;--color-surface-3:#24262b;--color-border:#26282d;--color-border-strong:#34363d;--color-text:#e8e9eb;--color-text-dim:#8b8e98;--color-text-faint:#5c5f6a;--color-accent:#5e6ad2;--color-accent-hover:#6e79e0;--color-accent-soft:#5e6ad226;--color-success:#4cb782;--color-warn:#f2c94c;--color-danger:#eb5757;--color-danger-soft:#eb575726}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-0\\.5{top:calc(var(--spacing) * .5)}.top-1{top:var(--spacing)}.top-1\\/2{top:50%}.top-3{top:calc(var(--spacing) * 3)}.top-\\[2px\\]{top:2px}.top-full{top:100%}.right-0{right:0}.right-0\\.5{right:calc(var(--spacing) * .5)}.right-4{right:calc(var(--spacing) * 4)}.right-full{right:100%}.bottom-0{bottom:0}.bottom-1{bottom:var(--spacing)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-\\[2px\\]{bottom:2px}.bottom-full{bottom:100%}.-left-\\[13\\.5px\\]{left:-13.5px}.left-0{left:0}.left-1{left:var(--spacing)}.left-1\\/2{left:50%}.left-\\[5px\\]{left:5px}.left-full{left:100%}.z-1{z-index:1}.z-10{z-index:10}.z-\\[2147483645\\]{z-index:2147483645}.z-\\[2147483646\\]{z-index:2147483646}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.-m-0{margin:0}.-m-0\\.5{margin:calc(var(--spacing) * -.5)}.-m-4{margin:calc(var(--spacing) * -4)}.m-0{margin:0}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.-my-1{margin-block:calc(var(--spacing) * -1)}.-my-1\\.5{margin-block:calc(var(--spacing) * -1.5)}.mt-0{margin-top:0}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-px{margin-top:1px}.mr-0{margin-right:0}.mr-0\\.5{margin-right:calc(var(--spacing) * .5)}.mr-1{margin-right:var(--spacing)}.mr-1\\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mr-2\\.5{margin-right:calc(var(--spacing) * 2.5)}.-mb-4{margin-bottom:calc(var(--spacing) * -4)}.mb-0{margin-bottom:0}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-2\\.5{margin-bottom:calc(var(--spacing) * 2.5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-2\\.5{margin-left:calc(var(--spacing) * 2.5)}.ml-4{margin-left:calc(var(--spacing) * 4)}.ml-auto{margin-left:auto}.ml-px{margin-left:1px}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-5{-webkit-line-clamp:5;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.size-0{width:0;height:0}.size-1{width:var(--spacing);height:var(--spacing)}.size-1\\.5{width:calc(var(--spacing) * 1.5);height:calc(var(--spacing) * 1.5)}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-2\\.5{width:calc(var(--spacing) * 2.5);height:calc(var(--spacing) * 2.5)}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-\\[9px\\]{width:9px;height:9px}.size-\\[12px\\]{width:12px;height:12px}.size-\\[16px\\]{width:16px;height:16px}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-16{height:calc(var(--spacing) * 16)}.h-\\[8px\\]{height:8px}.h-\\[17px\\]{height:17px}.h-\\[18px\\]{height:18px}.h-\\[20px\\]{height:20px}.h-\\[24px\\]{height:24px}.h-fit{height:fit-content}.h-full{height:100%}.h-screen{height:100vh}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-44{max-height:calc(var(--spacing) * 44)}.max-h-56{max-height:calc(var(--spacing) * 56)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\\[var\\(--rg-edit-list-max-h\\)\\]{max-height:var(--rg-edit-list-max-h)}.min-h-0{min-height:0}.min-h-4{min-height:calc(var(--spacing) * 4)}.min-h-\\[2lh\\]{min-height:2lh}.min-h-\\[28px\\]{min-height:28px}.w-1{width:var(--spacing)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-16{width:calc(var(--spacing) * 16)}.w-28{width:calc(var(--spacing) * 28)}.w-72{width:calc(var(--spacing) * 72)}.w-\\[2px\\]{width:2px}.w-\\[calc\\(100\\%\\+16px\\)\\]{width:calc(100% + 16px)}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\\[55\\%\\]{max-width:55%}.max-w-\\[100vw\\]{max-width:100vw}.max-w-\\[110px\\]{max-width:110px}.max-w-\\[280px\\]{max-width:280px}.max-w-full{max-width:100%}.min-w-0{min-width:0}.min-w-\\[3\\.5ch\\]{min-width:3.5ch}.min-w-\\[4ch\\]{min-width:4ch}.min-w-\\[5ch\\]{min-width:5ch}.min-w-\\[6ch\\]{min-width:6ch}.min-w-\\[7ch\\]{min-width:7ch}.min-w-\\[8ch\\]{min-width:8ch}.min-w-\\[10ch\\]{min-width:10ch}.min-w-\\[12ch\\]{min-width:12ch}.min-w-\\[36px\\]{min-width:36px}.min-w-\\[52px\\]{min-width:52px}.min-w-\\[100px\\]{min-width:100px}.min-w-\\[150px\\]{min-width:150px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.-rotate-90{rotate:-90deg}.rotate-0{rotate:0deg}.rotate-90{rotate:90deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-decimal{list-style-type:decimal}.grid-cols-\\[0fr\\]{grid-template-columns:0fr}.grid-cols-\\[1fr\\]{grid-template-columns:1fr}.grid-rows-\\[0fr\\]{grid-template-rows:0fr}.grid-rows-\\[1fr\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0{gap:0}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-\\[5px\\]{gap:5px}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-\\[5px\\]{border-radius:5px}.rounded-\\[6px\\]{border-radius:6px}.rounded-\\[13px\\]{border-radius:13px}.rounded-\\[14px\\]{border-radius:14px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-\\[10px\\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-l-\\[10px\\]{border-top-left-radius:10px;border-bottom-left-radius:10px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-\\[10px\\]{border-top-right-radius:10px;border-bottom-right-radius:10px}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-\\[6px\\]{border-bottom-right-radius:6px;border-bottom-left-radius:6px}.rounded-b-\\[10px\\]{border-bottom-right-radius:10px;border-bottom-left-radius:10px}.rounded-b-none{border-bottom-right-radius:0;border-bottom-left-radius:0}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.\\[border-width\\:0\\.5px\\]{border-width:.5px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.\\[border-top-width\\:0\\.5px\\]{border-top-width:.5px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[var\\(--rg-border-button\\)\\]{border-color:var(--rg-border-button)}.border-accent{border-color:var(--color-accent)}.border-accent\\/40{border-color:#5e6ad266}@supports (color:color-mix(in lab, red, red)){.border-accent\\/40{border-color:color-mix(in oklab, var(--color-accent) 40%, transparent)}}.border-border{border-color:var(--color-border)}.border-success{border-color:var(--color-success)}.border-success\\/40{border-color:#4cb78266}@supports (color:color-mix(in lab, red, red)){.border-success\\/40{border-color:color-mix(in oklab, var(--color-success) 40%, transparent)}}.border-text-dim{border-color:var(--color-text-dim)}.border-transparent{border-color:#0000}.border-warn{border-color:var(--color-warn)}.border-warn\\/40{border-color:#f2c94c66}@supports (color:color-mix(in lab, red, red)){.border-warn\\/40{border-color:color-mix(in oklab, var(--color-warn) 40%, transparent)}}.border-t-\\[var\\(--rg-border-subtle\\)\\]{border-top-color:var(--rg-border-subtle)}.border-t-transparent{border-top-color:#0000}.bg-\\[var\\(--rg-error-bg\\)\\]{background-color:var(--rg-error-bg)}.bg-\\[var\\(--rg-panel-bg\\)\\]{background-color:var(--rg-panel-bg)}.bg-\\[var\\(--rg-submit-bg\\)\\]{background-color:var(--rg-submit-bg)}.bg-\\[var\\(--rg-surface-active\\)\\]{background-color:var(--rg-surface-active)}.bg-\\[var\\(--rg-surface-hover\\)\\]{background-color:var(--rg-surface-hover)}.bg-\\[var\\(--rg-text-primary\\)\\]{background-color:var(--rg-text-primary)}.bg-\\[var\\(--rg-text-secondary\\)\\]{background-color:var(--rg-text-secondary)}.bg-accent{background-color:var(--color-accent)}.bg-accent-soft{background-color:var(--color-accent-soft)}.bg-bg{background-color:var(--color-bg)}.bg-bg\\/80{background-color:#0b0c0ecc}@supports (color:color-mix(in lab, red, red)){.bg-bg\\/80{background-color:color-mix(in oklab, var(--color-bg) 80%, transparent)}}.bg-border{background-color:var(--color-border)}.bg-current{background-color:currentColor}.bg-danger{background-color:var(--color-danger)}.bg-danger-soft{background-color:var(--color-danger-soft)}.bg-red-500{background-color:var(--color-red-500)}.bg-success{background-color:var(--color-success)}.bg-surface{background-color:var(--color-surface)}.bg-surface-2{background-color:var(--color-surface-2)}.bg-surface-3{background-color:var(--color-surface-3)}.bg-text-faint{background-color:var(--color-text-faint)}.bg-transparent{background-color:#0000}.bg-warn{background-color:var(--color-warn)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:0}.p-0\\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\\.5{padding:calc(var(--spacing) * 2.5)}.p-6{padding:calc(var(--spacing) * 6)}.px-0{padding-inline:0}.px-0\\.25{padding-inline:calc(var(--spacing) * .25)}.px-1{padding-inline:var(--spacing)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-\\[3px\\]{padding-inline:3px}.py-0{padding-block:0}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-0\\.25{padding-block:calc(var(--spacing) * .25)}.py-1{padding-block:var(--spacing)}.py-1\\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-10{padding-block:calc(var(--spacing) * 10)}.py-px{padding-block:1px}.pt-0{padding-top:0}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-1\\.5{padding-right:calc(var(--spacing) * 1.5)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-4{padding-right:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-0{padding-left:0}.pl-0\\.5{padding-left:calc(var(--spacing) * .5)}.pl-2{padding-left:calc(var(--spacing) * 2)}.pl-2\\.5{padding-left:calc(var(--spacing) * 2.5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-end{text-align:end}.text-justify{text-align:justify}.text-left{text-align:left}.text-right{text-align:right}.text-start{text-align:start}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-\\[9\\.5px\\]{font-size:9.5px}.text-\\[9px\\]{font-size:9px}.text-\\[10\\.5px\\]{font-size:10.5px}.text-\\[10px\\]{font-size:10px}.text-\\[11\\.5px\\]{font-size:11.5px}.text-\\[11px\\]{font-size:11px}.text-\\[12\\.5px\\]{font-size:12.5px}.text-\\[12px\\]{font-size:12px}.text-\\[13px\\]{font-size:13px}.text-\\[15px\\]{font-size:15px}.leading-3{--tw-leading:calc(var(--spacing) * 3);line-height:calc(var(--spacing) * 3)}.leading-3\\.5{--tw-leading:calc(var(--spacing) * 3.5);line-height:calc(var(--spacing) * 3.5)}.leading-4{--tw-leading:calc(var(--spacing) * 4);line-height:calc(var(--spacing) * 4)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.font-black{--tw-font-weight:var(--font-weight-black);font-weight:var(--font-weight-black)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-extralight{--tw-font-weight:var(--font-weight-extralight);font-weight:var(--font-weight-extralight)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.font-thin{--tw-font-weight:var(--font-weight-thin);font-weight:var(--font-weight-thin)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-normal{overflow-wrap:normal;word-break:normal}.break-words,.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.break-keep{word-break:keep-all}.text-ellipsis{text-overflow:ellipsis}.whitespace-break-spaces{white-space:break-spaces}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[var\\(--rg-error-text\\)\\]{color:var(--rg-error-text)}.text-\\[var\\(--rg-submit-fg\\)\\]{color:var(--rg-submit-fg)}.text-\\[var\\(--rg-text-primary\\)\\]{color:var(--rg-text-primary)}.text-\\[var\\(--rg-text-primary-85\\)\\]{color:var(--rg-text-primary-85)}.text-\\[var\\(--rg-text-secondary\\)\\]{color:var(--rg-text-secondary)}.text-accent{color:var(--color-accent)}.text-danger{color:var(--color-danger)}.text-success{color:var(--color-success)}.text-text{color:var(--color-text)}.text-text-dim{color:var(--color-text-dim)}.text-text-faint{color:var(--color-text-faint)}.text-warn{color:var(--color-warn)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.accent-accent{accent-color:var(--color-accent)}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.\\[box-shadow\\:var\\(--rg-shadow\\)\\]{box-shadow:var(--rg-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\\[filter\\:var\\(--rg-drop-shadow\\)\\]{filter:var(--rg-drop-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-columns\\]{transition-property:grid-template-columns;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[grid-template-rows\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[padding\\,border-radius\\,transform\\]{transition-property:padding,border-radius,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[top\\,left\\,width\\,height\\,opacity\\,border-radius\\]{transition-property:top,left,width,height,opacity,border-radius;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,color\\]{transition-property:transform,color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.delay-\\[80ms\\]{transition-delay:80ms}.duration-60{--tw-duration:60ms;transition-duration:60ms}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-120{--tw-duration:.12s;transition-duration:.12s}.duration-140{--tw-duration:.14s;transition-duration:.14s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-180{--tw-duration:.18s;transition-duration:.18s}.duration-220{--tw-duration:.22s;transition-duration:.22s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\,0\\,0\\.2\\,1\\)\\]{--tw-ease:cubic-bezier(0,0,.2,1);transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-\\[opacity\\,transform\\]{will-change:opacity,transform}.will-change-transform{will-change:transform}.contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,) var(--tw-contain-layout,) var(--tw-contain-paint,) var(--tw-contain-style,)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.\\[corner-shape\\:superellipse\\(1\\.25\\)\\]{corner-shape:superellipse(1.25)}.\\[font-synthesis\\:none\\]{font-synthesis:none}.group-open\\:rotate-90:is(:where(.group):is([open],:popover-open,:open) *){rotate:90deg}@media (hover:hover){.group-hover\\:text-\\[var\\(--rg-text-primary\\)\\]:is(:where(.group):hover *){color:var(--rg-text-primary)}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-text-faint::placeholder{color:var(--color-text-faint)}@media (hover:hover){.hover\\:bg-\\[var\\(--rg-error-bg-hover\\)\\]:hover{background-color:var(--rg-error-bg-hover)}.hover\\:bg-\\[var\\(--rg-surface-active\\)\\]:hover{background-color:var(--rg-surface-active)}.hover\\:bg-\\[var\\(--rg-surface-hover\\)\\]:hover{background-color:var(--rg-surface-hover)}.hover\\:bg-accent-hover:hover{background-color:var(--color-accent-hover)}.hover\\:bg-accent\\/50:hover{background-color:#5e6ad280}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab, var(--color-accent) 50%, transparent)}}.hover\\:bg-danger\\/30:hover{background-color:#eb57574d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-danger\\/30:hover{background-color:color-mix(in oklab, var(--color-danger) 30%, transparent)}}.hover\\:bg-surface-2:hover{background-color:var(--color-surface-2)}.hover\\:bg-surface-3:hover{background-color:var(--color-surface-3)}.hover\\:text-\\[var\\(--rg-text-primary\\)\\]:hover{color:var(--rg-text-primary)}.hover\\:text-accent:hover{color:var(--color-accent)}.hover\\:text-danger:hover{color:var(--color-danger)}.hover\\:text-text:hover{color:var(--color-text)}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:opacity-80:hover{opacity:.8}}.focus\\:border-accent:focus{border-color:var(--color-accent)}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-accent:active{background-color:var(--color-accent)}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-surface-3:disabled{background-color:var(--color-surface-3)}.disabled\\:text-text-faint:disabled{color:var(--color-text-faint)}.disabled\\:opacity-40:disabled{opacity:.4}@media (hover:hover){.disabled\\:hover\\:bg-surface-2:disabled:hover{background-color:var(--color-surface-2)}}}:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}[data-theme=light],:host([data-theme=light]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:light){:root:not([data-theme=dark]){--color-bg:#fbfbfc;--color-surface:#fff;--color-surface-2:#f4f4f6;--color-surface-3:#e9e9ee;--color-border:#e2e2e8;--color-border-strong:#cfcfd8;--color-text:#1b1c20;--color-text-dim:#5c5f6a;--color-text-faint:#9a9da8;--color-accent-soft:#5e6ad21f;--color-danger-soft:#eb57571a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}}body{background-color:var(--color-bg);font-family:var(--font-sans);color:var(--color-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;min-width:320px;margin:0;font-size:13px}@keyframes geist-spinner-fade{0%{opacity:1}to{opacity:.15}}[data-tip]{position:relative}[data-tip]:hover:after{content:attr(data-tip);color:#fff;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;z-index:60;background:#1b1c20;border-radius:6px;max-width:260px;padding:3px 8px;font-size:10.5px;font-weight:500;line-height:1.35;position:absolute;bottom:calc(100% + 6px);left:50%;overflow:hidden;transform:translate(-50%);box-shadow:0 4px 12px #0000004d}[data-tip][data-tip-pos~=right]:hover:after{left:0;transform:none}[data-tip][data-tip-pos~=left]:hover:after{left:auto;right:0;transform:none}[data-tip][data-tip-pos~=bottom]:hover:after{top:calc(100% + 6px);bottom:auto}.no-scrollbar{scrollbar-width:none}.no-scrollbar::-webkit-scrollbar{display:none}.lg-md p{margin:0 0 6px}.lg-md p:last-child{margin-bottom:0}.lg-md a{color:var(--color-accent);word-break:break-all;text-decoration:none}.lg-md a:hover{text-decoration:underline}.lg-md code{background:var(--color-surface-2);border:1px solid var(--color-border);font-family:var(--font-mono);border-radius:4px;padding:0 4px;font-size:11px}.lg-md pre{background:var(--color-surface-2);border:1px solid var(--color-border);border-radius:6px;margin:6px 0;padding:8px;overflow-x:auto}.lg-md pre code{white-space:pre;background:0 0;border:none;padding:0;font-size:11px}.lg-md ul,.lg-md ol{flex-direction:column;gap:2px;margin:4px 0 6px;padding-left:18px;display:flex}.lg-md ul{list-style:outside}.lg-md ol{list-style:decimal}.lg-md h4{margin:8px 0 4px;font-size:12px;font-weight:600}.lg-md lg-media{display:block}.lg-md lg-media img,.lg-md lg-media video{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md video{border:1px solid var(--color-border);background:#000;border-radius:6px;max-width:100%;margin:4px 0}.lg-md img{border:1px solid var(--color-border);border-radius:6px;max-width:100%;margin:4px 0}.lg-md strong{font-weight:600}*{scrollbar-width:thin;scrollbar-color:var(--color-border-strong) transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:var(--color-border-strong);border-radius:4px}::-webkit-scrollbar-track{background:0 0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-contain-size{syntax:"*";inherits:false}@property --tw-contain-layout{syntax:"*";inherits:false}@property --tw-contain-paint{syntax:"*";inherits:false}@property --tw-contain-style{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`;Br();var P4=N(`<span aria-hidden class="bg-danger size-2 shrink-0 animate-pulse rounded-full">`),F4=N(`<span class="text-text min-w-[5ch] text-[11px] font-medium tabular-nums">`),I4=N(`<button class="bg-accent hover:bg-accent-hover h-7 cursor-pointer rounded-full px-2.5 text-[11px] font-medium text-white transition-colors"><span class="inline-block min-w-[4ch] text-center">Stop`),L4=N(`<p class="text-warn px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Needs review`),R4=N(`<div><p class="text-text-dim px-1.5 pt-1 pb-1.5 text-[10.5px] font-semibold tracking-wide uppercase">Running agents`),z4=N(`<div class="fixed z-[2147483646] select-none"><div class="bg-surface border-border text-text flex h-9 cursor-grab items-center gap-1 rounded-full border py-1 pr-1 pl-2.5 font-sans shadow-lg active:cursor-grabbing">`),B4=N(`<div><div title="Drag to resize">`),V4=N(`<button title="Open Linear Grab"aria-label="Open Linear Grab"class="text-accent hover:opacity-80 inline-flex cursor-pointer items-center gap-1.5">`),H4=N(`<span class="bg-border h-4 w-px"aria-hidden>`),U4=N(`<span aria-hidden class="bg-warn size-2 rounded-full">`),W4=N(`<span class="text-warn min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums"> rev`),G4=N(`<button title="Running agents"aria-label="Running agents"class="hover:bg-surface-2 flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2 transition-colors"><span aria-hidden></span><span>`),K4=N(`<p class="text-text-faint px-1.5 pb-1.5 text-[11.5px]">No agents running right now.`),q4=N(`<button class="hover:bg-surface-2 flex w-full cursor-pointer flex-col gap-0.5 rounded-md px-1.5 py-1.5 text-left transition-colors"><span class="flex min-w-0 items-center gap-1.5"><span aria-hidden class="size-1.5 shrink-0 rounded-full"></span><span class="font-mono text-text-dim shrink-0 text-[10.5px]"></span><span class="text-text truncate text-[11.5px]"></span></span><span class="text-text-faint pl-3 text-[10.5px] tabular-nums"> · <!> · `);function J4(e={}){if(typeof window>`u`||window.__LINEAR_GRAB_PAGE__)return;window.__LINEAR_GRAB_PAGE__=!0;let t=()=>{lk(),JZ();let t=document.createElement(`div`);t.id=`linear-grab-root`,document.body.appendChild(t);let n=e=>{let n=e.composedPath();if(!n.includes(t))return;e.stopImmediatePropagation();let r=n[0];e instanceof KeyboardEvent&&r&&r!==t&&r.dispatchEvent(new KeyboardEvent(e.type,{key:e.key,code:e.code,location:e.location,repeat:e.repeat,isComposing:e.isComposing,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,bubbles:!1,cancelable:!1}))};for(let e of[`keydown`,`keyup`,`keypress`])window.addEventListener(e,n,{capture:!0});let r=t.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=N4,r.appendChild(i);let a=document.createElement(`div`);r.appendChild(a);let o=()=>a.setAttribute(`data-theme`,Y4());o(),matchMedia(`(prefers-color-scheme: light)`).addEventListener(`change`,o),nt(()=>j(t3,{get defaultOpen(){return e.defaultOpen??!1}}),a)};document.body?t():document.addEventListener(`DOMContentLoaded`,t,{once:!0})}function Y4(){try{let e=[document.body,document.documentElement];for(let t of e){let e=getComputedStyle(t).backgroundColor.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+))?/);if(!(!e||e[4]!==void 0&&Number(e[4])===0))return .2126*e[1]+.7152*e[2]+.0722*e[3]>140?`light`:`dark`}}catch{}return matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}var X4=130,Z4=36,Q4=380,$4=280,e3=720;function t3(e){let[t,n]=T(e.defaultOpen),[r,i]=T(`right`),[a,o]=T({x:Math.max(8,window.innerWidth-X4-24),y:Math.max(8,window.innerHeight-Z4-20)}),[s,c]=T({running:[],review:[]}),l=()=>s().running,u=()=>s().review,[d,f]=T(!1),[p,m]=T(HD().phase),[h,g]=T(0);ie(()=>{let e=setInterval(()=>{p()===`recording`&&g(Date.now()-(HD().startedAt??Date.now()))},250);ae(()=>clearInterval(e))});let _=e=>{let t=Math.floor(e/1e3);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},[v,y]=T(null),b=e=>({x:Math.min(Math.max(8,e.x),window.innerWidth-X4-8),y:Math.min(Math.max(8,e.y),window.innerHeight-Z4-8)}),x=e=>({x:Math.min(Math.max(8-(te()-80),e.x),window.innerWidth-80),y:Math.min(Math.max(0,e.y),window.innerHeight-80)}),[S,C]=T(!1),[w,E]=T(`cloud`),[k,ee]=T(!1),[te,A]=T(Q4),ne=e=>Math.min(e3,Math.max($4,Math.min(e,window.innerWidth-60)));O(()=>{let e=document.documentElement,n=t()&&S();e.style.transition=`margin 0.2s ease`,e.style.marginRight=n&&r()===`right`?`${te()}px`:``,e.style.marginLeft=n&&r()===`left`?`${te()}px`:``}),ae(()=>{document.documentElement.style.marginRight=``,document.documentElement.style.marginLeft=``});let re=()=>{let e=!S();C(e),e&&y(null),Er({panelMode:e?`pinned`:`overlay`,panelPos:void 0})};ie(()=>{Tr().then(e=>{e.panelSide&&i(e.panelSide),e.launcherPos&&o(b(e.launcherPos)),e.panelPos&&y(x(e.panelPos)),e.panelWidth&&A(ne(e.panelWidth)),C(e.panelMode===`pinned`),E(e.workflowMode??`cloud`)});let e=Mr(e=>{e===`settings`&&Tr().then(e=>{i(e.panelSide??`right`),C(e.panelMode===`pinned`),E(e.workflowMode??`cloud`)}),e===`grab`&&w()!==`local`&&n(!0)}),t=()=>{ee(!0),setTimeout(()=>ee(!1),1600)};window.addEventListener(zZ,t);let r=()=>{f(!1),S()||n(!1)};window.addEventListener(BZ,r);let s=()=>n(!0);window.addEventListener(`linear-grab:picker-finished`,s),ae(()=>{window.removeEventListener(zZ,t),window.removeEventListener(BZ,r),window.removeEventListener(`linear-grab:picker-finished`,s)});let l=e$(c),u=HD().phase,d=UD(e=>{m(e.phase),e.phase===`recording`&&u!==`recording`&&!S()&&n(!1),e.phase===`ready`&&u!==`ready`&&(oj(`capture`),n(!0)),u=e.phase}),p=()=>{o(b(a()));let e=v();e&&y(x(e))};window.addEventListener(`resize`,p),ae(()=>{e(),l(),d(),window.removeEventListener(`resize`,p)})});let oe=!1,se=e=>{if(e.button!==0)return;let t={x:e.clientX,y:e.clientY},n=a();oe=!1;let r=e=>{let r=e.clientX-t.x,i=e.clientY-t.y;Math.abs(r)+Math.abs(i)>4&&(oe=!0),oe&&o(b({x:n.x+r,y:n.y+i}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i),oe&&Er({launcherPos:a()}),setTimeout(()=>{oe=!1},0)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},ce=()=>a().y>260,le=e=>{f(!1),oj(`activity`,e),n(!0)},ue=e=>{if(e.button!==0)return;e.preventDefault(),e.stopPropagation();let t=e.clientX,n=te(),i=v(),a=e=>{let a=e.clientX-t,o=r()===`right`?-a:a,s=ne(n+o);A(s),i&&r()===`right`&&y(x({x:i.x+(n-s),y:i.y}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),Er({panelWidth:te(),...v()?{panelPos:v()}:{}})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},de=e=>{if(e.button!==0)return;if(e.detail===2){y(null),Er({panelPos:void 0});return}let t={x:e.clientX,y:e.clientY},n=v()??{x:r()===`right`?window.innerWidth-te():0,y:0},i=!1,a=e=>{let r=e.clientX-t.x,a=e.clientY-t.y;Math.abs(r)+Math.abs(a)>4&&(i=!0),i&&y(x({x:n.x+r,y:n.y+a}))},o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o);let e=v();i&&e&&Er({panelPos:e})};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)};return[j(M,{get when(){return!t()},get children(){var e=z4(),t=e.firstChild;return t.$$click=()=>{oe||p()===`recording`||(f(!1),n(!0))},t.$$pointerdown=se,P(t,j(M,{get when(){return p()===`recording`},get fallback(){return[(()=>{var e=V4();return e.$$click=()=>{oe||(f(!1),n(!0))},P(e,j(j4,{size:13})),e})(),H4(),(()=>{var e=G4(),t=e.firstChild,n=t.nextSibling;return e.$$click=e=>{e.stopPropagation(),!oe&&f(e=>!e)},P(n,(()=>{var e=$e(()=>!!k());return()=>e()?`Copied ✓`:`${l().length} run`})()),P(e,j(M,{get when(){return $e(()=>!k())()&&u().length>0},get children(){return[U4(),(()=>{var e=W4(),t=e.firstChild;return P(e,()=>u().length,t),e})()]}}),null),D(e=>{var r=`size-2 rounded-full ${k()?`bg-success`:l().length?`bg-success animate-pulse`:`bg-text-faint`}`,i=`min-w-[3.5ch] text-left text-[11px] font-medium tabular-nums ${k()?`text-success`:`text-text-dim`}`;return r!==e.e&&st(t,e.e=r),i!==e.t&&st(n,e.t=i),e},{e:void 0,t:void 0}),e})()]},get children(){return[P4(),(()=>{var e=F4();return P(e,()=>_(h())),e})(),(()=>{var e=I4();return e.$$click=()=>{oe||eO()},e})()]}})),P(e,j(M,{get when(){return d()},get children(){var e=R4(),t=e.firstChild;return P(e,j(M,{get when(){return u().length>0},get children(){return[L4(),j(We,{get each(){return u()},children:e=>j(n3,{agent:e,review:!0,onOpen:le})})]}}),t),P(e,j(M,{get when(){return l().length>0},get fallback(){return K4()},get children(){return j(We,{get each(){return l()},children:e=>j(n3,{agent:e,onOpen:le})})}}),null),D(()=>st(e,`bg-surface border-border absolute w-72 rounded-lg border p-1.5 font-sans shadow-2xl ${ce()?`bottom-full mb-2`:`top-full mt-2`} ${a().x>window.innerWidth-300?`right-0`:`left-0`}`)),e}}),null),D(t=>{var n=`${a().x}px`,r=`${a().y}px`;return n!==t.e&&dt(e,`left`,t.e=n),r!==t.t&&dt(e,`top`,t.t=r),t},{e:void 0,t:void 0}),e}}),j(M,{get when(){return t()},get children(){var e=B4(),t=e.firstChild;return t.$$pointerdown=ue,P(e,j(M4,{onGrab:()=>n(!0),onClose:()=>n(!1),get onHeaderPointerDown(){return S()?void 0:de},get pinned(){return S()},onTogglePin:re}),null),D(n=>{var i=`bg-bg text-text border-border fixed z-[2147483645] flex max-w-[100vw] flex-col overflow-hidden font-sans text-[13px] antialiased ${S()?``:`shadow-2xl`} ${!S()&&v()?`rounded-xl border`:r()===`right`?`top-0 right-0 h-screen border-l`:`top-0 left-0 h-screen border-r`}`,a={width:`${te()}px`,...!S()&&v()?{left:`${v().x}px`,top:`${v().y}px`,height:`${Math.min(680,window.innerHeight-16)}px`}:{}},o=`hover:bg-accent/50 active:bg-accent absolute top-0 z-10 h-full w-1 cursor-col-resize transition-colors ${r()===`right`?`left-0`:`right-0`}`;return i!==n.e&&st(e,n.e=i),n.t=ut(e,a,n.t),o!==n.a&&st(t,n.a=o),n},{e:void 0,t:void 0,a:void 0}),e}})]}function n3(e){return(()=>{var t=q4(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=n.nextSibling,s=o.firstChild,c=s.nextSibling;return c.nextSibling,t.$$click=()=>e.onOpen(e.agent.id),P(i,()=>e.agent.identifier),P(a,()=>e.agent.title),P(o,(()=>{var t=$e(()=>!!e.review);return()=>t()?`PR ready · needs review`:e.agent.stateName})(),s),P(o,()=>e.agent.delegateName,c),P(o,()=>r3(e.agent.updatedAt),null),D(t=>dt(r,`background`,e.review?`var(--color-warn)`:e.agent.stateColor)),t})()}function r3(e){let t=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));return t<60?`now`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}rt([`pointerdown`,`click`]),J4()})();