@frontify/guideline-blocks-settings 0.28.2 → 0.28.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/components/Attachments/AttachmentItem.es.js +67 -67
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +80 -80
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +67 -67
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +28 -28
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar.es.js +33 -33
- package/dist/components/BlockItemWrapper/Toolbar.es.js.map +1 -1
- package/dist/components/DownloadButton/DownloadButton.es.js +12 -12
- package/dist/components/DownloadButton/DownloadButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +12 -12
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/SerializedText.es.js +4 -4
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +9 -9
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +8 -8
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +6 -6
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +10 -10
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +13 -13
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +18 -18
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +11 -11
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +15 -15
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +3 -3
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +40 -40
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +10 -10
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +4 -4
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +14 -14
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +14 -14
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +14 -14
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +20 -20
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +17 -17
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +17 -17
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +17 -17
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +18 -18
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +16 -16
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +19 -19
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +15 -15
- package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js +32 -32
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js +15 -15
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js +30 -30
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js +27 -27
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js +12 -12
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js +14 -14
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/SectionLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js +3 -2
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js +7 -7
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js +27 -12
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js +7 -7
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js +33 -33
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js.map +1 -1
- package/dist/index.cjs.js +12 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +12 -37
- package/dist/index.umd.js.map +1 -1
- package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
- package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
- package/package.json +12 -11
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.tsx +2 -2
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.tsx +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/index.ts +2 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.tsx +1 -1
- package/src/components/RichTextEditor/plugins/styles.ts +1 -1
- package/src/components/RichTextEditor/serializer/nodes/button.ts +3 -1
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +5 -4
- package/src/components/RichTextEditor/serializer/nodes/default.ts +30 -14
- package/src/components/RichTextEditor/serializer/nodes/link.ts +5 -4
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +5 -5
- package/src/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.ts +1 -1
- package/src/utilities/react/getBackgroundColorStyles.ts +2 -3
- package/src/utilities/react/getBorderStyles.ts +2 -3
- package/src/utilities/react/getRadiusStyles.ts +1 -1
- package/vite.config.ts +4 -2
- package/dist/_virtual/jsx-runtime.es.js +0 -5
- package/dist/_virtual/jsx-runtime.es.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.development.es.js +0 -5
- package/dist/_virtual/react-jsx-runtime.development.es.js.map +0 -1
- package/dist/_virtual/react-jsx-runtime.production.min.es.js +0 -5
- package/dist/_virtual/react-jsx-runtime.production.min.es.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,46 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@frontify/sidebar-settings"),w=require("react"),o=require("@frontify/fondue"),fe=require("@frontify/app-bridge"),_=require("@dnd-kit/core"),De=require("@dnd-kit/sortable"),qt=require("@react-aria/focus"),ur=require("@dnd-kit/modifiers"),l=require("@udecode/plate"),rt=require("escape-html"),Gt=require("slate-react"),cr=require("@react-stately/overlays"),dr=require("slate"),gr=require("react-dom"),ne=require("@ctrl/tinycolor");var at={exports:{}},Ie={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Ht;function mr(){if(Ht)return Ie;Ht=1;var e=w,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function d(g,c,p){var h,f={},x=null,T=null;p!==void 0&&(x=""+p),c.key!==void 0&&(x=""+c.key),c.ref!==void 0&&(T=c.ref);for(h in c)r.call(c,h)&&!u.hasOwnProperty(h)&&(f[h]=c[h]);if(g&&g.defaultProps)for(h in c=g.defaultProps,c)f[h]===void 0&&(f[h]=c[h]);return{$$typeof:t,type:g,key:x,ref:T,props:f,_owner:a.current}}return Ie.Fragment=n,Ie.jsx=d,Ie.jsxs=d,Ie}var Re={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Vt;function fr(){return Vt||(Vt=1,process.env.NODE_ENV!=="production"&&function(){var e=w,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),g=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),B=Symbol.iterator,D="@@iterator";function U(i){if(i===null||typeof i!="object")return null;var m=B&&i[B]||i[D];return typeof m=="function"?m:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(i){{for(var m=arguments.length,y=new Array(m>1?m-1:0),S=1;S<m;S++)y[S-1]=arguments[S];K("error",i,y)}}function K(i,m,y){{var S=I.ReactDebugCurrentFrame,P=S.getStackAddendum();P!==""&&(m+="%s",y=y.concat([P]));var N=y.map(function(C){return String(C)});N.unshift("Warning: "+m),Function.prototype.apply.call(console[i],console,N)}}var se=!1,q=!1,j=!1,$=!1,W=!1,Z;Z=Symbol.for("react.module.reference");function le(i){return!!(typeof i=="string"||typeof i=="function"||i===r||i===u||W||i===a||i===p||i===h||$||i===T||se||q||j||typeof i=="object"&&i!==null&&(i.$$typeof===x||i.$$typeof===f||i.$$typeof===d||i.$$typeof===g||i.$$typeof===c||i.$$typeof===Z||i.getModuleId!==void 0))}function ie(i,m,y){var S=i.displayName;if(S)return S;var P=m.displayName||m.name||"";return P!==""?y+"("+P+")":y}function Ce(i){return i.displayName||"Context"}function Y(i){if(i==null)return null;if(typeof i.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case r:return"Fragment";case n:return"Portal";case u:return"Profiler";case a:return"StrictMode";case p:return"Suspense";case h:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case g:var m=i;return Ce(m)+".Consumer";case d:var y=i;return Ce(y._context)+".Provider";case c:return ie(i,i.render,"ForwardRef");case f:var S=i.displayName||null;return S!==null?S:Y(i.type)||"Memo";case x:{var P=i,N=P._payload,C=P._init;try{return Y(C(N))}catch{return null}}}return null}var ee=Object.assign,E=0,H,J,Ne,Be,Te,pe,Tt;function Pt(){}Pt.__reactDisabledLog=!0;function Mn(){{if(E===0){H=console.log,J=console.info,Ne=console.warn,Be=console.error,Te=console.group,pe=console.groupCollapsed,Tt=console.groupEnd;var i={configurable:!0,enumerable:!0,value:Pt,writable:!0};Object.defineProperties(console,{info:i,log:i,warn:i,error:i,group:i,groupCollapsed:i,groupEnd:i})}E++}}function Dn(){{if(E--,E===0){var i={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ee({},i,{value:H}),info:ee({},i,{value:J}),warn:ee({},i,{value:Ne}),error:ee({},i,{value:Be}),group:ee({},i,{value:Te}),groupCollapsed:ee({},i,{value:pe}),groupEnd:ee({},i,{value:Tt})})}E<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ke=I.ReactCurrentDispatcher,Ye;function Ae(i,m,y){{if(Ye===void 0)try{throw Error()}catch(P){var S=P.stack.trim().match(/\n( *(at )?)/);Ye=S&&S[1]||""}return`
|
|
18
|
-
`+Ye+i}}var Xe=!1,_e;{var $n=typeof WeakMap=="function"?WeakMap:Map;_e=new $n}function It(i,m){if(!i||Xe)return"";{var y=_e.get(i);if(y!==void 0)return y}var S;Xe=!0;var P=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var N;N=Ke.current,Ke.current=null,Mn();try{if(m){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(te){S=te}Reflect.construct(i,[],C)}else{try{C.call()}catch(te){S=te}i.call(C.prototype)}}else{try{throw Error()}catch(te){S=te}i()}}catch(te){if(te&&S&&typeof te.stack=="string"){for(var k=te.stack.split(`
|
|
19
|
-
`),V=S.stack.split(`
|
|
20
|
-
`),A=k.length-1,O=V.length-1;A>=1&&O>=0&&k[A]!==V[O];)O--;for(;A>=1&&O>=0;A--,O--)if(k[A]!==V[O]){if(A!==1||O!==1)do if(A--,O--,O<0||k[A]!==V[O]){var G=`
|
|
21
|
-
`+k[A].replace(" at new "," at ");return i.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",i.displayName)),typeof i=="function"&&_e.set(i,G),G}while(A>=1&&O>=0);break}}}finally{Xe=!1,Ke.current=N,Dn(),Error.prepareStackTrace=P}var be=i?i.displayName||i.name:"",Ut=be?Ae(be):"";return typeof i=="function"&&_e.set(i,Ut),Ut}function Un(i,m,y){return It(i,!1)}function Hn(i){var m=i.prototype;return!!(m&&m.isReactComponent)}function Oe(i,m,y){if(i==null)return"";if(typeof i=="function")return It(i,Hn(i));if(typeof i=="string")return Ae(i);switch(i){case p:return Ae("Suspense");case h:return Ae("SuspenseList")}if(typeof i=="object")switch(i.$$typeof){case c:return Un(i.render);case f:return Oe(i.type,m,y);case x:{var S=i,P=S._payload,N=S._init;try{return Oe(N(P),m,y)}catch{}}}return""}var Fe=Object.prototype.hasOwnProperty,Rt={},jt=I.ReactDebugCurrentFrame;function Me(i){if(i){var m=i._owner,y=Oe(i.type,i._source,m?m.type:null);jt.setExtraStackFrame(y)}else jt.setExtraStackFrame(null)}function Vn(i,m,y,S,P){{var N=Function.call.bind(Fe);for(var C in i)if(N(i,C)){var k=void 0;try{if(typeof i[C]!="function"){var V=Error((S||"React class")+": "+y+" type `"+C+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[C]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw V.name="Invariant Violation",V}k=i[C](m,C,S,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(A){k=A}k&&!(k instanceof Error)&&(Me(P),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",S||"React class",y,C,typeof k),Me(null)),k instanceof Error&&!(k.message in Rt)&&(Rt[k.message]=!0,Me(P),R("Failed %s type: %s",y,k.message),Me(null))}}}var zn=Array.isArray;function Je(i){return zn(i)}function Wn(i){{var m=typeof Symbol=="function"&&Symbol.toStringTag,y=m&&i[Symbol.toStringTag]||i.constructor.name||"Object";return y}}function qn(i){try{return Lt(i),!1}catch{return!0}}function Lt(i){return""+i}function Nt(i){if(qn(i))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Wn(i)),Lt(i)}var Pe=I.ReactCurrentOwner,Gn={key:!0,ref:!0,__self:!0,__source:!0},Bt,At,Qe;Qe={};function Kn(i){if(Fe.call(i,"ref")){var m=Object.getOwnPropertyDescriptor(i,"ref").get;if(m&&m.isReactWarning)return!1}return i.ref!==void 0}function Yn(i){if(Fe.call(i,"key")){var m=Object.getOwnPropertyDescriptor(i,"key").get;if(m&&m.isReactWarning)return!1}return i.key!==void 0}function Xn(i,m){if(typeof i.ref=="string"&&Pe.current&&m&&Pe.current.stateNode!==m){var y=Y(Pe.current.type);Qe[y]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',Y(Pe.current.type),i.ref),Qe[y]=!0)}}function Jn(i,m){{var y=function(){Bt||(Bt=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};y.isReactWarning=!0,Object.defineProperty(i,"key",{get:y,configurable:!0})}}function Qn(i,m){{var y=function(){At||(At=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};y.isReactWarning=!0,Object.defineProperty(i,"ref",{get:y,configurable:!0})}}var Zn=function(i,m,y,S,P,N,C){var k={$$typeof:t,type:i,key:m,ref:y,props:C,_owner:N};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:S}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function er(i,m,y,S,P){{var N,C={},k=null,V=null;y!==void 0&&(Nt(y),k=""+y),Yn(m)&&(Nt(m.key),k=""+m.key),Kn(m)&&(V=m.ref,Xn(m,P));for(N in m)Fe.call(m,N)&&!Gn.hasOwnProperty(N)&&(C[N]=m[N]);if(i&&i.defaultProps){var A=i.defaultProps;for(N in A)C[N]===void 0&&(C[N]=A[N])}if(k||V){var O=typeof i=="function"?i.displayName||i.name||"Unknown":i;k&&Jn(C,O),V&&Qn(C,O)}return Zn(i,k,V,P,S,Pe.current,C)}}var Ze=I.ReactCurrentOwner,_t=I.ReactDebugCurrentFrame;function ye(i){if(i){var m=i._owner,y=Oe(i.type,i._source,m?m.type:null);_t.setExtraStackFrame(y)}else _t.setExtraStackFrame(null)}var et;et=!1;function tt(i){return typeof i=="object"&&i!==null&&i.$$typeof===t}function Ot(){{if(Ze.current){var i=Y(Ze.current.type);if(i)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+i+"`."}return""}}function tr(i){{if(i!==void 0){var m=i.fileName.replace(/^.*[\\\/]/,""),y=i.lineNumber;return`
|
|
24
|
-
|
|
25
|
-
Check your code at `+m+":"+y+"."}return""}}var Ft={};function nr(i){{var m=Ot();if(!m){var y=typeof i=="string"?i:i.displayName||i.name;y&&(m=`
|
|
26
|
-
|
|
27
|
-
Check the top-level render call using <`+y+">.")}return m}}function Mt(i,m){{if(!i._store||i._store.validated||i.key!=null)return;i._store.validated=!0;var y=nr(m);if(Ft[y])return;Ft[y]=!0;var S="";i&&i._owner&&i._owner!==Ze.current&&(S=" It was passed a child from "+Y(i._owner.type)+"."),ye(i),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,S),ye(null)}}function Dt(i,m){{if(typeof i!="object")return;if(Je(i))for(var y=0;y<i.length;y++){var S=i[y];tt(S)&&Mt(S,m)}else if(tt(i))i._store&&(i._store.validated=!0);else if(i){var P=U(i);if(typeof P=="function"&&P!==i.entries)for(var N=P.call(i),C;!(C=N.next()).done;)tt(C.value)&&Mt(C.value,m)}}}function rr(i){{var m=i.type;if(m==null||typeof m=="string")return;var y;if(typeof m=="function")y=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===c||m.$$typeof===f))y=m.propTypes;else return;if(y){var S=Y(m);Vn(y,i.props,"prop",S,i)}else if(m.PropTypes!==void 0&&!et){et=!0;var P=Y(m);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",P||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ar(i){{for(var m=Object.keys(i.props),y=0;y<m.length;y++){var S=m[y];if(S!=="children"&&S!=="key"){ye(i),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",S),ye(null);break}}i.ref!==null&&(ye(i),R("Invalid attribute `ref` supplied to `React.Fragment`."),ye(null))}}function $t(i,m,y,S,P,N){{var C=le(i);if(!C){var k="";(i===void 0||typeof i=="object"&&i!==null&&Object.keys(i).length===0)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var V=tr(P);V?k+=V:k+=Ot();var A;i===null?A="null":Je(i)?A="array":i!==void 0&&i.$$typeof===t?(A="<"+(Y(i.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):A=typeof i,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",A,k)}var O=er(i,m,y,P,N);if(O==null)return O;if(C){var G=m.children;if(G!==void 0)if(S)if(Je(G)){for(var be=0;be<G.length;be++)Dt(G[be],i);Object.freeze&&Object.freeze(G)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Dt(G,i)}return i===r?ar(O):rr(O),O}}function sr(i,m,y){return $t(i,m,y,!0)}function ir(i,m,y){return $t(i,m,y,!1)}var or=ir,lr=sr;Re.Fragment=r,Re.jsx=or,Re.jsxs=lr}()),Re}process.env.NODE_ENV==="production"?at.exports=mr():at.exports=fr();var s=at.exports;const re=e=>e.filter(Boolean).join(" "),hr=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:u,onAssetChooseClick:d,onUploadClick:g,withMenu:c=!0,onClick:p,validFileType:h,verticalLayout:f})=>{const[x,T]=w.useState(!1),[B,D]=w.useState(),U=w.useRef(null),[I,R]=w.useState(void 0),K=j=>{if(j.preventDefault(),T(!1),!se(j.dataTransfer.files)){R("Invalid"),setTimeout(()=>{R(void 0)},1e3);return}e==null||e(j.dataTransfer.files)},se=j=>{if(!h)return!0;for(let $=0;$<j.length;$++){const W=j[$].name.split(".").pop()??"";if(!fe.FileExtensionSets[h].includes(W))return!1}return!0},q=j=>{if(!U.current||a)return;const{left:$,top:W}=U.current.getBoundingClientRect(),Z=j.clientX-$,le=j.clientY-W;D([Z,le])};return s.jsxs("button",{ref:U,"data-test-id":"block-inject-button",className:re(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",f?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",u?"tw-h-full":"tw-h-[72px]",x&&!a?"tw-border-dashed":"tw-border-solid",B&&"tw-bg-blank-state-pressed-inverse",x&&"tw-bg-blank-state-weak-inverse",I?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||B||x||I?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(x||B)&&!I?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?j=>{var $;if(T(!0),h==="Images")for(const W of Array.from(j.dataTransfer.items))($=W==null?void 0:W.type)!=null&&$.startsWith("image/")?R(void 0):R("Invalid")}:void 0,onDragLeave:e?()=>{T(!1),R(void 0)}:void 0,onDrop:e?K:void 0,onClick:j=>{c&&q(j),p==null||p()},children:[a?s.jsx(o.LoadingCircle,{}):I?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(o.IconExclamationMarkTriangle,{}),I]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),B&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:B[0],top:B[1]},children:s.jsx(o.Flyout,{onOpenChange:j=>!j&&D(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(o.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...g?[{id:"upload",size:o.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{g(),D(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(o.IconArrowCircleUp20,{})})}]:[],...d?[{id:"asset",size:o.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{d(),D(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(o.IconImageStack20,{})})}]:[]]}]})})})]})},he=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(u=>r.hasOwnProperty(u)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},pr=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),yr=(e,t)=>{const n=pr(e)?he(e):e,r=ne(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},br=e=>ne(he(e)).toHex8String(),wr=e=>ne(he(e)).toHexString(),dt=e=>ne(he(e)).toRgbString(),xr=(e,t)=>ne(t).setAlpha(e).toRgbString(),vr=e=>{const{r:t,g:n,b:r,a}=ne(e);return{red:t,green:n,blue:r,alpha:a}},zt=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Sr=(e,t)=>{const n=zt(e)?he(e):e,r=zt(t)?he(t):t;let a=ne(n);const u=ne(r);for(;ne.readability(a,u)<4.5;)a=a.darken(1);return a.toRgbString()},Er=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const u=r.splice(t,1)[0];r.splice(a,0,u)}return r},kr=e=>({backgroundColor:dt(e)});var Q=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(Q||{});const Kt={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var oe=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(oe||{});const ge={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var ue=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(ue||{});const we={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var ce=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(ce||{});const xe={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var me=(e=>(e.Global="Global",e.Custom="Custom",e))(me||{}),de=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))(de||{});const Yt={Auto:"4px",S:"10px",M:"30px",L:"50px"},Cr={red:241,green:241,blue:241,alpha:1},Xt={red:234,green:235,blue:235,alpha:1},Tr="1px",je="24px",Le="24px",Pr=(e=Q.Solid,t="1px",n=Xt)=>({borderStyle:Kt[e],borderWidth:t,borderColor:dt(n)}),Ir=(e,t=!1,n)=>({borderRadius:t?n:ge[e]}),Jt="Drag or press ↵ to move",Qt="Move with ↑↓←→ and confirm with ↵",Rr=({items:e,flyoutItems:t,isFlyoutOpen:n,setIsFlyoutOpen:r,isDragging:a,isFlyoutDisabled:u})=>s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-flex tw-justify-end",children:s.jsxs("div",{className:"tw-bg-white tw-text-box-selected-inverse tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-[2px] tw-px-[1px] tw-spacing tw-items-center tw-h-7 tw-self-start tw-border tw-border-box-selected-inverse tw-rounded",children:[e.map((d,g)=>"draggableProps"in d?s.jsx(o.Tooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:a,position:o.TooltipPosition.Top,content:s.jsx("div",{children:a?Qt:d.tooltip??Jt}),triggerElement:s.jsx("button",{ref:d.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...d.draggableProps,className:re(["tw-bg-base tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",a?"tw-cursor-grabbing tw-bg-box-selected-pressed":"tw-cursor-grab hover:tw-bg-box-selected-hover"]),children:d.icon})},g):s.jsx(o.Tooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:a,position:o.TooltipPosition.Top,content:s.jsx("div",{children:d.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:d.onClick,className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:d.icon})},g)),t.length>0&&s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6",children:s.jsx(o.Flyout,{isOpen:n&&!a,isTriggerDisabled:u,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:r,trigger:s.jsx(o.Tooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:a,position:o.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:s.jsx(o.IconDotsHorizontal16,{})})}),children:s.jsx(o.ActionMenu,{menuBlocks:t.map((d,g)=>({id:g.toString(),menuItems:d.map((c,p)=>({id:g.toString()+p.toString(),size:o.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{r(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})]})}),jr=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:u,shouldFillContainer:d,outlineOffset:g=2,shouldBeShown:c=!1})=>{const[p,h]=w.useState(c),[f,x]=w.useState(!1),T=w.useRef(null);if(w.useEffect(()=>{p||x(!0)},[p]),r)return e;const B=n==null?void 0:n.filter(D=>D!==void 0);return s.jsxs("div",{ref:T,onFocus:()=>x(!1),onPointerEnter:()=>x(!1),"data-test-id":"block-item-wrapper",style:{outlineOffset:g},className:re(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",d&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",(p||c)&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-g,bottom:`calc(100% - ${2+g}px)`},className:re(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-10","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",(p||c)&&"tw-opacity-100"]),children:s.jsx(Rr,{isFlyoutOpen:p,isFlyoutDisabled:f,setIsFlyoutOpen:h,flyoutItems:t,items:B,isDragging:u})}),e]})},Lr=e=>e==="IMAGE"?s.jsx(o.IconImage24,{}):e==="VIDEO"?s.jsx(o.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(o.IconMusicNote24,{}):s.jsx(o.IconDocument24,{}),gt=w.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:u,isLoading:d,onDelete:g,onReplaceWithBrowse:c,onReplaceWithUpload:p},h)=>{const[f,x]=w.useState(),[T,{selectedFiles:B}]=fe.useFileInput({multiple:!0,accept:"image/*"}),[D,{results:U,doneAll:I}]=fe.useAssetUpload(),{focusProps:R,isFocusVisible:K}=qt.useFocusRing();w.useEffect(()=>{B&&D(B[0])},[B]),w.useEffect(()=>{I&&p(U[0])},[I,U]);const se=(j,$)=>{fetch(j).then(W=>{W.blob().then(Z=>{const le=URL.createObjectURL(Z),ie=document.createElement("a");ie.href=le,ie.download=$,ie.click()})})},q=d||B&&!I;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>se(e.genericUrl,e.fileName),ref:h,style:{...r,opacity:a&&!u?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:re(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:q?s.jsx(o.LoadingCircle,{size:o.LoadingCircleSize.Small}):Lr(e.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:re(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",u||(f==null?void 0:f.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...R,...n,"aria-label":"Drag attachment",className:re([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",a||u?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",K&&o.FOCUS_STYLE,K&&"tw-z-[2]"]),children:s.jsx(o.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(o.Flyout,{placement:o.FlyoutPlacement.Right,isOpen:(f==null?void 0:f.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:j=>x(j?e:void 0),trigger:(j,$)=>s.jsx(o.Button,{ref:$,icon:s.jsx(o.IconPen20,{}),emphasis:o.ButtonEmphasis.Default,onClick:()=>x(e)}),children:s.jsx(o.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:o.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{T(),x(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(o.IconArrowCircleUp20,{})})},{id:"asset",size:o.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),x(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(o.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:o.MenuItemContentSize.XSmall,title:"Delete",style:o.MenuItemStyle.Danger,onClick:()=>{g(),x(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(o.IconTrashBin20,{})})}]}]})})})]})]})});gt.displayName="AttachmentItem";const Nr=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:u,isDragging:d}=De.useSortable({id:e.item.id}),g={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:u,zIndex:d?2:1},c={...t,...n};return s.jsx(gt,{ref:r,isDragging:d,transformStyle:g,draggableProps:c,...e})},Br=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:u,onSorted:d,appBridge:g})=>{const[c,p]=w.useState(e),[h,f]=w.useState(!1),x=_.useSensors(_.useSensor(_.PointerSensor),_.useSensor(_.KeyboardSensor)),[T,B]=w.useState(void 0),[D,U]=w.useState(!1),[I,R]=w.useState([]),[K,se]=w.useState(null),q=fe.useEditorState(g),j=c==null?void 0:c.find(E=>E.id===T),[$,{results:W,doneAll:Z}]=fe.useAssetUpload({onUploadProgress:()=>!D&&U(!0)});w.useEffect(()=>{p(e)},[e]),w.useEffect(()=>{K&&(U(!0),$(K))},[K]),w.useEffect(()=>{(async()=>{Z&&(await u(W),U(!1))})()},[Z,W]);const le=()=>{f(!1),g.openAssetChooser(E=>{a(E),g.closeAssetChooser(),f(!0)},{multiSelection:!0,selectedValueIds:c.map(E=>E.id)})},ie=E=>{f(!1),g.openAssetChooser(async H=>{f(!0),g.closeAssetChooser(),R([...I,E.id]),await n(E,H[0]),R(I.filter(J=>J!==E.id))},{multiSelection:!1,selectedValueIds:c.map(H=>H.id)})},Ce=async(E,H)=>{R([...I,E.id]),await r(E,H),R(I.filter(J=>J!==E.id))},Y=E=>{const{active:H}=E;B(H.id)},ee=E=>{const{active:H,over:J}=E;if(J&&H.id!==J.id&&c){const Ne=c.findIndex(pe=>pe.id===H.id),Be=c.findIndex(pe=>pe.id===J.id),Te=De.arrayMove(c,Ne,Be);p(Te),d(Te)}B(void 0)};return q||((c==null?void 0:c.length)??0)>0?s.jsx(o.Tooltip,{withArrow:!0,position:o.TooltipPosition.Top,content:"Attachments",disabled:h,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(o.Flyout,{placement:o.FlyoutPlacement.BottomRight,onOpenChange:E=>f(j?!0:E),isOpen:h,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsxs("div",{className:"tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line",children:[s.jsx(o.IconPaperclip16,{}),s.jsx("div",{children:e.length>0?e.length:"Add"}),s.jsx(o.IconCaretDown12,{})]}),children:s.jsxs("div",{className:"tw-w-[300px]",children:[c.length>0&&s.jsxs(_.DndContext,{sensors:x,collisionDetection:_.closestCenter,onDragStart:Y,onDragEnd:ee,modifiers:[ur.restrictToWindowEdges],children:[s.jsx(De.SortableContext,{items:c,strategy:De.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:c.map(E=>s.jsx(Nr,{isEditing:q,isLoading:I.includes(E.id),item:E,onDelete:()=>t(E),onReplaceWithBrowse:()=>ie(E),onReplaceWithUpload:H=>Ce(E,H)},E.id))})}),s.jsx(_.DragOverlay,{children:j&&s.jsx(gt,{isOverlay:!0,isEditing:q,item:j,isDragging:!0,onDelete:()=>t(j),onReplaceWithBrowse:()=>ie(j),onReplaceWithUpload:E=>Ce(j,E)},T)})]}),q&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(o.AssetInput,{isLoading:D,size:o.AssetInputSize.Small,onUploadClick:E=>se(E),onLibraryClick:le})]})]})})})}):null},Ar=({onDownload:e})=>{const{isFocused:t,focusProps:n}=qt.useFocusRing();return s.jsx(o.Tooltip,{withArrow:!0,position:o.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:re(["tw-outline-none tw-rounded",t&&o.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(o.IconArrowCircleDown16,{})})})})},_r=({floatingOptions:e,...t})=>{const n=l.useEditorRef(),r=Gt.useFocused(),a=l.useFloatingLinkSelectors().mode(),u=l.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:d}=l.getPluginOptions(n,l.ELEMENT_LINK);l.useHotkeys(d,h=>{l.triggerFloatingLinkInsert(n,{focused:r})&&h.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:g,style:c,floating:p}=l.useVirtualFloatingLink({editorId:n.id,open:u&&a==="insert",getBoundingClientRect:l.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return w.useEffect(()=>{u?(g(),l.floatingLinkActions.updated(!0)):l.floatingLinkActions.updated(!1)},[u,g]),l.useFloatingLinkEscape(),{style:{...c,zIndex:1e3},...t,ref:l.useComposedRef(t.ref,p)}},Or=l.createComponentAs(e=>{var n;const t=_r({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:l.createElementAs("div",t)}),Fr=l.createComponentAs(e=>{var n;const t=Ra({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:l.createElementAs("div",t)});l.FloatingLink.EditRoot=Fr;l.FloatingLink.InsertRoot=Or;const $e=l.FloatingLink,Se="link-plugin",Zt=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},Mr=(e="p",t="",n)=>Zt(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),Dr=[_.KeyboardCode.Down,_.KeyboardCode.Right,_.KeyboardCode.Up,_.KeyboardCode.Left],en=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),Dr.includes(n.code)){const u=(a==null?void 0:a.offsetWidth)??0,d=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case _.KeyboardCode.Right:return{...r,x:r.x+u+e};case _.KeyboardCode.Left:return{...r,x:r.x-u-e};case _.KeyboardCode.Down:return{...r,y:r.y+d+t};case _.KeyboardCode.Up:return{...r,y:r.y-d-t}}}},$r=(e,t,n)=>e===me.Custom?t:n,Ur=e=>e.map(tn),tn=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),mt=(e,t)=>{const n=l.getAboveNode(e,{match:{type:l.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Hr=e=>mt(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Vr=e=>mt(e,t=>t.url||""),zr=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},Wr=e=>mt(e,zr),nn=/^\/(document|r)\/\S+$/i,We=e=>{if(nn.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},ft=e=>{if(nn.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},Ue=e=>ft(We(e))||e==="",qr=(e,t)=>{const n=l.getAboveNode(e,{match:{type:L}});return Array.isArray(n)?t(n[0]):""},rn=e=>qr(e,t=>t.url??""),an=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:u})=>({type:l.getPluginType(e,L),url:t,target:a,buttonStyle:r,children:u??[{text:n}]}),ht=l.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),F=ht.set,z=ht.get,Ee=()=>ht.use,qe=e=>{const t=l.findNode(e,{match:{type:l.getPluginType(e,L)}});if(!t)return;const[n,r]=t;let a=l.getEditorString(e,r);F.url(n.url),F.newTab(n.target===void 0),a===n.url&&(a=""),F.text(a),F.isEditing(!0)},Gr=({floatingOptions:e,...t})=>{const n=l.useEditorRef(),r=l.usePlateSelectors(n.id).keyEditor(),a=Ee().mode(),u=Ee().isOpen(n.id),{triggerFloatingButtonHotkeys:d}=l.getPluginOptions(n,L),g=w.useCallback(()=>{const x=l.getAboveNode(n,{match:{type:l.getPluginType(n,L)}});if(x){const[,T]=x;return l.getRangeBoundingClientRect(n,{anchor:l.getStartPoint(n,T),focus:l.getEndPoint(n,T)})}return l.getDefaultBoundingClientRect()},[n]),c=u&&a==="edit",{update:p,style:h,floating:f}=cn({open:c,getBoundingClientRect:g,...e});return w.useEffect(()=>{const x=rn(n);if(x&&F.url(x),n.selection&&l.someNode(n,{match:{type:l.getPluginType(n,L)}})){F.show("edit",n.id),p();return}z.mode()==="edit"&&F.hide()},[n,r,p]),l.useHotkeys(d,x=>{x.preventDefault(),z.mode()==="edit"&&qe(n)},{enableOnContentEditable:!0},[]),sa(),un(),{style:{...h,zIndex:1e3},...t,ref:l.useComposedRef(t.ref,f)}},pt=(e,{focused:t}={})=>{z.mode()||!t||l.isRangeAcrossBlocks(e,{at:e.selection})||l.someNode(e,{match:{type:l.getPluginType(e,L)}})||(F.text(l.getEditorString(e,e.selection)),F.show("insert",e.id))},Kr=({floatingOptions:e,...t})=>{const n=l.useEditorRef(),r=Gt.useFocused(),a=Ee().mode(),u=Ee().isOpen(n.id),{triggerFloatingButtonHotkeys:d}=l.getPluginOptions(n,L);l.useHotkeys(d,h=>{h.preventDefault(),pt(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:g,style:c,floating:p}=cn({open:u&&a==="insert",getBoundingClientRect:l.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return w.useEffect(()=>{u&&g(),F.updated(u)},[u,g]),un(),{style:{...c,zIndex:1e3},...t,ref:l.useComposedRef(t.ref,p)}},Yr=e=>{const t=l.useEditorRef();return{onClick:w.useCallback(()=>{qe(t)},[t]),...e}},Xr=l.createComponentAs(e=>{const t=Yr(e);return l.createElementAs("button",t)}),sn=(e,t,n)=>{l.insertNodes(e,[an(e,t)],n)},yt=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=l.getPluginOptions(e,L),r=z.url();if(!((t==null?void 0:t(r))||n))return;const u=z.text(),d=z.buttonStyle(),g=z.newTab()?void 0:"_self";return F.hide(),on(e,{url:r,text:u,buttonStyle:d,target:g,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{l.focusEditor(e,e.selection??void 0)},0),!0},ke=(e,t)=>l.withoutNormalizing(e,()=>{var n,r,a,u,d,g;if(t!=null&&t.split){if(l.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:l.getPluginType(e,L)}}))return l.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:h=>l.isElement(h)&&h.type===l.getPluginType(e,L)}),ke(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(l.getAboveNode(e,{at:(u=e.selection)==null?void 0:u.focus,match:{type:l.getPluginType(e,L)}}))return l.splitNodes(e,{at:(d=e.selection)==null?void 0:d.focus,match:h=>l.isElement(h)&&h.type===l.getPluginType(e,L)}),ke(e,{at:(g=e.selection)==null?void 0:g.focus}),!0}l.unwrapNodes(e,{match:{type:l.getPluginType(e,L)},...t})}),on=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:u,insertNodesOptions:d,isUrl:g=l.getPluginOptions(e,L).isUrl})=>{var I;const c=e.selection;if(!c)return;const p=l.getAboveNode(e,{at:c,match:{type:l.getPluginType(e,L)}});if(u&&p)return e.insertText(t),!0;if(!(g!=null&&g(t)))return;if(l.isDefined(n)&&n.length===0&&(n=t),p)return Zr(t,e,p,a,r,n),!0;const h=l.findNode(e,{at:c,match:{type:l.getPluginType(e,L)}}),[f,x]=h??[],T=Jr(e,x,n);if(l.isExpanded(c))return Qr(p,e,t,r,a,n),!0;T&&l.removeNodes(e,{at:x});const B=l.getNodeProps(f??{}),D=(I=e.selection)==null?void 0:I.focus.path;if(!D)return;const U=l.getNodeLeaf(e,D);return n!=null&&n.length||(n=t),sn(e,{...B,url:t,target:a,children:[{...U,text:n}]},d),!0};function Jr(e,t,n){return t&&(n==null?void 0:n.length)&&n!==l.getEditorString(e,t)}function Qr(e,t,n,r,a,u){e?ke(t,{at:e[1]}):ke(t,{split:!0}),ln(t,{url:n,buttonStyle:r,target:a}),bt(t,{url:n,target:a,text:u})}function Zr(e,t,n,r,a,u){var d,g,c;(e!==((d=n[0])==null?void 0:d.url)||r!==((g=n[0])==null?void 0:g.target)||a!==((c=n[0])==null?void 0:c.buttonStyle))&&l.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),bt(t,{url:e,text:u,target:r})}const bt=(e,{text:t})=>{const n=l.getAboveNode(e,{match:{type:l.getPluginType(e,L)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==l.getEditorString(e,a)){const u=r.children[0];l.replaceNodeChildren(e,{at:a,nodes:{...u,text:t},insertOptions:{select:!0}})}}},ln=(e,{url:t,buttonStyle:n,target:r,...a})=>{l.wrapNodes(e,{type:l.getPluginType(e,L),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},ea=e=>{const t=l.useEditorRef();return{onClick:w.useCallback(()=>{ke(t),l.focusEditor(t,t.selection??void 0)},[t]),...e}},ta=l.createComponentAs(e=>{const t=ea(e);return l.createElementAs(l.Button,t)}),na=l.createComponentAs(e=>{var n;const t=Gr(e);return((n=t.style)==null?void 0:n.display)==="none"?null:l.createElementAs("div",t)}),ra=l.createComponentAs(e=>{var n;const t=Kr(e);return((n=t.style)==null?void 0:n.display)==="none"?null:l.createElementAs("div",t)}),He={EditRoot:na,InsertRoot:ra,EditButton:Xr,UnlinkButton:ta},aa=e=>{const t=Ee().updated(),n=w.useRef(null);w.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=w.useCallback(a=>{F.url(a.target.value)},[]);return l.mergeProps({onChange:r,defaultValue:z.url()},{...e,ref:l.useComposedRef(e.ref,n)})},sa=()=>{const e=l.useEditorRef();l.useHotkeys("*",t=>{t.key==="Enter"&&yt(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},un=()=>{const e=l.useEditorRef();l.useHotkeys("escape",()=>{if(z.mode()==="edit"){if(z.isEditing()){F.show("edit",e.id),l.focusEditor(e,e.selection??void 0);return}F.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},ia=12,oa=-22,la=96,cn=e=>l.useVirtualFloating({placement:"bottom-start",middleware:[l.offset({mainAxis:ia,alignmentAxis:oa}),l.flip({padding:la})],...e}),dn=(e,{focused:t}={})=>{if(z.mode()==="edit"){qe(e);return}pt(e,{focused:t})},Ge={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},ua=e=>({...l.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),ca=e=>{const{href:t,target:n,buttonStyle:r}=ua(e),{attributes:a,children:u}=e;return s.jsx(da,{attributes:a,href:t,target:n,styles:Ge[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:u})},da=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[u,d]=w.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),href:r,target:a,style:u?{...t,...t.hover}:t,children:n})};class ga extends o.MarkupElement{constructor(t=L,n=ca){super(t,n)}}const ma=({type:e,...t})=>{const n=l.useEditorRef(),r=!!l.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&l.someNode(n,{match:{type:e}});return s.jsx(l.ToolbarButton,{tooltip:o.getTooltip(r?`Button
|
|
28
|
-
${o.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:o.getButtonClassNames(r),active:a,onMouseDown:async u=>{n&&(u.preventDefault(),u.stopPropagation(),l.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{dn(n,{focused:!0})},0))},...t})},fa=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(ma,{type:l.getPluginType(e,L),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(o.IconButton16,{})}),styles:o.buttonStyles})}),ha=()=>{const e=aa({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between",children:[s.jsx("span",{className:"tw-pointer-events-none",style:M.p,children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(He.EditButton,{children:s.jsx(o.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(He.UnlinkButton,{children:s.jsx(o.IconTrashBin16,{})})})]})]})})},pa=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:o.merge(["tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(o.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},ya=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[u,d]=w.useState(e.id===r.documentId),g=e.permanentLink===t,{documentSections:c}=fe.useDocumentSection(a,e.id),p=[...c.values()],h=p.length>0;return w.useEffect(()=>{e.id===r.pageId&&d(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("div",{tabIndex:0,"data-test-id":"internal-link-selector-page-link",className:o.merge(["tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer",h?"tw-pl-7":"tw-pl-12",g?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[h&&s.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>d(!u),onFocus:()=>d(!u),children:s.jsx("div",{className:o.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",u?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),u&&p.length>0&&p.map(f=>s.jsx(pa,{section:f,selectedUrl:t,onSelectUrl:n},f.id))]})},ba=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[u,d]=w.useState([]),[g,c]=w.useState(!0),p=[...u.values()],h=!g&&p.length>0;return w.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(f=>{d(f)}).finally(()=>{c(!1)})},[]),g?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(o.LoadingCircle,{})}):h?s.jsx(s.Fragment,{children:p.map(f=>s.jsx(ya,{page:f,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},f.id))}):s.jsx("div",{className:"tw-py-2 tw-px-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},wa=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[u,d]=w.useState(e.id===a.documentId),g=e.permanentLink===n;return w.useEffect(()=>{e.id===a.documentId&&d(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:o.merge(["tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",g?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),onFocus:()=>r(e.permanentLink),children:[s.jsx("div",{role:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>d(!u),onFocus:()=>d(!u),children:s.jsx("div",{className:o.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",u?"tw-rotate-90":""])})}),s.jsx(o.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),u&&s.jsx(ba,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},xa=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=w.useState(!0),[u,d]=w.useState([]),[g,c]=w.useState({documentId:void 0,pageId:void 0}),p=[...u.values()];w.useEffect(()=>{t&&p.length>0&&h().then(f=>{c(f)})},[p.length]),w.useEffect(()=>{e.getAllDocuments().then(f=>{d(f)}).finally(()=>{a(!1)})},[]);const h=async()=>{const f={documentId:void 0,pageId:void 0};if(p.find(T=>T.permanentLink===t))return f;for(const T of p){const B=await e.getDocumentPagesByDocumentId(T.id);e.getAllDocuments();const D=[...B.values()];if(!!D.find(I=>I.permanentLink===t))return f.documentId=T.id,f;for(const I of D)if(!![...(await e.getDocumentSectionsByDocumentPageId(I.id)).values()].find(q=>q.permanentLink===t))return f.documentId=T.id,f.pageId=I.id,f}return f};return r?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(o.LoadingCircle,{})}):s.jsx(s.Fragment,{children:p.map(f=>s.jsx(wa,{document:f,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:g},f.id))})},va=({appBridge:e,url:t,onUrlChange:n})=>{const{open:r,isOpen:a,close:u}=cr.useOverlayTriggerState({}),[d,g]=w.useState(t),c=f=>{g(f)},p=f=>{f.key==="Enter"&&h()};w.useEffect(()=>{t&&!d&&g(t)},[t,d]);const h=()=>{n(d),u()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:p,children:[s.jsx(o.Button,{icon:s.jsx(o.IconLink,{}),size:o.ButtonSize.Medium,type:o.ButtonType.Button,style:o.ButtonStyle.Default,emphasis:o.ButtonEmphasis.Default,onClick:()=>r(),children:"Internal link"}),s.jsxs(o.Modal,{zIndex:1001,onClose:()=>u(),isOpen:a,isDismissable:!0,children:[s.jsx(o.Modal.Header,{title:"Select internal link"}),s.jsx(o.Modal.Body,{children:s.jsx(xa,{appBridge:e,selectedUrl:d,onSelectUrl:c})}),s.jsx(o.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>u(),style:o.ButtonStyle.Default,emphasis:o.ButtonEmphasis.Default},{children:"Choose",onClick:f=>{f==null||f.preventDefault(),h()},style:o.ButtonStyle.Default,emphasis:o.ButtonEmphasis.Strong,disabled:!d}]})]})]})},gn=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:u,isValidUrlOrEmpty:d,hasValues:g,testId:c,appBridge:p,children:h})=>s.jsxs("div",{"data-test-id":c,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(o.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(o.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),h,s.jsxs("div",{className:"tw-pt-5",children:[s.jsx(o.FormControl,{label:{children:"URL",htmlFor:"url",required:!0},children:s.jsx(o.TextInput,{id:"url",value:e.url,placeholder:"https://example.com",focusOnMount:!0,onChange:n})}),!d(e==null?void 0:e.url)&&s.jsx("div",{className:"tw-text-red-65 tw-mt-3",children:"Please enter a valid URL."})]}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(va,{url:e.url,appBridge:p,onUrlChange:n})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(o.Checkbox,{value:"new-tab",label:"Open in new tab",state:e.newTab,onChange:r})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(o.Button,{onClick:a,size:o.ButtonSize.Medium,style:o.ButtonStyle.Default,emphasis:o.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(o.Button,{onClick:u,size:o.ButtonSize.Medium,icon:s.jsx(o.IconCheckMark20,{}),disabled:!g||!d(e==null?void 0:e.url),children:"Save"})]})})]}),Sa=e=>{var n;const t=l.getAboveNode(e,{match:{type:L}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},Ea={url:"",text:"",buttonStyle:"primary",newTab:o.CheckboxState.Unchecked},ka=()=>{const[e,t]=w.useReducer((n,r)=>{const{type:a,payload:u}=r;switch(a){case"NEW_TAB":return{...n,newTab:o.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:o.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...u};default:return n}},Ea);return[e,t]},Ca=()=>{const e=l.useEditorRef(),[t,n]=ka();w.useEffect(()=>{const f=Sa(e);n({type:"INIT",payload:{text:z.text(),buttonStyle:f,newTab:z.newTab()?o.CheckboxState.Checked:o.CheckboxState.Unchecked,url:z.url()}})},[n,e]);const r=f=>{n({type:"TEXT",payload:{text:f}})},a=f=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:f}})},u=f=>{n({type:"URL",payload:{url:f}})},d=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},g=()=>{F.hide()},c=f=>{if(!Ue(t.url)||!p)return;const x=We(t.url);F.text(t.text),F.url(x),F.buttonStyle(t.buttonStyle),F.newTab(t.newTab===o.CheckboxState.Checked),yt(e)&&(f==null||f.preventDefault())},p=t.url!==""&&t.text!=="",{appBridge:h}=l.getPluginOptions(e,L);return l.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:u,onToggleTab:d,onCancel:g,onSave:c,hasValues:p,isValidUrlOrEmpty:Ue,appBridge:h}},Ta=()=>{const e=Ca(),{state:t,onButtonStyleChange:n}=e;return s.jsx(gn,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(o.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(nt,{id:"primary",styles:M.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(nt,{id:"secondary",styles:M.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(nt,{id:"tertiary",styles:M.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},nt=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[u,d]=w.useState(!1),g=()=>t&&t.hover&&u?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:r,style:g(),className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},Pa=()=>{const e=Ee().isEditing(),t=s.jsx(Ta,{}),n=e?t:s.jsx(ha,{});return s.jsxs(s.Fragment,{children:[s.jsx(He.InsertRoot,{children:t}),s.jsx(He.EditRoot,{children:n})]})},mn=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const u=a.newProperties;if(!(u!=null&&u.focus)||!u.anchor||!l.isCollapsed(u)){n(a);return}const d=l.getAboveNode(e,{at:u,match:{type:l.getPluginType(e,L)}});if(d){const[,g]=d;let c;l.isStartPoint(e,u.focus,g)&&(c=l.getPreviousNodeEndPoint(e,g)),l.isEndPoint(e,u.focus,g)&&(c=l.getNextNodeStartPoint(e,g)),c&&(a.newProperties={anchor:c,focus:c})}n(a)},e.normalizeNode=([a,u])=>{if(a.type===l.getPluginType(e,L)){const d=e.selection;if(d&&l.isCollapsed(d)&&l.isEndPoint(e,d.focus,u)){const g=l.getNextNodeStartPoint(e,u);if(g)l.select(e,g);else{const c=dr.Path.next(u);l.insertNodes(e,{text:""},{at:c}),l.select(e,c)}}}r([a,u])},l.withRemoveEmptyNodes(e,l.mockPlugin({options:{types:t}}))},L="button",wt="button-plugin",fn=e=>l.createPluginFactory({key:L,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:mn,renderAfterEditable:Pa,options:{isUrl:ft,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class hn extends o.Plugin{constructor({styles:t=Ge,...n}){super(wt,{button:fa,markupElement:new ga,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[fn(this.appBridge)]}}var v=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(v||{});const M={heading1:{display:"inline-block",fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[Se]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...Ge},Ia=()=>{const e=l.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between",children:[s.jsx("span",{className:"tw-pointer-events-none",style:M.p,children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx($e.EditButton,{children:s.jsx(o.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx($e.UnlinkButton,{children:s.jsx(o.IconTrashBin16,{})})})]})]})})},Ra=({floatingOptions:e,...t})=>{const n=l.useEditorRef(),r=l.usePlateSelectors().keyEditor(),a=l.useFloatingLinkSelectors().mode(),u=l.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:d="command+k, ctrl+k"}=l.getPluginOptions(n,l.ELEMENT_LINK),g=w.useCallback(()=>{const x=l.getAboveNode(n,{match:{type:l.getPluginType(n,l.ELEMENT_LINK)}});if(x){const[,T]=x;return l.getRangeBoundingClientRect(n,{anchor:l.getStartPoint(n,T),focus:l.getEndPoint(n,T)})}return l.getDefaultBoundingClientRect()},[n]),c=u&&a==="edit",{update:p,style:h,floating:f}=l.useVirtualFloatingLink({editorId:n.id,open:c,getBoundingClientRect:g,...e});return w.useEffect(()=>{const x=Wr(n);if(x&&l.floatingLinkActions.url(x),n.selection&&l.someNode(n,{match:{type:l.getPluginType(n,l.ELEMENT_LINK)}})){l.floatingLinkActions.show("edit",n.id),p();return}l.floatingLinkSelectors.mode()==="edit"&&l.floatingLinkActions.hide()},[n,r,p]),l.useHotkeys(d,x=>{x.preventDefault(),l.floatingLinkSelectors.mode()==="edit"&&l.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),l.useFloatingLinkEnter(),l.useFloatingLinkEscape(),{style:{...h,zIndex:1e3},...t,ref:l.useComposedRef(t.ref,f)}},ja={url:"",text:"",newTab:o.CheckboxState.Unchecked},La=()=>{const[e,t]=w.useReducer((n,r)=>{const{type:a,payload:u}=r;switch(a){case"NEW_TAB":return{...n,newTab:o.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:o.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...u};default:return n}},ja);return[e,t]},Na=()=>{const e=l.useEditorRef(),[t,n]=La();w.useEffect(()=>{const h=Hr(e),f=Vr(e);n({type:"INIT",payload:{text:l.floatingLinkSelectors.text(),newTab:l.floatingLinkSelectors.newTab()?o.CheckboxState.Checked:o.CheckboxState.Unchecked,url:h&&f===""?h:l.floatingLinkSelectors.url()}})},[n,e]);const r=h=>{n({type:"TEXT",payload:{text:h}})},a=h=>{n({type:"URL",payload:{url:h}})},u=h=>{n(h?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{l.floatingLinkActions.hide()},g=h=>{if(!Ue(t.url)||!c)return;const f=We(t.url);l.floatingLinkActions.text(t.text),l.floatingLinkActions.url(f),l.floatingLinkActions.newTab(t.newTab===o.CheckboxState.Checked),l.submitFloatingLink(e)&&(h==null||h.preventDefault())},c=t.url!==""&&t.text!=="",{appBridge:p}=l.getPluginOptions(e,l.ELEMENT_LINK);return l.useHotkeys("enter",g,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:u,onCancel:d,onSave:g,hasValues:c,isValidUrlOrEmpty:Ue,appBridge:p}},Ba=()=>s.jsx(gn,{...Na(),testId:"floating-link-insert"}),Aa=({readOnly:e})=>{const t=l.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(Ba,{}),r=t?n:s.jsx(Ia,{});return s.jsxs(s.Fragment,{children:[s.jsx($e.InsertRoot,{children:n}),s.jsx($e.EditRoot,{children:r})]})},_a=({id:e,editorId:t})=>{const n=l.usePlateEditorState(l.useEventPlateId(t)),r=!!l.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(l.LinkToolbarButton,{tooltip:o.getTooltip(r?`Link
|
|
29
|
-
${o.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(o.IconLink,{size:o.IconSize.Size16})}),classNames:o.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},Oa=e=>({...l.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_blank"}}}),onMouseOver:n=>{n.stopPropagation()}}),Fa=e=>{const t=Oa(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:M[Se],children:r})};class Ma extends o.MarkupElement{constructor(t=l.ELEMENT_LINK,n=Fa){super(t,n)}}const pn=e=>l.createPluginFactory({...l.createLinkPlugin(),renderAfterEditable:Aa,options:{isUrl:ft,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class yn extends o.Plugin{constructor(t,n=M[Se]){super(Se,{button:_a,markupElement:new Ma,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[pn(this.appBridge)]}}const Da="textstyle-custom1-plugin";class bn extends o.Plugin{constructor({styles:t=M.custom1,...n}={}){super(v.custom1,{label:"Custom 1",markupElement:new $a,...n}),this.styles={},this.styles=t}plugins(){return[Ua(this.styles)]}}class $a extends o.MarkupElement{constructor(t=Da,n=wn){super(t,n)}}const wn=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-custom1"]),children:s.jsx("span",{style:r,children:n})})},Ua=e=>l.createPluginFactory({key:v.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom1}]}})({component:t=>s.jsx(wn,{...t,styles:e})}),Ha="textstyle-custom2-plugin";class xn extends o.Plugin{constructor({styles:t=M.custom2,...n}={}){super(v.custom2,{label:"Custom 2",markupElement:new Va,...n}),this.styles={},this.styles=t}plugins(){return[za(this.styles)]}}class Va extends o.MarkupElement{constructor(t=Ha,n=vn){super(t,n)}}const vn=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-custom2"]),children:s.jsx("span",{style:r,children:n})})},za=e=>l.createPluginFactory({key:v.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom2}]}})({component:t=>s.jsx(vn,{...t,styles:e})}),Wa="textstyle-custom3-plugin";class Sn extends o.Plugin{constructor({styles:t=M.custom3,...n}={}){super(o.TextStyles.custom3,{label:"Custom 3",markupElement:new qa,...n}),this.styles={},this.styles=t}plugins(){return[Ga(this.styles)]}}class qa extends o.MarkupElement{constructor(t=Wa,n=En){super(t,n)}}const En=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-custom3"]),children:s.jsx("span",{style:r,children:n})})},Ga=e=>l.createPluginFactory({key:o.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:o.TextStyles.custom3}]}})({component:t=>s.jsx(En,{...t,styles:e})}),Ka="textstyle-heading1-plugin";class kn extends o.Plugin{constructor({styles:t=M.heading1,...n}={}){super(v.heading1,{label:"Heading 1",markupElement:new Ya,...n}),this.styles={},this.styles=t}plugins(){return[Xa(this.styles)]}}class Ya extends o.MarkupElement{constructor(t=Ka,n=st){super(t,n)}}const st=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-h1"]),children:s.jsx("span",{style:r,children:n})})},Xa=e=>l.createPluginFactory({key:v.heading1,isElement:!0,component:st,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(st,{...t,styles:e})}),Ja="textstyle-heading2-plugin";class Cn extends o.Plugin{constructor({styles:t=M.heading2,...n}={}){super(v.heading2,{label:"Heading 2",markupElement:new Qa,...n}),this.styles={},this.styles=t}plugins(){return[Za(this.styles)]}}class Qa extends o.MarkupElement{constructor(t=Ja,n=it){super(t,n)}}const it=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e)]),children:s.jsx("span",{style:r,children:n})})},Za=e=>l.createPluginFactory({key:v.heading2,isElement:!0,component:it,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(it,{...t,styles:e})}),es="textstyle-heading3-plugin";class Tn extends o.Plugin{constructor({styles:t=M.heading3,...n}={}){super(v.heading3,{label:"Heading 3",markupElement:new ts,...n}),this.styles={},this.styles=t}plugins(){return[ns(this.styles)]}}class ts extends o.MarkupElement{constructor(t=es,n=ot){super(t,n)}}const ot=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e)]),children:s.jsx("span",{style:r,children:n})})},ns=e=>l.createPluginFactory({key:v.heading3,isElement:!0,component:ot,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ot,{...t,styles:e})}),rs="textstyle-heading4-plugin";class Pn extends o.Plugin{constructor({styles:t=M.heading4,...n}={}){super(v.heading4,{label:"Heading 4",markupElement:new as,...n}),this.styles={},this.styles=t}plugins(){return[ss(this.styles)]}}class as extends o.MarkupElement{constructor(t=rs,n=lt){super(t,n)}}const lt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e)]),children:s.jsx("span",{style:r,children:n})})},ss=e=>l.createPluginFactory({key:v.heading4,isElement:!0,component:lt,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(lt,{...t,styles:e})}),is="textstyle-imageCaption-plugin";class In extends o.Plugin{constructor({styles:t=M.imageCaption,...n}={}){super(v.imageCaption,{label:"Image Caption",markupElement:new os,...n}),this.styles={},this.styles=t}plugins(){return[ls(this.styles)]}}class os extends o.MarkupElement{constructor(t=is,n=ut){super(t,n)}}const ut=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-image-caption"]),children:s.jsx("span",{style:r,children:n})})},ls=e=>l.createPluginFactory({key:v.imageCaption,isElement:!0,component:ut,deserializeHtml:{rules:[{validClassName:v.imageCaption}]}})({component:t=>s.jsx(ut,{...t,styles:e})}),us="textstyle-imageTitle-plugin";class Rn extends o.Plugin{constructor({styles:t=M.imageTitle,...n}={}){super(v.imageTitle,{label:"Image Title",markupElement:new cs,...n}),this.styles={},this.styles=t}plugins(){return[ds(this.styles)]}}class cs extends o.MarkupElement{constructor(t=us,n=ct){super(t,n)}}const ct=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-image-title"]),children:s.jsx("span",{style:r,children:n})})},ds=e=>l.createPluginFactory({key:v.imageTitle,isElement:!0,component:ct,deserializeHtml:{rules:[{validClassName:v.imageTitle}]}})({component:t=>s.jsx(ct,{...t,styles:e})});class jn extends o.Plugin{constructor({styles:t=M.p,...n}={}){super(v.p,{markupElement:new Nn,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Bn(this.styles)]}}const Ln="tw-m-0 tw-px-0 tw-py-0",Ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,u=o.merge([a&&o.alignmentClassnames[a],Ln,o.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:u,style:r,children:n})};class Nn extends o.MarkupElement{constructor(t=v.p,n=Ve){super(t,n)}}const Bn=e=>l.createPluginFactory({...l.createParagraphPlugin(),key:v.p,isElement:!0,component:Ve})({component:t=>s.jsx(Ve,{...t,styles:e})}),gs="textstyle-quote-plugin";class An extends o.Plugin{constructor({styles:t=M.quote,...n}={}){super(v.quote,{label:"Quote",markupElement:new ms,...n}),this.styles={},this.styles=t}plugins(){return[_n(this.styles)]}}class ms extends o.MarkupElement{constructor(t=gs,n=ze){super(t,n)}}const ze=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:o.merge([a&&o.alignmentClassnames[a],o.getColumnBreakClasses(e),"a-quote"]),children:s.jsx("span",{style:r,children:n})})},_n=e=>l.createPluginFactory({key:v.quote,isElement:!0,component:ze,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(ze,{...t,styles:e})}),xt=[new kn,new Cn,new Tn,new Pn,new bn,new xn,new Sn,new An,new jn],ve=[v.heading1,v.heading2,v.heading3,v.heading4,v.custom1,v.custom2,v.custom3,v.quote,v.p],fs=[...xt,new In,new Rn],hs=[...ve,v.imageCaption,v.imageTitle],ps=e=>{let t=rt(e.text);t=t.replaceAll(`
|
|
30
|
-
`,"<br />");const{bold:n,italic:r,underline:a,strikethrough:u,code:d,subscript:g,superscript:c}=e;return n&&(t=`<span class="${o.BOLD_CLASSES}">${t}</span>`),r&&(t=`<span class="${o.ITALIC_CLASSES}">${t}</span>`),a&&(t=`<span class="${o.UNDERLINE_CLASSES}">${t}</span>`),u&&(t=`<span class="${o.STRIKETHROUGH_CLASSES}">${t}</span>`),d&&(t=`<span class="${o.CODE_CLASSES}">${t}</span>`),g?t=`<sub>${t}</sub>`:c&&(t=`<sup>${t}</sup>`),t},ae=e=>e?Object.keys(e).reduce((t,n)=>{const r=e[n];return r?`${t}${ys(n)}: ${r}; `:t},"").trim().replaceAll('"',"'"):"",ys=e=>e.replaceAll(/([A-Z])/g,"-$1").toLowerCase(),bs=(e,t,n,r)=>{const a=r[wt],u=e.buttonStyle??"primary",d=`button${u.charAt(0).toUpperCase()}${u.slice(1)}`,g=a[d],c=ae(g);return`<a href="${e.url}"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),a=require("react/jsx-runtime"),i=require("@frontify/fondue"),p=require("react"),X=require("@frontify/app-bridge"),C=require("@dnd-kit/core"),ue=require("@dnd-kit/sortable"),We=require("@react-aria/focus"),Ht=require("@dnd-kit/modifiers"),o=require("@udecode/plate"),be=require("escape-html"),Ke=require("slate-react"),Ut=require("@react-stately/overlays"),Vt=require("slate"),zt=require("react-dom"),$=require("@ctrl/tinycolor");const _=e=>e.filter(Boolean).join(" "),qt=({onDrop:e,label:t,icon:n,secondaryLabel:s,isLoading:r,fillParentContainer:l,onAssetChooseClick:c,onUploadClick:d,withMenu:u=!0,onClick:m,validFileType:f,verticalLayout:g})=>{const[w,v]=p.useState(!1),[E,T]=p.useState(),j=p.useRef(null),[S,B]=p.useState(void 0),O=k=>{if(k.preventDefault(),v(!1),!Y(k.dataTransfer.files)){B("Invalid"),setTimeout(()=>{B(void 0)},1e3);return}e==null||e(k.dataTransfer.files)},Y=k=>{if(!f)return!0;for(let N=0;N<k.length;N++){const A=k[N].name.split(".").pop()??"";if(!X.FileExtensionSets[f].includes(A))return!1}return!0},F=k=>{if(!j.current||r)return;const{left:N,top:A}=j.current.getBoundingClientRect(),J=k.clientX-N,ie=k.clientY-A;T([J,ie])};return a.jsxs("button",{ref:j,"data-test-id":"block-inject-button",className:_(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",g?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",l?"tw-h-full":"tw-h-[72px]",w&&!r?"tw-border-dashed":"tw-border-solid",E&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",S?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",r||E||w||S?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(w||E)&&!S?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?k=>{var N;if(v(!0),f==="Images")for(const A of Array.from(k.dataTransfer.items))(N=A==null?void 0:A.type)!=null&&N.startsWith("image/")?B(void 0):B("Invalid")}:void 0,onDragLeave:e?()=>{v(!1),B(void 0)}:void 0,onDrop:e?O:void 0,onClick:k=>{u&&F(k),m==null||m()},children:[r?a.jsx(i.LoadingCircle,{}):S?a.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[a.jsx(i.IconExclamationMarkTriangle,{}),S]}):a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{children:n}),(t||s)&&a.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&a.jsx("div",{className:"tw-font-medium",children:t}),s&&a.jsx("div",{className:"tw-font-normal",children:s})]})]}),E&&a.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:E[0],top:E[1]},children:a.jsx(i.Flyout,{onOpenChange:k=>!k&&T(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:a.jsx("div",{}),children:a.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),T(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(i.IconArrowCircleUp20,{})})}]:[],...c?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{c(),T(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},Q=e=>{const t=s=>typeof s=="object"&&["red","green","blue"].every(l=>s.hasOwnProperty(l)),n=s=>{const r=typeof s.alpha=="number"?s.alpha:1;return{r:s.red,g:s.green,b:s.blue,a:r}};return t(e)?n(e):e},Wt=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Kt=(e,t)=>{const n=Wt(e)?Q(e):e,s=$(n);return t?s.getBrightness()<t:s.isDark()||s.getAlpha()>.25&&s.getAlpha()<1},Gt=e=>$(Q(e)).toHex8String(),Xt=e=>$(Q(e)).toHexString(),Ie=e=>$(Q(e)).toRgbString(),Qt=(e,t)=>$(t).setAlpha(e).toRgbString(),Yt=e=>{const{r:t,g:n,b:s,a:r}=$(e);return{red:t,green:n,blue:s,alpha:r}},ze=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Jt=(e,t)=>{const n=ze(e)?Q(e):e,s=ze(t)?Q(t):t;let r=$(n);const l=$(s);for(;$.readability(r,l)<4.5;)r=r.darken(1);return r.toRgbString()},Zt=(e,t,n)=>{const s=[...e],r=n<0?s.length+n:n;if(r>=0&&r<s.length){const l=s.splice(t,1)[0];s.splice(r,0,l)}return s},en=e=>({backgroundColor:Ie(e)});var D=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(D||{});const Ge={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var U=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(U||{});const K={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const ee={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var q=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(q||{});const te={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var G=(e=>(e.Global="Global",e.Custom="Custom",e))(G||{}),W=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))(W||{});const Xe={Auto:"4px",S:"10px",M:"30px",L:"50px"},tn={red:241,green:241,blue:241,alpha:1},Qe={red:234,green:235,blue:235,alpha:1},nn="1px",oe="24px",le="24px",sn=(e=D.Solid,t="1px",n=Qe)=>({borderStyle:Ge[e],borderWidth:t,borderColor:Ie(n)}),rn=(e,t=!1,n)=>({borderRadius:t?n:K[e]}),Ye="Drag or press ↵ to move",Je="Move with ↑↓←→ and confirm with ↵",an=({items:e,flyoutItems:t,isFlyoutOpen:n,setIsFlyoutOpen:s,isDragging:r,isFlyoutDisabled:l})=>a.jsx("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-flex tw-justify-end",children:a.jsxs("div",{className:"tw-bg-white tw-text-box-selected-inverse tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-[2px] tw-px-[1px] tw-spacing tw-items-center tw-h-7 tw-self-start tw-border tw-border-box-selected-inverse tw-rounded",children:[e.map((c,d)=>"draggableProps"in c?a.jsx(i.Tooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:r,position:i.TooltipPosition.Top,content:a.jsx("div",{children:r?Je:c.tooltip??Ye}),triggerElement:a.jsx("button",{ref:c.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...c.draggableProps,className:_(["tw-bg-base tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",r?"tw-cursor-grabbing tw-bg-box-selected-pressed":"tw-cursor-grab hover:tw-bg-box-selected-hover"]),children:c.icon})},d):a.jsx(i.Tooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:r,position:i.TooltipPosition.Top,content:a.jsx("div",{children:c.tooltip??""}),triggerElement:a.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:c.onClick,className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:c.icon})},d)),t.length>0&&a.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6",children:a.jsx(i.Flyout,{isOpen:n&&!r,isTriggerDisabled:l,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:s,trigger:a.jsx(i.Tooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:r,position:i.TooltipPosition.Top,content:a.jsx("div",{children:"Options"}),triggerElement:a.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:a.jsx(i.IconDotsHorizontal16,{})})}),children:a.jsx(i.ActionMenu,{menuBlocks:t.map((c,d)=>({id:d.toString(),menuItems:c.map((u,m)=>({id:d.toString()+m.toString(),size:i.MenuItemContentSize.XSmall,title:u.title,style:u.style,onClick:()=>{s(!1),u.onClick()},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:u.icon})}))}))})})})]})}),on=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:s,shouldHideComponent:r=!1,isDragging:l,shouldFillContainer:c,outlineOffset:d=2,shouldBeShown:u=!1})=>{const[m,f]=p.useState(u),[g,w]=p.useState(!1),v=p.useRef(null);if(p.useEffect(()=>{m||w(!0)},[m]),s)return e;const E=n==null?void 0:n.filter(T=>T!==void 0);return a.jsxs("div",{ref:v,onFocus:()=>w(!1),onPointerEnter:()=>w(!1),"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:_(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",c&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",(m||u)&&"tw-outline",r&&"tw-opacity-0"]),children:[a.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:_(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-10","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",(m||u)&&"tw-opacity-100"]),children:a.jsx(an,{isFlyoutOpen:m,isFlyoutDisabled:g,setIsFlyoutOpen:f,flyoutItems:t,items:E,isDragging:l})}),e]})},ln=e=>e==="IMAGE"?a.jsx(i.IconImage24,{}):e==="VIDEO"?a.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?a.jsx(i.IconMusicNote24,{}):a.jsx(i.IconDocument24,{}),Te=p.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:s,isDragging:r,isOverlay:l,isLoading:c,onDelete:d,onReplaceWithBrowse:u,onReplaceWithUpload:m},f)=>{const[g,w]=p.useState(),[v,{selectedFiles:E}]=X.useFileInput({multiple:!0,accept:"image/*"}),[T,{results:j,doneAll:S}]=X.useAssetUpload(),{focusProps:B,isFocusVisible:O}=We.useFocusRing();p.useEffect(()=>{E&&T(E[0])},[E]),p.useEffect(()=>{S&&m(j[0])},[S,j]);const Y=(k,N)=>{fetch(k).then(A=>{A.blob().then(J=>{const ie=URL.createObjectURL(J),Z=document.createElement("a");Z.href=ie,Z.download=N,Z.click()})})},F=c||E&&!S;return a.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>Y(e.genericUrl,e.fileName),ref:f,style:{...s,opacity:r&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:_(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",r?"tw-bg-box-neutral-hover":""]),children:[a.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:F?a.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):ln(e.objectType)}),a.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[a.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),a.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&a.jsxs("div",{"data-test-id":"attachments-actionbar",className:_(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",l||(g==null?void 0:g.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[a.jsx("button",{...B,...n,"aria-label":"Drag attachment",className:_([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",r||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",O&&i.FOCUS_STYLE,O&&"tw-z-[2]"]),children:a.jsx(i.IconGrabHandle20,{})}),a.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:a.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(g==null?void 0:g.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:k=>w(k?e:void 0),trigger:(k,N)=>a.jsx(i.Button,{ref:N,icon:a.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>w(e)}),children:a.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{v(),w(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{u(),w(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),w(void 0)},initialValue:!0,decorator:a.jsx("div",{className:"tw-mr-2",children:a.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Te.displayName="AttachmentItem";const un=e=>{const{attributes:t,listeners:n,setNodeRef:s,transform:r,transition:l,isDragging:c}=ue.useSortable({id:e.item.id}),d={transform:r?`translate(${r.x}px, ${r.y}px)`:"",transition:l,zIndex:c?2:1},u={...t,...n};return a.jsx(Te,{ref:s,isDragging:c,transformStyle:d,draggableProps:u,...e})},cn=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:s,onBrowse:r,onUpload:l,onSorted:c,appBridge:d})=>{const[u,m]=p.useState(e),[f,g]=p.useState(!1),w=C.useSensors(C.useSensor(C.PointerSensor),C.useSensor(C.KeyboardSensor)),[v,E]=p.useState(void 0),[T,j]=p.useState(!1),[S,B]=p.useState([]),[O,Y]=p.useState(null),F=X.useEditorState(d),k=u==null?void 0:u.find(x=>x.id===v),[N,{results:A,doneAll:J}]=X.useAssetUpload({onUploadProgress:()=>!T&&j(!0)});p.useEffect(()=>{m(e)},[e]),p.useEffect(()=>{O&&(j(!0),N(O))},[O]),p.useEffect(()=>{(async()=>{J&&(await l(A),j(!1))})()},[J,A]);const ie=()=>{g(!1),d.openAssetChooser(x=>{r(x),d.closeAssetChooser(),g(!0)},{multiSelection:!0,selectedValueIds:u.map(x=>x.id)})},Z=x=>{g(!1),d.openAssetChooser(async R=>{g(!0),d.closeAssetChooser(),B([...S,x.id]),await n(x,R[0]),B(S.filter(V=>V!==x.id))},{multiSelection:!1,selectedValueIds:u.map(R=>R.id)})},Ue=async(x,R)=>{B([...S,x.id]),await s(x,R),B(S.filter(V=>V!==x.id))},Dt=x=>{const{active:R}=x;E(R.id)},Ot=x=>{const{active:R,over:V}=x;if(V&&R.id!==V.id&&u){const $t=u.findIndex(ye=>ye.id===R.id),_t=u.findIndex(ye=>ye.id===V.id),Ve=ue.arrayMove(u,$t,_t);m(Ve),c(Ve)}E(void 0)};return F||((u==null?void 0:u.length)??0)>0?a.jsx(i.Tooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:f,enterDelay:500,triggerElement:a.jsx("div",{"data-test-id":"attachments-flyout-button",children:a.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:x=>g(k?!0:x),isOpen:f,hug:!1,fitContent:!0,legacyFooter:!1,trigger:a.jsxs("div",{className:"tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line",children:[a.jsx(i.IconPaperclip16,{}),a.jsx("div",{children:e.length>0?e.length:"Add"}),a.jsx(i.IconCaretDown12,{})]}),children:a.jsxs("div",{className:"tw-w-[300px]",children:[u.length>0&&a.jsxs(C.DndContext,{sensors:w,collisionDetection:C.closestCenter,onDragStart:Dt,onDragEnd:Ot,modifiers:[Ht.restrictToWindowEdges],children:[a.jsx(ue.SortableContext,{items:u,strategy:ue.rectSortingStrategy,children:a.jsx("div",{className:"tw-border-b tw-border-b-line",children:u.map(x=>a.jsx(un,{isEditing:F,isLoading:S.includes(x.id),item:x,onDelete:()=>t(x),onReplaceWithBrowse:()=>Z(x),onReplaceWithUpload:R=>Ue(x,R)},x.id))})}),a.jsx(C.DragOverlay,{children:k&&a.jsx(Te,{isOverlay:!0,isEditing:F,item:k,isDragging:!0,onDelete:()=>t(k),onReplaceWithBrowse:()=>Z(k),onReplaceWithUpload:x=>Ue(k,x)},v)})]}),F&&a.jsxs("div",{className:"tw-px-5 tw-py-3",children:[a.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),a.jsx(i.AssetInput,{isLoading:T,size:i.AssetInputSize.Small,onUploadClick:x=>Y(x),onLibraryClick:ie})]})]})})})}):null},dn=({onDownload:e})=>{const{isFocused:t,focusProps:n}=We.useFocusRing();return a.jsx(i.Tooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:a.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:_(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,onPointerDown:s=>s.preventDefault(),children:a.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:a.jsx(i.IconArrowCircleDown16,{})})})})},gn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),s=Ke.useFocused(),r=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:c}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(c,f=>{o.triggerFloatingLinkInsert(n,{focused:s})&&f.preventDefault()},{enableOnContentEditable:!0},[s]);const{update:d,style:u,floating:m}=o.useVirtualFloatingLink({editorId:n.id,open:l&&r==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return p.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...u,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},mn=o.createComponentAs(e=>{var n;const t=gn({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),hn=o.createComponentAs(e=>{var n;const t=is({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=hn;o.FloatingLink.InsertRoot=mn;const ce=o.FloatingLink,se="link-plugin",Ze=e=>{if(!e)return!1;const t=n=>n.some(s=>s.text?s.text!=="":s.children?t(s.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},fn=(e="p",t="",n)=>Ze(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),pn=[C.KeyboardCode.Down,C.KeyboardCode.Right,C.KeyboardCode.Up,C.KeyboardCode.Left],et=(e,t)=>(n,{currentCoordinates:s,context:{activeNode:r}})=>{if(n.preventDefault(),pn.includes(n.code)){const l=(r==null?void 0:r.offsetWidth)??0,c=(r==null?void 0:r.offsetHeight)??0;switch(n.code){case C.KeyboardCode.Right:return{...s,x:s.x+l+e};case C.KeyboardCode.Left:return{...s,x:s.x-l-e};case C.KeyboardCode.Down:return{...s,y:s.y+c+t};case C.KeyboardCode.Up:return{...s,y:s.y-c-t}}}},wn=(e,t,n)=>e===G.Custom?t:n,yn=e=>e.map(tt),tt=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Le=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},xn=e=>Le(e,t=>{var n,s;return((s=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:s.link)||""}),bn=e=>Le(e,t=>t.url||""),vn=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},kn=e=>Le(e,vn),nt=/^\/(document|r)\/\S+$/i,fe=e=>{if(nt.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},Ne=e=>{if(nt.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},de=e=>Ne(fe(e))||e==="",Sn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:b}});return Array.isArray(n)?t(n[0]):""},st=e=>Sn(e,t=>t.url??""),rt=(e,{url:t,text:n="",buttonStyle:s="primary",target:r,children:l})=>({type:o.getPluginType(e,b),url:t,target:r,buttonStyle:s,children:l??[{text:n}]}),je=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),P=je.set,L=je.get,re=()=>je.use,pe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,b)}});if(!t)return;const[n,s]=t;let r=o.getEditorString(e,s);P.url(n.url),P.newTab(n.target===void 0),r===n.url&&(r=""),P.text(r),P.isEditing(!0)},Cn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),s=o.usePlateSelectors(n.id).keyEditor(),r=re().mode(),l=re().isOpen(n.id),{triggerFloatingButtonHotkeys:c}=o.getPluginOptions(n,b),d=p.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,b)}});if(w){const[,v]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,v),focus:o.getEndPoint(n,v)})}return o.getDefaultBoundingClientRect()},[n]),u=l&&r==="edit",{update:m,style:f,floating:g}=ut({open:u,getBoundingClientRect:d,...e});return p.useEffect(()=>{const w=st(n);if(w&&P.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,b)}})){P.show("edit",n.id),m();return}L.mode()==="edit"&&P.hide()},[n,s,m]),o.useHotkeys(c,w=>{w.preventDefault(),L.mode()==="edit"&&pe(n)},{enableOnContentEditable:!0},[]),Fn(),lt(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Be=(e,{focused:t}={})=>{L.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,b)}})||(P.text(o.getEditorString(e,e.selection)),P.show("insert",e.id))},En=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),s=Ke.useFocused(),r=re().mode(),l=re().isOpen(n.id),{triggerFloatingButtonHotkeys:c}=o.getPluginOptions(n,b);o.useHotkeys(c,f=>{f.preventDefault(),Be(n,{focused:s})},{enableOnContentEditable:!0},[s]);const{update:d,style:u,floating:m}=ut({open:l&&r==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return p.useEffect(()=>{l&&d(),P.updated(l)},[l,d]),lt(),{style:{...u,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Pn=e=>{const t=o.useEditorRef();return{onClick:p.useCallback(()=>{pe(t)},[t]),...e}},In=o.createComponentAs(e=>{const t=Pn(e);return o.createElementAs("button",t)}),at=(e,t,n)=>{o.insertNodes(e,[rt(e,t)],n)},Ae=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,b),s=L.url();if(!((t==null?void 0:t(s))||n))return;const l=L.text(),c=L.buttonStyle(),d=L.newTab()?void 0:"_self";return P.hide(),it(e,{url:s,text:l,buttonStyle:c,target:d,isUrl:u=>n||!t?!0:t(u)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},ae=(e,t)=>o.withoutNormalizing(e,()=>{var n,s,r,l,c,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,b)}}))return o.splitNodes(e,{at:(s=e.selection)==null?void 0:s.anchor,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,b)}),ae(e,{at:(r=e.selection)==null?void 0:r.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,b)}}))return o.splitNodes(e,{at:(c=e.selection)==null?void 0:c.focus,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,b)}),ae(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,b)},...t})}),it=(e,{url:t,text:n,buttonStyle:s,target:r,insertTextInButton:l,insertNodesOptions:c,isUrl:d=o.getPluginOptions(e,b).isUrl})=>{var S;const u=e.selection;if(!u)return;const m=o.getAboveNode(e,{at:u,match:{type:o.getPluginType(e,b)}});if(l&&m)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),m)return Nn(t,e,m,r,s,n),!0;const f=o.findNode(e,{at:u,match:{type:o.getPluginType(e,b)}}),[g,w]=f??[],v=Tn(e,w,n);if(o.isExpanded(u))return Ln(m,e,t,s,r,n),!0;v&&o.removeNodes(e,{at:w});const E=o.getNodeProps(g??{}),T=(S=e.selection)==null?void 0:S.focus.path;if(!T)return;const j=o.getNodeLeaf(e,T);return n!=null&&n.length||(n=t),at(e,{...E,url:t,target:r,children:[{...j,text:n}]},c),!0};function Tn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function Ln(e,t,n,s,r,l){e?ae(t,{at:e[1]}):ae(t,{split:!0}),ot(t,{url:n,buttonStyle:s,target:r}),Re(t,{url:n,target:r,text:l})}function Nn(e,t,n,s,r,l){var c,d,u;(e!==((c=n[0])==null?void 0:c.url)||s!==((d=n[0])==null?void 0:d.target)||r!==((u=n[0])==null?void 0:u.buttonStyle))&&o.setNodes(t,{url:e,target:s,buttonStyle:r},{at:n[1]}),Re(t,{url:e,text:l,target:s})}const Re=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,b)}});if(n){const[s,r]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,r)){const l=s.children[0];o.replaceNodeChildren(e,{at:r,nodes:{...l,text:t},insertOptions:{select:!0}})}}},ot=(e,{url:t,buttonStyle:n,target:s,...r})=>{o.wrapNodes(e,{type:o.getPluginType(e,b),url:t,buttonStyle:n,target:s,children:[]},{split:!0,...r})},jn=e=>{const t=o.useEditorRef();return{onClick:p.useCallback(()=>{ae(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},Bn=o.createComponentAs(e=>{const t=jn(e);return o.createElementAs(o.Button,t)}),An=o.createComponentAs(e=>{var n;const t=Cn(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),Rn=o.createComponentAs(e=>{var n;const t=En(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ge={EditRoot:An,InsertRoot:Rn,EditButton:In,UnlinkButton:Bn},Mn=e=>{const t=re().updated(),n=p.useRef(null);p.useEffect(()=>{n.current&&t&&setTimeout(()=>{var r;(r=n.current)==null||r.focus()},0)},[t]);const s=p.useCallback(r=>{P.url(r.target.value)},[]);return o.mergeProps({onChange:s,defaultValue:L.url()},{...e,ref:o.useComposedRef(e.ref,n)})},Fn=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&Ae(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},lt=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(L.mode()==="edit"){if(L.isEditing()){P.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}P.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Dn=12,On=-22,$n=96,ut=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:Dn,alignmentAxis:On}),o.flip({padding:$n})],...e}),ct=(e,{focused:t}={})=>{if(L.mode()==="edit"){pe(e);return}Be(e,{focused:t})},we={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},_n=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),Hn=e=>{const{href:t,target:n,buttonStyle:s}=_n(e),{attributes:r,children:l}=e;return a.jsx(Un,{attributes:r,href:t,target:n,styles:we[`button${s.charAt(0).toUpperCase()+s.slice(1)}`],children:l})},Un=({attributes:e,styles:t={hover:{}},children:n,href:s="#",target:r})=>{const[l,c]=p.useState(!1);return a.jsx("a",{...e,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),href:s,target:r,style:l?{...t,...t.hover}:t,children:n})};class Vn extends i.MarkupElement{constructor(t=b,n=Hn){super(t,n)}}const zn=({type:e,...t})=>{const n=o.useEditorRef(),s=!!o.isRangeInSameBlock(n,{at:n.selection}),r=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return a.jsx(o.ToolbarButton,{tooltip:i.getTooltip(s?`Button
|
|
2
|
+
${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(s),active:r,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{ct(n,{focused:!0})},0))},...t})},qn=({editor:e,id:t})=>a.jsx("div",{"data-plugin-id":t,children:a.jsx(zn,{type:o.getPluginType(e,b),icon:a.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:a.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),Wn=()=>{const e=Mn({});return a.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:a.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between",children:[a.jsx("span",{className:"tw-pointer-events-none",style:I.p,children:e.defaultValue}),a.jsxs("span",{className:"tw-flex tw-gap-2",children:[a.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:a.jsx(ge.EditButton,{children:a.jsx(i.IconPen16,{})})}),a.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:a.jsx(ge.UnlinkButton,{children:a.jsx(i.IconTrashBin16,{})})})]})]})})},Kn=({section:e,selectedUrl:t,onSelectUrl:n})=>{const s=e.permanentLink===t;return a.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",s?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:a.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[a.jsx(i.IconDocumentText16,{}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Gn=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:s,appBridge:r})=>{const[l,c]=p.useState(e.id===s.documentId),d=e.permanentLink===t,{documentSections:u}=X.useDocumentSection(r,e.id),m=[...u.values()],f=m.length>0;return p.useEffect(()=>{e.id===s.pageId&&c(!0)},[s,e.id]),a.jsxs(a.Fragment,{children:[a.jsx("div",{tabIndex:0,"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer",f?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:a.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[f&&a.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>c(!l),onFocus:()=>c(!l),children:a.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&m.length>0&&m.map(g=>a.jsx(Kn,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},Xn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:s,itemsToExpandInitially:r})=>{const[l,c]=p.useState([]),[d,u]=p.useState(!0),m=[...l.values()],f=!d&&m.length>0;return p.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{c(g)}).finally(()=>{u(!1)})},[]),d?a.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:a.jsx(i.LoadingCircle,{})}):f?a.jsx(a.Fragment,{children:m.map(g=>a.jsx(Gn,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:s,itemsToExpandInitially:r},g.id))}):a.jsx("div",{className:"tw-py-2 tw-px-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},Qn=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:s,itemsToExpandInitially:r})=>{const[l,c]=p.useState(e.id===r.documentId),d=e.permanentLink===n;return p.useEffect(()=>{e.id===r.documentId&&c(!0)},[r,e.id]),a.jsxs(a.Fragment,{children:[a.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.merge(["tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>s(e.permanentLink),onFocus:()=>s(e.permanentLink),children:[a.jsx("div",{role:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>c(!l),onFocus:()=>c(!l),children:a.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),a.jsx(i.IconColorFan16,{}),a.jsx("span",{className:"tw-text-s",children:e.title}),a.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&a.jsx(Xn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:s,itemsToExpandInitially:r})]})},Yn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[s,r]=p.useState(!0),[l,c]=p.useState([]),[d,u]=p.useState({documentId:void 0,pageId:void 0}),m=[...l.values()];p.useEffect(()=>{t&&m.length>0&&f().then(g=>{u(g)})},[m.length]),p.useEffect(()=>{e.getAllDocuments().then(g=>{c(g)}).finally(()=>{r(!1)})},[]);const f=async()=>{const g={documentId:void 0,pageId:void 0};if(m.find(v=>v.permanentLink===t))return g;for(const v of m){const E=await e.getDocumentPagesByDocumentId(v.id);e.getAllDocuments();const T=[...E.values()];if(!!T.find(S=>S.permanentLink===t))return g.documentId=v.id,g;for(const S of T)if(!![...(await e.getDocumentSectionsByDocumentPageId(S.id)).values()].find(F=>F.permanentLink===t))return g.documentId=v.id,g.pageId=S.id,g}return g};return s?a.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:a.jsx(i.LoadingCircle,{})}):a.jsx(a.Fragment,{children:m.map(g=>a.jsx(Qn,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},Jn=({appBridge:e,url:t,onUrlChange:n})=>{const{open:s,isOpen:r,close:l}=Ut.useOverlayTriggerState({}),[c,d]=p.useState(t),u=g=>{d(g)},m=g=>{g.key==="Enter"&&f()};p.useEffect(()=>{t&&!c&&d(t)},[t,c]);const f=()=>{n(c),l()};return a.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:m,children:[a.jsx(i.Button,{icon:a.jsx(i.IconLink,{}),size:i.ButtonSize.Medium,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>s(),children:"Internal link"}),a.jsxs(i.Modal,{zIndex:1001,onClose:()=>l(),isOpen:r,isDismissable:!0,children:[a.jsx(i.Modal.Header,{title:"Select internal link"}),a.jsx(i.Modal.Body,{children:a.jsx(Yn,{appBridge:e,selectedUrl:c,onSelectUrl:u})}),a.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>l(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:g=>{g==null||g.preventDefault(),f()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!c}]})]})]})},dt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:s,onCancel:r,onSave:l,isValidUrlOrEmpty:c,hasValues:d,testId:u,appBridge:m,children:f})=>a.jsxs("div",{"data-test-id":u,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[a.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:a.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),f,a.jsxs("div",{className:"tw-pt-5",children:[a.jsx(i.FormControl,{label:{children:"URL",htmlFor:"url",required:!0},children:a.jsx(i.TextInput,{id:"url",value:e.url,placeholder:"https://example.com",focusOnMount:!0,onChange:n})}),!c(e==null?void 0:e.url)&&a.jsx("div",{className:"tw-text-red-65 tw-mt-3",children:"Please enter a valid URL."})]}),a.jsx("div",{className:"tw-mt-3",children:a.jsx(Jn,{url:e.url,appBridge:m,onUrlChange:n})}),a.jsx("div",{className:"tw-mt-3",children:a.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:e.newTab,onChange:s})}),a.jsx("div",{className:"tw-mt-3",children:a.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[a.jsx(i.Button,{onClick:r,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),a.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:a.jsx(i.IconCheckMark20,{}),disabled:!d||!c(e==null?void 0:e.url),children:"Save"})]})})]}),Zn=e=>{var n;const t=o.getAboveNode(e,{match:{type:b}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},es={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},ts=()=>{const[e,t]=p.useReducer((n,s)=>{const{type:r,payload:l}=s;switch(r){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},es);return[e,t]},ns=()=>{const e=o.useEditorRef(),[t,n]=ts();p.useEffect(()=>{const g=Zn(e);n({type:"INIT",payload:{text:L.text(),buttonStyle:g,newTab:L.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:L.url()}})},[n,e]);const s=g=>{n({type:"TEXT",payload:{text:g}})},r=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},c=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{P.hide()},u=g=>{if(!de(t.url)||!m)return;const w=fe(t.url);P.text(t.text),P.url(w),P.buttonStyle(t.buttonStyle),P.newTab(t.newTab===i.CheckboxState.Checked),Ae(e)&&(g==null||g.preventDefault())},m=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,b);return o.useHotkeys("enter",u,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:s,onButtonStyleChange:r,onUrlChange:l,onToggleTab:c,onCancel:d,onSave:u,hasValues:m,isValidUrlOrEmpty:de,appBridge:f}},ss=()=>{const e=ns(),{state:t,onButtonStyleChange:n}=e;return a.jsx(dt,{...e,testId:"floating-button-insert",children:a.jsx("div",{className:"tw-pt-5",children:a.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[a.jsx(xe,{id:"primary",styles:I.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),a.jsx(xe,{id:"secondary",styles:I.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),a.jsx(xe,{id:"tertiary",styles:I.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},xe=({id:e,styles:t,isActive:n,onClick:s,children:r})=>{const[l,c]=p.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return a.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:s,style:d(),className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:r})},rs=()=>{const e=re().isEditing(),t=a.jsx(ss,{}),n=e?t:a.jsx(Wn,{});return a.jsxs(a.Fragment,{children:[a.jsx(ge.InsertRoot,{children:t}),a.jsx(ge.EditRoot,{children:n})]})},gt=(e,{type:t})=>{const{apply:n,normalizeNode:s}=e;return e.apply=r=>{if(r.type!=="set_selection"){n(r);return}const l=r.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(r);return}const c=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,b)}});if(c){const[,d]=c;let u;o.isStartPoint(e,l.focus,d)&&(u=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(u=o.getNextNodeStartPoint(e,d)),u&&(r.newProperties={anchor:u,focus:u})}n(r)},e.normalizeNode=([r,l])=>{if(r.type===o.getPluginType(e,b)){const c=e.selection;if(c&&o.isCollapsed(c)&&o.isEndPoint(e,c.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const u=Vt.Path.next(l);o.insertNodes(e,{text:""},{at:u}),o.select(e,u)}}}s([r,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},b="button",Me="button-plugin",mt=e=>o.createPluginFactory({key:b,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:gt,renderAfterEditable:rs,options:{isUrl:Ne,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:s=>({type:n,url:s.getAttribute("href"),target:s.getAttribute("target")||"_blank"})}})})();class ht extends i.Plugin{constructor({styles:t=we,...n}){super(Me,{button:qn,markupElement:new Vn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[mt(this.appBridge)]}}var y=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(y||{});const I={heading1:{display:"inline-block",fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[se]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...we},as=()=>{const e=o.useFloatingLinkUrlInput({});return a.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:a.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between",children:[a.jsx("span",{className:"tw-pointer-events-none",style:I.p,children:e.defaultValue}),a.jsxs("span",{className:"tw-flex tw-gap-2",children:[a.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:a.jsx(ce.EditButton,{children:a.jsx(i.IconPen16,{})})}),a.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:a.jsx(ce.UnlinkButton,{children:a.jsx(i.IconTrashBin16,{})})})]})]})})},is=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),s=o.usePlateSelectors().keyEditor(),r=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:c="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=p.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,v]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,v),focus:o.getEndPoint(n,v)})}return o.getDefaultBoundingClientRect()},[n]),u=l&&r==="edit",{update:m,style:f,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:u,getBoundingClientRect:d,...e});return p.useEffect(()=>{const w=kn(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),m();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,s,m]),o.useHotkeys(c,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},os={url:"",text:"",newTab:i.CheckboxState.Unchecked},ls=()=>{const[e,t]=p.useReducer((n,s)=>{const{type:r,payload:l}=s;switch(r){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},os);return[e,t]},us=()=>{const e=o.useEditorRef(),[t,n]=ls();p.useEffect(()=>{const f=xn(e),g=bn(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:f&&g===""?f:o.floatingLinkSelectors.url()}})},[n,e]);const s=f=>{n({type:"TEXT",payload:{text:f}})},r=f=>{n({type:"URL",payload:{url:f}})},l=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{o.floatingLinkActions.hide()},d=f=>{if(!de(t.url)||!u)return;const g=fe(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(f==null||f.preventDefault())},u=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:s,onUrlChange:r,onToggleTab:l,onCancel:c,onSave:d,hasValues:u,isValidUrlOrEmpty:de,appBridge:m}},cs=()=>a.jsx(dt,{...us(),testId:"floating-link-insert"}),ds=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=a.jsx(cs,{}),s=t?n:a.jsx(as,{});return a.jsxs(a.Fragment,{children:[a.jsx(ce.InsertRoot,{children:n}),a.jsx(ce.EditRoot,{children:s})]})},gs=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),s=!!o.isRangeInSameBlock(n,{at:n.selection});return a.jsx("div",{"data-plugin-id":e,children:a.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(s?`Link
|
|
3
|
+
${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:a.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:a.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(s),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},ms=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var s,r;return{href:n.url||((r=(s=n.chosenLink)==null?void 0:s.searchResult)==null?void 0:r.link)||"",target:n.target||"_blank"}}}),onMouseOver:n=>{n.stopPropagation()}}),hs=e=>{const t=ms(e),{attributes:n,children:s}=e;return a.jsx("a",{...n,href:t.href,target:t.target,style:I[se],children:s})};class fs extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=hs){super(t,n)}}const ft=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:ds,options:{isUrl:Ne,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class pt extends i.Plugin{constructor(t,n=I[se]){super(se,{button:gs,markupElement:new fs,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[ft(this.appBridge)]}}const ps="textstyle-custom1-plugin";class wt extends i.Plugin{constructor({styles:t=I.custom1,...n}={}){super(y.custom1,{label:"Custom 1",markupElement:new ws,...n}),this.styles={},this.styles=t}plugins(){return[ys(this.styles)]}}class ws extends i.MarkupElement{constructor(t=ps,n=yt){super(t,n)}}const yt=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("p",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-custom1"]),children:a.jsx("span",{style:s,children:n})})},ys=e=>o.createPluginFactory({key:y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom1}]}})({component:t=>a.jsx(yt,{...t,styles:e})}),xs="textstyle-custom2-plugin";class xt extends i.Plugin{constructor({styles:t=I.custom2,...n}={}){super(y.custom2,{label:"Custom 2",markupElement:new bs,...n}),this.styles={},this.styles=t}plugins(){return[vs(this.styles)]}}class bs extends i.MarkupElement{constructor(t=xs,n=bt){super(t,n)}}const bt=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("p",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-custom2"]),children:a.jsx("span",{style:s,children:n})})},vs=e=>o.createPluginFactory({key:y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom2}]}})({component:t=>a.jsx(bt,{...t,styles:e})}),ks="textstyle-custom3-plugin";class vt extends i.Plugin{constructor({styles:t=I.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new Ss,...n}),this.styles={},this.styles=t}plugins(){return[Cs(this.styles)]}}class Ss extends i.MarkupElement{constructor(t=ks,n=kt){super(t,n)}}const kt=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("p",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-custom3"]),children:a.jsx("span",{style:s,children:n})})},Cs=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>a.jsx(kt,{...t,styles:e})}),Es="textstyle-heading1-plugin";class St extends i.Plugin{constructor({styles:t=I.heading1,...n}={}){super(y.heading1,{label:"Heading 1",markupElement:new Ps,...n}),this.styles={},this.styles=t}plugins(){return[Is(this.styles)]}}class Ps extends i.MarkupElement{constructor(t=Es,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("h1",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-h1"]),children:a.jsx("span",{style:s,children:n})})},Is=e=>o.createPluginFactory({key:y.heading1,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>a.jsx(ve,{...t,styles:e})}),Ts="textstyle-heading2-plugin";class Ct extends i.Plugin{constructor({styles:t=I.heading2,...n}={}){super(y.heading2,{label:"Heading 2",markupElement:new Ls,...n}),this.styles={},this.styles=t}plugins(){return[Ns(this.styles)]}}class Ls extends i.MarkupElement{constructor(t=Ts,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("h2",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e)]),children:a.jsx("span",{style:s,children:n})})},Ns=e=>o.createPluginFactory({key:y.heading2,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>a.jsx(ke,{...t,styles:e})}),js="textstyle-heading3-plugin";class Et extends i.Plugin{constructor({styles:t=I.heading3,...n}={}){super(y.heading3,{label:"Heading 3",markupElement:new Bs,...n}),this.styles={},this.styles=t}plugins(){return[As(this.styles)]}}class Bs extends i.MarkupElement{constructor(t=js,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("h3",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e)]),children:a.jsx("span",{style:s,children:n})})},As=e=>o.createPluginFactory({key:y.heading3,isElement:!0,component:Se,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>a.jsx(Se,{...t,styles:e})}),Rs="textstyle-heading4-plugin";class Pt extends i.Plugin{constructor({styles:t=I.heading4,...n}={}){super(y.heading4,{label:"Heading 4",markupElement:new Ms,...n}),this.styles={},this.styles=t}plugins(){return[Fs(this.styles)]}}class Ms extends i.MarkupElement{constructor(t=Rs,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("h4",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e)]),children:a.jsx("span",{style:s,children:n})})},Fs=e=>o.createPluginFactory({key:y.heading4,isElement:!0,component:Ce,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>a.jsx(Ce,{...t,styles:e})}),Ds="textstyle-imageCaption-plugin";class It extends i.Plugin{constructor({styles:t=I.imageCaption,...n}={}){super(y.imageCaption,{label:"Image Caption",markupElement:new Os,...n}),this.styles={},this.styles=t}plugins(){return[$s(this.styles)]}}class Os extends i.MarkupElement{constructor(t=Ds,n=Ee){super(t,n)}}const Ee=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("p",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-image-caption"]),children:a.jsx("span",{style:s,children:n})})},$s=e=>o.createPluginFactory({key:y.imageCaption,isElement:!0,component:Ee,deserializeHtml:{rules:[{validClassName:y.imageCaption}]}})({component:t=>a.jsx(Ee,{...t,styles:e})}),_s="textstyle-imageTitle-plugin";class Tt extends i.Plugin{constructor({styles:t=I.imageTitle,...n}={}){super(y.imageTitle,{label:"Image Title",markupElement:new Hs,...n}),this.styles={},this.styles=t}plugins(){return[Us(this.styles)]}}class Hs extends i.MarkupElement{constructor(t=_s,n=Pe){super(t,n)}}const Pe=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("p",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-image-title"]),children:a.jsx("span",{style:s,children:n})})},Us=e=>o.createPluginFactory({key:y.imageTitle,isElement:!0,component:Pe,deserializeHtml:{rules:[{validClassName:y.imageTitle}]}})({component:t=>a.jsx(Pe,{...t,styles:e})});class Lt extends i.Plugin{constructor({styles:t=I.p,...n}={}){super(y.p,{markupElement:new jt,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Bt(this.styles)]}}const Nt="tw-m-0 tw-px-0 tw-py-0",me=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align,l=i.merge([r&&i.alignmentClassnames[r],Nt,i.getColumnBreakClasses(e)]);return a.jsx("p",{...t,className:l,style:s,children:n})};class jt extends i.MarkupElement{constructor(t=y.p,n=me){super(t,n)}}const Bt=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:y.p,isElement:!0,component:me})({component:t=>a.jsx(me,{...t,styles:e})}),Vs="textstyle-quote-plugin";class At extends i.Plugin{constructor({styles:t=I.quote,...n}={}){super(y.quote,{label:"Quote",markupElement:new zs,...n}),this.styles={},this.styles=t}plugins(){return[Rt(this.styles)]}}class zs extends i.MarkupElement{constructor(t=Vs,n=he){super(t,n)}}const he=({element:e,attributes:t,children:n,styles:s})=>{const r=e.align;return a.jsx("blockquote",{...t,className:i.merge([r&&i.alignmentClassnames[r],i.getColumnBreakClasses(e),"a-quote"]),children:a.jsx("span",{style:s,children:n})})},Rt=e=>o.createPluginFactory({key:y.quote,isElement:!0,component:he,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>a.jsx(he,{...t,styles:e})}),Fe=[new St,new Ct,new Et,new Pt,new wt,new xt,new vt,new At,new Lt],ne=[y.heading1,y.heading2,y.heading3,y.heading4,y.custom1,y.custom2,y.custom3,y.quote,y.p],qs=[...Fe,new It,new Tt],Ws=[...ne,y.imageCaption,y.imageTitle],Ks=e=>{let t=be(e.text);t=t.replaceAll(`
|
|
4
|
+
`,"<br />");const{bold:n,italic:s,underline:r,strikethrough:l,code:c,subscript:d,superscript:u}=e;return n&&(t=`<span class="${i.BOLD_CLASSES}">${t}</span>`),s&&(t=`<span class="${i.ITALIC_CLASSES}">${t}</span>`),r&&(t=`<span class="${i.UNDERLINE_CLASSES}">${t}</span>`),l&&(t=`<span class="${i.STRIKETHROUGH_CLASSES}">${t}</span>`),c&&(t=`<span class="${i.CODE_CLASSES}">${t}</span>`),d?t=`<sub>${t}</sub>`:u&&(t=`<sup>${t}</sup>`),t},H=e=>e?Object.keys(e).reduce((t,n)=>{const s=e[n];return s?`${t}${Gs(n)}: ${s}; `:t},"").trim().replaceAll('"',"'"):"",Gs=e=>e.replaceAll(/([A-Z])/g,"-$1").toLowerCase(),Xs=(e,t,n,s)=>{const r=s[Me],l=e.buttonStyle??"primary",c=`button${l.charAt(0).toUpperCase()}${l.slice(1)}`,d=r[c],u=H(d);return`<a href="${e.url}"
|
|
31
5
|
target="${e.target??"_blank"}"
|
|
32
|
-
|
|
6
|
+
dir="auto"
|
|
7
|
+
style="${u}"
|
|
33
8
|
class="${n}"
|
|
34
|
-
onmouseenter="this.setAttribute('style', '${
|
|
35
|
-
onmouseleave="this.setAttribute('style', '${
|
|
36
|
-
>${t}</a>`},
|
|
37
|
-
<div class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
|
|
9
|
+
onmouseenter="this.setAttribute('style', '${u} ${H(d==null?void 0:d.hover)}');"
|
|
10
|
+
onmouseleave="this.setAttribute('style', '${H(d)}');"
|
|
11
|
+
>${t}</a>`},Qs=(e,t,n,s)=>{var r;if(e.chosenLink){const{chosenLink:l}=e;return`<a dir="auto" class="${n}" style="${H(s[se])}" target=${l!=null&&l.openInNewTab?"_blank":"_self"} href="${be((r=l==null?void 0:l.searchResult)==null?void 0:r.link)}">${t}</a>`}return`<a dir="auto" class="${n}" style="${H(s[se])}" target="${(e==null?void 0:e.target)??"_blank"}" href="${be(e.url)}">${t}</a>`},Ys=(e,t,n,s)=>{const r=H(n);return e.type===y.heading1?`<h1 dir="auto" class="${i.merge([s,"a-h1"])}">${M(t,r)}</h1>`:e.type===y.heading2?`<h2 dir="auto" class="${s}">${M(t,r)}</h2>`:e.type===y.heading3?`<h3 dir="auto" class="${s}">${M(t,r)}</h3>`:e.type===y.heading4?`<h4 dir="auto" class="${s}">${M(t,r)}</h4>`:e.type===y.custom1?`<p dir="auto" class="${i.merge([s,"a-custom1"])}">${M(t,r)}</p>`:e.type===y.custom2?`<p dir="auto" class="${i.merge([s,"a-custom2"])}">${M(t,r)}</p>`:e.type===y.custom3?`<p dir="auto" class="${i.merge([s,"a-custom3"])}">${M(t,r)}</p>`:e.type===y.quote?`<p dir="auto" class="${i.merge([s,"a-quote"])}">${M(t,r)}</p>`:e.type===y.imageTitle?`<p dir="auto" class="${i.merge([s,"a-image-title"])}">${M(t,r)}</p>`:e.type===y.imageCaption?`<p dir="auto" class="${i.merge([s,"a-image-caption"])}">${M(t,r)}</p>`:`<p dir="auto" class="${s}">${M(t,r)}</p>`},M=(e,t)=>`<span dir="auto" style="${t}">${e}</span>`,Js=(e,t,n,s)=>`<div dir="auto" disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${n}" style="margin-left:${(e.indent??0)*24}px;">
|
|
12
|
+
<div dir="auto" class="tw-flex tw-items-center tw-justify-center tw-select-none tw-mr-1.5">
|
|
38
13
|
<input
|
|
39
14
|
class="tw-w-4 tw-h-4 tw-m-0"
|
|
40
15
|
type="checkbox"
|
|
41
16
|
${e.checked?"checked":""}
|
|
42
17
|
onclick="return false;" />
|
|
43
18
|
</div>
|
|
44
|
-
<span class="${
|
|
45
|
-
</div>`,Ss=(e,{mentionable:t}={})=>{if(!t)return"";const n=document.createElement("div");return gr.render(o.MentionMarkupElementNode(t)({element:e}),n),n.innerHTML},vt=(e,t)=>e.reduce((n,r)=>(r.type===t&&n++,r.children?n+vt(r.children,t):n),0),On=(e,t,{mappedMentionable:n,nestingCount:r={}})=>{if(l.isText(e))return ps(e);const a=r[e.type]||vt([e],e.type);let u="";for(const g of e.children)u+=On(g,t,{nestingCount:{...r,[g.type]:a},mappedMentionable:n});const d=Es[e.type];return typeof d<"u"?d({classNames:Wt(e.breakAfterColumn,e.align),children:u,rootNestingCount:a,node:e,mappedMentionable:n,styles:t}):xs(e,u,t[e.type],Wt(e.breakAfterColumn,e.align))},Es={[l.ELEMENT_UL]:e=>`<ul class="${o.UL_CLASSES} ${e.classNames}">${e.children}</ul>`,[l.ELEMENT_OL]:({classNames:e,children:t,node:n,rootNestingCount:r})=>{const a=Math.max(r-vt([n],l.ELEMENT_OL),0);return`<ol class="${o.getOrderedListClasses(a)} ${e}" style="${ae(o.OL_STYLES)}">${t}</ol>`},[l.ELEMENT_LI]:({classNames:e,children:t,node:n,styles:r})=>`<li class="${e} ${o.LI_CLASSNAMES}" style="${ae(o.getLiStyles(n,r))}">${t}</li>`,[l.ELEMENT_LIC]:({classNames:e,children:t,node:n})=>`<p class="${e} ${o.getLicElementClassNames(n)}"><span>${t}</span></p>`,[l.ELEMENT_LINK]:({node:e,children:t,classNames:n,styles:r})=>ws(e,t,n,r),[L]:({node:e,children:t,classNames:n,styles:r})=>bs(e,t,n,r),[o.ELEMENT_CHECK_ITEM]:({node:e,children:t,classNames:n,styles:r})=>vs(e,t,n,r),[l.ELEMENT_MENTION]:({node:e,mappedMentionable:t})=>Ss(e,{mentionable:t})},Wt=(e,t)=>{const n="tw-break-words",r=e==="active"?"tw-break-after-column tw-break-inside-avoid-column":"",a=t?o.alignmentClassnames[t]:"";return o.merge([a,n,r])},ks=async(e,t=1,n="normal",r=new o.PluginComposer)=>{const a=o.parseRawValue({raw:e,plugins:r}),u=r.getStyles;return Promise.resolve(Cs(a,{columns:t,columnGap:n,styles:u}))},Cs=(e,{mentionable:t,columns:n=1,columnGap:r="normal",styles:a=M}={})=>{const u=t?o.mapMentionable(t):new Map;let d="";for(let g=0,c=e.length;g<c;g++){const p=e[g];Ts(p)?d+="<br />":d+=On(p,a,{mappedMentionable:u})}return n>1?`<div style="columns:${n}; column-gap:${r};">${d}</div>`:d},Ts=e=>{var t;return Array.isArray(e==null?void 0:e.children)?(t=e==null?void 0:e.children)==null?void 0:t.every(n=>n.text===""):!1},Ps=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[u,d]=w.useState(null);return w.useEffect(()=>{(async()=>d(await ks(e,n,t,a)))()},[e,n,t,a]),!r||u==="<br />"?null:u!==null?s.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:u}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Is=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:u,plugins:d,onTextChange:g,showSerializedText:c})=>{const[p,h]=w.useState(!1),f=x=>{g&&x!==n&&g(x),h(!1)};return w.useEffect(()=>{const x=T=>(T.preventDefault(),T.returnValue="Unprocessed changes");return p&&window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[p]),t?s.jsx(o.RichTextEditor,{id:e,value:n,border:!1,placeholder:u,plugins:d,onValueChanged:()=>h(!0),onTextChange:f,hideExternalFloatingModals:x=>{z.isOpen(x)&&F.reset()}}):s.jsx(Ps,{value:n,columns:r,gap:a,show:c,plugins:d})},Rs=e=>new o.PluginComposer().setPlugin(new o.SoftBreakPlugin,new o.TextStylePlugin({textStyles:xt})).setPlugin([new o.BoldPlugin,new o.ItalicPlugin,new o.UnderlinePlugin,new o.StrikethroughPlugin,new yn({appBridge:e}),new hn({appBridge:e}),new o.CodePlugin],[new o.AlignLeftPlugin({validTypes:ve}),new o.AlignCenterPlugin({validTypes:ve}),new o.AlignRightPlugin({validTypes:ve}),new o.AlignJustifyPlugin({validTypes:ve}),new o.UnorderedListPlugin,new o.CheckboxListPlugin,new o.OrderedListPlugin,new o.ResetFormattingPlugin]),js="--f-theme-settings-",Ls=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=fe.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAddAttachments:async p=>{const h=a.map(f=>f.id);for(const f of p)h.push(f.id);await r(t,h)},onAttachmentDelete:async p=>{const h=a.filter(f=>f.id!==p.id).map(f=>f.id);await r(t,h)},onAttachmentReplace:async(p,h)=>{const f=a.map(x=>x.id===p.id?h.id:x.id);await r(t,f)},onAttachmentsSorted:async p=>{const h=p.map(f=>f.id);await r(t,h)},attachments:a}},Ns={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},Bs=(e=0,t=0)=>{const n=en(e,t);return _.useSensors(_.useSensor(_.PointerSensor),_.useSensor(_.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Ns}))},As=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||Cr,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},_s=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",u=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",d=(e==null?void 0:e.defaultColor)||Xt,g=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:g,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>b.appendUnit(c,a),layout:b.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:Q.Solid,choices:[{value:Q.Solid,label:Q.Solid},{value:Q.Dotted,label:Q.Dotted},{value:Q.Dashed,label:Q.Dashed}]},{id:a,type:"input",defaultValue:Tr,rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:u,type:"colorInput",defaultValue:d}]}],off:[]}},St=(e,t=oe.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:oe.None,label:"None"},{value:oe.Small,label:"S"},{value:oe.Medium,label:"M"},{value:oe.Large,label:"L"}]}),Os=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||oe.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:u=>{var d;return e!=null&&e.dependentSettingId?!!((d=u.getBlock(e.dependentSettingId))!=null&&d.value):!0},onChange:u=>b.presetCustomValue(u,r,n,(e==null?void 0:e.radiusStyleMap)||ge),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[b.numericalOrPixelRule],onChange:u=>b.appendUnit(u,n)}],off:[St(r,a)]}},Fs=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",u=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",d=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",g=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var p;return e!=null&&e.dependentSettingId?!!((p=c.getBlock(e.dependentSettingId))!=null&&p.value):!0},onChange:c=>{b.presetCustomValue(c,r,a,ge),b.presetCustomValue(c,r,u,ge),b.presetCustomValue(c,r,d,ge),b.presetCustomValue(c,r,g,ge)},on:[{id:n,type:"multiInput",layout:b.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[b.numericalOrPixelRule],onChange:c=>b.appendUnit(c,a)},{id:u,type:"input",label:"Top Right",rules:[b.numericalOrPixelRule],onChange:c=>b.appendUnit(c,u)},{id:d,type:"input",label:"Bottom Left",rules:[b.numericalOrPixelRule],onChange:c=>b.appendUnit(c,d)},{id:g,type:"input",label:"Bottom Right",rules:[b.numericalOrPixelRule],onChange:c=>b.appendUnit(c,g)}]}],off:[St(r,e==null?void 0:e.defaultValue)]}},Ms=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",u=e!=null&&e.defaultValueChoices?e.defaultValueChoices:de.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:d=>b.presetCustomValue(d,r,a,Yt),show:d=>{var g;return((g=d.getBlock(n))==null?void 0:g.value)!=="1"},on:[{id:a,type:"input",rules:[b.numericalOrPixelRule],onChange:d=>b.appendUnit(d,a)}],off:[{id:r,type:"slider",defaultValue:u,choices:[{value:de.Auto,label:"Auto"},{value:de.S,label:"S"},{value:de.M,label:"M"},{value:de.L,label:"L"}]}]}},Et=e=>({id:e,type:"segmentedControls",defaultValue:ce.None,choices:[{value:ce.None,label:"None"},{value:ce.Small,label:"S"},{value:ce.Medium,label:"M"},{value:ce.Large,label:"L"}]}),Ds=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>b.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||xe),on:[{id:n,type:"input",placeholder:Le,rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>b.appendUnit(a,n)}],off:[Et(r)]}},$s=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",u=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",d=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",g=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{b.presetCustomValue(c,r,a,xe),b.presetCustomValue(c,r,u,xe),b.presetCustomValue(c,r,d,xe),b.presetCustomValue(c,r,g,xe)},on:[{id:n,type:"multiInput",layout:b.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:Le,onChange:c=>b.appendUnit(c,a),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Left",placeholder:Le,onChange:c=>b.appendUnit(c,u),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Right",placeholder:Le,onChange:c=>b.appendUnit(c,d),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:Le,onChange:c=>b.appendUnit(c,g),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Et(r)]}},kt=e=>({id:e,type:"segmentedControls",defaultValue:ue.Small,choices:[{value:ue.None,label:"None"},{value:ue.Small,label:"S"},{value:ue.Medium,label:"M"},{value:ue.Large,label:"L"}]}),Us=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>b.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||we),on:[{id:n,type:"input",placeholder:je,rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>b.appendUnit(a,n)}],off:[kt(r)]}},Hs=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",u=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",d=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",g=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{b.presetCustomValue(c,r,a,we),b.presetCustomValue(c,r,u,we),b.presetCustomValue(c,r,d,we),b.presetCustomValue(c,r,g,we)},on:[{id:n,type:"multiInput",layout:b.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:je,onChange:c=>b.appendUnit(c,a),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Left",placeholder:je,onChange:c=>b.appendUnit(c,u),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Right",placeholder:je,onChange:c=>b.appendUnit(c,d),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:je,onChange:c=>b.appendUnit(c,g),rules:[b.numericalOrPixelRule,b.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[kt(r)]}},Vs=e=>{const t=Ct(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===me.Custom}}},Ct=e=>e||"security",zs=e=>[{id:Ct(e),type:"segmentedControls",defaultValue:me.Global,choices:[{value:me.Global,label:"Global Settings"},{value:me.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:b.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Fn=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Fn||{});const Ws=e=>e,qs=e=>e;exports.AllTextStylePlugins=fs;exports.AllTextStyles=hs;exports.Attachments=Br;exports.BUTTON_PLUGIN=wt;exports.BlockButtonStyles=Ge;exports.BlockInjectButton=hr;exports.BlockItemWrapper=jr;exports.BlockStyles=M;exports.BorderStyle=Q;exports.ButtonPlugin=hn;exports.Custom1Plugin=bn;exports.Custom2Plugin=xn;exports.Custom3Plugin=Sn;exports.DEFAULT_DRAGGING_TOOLTIP=Qt;exports.DEFAULT_DRAG_TOOLTIP=Jt;exports.DownloadButton=Ar;exports.ELEMENT_BUTTON=L;exports.GutterSpacing=de;exports.Heading1Plugin=kn;exports.Heading2Plugin=Cn;exports.Heading3Plugin=Tn;exports.Heading4Plugin=Pn;exports.ImageCaptionPlugin=In;exports.ImageTitlePlugin=Rn;exports.LinkPlugin=yn;exports.Margin=ce;exports.PARAGRAPH_CLASSES=Ln;exports.Padding=ue;exports.ParagraphMarkupElement=Nn;exports.ParagraphMarkupElementNode=Ve;exports.ParagraphPlugin=jn;exports.QuoteMarkupElementNode=ze;exports.QuotePlugin=An;exports.Radius=oe;exports.RichTextEditor=Is;exports.Sections=Fn;exports.Security=me;exports.THEME_PREFIX=js;exports.TextStylePluginsWithoutImage=xt;exports.TextStyles=v;exports.TextStylesWithoutImage=ve;exports.addHttps=We;exports.borderStyleMap=Kt;exports.convertToRteValue=Mr;exports.createButtonNode=an;exports.createButtonPlugin=fn;exports.createLinkPlugin=pn;exports.createParagraphPlugin=Bn;exports.createQuotePlugin=_n;exports.customCoordinatesGetterFactory=en;exports.defineBlock=Ws;exports.defineSettings=qs;exports.getBackgroundColorStyles=kr;exports.getBackgroundSettings=As;exports.getBorderRadiusSettings=Os;exports.getBorderRadiusSlider=St;exports.getBorderSettings=_s;exports.getBorderStyles=Pr;exports.getDefaultPluginsWithLinkChooser=Rs;exports.getExtendedBorderRadiusSettings=Fs;exports.getGutterSettings=Ms;exports.getMarginExtendedSettings=$s;exports.getMarginSettings=Ds;exports.getMarginSlider=Et;exports.getPaddingExtendedSettings=Hs;exports.getPaddingSettings=Us;exports.getPaddingSlider=kt;exports.getRadiusStyles=Ir;exports.getReadableColor=Sr;exports.getSecurityDownloadableSetting=Vs;exports.getSecurityGlobalControlId=Ct;exports.getSecurityGlobalControlSetting=zs;exports.getUrlFromEditor=rn;exports.gutterSpacingStyleMap=Yt;exports.hasRichTextValue=Zt;exports.insertButton=sn;exports.isDark=yr;exports.isDownloadable=$r;exports.joinClassNames=re;exports.mapAppBridgeColorPaletteToFonduePalette=tn;exports.mapAppBridgeColorPalettesToFonduePalettes=Ur;exports.marginStyleMap=xe;exports.moveItemInArray=Er;exports.paddingStyleMap=we;exports.radiusStyleMap=ge;exports.setAlpha=xr;exports.submitFloatingButton=yt;exports.toColorObject=vr;exports.toHex8String=br;exports.toHexString=wr;exports.toRgbaString=dt;exports.toShortRgba=he;exports.triggerFloatingButton=dn;exports.triggerFloatingButtonEdit=qe;exports.triggerFloatingButtonInsert=pt;exports.unwrapButton=ke;exports.upsertButton=on;exports.upsertButtonText=bt;exports.useAttachments=Ls;exports.useDndSensors=Bs;exports.withButton=mn;exports.wrapButton=ln;Object.keys(b).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>b[e]})});
|
|
19
|
+
<span dir="auto" class="${i.merge(["tw-flex-1 tw-focus:outline-none",e.checked?"!tw-line-through":""])}" style="${H(s[e.children[0].textStyle])}">${t}</span>
|
|
20
|
+
</div>`,Zs=(e,{mentionable:t}={})=>{if(!t)return"";const n=document.createElement("div");return zt.render(i.MentionMarkupElementNode(t)({element:e}),n),n.innerHTML},De=(e,t)=>e.reduce((n,s)=>(s.type===t&&n++,s.children?n+De(s.children,t):n),0),Mt=(e,t,{mappedMentionable:n,nestingCount:s={}})=>{if(o.isText(e))return Ks(e);const r=s[e.type]||De([e],e.type);let l="";for(const d of e.children)l+=Mt(d,t,{nestingCount:{...s,[d.type]:r},mappedMentionable:n});const c=er[e.type];return typeof c<"u"?c({classNames:qe(e.breakAfterColumn,e.align),children:l,rootNestingCount:r,node:e,mappedMentionable:n,styles:t}):Ys(e,l,t[e.type],qe(e.breakAfterColumn,e.align))},er={[o.ELEMENT_UL]:e=>`<ul dir="auto" class="${i.UL_CLASSES} ${e.classNames}">${e.children}</ul>`,[o.ELEMENT_OL]:({classNames:e,children:t,node:n,rootNestingCount:s})=>{const r=Math.max(s-De([n],o.ELEMENT_OL),0);return`<ol dir="auto" class="${i.getOrderedListClasses(r)} ${e}" style="${H(i.OL_STYLES)}">${t}</ol>`},[o.ELEMENT_LI]:({classNames:e,children:t,node:n,styles:s})=>`<li dir="auto" class="${e} ${i.LI_CLASSNAMES}" style="${H(i.getLiStyles(n,s))}">${t}</li>`,[o.ELEMENT_LIC]:({classNames:e,children:t,node:n})=>`<p dir="auto" class="${e} ${i.getLicElementClassNames(n)}"><span>${t}</span></p>`,[o.ELEMENT_LINK]:({node:e,children:t,classNames:n,styles:s})=>Qs(e,t,n,s),[b]:({node:e,children:t,classNames:n,styles:s})=>Xs(e,t,n,s),[i.ELEMENT_CHECK_ITEM]:({node:e,children:t,classNames:n,styles:s})=>Js(e,t,n,s),[o.ELEMENT_MENTION]:({node:e,mappedMentionable:t})=>Zs(e,{mentionable:t})},qe=(e,t)=>{const n="tw-break-words",s=e==="active"?"tw-break-after-column tw-break-inside-avoid-column":"",r=t?i.alignmentClassnames[t]:"";return i.merge([r,n,s])},tr=async(e,t=1,n="normal",s=new i.PluginComposer)=>{const r=i.parseRawValue({raw:e,plugins:s}),l=s.getStyles;return Promise.resolve(nr(r,{columns:t,columnGap:n,styles:l}))},nr=(e,{mentionable:t,columns:n=1,columnGap:s="normal",styles:r=I}={})=>{const l=t?i.mapMentionable(t):new Map;let c="";for(let d=0,u=e.length;d<u;d++){const m=e[d];sr(m)?c+="<br />":c+=Mt(m,r,{mappedMentionable:l})}return n>1?`<div style="columns:${n}; column-gap:${s};">${c}</div>`:c},sr=e=>{var t;return Array.isArray(e==null?void 0:e.children)?(t=e==null?void 0:e.children)==null?void 0:t.every(n=>n.text===""):!1},rr=({value:e="",gap:t,columns:n,show:s=!0,plugins:r})=>{const[l,c]=p.useState(null);return p.useEffect(()=>{(async()=>c(await tr(e,n,t,r)))()},[e,n,t,r]),!s||l==="<br />"?null:l!==null?a.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):a.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},ar=({id:e="rte",isEditing:t,value:n,columns:s,gap:r,placeholder:l,plugins:c,onTextChange:d,showSerializedText:u})=>{const[m,f]=p.useState(!1),g=w=>{d&&w!==n&&d(w),f(!1)};return p.useEffect(()=>{const w=v=>(v.preventDefault(),v.returnValue="Unprocessed changes");return m&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[m]),t?a.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:c,onValueChanged:()=>f(!0),onTextChange:g,hideExternalFloatingModals:w=>{L.isOpen(w)&&P.reset()}}):a.jsx(rr,{value:n,columns:s,gap:r,show:u,plugins:c})},ir=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Fe})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new pt({appBridge:e}),new ht({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:ne}),new i.AlignCenterPlugin({validTypes:ne}),new i.AlignRightPlugin({validTypes:ne}),new i.AlignJustifyPlugin({validTypes:ne}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin]),or="--f-theme-settings-",lr=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:s}=X.useBlockAssets(e),r=(n==null?void 0:n[t])||[];return{onAddAttachments:async m=>{const f=r.map(g=>g.id);for(const g of m)f.push(g.id);await s(t,f)},onAttachmentDelete:async m=>{const f=r.filter(g=>g.id!==m.id).map(g=>g.id);await s(t,f)},onAttachmentReplace:async(m,f)=>{const g=r.map(w=>w.id===m.id?f.id:w.id);await s(t,g)},onAttachmentsSorted:async m=>{const f=m.map(g=>g.id);await s(t,f)},attachments:r}},ur={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},cr=(e=0,t=0)=>{const n=et(e,t);return C.useSensors(C.useSensor(C.PointerSensor),C.useSensor(C.KeyboardSensor,{coordinateGetter:n,keyboardCodes:ur}))},dr=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",s=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||tn,r=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:r,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:s,type:"colorInput"}]}},gr=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",s=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",r=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",c=(e==null?void 0:e.defaultColor)||Qe,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:u=>h.appendUnit(u,r),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:s,type:"dropdown",defaultValue:D.Solid,choices:[{value:D.Solid,label:D.Solid},{value:D.Dotted,label:D.Dotted},{value:D.Dashed,label:D.Dashed}]},{id:r,type:"input",defaultValue:nn,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:c}]}],off:[]}},Oe=(e,t=U.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:U.None,label:"None"},{value:U.Small,label:"S"},{value:U.Medium,label:"M"},{value:U.Large,label:"L"}]}),mr=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",s=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",r=(e==null?void 0:e.defaultRadius)||U.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var c;return e!=null&&e.dependentSettingId?!!((c=l.getBlock(e.dependentSettingId))!=null&&c.value):!0},onChange:l=>h.presetCustomValue(l,s,n,(e==null?void 0:e.radiusStyleMap)||K),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Oe(s,r)]}},hr=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",s=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",r=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",c=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:u=>{var m;return e!=null&&e.dependentSettingId?!!((m=u.getBlock(e.dependentSettingId))!=null&&m.value):!0},onChange:u=>{h.presetCustomValue(u,s,r,K),h.presetCustomValue(u,s,l,K),h.presetCustomValue(u,s,c,K),h.presetCustomValue(u,s,d,K)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:r,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,r)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,l)},{id:c,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,c)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,d)}]}],off:[Oe(s,e==null?void 0:e.defaultValue)]}},fr=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",s=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",r=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:W.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>h.presetCustomValue(c,s,r,Xe),show:c=>{var d;return((d=c.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:r,type:"input",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,r)}],off:[{id:s,type:"slider",defaultValue:l,choices:[{value:W.Auto,label:"Auto"},{value:W.S,label:"S"},{value:W.M,label:"M"},{value:W.L,label:"L"}]}]}},$e=e=>({id:e,type:"segmentedControls",defaultValue:q.None,choices:[{value:q.None,label:"None"},{value:q.Small,label:"S"},{value:q.Medium,label:"M"},{value:q.Large,label:"L"}]}),pr=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",s=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:r=>h.presetCustomValue(r,s,n,(e==null?void 0:e.marginStyleMap)||te),on:[{id:n,type:"input",placeholder:le,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:r=>h.appendUnit(r,n)}],off:[$e(s)]}},wr=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",s=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",r=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",c=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:u=>{h.presetCustomValue(u,s,r,te),h.presetCustomValue(u,s,l,te),h.presetCustomValue(u,s,c,te),h.presetCustomValue(u,s,d,te)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:r,type:"input",label:"Top",placeholder:le,onChange:u=>h.appendUnit(u,r),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:le,onChange:u=>h.appendUnit(u,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:le,onChange:u=>h.appendUnit(u,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:le,onChange:u=>h.appendUnit(u,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[$e(s)]}},_e=e=>({id:e,type:"segmentedControls",defaultValue:z.Small,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),yr=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",s=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:r=>h.presetCustomValue(r,s,n,(e==null?void 0:e.paddingStyleMap)||ee),on:[{id:n,type:"input",placeholder:oe,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:r=>h.appendUnit(r,n)}],off:[_e(s)]}},xr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",s=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",r=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",c=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:u=>{h.presetCustomValue(u,s,r,ee),h.presetCustomValue(u,s,l,ee),h.presetCustomValue(u,s,c,ee),h.presetCustomValue(u,s,d,ee)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:r,type:"input",label:"Top",placeholder:oe,onChange:u=>h.appendUnit(u,r),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:oe,onChange:u=>h.appendUnit(u,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:oe,onChange:u=>h.appendUnit(u,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:oe,onChange:u=>h.appendUnit(u,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[_e(s)]}},br=e=>{const t=He(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var s;return((s=n.getBlock(t))==null?void 0:s.value)===G.Custom}}},He=e=>e||"security",vr=e=>[{id:He(e),type:"segmentedControls",defaultValue:G.Global,choices:[{value:G.Global,label:"Global Settings"},{value:G.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Ft=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Ft||{});const kr=e=>e,Sr=e=>e;exports.AllTextStylePlugins=qs;exports.AllTextStyles=Ws;exports.Attachments=cn;exports.BUTTON_PLUGIN=Me;exports.BlockButtonStyles=we;exports.BlockInjectButton=qt;exports.BlockItemWrapper=on;exports.BlockStyles=I;exports.BorderStyle=D;exports.ButtonPlugin=ht;exports.Custom1Plugin=wt;exports.Custom2Plugin=xt;exports.Custom3Plugin=vt;exports.DEFAULT_DRAGGING_TOOLTIP=Je;exports.DEFAULT_DRAG_TOOLTIP=Ye;exports.DownloadButton=dn;exports.ELEMENT_BUTTON=b;exports.GutterSpacing=W;exports.Heading1Plugin=St;exports.Heading2Plugin=Ct;exports.Heading3Plugin=Et;exports.Heading4Plugin=Pt;exports.ImageCaptionPlugin=It;exports.ImageTitlePlugin=Tt;exports.LinkPlugin=pt;exports.Margin=q;exports.PARAGRAPH_CLASSES=Nt;exports.Padding=z;exports.ParagraphMarkupElement=jt;exports.ParagraphMarkupElementNode=me;exports.ParagraphPlugin=Lt;exports.QuoteMarkupElementNode=he;exports.QuotePlugin=At;exports.Radius=U;exports.RichTextEditor=ar;exports.Sections=Ft;exports.Security=G;exports.THEME_PREFIX=or;exports.TextStylePluginsWithoutImage=Fe;exports.TextStyles=y;exports.TextStylesWithoutImage=ne;exports.addHttps=fe;exports.borderStyleMap=Ge;exports.convertToRteValue=fn;exports.createButtonNode=rt;exports.createButtonPlugin=mt;exports.createLinkPlugin=ft;exports.createParagraphPlugin=Bt;exports.createQuotePlugin=Rt;exports.customCoordinatesGetterFactory=et;exports.defineBlock=kr;exports.defineSettings=Sr;exports.getBackgroundColorStyles=en;exports.getBackgroundSettings=dr;exports.getBorderRadiusSettings=mr;exports.getBorderRadiusSlider=Oe;exports.getBorderSettings=gr;exports.getBorderStyles=sn;exports.getDefaultPluginsWithLinkChooser=ir;exports.getExtendedBorderRadiusSettings=hr;exports.getGutterSettings=fr;exports.getMarginExtendedSettings=wr;exports.getMarginSettings=pr;exports.getMarginSlider=$e;exports.getPaddingExtendedSettings=xr;exports.getPaddingSettings=yr;exports.getPaddingSlider=_e;exports.getRadiusStyles=rn;exports.getReadableColor=Jt;exports.getSecurityDownloadableSetting=br;exports.getSecurityGlobalControlId=He;exports.getSecurityGlobalControlSetting=vr;exports.getUrlFromEditor=st;exports.gutterSpacingStyleMap=Xe;exports.hasRichTextValue=Ze;exports.insertButton=at;exports.isDark=Kt;exports.isDownloadable=wn;exports.joinClassNames=_;exports.mapAppBridgeColorPaletteToFonduePalette=tt;exports.mapAppBridgeColorPalettesToFonduePalettes=yn;exports.marginStyleMap=te;exports.moveItemInArray=Zt;exports.paddingStyleMap=ee;exports.radiusStyleMap=K;exports.setAlpha=Qt;exports.submitFloatingButton=Ae;exports.toColorObject=Yt;exports.toHex8String=Gt;exports.toHexString=Xt;exports.toRgbaString=Ie;exports.toShortRgba=Q;exports.triggerFloatingButton=ct;exports.triggerFloatingButtonEdit=pe;exports.triggerFloatingButtonInsert=Be;exports.unwrapButton=ae;exports.upsertButton=it;exports.upsertButtonText=Re;exports.useAttachments=lr;exports.useDndSensors=cr;exports.withButton=gt;exports.wrapButton=ot;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
|
|
46
21
|
//# sourceMappingURL=index.cjs.js.map
|