@yoopta/editor 4.5.2-rc.3 → 4.6.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insertBlocks.d.ts","sourceRoot":"","sources":["../../../src/editor/blocks/insertBlocks.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAErG,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,OAAO,GAAE,4BAAiC,
|
|
1
|
+
{"version":3,"file":"insertBlocks.d.ts","sourceRoot":"","sources":["../../../src/editor/blocks/insertBlocks.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,4BAA4B,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAErG,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,OAAO,GAAE,4BAAiC,QAuEpH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateBlock.d.ts","sourceRoot":"","sources":["../../../src/editor/blocks/updateBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEtD,wBAAgB,WAAW,CAAC,YAAY,SAAS,MAAM,EAAE,MAAM,EAC7D,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"updateBlock.d.ts","sourceRoot":"","sources":["../../../src/editor/blocks/updateBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEtD,wBAAgB,WAAW,CAAC,YAAY,SAAS,MAAM,EAAE,MAAM,EAC7D,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,QAsC/B"}
|
package/dist/index.js
CHANGED
|
@@ -10,4 +10,4 @@ var Xo=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[hr
|
|
|
10
10
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*/
|
|
13
|
-
function ll(e){return"[object Object]"===Object.prototype.toString.call(e)}var cl={isHistory(e){return!1!==ll(t=e)&&(void 0===(n=t.constructor)||!1!==ll(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf"))&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||A.isOperationList(e.redos[0].operations))&&(0===e.undos.length||A.isOperationList(e.undos[0].operations));var t,n,o}},al=new WeakMap,sl=new WeakMap,dl={isHistoryEditor:e=>cl.isHistory(e.history)&&S.isEditor(e),isMerging:e=>sl.get(e),isSaving:e=>al.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=dl.isMerging(e);sl.set(e,!1),t(),sl.set(e,n)},withoutSaving(e,t){var n=dl.isSaving(e);al.set(e,!1),t(),al.set(e,n)}},ul=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var o=n[n.length-1];o.selectionBefore&&D.setSelection(t,o.selectionBefore),dl.withoutSaving(t,(()=>{S.withoutNormalizing(t,(()=>{for(var e of o.operations)t.apply(e)}))})),e.redos.pop(),t.writeHistory("undos",o)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var o=n[n.length-1];dl.withoutSaving(t,(()=>{S.withoutNormalizing(t,(()=>{var e=o.operations.map(A.inverse).reverse();for(var n of e)t.apply(n);o.selectionBefore&&D.setSelection(t,o.selectionBefore)}))})),t.writeHistory("redos",o),e.undos.pop()}},t.apply=e=>{var{operations:o,history:r}=t,{undos:i}=r,l=i[i.length-1],c=l&&l.operations[l.operations.length-1],a=dl.isSaving(t),s=dl.isMerging(t);if(null==a&&(a=pl(e)),a){if(null==s&&(s=null!=l&&(0!==o.length||fl(e,c))),l&&s)l.operations.push(e);else{var d={operations:[e],selectionBefore:t.selection};t.writeHistory("undos",d)}for(;i.length>100;)i.shift();r.redos=[]}n(e)},t.writeHistory=(e,n)=>{t.history[e].push(n)},t},fl=(e,t)=>!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!j.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!j.equals(e.path,t.path)),pl=(e,t)=>"set_selection"!==e.type,hl=Symbol.for("immer-nothing"),gl=Symbol.for("immer-draftable"),vl=Symbol.for("immer-state");function yl(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ml=Object.getPrototypeOf;function bl(e){return!!e&&!!e[vl]}function wl(e){return!!e&&(kl(e)||Array.isArray(e)||!!e[gl]||!!e.constructor?.[gl]||Dl(e)||jl(e))}var xl=Object.prototype.constructor.toString();function kl(e){if(!e||"object"!=typeof e)return!1;const t=ml(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===xl}function El(e,t){0===Ol(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function Ol(e){const t=e[vl];return t?t.type_:Array.isArray(e)?1:Dl(e)?2:jl(e)?3:0}function Cl(e,t){return 2===Ol(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sl(e,t,n){const o=Ol(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Dl(e){return e instanceof Map}function jl(e){return e instanceof Set}function Bl(e){return e.copy_||e.base_}function Rl(e,t){if(Dl(e))return new Map(e);if(jl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&kl(e)){if(!ml(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[vl];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(ml(e),n)}function _l(e,t=!1){return Ml(e)||bl(e)||!wl(e)||(Ol(e)>1&&(e.set=e.add=e.clear=e.delete=Al),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>_l(t,!0)))),e}function Al(){yl(2)}function Ml(e){return Object.isFrozen(e)}var Tl,Nl={};function Ll(e){const t=Nl[e];return t||yl(0),t}function Pl(){return Tl}function Il(e,t){t&&(Ll("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fl(e){zl(e),e.drafts_.forEach(Ul),e.drafts_=null}function zl(e){e===Tl&&(Tl=e.parent_)}function Hl(e){return Tl={drafts_:[],parent_:Tl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ul(e){const t=e[vl];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Vl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[vl].modified_&&(Fl(t),yl(4)),wl(e)&&(e=$l(t,e),t.parent_||Kl(t,e)),t.patches_&&Ll("Patches").generateReplacementPatches_(n[vl].base_,e,t.patches_,t.inversePatches_)):e=$l(t,n,[]),Fl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==hl?e:void 0}function $l(e,t,n){if(Ml(t))return t;const o=t[vl];if(!o)return El(t,((r,i)=>Wl(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Kl(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),El(r,((r,l)=>Wl(e,o,t,r,l,n,i))),Kl(e,t,!1),n&&e.patches_&&Ll("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Wl(e,t,n,o,r,i,l){if(bl(r)){const l=$l(e,r,i&&t&&3!==t.type_&&!Cl(t.assigned_,o)?i.concat(o):void 0);if(Sl(n,o,l),!bl(l))return;e.canAutoFreeze_=!1}else l&&n.add(r);if(wl(r)&&!Ml(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;$l(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Kl(e,r)}}function Kl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_l(t,n)}var Yl={get(e,t){if(t===vl)return e;const n=Bl(e);if(!Cl(n,t))return function(e,t,n){const o=ql(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!wl(o)?o:o===Zl(e.base_,t)?(Jl(e),e.copy_[t]=Ql(o,e)):o},has:(e,t)=>t in Bl(e),ownKeys:e=>Reflect.ownKeys(Bl(e)),set(e,t,n){const o=ql(Bl(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Zl(Bl(e),t),l=o?.[vl];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(i=o)?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==n||Cl(e.base_,t)))return!0;Jl(e),Gl(e)}var r,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Zl(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Jl(e),Gl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Bl(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){yl(11)},getPrototypeOf:e=>ml(e.base_),setPrototypeOf(){yl(12)}},Xl={};function Zl(e,t){const n=e[vl];return(n?Bl(n):e)[t]}function ql(e,t){if(!(t in e))return;let n=ml(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ml(n)}}function Gl(e){e.modified_||(e.modified_=!0,e.parent_&&Gl(e.parent_))}function Jl(e){e.copy_||(e.copy_=Rl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}El(Yl,((e,t)=>{Xl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Xl.deleteProperty=function(e,t){return Xl.set.call(this,e,t,void 0)},Xl.set=function(e,t,n){return Yl.set.call(this,e[0],t,n,e[0])};function Ql(e,t){const n=Dl(e)?Ll("MapSet").proxyMap_(e,t):jl(e)?Ll("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Pl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Yl;n&&(r=[o],i=Xl);const{revoke:l,proxy:c}=Proxy.revocable(r,i);return o.draft_=c,o.revoke_=l,c}(e,t);return(t?t.scope_:Pl()).drafts_.push(n),n}function ec(e){if(!wl(e)||Ml(e))return e;const t=e[vl];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Rl(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Rl(e,!0);return El(n,((e,t)=>{Sl(n,e,ec(t))})),t&&(t.finalized_=!1),n}var tc=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&yl(6),void 0!==n&&"function"!=typeof n&&yl(7),wl(e)){const r=Hl(this),i=Ql(e,void 0);let l=!0;try{o=t(i),l=!1}finally{l?Fl(r):zl(r)}return Il(r,n),Vl(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===hl&&(o=void 0),this.autoFreeze_&&_l(o,!0),n){const t=[],r=[];Ll("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}yl(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;return[this.produce(e,t,((e,t)=>{n=e,o=t})),n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){wl(e)||yl(8),bl(e)&&(e=function(e){bl(e)||yl(10);return ec(e)}(e));const t=Hl(this),n=Ql(e,void 0);return n[vl].isManual_=!0,zl(t),n}finishDraft(e,t){const n=e&&e[vl];n&&n.isManual_||yl(9);const{scope_:o}=n;return Il(o,t),Vl(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=Ll("Patches").applyPatches_;return bl(e)?o(e,t):this.produce(e,(e=>o(e,t)))}};tc.produce,tc.produceWithPatches.bind(tc),tc.setAutoFreeze.bind(tc),tc.setUseStrictShallowCopy.bind(tc),tc.applyPatches.bind(tc);var nc=tc.createDraft.bind(tc),oc=tc.finishDraft.bind(tc);function rc(e,t,n){e.children=nc(e.children);const o=L(e);if(!o)throw new Error(`No block found in the current selection path. Passed path: ${e.selection}`);const r=(null==n?void 0:n.slate)||Nn(e,{at:[null==o?void 0:o.meta.order]});if(!r||!r.selection)return;const i=e.blocks[t],l=function(e,t){const n=e.blocks[t].elements,o=oi(n);if(!o)throw new Error(`Root element type not found for block type ${t}`);const r=n[o];return{id:q(),type:o,props:r.props,children:r.children&&r.children.length>0?ii(r,n):[{text:""}]}}(e,t);(null==n?void 0:n.deleteText)&&D.delete(r,{at:[0,0]});const c=J({id:o.id,type:i.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[l]});r.children=c.value;const a=c.id;e.children[a]=c,e.blockEditorsMap[a]=r,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(a,{slate:r,waitExecution:!0})}function ic(e,t){const n=Nn(e);if(!n)return!1;const o=S.marks(n);return!!(null==o?void 0:o[t])}const lc=(e,t)=>{const{insertText:n}=t;return t.insertText=o=>{var r;const{selection:i}=t;if(" "===o&&i&&B.isCollapsed(i)){const{anchor:l}=i,c=S.above(t,{match:e=>_.isElement(e)&&S.isBlock(t,e),mode:"lowest"});if(!c)return;const[,a]=c,s=S.parent(t,a),[d]=s;if(_.isElement(d)&&!R.isText(d.children[0]))return n(o);const u=c?a:[],f={anchor:l,focus:S.start(t,u)},p=S.string(t,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(!!h&&!h.isActive())return D.select(t,f),D.delete(t),void h.create({deleteText:!1})}n(o)},t};function cc(e,t,n){e.children=nc(e.children);let o=!1;const r=e.children[t];r?(n.id&&(r.id=n.id,o=!0),n.type&&(r.type=n.type,o=!0),n.meta&&(r.meta=n.meta,o=!0),n.value&&(r.value=n.value),e.children=oc(e.children),o&&e.applyChanges(),e.emit("change",e.children)):console.log(`Block with id ${t} not found`)}const ac="Paragraph";function sc(e,t,n){e.children=nc(e.children);const o=L(e,{at:(null==n?void 0:n.at)||e.selection});if(!o)throw new Error("Block from not found at current selection");let r=t;o.type===r&&(r=ac);const i=Nn(e,{at:[o.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${o.meta.order}`);const l=oi(e.blocks[r].elements);S.withoutNormalizing(i,(()=>{D.setNodes(i,{type:l},{at:[0],mode:"lowest",match:e=>_.isElement(e)&&!S.isInline(i,e)}),(null==n?void 0:n.deleteText)&&D.delete(i,{at:[0,0]});const t={id:o.id,type:r,meta:Object.assign(Object.assign({},o.meta),{order:o.meta.order}),value:i.children};e.blockEditorsMap[o.id]=i,e.children[o.id]=t,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(t.id,{slate:i})}))}function dc(e,t={}){const{at:n=e.selection,deleteAll:o=!1,fromPaths:r,focus:i}=t;if(Array.isArray(r)&&r.length>0){e.children=nc(e.children),r.forEach((t=>{const n=L(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));return Object.keys(e.children).forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=oc(e.children),e.applyChanges(),void e.emit("change",e.children)}if(o||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=J({id:q()}),n=function(e){return lc(e,ul(C(M())))}(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.setBlockSelected(null),e.focusBlock(t.id,{slate:n,waitExecution:!0}),e.applyChanges(),void e.emit("change",e.children)}if(!n)return;e.children=nc(e.children);const[l]=n,c=Object.keys(e.children),a=c.find((t=>e.children[t].meta.order===l));if(c.forEach((t=>{const n=e.children[t];n.meta.order>l&&(n.meta.order-=1)})),a&&(delete e.children[a],delete e.blockEditorsMap[a]),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,o=L(e,{at:[n]});o&&e.focusBlock(o.id,{focusAt:t.focusAt})}}function uc(e,t){const n={};return t.forEach((t=>{const o=t.type;n[o]={hotkey:t.hotkey,type:o,getValue:()=>function(e,t){const n=Nn(e);if(!n)return null;const o=S.marks(n);return null==o?void 0:o[t]}(e,o),isActive:()=>ic(e,o),toggle:()=>function(e,t){const n=Nn(e),o=ic(e,t);n&&(o?S.removeMark(n,t):S.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,o),update:t=>function(e,t,n){const o=Nn(e);o&&o.selection&&B.isExpanded(o.selection)&&(S.addMark(o,t,n),e.applyChanges(),e.emit("change",e.children))}(e,o,t)}})),n}function fc(e){const t={};return Object.keys(e.children).forEach((n=>{const o=pc(e);t[n]=o})),t}function pc(e){return lc(e,ul(C(M())))}function hc({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const gc=hc({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),vc=(()=>{const e=q();return{[e]:J({id:e})}})(),yc=new X,mc=(e,t)=>yc.on(e,t),bc=(e,t)=>yc.once(e,t),wc=(e,t)=>yc.off(e,t),xc=(e,t)=>yc.emit(e,t);const kc=({id:n,editor:o,value:r,marks:i,plugins:l,autoFocus:c,className:a,tools:s,selectionBoxRoot:u,children:p,placeholder:h,readOnly:g,width:v,style:y})=>{const m=()=>{k((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},b=d((()=>i?[gc,...i]:[gc]),[i]),w=d((()=>l.map((e=>e.getPlugin))),[l]),[x,k]=f((()=>{o.id||(o.id=n||q()),o.applyChanges=m,o.readOnly=g||!1,b&&(o.formats=uc(o,b)),o.blocks=function(e,t){const n={};return t.forEach((t=>{var o;const r=ri(t.elements),i=null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType;if("inline"!==i&&"inlineVoid"!==i){const o={};Object.keys(t.elements).forEach((e=>{const n=bi(t.elements[e],["render"]);o[e]=n}));const{display:r,placeholder:i,align:l,shortcuts:c}=t.options||{};n[t.type]={type:t.type,elements:o,hasCustomEditor:!!t.customEditor,options:{display:r,placeholder:i,align:l,shortcuts:c},isActive:()=>{const n=L(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:n=>sc(e,t.type,n),create:n=>rc(e,t.type,n),update:(t,n)=>{cc(e,t,n)},delete:t=>{dc(e,t)}}}})),n}(o,w);const e=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),o.children=e?r:vc,o.blockEditorsMap=fc(o),o.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,o,r,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(o=e.options)||void 0===o?void 0:o.shortcuts.length)>0&&(null===(i=null===(r=e.options)||void 0===r?void 0:r.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(o),o.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var o;const r=e.elements[t],i=null===(o=r.props)||void 0===o?void 0:o.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},r),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const o=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:o})}})),t}(w),o.on=mc,o.once=bc,o.off=wc,o.emit=xc,{editor:o,version:0}}));return(e=>!!(Array.isArray(e)&&e.length>0)&&e.some((e=>{if(e.id||e.nodeType||e.type||e.children)return!0})))(r)?(console.error("Legacy version of Yoopta-Editor in use"),t("div",{children:[e("h1",{children:"Legacy version of the Yoopta-Editor is used"}),e("p",{children:"It looks like you are using a legacy version of the editor."}),t("p",{children:["The structure of value has changed in new ",e("b",{children:"@v4"})," version"]}),t("p",{children:["Please, check the migration guide to update your editor to the new ",e("b",{children:"@v4"})," version.",e("a",{href:""})]}),t("p",{children:["If you have specific case please"," ",e("a",Object.assign({href:"https://github.com/Darginec05/Yoopta-Editor/issues",target:"_blank",rel:"noopener noreferrer"},{children:"open the issue"}))," ","and we will solve your problem with migration"]})]})):e(il,{children:e(F,Object.assign({editorState:x},{children:e(ci,Object.assign({tools:s},{children:e(rl,Object.assign({placeholder:h,marks:b,autoFocus:c,className:a,selectionBoxRoot:u,width:v,style:y},{children:p}))}))}))})},Ec=Object.assign(Object.assign({},vi),{ExtendedBlockActions:({id:o,className:r,style:i,onClick:l,children:c})=>{const a=V(),[s,d]=f(!1),{refs:u,floatingStyles:p,context:h}=Pr({placement:"bottom-start",open:s,onOpenChange:d,middleware:[Ho(),zo(),Fo(),ko(10)],whileElementsMounted:Io}),{isMounted:g,styles:v}=Hr(h,{duration:100}),y=Object.assign(Object.assign({},v),p);return a?null:t(n,{children:[g&&e(gi,Object.assign({isOpen:!0,onClose:()=>d(!1),refs:u,style:y},{children:c})),e("button",Object.assign({type:"button",ref:u.setReference,id:o,className:`yoopta-button yoopta-extended-block-actions ${r||""}`,onClick:()=>{null==l||l(),d(!0)},style:s?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(Zr,{})}))]})},Portal:ui,Overlay:di});function Oc(e,t){const n=Object.keys(e.children),{type:o}=t||{},r=n.find((t=>e.children[t].type===o));return r?e.children[r]:null}function Cc(e,t,n={}){e.children=nc(e.children);const{at:o=null,focus:r=!1,slate:i=null}=n,l=L(e),c=o,a={id:q(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let s=!1;if(i&&i.selection){const e=S.string(i,i.selection.anchor.path);s=S.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(c){const[t]=c;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),a.meta.order=t}else{const t=Object.keys(e.children).length;a.meta.order=t}const d=pc(e);e.blockEditorsMap[a.id]=d,s&&l&&(a.meta.order=l.meta.order,l.meta.order+=1),e.children[a.id]=a;const u=null==l?void 0:l.id;e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(s&&u?u:a.id)}function Sc(e,t,n){e.children=nc(e.children);const[o]=n,r=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===o)),l=r.meta.order<i.meta.order,c=r.meta.order>i.meta.order;Object.values(e.children).forEach((e=>{l?e.meta.order>r.meta.order&&e.meta.order<=i.meta.order&&e.meta.order--:c&&e.meta.order<r.meta.order&&e.meta.order>=i.meta.order&&e.meta.order++})),r.meta.order=o,r.meta.depth=i.meta.depth,e.setSelection([o]),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children)}function Dc(e,t,n={}){try{const{focusAt:o,waitExecution:r=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:l=!0}=n,c=()=>{const r=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!r||!i)return;if(!e.blocks[i.type].hasCustomEditor){const e=function(e,t){if(T.isPoint(t))return t;if(j.isPath(t))return{path:t,offset:0};const[,n]=S.first(e,[0]);return{path:n||[0,0],offset:0}}(r,o);D.select(r,e),w.focus(r)}l&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};r?setTimeout((()=>c()),i):c(),Hi.set(e,!0)}catch(e){}}function jc(e,t={}){const{slate:n,focus:o=!0}=t,r=L(e);n&&n.selection&&r&&S.withoutNormalizing(n,(()=>{e.children=nc(e.children);const t=j.parent(n.selection.anchor.path);D.splitNodes(n,{at:n.selection,match:e=>_.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,l=n.children.slice()[i];D.removeNodes(n,{at:[i],match:e=>_.isElement(e),mode:"highest"});const c={id:q(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth},value:[l]};Object.values(e.children).forEach((e=>{e.meta.order>=c.meta.order&&(e.meta.order+=1)}));const a=pc(e);e.blockEditorsMap[c.id]=a,e.children[c.id]=c,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(c.id,{slate:a})}))}function Bc(e,t={}){const{at:n=e.selection,blockId:o=""}=t;if(!o&&!n)return;e.children=nc(e.children);const r=e.children[o]||L(e);r&&(r.meta.depth=r.meta.depth+1,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children))}function Rc(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=nc(e.children);const o=L(e);o&&(o.meta.depth=0===o.meta.depth?0:o.meta.depth-1,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children))}function _c(e){return Array.from(new Set(e))}var Ac={};!function(e,t){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object Boolean]",l="[object Date]",c="[object Function]",a="[object GeneratorFunction]",s="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",C="[object Uint8Array]",S="[object Uint8ClampedArray]",D="[object Uint16Array]",j="[object Uint32Array]",B=/\w*$/,R=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,A={};A[r]=A["[object Array]"]=A[m]=A[b]=A[i]=A[l]=A[w]=A[x]=A[k]=A[E]=A[O]=A[s]=A[d]=A[u]=A[p]=A[h]=A[g]=A[v]=A[C]=A[S]=A[D]=A[j]=!0,A["[object Error]"]=A[c]=A[y]=!1;var M="object"==typeof K&&K&&K.Object===Object&&K,T="object"==typeof self&&self&&self.Object===Object&&self,N=M||T||Function("return this")(),L=t&&!t.nodeType&&t,P=L&&e&&!e.nodeType&&e,I=P&&P.exports===L;function F(e,t){return e.set(t[0],t[1]),e}function z(e,t){return e.add(t),e}function H(e,t,n,o){var r=-1,i=e?e.length:0;for(o&&i&&(n=e[++r]);++r<i;)n=t(n,e[r],r,e);return n}function U(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}function $(e,t){return function(n){return e(t(n))}}function W(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Y,X=Array.prototype,Z=Function.prototype,q=Object.prototype,G=N["__core-js_shared__"],J=(Y=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",Q=Z.toString,ee=q.hasOwnProperty,te=q.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=I?N.Buffer:void 0,re=N.Symbol,ie=N.Uint8Array,le=$(Object.getPrototypeOf,Object),ce=Object.create,ae=q.propertyIsEnumerable,se=X.splice,de=Object.getOwnPropertySymbols,ue=oe?oe.isBuffer:void 0,fe=$(Object.keys,Object),pe=Ie(N,"DataView"),he=Ie(N,"Map"),ge=Ie(N,"Promise"),ve=Ie(N,"Set"),ye=Ie(N,"WeakMap"),me=Ie(Object,"create"),be=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Ee=Ve(ye),Oe=re?re.prototype:void 0,Ce=Oe?Oe.valueOf:void 0;function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function De(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function Be(e){this.__data__=new De(e)}function Re(e,t){var n=We(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ke(e)}(e)&&ee.call(e,"callee")&&(!ae.call(e,"callee")||te.call(e)==r)}(e)?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],o=n.length,i=!!o;for(var l in e)!t&&!ee.call(e,l)||i&&("length"==l||He(l,o))||n.push(l);return n}function _e(e,t,n){var o=e[t];ee.call(e,t)&&$e(o,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if($e(e[n][0],t))return n;return-1}function Me(e,t,n,o,f,y,R){var _;if(o&&(_=y?o(e,f,y,R):o(e)),void 0!==_)return _;if(!Ze(e))return e;var M=We(e);if(M){if(_=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,o=e.length;t||(t=Array(o));for(;++n<o;)t[n]=e[n];return t}(e,_)}else{var T=ze(e),N=T==c||T==a;if(Ye(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==u||T==r||N&&!y){if(U(e))return y?e:{};if(_=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=le(e),Ze(t)?ce(t):{});var t}(N?{}:e),!t)return function(e,t){return Le(e,Fe(e),t)}(e,function(e,t){return e&&Le(t,qe(t),e)}(_,e))}else{if(!A[T])return y?e:{};_=function(e,t,n,o){var r=e.constructor;switch(t){case m:return Ne(e);case i:case l:return new r(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,o);case w:case x:case k:case E:case O:case C:case S:case D:case j:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,o);case s:return function(e,t,n){var o=t?n(V(e),!0):V(e);return H(o,F,new e.constructor)}(e,o,n);case d:case g:return new r(e);case p:return function(e){var t=new e.constructor(e.source,B.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var o=t?n(W(e),!0):W(e);return H(o,z,new e.constructor)}(e,o,n);case v:return c=e,Ce?Object(Ce.call(c)):{}}var c}(e,T,Me,t)}}R||(R=new Be);var L=R.get(e);if(L)return L;if(R.set(e,_),!M)var P=n?function(e){return function(e,t,n){var o=t(e);return We(e)?o:function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}(o,n(e))}(e,qe,Fe)}(e):qe(e);return function(e,t){for(var n=-1,o=e?e.length:0;++n<o&&!1!==t(e[n],n,e););}(P||e,(function(r,i){P&&(r=e[i=r]),_e(_,i,Me(r,t,n,o,i,e,R))})),_}function Te(e){return!(!Ze(e)||(t=e,J&&J in t))&&(Xe(e)||U(e)?ne:R).test(Ve(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Le(e,t,n,o){n||(n={});for(var r=-1,i=t.length;++r<i;){var l=t[r],c=o?o(n[l],e[l],l,n,e):void 0;_e(n,l,void 0===c?e[l]:c)}return n}function Pe(e,t){var n,o,r=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}Se.prototype.clear=function(){this.__data__=me?me(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(me){var o=t[e];return o===n?void 0:o}return ee.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?n:t,this},De.prototype.clear=function(){this.__data__=[]},De.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():se.call(t,n,1),!0)},De.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return Ae(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,o=Ae(n,e);return o<0?n.push([e,t]):n[o][1]=t,this},je.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||De),string:new Se}},je.prototype.delete=function(e){return Pe(this,e).delete(e)},je.prototype.get=function(e){return Pe(this,e).get(e)},je.prototype.has=function(e){return Pe(this,e).has(e)},je.prototype.set=function(e,t){return Pe(this,e).set(e,t),this},Be.prototype.clear=function(){this.__data__=new De},Be.prototype.delete=function(e){return this.__data__.delete(e)},Be.prototype.get=function(e){return this.__data__.get(e)},Be.prototype.has=function(e){return this.__data__.has(e)},Be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof De){var o=n.__data__;if(!he||o.length<199)return o.push([e,t]),this;n=this.__data__=new je(o)}return n.set(e,t),this};var Fe=de?$(de,Object):function(){return[]},ze=function(e){return te.call(e)};function He(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||_.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function $e(e,t){return e===t||e!=e&&t!=t}(pe&&ze(new pe(new ArrayBuffer(1)))!=b||he&&ze(new he)!=s||ge&&ze(ge.resolve())!=f||ve&&ze(new ve)!=h||ye&&ze(new ye)!=y)&&(ze=function(e){var t=te.call(e),n=t==u?e.constructor:void 0,o=n?Ve(n):void 0;if(o)switch(o){case be:return b;case we:return s;case xe:return f;case ke:return h;case Ee:return y}return t});var We=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Xe(e)}var Ye=ue||function(){return!1};function Xe(e){var t=Ze(e)?te.call(e):"";return t==c||t==a}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function qe(e){return Ke(e)?Re(e):function(e){if(!Ue(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Me(e,!0,!0)}}({get exports(){return Ac},set exports(e){Ac=e}},Ac);var Mc=Ac;function Tc(e,t={}){const{blockId:n,focus:o}=t;if(!n&&!t.at)throw new Error("blockId or path should be provided");let r=null;if(n&&(r=e.children[n],!r))throw new Error(`Block not with blockId: ${n} found`);if(t.at&&(r=L(e,{at:t.at}),!r))throw new Error(`Block in path ${t.at} not found`);if(!r)throw new Error("Block not found");e.children=nc(e.children);Object.values(e.children).forEach((e=>{e.meta.order>r.meta.order&&(e.meta.order+=1)}));const i=(l=r,"function"==typeof window.structuredClone?window.structuredClone(l):Mc(l));var l;const c=pc(e);i.id=q(),i.meta.order=r.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=c;const a=i.id;e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(a,{waitExecution:!0})}function Nc(e,t,n={}){e.children=nc(e.children);const{at:o,focus:r}=n;let i=o||[0];const l=L(e),c=Nn(e);let a=!1,s=!1;if(c&&c.selection){const t=j.parent(c.selection.anchor.path),n=S.string(c,t).trim(),o=S.isStart(c,c.selection.anchor,t);a=""===n&&o,s=!o||n.length>0,w.blur(c),e.setSelection(null)}s&&(i=[i[0]+1]),Object.values(e.children).forEach((e=>{e.meta.order>=i[0]&&(e.meta.order+=t.length)}));const d=[];if(t.forEach(((t,n)=>{const o={id:t.id,value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:i[0]+n})};d.push(o.meta.order),e.children[o.id]=o;const r=pc(e);e.blockEditorsMap[o.id]=r})),l&&a){const t=l.meta.order;delete e.children[l.id],delete e.blockEditorsMap[l.id],Object.keys(e.children).forEach((n=>{const o=e.children[n];o.meta.order>t&&(o.meta.order-=1)}))}e.children=oc(e.children),console.log("editor.children",e.children),e.applyChanges(),e.emit("change",e.children),r&&e.setBlockSelected(d)}function Lc(e,t){try{w.blur(t),w.deselect(t),D.deselect(t)}catch(e){}e.setBlockSelected(null),e.setSelection(null)}function Pc(e,t={}){const{deleteAll:n=!1,paths:o,blockIds:r,focus:i=!0}=t;if(n||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=J({id:q()}),n=function(e){return lc(e,ul(C(M())))}(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t.id,{waitExecution:!0}))}if(Array.isArray(r)&&r.length>0){e.children=nc(e.children),r.forEach((t=>{delete e.children[t],delete e.blockEditorsMap[t]}));const t=Object.keys(e.children).sort(((t,n)=>e.children[t].meta.order>e.children[n].meta.order?1:-1));return t.forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t[0],{waitExecution:!0}))}if(Array.isArray(o)&&o.length>0){e.children=nc(e.children),o.forEach((t=>{const n=L(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));const t=Object.keys(e.children).sort(((t,n)=>e.children[t].meta.order>e.children[n].meta.order?1:-1));return t.forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t[0],{waitExecution:!0}))}}const Ic=()=>{const e={id:"",children:{},selection:null,selectedBlocks:null,readOnly:!1,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),setEditorValue:(...t)=>function(e,t){e.children=t,e.blockEditorsMap=fc(e),e.applyChanges(),e.emit("change",e.children)}(e,...t),applyChanges:()=>{},insertBlock:(...t)=>Cc(e,...t),insertBlocks:(...t)=>Nc(e,...t),deleteBlocks:(...t)=>Pc(e,...t),deleteBlock:(...t)=>dc(e,...t),duplicateBlock:(...t)=>Tc(e,...t),toggleBlock:(...t)=>sc(e,...t),increaseBlockDepth:(...t)=>Bc(e,...t),decreaseBlockDepth:(...t)=>Rc(e,...t),moveBlock:(...t)=>Sc(e,...t),focusBlock:(...t)=>Dc(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>cc(e,...t),splitBlock:(...t)=>jc(e,...t),setSelection:(...t)=>function(e,t,n={}){const{applyChanges:o=!0}=n;e.selection=t,o&&e.applyChanges()}(e,...t),setBlockSelected:(...t)=>function(e,t,n={}){const{only:o=!1,allSelected:r=!1}=n,i=e.selectedBlocks||[];if(null===t)e.selectedBlocks=null;else if(t.length>1)e.selectedBlocks=t;else if(o)e.selectedBlocks=t;else if(r){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=_c(t)}else e.selectedBlocks=_c(i.concat(t));e.applyChanges()}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{},isFocused:()=>function(e){return!!Hi.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=L(e,{at:[0]});t&&(Hi.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const o=null!==(n=t.slate)&&void 0!==n?n:Nn(e);if(!o)return;const{waitExecution:r,waitExecutionMs:i}=t;r?setTimeout((()=>Lc(e,o)),i):(Hi.set(e,!1),Lc(e,o),e.emit("blur",!1),e.applyChanges())}(e,...t)};return e};function Fc(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(!r)return void console.warn("No slate found");let i=e=>_.isElement(e);(null==n?void 0:n.type)&&(i=e=>_.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=S.nodes(r,{at:(null==n?void 0:n.path)||r.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function zc(e,t,n){const o=Fc(e,t,n);if(o)return o[0]}const Hc={createElement:function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Nn(e,{at:[r.meta.order]});i?S.withoutNormalizing(i,(()=>{const l=e.blocks[r.type],c=l.elements[n.type],a=G({type:n.type,props:Object.assign(Object.assign({},c.props),n.props)}),s=Object.keys(l.elements);let d=[];s.forEach((e=>{const t=l.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=l.elements[e];d.push(G({type:e,props:t.props}))}))})),d.length>0&&(a.children=d);const{path:u,focus:f=!0}=o||{};let p;const h=Fc(e,t,{type:n.type});if(h){const[,e]=h;j.isPath(u)?p=u:"prev"===u?p=j.previous(e):"next"===u&&(p=j.next(e))}if(D.insertNodes(i,a,{at:p,select:f}),f&&d.length>0){const n=d[0],o=Fc(e,t,{path:p,type:n.type});if(o){const[,e]=o;D.select(i,e)}}e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},deleteElement:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});r?S.withoutNormalizing(r,(()=>{D.removeNodes(r,{at:n.path,match:e=>_.isElement(e)&&e.type===n.type}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},updateElement:function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Nn(e,{at:[r.meta.order]});i?S.withoutNormalizing(i,(()=>{const[t]=S.nodes(i,{at:(null==o?void 0:o.path)||[0],match:e=>_.isElement(e)&&e.type===n.type}),r=null==t?void 0:t[0],l=(null==r?void 0:r.props)||{},c={props:Object.assign(Object.assign({},l),n.props)};D.setNodes(i,c,{at:(null==o?void 0:o.path)||[0],match:e=>_.isElement(e)&&e.type===n.type,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},getElement:zc,getElementChildren:function(e,t,n){const o=zc(e,t,n);if(o)return o.children},getElementEntry:Fc,isElementEmpty:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(!r)return void console.warn("No slate found");const[i]=S.nodes(r,{at:n.path||r.selection,match:e=>_.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===S.string(r,t).trim().length}return!1},getElementPath:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(r)try{return w.findPath(r,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(!r)return console.warn("No slate found"),[];try{const e=w.findPath(r,n);return j.parent(e)}catch(e){}}},Uc={insertBlock:Cc,deleteBlock:dc,moveBlock:Sc,focusBlock:Dc,splitBlock:jc,increaseBlockDepth:Bc,decreaseBlockDepth:Rc,duplicateBlock:Tc,updateBlock:cc,toggleBlock:sc,insertBlocks:Nc,deleteBlocks:Pc};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}button{background-color:transparent;border:none;cursor:pointer}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-editor{height:auto}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block{background-color:#2383e224;border-radius:.25rem;height:100%;left:0;opacity:1;pointer-events:none;position:absolute;top:0;width:100%;z-index:90}.yoopta-block-actions{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-block-actions[data-hovered-state-open=true]{opacity:1}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}");export{Uc as Blocks,Hc as Elements,Li as HOTKEYS,Ec as UI,N as YooptaPlugin,J as buildBlockData,G as buildBlockElement,Ic as createYooptaEditor,hc as createYooptaMark,kc as default,L as findPluginBlockBySelectionPath,Oc as findPluginBlockByType,Nn as findSlateBySelectionPath,q as generateId,ri as getRootBlockElement,oi as getRootBlockElementType,H as useBlockData,W as useBlockSelected,z as useYooptaEditor,U as useYooptaFocused,$ as useYooptaPluginOptions,V as useYooptaReadOnly,ai as useYooptaTools};
|
|
13
|
+
function ll(e){return"[object Object]"===Object.prototype.toString.call(e)}var cl={isHistory(e){return!1!==ll(t=e)&&(void 0===(n=t.constructor)||!1!==ll(o=n.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf"))&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(0===e.redos.length||A.isOperationList(e.redos[0].operations))&&(0===e.undos.length||A.isOperationList(e.undos[0].operations));var t,n,o}},al=new WeakMap,sl=new WeakMap,dl={isHistoryEditor:e=>cl.isHistory(e.history)&&S.isEditor(e),isMerging:e=>sl.get(e),isSaving:e=>al.get(e),redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=dl.isMerging(e);sl.set(e,!1),t(),sl.set(e,n)},withoutSaving(e,t){var n=dl.isSaving(e);al.set(e,!1),t(),al.set(e,n)}},ul=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:e}=t,{redos:n}=e;if(n.length>0){var o=n[n.length-1];o.selectionBefore&&D.setSelection(t,o.selectionBefore),dl.withoutSaving(t,(()=>{S.withoutNormalizing(t,(()=>{for(var e of o.operations)t.apply(e)}))})),e.redos.pop(),t.writeHistory("undos",o)}},t.undo=()=>{var{history:e}=t,{undos:n}=e;if(n.length>0){var o=n[n.length-1];dl.withoutSaving(t,(()=>{S.withoutNormalizing(t,(()=>{var e=o.operations.map(A.inverse).reverse();for(var n of e)t.apply(n);o.selectionBefore&&D.setSelection(t,o.selectionBefore)}))})),t.writeHistory("redos",o),e.undos.pop()}},t.apply=e=>{var{operations:o,history:r}=t,{undos:i}=r,l=i[i.length-1],c=l&&l.operations[l.operations.length-1],a=dl.isSaving(t),s=dl.isMerging(t);if(null==a&&(a=pl(e)),a){if(null==s&&(s=null!=l&&(0!==o.length||fl(e,c))),l&&s)l.operations.push(e);else{var d={operations:[e],selectionBefore:t.selection};t.writeHistory("undos",d)}for(;i.length>100;)i.shift();r.redos=[]}n(e)},t.writeHistory=(e,n)=>{t.history[e].push(n)},t},fl=(e,t)=>!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!j.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!j.equals(e.path,t.path)),pl=(e,t)=>"set_selection"!==e.type,hl=Symbol.for("immer-nothing"),gl=Symbol.for("immer-draftable"),vl=Symbol.for("immer-state");function yl(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ml=Object.getPrototypeOf;function bl(e){return!!e&&!!e[vl]}function wl(e){return!!e&&(kl(e)||Array.isArray(e)||!!e[gl]||!!e.constructor?.[gl]||Dl(e)||jl(e))}var xl=Object.prototype.constructor.toString();function kl(e){if(!e||"object"!=typeof e)return!1;const t=ml(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===xl}function El(e,t){0===Ol(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function Ol(e){const t=e[vl];return t?t.type_:Array.isArray(e)?1:Dl(e)?2:jl(e)?3:0}function Cl(e,t){return 2===Ol(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sl(e,t,n){const o=Ol(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function Dl(e){return e instanceof Map}function jl(e){return e instanceof Set}function Bl(e){return e.copy_||e.base_}function Rl(e,t){if(Dl(e))return new Map(e);if(jl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&kl(e)){if(!ml(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[vl];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(ml(e),n)}function _l(e,t=!1){return Ml(e)||bl(e)||!wl(e)||(Ol(e)>1&&(e.set=e.add=e.clear=e.delete=Al),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>_l(t,!0)))),e}function Al(){yl(2)}function Ml(e){return Object.isFrozen(e)}var Tl,Nl={};function Ll(e){const t=Nl[e];return t||yl(0),t}function Pl(){return Tl}function Il(e,t){t&&(Ll("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fl(e){zl(e),e.drafts_.forEach(Ul),e.drafts_=null}function zl(e){e===Tl&&(Tl=e.parent_)}function Hl(e){return Tl={drafts_:[],parent_:Tl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ul(e){const t=e[vl];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Vl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[vl].modified_&&(Fl(t),yl(4)),wl(e)&&(e=$l(t,e),t.parent_||Kl(t,e)),t.patches_&&Ll("Patches").generateReplacementPatches_(n[vl].base_,e,t.patches_,t.inversePatches_)):e=$l(t,n,[]),Fl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==hl?e:void 0}function $l(e,t,n){if(Ml(t))return t;const o=t[vl];if(!o)return El(t,((r,i)=>Wl(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Kl(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),El(r,((r,l)=>Wl(e,o,t,r,l,n,i))),Kl(e,t,!1),n&&e.patches_&&Ll("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Wl(e,t,n,o,r,i,l){if(bl(r)){const l=$l(e,r,i&&t&&3!==t.type_&&!Cl(t.assigned_,o)?i.concat(o):void 0);if(Sl(n,o,l),!bl(l))return;e.canAutoFreeze_=!1}else l&&n.add(r);if(wl(r)&&!Ml(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;$l(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Kl(e,r)}}function Kl(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_l(t,n)}var Yl={get(e,t){if(t===vl)return e;const n=Bl(e);if(!Cl(n,t))return function(e,t,n){const o=ql(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!wl(o)?o:o===Zl(e.base_,t)?(Jl(e),e.copy_[t]=Ql(o,e)):o},has:(e,t)=>t in Bl(e),ownKeys:e=>Reflect.ownKeys(Bl(e)),set(e,t,n){const o=ql(Bl(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=Zl(Bl(e),t),l=o?.[vl];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(i=o)?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==n||Cl(e.base_,t)))return!0;Jl(e),Gl(e)}var r,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Zl(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Jl(e),Gl(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Bl(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){yl(11)},getPrototypeOf:e=>ml(e.base_),setPrototypeOf(){yl(12)}},Xl={};function Zl(e,t){const n=e[vl];return(n?Bl(n):e)[t]}function ql(e,t){if(!(t in e))return;let n=ml(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=ml(n)}}function Gl(e){e.modified_||(e.modified_=!0,e.parent_&&Gl(e.parent_))}function Jl(e){e.copy_||(e.copy_=Rl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}El(Yl,((e,t)=>{Xl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Xl.deleteProperty=function(e,t){return Xl.set.call(this,e,t,void 0)},Xl.set=function(e,t,n){return Yl.set.call(this,e[0],t,n,e[0])};function Ql(e,t){const n=Dl(e)?Ll("MapSet").proxyMap_(e,t):jl(e)?Ll("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Pl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=Yl;n&&(r=[o],i=Xl);const{revoke:l,proxy:c}=Proxy.revocable(r,i);return o.draft_=c,o.revoke_=l,c}(e,t);return(t?t.scope_:Pl()).drafts_.push(n),n}function ec(e){if(!wl(e)||Ml(e))return e;const t=e[vl];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Rl(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Rl(e,!0);return El(n,((e,t)=>{Sl(n,e,ec(t))})),t&&(t.finalized_=!1),n}var tc=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&yl(6),void 0!==n&&"function"!=typeof n&&yl(7),wl(e)){const r=Hl(this),i=Ql(e,void 0);let l=!0;try{o=t(i),l=!1}finally{l?Fl(r):zl(r)}return Il(r,n),Vl(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===hl&&(o=void 0),this.autoFreeze_&&_l(o,!0),n){const t=[],r=[];Ll("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}yl(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;return[this.produce(e,t,((e,t)=>{n=e,o=t})),n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){wl(e)||yl(8),bl(e)&&(e=function(e){bl(e)||yl(10);return ec(e)}(e));const t=Hl(this),n=Ql(e,void 0);return n[vl].isManual_=!0,zl(t),n}finishDraft(e,t){const n=e&&e[vl];n&&n.isManual_||yl(9);const{scope_:o}=n;return Il(o,t),Vl(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=Ll("Patches").applyPatches_;return bl(e)?o(e,t):this.produce(e,(e=>o(e,t)))}};tc.produce,tc.produceWithPatches.bind(tc),tc.setAutoFreeze.bind(tc),tc.setUseStrictShallowCopy.bind(tc),tc.applyPatches.bind(tc);var nc=tc.createDraft.bind(tc),oc=tc.finishDraft.bind(tc);function rc(e,t,n){e.children=nc(e.children);const o=L(e);if(!o)throw new Error(`No block found in the current selection path. Passed path: ${e.selection}`);const r=(null==n?void 0:n.slate)||Nn(e,{at:[null==o?void 0:o.meta.order]});if(!r||!r.selection)return;const i=e.blocks[t],l=function(e,t){const n=e.blocks[t].elements,o=oi(n);if(!o)throw new Error(`Root element type not found for block type ${t}`);const r=n[o];return{id:q(),type:o,props:r.props,children:r.children&&r.children.length>0?ii(r,n):[{text:""}]}}(e,t);(null==n?void 0:n.deleteText)&&D.delete(r,{at:[0,0]});const c=J({id:o.id,type:i.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[l]});r.children=c.value;const a=c.id;e.children[a]=c,e.blockEditorsMap[a]=r,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(a,{slate:r,waitExecution:!0})}function ic(e,t){const n=Nn(e);if(!n)return!1;const o=S.marks(n);return!!(null==o?void 0:o[t])}const lc=(e,t)=>{const{insertText:n}=t;return t.insertText=o=>{var r;const{selection:i}=t;if(" "===o&&i&&B.isCollapsed(i)){const{anchor:l}=i,c=S.above(t,{match:e=>_.isElement(e)&&S.isBlock(t,e),mode:"lowest"});if(!c)return;const[,a]=c,s=S.parent(t,a),[d]=s;if(_.isElement(d)&&!R.isText(d.children[0]))return n(o);const u=c?a:[],f={anchor:l,focus:S.start(t,u)},p=S.string(t,f),h=null===(r=e.shortcuts)||void 0===r?void 0:r[p];if(!!h&&!h.isActive())return D.select(t,f),D.delete(t),void h.create({deleteText:!1})}n(o)},t};function cc(e,t,n){e.children=nc(e.children);let o=!1;const r=e.children[t];r&&(n.id&&(r.id=n.id,o=!0),n.type&&(r.type=n.type,o=!0),n.meta&&(r.meta=n.meta,o=!0),n.value&&(r.value=n.value),e.children=oc(e.children),o&&e.applyChanges(),e.emit("change",e.children))}const ac="Paragraph";function sc(e,t,n){e.children=nc(e.children);const o=L(e,{at:(null==n?void 0:n.at)||e.selection});if(!o)throw new Error("Block from not found at current selection");let r=t;o.type===r&&(r=ac);const i=Nn(e,{at:[o.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${o.meta.order}`);const l=oi(e.blocks[r].elements);S.withoutNormalizing(i,(()=>{D.setNodes(i,{type:l},{at:[0],mode:"lowest",match:e=>_.isElement(e)&&!S.isInline(i,e)}),(null==n?void 0:n.deleteText)&&D.delete(i,{at:[0,0]});const t={id:o.id,type:r,meta:Object.assign(Object.assign({},o.meta),{order:o.meta.order}),value:i.children};e.blockEditorsMap[o.id]=i,e.children[o.id]=t,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(t.id,{slate:i})}))}function dc(e,t={}){const{at:n=e.selection,deleteAll:o=!1,fromPaths:r,focus:i}=t;if(Array.isArray(r)&&r.length>0){e.children=nc(e.children),r.forEach((t=>{const n=L(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));return Object.keys(e.children).forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=oc(e.children),e.applyChanges(),void e.emit("change",e.children)}if(o||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=J({id:q()}),n=function(e){return lc(e,ul(C(M())))}(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.setBlockSelected(null),e.focusBlock(t.id,{slate:n,waitExecution:!0}),e.applyChanges(),void e.emit("change",e.children)}if(!n)return;e.children=nc(e.children);const[l]=n,c=Object.keys(e.children),a=c.find((t=>e.children[t].meta.order===l));if(c.forEach((t=>{const n=e.children[t];n.meta.order>l&&(n.meta.order-=1)})),a&&(delete e.children[a],delete e.blockEditorsMap[a]),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,o=L(e,{at:[n]});o&&e.focusBlock(o.id,{focusAt:t.focusAt})}}function uc(e,t){const n={};return t.forEach((t=>{const o=t.type;n[o]={hotkey:t.hotkey,type:o,getValue:()=>function(e,t){const n=Nn(e);if(!n)return null;const o=S.marks(n);return null==o?void 0:o[t]}(e,o),isActive:()=>ic(e,o),toggle:()=>function(e,t){const n=Nn(e),o=ic(e,t);n&&(o?S.removeMark(n,t):S.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,o),update:t=>function(e,t,n){const o=Nn(e);o&&o.selection&&B.isExpanded(o.selection)&&(S.addMark(o,t,n),e.applyChanges(),e.emit("change",e.children))}(e,o,t)}})),n}function fc(e){const t={};return Object.keys(e.children).forEach((n=>{const o=pc(e);t[n]=o})),t}function pc(e){return lc(e,ul(C(M())))}function hc({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const gc=hc({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),vc=(()=>{const e=q();return{[e]:J({id:e})}})(),yc=new X,mc=(e,t)=>yc.on(e,t),bc=(e,t)=>yc.once(e,t),wc=(e,t)=>yc.off(e,t),xc=(e,t)=>yc.emit(e,t);const kc=({id:n,editor:o,value:r,marks:i,plugins:l,autoFocus:c,className:a,tools:s,selectionBoxRoot:u,children:p,placeholder:h,readOnly:g,width:v,style:y})=>{const m=()=>{k((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},b=d((()=>i?[gc,...i]:[gc]),[i]),w=d((()=>l.map((e=>e.getPlugin))),[l]),[x,k]=f((()=>{o.id||(o.id=n||q()),o.applyChanges=m,o.readOnly=g||!1,b&&(o.formats=uc(o,b)),o.blocks=function(e,t){const n={};return t.forEach((t=>{var o;const r=ri(t.elements),i=null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType;if("inline"!==i&&"inlineVoid"!==i){const o={};Object.keys(t.elements).forEach((e=>{const n=bi(t.elements[e],["render"]);o[e]=n}));const{display:r,placeholder:i,align:l,shortcuts:c}=t.options||{};n[t.type]={type:t.type,elements:o,hasCustomEditor:!!t.customEditor,options:{display:r,placeholder:i,align:l,shortcuts:c},isActive:()=>{const n=L(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:n=>sc(e,t.type,n),create:n=>rc(e,t.type,n),update:(t,n)=>{cc(e,t,n)},delete:t=>{dc(e,t)}}}})),n}(o,w);const e=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),o.children=e?r:vc,o.blockEditorsMap=fc(o),o.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,o,r,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(o=e.options)||void 0===o?void 0:o.shortcuts.length)>0&&(null===(i=null===(r=e.options)||void 0===r?void 0:r.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(o),o.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var o;const r=e.elements[t],i=null===(o=r.props)||void 0===o?void 0:o.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},r),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const o=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:o})}})),t}(w),o.on=mc,o.once=bc,o.off=wc,o.emit=xc,{editor:o,version:0}}));return(e=>!!(Array.isArray(e)&&e.length>0)&&e.some((e=>{if(e.id||e.nodeType||e.type||e.children)return!0})))(r)?(console.error("Legacy version of Yoopta-Editor in use"),t("div",{children:[e("h1",{children:"Legacy version of the Yoopta-Editor is used"}),e("p",{children:"It looks like you are using a legacy version of the editor."}),t("p",{children:["The structure of value has changed in new ",e("b",{children:"@v4"})," version"]}),t("p",{children:["Please, check the migration guide to update your editor to the new ",e("b",{children:"@v4"})," version.",e("a",{href:""})]}),t("p",{children:["If you have specific case please"," ",e("a",Object.assign({href:"https://github.com/Darginec05/Yoopta-Editor/issues",target:"_blank",rel:"noopener noreferrer"},{children:"open the issue"}))," ","and we will solve your problem with migration"]})]})):e(il,{children:e(F,Object.assign({editorState:x},{children:e(ci,Object.assign({tools:s},{children:e(rl,Object.assign({placeholder:h,marks:b,autoFocus:c,className:a,selectionBoxRoot:u,width:v,style:y},{children:p}))}))}))})},Ec=Object.assign(Object.assign({},vi),{ExtendedBlockActions:({id:o,className:r,style:i,onClick:l,children:c})=>{const a=V(),[s,d]=f(!1),{refs:u,floatingStyles:p,context:h}=Pr({placement:"bottom-start",open:s,onOpenChange:d,middleware:[Ho(),zo(),Fo(),ko(10)],whileElementsMounted:Io}),{isMounted:g,styles:v}=Hr(h,{duration:100}),y=Object.assign(Object.assign({},v),p);return a?null:t(n,{children:[g&&e(gi,Object.assign({isOpen:!0,onClose:()=>d(!1),refs:u,style:y},{children:c})),e("button",Object.assign({type:"button",ref:u.setReference,id:o,className:`yoopta-button yoopta-extended-block-actions ${r||""}`,onClick:()=>{null==l||l(),d(!0)},style:s?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(Zr,{})}))]})},Portal:ui,Overlay:di});function Oc(e,t){const n=Object.keys(e.children),{type:o}=t||{},r=n.find((t=>e.children[t].type===o));return r?e.children[r]:null}function Cc(e,t,n={}){e.children=nc(e.children);const{at:o=null,focus:r=!1,slate:i=null}=n,l=L(e),c=o,a={id:q(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let s=!1;if(i&&i.selection){const e=S.string(i,i.selection.anchor.path);s=S.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(c){const[t]=c;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),a.meta.order=t}else{const t=Object.keys(e.children).length;a.meta.order=t}const d=pc(e);e.blockEditorsMap[a.id]=d,s&&l&&(a.meta.order=l.meta.order,l.meta.order+=1),e.children[a.id]=a;const u=null==l?void 0:l.id;e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(s&&u?u:a.id)}function Sc(e,t,n){e.children=nc(e.children);const[o]=n,r=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===o)),l=r.meta.order<i.meta.order,c=r.meta.order>i.meta.order;Object.values(e.children).forEach((e=>{l?e.meta.order>r.meta.order&&e.meta.order<=i.meta.order&&e.meta.order--:c&&e.meta.order<r.meta.order&&e.meta.order>=i.meta.order&&e.meta.order++})),r.meta.order=o,r.meta.depth=i.meta.depth,e.setSelection([o]),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children)}function Dc(e,t,n={}){try{const{focusAt:o,waitExecution:r=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:l=!0}=n,c=()=>{const r=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!r||!i)return;if(!e.blocks[i.type].hasCustomEditor){const e=function(e,t){if(T.isPoint(t))return t;if(j.isPath(t))return{path:t,offset:0};const[,n]=S.first(e,[0]);return{path:n||[0,0],offset:0}}(r,o);D.select(r,e),w.focus(r)}l&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};r?setTimeout((()=>c()),i):c(),Hi.set(e,!0)}catch(e){}}function jc(e,t={}){const{slate:n,focus:o=!0}=t,r=L(e);n&&n.selection&&r&&S.withoutNormalizing(n,(()=>{e.children=nc(e.children);const t=j.parent(n.selection.anchor.path);D.splitNodes(n,{at:n.selection,match:e=>_.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,l=n.children.slice()[i];D.removeNodes(n,{at:[i],match:e=>_.isElement(e),mode:"highest"});const c={id:q(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth},value:[l]};Object.values(e.children).forEach((e=>{e.meta.order>=c.meta.order&&(e.meta.order+=1)}));const a=pc(e);e.blockEditorsMap[c.id]=a,e.children[c.id]=c,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(c.id,{slate:a})}))}function Bc(e,t={}){const{at:n=e.selection,blockId:o=""}=t;if(!o&&!n)return;e.children=nc(e.children);const r=e.children[o]||L(e);r&&(r.meta.depth=r.meta.depth+1,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children))}function Rc(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=nc(e.children);const o=L(e);o&&(o.meta.depth=0===o.meta.depth?0:o.meta.depth-1,e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children))}function _c(e){return Array.from(new Set(e))}var Ac={};!function(e,t){var n="__lodash_hash_undefined__",o=9007199254740991,r="[object Arguments]",i="[object Boolean]",l="[object Date]",c="[object Function]",a="[object GeneratorFunction]",s="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",O="[object Int32Array]",C="[object Uint8Array]",S="[object Uint8ClampedArray]",D="[object Uint16Array]",j="[object Uint32Array]",B=/\w*$/,R=/^\[object .+?Constructor\]$/,_=/^(?:0|[1-9]\d*)$/,A={};A[r]=A["[object Array]"]=A[m]=A[b]=A[i]=A[l]=A[w]=A[x]=A[k]=A[E]=A[O]=A[s]=A[d]=A[u]=A[p]=A[h]=A[g]=A[v]=A[C]=A[S]=A[D]=A[j]=!0,A["[object Error]"]=A[c]=A[y]=!1;var M="object"==typeof K&&K&&K.Object===Object&&K,T="object"==typeof self&&self&&self.Object===Object&&self,N=M||T||Function("return this")(),L=t&&!t.nodeType&&t,P=L&&e&&!e.nodeType&&e,I=P&&P.exports===L;function F(e,t){return e.set(t[0],t[1]),e}function z(e,t){return e.add(t),e}function H(e,t,n,o){var r=-1,i=e?e.length:0;for(o&&i&&(n=e[++r]);++r<i;)n=t(n,e[r],r,e);return n}function U(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach((function(e,o){n[++t]=[o,e]})),n}function $(e,t){return function(n){return e(t(n))}}function W(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Y,X=Array.prototype,Z=Function.prototype,q=Object.prototype,G=N["__core-js_shared__"],J=(Y=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",Q=Z.toString,ee=q.hasOwnProperty,te=q.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=I?N.Buffer:void 0,re=N.Symbol,ie=N.Uint8Array,le=$(Object.getPrototypeOf,Object),ce=Object.create,ae=q.propertyIsEnumerable,se=X.splice,de=Object.getOwnPropertySymbols,ue=oe?oe.isBuffer:void 0,fe=$(Object.keys,Object),pe=Ie(N,"DataView"),he=Ie(N,"Map"),ge=Ie(N,"Promise"),ve=Ie(N,"Set"),ye=Ie(N,"WeakMap"),me=Ie(Object,"create"),be=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Ee=Ve(ye),Oe=re?re.prototype:void 0,Ce=Oe?Oe.valueOf:void 0;function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function De(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function Be(e){this.__data__=new De(e)}function Re(e,t){var n=We(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ke(e)}(e)&&ee.call(e,"callee")&&(!ae.call(e,"callee")||te.call(e)==r)}(e)?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],o=n.length,i=!!o;for(var l in e)!t&&!ee.call(e,l)||i&&("length"==l||He(l,o))||n.push(l);return n}function _e(e,t,n){var o=e[t];ee.call(e,t)&&$e(o,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if($e(e[n][0],t))return n;return-1}function Me(e,t,n,o,f,y,R){var _;if(o&&(_=y?o(e,f,y,R):o(e)),void 0!==_)return _;if(!Ze(e))return e;var M=We(e);if(M){if(_=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,o=e.length;t||(t=Array(o));for(;++n<o;)t[n]=e[n];return t}(e,_)}else{var T=ze(e),N=T==c||T==a;if(Ye(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==u||T==r||N&&!y){if(U(e))return y?e:{};if(_=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=le(e),Ze(t)?ce(t):{});var t}(N?{}:e),!t)return function(e,t){return Le(e,Fe(e),t)}(e,function(e,t){return e&&Le(t,qe(t),e)}(_,e))}else{if(!A[T])return y?e:{};_=function(e,t,n,o){var r=e.constructor;switch(t){case m:return Ne(e);case i:case l:return new r(+e);case b:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,o);case w:case x:case k:case E:case O:case C:case S:case D:case j:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,o);case s:return function(e,t,n){var o=t?n(V(e),!0):V(e);return H(o,F,new e.constructor)}(e,o,n);case d:case g:return new r(e);case p:return function(e){var t=new e.constructor(e.source,B.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var o=t?n(W(e),!0):W(e);return H(o,z,new e.constructor)}(e,o,n);case v:return c=e,Ce?Object(Ce.call(c)):{}}var c}(e,T,Me,t)}}R||(R=new Be);var L=R.get(e);if(L)return L;if(R.set(e,_),!M)var P=n?function(e){return function(e,t,n){var o=t(e);return We(e)?o:function(e,t){for(var n=-1,o=t.length,r=e.length;++n<o;)e[r+n]=t[n];return e}(o,n(e))}(e,qe,Fe)}(e):qe(e);return function(e,t){for(var n=-1,o=e?e.length:0;++n<o&&!1!==t(e[n],n,e););}(P||e,(function(r,i){P&&(r=e[i=r]),_e(_,i,Me(r,t,n,o,i,e,R))})),_}function Te(e){return!(!Ze(e)||(t=e,J&&J in t))&&(Xe(e)||U(e)?ne:R).test(Ve(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Le(e,t,n,o){n||(n={});for(var r=-1,i=t.length;++r<i;){var l=t[r],c=o?o(n[l],e[l],l,n,e):void 0;_e(n,l,void 0===c?e[l]:c)}return n}function Pe(e,t){var n,o,r=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}Se.prototype.clear=function(){this.__data__=me?me(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(me){var o=t[e];return o===n?void 0:o}return ee.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?n:t,this},De.prototype.clear=function(){this.__data__=[]},De.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():se.call(t,n,1),!0)},De.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return Ae(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,o=Ae(n,e);return o<0?n.push([e,t]):n[o][1]=t,this},je.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||De),string:new Se}},je.prototype.delete=function(e){return Pe(this,e).delete(e)},je.prototype.get=function(e){return Pe(this,e).get(e)},je.prototype.has=function(e){return Pe(this,e).has(e)},je.prototype.set=function(e,t){return Pe(this,e).set(e,t),this},Be.prototype.clear=function(){this.__data__=new De},Be.prototype.delete=function(e){return this.__data__.delete(e)},Be.prototype.get=function(e){return this.__data__.get(e)},Be.prototype.has=function(e){return this.__data__.has(e)},Be.prototype.set=function(e,t){var n=this.__data__;if(n instanceof De){var o=n.__data__;if(!he||o.length<199)return o.push([e,t]),this;n=this.__data__=new je(o)}return n.set(e,t),this};var Fe=de?$(de,Object):function(){return[]},ze=function(e){return te.call(e)};function He(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||_.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function $e(e,t){return e===t||e!=e&&t!=t}(pe&&ze(new pe(new ArrayBuffer(1)))!=b||he&&ze(new he)!=s||ge&&ze(ge.resolve())!=f||ve&&ze(new ve)!=h||ye&&ze(new ye)!=y)&&(ze=function(e){var t=te.call(e),n=t==u?e.constructor:void 0,o=n?Ve(n):void 0;if(o)switch(o){case be:return b;case we:return s;case xe:return f;case ke:return h;case Ee:return y}return t});var We=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}(e.length)&&!Xe(e)}var Ye=ue||function(){return!1};function Xe(e){var t=Ze(e)?te.call(e):"";return t==c||t==a}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function qe(e){return Ke(e)?Re(e):function(e){if(!Ue(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Me(e,!0,!0)}}({get exports(){return Ac},set exports(e){Ac=e}},Ac);var Mc=Ac;function Tc(e,t={}){const{blockId:n,focus:o}=t;if(!n&&!t.at)throw new Error("blockId or path should be provided");let r=null;if(n&&(r=e.children[n],!r))throw new Error(`Block not with blockId: ${n} found`);if(t.at&&(r=L(e,{at:t.at}),!r))throw new Error(`Block in path ${t.at} not found`);if(!r)throw new Error("Block not found");e.children=nc(e.children);Object.values(e.children).forEach((e=>{e.meta.order>r.meta.order&&(e.meta.order+=1)}));const i=(l=r,"function"==typeof window.structuredClone?window.structuredClone(l):Mc(l));var l;const c=pc(e);i.id=q(),i.meta.order=r.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=c;const a=i.id;e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(a,{waitExecution:!0})}function Nc(e,t,n={}){e.children=nc(e.children);const{at:o,focus:r}=n;let i=o||[0];const l=L(e),c=Nn(e);let a=!1,s=!1;if(c&&c.selection){const t=j.parent(c.selection.anchor.path),n=S.string(c,t).trim(),o=S.isStart(c,c.selection.anchor,t);a=""===n&&o,s=!o||n.length>0,w.blur(c),e.setSelection(null)}s&&(i=[i[0]+1]),Object.values(e.children).forEach((e=>{e.meta.order>=i[0]&&(e.meta.order+=t.length)}));const d=[];if(t.forEach(((t,n)=>{const o={id:t.id,value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:i[0]+n})};d.push(o.meta.order),e.children[o.id]=o;const r=pc(e);e.blockEditorsMap[o.id]=r})),l&&a){const t=l.meta.order;delete e.children[l.id],delete e.blockEditorsMap[l.id],Object.keys(e.children).forEach((n=>{const o=e.children[n];o.meta.order>t&&(o.meta.order-=1)}))}e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.setBlockSelected(d)}function Lc(e,t){try{w.blur(t),w.deselect(t),D.deselect(t)}catch(e){}e.setBlockSelected(null),e.setSelection(null)}function Pc(e,t={}){const{deleteAll:n=!1,paths:o,blockIds:r,focus:i=!0}=t;if(n||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=J({id:q()}),n=function(e){return lc(e,ul(C(M())))}(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t.id,{waitExecution:!0}))}if(Array.isArray(r)&&r.length>0){e.children=nc(e.children),r.forEach((t=>{delete e.children[t],delete e.blockEditorsMap[t]}));const t=Object.keys(e.children).sort(((t,n)=>e.children[t].meta.order>e.children[n].meta.order?1:-1));return t.forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t[0],{waitExecution:!0}))}if(Array.isArray(o)&&o.length>0){e.children=nc(e.children),o.forEach((t=>{const n=L(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));const t=Object.keys(e.children).sort(((t,n)=>e.children[t].meta.order>e.children[n].meta.order?1:-1));return t.forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=oc(e.children),e.applyChanges(),e.emit("change",e.children),void(i&&e.focusBlock(t[0],{waitExecution:!0}))}}const Ic=()=>{const e={id:"",children:{},selection:null,selectedBlocks:null,readOnly:!1,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),setEditorValue:(...t)=>function(e,t){e.children=t,e.blockEditorsMap=fc(e),e.applyChanges(),e.emit("change",e.children)}(e,...t),applyChanges:()=>{},insertBlock:(...t)=>Cc(e,...t),insertBlocks:(...t)=>Nc(e,...t),deleteBlocks:(...t)=>Pc(e,...t),deleteBlock:(...t)=>dc(e,...t),duplicateBlock:(...t)=>Tc(e,...t),toggleBlock:(...t)=>sc(e,...t),increaseBlockDepth:(...t)=>Bc(e,...t),decreaseBlockDepth:(...t)=>Rc(e,...t),moveBlock:(...t)=>Sc(e,...t),focusBlock:(...t)=>Dc(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>cc(e,...t),splitBlock:(...t)=>jc(e,...t),setSelection:(...t)=>function(e,t,n={}){const{applyChanges:o=!0}=n;e.selection=t,o&&e.applyChanges()}(e,...t),setBlockSelected:(...t)=>function(e,t,n={}){const{only:o=!1,allSelected:r=!1}=n,i=e.selectedBlocks||[];if(null===t)e.selectedBlocks=null;else if(t.length>1)e.selectedBlocks=t;else if(o)e.selectedBlocks=t;else if(r){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=_c(t)}else e.selectedBlocks=_c(i.concat(t));e.applyChanges()}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{},isFocused:()=>function(e){return!!Hi.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=L(e,{at:[0]});t&&(Hi.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const o=null!==(n=t.slate)&&void 0!==n?n:Nn(e);if(!o)return;const{waitExecution:r,waitExecutionMs:i}=t;r?setTimeout((()=>Lc(e,o)),i):(Hi.set(e,!1),Lc(e,o),e.emit("blur",!1),e.applyChanges())}(e,...t)};return e};function Fc(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(!r)return void console.warn("No slate found");let i=e=>_.isElement(e);(null==n?void 0:n.type)&&(i=e=>_.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=S.nodes(r,{at:(null==n?void 0:n.path)||r.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function zc(e,t,n){const o=Fc(e,t,n);if(o)return o[0]}const Hc={createElement:function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Nn(e,{at:[r.meta.order]});i?S.withoutNormalizing(i,(()=>{const l=e.blocks[r.type],c=l.elements[n.type],a=G({type:n.type,props:Object.assign(Object.assign({},c.props),n.props)}),s=Object.keys(l.elements);let d=[];s.forEach((e=>{const t=l.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=l.elements[e];d.push(G({type:e,props:t.props}))}))})),d.length>0&&(a.children=d);const{path:u,focus:f=!0}=o||{};let p;const h=Fc(e,t,{type:n.type});if(h){const[,e]=h;j.isPath(u)?p=u:"prev"===u?p=j.previous(e):"next"===u&&(p=j.next(e))}if(D.insertNodes(i,a,{at:p,select:f}),f&&d.length>0){const n=d[0],o=Fc(e,t,{path:p,type:n.type});if(o){const[,e]=o;D.select(i,e)}}e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},deleteElement:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});r?S.withoutNormalizing(r,(()=>{D.removeNodes(r,{at:n.path,match:e=>_.isElement(e)&&e.type===n.type}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},updateElement:function(e,t,n,o){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const i=Nn(e,{at:[r.meta.order]});i?S.withoutNormalizing(i,(()=>{const[t]=S.nodes(i,{at:(null==o?void 0:o.path)||[0],match:e=>_.isElement(e)&&e.type===n.type}),r=null==t?void 0:t[0],l=(null==r?void 0:r.props)||{},c={props:Object.assign(Object.assign({},l),n.props)};D.setNodes(i,c,{at:(null==o?void 0:o.path)||[0],match:e=>_.isElement(e)&&e.type===n.type,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")},getElement:zc,getElementChildren:function(e,t,n){const o=zc(e,t,n);if(o)return o.children},getElementEntry:Fc,isElementEmpty:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(!r)return void console.warn("No slate found");const[i]=S.nodes(r,{at:n.path||r.selection,match:e=>_.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===S.string(r,t).trim().length}return!1},getElementPath:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(r)try{return w.findPath(r,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const r=Nn(e,{at:[o.meta.order]});if(!r)return console.warn("No slate found"),[];try{const e=w.findPath(r,n);return j.parent(e)}catch(e){}}},Uc={insertBlock:Cc,deleteBlock:dc,moveBlock:Sc,focusBlock:Dc,splitBlock:jc,increaseBlockDepth:Bc,decreaseBlockDepth:Rc,duplicateBlock:Tc,updateBlock:cc,toggleBlock:sc,insertBlocks:Nc,deleteBlocks:Pc};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&o.firstChild?o.insertBefore(r,o.firstChild):o.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}(".yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}button{background-color:transparent;border:none;cursor:pointer}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-editor{height:auto}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block{background-color:#2383e224;border-radius:.25rem;height:100%;left:0;opacity:1;pointer-events:none;position:absolute;top:0;width:100%;z-index:90}.yoopta-block-actions{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-block-actions[data-hovered-state-open=true]{opacity:1}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}");export{Uc as Blocks,Hc as Elements,Li as HOTKEYS,Ec as UI,N as YooptaPlugin,J as buildBlockData,G as buildBlockElement,Ic as createYooptaEditor,hc as createYooptaMark,kc as default,L as findPluginBlockBySelectionPath,Oc as findPluginBlockByType,Nn as findSlateBySelectionPath,q as generateId,ri as getRootBlockElement,oi as getRootBlockElementType,H as useBlockData,W as useBlockSelected,z as useYooptaEditor,U as useYooptaFocused,$ as useYooptaPluginOptions,V as useYooptaReadOnly,ai as useYooptaTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlateEditorComponent.d.ts","sourceRoot":"","sources":["../../src/plugins/SlateEditorComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAA+E,MAAM,EAAE,MAAM,SAAS,CAAC;AAc9G,KAAK,KAAK,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAgBF,QAAA,MAAM,oBAAoB,2LAyPzB,CAAC;
|
|
1
|
+
{"version":3,"file":"SlateEditorComponent.d.ts","sourceRoot":"","sources":["../../src/plugins/SlateEditorComponent.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAA+E,MAAM,EAAE,MAAM,SAAS,CAAC;AAc9G,KAAK,KAAK,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,EAAE,QAAQ,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG;IACrF,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAgBF,QAAA,MAAM,oBAAoB,2LAyPzB,CAAC;AAwEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
68
68
|
},
|
|
69
69
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "6aa0efc351d0e71c53e60a452c13023febc31235"
|
|
71
71
|
}
|