import{p as o}from"./vendor-lezer-json-DDnhoYFs.js";import{L as a,c as s,d as i,f as p,e as n,k as m}from"./cm-language-CDsY7zq0.js";import"./vendor-lezer-lr-eZ5kYecM.js";import"./vendor-lezer-common-tVQBIsvN.js";import"./vendor-lezer-highlight-DuEf3ZFH.js";import"./cm-state-X9WpHEQO.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./cm-view-CiSFjroV.js";import"./vendor-style-mod-Bs6eFhZE.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";const S=()=>r=>{try{JSON.parse(r.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const e=c(t,r.state.doc);return[{from:e,message:t.message,severity:"error",to:e}]}return[]};function c(r,t){let e;return(e=r.message.match(/at position (\d+)/))?Math.min(+e[1],t.length):(e=r.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+e[1]).from+ +e[2]-1,t.length):0}const d=a.define({name:"json",parser:o.configure({props:[i.add({Object:n({except:/^\s*\}/}),Array:n({except:/^\s*\]/})}),p.add({"Object Array":m})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function b(){return new s(d)}export{b as json,d as jsonLanguage,S as jsonParseLinter};
