AlkantarClanX12
Current Path : /home/thanudqk/128shen.com/wp-content/plugins/tablepress/admin/js/build/ |
Current File : /home/thanudqk/128shen.com/wp-content/plugins/tablepress/admin/js/build/edit.js |
(()=>{"use strict";const e=window.wp.components,t=window.wp.i18n,s=window.React,l=window.ReactDOM,o=window.wp.hooks,a=window.ReactJSXRuntime,n=(e,t,s)=>{(0,o.addFilter)(`tablepress.${t}ScreenFeatures`,`tp/${e}/${t}-screen-feature`,(t=>[...t,e])),(0,o.addFilter)(`tablepress.${t}ScreenPortals`,`tp/${e}/${t}-screen-portal`,(t=>o=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t,{...o}),(0,l.createPortal)((0,a.jsx)(s,{...o}),document.getElementById(`tablepress-${e}-section`))]})))},r=window?.navigator?.platform?.includes("Mac")?(0,t._x)("⌘","keyboard shortcut modifier key on a Mac keyboard","tablepress"):(0,t._x)("Ctrl+","keyboard shortcut modifier key on a non-Mac keyboard","tablepress"),i=()=>(0,a.jsx)(e.__experimentalVStack,{style:{margin:"1.5rem 0"},children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[tp.screen_options.currentUserCanPreviewTable&&(0,a.jsx)(e.Button,{variant:"secondary",href:tp.screen_options.previewUrl,className:"button-preview",text:(0,t.__)("Preview","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$sP","keyboard shortcut for Preview","tablepress"),r)),onClick:e=>tp.callbacks.table_preview.process(e)}),(0,a.jsx)(e.Button,{variant:"primary",className:"button-save-changes",text:(0,t.__)("Save Changes","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$sS","keyboard shortcut for Save Changes","tablepress"),r)),onClick:e=>tp.callbacks.save_changes.process(e)})]})});n("tablepress_edit-buttons-1","edit",i),n("tablepress_edit-buttons-2","edit",i);const c=window.wp.element,p=e=>"#"===e[0]?document.getElementById(e.slice(1)):document.querySelectorAll(e);n("table-information","edit",(({tableMeta:l,updateTableMeta:o})=>{const[n,r]=(0,s.useState)(l.newId);return(0,s.useEffect)((()=>{r(l.newId)}),[l.newId]),(0,a.jsx)(e.__experimentalVStack,{spacing:"16px",style:{paddingTop:"6px"},children:(0,a.jsx)("table",{className:"tablepress-postbox-table fixed",children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsx)("th",{className:"column-1",scope:"row",children:(0,a.jsxs)("label",{htmlFor:"table-id",children:[(0,t.__)("Table ID","tablepress"),":"]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalHStack,{children:[(0,a.jsx)(e.TextControl,{__nextHasNoMarginBottom:!0,id:"table-id",title:(0,t.__)("The Table ID can only consist of letters, numbers, hyphens (-), and underscores (_).","tablepress"),pattern:"[A-Za-z1-9_\\-]|[A-Za-z0-9_\\-]{2,}",value:n,onChange:e=>r(e.replace(/[^0-9a-zA-Z_-]/g,"")),onBlur:e=>{if(l.newId!==n)return""===n||"0"===n?(window.alert((0,t.__)("This table ID is invalid. Please enter a different table ID.","tablepress")),r(l.newId),void e.target.focus()):void(window.confirm((0,t.__)("Do you really want to change the Table ID? All blocks and Shortcodes for this table in your posts and pages will have to be adjusted!","tablepress"))?(o({newId:n}),p("#table-information-shortcode").focus()):r(l.newId))},required:!0,readOnly:!tp.screen_options.currentUserCanEditTableId}),(0,a.jsx)("label",{htmlFor:"table-information-shortcode",children:(0,a.jsx)(e.__experimentalHStack,{alignment:"left",children:(0,c.createInterpolateElement)((0,t.__)("Shortcode: <input />","tablepress"),{input:(0,a.jsx)(e.TextControl,{__nextHasNoMarginBottom:!0,id:"table-information-shortcode",value:`[${tp.table.shortcode} id=${l.newId} /]`,onFocus:e=>e.target.select(),readOnly:!0})})})})]})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsx)("th",{className:"column-1",scope:"row",children:(0,a.jsxs)("label",{htmlFor:"table-name",children:[(0,t.__)("Table Name","tablepress"),":"]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.TextControl,{__nextHasNoMarginBottom:!0,id:"table-name",value:l.name,onChange:e=>o({name:e})})})]}),(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsx)("th",{className:"column-1 top-align",scope:"row",children:(0,a.jsxs)("label",{htmlFor:"table-description",children:[(0,t.__)("Description","tablepress"),":"]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.TextareaControl,{__nextHasNoMarginBottom:!0,id:"table-description",value:l.description,onChange:e=>o({description:e}),rows:"4"})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Last Modified","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,t.sprintf)((0,t.__)("%1$s by %2$s","tablepress"),l.lastModified,l.lastEditor)})]})]})})})}));const d=window?.navigator?.platform?.includes("Mac")?(0,t._x)("⌘","keyboard shortcut modifier key on a Mac keyboard","tablepress"):(0,t._x)("Ctrl+","keyboard shortcut modifier key on a non-Mac keyboard","tablepress");n("table-manipulation","edit",(()=>{const[l,o]=(0,s.useState)(1),[n,r]=(0,s.useState)(1),i=(e,s)=>{tp.helpers.move_allowed(s,e)?tp.callbacks.move(e,s):window.alert((0,t.__)("You can not do this move, because you reached the border of the table.","tablepress"))},p=e=>{const s="rows"===e;(s?tp.editor.options.data.length:tp.editor.options.columns.length)!==tp.helpers.selection[e].length?tp.callbacks.remove(e):window.alert(s?(0,t.__)("You can not delete all table rows!","tablepress"):(0,t.__)("You can not delete all table columns!","tablepress"))};return(0,a.jsx)(e.__experimentalVStack,{spacing:"16px",style:{paddingTop:"6px"},children:(0,a.jsx)("table",{className:"tablepress-postbox-table fixed",children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsx)("td",{className:"column-1",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected cells","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Insert Link","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$sL","keyboard shortcut for Insert Link","tablepress"),d)),onClick:()=>tp.callbacks.insert_link.open_dialog()}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Insert Image","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$sI","keyboard shortcut for Insert Image","tablepress"),d)),onClick:()=>tp.callbacks.insert_image.open_dialog()}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Advanced Editor","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$sE","keyboard shortcut for Advanced Editor","tablepress"),d)),onClick:()=>tp.callbacks.advanced_editor.open_dialog()})]})]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected cells","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Combine/Merge","tablepress"),onClick:()=>{tp.helpers.cell_merge_allowed("alert")&&tp.callbacks.merge_cells()}}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("?","tablepress"),title:(0,t.__)("Help on combining cells","tablepress"),onClick:()=>tp.callbacks.help_box.open_dialog("#help-box-combine-cells")})]})]})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsx)("td",{className:"column-1",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected rows","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Duplicate","tablepress"),onClick:()=>tp.callbacks.insert_duplicate("duplicate","rows")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Insert","tablepress"),onClick:()=>tp.callbacks.insert_duplicate("insert","rows")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Delete","tablepress"),onClick:()=>p("rows")})]})]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected columns","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Duplicate","tablepress"),onClick:()=>tp.callbacks.insert_duplicate("duplicate","columns")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Insert","tablepress"),onClick:()=>tp.callbacks.insert_duplicate("insert","columns")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Delete","tablepress"),onClick:()=>p("columns")})]})]})})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"column-1",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected rows","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Move up","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$s⇧↑","keyboard shortcut for Move up","tablepress"),d)),onClick:()=>i("up","rows")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Move down","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$s⇧↓","keyboard shortcut for Move down","tablepress"),d)),onClick:()=>i("down","rows")})]})]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected columns","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Move left","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$s⇧←","keyboard shortcut for Move left","tablepress"),d)),onClick:()=>i("left","columns")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Move right","tablepress"),title:(0,t.sprintf)((0,t.__)("Keyboard Shortcut: %s","tablepress"),(0,t.sprintf)((0,t._x)("%1$s⇧→","keyboard shortcut for Move right","tablepress"),d)),onClick:()=>i("right","columns")})]})]})})]}),(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsx)("td",{className:"column-1",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected rows","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Hide","tablepress"),onClick:()=>tp.callbacks.hide_unhide("hide","rows")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Show","tablepress"),onClick:()=>tp.callbacks.hide_unhide("unhide","rows")})]})]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsxs)("span",{children:[(0,t.__)("Selected columns","tablepress"),":"]}),(0,a.jsxs)(e.__experimentalHStack,{spacing:"4px",alignment:"left",expanded:!1,wrap:!0,children:[(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Hide","tablepress"),onClick:()=>tp.callbacks.hide_unhide("hide","columns")}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Show","tablepress"),onClick:()=>tp.callbacks.hide_unhide("unhide","columns")})]})]})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsx)("td",{className:"column-1",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsx)("label",{htmlFor:"rows-append-number",children:(0,a.jsx)(e.__experimentalHStack,{children:(0,c.createInterpolateElement)((0,t.__)("Add <input /> row(s)","tablepress"),{input:(0,a.jsx)(e.__experimentalNumberControl,{id:"rows-append-number",title:(0,t.__)("This field must contain a positive number.","tablepress"),isDragEnabled:!1,value:n,onChange:e=>{e=""!==e?parseInt(e,10):1,r(e)},min:1,required:!0,style:{width:"55px"}})})})}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Add","tablepress"),onClick:()=>tp.callbacks.append("rows",n)})]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalHStack,{alignment:"left",children:[(0,a.jsx)("label",{htmlFor:"columns-append-number",children:(0,a.jsx)(e.__experimentalHStack,{children:(0,c.createInterpolateElement)((0,t.__)("Add <input /> column(s)","tablepress"),{input:(0,a.jsx)(e.__experimentalNumberControl,{id:"columns-append-number",title:(0,t.__)("This field must contain a positive number.","tablepress"),isDragEnabled:!1,value:l,onChange:e=>{e=""!==e?parseInt(e,10):1,o(e)},min:1,required:!0,style:{width:"55px"}})})})}),(0,a.jsx)(e.Button,{variant:"secondary",size:"compact",text:(0,t.__)("Add","tablepress"),onClick:()=>tp.callbacks.append("columns",l)})]})})]})]})})})})),n("table-options","edit",(({tableOptions:s,updateTableOptions:l})=>(0,a.jsx)(e.__experimentalVStack,{spacing:"16px",style:{paddingTop:"6px"},children:(0,a.jsx)("table",{className:"tablepress-postbox-table fixed",children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Table Header","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)("label",{htmlFor:"option-table_head",children:(0,a.jsx)(e.__experimentalHStack,{alignment:"left",children:(0,c.createInterpolateElement)((0,t.__)("The first <input /> rows are the table header.","tablepress"),{input:(0,a.jsx)(e.__experimentalNumberControl,{id:"option-table_head",title:(0,t.__)("This field must contain a non-negative number.","tablepress"),isDragEnabled:!1,value:s.table_head,onChange:e=>{e=""!==e?parseInt(e,10):0,l({table_head:e})},min:0,max:9,required:!0,style:{width:"65px"}})})})})})]}),(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Table Footer","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)("label",{htmlFor:"option-table_foot",children:(0,a.jsx)(e.__experimentalHStack,{alignment:"left",children:(0,c.createInterpolateElement)((0,t.__)("The last <input /> rows are the table footer.","tablepress"),{input:(0,a.jsx)(e.__experimentalNumberControl,{id:"option-table_foot",title:(0,t.__)("This field must contain a non-negative number.","tablepress"),isDragEnabled:!1,value:s.table_foot,onChange:e=>{e=""!==e?parseInt(e,10):0,l({table_foot:e})},min:0,max:9,required:!0,style:{width:"65px"}})})})})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Alternating Row Colors","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("The background colors of consecutive rows shall alternate.","tablepress"),checked:s.alternating_row_colors,onChange:e=>l({alternating_row_colors:e})})})]}),(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Row Hover Highlighting","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Highlight a row while the mouse cursor hovers above it by changing its background color.","tablepress"),checked:s.row_hover,onChange:e=>l({row_hover:e})})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Print Table Name","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"checkbox-select-in-label",label:(0,c.createInterpolateElement)((0,t._x)("Show the table name <select /> the table.","position (above or below)","tablepress"),{select:(0,a.jsx)(e.SelectControl,{__nextHasNoMarginBottom:!0,value:s.print_name_position,disabled:!s.print_name,onChange:e=>l({print_name_position:e}),options:[{label:(0,t.__)("above","tablepress"),value:"above"},{label:(0,t.__)("below","tablepress"),value:"below"}]})}),checked:s.print_name,onChange:e=>l({print_name:e})})})]}),(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Print Table Description","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,className:"checkbox-select-in-label",label:(0,c.createInterpolateElement)((0,t._x)("Show the table description <select /> the table.","position (above or below)","tablepress"),{select:(0,a.jsx)(e.SelectControl,{__nextHasNoMarginBottom:!0,value:s.print_description_position,disabled:!s.print_description,onChange:e=>l({print_description_position:e}),options:[{label:(0,t.__)("above","tablepress"),value:"above"},{label:(0,t.__)("below","tablepress"),value:"below"}]})}),checked:s.print_description,onChange:e=>l({print_description:e})})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsx)("th",{className:"column-1 top-align",scope:"row",children:(0,a.jsxs)("label",{htmlFor:"option-extra_css_classes",children:[(0,t.__)("Extra CSS Classes","tablepress"),":"]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsxs)(e.__experimentalVStack,{children:[(0,a.jsx)(e.FormTokenField,{__nextHasNoMarginBottom:!0,id:"option-extra_css_classes",label:"",className:"code",title:(0,t.__)("This field can only contain letters, numbers, spaces, hyphens (-), underscores (_), and colons (:).","tablepress"),pattern:"[A-Za-z0-9 _:\\-]*",onChange:e=>l({extra_css_classes:e.join(" ").trim().replace(/[^A-Za-z0-9 _:-]/g,"")}),value:""!==s.extra_css_classes?s.extra_css_classes.split(" "):[],tokenizeOnBlur:!0,tokenizeOnSpace:!0,__experimentalShowHowTo:!1}),(0,a.jsx)("span",{style:{fontSize:"12px",color:"#757575"},children:(0,c.createInterpolateElement)((0,t.__)("Additional CSS classes for styling purposes can be entered here.","tablepress")+" "+(0,t.__)("This is NOT the place to enter <a>Custom CSS</a> code!","tablepress"),{a:(0,a.jsx)("a",{href:tp.screen_options.optionsUrl})})})]})})]})]})})}))),n("datatables-features","edit",(({tableOptions:s,updateTableOptions:l})=>{const o=s.table_head>0,n=o&&s.use_datatables;return(0,a.jsxs)(e.__experimentalVStack,{spacing:"16px",style:{paddingTop:"6px"},children:[!o&&(0,a.jsx)("span",{children:(0,a.jsx)("em",{children:(0,t.sprintf)((0,t.__)("These features and options are only available when the “%1$s” setting in the “%2$s” section is used.","tablepress"),(0,t.__)("Table Header","tablepress"),(0,t.__)("Table Options","tablepress"))})}),(0,a.jsx)("table",{className:"tablepress-postbox-table fixed",children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{className:"bottom-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Enable Visitor Features","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Offer the following functions for site visitors with this table:","tablepress"),checked:s.use_datatables,disabled:!o,onChange:e=>{e&&(tp.helpers.visibility.update(),tp.helpers.editor.has_merged_body_cells()&&(e=!1,window.alert((0,t.__)("You can not enable the Table Features for Site Visitors, because your table’s body rows contain combined/merged cells.","tablepress")))),l({use_datatables:e})}})})]}),(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Sorting","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable sorting of the table by the visitor.","tablepress"),checked:s.datatables_sort,disabled:!n,onChange:e=>l({datatables_sort:e})})})]}),(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Search/Filtering","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable the visitor to filter or search the table. Only rows with the search word in them are shown.","tablepress"),checked:s.datatables_filter,disabled:!n,onChange:e=>l({datatables_filter:e})})})]}),(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Pagination","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable pagination of the table (viewing only a certain number of rows at a time) by the visitor.","tablepress"),checked:s.datatables_paginate,disabled:!n,onChange:e=>l({datatables_paginate:e})})})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"column-1",scope:"row"}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)("label",{htmlFor:"option-datatables_paginate_entries",children:(0,a.jsx)(e.__experimentalHStack,{alignment:"left",style:{paddingLeft:"24px"},children:(0,c.createInterpolateElement)((0,t.__)("Show <input /> rows per page.","tablepress"),{input:(0,a.jsx)(e.__experimentalNumberControl,{id:"option-datatables_paginate_entries",title:(0,t.__)("This field must contain a non-negative number.","tablepress"),isDragEnabled:!1,value:s.datatables_paginate_entries,disabled:!n||!s.datatables_paginate,onChange:e=>{e=""!==e?parseInt(e,10):1,l({datatables_paginate_entries:e})},min:1,required:!0,style:{width:"65px"}})})})})})]}),(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Pagination Length Change","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Allow the visitor to change the number of rows shown when using pagination.","tablepress"),checked:s.datatables_lengthchange,disabled:!n||!s.datatables_paginate,onChange:e=>l({datatables_lengthchange:e})})})]}),(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Info","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable the table information display, with information about the currently visible data, like the number of rows.","tablepress"),checked:s.datatables_info,disabled:!n,onChange:e=>l({datatables_info:e})})})]}),(0,a.jsxs)("tr",{className:tp.screen_options.showCustomCommands?"bottom-border":void 0,children:[(0,a.jsxs)("th",{className:"column-1",scope:"row",children:[(0,t.__)("Horizontal Scrolling","tablepress"),":"]}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,t.__)("Enable horizontal scrolling, to make viewing tables with many columns easier.","tablepress"),checked:s.datatables_scrollx,disabled:!n,onChange:e=>l({datatables_scrollx:e})})})]}),tp.screen_options.showCustomCommands&&(0,a.jsxs)("tr",{className:"top-border",children:[(0,a.jsx)("th",{className:"column-1 top-align",scope:"row",children:(0,a.jsxs)("label",{htmlFor:"option-datatables_custom_commands",children:[(0,t.__)("Custom Commands","tablepress"),":"]})}),(0,a.jsx)("td",{className:"column-2",children:(0,a.jsx)(e.TextareaControl,{__nextHasNoMarginBottom:!0,id:"option-datatables_custom_commands",rows:"1",className:"code",value:s.datatables_custom_commands,disabled:!n,onChange:e=>l({datatables_custom_commands:e}),help:(0,c.createInterpolateElement)((0,t.__)("Additional parameters from the <a>DataTables documentation</a> to be added to the JS call.","tablepress")+" "+(0,t.__)("For advanced use only.","tablepress"),{a:(0,a.jsx)("a",{href:"https://datatables.net/"})})})})]})]})})]})}));const b=window.wp.url;window.tp=window.tp||{},tp.made_changes=!1,tp.helpers=tp.helpers||{},tp.helpers.selection=tp.helpers.selection||{rows:[0],columns:[0]},tp.helpers.unsaved_changes=tp.helpers.unsaved_changes||{},tp.helpers.unsaved_changes.unload_dialog=function(e){e.preventDefault(),e.returnValue=""},tp.helpers.unsaved_changes.set=function(){tp.made_changes||(tp.made_changes=!0,window.addEventListener("beforeunload",tp.helpers.unsaved_changes.unload_dialog))},tp.helpers.unsaved_changes.unset=function(){tp.made_changes=!1,window.removeEventListener("beforeunload",tp.helpers.unsaved_changes.unload_dialog)},tp.helpers.meta=tp.helpers.meta||{},tp.helpers.meta.update=function(e){tp.table.meta={...tp.table.meta,...e},(0,o.doAction)("tablepress.metaUpdated",e),tp.helpers.unsaved_changes.set()},tp.helpers.visibility=tp.helpers.visibility||{},tp.helpers.visibility.load=function(){const e=tp.table.visibility.rows.length,t=tp.table.visibility.columns.length,s={};for(let l=0;l<e;l++)if(1!==tp.table.visibility.rows[l])for(let e=0;e<t;e++){const t=jspreadsheet.getColumnNameFromId([e,l]);s[t]=s[t]||{},s[t].row_hidden=!0}for(let l=0;l<t;l++)if(1!==tp.table.visibility.columns[l])for(let t=0;t<e;t++){const e=jspreadsheet.getColumnNameFromId([l,t]);s[e]=s[e]||{},s[e].column_hidden=!0}return s},tp.helpers.visibility.update=function(){tp.table.visibility.rows=[];for(let e=0;e<tp.editor.options.data.length;e++)tp.table.visibility.rows[e]=1;tp.table.visibility.columns=[];for(let e=0;e<tp.editor.options.columns.length;e++)tp.table.visibility.columns[e]=1;Object.keys(tp.editor.options.meta).forEach((function(e){const t=jspreadsheet.getIdFromColumnName(e,!0);1===tp.table.visibility.rows[t[1]]&&tp.editor.options.meta[e].row_hidden&&(tp.table.visibility.rows[t[1]]=0),1===tp.table.visibility.columns[t[0]]&&tp.editor.options.meta[e].column_hidden&&(tp.table.visibility.columns[t[0]]=0)}))},tp.helpers.visibility.selection_contains=function(e,t){return tp.helpers.selection[e].some((s=>tp.table.visibility[e][s]===t))},tp.helpers.move_allowed=function(e,t){let s=tp.helpers.selection[e][0],l=0;return"down"!==t&&"right"!==t&&"bottom"!==t&&"last"!==t||(s=tp.helpers.selection[e][tp.helpers.selection[e].length-1],l="rows"===e?tp.editor.options.data.length-1:tp.editor.options.columns.length-1),l!==s},tp.helpers.cell_merge_allowed=function(e,s={}){const l="alert"===e,o=tp.helpers.selection.rows[0],a=tp.helpers.selection.rows[tp.helpers.selection.rows.length-1],n=tp.table.options.table_head,r=tp.editor.options.data.length-1-tp.table.options.table_foot;return!(tp.table.options.table_head>0&&tp.table.options.use_datatables)||o<n&&a<n||o>r&&a>r?o<n&&a>=n?(s.text=(0,t.sprintf)((0,t.__)("You can not combine these cells, because the “%1$s” setting in the “%2$s” section is active.","tablepress"),(0,t.__)("Table Header","tablepress"),(0,t.__)("Table Options","tablepress")),l&&window.alert(s.text),!1):!(o<=r&&a>r&&(s.text=(0,t.sprintf)((0,t.__)("You can not combine these cells, because the “%1$s” setting in the “%2$s” section is active.","tablepress"),(0,t.__)("Table Footer","tablepress"),(0,t.__)("Table Options","tablepress")),l&&window.alert(s.text),1)):(s.text=(0,t.sprintf)((0,t.__)("You can not combine these cells, because the “%1$s” checkbox in the “%2$s” section is checked.","tablepress"),(0,t.__)("Enable Visitor Features","tablepress"),(0,t.__)("Table Features for Site Visitors","tablepress"))+" "+(0,t.__)("When the Table Features for Site Visitors are used, merging is only allowed in the table header and footer rows.","tablepress"),l&&window.alert(s.text),!1)},tp.helpers.editor=tp.helpers.editor||{},tp.helpers.editor.reselect=function(e,t){void 0===t&&(t=tp.editor),t.updateSelectionFromCoords(tp.helpers.selection.columns[0],tp.helpers.selection.rows[0],tp.helpers.selection.columns[tp.helpers.selection.columns.length-1],tp.helpers.selection.rows[tp.helpers.selection.rows.length-1])},tp.helpers.editor.has_merged_body_cells=function(){const e=tp.table.options.table_head,t=tp.editor.options.data.length-tp.table.options.table_foot,s=tp.editor.options.columns.length;for(let l=e;l<t;l++)for(let e=0;e<s;e++)if(("#rowspan#"===tp.editor.options.data[l][e]||"#colspan#"===tp.editor.options.data[l][e])&&1===tp.table.visibility.rows[l]&&1===tp.table.visibility.columns[e])return!0;return!1},tp.helpers.editor.sorting=function(e){return e=e?-1:1,function(t,s){const l=t[1].localeCompare(s[1],void 0,{numeric:!0,sensitivity:"base"});return e*l}},tp.callbacks=tp.callbacks||{},tp.callbacks.editor=tp.callbacks.editor||{},tp.callbacks.editor.onselection=function(e,t,s,l,o){tp.helpers.selection={rows:[],columns:[]};for(let e=s;e<=o;e++)tp.helpers.selection.rows.push(e);for(let e=t;e<=l;e++)tp.helpers.selection.columns.push(e)},tp.callbacks.editor.onupdatetable=function(e,t,s,l,o,a,n){const r=e.jspreadsheet.options.meta[n];if(t.classList.toggle("column-hidden",Boolean(r?.column_hidden)),0===s&&(t.parentNode.classList.toggle("row-hidden",Boolean(r?.row_hidden)),t.parentNode.classList.remove("head-row","foot-row"),l===e.jspreadsheet.rows.length-1)){const t=e.jspreadsheet.content.querySelectorAll(":scope tbody tr:not(.row-hidden)");for(let e=0;e<tp.table.options.table_head;e++)t[e]?.classList.add("head-row");if(t.length>=tp.table.options.table_head+tp.table.options.table_foot){const e=t.length-1;for(let s=0;s<tp.table.options.table_foot;s++)t[e-s]?.classList.add("foot-row")}}},tp.callbacks.editor.oninsertroc=function(e,t,s,l,o,a,n){const r="rows"===e,i=r?"column_hidden":"row_hidden",c="duplicate"===t,p=l+(n?o:0),d=r?tp.editor.options.columns.length:tp.editor.options.data.length,b={};for(let e=0;e<d;e++){const t=r?[e,p]:[p,e],s=tp.editor.options.meta[jspreadsheet.getColumnNameFromId(t)];s&&(c?b[e]=s:s[i]&&(b[e]=b[e]||{},b[e][i]=!0))}const h=Object.keys(b);if(!h.length)return;const _={};n||l++;for(let e=0;e<o;e++){const t=l+e;h.forEach((function(e){const s=r?[e,t]:[t,e];_[jspreadsheet.getColumnNameFromId(s)]=b[e]}))}tp.editor.setMeta(_),tp.editor.updateTable()},tp.callbacks.editor.onmove=function(){tp.helpers.editor.reselect(),tp.helpers.unsaved_changes.set()},tp.callbacks.editor.onsort=function(){tp.editor.updateTable(),tp.helpers.unsaved_changes.set()},tp.helpers.editor.insert_from_helper_textarea=function(){tp.editor.setValueFromCoords(tp.helpers.selection.columns[0],tp.helpers.selection.rows[0],this.value)},tp.callbacks.insert_link={},tp.callbacks.insert_link.open_dialog=function(e=null){const s=p("#textarea-insert-helper");s.value=tp.editor.options.data[tp.helpers.selection.rows[0]][tp.helpers.selection.columns[0]],e?(s.selectionStart=e.selectionStart,s.selectionEnd=e.selectionEnd):(s.selectionStart=s.value.length,s.selectionEnd=s.value.length);const l=jexcel.getColumnNameFromId([tp.helpers.selection.columns[0],tp.helpers.selection.rows[0]]);p("#link-modal-title").textContent=(0,t.sprintf)((0,t.__)("Insert Link into cell %1$s","tablepress"),l),wpLink.open("textarea-insert-helper"),jexcel.current=null},tp.callbacks.insert_image={},tp.callbacks.insert_image.open_dialog=function(e=null){const s=p("#textarea-insert-helper");s.value=tp.editor.options.data[tp.helpers.selection.rows[0]][tp.helpers.selection.columns[0]],e?(s.selectionStart=e.selectionStart,s.selectionEnd=e.selectionEnd):(s.selectionStart=s.value.length,s.selectionEnd=s.value.length),wp.media.editor.open("textarea-insert-helper",{frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0});const l=jexcel.getColumnNameFromId([tp.helpers.selection.columns[0],tp.helpers.selection.rows[0]]);document.querySelector("#media-frame-title h1").textContent=(0,t.sprintf)((0,t.__)("Add media to cell %1$s","tablepress"),l),jexcel.current=null},tp.callbacks.advanced_editor={},tp.callbacks.advanced_editor.$textarea=p("#advanced-editor-content"),tp.callbacks.advanced_editor.open_dialog=function(e=null){tp.callbacks.advanced_editor.$textarea.value=tp.editor.options.data[tp.helpers.selection.rows[0]][tp.helpers.selection.columns[0]];const s=jexcel.getColumnNameFromId([tp.helpers.selection.columns[0],tp.helpers.selection.rows[0]]),l=(0,t.sprintf)((0,t.__)("Advanced Editor for cell %1$s","tablepress"),s);p("#advanced-editor-label").textContent=l,p("#link-modal-title").textContent=(0,t.sprintf)((0,t.__)("Insert Link into cell %1$s","tablepress"),s),jQuery("#advanced-editor").wpdialog({width:600,modal:!0,title:l,resizable:!1,closeOnEscape:!0,buttons:[{text:(0,t.__)("Cancel","tablepress"),class:"button button-cancel",click(){jQuery(this).wpdialog("close")}},{text:(0,t.__)("OK","tablepress"),class:"button button-primary button-ok",click:tp.callbacks.advanced_editor.confirm_save}]}),jexcel.current=null,e?(tp.callbacks.advanced_editor.$textarea.selectionStart=e.selectionStart,tp.callbacks.advanced_editor.$textarea.selectionEnd=e.selectionEnd):(tp.callbacks.advanced_editor.$textarea.selectionStart=tp.callbacks.advanced_editor.$textarea.value.length,tp.callbacks.advanced_editor.$textarea.selectionEnd=tp.callbacks.advanced_editor.$textarea.value.length),tp.callbacks.advanced_editor.$textarea.focus()},tp.callbacks.advanced_editor.confirm_save=function(){const e=tp.editor.options.data[tp.helpers.selection.rows[0]][tp.helpers.selection.columns[0]];tp.callbacks.advanced_editor.$textarea.value!==e&&tp.editor.setValueFromCoords(tp.helpers.selection.columns[0],tp.helpers.selection.rows[0],tp.callbacks.advanced_editor.$textarea.value),jQuery(this).wpdialog("close")},tp.callbacks.help_box={},tp.callbacks.help_box.open_dialog=function(e){"string"!=typeof e&&(e=e.target.dataset.helpBox);const s=p(e);jQuery(s).wpdialog({height:s.dataset.height,width:s.dataset.width,minWidth:260,modal:!0,closeOnEscape:!0,buttons:[{text:(0,t.__)("OK","tablepress"),class:"button button-ok",click(){jQuery(this).wpdialog("close")}}],open(){jQuery(this).next().find(".button-ok").trigger("focus")}})},tp.callbacks.table_preview={},tp.callbacks.table_preview.process=function(e){e.preventDefault();let s=tp.table.meta.name;if(""===s.trim()&&(s=(0,t.__)("(no name)","tablepress")),tp.callbacks.table_preview.$dialog=jQuery("#table-preview").wpdialog({autoOpen:!1,width:window.innerWidth-80,height:window.innerHeight-80,modal:!0,title:(0,t.sprintf)((0,t.__)("Preview of table “%1$s” (ID %2$s)","tablepress"),s,tp.table.id),closeOnEscape:!0,buttons:[{text:(0,t.__)("OK","tablepress"),class:"button button-ok",click(){jQuery(this).wpdialog("close")}}]}),!tp.made_changes){const t=p("#table-preview-iframe");return t.src=e.target.href,t.removeAttribute("srcdoc"),void tp.callbacks.table_preview.$dialog.wpdialog("open")}tp.helpers.visibility.update();const l={action:"tablepress_preview_table",_ajax_nonce:tp.nonces.preview_table,tablepress:{id:tp.table.id,new_id:tp.table.meta.newId,name:tp.table.meta.name,description:tp.table.meta.description,data:JSON.stringify(tp.editor.options.data),options:JSON.stringify(tp.table.options),visibility:JSON.stringify(tp.table.visibility),number:{rows:tp.editor.options.data.length,columns:tp.editor.options.columns.length}}};e.target.parentNode.insertAdjacentHTML("beforeend",`<span id="spinner-table-preview" class="spinner-table-preview spinner is-active" title="${(0,t.__)("The Table Preview is being loaded …","tablepress")}"></span>`),p(".button-preview").forEach((e=>e.classList.add("disabled"))),document.body.classList.add("wait"),fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:(0,b.buildQueryString)(l)}).then((e=>{if(!e.ok)throw new Error(`There was a problem with the server, HTTP response code ${e.status} (${e.statusText}).`);return e.json()})).then((e=>{if(null==e||"-1"===e||void 0===e.success)throw new Error("The JSON data returned from the server is unclear or incomplete.");if(!0!==e.success)throw new Error("The preview could not be loaded.");tp.callbacks.table_preview.success(e)})).catch((e=>tp.callbacks.table_preview.error(e.message))).finally((()=>{p("#spinner-table-preview").remove(),p(".button-preview").forEach((e=>e.classList.remove("disabled"))),document.body.classList.remove("wait")}))},tp.callbacks.table_preview.success=function(e){const t=p("#table-preview-iframe");t.src="",t.srcdoc=`<!DOCTYPE html><html><head>${e.head_html}</head><body>${e.body_html}</body></html>`,tp.callbacks.table_preview.$dialog.wpdialog("open")},tp.callbacks.table_preview.error=function(e){e=(0,t.__)("Attention: Unfortunately, an error occurred.","tablepress")+" "+e+"<br>"+(0,t.sprintf)((0,t.__)('Please see the <a href="%s" target="_blank">TablePress FAQ page</a> for suggestions.',"tablepress"),"https://tablepress.org/faq/common-errors/");const s=`show-preview-${Date.now()}`;p("#spinner-table-preview").parentNode.insertAdjacentHTML("afterend",`<div id="${s}" class="ajax-alert notice notice-error"><p>${e}</p></div>`);const l=p(`#${s}`);l.offsetWidth,l.style.opacity=0,l.addEventListener("transitionend",(e=>{e.target.matches(".notice")&&l.remove()}))},tp.callbacks.save_changes={},tp.callbacks.save_changes.process=function(e){if(!(0,o.applyFilters)("tablepress.optionsValidateFields",!0,tp.table.options))return;tp.helpers.visibility.update();const s={action:"tablepress_save_table",_ajax_nonce:tp.nonces.edit_table,tablepress:{id:tp.table.id,new_id:tp.table.meta.newId,name:tp.table.meta.name,description:tp.table.meta.description,data:JSON.stringify(tp.editor.options.data),options:JSON.stringify(tp.table.options),visibility:JSON.stringify(tp.table.visibility),number:{rows:tp.editor.options.data.length,columns:tp.editor.options.columns.length}}};e.target.parentNode.insertAdjacentHTML("beforeend",`<span id="spinner-save-changes" class="spinner-save-changes spinner is-active" title="${(0,t.__)("Changes are being saved …","tablepress")}"></span>`),p(".button-save-changes").forEach((e=>e.disabled=!0)),document.body.classList.add("wait"),fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:(0,b.buildQueryString)(s)}).then((e=>{if(!e.ok)throw new Error(`There was a problem with the server, HTTP response code ${e.status} (${e.statusText}).`);return e.json()})).then((e=>{if(null==e||"-1"===e||void 0===e.success)throw new Error("The JSON data returned from the server is unclear or incomplete.");if(!0!==e.success){const s=(0,t.__)("These errors were encountered:","tablepress"),l=e.error_details?`</p><p>${s}</p><pre>${e.error_details}</pre><p>`:"";throw new Error(`The table could not be saved to the database properly.${l}`)}tp.callbacks.save_changes.success(e)})).catch((e=>tp.callbacks.save_changes.error(e.message))).finally((()=>{p("#spinner-save-changes").remove(),p(".button-save-changes").forEach((e=>e.disabled=!1)),document.body.classList.remove("wait")}))},tp.callbacks.save_changes.success=function(e){tp.table.id!==e.table_id&&window?.history?.pushState&&window.history.pushState("","",window.location.href.replace(/table_id=[a-zA-Z0-9_-]+/gi,`table_id=${e.table_id}`)),tp.table.id=e.table_id,tp.helpers.meta.update({newId:e.table_id,lastModified:e.last_modified,lastEditor:e.last_editor}),tp.nonces.edit_table=e.new_edit_nonce,tp.nonces.preview_table=e.new_preview_nonce,tp.nonces.copy_table=e.new_copy_nonce,tp.nonces.delete_table=e.new_delete_nonce,["preview","copy","delete"].forEach((t=>{p(`.button-${t}`).forEach((s=>{s.href=s.href.replace(/item=[a-zA-Z0-9_-]+/g,`item=${e.table_id}`).replace(/&_wpnonce=[a-zA-Z0-9]+/g,`&_wpnonce=${e[`new_${t}_nonce`]}`)}))})),p(".button-export").forEach((t=>{t.href=t.href.replace(/table_id=[a-zA-Z0-9_-]+/g,`table_id=${e.table_id}`)})),tp.helpers.unsaved_changes.unset();const s={};if(s.success_save=(0,t.__)("The table was saved successfully.","tablepress"),s.success_save_success_id_change=s.success_save+" "+(0,t.__)("The table ID was changed.","tablepress"),s.success_save_error_id_change=s.success_save+" "+(0,t.__)("The table ID could not be changed, probably because the new ID is already in use!","tablepress"),"success_save_error_id_change"===e.message&&e.error_details){const l=(0,t.__)("These errors were encountered:","tablepress");s.success_save_error_id_change+=`</p><p>${l}</p><pre>${e.error_details}</pre><p>`}const l=e.message.includes("error")?"error":"success";tp.callbacks.save_changes.after_saving_notice(l,s[e.message])},tp.callbacks.save_changes.error=function(e){e=(0,t.__)("Attention: Unfortunately, an error occurred.","tablepress")+" "+e+"<br>"+(0,t.sprintf)((0,t.__)('Please see the <a href="%s" target="_blank">TablePress FAQ page</a> for suggestions.',"tablepress"),"https://tablepress.org/faq/common-errors/"),tp.callbacks.save_changes.after_saving_notice("error",e)},tp.callbacks.save_changes.after_saving_notice=function(e,t){const s=`save-changes-${Date.now()}`;p("#spinner-save-changes").parentNode.insertAdjacentHTML("afterend",`<div id="${s}" class="ajax-alert notice notice-${e}"><p>${t}</p></div>`);const l=p(`#${s}`);l.offsetWidth,l.style.opacity=0,l.addEventListener("transitionend",(e=>{e.target.matches(".notice")&&l.remove()}))},tp.callbacks.insert_duplicate=function(e,t,s="before"){const l="rows"===t,o=l?tp.editor.insertRow:tp.editor.insertColumn,a=l?tp.editor.getRowData:tp.editor.getColumnData,n="duplicate"===e;tp.editor.options[l?"oninsertrow":"oninsertcolumn"]=tp.callbacks.editor.oninsertroc.bind(null,t,e),tp.helpers.selection[t].forEach((function(e,t){const l=e+t,r=n?a(l):1;o(r,l,"before"===s)})),tp.helpers.unsaved_changes.set();const r=tp.helpers.selection[t].length;r>1&&tp.editor.updateSelectionFromCoords(tp.helpers.selection.columns[0],tp.helpers.selection.rows[0],l?tp.helpers.selection.columns[tp.helpers.selection.columns.length-1]:tp.helpers.selection.columns[tp.helpers.selection.columns.length-1]+r,l?tp.helpers.selection.rows[tp.helpers.selection.rows.length-1]+r:tp.helpers.selection.rows[tp.helpers.selection.rows.length-1])},tp.callbacks.remove=function(e){const t="rows"===e,s=t?tp.editor.options.columns.length:tp.editor.options.data.length,l=t?tp.editor.options.data.length-1:tp.editor.options.columns.length-1;if(tp.editor.options.meta&&tp.helpers.selection[e].forEach((function(e){for(let l=0;l<s;l++){const s=t?[l,e]:[e,l];delete tp.editor.options.meta[jspreadsheet.getColumnNameFromId(s)]}})),(t?tp.editor.deleteRow:tp.editor.deleteColumn)(tp.helpers.selection[e][0],tp.helpers.selection[e].length),tp.helpers.unsaved_changes.set(),l===tp.helpers.selection[e][tp.helpers.selection[e].length-1]){const e=t?tp.helpers.selection.columns[0]:tp.helpers.selection.columns[0]-1,s=t?tp.helpers.selection.rows[0]-1:tp.helpers.selection.rows[0];tp.editor.updateSelectionFromCoords(e,s,e,s)}},tp.callbacks.append=function(e,t){const s="rows"===e,l=s?tp.editor.insertRow:tp.editor.insertColumn;tp.editor.options[s?"oninsertrow":"oninsertcolumn"]=tp.callbacks.editor.oninsertroc.bind(null,e,"append"),l(t),tp.helpers.unsaved_changes.set()},tp.callbacks.move=function(e,t){const s="rows"===t;let l=tp.helpers.selection[t],o=-1;if("down"===e||"right"===e)l=l.slice().reverse(),o=1;else if("top"===e||"first"===e)o=-l[0];else if("bottom"===e||"last"===e){l=l.slice().reverse();const e="rows"===t?tp.editor.options.data.length-1:tp.editor.options.columns.length-1;o=e-l[0]}if(0===o)return;const a=s?tp.editor.moveRow:tp.editor.moveColumn;l.forEach((e=>a(e,e+o))),tp.helpers.unsaved_changes.set(),tp.editor.updateSelectionFromCoords(s?tp.helpers.selection.columns[0]:tp.helpers.selection.columns[0]+o,s?tp.helpers.selection.rows[0]+o:tp.helpers.selection.rows[0],s?tp.helpers.selection.columns[tp.helpers.selection.columns.length-1]:tp.helpers.selection.columns[tp.helpers.selection.columns.length-1]+o,s?tp.helpers.selection.rows[tp.helpers.selection.rows.length-1]+o:tp.helpers.selection.rows[tp.helpers.selection.rows.length-1])},tp.callbacks.sort=function(e){tp.editor.orderBy(tp.helpers.selection.columns[0],"desc"===e)},tp.callbacks.hide_unhide=function(e,t){const s="rows"===t,l=s?"row_hidden":"column_hidden",o=s?tp.editor.options.columns.length:tp.editor.options.data.length,a="hide"===e,n={};tp.helpers.selection[t].forEach((function(e){for(let t=0;t<o;t++){const o=s?[t,e]:[e,t],r=jspreadsheet.getColumnNameFromId(o);n[r]={},n[r][l]=a}})),tp.editor.setMeta(n),tp.helpers.unsaved_changes.set(),tp.editor.updateTable()},tp.callbacks.merge_cells=function(){const e=tp.helpers.selection.columns[0],t=tp.helpers.selection.rows[0],s=tp.helpers.selection.columns.length,l=tp.helpers.selection.rows.length;for(let s=1;s<l;s++)tp.editor.setValueFromCoords(e,t+s,"#rowspan#");for(let l=1;l<s;l++)tp.editor.setValueFromCoords(e+l,t,"#colspan#");for(let o=1;o<l;o++)for(let l=1;l<s;l++)tp.editor.setValueFromCoords(e+l,t+o,"#span#");tp.helpers.unsaved_changes.set()},tp.editor=jspreadsheet(p("#table-editor"),{data:tp.table.data,meta:tp.helpers.visibility.load(),wordWrap:!0,rowDrag:!0,rowResize:!0,columnSorting:!0,columnDrag:!0,columnResize:!0,defaultColWidth:tp.screen_options.table_editor_column_width,defaultColAlign:"left",parseFormulas:!1,allowExport:!1,allowComments:!1,allowManualInsertRow:!1,allowManualInsertColumn:!1,about:!1,secureFormulas:!1,detachForUpdates:!0,onselection:tp.callbacks.editor.onselection,updateTable:tp.callbacks.editor.onupdatetable,contextMenu:e=>{const s=tp.editor.options.data.length,l=tp.editor.options.columns.length,a=tp.helpers.selection.rows.length,n=tp.helpers.selection.columns.length,r=window?.navigator?.platform?.includes("Mac"),i=r?(0,t._x)("⌘","keyboard shortcut modifier key on a Mac keyboard","tablepress"):(0,t._x)("Ctrl+","keyboard shortcut modifier key on a non-Mac keyboard","tablepress"),c=r?(0,t._x)("⌥","keyboard shortcut option key on a Mac keyboard","tablepress"):(0,t._x)("Alt+","keyboard shortcut Alt key on a non-Mac keyboard","tablepress"),p={text:""};tp.helpers.visibility.update();const d=[{title:(0,t.__)("Undo","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sZ","keyboard shortcut for Undo","tablepress"),i),onclick:e.undo,disabled:-1===e.historyIndex},{title:(0,t.__)("Redo","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sY","keyboard shortcut for Redo","tablepress"),i),onclick:e.redo,disabled:e.historyIndex===e.history.length-1},{type:"divisor"},{title:(0,t.__)("Cut","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sX","keyboard shortcut for Cut","tablepress"),i),onclick(){if("TEXTAREA"===document.activeElement.tagName&&document.activeElement.selectionStart!==document.activeElement.selectionEnd){document.execCommand("copy");const e=document.activeElement.selectionStart;document.activeElement.value=document.activeElement.value.slice(0,document.activeElement.selectionStart)+document.activeElement.value.slice(document.activeElement.selectionEnd),document.activeElement.selectionEnd=e}else e.copy(!0),e.setValue(e.highlighted,"")}},{title:(0,t.__)("Copy","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sC","keyboard shortcut for Copy","tablepress"),i),onclick(){"TEXTAREA"===document.activeElement.tagName&&document.activeElement.selectionStart!==document.activeElement.selectionEnd?document.execCommand("copy"):e.copy(!0)}},{title:(0,t.__)("Paste","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sV","keyboard shortcut for Paste","tablepress"),i),onclick(){"TEXTAREA"===document.activeElement.tagName?window.navigator.clipboard.readText().then((e=>{if(e){const t=document.activeElement.selectionStart+e.length;document.activeElement.value=document.activeElement.value.slice(0,document.activeElement.selectionStart)+e+document.activeElement.value.slice(document.activeElement.selectionEnd),document.activeElement.selectionEnd=t}})):e.selectedCell&&window.navigator.clipboard.readText().then((t=>{t&&e.paste(e.selectedCell[0],e.selectedCell[1],t)}))},disabled:!window?.navigator?.clipboard?.readText,tooltip:window?.navigator?.clipboard?.readText?"":(0,t.__)("Your browser does not allow pasting via the context menu. Use the keyboard shortcut instead.","tablepress")},{type:"divisor"},{title:(0,t.__)("Insert Link","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sL","keyboard shortcut for Insert Link","tablepress"),i),onclick:tp.callbacks.insert_link.open_dialog.bind(null,"TEXTAREA"===document.activeElement.tagName?document.activeElement:null)},{title:(0,t.__)("Insert Image","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sI","keyboard shortcut for Insert Image","tablepress"),i),onclick:tp.callbacks.insert_image.open_dialog.bind(null,"TEXTAREA"===document.activeElement.tagName?document.activeElement:null)},{title:(0,t.__)("Advanced Editor","tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$sE","keyboard shortcut for Advanced Editor","tablepress"),i),onclick:tp.callbacks.advanced_editor.open_dialog.bind(null,"TEXTAREA"===document.activeElement.tagName?document.activeElement:null)},{type:"divisor"},{title:(0,t.__)("Duplicate …","tablepress"),submenu:[{title:(0,t._n)("Duplicate row","Duplicate rows",a,"tablepress"),onclick:tp.callbacks.insert_duplicate.bind(null,"duplicate","rows")},{title:(0,t._n)("Duplicate column","Duplicate columns",n,"tablepress"),onclick:tp.callbacks.insert_duplicate.bind(null,"duplicate","columns")}]},{title:(0,t.__)("Insert …","tablepress"),submenu:[{title:(0,t._n)("Insert row above","Insert rows above",a,"tablepress"),onclick:tp.callbacks.insert_duplicate.bind(null,"insert","rows","before")},{title:(0,t._n)("Insert row below","Insert rows below",a,"tablepress"),onclick:tp.callbacks.insert_duplicate.bind(null,"insert","rows","after")},{title:(0,t._n)("Insert column on the left","Insert columns on the left",n,"tablepress"),onclick:tp.callbacks.insert_duplicate.bind(null,"insert","columns","before")},{title:(0,t._n)("Insert column on the right","Insert columns on the right",n,"tablepress"),onclick:tp.callbacks.insert_duplicate.bind(null,"insert","columns","after")}]},{title:(0,t.__)("Append …","tablepress"),submenu:[{title:(0,t.__)("Append row","tablepress"),onclick:tp.callbacks.append.bind(null,"rows",1)},{title:(0,t.__)("Append column","tablepress"),onclick:tp.callbacks.append.bind(null,"columns",1)}]},{title:(0,t.__)("Delete …","tablepress"),submenu:[{title:(0,t._n)("Delete row","Delete rows",a,"tablepress"),onclick:tp.callbacks.remove.bind(null,"rows"),disabled:s===a,tooltip:s===a?(0,t.__)("This option is disabled.","tablepress")+" "+(0,t.__)("You can not delete all table rows!","tablepress"):""},{title:(0,t._n)("Delete column","Delete columns",n,"tablepress"),onclick:tp.callbacks.remove.bind(null,"columns"),disabled:l===n,tooltip:l===n?(0,t.__)("This option is disabled.","tablepress")+" "+(0,t.__)("You can not delete all table columns!","tablepress"):""}]},{type:"divisor"},{title:(0,t.__)("Move …","tablepress"),submenu:[{title:(0,t._n)("Move row up","Move rows up",a,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s⇧↑","keyboard shortcut for Move up","tablepress"),i),onclick:tp.callbacks.move.bind(null,"up","rows"),disabled:!tp.helpers.move_allowed("rows","up")},{title:(0,t._n)("Move row down","Move rows down",a,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s⇧↓","keyboard shortcut for Move down","tablepress"),i),onclick:tp.callbacks.move.bind(null,"down","rows"),disabled:!tp.helpers.move_allowed("rows","down")},{title:(0,t._n)("Move column left","Move columns left",n,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s⇧←","keyboard shortcut for Move left","tablepress"),i),onclick:tp.callbacks.move.bind(null,"left","columns"),disabled:!tp.helpers.move_allowed("columns","left")},{title:(0,t._n)("Move column right","Move columns right",n,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s⇧→","keyboard shortcut for Move right","tablepress"),i),onclick:tp.callbacks.move.bind(null,"right","columns"),disabled:!tp.helpers.move_allowed("columns","right")},{type:"divisor"},{title:(0,t._n)("Move row to the top","Move rows to the top",a,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s%2$s⇧↑","keyboard shortcut for Move to the top","tablepress"),i,c),onclick:tp.callbacks.move.bind(null,"top","rows"),disabled:!tp.helpers.move_allowed("rows","top")},{title:(0,t._n)("Move row to the bottom","Move rows to the bottom",a,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s%2$s⇧↓","keyboard shortcut for Move to the bottom","tablepress"),i,c),onclick:tp.callbacks.move.bind(null,"bottom","rows"),disabled:!tp.helpers.move_allowed("rows","bottom")},{title:(0,t._n)("Move column to first","Move columns to first",n,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s%2$s⇧←","keyboard shortcut for Move to first","tablepress"),i,c),onclick:tp.callbacks.move.bind(null,"first","columns"),disabled:!tp.helpers.move_allowed("columns","first")},{title:(0,t._n)("Move column to last","Move columns to last",n,"tablepress"),shortcut:(0,t.sprintf)((0,t._x)("%1$s%2$s⇧→","keyboard shortcut for Move to last","tablepress"),i,c),onclick:tp.callbacks.move.bind(null,"last","columns"),disabled:!tp.helpers.move_allowed("columns","last")}]},{title:(0,t.__)("Sort by column …","tablepress"),submenu:[{title:(0,t.__)("Sort by column ascending","tablepress"),onclick:tp.callbacks.sort.bind(null,"asc"),disabled:1!==n,tooltip:1!==n?(0,t.__)("This option is disabled because more than one column was selected.","tablepress"):""},{title:(0,t.__)("Sort by column descending","tablepress"),onclick:tp.callbacks.sort.bind(null,"desc"),disabled:1!==n,tooltip:1!==n?(0,t.__)("This option is disabled because more than one column was selected.","tablepress"):""}]},{type:"divisor"},{title:(0,t.__)("Hide/Show …","tablepress"),submenu:[{title:(0,t._n)("Hide row","Hide rows",a,"tablepress"),onclick:tp.callbacks.hide_unhide.bind(null,"hide","rows"),disabled:!tp.helpers.visibility.selection_contains("rows",1),tooltip:tp.helpers.visibility.selection_contains("rows",1)?"":(0,t.__)("This option is disabled because no visible rows were selected.","tablepress")},{title:(0,t._n)("Hide column","Hide columns",n,"tablepress"),onclick:tp.callbacks.hide_unhide.bind(null,"hide","columns"),disabled:!tp.helpers.visibility.selection_contains("columns",1),tooltip:tp.helpers.visibility.selection_contains("columns",1)?"":(0,t.__)("This option is disabled because no visible columns were selected.","tablepress")},{title:(0,t._n)("Show row","Show rows",a,"tablepress"),onclick:tp.callbacks.hide_unhide.bind(null,"unhide","rows"),disabled:!tp.helpers.visibility.selection_contains("rows",0),tooltip:tp.helpers.visibility.selection_contains("rows",0)?"":(0,t.__)("This option is disabled because no hidden rows were selected.","tablepress")},{title:(0,t._n)("Show column","Show columns",n,"tablepress"),onclick:tp.callbacks.hide_unhide.bind(null,"unhide","columns"),disabled:!tp.helpers.visibility.selection_contains("columns",0),tooltip:tp.helpers.visibility.selection_contains("columns",0)?"":(0,t.__)("This option is disabled because no hidden columns were selected.","tablepress")}]},{type:"divisor"},{title:(0,t.__)("Combine/Merge cells","tablepress"),onclick:tp.callbacks.merge_cells,disabled:1===a&&1===n||!tp.helpers.cell_merge_allowed("no-alert"),tooltip:1===a&&1===n||!tp.helpers.cell_merge_allowed("no-alert",p)?(0,t.__)("This option is disabled.","tablepress")+" "+p.text:""}];return(0,o.applyFilters)("tablepress.editScreenContextMenuItems",d,e)},sorting:tp.helpers.editor.sorting,onmoverow:tp.callbacks.editor.onmove,onmovecolumn:tp.callbacks.editor.onmove,onblur:tp.helpers.editor.reselect,onload:tp.helpers.editor.reselect,onchange:tp.helpers.unsaved_changes.set,onsort:tp.callbacks.editor.onsort}),p("#tablepress-page").addEventListener("click",(e=>{e?.target?.matches(".button-show-help-box")&&tp.callbacks.help_box.open_dialog(e)})),jQuery("#textarea-insert-helper").on("change",tp.helpers.editor.insert_from_helper_textarea),document.querySelectorAll("#tablepress-body .button-module-help").forEach((e=>e.closest(".postbox").querySelector(".handle-actions").prepend(e))),jQuery((()=>{jQuery("#wp-link").on("focus","input",(e=>e.stopPropagation())),jQuery("body").on("focus",".media-modal .media-frame-content input, .media-modal .media-frame-content textarea",(e=>e.stopPropagation()))})),window.addEventListener("keydown",(e=>{let t="",s="",l="";if((e.ctrlKey||e.metaKey)&&(80===e.keyCode?t="preview":83===e.keyCode?t="save-changes":76===e.keyCode?t="insert_link":73===e.keyCode?t="insert_image":69===e.keyCode?t="advanced_editor":e.shiftKey&&e.altKey&&38===e.keyCode?(t="move",s="top",l="rows"):e.shiftKey&&e.altKey&&40===e.keyCode?(t="move",s="bottom",l="rows"):e.shiftKey&&e.altKey&&37===e.keyCode?(t="move",s="first",l="columns"):e.shiftKey&&e.altKey&&39===e.keyCode?(t="move",s="last",l="columns"):e.shiftKey&&38===e.keyCode?(t="move",s="up",l="rows"):e.shiftKey&&40===e.keyCode?(t="move",s="down",l="rows"):e.shiftKey&&37===e.keyCode?(t="move",s="left",l="columns"):e.shiftKey&&39===e.keyCode&&(t="move",s="right",l="columns")),"save-changes"===t||"preview"===t)document.activeElement.blur(),document.querySelector(`#tablepress-tablepress_edit-buttons-2-section .button-${t}`).click(),e.preventDefault();else if("insert_link"===t||"insert_image"===t||"advanced_editor"===t){if(p("#table-editor").contains(document.activeElement)){const e="TEXTAREA"===document.activeElement.tagName?document.activeElement:null;tp.callbacks[t].open_dialog(e)}e.preventDefault()}else"move"===t&&(p("#table-editor").contains(document.activeElement)&&"TEXTAREA"!==document.activeElement.tagName&&tp.helpers.move_allowed(l,s)&&tp.callbacks.move(s,l),e.stopImmediatePropagation())}),!0);const h=p("#tablepress-screen-options");h&&(h.addEventListener("input",(e=>{if(e.target)return"table_editor_line_clamp"===e.target.id?(tp.editor.el.style.setProperty("--table-editor-line-clamp",parseInt(e.target.value,10)),void tp.editor.updateCornerPosition()):"table_editor_column_width"===e.target.id?(tp.screen_options.table_editor_column_width=parseInt(e.target.value,10),tp.screen_options.table_editor_column_width=Math.max(tp.screen_options.table_editor_column_width,30),tp.screen_options.table_editor_column_width=Math.min(tp.screen_options.table_editor_column_width,9999),tp.editor.colgroup.forEach((e=>e.setAttribute("width",tp.screen_options.table_editor_column_width))),void tp.editor.updateCornerPosition()):void 0})),h.addEventListener("change",(e=>{e.target&&(e.target.was_changed=!0)})),h.addEventListener("focusout",(e=>{if(!e.target)return;if(!e.target.was_changed)return;e.target.was_changed=!1;const s={action:"tablepress_save_screen_options",_ajax_nonce:tp.nonces.screen_options,tablepress:{[e.target.id]:parseInt(e.target.value,10)}};e.target.parentNode.insertAdjacentHTML("beforeend",`<span id="spinner-save-changes" class="spinner-save-changes spinner is-active" title="${(0,t.__)("Changes are being saved …","tablepress")}"></span>`),document.body.classList.add("wait"),fetch(ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:(0,b.buildQueryString)(s)}).finally((()=>{p("#spinner-save-changes").remove(),document.body.classList.remove("wait")}))})));const _=(0,o.applyFilters)("tablepress.editScreenFeatures",[]),u=(0,e.withFilters)("tablepress.editScreenPortals")((()=>(0,a.jsx)(a.Fragment,{}))),m=()=>{const[e,t]=(0,s.useState)((()=>({...tp.table.options}))),[l,n]=(0,s.useState)((()=>({...tp.table.meta})));(0,s.useEffect)((()=>((0,o.addAction)("tablepress.metaUpdated","tp/edit-screen/handle-meta-updated",(()=>{n({...tp.table.meta})})),()=>{(0,o.removeAction)("tablepress.metaUpdated","tp/edit-screen/handle-meta-updated")})),[]),(0,s.useEffect)((()=>{e.use_datatables&&tp.helpers.editor.has_merged_body_cells()&&r({use_datatables:!1})}),[]);const r=e=>{t((t=>({...t,...e}))),tp.table.options={...tp.table.options,...e},tp.helpers.unsaved_changes.set(),["table_head","table_foot"].some((t=>Object.keys(e).includes(t)))&&tp.editor.updateTable()};return(0,a.jsx)(u,{tableMeta:l,updateTableMeta:e=>tp.helpers.meta.update(e),tableOptions:e,updateTableOptions:r,features:_})};((e,t)=>{const s=document.getElementById("tablepress-edit-screen");s&&(0,l.createRoot)(s).render(t)})(0,(0,a.jsx)(m,{}))})();