File: /virtual/nagasaki/public_html/wp-content/plugins/tablepress/blocks/table/build/index.js
(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.blocks,r=window.wp.shortcode;var a=e.n(r);const l=JSON.parse('{"u2":"tablepress/table"}'),n=e=>{let t=Object.entries(e.named).map((e=>{let[t,r]=e,a="";return r=r.replace(/“([^”]*)”/g,"$1"),(/\s/.test(r)||""===r)&&(a='"'),r.includes('"')&&(a="'"),`${t}=${a}${r}${a}`})).join(" ");return e.numeric.forEach((e=>{/\s/.test(e)?t+=' "'+e+'"':t+=" "+e})),t},s=function(e){let r=a().next(tp.table.shortcode,e).shortcode.attrs;r={named:{...r.named},numeric:[...r.numeric]};const s=r.named.id;delete r.named.id;let o=n(r);return o=o.replace(/=“([^”]*)”/g,'="$1"'),(0,t.createBlock)(l.u2,{id:s,parameters:o})},o={from:[{type:"shortcode",tag:tp.table.shortcode,attributes:{id:{type:"string",shortcode:e=>{let{named:{id:t=""}}=e;return t}},parameters:{type:"string",shortcode:e=>(delete(e={named:{...e.named},numeric:[...e.numeric]}).named.id,n(e))}}},{type:"enter",regExp:a().regexp(tp.table.shortcode),transform:e=>{let{content:t}=e;return s(t)}},{type:"block",blocks:["core/shortcode"],transform:e=>{let{text:t}=e;return s(t)},isMatch:e=>{let{text:t}=e;return void 0!==a().next(tp.table.shortcode,t)},isMultiBlock:!1}],to:[{type:"block",blocks:["core/shortcode"],transform:e=>{let{id:r,parameters:a}=e;a=a.trim(),""!==a&&(a+=" ");const l=`[${tp.table.shortcode} id=${r} ${a}/]`;return(0,t.createBlock)("core/shortcode",{text:l})}}]},c=window.wp.element,i=window.wp.i18n,d=window.wp.serverSideRender;var p=e.n(d);const m=window.wp.blockEditor,b=window.wp.components,u=Object.entries(tp.tables).map((e=>{let[t,r]=e;return{value:t,label:(0,i.sprintf)((0,i.__)("ID %1$s: “%2$s”","tablepress"),t,r)}})),h=function(){return""!==tp.url&&(0,c.createElement)(b.ExternalLink,{href:tp.url},(0,i.__)("Manage your tables.","tablepress"))};let w=null;const _=Object.keys(tp.tables);_.length&&(w={attributes:{id:_[Math.floor(Math.random()*_.length)],parameters:""}});const g=w;(0,t.registerBlockType)(l.u2,{transforms:o,edit:function(e){let{attributes:t,setAttributes:r}=e;const s=(0,m.useBlockProps)();let o;o=t.id&&tp.tables.hasOwnProperty(t.id)?(0,c.createElement)("div",s,tp.load_block_preview&&(0,c.createElement)(p(),{block:l.u2,attributes:t,className:"render-wrapper"}),(0,c.createElement)("div",{className:"table-overlay"},(0,i.sprintf)((0,i.__)("TablePress table %1$s: “%2$s”","tablepress"),t.id,tp.tables[t.id]))):(0,c.createElement)("div",s,(0,c.createElement)(b.Placeholder,{icon:(0,c.createElement)(b.Icon,{icon:"list-view"}),label:(0,i.__)("TablePress table","tablepress"),instructions:(0,c.createElement)(c.Fragment,null,t.id&&(0,i.sprintf)((0,i.__)("There is a problem: The TablePress table with the ID “%1$s” could not be found.","tablepress"),t.id)+" ",0<u.length?(0,i.__)("Select the TablePress table that you want to embed in the Settings sidebar.","tablepress"):(0,i.__)("There are no TablePress tables on this site yet.","tablepress"))},(0,c.createElement)(h,null)));const d=(0,c.createElement)(c.Fragment,null,(0,c.createElement)(m.InspectorControls,null,(0,c.createElement)(b.PanelBody,{opened:!0},0<u.length?(0,c.createElement)(b.ComboboxControl,{label:(0,i.__)("Table:","tablepress"),help:(0,c.createElement)(c.Fragment,null,(0,i.__)("Select the TablePress table that you want to embed.","tablepress"),""!==tp.url&&" ",(0,c.createElement)(h,null)),value:t.id,options:u,onChange:e=>{var t;null!==(t=e)&&void 0!==t||(e=""),r({id:e.replace(/[^0-9a-zA-Z-_]/g,"")})}}):(0,c.createElement)(c.Fragment,null,(0,i.__)("There are no TablePress tables on this site yet.","tablepress"),""!==tp.url&&" ",(0,c.createElement)(h,null)))),t.id&&tp.tables.hasOwnProperty(t.id)&&(0,c.createElement)(m.InspectorAdvancedControls,null,(0,c.createElement)(b.TextControl,{label:(0,i.__)("Configuration parameters:","tablepress"),help:(0,i.__)("These additional parameters can be used to modify specific table features.","tablepress")+" "+(0,i.__)("See the TablePress Documentation for more information.","tablepress"),value:t.parameters,onChange:e=>{e=(e=a().replace(tp.table.shortcode,e,(e=>{let{attrs:t}=e;return t={named:{...t.named},numeric:[...t.numeric]},delete t.named.id," "+n(t)+" "}))).replace(/=“([^”]*)”/g,'="$1"'),r({parameters:e})},onBlur:e=>{const t=e.target.value.trim();r({parameters:t})}})));return(0,c.createElement)(c.Fragment,null,o,d)},save:function(e){let{attributes:{id:t="",parameters:r=""}}=e;return""===t?"":(r=r.trim(),""!==r&&(r+=" "),(0,c.createElement)(c.RawHTML,null,`[${tp.table.shortcode} id=${t} ${r}/]`))},example:g})})();