"use strict";(self.webpackChunksage_agent_internal=self.webpackChunksage_agent_internal||[]).push([[439],{7820:(n,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.parse=r.enableErrorLogging=r.disableErrorLogging=r.setErrorLogger=void 0;let t=console.error;function e(n){if(void 0!==n){if(null===n)return null;if(""===n)return"";n=n.replace(/\\+$/,n=>n.length%2==0?n:n.slice(0,-1));try{return JSON.parse(n)}catch(r){const[t,i]=":"===n.trimLeft()[0]?s(n,r):s(n,r,h);if(e.lastParseReminding=i,e.onExtraToken&&i.length>0){const r=i.trimRight();e.lastParseReminding=r,r.length>0&&e.onExtraToken(n,t,r)}return t}}}function s(n,r,e){const s=o[n[0]]||e;if(!s)throw t(`no parser registered for ${JSON.stringify(n[0])}:`,{s:n}),r;return s(n,r)}function i(n,r,t){return'"'===n[0]?g(n):"'"===n[0]?b(n):h(n,0,t)}r.setErrorLogger=function(n){t=n},r.disableErrorLogging=function(){t=()=>{}},r.enableErrorLogging=function(){t=console.error},r.parse=e,function(n){n.onExtraToken=(n,r,e)=>{t("parsed json with extra tokens:",{text:n,data:r,reminding:e})}}(e=r.parse||(r.parse={}));const o={};function u(n){return n.trimLeft()}function c(n,r){return s(n=u(n),r)}o[" "]=c,o["\r"]=c,o["\n"]=c,o["\t"]=c,o["["]=function(n,r){const t=[];for(n=u(n=n.substr(1));n.length>0;){if("]"===n[0]){n=n.substr(1);break}const e=s(n,r,(n,r)=>h(n,0,[",","]"]));t.push(e[0]),","===(n=u(n=e[1]))[0]&&(n=u(n=n.substring(1)))}return[t,n]};for(const n of"0123456789.-".slice())o[n]=f;function f(n){for(let r=0;r<n.length;r++){const t=n[r];if(o[t]===f)continue;const e=n.substring(0,r);return n=n.substring(r),[l(e),n]}return[l(n),""]}function l(n){if("-"===n)return-0;const r=+n;return Number.isNaN(r)?n:r}function g(n){for(let r=1;r<n.length;r++){const t=n[r];if("\\"!==t){if('"'===t){const t=a(n.substring(0,r+1));return n=n.substring(r+1),[JSON.parse(t),n]}}else r++}return[JSON.parse(a(n)+'"'),""]}function a(n){return n.replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}function b(n){for(let r=1;r<n.length;r++){const t=n[r];if("\\"!==t){if("'"===t){const t=a(n.substring(0,r+1));return n=n.substring(r+1),[JSON.parse('"'+t.slice(1,-1)+'"'),n]}}else r++}return[JSON.parse('"'+a(n.slice(1))+'"'),""]}function h(n,r,t=[" "]){const e=Math.min(...t.map(r=>{const t=n.indexOf(r);return-1===t?n.length:t}));return[n.substring(0,e).trim(),n.substring(e)]}function p(n,r,e,s){for(let t=r.length;t>=1;t--)if(n.startsWith(r.slice(0,t)))return[e,n.slice(t)];{const e=JSON.stringify(n.slice(0,r.length));throw t(`unknown token starting with ${e}:`,{s:n}),s}}o['"']=g,o["'"]=b,o["{"]=function(n,r){const t={};for(n=u(n=n.substr(1));n.length>0;){if("}"===n[0]){n=n.substr(1);break}const e=i(n,0,[":","}"]),o=e[0];if(":"!==(n=u(n=e[1]))[0]){t[o]=void 0;break}if(0===(n=u(n=n.substr(1))).length){t[o]=void 0;break}const c=s(n,r);t[o]=c[0],","===(n=u(n=c[1]))[0]&&(n=u(n=n.substr(1)))}return[t,n]},o.t=function(n,r){return p(n,"true",!0,r)},o.f=function(n,r){return p(n,"false",!1,r)},o.n=function(n,r){return p(n,"null",null,r)}}}]);