%PDF- %PDF-
Direktori : /home/t/r/a/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/admin/chunks/ |
Current File : /home/t/r/a/tradesc/www/relax/wp-content/plugins/woocommerce/assets/client/admin/chunks/5691.js |
"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[5691],{95691:(e,t,o)=>{o.r(t),o.d(t,{ModalEditor:()=>le});var r=o(69307),n=o(9818),c=o(55609),l=o(94333),a=o(98817),i=o(87608),s=o.n(i),m=o(74617),d=o(55815),u=o(52175),h=o(76664),p=o(65736),_=o(17289);function b({onClick:e}){return(0,r.createElement)(c.Button,{className:"woocommerce-iframe-editor__back-button",icon:_.Z,onClick:e},(0,p.__)("Back","woocommerce"))}function v({children:e,enableResizing:t,settings:o,...n}){const c=(0,u.__unstableUseMouseMoveTypingReset)();return(0,r.createElement)(u.__unstableIframe,{ref:c,name:"editor-canvas",className:"edit-site-visual-editor__editor-canvas",...n},(0,r.createElement)(r.Fragment,null,(0,r.createElement)(u.__unstableEditorStyles,{styles:null==o?void 0:o.styles}),(0,r.createElement)("style",null,".is-root-container {\n\t\t\t\t\t\t\t\tpadding: 36px;\n\t\t\t\t\t\t\t\tdisplay: flow-root;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbody { position: relative; }"),t&&(0,r.createElement)("style",null,".is-root-container { min-height: 0 !important; }"),e))}const w=(0,r.createContext)({hasRedo:!1,hasUndo:!1,isDocumentOverviewOpened:!1,isInserterOpened:!1,redo:()=>{},setIsDocumentOverviewOpened:()=>{},setIsInserterOpened:()=>{},undo:()=>{}});var f=o(3338),g=o(68617),E=o(16719),k=o(21571),C=o(73091),S=o(39630);const y=(0,r.forwardRef)((function(e,t){const o=(0,S.isAppleOS)()?S.displayShortcut.primaryShift("z"):S.displayShortcut.primary("y"),{hasRedo:n,redo:l}=(0,r.useContext)(w);return(0,r.createElement)(c.Button,{...e,ref:t,icon:(0,p.isRTL)()?C.Z:k.Z,label:(0,p.__)("Redo","woocommerce"),shortcut:o,"aria-disabled":!n,onClick:n?l:void 0,className:"editor-history__redo"})})),B=(0,r.forwardRef)((function(e,t){const{hasUndo:o,undo:n}=(0,r.useContext)(w);return(0,r.createElement)(c.Button,{...e,ref:t,icon:(0,p.isRTL)()?k.Z:C.Z,label:(0,p.__)("Undo","woocommerce"),shortcut:S.displayShortcut.primary("z"),"aria-disabled":!o,onClick:o?n:void 0,className:"editor-history__undo"})}));var T=o(9622);const I=(0,r.forwardRef)((function(e,t){const{isDocumentOverviewOpened:o,setIsDocumentOverviewOpened:n}=(0,r.useContext)(w);return(0,r.createElement)(c.Button,{...e,ref:t,icon:T.Z,isPressed:o,label:(0,p.__)("Document overview","woocommerce"),shortcut:S.displayShortcut.access("o"),onClick:function(){n(!o)},className:"document-overview"})}));var R=o(4981),O=o(14599);const x=()=>{const{createNotice:e}=(0,n.useDispatch)("core/notices"),{blocks:t}=(0,n.useSelect)((e=>{const{getBlocks:t}=e(u.store);return{blocks:t()}}),[]),o=(0,l.useCopyToClipboard)((()=>(0,R.serialize)(t)),(()=>{e("success",(0,p.__)("All content copied.","woocommerce"))}));return(0,r.createElement)(c.MenuItem,{ref:o,role:"menuitem",onClick:()=>{(0,O.recordEvent)("product_iframe_editor_copy_all_content_menu_item_click")},disabled:!t.length},(0,p.__)("Copy all content","woocommerce"))};var D=o(46646);const z=()=>(0,r.createElement)(c.MenuItem,{role:"menuitem",icon:D.Z,href:(0,p.__)("https://wordpress.org/documentation/article/wordpress-block-editor/","woocommerce"),onClick:()=>{(0,O.recordEvent)("product_iframe_editor_help_menu_item_click")},target:"_blank",rel:"noopener noreferrer"},(0,p.__)("Help","woocommerce"),(0,r.createElement)(c.VisuallyHidden,{as:"span"},(0,p.__)("(opens in a new tab)","woocommerce"))),N=()=>(0,r.createElement)(c.MenuGroup,{label:(0,p.__)("Tools","woocommerce")},(0,r.createElement)(x,null),(0,r.createElement)(z,null));function M(){const{set:e}=(0,n.useDispatch)(d.store);return(0,l.useViewportMatch)("medium")?(0,r.createElement)(c.MenuGroup,{label:(0,p.__)("View","woocommerce")},(0,r.createElement)(d.PreferenceToggleMenuItem,{scope:"core",name:"fixedToolbar",onToggle:()=>{e("core","distractionFree",!1)},label:(0,p.__)("Top toolbar","woocommerce"),info:(0,p.__)("Access all block and document tools in a single place","woocommerce"),messageActivated:(0,p.__)("Top toolbar activated","woocommerce"),messageDeactivated:(0,p.__)("Top toolbar deactivated","woocommerce")})):null}var H=o(56644),F=o(70250);const V=()=>{const e=(0,m.isWpVersion)("6.5",">=")||(0,H.B)()>17.3;return(0,r.createElement)(h.Eo,null,(({onClose:t})=>(0,r.createElement)(r.Fragment,null,e&&(0,r.createElement)(M,null),(0,r.createElement)(h.tC.Slot,{name:F.hB,label:(0,p.__)("Plugins","woocommerce"),as:c.MenuGroup,fillProps:{onClick:t}}),(0,r.createElement)(N,null))))};function P({onSave:e=(()=>{}),onCancel:t=(()=>{})}){const{isInserterOpened:o,setIsInserterOpened:a}=(0,r.useContext)(w),[i,_]=(0,r.useState)(!0),b=(0,l.useViewportMatch)("medium"),v=(0,r.useRef)(null),{isInserterEnabled:k,isTextModeEnabled:C,hasBlockSelection:S,hasFixedToolbar:T}=(0,n.useSelect)((e=>{var t,o;const{hasInserterItems:r,getBlockRootClientId:n,getBlockSelectionEnd:c,__unstableGetEditorMode:l,getBlockSelectionStart:a}=e(u.store),{get:i}=e(d.store);return{isTextModeEnabled:"text"===l(),isInserterEnabled:r(null!==(o=n(null!==(t=c())&&void 0!==t?t:""))&&void 0!==o?o:void 0),hasBlockSelection:!!a(),hasFixedToolbar:i("core","fixedToolbar")}}),[]),R=(0,r.useCallback)((()=>a(!o)),[o,a]);(0,r.useEffect)((()=>{S&&_(!1)}),[S]);const O=(0,m.isWpVersion)("6.5",">=")||(0,H.B)()>17.3;return(0,r.createElement)("div",{className:"woocommerce-iframe-editor__header"},(0,r.createElement)("div",{className:"woocommerce-iframe-editor__header-left"},(0,r.createElement)(u.NavigableToolbar,{className:"woocommerce-iframe-editor-document-tools","aria-label":(0,p.__)("Document tools","woocommerce"),variant:"unstyled"},(0,r.createElement)("div",{className:"woocommerce-iframe-editor-document-tools__left"},(0,r.createElement)(c.ToolbarItem,{ref:v,as:c.Button,className:"woocommerce-iframe-editor__header-inserter-toggle",variant:"primary",isPressed:o,onMouseDown:e=>{e.preventDefault()},onClick:R,disabled:!k,icon:f.Z,label:(0,p.__)("Toggle block inserter","woocommerce"),"aria-expanded":o,showTooltip:!0}),b&&(0,r.createElement)(c.ToolbarItem,{as:u.ToolSelector,disabled:C,size:"compact"}),(0,r.createElement)(c.ToolbarItem,{as:B,size:"compact"}),(0,r.createElement)(c.ToolbarItem,{as:y,size:"compact"}),(0,r.createElement)(c.ToolbarItem,{as:I,size:"compact"}))),T&&b&&O&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("div",{className:s()("selected-block-tools-wrapper",{"is-collapsed":i})},(0,r.createElement)(u.BlockToolbar,{hideDragHandle:!0})),(0,r.createElement)(c.Popover.Slot,{name:"block-toolbar"}),S&&(0,r.createElement)(c.Button,{className:"edit-post-header__block-tools-toggle",icon:i?g.Z:E.Z,onClick:()=>{_((e=>!e))},label:i?(0,p.__)("Show block tools","woocommerce"):(0,p.__)("Hide block tools","woocommerce")}))),(0,r.createElement)("div",{className:"woocommerce-iframe-editor__header-right"},(0,r.createElement)(c.Button,{variant:"tertiary",className:"woocommerce-modal-actions__cancel-button",onClick:t,text:(0,p.__)("Cancel","woocommerce")}),(0,r.createElement)(c.Button,{variant:"primary",className:"woocommerce-modal-actions__done-button",onClick:e,text:(0,p.__)("Done","woocommerce")}),(0,r.createElement)(h.Ox.Slot,{scope:F.ai}),(0,r.createElement)(V,null)))}const Z=()=>{const e=(0,n.useRegistry)();return(0,r.useEffect)((()=>{e.register(h.h)}),[e]),null},A=20;function L({direction:e,resizeWidthBy:t}){return(0,r.createElement)(r.Fragment,null,(0,r.createElement)("button",{className:`resizable-editor__drag-handle is-${e}`,"aria-label":(0,p.__)("Drag to resize","woocommerce"),"aria-describedby":`resizable-editor__resize-help-${e}`,onKeyDown:function(o){const{keyCode:r}=o;"left"===e&&r===S.LEFT||"right"===e&&r===S.RIGHT?t(A):("left"===e&&r===S.RIGHT||"right"===e&&r===S.LEFT)&&t(-A)}}),(0,r.createElement)(c.VisuallyHidden,{id:`resizable-editor__resize-help-${e}`},(0,p.__)("Use left and right arrow keys to resize the canvas.","woocommerce")))}const U={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0};function W({enableResizing:e,height:t,children:o}){const[n,l]=(0,r.useState)("100%"),a=(0,r.useRef)(),i=(0,r.useCallback)((e=>{a.current&&l(a.current.offsetWidth+e)}),[]);return(0,r.createElement)(c.ResizableBox,{ref:e=>{a.current=null==e?void 0:e.resizable},size:{width:e?n:"100%",height:e&&t?t:"100%"},onResizeStop:(e,t,o)=>{l(o.style.width)},minWidth:300,maxWidth:"100%",maxHeight:"100%",minHeight:t,enable:{right:e,left:e},showHandle:e,resizeRatio:2,handleComponent:{left:(0,r.createElement)(L,{direction:"left",resizeWidthBy:i}),right:(0,r.createElement)(L,{direction:"right",resizeWidthBy:i})},handleClasses:void 0,handleStyles:{left:U,right:U}},o)}function G(){const{setIsInserterOpened:e}=(0,r.useContext)(w),t=(0,l.useViewportMatch)("medium","<"),{rootClientId:o}=(0,n.useSelect)((e=>{const{getBlockRootClientId:t}=e(u.store);return{rootClientId:t("")}})),c=(0,r.useCallback)((()=>e(!1)),[e]),a=(0,r.useCallback)((e=>{e.keyCode!==S.ESCAPE||e.defaultPrevented||(e.preventDefault(),c())}),[c]),i=(0,r.useRef)(null);return(0,r.useEffect)((()=>{var e,t;null===(t=null===(e=i.current)||void 0===e?void 0:e.focusSearch)||void 0===t||t.call(e)}),[]),(0,r.createElement)("div",{onKeyDown:a,className:"woocommerce-iframe-editor__inserter-panel"},(0,r.createElement)("div",{className:"woocommerce-iframe-editor__inserter-panel-content"},(0,r.createElement)(u.__experimentalLibrary,{showInserterHelpPanel:!0,shouldFocusBlock:t,rootClientId:o,ref:i,onClose:c,onSelect:()=>{t&&c()}})))}var K=o(59538);function X(){const{setIsDocumentOverviewOpened:e}=(0,r.useContext)(w),t=(0,l.useFocusOnMount)("firstElement"),o=(0,l.useFocusReturn)(),n=(0,l.useFocusReturn)(),[a,i]=(0,r.useState)(null),[s,m]=(0,r.useState)("list-view"),d=(0,r.useRef)(null),h=(0,l.useMergeRefs)([n,t,d,i]);return(0,r.createElement)("div",{className:"woocommerce-iframe-editor__document-overview-sidebar",onKeyDown:function(t){"Escape"!==t.code||t.defaultPrevented||(t.preventDefault(),e(!1))}},(0,r.createElement)(c.Button,{className:"woocommerce-iframe-editor__document-overview-sidebar-close-button",ref:o,icon:K.Z,label:(0,p.__)("Close","woocommerce"),onClick:()=>e(!1)}),(0,r.createElement)(c.TabPanel,{className:"woocommerce-iframe-editor__document-overview-sidebar-tab-panel",initialTabName:s,onSelect:m,tabs:[{name:"list-view",title:(0,p.__)("List View","woocommerce"),className:"woocommerce-iframe-editor__document-overview-sidebar-tab-item"}]},(e=>(0,r.createElement)("div",{className:"woocommerce-iframe-editor__document-overview-sidebar-tab-content",ref:h},"list-view"===e.name?(0,r.createElement)(u.__experimentalListView,{dropZoneElement:a}):null))))}function $(){const{isInserterOpened:e,isDocumentOverviewOpened:t}=(0,r.useContext)(w);return e?(0,r.createElement)(G,null):t?(0,r.createElement)(X,null):null}const J=(0,r.createElement)("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,r.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z"})),j=(0,r.createElement)("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},(0,r.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z"}));var q=o(1636);const Q=()=>(0,r.createElement)("strong",null,(0,p.__)("Settings","woocommerce")),Y=({smallScreenTitle:e})=>(0,r.createElement)(q.Q,{identifier:F.ZX,title:(0,p.__)("Settings","woocommerce"),icon:(0,p.isRTL)()?j:J,isActiveByDefault:!0,header:(0,r.createElement)(Q,null),closeLabel:(0,p.__)("Close settings","woocommerce"),smallScreenTitle:e},(0,r.createElement)(u.BlockInspector,null)),ee=50;var te=o(50528),oe=o(24705);const re=()=>{const{isDocumentOverviewOpened:e,redo:t,setIsDocumentOverviewOpened:o,undo:c}=(0,r.useContext)(w),{isSettingsSidebarOpen:l}=(0,n.useSelect)((e=>{const{getActiveComplementaryArea:t}=e(h.h);return{isSettingsSidebarOpen:t(F.ai)===F.ZX}}),[]),{disableComplementaryArea:a,enableComplementaryArea:i}=(0,n.useDispatch)(h.h);return(0,oe.useShortcut)("woocommerce/product-editor/modal-block-editor/undo",(e=>{c(),e.preventDefault()})),(0,oe.useShortcut)("woocommerce/product-editor/modal-block-editor/redo",(e=>{t(),e.preventDefault()})),(0,oe.useShortcut)("woocommerce/product-editor/modal-block-editor/toggle-list-view",(t=>{o(!e),t.preventDefault()})),(0,oe.useShortcut)("woocommerce/product-editor/modal-block-editor/toggle-sidebar",(e=>{l?a(F.ai):i(F.ai,F.ZX),e.preventDefault()})),null},ne=()=>{const{registerShortcut:e}=(0,n.useDispatch)(oe.store);return(0,r.useEffect)((()=>{e({name:"woocommerce/product-editor/modal-block-editor/undo",category:"global",description:(0,p.__)("Undo your last changes.","woocommerce"),keyCombination:{modifier:"primary",character:"z"}}),e({name:"woocommerce/product-editor/modal-block-editor/redo",category:"global",description:(0,p.__)("Redo your last undo.","woocommerce"),keyCombination:{modifier:"primaryShift",character:"z"},aliases:(0,S.isAppleOS)()?[]:[{modifier:"primary",character:"y"}]}),e({name:"woocommerce/product-editor/modal-block-editor/toggle-list-view",category:"global",description:(0,p.__)("Open the block list view.","woocommerce"),keyCombination:{modifier:"access",character:"o"}}),e({name:"woocommerce/product-editor/modal-block-editor/toggle-sidebar",category:"global",description:(0,p.__)("Show or hide the Settings sidebar.","woocommerce"),keyCombination:{modifier:"primaryShift",character:","}})}),[e]),null};function ce({onChange:e=(()=>{}),onClose:t,onInput:o=(()=>{}),settings:i,showBackButton:p=!1,name:_}){const[f]=(0,l.useResizeObserver)(),[g,E]=(0,r.useState)([]),k=(0,n.useSelect)((e=>e(te.h).getModalEditorBlocks()),[]),{setModalEditorBlocks:C,setModalEditorContentHasChanged:S}=(0,n.useDispatch)(te.h),{appendEdit:y,hasRedo:B,hasUndo:T,redo:I,undo:R}=function({maxHistory:e=ee,setBlocks:t}){const[o,n]=(0,r.useState)([]),[c,a]=(0,r.useState)(0),i=(0,l.useDebounce)((0,r.useCallback)((t=>{const r=[...o.slice(0,c+1),t].slice(-1*e);n(r),a(r.length-1)}),[o,e,c]),500),s=(0,r.useCallback)((()=>{i.flush();const e=Math.max(0,c-1);o[e]&&(t(o[e]),a(e))}),[i,o,c,t]),m=(0,r.useCallback)((()=>{i.flush();const e=Math.min(o.length-1,c+1);o[e]&&(t(o[e]),a(e))}),[i,o,c,t]);return{appendEdit:i,hasRedo:!!o.length&&c<o.length-1,hasUndo:!!o.length&&c>0,redo:m,undo:s}}({setBlocks:E});(0,r.useEffect)((()=>{y(k),E(k)}),[]);const[O,x]=(0,r.useState)(!1),[D,z]=(0,r.useState)(!1),{clearSelectedBlock:N,updateSettings:M}=(0,n.useDispatch)(u.store),V=(0,n.useSelect)((e=>e(u.store).getSettings()),[]),{hasFixedToolbar:A}=(0,n.useSelect)((e=>{const{get:t}=e(d.store);return{hasFixedToolbar:t("core","fixedToolbar")}}),[]);(0,r.useEffect)((()=>{M(productBlockEditorSettings)}),[]);const L=i||V,U=(0,m.isWpVersion)("6.5",">=")||(0,H.B)()>17.3;return(0,r.createElement)("div",{className:"woocommerce-iframe-editor"},(0,r.createElement)(w.Provider,{value:{hasRedo:B,hasUndo:T,isInserterOpened:O,isDocumentOverviewOpened:D,redo:I,setIsInserterOpened:x,setIsDocumentOverviewOpened:z,undo:R}},(0,r.createElement)(u.BlockEditorProvider,{settings:{...L,hasFixedToolbar:A||!U,templateLock:!1},value:g,onChange:t=>{y(t),E(t),e(t)},onInput:e=>{y(e),E(e),o(e)},useSubRegistry:!0},(0,r.createElement)(Z,null),(0,r.createElement)(re,null),(0,r.createElement)(ne,null),(0,r.createElement)(P,{onSave:()=>{C(function(e){if(!(null==e?void 0:e.length))return!0;if(1===e.length){const t=e[0];if("core/paragraph"===t.name){const{content:e,dropCap:o,backgroundColor:r,...n}=t.attributes,c=!e||!e.trim(),l=!!r,a=Object.keys(n).length>0;if(c&&!l&&!a)return!0}}return!1}(g)?[]:g),S(!0),e(g),null==t||t()},onCancel:()=>{C(k),e(k),E(k),null==t||t()}}),(0,r.createElement)("div",{className:"woocommerce-iframe-editor__main"},(0,r.createElement)($,null),(0,r.createElement)(u.BlockTools,{className:s()("woocommerce-iframe-editor__content",{"old-fixed-toolbar-shown":!U}),onClick:e=>{e.target===e.currentTarget&&N()}},(0,r.createElement)(u.BlockEditorKeyboardShortcuts.Register,null),p&&t&&(0,r.createElement)(b,{onClick:()=>{setTimeout(t,550)}}),(0,r.createElement)(W,{enableResizing:!0,height:"100%"},(0,r.createElement)(v,{enableResizing:!0,settings:L},f,(0,r.createElement)(u.BlockList,{className:"edit-site-block-editor__block-list wp-site-blocks"})),(0,r.createElement)(c.Popover.Slot,null)),(0,r.createElement)("div",{className:"woocommerce-iframe-editor__content-inserter-clipper"})),(0,r.createElement)(h.Vi.Slot,{scope:F.ai})),(0,r.createElement)(a.PluginArea,{scope:"woocommerce-product-editor-modal-block-editor"}),(0,r.createElement)(Y,{smallScreenTitle:_}))))}function le({initialBlocks:e,onChange:t,onClose:o,title:a,name:i}){const{closeModalEditor:s}=(0,n.useDispatch)(te.h),m=(0,l.useDebounce)((e=>{null==t||t(e)}),250);function d(){const e=m.flush();e&&(null==t||t(e)),s(),null==o||o()}return(0,r.createElement)(c.Modal,{className:"woocommerce-modal-editor",title:a,onRequestClose:d,shouldCloseOnClickOutside:!1},(0,r.createElement)(ce,{initialBlocks:e,onInput:m,onChange:m,onClose:d,name:i}))}}}]);