react-monaco-json-merge 1.1.14 → 1.1.16

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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Xe=require("react/jsx-runtime"),P=require("react");function Jt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function wn(e){if(Array.isArray(e))return e}function An(e,t,r){return(t=Sn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,c=[],a=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(a=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{if(!a&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return c}}function En(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Gt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ht(Object(r),!0).forEach(function(n){An(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tn(e,t){if(e==null)return{};var r,n,o=In(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function In(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ln(e,t){return wn(e)||Nn(e,t)||_n(e,t)||En()}function kn(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sn(e){var t=kn(e,"string");return typeof t=="symbol"?t:t+""}function _n(e,t){if(e){if(typeof e=="string")return Jt(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(e,t):void 0}}function Pn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wt(Object(r),!0).forEach(function(n){Pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function Ce(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,c=new Array(s),a=0;a<s;a++)c[a]=arguments[a];return t.apply(r,[].concat(o,c))}}}function st(e){return{}.toString.call(e).includes("Object")}function jn(e){return!Object.keys(e).length}function Qe(e){return typeof e=="function"}function Dn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mn(e,t){return st(t)||Se("changeType"),Object.keys(t).some(function(r){return!Dn(e,r)})&&Se("changeField"),t}function xn(e){Qe(e)||Se("selectorType")}function $n(e){Qe(e)||st(e)||Se("handlerType"),st(e)&&Object.values(e).some(function(t){return!Qe(t)})&&Se("handlersType")}function Bn(e){e||Se("initialIsRequired"),st(e)||Se("initialType"),jn(e)&&Se("initialContent")}function Fn(e,t){throw new Error(e[t]||e.default)}var Un={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Se=Ce(Fn)(Un),rt={changes:Mn,selector:xn,handler:$n,initial:Bn};function Vn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};rt.initial(e),rt.handler(t);var r={current:e},n=Ce(Gn)(r,t),o=Ce(Hn)(r),i=Ce(rt.changes)(e),s=Ce(Jn)(r);function c(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(l){return l};return rt.selector(u),u(r.current)}function a(u){Rn(n,o,i,s)(u)}return[c,a]}function Jn(e,t){return Qe(t)?t(e.current):t}function Hn(e,t){return e.current=qt(qt({},e.current),t),t}function Gn(e,t,r){return Qe(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Wn={create:Vn},qn={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function Yn(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,c=new Array(s),a=0;a<s;a++)c[a]=arguments[a];return t.apply(r,[].concat(o,c))}}}function zn(e){return{}.toString.call(e).includes("Object")}function Xn(e){return e||Yt("configIsRequired"),zn(e)||Yt("configType"),e.urls?(Cn(),{paths:{vs:e.urls.monacoBase}}):e}function Cn(){console.warn(tn.deprecation)}function Qn(e,t){throw new Error(e[t]||e.default)}var tn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("react/jsx-runtime"),P=require("react");function Jt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function wn(e){if(Array.isArray(e))return e}function An(e,t,r){return(t=kn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,s,c=[],a=!0,u=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(a=(n=i.call(r)).done)&&(c.push(n.value),c.length!==t);a=!0);}catch(l){u=!0,o=l}finally{try{if(!a&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw o}}return c}}function En(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Gt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ht(Object(r),!0).forEach(function(n){An(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Tn(e,t){if(e==null)return{};var r,n,o=In(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function In(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Ln(e,t){return wn(e)||Nn(e,t)||_n(e,t)||En()}function Sn(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kn(e){var t=Sn(e,"string");return typeof t=="symbol"?t:t+""}function _n(e,t){if(e){if(typeof e=="string")return Jt(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jt(e,t):void 0}}function Pn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Wt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wt(Object(r),!0).forEach(function(n){Pn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function Xe(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,c=new Array(s),a=0;a<s;a++)c[a]=arguments[a];return t.apply(r,[].concat(o,c))}}}function st(e){return{}.toString.call(e).includes("Object")}function jn(e){return!Object.keys(e).length}function Qe(e){return typeof e=="function"}function Dn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Mn(e,t){return st(t)||ke("changeType"),Object.keys(t).some(function(r){return!Dn(e,r)})&&ke("changeField"),t}function xn(e){Qe(e)||ke("selectorType")}function $n(e){Qe(e)||st(e)||ke("handlerType"),st(e)&&Object.values(e).some(function(t){return!Qe(t)})&&ke("handlersType")}function Bn(e){e||ke("initialIsRequired"),st(e)||ke("initialType"),jn(e)&&ke("initialContent")}function Fn(e,t){throw new Error(e[t]||e.default)}var Un={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ke=Xe(Fn)(Un),rt={changes:Mn,selector:xn,handler:$n,initial:Bn};function Vn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};rt.initial(e),rt.handler(t);var r={current:e},n=Xe(Gn)(r,t),o=Xe(Hn)(r),i=Xe(rt.changes)(e),s=Xe(Jn)(r);function c(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(l){return l};return rt.selector(u),u(r.current)}function a(u){Rn(n,o,i,s)(u)}return[c,a]}function Jn(e,t){return Qe(t)?t(e.current):t}function Hn(e,t){return e.current=qt(qt({},e.current),t),t}function Gn(e,t,r){return Qe(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Wn={create:Vn},qn={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function Yn(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,c=new Array(s),a=0;a<s;a++)c[a]=arguments[a];return t.apply(r,[].concat(o,c))}}}function zn(e){return{}.toString.call(e).includes("Object")}function Cn(e){return e||Yt("configIsRequired"),zn(e)||Yt("configType"),e.urls?(Xn(),{paths:{vs:e.urls.monacoBase}}):e}function Xn(){console.warn(tn.deprecation)}function Qn(e,t){throw new Error(e[t]||e.default)}var tn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
5
5
  Instead of using
@@ -8,13 +8,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
8
8
  monaco.config({ paths: { vs: '...' } })
9
9
 
10
10
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
11
- `},Yt=Yn(Qn)(tn),Zn={config:Xn},Kn=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(i,s){return s(i)},o)}};function nn(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],nn(e[r],t[r]))}),Gt(Gt({},e),t)}var er={type:"cancelation",msg:"operation is manually canceled"};function gt(e){var t=!1,r=new Promise(function(n,o){e.then(function(i){return t?o(er):n(i)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var tr=["monaco"],nr=Wn.create({config:qn,isInitialized:!1,resolve:null,reject:null,monaco:null}),rn=Ln(nr,2),Ke=rn[0],ut=rn[1];function rr(e){var t=Zn.config(e),r=t.monaco,n=Tn(t,tr);ut(function(o){return{config:nn(o.config,n),monaco:r}})}function or(){var e=Ke(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(ut({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),gt(mt);if(window.monaco&&window.monaco.editor)return on(window.monaco),e.resolve(window.monaco),gt(mt);Kn(ir,cr)(ar)}return gt(mt)}function ir(e){return document.body.appendChild(e)}function sr(e){var t=document.createElement("script");return e&&(t.src=e),t}function cr(e){var t=Ke(function(n){var o=n.config,i=n.reject;return{config:o,reject:i}}),r=sr("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function ar(){var e=Ke(function(r){var n=r.config,o=r.resolve,i=r.reject;return{config:n,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var n=r.m;on(n),e.resolve(n)},function(r){e.reject(r)})}function on(e){Ke().monaco||ut({monaco:e})}function lr(){return Ke(function(e){var t=e.monaco;return t})}var mt=new Promise(function(e,t){return ut({resolve:e,reject:t})}),ur={config:rr,init:or,__getMonacoInstance:lr},ne=(e=>(e[e.excluded=0]="excluded",e[e.first=1]="first",e[e.second=2]="second",e))(ne||{}),x=(e=>(e.SAME_CHANGE="same_change",e.INPUT1_ONLY="input1_only",e.INPUT2_ONLY="input2_only",e.TRUE_CONFLICT="true_conflict",e))(x||{});function fr(e,t=!1){const r=e.length;let n=0,o="",i=0,s=16,c=0,a=0,u=0,l=0,y=0;function p(f,T){let S=0,g=0;for(;S<f;){let b=e.charCodeAt(n);if(b>=48&&b<=57)g=g*16+b-48;else if(b>=65&&b<=70)g=g*16+b-65+10;else if(b>=97&&b<=102)g=g*16+b-97+10;else break;n++,S++}return S<f&&(g=-1),g}function d(f){n=f,o="",i=0,s=16,y=0}function L(){let f=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Fe(e.charCodeAt(n)))for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;else return y=3,e.substring(f,n);let T=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Fe(e.charCodeAt(n))){for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;T=n}else y=3;return e.substring(f,T)}function E(){let f="",T=n;for(;;){if(n>=r){f+=e.substring(T,n),y=2;break}const S=e.charCodeAt(n);if(S===34){f+=e.substring(T,n),n++;break}if(S===92){if(f+=e.substring(T,n),n++,n>=r){y=2;break}switch(e.charCodeAt(n++)){case 34:f+='"';break;case 92:f+="\\";break;case 47:f+="/";break;case 98:f+="\b";break;case 102:f+="\f";break;case 110:f+=`
12
- `;break;case 114:f+="\r";break;case 116:f+=" ";break;case 117:const b=p(4);b>=0?f+=String.fromCharCode(b):y=4;break;default:y=5}T=n;continue}if(S>=0&&S<=31)if(Ye(S)){f+=e.substring(T,n),y=2;break}else y=6;n++}return f}function v(){if(o="",y=0,i=n,a=c,l=u,n>=r)return i=r,s=17;let f=e.charCodeAt(n);if(yt(f)){do n++,o+=String.fromCharCode(f),f=e.charCodeAt(n);while(yt(f));return s=15}if(Ye(f))return n++,o+=String.fromCharCode(f),f===13&&e.charCodeAt(n)===10&&(n++,o+=`
13
- `),c++,u=n,s=14;switch(f){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,o=E(),s=10;case 47:const T=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Ye(e.charCodeAt(n));)n++;return o=e.substring(T,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;const S=r-1;let g=!1;for(;n<S;){const b=e.charCodeAt(n);if(b===42&&e.charCodeAt(n+1)===47){n+=2,g=!0;break}n++,Ye(b)&&(b===13&&e.charCodeAt(n)===10&&n++,c++,u=n)}return g||(n++,y=1),o=e.substring(T,n),s=13}return o+=String.fromCharCode(f),n++,s=16;case 45:if(o+=String.fromCharCode(f),n++,n===r||!Fe(e.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=L(),s=11;default:for(;n<r&&h(f);)n++,f=e.charCodeAt(n);if(i!==n){switch(o=e.substring(i,n),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(f),n++,s=16}}function h(f){if(yt(f)||Ye(f))return!1;switch(f){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function m(){let f;do f=v();while(f>=12&&f<=15);return f}return{setPosition:d,getPosition:()=>n,scan:t?m:v,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>a,getTokenStartCharacter:()=>i-l,getTokenError:()=>y}}function yt(e){return e===32||e===9}function Ye(e){return e===10||e===13}function Fe(e){return e>=48&&e<=57}var zt;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(zt||(zt={}));new Array(20).fill(0).map((e,t)=>" ".repeat(t));const Ue=200;new Array(Ue).fill(0).map((e,t)=>`
11
+ `},Yt=Yn(Qn)(tn),Zn={config:Cn},Kn=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(o){return r.reduceRight(function(i,s){return s(i)},o)}};function nn(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],nn(e[r],t[r]))}),Gt(Gt({},e),t)}var er={type:"cancelation",msg:"operation is manually canceled"};function gt(e){var t=!1,r=new Promise(function(n,o){e.then(function(i){return t?o(er):n(i)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var tr=["monaco"],nr=Wn.create({config:qn,isInitialized:!1,resolve:null,reject:null,monaco:null}),rn=Ln(nr,2),Ke=rn[0],ut=rn[1];function rr(e){var t=Zn.config(e),r=t.monaco,n=Tn(t,tr);ut(function(o){return{config:nn(o.config,n),monaco:r}})}function or(){var e=Ke(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(ut({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),gt(mt);if(window.monaco&&window.monaco.editor)return on(window.monaco),e.resolve(window.monaco),gt(mt);Kn(ir,cr)(ar)}return gt(mt)}function ir(e){return document.body.appendChild(e)}function sr(e){var t=document.createElement("script");return e&&(t.src=e),t}function cr(e){var t=Ke(function(n){var o=n.config,i=n.reject;return{config:o,reject:i}}),r=sr("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function ar(){var e=Ke(function(r){var n=r.config,o=r.resolve,i=r.reject;return{config:n,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){var n=r.m;on(n),e.resolve(n)},function(r){e.reject(r)})}function on(e){Ke().monaco||ut({monaco:e})}function lr(){return Ke(function(e){var t=e.monaco;return t})}var mt=new Promise(function(e,t){return ut({resolve:e,reject:t})}),ur={config:rr,init:or,__getMonacoInstance:lr},ne=(e=>(e[e.excluded=0]="excluded",e[e.first=1]="first",e[e.second=2]="second",e))(ne||{}),M=(e=>(e.SAME_CHANGE="same_change",e.INPUT1_ONLY="input1_only",e.INPUT2_ONLY="input2_only",e.TRUE_CONFLICT="true_conflict",e))(M||{});function fr(e,t=!1){const r=e.length;let n=0,o="",i=0,s=16,c=0,a=0,u=0,l=0,y=0;function p(f,E){let S=0,g=0;for(;S<f;){let b=e.charCodeAt(n);if(b>=48&&b<=57)g=g*16+b-48;else if(b>=65&&b<=70)g=g*16+b-65+10;else if(b>=97&&b<=102)g=g*16+b-97+10;else break;n++,S++}return S<f&&(g=-1),g}function d(f){n=f,o="",i=0,s=16,y=0}function L(){let f=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Fe(e.charCodeAt(n)))for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;else return y=3,e.substring(f,n);let E=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Fe(e.charCodeAt(n))){for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;E=n}else y=3;return e.substring(f,E)}function N(){let f="",E=n;for(;;){if(n>=r){f+=e.substring(E,n),y=2;break}const S=e.charCodeAt(n);if(S===34){f+=e.substring(E,n),n++;break}if(S===92){if(f+=e.substring(E,n),n++,n>=r){y=2;break}switch(e.charCodeAt(n++)){case 34:f+='"';break;case 92:f+="\\";break;case 47:f+="/";break;case 98:f+="\b";break;case 102:f+="\f";break;case 110:f+=`
12
+ `;break;case 114:f+="\r";break;case 116:f+=" ";break;case 117:const b=p(4);b>=0?f+=String.fromCharCode(b):y=4;break;default:y=5}E=n;continue}if(S>=0&&S<=31)if(Ye(S)){f+=e.substring(E,n),y=2;break}else y=6;n++}return f}function v(){if(o="",y=0,i=n,a=c,l=u,n>=r)return i=r,s=17;let f=e.charCodeAt(n);if(yt(f)){do n++,o+=String.fromCharCode(f),f=e.charCodeAt(n);while(yt(f));return s=15}if(Ye(f))return n++,o+=String.fromCharCode(f),f===13&&e.charCodeAt(n)===10&&(n++,o+=`
13
+ `),c++,u=n,s=14;switch(f){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,o=N(),s=10;case 47:const E=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Ye(e.charCodeAt(n));)n++;return o=e.substring(E,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;const S=r-1;let g=!1;for(;n<S;){const b=e.charCodeAt(n);if(b===42&&e.charCodeAt(n+1)===47){n+=2,g=!0;break}n++,Ye(b)&&(b===13&&e.charCodeAt(n)===10&&n++,c++,u=n)}return g||(n++,y=1),o=e.substring(E,n),s=13}return o+=String.fromCharCode(f),n++,s=16;case 45:if(o+=String.fromCharCode(f),n++,n===r||!Fe(e.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=L(),s=11;default:for(;n<r&&h(f);)n++,f=e.charCodeAt(n);if(i!==n){switch(o=e.substring(i,n),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(f),n++,s=16}}function h(f){if(yt(f)||Ye(f))return!1;switch(f){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function m(){let f;do f=v();while(f>=12&&f<=15);return f}return{setPosition:d,getPosition:()=>n,scan:t?m:v,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>n-i,getTokenStartLine:()=>a,getTokenStartCharacter:()=>i-l,getTokenError:()=>y}}function yt(e){return e===32||e===9}function Ye(e){return e===10||e===13}function Fe(e){return e>=48&&e<=57}var zt;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(zt||(zt={}));new Array(20).fill(0).map((e,t)=>" ".repeat(t));const Ue=200;new Array(Ue).fill(0).map((e,t)=>`
14
14
  `+" ".repeat(t)),new Array(Ue).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(Ue).fill(0).map((e,t)=>`\r
15
15
  `+" ".repeat(t)),new Array(Ue).fill(0).map((e,t)=>`
16
16
  `+" ".repeat(t)),new Array(Ue).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(Ue).fill(0).map((e,t)=>`\r
17
- `+" ".repeat(t));var ct;(function(e){e.DEFAULT={allowTrailingComma:!1}})(ct||(ct={}));function pr(e,t=[],r=ct.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(a){n.type==="property"&&(n.length=a-n.offset,n=n.parent)}function i(a){return n.children.push(a),a}hr(e,{onObjectBegin:a=>{n=i({type:"object",offset:a,length:-1,parent:n,children:[]})},onObjectProperty:(a,u,l)=>{n=i({type:"property",offset:u,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:a,offset:u,length:l,parent:n})},onObjectEnd:(a,u)=>{o(a+u),n.length=a+u-n.offset,n=n.parent,o(a+u)},onArrayBegin:(a,u)=>{n=i({type:"array",offset:a,length:-1,parent:n,children:[]})},onArrayEnd:(a,u)=>{n.length=a+u-n.offset,n=n.parent,o(a+u)},onLiteralValue:(a,u,l)=>{i({type:gr(a),offset:u,length:l,parent:n,value:a}),o(u+l)},onSeparator:(a,u,l)=>{n.type==="property"&&(a===":"?n.colonOffset=u:a===","&&o(u))},onError:(a,u,l)=>{t.push({error:a,offset:u,length:l})}},r);const c=n.children[0];return c&&delete c.parent,c}function dr(e,t){if(!e)return;let r=e;for(let n of t)if(typeof n=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;let o=!1;for(const i of r.children)if(Array.isArray(i.children)&&i.children[0].value===n&&i.children.length===2){r=i.children[1],o=!0;break}if(!o)return}else{const o=n;if(r.type!=="array"||o<0||!Array.isArray(r.children)||o>=r.children.length)return;r=r.children[o]}return r}function hr(e,t,r=ct.DEFAULT){const n=fr(e,!1),o=[];let i=0;function s(A){return A?()=>i===0&&A(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(A){return A?w=>i===0&&A(w,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(A){return A?w=>i===0&&A(w,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function u(A){return A?()=>{i>0?i++:A(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function l(A){return A?()=>{i>0&&i--,i===0&&A(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const y=u(t.onObjectBegin),p=a(t.onObjectProperty),d=l(t.onObjectEnd),L=u(t.onArrayBegin),E=l(t.onArrayEnd),v=a(t.onLiteralValue),h=c(t.onSeparator),m=s(t.onComment),f=c(t.onError),T=r&&r.disallowComments,S=r&&r.allowTrailingComma;function g(){for(;;){const A=n.scan();switch(n.getTokenError()){case 4:b(14);break;case 5:b(15);break;case 3:b(13);break;case 1:T||b(11);break;case 2:b(12);break;case 6:b(16);break}switch(A){case 12:case 13:T?b(10):m();break;case 16:b(1);break;case 15:case 14:break;default:return A}}}function b(A,w=[],j=[]){if(f(A),w.length+j.length>0){let C=n.getToken();for(;C!==17;){if(w.indexOf(C)!==-1){g();break}else if(j.indexOf(C)!==-1)break;C=g()}}}function D(A){const w=n.getTokenValue();return A?v(w):(p(w),o.push(w)),g(),!0}function N(){switch(n.getToken()){case 11:const A=n.getTokenValue();let w=Number(A);isNaN(w)&&(b(2),w=0),v(w);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return!1}return g(),!0}function F(){return n.getToken()!==10?(b(3,[],[2,5]),!1):(D(!1),n.getToken()===6?(h(":"),g(),J()||b(4,[],[2,5])):b(5,[],[2,5]),o.pop(),!0)}function M(){y(),g();let A=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(A||b(4,[],[]),h(","),g(),n.getToken()===2&&S)break}else A&&b(6,[],[]);F()||b(4,[],[2,5]),A=!0}return d(),n.getToken()!==2?b(7,[2],[]):g(),!0}function $(){L(),g();let A=!0,w=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(w||b(4,[],[]),h(","),g(),n.getToken()===4&&S)break}else w&&b(6,[],[]);A?(o.push(0),A=!1):o[o.length-1]++,J()||b(4,[],[4,5]),w=!0}return E(),A||o.pop(),n.getToken()!==4?b(8,[4],[]):g(),!0}function J(){switch(n.getToken()){case 3:return $();case 1:return M();case 10:return D(!0);default:return N()}}return g(),n.getToken()===17?r.allowEmptyContent?!0:(b(4,[],[]),!1):J()?(n.getToken()!==17&&b(9,[],[]),!0):(b(4,[],[]),!1)}function gr(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}var Xt;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Xt||(Xt={}));var Ct;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Ct||(Ct={}));const sn=pr,cn=dr;var Qt;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Qt||(Qt={}));function mr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vt,Zt;function yr(){return Zt||(Zt=1,vt=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}),vt}var vr=yr();const ye=mr(vr),q=(e,t)=>{if(!e)return;const r=t.replace(/^\//,"").replace(/\[/g,".").replace(/\]/g,"").split(/[./#]/).filter(Boolean);let n=e;for(const o of r){if(!n||typeof n!="object")return;if(Array.isArray(n)){const i=Number.parseInt(o,10);if(Number.isNaN(i)||i<0||i>=n.length)return;n=n[i]}else if(o in n)n=n[o];else return}return n};/*!
17
+ `+" ".repeat(t));var ct;(function(e){e.DEFAULT={allowTrailingComma:!1}})(ct||(ct={}));function pr(e,t=[],r=ct.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(a){n.type==="property"&&(n.length=a-n.offset,n=n.parent)}function i(a){return n.children.push(a),a}hr(e,{onObjectBegin:a=>{n=i({type:"object",offset:a,length:-1,parent:n,children:[]})},onObjectProperty:(a,u,l)=>{n=i({type:"property",offset:u,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:a,offset:u,length:l,parent:n})},onObjectEnd:(a,u)=>{o(a+u),n.length=a+u-n.offset,n=n.parent,o(a+u)},onArrayBegin:(a,u)=>{n=i({type:"array",offset:a,length:-1,parent:n,children:[]})},onArrayEnd:(a,u)=>{n.length=a+u-n.offset,n=n.parent,o(a+u)},onLiteralValue:(a,u,l)=>{i({type:gr(a),offset:u,length:l,parent:n,value:a}),o(u+l)},onSeparator:(a,u,l)=>{n.type==="property"&&(a===":"?n.colonOffset=u:a===","&&o(u))},onError:(a,u,l)=>{t.push({error:a,offset:u,length:l})}},r);const c=n.children[0];return c&&delete c.parent,c}function dr(e,t){if(!e)return;let r=e;for(let n of t)if(typeof n=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;let o=!1;for(const i of r.children)if(Array.isArray(i.children)&&i.children[0].value===n&&i.children.length===2){r=i.children[1],o=!0;break}if(!o)return}else{const o=n;if(r.type!=="array"||o<0||!Array.isArray(r.children)||o>=r.children.length)return;r=r.children[o]}return r}function hr(e,t,r=ct.DEFAULT){const n=fr(e,!1),o=[];let i=0;function s(A){return A?()=>i===0&&A(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(A){return A?w=>i===0&&A(w,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(A){return A?w=>i===0&&A(w,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function u(A){return A?()=>{i>0?i++:A(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function l(A){return A?()=>{i>0&&i--,i===0&&A(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const y=u(t.onObjectBegin),p=a(t.onObjectProperty),d=l(t.onObjectEnd),L=u(t.onArrayBegin),N=l(t.onArrayEnd),v=a(t.onLiteralValue),h=c(t.onSeparator),m=s(t.onComment),f=c(t.onError),E=r&&r.disallowComments,S=r&&r.allowTrailingComma;function g(){for(;;){const A=n.scan();switch(n.getTokenError()){case 4:b(14);break;case 5:b(15);break;case 3:b(13);break;case 1:E||b(11);break;case 2:b(12);break;case 6:b(16);break}switch(A){case 12:case 13:E?b(10):m();break;case 16:b(1);break;case 15:case 14:break;default:return A}}}function b(A,w=[],j=[]){if(f(A),w.length+j.length>0){let X=n.getToken();for(;X!==17;){if(w.indexOf(X)!==-1){g();break}else if(j.indexOf(X)!==-1)break;X=g()}}}function D(A){const w=n.getTokenValue();return A?v(w):(p(w),o.push(w)),g(),!0}function T(){switch(n.getToken()){case 11:const A=n.getTokenValue();let w=Number(A);isNaN(w)&&(b(2),w=0),v(w);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return!1}return g(),!0}function F(){return n.getToken()!==10?(b(3,[],[2,5]),!1):(D(!1),n.getToken()===6?(h(":"),g(),J()||b(4,[],[2,5])):b(5,[],[2,5]),o.pop(),!0)}function x(){y(),g();let A=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(A||b(4,[],[]),h(","),g(),n.getToken()===2&&S)break}else A&&b(6,[],[]);F()||b(4,[],[2,5]),A=!0}return d(),n.getToken()!==2?b(7,[2],[]):g(),!0}function $(){L(),g();let A=!0,w=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(w||b(4,[],[]),h(","),g(),n.getToken()===4&&S)break}else w&&b(6,[],[]);A?(o.push(0),A=!1):o[o.length-1]++,J()||b(4,[],[4,5]),w=!0}return N(),A||o.pop(),n.getToken()!==4?b(8,[4],[]):g(),!0}function J(){switch(n.getToken()){case 3:return $();case 1:return x();case 10:return D(!0);default:return T()}}return g(),n.getToken()===17?r.allowEmptyContent?!0:(b(4,[],[]),!1):J()?(n.getToken()!==17&&b(9,[],[]),!0):(b(4,[],[]),!1)}function gr(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}var Ct;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Ct||(Ct={}));var Xt;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Xt||(Xt={}));const sn=pr,cn=dr;var Qt;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Qt||(Qt={}));function mr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vt,Zt;function yr(){return Zt||(Zt=1,vt=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}),vt}var vr=yr();const de=mr(vr),q=(e,t)=>{if(!e)return;const r=t.replace(/^\//,"").replace(/\[/g,".").replace(/\]/g,"").split(/[./#]/).filter(Boolean);let n=e;for(const o of r){if(!n||typeof n!="object")return;if(Array.isArray(n)){const i=Number.parseInt(o,10);if(Number.isNaN(i)||i<0||i>=n.length)return;n=n[i]}else if(o in n)n=n[o];else return}return n};/*!
18
18
  * https://github.com/Starcounter-Jack/JSON-Patch
19
19
  * (c) 2017-2022 Joachim Wester
20
20
  * MIT licensed
@@ -23,15 +23,15 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
23
23
  * https://github.com/Starcounter-Jack/JSON-Patch
24
24
  * (c) 2017-2021 Joachim Wester
25
25
  * MIT license
26
- */var kt=new WeakMap,Tr=(function(){function e(t){this.observers=new Map,this.obj=t}return e})(),Ir=(function(){function e(t,r){this.callback=t,this.observer=r}return e})();function Lr(e){return kt.get(e)}function kr(e,t){return e.observers.get(t)}function Sr(e,t){e.observers.delete(t.callback)}function _r(e,t){t.unobserve()}function Pr(e,t){var r=[],n,o=Lr(e);if(!o)o=new Tr(e),kt.set(e,o);else{var i=kr(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=we(e),t){n.callback=t,n.next=null;var s=function(){Tt(n)},c=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return n.patches=r,n.object=e,n.unobserve=function(){Tt(n),clearTimeout(n.next),Sr(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},o.observers.set(t,new Ir(t,n)),n}function Tt(e,t){t===void 0&&(t=!1);var r=kt.get(e.object);St(r.value,e.object,e.patches,"",t),e.patches.length&&Lt(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function St(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=At(t),s=At(e),c=!1,a=s.length-1;a>=0;a--){var u=s[a],l=e[u];if(wt(t,u)&&!(t[u]===void 0&&l!==void 0&&Array.isArray(t)===!1)){var y=t[u];typeof l=="object"&&l!=null&&typeof y=="object"&&y!=null&&Array.isArray(l)===Array.isArray(y)?St(l,y,r,n+"/"+Re(u),o):l!==y&&(o&&r.push({op:"test",path:n+"/"+Re(u),value:we(l)}),r.push({op:"replace",path:n+"/"+Re(u),value:we(y)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Re(u),value:we(l)}),r.push({op:"remove",path:n+"/"+Re(u)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}))}if(!(!c&&i.length==s.length))for(var a=0;a<i.length;a++){var u=i[a];!wt(e,u)&&t[u]!==void 0&&r.push({op:"add",path:n+"/"+Re(u),value:we(t[u])})}}}function Je(e,t,r){r===void 0&&(r=!1);var n=[];return St(e,t,n,"",r),n}const Rr=Object.freeze(Object.defineProperty({__proto__:null,compare:Je,generate:Tt,observe:Pr,unobserve:_r},Symbol.toStringTag,{value:"Module"}));Object.assign({},Er,Rr,{JsonPatchError:ln,deepClone:we,escapePathComponent:Re,unescapePathComponent:an});const ft="oneOf",_t="anyOf",Pt="allOf";function Rt(e){return!!(e[ft]||e[_t]||e[Pt])}function fn(e){const t=e[ft]||e[_t]||e[Pt];return Array.isArray(t)?t:void 0}function ot(e){return e.oneOf?ft:e.anyOf?_t:e.allOf?Pt:""}function jr(e,t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const r=t,n=new Set;for(const o of e){const i=o.properties;if(i)for(const[s,c]of Object.entries(i))c&&typeof c=="object"&&"const"in c&&n.add(s)}for(const o of n)if(o in r)return{field:o,value:r[o]};return null}function it(e,t,r=ft){var n;if(t.length===0)throw new Error("No variants provided to chooseSubschemaSync");if(e===null)for(let o=0;o<t.length;o++){const i=t[o];if(i.const===null)return{selectedIndex:o,schema:i}}if(typeof e=="object"&&e!==null&&!Array.isArray(e)){const o=e,i=jr(t,e);if(i)for(let s=0;s<t.length;s++){const c=t[s],a=(n=c.properties)==null?void 0:n[i.field];if(a&&typeof a=="object"&&"const"in a&&a.const===i.value)return{selectedIndex:s,schema:c}}for(let s=0;s<t.length;s++){const c=t[s];if(c.type==="object"&&c.properties){const a=c.required||[];if(a.every(l=>l in o)&&a.length>0){let l=!0;for(const[y,p]of Object.entries(c.properties))if(p&&typeof p=="object"&&"const"in p){const d=p.const;if(o[y]!==d){l=!1;break}}if(l)return{selectedIndex:s,schema:c}}}}}for(let o=0;o<t.length;o++){const i=t[o];if(i.const!==void 0&&i.const===e)return{selectedIndex:o,schema:i}}for(let o=0;o<t.length;o++){const i=t[o];if(i.type){const s=Array.isArray(e)?"array":typeof e;if((Array.isArray(i.type)?i.type[0]:i.type)===s)return{selectedIndex:o,schema:i}}}return{selectedIndex:0,schema:t[0]}}function It(e,t,r){const n=!ye(e,t),o=!ye(e,r);return n&&o?ye(t,r)?x.SAME_CHANGE:x.TRUE_CONFLICT:n?x.INPUT1_ONLY:o?x.INPUT2_ONLY:x.SAME_CHANGE}function ke(e,t){try{const r=sn(e);if(!r)return{start:1,end:1};const n=t.split("/").filter(Boolean).map(s=>{const c=Number.parseInt(s,10);return!Number.isNaN(c)&&String(c)===s?c:s}),o=n.length===0?r:cn(r,n);return o?{start:en(e,o.offset),end:en(e,o.offset+o.length)}:{start:1,end:1}}catch{return{start:1,end:1}}}function en(e,t){return e.substring(0,t).split(`
27
- `).length}function Dr(e,t){const r=new Map,n=o=>{const i=o.split("/").filter(Boolean);return i.length>0?`/${i[0]}`:"/"};for(const o of e){const i=n(o.path);r.has(i)||r.set(i,{patches1:[],patches2:[]});const s=r.get(i);s&&s.patches1.push(o)}for(const o of t){const i=n(o.path);r.has(i)||r.set(i,{patches1:[],patches2:[]});const s=r.get(i);s&&s.patches2.push(o)}return r}function Mr(e,t,r,n,o,i){const s=new Map,c=new Map,a=new Map,u=[],l=[];for(const v of e){const h=v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(h){const m=h[1];c.has(m)||c.set(m,[]);const f=c.get(m);f&&f.push(v)}else u.push(v)}for(const v of t){const h=v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(h){const m=h[1];a.has(m)||a.set(m,[]);const f=a.get(m);f&&f.push(v)}else l.push(v)}const y=new Set([...c.keys(),...a.keys()]);for(const v of y){const h=q(r,v),m=q(n,v),f=q(o,v);if(!Array.isArray(h)||!Array.isArray(m)||!Array.isArray(f)){const N=c.get(v)||[],F=a.get(v)||[];for(const M of N){const $=M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if($){const J=$[1];s.has(J)||s.set(J,{patches1:[],patches2:[]});const A=s.get(J);A&&A.patches1.push(M)}}for(const M of F){const $=M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if($){const J=$[1];s.has(J)||s.set(J,{patches1:[],patches2:[]});const A=s.get(J);A&&A.patches2.push(M)}}continue}const T=He(i,v,r),S=T!=null&&T.items?Array.isArray(T.items)&&T.items[0]?T.items[0]:Array.isArray(T.items)?null:T.items:null,g=S&&typeof S=="object"?S:null;if(g){const N=Br(h,m,f,g);if(N.size>0){const F=new Map,M=new Map,$=new Map;for(const[w,j]of N.entries())j.base!==void 0&&F.set(j.base,w),j.input1!==void 0&&M.set(j.input1,w),j.input2!==void 0&&$.set(j.input2,w);const J=c.get(v)||[],A=a.get(v)||[];for(const w of J){const j=w.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(j){const C=Number.parseInt(j[1],10),re=M.get(C);if(re!==void 0){const le=`${v}#${re}`;s.has(le)||s.set(le,{patches1:[],patches2:[]});const ge=s.get(le);ge&&ge.patches1.push(w)}}}for(const w of A){const j=w.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(j){const C=Number.parseInt(j[1],10),re=$.get(C);if(re!==void 0){const le=`${v}#${re}`;s.has(le)||s.set(le,{patches1:[],patches2:[]});const ge=s.get(le);ge&&ge.patches2.push(w)}}}continue}}const b=c.get(v)||[],D=a.get(v)||[];for(const N of b){const F=N.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(F){const M=F[1];s.has(M)||s.set(M,{patches1:[],patches2:[]});const $=s.get(M);$&&$.patches1.push(N)}}for(const N of D){const F=N.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(F){const M=F[1];s.has(M)||s.set(M,{patches1:[],patches2:[]});const $=s.get(M);$&&$.patches2.push(N)}}}const p=(v,h)=>{if(!h)return null;const m=v.split("/").filter(Boolean);if(m.length<2)return null;const f=`/${m[0]}`,T=He(h,f);return T&&Rt(T)?f:null},d=[...u],L=[...l],E=new Set;for(const v of d){const h=p(v.path,i);h&&E.add(h)}for(const v of L){const h=p(v.path,i);h&&E.add(h)}for(const v of E)s.has(v)||s.set(v,{patches1:[],patches2:[]});for(const v of d){const h=v.path,m=p(h,i);if(m){const f=s.get(m);f&&f.patches1.push(v)}else{s.has(h)||s.set(h,{patches1:[],patches2:[]});const f=s.get(h);f&&f.patches1.push(v)}}for(const v of L){const h=v.path,m=p(h,i);if(m){const f=s.get(m);f&&f.patches2.push(v)}else{s.has(h)||s.set(h,{patches1:[],patches2:[]});const f=s.get(h);f&&f.patches2.push(v)}}return s}function He(e,t,r){if(!e)return null;const n=t.split("/").filter(Boolean);if(n.length===0)return e;let o=e,i="";for(let s=0;s<n.length;s++){const c=n[s],a=Number.parseInt(c,10),u=!Number.isNaN(a)&&String(a)===c;if(o&&Rt(o)){const l=fn(o),y=ot(o),p=r?q(r,i||"/"):void 0;if(l&&l.length>0)if(p!==void 0)try{const{schema:d}=it(p,l,y);o=d}catch{l.length>0&&l[0]&&(o=l[0])}else l.length>0&&l[0]&&(o=l[0])}if(!o)return null;if(u)if(o.items)if(Array.isArray(o.items)){const l=a<o.items.length?o.items[a]:null;o=l&&typeof l=="object"?l:null}else typeof o.items=="object"?o=o.items:o=null;else return null;else if(o.properties&&typeof o.properties=="object"&&!Array.isArray(o.properties))o=o.properties[c]||null;else return null;if(!o)return null;i=i?`${i}/${c}`:`/${c}`}return o}function pn(e){if(!e||typeof e!="object")return[];const t=[];if(e.properties&&typeof e.properties=="object"&&!Array.isArray(e.properties)){const r=e.properties;for(const[o,i]of Object.entries(r))i&&typeof i=="object"&&"const"in i&&t.push(o);for(const[o,i]of Object.entries(r))if(i&&typeof i=="object"){const s=i.format;(s==="uuid"||s==="objectid")&&(t.includes(o)||t.push(o))}const n=["id","uuid","_id","key"];for(const o of n)o in r&&!t.includes(o)&&t.push(o);"type"in r&&!t.includes("type")&&t.push("type"),"name"in r&&!t.includes("name")&&t.push("name")}return t}function xr(e){const t=pn(e);return t.length>0?t[0]:null}function $r(e,t,r){const n=new Map,o=pn(r);if(o.length===0)return n;const i=c=>{if(typeof c!="object"||c===null)return null;const a=c,u=[];for(const l of o){const y=a[l];y!=null&&u.push(`${l}:${JSON.stringify(y)}`)}return u.length>0?u.join("|"):null},s=(c,a)=>{c.forEach((u,l)=>{const y=i(u);if(y){n.has(y)||n.set(y,{});const p=n.get(y);p&&(p[a]=l)}})};return s(e,"input1"),s(t,"input2"),n}function Br(e,t,r,n){const o=new Map,i=xr(n);if(!i)return o;const s=(c,a)=>{c.forEach((u,l)=>{if(typeof u=="object"&&u!==null){const y=u[i];if(y!=null){const p=String(y);o.has(p)||o.set(p,{});const d=o.get(p);d&&(d[a]=l)}}})};return s(e,"base"),s(t,"input1"),s(r,"input2"),o}function dn(e,t,r,n){const o=typeof e=="object"&&e!==null||Array.isArray(e)?e:{},i=typeof t=="object"&&t!==null||Array.isArray(t)?t:{},s=typeof r=="object"&&r!==null||Array.isArray(r)?r:{},c=Je(o,i),a=Je(o,s);let u=Dr(c,a);n&&(u=Mr(c,a,e,t,r,n));const l=[],y=new Set,p=(d,L,E,v)=>{if(!n||typeof L!="object"||L===null||Array.isArray(L)||typeof E!="object"||E===null||Array.isArray(E)||typeof v!="object"||v===null||Array.isArray(v))return!1;const h=He(n,d,L);if(!h||!Rt(h))return!1;const m=fn(h);if(!m||m.length<2)return!1;const f=it(L,m,ot(h)),T=it(E,m,ot(h)),S=it(v,m,ot(h));return T.selectedIndex!==S.selectedIndex&&(f.selectedIndex!==T.selectedIndex||f.selectedIndex!==S.selectedIndex)};for(const[d,{patches1:L,patches2:E}]of u){y.add(d);let v=d;L.length>0?v=L[0].path:E.length>0?v=E[0].path:d.includes("#")&&(v=d.split("#")[0]);let h=d;if(d.includes("#"))h=d.split("#")[0];else{const M=d.split("/").filter(Boolean);M.length>1&&(h=`/${M[0]}`)}if([...L,...E].every(M=>(M.path.split("/").slice(0,2).join("/")||`/${M.path.split("/")[1]}`)===h)&&h!==v){const M=q(e,h),$=q(t,h),J=q(r,h);if(p(h,M,$,J)){const w=M,j=$,C=J;let re=It(w,j,C);!ye(w,j)&&!ye(w,C)&&!ye(j,C)&&(re=x.TRUE_CONFLICT);const le=[...L,...E].filter(Ee=>Ee.path.startsWith(`${h}/`)||Ee.path===h),ge=[],_e=[];for(const Ee of le){const K=Ee.path,se=e!==void 0?q(e,K):void 0,te=q(t,K),U=q(r,K);let fe=!1,Te=!1;Ee.op==="replace"?se!==void 0&&(fe=!ye(se,te),Te=!ye(se,U)):Ee.op==="add"?(fe=se===void 0&&te!==void 0,Te=se===void 0&&U!==void 0):Ee.op==="remove"&&(fe=se!==void 0&&te===void 0,Te=se!==void 0&&U===void 0),se!==void 0&&(te!==void 0&&ye(se,te)&&(fe=!1),U!==void 0&&ye(se,U)&&(Te=!1)),fe&&ge.push(Ee),Te&&_e.push(Ee)}l.push({path:h,baseValue:w,input1Value:j,input2Value:C,conflictType:re,patches1:ge,patches2:_e});continue}}const f=q(e,v),T=q(t,v),S=q(r,v);let g=It(f,T,S);const b=f!=null,D=T!=null,N=S!=null;!b&&D&&N&&g!==x.SAME_CHANGE&&(g=x.TRUE_CONFLICT),b&&ye(f,T)&&ye(f,S)||l.push({path:v,baseValue:f,input1Value:T,input2Value:S,conflictType:g,patches1:L,patches2:E})}return l}function hn(e,t,r){var y,p,d,L;const n=typeof e=="object"&&e!==null||Array.isArray(e)?e:{},o=typeof t=="object"&&t!==null||Array.isArray(t)?t:{},i=Je(n,o);if(i.length===0)return[];const s=[],c=new Set,a=new Map,u=[];for(const E of i){const v=E.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(v){const h=v[1];a.has(h)||a.set(h,[]);const m=a.get(h);m&&m.push(E)}else u.push(E)}for(const[E,v]of a){const h=q(e,E),m=q(t,E);if(!Array.isArray(h)||!Array.isArray(m)){const g=new Map;for(const b of v){const D=b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(D){const N=D[1];g.has(N)||g.set(N,[]),(y=g.get(N))==null||y.push(b)}}for(const[b,D]of g)s.push(...ze(b,D,e,t,void 0)),c.add(b);continue}const f=r?He(r,E,e):null,T=f!=null&&f.items?Array.isArray(f.items)&&f.items[0]?f.items[0]:Array.isArray(f.items)?null:f.items:null,S=T&&typeof T=="object"?T:null;if(S){const g=$r(h,m,S),b=new Map,D=new Map;for(const[$,J]of g.entries())J.input1!==void 0&&b.set(J.input1,$),J.input2!==void 0&&D.set(J.input2,$);const N=new Map,F=[];for(const $ of v){const J=$.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(J){const A=Number.parseInt(J[1],10);let w;if($.op==="add"?w=D.get(A):w=b.get(A),w){N.has(w)||N.set(w,[]);const j=N.get(w);j&&j.push($)}else F.push($)}}for(const[$,J]of N){const A=g.get($);if(!A)continue;const w=A.input1!==void 0?`${E}/${A.input1}`:`${E}/${A.input2}`;s.push(...ze(w,J,e,t,void 0)),c.add(w)}const M=new Map;for(const $ of F){const J=$.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(J){const A=J[1];M.has(A)||M.set(A,[]),(p=M.get(A))==null||p.push($)}}for(const[$,J]of M)c.has($)||(s.push(...ze($,J,e,t,void 0)),c.add($))}else{const g=new Map;for(const b of v){const D=b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(D){const N=D[1];g.has(N)||g.set(N,[]),(d=g.get(N))==null||d.push(b)}}for(const[b,D]of g)s.push(...ze(b,D,e,t,void 0)),c.add(b)}}const l=new Map;for(const E of u){const v=E.path.split("/").filter(Boolean),h=v.length>0?`/${v[0]}`:"/";l.has(h)||l.set(h,[]),(L=l.get(h))==null||L.push(E)}for(const[E,v]of l)s.push(...ze(E,v,e,t,void 0));return s}function ze(e,t,r,n,o){const i=o!==void 0?q(o,e):void 0,s=q(r,e),c=q(n,e),a=[],u=[];for(const f of t){const T=f.path,S=void 0,g=q(r,T),b=q(n,T);let D=!1,N=!1;f.op==="add"?(D=g!==void 0,N=b!==void 0):f.op==="remove"?(D=S!==void 0,N=S!==void 0):f.op==="replace"&&(D=g!==void 0,N=b!==void 0),T===e&&(D=!0,N=!0),D&&a.push(f),N&&u.push(f)}if(a.length===0&&u.length===0&&i!==void 0&&s!==void 0&&c!==void 0&&ye(i,s)&&ye(i,c))return[];const l=a.length>0?a:t,y=u.length>0?u:t,p=[...l,...y],d=p.some(f=>f.op==="add"),L=p.some(f=>f.op==="remove"),E=p.some(f=>f.op==="replace");if(d&&!E&&!L){if(s!==void 0&&c===void 0)return[{path:e,baseValue:void 0,input1Value:s,input2Value:void 0,conflictType:x.INPUT1_ONLY,patches1:l,patches2:[]}];if(c!==void 0&&s===void 0)return[{path:e,baseValue:void 0,input1Value:void 0,input2Value:c,conflictType:x.INPUT2_ONLY,patches1:[],patches2:y}]}if(L&&!d&&!E){if(s!==void 0&&c===void 0)return[{path:e,baseValue:s,input1Value:s,input2Value:void 0,conflictType:x.INPUT1_ONLY,patches1:l,patches2:[]}];if(c!==void 0&&s===void 0)return[{path:e,baseValue:c,input1Value:void 0,input2Value:c,conflictType:x.INPUT2_ONLY,patches1:[],patches2:y}]}const v=It(i,s,c);let h=[],m=[];switch(v){case x.INPUT1_ONLY:h=l,m=[];break;case x.INPUT2_ONLY:h=[],m=y;break;case x.SAME_CHANGE:h=l,m=y;break;case x.TRUE_CONFLICT:h=l,m=y;break}return[{path:e,baseValue:i,input1Value:s,input2Value:c,conflictType:v,patches1:h,patches2:m}]}function bt(e,t){if(!t||t.length===0)return{start:1,end:1};let r=Number.MAX_SAFE_INTEGER,n=0,o=!1;for(const i of t){const s=ke(e,i.path);s.start===1&&s.end===1||(r=Math.min(r,s.start),n=Math.max(n,s.end),o=!0)}return!o||r===Number.MAX_SAFE_INTEGER||n===0?{start:1,end:1}:{start:r,end:n}}function Fr(e,t,r,n){var i,s,c,a,u,l;const o=[];for(let y=0;y<e.length;y++){const p=e[y];let d,L,E;(((i=p.patches1)==null?void 0:i.length)??0)===0&&(((s=p.patches2)==null?void 0:s.length)??0)===0?(d=t?ke(t,p.path):{start:1,end:1},L=ke(r,p.path),E=ke(n,p.path)):(d=bt(t,[...p.patches1||[],...p.patches2||[]]),L=bt(r,p.patches1||[]),E=bt(n,p.patches2||[]));const v=p.conflictType===x.TRUE_CONFLICT;let h=ne.excluded,m=ne.excluded;switch(p.conflictType){case x.SAME_CHANGE:h=ne.first,m=ne.first;break;case x.INPUT1_ONLY:h=ne.first;break;case x.INPUT2_ONLY:m=ne.first;break;case x.TRUE_CONFLICT:m=ne.first;break}const f=[],T=[];if(p.patches1&&(p.patches1.length??0)>0)for(const g of p.patches1){if(g.op==="remove")continue;const b=ke(r,g.path);if(b.start!==1||b.end!==1)for(let D=b.start;D<=b.end;D++)f.push({line:D})}else if((((c=p.patches1)==null?void 0:c.length)??0)===0&&(((a=p.patches2)==null?void 0:a.length)??0)===0){const g=ke(r,p.path);(g.start!==1||g.end!==1)&&f.push({line:g.start})}if(p.patches2&&(p.patches2.length??0)>0)for(const g of p.patches2){if(g.op==="remove")continue;const b=ke(n,g.path);if(b.start!==1||b.end!==1)for(let D=b.start;D<=b.end;D++)T.push({line:D})}else if((((u=p.patches1)==null?void 0:u.length)??0)===0&&(((l=p.patches2)==null?void 0:l.length)??0)===0){const g=ke(n,p.path);(g.start!==1||g.end!==1)&&T.push({line:g.start})}const S={id:`conflict-${y}`,path:p.path,baseRange:{startLineNumber:d.start,endLineNumberExclusive:d.end+1},input1Range:{startLineNumber:L.start,endLineNumberExclusive:L.end+1},input2Range:{startLineNumber:E.start,endLineNumberExclusive:E.end+1},input1Diffs:f,input2Diffs:T,isConflicting:v,conflictType:p.conflictType,input1State:h,input2State:m,handled:p.conflictType===x.SAME_CHANGE,focused:!1};o.push(S)}return o}function gn(e,t,r,n={}){const{comparisonMode:o="split",schema:i}=n;if(!t||!r)throw new Error("JSON Patch diff requires non-empty input1 and input2 strings");try{const s=e?JSON.parse(e):void 0,c=JSON.parse(t),a=JSON.parse(r);let u;if(s===void 0)u=hn(c,a,i);else if(o==="split")u=dn(s,c,a,i);else{const l=Je(s,c),y=Je(c,a),p=new Set;l.forEach(d=>{p.add(d.path)}),y.forEach(d=>{p.add(d.path)}),u=Array.from(p).map(d=>{const L=q(s,d),E=q(c,d),v=q(a,d),h=!ye(L,E),m=!ye(E,v);let f;return h&&m?f=x.TRUE_CONFLICT:h?f=x.INPUT1_ONLY:m?f=x.INPUT2_ONLY:f=x.SAME_CHANGE,{path:d,baseValue:L,input1Value:E,input2Value:v,conflictType:f}})}return Fr(u,e,t,r)}catch(s){const c=s instanceof Error?s.message:String(s);throw new Error(`JSON Patch diff computation failed: ${c}`)}}function mn(e,t,r){const n=e!==t,o=e!==r;let i;return n&&o?t===r?i=x.SAME_CHANGE:i=x.TRUE_CONFLICT:n?i=x.INPUT1_ONLY:i=x.INPUT2_ONLY,{conflictType:i,input1Changed:n,input2Changed:o}}function Ur(e,t,r){var u,l,y;const n=[],o=[];for(let p=0;p<Math.max(e.length,t.length,r.length);p++){const d=e[p]!==void 0?e[p]:"",L=t[p]!==void 0?t[p]:"",E=r[p]!==void 0?r[p]:"",{conflictType:v,input1Changed:h,input2Changed:m}=mn(d,L,E);(h||m)&&o.push({line:p+1,input1Changed:h,input2Changed:m,baseLine:d,input1Line:L,input2Line:E,conflictType:v})}if(o.length===0)return[];let i=((u=o[0])==null?void 0:u.line)??1,s=(l=o[0])==null?void 0:l.conflictType,c=[],a=[];for(let p=0;p<=o.length;p++){const d=o[p],L=p===o.length,E=!L&&d&&o[p-1]&&d.line>(((y=o[p-1])==null?void 0:y.line)??0)+1,v=!L&&d&&d.conflictType!==s;if(L||E||v){const h=o[p-1],m=h?h.line+1:i+1,f=c.length>0,T=a.length>0,S=s===x.TRUE_CONFLICT,g={id:`conflict-${n.length}`,baseRange:{startLineNumber:i,endLineNumberExclusive:m},input1Range:{startLineNumber:i,endLineNumberExclusive:m},input2Range:{startLineNumber:i,endLineNumberExclusive:m},input1Diffs:c,input2Diffs:a,isConflicting:S,conflictType:s,input1State:s===x.SAME_CHANGE&&f?ne.first:ne.excluded,input2State:T?ne.first:ne.excluded,handled:s===x.SAME_CHANGE,focused:!1};n.push(g),!L&&d&&(i=d.line,s=d.conflictType,c=[],a=[])}!L&&d&&(d.input1Changed&&c.push({line:d.line}),d.input2Changed&&a.push({line:d.line}))}return n}function Vr(e,t,r){if(!t||t==="/"){if(typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof r=="object"&&r!==null&&!Array.isArray(r)){Object.assign(e,r);return}throw new Error(`Cannot assign root value: expected object, got ${typeof r}`)}const n=t.split("/").filter(c=>c!=="");let o=e;for(let c=0;c<n.length-1;c++){const a=n[c],u=Number.parseInt(a,10);if(!Number.isNaN(u)&&String(u)===a){if(!Array.isArray(o))throw new Error(`Path ${t}: segment ${a} expects array but got ${typeof o}`);o=o[u]}else{if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Path ${t}: segment ${a} expects object but got ${typeof o}`);const l=o;a in l||(l[a]={}),o=l[a]}}const i=n[n.length-1],s=Number.parseInt(i,10);if(!Number.isNaN(s)&&String(s)===i){if(!Array.isArray(o))throw new Error(`Path ${t}: last segment expects array but got ${typeof o}`);o[s]=r}else{if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Path ${t}: last segment expects object but got ${typeof o}`);o[i]=r}}function Jr(e,t){try{const r=sn(e);if(!r)return null;const n=t.split("/").filter(l=>l!=="").map(l=>{const y=Number.parseInt(l,10);return!Number.isNaN(y)&&String(y)===l?y:l}),o=cn(r,n);if(!o)return null;const s=e.substring(0,o.offset).split(`
26
+ */var St=new WeakMap,Tr=(function(){function e(t){this.observers=new Map,this.obj=t}return e})(),Ir=(function(){function e(t,r){this.callback=t,this.observer=r}return e})();function Lr(e){return St.get(e)}function Sr(e,t){return e.observers.get(t)}function kr(e,t){e.observers.delete(t.callback)}function _r(e,t){t.unobserve()}function Pr(e,t){var r=[],n,o=Lr(e);if(!o)o=new Tr(e),St.set(e,o);else{var i=Sr(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=we(e),t){n.callback=t,n.next=null;var s=function(){Tt(n)},c=function(){clearTimeout(n.next),n.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return n.patches=r,n.object=e,n.unobserve=function(){Tt(n),clearTimeout(n.next),kr(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},o.observers.set(t,new Ir(t,n)),n}function Tt(e,t){t===void 0&&(t=!1);var r=St.get(e.object);kt(r.value,e.object,e.patches,"",t),e.patches.length&&Lt(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function kt(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=At(t),s=At(e),c=!1,a=s.length-1;a>=0;a--){var u=s[a],l=e[u];if(wt(t,u)&&!(t[u]===void 0&&l!==void 0&&Array.isArray(t)===!1)){var y=t[u];typeof l=="object"&&l!=null&&typeof y=="object"&&y!=null&&Array.isArray(l)===Array.isArray(y)?kt(l,y,r,n+"/"+Re(u),o):l!==y&&(o&&r.push({op:"test",path:n+"/"+Re(u),value:we(l)}),r.push({op:"replace",path:n+"/"+Re(u),value:we(y)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Re(u),value:we(l)}),r.push({op:"remove",path:n+"/"+Re(u)}),c=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}))}if(!(!c&&i.length==s.length))for(var a=0;a<i.length;a++){var u=i[a];!wt(e,u)&&t[u]!==void 0&&r.push({op:"add",path:n+"/"+Re(u),value:we(t[u])})}}}function Je(e,t,r){r===void 0&&(r=!1);var n=[];return kt(e,t,n,"",r),n}const Rr=Object.freeze(Object.defineProperty({__proto__:null,compare:Je,generate:Tt,observe:Pr,unobserve:_r},Symbol.toStringTag,{value:"Module"}));Object.assign({},Er,Rr,{JsonPatchError:ln,deepClone:we,escapePathComponent:Re,unescapePathComponent:an});const ft="oneOf",_t="anyOf",Pt="allOf";function Rt(e){return!!(e[ft]||e[_t]||e[Pt])}function fn(e){const t=e[ft]||e[_t]||e[Pt];return Array.isArray(t)?t:void 0}function ot(e){return e.oneOf?ft:e.anyOf?_t:e.allOf?Pt:""}function jr(e,t){if(typeof t!="object"||t===null||Array.isArray(t))return null;const r=t,n=new Set;for(const o of e){const i=o.properties;if(i)for(const[s,c]of Object.entries(i))c&&typeof c=="object"&&"const"in c&&n.add(s)}for(const o of n)if(o in r)return{field:o,value:r[o]};return null}function it(e,t,r=ft){var n;if(t.length===0)throw new Error("No variants provided to chooseSubschemaSync");if(e===null)for(let o=0;o<t.length;o++){const i=t[o];if(i.const===null)return{selectedIndex:o,schema:i}}if(typeof e=="object"&&e!==null&&!Array.isArray(e)){const o=e,i=jr(t,e);if(i)for(let s=0;s<t.length;s++){const c=t[s],a=(n=c.properties)==null?void 0:n[i.field];if(a&&typeof a=="object"&&"const"in a&&a.const===i.value)return{selectedIndex:s,schema:c}}for(let s=0;s<t.length;s++){const c=t[s];if(c.type==="object"&&c.properties){const a=c.required||[];if(a.every(l=>l in o)&&a.length>0){let l=!0;for(const[y,p]of Object.entries(c.properties))if(p&&typeof p=="object"&&"const"in p){const d=p.const;if(o[y]!==d){l=!1;break}}if(l)return{selectedIndex:s,schema:c}}}}}for(let o=0;o<t.length;o++){const i=t[o];if(i.const!==void 0&&i.const===e)return{selectedIndex:o,schema:i}}for(let o=0;o<t.length;o++){const i=t[o];if(i.type){const s=Array.isArray(e)?"array":typeof e;if((Array.isArray(i.type)?i.type[0]:i.type)===s)return{selectedIndex:o,schema:i}}}return{selectedIndex:0,schema:t[0]}}function It(e,t,r){const n=!de(e,t),o=!de(e,r);return n&&o?de(t,r)?M.SAME_CHANGE:M.TRUE_CONFLICT:n?M.INPUT1_ONLY:o?M.INPUT2_ONLY:M.SAME_CHANGE}function Se(e,t){try{const r=sn(e);if(!r)return{start:1,end:1};const n=t.split("/").filter(Boolean).map(s=>{const c=Number.parseInt(s,10);return!Number.isNaN(c)&&String(c)===s?c:s}),o=n.length===0?r:cn(r,n);return o?{start:en(e,o.offset),end:en(e,o.offset+o.length)}:{start:1,end:1}}catch{return{start:1,end:1}}}function en(e,t){return e.substring(0,t).split(`
27
+ `).length}function Dr(e,t){const r=new Map,n=o=>{const i=o.split("/").filter(Boolean);return i.length>0?`/${i[0]}`:"/"};for(const o of e){const i=n(o.path);r.has(i)||r.set(i,{patches1:[],patches2:[]});const s=r.get(i);s&&s.patches1.push(o)}for(const o of t){const i=n(o.path);r.has(i)||r.set(i,{patches1:[],patches2:[]});const s=r.get(i);s&&s.patches2.push(o)}return r}function Mr(e,t,r,n,o,i){const s=new Map,c=new Map,a=new Map,u=[],l=[];for(const v of e){const h=v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(h){const m=h[1];c.has(m)||c.set(m,[]);const f=c.get(m);f&&f.push(v)}else u.push(v)}for(const v of t){const h=v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(h){const m=h[1];a.has(m)||a.set(m,[]);const f=a.get(m);f&&f.push(v)}else l.push(v)}const y=new Set([...c.keys(),...a.keys()]);for(const v of y){const h=q(r,v),m=q(n,v),f=q(o,v);if(!Array.isArray(h)||!Array.isArray(m)||!Array.isArray(f)){const T=c.get(v)||[],F=a.get(v)||[];for(const x of T){const $=x.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if($){const J=$[1];s.has(J)||s.set(J,{patches1:[],patches2:[]});const A=s.get(J);A&&A.patches1.push(x)}}for(const x of F){const $=x.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if($){const J=$[1];s.has(J)||s.set(J,{patches1:[],patches2:[]});const A=s.get(J);A&&A.patches2.push(x)}}continue}const E=He(i,v,r),S=E!=null&&E.items?Array.isArray(E.items)&&E.items[0]?E.items[0]:Array.isArray(E.items)?null:E.items:null,g=S&&typeof S=="object"?S:null;if(g){const T=Br(h,m,f,g);if(T.size>0){const F=new Map,x=new Map,$=new Map;for(const[w,j]of T.entries())j.base!==void 0&&F.set(j.base,w),j.input1!==void 0&&x.set(j.input1,w),j.input2!==void 0&&$.set(j.input2,w);const J=c.get(v)||[],A=a.get(v)||[];for(const w of J){const j=w.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(j){const X=Number.parseInt(j[1],10),re=x.get(X);if(re!==void 0){const le=`${v}#${re}`;s.has(le)||s.set(le,{patches1:[],patches2:[]});const me=s.get(le);me&&me.patches1.push(w)}}}for(const w of A){const j=w.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(j){const X=Number.parseInt(j[1],10),re=$.get(X);if(re!==void 0){const le=`${v}#${re}`;s.has(le)||s.set(le,{patches1:[],patches2:[]});const me=s.get(le);me&&me.patches2.push(w)}}}continue}}const b=c.get(v)||[],D=a.get(v)||[];for(const T of b){const F=T.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(F){const x=F[1];s.has(x)||s.set(x,{patches1:[],patches2:[]});const $=s.get(x);$&&$.patches1.push(T)}}for(const T of D){const F=T.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(F){const x=F[1];s.has(x)||s.set(x,{patches1:[],patches2:[]});const $=s.get(x);$&&$.patches2.push(T)}}}const p=(v,h)=>{if(!h)return null;const m=v.split("/").filter(Boolean);if(m.length<2)return null;const f=`/${m[0]}`,E=He(h,f);return E&&Rt(E)?f:null},d=[...u],L=[...l],N=new Set;for(const v of d){const h=p(v.path,i);h&&N.add(h)}for(const v of L){const h=p(v.path,i);h&&N.add(h)}for(const v of N)s.has(v)||s.set(v,{patches1:[],patches2:[]});for(const v of d){const h=v.path,m=p(h,i);if(m){const f=s.get(m);f&&f.patches1.push(v)}else{s.has(h)||s.set(h,{patches1:[],patches2:[]});const f=s.get(h);f&&f.patches1.push(v)}}for(const v of L){const h=v.path,m=p(h,i);if(m){const f=s.get(m);f&&f.patches2.push(v)}else{s.has(h)||s.set(h,{patches1:[],patches2:[]});const f=s.get(h);f&&f.patches2.push(v)}}return s}function He(e,t,r){if(!e)return null;const n=t.split("/").filter(Boolean);if(n.length===0)return e;let o=e,i="";for(let s=0;s<n.length;s++){const c=n[s],a=Number.parseInt(c,10),u=!Number.isNaN(a)&&String(a)===c;if(o&&Rt(o)){const l=fn(o),y=ot(o),p=r?q(r,i||"/"):void 0;if(l&&l.length>0)if(p!==void 0)try{const{schema:d}=it(p,l,y);o=d}catch{l.length>0&&l[0]&&(o=l[0])}else l.length>0&&l[0]&&(o=l[0])}if(!o)return null;if(u)if(o.items)if(Array.isArray(o.items)){const l=a<o.items.length?o.items[a]:null;o=l&&typeof l=="object"?l:null}else typeof o.items=="object"?o=o.items:o=null;else return null;else if(o.properties&&typeof o.properties=="object"&&!Array.isArray(o.properties))o=o.properties[c]||null;else return null;if(!o)return null;i=i?`${i}/${c}`:`/${c}`}return o}function pn(e){if(!e||typeof e!="object")return[];const t=[];if(e.properties&&typeof e.properties=="object"&&!Array.isArray(e.properties)){const r=e.properties;for(const[o,i]of Object.entries(r))i&&typeof i=="object"&&"const"in i&&t.push(o);for(const[o,i]of Object.entries(r))if(i&&typeof i=="object"){const s=i.format;(s==="uuid"||s==="objectid")&&(t.includes(o)||t.push(o))}const n=["id","uuid","_id","key"];for(const o of n)o in r&&!t.includes(o)&&t.push(o);"type"in r&&!t.includes("type")&&t.push("type"),"name"in r&&!t.includes("name")&&t.push("name")}return t}function xr(e){const t=pn(e);return t.length>0?t[0]:null}function $r(e,t,r){const n=new Map,o=pn(r);if(o.length===0)return n;const i=c=>{if(typeof c!="object"||c===null)return null;const a=c,u=[];for(const l of o){const y=a[l];y!=null&&u.push(`${l}:${JSON.stringify(y)}`)}return u.length>0?u.join("|"):null},s=(c,a)=>{c.forEach((u,l)=>{const y=i(u);if(y){n.has(y)||n.set(y,{});const p=n.get(y);p&&(p[a]=l)}})};return s(e,"input1"),s(t,"input2"),n}function Br(e,t,r,n){const o=new Map,i=xr(n);if(!i)return o;const s=(c,a)=>{c.forEach((u,l)=>{if(typeof u=="object"&&u!==null){const y=u[i];if(y!=null){const p=String(y);o.has(p)||o.set(p,{});const d=o.get(p);d&&(d[a]=l)}}})};return s(e,"base"),s(t,"input1"),s(r,"input2"),o}function dn(e,t,r,n){const o=typeof e=="object"&&e!==null||Array.isArray(e)?e:{},i=typeof t=="object"&&t!==null||Array.isArray(t)?t:{},s=typeof r=="object"&&r!==null||Array.isArray(r)?r:{},c=Je(o,i),a=Je(o,s);let u=Dr(c,a);n&&(u=Mr(c,a,e,t,r,n));const l=[],y=new Set,p=(d,L,N,v)=>{if(!n||typeof L!="object"||L===null||Array.isArray(L)||typeof N!="object"||N===null||Array.isArray(N)||typeof v!="object"||v===null||Array.isArray(v))return!1;const h=He(n,d,L);if(!h||!Rt(h))return!1;const m=fn(h);if(!m||m.length<2)return!1;const f=it(L,m,ot(h)),E=it(N,m,ot(h)),S=it(v,m,ot(h));return E.selectedIndex!==S.selectedIndex&&(f.selectedIndex!==E.selectedIndex||f.selectedIndex!==S.selectedIndex)};for(const[d,{patches1:L,patches2:N}]of u){y.add(d);let v=d;L.length>0?v=L[0].path:N.length>0?v=N[0].path:d.includes("#")&&(v=d.split("#")[0]);let h=d;if(d.includes("#"))h=d.split("#")[0];else{const x=d.split("/").filter(Boolean);x.length>1&&(h=`/${x[0]}`)}if([...L,...N].every(x=>(x.path.split("/").slice(0,2).join("/")||`/${x.path.split("/")[1]}`)===h)&&h!==v){const x=q(e,h),$=q(t,h),J=q(r,h);if(p(h,x,$,J)){const w=x,j=$,X=J;let re=It(w,j,X);!de(w,j)&&!de(w,X)&&!de(j,X)&&(re=M.TRUE_CONFLICT);const le=[...L,...N].filter(Ee=>Ee.path.startsWith(`${h}/`)||Ee.path===h),me=[],_e=[];for(const Ee of le){const K=Ee.path,se=e!==void 0?q(e,K):void 0,te=q(t,K),U=q(r,K);let fe=!1,Te=!1;Ee.op==="replace"?se!==void 0&&(fe=!de(se,te),Te=!de(se,U)):Ee.op==="add"?(fe=se===void 0&&te!==void 0,Te=se===void 0&&U!==void 0):Ee.op==="remove"&&(fe=se!==void 0&&te===void 0,Te=se!==void 0&&U===void 0),se!==void 0&&(te!==void 0&&de(se,te)&&(fe=!1),U!==void 0&&de(se,U)&&(Te=!1)),fe&&me.push(Ee),Te&&_e.push(Ee)}l.push({path:h,baseValue:w,input1Value:j,input2Value:X,conflictType:re,patches1:me,patches2:_e});continue}}const f=q(e,v),E=q(t,v),S=q(r,v);let g=It(f,E,S);const b=f!=null,D=E!=null,T=S!=null;!b&&D&&T&&g!==M.SAME_CHANGE&&(g=M.TRUE_CONFLICT),b&&de(f,E)&&de(f,S)||l.push({path:v,baseValue:f,input1Value:E,input2Value:S,conflictType:g,patches1:L,patches2:N})}return l}function hn(e,t,r){var y,p,d,L;const n=typeof e=="object"&&e!==null||Array.isArray(e)?e:{},o=typeof t=="object"&&t!==null||Array.isArray(t)?t:{},i=Je(n,o);if(i.length===0)return[];const s=[],c=new Set,a=new Map,u=[];for(const N of i){const v=N.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(v){const h=v[1];a.has(h)||a.set(h,[]);const m=a.get(h);m&&m.push(N)}else u.push(N)}for(const[N,v]of a){const h=q(e,N),m=q(t,N);if(!Array.isArray(h)||!Array.isArray(m)){const g=new Map;for(const b of v){const D=b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(D){const T=D[1];g.has(T)||g.set(T,[]),(y=g.get(T))==null||y.push(b)}}for(const[b,D]of g)s.push(...ze(b,D,e,t,void 0)),c.add(b);continue}const f=r?He(r,N,e):null,E=f!=null&&f.items?Array.isArray(f.items)&&f.items[0]?f.items[0]:Array.isArray(f.items)?null:f.items:null,S=E&&typeof E=="object"?E:null;if(S){const g=$r(h,m,S),b=new Map,D=new Map;for(const[$,J]of g.entries())J.input1!==void 0&&b.set(J.input1,$),J.input2!==void 0&&D.set(J.input2,$);const T=new Map,F=[];for(const $ of v){const J=$.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(J){const A=Number.parseInt(J[1],10);let w;if($.op==="add"?w=D.get(A):w=b.get(A),w){T.has(w)||T.set(w,[]);const j=T.get(w);j&&j.push($)}else F.push($)}}for(const[$,J]of T){const A=g.get($);if(!A)continue;const w=A.input1!==void 0?`${N}/${A.input1}`:`${N}/${A.input2}`;s.push(...ze(w,J,e,t,void 0)),c.add(w)}const x=new Map;for(const $ of F){const J=$.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(J){const A=J[1];x.has(A)||x.set(A,[]),(p=x.get(A))==null||p.push($)}}for(const[$,J]of x)c.has($)||(s.push(...ze($,J,e,t,void 0)),c.add($))}else{const g=new Map;for(const b of v){const D=b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(D){const T=D[1];g.has(T)||g.set(T,[]),(d=g.get(T))==null||d.push(b)}}for(const[b,D]of g)s.push(...ze(b,D,e,t,void 0)),c.add(b)}}const l=new Map;for(const N of u){const v=N.path.split("/").filter(Boolean),h=v.length>0?`/${v[0]}`:"/";l.has(h)||l.set(h,[]),(L=l.get(h))==null||L.push(N)}for(const[N,v]of l)s.push(...ze(N,v,e,t,void 0));return s}function ze(e,t,r,n,o){const i=o!==void 0?q(o,e):void 0,s=q(r,e),c=q(n,e),a=[],u=[];for(const f of t){const E=f.path,S=q(r,E),g=q(n,E);let b=!1,D=!1;f.op==="add"?(b=!1,D=g!==void 0):f.op==="remove"?(b=S!==void 0,D=!1):f.op==="replace"&&(b=S!==void 0&&!de(S,g),D=g!==void 0&&!de(S,g)),E===e&&(b=!0,D=!0),b&&a.push(f),D&&u.push(f)}if(a.length===0&&u.length===0&&i!==void 0&&s!==void 0&&c!==void 0&&de(i,s)&&de(i,c))return[];const l=a.length>0?a:t,y=u.length>0?u:t,p=[...l,...y],d=p.some(f=>f.op==="add"),L=p.some(f=>f.op==="remove"),N=p.some(f=>f.op==="replace");if(d&&!N&&!L){if(s!==void 0&&c===void 0)return[{path:e,baseValue:void 0,input1Value:s,input2Value:void 0,conflictType:M.INPUT1_ONLY,patches1:l,patches2:[]}];if(c!==void 0&&s===void 0)return[{path:e,baseValue:void 0,input1Value:void 0,input2Value:c,conflictType:M.INPUT2_ONLY,patches1:[],patches2:y}]}if(L&&!d&&!N){if(s!==void 0&&c===void 0)return[{path:e,baseValue:s,input1Value:s,input2Value:void 0,conflictType:M.INPUT1_ONLY,patches1:l,patches2:[]}];if(c!==void 0&&s===void 0)return[{path:e,baseValue:c,input1Value:void 0,input2Value:c,conflictType:M.INPUT2_ONLY,patches1:[],patches2:y}]}const v=It(i,s,c);let h=[],m=[];switch(v){case M.INPUT1_ONLY:h=l,m=[];break;case M.INPUT2_ONLY:h=[],m=y;break;case M.SAME_CHANGE:h=l,m=y;break;case M.TRUE_CONFLICT:h=l,m=y;break}return[{path:e,baseValue:i,input1Value:s,input2Value:c,conflictType:v,patches1:h,patches2:m}]}function bt(e,t){if(!t||t.length===0)return{start:1,end:1};let r=Number.MAX_SAFE_INTEGER,n=0,o=!1;for(const i of t){const s=Se(e,i.path);s.start===1&&s.end===1||(r=Math.min(r,s.start),n=Math.max(n,s.end),o=!0)}return!o||r===Number.MAX_SAFE_INTEGER||n===0?{start:1,end:1}:{start:r,end:n}}function Fr(e,t,r,n){var i,s,c,a,u,l;const o=[];for(let y=0;y<e.length;y++){const p=e[y];let d,L,N;(((i=p.patches1)==null?void 0:i.length)??0)===0&&(((s=p.patches2)==null?void 0:s.length)??0)===0?(d=t?Se(t,p.path):{start:1,end:1},L=Se(r,p.path),N=Se(n,p.path)):(d=bt(t,[...p.patches1||[],...p.patches2||[]]),L=bt(r,p.patches1||[]),N=bt(n,p.patches2||[]));const v=p.conflictType===M.TRUE_CONFLICT;let h=ne.excluded,m=ne.excluded;switch(p.conflictType){case M.SAME_CHANGE:h=ne.first,m=ne.first;break;case M.INPUT1_ONLY:h=ne.first;break;case M.INPUT2_ONLY:m=ne.first;break;case M.TRUE_CONFLICT:m=ne.first;break}const f=[],E=[];if(p.patches1&&(p.patches1.length??0)>0)for(const g of p.patches1){const b=!t||t.trim()==="";if(g.op==="remove"&&!b)continue;const D=Se(r,g.path);if(D.start!==1||D.end!==1)for(let T=D.start;T<=D.end;T++)f.push({line:T})}else if((((c=p.patches1)==null?void 0:c.length)??0)===0&&(((a=p.patches2)==null?void 0:a.length)??0)===0){const g=Se(r,p.path);(g.start!==1||g.end!==1)&&f.push({line:g.start})}if(p.patches2&&(p.patches2.length??0)>0)for(const g of p.patches2){if(g.op==="remove")continue;const b=Se(n,g.path);if(b.start!==1||b.end!==1)for(let D=b.start;D<=b.end;D++)E.push({line:D})}else if((((u=p.patches1)==null?void 0:u.length)??0)===0&&(((l=p.patches2)==null?void 0:l.length)??0)===0){const g=Se(n,p.path);(g.start!==1||g.end!==1)&&E.push({line:g.start})}const S={id:`conflict-${y}`,path:p.path,baseRange:{startLineNumber:d.start,endLineNumberExclusive:d.end+1},input1Range:{startLineNumber:L.start,endLineNumberExclusive:L.end+1},input2Range:{startLineNumber:N.start,endLineNumberExclusive:N.end+1},input1Diffs:f,input2Diffs:E,isConflicting:v,conflictType:p.conflictType,input1State:h,input2State:m,handled:p.conflictType===M.SAME_CHANGE,focused:!1};o.push(S)}return o}function gn(e,t,r,n={}){const{comparisonMode:o="split",schema:i}=n;if(!t||!r)throw new Error("JSON Patch diff requires non-empty input1 and input2 strings");try{const s=e?JSON.parse(e):void 0,c=JSON.parse(t),a=JSON.parse(r);let u;if(s===void 0)u=hn(c,a,i);else if(o==="split")u=dn(s,c,a,i);else{const l=Je(s,c),y=Je(c,a),p=new Set;l.forEach(d=>{p.add(d.path)}),y.forEach(d=>{p.add(d.path)}),u=Array.from(p).map(d=>{const L=q(s,d),N=q(c,d),v=q(a,d),h=!de(L,N),m=!de(N,v);let f;return h&&m?f=M.TRUE_CONFLICT:h?f=M.INPUT1_ONLY:m?f=M.INPUT2_ONLY:f=M.SAME_CHANGE,{path:d,baseValue:L,input1Value:N,input2Value:v,conflictType:f}})}return Fr(u,e,t,r)}catch(s){const c=s instanceof Error?s.message:String(s);throw new Error(`JSON Patch diff computation failed: ${c}`)}}function mn(e,t,r){const n=e!==t,o=e!==r;let i;return n&&o?t===r?i=M.SAME_CHANGE:i=M.TRUE_CONFLICT:n?i=M.INPUT1_ONLY:i=M.INPUT2_ONLY,{conflictType:i,input1Changed:n,input2Changed:o}}function Ur(e,t,r){var u,l,y;const n=[],o=[];for(let p=0;p<Math.max(e.length,t.length,r.length);p++){const d=e[p]!==void 0?e[p]:"",L=t[p]!==void 0?t[p]:"",N=r[p]!==void 0?r[p]:"",{conflictType:v,input1Changed:h,input2Changed:m}=mn(d,L,N);(h||m)&&o.push({line:p+1,input1Changed:h,input2Changed:m,baseLine:d,input1Line:L,input2Line:N,conflictType:v})}if(o.length===0)return[];let i=((u=o[0])==null?void 0:u.line)??1,s=(l=o[0])==null?void 0:l.conflictType,c=[],a=[];for(let p=0;p<=o.length;p++){const d=o[p],L=p===o.length,N=!L&&d&&o[p-1]&&d.line>(((y=o[p-1])==null?void 0:y.line)??0)+1,v=!L&&d&&d.conflictType!==s;if(L||N||v){const h=o[p-1],m=h?h.line+1:i+1,f=c.length>0,E=a.length>0,S=s===M.TRUE_CONFLICT,g={id:`conflict-${n.length}`,baseRange:{startLineNumber:i,endLineNumberExclusive:m},input1Range:{startLineNumber:i,endLineNumberExclusive:m},input2Range:{startLineNumber:i,endLineNumberExclusive:m},input1Diffs:c,input2Diffs:a,isConflicting:S,conflictType:s,input1State:s===M.SAME_CHANGE&&f?ne.first:ne.excluded,input2State:E?ne.first:ne.excluded,handled:s===M.SAME_CHANGE,focused:!1};n.push(g),!L&&d&&(i=d.line,s=d.conflictType,c=[],a=[])}!L&&d&&(d.input1Changed&&c.push({line:d.line}),d.input2Changed&&a.push({line:d.line}))}return n}function Vr(e,t,r){if(!t||t==="/"){if(typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof r=="object"&&r!==null&&!Array.isArray(r)){Object.assign(e,r);return}throw new Error(`Cannot assign root value: expected object, got ${typeof r}`)}const n=t.split("/").filter(c=>c!=="");let o=e;for(let c=0;c<n.length-1;c++){const a=n[c],u=Number.parseInt(a,10);if(!Number.isNaN(u)&&String(u)===a){if(!Array.isArray(o))throw new Error(`Path ${t}: segment ${a} expects array but got ${typeof o}`);o=o[u]}else{if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Path ${t}: segment ${a} expects object but got ${typeof o}`);const l=o;a in l||(l[a]={}),o=l[a]}}const i=n[n.length-1],s=Number.parseInt(i,10);if(!Number.isNaN(s)&&String(s)===i){if(!Array.isArray(o))throw new Error(`Path ${t}: last segment expects array but got ${typeof o}`);o[s]=r}else{if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`Path ${t}: last segment expects object but got ${typeof o}`);o[i]=r}}function Jr(e,t){try{const r=sn(e);if(!r)return null;const n=t.split("/").filter(l=>l!=="").map(l=>{const y=Number.parseInt(l,10);return!Number.isNaN(y)&&String(y)===l?y:l}),o=cn(r,n);if(!o)return null;const s=e.substring(0,o.offset).split(`
28
28
  `).length,c=o.offset+o.length,u=e.substring(0,c).split(`
29
29
  `).length;return{startLine:s,endLine:u}}catch{return null}}function yn(e,t,r,n=""){if(JSON.stringify(e)===JSON.stringify(t))return e;if(e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&!Array.isArray(e)&&!Array.isArray(t)){const o=e,i=t,s={...o},c=r?He(r,n,e):null,a=c!=null&&c.properties&&typeof c.properties=="object"&&!Array.isArray(c.properties)?c.properties:void 0,u=c==null?void 0:c.additionalProperties;for(const l of Object.keys(i))if(l in s){if(JSON.stringify(s[l])!==JSON.stringify(i[l])){const y=a==null?void 0:a[l],p=n?`${n}/${l}`:`/${l}`,d=yn(s[l],i[l],y,p);if(d!==null)s[l]=d;else return null}}else if(u===!0||u===void 0||(a==null?void 0:a[l])!==void 0)s[l]=i[l];else{if(u===!1)return null;if(typeof u=="object")s[l]=i[l];else return null}return s}return null}function Hr(e,t,r,n,o){var S;const i=[],s=[],c=e.join(`
30
30
  `),a=t.join(`
31
31
  `),u=r.join(`
32
- `);let l,y,p;try{l=c?JSON.parse(c):{},y=a?JSON.parse(a):{},p=u?JSON.parse(u):{}}catch(g){return{content:c||"",isValid:!1,validationError:`Failed to parse input JSON: ${g instanceof Error?g.message:String(g)}`,warnings:i}}let d;!l||typeof l=="object"&&l!==null&&Object.keys(l).length===0?d=JSON.parse(JSON.stringify(p)):d=JSON.parse(JSON.stringify(l));const L=new Set,E=new Set,v=new Set,h=(g,b,D)=>null;for(const g of n){const b=g.input1State===ne.first||g.input1State===ne.second,D=g.input2State===ne.first||g.input2State===ne.second;let N=g.path;if(!N&&(N=h(g.baseRange.startLineNumber,g.baseRange.endLineNumberExclusive)||void 0,!N)){g.conflictType===x.INPUT2_ONLY&&D?d=JSON.parse(JSON.stringify(p)):g.conflictType===x.INPUT1_ONLY&&b?d=JSON.parse(JSON.stringify(y)):g.conflictType===x.SAME_CHANGE&&(b||D)||D?d=JSON.parse(JSON.stringify(p)):b&&(d=JSON.parse(JSON.stringify(y)));continue}try{let F,M=N;const $=(S=g.path)==null?void 0:S.match(/^(.*\/\d+)(?:\/.*)?$/);let J=!1,A="";if($){const j=$[1].split("/").filter(C=>C!=="");if(j.length>=2){const C=j[j.length-1];/^\d+$/.test(C)&&(J=!0,A=`/${j.slice(0,-1).join("/")}`)}}if(b&&D)if(g.conflictType===x.SAME_CHANGE)J?(F=q(p,A),M=A):F=q(p,N);else{const w=J?A:N,j=q(y,w),C=q(p,w),re=o&&l&&typeof l=="object"&&He(o,w,l)||void 0,le=yn(j,C,re,w);le!==null?(F=le,M=w,i.push(`Smart-merged conflict at path ${w}`)):(F=C,M=w,i.push(`Merge failed at path ${w}, using input2 value`))}else if(b)if(J)F=q(y,A),M=A;else{const w=N.split("/").filter(Boolean);if(w.length>1){const j=`/${w.slice(0,-1).join("/")}`;if(!v.has(j)){const C=q(y,j);if(typeof C=="object"&&C!==null&&!Array.isArray(C)){const re=q(d,j);if(typeof re=="object"&&re!==null&&!Array.isArray(re)){for(const[le,ge]of Object.entries(C)){const _e=`${j}/${le}`;E.has(_e)||(re[le]=ge)}v.add(j)}}}F=q(y,N)}else F=q(y,N)}else if(D)if(J)F=q(p,A),M=A;else{const w=N.split("/").filter(Boolean);if(w.length>1){const j=`/${w.slice(0,-1).join("/")}`;if(!v.has(j)){const C=q(p,j);if(typeof C=="object"&&C!==null&&!Array.isArray(C)){const re=q(d,j);if(typeof re=="object"&&re!==null&&!Array.isArray(re)){for(const[le,ge]of Object.entries(C)){const _e=`${j}/${le}`;E.has(_e)||(re[le]=ge)}v.add(j)}}}F=q(p,N)}else F=q(p,N)}else{const w=J?A:N,j=q(l,w);if(j!==void 0)F=j,M=w;else continue}F!==void 0&&(Vr(d,M,F),L.add(M),E.add(M))}catch(F){i.push(`Failed to apply conflict at path ${N||g.id}: ${F instanceof Error?F.message:String(F)}`)}}const m=JSON.stringify(d,null,2);for(const g of n){const b=g.path;if(!b)continue;const D=g.input1State===ne.first||g.input1State===ne.second,N=g.input2State===ne.first||g.input2State===ne.second;if(D&&N&&g.conflictType===x.TRUE_CONFLICT){const F=Jr(m,b);F&&s.push({conflictId:g.id,conflictPath:b,type:"warning",message:"Both conflicting changes were accepted - please review and manually resolve",startLine:F.startLine,endLine:F.endLine})}}let f=!0,T;try{JSON.parse(m)}catch(g){f=!1,T=g instanceof Error?g.message:"Invalid JSON",s.push({conflictId:"validation-error",conflictPath:"/",type:"error",message:T,startLine:1,endLine:m.split(`
33
- `).length})}return{content:m,isValid:f,validationError:T,warnings:i.length>0?i:void 0,conflictIssues:s.length>0?s:void 0}}function Gr(e,t,r){let n="",o="",i="",s="",c="",a="",u="",l="";switch(e.conflictType){case x.SAME_CHANGE:{const y=e.baseRange.startLineNumber===1&&e.baseRange.endLineNumberExclusive===2&&e.input1Range.startLineNumber!==1&&e.input2Range.startLineNumber!==1;t?y?(n="merge-2way-deletion",o="merge-same-change",s=r.baseOverviewColor,c=r.changeOverviewColor,a="",u="-",l="+"):(n="merge-2way-deletion",o="merge-same-change",i="merge-change-base",s=r.baseOverviewColor,c=r.changeOverviewColor,a="",u="-",l=""):y?(n="merge-same-change",o="merge-same-change",i="",s=r.changeOverviewColor,c=r.changeOverviewColor,a="",u="+",l="+"):(n="merge-change-incoming",o="merge-same-change",i="merge-change-base",s=r.changeOverviewColor,c=r.changeOverviewColor,a=r.baseOverviewColor,u="",l="");break}case x.INPUT1_ONLY:t?(n="merge-2way-deletion",o="",s=r.baseOverviewColor,c="",u="-",l=""):(n="merge-change-incoming",o="",i="merge-change-base",s=r.conflictOverviewColor,c="",a=r.baseOverviewColor,u="-",l="");break;case x.INPUT2_ONLY:n="",o="merge-change-current",i=t?"":"merge-change-base",s="",c=r.changeOverviewColor,a=t?"":r.baseOverviewColor,u="",l="+";break;case x.TRUE_CONFLICT:{const y=e.baseRange.startLineNumber===1&&e.baseRange.endLineNumberExclusive===2&&e.input1Range.startLineNumber!==1&&e.input2Range.startLineNumber!==1;t?y?(n="merge-2way-deletion",o="merge-change-current",s=r.baseOverviewColor,c=r.changeOverviewColor,a="",u="-",l="+"):(n="merge-2way-deletion",o="merge-conflict-current",i="merge-conflict-base",s=r.baseOverviewColor,c=r.conflictOverviewColor,a=r.baseOverviewColor,u="-",l="+"):y?(n="merge-change-incoming",o="merge-change-current",i="",s=r.changeOverviewColor,c=r.changeOverviewColor,a="",u="+",l="+"):(n="merge-conflict-incoming",o="merge-conflict-current",i="merge-conflict-base",s=r.conflictOverviewColor,c=r.conflictOverviewColor,a=r.baseOverviewColor,u="",l="");break}}return{input1Class:n,input2Class:o,baseClass:i,input1OverviewColor:s,input2OverviewColor:c,baseOverviewColor:a,input1Symbol:u,input2Symbol:l}}function vn(e){const t=new Set;for(const r of e)if(r&&typeof r=="object"&&"line"in r){const n=r.line;n>0&&t.add(n)}return Array.from(t).sort((r,n)=>r-n)}function Wr(e,t,r){const n=[];if(e.input1Diffs.length>0&&t.input1Class){const o=vn(e.input1Diffs);for(const i of o)n.push({range:new r.Range(i,1,i,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.input1Class,linesDecorationsClassName:t.input1Symbol&&t.input1Symbol!==""?`diff-symbol diff-symbol-${t.input1Symbol==="+"?"plus":"minus"}`:void 0,overviewRuler:t.input1OverviewColor?{color:t.input1OverviewColor,position:r.editor.OverviewRulerLane.Full}:void 0,minimap:t.input1OverviewColor?{color:t.input1OverviewColor,position:r.editor.MinimapPosition.Inline}:void 0}})}return n}function qr(e,t,r){const n=[];if(e.input2Diffs.length>0&&t.input2Class){const o=vn(e.input2Diffs);for(const i of o)n.push({range:new r.Range(i,1,i,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.input2Class,linesDecorationsClassName:t.input2Symbol&&t.input2Symbol!==""?`diff-symbol diff-symbol-${t.input2Symbol==="+"?"plus":"minus"}`:void 0,overviewRuler:t.input2OverviewColor?{color:t.input2OverviewColor,position:r.editor.OverviewRulerLane.Full}:void 0,minimap:t.input2OverviewColor?{color:t.input2OverviewColor,position:r.editor.MinimapPosition.Inline}:void 0}})}return n}function Yr(e,t,r){const n=[],o=e.baseRange.startLineNumber===1&&e.baseRange.endLineNumberExclusive===2;return(e.input1Diffs.length>0||e.input2Diffs.length>0)&&!o&&n.push({range:new r.Range(e.baseRange.startLineNumber,1,e.baseRange.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.baseClass,overviewRuler:{color:t.baseOverviewColor,position:r.editor.OverviewRulerLane.Full},minimap:{color:t.baseOverviewColor,position:r.editor.MinimapPosition.Inline}}}),n}function zr(e,t,r,n){const o=Gr(e,t,r);return{input1Decorations:Wr(e,o,n),input2Decorations:qr(e,o,n),baseDecorations:Yr(e,o,n)}}function Xr(e,t,r,n){const o=[],i=[],s=[];for(const c of e){const a=zr(c,t,r,n);o.push(...a.input1Decorations),i.push(...a.input2Decorations),s.push(...a.baseDecorations)}return{input1Decorations:o,input2Decorations:i,baseDecorations:s}}const Cr=()=>Xe.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#888"},children:"Loading Monaco Editor..."}),Ot="⚠";function Qr(e){const{original:t="",modified:r="",base:n="",theme:o="vs",options:i={},width:s="100%",height:c="100%",className:a,loading:u,onMount:l,onMergeResolve:y,showResultColumn:p,baseIndex:d=1,comparisonMode:L="split",schema:E,patches:v,labels:h}=e,m=n?p:!1,f=!n||n==="",T="json",[S,g]=P.useState(!1),[b,D]=P.useState(!0),[N,F]=P.useState([]),[M,$]=P.useState(null),[J,A]=P.useState([]),[w,j]=P.useState([]),[C,re]=P.useState(!1),le=P.useRef(""),ge=P.useCallback((k,O,I,B)=>{const R=document.createElement("div");R.className="native-checkbox-container";const V=document.createElement("input");return V.type="checkbox",V.className="native-checkbox",V.checked=k===ne.first||k===ne.second,V.setAttribute("aria-label",V.checked?"Undo accept":"Accept change"),V.addEventListener("click",Q=>{Q.preventDefault(),Q.stopPropagation(),requestAnimationFrame(()=>{B()})}),R.appendChild(V),R},[]),[_e,Ee]=P.useState(0),K=P.useRef(null),se=P.useRef(null),te=P.useRef(null),U=P.useRef(null),fe=P.useRef(null),Te=P.useRef(null),Pe=P.useRef(!1),pt=P.useRef(!1),De=P.useRef(null),Ge=P.useRef(null),Le=P.useRef(null),Me=P.useRef(new Map),Ie=P.useRef(null),xe=P.useRef(null),$e=P.useRef(null),Be=P.useRef(null);P.useEffect(()=>{let k=!0;const O=ur.init();return O.then(I=>{k&&(fe.current=I,D(!1),g(!0))}).catch(I=>{k&&(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)}),()=>{k=!1,Pe.current||O.cancel()}},[]);const jt=P.useCallback((k,O,I)=>{if(!fe.current)return[];const B=(k==null?void 0:k.getValue())||"",R=O.getValue(),V=I.getValue();try{const Q=performance.now(),z=gn(B,R,V,{comparisonMode:L,schema:E,patches:v}),_=performance.now()-Q;return _>100&&console.warn(`JSON Patch diff took ${_.toFixed(2)}ms`),z}catch(Q){const z=Q instanceof Error?Q.message:String(Q);return console.error("JSON Patch diff error:",z),[]}},[L,E,v]),We=P.useCallback(k=>{try{return k.getLayoutInfo().decorationsLeft||0}catch{return 0}},[]),qe=P.useCallback(k=>{try{return k.getLayoutInfo().decorationsWidth||0}catch{return 0}},[]),et=P.useCallback(k=>{if(!m||!U.current||!Le.current)return;const O=fe.current;if(!O)return;const I=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),B=We(U.current),R=qe(U.current);Le.current.style.left=`${B}px`,Le.current.style.width=`${R}px`;const V=U.current.getScrollTop();if(U.current.getModel()){Le.current.innerHTML="";for(const z of k){const _=z.startLine,ue=z.endLine,Z=U.current.getTopForLineNumber(_)-V,G=U.current.getTopForLineNumber(ue)-V,H=U.current.getOption(O.editor.EditorOption.lineHeight),oe=ue>_?G-Z+H:H,W=document.createElement("div");W.className=`conflict-issue-marker conflict-issue-${z.type}`,W.setAttribute("data-conflict-id",z.conflictId),W.setAttribute("data-issue-type",z.type),W.title=z.message,W.style.position="absolute",W.style.top=`${Math.max(0,Z)}px`,W.style.height=`${oe}px`,W.style.width="26px",W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.cursor="help",W.style.pointerEvents="auto";const ie=document.createElement("div");ie.className="issue-icon",z.type==="error"?(ie.textContent="✗",ie.style.color=I?"#ff6666":"#cc0000"):z.type==="warning"?(ie.textContent=Ot,ie.style.color=I?"#ffaa00":"#ff8800"):z.type==="smart-merge"&&(ie.textContent="↕",ie.style.color=I?"#0096ff":"#0078d4"),ie.style.fontSize="14px",ie.style.fontWeight="bold",W.appendChild(ie),Le.current.appendChild(W)}}},[m,o,We,qe]),tt=P.useCallback(k=>{var ce,oe,W,ie;if(!U.current||C)return;const O=U.current.getModel(),I=(ce=K.current)==null?void 0:ce.getModel(),B=(oe=te.current)==null?void 0:oe.getModel(),R=(W=se.current)==null?void 0:W.getModel();if(!O||!I||!B||!R)return;const V=R.getLinesContent(),Q=I.getLinesContent(),z=B.getLinesContent(),_=Hr(V,Q,z,k,E);if($(_.isValid?null:_.validationError||"Invalid JSON"),A(_.warnings||[]),j(_.conflictIssues||[]),Ie.current){const X=(h==null?void 0:h.result)||"Result";_.isValid?_.warnings&&_.warnings.length>0?(Ie.current.textContent=`${X} ${Ot}`,Ie.current.title=_.warnings.join(`
34
- `)):(Ie.current.textContent=X,Ie.current.style.color="",Ie.current.title=""):(Ie.current.textContent=`${X} ${Ot} Invalid JSON`,Ie.current.style.color="#ff4444",Ie.current.title=_.validationError||"Invalid JSON - please fix manually")}if(O.getValue()!==_.content){const X=U.current.getPosition(),Y=U.current.getSelection();if(pt.current=!0,O.setValue(_.content),pt.current=!1,X){const de=O.getLineCount(),ee=O.getLineLength(de),ve={lineNumber:Math.min(X.lineNumber,de),column:X.lineNumber<=de?Math.min(X.column,O.getLineLength(X.lineNumber)+1):ee+1};U.current.setPosition(ve),Y&&!Y.isEmpty()&&U.current.setSelection(Y)}}const Z=fe.current,G=O;let H=G._invalidDecorations;if(!_.isValid&&U.current&&Z?(H||(H=U.current.createDecorationsCollection([]),G._invalidDecorations=H),H.set([{range:new Z.Range(1,1,O.getLineCount(),Number.MAX_SAFE_INTEGER),options:{isWholeLine:!1,className:"merge-result-invalid",hoverMessage:{value:_.validationError||"Invalid JSON - please fix manually"}}}])):_.isValid&&H&&U.current&&H.set([]),_.conflictIssues&&_.conflictIssues.length>0){if(et(_.conflictIssues),U.current&&Z){const X=O;if(!X._conflictIssueDecorations){const ee=U.current.createDecorationsCollection([]);X._conflictIssueDecorations=ee}const Y=X._conflictIssueDecorations,de=_.conflictIssues.map(ee=>{let ve,Ae;return ee.type==="error"?(ve=o==="vs-dark"?"rgba(255, 0, 0, 0.1)":"rgba(255, 0, 0, 0.05)",Ae=o==="vs-dark"?"#ff6666":"#cc0000"):ee.type==="warning"?(ve=o==="vs-dark"?"rgba(255, 170, 0, 0.1)":"rgba(255, 136, 0, 0.05)",Ae=o==="vs-dark"?"#ffaa00":"#ff8800"):(ve=o==="vs-dark"?"rgba(0, 150, 255, 0.1)":"rgba(0, 120, 212, 0.05)",Ae=o==="vs-dark"?"#0096ff":"#0078d4"),{range:new Z.Range(ee.startLine,1,ee.endLine,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:`conflict-issue-line conflict-issue-${ee.type}`,linesDecorationsClassName:`conflict-issue-line-decoration conflict-issue-${ee.type}`,backgroundColor:ve,overviewRuler:{color:Ae,position:Z.editor.OverviewRulerLane.Right},minimap:{color:Ae,position:Z.editor.MinimapPosition.Inline}}}});Y.set(de)}}else if(U.current){const X=O;X._conflictIssueDecorations&&X._conflictIssueDecorations.set([]),Le.current&&m&&(Le.current.innerHTML="")}if(y){const X=`${_.content}|${_.isValid}|${(ie=_.warnings)==null?void 0:ie.join(",")}`;le.current!==X&&(le.current=X,queueMicrotask(()=>{y(_.content,{isValid:_.isValid,validationError:_.validationError,warnings:_.warnings,conflictIssues:_.conflictIssues})}))}},[y,E,h,o,et,m,C]),dt=P.useCallback((k,O)=>{re(!1),F(I=>{const B=I.map(R=>{if(R.id!==k)return R;const Q=(O===1?R.input1State:R.input2State)===ne.excluded?ne.first:ne.excluded;return O===1?{...R,input1State:Q}:{...R,input2State:Q}});return m&&U.current&&tt(B),B})},[m,tt]),ht=P.useCallback((k,O,I,B,R,V,Q)=>{if(!fe.current)return;const _=B===1?K.current:te.current;if(!_)return;const ue=B===1?I.input1Range:I.input2Range,Z=B===1?I.input1State:I.input2State,G=_.getModel();if(!G)return;const H=G.getLineCount(),ce=Math.max(1,Math.min(ue.startLineNumber,H)),oe=Math.max(1,Math.min(ue.endLineNumberExclusive-1,H));if(ce>H||oe<1||ce>oe)return;const W=_.getTopForLineNumber(ce)-R,X=_.getBottomForLineNumber(oe)-R-W;let Y=Me.current.get(O);if(!Y){Y=document.createElement("div"),Y.className="merge-accept-gutter-marker";const he=document.createElement("div");he.className="background",Y.appendChild(he);const pe=document.createElement("div");pe.className="checkbox";const me=document.createElement("div");me.className="checkbox-background";const Ne=ge(Z,B,I.id,()=>dt(I.id,B));me.appendChild(Ne),pe.appendChild(me),Y.appendChild(pe),k.appendChild(Y),Me.current.set(O,Y)}Y.style.top=`${W}px`,Y.style.height=`${X}px`;const de=Y.querySelector(".checkbox-background");if(de){de.innerHTML="";const he=ge(Z,B,I.id,()=>dt(I.id,B));de.appendChild(he)}const ee=I.handled,ve=I.focused,Ae=X>30;Y.className="merge-accept-gutter-marker",ee&&Y.classList.add("handled"),ve&&Y.classList.add("focused"),Ae?Y.classList.add("multi-line"):Y.classList.add("single-line");const Oe=Y.querySelector(".checkbox");if(Oe){const pe=X/2-12,me=24;let Ne=pe;const bn=me,On=V-me-24,Ut=me,Vt=X-24-me;Ut<Vt&&(Ne=Math.max(bn,Math.min(Ne+W,On))-W,Ne=Math.max(Ut,Math.min(Ne,Vt))),Oe.style.top=`${Ne+5}px`}},[dt,ge]),nt=P.useCallback(()=>{if(!m){const G=Me.current;for(const[H,ce]of G.entries())ce.remove(),G.delete(H);return}if(!K.current||!te.current||!De.current||!Ge.current||!fe.current)return;const O=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),I=We(K.current),B=qe(K.current),R=We(te.current),V=qe(te.current);De.current.style.left=`${I}px`,De.current.style.width=`${B}px`,Ge.current.style.left=`${R}px`,Ge.current.style.width=`${V}px`;const Q=K.current.getVisibleRanges();if(!Q||Q.length===0)return;const z=K.current.getScrollTop(),_=De.current.clientHeight,ue=new Set;for(const G of N)if(!(G.input1Diffs.length===0&&G.input2Diffs.length===0)){if(G.input1Diffs.length>0){const H=`${G.id}-input1`;ue.add(H),ht(De.current,H,G,1,z,_,O)}if(G.input2Diffs.length>0){const H=`${G.id}-input2`;ue.add(H),ht(Ge.current,H,G,2,z,_,O)}}const Z=Me.current;for(const[G,H]of Z.entries())ue.has(G)||(H.remove(),Z.delete(G))},[N,o,m,We,qe,ht]),be=P.useCallback((k,O)=>{var I,B,R;try{if(fe.current){const V=(B=(I=fe.current.editor).getTheme)==null?void 0:B.call(I);if((R=V==null?void 0:V.colors)!=null&&R[k])return V.colors[k]}}catch{}return O},[]),Dt=P.useCallback(()=>{if(!fe.current||!K.current||!te.current)return;const k=fe.current,O=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),I=be("mergeEditor.change.background",O?"rgba(255, 166, 0, 0.2)":"rgba(255, 166, 0, 0.15)"),B=be("diffEditor.insertedTextBackground",O?"rgba(155, 185, 85, 0.2)":"rgba(155, 185, 85, 0.15)"),R=be("mergeEditor.changeBase.background",O?"rgba(255, 100, 100, 0.2)":"rgba(255, 100, 100, 0.15)"),V=be("editorOverviewRuler.modifiedForeground",O?"rgba(255, 166, 0, 0.8)":"rgba(255, 166, 0, 1)"),Q=be("editorOverviewRuler.addedForeground",O?"rgba(155, 185, 85, 0.8)":"rgba(155, 185, 85, 1)"),z=be("editorOverviewRuler.deletedForeground",O?"rgba(255, 100, 100, 0.8)":"rgba(255, 100, 100, 1)"),_=f,ue={conflictOverviewColor:V,changeOverviewColor:Q,baseOverviewColor:z},{input1Decorations:Z,input2Decorations:G,baseDecorations:H}=Xr(N,_,ue,k),ce=be("input.background",O?"#3c3c3c":"#f3f3f3"),oe=be("input.border",O?"#6b6b6b":"#c8c8c8"),W=be("focusBorder",O?"#007acc":"#0078d4"),ie=be("inputOption.activeForeground",O?"#3794ff":"#0078d4"),X="monaco-three-way-diff-dynamic";let Y=document.getElementById(X);Y||(Y=document.createElement("style"),Y.id=X,document.head.appendChild(Y));const de=be("diffEditor.insertedTextBackground",O?"rgba(100, 100, 255, 0.15)":"rgba(100, 100, 255, 0.1)"),ee=be("diffEditor.insertedTextBackground",O?"rgba(155, 185, 85, 0.2)":"rgba(155, 185, 85, 0.15)");Y.textContent=`
32
+ `);let l,y,p;try{l=c?JSON.parse(c):{},y=a?JSON.parse(a):{},p=u?JSON.parse(u):{}}catch(g){return{content:c||"",isValid:!1,validationError:`Failed to parse input JSON: ${g instanceof Error?g.message:String(g)}`,warnings:i}}let d;!l||typeof l=="object"&&l!==null&&Object.keys(l).length===0?d=JSON.parse(JSON.stringify(p)):d=JSON.parse(JSON.stringify(l));const L=new Set,N=new Set,v=new Set,h=(g,b,D)=>null;for(const g of n){const b=g.input1State===ne.first||g.input1State===ne.second,D=g.input2State===ne.first||g.input2State===ne.second;let T=g.path;if(!T&&(T=h(g.baseRange.startLineNumber,g.baseRange.endLineNumberExclusive)||void 0,!T)){g.conflictType===M.INPUT2_ONLY&&D?d=JSON.parse(JSON.stringify(p)):g.conflictType===M.INPUT1_ONLY&&b?d=JSON.parse(JSON.stringify(y)):g.conflictType===M.SAME_CHANGE&&(b||D)||D?d=JSON.parse(JSON.stringify(p)):b&&(d=JSON.parse(JSON.stringify(y)));continue}try{let F,x=T;const $=(S=g.path)==null?void 0:S.match(/^(.*\/\d+)(?:\/.*)?$/);let J=!1,A="";if($){const j=$[1].split("/").filter(X=>X!=="");if(j.length>=2){const X=j[j.length-1];/^\d+$/.test(X)&&(J=!0,A=`/${j.slice(0,-1).join("/")}`)}}if(b&&D)if(g.conflictType===M.SAME_CHANGE)J?(F=q(p,A),x=A):F=q(p,T);else{const w=J?A:T,j=q(y,w),X=q(p,w),re=o&&l&&typeof l=="object"&&He(o,w,l)||void 0,le=yn(j,X,re,w);le!==null?(F=le,x=w,i.push(`Smart-merged conflict at path ${w}`)):(F=X,x=w,i.push(`Merge failed at path ${w}, using input2 value`))}else if(b)if(J)F=q(y,A),x=A;else{const w=T.split("/").filter(Boolean);if(w.length>1){const j=`/${w.slice(0,-1).join("/")}`;if(!v.has(j)){const X=q(y,j);if(typeof X=="object"&&X!==null&&!Array.isArray(X)){const re=q(d,j);if(typeof re=="object"&&re!==null&&!Array.isArray(re)){for(const[le,me]of Object.entries(X)){const _e=`${j}/${le}`;N.has(_e)||(re[le]=me)}v.add(j)}}}F=q(y,T)}else F=q(y,T)}else if(D)if(J)F=q(p,A),x=A;else{const w=T.split("/").filter(Boolean);if(w.length>1){const j=`/${w.slice(0,-1).join("/")}`;if(!v.has(j)){const X=q(p,j);if(typeof X=="object"&&X!==null&&!Array.isArray(X)){const re=q(d,j);if(typeof re=="object"&&re!==null&&!Array.isArray(re)){for(const[le,me]of Object.entries(X)){const _e=`${j}/${le}`;N.has(_e)||(re[le]=me)}v.add(j)}}}F=q(p,T)}else F=q(p,T)}else{const w=J?A:T,j=q(l,w);if(j!==void 0)F=j,x=w;else continue}F!==void 0&&(Vr(d,x,F),L.add(x),N.add(x))}catch(F){i.push(`Failed to apply conflict at path ${T||g.id}: ${F instanceof Error?F.message:String(F)}`)}}const m=JSON.stringify(d,null,2);for(const g of n){const b=g.path;if(!b)continue;const D=g.input1State===ne.first||g.input1State===ne.second,T=g.input2State===ne.first||g.input2State===ne.second;if(D&&T&&g.conflictType===M.TRUE_CONFLICT){const F=Jr(m,b);F&&s.push({conflictId:g.id,conflictPath:b,type:"warning",message:"Both conflicting changes were accepted - please review and manually resolve",startLine:F.startLine,endLine:F.endLine})}}let f=!0,E;try{JSON.parse(m)}catch(g){f=!1,E=g instanceof Error?g.message:"Invalid JSON",s.push({conflictId:"validation-error",conflictPath:"/",type:"error",message:E,startLine:1,endLine:m.split(`
33
+ `).length})}return{content:m,isValid:f,validationError:E,warnings:i.length>0?i:void 0,conflictIssues:s.length>0?s:void 0}}function Gr(e,t,r){let n="",o="",i="",s="",c="",a="",u="",l="";switch(e.conflictType){case M.SAME_CHANGE:{const y=e.baseRange.startLineNumber===1&&e.baseRange.endLineNumberExclusive===2&&e.input1Range.startLineNumber!==1&&e.input2Range.startLineNumber!==1;t?y?(n="merge-2way-deletion",o="merge-same-change",s=r.baseOverviewColor,c=r.changeOverviewColor,a="",u="-",l="+"):(n="merge-2way-deletion",o="merge-same-change",i="merge-change-base",s=r.baseOverviewColor,c=r.changeOverviewColor,a="",u="-",l=""):y?(n="merge-same-change",o="merge-same-change",i="",s=r.changeOverviewColor,c=r.changeOverviewColor,a="",u="+",l="+"):(n="merge-change-incoming",o="merge-same-change",i="merge-change-base",s=r.changeOverviewColor,c=r.changeOverviewColor,a=r.baseOverviewColor,u="",l="");break}case M.INPUT1_ONLY:t?(n="merge-2way-deletion",o="",s=r.baseOverviewColor,c="",u="-",l=""):(n="merge-change-incoming",o="",i="merge-change-base",s=r.conflictOverviewColor,c="",a=r.baseOverviewColor,u="-",l="");break;case M.INPUT2_ONLY:n="",o="merge-change-current",i=t?"":"merge-change-base",s="",c=r.changeOverviewColor,a=t?"":r.baseOverviewColor,u="",l="+";break;case M.TRUE_CONFLICT:{const y=e.baseRange.startLineNumber===1&&e.baseRange.endLineNumberExclusive===2&&e.input1Range.startLineNumber!==1&&e.input2Range.startLineNumber!==1;t?y?(n="merge-2way-deletion",o="merge-change-current",s=r.baseOverviewColor,c=r.changeOverviewColor,a="",u="-",l="+"):(n="merge-2way-deletion",o="merge-conflict-current",i="merge-conflict-base",s=r.baseOverviewColor,c=r.conflictOverviewColor,a=r.baseOverviewColor,u="-",l="+"):y?(n="merge-change-incoming",o="merge-change-current",i="",s=r.changeOverviewColor,c=r.changeOverviewColor,a="",u="+",l="+"):(n="merge-conflict-incoming",o="merge-conflict-current",i="merge-conflict-base",s=r.conflictOverviewColor,c=r.conflictOverviewColor,a=r.baseOverviewColor,u="",l="");break}}return{input1Class:n,input2Class:o,baseClass:i,input1OverviewColor:s,input2OverviewColor:c,baseOverviewColor:a,input1Symbol:u,input2Symbol:l}}function vn(e){const t=new Set;for(const r of e)if(r&&typeof r=="object"&&"line"in r){const n=r.line;n>0&&t.add(n)}return Array.from(t).sort((r,n)=>r-n)}function Wr(e,t,r){const n=[];if(t.input1Class){if(e.input1Diffs.length>0){const o=vn(e.input1Diffs);for(const i of o)n.push({range:new r.Range(i,1,i,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.input1Class,linesDecorationsClassName:t.input1Symbol&&t.input1Symbol!==""?`diff-symbol diff-symbol-${t.input1Symbol==="+"?"plus":"minus"}`:void 0,overviewRuler:t.input1OverviewColor?{color:t.input1OverviewColor,position:r.editor.OverviewRulerLane.Full}:void 0,minimap:t.input1OverviewColor?{color:t.input1OverviewColor,position:r.editor.MinimapPosition.Inline}:void 0}})}else if(e.conflictType===M.INPUT1_ONLY){const o=e.input1Range.startLineNumber,i=e.input1Range.endLineNumberExclusive-1;for(let s=o;s<=i;s++)n.push({range:new r.Range(s,1,s,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.input1Class,linesDecorationsClassName:t.input1Symbol&&t.input1Symbol!==""?`diff-symbol diff-symbol-${t.input1Symbol==="+"?"plus":"minus"}`:void 0,overviewRuler:t.input1OverviewColor?{color:t.input1OverviewColor,position:r.editor.OverviewRulerLane.Full}:void 0,minimap:t.input1OverviewColor?{color:t.input1OverviewColor,position:r.editor.MinimapPosition.Inline}:void 0}})}}return n}function qr(e,t,r){const n=[];if(e.input2Diffs.length>0&&t.input2Class){const o=vn(e.input2Diffs);for(const i of o)n.push({range:new r.Range(i,1,i,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.input2Class,linesDecorationsClassName:t.input2Symbol&&t.input2Symbol!==""?`diff-symbol diff-symbol-${t.input2Symbol==="+"?"plus":"minus"}`:void 0,overviewRuler:t.input2OverviewColor?{color:t.input2OverviewColor,position:r.editor.OverviewRulerLane.Full}:void 0,minimap:t.input2OverviewColor?{color:t.input2OverviewColor,position:r.editor.MinimapPosition.Inline}:void 0}})}return n}function Yr(e,t,r){const n=[],o=e.baseRange.startLineNumber===1&&e.baseRange.endLineNumberExclusive===2;return(e.input1Diffs.length>0||e.input2Diffs.length>0)&&!o&&n.push({range:new r.Range(e.baseRange.startLineNumber,1,e.baseRange.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:t.baseClass,overviewRuler:{color:t.baseOverviewColor,position:r.editor.OverviewRulerLane.Full},minimap:{color:t.baseOverviewColor,position:r.editor.MinimapPosition.Inline}}}),n}function zr(e,t,r,n){const o=Gr(e,t,r);return{input1Decorations:Wr(e,o,n),input2Decorations:qr(e,o,n),baseDecorations:Yr(e,o,n)}}function Cr(e,t,r,n){const o=[],i=[],s=[];for(const c of e){const a=zr(c,t,r,n);o.push(...a.input1Decorations),i.push(...a.input2Decorations),s.push(...a.baseDecorations)}return{input1Decorations:o,input2Decorations:i,baseDecorations:s}}const Xr=()=>Ce.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#888"},children:"Loading Monaco Editor..."}),Ot="⚠";function Qr(e){const{original:t="",modified:r="",base:n="",theme:o="vs",options:i={},width:s="100%",height:c="100%",className:a,loading:u,onMount:l,onMergeResolve:y,showResultColumn:p,baseIndex:d=1,comparisonMode:L="split",schema:N,patches:v,labels:h}=e,m=n?p:!1,f=!n||n==="",E="json",[S,g]=P.useState(!1),[b,D]=P.useState(!0),[T,F]=P.useState([]),[x,$]=P.useState(null),[J,A]=P.useState([]),[w,j]=P.useState([]),[X,re]=P.useState(!1),le=P.useRef(""),me=P.useCallback((k,O,I,B)=>{const R=document.createElement("div");R.className="native-checkbox-container";const V=document.createElement("input");return V.type="checkbox",V.className="native-checkbox",V.checked=k===ne.first||k===ne.second,V.setAttribute("aria-label",V.checked?"Undo accept":"Accept change"),V.addEventListener("click",Q=>{Q.preventDefault(),Q.stopPropagation(),requestAnimationFrame(()=>{B()})}),R.appendChild(V),R},[]),[_e,Ee]=P.useState(0),K=P.useRef(null),se=P.useRef(null),te=P.useRef(null),U=P.useRef(null),fe=P.useRef(null),Te=P.useRef(null),Pe=P.useRef(!1),pt=P.useRef(!1),De=P.useRef(null),Ge=P.useRef(null),Le=P.useRef(null),Me=P.useRef(new Map),Ie=P.useRef(null),xe=P.useRef(null),$e=P.useRef(null),Be=P.useRef(null);P.useEffect(()=>{let k=!0;const O=ur.init();return O.then(I=>{k&&(fe.current=I,D(!1),g(!0))}).catch(I=>{k&&(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)}),()=>{k=!1,Pe.current||O.cancel()}},[]);const jt=P.useCallback((k,O,I)=>{if(!fe.current)return[];const B=(k==null?void 0:k.getValue())||"",R=O.getValue(),V=I.getValue();try{const Q=performance.now(),z=gn(B,R,V,{comparisonMode:L,schema:N,patches:v}),_=performance.now()-Q;return _>100&&console.warn(`JSON Patch diff took ${_.toFixed(2)}ms`),z}catch(Q){const z=Q instanceof Error?Q.message:String(Q);return console.error("JSON Patch diff error:",z),[]}},[L,N,v]),We=P.useCallback(k=>{try{return k.getLayoutInfo().decorationsLeft||0}catch{return 0}},[]),qe=P.useCallback(k=>{try{return k.getLayoutInfo().decorationsWidth||0}catch{return 0}},[]),et=P.useCallback(k=>{if(!m||!U.current||!Le.current)return;const O=fe.current;if(!O)return;const I=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),B=We(U.current),R=qe(U.current);Le.current.style.left=`${B}px`,Le.current.style.width=`${R}px`;const V=U.current.getScrollTop();if(U.current.getModel()){Le.current.innerHTML="";for(const z of k){const _=z.startLine,ue=z.endLine,Z=U.current.getTopForLineNumber(_)-V,G=U.current.getTopForLineNumber(ue)-V,H=U.current.getOption(O.editor.EditorOption.lineHeight),oe=ue>_?G-Z+H:H,W=document.createElement("div");W.className=`conflict-issue-marker conflict-issue-${z.type}`,W.setAttribute("data-conflict-id",z.conflictId),W.setAttribute("data-issue-type",z.type),W.title=z.message,W.style.position="absolute",W.style.top=`${Math.max(0,Z)}px`,W.style.height=`${oe}px`,W.style.width="26px",W.style.display="flex",W.style.alignItems="center",W.style.justifyContent="center",W.style.cursor="help",W.style.pointerEvents="auto";const ie=document.createElement("div");ie.className="issue-icon",z.type==="error"?(ie.textContent="✗",ie.style.color=I?"#ff6666":"#cc0000"):z.type==="warning"?(ie.textContent=Ot,ie.style.color=I?"#ffaa00":"#ff8800"):z.type==="smart-merge"&&(ie.textContent="↕",ie.style.color=I?"#0096ff":"#0078d4"),ie.style.fontSize="14px",ie.style.fontWeight="bold",W.appendChild(ie),Le.current.appendChild(W)}}},[m,o,We,qe]),tt=P.useCallback(k=>{var ce,oe,W,ie;if(!U.current||X)return;const O=U.current.getModel(),I=(ce=K.current)==null?void 0:ce.getModel(),B=(oe=te.current)==null?void 0:oe.getModel(),R=(W=se.current)==null?void 0:W.getModel();if(!O||!I||!B||!R)return;const V=R.getLinesContent(),Q=I.getLinesContent(),z=B.getLinesContent(),_=Hr(V,Q,z,k,N);if($(_.isValid?null:_.validationError||"Invalid JSON"),A(_.warnings||[]),j(_.conflictIssues||[]),Ie.current){const C=(h==null?void 0:h.result)||"Result";_.isValid?_.warnings&&_.warnings.length>0?(Ie.current.textContent=`${C} ${Ot}`,Ie.current.title=_.warnings.join(`
34
+ `)):(Ie.current.textContent=C,Ie.current.style.color="",Ie.current.title=""):(Ie.current.textContent=`${C} ${Ot} Invalid JSON`,Ie.current.style.color="#ff4444",Ie.current.title=_.validationError||"Invalid JSON - please fix manually")}if(O.getValue()!==_.content){const C=U.current.getPosition(),Y=U.current.getSelection();if(pt.current=!0,O.setValue(_.content),pt.current=!1,C){const he=O.getLineCount(),ee=O.getLineLength(he),ve={lineNumber:Math.min(C.lineNumber,he),column:C.lineNumber<=he?Math.min(C.column,O.getLineLength(C.lineNumber)+1):ee+1};U.current.setPosition(ve),Y&&!Y.isEmpty()&&U.current.setSelection(Y)}}const Z=fe.current,G=O;let H=G._invalidDecorations;if(!_.isValid&&U.current&&Z?(H||(H=U.current.createDecorationsCollection([]),G._invalidDecorations=H),H.set([{range:new Z.Range(1,1,O.getLineCount(),Number.MAX_SAFE_INTEGER),options:{isWholeLine:!1,className:"merge-result-invalid",hoverMessage:{value:_.validationError||"Invalid JSON - please fix manually"}}}])):_.isValid&&H&&U.current&&H.set([]),_.conflictIssues&&_.conflictIssues.length>0){if(et(_.conflictIssues),U.current&&Z){const C=O;if(!C._conflictIssueDecorations){const ee=U.current.createDecorationsCollection([]);C._conflictIssueDecorations=ee}const Y=C._conflictIssueDecorations,he=_.conflictIssues.map(ee=>{let ve,Ae;return ee.type==="error"?(ve=o==="vs-dark"?"rgba(255, 0, 0, 0.1)":"rgba(255, 0, 0, 0.05)",Ae=o==="vs-dark"?"#ff6666":"#cc0000"):ee.type==="warning"?(ve=o==="vs-dark"?"rgba(255, 170, 0, 0.1)":"rgba(255, 136, 0, 0.05)",Ae=o==="vs-dark"?"#ffaa00":"#ff8800"):(ve=o==="vs-dark"?"rgba(0, 150, 255, 0.1)":"rgba(0, 120, 212, 0.05)",Ae=o==="vs-dark"?"#0096ff":"#0078d4"),{range:new Z.Range(ee.startLine,1,ee.endLine,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:`conflict-issue-line conflict-issue-${ee.type}`,linesDecorationsClassName:`conflict-issue-line-decoration conflict-issue-${ee.type}`,backgroundColor:ve,overviewRuler:{color:Ae,position:Z.editor.OverviewRulerLane.Right},minimap:{color:Ae,position:Z.editor.MinimapPosition.Inline}}}});Y.set(he)}}else if(U.current){const C=O;C._conflictIssueDecorations&&C._conflictIssueDecorations.set([]),Le.current&&m&&(Le.current.innerHTML="")}if(y){const C=`${_.content}|${_.isValid}|${(ie=_.warnings)==null?void 0:ie.join(",")}`;le.current!==C&&(le.current=C,queueMicrotask(()=>{y(_.content,{isValid:_.isValid,validationError:_.validationError,warnings:_.warnings,conflictIssues:_.conflictIssues})}))}},[y,N,h,o,et,m,X]),dt=P.useCallback((k,O)=>{re(!1),F(I=>{const B=I.map(R=>{if(R.id!==k)return R;const Q=(O===1?R.input1State:R.input2State)===ne.excluded?ne.first:ne.excluded;return O===1?{...R,input1State:Q}:{...R,input2State:Q}});return m&&U.current&&tt(B),B})},[m,tt]),ht=P.useCallback((k,O,I,B,R,V,Q)=>{if(!fe.current)return;const _=B===1?K.current:te.current;if(!_)return;const ue=B===1?I.input1Range:I.input2Range,Z=B===1?I.input1State:I.input2State,G=_.getModel();if(!G)return;const H=G.getLineCount(),ce=Math.max(1,Math.min(ue.startLineNumber,H)),oe=Math.max(1,Math.min(ue.endLineNumberExclusive-1,H));if(ce>H||oe<1||ce>oe)return;const W=_.getTopForLineNumber(ce)-R,C=_.getBottomForLineNumber(oe)-R-W;let Y=Me.current.get(O);if(!Y){Y=document.createElement("div"),Y.className="merge-accept-gutter-marker";const ge=document.createElement("div");ge.className="background",Y.appendChild(ge);const pe=document.createElement("div");pe.className="checkbox";const ye=document.createElement("div");ye.className="checkbox-background";const Ne=me(Z,B,I.id,()=>dt(I.id,B));ye.appendChild(Ne),pe.appendChild(ye),Y.appendChild(pe),k.appendChild(Y),Me.current.set(O,Y)}Y.style.top=`${W}px`,Y.style.height=`${C}px`;const he=Y.querySelector(".checkbox-background");if(he){he.innerHTML="";const ge=me(Z,B,I.id,()=>dt(I.id,B));he.appendChild(ge)}const ee=I.handled,ve=I.focused,Ae=C>30;Y.className="merge-accept-gutter-marker",ee&&Y.classList.add("handled"),ve&&Y.classList.add("focused"),Ae?Y.classList.add("multi-line"):Y.classList.add("single-line");const Oe=Y.querySelector(".checkbox");if(Oe){const pe=C/2-12,ye=24;let Ne=pe;const bn=ye,On=V-ye-24,Ut=ye,Vt=C-24-ye;Ut<Vt&&(Ne=Math.max(bn,Math.min(Ne+W,On))-W,Ne=Math.max(Ut,Math.min(Ne,Vt))),Oe.style.top=`${Ne+5}px`}},[dt,me]),nt=P.useCallback(()=>{if(!m){const G=Me.current;for(const[H,ce]of G.entries())ce.remove(),G.delete(H);return}if(!K.current||!te.current||!De.current||!Ge.current||!fe.current)return;const O=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),I=We(K.current),B=qe(K.current),R=We(te.current),V=qe(te.current);De.current.style.left=`${I}px`,De.current.style.width=`${B}px`,Ge.current.style.left=`${R}px`,Ge.current.style.width=`${V}px`;const Q=K.current.getVisibleRanges();if(!Q||Q.length===0)return;const z=K.current.getScrollTop(),_=De.current.clientHeight,ue=new Set;for(const G of T)if(!(G.input1Diffs.length===0&&G.input2Diffs.length===0)){if(G.input1Diffs.length>0){const H=`${G.id}-input1`;ue.add(H),ht(De.current,H,G,1,z,_,O)}if(G.input2Diffs.length>0){const H=`${G.id}-input2`;ue.add(H),ht(Ge.current,H,G,2,z,_,O)}}const Z=Me.current;for(const[G,H]of Z.entries())ue.has(G)||(H.remove(),Z.delete(G))},[T,o,m,We,qe,ht]),be=P.useCallback((k,O)=>{var I,B,R;try{if(fe.current){const V=(B=(I=fe.current.editor).getTheme)==null?void 0:B.call(I);if((R=V==null?void 0:V.colors)!=null&&R[k])return V.colors[k]}}catch{}return O},[]),Dt=P.useCallback(()=>{if(!fe.current||!K.current||!te.current)return;const k=fe.current,O=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),I=be("mergeEditor.change.background",O?"rgba(255, 166, 0, 0.2)":"rgba(255, 166, 0, 0.15)"),B=be("diffEditor.insertedTextBackground",O?"rgba(155, 185, 85, 0.2)":"rgba(155, 185, 85, 0.15)"),R=be("mergeEditor.changeBase.background",O?"rgba(255, 100, 100, 0.2)":"rgba(255, 100, 100, 0.15)"),V=be("editorOverviewRuler.modifiedForeground",O?"rgba(255, 166, 0, 0.8)":"rgba(255, 166, 0, 1)"),Q=be("editorOverviewRuler.addedForeground",O?"rgba(155, 185, 85, 0.8)":"rgba(155, 185, 85, 1)"),z=be("editorOverviewRuler.deletedForeground",O?"rgba(255, 100, 100, 0.8)":"rgba(255, 100, 100, 1)"),_=f,ue={conflictOverviewColor:V,changeOverviewColor:Q,baseOverviewColor:z},{input1Decorations:Z,input2Decorations:G,baseDecorations:H}=Cr(T,_,ue,k),ce=be("input.background",O?"#3c3c3c":"#f3f3f3"),oe=be("input.border",O?"#6b6b6b":"#c8c8c8"),W=be("focusBorder",O?"#007acc":"#0078d4"),ie=be("inputOption.activeForeground",O?"#3794ff":"#0078d4"),C="monaco-three-way-diff-dynamic";let Y=document.getElementById(C);Y||(Y=document.createElement("style"),Y.id=C,document.head.appendChild(Y));const he=be("diffEditor.insertedTextBackground",O?"rgba(100, 100, 255, 0.15)":"rgba(100, 100, 255, 0.1)"),ee=be("diffEditor.insertedTextBackground",O?"rgba(155, 185, 85, 0.2)":"rgba(155, 185, 85, 0.15)");Y.textContent=`
35
35
  /* True conflict - both sides changed differently (orange/amber) */
36
36
  .monaco-editor .merge-conflict-incoming,
37
37
  .monaco-editor .merge-conflict-current {
@@ -54,7 +54,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
54
54
 
55
55
  /* Same change on both sides (blue/purple) */
56
56
  .monaco-editor .merge-same-change {
57
- background-color: ${de};
57
+ background-color: ${he};
58
58
  }
59
59
 
60
60
  /* Base changes */
@@ -216,5 +216,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
216
216
  outline: 2px solid ${W};
217
217
  outline-offset: 2px;
218
218
  }
219
- `,xe.current||(xe.current=K.current.createDecorationsCollection([])),xe.current.set(Z),$e.current||($e.current=te.current.createDecorationsCollection([])),$e.current.set(G),se.current&&(Be.current||(Be.current=se.current.createDecorationsCollection([])),Be.current.set(H))},[N,o,f,be]),Mt=P.useCallback(()=>{if(!Pe.current&&Te.current&&fe.current&&!b){const k=fe.current;Te.current.innerHTML="";const O=document.createElement("div");O.style.display="flex",O.style.height="100%",O.style.width="100%";const I=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),B=I?"#444":"#ddd",R=I?"#fff":"#333",V=(ee,ve)=>{var Ae,Oe,he;try{const pe=(Oe=(Ae=k.editor).getTheme)==null?void 0:Oe.call(Ae);if((he=pe==null?void 0:pe.colors)!=null&&he[ee])return pe.colors[ee]}catch{}return ve},Q=V("mergeEditor.conflict.input1.header.background",I?"#4B1818":"#FFE6E6"),z=V("editorGutter.background",I?"#333":"#f0f0f0"),_=V("mergeEditor.conflict.input2.header.background",I?"#1B4B18":"#E6FFE6"),ue=V("mergeEditor.result.header.background",I?"#7F5F00":"#FFECB3"),Z=(ee,ve,Ae=!1)=>{const Oe=document.createElement("div");Oe.style.flex="1",Oe.style.display="flex",Oe.style.flexDirection="column",Oe.style.borderRight=`1px solid ${B}`;const he=document.createElement("div");he.textContent=ee,he.style.padding="4px 8px",he.style.fontSize="11px",he.style.fontWeight="500",he.style.backgroundColor=ve,he.style.color=R,he.style.borderBottom=`1px solid ${B}`,Oe.appendChild(he);const pe=document.createElement("div");pe.style.flex="1",pe.style.position="relative",pe.style.overflow="hidden";const me=document.createElement("div");me.style.position="absolute",me.style.left="0",me.style.right="0",me.style.top="0",me.style.bottom="0",pe.appendChild(me);let Ne=null;return Ae&&(Ne=document.createElement("div"),Ne.className="merge-editor-gutter",pe.appendChild(Ne)),Oe.appendChild(pe),{container:Oe,editorDiv:me,gutterDiv:Ne}},G=Z((h==null?void 0:h.input1)||"Theirs",Q,m),H=Z((h==null?void 0:h.input2)||"Ours",_,m);G.gutterDiv&&(De.current=G.gutterDiv),H.gutterDiv&&(Ge.current=H.gutterDiv);const ce=!!n;let oe=null;if(ce){oe=Z((h==null?void 0:h.base)||"Base",z,!1);const ee=[];d===0?ee.push(oe.container,G.container,H.container):d===1?ee.push(G.container,oe.container,H.container):d===2&&ee.push(G.container,H.container,oe.container),ee.forEach(ve=>{O.appendChild(ve)})}else O.appendChild(G.container),O.appendChild(H.container);let W=null;m&&ce&&(W=Z((h==null?void 0:h.result)||"Result",ue,!0),Ie.current=W.container.querySelector("div"),W.gutterDiv&&(Le.current=W.gutterDiv),O.appendChild(W.container)),Te.current.appendChild(O);const ie=k.editor.createModel(t||"",T),X=ce?k.editor.createModel(n||"",T):null,Y=k.editor.createModel(r||"",T);if(K.current=k.editor.create(G.editorDiv,{model:ie,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:m?26:10}),ce&&oe&&(se.current=k.editor.create(oe.editorDiv,{model:X,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:10})),te.current=k.editor.create(H.editorDiv,{model:Y,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:m?26:10}),m&&W){const ee=k.editor.createModel(r||"",T);U.current=k.editor.create(W.editorDiv,{model:ee,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,readOnly:!1,lineDecorationsWidth:26}),ee.onDidChangeContent(()=>{pt.current||re(!0)})}k.editor.setTheme(o);const de=jt(X,ie,Y);F(de),Pe.current=!0,l&&K.current&&l(K.current,k)}},[i,o,t,r,n,m,d,b,jt,l,h]),xt=P.useRef(m),$t=P.useRef(d),Bt=P.useRef(L),Ft=P.useRef(n);return P.useEffect(()=>{var R,V,Q,z,_,ue,Z,G,H,ce,oe;const k=xt.current!==m,O=$t.current!==d,I=Bt.current!==L,B=Ft.current!==n;if((k||O||I||B)&&Pe.current){xt.current=m,$t.current=d,Bt.current=L,Ft.current=n,Me.current.forEach(de=>{de.remove()}),Me.current.clear(),(R=xe.current)==null||R.set([]),(V=$e.current)==null||V.set([]),(Q=Be.current)==null||Q.set([]),xe.current=null,$e.current=null,Be.current=null;const W=(z=K.current)==null?void 0:z.getModel(),ie=(_=se.current)==null?void 0:_.getModel(),X=(ue=te.current)==null?void 0:ue.getModel(),Y=(Z=U.current)==null?void 0:Z.getModel();(G=K.current)==null||G.dispose(),(H=se.current)==null||H.dispose(),(ce=te.current)==null||ce.dispose(),(oe=U.current)==null||oe.dispose(),W==null||W.dispose(),ie==null||ie.dispose(),X==null||X.dispose(),Y==null||Y.dispose(),Pe.current=!1,Ee(de=>de+1)}},[m,d,L,n]),P.useEffect(()=>{!b&&fe.current&&Te.current&&!Pe.current&&Mt()},[b,Mt]),P.useEffect(()=>{!S||!i||(K.current&&K.current.updateOptions(i),te.current&&te.current.updateOptions(i),se.current&&se.current.updateOptions(i),U.current&&U.current.updateOptions(i))},[i,S]),P.useEffect(()=>{S&&N.length>0&&(Dt(),m&&nt())},[S,N,Dt,nt,m]),P.useEffect(()=>{S&&N.length>0&&m&&U.current&&tt(N)},[S,N,m,tt]),P.useEffect(()=>{if(!S)return;const k=()=>{w.length>0&&et(w)},O=[],I=()=>{nt()};return K.current&&O.push(K.current.onDidScrollChange(I)),te.current&&O.push(te.current.onDidScrollChange(I)),U.current&&m&&(O.push(U.current.onDidScrollChange(k)),O.push(U.current.onDidLayoutChange(k))),K.current&&O.push(K.current.onDidLayoutChange(I)),te.current&&O.push(te.current.onDidLayoutChange(I)),()=>{O.forEach(B=>{B==null||B.dispose()})}},[S,nt,et,m,w]),P.useEffect(()=>{if(!S)return;const k=[K.current,se.current,te.current];m&&U.current&&k.push(U.current);const O=[];let I=!1;const B=R=>{if(I)return;I=!0;const V=R.getScrollTop(),Q=R.getScrollLeft();k.forEach(z=>{z&&z!==R&&(z.setScrollTop(V),z.setScrollLeft(Q))}),setTimeout(()=>{I=!1},10)};return k.forEach(R=>{R&&O.push(R.onDidScrollChange(()=>{B(R)}))}),()=>{O.forEach(R=>{R==null||R.dispose()})}},[S,m]),P.useEffect(()=>()=>{var R,V,Q,z,_,ue,Z,G,H,ce,oe;(R=xe.current)==null||R.set([]),(V=$e.current)==null||V.set([]),(Q=Be.current)==null||Q.set([]);const k=(z=K.current)==null?void 0:z.getModel(),O=(_=se.current)==null?void 0:_.getModel(),I=(ue=te.current)==null?void 0:ue.getModel(),B=(Z=U.current)==null?void 0:Z.getModel();(G=K.current)==null||G.dispose(),(H=se.current)==null||H.dispose(),(ce=te.current)==null||ce.dispose(),(oe=U.current)==null||oe.dispose(),k==null||k.dispose(),O==null||O.dispose(),I==null||I.dispose(),B==null||B.dispose(),Pe.current=!1,g(!1)},[]),b||!S?Xe.jsx(Xe.Fragment,{children:u??Xe.jsx(Cr,{})}):Xe.jsx("div",{ref:Te,style:{width:s,height:c},className:a})}exports.JsonDiffMergeEditor=Qr;exports.analyzeConflicts=dn;exports.analyzeTwoWayConflicts=hn;exports.computeDiffs=Ur;exports.computeDiffsJsonPatch=gn;exports.computeLineConflictType=mn;
219
+ `,xe.current||(xe.current=K.current.createDecorationsCollection([])),xe.current.set(Z),$e.current||($e.current=te.current.createDecorationsCollection([])),$e.current.set(G),se.current&&(Be.current||(Be.current=se.current.createDecorationsCollection([])),Be.current.set(H))},[T,o,f,be]),Mt=P.useCallback(()=>{if(!Pe.current&&Te.current&&fe.current&&!b){const k=fe.current;Te.current.innerHTML="";const O=document.createElement("div");O.style.display="flex",O.style.height="100%",O.style.width="100%";const I=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),B=I?"#444":"#ddd",R=I?"#fff":"#333",V=(ee,ve)=>{var Ae,Oe,ge;try{const pe=(Oe=(Ae=k.editor).getTheme)==null?void 0:Oe.call(Ae);if((ge=pe==null?void 0:pe.colors)!=null&&ge[ee])return pe.colors[ee]}catch{}return ve},Q=V("mergeEditor.conflict.input1.header.background",I?"#4B1818":"#FFE6E6"),z=V("editorGutter.background",I?"#333":"#f0f0f0"),_=V("mergeEditor.conflict.input2.header.background",I?"#1B4B18":"#E6FFE6"),ue=V("mergeEditor.result.header.background",I?"#7F5F00":"#FFECB3"),Z=(ee,ve,Ae=!1)=>{const Oe=document.createElement("div");Oe.style.flex="1",Oe.style.display="flex",Oe.style.flexDirection="column",Oe.style.borderRight=`1px solid ${B}`;const ge=document.createElement("div");ge.textContent=ee,ge.style.padding="4px 8px",ge.style.fontSize="11px",ge.style.fontWeight="500",ge.style.backgroundColor=ve,ge.style.color=R,ge.style.borderBottom=`1px solid ${B}`,Oe.appendChild(ge);const pe=document.createElement("div");pe.style.flex="1",pe.style.position="relative",pe.style.overflow="hidden";const ye=document.createElement("div");ye.style.position="absolute",ye.style.left="0",ye.style.right="0",ye.style.top="0",ye.style.bottom="0",pe.appendChild(ye);let Ne=null;return Ae&&(Ne=document.createElement("div"),Ne.className="merge-editor-gutter",pe.appendChild(Ne)),Oe.appendChild(pe),{container:Oe,editorDiv:ye,gutterDiv:Ne}},G=Z((h==null?void 0:h.input1)||"Theirs",Q,m),H=Z((h==null?void 0:h.input2)||"Ours",_,m);G.gutterDiv&&(De.current=G.gutterDiv),H.gutterDiv&&(Ge.current=H.gutterDiv);const ce=!!n;let oe=null;if(ce){oe=Z((h==null?void 0:h.base)||"Base",z,!1);const ee=[];d===0?ee.push(oe.container,G.container,H.container):d===1?ee.push(G.container,oe.container,H.container):d===2&&ee.push(G.container,H.container,oe.container),ee.forEach(ve=>{O.appendChild(ve)})}else O.appendChild(G.container),O.appendChild(H.container);let W=null;m&&ce&&(W=Z((h==null?void 0:h.result)||"Result",ue,!0),Ie.current=W.container.querySelector("div"),W.gutterDiv&&(Le.current=W.gutterDiv),O.appendChild(W.container)),Te.current.appendChild(O);const ie=k.editor.createModel(t||"",E),C=ce?k.editor.createModel(n||"",E):null,Y=k.editor.createModel(r||"",E);if(K.current=k.editor.create(G.editorDiv,{model:ie,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:m?26:10}),ce&&oe&&(se.current=k.editor.create(oe.editorDiv,{model:C,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:10})),te.current=k.editor.create(H.editorDiv,{model:Y,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:m?26:10}),m&&W){const ee=k.editor.createModel(r||"",E);U.current=k.editor.create(W.editorDiv,{model:ee,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,readOnly:!1,lineDecorationsWidth:26}),ee.onDidChangeContent(()=>{pt.current||re(!0)})}k.editor.setTheme(o);const he=jt(C,ie,Y);F(he),Pe.current=!0,l&&K.current&&l(K.current,k)}},[i,o,t,r,n,m,d,b,jt,l,h]),xt=P.useRef(m),$t=P.useRef(d),Bt=P.useRef(L),Ft=P.useRef(n);return P.useEffect(()=>{var R,V,Q,z,_,ue,Z,G,H,ce,oe;const k=xt.current!==m,O=$t.current!==d,I=Bt.current!==L,B=Ft.current!==n;if((k||O||I||B)&&Pe.current){xt.current=m,$t.current=d,Bt.current=L,Ft.current=n,Me.current.forEach(he=>{he.remove()}),Me.current.clear(),(R=xe.current)==null||R.set([]),(V=$e.current)==null||V.set([]),(Q=Be.current)==null||Q.set([]),xe.current=null,$e.current=null,Be.current=null;const W=(z=K.current)==null?void 0:z.getModel(),ie=(_=se.current)==null?void 0:_.getModel(),C=(ue=te.current)==null?void 0:ue.getModel(),Y=(Z=U.current)==null?void 0:Z.getModel();(G=K.current)==null||G.dispose(),(H=se.current)==null||H.dispose(),(ce=te.current)==null||ce.dispose(),(oe=U.current)==null||oe.dispose(),W==null||W.dispose(),ie==null||ie.dispose(),C==null||C.dispose(),Y==null||Y.dispose(),Pe.current=!1,Ee(he=>he+1)}},[m,d,L,n]),P.useEffect(()=>{!b&&fe.current&&Te.current&&!Pe.current&&Mt()},[b,Mt]),P.useEffect(()=>{!S||!i||(K.current&&K.current.updateOptions(i),te.current&&te.current.updateOptions(i),se.current&&se.current.updateOptions(i),U.current&&U.current.updateOptions(i))},[i,S]),P.useEffect(()=>{S&&T.length>0&&(Dt(),m&&nt())},[S,T,Dt,nt,m]),P.useEffect(()=>{S&&T.length>0&&m&&U.current&&tt(T)},[S,T,m,tt]),P.useEffect(()=>{if(!S)return;const k=()=>{w.length>0&&et(w)},O=[],I=()=>{nt()};return K.current&&O.push(K.current.onDidScrollChange(I)),te.current&&O.push(te.current.onDidScrollChange(I)),U.current&&m&&(O.push(U.current.onDidScrollChange(k)),O.push(U.current.onDidLayoutChange(k))),K.current&&O.push(K.current.onDidLayoutChange(I)),te.current&&O.push(te.current.onDidLayoutChange(I)),()=>{O.forEach(B=>{B==null||B.dispose()})}},[S,nt,et,m,w]),P.useEffect(()=>{if(!S)return;const k=[K.current,se.current,te.current];m&&U.current&&k.push(U.current);const O=[];let I=!1;const B=R=>{if(I)return;I=!0;const V=R.getScrollTop(),Q=R.getScrollLeft();k.forEach(z=>{z&&z!==R&&(z.setScrollTop(V),z.setScrollLeft(Q))}),setTimeout(()=>{I=!1},10)};return k.forEach(R=>{R&&O.push(R.onDidScrollChange(()=>{B(R)}))}),()=>{O.forEach(R=>{R==null||R.dispose()})}},[S,m]),P.useEffect(()=>()=>{var R,V,Q,z,_,ue,Z,G,H,ce,oe;(R=xe.current)==null||R.set([]),(V=$e.current)==null||V.set([]),(Q=Be.current)==null||Q.set([]);const k=(z=K.current)==null?void 0:z.getModel(),O=(_=se.current)==null?void 0:_.getModel(),I=(ue=te.current)==null?void 0:ue.getModel(),B=(Z=U.current)==null?void 0:Z.getModel();(G=K.current)==null||G.dispose(),(H=se.current)==null||H.dispose(),(ce=te.current)==null||ce.dispose(),(oe=U.current)==null||oe.dispose(),k==null||k.dispose(),O==null||O.dispose(),I==null||I.dispose(),B==null||B.dispose(),Pe.current=!1,g(!1)},[]),b||!S?Ce.jsx(Ce.Fragment,{children:u??Ce.jsx(Xr,{})}):Ce.jsx("div",{ref:Te,style:{width:s,height:c},className:a})}exports.JsonDiffMergeEditor=Qr;exports.analyzeConflicts=dn;exports.analyzeTwoWayConflicts=hn;exports.computeDiffs=Ur;exports.computeDiffsJsonPatch=gn;exports.computeLineConflictType=mn;
220
220
  //# sourceMappingURL=index.cjs.map