@abelxiaoxing/cadence 2.1.4 → 2.1.5
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.
|
@@ -12,7 +12,7 @@ import{r as e}from"./rolldown-runtime.js";import{n as t,r as n,t as r}from"./rea
|
|
|
12
12
|
`)}function Mr(e){let t=typeof e==`object`&&!!e&&Object.hasOwn(e,`notice`),n=H(e,[`id`,`revision`,`enabled`,`head`,`proposal`,`runs`,...t?[`notice`]:[]]);return{id:fn(n.id),revision:L(n.revision,0),enabled:R(n.enabled),head:V(n.head,W),proposal:V(n.proposal,br),runs:U(n.runs,200,W),...t?{notice:I(n.notice,1024,!0)}:{}}}function Nr(e){let t=I(e,64,!0);if(!/^[A-Za-z0-9_-]+$/.test(t))throw new P(`invalid`);return t}var Pr=196608,Fr=16384,Ir=1e3,Lr=16384,Rr=1024;function zr(e,t){let n=e=>new TextEncoder().encode(JSON.stringify(e)).length;if(n(e)<=t)return e;let r=0,i=Math.min(e.length,t);for(;r<i;){let a=Math.ceil((r+i)/2);n(e.slice(0,a))<=t?r=a:i=a-1}return/[\uD800-\uDBFF]/u.test(e.slice(r-1,r))?e.slice(0,r-1):e.slice(0,r)}function Br(e){let t;try{t=JSON.parse(e)}catch{return``}if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=e=>{let n=Object.hasOwn(t,e)?t[e]:void 0;return typeof n==`string`?n.trim():``},r=n(`command`);return r?r.split(`
|
|
13
13
|
`,1)[0]:[n(`pattern`),n(`path`)].filter(Boolean).join(` `)}function Vr(e,t,n=!1){let r=e.role===`tool`,i=r||e.role===`thinking`,a=i?``:zr(e.text,Lr);return{id:e.id,role:e.role,text:a,...e.images?.length?{images:e.images}:{},clipped:!i&&(n||a!==e.text),name:e.name,target:r?zr(Br(e.args),Rr):``,error:e.error,parts:t}}function Hr(e){let t=H(e,[`id`,`updatedAt`]);return{id:fn(t.id),updatedAt:L(t.updatedAt,0)}}var Ur=[`queued`,`running`,`completed`,`failed`,`canceled`,`timeout`,`unknown`];function Wr(e){let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;switch(t){case`conversation-context`:case`conversation-models`:return{kind:t,location:pn(H(e,[`kind`,`location`]).location)};case`conversation-turn`:{let n=H(e,[`kind`,`id`,`leaf`,`ordinal`,`before`]);return{kind:t,id:fn(n.id),leaf:V(n.leaf,Nr),ordinal:L(n.ordinal,0),before:V(n.before,e=>L(e,0))}}case`conversation-image`:{let n=H(e,[`kind`,`id`,`leaf`,`entry`,`index`,`offset`,...Object.hasOwn(e??{},`live`)?[`live`]:[]]),r=L(n.offset,0);if(r%Vn.chunkChars||n.live!==void 0&&n.live!==!0)throw new P(`invalid`);return{kind:t,id:fn(n.id),leaf:V(n.leaf,Nr),...n.live===void 0?{}:{live:!0},entry:Nr(n.entry),index:L(n.index,0),offset:r}}case`conversation-step`:{let n=H(e,[`kind`,`id`,`leaf`,`turnId`,`step`,`part`]);return{kind:t,id:fn(n.id),leaf:V(n.leaf,Nr),turnId:Nr(n.turnId),step:L(n.step,0),part:L(n.part,0)}}case`cadence-conversation`:return{kind:t,id:fn(H(e,[`kind`,`id`]).id)};case`conversation-tree`:{let n=H(e,[`kind`,`id`,`leaf`]);return{kind:t,id:fn(n.id),leaf:V(n.leaf,Nr)}}case`workflow-history`:{let n=Object.hasOwn(e,`scan`),r=H(e,[`kind`,`after`,...n?[`scan`]:[]]);return{kind:t,after:V(r.after,W),...n?{scan:W(r.scan)}:{}}}case`workflow-active`:return H(e,[`kind`]),{kind:t};case`workflow-transcript`:case`workflow-detail`:{let n=H(e,[`kind`,`id`,`stepId`]);return{kind:t,id:W(n.id),stepId:I(n.stepId,160,!0)}}case`workflow`:{let n=H(e,[`kind`,`id`,...Object.hasOwn(e??{},`before`)?[`before`]:[]]);return{kind:t,id:W(n.id),...n.before===void 0?{}:{before:L(n.before,1)}}}case`conversations`:{let n=Object.hasOwn(e,`after`),r=Object.hasOwn(e,`archived`),i=H(e,[`kind`,...n?[`after`]:[],...r?[`archived`]:[]]);if(r&&i.archived!==!0)throw new P(`invalid`);return{kind:t,...n?{after:V(i.after,Hr)}:{},...r?{archived:!0}:{}}}case`conversation-active`:case`projects`:return H(e,[`kind`]),{kind:t};case`conversation`:{let n=H(e,[`kind`,`id`,`leaf`,`known`]);return{kind:t,id:fn(n.id),leaf:V(n.leaf,Nr),known:V(n.known,Nr)}}case`file-part`:{let n=Object.hasOwn(e??{},`location`),r=H(e,[`kind`,`path`,`offset`,...n?[`location`]:[]]),i=L(r.offset,0);if(i%196608||i>=67108864)throw new P(`invalid`);return{kind:t,path:I(r.path,4096),offset:i,...n?{location:pn(r.location)}:{}}}default:{let n=(t===`file`||t===`files`)&&Object.hasOwn(e??{},`location`),r=H(e,[`kind`,`path`,...n?[`location`]:[]]);return{kind:z(r.kind,[`files`,`file`,`directories`]),path:I(r.path,4096),...n?{location:pn(r.location)}:{}}}}}function Gr(e){let t=I(e,400);if(t!==t.trim()||/\p{Cc}/u.test(t))throw new P(`invalid`);if([...t].length>100)throw new P(`oversize`);return t}function Kr(e){let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(t===`conversation-model`){let n=H(e,[`kind`,`commandId`,`location`,`expected`,`choice`]);return{kind:t,commandId:W(n.commandId),location:pn(n.location),expected:gn(n.expected),choice:pe(n.choice)}}if(t===`restore-model`||t===`workflow-cancel`){let n=H(e,t===`restore-model`?[`kind`,`commandId`,`epoch`,...Object.hasOwn(e??{},`location`)?[`location`]:[],...Object.hasOwn(e??{},`expected`)||Object.hasOwn(e??{},`choice`)?[`expected`,`choice`]:[]]:[`kind`,`commandId`,`epoch`,`runId`]);if((n.expected!==void 0||n.choice!==void 0)&&n.location===void 0)throw new P(`invalid`);let r=Object.hasOwn(e??{},`expected`)||Object.hasOwn(e??{},`choice`),i={commandId:W(n.commandId),epoch:W(n.epoch)};return t===`restore-model`?{kind:t,...i,...n.location===void 0?{}:{location:pn(n.location)},...r?{expected:gn(n.expected),choice:pe(n.choice)}:{}}:{kind:t,...i,runId:W(n.runId)}}if(t===`cadence-exit`){let n=H(e,[`kind`,`commandId`,`conversationId`,`head`,`revision`,...Object.hasOwn(e??{},`location`)?[`location`]:[]]);return{kind:t,...n.location===void 0?{}:{location:pn(n.location)},commandId:W(n.commandId),conversationId:fn(n.conversationId),head:V(n.head,Nr),revision:L(n.revision,0)}}if(t===`image-upload`){let n=H(e,[`kind`,`commandId`,`imageId`,`send`,`mimeType`,`size`,`offset`,`data`]);if(![`send`,`cadence-send`].includes(Object.getOwnPropertyDescriptor(n.send??{},`kind`)?.value))throw new P(`invalid`);let r=Kr(n.send);if(r.kind!==`send`&&r.kind!==`cadence-send`||r.images?.length||r.kind===`cadence-send`&&r.intent===`exit`)throw new P(`invalid`);return{kind:t,commandId:W(n.commandId),imageId:W(n.imageId),send:r,mimeType:z(n.mimeType,Hn),size:L(n.size,1),offset:L(n.offset,0),data:I(n.data,Vn.chunkChars,!0)}}if(t===`cadence-send`){let n=H(e,[`kind`,`commandId`,`conversationId`,`head`,`text`,...Object.hasOwn(e??{},`images`)?[`images`]:[],`model`,`revision`,`intent`]);return{kind:t,commandId:W(n.commandId),conversationId:fn(n.conversationId),head:V(n.head,Nr),text:I(n.text,Fr),...n.images===void 0?{}:{images:U(n.images,2**53-1,W)},model:gn(n.model),revision:L(n.revision,0),intent:z(n.intent,[`message`,`enter`,`exit`])}}if(t===`cadence-prepare`||t===`cadence-approve`){let n=[`kind`,`commandId`,`conversationId`,`revision`,`proposalId`,`digest`],r=H(e,t===`cadence-approve`?[...n,`grant`]:n),i={commandId:W(r.commandId),conversationId:fn(r.conversationId),revision:L(r.revision,0),proposalId:W(r.proposalId),digest:G(r.digest)};return t===`cadence-prepare`?{kind:t,...i}:{kind:t,...i,grant:W(r.grant)}}if(t===`workflow`){let n=H(e,[`kind`,`commandId`,`epoch`,`request`]);return{kind:t,commandId:W(n.commandId),epoch:W(n.epoch),request:xr(n.request)}}if(t===`send`){let n=H(e,[`kind`,`commandId`,`conversationId`,`head`,`text`,...Object.hasOwn(e??{},`images`)?[`images`]:[],`model`]);return{kind:t,commandId:W(n.commandId),conversationId:fn(n.conversationId),head:V(n.head,Nr),text:I(n.text,Fr),...n.images===void 0?{}:{images:U(n.images,2**53-1,W)},model:gn(n.model)}}if(t===`interrupt`||t===`conversation-input`||t===`conversation-input-cancel`){let n=H(e,[`kind`,`commandId`,`conversationId`,`turnId`,`epoch`,...t===`conversation-input`?[`mode`,`text`]:t===`conversation-input-cancel`?[`inputId`]:[]]),r={commandId:W(n.commandId),conversationId:fn(n.conversationId),turnId:W(n.turnId),epoch:W(n.epoch)};return t===`conversation-input`?{kind:t,...r,mode:z(n.mode,[`steer`,`queue`]),text:I(n.text,Fr,!0)}:t===`interrupt`?{kind:t,...r}:{kind:t,...r,inputId:W(n.inputId)}}if(t===`conversation-rename`){let n=H(e,[`kind`,`commandId`,`conversationId`,`name`]);return{kind:t,commandId:W(n.commandId),conversationId:fn(n.conversationId),name:Gr(n.name)}}if(t===`conversation-archive`){let n=H(e,[`kind`,`commandId`,`conversationId`,`archived`]);return{kind:t,commandId:W(n.commandId),conversationId:fn(n.conversationId),archived:R(n.archived)}}let n=H(e,[`kind`,`commandId`,`path`,`epoch`]);return{kind:z(n.kind,[`open-project`]),commandId:W(n.commandId),path:I(n.path,4096,!0),epoch:W(n.epoch)}}function qr(e){let t=[`id`,`epoch`,`status`,`items`,`notice`],n=typeof e==`object`&&!!e&&Object.hasOwn(e,`omitted`),r=typeof e==`object`&&!!e&&Object.hasOwn(e,`transcript`),i=H(e,[...t,...n?[`omitted`]:[],...r?[`transcript`]:[],...Object.hasOwn(e??{},`execution`)?[`execution`]:[],...Object.hasOwn(e??{},`retry`)?[`retry`]:[]]),a=r?H(i.transcript,[`pages`]):null,o=n?H(i.omitted,[`thinking`,`media`,`other`]):null;return{...i.execution===void 0?{}:{execution:hn(i.execution)},...i.retry===void 0?{}:{retry:We(i.retry)},id:W(i.id),epoch:W(i.epoch),status:z(i.status,Ur),notice:I(i.notice,1024),...a?{transcript:{pages:L(a.pages,0)}}:{},omitted:{thinking:o?R(o.thinking):!1,media:o?R(o.media):!1,other:o?R(o.other):!1},items:U(i.items,256,Xr)}}var Jr=[`user`,`assistant`,`tool`,`thinking`];function Yr(e){return U(e,2**53-1,e=>{let t=H(e,[`entry`,`index`,`mimeType`,...Object.hasOwn(e??{},`live`)?[`live`]:[]]);if(t.live!==void 0&&t.live!==!0)throw new P(`invalid`);return{...t.live===void 0?{}:{live:!0},entry:Nr(t.entry),index:L(t.index,0),mimeType:z(t.mimeType,Hn)}})}function Xr(e){let t=H(e,[`id`,`role`,`text`,`name`,`args`,`error`,...Object.hasOwn(e??{},`images`)?[`images`]:[]]);return{...t.images===void 0?{}:{images:Yr(t.images)},id:I(t.id,160,!0),role:z(t.role,Jr),text:I(t.text,262144),name:I(t.name,128),args:I(t.args,65536),error:R(t.error)}}function Zr(e){let t=H(e,[`id`,`role`,`text`,`clipped`,...Object.hasOwn(e??{},`images`)?[`images`]:[],`name`,`target`,`error`,`parts`]),n={...t.images===void 0?{}:{images:Yr(t.images)},id:I(t.id,160,!0),role:z(t.role,Jr),text:I(t.text,Lr),clipped:R(t.clipped),name:I(t.name,128),target:I(t.target,Rr),error:R(t.error),parts:L(t.parts,0)};if((n.role===`tool`||n.role===`thinking`)&&(n.text||n.clipped)||n.role===`thinking`&&!n.parts)throw new P(`invalid`);return n}function Qr(e){let t=H(e,[`id`,`status`,`notice`,`omitted`,`steps`,`stable`,...Object.hasOwn(e??{},`execution`)?[`execution`]:[],...Object.hasOwn(e??{},`retry`)?[`retry`]:[],`entry`,...Object.hasOwn(e??{},`parent`)?[`parent`]:[],`at`]),n=H(t.omitted,[`thinking`,`media`,`other`]),r=L(t.steps,0);return{...t.execution===void 0?{}:{execution:hn(t.execution)},...t.retry===void 0?{}:{retry:We(t.retry)},id:Nr(t.id),entry:V(t.entry,Nr),...t.parent===void 0?{}:{parent:V(t.parent,Nr)},at:L(t.at,0),status:z(t.status,Ur),notice:I(t.notice,1024),omitted:{thinking:R(n.thinking),media:R(n.media),other:R(n.other)},steps:r,stable:L(t.stable,0,r)}}function $r(e){let t=t=>typeof e==`object`&&!!e&&Object.hasOwn(e,t),n=H(e,[`id`,`title`,`leaf`,`status`,`updatedAt`,`origin`,...t(`cadence`)?[`cadence`]:[],...t(`live`)?[`live`]:[],...t(`archived`)?[`archived`]:[]]),r=t(`live`)?H(n.live,[`commandId`,`epoch`]):null;if(t(`archived`)&&n.archived!==!0)throw new P(`invalid`);return{id:fn(n.id),title:I(n.title,512,!0),leaf:V(n.leaf,Nr),status:z(n.status,Ur),updatedAt:L(n.updatedAt,0),origin:z(n.origin,[`terminal`,`webui`]),...t(`cadence`)?{cadence:R(n.cadence)}:{},...r?{live:{commandId:W(r.commandId),epoch:W(r.epoch)}}:{},...t(`archived`)?{archived:!0}:{}}}function ei(e){let t=H(e,[`commandId`,`text`,`status`,`notice`]);return{commandId:W(t.commandId),text:I(t.text,16384),status:z(t.status,Ur),notice:I(t.notice,1024)}}function ti(e){let t=H(e,[`commandId`,`mode`,`text`]);return{commandId:W(t.commandId),mode:z(t.mode,[`steer`,`queue`]),text:I(t.text,256)}}function ni(e){let t=H(e,[`tokens`,`provider`,`model`]);return{tokens:V(t.tokens,e=>L(e,1)),provider:I(t.provider,128),model:I(t.model,256)}}function ri(e){let t=H(e,[`input`,`read`,`write`]);return{input:L(t.input,0),read:L(t.read,0),write:L(t.write,0)}}function ii(e){let t=H(e,[`id`,`parent`,`text`,`at`,`leaf`,`current`]);return{id:Nr(t.id),parent:V(t.parent,Nr),text:I(t.text,1024),at:L(t.at,0),leaf:Nr(t.leaf),current:R(t.current)}}function ai(e){J(e,524288);let t=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(t===`image-upload`){let n=H(e,[`kind`,`commandId`,`imageId`,`offset`]);return{kind:t,commandId:W(n.commandId),imageId:W(n.imageId),offset:L(n.offset,0)}}if(t===`conversation-image`){let n=H(e,[`kind`,`mimeType`,`data`,`next`]);return{kind:t,mimeType:z(n.mimeType,Hn),data:I(n.data,Vn.chunkChars,!0),next:V(n.next,e=>L(e,0))}}if(t===`conversation-context`)return{kind:t,context:mn(H(e,[`kind`,`context`]).context)};if(t===`conversation-models`)return{kind:t,catalog:Sn(H(e,[`kind`,`catalog`]).catalog)};if(t===`conversation-model`){let n=H(e,[`kind`,`commandId`,`choice`]);return{kind:t,commandId:W(n.commandId),choice:_n(n.choice)}}if(t===`workflow-transcript`){let n=H(e,[`kind`,`runId`,`stepId`,`turn`]);return{kind:t,runId:W(n.runId),stepId:I(n.stepId,160,!0),turn:V(n.turn,qr)}}if(t===`cadence-conversation`)return{kind:t,state:Mr(H(e,[`kind`,`state`]).state)};if(t===`workflow-history-progress`){let n=H(e,[`kind`,`after`,`scan`]);return{kind:t,after:V(n.after,W),scan:W(n.scan)}}if(t===`workflow-history`){let n=H(e,[`kind`,`entries`,`next`]),r=U(n.entries,Gn.historyPage,e=>{let t=H(e,[`id`,`run`]),n=W(t.id),r=V(t.run,Sr);if(r&&r.id!==n)throw new P(`invalid`);return{id:n,run:r}}),i=V(n.next,W);if(new Set(r.map(e=>e.id)).size!==r.length||i!==null&&i!==r.at(-1)?.id)throw new P(`invalid`);return{kind:t,entries:r,next:i}}if(t===`workflow-active`){let n=typeof e==`object`&&!!e&&Object.hasOwn(e,`links`),r=H(e,[`kind`,`runs`,...n?[`links`]:[]]),i=U(r.runs,4,Sr),a=n?U(r.links,4,e=>{let t=H(e,[`runId`,`conversationId`]);return{runId:W(t.runId),conversationId:fn(t.conversationId)}}):[];if(new Set(a.map(e=>e.runId)).size!==a.length||a.some(e=>!i.some(t=>t.id===e.runId)))throw new P(`invalid`);return{kind:t,runs:i,links:a}}if(t===`cadence-grant`){let n=H(e,[`kind`,`commandId`,`grant`,`expiresAt`,`revision`,`proposal`]);return{kind:t,commandId:W(n.commandId),grant:W(n.grant),expiresAt:L(n.expiresAt,0),revision:L(n.revision,0),proposal:br(n.proposal)}}let n=Object.getOwnPropertyDescriptor(e??{},`kind`)?.value;if(n===`workflow`){let t=H(e,[`kind`,`commandId`,`response`]);return{kind:n,commandId:V(t.commandId,W),response:Cr(t.response)}}if(n===`conversation-active`)return{kind:n,entries:U(H(e,[`kind`,`entries`]).entries,8,$r)};if(n===`conversations`){let t=H(e,[`kind`,`entries`,`next`]);return{kind:n,entries:U(t.entries,200,$r),next:V(t.next,Hr)}}if(n===`conversation`){let t=H(e,[`kind`,`summary`,`leaf`,`continues`,`turns`,`branches`,`runs`,`attempt`,...Object.hasOwn(e??{},`commands`)?[`commands`]:[],...Object.hasOwn(e??{},`context`)?[`context`]:[],...Object.hasOwn(e??{},`cache`)?[`cache`]:[],...Object.hasOwn(e??{},`pending`)?[`pending`]:[],...Object.hasOwn(e??{},`undelivered`)?[`undelivered`]:[]]),r=V(t.summary,$r),i=L(t.turns,0);if(!r&&i)throw new P(`invalid`);return{kind:n,...t.commands===void 0?{}:{commands:U(t.commands,64,W)},...t.context===void 0?{}:{context:ni(t.context)},...t.cache===void 0?{}:{cache:ri(t.cache)},...t.pending===void 0?{}:{pending:U(t.pending,8,ti)},...t.undelivered===void 0?{}:{undelivered:U(t.undelivered,8,ei)},summary:r,leaf:V(t.leaf,Nr),continues:R(t.continues),turns:i,branches:L(t.branches,0),runs:U(t.runs,200,W),attempt:V(t.attempt,ei)}}if(n===`conversation-tree`){let t=H(e,[`kind`,`conversationId`,`nodes`,`truncated`]);return{kind:n,conversationId:fn(t.conversationId),nodes:U(t.nodes,Ir,ii),truncated:R(t.truncated)}}if(n===`conversation-turn`){let t=H(e,[`kind`,`conversationId`,`leaf`,`ordinal`,`turn`,`start`,`steps`]),r=Qr(t.turn),i=L(t.start,0),a=U(t.steps,24,Zr);if(i+a.length>r.steps)throw new P(`invalid`);return{kind:n,conversationId:fn(t.conversationId),leaf:V(t.leaf,Nr),ordinal:L(t.ordinal,0),turn:r,start:i,steps:a}}if(n===`conversation-step`){let t=H(e,[`kind`,`conversationId`,`leaf`,`turnId`,`step`,`part`,`item`]);return{kind:n,conversationId:fn(t.conversationId),leaf:V(t.leaf,Nr),turnId:Nr(t.turnId),step:L(t.step,0),part:L(t.part,0),item:Xr(t.item)}}if(n===`files`||n===`directories`){let t=H(e,[`kind`,`path`,`parent`,`entries`,`limited`]);return{kind:n,path:I(t.path,4096),parent:V(t.parent,e=>I(e,4096)),limited:R(t.limited),entries:U(t.entries,200,e=>{let t=H(e,[`name`,`path`,`directory`]);return{name:I(t.name,1024,!0),path:I(t.path,4096,!0),directory:R(t.directory)}})}}if(n===`file`){let t=H(e,[`kind`,`path`,`text`,`limited`]);return{kind:n,path:I(t.path,4096),text:I(t.text,262144),limited:R(t.limited)}}if(n===`file-part`){let t=H(e,[`kind`,`path`,`size`,`version`,`data`,`next`]),r=L(t.size,0),i=I(t.data,Pr/3*4),a=V(t.next,e=>L(e,1)),o=I(t.version,32,!0);if(r>67108864||!/^[a-f0-9]{32}$/.test(o)||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(i)||a!==null&&(a%196608!=0||a>=r))throw new P(`invalid`);return{kind:n,path:I(t.path,4096),size:r,version:o,data:i,next:a}}if(n===`projects`)return{kind:n,entries:U(H(e,[`kind`,`entries`]).entries,128,e=>{let t=H(e,[`path`,`current`]);return{path:I(t.path,4096,!0),current:R(t.current)}})};if(n===`accepted`)return{kind:n,commandId:W(H(e,[`kind`,`commandId`]).commandId)};let r=H(e,[`kind`,`commandId`,`path`,`link`]);return{kind:z(r.kind,[`project`]),commandId:W(r.commandId),path:I(r.path,4096,!0),link:I(r.link,8192,!0)}}var oi={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},si=f.createContext&&f.createContext(oi),ci=[`attr`,`size`,`title`];function li(e,t){if(e==null)return{};var n,r,i=ui(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ui(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function di(){return di=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},di.apply(null,arguments)}function fi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fi(Object(n),!0).forEach(function(t){mi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mi(e,t,n){return(t=hi(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hi(e){var t=gi(e,`string`);return typeof t==`symbol`?t:t+``}function gi(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _i(e){return e&&e.map((e,t)=>f.createElement(e.tag,pi({key:t},e.attr),_i(e.child)))}function $(e){return t=>f.createElement(vi,di({attr:pi({},e.attr)},t),_i(e.child))}function vi(e){var t=t=>{var n=e.attr,r=e.size,i=e.title,a=li(e,ci),o=r||t.size||`1em`,s;return t.className&&(s=t.className),e.className&&(s=(s?s+` `:``)+e.className),f.createElement(`svg`,di({stroke:`currentColor`,fill:`currentColor`,strokeWidth:`0`},t.attr,n,a,{className:s,style:pi(pi({color:e.color||t.color},t.style),e.style),height:o,width:o,xmlns:`http://www.w3.org/2000/svg`}),i&&f.createElement(`title`,null,i),e.children)};return si===void 0?t(oi):f.createElement(si.Consumer,null,e=>t(e))}function yi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`11`,x2:`14`,y2:`11`},child:[]}]})(e)}function bi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]},{tag:`line`,attr:{x1:`11`,y1:`8`,x2:`11`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`11`,x2:`14`,y2:`11`},child:[]}]})(e)}function xi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`18`,y1:`6`,x2:`6`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`18`,y2:`18`},child:[]}]})(e)}function Si(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`9`,x2:`9`,y2:`15`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`9`,x2:`15`,y2:`15`},child:[]}]})(e)}function Ci(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`},child:[]}]})(e)}function wi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`4 17 10 11 4 5`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`19`,x2:`20`,y2:`19`},child:[]}]})(e)}function Ti(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`5`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`1`,x2:`12`,y2:`3`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`21`,x2:`12`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`4.22`,y1:`4.22`,x2:`5.64`,y2:`5.64`},child:[]},{tag:`line`,attr:{x1:`18.36`,y1:`18.36`,x2:`19.78`,y2:`19.78`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`12`,x2:`3`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`12`,x2:`23`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`4.22`,y1:`19.78`,x2:`5.64`,y2:`18.36`},child:[]},{tag:`line`,attr:{x1:`18.36`,y1:`5.64`,x2:`19.78`,y2:`4.22`},child:[]}]})(e)}function Ei(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]}]})(e)}function Di(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`4.93`,y1:`4.93`,x2:`19.07`,y2:`19.07`},child:[]}]})(e)}function Oi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`3`,x2:`9`,y2:`21`},child:[]}]})(e)}function ki(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`2`,y:`2`,width:`20`,height:`8`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{x:`2`,y:`14`,width:`20`,height:`8`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`6`,x2:`6.01`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`6`,y1:`18`,x2:`6.01`,y2:`18`},child:[]}]})(e)}function Ai(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`11`,cy:`11`,r:`8`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`},child:[]}]})(e)}function ji(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`1 4 1 10 7 10`},child:[]},{tag:`path`,attr:{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`},child:[]}]})(e)}function Mi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`23 4 23 10 17 10`},child:[]},{tag:`polyline`,attr:{points:`1 20 1 14 7 14`},child:[]},{tag:`path`,attr:{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`},child:[]}]})(e)}function Ni(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function Pi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`19`,cy:`12`,r:`1`},child:[]},{tag:`circle`,attr:{cx:`5`,cy:`12`,r:`1`},child:[]}]})(e)}function Fi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`},child:[]}]})(e)}function Ii(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`2`,y:`3`,width:`20`,height:`14`,rx:`2`,ry:`2`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`21`,x2:`16`,y2:`21`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`17`,x2:`12`,y2:`21`},child:[]}]})(e)}function Li(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`5`,y1:`12`,x2:`19`,y2:`12`},child:[]}]})(e)}function Ri(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3`},child:[]}]})(e)}function zi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`},child:[]}]})(e)}function Bi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`21`,y2:`18`},child:[]}]})(e)}function Vi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3`},child:[]}]})(e)}function Hi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`},child:[]},{tag:`polyline`,attr:{points:`16 17 21 12 16 7`},child:[]},{tag:`line`,attr:{x1:`21`,y1:`12`,x2:`9`,y2:`12`},child:[]}]})(e)}function Ui(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`8`,y1:`6`,x2:`21`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`12`,x2:`21`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`8`,y1:`18`,x2:`21`,y2:`18`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`},child:[]}]})(e)}function Wi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`},child:[]},{tag:`path`,attr:{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`},child:[]}]})(e)}function Gi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polygon`,attr:{points:`12 2 2 7 12 12 22 7 12 2`},child:[]},{tag:`polyline`,attr:{points:`2 17 12 22 22 17`},child:[]},{tag:`polyline`,attr:{points:`2 12 12 17 22 12`},child:[]}]})(e)}function Ki(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`16`,x2:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`8`,x2:`12.01`,y2:`8`},child:[]}]})(e)}function qi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,ry:`2`},child:[]},{tag:`circle`,attr:{cx:`8.5`,cy:`8.5`,r:`1.5`},child:[]},{tag:`polyline`,attr:{points:`21 15 16 10 5 21`},child:[]}]})(e)}function Ji(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`},child:[]},{tag:`polyline`,attr:{points:`9 22 9 12 15 12 15 22`},child:[]}]})(e)}function Yi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`path`,attr:{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`},child:[]}]})(e)}function Xi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`2`,y1:`12`,x2:`22`,y2:`12`},child:[]},{tag:`path`,attr:{d:`M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`},child:[]}]})(e)}function Zi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`6`,y1:`3`,x2:`6`,y2:`15`},child:[]},{tag:`circle`,attr:{cx:`18`,cy:`6`,r:`3`},child:[]},{tag:`circle`,attr:{cx:`6`,cy:`18`,r:`3`},child:[]},{tag:`path`,attr:{d:`M18 9a9 9 0 0 1-9 9`},child:[]}]})(e)}function Qi(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},child:[]}]})(e)}function $i(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z`},child:[]},{tag:`polyline`,attr:{points:`13 2 13 9 20 9`},child:[]}]})(e)}function ea(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z`},child:[]},{tag:`polyline`,attr:{points:`14 2 14 8 20 8`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`13`,x2:`8`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`16`,y1:`17`,x2:`8`,y2:`17`},child:[]},{tag:`polyline`,attr:{points:`10 9 9 9 8 9`},child:[]}]})(e)}function ta(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`},child:[]},{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`3`},child:[]}]})(e)}function na(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M12 20h9`},child:[]},{tag:`path`,attr:{d:`M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z`},child:[]}]})(e)}function ra(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z`},child:[]}]})(e)}function ia(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`},child:[]},{tag:`polyline`,attr:{points:`7 10 12 15 17 10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`15`,x2:`12`,y2:`3`},child:[]}]})(e)}function aa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`ellipse`,attr:{cx:`12`,cy:`5`,rx:`9`,ry:`3`},child:[]},{tag:`path`,attr:{d:`M21 12c0 1.66-4 3-9 3s-9-1.34-9-3`},child:[]},{tag:`path`,attr:{d:`M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5`},child:[]}]})(e)}function oa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,ry:`2`},child:[]},{tag:`rect`,attr:{x:`9`,y:`9`,width:`6`,height:`6`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`1`,x2:`9`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`1`,x2:`15`,y2:`4`},child:[]},{tag:`line`,attr:{x1:`9`,y1:`20`,x2:`9`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`15`,y1:`20`,x2:`15`,y2:`23`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`9`,x2:`23`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`20`,y1:`14`,x2:`23`,y2:`14`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`9`,x2:`4`,y2:`9`},child:[]},{tag:`line`,attr:{x1:`1`,y1:`14`,x2:`4`,y2:`14`},child:[]}]})(e)}function sa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 14 4 9 9 4`},child:[]},{tag:`path`,attr:{d:`M20 20v-7a4 4 0 0 0-4-4H4`},child:[]}]})(e)}function ca(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`15 10 20 15 15 20`},child:[]},{tag:`path`,attr:{d:`M4 4v7a4 4 0 0 0 4 4h12`},child:[]}]})(e)}function la(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`rect`,attr:{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`},child:[]},{tag:`path`,attr:{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},child:[]}]})(e)}function ua(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polygon`,attr:{points:`16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76`},child:[]}]})(e)}function da(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`12 6 12 12 16 14`},child:[]}]})(e)}function fa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`},child:[]},{tag:`rect`,attr:{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,ry:`1`},child:[]}]})(e)}function pa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`18 15 12 9 6 15`},child:[]}]})(e)}function ma(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`9 18 15 12 9 6`},child:[]}]})(e)}function ha(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`15 18 9 12 15 6`},child:[]}]})(e)}function ga(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`6 9 12 15 18 9`},child:[]}]})(e)}function _a(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`20 6 9 17 4 12`},child:[]}]})(e)}function va(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M22 11.08V12a10 10 0 1 1-5.93-9.14`},child:[]},{tag:`polyline`,attr:{points:`22 4 12 14.01 9 11.01`},child:[]}]})(e)}function ya(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`19`,x2:`12`,y2:`5`},child:[]},{tag:`polyline`,attr:{points:`5 12 12 5 19 12`},child:[]}]})(e)}function ba(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`polyline`,attr:{points:`16 12 12 8 8 12`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`16`,x2:`12`,y2:`8`},child:[]}]})(e)}function xa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`19`,y1:`12`,x2:`5`,y2:`12`},child:[]},{tag:`polyline`,attr:{points:`12 19 5 12 12 5`},child:[]}]})(e)}function Sa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`line`,attr:{x1:`12`,y1:`5`,x2:`12`,y2:`19`},child:[]},{tag:`polyline`,attr:{points:`19 12 12 19 5 12`},child:[]}]})(e)}function Ca(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`polyline`,attr:{points:`21 8 21 21 3 21 3 8`},child:[]},{tag:`rect`,attr:{x:`1`,y:`3`,width:`22`,height:`5`},child:[]},{tag:`line`,attr:{x1:`10`,y1:`12`,x2:`14`,y2:`12`},child:[]}]})(e)}function wa(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`path`,attr:{d:`M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`9`,x2:`12`,y2:`13`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`},child:[]}]})(e)}function Ta(e){return $({tag:`svg`,attr:{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},child:[{tag:`circle`,attr:{cx:`12`,cy:`12`,r:`10`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`8`,x2:`12`,y2:`12`},child:[]},{tag:`line`,attr:{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`},child:[]}]})(e)}var Ea=e=>({kind:`error`,error:ae(`unavailable`,e?`uncertain`:`none`)}),Da=class{transport;constructor(e){this.transport=e}async workbenchRead(e,t){let n=Wr(e);try{if(!this.transport.workbenchRead)return Ea(!1);let e=Q(await this.transport.workbenchRead(n,t),ai);return e.kind===`ok`&&n.kind===`conversation-context`&&(e.value.kind!==n.kind||e.value.context.id!==n.location.id)?Ea(!1):e}catch{return Ea(!1)}}async workbenchCommand(e){let t=Kr(e);try{if(!this.transport.workbenchCommand)return Ea(!0);let e=Q(await this.transport.workbenchCommand(t),ai);return e.kind===`ok`&&(!(`commandId`in e.value)||e.value.commandId!==t.commandId)?Ea(!0):e}catch{return Ea(!0)}}async current(e,t){let n=rn(e);try{if(!this.transport.current)return Ea(!1);let e=Q(await this.transport.current(n,t),un);return e.kind===`ok`&&J(e.value.request)!==J(n)?Ea(!1):e}catch{return Ea(!1)}}async currentChanges(e,t){let n=an(e);try{if(!this.transport.currentChanges)return Ea(!1);let e=Q(await this.transport.currentChanges(n,t),dn);return e.kind===`ok`&&J(e.value.request)!==J(n)?Ea(!1):e}catch{return Ea(!1)}}async activeRuns(e){try{return this.transport.activeRuns?Q(await this.transport.activeRuns(e),rt):Ea(!1)}catch{return Ea(!1)}}async models(e,t){try{if(t){let n=await this.workbenchRead({kind:`conversation-models`,location:t},e);return n.kind===`error`?n:n.value.kind===`conversation-models`&&n.value.catalog.version.conversation?.id===t.id?{kind:`ok`,value:n.value.catalog}:Ea(!1)}return this.transport.models?Q(await this.transport.models(e),Sn):Ea(!1)}catch{return Ea(!1)}}async chooseModel(e,t){let n=vn(e);try{let e;if(t){let r=await this.workbenchCommand({kind:`conversation-model`,commandId:crypto.randomUUID(),location:t,...n});e=r.kind===`error`?r:r.value.kind===`conversation-model`?{kind:`ok`,value:r.value.choice}:Ea(!0)}else{if(!this.transport.chooseModel)return Ea(!1);e=Q(await this.transport.chooseModel(n),_n)}if(e.kind===`ok`){let{sourceSelectionId:r,...i}=e.value.selected??{};if(J(i)!==J(n.choice)||J(e.value.version.conversation??null)!==J(n.expected.conversation??null)||e.value.version.epoch!==n.expected.epoch||e.value.version.accessGeneration!==n.expected.accessGeneration||![n.expected.configRev,n.expected.configRev+1].includes(e.value.version.configRev)||!t&&e.value.version.configRev===n.expected.configRev!=(e.value.version.catalogId===n.expected.catalogId)||t&&e.value.version.configRev!==n.expected.configRev&&e.value.version.catalogId===n.expected.catalogId)return Ea(!0)}return e}catch{return Ea(!0)}}async checkObligations(e,t){W(e);try{let n=Q(await this.transport.checkObligations(e,t),Qt);return n.kind===`ok`&&n.value.taskId!==e?Ea(!1):n}catch{return Ea(!1)}}task(e,t){return this.entity(`task`,e,t)}message(e,t){return this.entity(`message`,e,t)}tool(e,t){return this.entity(`tool`,e,t)}async entity(e,t,n){let r=$t({...t,kind:e});try{let e=Q(await this.transport.entity(r,n),tn);return e.kind===`ok`&&J(e.value.request)!==J(r)?Ea(!1):e}catch{return Ea(!1)}}async session(e){try{return Q(await this.transport.session(e),Dt)}catch{return Ea(!1)}}async workspace(e){try{return Q(await this.transport.workspace(e),Ot)}catch{return Ea(!1)}}tasks(e,t){return this.page(`tasks`,e,t)}runs(e,t){return this.page(`runs`,e,t)}messages(e,t){return this.page(`messages`,e,t)}tools(e,t){return this.page(`tools`,e,t)}contents(e,t){return this.page(`contents`,e,t)}events(e,t){return this.page(`events`,e,t)}checks(e,t){return this.page(`checks`,e,t)}changes(e,t){return this.page(`changes`,e,t)}reviews(e,t){return this.page(`reviews`,e,t)}async page(e,t,n){let r=It({...t,reader:e});try{let t=Q(await this.transport[e](r,n),Ht);return t.kind===`ok`&&!Ut(r,t.value)?Ea(!1):t}catch{return Ea(!1)}}async graph(e,t){let n=Wt(e);try{let e=Q(await this.transport.graph(n,t),Kt);return e.kind===`ok`&&J(e.value.request)!==J(n)?Ea(!1):e}catch{return Ea(!1)}}async*export(e,t){let n=qt(e),r=new Xt(n),i;try{if(t.aborted)throw new P(`unavailable`);for await(let e of this.transport.export(n,t)){if(t.aborted)throw new P(`unavailable`);let n=r.receive(e);n.event.kind===`trailer`?i=n:yield n}if(t.aborted||!i)throw new P(`unavailable`);yield i}catch{throw new P(`unavailable`)}}async preflight(e,t){let n=Ee({expected:e,action:t});try{let e=Q(await this.transport.preflight(n),je);return e.kind===`ok`&&(J(e.value.preview.version)!==J(n.expected)||J(e.value.preview.action)!==J(n.action))?Ea(!1):e}catch{return Ea(!1)}}create(e){return this.execute(`create`,e)}savePlan(e){return this.execute(`save-plan`,e)}generatePlan(e){return this.execute(`generate-plan`,e)}start(e){return this.execute(`start`,e)}check(e){return this.execute(`check`,e)}review(e){return this.execute(`review`,e)}async execute(e,t){let n=De(t);if(n.action.kind!==e)return{kind:`error`,error:ae(`invalid`)};try{let e=Q(await this.transport.command(n),lt);if(e.kind===`ok`){if(e.value.commandId!==n.commandId)return Ea(!0);ut({identity:{kind:`action`,expected:n.expected,action:n.action},receipt:e.value})}return e}catch{return Ea(!0)}}async cancel(e){let t=ke(e);try{let e=Q(await this.transport.cancel(t),lt);if(e.kind===`ok`){if(e.value.commandId!==t.commandId)return Ea(!0);ut({identity:{kind:`cancel`,epoch:t.epoch,runId:t.runId},receipt:e.value})}return e}catch{return Ea(!0)}}async receipt(e,t){W(e);try{let n=dt(await this.transport.receipt(e,t));if(n.status===`found`&&n.receipt.commandId!==e)throw Error(`invalid`);return n}catch{return{status:`inconclusive`,error:ae(`receipt-inconclusive`,`uncertain`)}}}async snapshot(e,t){let n=Ie(e);try{let e=Q(await this.transport.snapshot(n,t),ht);return e.kind===`ok`&&J(e.value.scope)!==J(n)?Ea(!1):e}catch{return Ea(!1)}}async detail(e,t){let n=Re(e);try{let e=Q(await this.transport.detail(n,t),yt);return e.kind===`ok`&&J(e.value.cursor)!==J(n)?Ea(!1):e}catch{return Ea(!1)}}async search(e,t){let n=Re(e);try{let e=Q(await this.transport.search(n,t),xt);return e.kind===`ok`&&J(e.value.cursor)!==J(n)?Ea(!1):e}catch{return Ea(!1)}}},Oa=class{generation=0;snapshotRequest=0;observation;lastSnapshotMs=0;beginSnapshot(){return++this.snapshotRequest}install(e,t,n){if(n!==this.snapshotRequest)return;let r=ht(e),i=this.observation?.snapshot;if(i&&i.storeId===r.storeId&&J(i.scope)===J(r.scope)&&se(r.committedSeq,i.committedSeq)<0)this.resync();else return this.observation={snapshot:r,connection:`current`,lastObservedMs:t},this.lastSnapshotMs=t,++this.generation}resync(){return this.observation&&(this.observation.connection=`resync`),this.snapshotRequest++,`resync`}get state(){return this.observation&&structuredClone(this.observation)}needsPoll(e){return!this.observation||this.observation.connection===`resync`||e<this.lastSnapshotMs||e-this.lastSnapshotMs>=N.reconcileMs}tick(e){let t=this.observation;t&&t.connection!==`resync`&&(e<t.lastObservedMs||e-t.lastObservedMs>=N.staleMs)&&(t.connection=`stale`)}receive(e,t,n){let r=this.observation;if(!r||t!==this.generation)return`ignored`;if(r.connection===`resync`)return`resync`;let i;try{i=gt(e)}catch{return this.resync()}let a=r.snapshot;if(i.storeId!==a.storeId||i.epoch!==a.epoch||J(i.scope)!==J(a.scope))return this.resync();let o=se(i.committedSeq,a.committedSeq);if(o<0)return`duplicate`;if(i.kind===`heartbeat`)return o>0?this.resync():(r.lastObservedMs=n,r.connection=`current`,`applied`);if(o===0)return`duplicate`;if(i.previousSeq!==a.committedSeq||wt(i.context)!==wt(a.context)||Tt(i.context)!==Tt(a.context)||i.context.status===`available`&&a.context.status===`available`&&i.context.version.controlRev<a.context.version.controlRev)return this.resync();let s=[...a.runs];for(let e of i.removed){let t=s.findIndex(t=>(t.childRunId??t.runId)===e);if(t===-1||s[t].lifecycle!==`settled`)return this.resync();s.splice(t,1)}for(let e of i.runs){let t=e.childRunId??e.runId,n=s.findIndex(e=>(e.childRunId??e.runId)===t);if(n===-1)s.push(e);else{let t=s[n];if(t.runId!==e.runId||t.childRunId!==e.childRunId||t.assignmentId!==e.assignmentId||J(t.admission)!==J(e.admission))return this.resync();s[n]=e}}if(s.length>N.maxPageEntries)return this.resync();let c={...a,runs:s,context:i.context,committedSeq:i.committedSeq,horizon:{...a.horizon,historicalRuns:{...a.horizon.historicalRuns,snapshotSeq:i.committedSeq}}};try{ht(c)}catch{return this.resync()}return a.runs=s,a.horizon=c.horizon,a.context=i.context,a.committedSeq=i.committedSeq,r.lastObservedMs=n,r.connection=`current`,`applied`}};function ka(e=[],t){if(t!==void 0&&(!Number.isFinite(t)||t<0||t>2147483647))throw RangeError(`invalid abort timeout`);let n=new AbortController,r=new Map,i,a=!1,o=()=>{if(!a){a=!0,clearTimeout(i);for(let[e,t]of r)e.removeEventListener(`abort`,t);r.clear()}},s=e=>{a||(o(),n.abort(e))};for(let t of e){if(!t||r.has(t))continue;if(t.aborted){s(t.reason);break}let e=()=>s(t.reason);r.set(t,e),t.addEventListener(`abort`,e,{once:!0})}return!a&&t!==void 0&&(i=setTimeout(()=>s(new DOMException(`The wait timed out`,`TimeoutError`)),t)),{signal:n.signal,dispose:o}}var Aa={session:`/api/v1/session`,workbenchRead:`/api/v1/workbench/read`,workbenchCommand:`/api/v1/workbench/command`,current:`/api/v1/current`,currentChanges:`/api/v1/current-changes`,activeRuns:`/api/v1/active-runs`,models:`/api/v1/models`,chooseModel:`/api/v1/model-choice`,workspace:`/api/v1/workspace`,tasks:`/api/v1/tasks`,runs:`/api/v1/runs`,messages:`/api/v1/messages`,tools:`/api/v1/tools`,contents:`/api/v1/contents`,events:`/api/v1/history-events`,checks:`/api/v1/checks`,changes:`/api/v1/changes`,reviews:`/api/v1/reviews`,checkObligations:`/api/v1/check-obligations`,entity:`/api/v1/entity`,graph:`/api/v1/graph`,snapshot:`/api/v1/snapshot`,detail:`/api/v1/details`,search:`/api/v1/search`,export:`/api/v1/export`,download:`/api/v1/download`,preflight:`/api/v1/preflight`,command:`/api/v1/commands`,cancel:`/api/v1/cancel`,receipt:`/api/v1/receipt`,detach:`/api/v1/detach`},ja=`/api/v1/events`,Ma=[`tasks`,`runs`,`messages`,`tools`,`contents`,`events`,`checks`,`changes`,`reviews`];function Na(e,t){if(Ma.includes(e)||e===`detail`||e===`search`||e===`entity`||e===`current`||e===`currentChanges`||e===`activeRuns`||e===`workspace`||e===`models`||e===`chooseModel`||e===`workbenchRead`||e===`workbenchCommand`)return N.pageBytes;if(e===`graph`){let e=Object.getOwnPropertyDescriptor(t??{},`kind`)?.value,n=Object.getOwnPropertyDescriptor(t??{},`value`)?.value;if(e===`ok`&&Object.getOwnPropertyDescriptor(n??{},`kind`)?.value===`progress`)return N.pageBytes}return N.controlBytes}function Pa(e){return[`preflight`,`command`,`cancel`,`detach`,`chooseModel`,`workbenchCommand`].includes(e)}function Fa(e,t){switch(e){case`workbenchRead`:return Wr(t);case`workbenchCommand`:return Kr(t);case`session`:case`models`:case`activeRuns`:case`workspace`:case`detach`:if(t!==null)throw new P(`invalid`);return null;case`tasks`:case`runs`:case`messages`:case`tools`:case`contents`:case`events`:case`checks`:case`changes`:case`reviews`:{let n=It(t);if(n.reader!==e)throw new P(`invalid`);return n}case`current`:return rn(t);case`currentChanges`:return an(t);case`checkObligations`:case`receipt`:return W(t);case`entity`:return $t(t);case`graph`:return Wt(t);case`snapshot`:return Ie(t);case`detail`:case`search`:return Re(t);case`export`:case`download`:return qt(t);case`chooseModel`:return vn(t);case`preflight`:return Ee(t);case`command`:return De(t);case`cancel`:return ke(t)}}function Ia(e,t){if(Ma.includes(e))return Q(t,Ht);switch(e){case`workbenchRead`:case`workbenchCommand`:return Q(t,ai);case`current`:return Q(t,un);case`currentChanges`:return Q(t,dn);case`activeRuns`:return Q(t,rt);case`models`:return Q(t,Sn);case`chooseModel`:return Q(t,_n);case`session`:return Q(t,Dt);case`workspace`:return Q(t,Ot);case`checkObligations`:return Q(t,Qt);case`entity`:return Q(t,tn);case`graph`:return Q(t,Kt);case`snapshot`:return Q(t,ht);case`detail`:return Q(t,yt);case`search`:return Q(t,xt);case`preflight`:return Q(t,je);case`command`:case`cancel`:return Q(t,lt);case`receipt`:return dt(t);case`detach`:return Q(t,e=>{if(e!==null)throw new P(`invalid`);return null});default:throw new P(`invalid`)}}function La(e){return[...Ma,`workbenchRead`,`current`,`currentChanges`,`checkObligations`,`entity`,`graph`,`snapshot`,`detail`,`search`,`export`,`download`,`receipt`].includes(e)}function Ra(e,t){let n=Aa[e];return t===null||Pa(e)?n:`${n}?request=${encodeURIComponent(J(t))}`}function za(e,t){let n=Fa(e,t),r=typeof n==`object`&&!!n&&Object.hasOwn(n,`navigation`),i=r?Aa[e]:Ra(e,n);return Pa(e)||La(e)&&(r||oe(i)>N.headerBytes/4)?{path:Aa[e],method:`POST`,body:J(n)}:{path:i,method:`GET`}}function Ba(e){J(e,N.viewerBytes);let t=z(Object.getOwnPropertyDescriptor(e,`kind`)?.value,[`snapshot`,`event`,`resync`]);return t===`snapshot`?{kind:t,snapshot:ht(H(e,[`kind`,`snapshot`]).snapshot)}:t===`event`?{kind:t,event:gt(H(e,[`kind`,`event`]).event)}:(H(e,[`kind`]),{kind:t})}var Va=class{options;attachment;csrf=null;fetcher;origin;constructor(e){this.options=e;let t=new URL(e.origin);if(t.origin!==e.origin||t.protocol!==`https:`&&!/^http:\/\/(?:127\.0\.0\.1|\[::1\]):[1-9][0-9]*$/.test(e.origin)||e.project!==void 0&&!/^[a-f0-9]{64}$/.test(e.project))throw new P(`invalid`);this.origin=e.origin,e.build&&=ot(e.build),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis)}workbenchRead(e,t){return this.request(`workbenchRead`,e,t)}workbenchCommand(e){return this.request(`workbenchCommand`,e)}headers(e){let t={"Cache-Control":`no-store`};if(this.options.build&&(t[`X-Cadence-Build`]=J(this.options.build)),this.attachment&&(t[`X-Cadence-Attachment`]=this.attachment),this.options.localCapability&&(t[`X-Cadence-Local`]=this.options.localCapability),e){if(!this.attachment||!this.options.localCapability&&!this.csrf)throw new P(`stale`);t[`Content-Type`]=`application/json`,this.csrf&&(t[`X-Cadence-CSRF`]=this.csrf)}return t}async request(e,t,n){let r=za(e,Fa(e,t)),i=r.method===`POST`,a=this.options.requestTimeoutMs===void 0?void 0:ka([n],this.options.requestTimeoutMs),o=a?.signal??n;try{if(o?.aborted)throw o.reason;let t=await this.fetcher(`${this.origin}${this.options.project?`/projects/${this.options.project}`:``}${r.path}`,{method:r.method,headers:this.headers(i),credentials:`same-origin`,redirect:`error`,signal:o,...i?{body:r.body}:{}}),n;try{e===`session`&&t.ok&&(n=W(t.headers.get(`x-cadence-attachment`)),this.attachment=n)}catch(e){throw await t.body?.cancel().catch(()=>{}),e}let a=await Ha(t,Na(e)),s=ce(a);if(oe(a)>Na(e,s))throw new P(`oversize`);let c=Ia(e,s);if(e===`session`){let e=Q(c,Dt);if(e.kind===`ok`){if(e.value.authority===`local`!=!!this.options.localCapability)throw new P(`forbidden`);this.attachment=n??W(t.headers.get(`x-cadence-attachment`)),this.csrf=e.value.csrf}}return c}finally{a?.dispose()}}session(e){return this.request(`session`,null,e)}current(e,t){return this.request(`current`,e,t)}currentChanges(e,t){return this.request(`currentChanges`,e,t)}activeRuns(e){return this.request(`activeRuns`,null,e)}models(e){return this.request(`models`,null,e)}chooseModel(e){return this.request(`chooseModel`,vn(e))}workspace(e){return this.request(`workspace`,null,e)}checkObligations(e,t){return this.request(`checkObligations`,W(e),t)}entity(e,t){return this.request(`entity`,$t(e),t)}tasks(e,t){return this.request(`tasks`,It(e),t)}runs(e,t){return this.request(`runs`,It(e),t)}messages(e,t){return this.request(`messages`,It(e),t)}tools(e,t){return this.request(`tools`,It(e),t)}contents(e,t){return this.request(`contents`,It(e),t)}events(e,t){return this.request(`events`,It(e),t)}checks(e,t){return this.request(`checks`,It(e),t)}changes(e,t){return this.request(`changes`,It(e),t)}reviews(e,t){return this.request(`reviews`,It(e),t)}graph(e,t){return this.request(`graph`,Wt(e),t)}preflight(e){return this.request(`preflight`,Ee(e))}command(e){return this.request(`command`,De(e))}cancel(e){return this.request(`cancel`,ke(e))}receipt(e,t){return this.request(`receipt`,W(e),t)}snapshot(e,t){return this.request(`snapshot`,e,t)}detail(e,t){return this.request(`detail`,e,t)}search(e,t){return this.request(`search`,e,t)}async detach(){let e=this.attachment;if(!e)return;let t=Q(await this.request(`detach`,null),e=>{if(e!==null)throw new P(`invalid`);return null});if(t.kind===`error`&&t.error.code!==`stale`&&t.error.code!==`unauthenticated`)throw new P(t.error.code);return this.attachment===e&&(this.attachment=void 0,this.csrf=null),t}async*export(e,t){let n=za(`export`,qt(e)),r=await this.fetcher(`${this.origin}${this.options.project?`/projects/${this.options.project}`:``}${n.path}`,{method:n.method,headers:this.headers(n.method===`POST`),...n.body===void 0?{}:{body:n.body},credentials:`same-origin`,redirect:`error`,signal:t});if(!r.ok||!r.body)throw await r.body?.cancel(),new P(`unavailable`);let i=r.body.getReader(),a=new TextDecoder(`utf-8`,{fatal:!0}),o=``;try{for(;;){let{value:e,done:n}=await i.read();if(t.aborted)throw new P(`unavailable`);for(let t=0;t<(n?1:e.byteLength);t+=N.chunkBytes){o+=n?a.decode():a.decode(e.subarray(t,t+N.chunkBytes),{stream:!0});let r=o.indexOf(`
|
|
14
14
|
`);for(;r!==-1;){let e=o.slice(0,r);o=o.slice(r+1),yield Jt(ce(e,N.controlBytes)),r=o.indexOf(`
|
|
15
|
-
`)}if(new TextEncoder().encode(o).length>N.controlBytes)throw new P(`oversize`)}if(n){if(o)throw new P(`invalid`);break}}}finally{await i.cancel().catch(()=>{}),i.releaseLock()}}subscribe(e,t,n){let r=Ie(e);if(!this.attachment||!this.options.socket)throw new P(`unavailable`);let i=this.options.socket(`${this.origin.replace(/^http/,`ws`)}${this.options.project?`/projects/${this.options.project}`:``}${ja}?attachment=${this.attachment}`),a=!1,o=!1,s=Date.now(),c=Date.now(),l=()=>{if(!o){o=!0,a=!1,clearInterval(d);try{i.close()}catch{}u(`closed`)}},u=e=>{try{n(e)}catch{}},d=setInterval(()=>{if(a){Date.now()-s>=N.staleMs&&u(`stale`);try{Date.now()-c>=N.reconcileMs?(i.send(J({kind:`resync`,scope:r})),c=Date.now()):i.send(`{"kind":"ping"}`)}catch{l()}}},N.heartbeatMs);return i.addEventListener(`open`,()=>{if(!o){a=!0;try{i.send(J({kind:`subscribe`,scope:r}))}catch{l()}}}),i.addEventListener(`message`,e=>{if(!o)try{if(typeof e.data!=`string`)throw new P(`invalid`);let n=Ba(ce(e.data,N.viewerBytes));s=Date.now(),u(`current`),t(n)}catch{l()}}),i.addEventListener(`error`,l),i.addEventListener(`close`,l),l}};async function Ha(e,t){if(!e.body)throw new P(`invalid`);let n=e.body.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0}),i=0,a=``;try{for(;;){let{value:e,done:o}=await n.read();if(o)return a+r.decode();if(i+=e.byteLength,i>t)throw new P(`oversize`);a+=r.decode(e,{stream:!0})}}finally{await n.cancel().catch(()=>{}),n.releaseLock()}}var Ua={sourceHash:`9f3709e456a0724b1a6569914553188f4da7b2ad3516f5e75700df80bf376da5`,contractHash:`c62dcda9dc71daea1a7c8ef3f8b671c6a1cc0cfa4ddd98ed008eec9b3ea81245`,buildId:`ce52360537f4e4bd556ca798896f415fa13fe89e4b603cf2027b152eb60ef62c`},Wa=`reload-required`;function Ga(e){return ct(e,Ua?{kind:`browser`,...Ua}:null)}function Ka(e){if(!Ua)throw Error(`unsupported-context`);if(!Ga(e))throw Error(Wa)}function qa(e){let t=new Va({origin:window.location.origin,...e?{project:e}:{},...Ua?{build:{kind:`browser`,...Ua}}:{},socket:e=>new WebSocket(e)});return{client:new Da(t),transport:t}}function Ja(e,t){if(e.initiatorType!==`fetch`)return null;let n;try{n=new URL(e.name)}catch{return null}return n.origin!==t||!/^(?:\/projects\/[a-f0-9]{64})?\/api\/v1\//.test(n.pathname)||!(e.requestStart>0)||!(e.responseStart>=e.requestStart)?null:{at:e.responseStart,ms:e.responseStart-e.requestStart}}function Ya(e,t){let n=null;for(let r of e)t-r.at<=6e4&&(n===null||r.ms<n)&&(n=r.ms);return n===null?null:Math.round(n)}var Xa=[],Za=null,Qa,$a,eo=new Set;function to(){let e=Ya(Xa,performance.now());if(e!==Za){Za=e;for(let e of eo)e()}}function no(e){if(eo.add(e),eo.size===1&&typeof PerformanceObserver<`u`)try{Qa=new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=Ja(t,location.origin);e&&(Xa=[...Xa.slice(-19),e])}to()}),Qa.observe({type:`resource`,buffered:!0}),$a=setInterval(to,5e3)}catch{Qa=void 0}return()=>{eo.delete(e),!eo.size&&(Qa?.disconnect(),Qa=void 0,clearInterval($a),Xa=[],Za=null)}}function ro(){return(0,f.useSyncExternalStore)(no,()=>Za,()=>null)}function io(e,t){let n=new URLSearchParams(e).get(`project`),r=new URLSearchParams(t.replace(/^#/,``)).get(`chat`),i=null;try{i=r?fn(r):null}catch{}return{project:n&&/^[a-f0-9]{64}$/.test(n)?n:null,chat:i}}function ao(e=typeof window>`u`?``:window.location.search){return io(e,``).project}function oo(e=typeof window>`u`?``:window.location.hash){return io(``,e).chat}function so(){let e=ao();return e?`/projects/${e}`:``}function co(e=typeof window>`u`?``:window.location.hash,t){let n=new URLSearchParams(e.replace(/^#/,``));if(t!==void 0&&io(``,e).chat!==t)return{selected:!1,leaf:null};try{return{selected:n.get(`activity`)===`1`,leaf:n.has(`leaf`)?Nr(n.get(`leaf`)):null}}catch{return{selected:!1,leaf:null}}}function lo(e,t){let n=new URLSearchParams(e.replace(/^#/,``));return t===null?n.delete(`leaf`):n.set(`leaf`,Nr(t)),`#${n}`}function uo(e,t){if(typeof window>`u`||oo()!==e)return;let n=lo(window.location.hash,t);n!==window.location.hash&&history.replaceState(history.state,``,`${location.pathname}${location.search}${n}`)}function fo(e,t){if(e.commandId!==t.commandId)return e;let n=[e.receipt,e.lookup?.status===`found`?e.lookup.receipt:void 0,t.receipt,t.lookup?.status===`found`?t.lookup.receipt:void 0],r,i=!1;for(let t of n)t&&t.commandId===e.commandId&&(r&&(r.operationId!==t.operationId||r.runId!==t.runId||r.created!==null&&r.created.taskId!==t.created?.taskId)||r&&se(t.committedSeq,r.committedSeq)>0&&(r.created?.state===`published`&&t.created?.state!==`published`||r.admission===`accepted`&&t.admission!==`accepted`||r.execution!==null&&t.execution!==r.execution||r.settlement!==null&&J(t.settlement)!==J(r.settlement))?i=!0:(!r||se(t.committedSeq,r.committedSeq)>0||J(r)===J(t))&&(r=t));return{commandId:e.commandId,receipt:r,lookup:r?{status:`found`,receipt:r}:t.lookup??e.lookup,error:i?`Conflicting receipt observation refused; prior committed facts preserved.`:r?void 0:t.error??e.error}}function po(e,t,n=0){let r=JSON.stringify(t),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)({key:r,revision:-1});(0,f.useEffect)(()=>{if(r===`null`)return;let t=new AbortController,a,o=async()=>{let c=await e.workbenchRead(Wr(JSON.parse(r)),t.signal);t.signal.aborted||(s(e=>c.kind===`ok`?{key:r,revision:i,value:c.value}:{key:r,revision:i,value:e.key===r?e.value:void 0,error:c.error.code}),n&&(a=setTimeout(()=>void o(),n)))};return o(),()=>{t.abort(),clearTimeout(a)}},[e,r,i,n]);let c=(0,f.useCallback)(()=>a(e=>e+1),[]);return{...o.key===r?o:{},loading:r!==`null`&&(o.key!==r||o.revision!==i),refresh:c}}function mo(e,t){let n=/^\/cadence(?:\s+|$)/.exec(e.trimStart());return n?{mode:`cadence`,text:e.trimStart().slice(n[0].length)}:{mode:t,text:e}}function ho(e,t,n=!1){let[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)([]),s=po(e,t?{kind:`conversations`,after:r,...n?{archived:n}:{}}:null,r===null&&!n?2e3:0),c=s.value?.kind===`conversations`?s.value:void 0;return{value:c,error:s.error,loading:t&&!c&&!s.error,refresh:s.refresh,canPrevious:a.length>0,first:()=>{i(null),o([])},previous:()=>{a.length&&(i(a.at(-1)??null),o(e=>e.slice(0,-1)))},next:()=>{c?.next&&(o(e=>[...e,r]),i(c.next))}}}async function go(e){return ce(await Ha(e,1048576),1048576)}function _o(e){return e&&typeof e==`object`&&`kind`in e&&e.kind===`error`&&`error`in e&&e.error&&typeof e.error==`object`&&`code`in e.error?String(e.error.code):`unavailable`}function vo(e){let t=Error(_o(e));return e&&typeof e==`object`&&`kind`in e&&e.kind===`error`&&`error`in e&&e.error&&typeof e.error==`object`&&`effect`in e.error&&[`none`,`accepted`,`uncertain`].includes(String(e.error.effect))&&(t.effect=e.error.effect),t}async function yo(e,t,n){let r=await fetch(e,{credentials:`same-origin`,redirect:`error`,cache:`no-store`,signal:n}),i=await go(r);if(!r.ok)throw Error(_o(i));return t(i)}function bo(e){return yo(`/workbench/v1/service`,Rn,e)}function xo(e){return yo(`/workbench/v1/service/release`,zn,e)}async function So(e,t){if(!Ua)throw Error(`unavailable`);let n=await fetch(`/workbench/v1/service`,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{"Content-Type":`application/json`,"X-Cadence-CSRF":t,"X-Cadence-Build":JSON.stringify({kind:`browser`,...Ua})},body:JSON.stringify(e)}),r=await go(n);if(!n.ok)throw Error(_o(r));let i=H(r,[`kind`,`job`]);return B(i.kind,`service-job`),Fn(i.job)}function Co(e,t,n=!0){return!e||e.status===`unavailable`?`unknown`:t||!n?`stale`:e.status}function wo(e,t,n){return!t||t.status===`unavailable`?{value:e??t,error:n??`unavailable`}:{value:t,error:void 0}}function To(e,t){let[n,r]=(0,f.useState)(0),i=(0,f.useRef)(0),a=(0,f.useRef)(0),[o,s]=(0,f.useState)({});(0,f.useEffect)(()=>{if(!e)return;let r=++a.current,i=new AbortController,o=()=>!i.signal.aborted&&a.current===r,c,l=async()=>{if(o()){try{let r=await fetch(`/workbench/v1/projects/${e}`,{credentials:`same-origin`,redirect:`error`,cache:`no-store`,signal:i.signal}),a=await go(r);if(!r.ok)throw Error(_o(a));let c=wn(a);o()&&s(r=>({id:e,revision:n,selectedEpoch:t,...wo(r.id===e?r.value:void 0,c)}))}catch(r){o()&&s(i=>({id:e,revision:n,selectedEpoch:t,...wo(i.id===e?i.value:void 0,void 0,r instanceof Error?r.message:`unavailable`)}))}o()&&(c=setTimeout(()=>void l(),5e3))}};return l(),()=>{i.abort(),clearTimeout(c)}},[e,n,t]);let c=(0,f.useCallback)(()=>{++a.current;let e=++i.current;return r(e),e},[]),l=t=>{let n=c();s(r=>({id:e,revision:n,selectedEpoch:t,value:{kind:`project-observation`,status:`running`,epoch:t,workspaceId:r.id===e?r.value?.workspaceId??null:null}}))},u=o.id===e?o:{};return{...u,readiness:Co(u.value,u.error,u.revision===n&&u.selectedEpoch===t),refresh:c,prepared:l}}var Eo=e=>e===`unauthenticated`||e===`forbidden`,Do=class{api;serial=Promise.resolve();version=0;stopCurrent;pollCurrent;latest;readiness=new Set;nextObservation(){return this.version+1}whenReady(e,t,n=0){return new Promise((r,i)=>{let a=e=>{this.readiness.delete(o),t.removeEventListener(`abort`,s),e?i(e):r()},o=t=>{this.version<n||t.epoch!==e||(t.compatible===!1?a(Error(`unsupported-context`)):t.workspace?.epoch===e&&t.compatible&&!t.error&&t.transportStatus===`current`&&a())},s=()=>a(Error(this.latest?.error??`unavailable`));t.aborted?s():(this.readiness.add(o),t.addEventListener(`abort`,s,{once:!0}),this.latest&&o(this.latest))})}constructor(e){this.api=e}refresh(e=!1){this.pollCurrent?.(e)}observe(e,t){this.stopCurrent?.();let n=++this.version,r=!1,i,a,o,s=new AbortController,c=new Oa,l=0,u=0,d=!1,f=!1,p=0,m=!1,h=!1,g=!1,_={actions:!1,transportStatus:`closed`,attachmentVersion:0};this.latest=_;let v=()=>!r&&n===this.version,y=()=>{if(v()){this.latest={..._,observation:c.state},t(this.latest);for(let e of this.readiness)e(this.latest)}},b=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=b;let x=e=>{this.serial=this.serial.then(e).catch(()=>{v()&&(h=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),_.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,_.actions=!1,_.transportStatus=`closed`,_.workspace=void 0,c=new Oa,y())})},S=async()=>{await this.api.transport.detach()},C=async(t=!1)=>{if(!v()||!f||d||h)return;d=!0,_.actions=!1;let n=!1;y(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!v()||r.aborted?!1:e.kind===`error`?(_.actions=!1,_.error=e.error.code,Eo(e.error.code)&&w(),!1):(T(e.value),!0)};if(t&&!await i())return;e||(_.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!v()||r.aborted)return;if(a.kind===`ok`)_.activeRuns=a.value;else if(Eo(a.error.code)){w();return}else _.activeRuns=void 0;y();let o=await this.api.client.workspace(r);if(!v()||r.aborted)return;if(o.kind===`error`){_.error=o.error.code,Eo(o.error.code)&&w();return}if(!t&&J(_.workspace?.models??[])!==J(o.value.models)&&!await i())return;if(_.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!v()||r.aborted)return;if(i.kind===`error`)_.error=i.error.code,Eo(i.error.code)&&w();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),_.error=void 0,n=!0}}else _.error=void 0,n=!0}catch{v()&&(_.error=`Observation unavailable.`,_.actions=!1,_.transportStatus=`stale`)}finally{d=!1,m=!n,_.actions=n&&g,y()}},w=()=>{h=!0,_.actions=!1,_.transportStatus=`closed`,_.error=`Access revoked; explicit token re-entry required.`,_.workspace=void 0,_.activeRuns=void 0,c=new Oa,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),x(S),y()},T=e=>{let t=Ua?{kind:`browser`,...Ua}:null;_.compatible=ct(e.build,t),_.cancelCompatible=ct(e.build,t,!0),g=e.capabilities.actions&&_.compatible},E=async()=>{if(f=!1,await S(),!v()||h)return;let t=await this.api.client.session();if(!v()||h){await S();return}if(t.kind===`error`){h=!0,_.error=`${t.error.code}; explicit re-entry required.`,_.workspace=void 0,c=new Oa,_.actions=!1,y();return}if(f=!0,s=new AbortController,c=new Oa,_={epoch:t.value.epoch,actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:_.attachmentVersion+1},T(t.value),y(),await C(),!v()||h||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(v()&&!h&&n===u){if(e.kind===`snapshot`){let t=c.install(e.snapshot,Date.now(),c.beginSnapshot());t!==void 0&&(l=t)}else e.kind===`event`?c.receive(e.event,l,Date.now())===`resync`&&C():C();y()}},e=>{v()&&!h&&n===u&&(_.transportStatus=e,e===`closed`&&(f=!1,_.actions=!1,_.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>x(E),1e3)),y())})};return x(E),this.pollCurrent=e=>{C(e)},a=setInterval(()=>{v()&&!h&&(c.tick(Date.now()),y(),(Date.now()-p>=(m?2e3:3e4)||e&&c.needsPoll(Date.now()))&&C())},1e3),()=>{v()&&(b(),x(S))}}};function Oo(e,t,n,r){let i=(0,f.useMemo)(()=>new Do(e),[e]),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)({actions:!1,transportStatus:`closed`,attachmentVersion:0}),l=t?.kind,u=t?.id;return(0,f.useEffect)(()=>{if(c({actions:!1,transportStatus:`closed`,attachmentVersion:0}),n)return i.observe(l&&u?{kind:l,id:u}:null,c)},[i,l,u,n,r,a]),{...s,refresh:(e=!1)=>i.refresh(e),whenReady:(e,t,n)=>i.whenReady(e,t,n),reconnect:()=>{let e=i.nextObservation();return o(e=>e+1),e}}}var ko=class{generation=0;identity=``;select(e){e!==this.identity&&(this.identity=e,this.depart())}depart(){this.generation++}ticket(){return this.generation}current(e){return e===this.generation}};function Ao({client:e,value:t,onChange:n}){let{t:r,tx:i}=T(),a=(0,f.useRef)(!0),o=(0,f.useRef)(null);(0,f.useEffect)(()=>(a.current=!0,()=>{a.current=!1,o.current?.abort()}),[]);let[s,c]=(0,f.useState)(!1),l=t.receipt??(t.lookup?.status===`found`?t.lookup.receipt:void 0);return(0,h.jsxs)(`section`,{className:`receipt`,"aria-label":r(`Command receipt`),children:[(0,h.jsx)(`h3`,{children:r(`Command receipt`)}),(0,h.jsx)(`code`,{children:t.commandId}),t.error&&(0,h.jsx)(`p`,{role:`alert`,children:i(t.error)}),l&&(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Admission`)}),(0,h.jsx)(`dd`,{children:i(l.admission)}),(0,h.jsx)(`dt`,{children:r(`Execution`)}),(0,h.jsx)(`dd`,{children:l.execution?i(l.execution):r(`not settled`)}),(0,h.jsx)(`dt`,{children:r(`Publication`)}),(0,h.jsx)(`dd`,{children:i(l.publication)}),(0,h.jsx)(`dt`,{children:r(`Run`)}),(0,h.jsx)(`dd`,{children:l.runId??r(`metadata action`)})]}),t.lookup&&t.lookup.status!==`found`&&(0,h.jsx)(`p`,{children:r(`{status}. This observation does not authorize replay.`,{status:i(t.lookup.status)})}),(0,h.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),o.current=new AbortController,e.receipt(t.commandId,o.current.signal).then(e=>{a.current&&(n({commandId:t.commandId,lookup:e}),c(!1))})},children:r(`Observe exact receipt`)})]})}function jo(e,t){let n=e??{content:t.content,chunks:[],offset:0},r=n.content,i=t.content;if(r.recordId!==i.recordId||r.version!==i.version||r.field!==i.field||r.sha256!==i.sha256||r.bytes!==i.bytes||n.offset!==(t.range?.start??0))throw Error(`Noncontiguous immutable field`);return{...n,chunks:[...n.chunks,t.text],offset:t.range?.end??0}}function Mo(e,t,n){switch(t.reader){case`tasks`:return e.tasks(t,n);case`runs`:return e.runs(t,n);case`messages`:return e.messages(t,n);case`tools`:return e.tools(t,n);case`contents`:return e.contents(t,n);case`events`:return e.events(t,n);case`checks`:return e.checks(t,n);case`changes`:return e.changes(t,n);case`reviews`:return e.reviews(t,n)}}function No(e,t,n,r){return{storeId:e,scope:t,snapshotSeq:n,query:null,recordId:r.recordId,recordVersion:r.version,field:r.field,offset:0}}async function Po(e,t,n){let r={...t,offset:0};delete r.navigation;let i=null,a=!0;for(;r;){if(n.aborted)throw Error(`canceled`);let t=await e.detail(r,n);if(n.aborted)throw Error(`canceled`);if(t.kind===`error`)throw Error(t.error.code);let o=t.value;r=o.next,`kind`in o||(a&&=o.coverage.observed===`complete`,i=jo(i,o)),await new Promise(e=>setTimeout(e,0))}if(!i||i.offset!==i.content.bytes)throw Error(`incomplete-content`);return{text:i.chunks.join(``),recordingComplete:a}}function Fo(e,t){let n=t?J({reader:t.reader,storeId:t.storeId,scope:t.scope,limit:t.limit}):`absent`,[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)([]),m=(0,f.useRef)(0),[h,g]=(0,f.useState)(n);return h!==n&&(m.current++,g(n),i(void 0),c(void 0),u(t),p([])),(0,f.useEffect)(()=>{let t=++m.current;if(!l){o(!1);return}let n=new AbortController;return o(!0),c(void 0),Mo(e,l,n.signal).then(e=>{t===m.current&&(o(!1),e.kind===`error`?c(e.error.code):i(e.value))}).catch(()=>{t===m.current&&(c(`Read unavailable.`),o(!1))}),()=>{n.abort(),m.current++}},[e,l]),{page:r,busy:a,error:s,more:()=>{!a&&r?.next&&(l&&p(e=>[...e,l]),u(r.next))},previous:()=>{!a&&d.length&&(u(d[d.length-1]),p(e=>e.slice(0,-1)))},canPrevious:d.length>0,refresh:()=>{i(void 0),p([]),u(t?{...t}:null)}}}function Io({value:e,compact:t=!1}){let{t:n,tx:r}=T();return t&&e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?(0,h.jsxs)(`details`,{className:`coverage-details`,children:[(0,h.jsx)(`summary`,{children:n(`Recording details`)}),(0,h.jsx)(Io,{value:e})]}):(0,h.jsxs)(`p`,{className:`coverage${e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?``:` partial`}`,children:[n(`Recording: {observed}; source: {source};`,{observed:r(e.observed),source:r(e.source)}),` `,e.redacted?n(`redacted`):n(`no reported redaction`),e.omissions.length>0&&n(`; omitted: {omissions}`,{omissions:e.omissions.map(r).join(`, `)}),n(`. Not a guarantee of complete original source or universal secret detection.`)]})}function Lo(e){if(typeof document>`u`)return!1;let t=document.createElement(`textarea`),n=document.activeElement;try{return t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove(),n instanceof HTMLElement&&n.isConnected&&n.focus()}}async function Ro(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return Lo(e)}return Lo(e)}function zo(e={}){let{duration:t=2e3,onSuccess:n,onError:r}=e,i=(0,f.useRef)(!0),[a,o]=(0,f.useState)(!1),s=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),l=(0,f.useCallback)(()=>{c(),o(!1)},[c]);return(0,f.useEffect)(()=>(i.current=!0,()=>{i.current=!1,c()}),[c]),{copied:a,copy:(0,f.useCallback)(async e=>{let a=!1;try{a=await Ro(e)}catch(e){a=!1,r&&r(e)}return i.current&&(a?(o(!0),c(),s.current=setTimeout(()=>{o(!1),s.current=null},t),n?.(e)):r&&!a&&r(Error(`Copy failed`))),a},[t,n,r,c]),reset:l}}function Bo(e){let t=e=>{if(typeof e==`string`||typeof e==`number`){let t=String(e);return t===``?[[]]:t.split(`
|
|
15
|
+
`)}if(new TextEncoder().encode(o).length>N.controlBytes)throw new P(`oversize`)}if(n){if(o)throw new P(`invalid`);break}}}finally{await i.cancel().catch(()=>{}),i.releaseLock()}}subscribe(e,t,n){let r=Ie(e);if(!this.attachment||!this.options.socket)throw new P(`unavailable`);let i=this.options.socket(`${this.origin.replace(/^http/,`ws`)}${this.options.project?`/projects/${this.options.project}`:``}${ja}?attachment=${this.attachment}`),a=!1,o=!1,s=Date.now(),c=Date.now(),l=()=>{if(!o){o=!0,a=!1,clearInterval(d);try{i.close()}catch{}u(`closed`)}},u=e=>{try{n(e)}catch{}},d=setInterval(()=>{if(a){Date.now()-s>=N.staleMs&&u(`stale`);try{Date.now()-c>=N.reconcileMs?(i.send(J({kind:`resync`,scope:r})),c=Date.now()):i.send(`{"kind":"ping"}`)}catch{l()}}},N.heartbeatMs);return i.addEventListener(`open`,()=>{if(!o){a=!0;try{i.send(J({kind:`subscribe`,scope:r}))}catch{l()}}}),i.addEventListener(`message`,e=>{if(!o)try{if(typeof e.data!=`string`)throw new P(`invalid`);let n=Ba(ce(e.data,N.viewerBytes));s=Date.now(),u(`current`),t(n)}catch{l()}}),i.addEventListener(`error`,l),i.addEventListener(`close`,l),l}};async function Ha(e,t){if(!e.body)throw new P(`invalid`);let n=e.body.getReader(),r=new TextDecoder(`utf-8`,{fatal:!0}),i=0,a=``;try{for(;;){let{value:e,done:o}=await n.read();if(o)return a+r.decode();if(i+=e.byteLength,i>t)throw new P(`oversize`);a+=r.decode(e,{stream:!0})}}finally{await n.cancel().catch(()=>{}),n.releaseLock()}}var Ua={sourceHash:`700a0d4bb0f6773b127eb8398b3debba8f39c10df4ef0cf5f0a5266a6d7d3cfd`,contractHash:`c62dcda9dc71daea1a7c8ef3f8b671c6a1cc0cfa4ddd98ed008eec9b3ea81245`,buildId:`fddca6045ef6bbe41c68d5071d20d7f51c1056b58d104341f3762022ac6e1270`},Wa=`reload-required`;function Ga(e){return ct(e,Ua?{kind:`browser`,...Ua}:null)}function Ka(e){if(!Ua)throw Error(`unsupported-context`);if(!Ga(e))throw Error(Wa)}function qa(e){let t=new Va({origin:window.location.origin,...e?{project:e}:{},...Ua?{build:{kind:`browser`,...Ua}}:{},socket:e=>new WebSocket(e)});return{client:new Da(t),transport:t}}function Ja(e,t){if(e.initiatorType!==`fetch`)return null;let n;try{n=new URL(e.name)}catch{return null}return n.origin!==t||!/^(?:\/projects\/[a-f0-9]{64})?\/api\/v1\//.test(n.pathname)||!(e.requestStart>0)||!(e.responseStart>=e.requestStart)?null:{at:e.responseStart,ms:e.responseStart-e.requestStart}}function Ya(e,t){let n=null;for(let r of e)t-r.at<=6e4&&(n===null||r.ms<n)&&(n=r.ms);return n===null?null:Math.round(n)}var Xa=[],Za=null,Qa,$a,eo=new Set;function to(){let e=Ya(Xa,performance.now());if(e!==Za){Za=e;for(let e of eo)e()}}function no(e){if(eo.add(e),eo.size===1&&typeof PerformanceObserver<`u`)try{Qa=new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=Ja(t,location.origin);e&&(Xa=[...Xa.slice(-19),e])}to()}),Qa.observe({type:`resource`,buffered:!0}),$a=setInterval(to,5e3)}catch{Qa=void 0}return()=>{eo.delete(e),!eo.size&&(Qa?.disconnect(),Qa=void 0,clearInterval($a),Xa=[],Za=null)}}function ro(){return(0,f.useSyncExternalStore)(no,()=>Za,()=>null)}function io(e,t){let n=new URLSearchParams(e).get(`project`),r=new URLSearchParams(t.replace(/^#/,``)).get(`chat`),i=null;try{i=r?fn(r):null}catch{}return{project:n&&/^[a-f0-9]{64}$/.test(n)?n:null,chat:i}}function ao(e=typeof window>`u`?``:window.location.search){return io(e,``).project}function oo(e=typeof window>`u`?``:window.location.hash){return io(``,e).chat}function so(){let e=ao();return e?`/projects/${e}`:``}function co(e=typeof window>`u`?``:window.location.hash,t){let n=new URLSearchParams(e.replace(/^#/,``));if(t!==void 0&&io(``,e).chat!==t)return{selected:!1,leaf:null};try{return{selected:n.get(`activity`)===`1`,leaf:n.has(`leaf`)?Nr(n.get(`leaf`)):null}}catch{return{selected:!1,leaf:null}}}function lo(e,t){let n=new URLSearchParams(e.replace(/^#/,``));return t===null?n.delete(`leaf`):n.set(`leaf`,Nr(t)),`#${n}`}function uo(e,t){if(typeof window>`u`||oo()!==e)return;let n=lo(window.location.hash,t);n!==window.location.hash&&history.replaceState(history.state,``,`${location.pathname}${location.search}${n}`)}function fo(e,t){if(e.commandId!==t.commandId)return e;let n=[e.receipt,e.lookup?.status===`found`?e.lookup.receipt:void 0,t.receipt,t.lookup?.status===`found`?t.lookup.receipt:void 0],r,i=!1;for(let t of n)t&&t.commandId===e.commandId&&(r&&(r.operationId!==t.operationId||r.runId!==t.runId||r.created!==null&&r.created.taskId!==t.created?.taskId)||r&&se(t.committedSeq,r.committedSeq)>0&&(r.created?.state===`published`&&t.created?.state!==`published`||r.admission===`accepted`&&t.admission!==`accepted`||r.execution!==null&&t.execution!==r.execution||r.settlement!==null&&J(t.settlement)!==J(r.settlement))?i=!0:(!r||se(t.committedSeq,r.committedSeq)>0||J(r)===J(t))&&(r=t));return{commandId:e.commandId,receipt:r,lookup:r?{status:`found`,receipt:r}:t.lookup??e.lookup,error:i?`Conflicting receipt observation refused; prior committed facts preserved.`:r?void 0:t.error??e.error}}function po(e,t,n=0){let r=JSON.stringify(t),[i,a]=(0,f.useState)(0),[o,s]=(0,f.useState)({key:r,revision:-1});(0,f.useEffect)(()=>{if(r===`null`)return;let t=new AbortController,a,o=async()=>{let c=await e.workbenchRead(Wr(JSON.parse(r)),t.signal);t.signal.aborted||(s(e=>c.kind===`ok`?{key:r,revision:i,value:c.value}:{key:r,revision:i,value:e.key===r?e.value:void 0,error:c.error.code}),n&&(a=setTimeout(()=>void o(),n)))};return o(),()=>{t.abort(),clearTimeout(a)}},[e,r,i,n]);let c=(0,f.useCallback)(()=>a(e=>e+1),[]);return{...o.key===r?o:{},loading:r!==`null`&&(o.key!==r||o.revision!==i),refresh:c}}function mo(e,t){let n=/^\/cadence(?:\s+|$)/.exec(e.trimStart());return n?{mode:`cadence`,text:e.trimStart().slice(n[0].length)}:{mode:t,text:e}}function ho(e,t,n=!1){let[r,i]=(0,f.useState)(null),[a,o]=(0,f.useState)([]),s=po(e,t?{kind:`conversations`,after:r,...n?{archived:n}:{}}:null,r===null&&!n?2e3:0),c=s.value?.kind===`conversations`?s.value:void 0;return{value:c,error:s.error,loading:t&&!c&&!s.error,refresh:s.refresh,canPrevious:a.length>0,first:()=>{i(null),o([])},previous:()=>{a.length&&(i(a.at(-1)??null),o(e=>e.slice(0,-1)))},next:()=>{c?.next&&(o(e=>[...e,r]),i(c.next))}}}async function go(e){return ce(await Ha(e,1048576),1048576)}function _o(e){return e&&typeof e==`object`&&`kind`in e&&e.kind===`error`&&`error`in e&&e.error&&typeof e.error==`object`&&`code`in e.error?String(e.error.code):`unavailable`}function vo(e){let t=Error(_o(e));return e&&typeof e==`object`&&`kind`in e&&e.kind===`error`&&`error`in e&&e.error&&typeof e.error==`object`&&`effect`in e.error&&[`none`,`accepted`,`uncertain`].includes(String(e.error.effect))&&(t.effect=e.error.effect),t}async function yo(e,t,n){let r=await fetch(e,{credentials:`same-origin`,redirect:`error`,cache:`no-store`,signal:n}),i=await go(r);if(!r.ok)throw Error(_o(i));return t(i)}function bo(e){return yo(`/workbench/v1/service`,Rn,e)}function xo(e){return yo(`/workbench/v1/service/release`,zn,e)}async function So(e,t){if(!Ua)throw Error(`unavailable`);let n=await fetch(`/workbench/v1/service`,{method:`POST`,credentials:`same-origin`,redirect:`error`,headers:{"Content-Type":`application/json`,"X-Cadence-CSRF":t,"X-Cadence-Build":JSON.stringify({kind:`browser`,...Ua})},body:JSON.stringify(e)}),r=await go(n);if(!n.ok)throw Error(_o(r));let i=H(r,[`kind`,`job`]);return B(i.kind,`service-job`),Fn(i.job)}function Co(e,t,n=!0){return!e||e.status===`unavailable`?`unknown`:t||!n?`stale`:e.status}function wo(e,t,n){return!t||t.status===`unavailable`?{value:e??t,error:n??`unavailable`}:{value:t,error:void 0}}function To(e,t){let[n,r]=(0,f.useState)(0),i=(0,f.useRef)(0),a=(0,f.useRef)(0),[o,s]=(0,f.useState)({});(0,f.useEffect)(()=>{if(!e)return;let r=++a.current,i=new AbortController,o=()=>!i.signal.aborted&&a.current===r,c,l=async()=>{if(o()){try{let r=await fetch(`/workbench/v1/projects/${e}`,{credentials:`same-origin`,redirect:`error`,cache:`no-store`,signal:i.signal}),a=await go(r);if(!r.ok)throw Error(_o(a));let c=wn(a);o()&&s(r=>({id:e,revision:n,selectedEpoch:t,...wo(r.id===e?r.value:void 0,c)}))}catch(r){o()&&s(i=>({id:e,revision:n,selectedEpoch:t,...wo(i.id===e?i.value:void 0,void 0,r instanceof Error?r.message:`unavailable`)}))}o()&&(c=setTimeout(()=>void l(),5e3))}};return l(),()=>{i.abort(),clearTimeout(c)}},[e,n,t]);let c=(0,f.useCallback)(()=>{++a.current;let e=++i.current;return r(e),e},[]),l=t=>{let n=c();s(r=>({id:e,revision:n,selectedEpoch:t,value:{kind:`project-observation`,status:`running`,epoch:t,workspaceId:r.id===e?r.value?.workspaceId??null:null}}))},u=o.id===e?o:{};return{...u,readiness:Co(u.value,u.error,u.revision===n&&u.selectedEpoch===t),refresh:c,prepared:l}}var Eo=e=>e===`unauthenticated`||e===`forbidden`,Do=class{api;serial=Promise.resolve();version=0;stopCurrent;pollCurrent;latest;readiness=new Set;nextObservation(){return this.version+1}whenReady(e,t,n=0){return new Promise((r,i)=>{let a=e=>{this.readiness.delete(o),t.removeEventListener(`abort`,s),e?i(e):r()},o=t=>{this.version<n||t.epoch!==e||(t.compatible===!1?a(Error(`unsupported-context`)):t.workspace?.epoch===e&&t.compatible&&!t.error&&t.transportStatus===`current`&&a())},s=()=>a(Error(this.latest?.error??`unavailable`));t.aborted?s():(this.readiness.add(o),t.addEventListener(`abort`,s,{once:!0}),this.latest&&o(this.latest))})}constructor(e){this.api=e}refresh(e=!1){this.pollCurrent?.(e)}observe(e,t){this.stopCurrent?.();let n=++this.version,r=!1,i,a,o,s=new AbortController,c=new Oa,l=0,u=0,d=!1,f=!1,p=0,m=!1,h=!1,g=!1,_={actions:!1,transportStatus:`closed`,attachmentVersion:0};this.latest=_;let v=()=>!r&&n===this.version,y=()=>{if(v()){this.latest={..._,observation:c.state},t(this.latest);for(let e of this.readiness)e(this.latest)}},b=()=>{r||(r=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),n===this.version&&(this.pollCurrent=void 0))};this.stopCurrent=b;let x=e=>{this.serial=this.serial.then(e).catch(()=>{v()&&(h=!0,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),_.error=`Observation unavailable or detach unconfirmed; explicit re-entry required.`,_.actions=!1,_.transportStatus=`closed`,_.workspace=void 0,c=new Oa,y())})},S=async()=>{await this.api.transport.detach()},C=async(t=!1)=>{if(!v()||!f||d||h)return;d=!0,_.actions=!1;let n=!1;y(),p=Date.now();let r=s.signal;try{let i=async()=>{let e=await this.api.client.session(r);return!v()||r.aborted?!1:e.kind===`error`?(_.actions=!1,_.error=e.error.code,Eo(e.error.code)&&w(),!1):(T(e.value),!0)};if(t&&!await i())return;e||(_.transportStatus=`current`);let a=await this.api.client.activeRuns(r);if(!v()||r.aborted)return;if(a.kind===`ok`)_.activeRuns=a.value;else if(Eo(a.error.code)){w();return}else _.activeRuns=void 0;y();let o=await this.api.client.workspace(r);if(!v()||r.aborted)return;if(o.kind===`error`){_.error=o.error.code,Eo(o.error.code)&&w();return}if(!t&&J(_.workspace?.models??[])!==J(o.value.models)&&!await i())return;if(_.workspace=o.value,e){let t=c.beginSnapshot(),i=await this.api.client.snapshot(e,r);if(!v()||r.aborted)return;if(i.kind===`error`)_.error=i.error.code,Eo(i.error.code)&&w();else{let e=c.install(i.value,Date.now(),t);e!==void 0&&(l=e),_.error=void 0,n=!0}}else _.error=void 0,n=!0}catch{v()&&(_.error=`Observation unavailable.`,_.actions=!1,_.transportStatus=`stale`)}finally{d=!1,m=!n,_.actions=n&&g,y()}},w=()=>{h=!0,_.actions=!1,_.transportStatus=`closed`,_.error=`Access revoked; explicit token re-entry required.`,_.workspace=void 0,_.activeRuns=void 0,c=new Oa,s.abort(),clearInterval(a),clearTimeout(o),u++,i?.(),x(S),y()},T=e=>{let t=Ua?{kind:`browser`,...Ua}:null;_.compatible=ct(e.build,t),_.cancelCompatible=ct(e.build,t,!0),g=e.capabilities.actions&&_.compatible},E=async()=>{if(f=!1,await S(),!v()||h)return;let t=await this.api.client.session();if(!v()||h){await S();return}if(t.kind===`error`){h=!0,_.error=`${t.error.code}; explicit re-entry required.`,_.workspace=void 0,c=new Oa,_.actions=!1,y();return}if(f=!0,s=new AbortController,c=new Oa,_={epoch:t.value.epoch,actions:t.value.capabilities.actions,transportStatus:`closed`,attachmentVersion:_.attachmentVersion+1},T(t.value),y(),await C(),!v()||h||!e)return;let n=++u;i=this.api.transport.subscribe(e,e=>{if(v()&&!h&&n===u){if(e.kind===`snapshot`){let t=c.install(e.snapshot,Date.now(),c.beginSnapshot());t!==void 0&&(l=t)}else e.kind===`event`?c.receive(e.event,l,Date.now())===`resync`&&C():C();y()}},e=>{v()&&!h&&n===u&&(_.transportStatus=e,e===`closed`&&(f=!1,_.actions=!1,_.attachmentVersion++,s.abort(),u++,o=setTimeout(()=>x(E),1e3)),y())})};return x(E),this.pollCurrent=e=>{C(e)},a=setInterval(()=>{v()&&!h&&(c.tick(Date.now()),y(),(Date.now()-p>=(m?2e3:3e4)||e&&c.needsPoll(Date.now()))&&C())},1e3),()=>{v()&&(b(),x(S))}}};function Oo(e,t,n,r){let i=(0,f.useMemo)(()=>new Do(e),[e]),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)({actions:!1,transportStatus:`closed`,attachmentVersion:0}),l=t?.kind,u=t?.id;return(0,f.useEffect)(()=>{if(c({actions:!1,transportStatus:`closed`,attachmentVersion:0}),n)return i.observe(l&&u?{kind:l,id:u}:null,c)},[i,l,u,n,r,a]),{...s,refresh:(e=!1)=>i.refresh(e),whenReady:(e,t,n)=>i.whenReady(e,t,n),reconnect:()=>{let e=i.nextObservation();return o(e=>e+1),e}}}var ko=class{generation=0;identity=``;select(e){e!==this.identity&&(this.identity=e,this.depart())}depart(){this.generation++}ticket(){return this.generation}current(e){return e===this.generation}};function Ao({client:e,value:t,onChange:n}){let{t:r,tx:i}=T(),a=(0,f.useRef)(!0),o=(0,f.useRef)(null);(0,f.useEffect)(()=>(a.current=!0,()=>{a.current=!1,o.current?.abort()}),[]);let[s,c]=(0,f.useState)(!1),l=t.receipt??(t.lookup?.status===`found`?t.lookup.receipt:void 0);return(0,h.jsxs)(`section`,{className:`receipt`,"aria-label":r(`Command receipt`),children:[(0,h.jsx)(`h3`,{children:r(`Command receipt`)}),(0,h.jsx)(`code`,{children:t.commandId}),t.error&&(0,h.jsx)(`p`,{role:`alert`,children:i(t.error)}),l&&(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Admission`)}),(0,h.jsx)(`dd`,{children:i(l.admission)}),(0,h.jsx)(`dt`,{children:r(`Execution`)}),(0,h.jsx)(`dd`,{children:l.execution?i(l.execution):r(`not settled`)}),(0,h.jsx)(`dt`,{children:r(`Publication`)}),(0,h.jsx)(`dd`,{children:i(l.publication)}),(0,h.jsx)(`dt`,{children:r(`Run`)}),(0,h.jsx)(`dd`,{children:l.runId??r(`metadata action`)})]}),t.lookup&&t.lookup.status!==`found`&&(0,h.jsx)(`p`,{children:r(`{status}. This observation does not authorize replay.`,{status:i(t.lookup.status)})}),(0,h.jsx)(`button`,{type:`button`,disabled:s,onClick:()=>{c(!0),o.current=new AbortController,e.receipt(t.commandId,o.current.signal).then(e=>{a.current&&(n({commandId:t.commandId,lookup:e}),c(!1))})},children:r(`Observe exact receipt`)})]})}function jo(e,t){let n=e??{content:t.content,chunks:[],offset:0},r=n.content,i=t.content;if(r.recordId!==i.recordId||r.version!==i.version||r.field!==i.field||r.sha256!==i.sha256||r.bytes!==i.bytes||n.offset!==(t.range?.start??0))throw Error(`Noncontiguous immutable field`);return{...n,chunks:[...n.chunks,t.text],offset:t.range?.end??0}}function Mo(e,t,n){switch(t.reader){case`tasks`:return e.tasks(t,n);case`runs`:return e.runs(t,n);case`messages`:return e.messages(t,n);case`tools`:return e.tools(t,n);case`contents`:return e.contents(t,n);case`events`:return e.events(t,n);case`checks`:return e.checks(t,n);case`changes`:return e.changes(t,n);case`reviews`:return e.reviews(t,n)}}function No(e,t,n,r){return{storeId:e,scope:t,snapshotSeq:n,query:null,recordId:r.recordId,recordVersion:r.version,field:r.field,offset:0}}async function Po(e,t,n){let r={...t,offset:0};delete r.navigation;let i=null,a=!0;for(;r;){if(n.aborted)throw Error(`canceled`);let t=await e.detail(r,n);if(n.aborted)throw Error(`canceled`);if(t.kind===`error`)throw Error(t.error.code);let o=t.value;r=o.next,`kind`in o||(a&&=o.coverage.observed===`complete`,i=jo(i,o)),await new Promise(e=>setTimeout(e,0))}if(!i||i.offset!==i.content.bytes)throw Error(`incomplete-content`);return{text:i.chunks.join(``),recordingComplete:a}}function Fo(e,t){let n=t?J({reader:t.reader,storeId:t.storeId,scope:t.scope,limit:t.limit}):`absent`,[r,i]=(0,f.useState)(),[a,o]=(0,f.useState)(!1),[s,c]=(0,f.useState)(),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)([]),m=(0,f.useRef)(0),[h,g]=(0,f.useState)(n);return h!==n&&(m.current++,g(n),i(void 0),c(void 0),u(t),p([])),(0,f.useEffect)(()=>{let t=++m.current;if(!l){o(!1);return}let n=new AbortController;return o(!0),c(void 0),Mo(e,l,n.signal).then(e=>{t===m.current&&(o(!1),e.kind===`error`?c(e.error.code):i(e.value))}).catch(()=>{t===m.current&&(c(`Read unavailable.`),o(!1))}),()=>{n.abort(),m.current++}},[e,l]),{page:r,busy:a,error:s,more:()=>{!a&&r?.next&&(l&&p(e=>[...e,l]),u(r.next))},previous:()=>{!a&&d.length&&(u(d[d.length-1]),p(e=>e.slice(0,-1)))},canPrevious:d.length>0,refresh:()=>{i(void 0),p([]),u(t?{...t}:null)}}}function Io({value:e,compact:t=!1}){let{t:n,tx:r}=T();return t&&e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?(0,h.jsxs)(`details`,{className:`coverage-details`,children:[(0,h.jsx)(`summary`,{children:n(`Recording details`)}),(0,h.jsx)(Io,{value:e})]}):(0,h.jsxs)(`p`,{className:`coverage${e.observed===`complete`&&e.source===`complete`&&!e.redacted&&e.omissions.length===0?``:` partial`}`,children:[n(`Recording: {observed}; source: {source};`,{observed:r(e.observed),source:r(e.source)}),` `,e.redacted?n(`redacted`):n(`no reported redaction`),e.omissions.length>0&&n(`; omitted: {omissions}`,{omissions:e.omissions.map(r).join(`, `)}),n(`. Not a guarantee of complete original source or universal secret detection.`)]})}function Lo(e){if(typeof document>`u`)return!1;let t=document.createElement(`textarea`),n=document.activeElement;try{return t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,t.setAttribute(`readonly`,``),document.body.appendChild(t),t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove(),n instanceof HTMLElement&&n.isConnected&&n.focus()}}async function Ro(e){if(typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`)try{return await navigator.clipboard.writeText(e),!0}catch{return Lo(e)}return Lo(e)}function zo(e={}){let{duration:t=2e3,onSuccess:n,onError:r}=e,i=(0,f.useRef)(!0),[a,o]=(0,f.useState)(!1),s=(0,f.useRef)(null),c=(0,f.useCallback)(()=>{s.current!==null&&(clearTimeout(s.current),s.current=null)},[]),l=(0,f.useCallback)(()=>{c(),o(!1)},[c]);return(0,f.useEffect)(()=>(i.current=!0,()=>{i.current=!1,c()}),[c]),{copied:a,copy:(0,f.useCallback)(async e=>{let a=!1;try{a=await Ro(e)}catch(e){a=!1,r&&r(e)}return i.current&&(a?(o(!0),c(),s.current=setTimeout(()=>{o(!1),s.current=null},t),n?.(e)):r&&!a&&r(Error(`Copy failed`))),a},[t,n,r,c]),reset:l}}function Bo(e){let t=e=>{if(typeof e==`string`||typeof e==`number`){let t=String(e);return t===``?[[]]:t.split(`
|
|
16
16
|
`).map(e=>e===``?[]:[e])}if(Array.isArray(e)){let n=[];for(let r of e){let e=t(r);if(n.length===0)n=e;else{let t=e[0]??[];n[n.length-1].push(...t),n.push(...e.slice(1))}}return n}if(e&&typeof e==`object`&&`props`in e){let n=e,r=n.props?.children,i={...n.props,children:void 0},a=r==null?[]:t(r);return a.length===0?[[(0,f.createElement)(n.type,i)]]:a.map(e=>[(0,f.createElement)(n.type,i,...e)])}return[[e]]},n=t(e);return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var Vo=function(){let e=this.data();e.micromarkExtensions??=[],e.micromarkExtensions.push({flow:{92:Ho(!0)},text:{92:Ho(!1)}});let t={enter:{backslashMathInline:Uo,backslashMathDisplay:Uo,backslashMathBlock:Uo},exit:{backslashMathInline:Wo,backslashMathDisplay:Wo,backslashMathBlock:Wo}};e.fromMarkdownExtensions??=[],e.fromMarkdownExtensions.push(t)};function Ho(e){return{tokenize:function(t,n,r){let i=this,a=93,o=e?`backslashMathBlock`:`backslashMathDisplay`,s;return c;function c(e){return e===92?(s=t.enter(o),t.consume(e),l):r(e)}function l(n){return n!==91&&(e||n!==40)?r(n):(a=n===91?93:41,!e&&n===40&&(o=`backslashMathInline`,s.type=o),t.consume(n),u)}function u(n){return n===null||e&&i.parser.lazy[i.now().line]?r(n):n===-5||n===-4||n===-3?(t.enter(`lineEnding`),t.consume(n),t.exit(`lineEnding`),u):(f(n),n===92?d:u)}function d(i){return i===a?(f(i),t.exit(o),e?p:n):i===null?r(i):i===-5||i===-4||i===-3?u(i):(f(i),u)}function f(e){t.enter(`backslashMathData`),t.consume(e),t.exit(`backslashMathData`)}function p(e){return e===null||e===-5||e===-4||e===-3?n(e):e===32||e===-2||e===-1?(t.enter(`whitespace`),t.consume(e),t.exit(`whitespace`),p):r(e)}},concrete:e,name:e?`backslashMathBlock`:`backslashMathText`}}var Uo=function(e){let t=e.type===`backslashMathBlock`,n=e.type!==`backslashMathInline`,r=this.sliceSerialize(e).slice(2,-2).trim(),i={type:`element`,tagName:`code`,properties:{className:[`language-math`,n?`math-display`:`math-inline`]},children:[{type:`text`,value:r}]},a=t?{type:`math`,meta:null,value:r,data:{hName:`pre`,hChildren:[i]}}:{type:`inlineMath`,value:r,data:{hName:`code`,hProperties:i.properties,hChildren:i.children}};this.enter(a,e)},Wo=function(e){this.exit(e)};function Go(e){switch(e){case`error`:return null;case`warning`:return 4200;default:return 2400}}var Ko=(e,t)=>e.key!==void 0&&e.key===t.key||e.level===t.level&&e.text.trim()===t.text.trim();function qo(e,t,n=3){let r=[...e.filter(e=>!Ko(e,t)),t];for(;r.length>n;){let e=r.slice(0,-1).findIndex(e=>e.level!==`error`);r.splice(Math.max(e,0),1)}return r}var Jo=[],Yo=1,Xo=new Set;function Zo(e){if(!(e.length===Jo.length&&e.every((e,t)=>e===Jo[t]))){Jo=e;for(let e of Xo)e()}}function Qo(e,t,n){let r=Yo++;return Zo(qo(Jo,{id:r,level:e,text:t,...n?{key:n}:{}})),r}function $o(e){Zo(Jo.filter(t=>t.id!==e))}function es(e){Zo(Jo.filter(t=>t.key!==e))}function ts(e){return Xo.add(e),()=>{Xo.delete(e)}}var ns=()=>Jo,rs=(0,f.memo)(function({text:e,className:t=`copy-btn`}){let{t:n}=T(),{copied:r,copy:i}=zo();return(0,h.jsx)(`button`,{type:`button`,className:r?`${t} copied`:t,title:n(`Copy displayed text`),"aria-label":n(`Copy displayed text`),onClick:()=>{i(e).then(e=>{e||Qo(`error`,n(`Copy unavailable`))})},children:r?(0,h.jsx)(_a,{}):(0,h.jsx)(la,{})})}),is=[s,d,Vo],as=[s,l,d,Vo],os=[[c,{strict:!1,throwOnError:!1,trust:!1,maxExpand:1e3}],[u,{detect:!1,ignoreMissing:!0}]];function ss(e){if(e.startsWith(`#`)&&![...e].some(e=>e.charCodeAt(0)<=32))return e;try{let t=new URL(e);return![`https:`,`http:`].includes(t.protocol)||t.username||t.password||t.searchParams.has(`token`)?void 0:e}catch{return}}function cs({text:e,rawHtml:t=!1,hardBreaks:n=!1}){return(0,h.jsx)(a,{remarkPlugins:n?as:is,rehypePlugins:t?[i,o,...os]:os,skipHtml:!t,disallowedElements:[`iframe`,`object`,`embed`,`script`,`style`,`video`,`audio`,`source`,`form`,`input`],components:{pre:ds,a:us,img:({alt:e})=>(0,h.jsxs)(`span`,{className:`omission`,children:[`[Image omitted: `,e||`external/media content`,`]`]})},children:e})}var ls=(0,f.memo)(function(e){return(0,h.jsx)(`div`,{className:`md`,children:(0,h.jsx)(cs,{...e})})});function us({href:e,children:t}){let n=e&&ss(e);return n?(0,h.jsx)(`a`,{href:n,target:n.startsWith(`#`)?void 0:`_blank`,rel:`noreferrer noopener`,referrerPolicy:`no-referrer`,children:t}):(0,h.jsxs)(`span`,{children:[t,` [link unavailable]`]})}function ds({children:e,node:t,...n}){let r=e&&typeof e==`object`&&`props`in e?e.props?.children:e,i=0,a=Bo(r).map(e=>{let t=`code-offset:${i}`;return i+=fs(e).length+1,{key:t,nodes:e}}),o=a.length>1,s=o?`${String(a.length).length+1}ch`:void 0;return(0,h.jsxs)(`div`,{className:`codeblock`,children:[(0,h.jsx)(rs,{text:fs(e)}),(0,h.jsx)(`pre`,{...n,children:a.map(({nodes:e,key:t},n)=>(0,h.jsxs)(`div`,{className:`code-line`,children:[o&&(0,h.jsx)(`span`,{className:`code-num`,style:s?{width:s}:void 0,children:n+1}),(0,h.jsx)(`code`,{className:`code-line-body hljs`,children:e})]},t))})]})}function fs(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(fs).join(``);if(e&&typeof e==`object`&&`props`in e){let t=e.props;return fs(t?.children)}return``}function ps(e,t){let n=[],r=t;if(!r)return n;let i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){let t=e.parentElement;return!t||t.closest(`.search-bar`)||t.closest(`.msg-collapsed`)?NodeFilter.FILTER_REJECT:(e.textContent??``).includes(r)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(let e=i.nextNode();e;e=i.nextNode()){let t=e.textContent??``;if(!e.parentElement?.closest(`[data-retained-field]`))continue;let i=t.indexOf(r);for(;i!==-1;){let a=document.createRange();if(a.setStart(e,i),a.setEnd(e,i+r.length),n.push(a),n.length===1e3)return n;i=t.indexOf(r,i+r.length)}}return n}var ms=new Map;function hs(e,t){t.length?ms.set(e,t):ms.delete(e);let n=e.endsWith(`-active`);e=n?`cadence-page-active`:`cadence-page`,t=[...ms].filter(([e])=>e.endsWith(`-active`)===n).flatMap(([,e])=>e);let r=CSS;if(!r.highlights)return;if(t.length===0){r.highlights.delete(e);return}let i=window.Highlight;i&&r.highlights.set(e,new i(...t))}function gs(e,t){let n=[],r=e;for(;r&&r!==t;){let e=getComputedStyle(r);/(auto|scroll|hidden)/.test(e.overflowY+e.overflowX)&&(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)&&n.push(r),r=r.parentElement}return n}function _s(e,t){let n=t.startContainer.parentElement;for(let r of gs(n,e)){let e=t.getBoundingClientRect(),n=r.getBoundingClientRect();if(e.height<=0||e.width<=0)return;e.top>=n.top+4&&e.bottom<=n.bottom-4||(r.scrollTop+=e.top-n.top-(r.clientHeight-e.height)/2),e.left>=n.left+4&&e.right<=n.right-4||(r.scrollLeft+=e.left-n.left-(r.clientWidth-e.width)/2)}let r=t.getBoundingClientRect(),i=e.getBoundingClientRect();if(r.height<=0||r.width<=0)return;let a=r.top>=i.top+6&&r.bottom<=i.bottom-6,o=r.left>=i.left+6&&r.right<=i.right-6;a&&o||(a||(e.scrollTop+=r.top-i.top-(i.height-r.height)/2),o||(e.scrollLeft+=r.left-i.left-(i.width-r.width)/2))}function vs({container:e,version:t}){let{t:n}=T(),[r,i]=(0,f.useState)(``),[a,o]=(0,f.useState)(0),[s,c]=(0,f.useState)(0),l=(0,f.useRef)([]),u=`cadence-page-${(0,f.useId)().replace(/[^a-z0-9]/gi,``)}`;(0,f.useEffect)(()=>{if(!t)return;let n=e.current,i=n&&r?ps(n,r):[];return l.current=i,c(i.length),o(0),hs(u,i),()=>hs(u,[])},[r,e,t,u]);let d=t=>{let n=s?(a+t+s)%s:0;o(n),e.current&&l.current[n]&&(_s(e.current,l.current[n]),hs(`${u}-active`,[l.current[n]]))};return(0,f.useEffect)(()=>()=>hs(`${u}-active`,[]),[u]),(0,h.jsxs)(`div`,{className:`search-bar toolbar`,children:[(0,h.jsxs)(`label`,{children:[n(`Find on displayed field page`),(0,h.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(e.shiftKey?-1:1))}})]}),(0,h.jsxs)(`span`,{children:[s?a+1:0,`/`,s,s>=1e3?n(` (first 1000 visual highlights)`):``,n(`; not whole-history search`)]}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(-1),children:n(`Previous match`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!s,onClick:()=>d(1),children:n(`Next match`)})]})}function ys({client:e,cursor:t,highlight:n,render:r,compact:i=!1}){let{t:a,tx:o}=T(),s=J(t),c=(0,f.useMemo)(()=>Re(JSON.parse(s)),[s]),[l,u]=(0,f.useState)(t),[d,p]=(0,f.useState)(),[m,g]=(0,f.useState)([]),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(),[x,S]=(0,f.useState)(i?`markdown`:`raw`),[C,w]=(0,f.useState)(``),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useEffect)(()=>(u(c),g([]),p(void 0),b(void 0),()=>E.current?.abort()),[c]),(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return v(!0),b(void 0),e.detail(l,n.signal).then(e=>{t&&(v(!1),e.kind===`error`?b(e.error.code):p(e.value))}).catch(()=>{t&&(b(`Read unavailable.`),v(!1))}),()=>{t=!1,n.abort()}},[e,l]);let O=async()=>{if(E.current)return;let n=new AbortController;E.current=n,w(a(`Reading all retained field pages…`));try{let r=await Po(e,t,n.signal);if(n.signal.aborted)return;let i=await Ro(r.text);if(n.signal.aborted)return;w(i?r.recordingComplete?a(`Copied all retained field bytes (source omissions still apply).`):a(`Copied retained field bytes; recording is incomplete. No complete-source claim.`):a(`Clipboard unavailable.`))}catch{n.signal.aborted||w(a(`Full-field copy refused/incomplete.`))}finally{E.current===n&&(E.current=null)}},k=d&&!(`kind`in d)?d:void 0;return(0,h.jsxs)(`section`,{className:`detail-pane${i?` message-field`:``}`,"aria-label":a(`Retained field`),children:[(0,h.jsxs)(`details`,{className:`field-details`,open:!i||void 0,children:[(0,h.jsx)(`summary`,{children:a(`Field details`)}),(0,h.jsxs)(`div`,{className:`detail-identity`,children:[(0,h.jsx)(`code`,{children:t.recordId}),` v`,t.recordVersion,` /`,` `,t.field&&o(t.field),` /`,` `,a(`snapshot {seq}`,{seq:t.snapshotSeq})]}),n&&(0,h.jsx)(`p`,{children:a(`Exact hit bytes [{start}, {end}); only this immutable field is highlighted.`,{start:n.start,end:n.end})}),(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e===`raw`?`markdown`:`raw`),children:a(x===`raw`?`Markdown page`:`Raw page`)}),(0,h.jsx)(`button`,{type:`button`,disabled:!!E.current,onClick:()=>void O(),children:a(`Copy full retained field`)}),!!E.current&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{E.current?.abort(),E.current=null,w(a(`Copy canceled; execution unchanged.`))},children:a(`Cancel copy`)})]})]}),C&&(0,h.jsx)(`p`,{role:`status`,children:C}),y&&(0,h.jsx)(`p`,{role:`alert`,children:a(`Detail refused: {error}`,{error:o(y)})}),_&&(0,h.jsx)(`p`,{role:`status`,children:a(`Reading…`)}),d&&(0,h.jsx)(Io,{value:d.coverage,compact:i}),d&&`kind`in d&&(0,h.jsx)(`p`,{children:a(`Validation in progress. The retained field is not empty.`)}),k&&(0,h.jsxs)(h.Fragment,{children:[(!i||k.next)&&(0,h.jsxs)(`p`,{children:[a(`Bytes {start}–{end} of {total}.`,{start:k.range?.start??0,end:k.range?.end??0,total:k.content.bytes}),` `,k.next?a(`More retained data available.`):a(`End of field.`)]}),!i&&(0,h.jsx)(vs,{container:D,version:`${k.content.recordId}:${k.content.version}:${k.range?.start??0}:${x}`}),(0,h.jsx)(`div`,{ref:D,"data-retained-field":!0,children:r?r(k.text):x===`markdown`?(0,h.jsx)(ls,{text:k.text}):(0,h.jsx)(`pre`,{className:`detail-text`,children:(()=>{if(!k||!n||!k.range)return k?.text;let e=Math.max(n.start,k.range.start)-k.range.start,t=Math.min(n.end,k.range.end)-k.range.start;if(t<=e)return k.text;let r=new TextEncoder().encode(k.text),i=(e,t)=>new TextDecoder(`utf-8`,{fatal:!0}).decode(r.subarray(e,t));return(0,h.jsxs)(h.Fragment,{children:[i(0,e),(0,h.jsx)(`mark`,{children:i(e,t)}),i(t,r.length)]})})()})})]}),(!i||m.length>0||d?.next)&&(0,h.jsxs)(`div`,{className:`toolbar`,children:[(0,h.jsx)(`button`,{type:`button`,disabled:_||!m.length,onClick:()=>{u(m[m.length-1]),g(e=>e.slice(0,-1))},children:a(`Previous`)}),(0,h.jsx)(`button`,{type:`button`,disabled:_||!d?.next,onClick:()=>{d?.next&&(g(e=>[...e,l]),u(d.next))},children:d&&`kind`in d?a(`Continue validation`):a(`Next field page`)})]})]})}function bs({pager:e,compact:t=!1}){let{t:n,tx:r}=T(),{page:i,busy:a,error:o}=e;return(0,h.jsxs)(`div`,{className:`page-controls${t?` compact`:``}`,children:[o&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Read refused: {error}. Retained state has not been repaired.`,{error:r(o)})}),a&&(0,h.jsx)(`p`,{role:`status`,children:n(`Reading bounded history page…`)}),i&&`kind`in i&&(0,h.jsxs)(`p`,{role:`status`,children:[i.kind===`snapshot`?n(`Snapshot selected`):n(`Validating retained history`),n(`; continue this exact read. No data page yet.`)]}),i&&!(t&&i.coverage.observed===`complete`&&i.coverage.source===`complete`&&!i.coverage.redacted&&i.coverage.omissions.length===0)&&(0,h.jsx)(Io,{value:i.coverage,compact:t}),(!t||e.canPrevious)&&(0,h.jsx)(`button`,{type:`button`,disabled:a||!e.canPrevious,onClick:e.previous,children:n(`Previous page`)}),(!t||i?.next)&&(0,h.jsx)(`button`,{type:`button`,disabled:a||!i?.next,onClick:e.more,children:i&&`kind`in i?n(`Continue validation`):n(`Next page`)}),(0,h.jsx)(`button`,{type:`button`,disabled:a,onClick:e.refresh,"aria-label":n(`Observe a new snapshot`),title:n(`Observe a new snapshot`),children:t?(0,h.jsx)(Mi,{"aria-hidden":`true`}):n(`Observe a new snapshot`)}),!t&&i&&!(`kind`in i)&&!i.next&&(0,h.jsx)(`span`,{className:`page-end`,children:i.coverage.observed===`incomplete`?n(`End of this retained snapshot (incomplete).`):n(`End of this retained snapshot.`)})]})}function xs({client:e,seed:t,entityId:n}){let{t:r,tx:i}=T(),a=Fo(e,{...t,reader:`contents`}),[o,s]=(0,f.useState)(),c=a.page;return(0,h.jsxs)(`section`,{"aria-label":r(`Retained content fields`),children:[(0,h.jsx)(bs,{pager:a}),n&&(0,h.jsx)(`p`,{children:(0,h.jsx)(x,{text:r(`Showing matches for entity {entity} on this page only. Continue paging for other fields/versions.`),slots:{entity:(0,h.jsx)(`code`,{children:n})}})}),c&&!(`kind`in c)&&c.records.map(e=>e.kind!==`content`&&e.kind!==`omitted`||n&&e.owner.entity.id!==n?null:e.kind===`omitted`?(0,h.jsxs)(`p`,{className:`omission`,children:[r(`Omitted source block:`),` `,(0,h.jsx)(`code`,{children:JSON.stringify(e.block)})]},`${e.owner.entity.id}:${e.version}:${JSON.stringify(e.block.owner)}`):(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`p`,{children:[i(e.owner.entity.kind),` `,(0,h.jsx)(`code`,{children:e.owner.entity.id}),` ·`,` `,i(e.content.field),` ·`,` `,r(`{bytes} retained bytes`,{bytes:e.content.bytes})]}),(0,h.jsx)(`pre`,{children:JSON.stringify(e.descriptor.owner)}),(0,h.jsx)(Io,{value:e.coverage}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{c.request.scope.kind!==`workspace`&&c.request.snapshotSeq!==null&&s(No(c.request.storeId,c.request.scope,c.request.snapshotSeq,e.content))},children:r(`Inspect complete retained field`)})]},`${e.content.recordId}:${e.content.version}`)),o&&(0,h.jsx)(ys,{client:e,cursor:o},`${o.recordId}:${o.recordVersion}`)]})}function Ss({client:e,seed:t}){return(0,h.jsx)(Cs,{client:e,seed:t},J(t))}function Cs({client:e,seed:t}){let{t:n,tx:r}=T(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),(i.kind===`message`?e.message(i,n.signal):i.kind===`tool`?e.tool(i,n.signal):e.task(i,n.signal)).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,h.jsxs)(`section`,{"aria-label":n(`Exact entity metadata`),children:[u&&(0,h.jsx)(`p`,{children:n(`Reading exact entity version…`)}),c&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Entity refused: {error}`,{error:r(c)})}),o&&`kind`in o&&(0,h.jsx)(Io,{value:o.coverage}),o&&(`kind`in o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:n(`Entity validation in progress, not missing.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue exact entity validation`)})]}):(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:n(`Exact stored owner and associations`)}),(0,h.jsx)(`pre`,{children:JSON.stringify(o.record,null,2)})]}))]})}function ws(e){let t=za(`download`,qt(e));if(t.method!==`GET`)throw Error(`Native download needs the named GET attachment route.`);let n=document.createElement(`a`);n.href=so()+t.path,n.download=`cadence-${e.scope.kind}-${e.scope.id}.${e.format===`markdown`?`md`:`ndjson`}`,n.referrerPolicy=`no-referrer`,document.body.appendChild(n),n.click(),n.remove()}function Ts({title:e,children:t,onClose:n}){let{t:r}=T(),i=(0,f.useRef)(null),a=(0,f.useId)(),o=(0,f.useRef)(n);return o.current=n,(0,f.useEffect)(()=>{let e=document.activeElement,t=i.current;return t?.showModal(),()=>{t?.close(),e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}},[]),(0,h.jsxs)(`dialog`,{ref:i,className:`action-dialog`,"aria-labelledby":a,onCancel:e=>{e.preventDefault(),o.current?.()},children:[(0,h.jsxs)(`header`,{children:[(0,h.jsx)(`h2`,{id:a,children:e}),n&&(0,h.jsx)(`button`,{type:`button`,className:`dialog-close`,"aria-label":r(`Close dialog — no cancellation of accepted work`),title:r(`Close — accepted work is not cancelled`),onClick:n,children:(0,h.jsx)(xi,{"aria-hidden":`true`})})]}),t]})}function Es({request:e,onClose:t}){let{t:n,tx:r}=T(),[i]=(0,f.useState)(e),[a,o]=(0,f.useState)(e.format),[s,c]=(0,f.useState)(``);return(0,h.jsxs)(Ts,{title:n(`Export retained history`),onClose:t,children:[(0,h.jsx)(`p`,{children:n(`Selected {kind}: {id} · snapshot {seq}`,{kind:r(i.scope.kind),id:i.scope.id,seq:i.snapshotSeq})}),(0,h.jsxs)(`label`,{children:[n(`Format`),(0,h.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value===`markdown`?`markdown`:`ndjson`),children:[(0,h.jsx)(`option`,{value:`ndjson`,children:n(`NDJSON public archive`)}),(0,h.jsx)(`option`,{value:`markdown`,children:n(`Readable Markdown with footer metadata`)})]})]}),(0,h.jsx)(`p`,{children:n(`Includes retained context, messages/tools, graph, lifecycle, changes, checks, human review and coverage beyond loaded pages. Redactions and source omissions remain.`)}),(0,h.jsx)(`p`,{children:n(`A native browser download request cannot establish completion. Inspect the original EOF and completion trailer/counts/digest in the downloaded artifact; missing footer means incomplete. Revoked access may terminate without a trailer.`)}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>{try{ws({...i,format:a}),c(n(`Download requested — completion not verified by this browser UI.`))}catch{c(n(`Download unavailable; no archive claimed complete.`))}},children:n(`Request selected-scope download`)}),(0,h.jsx)(`p`,{role:`status`,children:s})]})}function Ds(e,t){if(!t||oe(t)>N.queryBytes)throw Error(`Query must be 1–${N.queryBytes} UTF-8 bytes; it was not clipped.`);let{navigation:n,...r}=e;return Re({...r,query:t,recordId:null,recordVersion:null,field:null,offset:0})}function Os(e){return e.next?`No hits in this bounded window; search is not finished.`:`No hits in the final retained window. Coverage limits above still apply.`}function ks({client:e,seed:t,onClose:n,onHit:r}){let{t:i,tx:a}=T(),[o]=(0,f.useState)(t),s=(0,f.useRef)(null),c=(0,f.useRef)(0),[l,u]=(0,f.useState)(``),[d,p]=(0,f.useState)(0),[m,g]=(0,f.useState)(),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(),x=(0,f.useRef)(null),S=(0,f.useCallback)(async(t,n)=>{x.current?.abort();let r=new AbortController;x.current=r,v(!0),b(void 0);try{let i=await e.search(t,r.signal);if(c.current!==n||r.signal.aborted)return;i.kind===`error`?b(i.error.code):(g(i.value),p(0))}catch{c.current===n&&!r.signal.aborted&&b(`Search unavailable or invalid; no automatic retry.`)}finally{c.current===n&&!r.signal.aborted&&v(!1)}},[e]);return(0,f.useEffect)(()=>(s.current?.focus(),()=>{c.current++,x.current?.abort()}),[]),(0,f.useEffect)(()=>{let e=++c.current;if(x.current?.abort(),v(!1),g(void 0),p(0),b(void 0),!l)return;let t;try{t=Ds(o,l)}catch{b(`Query must be 1–1024 UTF-8 bytes; it was not clipped.`);return}let n=setTimeout(()=>void S(t,e),300);return()=>{clearTimeout(n),c.current++,x.current?.abort()}},[l,o,S]),(0,h.jsx)(Ts,{title:i(`Search retained history`),onClose:n,children:(0,h.jsxs)(`div`,{className:`gs-modal`,children:[(0,h.jsxs)(`div`,{className:`gs-input-row`,children:[(0,h.jsx)(Ai,{}),(0,h.jsx)(`input`,{ref:s,"aria-label":i(`Case-sensitive literal query`),value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`ArrowDown`&&(e.preventDefault(),p(e=>Math.max(0,Math.min(e+1,(m?.hits.length??0)-1)))),e.key===`ArrowUp`&&(e.preventDefault(),p(e=>Math.max(e-1,0))),e.key===`Enter`&&m?.hits[d]&&(e.preventDefault(),r(m.hits[d]),n())}})]}),(0,h.jsx)(`p`,{children:i(`Case-sensitive literal UTF-8 search. Scope {kind} {id}; snapshot {seq}. No regex, provider request or history repair.`,{kind:a(o.scope.kind),id:o.scope.id,seq:o.snapshotSeq})}),(0,h.jsxs)(`div`,{className:`gs-results`,children:[_&&(0,h.jsx)(`p`,{role:`status`,children:i(`Searching bounded retained range…`)}),y&&(0,h.jsx)(`p`,{role:`alert`,children:i(`Search refused: {error}`,{error:a(y)})}),!l&&(0,h.jsx)(`p`,{children:i(`Enter a query to search this selected scope.`)}),m&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(Io,{value:m.coverage}),(0,h.jsxs)(`div`,{className:`gs-section`,children:[(0,h.jsx)(`div`,{className:`gs-section-head`,children:i(`Matches on this page: {count}`,{count:m.hits.length})}),m.hits.map((e,t)=>(0,h.jsxs)(`button`,{type:`button`,className:`gs-item ${d===t?`active`:``}`,onMouseEnter:()=>p(t),onClick:()=>{r(e),n()},children:[(0,h.jsxs)(`span`,{className:`gs-item-title`,children:[a(e.owner.entity.kind),` · `,a(e.content.field),` · v`,e.content.version]}),(0,h.jsx)(`span`,{className:`gs-item-sub`,children:e.preview}),(0,h.jsxs)(`code`,{children:[e.owner.childRunId??e.owner.runId??e.owner.taskId,` `,`/ `,e.content.recordId,` /`,` `,i(`bytes {start}–{end}`,{start:e.range.start,end:e.range.end})]})]},`${e.content.recordId}:${e.content.version}:${e.range.start}`)),m.hits.length===0&&(0,h.jsx)(`p`,{children:a(Os(m))})]}),(0,h.jsx)(`button`,{type:`button`,disabled:_||!m.next,onClick:()=>{m.next&&S(m.next,++c.current)},children:i(`Continue same snapshot search`)})]})]}),(0,h.jsx)(`footer`,{className:`gs-foot`,children:i(`↑↓ Navigate · Enter Open exact hit · Escape Close. Reopening never resumes execution.`)})]})})}function As({run:e,historical:t=!1}){let{t:n,tx:r}=T();return(0,h.jsxs)(`article`,{className:`run-summary`,children:[(0,h.jsxs)(`h3`,{children:[e.assignmentId??e.admission.kind,` ·`,` `,n(t?`historical projection`:`owner projection`)]}),(0,h.jsx)(`p`,{children:(0,h.jsx)(`code`,{children:e.childRunId??e.runId})}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:n(`Lifecycle`)}),(0,h.jsx)(`dd`,{children:r(e.lifecycle)}),(0,h.jsx)(`dt`,{children:n(`Execution`)}),(0,h.jsx)(`dd`,{children:e.outcome?r(e.outcome):n(`unsettled`)}),(0,h.jsx)(`dt`,{children:n(`Wait/block reason`)}),(0,h.jsx)(`dd`,{children:e.reason?r(e.reason):n(`none reported`)}),(0,h.jsx)(`dt`,{children:n(`Summary publication`)}),(0,h.jsx)(`dd`,{children:r(e.publication)})]}),(0,h.jsx)(Io,{value:e.coverage}),(0,h.jsxs)(`details`,{children:[(0,h.jsx)(`summary`,{children:n(`Native / recording / parent settlement facts (independent of human review)`)}),(0,h.jsx)(`pre`,{children:e.settlement?JSON.stringify(e.settlement,null,2):n(`No settlement recorded`)})]})]})}function js({client:e,seed:t}){return(0,h.jsx)(Ms,{client:e,seed:t},J(t))}function Ms({client:e,seed:t}){let{t:n,tx:r}=T(),[i,a]=(0,f.useState)(t),[o,s]=(0,f.useState)(),[c,l]=(0,f.useState)(),[u,d]=(0,f.useState)(!1);return(0,f.useEffect)(()=>{let t=!0,n=new AbortController;return d(!0),e.graph(i,n.signal).then(e=>{t&&(d(!1),e.kind===`error`?l(e.error.code):(s(e.value),l(void 0)))}).catch(()=>{t&&(l(`Read unavailable.`),d(!1))}),()=>{t=!1,n.abort()}},[e,i]),(0,h.jsxs)(`section`,{children:[(0,h.jsx)(`h3`,{children:n(`Immutable admitted graph`)}),c&&(0,h.jsx)(`p`,{role:`alert`,children:n(`Graph refused: {error}`,{error:r(c)})}),u&&(0,h.jsx)(`p`,{children:n(`Reading graph…`)}),o&&`kind`in o&&(0,h.jsx)(Io,{value:o.coverage}),o&&(`kind`in o?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:n(`Graph validation in progress; not an empty graph.`)}),(0,h.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>a(o.next),children:n(`Continue graph validation`)})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ys,{client:e,cursor:No(o.request.storeId,o.request.scope,o.request.snapshotSeq,o.graph.plan)}),o.graph.assignments.map(e=>(0,h.jsxs)(`article`,{children:[(0,h.jsxs)(`h4`,{children:[e.id,` / `,e.purpose]}),(0,h.jsx)(ls,{text:e.instructions}),(0,h.jsx)(`p`,{children:n(`Expected: {output}`,{output:e.expectedOutput})}),(0,h.jsx)(`pre`,{children:JSON.stringify({model:e.model,role:e.role,dependencies:e.dependencies},null,2)})]},e.id))]}))]})}function Ns({client:e,seed:t,onScope:n}){let{t:r}=T(),i=Fo(e,{...t,reader:`runs`}),a=i.page,[o,s]=(0,f.useState)();return(0,h.jsxs)(`section`,{children:[(0,h.jsx)(bs,{pager:i}),a&&!(`kind`in a)&&a.records.map(e=>e.kind===`run`?(0,h.jsxs)(`article`,{children:[(0,h.jsx)(As,{run:e.projection,historical:!0}),(0,h.jsx)(`button`,{type:`button`,onClick:()=>n({kind:e.projection.childRunId?`child`:`run`,id:e.projection.childRunId??e.projection.runId}),children:r(`Open retained episode/child details`)}),e.projection.admission.graph&&(0,h.jsx)(`button`,{type:`button`,onClick:()=>{a.request.scope.kind!==`workspace`&&a.request.snapshotSeq!==null&&e.projection.admission.graph&&s({storeId:a.request.storeId,scope:a.request.scope,snapshotSeq:a.request.snapshotSeq,graph:e.projection.admission.graph})},children:r(`Inspect admitted graph and plan`)})]},e.projection.childRunId??e.projection.runId):null),o&&(0,h.jsx)(js,{client:e,seed:o},o.graph.recordId)]})}function Ps({onOpen:e,disabled:t}){let{t:n}=T();return(0,h.jsx)(`button`,{type:`button`,className:`chip search-toggle`,"aria-label":n(`Search all retained pages in selected scope`),"data-tip":n(`Search all retained pages in selected scope`),disabled:t,onClick:e,children:(0,h.jsx)(Ai,{"aria-hidden":`true`})})}function Fs(e,t,n,r,i){let a=i??t,o=[],s=[],c=0;for(let i of e)n.has(i.id)||(r.has(i.id)?i.top<t.bottom&&i.bottom>t.top&&o.push(i.id):i.top<a.bottom&&i.bottom>a.top||(s.push(i.id),i.bottom<=a.top&&(c+=i.bottom-i.top)));return{show:o,hide:s,shrinkAbove:c}}function Is(e,t){if(t.show.length===0&&t.hide.length===0)return e;let n=new Set(e);for(let e of t.show)n.delete(e);for(let e of t.hide)n.add(e);return n}function Ls(e,t,n){let r=new Set,i=0;for(let a=e.length-1;a>=0&&!(a<e.length-1&&i>=n);a--){let n=e[a];r.add(n.id),i+=t.get(n.id)??Rs(n.role,n.customType)}return r}function Rs(e,t){switch(e){case`user`:return 72;case`assistant`:return 280;case`tool-result`:return 120;case`custom`:return t===`file`?96:72;default:return 60}}function zs(e,t,n,r){let i=n.get(e);return i&&i.len===t?i.h:r}function Bs(e,t,n=null,r=1800){let[i,a]=(0,f.useState)(()=>new Set),o=(0,f.useRef)(i);o.current=i;let s=(0,f.useRef)(new Map),c=(0,f.useRef)(new Map),l=(0,f.useRef)(new Map),u=(0,f.useRef)(0),d=(0,f.useRef)(new Map);d.current=new Map(t.map(e=>[e.id,e.version]));let p=(0,f.useRef)(new Set);p.current=Ls(t,s.current,r),n!==null&&p.current.add(n);let m=(0,f.useCallback)((e,t)=>{let n=d.current.get(e);n!==void 0&&(c.current.set(e,{h:t,len:n}),s.current.set(e,t))},[]),h=(0,f.useCallback)(()=>{let t=e.current;if(!t)return;let n=t.getBoundingClientRect(),r=[];for(let[e,t]of l.current){let n=t.getBoundingClientRect();r.push({id:e,top:n.top,bottom:n.bottom}),o.current.has(e)||m(e,n.height)}let i=Fs(r,{top:n.top-1200,bottom:n.bottom+1200},p.current,o.current,{top:n.top-2400,bottom:n.bottom+2400});for(let e of i.hide){let t=l.current.get(e);t&&m(e,t.offsetHeight)}a(e=>Is(e,i))},[m,e]),g=(0,f.useCallback)(()=>{u.current||=requestAnimationFrame(()=>{u.current=0,h()})},[h]);return(0,f.useLayoutEffect)(()=>{t.length?h():a(new Set)},[h,t,n]),(0,f.useEffect)(()=>{let t=new ResizeObserver(g);return e.current&&t.observe(e.current),()=>{t.disconnect(),cancelAnimationFrame(u.current)}},[g,e]),{hidden:i,scheduleSweep:g,recordMeasured:m,register:(0,f.useCallback)(e=>t=>{t?l.current.set(e,t):l.current.delete(e)},[]),placeholder:(0,f.useCallback)((e,t,n)=>zs(e,t,c.current,n),[])}}var Vs=(0,f.memo)(function({id:e,show:t,height:n,containerRef:r,onMeasured:i,lazyRef:a,children:o}){let s=(0,f.useRef)(null);return(0,f.useLayoutEffect)(()=>{if(!t)return;let n=s.current;if(!n)return;let r=n.offsetHeight;r>0&&i?.(e,r)},[t,e,i]),t?(0,h.jsx)(`div`,{ref:a,"data-lazy-id":e,children:(0,h.jsx)(`div`,{ref:s,children:o})}):(0,h.jsx)(`div`,{ref:a,className:`msg-lazy-ph`,"data-msg-id":e,"data-lazy-id":e,style:{height:n},"aria-hidden":`true`})}),Hs=(0,f.memo)(function({message:e,client:t,seed:n}){let{t:r,tx:i}=T(),[a,o]=(0,f.useState)(!1);return(0,h.jsxs)(`article`,{className:`msg msg-${e.role}`,"data-msg-id":e.owner.entity.id,children:[(0,h.jsxs)(`header`,{className:`msg-meta`,children:[(0,h.jsx)(`strong`,{className:`msg-role`,children:i(e.role)}),e.state!==`final`&&(0,h.jsx)(`span`,{className:`msg-state`,children:i(e.state)}),(0,h.jsxs)(`button`,{type:`button`,className:`msg-inspect`,"aria-expanded":a,onClick:()=>o(e=>!e),children:[a?(0,h.jsx)(pa,{"aria-hidden":`true`}):(0,h.jsx)(ta,{"aria-hidden":`true`}),r(a?`Collapse`:`Inspect message`)]})]}),(0,h.jsxs)(`div`,{className:`msg-body`,children:[e.role===`tool-result`&&(0,h.jsx)(`p`,{className:`msg-note`,children:r(`Result call: {call}. Kept visible independently of the tool card.`,{call:e.resultCallId??r(`unassociated / orphan`)})}),(0,h.jsx)(`div`,{className:`msg-text`,children:(0,h.jsxs)(`div`,{className:`msg-text-main`,children:[e.finalText&&n.scope.kind!==`workspace`&&n.snapshotSeq!==null?(0,h.jsx)(ys,{compact:!0,client:t,cursor:No(n.storeId,n.scope,n.snapshotSeq,e.finalText)}):(0,h.jsx)(`p`,{children:r(`No finalized text field in this snapshot. Inspect retained partial/final blocks and omission metadata below.`)}),a&&(0,h.jsxs)(`div`,{className:`message-inspection`,children:[(0,h.jsx)(`p`,{className:`msg-ident`,children:r(`Child {child} · message {message} · version {version}`,{child:e.owner.childRunId??``,message:e.owner.entity.id,version:e.version})}),(0,h.jsx)(`p`,{className:`msg-note`,children:r(`{state} message record, not execution outcome`,{state:i(e.state)})}),(0,h.jsxs)(`details`,{open:!0,children:[(0,h.jsx)(`summary`,{children:r(`All message blocks, source limits and tool associations`)}),(0,h.jsx)(xs,{client:t,seed:n,entityId:e.owner.entity.id})]})]})]})})]})]})});function Us({messages:e,client:t,seed:n}){let{t:r}=T(),i=(0,f.useRef)(null),a=(0,f.useRef)(!0),o=(0,f.useMemo)(()=>e.map(e=>({id:e.owner.entity.id,role:e.role,version:e.version,message:e})),[e]),s=Bs(i,o);return(0,h.jsxs)(`div`,{className:`messages-wrap`,children:[(0,h.jsx)(`div`,{className:`messages`,ref:i,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,s.scheduleSweep()},children:o.map(({id:e,role:r,message:a})=>(0,h.jsx)(Vs,{id:e,show:!s.hidden.has(e),height:s.placeholder(e,a.version,r===`user`?100:280),containerRef:i,onMeasured:s.recordMeasured,lazyRef:s.register(e),children:(0,h.jsx)(Hs,{message:a,client:t,seed:n})},e))}),(0,h.jsxs)(`button`,{type:`button`,className:`scroll-bottom`,onClick:()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight,a.current=!0)},children:[(0,h.jsx)(Sa,{"aria-hidden":`true`}),r(`Latest on loaded page`)]})]})}function Ws({client:e,seed:t}){let{t:n}=T(),r=Fo(e,{...t,reader:`messages`}),i=r.page;return(0,h.jsxs)(`section`,{className:`transcript`,children:[(0,h.jsx)(bs,{pager:r,compact:!0}),i&&!(`kind`in i)&&t.snapshotSeq!==null&&i.request.snapshotSeq!==t.snapshotSeq&&(0,h.jsx)(`button`,{type:`button`,className:`conversation-update`,disabled:r.busy,onClick:r.refresh,children:n(`New activity — update conversation`)}),i&&!(`kind`in i)&&(0,h.jsxs)(h.Fragment,{children:[i.records.length===0&&(0,h.jsx)(`p`,{className:`empty-note panel-empty`,children:i.next?n(`No message records on this page; more history remains.`):n(`No message records on this page.`)}),(0,h.jsx)(Us,{messages:i.records.filter(e=>e.kind===`message`),client:e,seed:i.request},`${i.request.snapshotSeq}:${i.request.after?.recordId??`first`}`)]})]})}function Gs({open:e,onToggle:t,headClassName:n,titleText:r,icon:i,iconClassName:a,titleClassName:o,toggleClassName:s,toggle:c,onHeadContextMenu:l,children:u,after:d}){return(0,h.jsxs)(`div`,{className:`chead ${n}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`chead-main`,"aria-expanded":e,title:r,onClick:t,onContextMenu:l,children:[c===void 0?(0,h.jsx)(`span`,{className:s?`chead-toggle ${s}`:`chead-toggle`,children:e?(0,h.jsx)(ga,{}):(0,h.jsx)(ma,{})}):c,(0,h.jsx)(`span`,{className:a?`chead-icon ${a}`:`chead-icon`,children:i}),(0,h.jsx)(`span`,{className:o?`chead-title ${o}`:`chead-title`,children:u})]}),d]})}var Ks=(0,f.memo)(function({record:e,client:t,seed:n}){let{t:r,tx:i}=T(),[a,o]=(0,f.useState)(!1),s=e.result?e.result.isError?r(`SDK tool error observed`):r(`SDK tool end observed`):e.startObserved?r(`Start observed; end not observed in this snapshot`):r(`No start observed`),c=e.result?e.result.isError?`err`:`ok`:e.startObserved?`pending`:``;return(0,h.jsxs)(`div`,{className:`toolcall${c===`err`?` err`:``}`,children:[(0,h.jsx)(Gs,{open:a,onToggle:()=>o(e=>!e),headClassName:`toolcall-head`,titleText:r(`Inspect recorded tool call`),icon:(0,h.jsx)(Ci,{}),iconClassName:`toolcall-icon`,titleClassName:`toolcall-name`,after:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{className:`toolcall-path`,children:r(`Child {child} · call {call} · v{version}`,{child:e.owner.childRunId??``,call:e.owner.entity.id,version:e.version})}),(0,h.jsx)(`span`,{className:`toolcall-badge ${c}`,children:s})]}),children:e.name}),a&&(0,h.jsxs)(`div`,{className:`toolcall-body`,children:[(0,h.jsx)(`p`,{children:r(`SDK tool observations are not native process launch/close or passing parent checks.`)}),(0,h.jsxs)(`dl`,{children:[(0,h.jsx)(`dt`,{children:r(`Source ID`)}),(0,h.jsxs)(`dd`,{children:[i(e.source.disposition),`:`,` `,e.source.value??r(`unavailable`)]}),(0,h.jsx)(`dt`,{children:r(`Declaration`)}),(0,h.jsx)(`dd`,{children:e.declaration?`${e.declaration.messageId} / ${e.declaration.blockId} (${i(String(e.declarationStage))})`:r(`No declaration recorded; orphan result remains accessible`)})]}),(0,h.jsxs)(`div`,{className:`toolcall-output`,children:[(0,h.jsx)(`div`,{className:`toolcall-output-label`,children:r(`Recorded tool end (not parsed from output)`)}),(0,h.jsx)(`pre`,{children:e.result?JSON.stringify(e.result,null,2):r(`No end fact in this snapshot.`)})]}),(0,h.jsx)(`div`,{className:`toolcall-args`,children:(0,h.jsx)(xs,{client:t,seed:n,entityId:e.owner.entity.id})})]})]})}),qs=(e,t,n,r)=>JSON.stringify([e,t,n,r]);function Js({value:e,error:t,opening:n,onOpen:r,represented:i=[]}){let{t:a,tx:o}=T(),s=new Set(e?.projects.flatMap(e=>e.activities.filter(e=>e.sessionId).map(t=>`${e.path}\0${t.sessionId}`))),c=e?.projects.map(e=>({...e,activities:e.activities.filter(t=>!i.includes(qs(e.path,t.source,t.id,t.epoch)))})).filter(e=>e.activities.length);return(0,h.jsxs)(`section`,{className:`lp-section`,"aria-label":a(`Active Pi work`),children:[(0,h.jsx)(`header`,{className:`lp-section-header`,children:(0,h.jsx)(`span`,{className:`lp-section-title`,children:a(`Active Pi work`)})}),(0,h.jsxs)(`div`,{className:`lp-section-body`,children:[e&&(0,h.jsx)(`p`,{className:`panel-hint`,children:a(`{projects} projects · {sessions} sessions`,{projects:e.projects.length,sessions:s.size})}),(t||e?.completeness===`partial`)&&(0,h.jsxs)(`p`,{role:`status`,className:`panel-hint`,children:[a(`Activity observation is partial. Missing work is not known to have finished.`),t?` (${t})`:``]}),i.length>0&&(0,h.jsx)(`p`,{className:`panel-hint`,children:a(`Owner work already listed below is not duplicated here.`)}),!e&&!t&&(0,h.jsx)(`p`,{className:`panel-hint`,children:a(`Discovering active work…`)}),e?.completeness===`complete`&&!t&&!e.projects.length&&(0,h.jsx)(`p`,{className:`panel-hint`,children:a(`No active work observed. Idle terminals and owners are not listed.`)}),c?.map(e=>(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`p`,{className:`panel-hint`,children:e.path}),e.activities.map(t=>(0,h.jsx)(`button`,{type:`button`,className:`session-item`,disabled:n||!t.sessionId||t.history!==`shared`,onClick:()=>r(e.path,t),children:(0,h.jsxs)(`span`,{className:`session-info`,children:[(0,h.jsx)(`span`,{className:`session-title`,children:t.sessionId??a(`Unattributed work`)}),(0,h.jsxs)(`span`,{className:`session-sub`,children:[t.source===`terminal`?a(`Terminal turn (observe only)`):t.source===`turn`?a(`Owner turn`):a(`Owner workflow`),` `,`· `,o(t.phase),` ·`,` `,t.freshness===`current`?a(`Current observation`):t.freshness===`stale`?a(`Stale observation`):a(`Unknown activity`)]}),t.history===`unavailable`&&(0,h.jsx)(`span`,{className:`session-sub`,children:a(`History configuration differs. Activity remains observe-only.`)}),(0,h.jsxs)(`span`,{className:`session-sub`,children:[t.cwd,t.executionCwd?` → ${t.executionCwd}`:``]})]})},`${t.epoch??t.instance}:${t.source}:${t.id}`))]},e.path))]})]})}function Ys(e){return e.replace(/(?:-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})+$/i,``)}function Xs(e){if(!e.tasks?.length)return null;let t={queued:0,running:0,completed:0,failed:0,superseded:0};for(let n of e.tasks)t[n.state]+=1;return t}var Zs=[[`running`,`{count} running`],[`queued`,`{count} queued`],[`completed`,`{count} done`],[`failed`,`{count} failed`],[`superseded`,`{count} superseded`]];function Qs(e,t){return Zs.filter(([t])=>e[t]>0).map(([n,r])=>t(r,{count:e[n]})).join(` · `)}function $s(e){let t=Xs(e);return!t||t.queued+t.running===0?null:t.running>1||(e.delivery?.artifacts?.length??0)>0?t:null}function ec(e,t=e.steps){return(e.tasks??[]).map(n=>{let r=e.delivery?.artifacts?.findLast(e=>e.id===n.id);return{task:n,steps:t.filter(e=>Ys(e.id)===n.id),...r?{artifact:r}:{}}})}var tc=[`queued`,`running`];function nc(e,t){let n=e=>Number(!tc.includes(e));return[...new Set(e)].flatMap(e=>{let r=t.get(e),i=(r?.steps.filter(e=>e.childRunId)??[]).reverse().sort((e,t)=>n(e.status)-n(t.status));return r&&i.length?[{run:r,steps:i}]:[]}).reverse().sort((e,t)=>n(e.steps[0].status)-n(t.steps[0].status))}function rc(e,t){return t.kind===`check`?e.delivery?.acceptance?.waived?.includes(t.id)?!0:t.status===`failed`&&!!e.verification?.steps.includes(t.id)&&(e.deviations??[]).some(e=>e.waives.includes(Ys(t.id))):!1}var ic=[`queued`,`running`],ac=4,oc=1e4;function sc(e,t,n=2e3){let[r,i]=(0,f.useState)(()=>({runs:new Map,failed:!1,unreadable:new Set})),a=(0,f.useRef)({client:e,runs:new Map}),o=JSON.stringify([...new Set(t)]);return(0,f.useEffect)(()=>{let t=new AbortController,r;a.current.client!==e&&(a.current={client:e,runs:new Map});let s=JSON.parse(o),c=new Set(s);for(let e of a.current.runs.keys())c.has(e)||a.current.runs.delete(e);let l=new Map(a.current.runs),u=new Map,d=e=>{let t=new Map;for(let e of s){let n=l.get(e);n&&t.set(e,n)}return i({runs:t,failed:e,unreadable:new Set(u.keys())}),t},f=async n=>{let r=await e.workbenchRead({kind:`workflow`,id:n},t.signal);if(t.signal.aborted)return!1;if(r.kind===`ok`&&r.value.kind===`workflow`&&r.value.response.type===`run`){let e=r.value.response.run;return l.set(n,e),u.delete(n),a.current.runs.set(n,e),!1}return l.has(n)?!0:(u.set(n,Date.now()),!1)},p=async()=>{let e=!1,i=Date.now(),a=s.filter(e=>{let t=l.get(e);return t?ic.includes(t.status):i-(u.get(e)??0)>=oc}).reverse();for(let n=0;n<a.length;n+=ac){let r=await Promise.all(a.slice(n,n+ac).map(f));if(t.signal.aborted)return;e||=r.includes(!0),n+ac<a.length&&d(e)}let o=d(e);e||[...o.values()].some(e=>ic.includes(e.status))?r=setTimeout(()=>void p(),n):u.size&&(r=setTimeout(()=>void p(),oc))};return p(),()=>{t.abort(),clearTimeout(r)}},[e,o,n]),r}function cc({run:e,steps:t,selected:n,onOpen:r}){let{t:i,tx:a}=T(),o=Xs(e),s=n?.runId===e.id?n.stepId:void 0;return(0,h.jsxs)(`section`,{className:`agent-dock-run`,"aria-label":e.goal,children:[(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-run-head${s===null?` active`:``}`,title:e.goal,onClick:()=>r?.({runId:e.id,stepId:null,label:e.goal}),children:[(0,h.jsx)(`span`,{className:`agent-dock-run-goal`,children:e.goal}),o&&(0,h.jsx)(`span`,{className:`agent-dock-run-state`,children:Qs(o,i)})]}),t.map(t=>{let n=Ys(t.id),o=e.tasks?.find(e=>e.id===n);return(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-row${s===t.id?` active`:``}`,title:o?`${o.title} · ${e.goal}`:e.goal,onClick:()=>r?.({runId:e.id,stepId:t.id,label:n}),children:[(0,h.jsx)(`span`,{className:`agent-dot ${t.status}`}),(0,h.jsxs)(`span`,{className:`agent-dock-label`,children:[(0,h.jsx)(`strong`,{children:`${a(t.kind)} · ${n}`}),o&&(0,h.jsx)(`small`,{children:i(`Assignment: {state}`,{state:a(o.state)})})]}),(0,h.jsx)(`span`,{className:`ep-state ${t.status}`,children:a(t.status)})]},t.childRunId)})]})}function lc({client:e,active:t,taskId:n,runs:r,snapshot:i,workflowRuns:a=[],selected:o,onOpen:s,onOpenWorkflow:c}){let{t:l,tx:u}=T(),[d,p]=(0,f.useState)(null),[m,g]=(0,f.useState)([]),[_,v]=(0,f.useState)(!1),y=sc(e,a),b=JSON.stringify(t?.status===`complete`?[...new Set(t.runs.map(e=>e.taskId))]:[]);(0,f.useEffect)(()=>{let t=new AbortController,n,r=async()=>{let i=[],a=!1;for(let n of JSON.parse(b)){let r=await e.snapshot({kind:`task`,id:n},t.signal);if(t.signal.aborted)return;if(r.kind===`ok`)for(let e of r.value.runs)e.childRunId&&i.push({taskId:n,run:e,snapshot:r.value.committedSeq});else a=!0}t.signal.aborted||(g(i),v(a),n=setTimeout(()=>void r(),3e3))};return r(),()=>{t.abort(),clearTimeout(n)}},[e,b]);let x=n&&i?r.filter(e=>e.childRunId).map(e=>({taskId:n,run:e,snapshot:i})):[],S=[...m,...x.filter(e=>!m.some(t=>t.run.childRunId===e.run.childRunId))].sort((e,t)=>Number(e.run.lifecycle===`settled`)-Number(t.run.lifecycle===`settled`)),C=nc(a,y.runs),w=C.flatMap(e=>e.steps),E=S.length+w.length,D=w.filter(e=>ic.includes(e.status)).length+S.filter(e=>e.run.lifecycle!==`settled`).length,O=d??(E>0||!!_);return(0,h.jsxs)(`section`,{className:`agent-dock${O?``:` collapsed`}`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-heading`,"aria-expanded":O,onClick:()=>p(!O),children:[(0,h.jsx)(ga,{}),(0,h.jsx)(oa,{}),(0,h.jsx)(`span`,{children:l(`Subagents`)}),(0,h.jsx)(`span`,{className:`lp-count${D?` live`:``}`,children:D?l(`{active} active · {total} total`,{active:D,total:E}):E})]}),O&&(0,h.jsxs)(`div`,{className:`agent-dock-body`,children:[(_||t?.status!==`complete`||y.failed)&&(0,h.jsx)(`p`,{className:`panel-hint`,children:l(`Subagent roster unavailable`)}),E===0&&!_&&t?.status===`complete`&&(0,h.jsx)(`p`,{className:`panel-hint`,children:l(`Cadence research, implementation and review agents appear here.`)}),C.map(({run:e,steps:t})=>(0,h.jsx)(cc,{run:e,steps:t,selected:o,onOpen:c},e.id)),S.map(e=>(0,h.jsxs)(`button`,{type:`button`,className:`agent-dock-row`,onClick:()=>s(e.taskId,e.run.childRunId,e.snapshot,e.run.assignmentId??l(`Subagent`)),children:[(0,h.jsx)(`span`,{className:`agent-dot ${e.run.outcome??e.run.lifecycle}`}),(0,h.jsxs)(`span`,{className:`agent-dock-label`,children:[(0,h.jsx)(`strong`,{children:e.run.assignmentId??l(`Subagent`)}),(0,h.jsx)(`small`,{children:l(`Task {id}`,{id:e.taskId.slice(0,8)})})]}),(0,h.jsx)(`span`,{className:`ep-state ${e.run.outcome??e.run.lifecycle}`,children:u(e.run.outcome??e.run.lifecycle)})]},e.run.childRunId))]})]})}function uc(e){let t=new Set(e.map(e=>e.id)),n=new Map;for(let r of e){let e=r.parent!==null&&t.has(r.parent)?r.parent:null,i=n.get(e);i?i.push(r):n.set(e,[r])}let r=[],i=[],a=(e,t)=>{let n=e.length>1;for(let r=e.length-1;r>=0;r--)i.push({node:e[r],depth:n?t+1:t})};for(a(n.get(null)??[],-1);i.length;){let e=i.pop();r.push({...e,depth:Math.max(0,e.depth)}),a(n.get(e.node.id)??[],Math.max(0,e.depth))}return r}function dc(e){let t=new Map;for(let n of e.nodes){if(n.parent===null&&e.truncated)continue;let r=t.get(n.parent);r?r.push(n):t.set(n.parent,[n])}let n=new Map;for(let e of t.values())if(e.length>1)for(let t of e)n.set(t.id,e);return n}var fc=e=>e.filter(e=>e.current);function pc(e,t,n,r,i){let a=e.findIndex(e=>e.id===t);if(a<0)return;let o=new Map(e.map((e,t)=>[e.id,t])),s=n.find(e=>o.has(e.header.id)),c=s?s.ordinal-(o.get(s.header.id)-a):r-+!!i-(e.length-a);return c>=0&&c<r?c:void 0}function mc(e,t,n,r,i){let[a,o]=(0,f.useState)();(0,f.useEffect)(()=>{i&&o(e=>e?.shape===r?e:{shape:r,leaf:n})},[i,r,n]);let s=po(e,a?{kind:`conversation-tree`,id:t,leaf:a.leaf}:null),{value:c,refresh:l}=s,u=(0,f.useMemo)(()=>a&&c?.kind===`conversation-tree`?{leaf:a.leaf,nodes:c.nodes,truncated:c.truncated}:void 0,[c,a]),[d,p]=(0,f.useState)();return(0,f.useEffect)(()=>{u&&p(u)},[u]),{tree:u??d,current:!!u&&a?.shape===r,error:s.error,loading:s.loading,refresh:l}}function hc({view:e,onChosen:t}){let{t:n,locale:r}=T(),[i,a]=(0,f.useState)(``),o=e=>new Date(e).toLocaleString(r===`zh`?`zh-CN`:`en-GB`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1}),s=e?.tree,c=(0,f.useMemo)(()=>uc(s?.nodes??[]),[s]),l=i.trim().toLowerCase(),u=l?c.filter(({node:e})=>e.text.toLowerCase().includes(l)):c,d=(e,n)=>{e(n),t?.()};return(0,h.jsxs)(`section`,{className:`branches-panel`,"aria-label":n(`Conversation branches`),children:[(0,h.jsxs)(`header`,{className:`panel-crumbs`,children:[(0,h.jsxs)(`label`,{className:`lp-filter`,children:[(0,h.jsx)(Ai,{"aria-hidden":`true`}),(0,h.jsx)(`input`,{type:`search`,value:i,placeholder:n(`Filter messages…`),"aria-label":n(`Filter messages…`),disabled:!c.length,onChange:e=>a(e.target.value)}),i&&(0,h.jsx)(`button`,{type:`button`,className:`lp-filter-clear`,title:n(`Clear filter`),"aria-label":n(`Clear filter`),onClick:()=>a(``),children:(0,h.jsx)(xi,{"aria-hidden":`true`})})]}),(0,h.jsx)(`button`,{type:`button`,className:`crumb`,title:n(`Refresh branches`),"aria-label":n(`Refresh branches`),disabled:!e,onClick:()=>e?.onRefresh(),children:(0,h.jsx)(Mi,{"aria-hidden":`true`})})]}),(0,h.jsx)(`p`,{className:`panel-hint`,children:n(`Each line is a message; indented lines are branches. Choose one to read that branch. The terminal shares this tree (/tree in Pi).`)}),e?.pinned&&(0,h.jsxs)(`p`,{className:`branches-pinned`,children:[(0,h.jsx)(`span`,{children:n(`A chosen branch is shown, not the latest.`)}),(0,h.jsx)(`button`,{type:`button`,className:`ghost`,onClick:()=>{e.onLatest(),t?.()},children:n(`Show the latest`)})]}),e?.error&&(0,h.jsx)(`p`,{className:`inspector-note`,role:`alert`,children:b(n,e.error)}),s?.truncated&&(0,h.jsx)(`p`,{className:`inspector-note`,children:n(`Only the newest messages are listed.`)}),!s&&!e?.error?(0,h.jsx)(`p`,{className:`panel-empty`,role:`status`,children:n(`Reading…`)}):s&&c.length===0?(0,h.jsx)(`p`,{className:`panel-empty`,children:n(`No messages yet.`)}):s&&u.length===0?(0,h.jsx)(`p`,{className:`panel-empty`,children:n(`No matching messages`)}):null,(0,h.jsx)(`ol`,{className:`branch-rows`,"aria-busy":e?.loading||void 0,children:u.map(({node:t,depth:r})=>(0,h.jsxs)(`li`,{className:`branch-item${t.current?` current`:``}`,children:[Array.from({length:r},(e,t)=>(0,h.jsx)(`span`,{className:`branch-rail`,"aria-hidden":`true`},t)),(0,h.jsxs)(`button`,{type:`button`,className:`branch-row`,"aria-current":t.current?`true`:void 0,title:t.text,onClick:()=>e&&d(e.onShow,t),children:[(0,h.jsx)(`span`,{className:`branch-dot`,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`branch-text`,children:t.text||`…`}),t.at>0&&(0,h.jsx)(`time`,{dateTime:new Date(t.at).toISOString(),children:o(t.at)})]}),(0,h.jsx)(`button`,{type:`button`,className:`branch-act`,"aria-label":n(`Edit and resend: {text}`,{text:t.text||`…`}),title:n(`Edit and resend`),disabled:!e?.canAct,onClick:()=>e&&d(e.onEdit,t),children:(0,h.jsx)(ra,{"aria-hidden":`true`})}),(0,h.jsx)(`button`,{type:`button`,className:`branch-act`,"aria-label":n(`Continue from here: {text}`,{text:t.text||`…`}),title:n(`Continue from here`),disabled:!e?.canAct,onClick:()=>e&&d(e.onContinue,t),children:(0,h.jsx)(ca,{"aria-hidden":`true`})})]},t.id))})]})}function gc(e,t){if(!e)return;let n=t?.find(t=>t.provider===e.provider&&t.model===e.model)?.contextWindow;return{tokens:e.tokens,window:n&&n>0?n:null,provider:e.provider,model:e.model}}function _c(e){let t=(e,t)=>`${e.toFixed(1).replace(/\.0$/,``)}${t}`;return e>=999950?t(e/1e6,`M`):e>=1e3?t(e/1e3,`K`):String(e)}function vc(e,t){return Math.round(e/t*100)}var yc=e=>e.trim().split(`
|
|
17
17
|
`,1)[0].slice(0,200);function bc(e,t){return e.header.parent===void 0?t?.ordinal===e.ordinal-1?t.header.entry??void 0:void 0:e.header.parent}var xc=(e,t)=>e?e.entry:t,Sc=(e,t)=>e!==null&&t>=e.from;function Cc(e){if(!e)return null;try{let t=JSON.parse(e);return t.kind!==`edit`&&t.kind!==`continue`||typeof t.turnId!=`string`||!Number.isSafeInteger(t.from)||t.from<0||typeof t.label!=`string`||typeof t.stash!=`string`?null:{kind:t.kind,entry:t.entry===null?null:Nr(t.entry),turnId:t.turnId,from:t.from,label:t.label,media:t.media===!0,stash:t.stash}}catch{return null}}function wc(e){return e.images>0?`images`:e.modeChange?`mode`:e.anchored?`anchor`:e.waiting>=8?`full`:null}function Tc(e,t,n,r,i=crypto.randomUUID()){return{kind:`conversation-input`,commandId:i,conversationId:e,turnId:t.commandId,epoch:t.epoch,mode:n,text:r}}function Ec(e,t,n,r=crypto.randomUUID()){return{kind:`conversation-input-cancel`,commandId:r,conversationId:e,turnId:t.commandId,epoch:t.epoch,inputId:n}}function Dc(e){return new TextEncoder().encode(JSON.stringify(e)).length<=248}function Oc(e){return e.kind===`ok`?{kind:`accepted`}:e.error.effect===`none`?{kind:`refused`,code:e.error.code}:{kind:`unknown`,code:e.error.code}}var kc=2e4;async function Ac(e,t,n,r){let i=ka([t],kc);try{if(i.signal.aborted)throw i.signal.reason;await e(i.signal,n,r)}finally{i.dispose()}}function jc(e,t,n){if(e===`not-dispatched`&&t===`reload-required`)return`Cadence WebUI has updated. Reload this page before sending. No preparation request was sent, the message was not sent, and its draft is kept.`;if(n===`none`)return`Execution preparation was refused with no effect ({code}). This attempt started no execution service; the message was not sent and its draft is kept.`;switch(e){case`dispatched`:return`Preparation outcome is unknown ({code}); an execution service may have started. The message was not sent and its draft is kept.`;case`confirmed`:return`Execution preparation was confirmed, but the message was not sent ({code}). Its draft is kept.`;default:return`The message was not sent ({code}). Its draft is kept.`}}function Mc(e){if(e&&typeof e==`object`&&`effect`in e)return[`none`,`accepted`,`uncertain`].includes(String(e.effect))?String(e.effect):void 0}function Nc(e){return e===`none`?`The message was not accepted ({code}). Its draft is kept.`:`Send outcome is unknown ({code}). Observe the original command before sending again; no automatic retry.`}async function Pc(e,t,n){n(t.commandId);let r=await e.workbenchCommand(t);return(r.kind===`ok`||r.error.effect===`none`)&&n(``),r}function Fc(e){let t={commandId:crypto.randomUUID(),conversationId:fn(e.id),head:e.head===null?null:Nr(e.head)},n=e.location?pn(e.location):void 0;if(n&&n.id!==t.conversationId)throw new P(`stale`);let r=I(e.text,Fr,!e.images?.length),i=e.intent===`exit`?{kind:`cadence-exit`,...n?{location:n}:{},...t,revision:L(e.revision,0)}:e.intent===`ordinary`?{kind:`send`,...t,text:r}:{kind:`cadence-send`,...t,text:r,intent:e.intent,revision:L(e.revision,0)};return Object.freeze({text:r,...e.installModel?{installModel:!0}:{},images:Object.freeze([...e.images??[]]),command:Object.freeze(i),...n?{location:Object.freeze(n)}:{},...e.model?{model:Object.freeze(Ic(e.model))}:{}})}function Ic(e){return pe({provider:e.provider,model:e.model,api:e.api,thinking:e.thinking})}function Lc(e,t){return Object.freeze({...e,model:Object.freeze(Ic(t))})}function Rc(e,t){if(e.model&&J(e.model)!==J(Ic(t)))throw new P(`stale`)}function zc(e,t){return Object.freeze({...e,preparedEpoch:W(t)})}function Bc(e,t,n){return Object.freeze({...Lc(e,t),installModel:!n})}function Vc(e,t){return e.preparedEpoch?t.status===`ready`?t.epoch===e.preparedEpoch?`ready`:`cancel`:[`stopped`,`not-started`,`incompatible`].includes(t.status)?`cancel`:`wait`:`cancel`}function Hc(e,t){return!!e&&e===t}async function Uc(e,t,n,r){if(!r())throw new P(`stale`);if(!t.installModel||!t.model)return n;if(!bn(n.entries,t.model))throw new P(`unsupported-context`);if(n.selected&&J(Ic(n.selected))===J(t.model))return n;let i=await e.chooseModel({expected:n.version,choice:t.model},t.location);if(!r())throw new P(`stale`);if(i.kind===`error`)throw new P(i.error.code);let a=await e.models(void 0,t.location);if(!r())throw new P(`stale`);if(a.kind===`error`)throw new P(a.error.code);if(!a.value.selected||J(a.value.version)!==J(i.value.version)||J(a.value.selected)!==J(i.value.selected))throw new P(`stale`);return Rc(t,a.value.selected),a.value}function Wc(e,t){if(e.location&&e.command.kind!==`cadence-exit`&&J(e.location)!==J(t?.conversation??null)||e.preparedEpoch&&e.command.kind!==`cadence-exit`&&t?.epoch!==e.preparedEpoch)throw new P(`stale`);let n=Kr(e.command.kind===`cadence-exit`?e.command:{...e.command,model:t});if(n.kind!==`send`&&n.kind!==`cadence-send`&&n.kind!==`cadence-exit`)throw new P(`invalid`);return n}function Gc(e,t,...n){let r=`cadence:draft:${e}:${t}`;try{let e=e=>[e,`${e}:pending`,`${e}:mode`].some(e=>sessionStorage.getItem(e)!==null);if(e(r))return r;for(let r of n){if(!r)continue;let n=`cadence:draft:${r}:${t}`;if(e(n))return n}}catch{}return r}function Kc(e){for(let t of e){if(!Hn.includes(t.type))throw Error(`Use PNG, JPEG or WebP images.`);if(!t.size)throw Error(`Image is empty.`)}}async function qc(e){Kc([e]);let t=new Uint8Array(await e.arrayBuffer());return Wn(t,e.type),t}var Jc=e=>{let t=``;for(let n=0;n<e.length;n+=8192)t+=String.fromCharCode(...e.subarray(n,n+8192));return btoa(t)};async function Yc(e,t,n,r){Kc(n);let i=[];for(let a of n){if(!r())throw Error(`stale`);let n=await qc(a);if(!r())throw Error(`stale`);let o=Jc(n),s=crypto.randomUUID();for(let i=0;i<o.length;i+=Vn.chunkChars){if(!r())throw Error(`stale`);let c=o.slice(i,i+Vn.chunkChars),l=await e.workbenchCommand({kind:`image-upload`,commandId:crypto.randomUUID(),imageId:s,send:t,mimeType:a.type,size:n.length,offset:i,data:c});if(!r())throw Error(`stale`);if(l.kind===`error`)throw Error(l.error.code);if(l.value.kind!==`image-upload`||l.value.imageId!==s||l.value.offset!==i+c.length)throw Error(`invalid`)}i.push(s)}return i.length?{...t,images:i}:t}async function Xc(e,t){let n=[],r=0;for(;;){let i=await t(r);if(i.kind!==`conversation-image`||i.mimeType!==e.mimeType||!i.data.length||i.data.length>Vn.chunkChars)throw Error(`invalid`);if(n.push(i.data),r+=i.data.length,i.next===null)break;if(i.next!==r||i.data.length!==Vn.chunkChars)throw Error(`invalid`)}let i=Un(n.join(``));return Wn(i,e.mimeType),new Blob([new Uint8Array(i)],{type:e.mimeType})}var Zc=1e3,Qc=1e4,$c=4,el=e=>e===`queued`||e===`running`,tl=class extends Error{},nl=class{client;id;notify;summary=void 0;leaf=null;pinned=null;branches=0;runs=[];attempt=null;pending=[];undelivered=[];commands=[];context;cache;count=0;first=null;opening=null;turns=new Map;imageReaders=new Map;details=new Map;error=``;loadingEarlier=!1;running=!1;again=!1;closed=!1;active=!1;timer;abort=new AbortController;reads=0;queue=[];snapshot;constructor(e,t,n){this.client=e,this.id=t,this.notify=n,this.snapshot=this.compose()}view(){return this.snapshot}setActive(e){this.active!==e&&(this.active=e,e?this.tick():clearTimeout(this.timer))}close(){this.closed=!0,this.abort.abort(),clearTimeout(this.timer)}refresh=()=>{this.tick()};choose=(e,t)=>{this.closed||(this.pinned===e?t!==void 0&&this.showFrom(t):(this.abort.abort(),this.abort=new AbortController,this.pinned=e,this.summary=void 0,this.context=void 0,this.pending=[],this.undelivered=[],this.error=``,this.forget(),this.opening=t===void 0?null:Math.max(0,t),this.publish(),this.tick()))};forget(){this.turns.clear(),this.details.clear(),this.imageReaders.clear(),this.first=null,this.count=0}loadEarlier=()=>{this.closed||this.loadingEarlier||!this.first||(this.first=Math.max(0,this.first-3),this.loadingEarlier=!0,this.publish(),this.tick())};showFrom=e=>{this.closed||(this.first===null?this.opening=Math.max(0,e):e>=this.first||(this.first=Math.max(0,e),this.loadingEarlier=!0,this.publish(),this.tick()))};publish(){this.closed||(this.snapshot=this.compose(),this.notify())}compose(){let e=[],t=this.count-1;for(;t>=0&&!this.turns.has(t);)t--;for(;t>=(this.first??this.count);t--){let n=this.turns.get(t);if(!n)break;e.unshift(n)}return{summary:this.summary,leaf:this.leaf,pinned:this.pinned!==null,branches:this.branches,runs:this.runs,attempt:this.attempt,pending:this.pending,undelivered:this.undelivered,commands:this.commands,...this.context?{context:this.context}:{},...this.cache?{cache:this.cache}:{},count:this.count,turns:e,earlier:(e[0]?.ordinal??this.count)>0,loadingEarlier:this.loadingEarlier,error:this.error}}async tick(){if(this.closed||!this.active)return;if(this.running){this.again=!0;return}this.running=!0,clearTimeout(this.timer);let e=this.loadingEarlier,t=this.abort;try{await this.sync(t.signal),t===this.abort&&(this.error=``)}catch(e){if(this.closed)return;t===this.abort&&(this.error=e instanceof tl?e.message:`unavailable`)}finally{this.running=!1}if(e&&!this.again&&(this.loadingEarlier=!1),this.publish(),this.again){this.again=!1,this.tick();return}if(!this.active)return;let n=el(this.summary?.status)||[...this.turns.values()].some(e=>el(e.header.status));this.timer=setTimeout(()=>void this.tick(),n?Zc:Qc)}async sync(e){let t=this.pinned,n=await this.read({kind:`conversation`,id:this.id,leaf:t,known:this.leaf},e);if(e.aborted)return;if(n.kind!==`conversation`)throw new tl(`invalid`);(!n.continues||n.turns<this.count)&&this.forget();let r=n.leaf===this.leaf?this.count:this.count-1;this.leaf=n.leaf,this.branches=n.branches,this.runs=n.runs,this.attempt=n.attempt,this.pending=n.pending??[],this.undelivered=n.undelivered??[],this.commands=n.commands??[],this.context=n.context,this.cache=n.cache,this.summary=n.summary,this.count=n.turns;let i=Math.max(0,n.turns-2);this.first=Math.min(this.first??this.opening??i,i),this.opening=null,this.publish();let a=[];for(let e=this.first;e<this.count;e++){let t=this.turns.get(e);(!t||e>=r||t.header.stable<t.header.steps||el(t.header.status))&&a.push(e)}await Promise.all(a.map(t=>this.load(t,n.leaf,e)))}async load(e,t,n){let r=this.turns.get(e),i=await this.turnRead(e,null,t,n),a=i.turn,o=Array.from({length:a.steps}),s=r?.header.id===a.id?Math.min(r.header.stable,i.start):0;for(let e=0;e<s;e++)o[e]=r?.steps[e];i.steps.forEach((e,t)=>{o[i.start+t]=e});let c=[];for(let e=i.start;e>s;e-=24)c.push(e);for(let r of await Promise.all(c.map(r=>this.turnRead(e,r,t,n))))r.steps.forEach((e,t)=>{let n=r.start+t;n>=s&&n<i.start&&(o[n]=e)});if(!n.aborted){if(o.some(e=>!e))throw new tl(`stale`);this.turns.set(e,{ordinal:e,header:a,steps:o,detail:this.detail(t,a.id,n),image:this.imageReader(t,n)})}}async turnRead(e,t,n,r){let i=await this.read({kind:`conversation-turn`,id:this.id,leaf:n,ordinal:e,before:t},r);if(i.kind!==`conversation-turn`||i.ordinal!==e||i.leaf!==n)throw new tl(`invalid`);return i}imageReader(e,t){let n=e??``,r=this.imageReaders.get(n);return r||(r=async(n,r)=>{let i=ka([t,r]);try{return await Xc(n,t=>this.read({kind:`conversation-image`,id:this.id,leaf:e,...n.live?{live:!0}:{},entry:n.entry,index:n.index,offset:t},i.signal))}finally{i.dispose()}},this.imageReaders.set(n,r)),r}detail(e,t,n){let r=`${e??``}:${t}`,i=this.details.get(r);return i||(i=async(r,i,a)=>{let o=await Promise.all(Array.from({length:i},async(i,o)=>{let s=ka([n,a]);try{let n=await this.read({kind:`conversation-step`,id:this.id,leaf:e,turnId:t,step:r,part:o},s.signal);if(n.kind!==`conversation-step`||n.part!==o)throw new tl(`invalid`);return n.item}finally{s.dispose()}}));return{text:o.map(e=>e.text).join(``),args:o.map(e=>e.args).join(``)}},this.details.set(r,i)),i}async read(e,t=this.abort.signal){this.reads>=$c&&await new Promise(e=>this.queue.push(e)),this.reads++;try{if(this.closed||t.aborted)throw new tl(`stale`);let n=await this.client.workbenchRead(e,t);if(n.kind===`error`)throw new tl(n.error.code);return n.value}finally{this.reads--,this.queue.shift()?.()}}};function rl(e,t,n,r=null){let[i,a]=(0,f.useState)(null),[o,s]=(0,f.useState)(null);return(0,f.useEffect)(()=>{let n=new nl(e,t,()=>s(n.view()));return n.choose(r),a(n),s(n.view()),()=>n.close()},[e,t,r]),(0,f.useEffect)(()=>{i?.setActive(n)},[i,n]),{...o??{summary:void 0,leaf:null,pinned:!1,branches:0,runs:[],attempt:null,pending:[],undelivered:[],commands:[],count:0,turns:[],earlier:!1,loadingEarlier:!1,error:``},refresh:i?.refresh??il,loadEarlier:i?.loadEarlier??il,showFrom:i?.showFrom??il,choose:i?.choose??il}}function il(){}function al(e,t,n,r){let i=t.status===`ready`?t.epoch:null,a=t.status===`ready`?t.attachmentVersion:null,o=i===null&&t.status!==`incompatible`&&t.status!==`preparing`?r:void 0,[s,c]=(0,f.useState)(0),l=(0,f.useRef)(0),u=(0,f.useMemo)(()=>({client:e,epoch:i,attachment:a,refresh:n,revision:s,preview:o}),[e,i,a,n,s,o]),d=(0,f.useRef)(u);d.current=u;let p=(0,f.useRef)(!0);(0,f.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]);let m=(0,f.useCallback)(()=>p.current&&(u.epoch!==null||!!u.preview)&&d.current===u&&l.current===u.revision,[u]),[h,g]=(0,f.useState)();(0,f.useEffect)(()=>{if(u.epoch===null&&!u.preview)return;let t=new AbortController,n=()=>!t.signal.aborted&&m();return u.preview?(u.preview(t.signal).then(e=>{n()&&g({scope:u,preview:e})}).catch(e=>{n()&&g({scope:u,error:e instanceof Error?e.message:`unavailable`})}),()=>t.abort()):(e&&e.models(t.signal).then(e=>{n()&&(e.kind===`error`?g({scope:u,error:e.error.code}):e.value.version.epoch===u.epoch?g({scope:u,catalog:e.value}):g({scope:u,error:`stale`}))}).catch(()=>{n()&&g({scope:u,error:`unavailable`})}),()=>t.abort())},[e,u,m]);let _=h?.scope===u&&m()?h:void 0;return{catalog:_?.catalog,preview:_?.preview,error:_?.error,loading:(i!==null||!!o)&&!_,isCurrent:m,reread(){m()&&c(++l.current)},accept(e){return!m()||e.version.epoch!==u.epoch?!1:(g({scope:u,catalog:e}),!0)}}}async function ol(e){let t=e.state.proposal;if(!t||!e.state.enabled||!e.current())throw Error(`stale`);let n={conversationId:e.state.id,revision:e.state.revision,proposalId:t.id,digest:t.digest},r=await e.client.workbenchCommand({kind:`cadence-prepare`,commandId:crypto.randomUUID(),...n});if(r.kind!==`ok`)throw Error(r.error.code);if(r.value.kind!==`cadence-grant`||!e.current()||r.value.revision!==e.state.revision||J(r.value.proposal)!==J(t)||Date.now()>=r.value.expiresAt)throw Error(`stale`);let i=crypto.randomUUID();return e.submitting(i),e.client.workbenchCommand({kind:`cadence-approve`,commandId:i,...n,grant:r.value.grant})}function sl(e){return/^(?:退出\s*cadence|关闭\s*cadence(?:模式)?|exit cadence)$/iu.test(e.trim())}function cl(e){return/^(?:按(?:这个|本)?计划(?:开始)?(?:执行|实施)|确认(?:计划并)?(?:执行|实施)|approve and execute)[。.!!]?$/iu.test(e.trim())}var ll=e=>`cadence:prompt-history:${e}`;function ul(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();e&&t.push(e)}return t}function dl(e,t,n=100){let r=t.trim();if(!r||e.length>0&&e[e.length-1]===r)return e;let i=[...e,r];return i.length>n?i.slice(i.length-n):i}function fl(e){try{let t=sessionStorage.getItem(ll(e));return t?ul(JSON.parse(t)):[]}catch{return[]}}function pl(e,t){let n=t;for(;n;)try{sessionStorage.setItem(ll(e),JSON.stringify(n));return}catch(e){if(!(e instanceof DOMException&&(e.name===`QuotaExceededError`||e.code===22))||n.length<=1)return;n=n.slice(Math.ceil(n.length/2))}}function ml(e,t){let n=fl(e),r=dl(n,t);r!==n&&pl(e,r)}var hl={index:-1,draft:``};function gl(e,t,n,r){if(n===`older`){if(!e.length||t.index===0)return null;let n=t.index===-1?e.length-1:Math.min(t.index,e.length)-1;return{cursor:{index:n,draft:t.index===-1?r:t.draft},text:e[n]}}if(t.index===-1)return null;let i=t.index+1;return i<e.length?{cursor:{index:i,draft:t.draft},text:e[i]}:{cursor:hl,text:t.draft}}function _l(e){return e===void 0||!(e===`@`||/[A-Za-z0-9_]/.test(e))}function vl(e,t){let n=typeof e==`string`?e:``,r=Math.max(0,Math.min(typeof t==`number`&&Number.isFinite(t)?Math.floor(t):0,n.length)),i=n.slice(0,r),a=i.lastIndexOf(`@`);if(a===-1||!_l(a>0?i[a-1]:void 0))return null;let o=i.slice(a+1);return/[\s@]/.test(o)?null:{start:a,query:o}}function yl(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?{folder:``,name:e}:{folder:e.slice(0,t).replace(/[\\/]+$/,``),name:e.slice(t+1)}}var bl=e=>e.length<=1024&&!/[\0\uD800-\uDFFF]/u.test(e);function xl(e,t,n=50){let r=t.toLowerCase();if(!r)return e.slice(0,n);let i=[],a=[];for(let t of e){let e=t.name.toLowerCase().indexOf(r);e===0?i.push(t):e>0&&a.push(t)}return[...i,...a].slice(0,n)}function Sl(e,t,n,r){let i=r.path.includes(`\\`)?`\\`:`/`,a=`@${r.path}${r.directory?i:` `}`,o=e.slice(n);return{text:e.slice(0,t.start)+a+(r.directory?o:o.replace(/^ /,``)),cursor:t.start+a.length}}function Cl(e){let t=Number.parseFloat(getComputedStyle(e).lineHeight)||0;return t>0?Math.max(2,t/2):2}var wl=``;function Tl(e,t,n=1){return{first:e<=n,last:Math.abs(t-e)<=n}}function El(e,t){return{first:!e.slice(0,t).includes(`
|
|
18
18
|
`),last:!e.slice(t).includes(`
|
package/web/dist/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "cadence-web-assets/1",
|
|
3
|
-
"sourceHash": "
|
|
3
|
+
"sourceHash": "700a0d4bb0f6773b127eb8398b3debba8f39c10df4ef0cf5f0a5266a6d7d3cfd",
|
|
4
4
|
"contractHash": "c62dcda9dc71daea1a7c8ef3f8b671c6a1cc0cfa4ddd98ed008eec9b3ea81245",
|
|
5
|
-
"buildId": "
|
|
5
|
+
"buildId": "fddca6045ef6bbe41c68d5071d20d7f51c1056b58d104341f3762022ac6e1270",
|
|
6
6
|
"assets": [
|
|
7
7
|
{
|
|
8
8
|
"name": "assets/cadence.css",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
{
|
|
75
75
|
"name": "assets/cadence.js",
|
|
76
76
|
"bytes": 514171,
|
|
77
|
-
"sha256": "
|
|
77
|
+
"sha256": "c560c5f7730a2818f389063d1c98aebe3d50ac6fc21a90287e1efebf1dfc8529",
|
|
78
78
|
"references": [
|
|
79
79
|
"assets/markdown.js",
|
|
80
80
|
"assets/react.js",
|