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