react-monaco-json-merge 1.1.17 → 1.2.0
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/components/editor.d.ts.map +1 -1
- package/dist/index.cjs +30 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1038 -1003
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const tt=require("react/jsx-runtime"),R=require("react");function zt(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 Ln(e){if(Array.isArray(e))return e}function kn(e,t,r){return(t=xn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sn(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 _n(){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 Xt(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?Xt(Object(r),!0).forEach(function(n){kn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Pn(e,t){if(e==null)return{};var r,n,o=Rn(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 Rn(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 jn(e,t){return Ln(e)||Sn(e,t)||Mn(e,t)||_n()}function Dn(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 xn(e){var t=Dn(e,"string");return typeof t=="symbol"?t:t+""}function Mn(e,t){if(e){if(typeof e=="string")return zt(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)?zt(e,t):void 0}}function $n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zt(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 Kt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zt(Object(r),!0).forEach(function(n){$n(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bn(){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 nt(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 ht(e){return{}.toString.call(e).includes("Object")}function Fn(e){return!Object.keys(e).length}function rt(e){return typeof e=="function"}function Un(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Vn(e,t){return ht(t)||Re("changeType"),Object.keys(t).some(function(r){return!Un(e,r)})&&Re("changeField"),t}function Jn(e){rt(e)||Re("selectorType")}function Hn(e){rt(e)||ht(e)||Re("handlerType"),ht(e)&&Object.values(e).some(function(t){return!rt(t)})&&Re("handlersType")}function Gn(e){e||Re("initialIsRequired"),ht(e)||Re("initialType"),Fn(e)&&Re("initialContent")}function Wn(e,t){throw new Error(e[t]||e.default)}var qn={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"},Re=nt(Wn)(qn),ft={changes:Vn,selector:Jn,handler:Hn,initial:Gn};function Cn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ft.initial(e),ft.handler(t);var r={current:e},n=nt(Xn)(r,t),o=nt(zn)(r),i=nt(ft.changes)(e),s=nt(Yn)(r);function c(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(l){return l};return ft.selector(u),u(r.current)}function a(u){Bn(n,o,i,s)(u)}return[c,a]}function Yn(e,t){return rt(t)?t(e.current):t}function zn(e,t){return e.current=Kt(Kt({},e.current),t),t}function Xn(e,t,r){return rt(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 Qn={create:Cn},Zn={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}};function Kn(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 er(e){return{}.toString.call(e).includes("Object")}function tr(e){return e||en("configIsRequired"),er(e)||en("configType"),e.urls?(nr(),{paths:{vs:e.urls.monacoBase}}):e}function nr(){console.warn(ln.deprecation)}function rr(e,t){throw new Error(e[t]||e.default)}var ln={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,48 +8,48 @@ 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
|
-
`},
|
|
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}
|
|
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=
|
|
14
|
-
`+" ".repeat(t)),new Array(
|
|
15
|
-
`+" ".repeat(t)),new Array(
|
|
16
|
-
`+" ".repeat(t)),new Array(
|
|
17
|
-
`+" ".repeat(t));var
|
|
11
|
+
`},en=Kn(rr)(ln),or={config:tr},ir=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 un(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],un(e[r],t[r]))}),Qt(Qt({},e),t)}var sr={type:"cancelation",msg:"operation is manually canceled"};function Nt(e){var t=!1,r=new Promise(function(n,o){e.then(function(i){return t?o(sr):n(i)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var cr=["monaco"],ar=Qn.create({config:Zn,isInitialized:!1,resolve:null,reject:null,monaco:null}),fn=jn(ar,2),it=fn[0],vt=fn[1];function lr(e){var t=or.config(e),r=t.monaco,n=Pn(t,cr);vt(function(o){return{config:un(o.config,n),monaco:r}})}function ur(){var e=it(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(vt({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Nt(Et);if(window.monaco&&window.monaco.editor)return pn(window.monaco),e.resolve(window.monaco),Nt(Et);ir(fr,dr)(hr)}return Nt(Et)}function fr(e){return document.body.appendChild(e)}function pr(e){var t=document.createElement("script");return e&&(t.src=e),t}function dr(e){var t=it(function(n){var o=n.config,i=n.reject;return{config:o,reject:i}}),r=pr("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function hr(){var e=it(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;pn(n),e.resolve(n)},function(r){e.reject(r)})}function pn(e){it().monaco||vt({monaco:e})}function gr(){return it(function(e){var t=e.monaco;return t})}var Et=new Promise(function(e,t){return vt({resolve:e,reject:t})}),mr={config:lr,init:ur,__getMonacoInstance:gr},re=(e=>(e[e.excluded=0]="excluded",e[e.first=1]="first",e[e.second=2]="second",e))(re||{}),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 yr(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,I){let k=0,g=0;for(;k<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++,k++}return k<f&&(g=-1),g}function d(f){n=f,o="",i=0,s=16,y=0}function _(){let f=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&He(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&He(e.charCodeAt(n)))for(n++;n<e.length&&He(e.charCodeAt(n));)n++;else return y=3,e.substring(f,n);let I=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&&He(e.charCodeAt(n))){for(n++;n<e.length&&He(e.charCodeAt(n));)n++;I=n}else y=3;return e.substring(f,I)}function T(){let f="",I=n;for(;;){if(n>=r){f+=e.substring(I,n),y=2;break}const k=e.charCodeAt(n);if(k===34){f+=e.substring(I,n),n++;break}if(k===92){if(f+=e.substring(I,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}I=n;continue}if(k>=0&&k<=31)if(Ke(k)){f+=e.substring(I,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(Tt(f)){do n++,o+=String.fromCharCode(f),f=e.charCodeAt(n);while(Tt(f));return s=15}if(Ke(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=T(),s=10;case 47:const I=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!Ke(e.charCodeAt(n));)n++;return o=e.substring(I,n),s=12}if(e.charCodeAt(n+1)===42){n+=2;const k=r-1;let g=!1;for(;n<k;){const b=e.charCodeAt(n);if(b===42&&e.charCodeAt(n+1)===47){n+=2,g=!0;break}n++,Ke(b)&&(b===13&&e.charCodeAt(n)===10&&n++,c++,u=n)}return g||(n++,y=1),o=e.substring(I,n),s=13}return o+=String.fromCharCode(f),n++,s=16;case 45:if(o+=String.fromCharCode(f),n++,n===r||!He(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+=_(),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(Tt(f)||Ke(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 Tt(e){return e===32||e===9}function Ke(e){return e===10||e===13}function He(e){return e>=48&&e<=57}var tn;(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"})(tn||(tn={}));new Array(20).fill(0).map((e,t)=>" ".repeat(t));const Ge=200;new Array(Ge).fill(0).map((e,t)=>`
|
|
14
|
+
`+" ".repeat(t)),new Array(Ge).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(Ge).fill(0).map((e,t)=>`\r
|
|
15
|
+
`+" ".repeat(t)),new Array(Ge).fill(0).map((e,t)=>`
|
|
16
|
+
`+" ".repeat(t)),new Array(Ge).fill(0).map((e,t)=>"\r"+" ".repeat(t)),new Array(Ge).fill(0).map((e,t)=>`\r
|
|
17
|
+
`+" ".repeat(t));var gt;(function(e){e.DEFAULT={allowTrailingComma:!1}})(gt||(gt={}));function vr(e,t=[],r=gt.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}wr(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:Or(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 br(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 wr(e,t,r=gt.DEFAULT){const n=yr(e,!1),o=[];let i=0;function s(E){return E?()=>i===0&&E(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(E){return E?A=>i===0&&E(A,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function a(E){return E?A=>i===0&&E(A,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice()):()=>!0}function u(E){return E?()=>{i>0?i++:E(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function l(E){return E?()=>{i>0&&i--,i===0&&E(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const y=u(t.onObjectBegin),p=a(t.onObjectProperty),d=l(t.onObjectEnd),_=u(t.onArrayBegin),T=l(t.onArrayEnd),v=a(t.onLiteralValue),h=c(t.onSeparator),m=s(t.onComment),f=c(t.onError),I=r&&r.disallowComments,k=r&&r.allowTrailingComma;function g(){for(;;){const E=n.scan();switch(n.getTokenError()){case 4:b(14);break;case 5:b(15);break;case 3:b(13);break;case 1:I||b(11);break;case 2:b(12);break;case 6:b(16);break}switch(E){case 12:case 13:I?b(10):m();break;case 16:b(1);break;case 15:case 14:break;default:return E}}}function b(E,A=[],D=[]){if(f(E),A.length+D.length>0){let Q=n.getToken();for(;Q!==17;){if(A.indexOf(Q)!==-1){g();break}else if(D.indexOf(Q)!==-1)break;Q=g()}}}function x(E){const A=n.getTokenValue();return E?v(A):(p(A),o.push(A)),g(),!0}function L(){switch(n.getToken()){case 11:const E=n.getTokenValue();let A=Number(E);isNaN(A)&&(b(2),A=0),v(A);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return!1}return g(),!0}function V(){return n.getToken()!==10?(b(3,[],[2,5]),!1):(x(!1),n.getToken()===6?(h(":"),g(),J()||b(4,[],[2,5])):b(5,[],[2,5]),o.pop(),!0)}function $(){y(),g();let E=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(E||b(4,[],[]),h(","),g(),n.getToken()===2&&k)break}else E&&b(6,[],[]);V()||b(4,[],[2,5]),E=!0}return d(),n.getToken()!==2?b(7,[2],[]):g(),!0}function B(){_(),g();let E=!0,A=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(A||b(4,[],[]),h(","),g(),n.getToken()===4&&k)break}else A&&b(6,[],[]);E?(o.push(0),E=!1):o[o.length-1]++,J()||b(4,[],[4,5]),A=!0}return T(),E||o.pop(),n.getToken()!==4?b(8,[4],[]):g(),!0}function J(){switch(n.getToken()){case 3:return B();case 1:return $();case 10:return x(!0);default:return L()}}return g(),n.getToken()===17?r.allowEmptyContent?!0:(b(4,[],[]),!1):J()?(n.getToken()!==17&&b(9,[],[]),!0):(b(4,[],[]),!1)}function Or(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 nn;(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"})(nn||(nn={}));var rn;(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"})(rn||(rn={}));const dn=vr,hn=br;var on;(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"})(on||(on={}));function Ar(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var It,sn;function Nr(){return sn||(sn=1,It=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}),It}var Er=Nr();const de=Ar(Er),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
|
|
21
|
-
*/var
|
|
22
|
-
`)}var
|
|
21
|
+
*/var Tr=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i])},e(t,r)};return function(t,r){e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Ir=Object.prototype.hasOwnProperty;function St(e,t){return Ir.call(e,t)}function _t(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)St(e,o)&&n.push(o);return n}function Ae(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function Pt(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}function Me(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function gn(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Rt(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Rt(e[t]))return!0}else if(typeof e=="object"){for(var n=_t(e),o=n.length,i=0;i<o;i++)if(Rt(e[n[i]]))return!0}}return!1}function cn(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
22
|
+
`)}var mn=(function(e){Tr(t,e);function t(r,n,o,i,s){var c=this.constructor,a=e.call(this,cn(r,{name:n,index:o,operation:i,tree:s}))||this;return a.name=n,a.index=o,a.operation=i,a.tree=s,Object.setPrototypeOf(a,c.prototype),a.message=cn(r,{name:n,index:o,operation:i,tree:s}),a}return t})(Error),le=mn,Lr=Ae,We={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=mt(r,this.path);n&&(n=Ae(n));var o=$e(r,{op:"remove",path:this.from}).removed;return $e(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=mt(r,this.from);return $e(r,{op:"add",path:this.path,value:Ae(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:ot(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},kr={add:function(e,t,r){return Pt(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:We.move,copy:We.copy,test:We.test,_get:We._get};function mt(e,t){if(t=="")return e;var r={op:"_get",path:t};return $e(e,r),r.value}function $e(e,t,r,n,o,i){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),i===void 0&&(i=0),r&&(typeof r=="function"?r(t,0,e,t.path):yt(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=mt(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=ot(e,t.value),s.test===!1)throw new le("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(r)throw new le("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return s}}else{n||(e=Ae(e));var c=t.path||"",a=c.split("/"),u=e,l=1,y=a.length,p=void 0,d=void 0,_=void 0;for(typeof r=="function"?_=r:_=yt;;){if(d=a[l],d&&d.indexOf("~")!=-1&&(d=gn(d)),o&&(d=="__proto__"||d=="prototype"&&l>0&&a[l-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&p===void 0&&(u[d]===void 0?p=a.slice(0,l).join("/"):l==y-1&&(p=t.path),p!==void 0&&_(t,0,e,p)),l++,Array.isArray(u)){if(d==="-")d=u.length;else{if(r&&!Pt(d))throw new le("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);Pt(d)&&(d=~~d)}if(l>=y){if(r&&t.op==="add"&&d>u.length)throw new le("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);var s=kr[t.op].call(t,u,d,e);if(s.test===!1)throw new le("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}}else if(l>=y){var s=We[t.op].call(t,u,d,e);if(s.test===!1)throw new le("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return s}if(u=u[d],r&&l<y&&(!u||typeof u!="object"))throw new le("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}}function xt(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(t))throw new le("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Ae(e));for(var i=new Array(t.length),s=0,c=t.length;s<c;s++)i[s]=$e(e,t[s],r,!0,o,s),e=i[s].newDocument;return i.newDocument=e,i}function Sr(e,t,r){var n=$e(e,t);if(n.test===!1)throw new le("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}function yt(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new le("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(We[e.op]){if(typeof e.path!="string")throw new le("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new le('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new le("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&Rt(e.value))throw new le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var o=e.path.split("/").length,i=n.split("/").length;if(o!==i+1&&o!==i)throw new le("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new le("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},c=yn([s],r);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new le("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new le("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}function yn(e,t,r){try{if(!Array.isArray(e))throw new le("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)xt(Ae(t),Ae(e),r||!0);else{r=r||yt;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(o){if(o instanceof le)return o;throw o}}function ot(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),o,i,s;if(r&&n){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!ot(e[o],t[o]))return!1;return!0}if(r!=n)return!1;var c=Object.keys(e);if(i=c.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!t.hasOwnProperty(c[o]))return!1;for(o=i;o--!==0;)if(s=c[o],!ot(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}const _r=Object.freeze(Object.defineProperty({__proto__:null,JsonPatchError:le,_areEquals:ot,applyOperation:$e,applyPatch:xt,applyReducer:Sr,deepClone:Lr,getValueByPointer:mt,validate:yn,validator:yt},Symbol.toStringTag,{value:"Module"}));/*!
|
|
23
23
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
24
24
|
* (c) 2017-2021 Joachim Wester
|
|
25
25
|
* MIT license
|
|
26
|
-
*/var
|
|
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)||[],U=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 U){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 U=new Map,x=new Map,$=new Map;for(const[w,j]of T.entries())j.base!==void 0&&U.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 U=T.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(U){const x=U[1];s.has(x)||s.set(x,{patches1:[],patches2:[]});const $=s.get(x);$&&$.patches1.push(T)}}for(const T of D){const U=T.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(U){const x=U[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,oe=e!==void 0?q(e,K):void 0,ee=q(t,K),B=q(r,K);let fe=!1,Te=!1;Ee.op==="replace"?oe!==void 0&&(fe=!de(oe,ee),Te=!de(oe,B)):Ee.op==="add"?(fe=oe===void 0&&ee!==void 0,Te=oe===void 0&&B!==void 0):Ee.op==="remove"&&(fe=oe!==void 0&&ee===void 0,Te=oe!==void 0&&B===void 0),oe!==void 0&&(ee!==void 0&&de(oe,ee)&&(fe=!1),B!==void 0&&de(oe,B)&&(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,U=[];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 U.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 U){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(`
|
|
26
|
+
*/var Mt=new WeakMap,Pr=(function(){function e(t){this.observers=new Map,this.obj=t}return e})(),Rr=(function(){function e(t,r){this.callback=t,this.observer=r}return e})();function jr(e){return Mt.get(e)}function Dr(e,t){return e.observers.get(t)}function xr(e,t){e.observers.delete(t.callback)}function Mr(e,t){t.unobserve()}function $r(e,t){var r=[],n,o=jr(e);if(!o)o=new Pr(e),Mt.set(e,o);else{var i=Dr(o,t);n=i&&i.observer}if(n)return n;if(n={},o.value=Ae(e),t){n.callback=t,n.next=null;var s=function(){jt(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(){jt(n),clearTimeout(n.next),xr(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 Rr(t,n)),n}function jt(e,t){t===void 0&&(t=!1);var r=Mt.get(e.object);$t(r.value,e.object,e.patches,"",t),e.patches.length&&xt(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function $t(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var i=_t(t),s=_t(e),c=!1,a=s.length-1;a>=0;a--){var u=s[a],l=e[u];if(St(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)?$t(l,y,r,n+"/"+Me(u),o):l!==y&&(o&&r.push({op:"test",path:n+"/"+Me(u),value:Ae(l)}),r.push({op:"replace",path:n+"/"+Me(u),value:Ae(y)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+Me(u),value:Ae(l)}),r.push({op:"remove",path:n+"/"+Me(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];!St(e,u)&&t[u]!==void 0&&r.push({op:"add",path:n+"/"+Me(u),value:Ae(t[u])})}}}function qe(e,t,r){r===void 0&&(r=!1);var n=[];return $t(e,t,n,"",r),n}const Br=Object.freeze(Object.defineProperty({__proto__:null,compare:qe,generate:jt,observe:$r,unobserve:Mr},Symbol.toStringTag,{value:"Module"}));Object.assign({},_r,Br,{JsonPatchError:mn,deepClone:Ae,escapePathComponent:Me,unescapePathComponent:gn});const bt="oneOf",Bt="anyOf",Ft="allOf";function Ut(e){return!!(e[bt]||e[Bt]||e[Ft])}function vn(e){const t=e[bt]||e[Bt]||e[Ft];return Array.isArray(t)?t:void 0}function pt(e){return e.oneOf?bt:e.anyOf?Bt:e.allOf?Ft:""}function Fr(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 dt(e,t,r=bt){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=Fr(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 Dt(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 Pe(e,t){try{const r=dn(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:hn(r,n);return o?{start:an(e,o.offset),end:an(e,o.offset+o.length)}:{start:1,end:1}}catch{return{start:1,end:1}}}function an(e,t){return e.substring(0,t).split(`
|
|
27
|
+
`).length}function Ur(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 Vr(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 L=c.get(v)||[],V=a.get(v)||[];for(const $ of L){const B=$.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(B){const J=B[1];s.has(J)||s.set(J,{patches1:[],patches2:[]});const E=s.get(J);E&&E.patches1.push($)}}for(const $ of V){const B=$.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(B){const J=B[1];s.has(J)||s.set(J,{patches1:[],patches2:[]});const E=s.get(J);E&&E.patches2.push($)}}continue}const I=Ce(i,v,r),k=I!=null&&I.items?Array.isArray(I.items)&&I.items[0]?I.items[0]:Array.isArray(I.items)?null:I.items:null,g=k&&typeof k=="object"?k:null;if(g){const L=Gr(h,m,f,g);if(L.size>0){const V=new Map,$=new Map,B=new Map;for(const[A,D]of L.entries())D.base!==void 0&&V.set(D.base,A),D.input1!==void 0&&$.set(D.input1,A),D.input2!==void 0&&B.set(D.input2,A);const J=c.get(v)||[],E=a.get(v)||[];for(const A of J){const D=A.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(D){const Q=Number.parseInt(D[1],10),oe=$.get(Q);if(oe!==void 0){const ie=`${v}#${oe}`;s.has(ie)||s.set(ie,{patches1:[],patches2:[]});const ge=s.get(ie);ge&&ge.patches1.push(A)}}}for(const A of E){const D=A.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(D){const Q=Number.parseInt(D[1],10),oe=B.get(Q);if(oe!==void 0){const ie=`${v}#${oe}`;s.has(ie)||s.set(ie,{patches1:[],patches2:[]});const ge=s.get(ie);ge&&ge.patches2.push(A)}}}continue}}const b=c.get(v)||[],x=a.get(v)||[];for(const L of b){const V=L.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(V){const $=V[1];s.has($)||s.set($,{patches1:[],patches2:[]});const B=s.get($);B&&B.patches1.push(L)}}for(const L of x){const V=L.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(V){const $=V[1];s.has($)||s.set($,{patches1:[],patches2:[]});const B=s.get($);B&&B.patches2.push(L)}}}const p=(v,h)=>{if(!h)return null;const m=v.split("/").filter(Boolean);if(m.length<2)return null;const f=`/${m[0]}`,I=Ce(h,f);return I&&Ut(I)?f:null},d=[...u],_=[...l],T=new Set;for(const v of d){const h=p(v.path,i);h&&T.add(h)}for(const v of _){const h=p(v.path,i);h&&T.add(h)}for(const v of T)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 _){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 Ce(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&&Ut(o)){const l=vn(o),y=pt(o),p=r?q(r,i||"/"):void 0;if(l&&l.length>0)if(p!==void 0)try{const{schema:d}=dt(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 bn(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 Jr(e){const t=bn(e);return t.length>0?t[0]:null}function Hr(e,t,r){const n=new Map,o=bn(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 Gr(e,t,r,n){const o=new Map,i=Jr(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 wn(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=qe(o,i),a=qe(o,s);let u=Ur(c,a);n&&(u=Vr(c,a,e,t,r,n));const l=[],y=new Set,p=(d,_,T,v)=>{if(!n||typeof _!="object"||_===null||Array.isArray(_)||typeof T!="object"||T===null||Array.isArray(T)||typeof v!="object"||v===null||Array.isArray(v))return!1;const h=Ce(n,d,_);if(!h||!Ut(h))return!1;const m=vn(h);if(!m||m.length<2)return!1;const f=dt(_,m,pt(h)),I=dt(T,m,pt(h)),k=dt(v,m,pt(h));return I.selectedIndex!==k.selectedIndex&&(f.selectedIndex!==I.selectedIndex||f.selectedIndex!==k.selectedIndex)};for(const[d,{patches1:_,patches2:T}]of u){y.add(d);let v=d;_.length>0?v=_[0].path:T.length>0?v=T[0].path:d.includes("#")&&(v=d.split("#")[0]);let h=d;if(d.includes("#"))h=d.split("#")[0];else{const $=d.split("/").filter(Boolean);$.length>1&&(h=`/${$[0]}`)}if([..._,...T].every($=>($.path.split("/").slice(0,2).join("/")||`/${$.path.split("/")[1]}`)===h)&&h!==v){const $=q(e,h),B=q(t,h),J=q(r,h);if(p(h,$,B,J)){const A=$,D=B,Q=J;let oe=Dt(A,D,Q);!de(A,D)&&!de(A,Q)&&!de(D,Q)&&(oe=M.TRUE_CONFLICT);const ie=[..._,...T].filter(be=>be.path.startsWith(`${h}/`)||be.path===h),ge=[],Le=[];for(const be of ie){const st=be.path,Ne=e!==void 0?q(e,st):void 0,Z=q(t,st),pe=q(r,st);let te=!1,F=!1;be.op==="replace"?Ne!==void 0&&(te=!de(Ne,Z),F=!de(Ne,pe)):be.op==="add"?(te=Ne===void 0&&Z!==void 0,F=Ne===void 0&&pe!==void 0):be.op==="remove"&&(te=Ne!==void 0&&Z===void 0,F=Ne!==void 0&&pe===void 0),Ne!==void 0&&(Z!==void 0&&de(Ne,Z)&&(te=!1),pe!==void 0&&de(Ne,pe)&&(F=!1)),te&&ge.push(be),F&&Le.push(be)}l.push({path:h,baseValue:A,input1Value:D,input2Value:Q,conflictType:oe,patches1:ge,patches2:Le});continue}}const f=q(e,v),I=q(t,v),k=q(r,v);let g=Dt(f,I,k);const b=f!=null,x=I!=null,L=k!=null;!b&&x&&L&&g!==M.SAME_CHANGE&&(g=M.TRUE_CONFLICT),b&&de(f,I)&&de(f,k)||l.push({path:v,baseValue:f,input1Value:I,input2Value:k,conflictType:g,patches1:_,patches2:T})}return l}function On(e,t,r){var y,p,d,_;const n=typeof e=="object"&&e!==null||Array.isArray(e)?e:{},o=typeof t=="object"&&t!==null||Array.isArray(t)?t:{},i=qe(n,o);if(i.length===0)return[];const s=[],c=new Set,a=new Map,u=[];for(const T of i){const v=T.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);if(v){const h=v[1];a.has(h)||a.set(h,[]);const m=a.get(h);m&&m.push(T)}else u.push(T)}for(const[T,v]of a){const h=q(e,T),m=q(t,T);if(!Array.isArray(h)||!Array.isArray(m)){const g=new Map;for(const b of v){const x=b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(x){const L=x[1];g.has(L)||g.set(L,[]),(y=g.get(L))==null||y.push(b)}}for(const[b,x]of g)s.push(...et(b,x,e,t,void 0)),c.add(b);continue}const f=r?Ce(r,T,e):null,I=f!=null&&f.items?Array.isArray(f.items)&&f.items[0]?f.items[0]:Array.isArray(f.items)?null:f.items:null,k=I&&typeof I=="object"?I:null;if(k){const g=Hr(h,m,k),b=new Map,x=new Map;for(const[B,J]of g.entries())J.input1!==void 0&&b.set(J.input1,B),J.input2!==void 0&&x.set(J.input2,B);const L=new Map,V=[];for(const B of v){const J=B.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);if(J){const E=Number.parseInt(J[1],10);let A;if(B.op==="add"?A=x.get(E):A=b.get(E),A){L.has(A)||L.set(A,[]);const D=L.get(A);D&&D.push(B)}else V.push(B)}}for(const[B,J]of L){const E=g.get(B);if(!E)continue;const A=E.input1!==void 0?`${T}/${E.input1}`:`${T}/${E.input2}`;s.push(...et(A,J,e,t,void 0)),c.add(A)}const $=new Map;for(const B of V){const J=B.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(J){const E=J[1];$.has(E)||$.set(E,[]),(p=$.get(E))==null||p.push(B)}}for(const[B,J]of $)c.has(B)||(s.push(...et(B,J,e,t,void 0)),c.add(B))}else{const g=new Map;for(const b of v){const x=b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);if(x){const L=x[1];g.has(L)||g.set(L,[]),(d=g.get(L))==null||d.push(b)}}for(const[b,x]of g)s.push(...et(b,x,e,t,void 0)),c.add(b)}}const l=new Map;for(const T of u){const v=T.path.split("/").filter(Boolean),h=v.length>0?`/${v[0]}`:"/";l.has(h)||l.set(h,[]),(_=l.get(h))==null||_.push(T)}for(const[T,v]of l)s.push(...et(T,v,e,t,void 0));return s}function et(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 I=f.path,k=q(r,I),g=q(n,I);let b=!1,x=!1;f.op==="add"?(b=!1,x=g!==void 0):f.op==="remove"?(b=k!==void 0,x=!1):f.op==="replace"&&(b=k!==void 0&&!de(k,g),x=g!==void 0&&!de(k,g)),I===e&&(b=!0,x=!0),b&&a.push(f),x&&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"),_=p.some(f=>f.op==="remove"),T=p.some(f=>f.op==="replace");if(d&&!T&&!_){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(_&&!d&&!T){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=Dt(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 Lt(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=Pe(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 Wr(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,_,T;(((i=p.patches1)==null?void 0:i.length)??0)===0&&(((s=p.patches2)==null?void 0:s.length)??0)===0?(d=t?Pe(t,p.path):{start:1,end:1},_=Pe(r,p.path),T=Pe(n,p.path)):(d=Lt(t,[...p.patches1||[],...p.patches2||[]]),_=Lt(r,p.patches1||[]),T=Lt(n,p.patches2||[]));const v=p.conflictType===M.TRUE_CONFLICT;let h=re.excluded,m=re.excluded;switch(p.conflictType){case M.SAME_CHANGE:h=re.first,m=re.first;break;case M.INPUT1_ONLY:h=re.first;break;case M.INPUT2_ONLY:m=re.first;break;case M.TRUE_CONFLICT:m=re.first;break}const f=[],I=[];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 x=Pe(r,g.path);if(x.start!==1||x.end!==1)for(let L=x.start;L<=x.end;L++)f.push({line:L})}else if((((c=p.patches1)==null?void 0:c.length)??0)===0&&(((a=p.patches2)==null?void 0:a.length)??0)===0){const g=Pe(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=Pe(n,g.path);if(b.start!==1||b.end!==1)for(let x=b.start;x<=b.end;x++)I.push({line:x})}else if((((u=p.patches1)==null?void 0:u.length)??0)===0&&(((l=p.patches2)==null?void 0:l.length)??0)===0){const g=Pe(n,p.path);(g.start!==1||g.end!==1)&&I.push({line:g.start})}const k={id:`conflict-${y}`,path:p.path,baseRange:{startLineNumber:d.start,endLineNumberExclusive:d.end+1},input1Range:{startLineNumber:_.start,endLineNumberExclusive:_.end+1},input2Range:{startLineNumber:T.start,endLineNumberExclusive:T.end+1},input1Diffs:f,input2Diffs:I,isConflicting:v,conflictType:p.conflictType,input1State:h,input2State:m,handled:p.conflictType===M.SAME_CHANGE,focused:!1};o.push(k)}return o}function An(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=On(c,a,i);else if(o==="split")u=wn(s,c,a,i);else{const l=qe(s,c),y=qe(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 _=q(s,d),T=q(c,d),v=q(a,d),h=!de(_,T),m=!de(T,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:_,input1Value:T,input2Value:v,conflictType:f}})}return Wr(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 Nn(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 qr(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]:"",_=t[p]!==void 0?t[p]:"",T=r[p]!==void 0?r[p]:"",{conflictType:v,input1Changed:h,input2Changed:m}=Nn(d,_,T);(h||m)&&o.push({line:p+1,input1Changed:h,input2Changed:m,baseLine:d,input1Line:_,input2Line:T,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],_=p===o.length,T=!_&&d&&o[p-1]&&d.line>(((y=o[p-1])==null?void 0:y.line)??0)+1,v=!_&&d&&d.conflictType!==s;if(_||T||v){const h=o[p-1],m=h?h.line+1:i+1,f=c.length>0,I=a.length>0,k=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:k,conflictType:s,input1State:s===M.SAME_CHANGE&&f?re.first:re.excluded,input2State:I?re.first:re.excluded,handled:s===M.SAME_CHANGE,focused:!1};n.push(g),!_&&d&&(i=d.line,s=d.conflictType,c=[],a=[])}!_&&d&&(d.input1Changed&&c.push({line:d.line}),d.input2Changed&&a.push({line:d.line}))}return n}function Cr(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 Yr(e,t){try{const r=dn(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=hn(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
|
-
`).length;return{startLine:s,endLine:u}}catch{return null}}function
|
|
29
|
+
`).length;return{startLine:s,endLine:u}}catch{return null}}function En(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?Ce(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=En(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 zr(e,t,r,n,o){var k;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
|
|
33
|
-
`).length})}return{content:m,isValid:f,validationError:
|
|
34
|
-
`)):(
|
|
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 _=new Set,T=new Set,v=new Set,h=(g,b,x)=>null;for(const g of n){const b=g.input1State===re.first||g.input1State===re.second,x=g.input2State===re.first||g.input2State===re.second;let L=g.path;if(!L&&(L=h(g.baseRange.startLineNumber,g.baseRange.endLineNumberExclusive)||void 0,!L)){g.conflictType===M.INPUT2_ONLY&&x?d=JSON.parse(JSON.stringify(p)):g.conflictType===M.INPUT1_ONLY&&b?d=JSON.parse(JSON.stringify(y)):g.conflictType===M.SAME_CHANGE&&(b||x)||x?d=JSON.parse(JSON.stringify(p)):b&&(d=JSON.parse(JSON.stringify(y)));continue}try{let V,$=L;const B=(k=g.path)==null?void 0:k.match(/^(.*\/\d+)(?:\/.*)?$/);let J=!1,E="";if(B){const D=B[1].split("/").filter(Q=>Q!=="");if(D.length>=2){const Q=D[D.length-1];/^\d+$/.test(Q)&&(J=!0,E=`/${D.slice(0,-1).join("/")}`)}}if(b&&x)if(g.conflictType===M.SAME_CHANGE)J?(V=q(p,E),$=E):V=q(p,L);else{const A=J?E:L,D=q(y,A),Q=q(p,A),oe=o&&l&&typeof l=="object"&&Ce(o,A,l)||void 0,ie=En(D,Q,oe,A);ie!==null?(V=ie,$=A,i.push(`Smart-merged conflict at path ${A}`)):(V=Q,$=A,i.push(`Merge failed at path ${A}, using input2 value`))}else if(b)if(J)V=q(y,E),$=E;else{const A=L.split("/").filter(Boolean);if(A.length>1){const D=`/${A.slice(0,-1).join("/")}`;if(!v.has(D)){const Q=q(y,D);if(typeof Q=="object"&&Q!==null&&!Array.isArray(Q)){const oe=q(d,D);if(typeof oe=="object"&&oe!==null&&!Array.isArray(oe)){for(const[ie,ge]of Object.entries(Q)){const Le=`${D}/${ie}`;T.has(Le)||(oe[ie]=ge)}v.add(D)}}}V=q(y,L)}else V=q(y,L)}else if(x)if(J)V=q(p,E),$=E;else{const A=L.split("/").filter(Boolean);if(A.length>1){const D=`/${A.slice(0,-1).join("/")}`;if(!v.has(D)){const Q=q(p,D);if(typeof Q=="object"&&Q!==null&&!Array.isArray(Q)){const oe=q(d,D);if(typeof oe=="object"&&oe!==null&&!Array.isArray(oe)){for(const[ie,ge]of Object.entries(Q)){const Le=`${D}/${ie}`;T.has(Le)||(oe[ie]=ge)}v.add(D)}}}V=q(p,L)}else V=q(p,L)}else{const A=J?E:L,D=q(l,A);if(D!==void 0)V=D,$=A;else continue}V!==void 0&&(Cr(d,$,V),_.add($),T.add($))}catch(V){i.push(`Failed to apply conflict at path ${L||g.id}: ${V instanceof Error?V.message:String(V)}`)}}const m=JSON.stringify(d,null,2);for(const g of n){const b=g.path;if(!b)continue;const x=g.input1State===re.first||g.input1State===re.second,L=g.input2State===re.first||g.input2State===re.second;if(x&&L&&g.conflictType===M.TRUE_CONFLICT){const V=Yr(m,b);V&&s.push({conflictId:g.id,conflictPath:b,type:"warning",message:"Both conflicting changes were accepted - please review and manually resolve",startLine:V.startLine,endLine:V.endLine})}}let f=!0,I;try{JSON.parse(m)}catch(g){f=!1,I=g instanceof Error?g.message:"Invalid JSON",s.push({conflictId:"validation-error",conflictPath:"/",type:"error",message:I,startLine:1,endLine:m.split(`
|
|
33
|
+
`).length})}return{content:m,isValid:f,validationError:I,warnings:i.length>0?i:void 0,conflictIssues:s.length>0?s:void 0}}function Xr(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 Tn(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 Qr(e,t,r){const n=[];if(t.input1Class){if(e.input1Diffs.length>0){const o=Tn(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 Zr(e,t,r){const n=[];if(e.input2Diffs.length>0&&t.input2Class){const o=Tn(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 Kr(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 eo(e,t,r,n){const o=Xr(e,t,r);return{input1Decorations:Qr(e,o,n),input2Decorations:Zr(e,o,n),baseDecorations:Kr(e,o,n)}}function to(e,t,r,n){const o=[],i=[],s=[];for(const c of e){const a=eo(c,t,r,n);o.push(...a.input1Decorations),i.push(...a.input2Decorations),s.push(...a.baseDecorations)}return{input1Decorations:o,input2Decorations:i,baseDecorations:s}}const no=()=>tt.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#888"},children:"Loading Monaco Editor..."}),kt="⚠";function ro(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:_="split",schema:T,patches:v,labels:h}=e,m=n?p:!1,f=!n||n==="",I="json",[k,g]=R.useState(!1),[b,x]=R.useState(!0),[L,V]=R.useState([]),[$,B]=R.useState(null),[J,E]=R.useState([]),[A,D]=R.useState([]),[Q,oe]=R.useState(!1),[ie,ge]=R.useState(new Set),Le=R.useRef(""),be=R.useCallback((P,w,N,O)=>{const S=document.createElement("div");S.className="native-checkbox-container";const U=document.createElement("input");return U.type="checkbox",U.className="native-checkbox",U.checked=P===re.first||P===re.second,U.setAttribute("aria-label",U.checked?"Undo accept":"Accept change"),U.addEventListener("click",K=>{K.preventDefault(),K.stopPropagation(),requestAnimationFrame(()=>{O()})}),S.appendChild(U),S},[]),[st,Ne]=R.useState(0),Z=R.useRef(null),pe=R.useRef(null),te=R.useRef(null),F=R.useRef(null),we=R.useRef(null),Ye=R.useRef(null),je=R.useRef(!1),wt=R.useRef(!1),Be=R.useRef(null),ze=R.useRef(null),Se=R.useRef(null),Fe=R.useRef(new Map),Te=R.useRef(null),_e=R.useRef(new Map),Ue=R.useRef(null),Ve=R.useRef(null),Je=R.useRef(null);R.useEffect(()=>{let P=!0;const w=mr.init();return w.then(N=>{P&&(we.current=N,x(!1),g(!0))}).catch(N=>{P&&(N==null?void 0:N.type)!=="cancelation"&&console.error("Monaco initialization: error:",N)}),()=>{P=!1,je.current||w.cancel()}},[]);const Vt=R.useCallback((P,w,N)=>{if(!we.current)return[];const O=(P==null?void 0:P.getValue())||"",S=w.getValue(),U=N.getValue();try{const K=performance.now(),z=An(O,S,U,{comparisonMode:_,schema:T,patches:v}),j=performance.now()-K;return j>100&&console.warn(`JSON Patch diff took ${j.toFixed(2)}ms`),z}catch(K){const z=K instanceof Error?K.message:String(K);return console.error("JSON Patch diff error:",z),[]}},[_,T,v]),Xe=R.useCallback(P=>{try{return P.getLayoutInfo().decorationsLeft||0}catch{return 0}},[]),Qe=R.useCallback(P=>{try{return P.getLayoutInfo().decorationsWidth||0}catch{return 0}},[]),ct=R.useCallback(P=>{if(!m||!F.current||!Se.current)return;const w=we.current;if(!w)return;const N=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),O=Xe(F.current),S=Qe(F.current);Se.current.style.left=`${O}px`,Se.current.style.width=`${S}px`;const U=F.current.getScrollTop();if(F.current.getModel()){Se.current.innerHTML="";for(const z of P){const j=z.startLine,ue=z.endLine,ne=F.current.getTopForLineNumber(j)-U,G=F.current.getTopForLineNumber(ue)-U,H=F.current.getOption(w.editor.EditorOption.lineHeight),se=ue>j?G-ne+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,ne)}px`,W.style.height=`${se}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 ce=document.createElement("div");ce.className="issue-icon",z.type==="error"?(ce.textContent="✗",ce.style.color=N?"#ff6666":"#cc0000"):z.type==="warning"?(ce.textContent=kt,ce.style.color=N?"#ffaa00":"#ff8800"):z.type==="smart-merge"&&(ce.textContent="↕",ce.style.color=N?"#0096ff":"#0078d4"),ce.style.fontSize="14px",ce.style.fontWeight="bold",W.appendChild(ce),Se.current.appendChild(W)}}},[m,o,Xe,Qe]),at=R.useCallback(P=>{var ae,se,W,ce;if(!F.current||Q)return;const w=F.current.getModel(),N=(ae=Z.current)==null?void 0:ae.getModel(),O=(se=te.current)==null?void 0:se.getModel(),S=(W=pe.current)==null?void 0:W.getModel();if(!w||!N||!O||!S)return;const U=S.getLinesContent(),K=N.getLinesContent(),z=O.getLinesContent(),j=zr(U,K,z,P,T);if(B(j.isValid?null:j.validationError||"Invalid JSON"),E(j.warnings||[]),D(j.conflictIssues||[]),Te.current){const X=(h==null?void 0:h.result)||"Result";j.isValid?j.warnings&&j.warnings.length>0?(Te.current.textContent=`${X} ${kt}`,Te.current.title=j.warnings.join(`
|
|
34
|
+
`)):(Te.current.textContent=X,Te.current.style.color="",Te.current.title=""):(Te.current.textContent=`${X} ${kt} Invalid JSON`,Te.current.style.color="#ff4444",Te.current.title=j.validationError||"Invalid JSON - please fix manually")}if(w.getValue()!==j.content){const X=F.current.getPosition(),C=F.current.getSelection();if(wt.current=!0,w.setValue(j.content),wt.current=!1,X){const he=w.getLineCount(),Y=w.getLineLength(he),ye={lineNumber:Math.min(X.lineNumber,he),column:X.lineNumber<=he?Math.min(X.column,w.getLineLength(X.lineNumber)+1):Y+1};F.current.setPosition(ye),C&&!C.isEmpty()&&F.current.setSelection(C)}}const ne=we.current,G=w;let H=G._invalidDecorations;if(!j.isValid&&F.current&&ne?(H||(H=F.current.createDecorationsCollection([]),G._invalidDecorations=H),H.set([{range:new ne.Range(1,1,w.getLineCount(),Number.MAX_SAFE_INTEGER),options:{isWholeLine:!1,className:"merge-result-invalid",hoverMessage:{value:j.validationError||"Invalid JSON - please fix manually"}}}])):j.isValid&&H&&F.current&&H.set([]),j.conflictIssues&&j.conflictIssues.length>0){if(ct(j.conflictIssues),F.current&&ne){const X=w;if(!X._conflictIssueDecorations){const Y=F.current.createDecorationsCollection([]);X._conflictIssueDecorations=Y}const C=X._conflictIssueDecorations,he=j.conflictIssues.map(Y=>{let ye,Ee;return Y.type==="error"?(ye=o==="vs-dark"?"rgba(255, 0, 0, 0.1)":"rgba(255, 0, 0, 0.05)",Ee=o==="vs-dark"?"#ff6666":"#cc0000"):Y.type==="warning"?(ye=o==="vs-dark"?"rgba(255, 170, 0, 0.1)":"rgba(255, 136, 0, 0.05)",Ee=o==="vs-dark"?"#ffaa00":"#ff8800"):(ye=o==="vs-dark"?"rgba(0, 150, 255, 0.1)":"rgba(0, 120, 212, 0.05)",Ee=o==="vs-dark"?"#0096ff":"#0078d4"),{range:new ne.Range(Y.startLine,1,Y.endLine,Number.MAX_SAFE_INTEGER),options:{isWholeLine:!0,className:`conflict-issue-line conflict-issue-${Y.type}`,linesDecorationsClassName:`conflict-issue-line-decoration conflict-issue-${Y.type}`,backgroundColor:ye,overviewRuler:{color:Ee,position:ne.editor.OverviewRulerLane.Right},minimap:{color:Ee,position:ne.editor.MinimapPosition.Inline}}}});C.set(he)}}else if(F.current){const X=w;X._conflictIssueDecorations&&X._conflictIssueDecorations.set([]),Se.current&&m&&(Se.current.innerHTML="")}if(y){const X=`${j.content}|${j.isValid}|${(ce=j.warnings)==null?void 0:ce.join(",")}`;Le.current!==X&&(Le.current=X,queueMicrotask(()=>{y(j.content,{isValid:j.isValid,validationError:j.validationError,warnings:j.warnings,conflictIssues:j.conflictIssues})}))}},[y,T,h,o,ct,m,Q]),Ot=R.useCallback((P,w)=>{oe(!1),V(N=>{const O=N.map(S=>{if(S.id!==P)return S;const K=(w===1?S.input1State:S.input2State)===re.excluded?re.first:re.excluded;return w===1?{...S,input1State:K}:{...S,input2State:K}});return m&&F.current&&at(O),O})},[m,at]),At=R.useCallback((P,w,N,O,S,U,K)=>{if(!we.current)return;const j=O===1?Z.current:te.current;if(!j)return;const ue=O===1?N.input1Range:N.input2Range,ne=O===1?N.input1State:N.input2State,G=j.getModel();if(!G)return;const H=G.getLineCount(),ae=Math.max(1,Math.min(ue.startLineNumber,H)),se=Math.max(1,Math.min(ue.endLineNumberExclusive-1,H));if(ae>H||se<1||ae>se)return;const W=j.getTopForLineNumber(ae)-S,X=j.getBottomForLineNumber(se)-S-W;let C=Fe.current.get(w);if(!C){C=document.createElement("div"),C.className="merge-accept-gutter-marker";const fe=document.createElement("div");fe.className="background",C.appendChild(fe);const ee=document.createElement("div");ee.className="checkbox";const me=document.createElement("div");me.className="checkbox-background";const ve=be(ne,O,N.id,()=>Ot(N.id,O));me.appendChild(ve),ee.appendChild(me),C.appendChild(ee),P.appendChild(C),Fe.current.set(w,C)}C.style.top=`${W}px`,C.style.height=`${X}px`;const he=C.querySelector(".checkbox-background");if(he){he.innerHTML="";const fe=be(ne,O,N.id,()=>Ot(N.id,O));he.appendChild(fe)}const Y=N.handled,ye=N.focused,Ee=X>30;C.className="merge-accept-gutter-marker",Y&&C.classList.add("handled"),ye&&C.classList.add("focused"),Ee?C.classList.add("multi-line"):C.classList.add("single-line");const De=C.querySelector(".checkbox");if(De){const ee=X/2-12,me=24;let ve=ee;const Ie=me,ke=U-me-24,xe=me,ut=X-24-me;xe<ut&&(ve=Math.max(Ie,Math.min(ve+W,ke))-W,ve=Math.max(xe,Math.min(ve,ut))),De.style.top=`${ve+5}px`}},[Ot,be]),lt=R.useCallback(()=>{if(!m){const G=Fe.current;for(const[H,ae]of G.entries())ae.remove(),G.delete(H);return}if(!Z.current||!te.current||!Be.current||!ze.current||!we.current)return;const w=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),N=Xe(Z.current),O=Qe(Z.current),S=Xe(te.current),U=Qe(te.current);Be.current.style.left=`${N}px`,Be.current.style.width=`${O}px`,ze.current.style.left=`${S}px`,ze.current.style.width=`${U}px`;const K=Z.current.getVisibleRanges();if(!K||K.length===0)return;const z=Z.current.getScrollTop(),j=Be.current.clientHeight,ue=new Set;for(const G of L)if(!(G.input1Diffs.length===0&&G.input2Diffs.length===0)){if(G.input1Diffs.length>0){const H=`${G.id}-input1`;ue.add(H),At(Be.current,H,G,1,z,j,w)}if(G.input2Diffs.length>0){const H=`${G.id}-input2`;ue.add(H),At(ze.current,H,G,2,z,j,w)}}const ne=Fe.current;for(const[G,H]of ne.entries())ue.has(G)||(H.remove(),ne.delete(G))},[L,o,m,Xe,Qe,At]),Oe=R.useCallback((P,w)=>{var N,O,S;try{if(we.current){const U=(O=(N=we.current.editor).getTheme)==null?void 0:O.call(N);if((S=U==null?void 0:U.colors)!=null&&S[P])return U.colors[P]}}catch{}return w},[]),Jt=R.useCallback(()=>{if(!we.current||!Z.current||!te.current)return;const P=we.current,w=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),N=Oe("mergeEditor.change.background",w?"rgba(255, 166, 0, 0.2)":"rgba(255, 166, 0, 0.15)"),O=Oe("diffEditor.insertedTextBackground",w?"rgba(155, 185, 85, 0.2)":"rgba(155, 185, 85, 0.15)"),S=Oe("mergeEditor.changeBase.background",w?"rgba(255, 100, 100, 0.2)":"rgba(255, 100, 100, 0.15)"),U=Oe("editorOverviewRuler.modifiedForeground",w?"rgba(255, 166, 0, 0.8)":"rgba(255, 166, 0, 1)"),K=Oe("editorOverviewRuler.addedForeground",w?"rgba(155, 185, 85, 0.8)":"rgba(155, 185, 85, 1)"),z=Oe("editorOverviewRuler.deletedForeground",w?"rgba(255, 100, 100, 0.8)":"rgba(255, 100, 100, 1)"),j=f,ue={conflictOverviewColor:U,changeOverviewColor:K,baseOverviewColor:z},{input1Decorations:ne,input2Decorations:G,baseDecorations:H}=to(L,j,ue,P),ae=Oe("input.background",w?"#3c3c3c":"#f3f3f3"),se=Oe("input.border",w?"#6b6b6b":"#c8c8c8"),W=Oe("focusBorder",w?"#007acc":"#0078d4"),ce=Oe("inputOption.activeForeground",w?"#3794ff":"#0078d4"),X="monaco-three-way-diff-dynamic";let C=document.getElementById(X);C||(C=document.createElement("style"),C.id=X,document.head.appendChild(C));const he=Oe("diffEditor.insertedTextBackground",w?"rgba(100, 100, 255, 0.15)":"rgba(100, 100, 255, 0.1)"),Y=Oe("diffEditor.insertedTextBackground",w?"rgba(155, 185, 85, 0.2)":"rgba(155, 185, 85, 0.15)");C.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 {
|
|
38
|
-
background-color: ${
|
|
38
|
+
background-color: ${N};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/* 2-way diff mode: red for deletions (input1 column) - must override merge-change-incoming */
|
|
42
42
|
.monaco-editor .merge-2way-deletion,
|
|
43
43
|
.monaco-editor .monaco-editor .merge-2way-deletion {
|
|
44
|
-
background-color: ${
|
|
44
|
+
background-color: ${S} !important;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/* Single-side change (green for input2/ours, orange for input1/theirs in 3-way) */
|
|
48
48
|
.monaco-editor .merge-change-incoming {
|
|
49
|
-
background-color: ${
|
|
49
|
+
background-color: ${Y};
|
|
50
50
|
}
|
|
51
51
|
.monaco-editor .merge-change-current {
|
|
52
|
-
background-color: ${
|
|
52
|
+
background-color: ${O};
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/* Same change on both sides (blue/purple) */
|
|
@@ -60,13 +60,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
60
60
|
/* Base changes */
|
|
61
61
|
.monaco-editor .merge-conflict-base,
|
|
62
62
|
.monaco-editor .merge-change-base {
|
|
63
|
-
background-color: ${
|
|
63
|
+
background-color: ${S};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/* Invalid JSON in result column */
|
|
67
67
|
.monaco-editor .merge-result-invalid {
|
|
68
|
-
background-color: ${
|
|
69
|
-
outline: 1px solid ${
|
|
68
|
+
background-color: ${w?"rgba(255, 0, 0, 0.2)":"rgba(255, 0, 0, 0.1)"};
|
|
69
|
+
outline: 1px solid ${w?"rgba(255, 100, 100, 0.5)":"rgba(255, 0, 0, 0.3)"};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/* Diff symbols (+ and -) in line decorations - positioned in code area */
|
|
@@ -98,7 +98,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
98
98
|
pointer-events: none;
|
|
99
99
|
font-family: "Courier New", monospace;
|
|
100
100
|
width: 20px;
|
|
101
|
-
color: ${
|
|
101
|
+
color: ${w?"#9BB955":"#6A9955"};
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
.monaco-editor .diff-symbol.diff-symbol-minus::before {
|
|
@@ -117,7 +117,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
117
117
|
pointer-events: none;
|
|
118
118
|
font-family: "Courier New", monospace;
|
|
119
119
|
width: 20px;
|
|
120
|
-
color: ${
|
|
120
|
+
color: ${w?"#FF6464":"#CC0000"};
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/* VSCode-style checkbox gutter - positioned at Monaco's glyph margin */
|
|
@@ -160,8 +160,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
160
160
|
width: 14px;
|
|
161
161
|
height: 14px;
|
|
162
162
|
border-radius: 3px;
|
|
163
|
-
background-color: ${
|
|
164
|
-
border: 1px solid ${
|
|
163
|
+
background-color: ${ae};
|
|
164
|
+
border: 1px solid ${se};
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
.merge-accept-gutter-marker.focused .checkbox-background {
|
|
@@ -188,7 +188,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
188
188
|
height: 16px;
|
|
189
189
|
cursor: pointer;
|
|
190
190
|
margin: 0;
|
|
191
|
-
accent-color: ${
|
|
191
|
+
accent-color: ${ce};
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
/* Result column status indicator */
|
|
@@ -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
|
-
`,
|
|
219
|
+
`,Ue.current||(Ue.current=Z.current.createDecorationsCollection([])),Ue.current.set(ne),Ve.current||(Ve.current=te.current.createDecorationsCollection([])),Ve.current.set(G),pe.current&&(Je.current||(Je.current=pe.current.createDecorationsCollection([])),Je.current.set(H))},[L,o,f,Oe]),Ht=R.useCallback(()=>{if(!je.current&&Ye.current&&we.current&&!b){const P=we.current;Ye.current.innerHTML="",_e.current.clear();const w=document.createElement("div");w.style.display="flex",w.style.height="100%",w.style.width="100%";const N=o==="vs-dark"||typeof o=="string"&&o.includes("dark"),O=N?"#444":"#ddd",S=N?"#fff":"#333",U=(Y,ye)=>{var Ee,De,fe;try{const ee=(De=(Ee=P.editor).getTheme)==null?void 0:De.call(Ee);if((fe=ee==null?void 0:ee.colors)!=null&&fe[Y])return ee.colors[Y]}catch{}return ye},K=U("mergeEditor.conflict.input1.header.background",N?"#4B1818":"#FFE6E6"),z=U("editorGutter.background",N?"#333":"#f0f0f0"),j=U("mergeEditor.conflict.input2.header.background",N?"#1B4B18":"#E6FFE6"),ue=U("mergeEditor.result.header.background",N?"#7F5F00":"#FFECB3"),ne=(Y,ye,Ee,De=!1)=>{const fe=document.createElement("div");fe.style.flex="1",fe.style.display="flex",fe.style.flexDirection="column",fe.style.borderRight=`1px solid ${O}`,fe.style.overflow="hidden",fe.style.transition="flex 0.2s ease, min-width 0.2s ease, max-width 0.2s ease",fe.dataset.columnKey=Y;const ee=document.createElement("div");ee.style.padding="4px 8px",ee.style.fontSize="11px",ee.style.fontWeight="500",ee.style.backgroundColor=Ee,ee.style.color=S,ee.style.borderBottom=`1px solid ${O}`,ee.style.display="flex",ee.style.alignItems="center",ee.style.gap="4px",ee.style.height="22px",ee.style.boxSizing="content-box",ee.style.whiteSpace="nowrap",ee.style.overflow="hidden";const me=document.createElement("span");me.textContent=ye,me.style.flex="1",me.style.overflow="hidden",me.style.textOverflow="ellipsis",ee.appendChild(me);const ve=document.createElement("div");ve.className="column-collapse-icon",ve.title="Collapse column",ve.innerHTML='<svg width="12" height="12" viewBox="0 0 12 12" fill="none" style="display:block"><path d="M8 2L4 6L8 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>',ve.addEventListener("click",ut=>{ut.stopPropagation(),ge(Yt=>{const Ze=new Set(Yt);if(Ze.has(Y))Ze.delete(Y);else{if(Array.from(_e.current.keys()).filter(In=>!Ze.has(In)).length<=1)return Yt;Ze.add(Y)}return Ze})}),ee.appendChild(ve),fe.appendChild(ee);const Ie=document.createElement("div");Ie.style.flex="1",Ie.style.position="relative",Ie.style.overflow="hidden",Ie.style.transition="opacity 0.2s ease";const ke=document.createElement("div");ke.style.position="absolute",ke.style.left="0",ke.style.right="0",ke.style.top="0",ke.style.bottom="0",Ie.appendChild(ke);let xe=null;return De&&(xe=document.createElement("div"),xe.className="merge-editor-gutter",Ie.appendChild(xe)),fe.appendChild(Ie),_e.current.set(Y,{container:fe,editorWrapper:Ie,labelDiv:ee,labelText:me,collapseIcon:ve}),{container:fe,editorDiv:ke,gutterDiv:xe}},G=ne("input1",(h==null?void 0:h.input1)||"Theirs",K,m),H=ne("input2",(h==null?void 0:h.input2)||"Ours",j,m);G.gutterDiv&&(Be.current=G.gutterDiv),H.gutterDiv&&(ze.current=H.gutterDiv);const ae=!!n;let se=null;if(ae){se=ne("base",(h==null?void 0:h.base)||"Base",z,!1);const Y=[];d===0?Y.push(se.container,G.container,H.container):d===1?Y.push(G.container,se.container,H.container):d===2&&Y.push(G.container,H.container,se.container),Y.forEach(ye=>{w.appendChild(ye)})}else w.appendChild(G.container),w.appendChild(H.container);let W=null;if(m&&ae){W=ne("result",(h==null?void 0:h.result)||"Result",ue,!0);const Y=_e.current.get("result");Te.current=(Y==null?void 0:Y.labelText)??W.container.querySelector("span"),W.gutterDiv&&(Se.current=W.gutterDiv),w.appendChild(W.container)}Ye.current.appendChild(w);const ce=P.editor.createModel(t||"",I),X=ae?P.editor.createModel(n||"",I):null,C=P.editor.createModel(r||"",I);if(Z.current=P.editor.create(G.editorDiv,{model:ce,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:m?26:10}),ae&&se&&(pe.current=P.editor.create(se.editorDiv,{model:X,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:10})),te.current=P.editor.create(H.editorDiv,{model:C,readOnly:!0,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,lineDecorationsWidth:m?26:10}),m&&W){const Y=P.editor.createModel(r||"",I);F.current=P.editor.create(W.editorDiv,{model:Y,automaticLayout:!0,folding:!m,glyphMargin:!1,...i,readOnly:!1,lineDecorationsWidth:26}),Y.onDidChangeContent(()=>{wt.current||oe(!0)})}P.editor.setTheme(o);const he=Vt(X,ce,C);V(he),je.current=!0,l&&Z.current&&te.current&&l({input1:Z.current,input2:te.current,base:pe.current,result:F.current},P)}},[i,o,t,r,n,m,d,b,Vt,l,h]),Gt=R.useRef(m),Wt=R.useRef(d),qt=R.useRef(_),Ct=R.useRef(n);return R.useEffect(()=>{var S,U,K,z,j,ue,ne,G,H,ae,se;const P=Gt.current!==m,w=Wt.current!==d,N=qt.current!==_,O=Ct.current!==n;if((P||w||N||O)&&je.current){Gt.current=m,Wt.current=d,qt.current=_,Ct.current=n,Fe.current.forEach(he=>{he.remove()}),Fe.current.clear(),_e.current.clear(),ge(new Set),(S=Ue.current)==null||S.set([]),(U=Ve.current)==null||U.set([]),(K=Je.current)==null||K.set([]),Ue.current=null,Ve.current=null,Je.current=null;const W=(z=Z.current)==null?void 0:z.getModel(),ce=(j=pe.current)==null?void 0:j.getModel(),X=(ue=te.current)==null?void 0:ue.getModel(),C=(ne=F.current)==null?void 0:ne.getModel();(G=Z.current)==null||G.dispose(),(H=pe.current)==null||H.dispose(),(ae=te.current)==null||ae.dispose(),(se=F.current)==null||se.dispose(),W==null||W.dispose(),ce==null||ce.dispose(),X==null||X.dispose(),C==null||C.dispose(),je.current=!1,Ne(he=>he+1)}},[m,d,_,n]),R.useEffect(()=>{!b&&we.current&&Ye.current&&!je.current&&Ht()},[b,Ht]),R.useEffect(()=>{!k||!i||(Z.current&&Z.current.updateOptions(i),te.current&&te.current.updateOptions(i),pe.current&&pe.current.updateOptions(i),F.current&&F.current.updateOptions(i))},[i,k]),R.useEffect(()=>{k&&L.length>0&&(Jt(),m&<())},[k,L,Jt,lt,m]),R.useEffect(()=>{k&&L.length>0&&m&&F.current&&at(L)},[k,L,m,at]),R.useEffect(()=>{if(!k)return;const P=()=>{A.length>0&&ct(A)},w=[],N=()=>{lt()};return Z.current&&w.push(Z.current.onDidScrollChange(N)),te.current&&w.push(te.current.onDidScrollChange(N)),F.current&&m&&(w.push(F.current.onDidScrollChange(P)),w.push(F.current.onDidLayoutChange(P))),Z.current&&w.push(Z.current.onDidLayoutChange(N)),te.current&&w.push(te.current.onDidLayoutChange(N)),()=>{w.forEach(O=>{O==null||O.dispose()})}},[k,lt,ct,m,A]),R.useEffect(()=>{if(!k)return;const P=[Z.current,pe.current,te.current];m&&F.current&&P.push(F.current);const w=[];let N=!1;const O=S=>{if(N)return;N=!0;const U=S.getScrollTop(),K=S.getScrollLeft();P.forEach(z=>{z&&z!==S&&(z.setScrollTop(U),z.setScrollLeft(K))}),setTimeout(()=>{N=!1},10)};return P.forEach(S=>{S&&w.push(S.onDidScrollChange(()=>{O(S)}))}),()=>{w.forEach(S=>{S==null||S.dispose()})}},[k,m]),R.useEffect(()=>{if(!k)return;const w=Array.from(_e.current.keys()).filter(N=>!ie.has(N)).length;for(const[N,O]of _e.current.entries()){const S=ie.has(N),U=w>1||S;S?(O.container.style.flex="0 0 28px",O.container.style.minWidth="28px",O.container.style.maxWidth="28px",O.editorWrapper.style.opacity="0",O.editorWrapper.style.pointerEvents="none",O.labelDiv.style.justifyContent="center",O.labelText.style.display="none",O.collapseIcon.style.transform="rotate(180deg)",O.collapseIcon.title="Expand column"):(O.container.style.flex="1",O.container.style.minWidth="",O.container.style.maxWidth="",O.editorWrapper.style.opacity="1",O.editorWrapper.style.pointerEvents="",O.labelDiv.style.justifyContent="",O.labelText.style.display="",O.collapseIcon.style.transform="",O.collapseIcon.title="Collapse column"),!S&&!U?(O.collapseIcon.classList.add("column-collapse-icon--disabled"),O.collapseIcon.title="Cannot collapse last column"):O.collapseIcon.classList.remove("column-collapse-icon--disabled")}requestAnimationFrame(()=>{var N;for(const[O]of _e.current.entries())if(!ie.has(O)){const S=O==="input1"?Z:O==="input2"?te:O==="base"?pe:O==="result"?F:null;(N=S==null?void 0:S.current)==null||N.layout()}})},[k,ie]),R.useEffect(()=>()=>{var S,U,K,z,j,ue,ne,G,H,ae,se;(S=Ue.current)==null||S.set([]),(U=Ve.current)==null||U.set([]),(K=Je.current)==null||K.set([]);const P=(z=Z.current)==null?void 0:z.getModel(),w=(j=pe.current)==null?void 0:j.getModel(),N=(ue=te.current)==null?void 0:ue.getModel(),O=(ne=F.current)==null?void 0:ne.getModel();(G=Z.current)==null||G.dispose(),(H=pe.current)==null||H.dispose(),(ae=te.current)==null||ae.dispose(),(se=F.current)==null||se.dispose(),P==null||P.dispose(),w==null||w.dispose(),N==null||N.dispose(),O==null||O.dispose(),je.current=!1,g(!1)},[]),b||!k?tt.jsx(tt.Fragment,{children:u??tt.jsx(no,{})}):tt.jsx("div",{ref:Ye,style:{width:s,height:c},className:a})}exports.JsonDiffMergeEditor=ro;exports.analyzeConflicts=wn;exports.analyzeTwoWayConflicts=On;exports.computeDiffs=qr;exports.computeDiffsJsonPatch=An;exports.computeLineConflictType=Nn;
|
|
220
220
|
//# sourceMappingURL=index.cjs.map
|