@hearsay-tools/squawk 0.18.0-pr4358.8529.2 → 0.18.0-pr4358.8568
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/index.js +23 -2
- package/dist/contract/session-context.d.ts +54 -8
- package/dist/data-gitignore.js +1 -0
- package/dist/data-gitignore.js.map +1 -1
- package/dist/delegation/provision.d.ts +2 -1
- package/dist/delegation/provision.js +45 -26
- package/dist/delegation/provision.js.map +1 -1
- package/dist/runners/antigravity/acp/events.d.ts +9 -1
- package/dist/runners/antigravity/acp/events.js +52 -11
- package/dist/runners/antigravity/acp/events.js.map +1 -1
- package/dist/runners/antigravity/acp/protocol.d.ts +12 -1
- package/dist/runners/antigravity/acp/protocol.js.map +1 -1
- package/dist/runners/antigravity/acp/session.d.ts +3 -0
- package/dist/runners/antigravity/acp/session.js +9 -0
- package/dist/runners/antigravity/acp/session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-runner.d.ts +2 -2
- package/dist/runners/antigravity/antigravity-session.d.ts +4 -4
- package/dist/runners/antigravity/antigravity-session.js +48 -20
- package/dist/runners/antigravity/antigravity-session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-ui-mapper.d.ts +2 -0
- package/dist/runners/antigravity/antigravity-ui-mapper.js +11 -3
- package/dist/runners/antigravity/antigravity-ui-mapper.js.map +1 -1
- package/dist/runners/antigravity/facts.d.ts +2 -2
- package/dist/runners/antigravity/facts.js +7 -5
- package/dist/runners/antigravity/facts.js.map +1 -1
- package/dist/runners/antigravity/mock.d.ts +4 -2
- package/dist/runners/antigravity/mock.js +3 -2
- package/dist/runners/antigravity/mock.js.map +1 -1
- package/dist/runners/antigravity/spec-support.js +1 -1
- package/dist/runners/antigravity/spec-support.js.map +1 -1
- package/dist/runners/antigravity/subagent-tracker.d.ts +50 -0
- package/dist/runners/antigravity/subagent-tracker.js +152 -0
- package/dist/runners/antigravity/subagent-tracker.js.map +1 -0
- package/dist/runners/antigravity/subagent-transcript.d.ts +41 -0
- package/dist/runners/antigravity/subagent-transcript.js +185 -0
- package/dist/runners/antigravity/subagent-transcript.js.map +1 -0
- package/dist/runners/antigravity/tool-normalization.d.ts +2 -0
- package/dist/runners/antigravity/tool-normalization.js +44 -2
- package/dist/runners/antigravity/tool-normalization.js.map +1 -1
- package/dist/runners/antigravity/tool-transcript.d.ts +24 -50
- package/dist/runners/antigravity/tool-transcript.js +88 -192
- package/dist/runners/antigravity/tool-transcript.js.map +1 -1
- package/dist/runners/antigravity/transcript-tailer.d.ts +56 -0
- package/dist/runners/antigravity/transcript-tailer.js +175 -0
- package/dist/runners/antigravity/transcript-tailer.js.map +1 -0
- package/dist/runners/antigravity/wire-updates.d.ts +4 -6
- package/dist/runners/antigravity/wire-updates.js +25 -3
- package/dist/runners/antigravity/wire-updates.js.map +1 -1
- package/dist/server/server.d.ts +64 -24
- package/dist/server/session-context-routes.d.ts +35 -15
- package/dist/server/session-context-routes.js +6 -6
- package/dist/server/session-context-routes.js.map +1 -1
- package/dist/session-context-file.d.ts +3 -3
- package/dist/session-context-file.js +45 -16
- package/dist/session-context-file.js.map +1 -1
- package/dist/session-context.d.ts +18 -9
- package/dist/session-context.js +118 -47
- package/dist/session-context.js.map +1 -1
- package/dist/workflows/run/continuation-session.js +1 -1
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/launch-context.d.ts +1 -1
- package/dist/workflows/run/launch-context.js +2 -2
- package/dist/workflows/run/launch-context.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +2 -2
- package/dist/workflows/run/session-events.js +2 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/step-session.js +1 -1
- package/dist/workflows/run/step-session.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-acp.mjs +128 -15
- package/web/dist/assets/{accounts-section-BQBCIvIe.js → accounts-section-VLKEYGPj.js} +1 -1
- package/web/dist/assets/{activity-motion-BoUcFlcy.js → activity-motion-IiyiWtXq.js} +1 -1
- package/web/dist/assets/{activity-route-dsZrLgOz.js → activity-route-QCPCR9kZ.js} +1 -1
- package/web/dist/assets/{agent-config-section-8C_KG8qw.js → agent-config-section-BK0gs0uc.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-Cpg6ytin.js → agent-defaults-section-BoluhHkE.js} +1 -1
- package/web/dist/assets/{appearance-CujGGeIB.js → appearance-CEFPwlnq.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BKFGWhTW.js → archive-on-merge-field-BEt4jVZt.js} +1 -1
- package/web/dist/assets/{automations-route-CcCP4L7S.js → automations-route-F58YdVbC.js} +1 -1
- package/web/dist/assets/{commit-list-DaVNfLE5.js → commit-list-BZ6wfGPz.js} +1 -1
- package/web/dist/assets/{diff-CCzM8XxZ.js → diff-BbD04q_C.js} +2 -2
- package/web/dist/assets/{diff-controls-C0gH_nhG.js → diff-controls-CW1hOWET.js} +1 -1
- package/web/dist/assets/{diff-view-C8P6QDsN.js → diff-view-C3XewBZ4.js} +1 -1
- package/web/dist/assets/{file-preview-UYewjhvt.js → file-preview-B3r8zavn.js} +1 -1
- package/web/dist/assets/{folder-browser-Dg4CmonF.js → folder-browser-6LK4AIPp.js} +1 -1
- package/web/dist/assets/{git-toolbar-Icz0Cr21.js → git-toolbar-CCZtGd6H.js} +1 -1
- package/web/dist/assets/github-CzZZ-wwm.js +1 -0
- package/web/dist/assets/{global-activity-route-NYRbJrma.js → global-activity-route-BNyhS-a8.js} +1 -1
- package/web/dist/assets/{image-preview-BuZ5gCX-.js → image-preview-CMk53HOX.js} +1 -1
- package/web/dist/assets/index-CGjknHnV.css +1 -0
- package/web/dist/assets/{index-C4gjdVLi.js → index-DaJ5iats.js} +6 -6
- package/web/dist/assets/{label-D1xUdJjL.js → label-YDZzSz0S.js} +1 -1
- package/web/dist/assets/{markdown-RK9z1Cn3.js → markdown-q0pVKAO0.js} +1 -1
- package/web/dist/assets/{notifications-section-CPqz7gvQ.js → notifications-section-n3Xb47pL.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-Cc8MoILP.js → preview-pane-connected-VmfC04wB.js} +1 -1
- package/web/dist/assets/{project-location-CDQm9Gul.js → project-location-GPzDWXuH.js} +1 -1
- package/web/dist/assets/{projects-section-ClAkyY7D.js → projects-section-BotQxpQ6.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-U3HnlNQb.js → prompt-templates-section-B8pr6Ue3.js} +1 -1
- package/web/dist/assets/queries-DDhFFTvR.js +1 -0
- package/web/dist/assets/{reference-chip-Clhghu8I.js → reference-chip-90x9Bq44.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CJcE3lxR.js → remote-settings-notice-F_onp6Yr.js} +1 -1
- package/web/dist/assets/{repo-git-CTIUcfsM.js → repo-git-B5Bse6ld.js} +1 -1
- package/web/dist/assets/{report-reader-BxaTkr-v.js → report-reader-B_kyYgIY.js} +1 -1
- package/web/dist/assets/reports-CNFNb36Z.css +1 -0
- package/web/dist/assets/{reports-Bz9ZRI-7.js → reports-D0E8DWXQ.js} +1 -1
- package/web/dist/assets/{resources-section-Dj1Bjzmf.js → resources-section-DcfHTNpN.js} +1 -1
- package/web/dist/assets/{run-header-BXQ-HR4O.js → run-header-OhEYfuQX.js} +1 -1
- package/web/dist/assets/{select-BhUI2GEt.js → select-r1KS5cjs.js} +1 -1
- package/web/dist/assets/session-context-section-PCOCiOTV.js +119 -0
- package/web/dist/assets/{settings-agent-picker-BdABOxwW.js → settings-agent-picker-D0UKjmOj.js} +1 -1
- package/web/dist/assets/{settings-shell-BUJWIyf6.js → settings-shell-BiPh5fg6.js} +1 -1
- package/web/dist/assets/{sidebar-section-C-CH38q4.js → sidebar-section-DmOlTUs8.js} +1 -1
- package/web/dist/assets/{skills-Be22BJDw.js → skills-CSLg7E0x.js} +1 -1
- package/web/dist/assets/{task-changes-D7ezDVM5.js → task-changes-DuOb61QV.js} +1 -1
- package/web/dist/assets/{task-commits-DxjVd56-.js → task-commits-CiGYJpqo.js} +1 -1
- package/web/dist/assets/{task-files-CVcyteyQ.js → task-files-fJSQ4Abg.js} +1 -1
- package/web/dist/assets/{task-github-item-Bw46CXoB.js → task-github-item-CRxN82Yw.js} +1 -1
- package/web/dist/assets/{task-groups-fk4Gq4hX.js → task-groups-B3Z2qfE6.js} +1 -1
- package/web/dist/assets/task-thread-CqjKwRuV.js +9 -0
- package/web/dist/assets/task-thread-DzADOhZd.css +1 -0
- package/web/dist/assets/{tasks-table-JFvtNCc1.js → tasks-table-Cm6YZBUB.js} +1 -1
- package/web/dist/assets/{thread-state-DU6osVw_.js → thread-state-DcHyKcQ-.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-C0vpMYLO.js → use-hand-to-agent-state-DuefXU2m.js} +1 -1
- package/web/dist/assets/{workflows-CsB1csR4.js → workflows-CC3TZmBS.js} +1 -1
- package/web/dist/assets/{workspace-tools-BXxPB3zi.js → workspace-tools-kscvD6KC.js} +1 -1
- package/web/dist/assets/{worktrees-section-BNnScarl.js → worktrees-section-CoKimDBt.js} +1 -1
- package/web/dist/index.html +8 -8
- package/dist/runners/antigravity/subagent-guard.d.ts +0 -17
- package/dist/runners/antigravity/subagent-guard.js +0 -38
- package/dist/runners/antigravity/subagent-guard.js.map +0 -1
- package/web/dist/assets/github-nBa7OE-M.js +0 -1
- package/web/dist/assets/index-B_cJa9gM.css +0 -1
- package/web/dist/assets/queries-BvWsZhaH.js +0 -1
- package/web/dist/assets/reports-DjDzVB_M.css +0 -1
- package/web/dist/assets/session-context-section-DcCwhluX.js +0 -119
- package/web/dist/assets/task-thread-cVekDQbH.js +0 -9
- package/web/dist/assets/task-thread-nVvn3n6d.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{c as n,o as r}from"./utils-DSMR_WLb.js";import{n as i,t as a,u as o}from"./live-refetch-1_o4J83F.js";import{$t as s,Ai as c,C as l,Ct as u,Di as d,Dt as f,E as p,G as m,Gt as h,H as g,Ht as _,In as v,Ir as ee,It as te,J as ne,Jt as re,K as ie,Kt as ae,Ln as oe,Lt as se,N as ce,Ni as le,Nn as ue,Ot as de,Pn as fe,Rr as pe,S as me,Si as he,St as ge,T as _e,Ti as ve,U as ye,Ut as be,V as xe,Vt as Se,W as Ce,Wr as we,Wt as Te,X as Ee,Xt as De,Y as Oe,Yt as ke,Zt as Ae,_ as je,_i as Me,_n as Ne,_t as Pe,ai as Fe,b as Ie,bi as Le,br as Re,bt as ze,ci as Be,cn as Ve,di as y,dn as He,en as Ue,f as We,fi as Ge,fn as Ke,ft as qe,g as Je,gi as Ye,gn as Xe,gt as Ze,hn as Qe,hr as $e,ht as et,ii as tt,in as nt,it as rt,j as it,jt as at,k as ot,ki as st,kt as ct,li as lt,ln as ut,lt as dt,mn as ft,mt as pt,ni as mt,nn as ht,oi as gt,p as _t,pt as vt,qt as yt,r as bt,ri as xt,rn as St,si as Ct,sn as wt,tn as Tt,un as Et,v as Dt,vt as Ot,w as kt,wt as At,x as jt,xt as Mt,y as Nt,yt as Pt,zn as Ft,zr as It,zt as Lt}from"./project-scope-context-C912rTJP.js";import{A as Rt,B as b,F as x,H as S,I as C,N as w,P as T,W as E,Z as D,j as O,z as k}from"./live-protocol-DMhTnCmf.js";import{t as zt}from"./useInfiniteQuery-CPEWc6dl.js";import{t as A}from"./useQuery-BOEhMTCg.js";import{n as j,r as Bt,t as Vt}from"./live-reads-CR3-q01w.js";import{n as Ht}from"./toaster-Bo5vCbz-.js";var Ut=class extends Ye{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Wt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Me({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Wt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Gt=class extends le{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),st(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Le(t.mutationKey)!==Le(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Wt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){D.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Kt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function qt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Jt=class extends le{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,D.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!st(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Kt(e,n).forEach(e=>{e.destroy()}),Kt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=d(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Ge(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=qt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},M=e(t(),1);function N({queries:e,...t},n){let r=y(n),i=lt(),a=Be(),o=M.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{mt(e);let t=r.getQueryCache().get(e.queryHash);Fe(e,a,t)}),Ct(a);let[s]=M.useState(()=>new Jt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;M.useSyncExternalStore(M.useCallback(e=>d?s.subscribe(D.batchCalls(e)):ve,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>tt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&tt(n,e)?xt(n,new Ge(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&>({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function P(e,t){let n=y(t),[r]=M.useState(()=>new Gt(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);let i=M.useSyncExternalStore(M.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((e,t)=>{r.mutate(e,t).catch(ve)},[r]);if(i.error&&c(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function F(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function I(e,t={}){return{...F(t),runId:e}}function Yt(e,t=!0,n=!1,r){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>de(F({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function L(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:W.models(t),refetchType:n})}function Xt(e,t=!0,n){return A({...Zt(e,n),enabled:t})}var Zt=(e,t)=>({queryKey:W.models(e,t),queryFn:({signal:n})=>Ft(e,{signal:n},t),staleTime:300*1e3});function Qt(e,t=!0){let n=N({queries:e.map(e=>({...Zt(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function $t(e,t){return JSON.stringify([e,t])}function en(e){return e.type===`run`?e.run.id:e.id}function R(e,t){return{...e,runs:t}}function tn(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var nn=class{runs;copied=!1;positions=new Map;constructor(e){this.runs=e,this.reindex()}reindex(){this.positions.clear(),this.runs.forEach((e,t)=>this.positions.set($t(e.projectId,e.id),t))}at(e,t){return this.positions.get($t(e,t))??-1}mutable(){return this.copied||=(this.runs=[...this.runs],!0),this.runs}replace(e,t){return this.mutable()[e]=t,this.runs}remove(e){return this.mutable().splice(e,1),this.reindex(),this.runs}insert(e){let t=this.runs.findIndex(t=>(t.createdAt??``).localeCompare(e.createdAt)<0);return this.mutable().splice(t<0?this.runs.length:t,0,e),this.reindex(),this.runs}};function rn(e,t,n){let r=new nn(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=un(i,e.project,e.usage,r);else{let t=sn(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function an(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function on(e,t,n){return sn(e,t,n,new nn(e.runs))}function sn(e,t,n,r){let{project:i}=t,a=r.at(i,en(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:R(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:R(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!an(e,i,n))return{index:e,reconcile:!0};let l=d(o,{projectId:i,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=r.replace(a,l),n=o.archived!==l.archived&&(s||tn(t,i)>e.perProjectLimit);return{index:R(e,t),reconcile:n}}if(s)return ln(e,l,r);let u=r.insert(l);return{index:R(e,u),reconcile:l.archived&&tn(u,i)>e.perProjectLimit}}function cn(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function ln(e,t,n){let r=cn(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:R(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function un(e,t,n,r){let i=!1;return e.runs.forEach((e,a)=>{if(e.projectId!==t)return;let o=n[e.id];if(o){let t=d(e.usage,o);if(t===e.usage)return;r.replace(a,{...e,usage:t})}else{if(e.usage===void 0)return;let{usage:t,...n}=e;r.replace(a,n)}i=!0}),i?R(e,r.runs):e}function dn(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function fn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function pn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function mn(e){e.stream=void 0}function hn(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,en(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function gn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function _n(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function vn(e,t,n){if(!_n(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=on(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var z=[`workspace`,`runs-index`],yn=[`workspace`,`projects`],bn=6e4,xn=100,Sn=new WeakMap;function Cn(e){let t=Sn.get(e);return t||(t=On(e),Sn.set(e,t)),t}function wn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:Cn(t).merge(e)}function Tn(e){let t=e.getQueryData(yn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function En(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function Dn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function On(e){let t=fn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(z,t)},h=()=>e.getQueryData(z),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:z,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:z,exact:!0}).then(()=>e.invalidateQueries({queryKey:z})):e.invalidateQueries({queryKey:z})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=Tn(e),{index:s,reconcile:c}=rn(a,t.filter(e=>e.generation===a.generation?e.type===`usage`?!l.has(e.project):!l.has(e.change.project)&&e.change.seq>a.eventSeq:!1),o);s!==a&&m(s),c&&_({hold:!0})},ee=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,xn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){pn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){mn(t)},run(e,r,i=!1){if(l.has(e))return;let a=Dn(e,r);if(!hn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),ee()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),ee()}},dropProject(e){l.add(e),gn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=dn(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=vn(t,n,Tn(e));for(let e of l)i.index=dn(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),En(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}function kn(e,t,r=!0){let i=mi(),a=K(),{runner:s,ready:c}=o(e??i.data?.defaultRunner??`claude`),l=a.data?.capabilities?.localHandoff===!1?null:t,u=n(),d=A({queryKey:U.runnerSkills(s,l),queryFn:({signal:e})=>me(s,l,{signal:e,projectId:u}),enabled:r&&c&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...d,runner:s,account:l,data:d.data?.skills,list:d.data,unchecked:d.isError||!d.data||d.data.source===`unavailable`}}var An={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},jn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function Mn(e){return typeof e==`string`&&Object.hasOwn(An,e)}function Nn(e){return e!==void 0&&Mn(e)?An[e]:void 0}var Pn=`cez.reference-statuses.v1`,Fn=`cez.reference-conflicts.v1`,B=new Map(zn()),In=1e3;function Ln(e,t){if(B.get(e)!==t){for(B.delete(e),B.set(e,t);B.size>In;){let e=B.keys().next().value;if(e===void 0)break;B.delete(e)}Hn()}}var V=new Set(Bn());function Rn(e,t){if(V.has(e)!==t){if(t)for(V.add(e);V.size>In;){let e=V.values().next().value;if(e===void 0)break;V.delete(e)}else V.delete(e);Hn()}}function zn(){try{let e=globalThis.sessionStorage?.getItem(Pn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&Mn(e[1])):[]}catch{return[]}}function Bn(){try{let e=globalThis.sessionStorage?.getItem(Fn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Vn;function Hn(){Vn===void 0&&(Vn=setTimeout(()=>{Vn=void 0;try{globalThis.sessionStorage?.setItem(Pn,JSON.stringify([...B])),globalThis.sessionStorage?.setItem(Fn,JSON.stringify([...V]))}catch{}},250))}var H=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Un(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function Wn(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function Gn(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;Ln(t,o),s!==void 0&&Rn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function Kn(e,t,n){let r=H(t),i=B.get(r),a=V.has(r)?!0:void 0,o=n.data;if(o?.available){Gn(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...Un(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...Un(i,a)});return}e.set(r,{state:`loading`,...Un(i,a)})}function qn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of Wn(i))Kn(n,e,t)}),n}var U={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},runnerSkills:(e,t)=>[n(),`runner-skills`,e,t??null],get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get sessionContext(){return[n(),`session-context`]},sessionContextPreview:(e,t)=>[n(),`session-context`,`preview`,t,e],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},W={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:z,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...W.fsBrowseRoot,e,t]};function Jn(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function Yn(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Xn(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function Zn(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function Qn(){let e=y();return A({queryKey:W.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(W.providerStatus),r=await ht(!1,{signal:t});return Re(n,e.getQueryData(W.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function $n(){let e=y();return P({mutationFn:()=>ht(!0),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>Re(r,e,t)),L(e)}})}function er(){let e=y();return P({mutationFn:({provider:e,authFailureId:t})=>He(e,t),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>Re(r,e,t,n.authFailureId)),L(e,n.provider)}})}function tr(e={}){return A({queryKey:W.projects,queryFn:({signal:e})=>Tt({signal:e}),...e})}function nr(e,t=!1){return A({queryKey:W.fsBrowse(e,t),queryFn:({signal:n})=>Te(e??void 0,{signal:n,showHidden:t}),retry:!1})}function rr(){let e=y();return P({mutationFn:e=>wt(e),onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function ir(){let e=y();return P({mutationFn:e=>ut(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:W.projects})}})}function ar(){let e=y();return P({mutationFn:e=>{let{id:t,...n}=e;return Xe(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:W.projects});let r=e.getQueryData(W.projects);return e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?or(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(W.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:W.projects})})}function or(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:Zn(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function sr(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(W.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:W.projects})})}function cr(){return sr(e=>{let{projectId:t,...n}=e;return ke(t,n)})}function lr(){return sr(e=>{let{projectId:t,webhookId:n,...r}=e;return Ne(t,n,r)})}function ur(){return sr(({projectId:e,webhookId:t})=>Et(e,t))}function dr(){return P({mutationFn:({projectId:e,webhookId:t})=>ft(e,t),retry:!1})}function G(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:W.agentProfiles}),t.invalidateQueries({queryKey:W.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),L(t)])},onError:()=>{t.invalidateQueries({queryKey:U.health}),t.invalidateQueries({queryKey:W.agentProfiles,exact:!0})}})}function fr(){return G(e=>yt(e))}function pr(){return G(e=>{let{id:t,...n}=e;return Qe(t,n)})}function mr(){return G(e=>Ve(e))}function hr(){return G(e=>Ke(e))}function gr(e,t){return A({queryKey:W.agentAccountStatus(e),queryFn:({signal:t})=>De(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function _r(){let e=y();return P({mutationFn:({provider:e,profileId:t})=>ae(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:W.agentProfiles}),e.invalidateQueries({queryKey:W.providerStatus}),L(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:U.health}),e.invalidateQueries({queryKey:W.agentProfiles,exact:!0})}})}function vr(){let e=y();return P({mutationFn:e=>De(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(W.agentAccountStatus(n),t),e.invalidateQueries({queryKey:W.agentProfiles}),L(e,t.status.provider)}})}function yr(){let e=y();return P({mutationFn:e=>h(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function br(){let e=y();return P({mutationFn:e=>re(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function xr({enabled:e}){return A({queryKey:W.githubOwners,queryFn:({signal:e})=>s({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Sr(){let e=y();(0,M.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(U.health);n&&(pe({bootProject:n.bootProject??`default`,apiBase:r()}),t??=Bt(`health`,t=>{e.setQueryData(U.health,t)}))};n();let i=e.getQueryCache().subscribe(n);return()=>{i(),t?.(),we()}},[e])}function K(){return A({queryKey:U.health,queryFn:({signal:e})=>Ue({signal:e})})}function Cr(e,t){let n=K().data,r=tr(t).data?.projects,i=bt(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?Jn(n?.repo?.remote):void 0}function wr(){return A({queryKey:W.uiState,queryFn:({signal:e})=>nt({signal:e})})}function Tr(){return A({queryKey:W.config,queryFn:({signal:e})=>St({signal:e})})}function Er(){return A({queryKey:W.agentProfiles,queryFn:({signal:e})=>Ae({signal:e})})}var q=[`workspace`,`runs-index`],J=e=>[e.cacheScope,`runs`,`list`],Y=e=>[e.cacheScope,`runs`,`detail`,e.runId],X=e=>typeof e==`function`?e():e;function Dr(e){let{seenAt:t,...n}=e;return n}function Or(e,t){let n=Dr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function kr(e,t,n){return t?{...e,seenAt:n}:Dr(e)}function Ar(e){let t=()=>{e.invalidateQueries({queryKey:q})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=It(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:J(X(n))}),await e.cancelQueries({queryKey:Y(X(n))});let i=e.getQueryData(J(X(n))),a=e.getQueryData(Y(X(n))),o=X(n).runId,s=new Date().toISOString();return e.setQueryData(J(X(n)),e=>e?.map(e=>e.id===o?kr(e,r,s):e)),e.setQueryData(Y(X(n)),e=>e&&kr(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(J(X(n)),i),a&&e.setQueryData(Y(X(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(J(X(n)),e=>e?.map(e=>e.id===o?Or(e,t):e)),a&&e.setQueryData(Y(X(n)),e=>e&&Or(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?kr(e,r,i.seenAt):e;e.setQueryData(J(X(n)),e=>e?.map(a));let s={...X(n),runId:r?o:i.id};e.setQueryData(Y(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:q});let i=e.getQueryData(q),a=n();return e.setQueryData(q,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(q,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function Z(){let e=y();return(0,M.useMemo)(()=>Ar(e),[e])}async function jr(e,t=!1){return oe(await fe.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:n(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),v(e,`/worker-destroy`))}function Mr(){return A({queryKey:U.openTargets,queryFn:({signal:e})=>Pe({signal:e}),staleTime:5*6e4})}function Nr(){return A({queryKey:U.runs.list(),queryFn:({signal:e})=>de(F(),{signal:e})})}function Pr(e,t){return zt({queryKey:U.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>qe({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function Fr(e){let t=e.trim();return A({queryKey:W.runsSearch(t),queryFn:({signal:e})=>Se(t,{signal:e}),enabled:t.length>=2,placeholderData:he,staleTime:1e4})}function Ir(e=!0,t=bn,n){let r=Cn(y());return j(`/api/v1/workspace/runs-index`,W.runsIndex,a(e?t:!1),wn),A({queryKey:W.runsIndex,queryFn:({signal:e})=>ct({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function Lr(e){let t=y();return P({mutationFn:({workerId:e,discardWork:t=!1})=>jr(e,t),onSettled:()=>t.invalidateQueries({queryKey:U.runs.relationships(e)})})}function Rr(e,t={}){return A({queryKey:U.runs.relationships(e),queryFn:({signal:t})=>f(e,{signal:t}),enabled:t.enabled??!0})}function zr(e){return A({queryKey:U.runs.detail(e??``),queryFn:({signal:t})=>Ot(I(e),{signal:t}),enabled:!!e})}function Br(e,t,n=!0){return A({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ot(I(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function Vr(e){return A({queryKey:U.runs.diff(e??``),queryFn:({signal:t})=>ge(e,{signal:t}),enabled:!!e})}function Hr(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,U.runs.changes(e??``),a(t?4e3:!1)),A({queryKey:U.runs.changes(e??``),queryFn:({signal:t})=>Pt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ur(e,t){return A({queryKey:U.runs.file(e??``,t??``),queryFn:({signal:n})=>u(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Wr(e,t){return A({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Ze(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Gr(e,t){return A({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>vt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Kr(e,t){return A({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>pt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function qr(e){return A({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>et(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Jr(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,U.runs.commits(e??``),a(t?5e3:!1)),A({queryKey:U.runs.commits(e??``),queryFn:({signal:t})=>Mt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Yr(e,t){return A({queryKey:U.runs.commit(e??``,t??``),queryFn:({signal:n})=>ze(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Xr(e,t=!0){return A({queryKey:U.runs.handoff(e??``),queryFn:({signal:t})=>At(I(e),{signal:t}),enabled:!!e&&t})}function Zr(e,t,n){return A({queryKey:e===void 0?U.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>At(I(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Qr(e,t){let r=[...new Set(e)],i=N({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>Je({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,M.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function $r(e){let t=y();return P({mutationFn:t=>at(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ei(e){let t=y();return P({mutationFn:t=>te(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ti(e){let t=Z(),n=e?.projectId,r=e?.cacheScope,i=P({mutationFn:e=>be(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,M.useCallback)(e=>({...I(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,M.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,M.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,M.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function ni(){let e=Z();return P({mutationFn:e=>be(I(e),!1),onMutate:t=>e.patchRead(()=>I(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ri(e){let t=Z();return P({mutationFn:({id:t,pinned:n})=>se(I(t,e),n),onError:e=>Ht(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??F(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ii(e,t){let n=Z();return P({mutationFn:n=>_(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof ue&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function ai(e,t){let n=Z();return P({mutationFn:(n={})=>rt(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function oi(e){let t=y();return P({mutationFn:({msgId:t,message:n})=>dt(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function si(e){let t=y();return P({mutationFn:t=>Lt(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ci(){return A({queryKey:U.workflows,queryFn:({signal:e})=>_e({signal:e})})}function li(){return A({queryKey:U.repo,queryFn:({signal:e})=>Dt({signal:e})})}function ui(e){return A({queryKey:[e,`repo`],queryFn:({signal:t})=>Dt({signal:t},e)})}function di(){return A({queryKey:U.repoBranches,queryFn:({signal:e})=>Nt({signal:e})})}function fi(){return A({queryKey:U.repoChanges,queryFn:({signal:e})=>Ie({signal:e}),retry:!1})}function pi(e){return A({queryKey:U.repoCommit(e??``),queryFn:({signal:t})=>jt(e,{signal:t}),enabled:!!e,retry:!1})}function mi(){return A({queryKey:U.config,queryFn:({signal:e})=>je({signal:e})})}function hi(){return A({queryKey:U.worktrees,queryFn:({signal:e})=>p({signal:e})})}function gi(e){return A({queryKey:[e,`worktrees`],queryFn:({signal:t})=>p({signal:t},e),staleTime:0})}function _i(e,t=!0,n=!1){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>kt({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:ee(e.sidebarLimits)},enabled:t})}function vi(){return _i(n())}function yi(){return A({queryKey:U.agentConfig,queryFn:({signal:e})=>We({signal:e})})}function bi(e){return A({queryKey:U.agentConfigFile(e??``),queryFn:({signal:t})=>_t(e,{signal:t}),enabled:e!==null})}function xi(){return A({queryKey:U.sessionContext,queryFn:({signal:e})=>l({signal:e})})}function Si(e,t){return A({queryKey:U.sessionContextPreview(e,t),queryFn:({signal:n})=>ot({content:e,role:t},{signal:n}),placeholderData:he,staleTime:0,retry:!1})}function Ci(){let e=y();return P({onMutate:()=>({fileKey:U.sessionContext}),mutationFn:e=>ce(e),onSuccess:(t,n,r)=>{r&&e.setQueryData(r.fileKey,t)}})}function wi(e){let t=y(),n=U.agentConfig,r=U.agentConfigFile(e);return P({mutationFn:t=>it(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var Ti=O([`passing`,`failing`,`pending`]).nullable(),Q=b({kind:O([`issue`,`pr`]),number:k(),title:E(),author:E(),createdAt:E(),labels:w(E()),body:E().optional(),url:E(),comments:k(),assignees:w(E()).optional(),projectIds:w(E()).optional(),isDraft:T().optional(),additions:k().optional(),deletions:k().optional(),checks:Ti.optional()});x(`available`,[b({available:C(!0),item:Q.nullable(),labelColors:S(E(),E()).optional()}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),number:Rt().int().positive().safe()});var Ei=b({id:E(),title:E(),url:E()});b({available:T(),reason:E().optional(),repo:E().optional(),syncedAt:E().optional(),issues:w(Q),prs:w(Q),labelColors:S(E(),E()).optional(),viewerLogin:E().optional(),projects:w(Ei).optional(),projectsReason:E().optional(),projectsState:O([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:E().optional(),issuesTotal:k().int().nonnegative().optional(),prsTotal:k().int().nonnegative().optional(),issuesNextCursor:E().nullable().optional(),prsNextCursor:E().nullable().optional(),commentsDeferred:C(!0).optional()});var Di=E().min(1).max(2e3).optional();b({limit:E().optional(),refresh:E().optional(),issuesCursor:Di,prsCursor:Di,issuesDone:C(`1`).optional(),prsDone:C(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),b({kind:O([`issue`,`pr`]),numbers:E().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:C(`1`).optional()}),x(`available`,[b({available:C(!0),counts:S(k(),k().int().nonnegative())}),b({available:C(!1),reason:E()})]),x(`available`,[b({available:C(!0),checks:S(k(),Ti)}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),q:E().trim().min(1).max(256),limit:Rt().int().positive().max(50).optional()}),b({available:T(),projectsReason:E().optional(),reason:E().optional(),items:w(Q),truncated:T().optional(),labelColors:S(E(),E()).optional()});var Oi=k().nullable();x(`available`,[b({available:C(!0),prs:S(k(),$e),issues:S(k(),$e),conflicts:w(k()).optional(),recheckAfterMs:Oi}),b({available:C(!1),reason:E(),recheckAfterMs:Oi})]);var ki=b({id:k(),author:E(),avatarUrl:E().optional(),createdAt:E(),body:E(),kind:O([`comment`,`review`]),reviewState:O([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:E()}),Ai=O([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),ji=b({id:E(),kind:Ai,actor:E(),avatarUrl:E().optional(),createdAt:E(),url:E().optional(),sha:E().optional(),message:E().optional(),checks:Ti.optional(),label:b({name:E(),color:E().optional()}).optional(),subject:E().optional(),refNumber:k().optional(),refTitle:E().optional(),refIsPr:T().optional()});b({available:T(),reason:E().optional(),comments:w(ki),truncated:T().optional(),events:w(ji).optional(),detail:b({body:E(),additions:k().int().nonnegative().optional(),deletions:k().int().nonnegative().optional()}).optional()});var Mi=O([`merge`,`squash`,`rebase`]),Ni=b({name:E(),state:O([`passing`,`failing`,`pending`,`unknown`]),required:T().nullable(),url:E().optional()}),Pi=b({number:k(),title:E(),url:E(),state:O([`open`,`closed`,`merged`]),isDraft:T(),headRef:E(),baseRef:E(),headSha:E(),mergeable:O([`mergeable`,`conflicting`,`unknown`]),reviewDecision:O([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:w(Ni),methods:w(Mi),defaultMethod:Mi.nullable(),eligibility:O([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:w(b({code:E(),message:E()})),canMerge:T(),canOverride:T()});x(`available`,[b({available:C(!0),mergeState:Pi}),b({available:C(!1),reason:E()})]),b({merged:C(!0),number:k(),url:E(),method:Mi,mergeCommitSha:E().optional()});var Fi=b({path:E(),previousPath:E().optional(),status:O([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:k(),deletions:k(),patch:E().optional(),patchUnavailableReason:O([`binary`,`too-large`,`not-provided`]).optional(),truncated:T().optional()});x(`available`,[b({available:C(!0),number:k(),headSha:E(),files:w(Fi),additions:k(),deletions:k(),truncated:T(),reason:E().optional()}),b({available:C(!1),reason:E()})]),b({generation:E().uuid()}),x(`state`,[b({generation:E().uuid(),state:C(`ready`),projects:w(Ei),membership:S(E(),w(E()))}),b({generation:E().uuid(),state:C(`unavailable`),reason:E()})]);function Ii(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function Li(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function Ri(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function zi(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){Ri(t.issues,a,r),Ri(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var $=e=>e.map(e=>e.number).join(`,`);function Bi(e,t){let n=e[0];if(e.length>1&&n&&($(n.issues)!==$(t.issues)||$(n.prs)!==$(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}function Vi(e={},t=!0){let r=y(),i=U.github(e);j(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=A({queryKey:U.github(e),queryFn:({signal:t})=>xe({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=A({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>ne(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,M.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,s,c.data,c.error,i]),o}var Hi=class extends Error{};function Ui(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await xe({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new Hi(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ii(e),retry:(e,t)=>!(t instanceof Hi)&&!(t instanceof ue&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function Wi(e=50,t=!0){let r=y(),i=U.githubPages(e),o=U.githubPagesHead(e);j(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=zt({...Ui(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=A({queryKey:o,queryFn:({signal:t})=>xe({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,M.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=Bi(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=N({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>ne(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,M.useEffect)(()=>{d.forEach((e,t)=>{let n=u[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,M.useMemo)(()=>zi(s.data?.pages??[]),[s.data])}}function Gi(e,t=50,n=!0){let r=zt({...Ui([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,M.useMemo)(()=>zi(r.data?.pages??[]),[r.data])}}function Ki(e,t,n=!0){let r=N({queries:t.filter(e=>e.length>0).map(t=>({queryKey:U.githubCommentCounts(e,t),queryFn:({signal:n})=>ye(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,M.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function qi(e,t,n,r=!0){return A({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>Ee(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function Ji(e,t=!0){return A({queryKey:U.githubChecks(e),queryFn:({signal:t})=>g(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Yi(e,t,n=!0){return A({queryKey:U.githubSearch(e,t),queryFn:({signal:n})=>Ee(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Xi=100;function Zi(e){return[...e].sort((e,t)=>t-e).slice(0,Xi).sort((e,t)=>e-t)}function Qi(){let e=bt(),t=K();return e.projectId??t.data?.bootProject}function $i(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Ln(H({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Ln(H({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var ea=5*6e4;function ta(e){return e?e.recheckAfterMs:ea}function na(e,t=!0){let n=(0,M.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:Zi(t.prs),issues:Zi(t.issues)}))},[e.map(H).sort().join(`|`)]),r=N({queries:n.map(e=>({queryKey:U.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Oe(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>ta(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),a=y(),o=JSON.stringify(n.map((e,t)=>({...e,interval:ta(r[t]?.data)??!1})));(0,M.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=U.githubRefStatus(t.projectId,t.prs,t.issues);return Vt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,M.useMemo)(()=>qn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,M.useCallback)(e=>{let t=H(e),n=s.get(t);if(n)return n;let r=B.get(t);return{state:`idle`,...r?{status:r}:{},...V.has(t)?{conflicting:!0}:{}}},[s])}function ra(e,t,n=!0){return A({queryKey:U.githubComments(e,t),queryFn:({signal:n})=>Ce(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ia(e,t,n=!0){return A({queryKey:U.githubItem(e,t),queryFn:({signal:n})=>m(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function aa(e){return A({queryKey:U.githubPrChanges(e??0),queryFn:({signal:t})=>ie(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Vr as $,N as $t,ci as A,hr as At,Wr as B,U as Bt,li as C,vr as Ct,xi as D,ir as Dt,pi as E,mr as Et,qr as F,Tr as Ft,ei as G,Cn as Gt,ni as H,jn as Ht,Qr as I,wr as It,si as J,Xt as Jt,ri as K,L as Kt,ai as L,Yn as Lt,Pr as M,pr as Mt,Gr as N,ar as Nt,Si as O,ur as Ot,Kr as P,lr as Pt,Jr as Q,P as Qt,Lr as R,Xn as Rt,Ci as S,Qn as St,fi as T,rr as Tt,$r as U,Nn as Ut,ti as V,W as Vt,Mr as W,kn as Wt,Hr as X,F as Xt,zr as Y,Yt,Yr as Z,I as Zt,mi as _,xr as _t,ra as a,Fr as at,gi as b,Cr as bt,aa as c,Z as ct,qi as d,yr as dt,Ut as en,Ur as et,Qi as f,_r as ft,bi as g,nr as gt,yi as h,cr as ht,Ki as i,Ir as it,hi as j,dr as jt,vi as k,er as kt,Yi as l,gr as lt,Li as m,br as mt,Vi as n,Rr as nt,ia as o,ii as ot,na as p,fr as pt,Br as q,Qt as qt,Ji as r,Nr as rt,Wi as s,Zr as st,$i as t,Xr as tt,Gi as u,Er as ut,ui as v,K as vt,di as w,$n as wt,wi as x,tr as xt,_i as y,Sr as yt,oi as z,Jn as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.reports-row{position:relative}.reports-open{align-items:center;min-width:0;display:flex}.reports-open:after{content:"";position:absolute;inset:0}.reports-task{z-index:1;align-items:center;min-width:0;max-width:100%;display:inline-flex;position:relative}@media (hover:none),(width<=767px){.reports-open{min-block-size:44px;margin-block:-12px}.reports-task{min-block-size:44px;margin-block:-14px}}.reports-open:focus-visible{outline:2px solid #0000}.reports-row:has(.reports-open:focus-visible){outline:2px solid var(--ring);outline-offset:2px}.reports-task:focus-visible{outline:2px solid var(--ring);outline-offset:2px;border-radius:4px}.reports-row:active{background:var(--sidebar-row-selected)}@media (hover:hover) and (pointer:fine){.reports-row:hover{background:var(--sidebar-row-hover)}.reports-row:hover .reports-cue{color:var(--foreground)}}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Nn as i}from"./project-scope-context-C912rTJP.js";import{D as a,O as o,S as s}from"./queries-BvWsZhaH.js";import{n as c}from"./toaster-Bo5vCbz-.js";import{t as l}from"./plus-CxRU2X8C.js";import{t as u}from"./button-B7MKxYjT.js";import{t as d}from"./badge-DQ3U69Ht.js";import{t as f}from"./centered-state-V15AR_qo.js";import{Hn as p,er as m,gn as h}from"./index-C4gjdVLi.js";import{t as g}from"./code-editor-B4baSOhz.js";var _=e(t(),1);function v(e,t,n){let r=e.indexOf(t),i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1};if(n===`Home`)return e[0];if(n===`End`)return e.at(-1);if(!(i[n]===void 0||r===-1))return e[(r+i[n]+e.length)%e.length]}var y=n(),b={"built-in":`built in`,parent:`parent`,worker:`worker`,both:`both`},x={applied:`border-success/40 text-success`,skipped:`border-conflict/50 text-conflict`,"not-for-role":`text-soft-foreground`},S=e=>`${e.toLocaleString(`en-US`)} B`;function C({id:e,preview:t,role:n,onRole:i,pending:a,className:o}){return(0,y.jsxs)(`section`,{id:e,"data-slot":`session-context-preview`,"aria-labelledby":`session-context-preview-title`,"aria-busy":a,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,o),children:[(0,y.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`h3`,{id:`session-context-preview-title`,className:`text-sm font-semibold`,children:`Preview`}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Updates as you type`})]}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,y.jsx)(`span`,{id:`session-context-role`,className:`text-[12px] text-soft-foreground`,children:`Preview as`}),(0,y.jsx)(w,{role:n,onRole:i}),(0,y.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`Files come from the project checkout. Task values are samples.`})]}),t?(0,y.jsx)(te,{used:t.usedBytes,limit:t.limitBytes,blocks:t.blocks}):(0,y.jsx)(`div`,{className:`h-[38px]`})]}),(0,y.jsx)(`ul`,{"data-slot":`session-context-blocks`,className:`divide-y divide-border`,children:t?.blocks.map((e,t)=>(0,y.jsx)(ne,{block:e,role:n},`${e.id}-${t}`))})]})}var ee=[`parent`,`worker`];function w({role:e,onRole:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`session-context-role`,onKeyDown:r=>{let i=v(ee,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`inline-flex overflow-hidden rounded-md border border-[var(--control-border)]`,children:ee.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,role:`radio`,"aria-checked":e===i,tabIndex:e===i?0:-1,"data-slot":`session-context-role`,onClick:()=>t(i),className:r(`min-h-11 px-4 text-[13px] capitalize text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,e===i&&`bg-muted text-foreground`),children:i},i))})}function te({used:e,limit:t,blocks:n}){let r=n.filter(e=>e.status===`applied`).length,i=n.filter(e=>e.status===`skipped`).length,a=Math.min(100,e/t*100);return(0,y.jsxs)(`div`,{"data-slot":`session-context-meter`,children:[(0,y.jsx)(`div`,{role:`meter`,"aria-label":`Session context size`,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":e,"aria-valuetext":`${S(e)} of ${S(t)}`,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,y.jsx)(`div`,{className:`h-full rounded-full bg-accent-strong`,style:{width:`${a}%`}})}),(0,y.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-x-3 text-[12px]`,children:[(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[S(e),` used: `,r,` `,r===1?`block`:`blocks`,` applied`,i>0?`, ${i} skipped`:``]}),(0,y.jsxs)(`span`,{className:`ml-auto text-soft-foreground`,children:[`Limit 64 KiB (`,S(t),`)`]})]})]})}function ne({block:e,role:t}){let n=e.status===`not-for-role`?`not for ${t}`:e.status;return(0,y.jsxs)(`li`,{"data-slot":`session-context-block`,"data-status":e.status,className:`flex flex-col gap-1.5 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] text-foreground`,children:e.id}),e.target&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:b[e.target]}),(0,y.jsx)(`span`,{className:`ml-auto font-mono text-[12px] text-soft-foreground`,children:e.bytes===null?`—`:S(e.bytes)}),(0,y.jsx)(d,{variant:`outline`,className:r(`text-[11px]`,x[e.status]),children:n})]}),e.reason&&(0,y.jsx)(`p`,{className:`text-[12px] text-conflict`,children:e.reason}),e.text!==null&&(0,y.jsxs)(`pre`,{tabIndex:0,"aria-label":`${e.id} text`,className:`max-h-28 overflow-auto rounded-md bg-background px-2.5 py-2 font-mono text-[12px] whitespace-pre-wrap text-muted-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[e.text,e.truncated?`
|
|
2
|
-
…`:``]})]})}var T=Symbol.for(`yaml.alias`),re=Symbol.for(`yaml.document`),E=Symbol.for(`yaml.map`),ie=Symbol.for(`yaml.pair`),D=Symbol.for(`yaml.scalar`),O=Symbol.for(`yaml.seq`),k=Symbol.for(`yaml.node.type`),ae=e=>!!e&&typeof e==`object`&&e[k]===T,oe=e=>!!e&&typeof e==`object`&&e[k]===re,A=e=>!!e&&typeof e==`object`&&e[k]===E,j=e=>!!e&&typeof e==`object`&&e[k]===ie,M=e=>!!e&&typeof e==`object`&&e[k]===D,se=e=>!!e&&typeof e==`object`&&e[k]===O;function N(e){if(e&&typeof e==`object`)switch(e[k]){case E:case O:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[k]){case T:case E:case D:case O:return!0}return!1}var ce=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),le=Symbol(`skip children`),I=Symbol(`remove node`);function ue(e,t){let n=me(t);oe(e)?de(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):de(null,e,n,Object.freeze([]))}ue.BREAK=F,ue.SKIP=le,ue.REMOVE=I;function de(e,t,n,r){let i=he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),de(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=de(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=de(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=de(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}async function fe(e,t){let n=me(t);oe(e)?await pe(null,e.contents,n,Object.freeze([e]))===I&&(e.contents=null):await pe(null,e,n,Object.freeze([]))}fe.BREAK=F,fe.SKIP=le,fe.REMOVE=I;async function pe(e,t,n,r){let i=await he(e,t,n,r);if(P(i)||j(i))return ge(e,r,i),pe(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await pe(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===I&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=await pe(`key`,t.key,n,r);if(e===F)return F;e===I&&(t.key=null);let i=await pe(`value`,t.value,n,r);if(i===F)return F;i===I&&(t.value=null)}}return i}function me(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function he(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(A(t))return n.Map?.(e,t,r);if(se(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(ae(t))return n.Alias?.(e,t,r)}function ge(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(oe(r))r.contents=n;else{let e=ae(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var _e={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},ve=e=>e.replace(/[!,[\]{}]/g,e=>_e[e]),L=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+ve(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&P(e.contents)){let t={};ue(e.contents,(e,n)=>{P(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
3
|
-
`)}};L.defaultYaml={explicit:!1,version:`1.2`},L.defaultTags={"!!":`tag:yaml.org,2002:`};function ye(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function be(e){let t=new Set;return ue(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function xe(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Se(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=be(e);let a=xe(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(M(t.node)||N(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function R(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=R(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=R(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=R(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=R(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function z(e,t,n){if(Array.isArray(e))return e.map((e,t)=>z(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ce(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var Ce=class{constructor(e){Object.defineProperty(this,k,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!oe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=z(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?R(i,{"":o},``,o):o}},we=class extends Ce{constructor(e){super(T),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ue(e,{Node:(e,t)=>{(ae(t)||ce(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(z(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Te(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ye(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Te(e,t,n){if(ae(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(N(t)){let r=0;for(let i of t.items){let t=Te(e,i,n);t>r&&(r=t)}return r}else if(j(t)){let r=Te(e,t.key,n),i=Te(e,t.value,n);return Math.max(r,i)}return 1}var Ee=e=>!e||typeof e!=`function`&&typeof e!=`object`,B=class extends Ce{constructor(e){super(D),this.value=e}toJSON(e,t){return t?.keep?this.value:z(this.value,e,t)}toString(){return String(this.value)}};B.BLOCK_FOLDED=`BLOCK_FOLDED`,B.BLOCK_LITERAL=`BLOCK_LITERAL`,B.PLAIN=`PLAIN`,B.QUOTE_DOUBLE=`QUOTE_DOUBLE`,B.QUOTE_SINGLE=`QUOTE_SINGLE`;var De=`tag:yaml.org,2002:`;function Oe(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ke(e,t,n){if(oe(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[E].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??=i(e),new we(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=De+t.slice(2));let l=Oe(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new B(e);return c&&(c.node=t),t}l=e instanceof Map?o[E]:Symbol.iterator in Object(e)?o[O]:o[E]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new B(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Ae(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ke(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var je=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Me=class extends Ce{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(je(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ae(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ne=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function V(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var H=(e,t,n)=>e.endsWith(`
|
|
4
|
-
`)?V(n,t):n.includes(`
|
|
5
|
-
`)?`
|
|
6
|
-
`+V(n,t):(e.endsWith(` `)?``:` `)+n,Pe=`flow`,Fe=`block`,Ie=`quoted`;function Le(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Re(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
7
|
-
`)n===`block`&&(h=Re(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
8
|
-
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
9
|
-
`&&t!==` `&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function Re(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
10
|
-
`);r=t,i=t+1,a=e[i]}return r}var ze=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Be=e=>/^(%|---|\.\.\.)/m.test(e);function Ve(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
11
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function He(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Be(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
12
|
-
|
|
13
|
-
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
14
|
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:Le(o,a,Ie,ze(t,!1))}function Ue(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
15
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return He(e,t);let n=t.indent||(Be(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:Le(r,n,Pe,ze(t,!1))}function We(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=He;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Ue:i&&!t?He:n?Ue:He}return r(e,t)}var Ge;try{Ge=RegExp(`(^|(?<!
|
|
16
|
-
))
|
|
17
|
-
+(?!
|
|
18
|
-
|$)`,`g`)}catch{Ge=/\n+(?!\n|$)/g}function Ke({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return We(n,r);let l=r.indent||(r.forceBlockIndent||Be(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===B.BLOCK_FOLDED?!1:t===B.BLOCK_LITERAL||!Ve(n,c,l.length);if(!n)return u?`|
|
|
19
|
-
`:`>
|
|
20
|
-
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
21
|
-
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
22
|
-
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
23
|
-
`&&(p=p.slice(0,-1)),p.replace(Ge,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
24
|
-
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
25
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=ze(r,!0);o!==`folded`&&t!==B.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Le(`${v}${e}${p}`,l,Fe,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function qe(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
26
|
-
`)||u&&/[[\]{},]/.test(a))return We(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
27
|
-
`)?We(a,t):Ke(e,t,n,r);if(!s&&!u&&i!==B.PLAIN&&a.includes(`
|
|
28
|
-
`))return Ke(e,t,n,r);if(Be(a)){if(c===``)return t.forceBlockIndent=!0,Ke(e,t,n,r);if(s&&c===l)return We(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return We(a,t)}return s?d:Le(d,c,Pe,ze(t,!1))}function Je(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==B.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=B.QUOTE_DOUBLE);let c=e=>{switch(e){case B.BLOCK_FOLDED:case B.BLOCK_LITERAL:return i||a?We(o.value,t):Ke(o,t,n,r);case B.QUOTE_DOUBLE:return He(o.value,t);case B.QUOTE_SINGLE:return Ue(o.value,t);case B.PLAIN:return qe(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Ye(e,t){let n=Object.assign({blockQuote:!0,commentString:Ne,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Xe(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(M(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ze(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(M(e)||N(e))&&e.anchor;a&&ye(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Qe(e,t,n,r){if(j(e))return e.toString(t,n,r);if(ae(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=P(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Xe(t.doc.schema.tags,a);let o=Ze(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):M(a)?Je(a,t,n,r):a.toString(t,n,r);return o?M(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function $e({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=P(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(N(e)||!P(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||N(e)||(M(e)?e.type===B.BLOCK_FOLDED||e.type===B.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Qe(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=H(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=H(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=H(g,n.indent,l(f))));let _,v,y;P(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&M(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&se(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Qe(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
29
|
-
`:``,v){let e=l(v);S+=`\n${V(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
30
|
-
`&&y&&(S=`
|
|
31
|
-
|
|
32
|
-
`):S+=`\n${n.indent}`}else if(!p&&N(t)){let e=x[0],r=x.indexOf(`
|
|
33
|
-
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
|
|
34
|
-
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=H(g,n.indent,l(y)):h&&i&&i(),g}function et(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var tt=`<<`,U={identify:e=>e===tt||typeof e==`symbol`&&e.description===tt,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new B(Symbol(tt)),{addToJSMap:rt}),stringify:()=>tt},nt=(e,t)=>(U.identify(t)||M(t)&&(!t.type||t.type===B.PLAIN)&&U.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===U.tag&&e.default);function rt(e,t,n){let r=at(e,n);if(se(r))for(let n of r.items)it(e,t,n);else if(Array.isArray(r))for(let n of r)it(e,t,n);else it(e,t,r)}function it(e,t,n){let r=at(e,n);if(!A(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function at(e,t){return e&&ae(t)?t.resolve(e.doc,e):t}function ot(e,t,{key:n,value:r}){if(P(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(nt(e,n))rt(e,t,r);else{let i=z(n,``,e);if(t instanceof Map)t.set(i,z(r,i,e));else if(t instanceof Set)t.add(i);else{let a=st(n,i,e),o=z(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function st(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(P(e)&&n?.doc){let t=Ye(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),et(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function ct(e,t,n){return new W(ke(e,void 0,n),ke(t,void 0,n))}var W=class e{constructor(e,t=null){Object.defineProperty(this,k,{value:ie}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return P(n)&&(n=n.clone(t)),P(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return ot(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?$e(this,e,t,n):JSON.stringify(this)}};function lt(e,t,n){return(t.inFlow??e.flow?dt:ut)(e,t,n)}function ut({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(P(i))!d&&i.spaceBefore&&f.push(``),ft(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(j(i)){let e=P(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),ft(n,f,e.commentBefore,d))}d=!1;let s=Qe(i,u,()=>o=null,()=>d=!0);o&&(s+=H(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
35
|
-
`}}return e?(p+=`
|
|
36
|
-
`+V(l(e),c),s&&s()):d&&o&&o(),p}function dt({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(P(i))i.spaceBefore&&d.push(``),ft(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(j(i)){let e=P(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),ft(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=P(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Qe(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
37
|
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=H(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
38
|
-
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function ft({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=V(t(r),e);n.push(i.trimStart())}}function G(e,t){let n=M(t)?t.value:t;for(let r of e)if(j(r)&&(r.key===t||r.key===n||M(r.key)&&r.key.value===n))return r}var K=class extends Me{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(E,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(ct(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=j(e)?e:!e||typeof e!=`object`||!(`key`in e)?new W(e,e?.value):new W(e.key,e.value);let r=G(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);M(r.value)&&Ee(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=G(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=G(this.items,e)?.value;return(!t&&M(n)?n.value:n)??void 0}has(e){return!!G(this.items,e)}set(e,t){this.add(new W(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)ot(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!j(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),lt(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},q={collection:`map`,default:!0,nodeClass:K,tag:`tag:yaml.org,2002:map`,resolve(e,t){return A(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>K.from(e,t,n)},J=class extends Me{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(O,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=pt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=pt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&M(r)?r.value:r}has(e){let t=pt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=pt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];M(r)&&Ee(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(z(e,String(r++),t));return n}toString(e,t,n){return e?lt(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(ke(a,void 0,n))}}return i}};function pt(e){let t=M(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var mt={collection:`seq`,default:!0,nodeClass:J,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return se(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>J.from(e,t,n)},ht={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Je(e,t,n,r)}},gt={identify:e=>e==null,createNode:()=>new B(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new B(null),stringify:({source:e},t)=>typeof e==`string`&>.test.test(e)?e:t.options.nullStr},_t={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new B(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&_t.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Y({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var vt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Y},yt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Y(e)}},bt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new B(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:Y},xt=e=>typeof e==`bigint`||Number.isInteger(e),St=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Ct(e,t,n){let{value:r}=e;return xt(r)&&r>=0?n+r.toString(t):Y(e)}var wt={identify:e=>xt(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>St(e,2,8,n),stringify:e=>Ct(e,8,`0o`)},Tt={identify:xt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>St(e,0,10,n),stringify:Y},Et={identify:e=>xt(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>St(e,2,16,n),stringify:e=>Ct(e,16,`0x`)},Dt=[q,mt,ht,gt,_t,wt,Tt,Et,vt,yt,bt];function Ot(e){return typeof e==`bigint`||Number.isInteger(e)}var kt=({value:e})=>JSON.stringify(e),At=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:kt},{identify:e=>e==null,createNode:()=>new B(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:kt},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:kt},{identify:Ot,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Ot(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:kt}],jt=[q,mt].concat(At,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Mt={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}else return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=B.BLOCK_LITERAL,t!==B.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===B.BLOCK_LITERAL?`
|
|
39
|
-
`:` `)}return Je({comment:e,type:t,value:s},r,i,a)}};function Nt(e,t){if(se(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!j(r)){if(A(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new W(new B(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=j(r)?r:new W(r)}}else t(`Expected a sequence for this tag`);return e}function Pt(e,t,n){let{replacer:r}=n,i=new J(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(ct(o,s,n))}return i}var Ft={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Nt,createNode:Pt},It=class e extends J{constructor(){super(),this.add=K.prototype.add.bind(this),this.delete=K.prototype.delete.bind(this),this.get=K.prototype.get.bind(this),this.has=K.prototype.has.bind(this),this.set=K.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(j(e)?(r=z(e.key,``,t),i=z(e.value,r,t)):r=z(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Pt(e,t,n),i=new this;return i.items=r.items,i}};It.tag=`tag:yaml.org,2002:omap`;var Lt={collection:`seq`,identify:e=>e instanceof Map,nodeClass:It,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Nt(e,t),r=[];for(let{key:e}of n.items)M(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new It,n)},createNode:(e,t,n)=>It.from(e,t,n)};function Rt({value:e,source:t},n){return t&&(e?zt:Bt).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var zt={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new B(!0),stringify:Rt},Bt={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new B(!1),stringify:Rt},Vt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Y},Ht={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Y(e)}},Ut={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new B(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Y},Wt=e=>typeof e==`bigint`||Number.isInteger(e);function Gt(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Kt(e,t,n){let{value:r}=e;if(Wt(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Y(e)}var qt={identify:Wt,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Gt(e,2,2,n),stringify:e=>Kt(e,2,`0b`)},Jt={identify:Wt,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Gt(e,1,8,n),stringify:e=>Kt(e,8,`0`)},Yt={identify:Wt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Gt(e,0,10,n),stringify:Y},Xt={identify:Wt,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Gt(e,2,16,n),stringify:e=>Kt(e,16,`0x`)},Zt=class e extends K{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=j(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new W(e.key,null):new W(e,null),G(this.items,t.key)||this.items.push(t)}get(e,t){let n=G(this.items,e);return!t&&j(n)?M(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=G(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new W(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(ct(e,null,n));return i}};Zt.tag=`tag:yaml.org,2002:set`;var Qt={collection:`map`,identify:e=>e instanceof Set,nodeClass:Zt,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Zt.from(e,t,n),resolve(e,t){if(A(e)){if(e.hasAllNullValues(!0))return Object.assign(new Zt,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function $t(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function en(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Y(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var tn={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>$t(e,n),stringify:en},nn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>$t(e,!1),stringify:en},rn={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(rn.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=$t(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},an=[q,mt,ht,gt,zt,Bt,qt,Jt,Yt,Xt,Vt,Ht,Ut,Mt,U,Lt,Ft,Qt,tn,nn,rn],on=new Map([[`core`,Dt],[`failsafe`,[q,mt,ht]],[`json`,jt],[`yaml11`,an],[`yaml-1.1`,an]]),sn={binary:Mt,bool:_t,float:bt,floatExp:yt,floatNaN:vt,floatTime:nn,int:Tt,intHex:Et,intOct:wt,intTime:tn,map:q,merge:U,null:gt,omap:Lt,pairs:Ft,seq:mt,set:Qt,timestamp:rn},cn={"tag:yaml.org,2002:binary":Mt,"tag:yaml.org,2002:merge":U,"tag:yaml.org,2002:omap":Lt,"tag:yaml.org,2002:pairs":Ft,"tag:yaml.org,2002:set":Qt,"tag:yaml.org,2002:timestamp":rn};function ln(e,t,n){let r=on.get(t);if(r&&!e)return n&&!r.includes(U)?r.concat(U):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let e=Array.from(on.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(U)),i.reduce((e,t)=>{let n=typeof t==`string`?sn[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(sn).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var un=(e,t)=>e.key<t.key?-1:+(e.key>t.key),dn=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?ln(e,`compat`):e?ln(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?cn:{},this.tags=ln(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,E,{value:q}),Object.defineProperty(this,D,{value:ht}),Object.defineProperty(this,O,{value:mt}),this.sortMapEntries=typeof a==`function`?a:a===!0?un:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function fn(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Ye(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(V(t,``))}let o=!1,s=null;if(e.contents){if(P(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(V(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Qe(e.contents,i,()=>s=null,t);s&&(c+=H(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Qe(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
|
|
40
|
-
`)?(n.push(`...`),n.push(V(t,``))):n.push(`... ${t}`)}else n.push(`...`);else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(V(a(t),``)))}return n.join(`
|
|
41
|
-
`)+`
|
|
42
|
-
`}var pn=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,k,{value:re});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new L({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[k]:{value:re}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=P(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){mn(this.contents)&&this.contents.add(e)}addIn(e,t){mn(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=be(this);e.anchor=!t||n.has(t)?xe(t||`a`,n):t}return new we(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=Se(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=ke(e,l,p);return o&&N(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new W(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return mn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return je(e)?this.contents==null?!1:(this.contents=null,!0):mn(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return N(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return je(e)?!t&&M(this.contents)?this.contents.value:this.contents:N(this.contents)?this.contents.getIn(e,t):void 0}has(e){return N(this.contents)?this.contents.has(e):!1}hasIn(e){return je(e)?this.contents!==void 0:N(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ae(this.schema,[e],t):mn(this.contents)&&this.contents.set(e,t)}setIn(e,t){je(e)?this.contents=t:this.contents==null?this.contents=Ae(this.schema,Array.from(e),t):mn(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new L({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new L({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new dn(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=z(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?R(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return fn(this,e)}};function mn(e){if(N(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var hn=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},gn=class extends hn{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},_n=class extends hn{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},vn=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
43
|
-
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function yn(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function bn(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
44
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(bn(t.key)||bn(t.value))return!0}return!1;default:return!0}}function xn(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&bn(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function Sn(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||M(e)&&M(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var Cn=`All mapping items must start at the same column`;function wn({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??K)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=yn(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,Cn)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
45
|
-
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||bn(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,Cn);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&xn(r.indent,u,i),n.atKey=!1,Sn(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=yn(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&xn(r.indent,f,i),s=c.range[2];let l=new W(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
|
|
46
|
-
`+_.comment:g.comment=_.comment);let e=new W(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function Tn({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??J)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=yn(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&xn(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function En(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var Dn=`Block collections are not allowed within flow collections`,On=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function kn({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?K:J))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=yn(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
|
|
47
|
-
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&bn(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];j(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
48
|
-
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],On(m)&&i(r.range,`BLOCK_IN_FLOW`,Dn)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);On(f)&&i(g.range,`BLOCK_IN_FLOW`,Dn),n.atKey=!1;let _=yn(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?On(m)&&i(v.range,`BLOCK_IN_FLOW`,Dn):_.comment&&(g.comment?g.comment+=`
|
|
49
|
-
`+_.comment:g.comment=_.comment);let y=new W(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;Sn(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new K(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=En(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
50
|
-
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function An(e,t,n,r,i,a){let o=n.type===`block-map`?wn(e,t,n,r,a):n.type===`block-seq`?Tn(e,t,n,r,a):kn(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function jn(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===K.tagName&&s===`map`||o===J.tagName&&s===`seq`)return An(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),An(e,t,n,i,o)}let l=An(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=P(u)?u:new B(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Mn(e,t,n){let r=t.offset,i=Nn(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?B.BLOCK_FOLDED:B.BLOCK_LITERAL,o=t.source?Pn(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
|
|
51
|
-
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
|
|
52
|
-
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===B.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
53
|
-
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
54
|
-
`:!p&&f===`
|
|
55
|
-
`&&(f=`
|
|
56
|
-
|
|
57
|
-
`),d+=f+t.slice(c)+r,f=`
|
|
58
|
-
`,p=!0):r===``?f===`
|
|
59
|
-
`?d+=`
|
|
60
|
-
`:f=`
|
|
61
|
-
`:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
|
|
62
|
-
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
63
|
-
`&&(d+=`
|
|
64
|
-
`);break;default:d+=`
|
|
65
|
-
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function Nn({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function Pn(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Fn(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=B.PLAIN,c=In(a,l);break;case`single-quoted-scalar`:s=B.QUOTE_SINGLE,c=Ln(a,l);break;case`double-quoted-scalar`:s=B.QUOTE_DOUBLE,c=zn(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=En(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function In(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`;break}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Rn(e)}function Ln(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Rn(e.slice(1,-1)).replace(/''/g,`'`)}function Rn(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
66
|
-
`,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
67
|
-
`,`sy`)}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],a=` `,o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)r[1]===``?a===`
|
|
68
|
-
`?i+=a:a=`
|
|
69
|
-
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function zn(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i===`\r`&&e[r+1]===`
|
|
70
|
-
`))if(i===`
|
|
71
|
-
`){let{fold:t,offset:i}=Bn(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Vn[i];if(a)n+=a;else if(i===`
|
|
72
|
-
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
73
|
-
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Hn(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
|
|
74
|
-
`&&!(a===`\r`&&e[r+2]===`
|
|
75
|
-
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function Bn(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
76
|
-
`||r===`\r`)&&!(r===`\r`&&e[t+2]!==`
|
|
77
|
-
`);)r===`
|
|
78
|
-
`&&(n+=`
|
|
79
|
-
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Vn={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
80
|
-
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Hn(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Un(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Mn(e,t,r):Fn(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[D]:c?Wn(e.schema,i,c,n,r):t.type===`scalar`?Gn(e,i,t,r):e.schema[D];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=M(a)?a:new B(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new B(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Wn(e,t,n,r,i){if(n===`!`)return e[D];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n)if(t.default&&t.test)a.push(t);else return t;for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[D])}function Gn({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[D];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[D];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Kn(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var qn={composeNode:Jn,composeEmptyNode:Yn};function Jn(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Xn(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Un(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=jn(qn,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Yn(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!M(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Yn(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Un(e,{type:`scalar`,offset:Kn(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Xn({options:e},{offset:t,source:n,end:r},i){let a=new we(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=En(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Zn(e,t,{offset:n,start:r,value:i,end:a},o){let s=new pn(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=yn(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Jn(c,i,l,o):Yn(c,l.end,r,null,l,o);let u=s.contents.range[2],d=En(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Qn(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function $n(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
81
|
-
|
|
82
|
-
`:`
|
|
83
|
-
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var er=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Qn(e);r?this.warnings.push(new _n(i,t,n)):this.errors.push(new gn(i,t,n))},this.directives=new L({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=$n(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(N(i)&&!i.flow&&i.items.length>0){let e=i.items[0];j(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$n(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Qn(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Zn(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new gn(Qn(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new gn(Qn(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=En(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new gn(Qn(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new pn(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},tr=Symbol(`break visit`),nr=Symbol(`skip children`),rr=Symbol(`remove item`);function ir(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),ar(Object.freeze([]),e,t)}ir.BREAK=tr,ir.SKIP=nr,ir.REMOVE=rr,ir.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},ir.parentCollection=(e,t)=>{let n=ir.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function ar(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=ar(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===tr)return tr;else r===rr&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function or(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
84
|
-
`:case`\r
|
|
85
|
-
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function X(e){switch(e){case void 0:case` `:case`
|
|
86
|
-
`:case`\r`:case` `:return!0;default:return!1}}var sr=new Set(`0123456789ABCDEFabcdef`),cr=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),lr=new Set(`,[]{}`),ur=new Set(` ,[]{}
|
|
87
|
-
\r `),dr=e=>!e||ur.has(e),fr=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
88
|
-
`||t===`\r`&&this.buffer[e+1]===`
|
|
89
|
-
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
90
|
-
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
91
|
-
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&X(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
92
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}else n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&X(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&X(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(dr),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&X(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]===`]`||r[0]===`}`)))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(dr),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||X(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
93
|
-
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
94
|
-
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>X(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
|
|
95
|
-
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
96
|
-
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
97
|
-
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
|
|
98
|
-
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
|
|
99
|
-
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(X(r)||e&&lr.has(r))break;t=n}else if(X(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
100
|
-
`?(n+=1,r=`
|
|
101
|
-
`,i=this.buffer[n+1]):t=n),i===`#`||e&&lr.has(i))break;if(r===`
|
|
102
|
-
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&lr.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(dr),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(X(n)||t&&lr.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!X(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(cr.has(t))t=this.buffer[++e];else if(t===`%`&&sr.has(this.buffer[e+1])&&sr.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
103
|
-
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
104
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},pr=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function Z(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function mr(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function hr(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function gr(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function Q(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function _r(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function vr(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Z(t.start,`explicit-key-ind`)&&!Z(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,hr(t.value)?t.value.end?_r(t.value.end,t.sep):t.value.end=t.sep:_r(t.start,t.sep),delete t.sep)}var yr=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new fr,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=or(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&vr(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&mr(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:mr(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=Q(gr(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
105
|
-
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
106
|
-
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){_r(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(Z(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Q(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(hr(t.key)&&!Z(t.sep,`newline`)){let e=Q(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Z(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!Z(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){_r(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||Z(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=Q(gr(t));vr(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
107
|
-
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
108
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Q(gr(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Q(gr(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function br(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pr||null,prettyErrors:t}}function xr(e,t={}){let{lineCounter:n,prettyErrors:r}=br(t),i=new yr(n?.addNewLine),a=new er(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new gn(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(vn(e,n)),o.warnings.forEach(vn(e,n))),o}var Sr=[`task`,`run.id`,`role`,`workflow.name`,`step.id`,`project.root`,`worktree.root`,`handoff.path`,`file:docs/example.md`],Cr=`file:<path>`,wr=/(?:^\s*-\s*|\{\s*)id:\s*([^\s,}]+)/gm;function Tr(e){let t=new Set([...e.matchAll(wr)].map(e=>e[1]));try{let n=xr(e).toJS()?.rules;if(Array.isArray(n))for(let e of n)t.add(e?.id)}catch{}if(!t.has(`new-rule`))return`new-rule`;let n=2;for(;t.has(`new-rule-${n}`);)n++;return`new-rule-${n}`}var Er=`Text for every session.`;function Dr(e,t){return[`${t}- id: ${e}`,`${t} on: session_start`,`${t} target: both`,`${t} template: |`,`${t} ${Er}`].join(`
|
|
109
|
-
`)}function $(e,t,n){return{text:e+t+n,select:[e.length,e.length+t.length]}}function Or(e){return Dr(`x`,e).slice(e.length+1+6)}function kr(){return[`[{ id: `,`, on: session_start, target: both, template: "${Er}" }]`]}function Ar(e,t,n,r,i){let[a,o]=kr();if(n?.range&&n.range[1]>n.range[0])return $(`${e.slice(0,n.range[0])}${a}`,i,o+e.slice(n.range[1]));let s=e.indexOf(`:`,t)+1;if(r)return $(`${e.slice(0,s)} ${a}`,i,o+e.slice(s));let c=e.lastIndexOf(`
|
|
110
|
-
`,t-1)+1,l=e.indexOf(`
|
|
111
|
-
`,t),u=e.slice(c,t);return $(`${l===-1?`${e}\n`:e.slice(0,l+1)}${u} - id: `,i,Or(`${u} `)+(l===-1?`
|
|
112
|
-
`:e.slice(l)))}function jr(e,t,n,r){let i=n?.range?n.range[1]:e.indexOf(`[`,t)+1;return $(`${e.slice(0,i)}${n?`, `:``}{ id: `,r,`, on: session_start, target: both, template: "${Er}" }${e.slice(i)}`)}function Mr(e,t,n,r){let i=e.lastIndexOf(`
|
|
113
|
-
`,t-1)+1,a=/^[ \t]*/.exec(e.slice(i))[0],o=e.slice(0,n);return o.endsWith(`
|
|
114
|
-
`)?$(`${o}${a}- id: `,r,`${Or(a)}\n${e.slice(n)}`):$(`${o}\n${a}- id: `,r,Or(a)+e.slice(n))}function Nr(e,t,n,r){let i=e.lastIndexOf(`}`,t),[a,o]=kr();return $(`${e.slice(0,i).replace(/\s*$/,``)}${n?`, `:``}rules: ${a}`,r,o+e.slice(i))}function Pr(e,t){let n=e.endsWith(`
|
|
115
|
-
`)?e:`${e}\n`;return/^rules:/m.test(n)||(n+=`rules:
|
|
116
|
-
`),$(`${n} - id: `,t,`${Or(` `)}\n`)}function Fr(e,t,n){if(!se(t)||!t.range)return;let r=t.items.at(-1);if(t.flow)return jr(e,t.range[0],r,n);let i=t.items[0]?.range?.[0];return i===void 0?void 0:Mr(e,i,t.range[1],n)}function Ir(e){let t=Tr(e);if(e.trim()===``)return Pr(`version: 1
|
|
117
|
-
`,t);let n=xr(e),r=n.errors.length===0&&A(n.contents)?n.contents:void 0,i=r?.items.find(e=>M(e.key)&&e.key.value===`rules`),a=i?.value,o=M(i?.key)?i.key.range?.[0]:void 0;return o!==void 0&&(a===null||M(a)&&a.value===null)?Ar(e,o,a,r?.flow===!0,t):Fr(e,a,t)||(!i&&r?.flow&&r.range?Nr(e,r.range[1],r.items.length>0,t):Pr(e,t))}function Lr(e,t,n,r){let i=`{{${r}}}`,a=e.slice(0,t)+i+e.slice(n);if(r.startsWith(`file:`)){let e=t+7;return{text:a,select:[e,e+r.length-5]}}let o=t+i.length;return{text:a,select:[o,o]}}function Rr(e,t){let n=0;for(let r=1;r<t;r++){let t=e.indexOf(`
|
|
118
|
-
`,n);if(t===-1)return[e.length,e.length];n=t+1}let r=e.indexOf(`
|
|
119
|
-
`,n);return[n,r===-1?e.length:r]}var zr=`https://github.com/hearsay-tools/squawk/blob/main/docs/context-injection.md`;function Br(){let e=a();return(0,y.jsxs)(`div`,{"data-slot":`session-context`,className:`flex flex-col gap-4 p-4 md:p-6`,children:[(0,y.jsx)(Vr,{}),e.data===void 0?e.isError?(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),tone:`danger`,title:`Session context did not load`,subtitle:e.error.message,heading:`h2`,actions:(0,y.jsx)(u,{variant:`outline`,onClick:()=>void e.refetch(),children:`Try again`})}):(0,y.jsx)(Hr,{}):(0,y.jsxs)(y.Fragment,{children:[e.isError&&(0,y.jsxs)(`p`,{"data-slot":`session-context-reload-error`,role:`alert`,className:`text-[13px] text-danger`,children:[`Could not read context.yaml again: `,e.error.message]}),(0,y.jsx)(Gr,{file:e.data,refetch:()=>e.refetch()},e.data.path)]})]})}function Vr(){return(0,y.jsx)(`div`,{"data-slot":`session-context-handoff`,className:`flex items-start gap-3 rounded-lg border border-border bg-card p-3`,children:(0,y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`Handoff block`}),(0,y.jsx)(d,{variant:`outline`,className:`border-accent-strong/40 text-[11px] text-link-foreground`,children:`Built in · always first`})]}),(0,y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Each task’s own handoff file: Goal, Progress log and Resume notes. It needs no setup and cannot be turned off. Your rules come after it.`})]})})}function Hr(){return(0,y.jsxs)(`div`,{"data-slot":`session-context-loading`,"aria-busy":`true`,"aria-label":`Loading session context`,className:`grid gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsx)(p,{className:`h-[420px] rounded-lg`}),(0,y.jsx)(p,{className:`h-[420px] rounded-lg max-md:hidden`})]})}function Ur(e,t=250){let[n,r]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Wr(e,t){let[n,r]=(0,_.useState)(null),[a,l]=(0,_.useState)(null),u=(0,_.useRef)(n);u.current=n;let d=t=>{l(t=>t??{version:e.version}),r(t)},[f,p]=(0,_.useState)(`parent`),[m,g]=(0,_.useState)(`edit`),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(!1),S=(0,_.useRef)(null),[C,ee]=(0,_.useState)(null),w=n??e.content,te=w!==e.content;h(te);let ne=Ur(w),T=o(ne,f),re=T.data!==void 0&&!T.isPlaceholderData&&!T.isError&&ne===w,E=T.isError&&!T.isFetching&&ne===w?T.error.message:null,ie=(0,_.useMemo)(()=>T.data?.problems??[],[T.data]),D=s();(0,_.useLayoutEffect)(()=>{!C||!S.current||(S.current.focus(),S.current.setSelectionRange(C[0],C[1]),ee(null))},[C]);let O=e=>{d(e.text),g(`edit`),ee(e.select)};return{started:e.exists||n!==null,content:w,dirty:te,setDraft:d,role:f,setRole:p,pane:m,setPane:g,failure:v,showDisk:b,toggleDisk:()=>x(e=>!e),inputRef:S,preview:T.data,current:re,problems:ie,previewError:E,retryPreview:()=>void T.refetch(),saving:D.isPending,edit:O,insert:e=>{let t=S.current;O(Lr(w,t?.selectionStart??w.length,t?.selectionEnd??w.length,e))},goToLine:e=>{g(`edit`),ee(Rr(w,e))},discard:()=>{r(null),l(null),y(null)},save:(n=!1)=>{let o=n||a===null?e.version:a.version;y(null);let s=w;D.mutate({content:s,version:o},{onSuccess:t=>{let n=u.current!==null&&u.current!==s;r(n?u.current:null),l(n?{version:t.version}:null),x(!1),c(`Saved ${e.path}`)},onError:e=>{let n=e instanceof i&&e.status===409;y({kind:n?`conflict`:`error`,message:e.message}),n&&t()}})}}}function Gr({file:e,refetch:t}){let n=Wr(e,t),{content:i,problems:a,current:o}=n,s=e.writable,c=(0,_.useMemo)(()=>new Set(a.flatMap(e=>e.line===null?[]:[e.line])),[a]);return n.started?(0,y.jsxs)(`div`,{"data-slot":`session-context-editor`,"data-reports-dirty":``,className:`flex flex-col gap-4`,children:[!s&&(0,y.jsx)(ti,{reason:e.readOnlyReason}),n.failure&&s&&(0,y.jsx)(ei,{failure:n.failure,showDisk:n.showDisk,onShowDisk:n.toggleDisk,onOverwrite:()=>n.save(!0)}),n.showDisk&&(0,y.jsx)(Yr,{content:e.content}),n.previewError&&(0,y.jsxs)(`div`,{"data-slot":`session-context-preview-error`,role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-lg border border-danger/45 bg-danger/10 p-3 text-[13px]`,children:[(0,y.jsxs)(`span`,{className:`mr-auto`,children:[`The preview failed: `,n.previewError,`. Save stays off until the draft is checked.`]}),(0,y.jsx)(u,{variant:`outline`,onClick:n.retryPreview,children:`Check again`})]}),a.length>0&&(0,y.jsx)(Qr,{problems:a,onLine:n.goToLine}),(0,y.jsx)(Jr,{pane:n.pane,onPane:n.setPane}),(0,y.jsxs)(`div`,{className:`grid items-start gap-4 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]`,children:[(0,y.jsxs)(`section`,{id:qr.edit,"data-slot":`session-context-file`,"aria-label":`context.yaml`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,n.pane!==`edit`&&`max-md:hidden`),children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border p-3`,children:[(0,y.jsx)(`code`,{className:`font-mono text-[12px] break-all`,children:e.path}),(0,y.jsx)(Zr,{problems:a.length,current:o,failed:n.previewError!==null,dirty:n.dirty}),s&&(0,y.jsxs)(u,{"data-slot":`session-context-add-rule`,variant:`outline`,className:`ml-auto`,onClick:()=>n.edit(Ir(i)),children:[(0,y.jsx)(l,{}),` Add rule`]})]}),(0,y.jsx)(g,{value:i,onChange:s?n.setDraft:void 0,readOnly:!s,language:`yaml`,markedLines:c,inputRef:n.inputRef,"aria-label":`context.yaml rules`,className:`h-[420px] rounded-none border-0`}),s&&(0,y.jsx)($r,{onInsert:n.insert})]}),(0,y.jsx)(C,{id:qr.preview,preview:n.preview,role:n.role,onRole:n.setRole,pending:!o,className:r(n.pane!==`preview`&&`max-md:hidden`)})]}),(0,y.jsx)(Xr,{writable:s,hasProblems:a.length>0,dirty:n.dirty,saving:n.saving,canSave:s&&n.dirty&&!n.saving&&o&&a.length===0,onDiscard:n.discard,onSave:()=>n.save()})]}):(0,y.jsx)(ni,{path:e.path,readOnlyReason:e.readOnlyReason,onAdd:s?()=>n.edit(Ir(``)):void 0})}var Kr=[`edit`,`preview`],qr={edit:`session-context-edit-panel`,preview:`session-context-preview-panel`};function Jr({pane:e,onPane:t}){let n=(0,_.useRef)(new Map);return(0,y.jsx)(`div`,{role:`tablist`,"aria-label":`Session context view`,onKeyDown:r=>{let i=v(Kr,e,r.key);i!==void 0&&(r.preventDefault(),t(i),n.current.get(i)?.focus())},className:`flex overflow-hidden rounded-md border border-[var(--control-border)] md:hidden`,children:Kr.map(i=>(0,y.jsx)(`button`,{ref:e=>{e?n.current.set(i,e):n.current.delete(i)},type:`button`,tabIndex:e===i?0:-1,"aria-controls":qr[i],role:`tab`,"data-slot":`session-context-pane`,"data-pane":i,"aria-selected":e===i,onClick:()=>t(i),className:r(`min-h-11 flex-1 text-[13px] capitalize text-muted-foreground`,e===i&&`bg-muted text-foreground`),children:i},i))})}function Yr({content:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-disk`,className:`flex flex-col gap-2`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold`,children:`On disk now`}),(0,y.jsx)(g,{value:e,language:`yaml`,readOnly:!0,"aria-label":`context.yaml on disk`,className:`h-[200px]`})]})}function Xr(e){return(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3`,children:[(0,y.jsx)(`p`,{"data-slot":`session-context-note`,className:`mr-auto text-[12px] text-soft-foreground`,children:e.hasProblems?`Save is off while the file has problems.`:`Applies from the next session launch. Squawk does not commit this file.`}),e.writable&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{variant:`outline`,disabled:!e.dirty||e.saving,onClick:e.onDiscard,children:`Discard changes`}),(0,y.jsx)(u,{"data-slot":`session-context-save`,disabled:!e.canSave,onClick:e.onSave,children:e.saving?`Saving…`:`Save`})]})]})}function Zr({problems:e,current:t,failed:n,dirty:r}){return(0,y.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,"aria-live":`polite`,children:[t&&e>0&&(0,y.jsxs)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:[e,` `,e===1?`problem`:`problems`]}),t&&e===0&&(0,y.jsx)(d,{variant:`outline`,className:`border-success/40 text-[11px] text-success`,children:`Valid`}),!t&&!n&&(0,y.jsx)(d,{variant:`outline`,className:`text-[11px]`,children:`Checking…`}),n&&(0,y.jsx)(d,{variant:`outline`,className:`border-danger/45 text-[11px] text-danger`,children:`Not checked`}),r&&(0,y.jsx)(d,{variant:`outline`,className:`border-conflict/50 text-[11px] text-conflict`,children:`Unsaved`})]})}function Qr({problems:e,onLine:t}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-problems`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsxs)(`h3`,{className:`text-sm font-semibold text-danger`,children:[e.length,` `,e.length===1?`problem`:`problems`,`: fix `,e.length===1?`it`:`them`,` to save`]}),(0,y.jsx)(`span`,{className:`ml-auto text-[12px] text-soft-foreground`,children:`Your draft is kept until you save or discard it.`})]}),(0,y.jsx)(`ul`,{className:`mt-1.5 flex flex-col`,children:e.map((e,n)=>(0,y.jsxs)(`li`,{className:`text-[13px] leading-6`,children:[e.line!==null&&(0,y.jsxs)(`button`,{type:`button`,"data-slot":`session-context-line`,onClick:()=>t(e.line),className:`inline-flex min-h-11 items-center align-middle text-link-foreground underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring md:min-h-8`,children:[`Line `,e.line]}),e.line!==null&&(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:` · `}),e.rule!==null&&(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`rule `,e.rule,`: `]}),(0,y.jsx)(`span`,{"data-slot":`session-context-problem`,children:e.message})]},n))})]})}function $r({onInsert:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-tokens`,className:`flex flex-col gap-2 border-t border-border p-3`,children:[(0,y.jsx)(`span`,{id:`session-context-tokens`,className:`text-[12px] text-soft-foreground`,children:`Insert a variable`}),(0,y.jsx)(`div`,{role:`group`,"aria-labelledby":`session-context-tokens`,className:`flex flex-wrap gap-1.5`,children:Sr.map(t=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>e(t),className:`min-h-8 rounded-md bg-muted px-2 font-mono text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring pointer-coarse:min-h-11`,children:`{{${t.startsWith(`file:`)?Cr:t}}}`},t))})]})}function ei({failure:e,showDisk:t,onShowDisk:n,onOverwrite:r}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-save-failure`,role:`alert`,className:`rounded-lg border border-danger/45 bg-danger/10 p-3`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-semibold text-danger`,children:e.kind===`conflict`?`Not saved: the file changed on disk`:`Not saved`}),(0,y.jsxs)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:[e.message,` Your draft is still here.`]}),e.kind===`conflict`&&(0,y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,y.jsx)(u,{variant:`outline`,onClick:n,children:t?`Hide the disk version`:`Show the disk version`}),(0,y.jsx)(u,{variant:`outline`,onClick:r,children:`Overwrite it`})]})]})}function ti({reason:e}){return(0,y.jsxs)(`div`,{"data-slot":`session-context-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read only. `,e]})}function ni({path:e,readOnlyReason:t,onAdd:n}){return(0,y.jsx)(`div`,{"data-slot":`session-context-empty`,className:`rounded-lg border border-border bg-card`,children:(0,y.jsx)(f,{icon:(0,y.jsx)(m,{}),title:`No project rules yet`,heading:`h2`,subtitle:`Every session already starts with its handoff block. Add rules to put more text after it: a project brief, the contents of a doc, or instructions only workers get. Rules live in ${e}.`,actions:(0,y.jsxs)(y.Fragment,{children:[n&&(0,y.jsx)(u,{onClick:n,children:`Add the first rule`}),(0,y.jsx)(u,{variant:`outline`,asChild:!0,children:(0,y.jsx)(`a`,{href:zr,target:`_blank`,rel:`noreferrer`,children:`How rules work`})})]}),children:t&&(0,y.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[`Read only. `,t]})})})}export{Br as SessionContextSection};
|