intlayer-editor 5.2.5 → 5.2.6

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.
@@ -53,7 +53,7 @@ Error generating stack: `+h.message+`
53
53
  * Copyright(c) 2012-2014 Isaac Z. Schlueter
54
54
  * Copyright(c) 2015 Douglas Christopher Wilson
55
55
  * MIT Licensed
56
- */var Sp;function Ib(){if(Sp)return xs.exports;Sp=1;var e=Eb(),t=_b(),a=Sb(),n=zb();xs.exports=r,xs.exports.Negotiator=r;function r(s){if(!(this instanceof r))return new r(s);this.request=s}return r.prototype.charset=function(o){var u=this.charsets(o);return u&&u[0]},r.prototype.charsets=function(o){return e(this.request.headers["accept-charset"],o)},r.prototype.encoding=function(o,u){var d=this.encodings(o,u);return d&&d[0]},r.prototype.encodings=function(o,u){var d=u||{};return t(this.request.headers["accept-encoding"],o,d.preferred)},r.prototype.language=function(o){var u=this.languages(o);return u&&u[0]},r.prototype.languages=function(o){return a(this.request.headers["accept-language"],o)},r.prototype.mediaType=function(o){var u=this.mediaTypes(o);return u&&u[0]},r.prototype.mediaTypes=function(o){return n(this.request.headers.accept,o)},r.prototype.preferredCharset=r.prototype.charset,r.prototype.preferredCharsets=r.prototype.charsets,r.prototype.preferredEncoding=r.prototype.encoding,r.prototype.preferredEncodings=r.prototype.encodings,r.prototype.preferredLanguage=r.prototype.language,r.prototype.preferredLanguages=r.prototype.languages,r.prototype.preferredMediaType=r.prototype.mediaType,r.prototype.preferredMediaTypes=r.prototype.mediaTypes,xs.exports}Ib();const Nb=(e,t=Y2.internationalization.locales)=>{const a=zS(e);let n=e;e.endsWith("/")&&(n=e.slice(0,-1));const r=a?new URL(n):new URL(n,"http://example.com"),s=r.pathname;s.startsWith("/")||(r.pathname=`/${s}`);const o=s.split("/"),u=o[1];if(t.includes(u)){o.splice(1,1);const d=o.join("/")??"/";r.pathname=d}return a?r.toString():r.toString().replace("http://example.com","")},yb=(e,t=Y2.internationalization.locales,a=Y2.internationalization.defaultLocale,n=Y2.middleware.prefixDefault)=>{const r=Nb(e,t),s=zS(r),o=s?new URL(r):new URL(r,"http://example.com");let u=o.pathname;u.startsWith("/")||(u=`/${u}`);const d=s?`${o.protocol}//${o.host}`:"";return t.reduce((v,p)=>{const A=p.toString()===a.toString();let _=n||!A?`/${p}${u}`:u;_.length>1&&_.endsWith("/")&&(_=_.slice(0,-1));const I=s?`${d}${_}${o.search}${o.hash}`:`${_}${o.search}${o.hash}`;return v[p]=I,v},{})},Cb=(e,t,a=Y2.internationalization.locales,n=Y2.internationalization.defaultLocale,r=Y2.middleware.prefixDefault)=>yb(e,a,n,r)[t],IS=N.createContext(void 0),Mb=e=>e4("INTLAYER_EDITED_CONTENT_CHANGED/get",e),NS=N.createContext(void 0),zp=(e,t)=>typeof e=="function"?e(t):e,xb=({children:e})=>{const{localeDictionaries:t}=ES(),[a,n]=Ua("INTLAYER_EDITED_CONTENT_CHANGED"),r=E=>{let _=zp(E);return n(I=>(_=zp(E,I==null?void 0:I[_.key]),{...I,[_.key]:_})),_},s=(E,_)=>{n(I=>({...I,[E]:{...I==null?void 0:I[E],content:_}}))},o=(E,_,I=[],y=!0)=>{n(C=>{var k,T;const M=(k=t[E])==null?void 0:k.content,w=structuredClone(((T=C==null?void 0:C[E])==null?void 0:T.content)??M);let D=I;if(!y){let F=0;const H=I.slice(0,-1),U=I[I.length-1];let f2=U.key;for(;typeof b3(w,D)<"u";)F++,f2=F===0?U.key:`${U.key} (${F})`,D=[...H,{...U,key:f2}]}const R=dp(w,D,_);return{...C,[E]:{...C==null?void 0:C[E],content:R}}})},u=(E,_,I=[])=>{n(y=>{var D,R;const C=(D=t[E])==null?void 0:D.content,M=structuredClone(((R=y==null?void 0:y[E])==null?void 0:R.content)??C),w=db(M,_,I);return{...y,[E]:{...y==null?void 0:y[E],content:w}}})},d=(E,_)=>{n(I=>{var D,R;const y=(D=t[E])==null?void 0:D.content,C=structuredClone(((R=I==null?void 0:I[E])==null?void 0:R.content)??y),M=b3(y,_),w=dp(C,_,M);return{...I,[E]:{...I==null?void 0:I[E],content:w}}})},f=E=>{n(_=>{const I={..._};return delete I[E],I})},v=E=>{n(_=>Object.entries(_).reduce((y,[C,M])=>C===E?y:{...y,[C]:M},{}))},p=()=>{n({})},A=(E,_)=>{var y;const I=((y=a==null?void 0:a[E])==null?void 0:y.content)??{};return b3(I,_)};return z.jsx(IS.Provider,{value:{editedContent:a},children:z.jsx(NS.Provider,{value:{setEditedContentState:n,setEditedDictionary:r,setEditedContent:s,addEditedContent:o,renameEditedContent:u,removeEditedContent:d,restoreEditedContent:f,clearEditedDictionaryContent:v,clearEditedContent:p,getEditedContentValue:A},children:e})})},h4=()=>{const e=N.useContext(NS);if(!e)throw new Error("useEditedContent must be used within an EditedContentProvider");return e},L1=()=>{const e=N.useContext(IS),t=h4();if(!e)throw new Error("useEditedContent must be used within an EditedContentProvider");return{...e,...t}},yS=N.createContext(void 0),CS=N.createContext(void 0),wb=({children:e})=>{const[t,a]=Ua("INTLAYER_FOCUSED_CONTENT_CHANGED",null),n=r=>{a(s=>s&&{...s,keyPath:r})};return z.jsx(yS.Provider,{value:{focusedContent:t},children:z.jsx(CS.Provider,{value:{setFocusedContent:a,setFocusedContentKeyPath:n},children:e})})},mh=()=>{const e=N.useContext(CS);if(e===void 0)throw new Error("useFocusDictionaryActions must be used within a FocusDictionaryProvider");return e},Dt=()=>{const e=mh(),t=N.useContext(yS);if(t===void 0)throw new Error("useFocusDictionaryState must be used within a FocusDictionaryProvider");return{...t,...e}},MS=N.createContext({enabled:!1}),Rb=e=>Ua("INTLAYER_EDITOR_ENABLED",!1,e),kb=e=>e4("INTLAYER_EDITOR_ENABLED/post",e),xS=e=>e4("INTLAYER_EDITOR_ENABLED/get",e),bb=({children:e})=>{const[t]=Rb({emit:!1,receive:!0});return z.jsx(MS.Provider,{value:{enabled:t},children:e})},wS=()=>N.useContext(MS),Tb=N.createContext(void 0),Db=N.createContext(void 0),Bb=({children:e})=>{const[t,a]=N.useState({}),n=(r,s)=>{a(o=>({...o,[r]:{...o==null?void 0:o[r],content:s}}))};return z.jsx(Tb.Provider,{value:{changedContent:t},children:z.jsx(Db.Provider,{value:{setChangedContent:n},children:e})})},Ip=({children:e})=>{const t=Mb();return N.useEffect(()=>{t()},[]),z.jsx(Gk,{children:z.jsx(xb,{children:z.jsx(wb,{children:e})})})},Ob=({children:e,fallback:t})=>{const a=xS(),{enabled:n}=wS();return N.useEffect(()=>{n||a()},[n]),n?e:t},Fb=({children:e,fallback:t})=>{const[a,n]=N.useState(!1);return N.useEffect(()=>{n(window.self!==window.top)},[]),a?e:t},Lb=({children:e,configuration:t,...a})=>z.jsx(Bb,{children:z.jsx(bb,{children:z.jsx(Vk,{configuration:t,children:a.mode==="editor"?z.jsx(op,{...a,children:z.jsx(Ip,{children:e})}):z.jsx(Fb,{fallback:e,children:z.jsx(op,{...a,children:z.jsx(Ob,{fallback:e,children:z.jsx(Ip,{children:e})})})})})})}),Hb=(e,t)=>Ua("INTLAYER_URL_CHANGE",e,t),Pb=e=>{const t=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window}),a=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});Object.assign(a,{iframeData:e}),Object.assign(t,{iframeData:e}),window.dispatchEvent(a),window.dispatchEvent(t)},Ub=()=>e4("INTLAYER_IFRAME_CLICKED",Pb),{editor:Ta2}=Y2;/*! js-cookie v3.0.5 | MIT */function Ts(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)e[n]=a[n]}return e}var Vb={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function K7(e,t){function a(r,s,o){if(!(typeof document>"u")){o=Ts({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var d in o)o[d]&&(u+="; "+d,o[d]!==!0&&(u+="="+o[d].split(";")[0]));return document.cookie=r+"="+e.write(s,r)+u}}function n(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var s=document.cookie?document.cookie.split("; "):[],o={},u=0;u<s.length;u++){var d=s[u].split("="),f=d.slice(1).join("=");try{var v=decodeURIComponent(d[0]);if(o[v]=e.read(f,v),r===v)break}catch{}}return r?o[r]:o}}return Object.create({set:a,get:n,remove:function(r,s){a(r,"",Ts({},s,{expires:-1}))},withAttributes:function(r){return K7(this.converter,Ts({},this.attributes,r))},withConverter:function(r){return K7(Ts({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var RS=K7(Vb,{path:"/"});const{cookieName:kS}=Y2.middleware,Gb={path:"/",expires:void 0,domain:void 0,secure:!1,sameSite:"strict"},vh=RS.get(kS),bS=e=>{RS.set(kS,e,Gb)},jb=()=>({localeCookie:vh,setLocaleCookie:bS});var dS;const Eo=N.createContext({locale:vh??((dS=Y2==null?void 0:Y2.internationalization)==null?void 0:dS.defaultLocale),setLocale:()=>null,disableEditor:!1}),Kb=()=>N.useContext(Eo),$b=({locale:e,defaultLocale:t,children:a,setLocale:n,disableEditor:r})=>{const{internationalization:s}=Y2??{},{defaultLocale:o,locales:u}=s??{},d=e??vh??t??o,[f,v]=Ua("INTLAYER_CURRENT_LOCALE",d),A=n??(_=>{if(f.toString()!==_.toString()){if(!(u!=null&&u.map(String).includes(_))){console.error(`Locale ${_} is not available`);return}v(_),bS(_)}}),E=gb(e??f);return z.jsx(Eo.Provider,{value:{locale:E,setLocale:A,disableEditor:r},children:a})},Zb=250,Yb=({children:e,onPress:t,onClickOutside:a,pressDuration:n=Zb,isSelecting:r,...s})=>{const o=N.useRef(null),[u,d]=N.useState(!1),[f,v]=N.useState(r),p=N.useRef(null),A=typeof e=="string",E=()=>{v(!0),t()},_=()=>{p.current=setTimeout(()=>{E()},n)},I=()=>{p.current&&(clearTimeout(p.current),p.current=null)},y=()=>{I(),_()},C=()=>{d(!0)},M=()=>{d(!1),I()},w=N.useCallback(k=>{o.current&&!o.current.contains(k.target)&&(v(!1),a==null||a())},[a]);N.useEffect(()=>(document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}),[w]);const D=k=>{f&&(k.preventDefault(),k.stopPropagation())},R=()=>{v(!1)};return z.jsx("span",{style:{display:A?"inline":"inline-block",cursor:"pointer",userSelect:"none",borderRadius:"0.375rem",outlineWidth:"2px",outlineOffset:"4px",outlineStyle:"solid",outlineColor:r||f||u?"inherit":"transparent",transition:"all 100ms 50ms ease-in-out"},role:"button",tabIndex:0,onKeyUp:()=>null,onClick:D,onMouseDown:y,onMouseUp:M,onMouseLeave:M,onTouchStart:y,onTouchEnd:M,onTouchCancel:M,onBlur:R,onMouseEnter:C,ref:o,...s,children:e})},Wb=({children:e,dictionaryKey:t,keyPath:a,dictionaryPath:n,...r})=>{const{focusedContent:s,setFocusedContent:o}=Dt(),{getEditedContentValue:u}=h4(),d=N.useMemo(()=>u(t,a),[t,a,u]),[f,v]=N.useState(e),p=N.useCallback(()=>o({dictionaryKey:t,keyPath:a}),[t,a,o]),A=N.useMemo(()=>{var E;return((s==null?void 0:s.dictionaryKey)===t&&(((E=s==null?void 0:s.keyPath)==null?void 0:E.length)??0)>0&&jr((s==null?void 0:s.keyPath)??[],a))??!1},[s,a,t]);return N.useEffect(()=>{v(d&&typeof d=="string"?d:e)},[d,s,e]),z.jsx(Yb,{onPress:p,isSelecting:A,...r,children:f})},qb=({children:e,...t})=>{const{enabled:a}=wS(),{disableEditor:n}=Kb();return a&&!n?z.jsx(Wb,{...t,children:e}):z.jsx(z.Fragment,{children:e})},TS=({value:e,children:t})=>{const a=N.isValidElement(t)?t:z.jsx(z.Fragment,{children:t});return{...N.cloneElement(a),value:e}},ph=e=>TS({value:e.value??e.content,children:z.jsx(qb,{...e,children:e.content})}),Qb=N.createContext({renderMarkdown:e=>e}),Xb=()=>N.useContext(Qb),Jb=({markdown:e})=>{const{renderMarkdown:t}=Xb();return TS({value:e,children:t(e)})},eT=e=>z.jsx(Jb,{markdown:e}),DS=e=>{if(typeof e=="string")return e;const a=(s=>{var o;if(s!=null&&s.props&&typeof s.props.children=="object"){const u=[],{children:d}=s.props;return Object.keys(d??{}).forEach(f=>{u.push(DS((d??{})[f]))}),{...s,props:{...s.props,children:u}}}return{...s,props:{...s.props,children:((o=s.props)==null?void 0:o.children)??[]}}})(e),{type:n,props:r}=a;return N.createElement(n??"span",r,...r.children)},tT={canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{plugins:t,...a})=>ph(a)},aT={canHandle:e=>typeof e=="object"&&typeof e.props<"u"&&typeof e.key<"u",transform:(e,{plugins:t,...a})=>ph({...a,content:DS(e),value:"[[react-element]]"})},nT={canHandle:e=>typeof e=="object"&&(e==null?void 0:e.nodeType)===G.Markdown,transform:(e,{plugins:t,...a})=>ph({...a,content:eT(e[G.Markdown]),value:e[G.Markdown]})},lT=(e,t,a)=>_S(e,t,[tT,aT,nT]),s1=(e,t)=>{const{locale:a}=N.useContext(Eo);return lT(e,a)},{defaultLocale:Da2,locales:Ba2}=Y2.internationalization,Ah=({onLocaleChange:e}={})=>{const{prefixDefault:t}=(Y2==null?void 0:Y2.middleware)??{},{defaultLocale:a,locales:n}=(Y2==null?void 0:Y2.internationalization)??{},{locale:r,setLocale:s}=N.useContext(Eo),{setLocaleCookie:o}=jb();return{locale:r,defaultLocale:a,availableLocales:n,localeList:Ab,setLocale:d=>{if(!(n!=null&&n.map(String).includes(d))){console.error(`Locale ${d} is not available`);return}s(d),o(d),e==null||e(d)}}};var kl={},Np;function rT(){if(Np)return kl;Np=1,Object.defineProperty(kl,"__esModule",{value:!0}),kl.parse=o,kl.serialize=f;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,r=Object.prototype.toString,s=(()=>{const A=function(){};return A.prototype=Object.create(null),A})();function o(A,E){const _=new s,I=A.length;if(I<2)return _;const y=(E==null?void 0:E.decode)||v;let C=0;do{const M=A.indexOf("=",C);if(M===-1)break;const w=A.indexOf(";",C),D=w===-1?I:w;if(M>D){C=A.lastIndexOf(";",M-1)+1;continue}const R=u(A,C,M),k=d(A,M,R),T=A.slice(R,k);if(_[T]===void 0){let F=u(A,M+1,D),H=d(A,D,F);const U=y(A.slice(F,H));_[T]=U}C=D+1}while(C<I);return _}function u(A,E,_){do{const I=A.charCodeAt(E);if(I!==32&&I!==9)return E}while(++E<_);return _}function d(A,E,_){for(;E>_;){const I=A.charCodeAt(--E);if(I!==32&&I!==9)return E+1}return _}function f(A,E,_){const I=(_==null?void 0:_.encode)||encodeURIComponent;if(!e.test(A))throw new TypeError(`argument name is invalid: ${A}`);const y=I(E);if(!t.test(y))throw new TypeError(`argument val is invalid: ${E}`);let C=A+"="+y;if(!_)return C;if(_.maxAge!==void 0){if(!Number.isInteger(_.maxAge))throw new TypeError(`option maxAge is invalid: ${_.maxAge}`);C+="; Max-Age="+_.maxAge}if(_.domain){if(!a.test(_.domain))throw new TypeError(`option domain is invalid: ${_.domain}`);C+="; Domain="+_.domain}if(_.path){if(!n.test(_.path))throw new TypeError(`option path is invalid: ${_.path}`);C+="; Path="+_.path}if(_.expires){if(!p(_.expires)||!Number.isFinite(_.expires.valueOf()))throw new TypeError(`option expires is invalid: ${_.expires}`);C+="; Expires="+_.expires.toUTCString()}if(_.httpOnly&&(C+="; HttpOnly"),_.secure&&(C+="; Secure"),_.partitioned&&(C+="; Partitioned"),_.priority)switch(typeof _.priority=="string"?_.priority.toLowerCase():void 0){case"low":C+="; Priority=Low";break;case"medium":C+="; Priority=Medium";break;case"high":C+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${_.priority}`)}if(_.sameSite)switch(typeof _.sameSite=="string"?_.sameSite.toLowerCase():_.sameSite){case!0:case"strict":C+="; SameSite=Strict";break;case"lax":C+="; SameSite=Lax";break;case"none":C+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${_.sameSite}`)}return C}function v(A){if(A.indexOf("%")===-1)return A;try{return decodeURIComponent(A)}catch{return A}}function p(A){return r.call(A)==="[object Date]"}return kl}rT();/**
56
+ */var Sp;function Ib(){if(Sp)return xs.exports;Sp=1;var e=Eb(),t=_b(),a=Sb(),n=zb();xs.exports=r,xs.exports.Negotiator=r;function r(s){if(!(this instanceof r))return new r(s);this.request=s}return r.prototype.charset=function(o){var u=this.charsets(o);return u&&u[0]},r.prototype.charsets=function(o){return e(this.request.headers["accept-charset"],o)},r.prototype.encoding=function(o,u){var d=this.encodings(o,u);return d&&d[0]},r.prototype.encodings=function(o,u){var d=u||{};return t(this.request.headers["accept-encoding"],o,d.preferred)},r.prototype.language=function(o){var u=this.languages(o);return u&&u[0]},r.prototype.languages=function(o){return a(this.request.headers["accept-language"],o)},r.prototype.mediaType=function(o){var u=this.mediaTypes(o);return u&&u[0]},r.prototype.mediaTypes=function(o){return n(this.request.headers.accept,o)},r.prototype.preferredCharset=r.prototype.charset,r.prototype.preferredCharsets=r.prototype.charsets,r.prototype.preferredEncoding=r.prototype.encoding,r.prototype.preferredEncodings=r.prototype.encodings,r.prototype.preferredLanguage=r.prototype.language,r.prototype.preferredLanguages=r.prototype.languages,r.prototype.preferredMediaType=r.prototype.mediaType,r.prototype.preferredMediaTypes=r.prototype.mediaTypes,xs.exports}Ib();const Nb=(e,t=Y2.internationalization.locales)=>{const a=zS(e);let n=e;e.endsWith("/")&&(n=e.slice(0,-1));const r=a?new URL(n):new URL(n,"http://example.com"),s=r.pathname;s.startsWith("/")||(r.pathname=`/${s}`);const o=s.split("/"),u=o[1];if(t.includes(u)){o.splice(1,1);const d=o.join("/")??"/";r.pathname=d}return a?r.toString():r.toString().replace("http://example.com","")},yb=(e,t=Y2.internationalization.locales,a=Y2.internationalization.defaultLocale,n=Y2.middleware.prefixDefault)=>{const r=Nb(e,t),s=zS(r),o=s?new URL(r):new URL(r,"http://example.com");let u=o.pathname;u.startsWith("/")||(u=`/${u}`);const d=s?`${o.protocol}//${o.host}`:"";return t.reduce((v,p)=>{const A=p.toString()===a.toString();let _=n||!A?`/${p}${u}`:u;_.length>1&&_.endsWith("/")&&(_=_.slice(0,-1));const I=s?`${d}${_}${o.search}${o.hash}`:`${_}${o.search}${o.hash}`;return v[p]=I,v},{})},Cb=(e,t,a=Y2.internationalization.locales,n=Y2.internationalization.defaultLocale,r=Y2.middleware.prefixDefault)=>yb(e,a,n,r)[t],IS=N.createContext(void 0),Mb=e=>e4("INTLAYER_EDITED_CONTENT_CHANGED/get",e),NS=N.createContext(void 0),zp=(e,t)=>typeof e=="function"?e(t):e,xb=({children:e})=>{const{localeDictionaries:t}=ES(),[a,n]=Ua("INTLAYER_EDITED_CONTENT_CHANGED"),r=E=>{let _=zp(E);return n(I=>(_=zp(E,I==null?void 0:I[_.key]),{...I,[_.key]:_})),_},s=(E,_)=>{n(I=>({...I,[E]:{...I==null?void 0:I[E],content:_}}))},o=(E,_,I=[],y=!0)=>{n(C=>{var k,T;const M=(k=t[E])==null?void 0:k.content,w=structuredClone(((T=C==null?void 0:C[E])==null?void 0:T.content)??M);let D=I;if(!y){let F=0;const H=I.slice(0,-1),U=I[I.length-1];let f2=U.key;for(;typeof b3(w,D)<"u";)F++,f2=F===0?U.key:`${U.key} (${F})`,D=[...H,{...U,key:f2}]}const R=dp(w,D,_);return{...C,[E]:{...C==null?void 0:C[E],content:R}}})},u=(E,_,I=[])=>{n(y=>{var D,R;const C=(D=t[E])==null?void 0:D.content,M=structuredClone(((R=y==null?void 0:y[E])==null?void 0:R.content)??C),w=db(M,_,I);return{...y,[E]:{...y==null?void 0:y[E],content:w}}})},d=(E,_)=>{n(I=>{var D,R;const y=(D=t[E])==null?void 0:D.content,C=structuredClone(((R=I==null?void 0:I[E])==null?void 0:R.content)??y),M=b3(y,_),w=dp(C,_,M);return{...I,[E]:{...I==null?void 0:I[E],content:w}}})},f=E=>{n(_=>{const I={..._};return delete I[E],I})},v=E=>{n(_=>Object.entries(_).reduce((y,[C,M])=>C===E?y:{...y,[C]:M},{}))},p=()=>{n({})},A=(E,_)=>{var y;const I=((y=a==null?void 0:a[E])==null?void 0:y.content)??{};return b3(I,_)};return z.jsx(IS.Provider,{value:{editedContent:a},children:z.jsx(NS.Provider,{value:{setEditedContentState:n,setEditedDictionary:r,setEditedContent:s,addEditedContent:o,renameEditedContent:u,removeEditedContent:d,restoreEditedContent:f,clearEditedDictionaryContent:v,clearEditedContent:p,getEditedContentValue:A},children:e})})},h4=()=>{const e=N.useContext(NS);if(!e)throw new Error("useEditedContent must be used within an EditedContentProvider");return e},L1=()=>{const e=N.useContext(IS),t=h4();if(!e)throw new Error("useEditedContent must be used within an EditedContentProvider");return{...e,...t}},yS=N.createContext(void 0),CS=N.createContext(void 0),wb=({children:e})=>{const[t,a]=Ua("INTLAYER_FOCUSED_CONTENT_CHANGED",null),n=r=>{a(s=>s&&{...s,keyPath:r})};return z.jsx(yS.Provider,{value:{focusedContent:t},children:z.jsx(CS.Provider,{value:{setFocusedContent:a,setFocusedContentKeyPath:n},children:e})})},mh=()=>{const e=N.useContext(CS);if(e===void 0)throw new Error("useFocusDictionaryActions must be used within a FocusDictionaryProvider");return e},Dt=()=>{const e=mh(),t=N.useContext(yS);if(t===void 0)throw new Error("useFocusDictionaryState must be used within a FocusDictionaryProvider");return{...t,...e}},MS=N.createContext({enabled:!1}),Rb=e=>Ua("INTLAYER_EDITOR_ENABLED",!1,e),kb=e=>e4("INTLAYER_EDITOR_ENABLED/post",e),xS=e=>e4("INTLAYER_EDITOR_ENABLED/get",e),bb=({children:e})=>{const[t]=Rb({emit:!1,receive:!0});return z.jsx(MS.Provider,{value:{enabled:t},children:e})},wS=()=>N.useContext(MS),Tb=N.createContext(void 0),Db=N.createContext(void 0),Bb=({children:e})=>{const[t,a]=N.useState({}),n=(r,s)=>{a(o=>({...o,[r]:{...o==null?void 0:o[r],content:s}}))};return z.jsx(Tb.Provider,{value:{changedContent:t},children:z.jsx(Db.Provider,{value:{setChangedContent:n},children:e})})},Ip=({children:e})=>{const t=Mb();return N.useEffect(()=>{t()},[]),z.jsx(Gk,{children:z.jsx(xb,{children:z.jsx(wb,{children:e})})})},Ob=({children:e,fallback:t})=>{const a=xS(),{enabled:n}=wS();return N.useEffect(()=>{n||a()},[n]),n?e:t},Fb=({children:e,fallback:t})=>{const[a,n]=N.useState(!1);return N.useEffect(()=>{n(window.self!==window.top)},[]),a?e:t},Lb=({children:e,configuration:t,...a})=>z.jsx(Bb,{children:z.jsx(bb,{children:z.jsx(Vk,{configuration:t,children:a.mode==="editor"?z.jsx(op,{...a,children:z.jsx(Ip,{children:e})}):z.jsx(Fb,{fallback:e,children:z.jsx(op,{...a,children:z.jsx(Ob,{fallback:e,children:z.jsx(Ip,{children:e})})})})})})}),Hb=(e,t)=>Ua("INTLAYER_URL_CHANGE",e,t),Pb=e=>{const t=new MouseEvent("mousedown",{bubbles:!0,cancelable:!0,view:window}),a=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});Object.assign(a,{iframeData:e}),Object.assign(t,{iframeData:e}),window.dispatchEvent(a),window.dispatchEvent(t)},Ub=()=>e4("INTLAYER_IFRAME_CLICKED",Pb),{editor:Ta2}=Y2;/*! js-cookie v3.0.5 | MIT */function Ts(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)e[n]=a[n]}return e}var Vb={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function K7(e,t){function a(r,s,o){if(!(typeof document>"u")){o=Ts({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var u="";for(var d in o)o[d]&&(u+="; "+d,o[d]!==!0&&(u+="="+o[d].split(";")[0]));return document.cookie=r+"="+e.write(s,r)+u}}function n(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var s=document.cookie?document.cookie.split("; "):[],o={},u=0;u<s.length;u++){var d=s[u].split("="),f=d.slice(1).join("=");try{var v=decodeURIComponent(d[0]);if(o[v]=e.read(f,v),r===v)break}catch{}}return r?o[r]:o}}return Object.create({set:a,get:n,remove:function(r,s){a(r,"",Ts({},s,{expires:-1}))},withAttributes:function(r){return K7(this.converter,Ts({},this.attributes,r))},withConverter:function(r){return K7(Ts({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var RS=K7(Vb,{path:"/"});const{cookieName:kS}=Y2.middleware,Gb={path:"/",expires:void 0,domain:void 0,secure:!1,sameSite:"strict"},vh=RS.get(kS),bS=e=>{RS.set(kS,e,Gb)},jb=()=>({localeCookie:vh,setLocaleCookie:bS});var dS;const Eo=N.createContext({locale:vh??((dS=Y2==null?void 0:Y2.internationalization)==null?void 0:dS.defaultLocale),setLocale:()=>null,disableEditor:!1}),Kb=()=>N.useContext(Eo),$b=({locale:e,defaultLocale:t,children:a,setLocale:n,disableEditor:r})=>{const{internationalization:s}=Y2??{},{defaultLocale:o,locales:u}=s??{},d=e??vh??t??o,[f,v]=Ua("INTLAYER_CURRENT_LOCALE",d),A=n??(_=>{if(f.toString()!==_.toString()){if(!(u!=null&&u.map(String).includes(_))){console.error(`Locale ${_} is not available`);return}v(_),bS(_)}}),E=gb(e??f);return z.jsx(Eo.Provider,{value:{locale:E,setLocale:A,disableEditor:r},children:a})},Zb=250,Yb=({children:e,onPress:t,onClickOutside:a,pressDuration:n=Zb,isSelecting:r,...s})=>{const o=N.useRef(null),[u,d]=N.useState(!1),[f,v]=N.useState(r),p=N.useRef(null),A=typeof e=="string",E=()=>{v(!0),t()},_=()=>{p.current=setTimeout(()=>{E()},n)},I=()=>{p.current&&(clearTimeout(p.current),p.current=null)},y=()=>{I(),_()},C=()=>{d(!0)},M=()=>{d(!1),I()},w=N.useCallback(k=>{o.current&&!o.current.contains(k.target)&&(v(!1),a==null||a())},[a]);N.useEffect(()=>(document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}),[w]);const D=k=>{f&&(k.preventDefault(),k.stopPropagation())},R=()=>{v(!1)};return z.jsx("span",{style:{display:A?"inline":"inline-block",cursor:"pointer",userSelect:"none",borderRadius:"0.375rem",outlineWidth:"2px",outlineOffset:"4px",outlineStyle:"solid",outlineColor:r||f||u?"inherit":"transparent",transition:"all 100ms 50ms ease-in-out"},role:"button",tabIndex:0,onKeyUp:()=>null,onClick:D,onMouseDown:y,onMouseUp:M,onMouseLeave:M,onTouchStart:y,onTouchEnd:M,onTouchCancel:M,onBlur:R,onMouseEnter:C,ref:o,...s,children:e})},Wb=({children:e,dictionaryKey:t,keyPath:a,dictionaryPath:n,...r})=>{const{focusedContent:s,setFocusedContent:o}=Dt(),{getEditedContentValue:u}=h4(),d=N.useMemo(()=>u(t,a),[t,a,u]),[f,v]=N.useState(e),p=N.useCallback(()=>o({dictionaryKey:t,keyPath:a}),[t,a,o]),A=N.useMemo(()=>{var E;return((s==null?void 0:s.dictionaryKey)===t&&(((E=s==null?void 0:s.keyPath)==null?void 0:E.length)??0)>0&&jr((s==null?void 0:s.keyPath)??[],a))??!1},[s,a,t]);return N.useEffect(()=>{v(d&&typeof d=="string"?d:e)},[d,s,e]),z.jsx(Yb,{onPress:p,isSelecting:A,...r,children:f})},qb=({children:e,...t})=>{const{enabled:a}=wS(),{disableEditor:n}=Kb();return a&&!n?z.jsx(Wb,{...t,children:e}):z.jsx(z.Fragment,{children:e})},TS=({value:e,children:t})=>({...N.isValidElement(t)?t:z.jsx(z.Fragment,{children:t}),value:e}),ph=e=>TS({value:e.value??e.content,children:z.jsx(qb,{...e,children:e.content})}),Qb=N.createContext({renderMarkdown:e=>e}),Xb=()=>N.useContext(Qb),Jb=({markdown:e})=>{const{renderMarkdown:t}=Xb();return TS({value:e,children:t(e)})},eT=e=>z.jsx(Jb,{markdown:e}),DS=e=>{if(typeof e=="string")return e;const a=(s=>{var o;if(s!=null&&s.props&&typeof s.props.children=="object"){const u=[],{children:d}=s.props;return Object.keys(d??{}).forEach(f=>{u.push(DS((d??{})[f]))}),{...s,props:{...s.props,children:u}}}return{...s,props:{...s.props,children:((o=s.props)==null?void 0:o.children)??[]}}})(e),{type:n,props:r}=a;return N.createElement(n??"span",r,...r.children)},tT={canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{plugins:t,...a})=>ph(a)},aT={canHandle:e=>typeof e=="object"&&typeof e.props<"u"&&typeof e.key<"u",transform:(e,{plugins:t,...a})=>ph({...a,content:DS(e),value:"[[react-element]]"})},nT={canHandle:e=>typeof e=="object"&&(e==null?void 0:e.nodeType)===G.Markdown,transform:(e,{plugins:t,...a})=>ph({...a,content:eT(e[G.Markdown]),value:e[G.Markdown]})},lT=(e,t,a)=>_S(e,t,[tT,aT,nT]),s1=(e,t)=>{const{locale:a}=N.useContext(Eo);return lT(e,a)},{defaultLocale:Da2,locales:Ba2}=Y2.internationalization,Ah=({onLocaleChange:e}={})=>{const{prefixDefault:t}=(Y2==null?void 0:Y2.middleware)??{},{defaultLocale:a,locales:n}=(Y2==null?void 0:Y2.internationalization)??{},{locale:r,setLocale:s}=N.useContext(Eo),{setLocaleCookie:o}=jb();return{locale:r,defaultLocale:a,availableLocales:n,localeList:Ab,setLocale:d=>{if(!(n!=null&&n.map(String).includes(d))){console.error(`Locale ${d} is not available`);return}s(d),o(d),e==null||e(d)}}};var kl={},Np;function rT(){if(Np)return kl;Np=1,Object.defineProperty(kl,"__esModule",{value:!0}),kl.parse=o,kl.serialize=f;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,a=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,r=Object.prototype.toString,s=(()=>{const A=function(){};return A.prototype=Object.create(null),A})();function o(A,E){const _=new s,I=A.length;if(I<2)return _;const y=(E==null?void 0:E.decode)||v;let C=0;do{const M=A.indexOf("=",C);if(M===-1)break;const w=A.indexOf(";",C),D=w===-1?I:w;if(M>D){C=A.lastIndexOf(";",M-1)+1;continue}const R=u(A,C,M),k=d(A,M,R),T=A.slice(R,k);if(_[T]===void 0){let F=u(A,M+1,D),H=d(A,D,F);const U=y(A.slice(F,H));_[T]=U}C=D+1}while(C<I);return _}function u(A,E,_){do{const I=A.charCodeAt(E);if(I!==32&&I!==9)return E}while(++E<_);return _}function d(A,E,_){for(;E>_;){const I=A.charCodeAt(--E);if(I!==32&&I!==9)return E+1}return _}function f(A,E,_){const I=(_==null?void 0:_.encode)||encodeURIComponent;if(!e.test(A))throw new TypeError(`argument name is invalid: ${A}`);const y=I(E);if(!t.test(y))throw new TypeError(`argument val is invalid: ${E}`);let C=A+"="+y;if(!_)return C;if(_.maxAge!==void 0){if(!Number.isInteger(_.maxAge))throw new TypeError(`option maxAge is invalid: ${_.maxAge}`);C+="; Max-Age="+_.maxAge}if(_.domain){if(!a.test(_.domain))throw new TypeError(`option domain is invalid: ${_.domain}`);C+="; Domain="+_.domain}if(_.path){if(!n.test(_.path))throw new TypeError(`option path is invalid: ${_.path}`);C+="; Path="+_.path}if(_.expires){if(!p(_.expires)||!Number.isFinite(_.expires.valueOf()))throw new TypeError(`option expires is invalid: ${_.expires}`);C+="; Expires="+_.expires.toUTCString()}if(_.httpOnly&&(C+="; HttpOnly"),_.secure&&(C+="; Secure"),_.partitioned&&(C+="; Partitioned"),_.priority)switch(typeof _.priority=="string"?_.priority.toLowerCase():void 0){case"low":C+="; Priority=Low";break;case"medium":C+="; Priority=Medium";break;case"high":C+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${_.priority}`)}if(_.sameSite)switch(typeof _.sameSite=="string"?_.sameSite.toLowerCase():_.sameSite){case!0:case"strict":C+="; SameSite=Strict";break;case"lax":C+="; SameSite=Lax";break;case"none":C+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${_.sameSite}`)}return C}function v(A){if(A.indexOf("%")===-1)return A;try{return decodeURIComponent(A)}catch{return A}}function p(A){return r.call(A)==="[object Date]"}return kl}rT();/**
57
57
  * react-router v7.3.0
58
58
  *
59
59
  * Copyright (c) Remix Software Inc.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Intlayer Editor</title>
8
- <script type="module" crossorigin src="/assets/index-DkF8KBha.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-T1e92A4H.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CXkX7v6q.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intlayer-editor",
3
- "version": "5.2.5",
3
+ "version": "5.2.6",
4
4
  "private": false,
5
5
  "description": "Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.",
6
6
  "keywords": [
@@ -72,14 +72,14 @@
72
72
  "react-dom": "^19.0.0",
73
73
  "react-router-dom": "^7.1.1",
74
74
  "rimraf": "^6.0.1",
75
- "@intlayer/api": "5.2.5",
76
- "@intlayer/config": "5.2.5",
77
- "@intlayer/core": "5.2.5",
78
- "@intlayer/editor": "5.2.5",
79
- "@intlayer/editor-react": "5.2.5",
80
- "vite-intlayer": "5.2.5",
81
- "react-intlayer": "5.2.5",
82
- "@intlayer/design-system": "5.2.5"
75
+ "@intlayer/api": "5.2.6",
76
+ "@intlayer/config": "5.2.6",
77
+ "@intlayer/core": "5.2.6",
78
+ "@intlayer/editor": "5.2.6",
79
+ "@intlayer/editor-react": "5.2.6",
80
+ "@intlayer/design-system": "5.2.6",
81
+ "react-intlayer": "5.2.6",
82
+ "vite-intlayer": "5.2.6"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@tailwindcss/vite": "^4.0.8",
@@ -100,7 +100,7 @@
100
100
  "typescript-eslint": "^8.18.2",
101
101
  "vite": "^6.0.11",
102
102
  "vitest": "^3.0.5",
103
- "@intlayer/backend": "5.2.5"
103
+ "@intlayer/backend": "5.2.6"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "@types/compression": "^1.7.5",
@@ -111,14 +111,14 @@
111
111
  "react-dom": ">=16.0.0",
112
112
  "react-router-dom": ">=6.0.0",
113
113
  "tailwind-merge": "^3.0.2",
114
- "@intlayer/config": "5.2.5",
115
- "@intlayer/core": "5.2.5",
116
- "@intlayer/design-system": "5.2.5",
117
- "@intlayer/editor": "5.2.5",
118
- "@intlayer/editor-react": "5.2.5",
119
- "react-intlayer": "5.2.5",
120
- "intlayer": "5.2.5",
121
- "vite-intlayer": "5.2.5"
114
+ "@intlayer/config": "5.2.6",
115
+ "@intlayer/core": "5.2.6",
116
+ "@intlayer/editor": "5.2.6",
117
+ "@intlayer/editor-react": "5.2.6",
118
+ "react-intlayer": "5.2.6",
119
+ "intlayer": "5.2.6",
120
+ "vite-intlayer": "5.2.6",
121
+ "@intlayer/design-system": "5.2.6"
122
122
  },
123
123
  "engines": {
124
124
  "node": ">=14.18"