1import{jl as ce,r as j,jk as Oe,j as P,U as Te,iW as je,m as Me,jn as Le}from"./main-D78L-pDZ.js";import{json as Ae}from"./index-BzA55CW9.js";import{E as z,t as a,d as De,h as Ie,l as _e,a as Be,b as Fe,c as Je,e as $e,f as We,g as Re,i as ee,r as Ue,j as He,k as ze,m as pe,n as Ke,p as Ge,o as qe,A as Pe,S as V,q as re,D as U}from"./index-CwLudJcF.js";import{H as Ye,s as be,f as Ve,a as Xe,i as Qe,d as Ze,b as et,c as tt}from"./index-BQWsM_EZ.js";import{c as rt,s as at,a as nt,b as it,d as st,h as ot}from"./index-BMH1sPWN.js";import{u as ct}from"./use-size-BCUyd-rQ.js";import{B as lt}from"./Callout-BUwHpBqs.js";import{a as ft}from"./PreviewFeed-CAJ1O6zX.js";import{u as ut}from"./useEvent-ePF7ciSt.js";import"./index-CTK7eujP.js";import"./useSuspenseQuery-r7fCUb8D.js";import"./suspense-DQWRhuZP.js";import"./useBaseQuery-Uw44u_v-.js";import"./useMutation-BwJWuCat.js";import"./useInfiniteQuery-DRomhpAO.js";import"./infiniteQueryObserver-BalJZeqo.js";import"./endOfMonth-DgwAzeHX.js";import"./hls-CD24oMQ3.js";import"./message-circle-DIOVd3RR.js";import"./index-DD0afz9h.js";import"./gauge-Bl-jT6tB.js";import"./sparkles-DoPKOpSi.js";import"./SimpleNode-wnkc8kUe.js";import"./select-D74RIcIT.js";import"./check-Bpili8b0.js";import"./tooltip-CJfdJb4B.js";import"./switch-MpKHC29J.js";import"./textarea-C2VQ12HW.js";import"./remove-invisible-chars-BqPUhN30.js";import"./checkbox-VnKLakWI.js";import"./label-CfuE8at4.js";import"./menu-7DvmME2A.js";import"./types-DJKwbrVw.js";import"./useQuery-COJn47Wo.js";import"./feature-flags-Dg89Ii9W.js";import"./plus-DJIk_AQG.js";import"./index-B_ptdHJC.js";import"./command-BDDhFmXj.js";import"./search-gpAkNYWQ.js";import"./dialog-CkR-ig-E.js";import"./bot-DXXwgqbd.js";import"./LoadMoreSpinner-B6VdMJfQ.js";import"./badge-BKZxsRBZ.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f76e2c71-57d9-449f-8841-497a39c5a45c",t._sentryDebugIdIdentifier="sentry-dbid-f76e2c71-57d9-449f-8841-497a39c5a45c")}catch{}var ve=t=>{var{theme:e,settings:r={},styles:n=[]}=t,i={".cm-gutters":{}},E={};r.background&&(E.backgroundColor=r.background),r.backgroundImage&&(E.backgroundImage=r.backgroundImage),r.foreground&&(E.color=r.foreground),r.fontSize&&(E.fontSize=r.fontSize),(r.background||r.foreground)&&(i["&"]=E),r.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(i[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(i[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(i[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(i[".cm-content"]={caretColor:r.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var y={};r.gutterActiveForeground&&(y.color=r.gutterActiveForeground),r.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:r.lineHighlight},y.backgroundColor=r.lineHighlight),i[".cm-activeLineGutter"]=y,r.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var x=z.theme(i,{dark:e==="dark"}),b=Ye.define(n),N=[x,be(b)];return N},dt={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},ht=[{tag:[a.standard(a.tagName),a.tagName],color:"#116329"},{tag:[a.comment,a.bracket],color:"#6a737d"},{tag:[a.className,a.propertyName],color:"#6f42c1"},{tag:[a.variableName,a.attributeName,a.number,a.operator],color:"#005cc5"},{tag:[a.keyword,a.typeName,a.typeOperator,a.typeName],color:"#d73a49"},{tag:[a.string,a.meta,a.regexp],color:"#032f62"},{tag:[a.name,a.quote],color:"#22863a"},{tag:[a.heading,a.strong],color:"#24292e",fontWeight:"bold"},{tag:[a.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[a.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[a.atom,a.bool,a.special(a.variableName)],color:"#e36209"},{tag:[a.url,a.escape,a.regexp,a.link],color:"#032f62"},{tag:a.link,textDecoration:"underline"},{tag:a.strikethrough,textDecoration:"line-through"},{tag:a.invalid,color:"#cb2431"}],gt=t=>{var{theme:e="light",settings:r={},styles:n=[]}={};return ve({theme:e,settings:ce({},dt,r),styles:[...ht,...n]})},mt=gt(),pt={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},bt=[{tag:[a.standard(a.tagName),a.tagName],color:"#7ee787"},{tag:[a.comment,a.bracket],color:"#8b949e"},{tag:[a.className,a.propertyName],color:"#d2a8ff"},{tag:[a.variableName,a.attributeName,a.number,a.operator],color:"#79c0ff"}
1,{tag:[a.keyword,a.typeName,a.typeOperator,a.typeName],color:"#ff7b72"},{tag:[a.string,a.meta,a.regexp],color:"#a5d6ff"},{tag:[a.name,a.quote],color:"#7ee787"},{tag:[a.heading,a.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[a.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[a.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[a.atom,a.bool,a.special(a.variableName)],color:"#ffab70"},{tag:a.link,textDecoration:"underline"},{tag:a.strikethrough,textDecoration:"line-through"},{tag:a.invalid,color:"#f97583"}],vt=t=>{var{theme:e="dark",settings:r={},styles:n=[]}={};return ve({theme:e,settings:ce({},pt,r),styles:[...bt,...n]})},yt=vt(),ue=function(e){e===void 0&&(e={});var{crosshairCursor:r=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(rt)),e.defaultKeymap!==!1&&(n=n.concat(De)),e.searchKeymap!==!1&&(n=n.concat(at)),e.historyKeymap!==!1&&(n=n.concat(Ie)),e.foldKeymap!==!1&&(n=n.concat(Ve)),e.completionKeymap!==!1&&(n=n.concat(nt)),e.lintKeymap!==!1&&(n=n.concat(_e));var i=[];return e.lineNumbers!==!1&&i.push(Be()),e.highlightActiveLineGutter!==!1&&i.push(Fe()),e.highlightSpecialChars!==!1&&i.push(Je()),e.history!==!1&&i.push($e()),e.foldGutter!==!1&&i.push(Xe()),e.drawSelection!==!1&&i.push(We()),e.dropCursor!==!1&&i.push(Re()),e.allowMultipleSelections!==!1&&i.push(ee.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(Qe()),e.syntaxHighlighting!==!1&&i.push(be(Ze,{fallback:!0})),e.bracketMatching!==!1&&i.push(et()),e.closeBrackets!==!1&&i.push(it()),e.autocompletion!==!1&&i.push(st()),e.rectangularSelection!==!1&&i.push(Ue()),r!==!1&&i.push(He()),e.highlightActiveLine!==!1&&i.push(ze()),e.highlightSelectionMatches!==!1&&i.push(ot()),e.tabSize&&typeof e.tabSize=="number"&&i.push(tt.of(" ".repeat(e.tabSize))),i.concat([pe.of(n.flat())]).filter(Boolean)},St=z.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),kt=function(e){e===void 0&&(e={});var{indentWithTab:r=!0,editable:n=!0,readOnly:i=!1,theme:E="light",placeholder:y="",basicSetup:x=!0}=e,b=[];switch(r&&b.unshift(pe.of([Ke])),x&&(typeof x=="boolean"?b.unshift(ue()):b.unshift(ue(x))),y&&b.unshift(Ge(y)),E){case"light":b.push(St);break;case"dark":b.push(qe);break;case"none":break;default:b.push(E);break}return n===!1&&b.push(z.editable.of(!1)),i&&b.push(ee.readOnly.of(!0)),[...b]},Et=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class xt{constructor(e,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(r=>{try{r()}catch(n){console.error("TimeoutLatch callback error:",n)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class de{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var ne=null,Nt=()=>typeof window>"u"?new de:(ne||(ne=new de),ne),he=Pe.define(),Ct=200,wt=[];function Ot(t){var{value:e,selection:r,onChange:n,onStatistics:i,onCreateEditor:E,onUpdate:y,extensions:x=wt,autoFocus:b,theme:N="light",height:L=null,minHeight:D=null,maxHeight:K=null,width:H=null,minWidth:d=null,maxWidth:v=null,placeholder:o="",editable:h=!0,readOnly:u=!1,indentWithTab:l=!0,basicSetup:s=!0,root:M,initialState:I}=t,[w,J]=j.useState(),[S,$]=j.useState(),[W,B]=j.useState(),p=j.useState(()=>({current:null}))[0],A=j.useState(()=>({current:null}))[0],k=z.theme({"&":{height:L,minHeight:D,maxHeight:K,width:H,minWidth:d,maxWidth:v},"& .cm-scroller":{height:"100% !important"}}),R=z.updateListener.of(c=>{if(c.docChanged&&typeof n=="function"&&!c.transactions.some(Y=>
1Y.annotation(he))){p.current?p.current.reset():(p.current=new xt(()=>{if(A.current){var Y=A.current;A.current=null,Y()}p.current=null},Ct),Nt().add(p.current));var C=c.state.doc,O=C.toString();n(O,c)}i&&i(Et(c))}),F=kt({theme:N,editable:h,readOnly:u,placeholder:o,indentWithTab:l,basicSetup:s}),G=[R,k,...F];return y&&typeof y=="function"&&G.push(z.updateListener.of(y)),G=G.concat(x),j.useLayoutEffect(()=>{if(w&&!W){var c={doc:e,selection:r,extensions:G},C=I?ee.fromJSON(I.json,c,I.fields):ee.create(c);if(B(C),!S){var O=new z({state:C,parent:w,root:M});$(O),E&&E(O,C)}}return()=>{S&&(B(void 0),$(void 0))}},[w,W]),j.useEffect(()=>{t.container&&J(t.container)},[t.container]),j.useEffect(()=>()=>{S&&(S.destroy(),$(void 0)),p.current&&(p.current.cancel(),p.current=null)},[S]),j.useEffect(()=>{b&&S&&S.focus()},[b,S]),j.useEffect(()=>{S&&S.dispatch({effects:V.reconfigure.of(G)})},[N,x,L,D,K,H,d,v,o,h,u,l,s,n,y]),j.useEffect(()=>{if(e!==void 0){var c=S?S.state.doc.toString():"";if(S&&e!==c){var C=p.current&&!p.current.isDone,O=()=>{S&&e!==S.state.doc.toString()&&S.dispatch({changes:{from:0,to:S.state.doc.toString().length,insert:e||""},annotations:[he.of(!0)]})};C?A.current=O:O()}}},[e,S]),{state:W,setState:B,view:S,setView:$,container:w,setContainer:J}}var Tt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],ye=j.forwardRef((t,e)=>{var{className:r,value:n="",selection:i,extensions:E=[],onChange:y,onStatistics:x,onCreateEditor:b,onUpdate:N,autoFocus:L,theme:D="light",height:K,minHeight:H,maxHeight:d,width:v,minWidth:o,maxWidth:h,basicSetup:u,placeholder:l,indentWithTab:s,editable:M,readOnly:I,root:w,initialState:J}=t,S=Oe(t,Tt),$=j.useRef(null),{state:W,view:B,container:p,setContainer:A}=Ot({root:w,value:n,autoFocus:L,theme:D,height:K,minHeight:H,maxHeight:d,width:v,minWidth:o,maxWidth:h,basicSetup:u,placeholder:l,indentWithTab:s,editable:M,readOnly:I,selection:i,onChange:y,onStatistics:x,onCreateEditor:b,onUpdate:N,extensions:E,initialState:J});j.useImperativeHandle(e,()=>({editor:$.current,state:W,view:B}),[$,p,W,B]);var k=j.useCallback(F=>{$.current=F,A(F)},[A]);if(typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);
1var R=typeof D=="string"?"cm-theme-"+D:"cm-theme";return P.jsx("div",ce({ref:k,className:""+R+(r?" "+r:"")},S))});ye.displayName="CodeMirror";var ie,ge;function jt(){if(ge)return ie;ge=1;const t=Symbol.for("indent"),e=Symbol.for("newline"),r=` 2`,n=" ",i=/^\uFEFF/,E=/^\s*[{[]((?:\r?\n)+)([\s\t]*)/,y=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,x=/^Unexpected token '?(.)'?(,)? /i,b=v=>{const o=v.charCodeAt(0).toString(16).toUpperCase();return`0x${o.length%2?"0":""}${o}`},N=v=>String(v).replace(i,""),L=(v,o,h=0)=>({message:`${v} while parsing ${o}`,position:h}),D=(v,o,h=20)=>{let u=v.message;if(!o)return L(u,"empty string");const l=u.match(x),s=u.match(/ position\s+(\d+)/i);l&&(u=u.replace(x,`Unexpected token ${JSON.stringify(l[1])} (${b(l[1])})$2 `));let M;if(s?M=+s[1]:u.match(/^Unexpected end of JSON.*/i)&&(M=o.length-1),M==null)return L(u,`'${o.slice(0,h*2)}'`);const I=M<=h?0:M-h,w=M+h>=o.length?o.length:M+h,J=`${I?"...":""}${o.slice(I,w)}${w===o.length?"":"..."}`;return L(u,`${o===J?"":"near "}${JSON.stringify(J)}`,M)};class K extends SyntaxError{constructor(o,h,u,l){const s=D(o,h,u);super(s.message),Object.assign(this,s),this.code="EJSONPARSE",this.systemError=o,Error.captureStackTrace(this,l||this.constructor)}get name(){return this.constructor.name}set name(o){}get[Symbol.toStringTag](){return this.constructor.name}}const H=(v,o)=>{const h=JSON.parse(v,o);if(h&&typeof h=="object"){const u=v.match(y)||v.match(E)||[null,"",""];h[e]=u[1]??r,h[t]=u[2]??n}return h},d=(v,o,h)=>{const u=N(v);try{return H(u,o)}catch(l){if(typeof v!="string"&&!Buffer.isBuffer(v)){const s=Array.isArray(v)&&v.length===0?"an empty array":String(v);throw Object.assign(new TypeError(`Cannot parse ${s}`),{code:"EJSONPARSE",systemError:l})}throw new K(l,u,h,d)}};return ie=d,d.JSONParseError=K,d.noExceptions=(v,o)=>{try{return H(N(v),o)}catch{}},ie}var Mt=jt();const Lt=Te(Mt);var te={},me;function At(){if(me)return te;me=1;var t={b:"\b",f:"\f",n:` 3`,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},e=97;te.parse=function(d,v,o){var h={},u=0,l=0,s=0,M=o&&o.bigint&&typeof BigInt<"u";return{data:I("",!0),pointers:h};function I(f,g){w();var m;F(f,"value");var T=p();switch(T){case"t":B("rue"),m=!0;break;case"f":B("alse"),m=!1;break;case"n":B("ull"),m=null;break;case'"':m=J();break;case"[":m=$(f);break;case"{":m=W(f);break;default:A(),"-0123456789".indexOf(T)>=0?m=S():C()}return F(f,"valueEnd"),w(),g&&s<d.length&&C(),m}function w(){e:for(;s<d.length;){switch(d[s]){case" ":l++;break;case" ":l+=4;break;case"\r":l=0;break;case` 4`:l=0,u++;break;default:break e}s++}}function J(){for(var f="",g;g=p(),g!='"';)g=="\\"?(g=p(),g in t?f+=t[g]:g=="u"?f+=k():O()):f+=g;return f}function S(){var f="",g=!0;d[s]=="-"&&(f+=p()),f+=d[s]=="0"?p():R(),d[s]=="."&&(f+=p()+R(),g=!1),(d[s]=="e"||d[s]=="E")&&(f+=p(),(d[s]=="+"||d[s]=="-")&&(f+=p()),f+=R(),g=!1);var m=+f;return M&&g&&(m>Number.MAX_SAFE_INTEGER||m<Number.MIN_SAFE_INTEGER)?BigInt(f):m}function $(f){w();var g=[],m=0;if(p()=="]")return g;for(A();;){var T=f+"/"+m;g.push(I(T)),w();var _=p();if(_=="]")break;_!=","&&O(),w(),m++}return g}function W(f){w();var g={};if(p()=="}")return g;for(A();;){var m=c();p()!='"'&&O();var T=J(),_=f+"/"+H(T);G(_,"key",m),F(_,"keyEnd"),w(),p()!=":"&&O(),w(),g[T]=I(_),w();var q=p();if(q=="}")break;q!=","&&O(),w()}return g}function B(f){for(var g=0;g<f.length;g++)p()!==f[g]&&O()}function p(){Y();var f=d[s];return s++,l++,f}function A(){s--,l--}function k(){for(var f=4,g=0;f--;){g<<=4;var m=p().toLowerCase();m>="a"&&m<="f"?g+=m.charCodeAt()-e+10:m>="0"&&m<="9"?g+=+m:O()}return String.fromCharCode(g)}function R(){for(var f="";d[s]>="0"&&d[s]<="9";)f+=p();if(f.length)return f;Y(),C()}function F(f,g){G(f,g,c())}function G(f,g,m){h[f]=h[f]||{},h[f][g]=m}function c(){return{line:u,column:l,pos:s}}function C(){throw new SyntaxError("Unexpected token "+d[s]+" in JSON at position "+s)}function O(){A(),C()}function Y(){if(s>=d.length)throw new SyntaxError("Unexpected end of JSON input")}},te.stringify=function(d,v,o){if(!n(d))return;var h=0,u,l,s=typeof o=="object"?o.space:o;switch(typeof s){case"number":var M=s>10?10:s<0?0:Math.floor(s);s=M&&G(M," "),u=M,l=M;break;case"string":s=s.slice(0,10),u=0,l=0;for(var I=0;I<s.length;I++){var w=s[I];switch(w){case" ":l++;break;case" ":l+=4;break;case"\r":l=0;break;case` 5`:l=0,h++;break;default:throw new Error("whitespace characters not allowed in JSON")}u++}break;default:s=void 0}var J="",S={},$=0,W=0,B=0,p=o&&o.es6&&typeof Map=="function";return A(d,0,""),{json:J,pointers:S};function A(c,C,O){switch(F(O,"value"),typeof c){case"number":case"bigint":case"boolean":k(""+c);break;case"string":k(L(c));break;case"object":c===null?k("null"):typeof c.toJSON=="function"?k(L(c.toJSON())):Array.isArray(c)?Y():p?c.c
5onstructor.BYTES_PER_ELEMENT?Y():c instanceof Map?g():c instanceof Set?g(!0):f():f()}F(O,"valueEnd");function Y(){if(c.length){k("[");for(var m=C+1,T=0;T<c.length;T++){T&&k(","),R(m);var _=n(c[T])?c[T]:null,q=O+"/"+T;A(_,m,q)}R(C),k("]")}else k("[]")}function f(){var m=Object.keys(c);if(m.length){k("{");for(var T=C+1,_=0;_<m.length;_++){var q=m[_],X=c[q];if(n(X)){_&&k(",");var Q=O+"/"+H(q);R(T),F(Q,"key"),k(L(q)),F(Q,"keyEnd"),k(":"),s&&k(" "),A(X,T,Q)}}R(C),k("}")}else k("{}")}function g(m){if(c.size){k("{");for(var T=C+1,_=!0,q=c.entries(),X=q.next();!X.done;){var Q=X.value,le=Q[0],fe=m?!0:Q[1];if(n(fe)){_||k(","),_=!1;var ae=O+"/"+H(le);R(T),F(ae,"key"),k(L(le)),F(ae,"keyEnd"),k(":"),s&&k(" "),A(fe,T,ae)}X=q.next()}R(C),k("}")}else k("{}")}}function k(c){W+=c.length,B+=c.length,J+=c}function R(c){if(s){for(J+=` 6`+G(c,s),$++,W=0;c--;)h?($+=h,W=l):W+=l,B+=u;B+=1}}function F(c,C){S[c]=S[c]||{},S[c][C]={line:$,column:W,pos:B}}function G(c,C){return Array(c+1).join(C)}};var r=["number","bigint","boolean","string","object"];function n(d){return r.indexOf(typeof d)>=0}var i=/"|\\/g,E=/[\b]/g,y=/\f/g,x=/\n/g,b=/\r/g,N=/\t/g;function L(d){return d=d.replace(i,"\\$&").replace(y,"\\f").replace(E,"\\b").replace(x,"\\n").replace(b,"\\r").replace(N,"\\t"),'"'+d+'"'}var D=/~/g,K=/\//g;function H(d){return d.replace(D,"~0").replace(K,"~1")}return te}var Dt=At();const Se=V.define(),se=V.define(),It=re.define({create(){return U.none},update(t,e){t=t.map(e.changes);for(const r of e.effects)r.is(Se)?t=t.update({add:r.value,sort:!0}):r.is(se)&&(t=U.none);return t},provide:t=>z.decorations.from(t)}),ke=V.define(),oe=V.define(),_t=re.define({create(){return U.none},update(t,e){t=t.map(e.changes);for(const r of e.effects)r.is(ke)?t=t.update({add:r.value,sort:!0}):r.is(oe)&&(t=U.none);return t},provide:t=>z.decorations.from(t)});function Ee(t,e,r,n,i){const E=ft(n),y=Object.keys(n?.condition||{}).filter(N=>N!=="metadata"&&!N.startsWith("_"))[0],x=i??`/manifest/filter/${y}`,b=e[x];if(b&&(E==="success"?t.view?.dispatch({effects:Se.of([U.mark({attributes:{"data-result":`${n?.scores[0]||""}`},class:"text-green-dim relative json-result before:content-[''] before:absolute before:inset-[-2px] before:bg-green-4 before:z-[-10]"}).range(b.value.pos,b.valueEnd.pos)])}):E==="failure"&&t.view?.dispatch({effects:ke.of([U.mark({attributes:{"data-result":`${n?.scores[0]||""}`},class:"text-red-dim relative json-result before:content-[''] before:absolute before:inset-[-2px] before:bg-red-4 before:z-[-10]"}).range(b.value.pos,b.valueEnd.pos)])})),n?.sub_audit?.length)for(let N=0;N<n.sub_audit.length;N++){const L=n.sub_audit[N];Ee(t,e,r,L,i?`${x}/${y}/${N}`:`${x}
6/${N}`)}}const Z={current:null};function xe(t){return Object.keys(t??{}).filter(e=>e.endsWith("isCustomNode")).map(e=>e.replace("/metadata/isCustomNode","")).map(e=>t[e])}const Bt=ee.transactionFilter.of(t=>{const e=Z.current,r=e?xe(e):[],{from:n,to:i}=t.startState.selection?.ranges[0]??{},E=t.changes;if(n&&i&&(E.inserted?.length||E.sections?.length&&E.sections.length>2)){for(const y of r)if(y&&(n>=y.value.pos&&n<=y.valueEnd.pos||i>=y.value.pos&&i<=y.valueEnd.pos))return t.startState.update()}return t}),Ne=V.define(),Ft=U.mark({class:"text-slate-dim relative before:content-[''] before:absolute before:inset-[-2px] before:bg-slate-4 before:z-[-10]"}),Jt=V.define(),$t=re.define({create(){return U.none},update(t,e){t=t.map(e.changes);for(const r of e.effects)r.is(Ne)?t=U.set(r.value,!0):r.is(Jt)&&(t=U.none);return t},provide:t=>z.decorations.from(t)}),Ce=V.define(),we=V.define(),Wt=re.define({create(){return U.none},update(t,e){t=t.map(e.changes);for(const r of e.effects)r.is(Ce)?t=U.set(r.value,!0):r.is(we)&&(t=U.none);return t},provide:t=>z.decorations.from(t)}),Rt=U.mark({class:"bg-reda-10 text-red-4"});function Lr({feedVersion:t,onChange:e,codeMirrorRef:r,extensions:n,audit:i}){const[E,y]=j.useState(JSON.stringify(t,null,2)),[x,b]=j.useState(null),N=j.useRef(null),L=ct(N),D=j.useRef(null),K=je(r,D),H=window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light";try{Z.current=Dt.parse(E).pointers}catch{}const d=ut(()=>{const o=D.current.view;if(i&&Z.current&&o)return Ee(D.current,Z.current,t,i.audit,void 0),()=>{o.dispatch({effects:[oe.of(null),se.of(null)]})};o&&o.dispatch({effects:[oe.of(null),se.of(null)]})}),v=JSON.stringify(i);return j.useEffect(d,[v,d]),P.jsxs("div",{ref:N,className:"h-full w-full relative overflow-auto",children:[P.jsx(ye,{value:E,ref:K,extensions:[$t,It,_t,Bt,Ae(),z.lineWrapping,z.contentAttributes.of({"aria-label":"Feed JSON"}),Wt,...n??[]],className:Me(x&&"[&_.cm-scroller]:pb-[160px]"),readOnly:!e,height:L?.height?`${L.height}px`:"100%",theme:H==="dark"?yt:mt,onChange:o=>{const h=o.replace(/[ââ]/g,'"').replace(/[ââ]/g,'"');y?.(h);try{Lt(h);const u=JSON.parse(h);if(typeof u!="object"){const l=new Error("You need to type JSON in the editor.");throw l.position=0,l}if(typeof u.manifest!="object"){const l=new Error("You need to add a root manifest");throw l.position=0,l}if(typeof u.manifest?.filter!="object"){const l=new Error("You need to add a root manifest.filter");throw l.position=0,l}e?.(JSON.parse(h)),D.current.view?.dispatch({effects:we.of(null)}),b(null)}catch(u){console.error(u);const{position:l,message:s}=u;b(s),h.length>0&&typeof l=="number"&&D.current.view?.dispatch({effects:Ce.of([Rt.range(Math.max(0,l-1),l+1)])})}},onCreateEditor:o=>{if(Z.current){const h=xe(Z.current);for(const u of h)u&&o.dispatch({effects:Ne.of([Ft.range(u.value.pos,u.valueEnd.pos)])})}}}),x&&P.jsx("div",{className:"absolute bottom-0 left-0 m-4 bg-slate-app",children:P.jsx(lt,{variant:"destructive",children:P.jsxs("div",{className:"flex gap-3 items-center",children:[P.jsx(Le,{className:"h-6 w-6"}),P.jsxs("div",{className:"flex flex-col gap-0.5",children:[P.jsx("span",{className:"font-semibold",children:"JSON Validation Error"}),P.jsx("span",{className:"text-sm",children:x})]})]})})})]})}export{Lr as default}; 7//# sourceMappingURL=JsonEditor-CENpfcCt.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.