Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Editor history navigation #55

Merged
merged 6 commits into from
Jan 9, 2025
Merged

Conversation

dcalhoun
Copy link
Member

@dcalhoun dcalhoun commented Jan 8, 2025

Related:

What?

Enable navigating forwards and backwards through the editor history.

Why?

Undo and redo actions are common, helpful features expected by users.

How?

Expose the availability of undo/redo actions to the host app, alongside methods
to invoke the relevant actions.

Testing Instructions

  1. Insert and edit various content in the editor.
  2. Tap the undo and redo buttons.
  3. Verify editor history is accurately replayed.

Accessibility Testing Instructions

Perform the testing instructions with a screen reader.

Screenshots or screencast

iOS Android
Simulator Screenshot - iPhone 16 Pro - 2025-01-08 at 12 06 54 Screenshot_20250109_102658_Jetpack Pre-Alpha

@dcalhoun dcalhoun added the enhancement New feature or request label Jan 8, 2025
@dcalhoun dcalhoun force-pushed the feat/editor-history-navigation branch from 80bc556 to ae41b33 Compare January 8, 2025 17:16
@dcalhoun dcalhoun changed the base branch from trunk to refactor/rename-editor-components January 8, 2025 17:17
Base automatically changed from refactor/rename-editor-components to trunk January 8, 2025 20:57
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-PsmJHRPp.js","./index-0lszm8gR.css"])))=>i.map(i=>d[i]);
import fe from"@wordpress/block-editor/build-style/default-editor-styles.css?inline";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();const pe="modulepreload",he=function(e,t){return new URL(e,t).href},N={},we=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){const a=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");i=Promise.allSettled(r.map(u=>{if(u=he(u,n),u in N)return;N[u]=!0;const w=u.endsWith(".css"),o=w?'[rel="stylesheet"]':"";if(!!n)for(let _=a.length-1;_>=0;_--){const f=a[_];if(f.href===u&&(!w||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${o}`))return;const h=document.createElement("link");if(h.rel=w?"stylesheet":pe,w||(h.as="script"),h.crossOrigin="",h.href=u,d&&h.setAttribute("nonce",d),document.head.appendChild(h),w)return new Promise((_,f)=>{h.addEventListener("load",_),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var I={},z;function me(){return z||(z=1,function(e){(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(c){return i(a(c),arguments)}function n(c,d){return r.apply(null,[c].concat(d||[]))}function i(c,d){var u=1,w=c.length,o,g="",h,_,f,A,S,P,O,l;for(h=0;h<w;h++)if(typeof c[h]=="string")g+=c[h];else if(typeof c[h]=="object"){if(f=c[h],f.keys)for(o=d[u],_=0;_<f.keys.length;_++){if(o==null)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',f.keys[_],f.keys[_-1]));o=o[f.keys[_]]}else f.param_no?o=d[f.param_no]:o=d[u++];if(t.not_type.test(f.type)&&t.not_primitive.test(f.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(f.type)&&typeof o!="number"&&isNaN(o))throw new TypeError(r("[sprintf] expecting number but found %T",o));switch(t.number.test(f.type)&&(O=o>=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?g+=o:(t.number.test(f.type)&&(!O||f.sign)?(l=O?"+":"-",o=o.toString().replace(t.sign,"")):l="",S=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",P=f.width-(l+o).length,A=f.width&&P>0?S.repeat(P):"",g+=f.align?l+o+A:S==="0"?l+A+o:A+l+o)}return g}var s=Object.create(null);function a(c){if(s[c])return s[c];for(var d=c,u,w=[],o=0;d;){if((u=t.text.exec(d))!==null)w.push(u[0]);else if((u=t.modulo.exec(d))!==null)w.push("%");else if((u=t.placeholder.exec(d))!==null){if(u[2]){o|=1;var g=[],h=u[2],_=[];if((_=t.key.exec(h))!==null)for(g.push(_[1]);(h=h.substring(_[0].length))!=="";)if((_=t.key_access.exec(h))!==null)g.push(_[1]);else if((_=t.index_access.exec(h))!==null)g.push(_[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");u[2]=g}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");w.push({placeholder:u[0],param_no:u[1],keys:u[2],sign:u[3],pad_char:u[4],align:u[5],width:u[6],precision:u[7],type:u[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");d=d.substring(u[0].length)}return s[c]=w}e.sprintf=r,e.vsprintf=n,typeof window<"u"&&(window.sprintf=r,window.vsprintf=n)})()}(I)),I}me();var C,re,R,ne;C={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1};re=["(","?"];R={")":["("],":":["?","?:"]};ne=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function ge(e){for(var t=[],r=[],n,i,s,a;n=e.match(ne);){for(i=n[0],s=e.substr(0,n.index).trim(),s&&t.push(s);a=r.pop();){if(R[i]){if(R[i][0]===a){i=R[i][1]||i;break}}else if(re.indexOf(a)>=0||C[a]<C[i]){r.push(a);break}t.push(a)}R[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var ye={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,r){if(e)throw t;return r}};function _e(e,t){var r=[],n,i,s,a,c,d;for(n=0;n<e.length;n++){if(c=e[n],a=ye[c],a){for(i=a.length,s=Array(i);i--;)s[i]=r.pop();try{d=a.apply(null,s)}catch(u){return u}}else t.hasOwnProperty(c)?d=t[c]:d=+c;r.push(d)}return r[0]}function be(e){var t=ge(e);return function(r){return _e(t,r)}}function ve(e){var t=be(e);return function(r){return+t({n:r})}}var q={contextDelimiter:"",onMissingKey:null};function Ee(e){var t,r,n;for(t=e.split(";"),r=0;r<t.length;r++)if(n=t[r].trim(),n.indexOf("plural=")===0)return n.substr(7)}function H(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in q)this.options[r]=t!==void 0&&r in t?t[r]:q[r]}H.prototype.getPluralForm=function(e,t){var r=this.pluralForms[e],n,i,s;return r||(n=this.data[e][""],s=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,typeof s!="function"&&(i=Ee(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),s=ve(i)),r=this.pluralForms[e]=s),r(t)};H.prototype.dcnpgettext=function(e,t,r,n,i){var s,a,c;return i===void 0?s=0:s=this.getPluralForm(e,i),a=r,t&&(a=t+this.options.contextDelimiter+r),c=this.data[e][a],c&&c[s]?c[s]:(this.options.onMissingKey&&this.options.onMissingKey(r,e),s===0?r:n)};const K={"":{plural_forms(e){return e===1?0:1}}},xe=/^i18n\.(n?gettext|has_translation)(_|$)/,Ae=(e,t,r)=>{const n=new H({}),i=new Set,s=()=>{i.forEach(l=>l())},a=l=>(i.add(l),()=>i.delete(l)),c=(l="default")=>n.data[l],d=(l,p="default")=>{n.data[p]={...n.data[p],...l},n.data[p][""]={...K[""],...n.data[p]?.[""]},delete n.pluralForms[p]},u=(l,p)=>{d(l,p),s()},w=(l,p="default")=>{n.data[p]={...n.data[p],...l,"":{...K[""],...n.data[p]?.[""],...l?.[""]}},delete n.pluralForms[p],s()},o=(l,p)=>{n.data={},n.pluralForms={},u(l,p)},g=(l="default",p,m,v,E)=>(n.data[l]||d(void 0,l),n.dcnpgettext(l,p,m,v,E)),h=(l="default")=>l,_=(l,p)=>{let m=g(p,void 0,l);return r?(m=r.applyFilters("i18n.gettext",m,l,p),r.applyFilters("i18n.gettext_"+h(p),m,l,p)):m},f=(l,p,m)=>{let v=g(m,p,l);return r?(v=r.applyFilters("i18n.gettext_with_context",v,l,p,m),r.applyFilters("i18n.gettext_with_context_"+h(m),v,l,p,m)):v},A=(l,p,m,v)=>{let E=g(v,void 0,l,p,m);return r?(E=r.applyFilters("i18n.ngettext",E,l,p,m,v),r.applyFilters("i18n.ngettext_"+h(v),E,l,p,m,v)):E},S=(l,p,m,v,E)=>{let k=g(E,v,l,p,m);return r?(k=r.applyFilters("i18n.ngettext_with_context",k,l,p,m,v,E),r.applyFilters("i18n.ngettext_with_context_"+h(E),k,l,p,m,v,E)):k},P=()=>f("ltr","text direction")==="rtl",O=(l,p,m)=>{const v=p?p+""+l:l;let E=!!n.data?.[m??"default"]?.[v];return r&&(E=r.applyFilters("i18n.has_translation",E,l,p,m),E=r.applyFilters("i18n.has_translation_"+h(m),E,l,p,m)),E};if(r){const l=p=>{xe.test(p)&&s()};r.addAction("hookAdded","core/i18n",l),r.addAction("hookRemoved","core/i18n",l)}return{getLocaleData:c,setLocaleData:u,addLocaleData:w,resetLocaleData:o,subscribe:a,__:_,_x:f,_n:A,_nx:S,isRTL:P,hasTranslation:O}};function ie(e){return typeof e!="string"||e===""?(console.error("The namespace must be a non-empty string."),!1):/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)?!0:(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}function U(e){return typeof e!="string"||e===""?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)?!0:(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}function B(e,t){return function(n,i,s,a=10){const c=e[t];if(!U(n)||!ie(i))return;if(typeof s!="function"){console.error("The hook callback must be a function.");return}if(typeof a!="number"){console.error("If specified, the hook priority must be a number.");return}const d={callback:s,priority:a,namespace:i};if(c[n]){const u=c[n].handlers;let w;for(w=u.length;w>0&&!(a>=u[w-1].priority);w--);w===u.length?u[w]=d:u.splice(w,0,d),c.__current.forEach(o=>{o.name===n&&o.currentIndex>=w&&o.currentIndex++})}else c[n]={handlers:[d],runs:0};n!=="hookAdded"&&e.doAction("hookAdded",n,i,s,a)}}function M(e,t,r=!1){return function(i,s){const a=e[t];if(!U(i)||!r&&!ie(s))return;if(!a[i])return 0;let c=0;if(r)c=a[i].handlers.length,a[i]={runs:a[i].runs,handlers:[]};else{const d=a[i].handlers;for(let u=d.length-1;u>=0;u--)d[u].namespace===s&&(d.splice(u,1),c++,a.__current.forEach(w=>{w.name===i&&w.currentIndex>=u&&w.currentIndex--}))}return i!=="hookRemoved"&&e.doAction("hookRemoved",i,s),c}}function G(e,t){return function(n,i){const s=e[t];return typeof i<"u"?n in s&&s[n].handlers.some(a=>a.namespace===i):n in s}}function L(e,t,r,n){return function(s,...a){const c=e[t];c[s]||(c[s]={handlers:[],runs:0}),c[s].runs++;const d=c[s].handlers;if(!d||!d.length)return r?a[0]:void 0;const u={name:s,currentIndex:0};async function w(){try{c.__current.add(u);let g=r?a[0]:void 0;for(;u.currentIndex<d.length;)g=await d[u.currentIndex].callback.apply(null,a),r&&(a[0]=g),u.currentIndex++;return r?g:void 0}finally{c.__current.delete(u)}}function o(){try{c.__current.add(u);let g=r?a[0]:void 0;for(;u.currentIndex<d.length;)g=d[u.currentIndex].callback.apply(null,a),r&&(a[0]=g),u.currentIndex++;return r?g:void 0}finally{c.__current.delete(u)}}return(n?w:o)()}}function Q(e,t){return function(){var n;const i=e[t];return(n=Array.from(i.__current).at(-1)?.name)!==null&&n!==void 0?n:null}}function J(e,t){return function(n){const i=e[t];return typeof n>"u"?i.__current.size>0:Array.from(i.__current).some(s=>s.name===n)}}function X(e,t){return function(n){const i=e[t];if(U(n))return i[n]&&i[n].runs?i[n].runs:0}}class Se{constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=B(this,"actions"),this.addFilter=B(this,"filters"),this.removeAction=M(this,"actions"),this.removeFilter=M(this,"filters"),this.hasAction=G(this,"actions"),this.hasFilter=G(this,"filters"),this.removeAllActions=M(this,"actions",!0),this.removeAllFilters=M(this,"filters",!0),this.doAction=L(this,"actions",!1,!1),this.doActionAsync=L(this,"actions",!1,!0),this.applyFilters=L(this,"filters",!0,!1),this.applyFiltersAsync=L(this,"filters",!0,!0),this.currentAction=Q(this,"actions"),this.currentFilter=Q(this,"filters"),this.doingAction=J(this,"actions"),this.doingFilter=J(this,"filters"),this.didAction=X(this,"actions"),this.didFilter=X(this,"filters")}}function Pe(){return new Se}const Oe=Pe(),b=Ae(void 0,void 0,Oe);b.getLocaleData.bind(b);b.setLocaleData.bind(b);b.resetLocaleData.bind(b);b.subscribe.bind(b);const D=b.__.bind(b);b._x.bind(b);b._n.bind(b);b._nx.bind(b);b.isRTL.bind(b);b.hasTranslation.bind(b);function Re(e){const t=(r,n)=>{const{headers:i={}}=r;for(const s in i)if(s.toLowerCase()==="x-wp-nonce"&&i[s]===t.nonce)return n(r);return n({...r,headers:{...i,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t}const se=(e,t)=>{let r=e.path,n,i;return typeof e.namespace=="string"&&typeof e.endpoint=="string"&&(n=e.namespace.replace(/^\/|\/$/g,""),i=e.endpoint.replace(/^\//,""),i?r=n+"/"+i:r=n),delete e.namespace,delete e.endpoint,t({...e,path:r})},Te=e=>(t,r)=>se(t,n=>{let i=n.url,s=n.path,a;return typeof s=="string"&&(a=e,e.indexOf("?")!==-1&&(s=s.replace("?","&")),s=s.replace(/^\//,""),typeof a=="string"&&a.indexOf("?")!==-1&&(s=s.replace("?","&")),i=a+s),r({...n,url:i})});function ke(e){let t;try{t=new URL(e,"http://example.com").search.substring(1)}catch{}if(t)return t}function ae(e){let t="";const r=Object.entries(e);let n;for(;n=r.shift();){let[i,s]=n;if(Array.isArray(s)||s&&s.constructor===Object){const c=Object.entries(s).reverse();for(const[d,u]of c)r.unshift([`${i}[${d}]`,u])}else s!==void 0&&(s===null&&(s=""),t+="&"+[i,s].map(encodeURIComponent).join("="))}return t.substr(1)}function Me(e){try{return decodeURIComponent(e)}catch{return e}}function Le(e,t,r){const n=t.length,i=n-1;for(let s=0;s<n;s++){let a=t[s];!a&&Array.isArray(e)&&(a=e.length.toString()),a=["__proto__","constructor","prototype"].includes(a)?a.toUpperCase():a;const c=!isNaN(Number(t[s+1]));e[a]=s===i?r:e[a]||(c?[]:{}),Array.isArray(e[a])&&!c&&(e[a]={...e[a]}),e=e[a]}}function F(e){return(ke(e)||"").replace(/\+/g,"%20").split("&").reduce((t,r)=>{const[n,i=""]=r.split("=").filter(Boolean).map(Me);if(n){const s=n.replace(/\]/g,"").split("[");Le(t,s,i)}return t},Object.create(null))}function x(e="",t){if(!t||!Object.keys(t).length)return e;let r=e;const n=e.indexOf("?");return n!==-1&&(t=Object.assign(F(e),t),r=r.substr(0,n)),r+"?"+ae(t)}function j(e,t){return F(e)[t]}function V(e,t){return j(e,t)!==void 0}function Z(e,...t){const r=e.indexOf("?");if(r===-1)return e;const n=F(e),i=e.substr(0,r);t.forEach(a=>delete n[a]);const s=ae(n);return s?i+"?"+s:i}function W(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map(i=>i.split("=")).map(i=>i.map(decodeURIComponent)).sort((i,s)=>i[0].localeCompare(s[0])).map(i=>i.map(encodeURIComponent)).map(i=>i.join("=")).join("&"):n}function De(e){const t=Object.fromEntries(Object.entries(e).map(([r,n])=>[W(r),n]));return(r,n)=>{const{parse:i=!0}=r;let s=r.path;if(!s&&r.url){const{rest_route:d,...u}=F(r.url);typeof d=="string"&&(s=x(d,u))}if(typeof s!="string")return n(r);const a=r.method||"GET",c=W(s);if(a==="GET"&&t[c]){const d=t[c];return delete t[c],Y(d,!!i)}else if(a==="OPTIONS"&&t[a]&&t[a][c]){const d=t[a][c];return delete t[a][c],Y(d,!!i)}return n(r)}}function Y(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}const Fe=({path:e,url:t,...r},n)=>({...r,url:t&&x(t,n),path:e&&x(e,n)}),ee=e=>e.json?e.json():Promise.reject(e),Ie=e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}},te=e=>{const{next:t}=Ie(e.headers.get("link"));return t},Ce=e=>{const t=!!e.path&&e.path.indexOf("per_page=-1")!==-1,r=!!e.url&&e.url.indexOf("per_page=-1")!==-1;return t||r},oe=async(e,t)=>{if(e.parse===!1||!Ce(e))return t(e);const r=await y({...Fe(e,{per_page:100}),parse:!1}),n=await ee(r);if(!Array.isArray(n))return n;let i=te(r);if(!i)return n;let s=[].concat(n);for(;i;){const a=await y({...e,path:void 0,url:i,parse:!1}),c=await ee(a);s=s.concat(c),i=te(a)}return s},je=new Set(["PATCH","PUT","DELETE"]),He="GET",Ue=(e,t)=>{const{method:r=He}=e;return je.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},$e=(e,t)=>(typeof e.url=="string"&&!V(e.url,"_locale")&&(e.url=x(e.url,{_locale:"user"})),typeof e.path=="string"&&!V(e.path,"_locale")&&(e.path=x(e.path,{_locale:"user"})),t(e)),Ne=(e,t=!0)=>t?e.status===204?null:e.json?e.json():Promise.reject(e):e,ze=e=>{const t={code:"invalid_json",message:D("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch(()=>{throw t})},ce=(e,t=!0)=>Promise.resolve(Ne(e,t)).catch(r=>$(r,t));function $(e,t=!0){if(!t)throw e;return ze(e).then(r=>{const n={code:"unknown_error",message:D("An unknown error occurred.")};throw r||n})}function qe(e){const t=!!e.method&&e.method==="POST";return(!!e.path&&e.path.indexOf("/wp/v2/media")!==-1||!!e.url&&e.url.indexOf("/wp/v2/media")!==-1)&&t}const Ke=(e,t)=>{if(!qe(e))return t(e);let r=0;const n=5,i=s=>(r++,t({path:`/wp/v2/media/${s}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>r<n?i(s):(t({path:`/wp/v2/media/${s}?force=true`,method:"DELETE"}),Promise.reject())));return t({...e,parse:!1}).catch(s=>{if(!s.headers)return Promise.reject(s);const a=s.headers.get("x-wp-upload-attachment-id");return s.status>=500&&s.status<600&&a?i(a).catch(()=>e.parse!==!1?Promise.reject({code:"post_process",message:D("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(s)):$(s,e.parse)}).then(s=>ce(s,e.parse))},Be=e=>(t,r)=>{if(typeof t.url=="string"){const n=j(t.url,"wp_theme_preview");n===void 0?t.url=x(t.url,{wp_theme_preview:e}):n===""&&(t.url=Z(t.url,"wp_theme_preview"))}if(typeof t.path=="string"){const n=j(t.path,"wp_theme_preview");n===void 0?t.path=x(t.path,{wp_theme_preview:e}):n===""&&(t.path=Z(t.path,"wp_theme_preview"))}return r(t)},Ge={Accept:"application/json, */*;q=0.1"},Qe={credentials:"include"},ue=[$e,se,Ue,oe];function Je(e){ue.unshift(e)}const le=e=>{if(e.status>=200&&e.status<300)return e;throw e},Xe=e=>{const{url:t,path:r,data:n,parse:i=!0,...s}=e;let{body:a,headers:c}=e;return c={...Ge,...c},n&&(a=JSON.stringify(n),c["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,{...Qe,...s,body:a,headers:c}).then(u=>Promise.resolve(u).then(le).catch(w=>$(w,i)).then(w=>ce(w,i)),u=>{throw u&&u.name==="AbortError"?u:{code:"fetch_error",message:D("You are probably offline.")}})};let de=Xe;function Ve(e){de=e}function y(e){return ue.reduceRight((r,n)=>i=>n(i,r),de)(e).catch(r=>r.code!=="rest_cookie_invalid_nonce"?Promise.reject(r):window.fetch(y.nonceEndpoint).then(le).then(n=>n.text()).then(n=>(y.nonceMiddleware.nonce=n,y(e))))}y.use=Je;y.setFetchHandler=Ve;y.createNonceMiddleware=Re;y.createPreloadingMiddleware=De;y.createRootURLMiddleware=Te;y.fetchAllMiddleware=oe;y.mediaUploadMiddleware=Ke;y.createThemePreviewMiddleware=Be;function lt(){window.editorDelegate&&window.editorDelegate.onEditorLoaded(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorLoaded",body:{}})}function dt(){window.editorDelegate&&window.editorDelegate.onEditorContentChanged(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorContentChanged"})}function ft(e){window.editorDelegate&&window.editorDelegate.openMediaLibrary(JSON.stringify(e)),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"openMediaLibrary",body:e})}function T(){if(window.GBKit)return window.GBKit;if(window.editorDelegate)try{return JSON.parse(window.editorDelegate.getEditorConfiguration())}catch{return{}}try{return JSON.parse(localStorage.getItem("GBKit"))||{}}catch{return{}}}function Ze(){const{post:e}=T();return e?{id:e.id,title:{raw:decodeURIComponent(e.title)},content:{raw:decodeURIComponent(e.content)},type:e.type||"post"}:{type:"post",status:"draft",id:-1}}function We(){const{siteApiRoot:e="",authHeader:t}=T();y.use(y.createRootURLMiddleware(e)),y.use(Ye),y.use(et),y.use(tt(t)),y.use(rt),y.use(nt),y.use(y.createPreloadingMiddleware({"/wp/v2/types?context=view":{body:{post:{description:"",hierarchical:!1,has_archive:!1,name:"Posts",slug:"post",taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}},page:{description:"",hierarchical:!0,has_archive:!1,name:"Pages",slug:"page",taxonomies:[],rest_base:"pages",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}}}},"/wp/v2/types/post?context=edit":{body:{name:"Posts",slug:"post",supports:{title:!0,editor:!0,author:!0,thumbnail:!0,excerpt:!0,trackbacks:!0,"custom-fields":!0,comments:!0,revisions:!0,"post-formats":!0,autosave:!0},taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1}}}))}function Ye(e,t){return e.mode="cors",delete e.headers["x-wp-api-fetch-from-editor"],t(e)}function et(e,t){const{siteApiNamespace:r}=T();return e.path&&r&&!e.path.includes(r)&&(e.path=e.path.replace(/^(?<apiPath>\/?(?:[\w.-]+\/){2})/,`$<apiPath>${r}/`)),t(e)}function tt(e){return(t,r)=>(t.headers=t.headers||{},e&&(t.headers.Authorization=e),r(t))}function rt(e,t){return[/^\/wp\/v2\/posts\/-?\d+/,/^\/wp\/v2\/pages\/-?\d+/].some(i=>i.test(e.path))?Promise.resolve([]):t(e)}function nt(e,t){return e.path&&e.path.startsWith("/wp/v2/media")&&e.method==="POST"&&e.body instanceof FormData&&e.body.get("post")==="-1"&&e.body.delete("post"),t(e)}window.GBKit=T();window.wp=window.wp||{};window.wp.apiFetch=y;We();it();async function it(){try{const{themeStyles:e,siteURL:t}=T(),{styles:r,scripts:n}=await y({url:`${t}/wp-json/__experimental/wp-block-editor/v1/editor-assets`});await st([...r,...n].join(""));const{dispatch:i}=window.wp.data,{store:s}=window.wp.editor,{store:a}=window.wp.preferences;y({path:"/wp-block-editor/v1/settings"}).then(h=>{i(s).updateEditorSettings(h)}).catch(()=>{const h={defaultEditorStyles:[{css:fe}]};i(s).updateEditorSettings(h)}),i(a).setDefaults("core/edit-post",{themeStyles:e});const d={post:Ze()},{default:u}=await we(async()=>{const{default:h}=await import("./index-PsmJHRPp.js");return{default:h}},__vite__mapDeps([0,1]),import.meta.url),{createRoot:w,createElement:o,StrictMode:g}=window.wp.element;w(document.getElementById("root")).render(o(g,null,o(u,d)))}catch{window.location.href="index.html?error=remote_editor_load_error"}}async function st(e){const t=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(t.querySelectorAll('link[rel="stylesheet"],script')).filter(n=>n.id&&!ot.test(n.src));for(const n of r)await ct(n)}const at=["api-fetch"],ot=new RegExp(at.flatMap(e=>[`wp-content/plugins/gutenberg/build/${e.replace(/\//g,"\\/")}\\b`,`wp-includes/js/dist/${e.replace(/\//g,"\\/")}\\b`]).join("|"));function ct(e){return new Promise(t=>{const r=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach(n=>{e[n]&&(r[n]=e[n])}),e.innerHTML&&r.appendChild(document.createTextNode(e.innerHTML)),r.onload=()=>t(!0),r.onerror=()=>{t(!1)},document.body.appendChild(r),(r.nodeName.toLowerCase()==="link"||r.nodeName.toLowerCase()==="script"&&!r.src)&&t()})}export{dt as a,lt as e,ft as o};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Fhlsxj64.js","./index-0lszm8gR.css"])))=>i.map(i=>d[i]);
import fe from"@wordpress/block-editor/build-style/default-editor-styles.css?inline";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();const pe="modulepreload",he=function(e,t){return new URL(e,t).href},N={},we=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){const a=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");i=Promise.allSettled(r.map(l=>{if(l=he(l,n),l in N)return;N[l]=!0;const w=l.endsWith(".css"),o=w?'[rel="stylesheet"]':"";if(!!n)for(let _=a.length-1;_>=0;_--){const f=a[_];if(f.href===l&&(!w||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const h=document.createElement("link");if(h.rel=w?"stylesheet":pe,w||(h.as="script"),h.crossOrigin="",h.href=l,d&&h.setAttribute("nonce",d),document.head.appendChild(h),w)return new Promise((_,f)=>{h.addEventListener("load",_),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var C={},z;function ge(){return z||(z=1,function(e){(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(c){return i(a(c),arguments)}function n(c,d){return r.apply(null,[c].concat(d||[]))}function i(c,d){var l=1,w=c.length,o,y="",h,_,f,A,S,P,O,u;for(h=0;h<w;h++)if(typeof c[h]=="string")y+=c[h];else if(typeof c[h]=="object"){if(f=c[h],f.keys)for(o=d[l],_=0;_<f.keys.length;_++){if(o==null)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',f.keys[_],f.keys[_-1]));o=o[f.keys[_]]}else f.param_no?o=d[f.param_no]:o=d[l++];if(t.not_type.test(f.type)&&t.not_primitive.test(f.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(f.type)&&typeof o!="number"&&isNaN(o))throw new TypeError(r("[sprintf] expecting number but found %T",o));switch(t.number.test(f.type)&&(O=o>=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?y+=o:(t.number.test(f.type)&&(!O||f.sign)?(u=O?"+":"-",o=o.toString().replace(t.sign,"")):u="",S=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",P=f.width-(u+o).length,A=f.width&&P>0?S.repeat(P):"",y+=f.align?u+o+A:S==="0"?u+A+o:A+u+o)}return y}var s=Object.create(null);function a(c){if(s[c])return s[c];for(var d=c,l,w=[],o=0;d;){if((l=t.text.exec(d))!==null)w.push(l[0]);else if((l=t.modulo.exec(d))!==null)w.push("%");else if((l=t.placeholder.exec(d))!==null){if(l[2]){o|=1;var y=[],h=l[2],_=[];if((_=t.key.exec(h))!==null)for(y.push(_[1]);(h=h.substring(_[0].length))!=="";)if((_=t.key_access.exec(h))!==null)y.push(_[1]);else if((_=t.index_access.exec(h))!==null)y.push(_[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=y}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");w.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");d=d.substring(l[0].length)}return s[c]=w}e.sprintf=r,e.vsprintf=n,typeof window<"u"&&(window.sprintf=r,window.vsprintf=n)})()}(C)),C}ge();var H,re,T,ne;H={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1};re=["(","?"];T={")":["("],":":["?","?:"]};ne=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function ye(e){for(var t=[],r=[],n,i,s,a;n=e.match(ne);){for(i=n[0],s=e.substr(0,n.index).trim(),s&&t.push(s);a=r.pop();){if(T[i]){if(T[i][0]===a){i=T[i][1]||i;break}}else if(re.indexOf(a)>=0||H[a]<H[i]){r.push(a);break}t.push(a)}T[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var me={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,r){if(e)throw t;return r}};function _e(e,t){var r=[],n,i,s,a,c,d;for(n=0;n<e.length;n++){if(c=e[n],a=me[c],a){for(i=a.length,s=Array(i);i--;)s[i]=r.pop();try{d=a.apply(null,s)}catch(l){return l}}else t.hasOwnProperty(c)?d=t[c]:d=+c;r.push(d)}return r[0]}function be(e){var t=ye(e);return function(r){return _e(t,r)}}function ve(e){var t=be(e);return function(r){return+t({n:r})}}var q={contextDelimiter:"",onMissingKey:null};function Ee(e){var t,r,n;for(t=e.split(";"),r=0;r<t.length;r++)if(n=t[r].trim(),n.indexOf("plural=")===0)return n.substr(7)}function j(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in q)this.options[r]=t!==void 0&&r in t?t[r]:q[r]}j.prototype.getPluralForm=function(e,t){var r=this.pluralForms[e],n,i,s;return r||(n=this.data[e][""],s=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,typeof s!="function"&&(i=Ee(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),s=ve(i)),r=this.pluralForms[e]=s),r(t)};j.prototype.dcnpgettext=function(e,t,r,n,i){var s,a,c;return i===void 0?s=0:s=this.getPluralForm(e,i),a=r,t&&(a=t+this.options.contextDelimiter+r),c=this.data[e][a],c&&c[s]?c[s]:(this.options.onMissingKey&&this.options.onMissingKey(r,e),s===0?r:n)};const K={"":{plural_forms(e){return e===1?0:1}}},xe=/^i18n\.(n?gettext|has_translation)(_|$)/,Ae=(e,t,r)=>{const n=new j({}),i=new Set,s=()=>{i.forEach(u=>u())},a=u=>(i.add(u),()=>i.delete(u)),c=(u="default")=>n.data[u],d=(u,p="default")=>{n.data[p]={...n.data[p],...u},n.data[p][""]={...K[""],...n.data[p]?.[""]},delete n.pluralForms[p]},l=(u,p)=>{d(u,p),s()},w=(u,p="default")=>{n.data[p]={...n.data[p],...u,"":{...K[""],...n.data[p]?.[""],...u?.[""]}},delete n.pluralForms[p],s()},o=(u,p)=>{n.data={},n.pluralForms={},l(u,p)},y=(u="default",p,g,v,E)=>(n.data[u]||d(void 0,u),n.dcnpgettext(u,p,g,v,E)),h=(u="default")=>u,_=(u,p)=>{let g=y(p,void 0,u);return r?(g=r.applyFilters("i18n.gettext",g,u,p),r.applyFilters("i18n.gettext_"+h(p),g,u,p)):g},f=(u,p,g)=>{let v=y(g,p,u);return r?(v=r.applyFilters("i18n.gettext_with_context",v,u,p,g),r.applyFilters("i18n.gettext_with_context_"+h(g),v,u,p,g)):v},A=(u,p,g,v)=>{let E=y(v,void 0,u,p,g);return r?(E=r.applyFilters("i18n.ngettext",E,u,p,g,v),r.applyFilters("i18n.ngettext_"+h(v),E,u,p,g,v)):E},S=(u,p,g,v,E)=>{let k=y(E,v,u,p,g);return r?(k=r.applyFilters("i18n.ngettext_with_context",k,u,p,g,v,E),r.applyFilters("i18n.ngettext_with_context_"+h(E),k,u,p,g,v,E)):k},P=()=>f("ltr","text direction")==="rtl",O=(u,p,g)=>{const v=p?p+""+u:u;let E=!!n.data?.[g??"default"]?.[v];return r&&(E=r.applyFilters("i18n.has_translation",E,u,p,g),E=r.applyFilters("i18n.has_translation_"+h(g),E,u,p,g)),E};if(r){const u=p=>{xe.test(p)&&s()};r.addAction("hookAdded","core/i18n",u),r.addAction("hookRemoved","core/i18n",u)}return{getLocaleData:c,setLocaleData:l,addLocaleData:w,resetLocaleData:o,subscribe:a,__:_,_x:f,_n:A,_nx:S,isRTL:P,hasTranslation:O}};function ie(e){return typeof e!="string"||e===""?(console.error("The namespace must be a non-empty string."),!1):/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)?!0:(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}function U(e){return typeof e!="string"||e===""?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)?!0:(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}function B(e,t){return function(n,i,s,a=10){const c=e[t];if(!U(n)||!ie(i))return;if(typeof s!="function"){console.error("The hook callback must be a function.");return}if(typeof a!="number"){console.error("If specified, the hook priority must be a number.");return}const d={callback:s,priority:a,namespace:i};if(c[n]){const l=c[n].handlers;let w;for(w=l.length;w>0&&!(a>=l[w-1].priority);w--);w===l.length?l[w]=d:l.splice(w,0,d),c.__current.forEach(o=>{o.name===n&&o.currentIndex>=w&&o.currentIndex++})}else c[n]={handlers:[d],runs:0};n!=="hookAdded"&&e.doAction("hookAdded",n,i,s,a)}}function D(e,t,r=!1){return function(i,s){const a=e[t];if(!U(i)||!r&&!ie(s))return;if(!a[i])return 0;let c=0;if(r)c=a[i].handlers.length,a[i]={runs:a[i].runs,handlers:[]};else{const d=a[i].handlers;for(let l=d.length-1;l>=0;l--)d[l].namespace===s&&(d.splice(l,1),c++,a.__current.forEach(w=>{w.name===i&&w.currentIndex>=l&&w.currentIndex--}))}return i!=="hookRemoved"&&e.doAction("hookRemoved",i,s),c}}function G(e,t){return function(n,i){const s=e[t];return typeof i<"u"?n in s&&s[n].handlers.some(a=>a.namespace===i):n in s}}function M(e,t,r,n){return function(s,...a){const c=e[t];c[s]||(c[s]={handlers:[],runs:0}),c[s].runs++;const d=c[s].handlers;if(!d||!d.length)return r?a[0]:void 0;const l={name:s,currentIndex:0};async function w(){try{c.__current.add(l);let y=r?a[0]:void 0;for(;l.currentIndex<d.length;)y=await d[l.currentIndex].callback.apply(null,a),r&&(a[0]=y),l.currentIndex++;return r?y:void 0}finally{c.__current.delete(l)}}function o(){try{c.__current.add(l);let y=r?a[0]:void 0;for(;l.currentIndex<d.length;)y=d[l.currentIndex].callback.apply(null,a),r&&(a[0]=y),l.currentIndex++;return r?y:void 0}finally{c.__current.delete(l)}}return(n?w:o)()}}function Q(e,t){return function(){var n;const i=e[t];return(n=Array.from(i.__current).at(-1)?.name)!==null&&n!==void 0?n:null}}function J(e,t){return function(n){const i=e[t];return typeof n>"u"?i.__current.size>0:Array.from(i.__current).some(s=>s.name===n)}}function X(e,t){return function(n){const i=e[t];if(U(n))return i[n]&&i[n].runs?i[n].runs:0}}class Se{constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=B(this,"actions"),this.addFilter=B(this,"filters"),this.removeAction=D(this,"actions"),this.removeFilter=D(this,"filters"),this.hasAction=G(this,"actions"),this.hasFilter=G(this,"filters"),this.removeAllActions=D(this,"actions",!0),this.removeAllFilters=D(this,"filters",!0),this.doAction=M(this,"actions",!1,!1),this.doActionAsync=M(this,"actions",!1,!0),this.applyFilters=M(this,"filters",!0,!1),this.applyFiltersAsync=M(this,"filters",!0,!0),this.currentAction=Q(this,"actions"),this.currentFilter=Q(this,"filters"),this.doingAction=J(this,"actions"),this.doingFilter=J(this,"filters"),this.didAction=X(this,"actions"),this.didFilter=X(this,"filters")}}function Pe(){return new Se}const Oe=Pe(),b=Ae(void 0,void 0,Oe);b.getLocaleData.bind(b);b.setLocaleData.bind(b);b.resetLocaleData.bind(b);b.subscribe.bind(b);const L=b.__.bind(b);b._x.bind(b);b._n.bind(b);b._nx.bind(b);b.isRTL.bind(b);b.hasTranslation.bind(b);function Te(e){const t=(r,n)=>{const{headers:i={}}=r;for(const s in i)if(s.toLowerCase()==="x-wp-nonce"&&i[s]===t.nonce)return n(r);return n({...r,headers:{...i,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t}const se=(e,t)=>{let r=e.path,n,i;return typeof e.namespace=="string"&&typeof e.endpoint=="string"&&(n=e.namespace.replace(/^\/|\/$/g,""),i=e.endpoint.replace(/^\//,""),i?r=n+"/"+i:r=n),delete e.namespace,delete e.endpoint,t({...e,path:r})},Re=e=>(t,r)=>se(t,n=>{let i=n.url,s=n.path,a;return typeof s=="string"&&(a=e,e.indexOf("?")!==-1&&(s=s.replace("?","&")),s=s.replace(/^\//,""),typeof a=="string"&&a.indexOf("?")!==-1&&(s=s.replace("?","&")),i=a+s),r({...n,url:i})});function ke(e){let t;try{t=new URL(e,"http://example.com").search.substring(1)}catch{}if(t)return t}function ae(e){let t="";const r=Object.entries(e);let n;for(;n=r.shift();){let[i,s]=n;if(Array.isArray(s)||s&&s.constructor===Object){const c=Object.entries(s).reverse();for(const[d,l]of c)r.unshift([`${i}[${d}]`,l])}else s!==void 0&&(s===null&&(s=""),t+="&"+[i,s].map(encodeURIComponent).join("="))}return t.substr(1)}function De(e){try{return decodeURIComponent(e)}catch{return e}}function Me(e,t,r){const n=t.length,i=n-1;for(let s=0;s<n;s++){let a=t[s];!a&&Array.isArray(e)&&(a=e.length.toString()),a=["__proto__","constructor","prototype"].includes(a)?a.toUpperCase():a;const c=!isNaN(Number(t[s+1]));e[a]=s===i?r:e[a]||(c?[]:{}),Array.isArray(e[a])&&!c&&(e[a]={...e[a]}),e=e[a]}}function F(e){return(ke(e)||"").replace(/\+/g,"%20").split("&").reduce((t,r)=>{const[n,i=""]=r.split("=").filter(Boolean).map(De);if(n){const s=n.replace(/\]/g,"").split("[");Me(t,s,i)}return t},Object.create(null))}function x(e="",t){if(!t||!Object.keys(t).length)return e;let r=e;const n=e.indexOf("?");return n!==-1&&(t=Object.assign(F(e),t),r=r.substr(0,n)),r+"?"+ae(t)}function I(e,t){return F(e)[t]}function V(e,t){return I(e,t)!==void 0}function Z(e,...t){const r=e.indexOf("?");if(r===-1)return e;const n=F(e),i=e.substr(0,r);t.forEach(a=>delete n[a]);const s=ae(n);return s?i+"?"+s:i}function W(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map(i=>i.split("=")).map(i=>i.map(decodeURIComponent)).sort((i,s)=>i[0].localeCompare(s[0])).map(i=>i.map(encodeURIComponent)).map(i=>i.join("=")).join("&"):n}function Le(e){const t=Object.fromEntries(Object.entries(e).map(([r,n])=>[W(r),n]));return(r,n)=>{const{parse:i=!0}=r;let s=r.path;if(!s&&r.url){const{rest_route:d,...l}=F(r.url);typeof d=="string"&&(s=x(d,l))}if(typeof s!="string")return n(r);const a=r.method||"GET",c=W(s);if(a==="GET"&&t[c]){const d=t[c];return delete t[c],Y(d,!!i)}else if(a==="OPTIONS"&&t[a]&&t[a][c]){const d=t[a][c];return delete t[a][c],Y(d,!!i)}return n(r)}}function Y(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}const Fe=({path:e,url:t,...r},n)=>({...r,url:t&&x(t,n),path:e&&x(e,n)}),ee=e=>e.json?e.json():Promise.reject(e),Ce=e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}},te=e=>{const{next:t}=Ce(e.headers.get("link"));return t},He=e=>{const t=!!e.path&&e.path.indexOf("per_page=-1")!==-1,r=!!e.url&&e.url.indexOf("per_page=-1")!==-1;return t||r},oe=async(e,t)=>{if(e.parse===!1||!He(e))return t(e);const r=await m({...Fe(e,{per_page:100}),parse:!1}),n=await ee(r);if(!Array.isArray(n))return n;let i=te(r);if(!i)return n;let s=[].concat(n);for(;i;){const a=await m({...e,path:void 0,url:i,parse:!1}),c=await ee(a);s=s.concat(c),i=te(a)}return s},Ie=new Set(["PATCH","PUT","DELETE"]),je="GET",Ue=(e,t)=>{const{method:r=je}=e;return Ie.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},$e=(e,t)=>(typeof e.url=="string"&&!V(e.url,"_locale")&&(e.url=x(e.url,{_locale:"user"})),typeof e.path=="string"&&!V(e.path,"_locale")&&(e.path=x(e.path,{_locale:"user"})),t(e)),Ne=(e,t=!0)=>t?e.status===204?null:e.json?e.json():Promise.reject(e):e,ze=e=>{const t={code:"invalid_json",message:L("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch(()=>{throw t})},ce=(e,t=!0)=>Promise.resolve(Ne(e,t)).catch(r=>$(r,t));function $(e,t=!0){if(!t)throw e;return ze(e).then(r=>{const n={code:"unknown_error",message:L("An unknown error occurred.")};throw r||n})}function qe(e){const t=!!e.method&&e.method==="POST";return(!!e.path&&e.path.indexOf("/wp/v2/media")!==-1||!!e.url&&e.url.indexOf("/wp/v2/media")!==-1)&&t}const Ke=(e,t)=>{if(!qe(e))return t(e);let r=0;const n=5,i=s=>(r++,t({path:`/wp/v2/media/${s}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>r<n?i(s):(t({path:`/wp/v2/media/${s}?force=true`,method:"DELETE"}),Promise.reject())));return t({...e,parse:!1}).catch(s=>{if(!s.headers)return Promise.reject(s);const a=s.headers.get("x-wp-upload-attachment-id");return s.status>=500&&s.status<600&&a?i(a).catch(()=>e.parse!==!1?Promise.reject({code:"post_process",message:L("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(s)):$(s,e.parse)}).then(s=>ce(s,e.parse))},Be=e=>(t,r)=>{if(typeof t.url=="string"){const n=I(t.url,"wp_theme_preview");n===void 0?t.url=x(t.url,{wp_theme_preview:e}):n===""&&(t.url=Z(t.url,"wp_theme_preview"))}if(typeof t.path=="string"){const n=I(t.path,"wp_theme_preview");n===void 0?t.path=x(t.path,{wp_theme_preview:e}):n===""&&(t.path=Z(t.path,"wp_theme_preview"))}return r(t)},Ge={Accept:"application/json, */*;q=0.1"},Qe={credentials:"include"},le=[$e,se,Ue,oe];function Je(e){le.unshift(e)}const ue=e=>{if(e.status>=200&&e.status<300)return e;throw e},Xe=e=>{const{url:t,path:r,data:n,parse:i=!0,...s}=e;let{body:a,headers:c}=e;return c={...Ge,...c},n&&(a=JSON.stringify(n),c["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,{...Qe,...s,body:a,headers:c}).then(l=>Promise.resolve(l).then(ue).catch(w=>$(w,i)).then(w=>ce(w,i)),l=>{throw l&&l.name==="AbortError"?l:{code:"fetch_error",message:L("You are probably offline.")}})};let de=Xe;function Ve(e){de=e}function m(e){return le.reduceRight((r,n)=>i=>n(i,r),de)(e).catch(r=>r.code!=="rest_cookie_invalid_nonce"?Promise.reject(r):window.fetch(m.nonceEndpoint).then(ue).then(n=>n.text()).then(n=>(m.nonceMiddleware.nonce=n,m(e))))}m.use=Je;m.setFetchHandler=Ve;m.createNonceMiddleware=Te;m.createPreloadingMiddleware=Le;m.createRootURLMiddleware=Re;m.fetchAllMiddleware=oe;m.mediaUploadMiddleware=Ke;m.createThemePreviewMiddleware=Be;function ut(){window.editorDelegate&&window.editorDelegate.onEditorLoaded(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorLoaded",body:{}})}function dt(){window.editorDelegate&&window.editorDelegate.onEditorContentChanged(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorContentChanged"})}function ft(e,t){window.editorDelegate&&window.editorDelegate.onEditorHistoryChanged(e,t),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorHistoryChanged",body:{hasUndo:e,hasRedo:t}})}function pt(e){window.editorDelegate&&window.editorDelegate.openMediaLibrary(JSON.stringify(e)),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"openMediaLibrary",body:e})}function R(){if(window.GBKit)return window.GBKit;if(window.editorDelegate)try{return JSON.parse(window.editorDelegate.getEditorConfiguration())}catch{return{}}try{return JSON.parse(localStorage.getItem("GBKit"))||{}}catch{return{}}}function Ze(){const{post:e}=R();return e?{id:e.id,title:{raw:decodeURIComponent(e.title)},content:{raw:decodeURIComponent(e.content)},type:e.type||"post"}:{type:"post",status:"draft",id:-1}}function We(){const{siteApiRoot:e="",authHeader:t}=R();m.use(m.createRootURLMiddleware(e)),m.use(Ye),m.use(et),m.use(tt(t)),m.use(rt),m.use(nt),m.use(m.createPreloadingMiddleware({"/wp/v2/types?context=view":{body:{post:{description:"",hierarchical:!1,has_archive:!1,name:"Posts",slug:"post",taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}},page:{description:"",hierarchical:!0,has_archive:!1,name:"Pages",slug:"page",taxonomies:[],rest_base:"pages",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}}}},"/wp/v2/types/post?context=edit":{body:{name:"Posts",slug:"post",supports:{title:!0,editor:!0,author:!0,thumbnail:!0,excerpt:!0,trackbacks:!0,"custom-fields":!0,comments:!0,revisions:!0,"post-formats":!0,autosave:!0},taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1}}}))}function Ye(e,t){return e.mode="cors",delete e.headers["x-wp-api-fetch-from-editor"],t(e)}function et(e,t){const{siteApiNamespace:r}=R();return e.path&&r&&!e.path.includes(r)&&(e.path=e.path.replace(/^(?<apiPath>\/?(?:[\w.-]+\/){2})/,`$<apiPath>${r}/`)),t(e)}function tt(e){return(t,r)=>(t.headers=t.headers||{},e&&(t.headers.Authorization=e),r(t))}function rt(e,t){return[/^\/wp\/v2\/posts\/-?\d+/,/^\/wp\/v2\/pages\/-?\d+/].some(i=>i.test(e.path))?Promise.resolve([]):t(e)}function nt(e,t){return e.path&&e.path.startsWith("/wp/v2/media")&&e.method==="POST"&&e.body instanceof FormData&&e.body.get("post")==="-1"&&e.body.delete("post"),t(e)}window.GBKit=R();window.wp=window.wp||{};window.wp.apiFetch=m;We();it();async function it(){try{const{themeStyles:e,siteURL:t}=R(),{styles:r,scripts:n}=await m({url:`${t}/wp-json/__experimental/wp-block-editor/v1/editor-assets`});await st([...r,...n].join(""));const{dispatch:i}=window.wp.data,{store:s}=window.wp.editor,{store:a}=window.wp.preferences;m({path:"/wp-block-editor/v1/settings"}).then(h=>{i(s).updateEditorSettings(h)}).catch(()=>{const h={defaultEditorStyles:[{css:fe}]};i(s).updateEditorSettings(h)}),i(a).setDefaults("core/edit-post",{themeStyles:e});const d={post:Ze()},{default:l}=await we(async()=>{const{default:h}=await import("./index-Fhlsxj64.js");return{default:h}},__vite__mapDeps([0,1]),import.meta.url),{createRoot:w,createElement:o,StrictMode:y}=window.wp.element;w(document.getElementById("root")).render(o(y,null,o(l,d)))}catch{window.location.href="index.html?error=remote_editor_load_error"}}async function st(e){const t=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(t.querySelectorAll('link[rel="stylesheet"],script')).filter(n=>n.id&&!ot.test(n.src));for(const n of r)await ct(n)}const at=["api-fetch"],ot=new RegExp(at.flatMap(e=>[`wp-content/plugins/gutenberg/build/${e.replace(/\//g,"\\/")}\\b`,`wp-includes/js/dist/${e.replace(/\//g,"\\/")}\\b`]).join("|"));function ct(e){return new Promise(t=>{const r=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach(n=>{e[n]&&(r[n]=e[n])}),e.innerHTML&&r.appendChild(document.createTextNode(e.innerHTML)),r.onload=()=>t(!0),r.onerror=()=>{t(!1)},document.body.appendChild(r),(r.nodeName.toLowerCase()==="link"||r.nodeName.toLowerCase()==="script"&&!r.src)&&t()})}export{dt as a,ft as b,ut as e,pt as o};

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix AI 4 days ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-PsmJHRPp.js","./index-0lszm8gR.css"])))=>i.map(i=>d[i]);
import fe from"@wordpress/block-editor/build-style/default-editor-styles.css?inline";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();const pe="modulepreload",he=function(e,t){return new URL(e,t).href},N={},we=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){const a=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");i=Promise.allSettled(r.map(u=>{if(u=he(u,n),u in N)return;N[u]=!0;const w=u.endsWith(".css"),o=w?'[rel="stylesheet"]':"";if(!!n)for(let _=a.length-1;_>=0;_--){const f=a[_];if(f.href===u&&(!w||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${o}`))return;const h=document.createElement("link");if(h.rel=w?"stylesheet":pe,w||(h.as="script"),h.crossOrigin="",h.href=u,d&&h.setAttribute("nonce",d),document.head.appendChild(h),w)return new Promise((_,f)=>{h.addEventListener("load",_),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var I={},z;function me(){return z||(z=1,function(e){(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(c){return i(a(c),arguments)}function n(c,d){return r.apply(null,[c].concat(d||[]))}function i(c,d){var u=1,w=c.length,o,g="",h,_,f,A,S,P,O,l;for(h=0;h<w;h++)if(typeof c[h]=="string")g+=c[h];else if(typeof c[h]=="object"){if(f=c[h],f.keys)for(o=d[u],_=0;_<f.keys.length;_++){if(o==null)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',f.keys[_],f.keys[_-1]));o=o[f.keys[_]]}else f.param_no?o=d[f.param_no]:o=d[u++];if(t.not_type.test(f.type)&&t.not_primitive.test(f.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(f.type)&&typeof o!="number"&&isNaN(o))throw new TypeError(r("[sprintf] expecting number but found %T",o));switch(t.number.test(f.type)&&(O=o>=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?g+=o:(t.number.test(f.type)&&(!O||f.sign)?(l=O?"+":"-",o=o.toString().replace(t.sign,"")):l="",S=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",P=f.width-(l+o).length,A=f.width&&P>0?S.repeat(P):"",g+=f.align?l+o+A:S==="0"?l+A+o:A+l+o)}return g}var s=Object.create(null);function a(c){if(s[c])return s[c];for(var d=c,u,w=[],o=0;d;){if((u=t.text.exec(d))!==null)w.push(u[0]);else if((u=t.modulo.exec(d))!==null)w.push("%");else if((u=t.placeholder.exec(d))!==null){if(u[2]){o|=1;var g=[],h=u[2],_=[];if((_=t.key.exec(h))!==null)for(g.push(_[1]);(h=h.substring(_[0].length))!=="";)if((_=t.key_access.exec(h))!==null)g.push(_[1]);else if((_=t.index_access.exec(h))!==null)g.push(_[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");u[2]=g}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");w.push({placeholder:u[0],param_no:u[1],keys:u[2],sign:u[3],pad_char:u[4],align:u[5],width:u[6],precision:u[7],type:u[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");d=d.substring(u[0].length)}return s[c]=w}e.sprintf=r,e.vsprintf=n,typeof window<"u"&&(window.sprintf=r,window.vsprintf=n)})()}(I)),I}me();var C,re,R,ne;C={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1};re=["(","?"];R={")":["("],":":["?","?:"]};ne=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function ge(e){for(var t=[],r=[],n,i,s,a;n=e.match(ne);){for(i=n[0],s=e.substr(0,n.index).trim(),s&&t.push(s);a=r.pop();){if(R[i]){if(R[i][0]===a){i=R[i][1]||i;break}}else if(re.indexOf(a)>=0||C[a]<C[i]){r.push(a);break}t.push(a)}R[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var ye={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,r){if(e)throw t;return r}};function _e(e,t){var r=[],n,i,s,a,c,d;for(n=0;n<e.length;n++){if(c=e[n],a=ye[c],a){for(i=a.length,s=Array(i);i--;)s[i]=r.pop();try{d=a.apply(null,s)}catch(u){return u}}else t.hasOwnProperty(c)?d=t[c]:d=+c;r.push(d)}return r[0]}function be(e){var t=ge(e);return function(r){return _e(t,r)}}function ve(e){var t=be(e);return function(r){return+t({n:r})}}var q={contextDelimiter:"",onMissingKey:null};function Ee(e){var t,r,n;for(t=e.split(";"),r=0;r<t.length;r++)if(n=t[r].trim(),n.indexOf("plural=")===0)return n.substr(7)}function H(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in q)this.options[r]=t!==void 0&&r in t?t[r]:q[r]}H.prototype.getPluralForm=function(e,t){var r=this.pluralForms[e],n,i,s;return r||(n=this.data[e][""],s=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,typeof s!="function"&&(i=Ee(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),s=ve(i)),r=this.pluralForms[e]=s),r(t)};H.prototype.dcnpgettext=function(e,t,r,n,i){var s,a,c;return i===void 0?s=0:s=this.getPluralForm(e,i),a=r,t&&(a=t+this.options.contextDelimiter+r),c=this.data[e][a],c&&c[s]?c[s]:(this.options.onMissingKey&&this.options.onMissingKey(r,e),s===0?r:n)};const K={"":{plural_forms(e){return e===1?0:1}}},xe=/^i18n\.(n?gettext|has_translation)(_|$)/,Ae=(e,t,r)=>{const n=new H({}),i=new Set,s=()=>{i.forEach(l=>l())},a=l=>(i.add(l),()=>i.delete(l)),c=(l="default")=>n.data[l],d=(l,p="default")=>{n.data[p]={...n.data[p],...l},n.data[p][""]={...K[""],...n.data[p]?.[""]},delete n.pluralForms[p]},u=(l,p)=>{d(l,p),s()},w=(l,p="default")=>{n.data[p]={...n.data[p],...l,"":{...K[""],...n.data[p]?.[""],...l?.[""]}},delete n.pluralForms[p],s()},o=(l,p)=>{n.data={},n.pluralForms={},u(l,p)},g=(l="default",p,m,v,E)=>(n.data[l]||d(void 0,l),n.dcnpgettext(l,p,m,v,E)),h=(l="default")=>l,_=(l,p)=>{let m=g(p,void 0,l);return r?(m=r.applyFilters("i18n.gettext",m,l,p),r.applyFilters("i18n.gettext_"+h(p),m,l,p)):m},f=(l,p,m)=>{let v=g(m,p,l);return r?(v=r.applyFilters("i18n.gettext_with_context",v,l,p,m),r.applyFilters("i18n.gettext_with_context_"+h(m),v,l,p,m)):v},A=(l,p,m,v)=>{let E=g(v,void 0,l,p,m);return r?(E=r.applyFilters("i18n.ngettext",E,l,p,m,v),r.applyFilters("i18n.ngettext_"+h(v),E,l,p,m,v)):E},S=(l,p,m,v,E)=>{let k=g(E,v,l,p,m);return r?(k=r.applyFilters("i18n.ngettext_with_context",k,l,p,m,v,E),r.applyFilters("i18n.ngettext_with_context_"+h(E),k,l,p,m,v,E)):k},P=()=>f("ltr","text direction")==="rtl",O=(l,p,m)=>{const v=p?p+""+l:l;let E=!!n.data?.[m??"default"]?.[v];return r&&(E=r.applyFilters("i18n.has_translation",E,l,p,m),E=r.applyFilters("i18n.has_translation_"+h(m),E,l,p,m)),E};if(r){const l=p=>{xe.test(p)&&s()};r.addAction("hookAdded","core/i18n",l),r.addAction("hookRemoved","core/i18n",l)}return{getLocaleData:c,setLocaleData:u,addLocaleData:w,resetLocaleData:o,subscribe:a,__:_,_x:f,_n:A,_nx:S,isRTL:P,hasTranslation:O}};function ie(e){return typeof e!="string"||e===""?(console.error("The namespace must be a non-empty string."),!1):/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)?!0:(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}function U(e){return typeof e!="string"||e===""?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)?!0:(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}function B(e,t){return function(n,i,s,a=10){const c=e[t];if(!U(n)||!ie(i))return;if(typeof s!="function"){console.error("The hook callback must be a function.");return}if(typeof a!="number"){console.error("If specified, the hook priority must be a number.");return}const d={callback:s,priority:a,namespace:i};if(c[n]){const u=c[n].handlers;let w;for(w=u.length;w>0&&!(a>=u[w-1].priority);w--);w===u.length?u[w]=d:u.splice(w,0,d),c.__current.forEach(o=>{o.name===n&&o.currentIndex>=w&&o.currentIndex++})}else c[n]={handlers:[d],runs:0};n!=="hookAdded"&&e.doAction("hookAdded",n,i,s,a)}}function M(e,t,r=!1){return function(i,s){const a=e[t];if(!U(i)||!r&&!ie(s))return;if(!a[i])return 0;let c=0;if(r)c=a[i].handlers.length,a[i]={runs:a[i].runs,handlers:[]};else{const d=a[i].handlers;for(let u=d.length-1;u>=0;u--)d[u].namespace===s&&(d.splice(u,1),c++,a.__current.forEach(w=>{w.name===i&&w.currentIndex>=u&&w.currentIndex--}))}return i!=="hookRemoved"&&e.doAction("hookRemoved",i,s),c}}function G(e,t){return function(n,i){const s=e[t];return typeof i<"u"?n in s&&s[n].handlers.some(a=>a.namespace===i):n in s}}function L(e,t,r,n){return function(s,...a){const c=e[t];c[s]||(c[s]={handlers:[],runs:0}),c[s].runs++;const d=c[s].handlers;if(!d||!d.length)return r?a[0]:void 0;const u={name:s,currentIndex:0};async function w(){try{c.__current.add(u);let g=r?a[0]:void 0;for(;u.currentIndex<d.length;)g=await d[u.currentIndex].callback.apply(null,a),r&&(a[0]=g),u.currentIndex++;return r?g:void 0}finally{c.__current.delete(u)}}function o(){try{c.__current.add(u);let g=r?a[0]:void 0;for(;u.currentIndex<d.length;)g=d[u.currentIndex].callback.apply(null,a),r&&(a[0]=g),u.currentIndex++;return r?g:void 0}finally{c.__current.delete(u)}}return(n?w:o)()}}function Q(e,t){return function(){var n;const i=e[t];return(n=Array.from(i.__current).at(-1)?.name)!==null&&n!==void 0?n:null}}function J(e,t){return function(n){const i=e[t];return typeof n>"u"?i.__current.size>0:Array.from(i.__current).some(s=>s.name===n)}}function X(e,t){return function(n){const i=e[t];if(U(n))return i[n]&&i[n].runs?i[n].runs:0}}class Se{constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=B(this,"actions"),this.addFilter=B(this,"filters"),this.removeAction=M(this,"actions"),this.removeFilter=M(this,"filters"),this.hasAction=G(this,"actions"),this.hasFilter=G(this,"filters"),this.removeAllActions=M(this,"actions",!0),this.removeAllFilters=M(this,"filters",!0),this.doAction=L(this,"actions",!1,!1),this.doActionAsync=L(this,"actions",!1,!0),this.applyFilters=L(this,"filters",!0,!1),this.applyFiltersAsync=L(this,"filters",!0,!0),this.currentAction=Q(this,"actions"),this.currentFilter=Q(this,"filters"),this.doingAction=J(this,"actions"),this.doingFilter=J(this,"filters"),this.didAction=X(this,"actions"),this.didFilter=X(this,"filters")}}function Pe(){return new Se}const Oe=Pe(),b=Ae(void 0,void 0,Oe);b.getLocaleData.bind(b);b.setLocaleData.bind(b);b.resetLocaleData.bind(b);b.subscribe.bind(b);const D=b.__.bind(b);b._x.bind(b);b._n.bind(b);b._nx.bind(b);b.isRTL.bind(b);b.hasTranslation.bind(b);function Re(e){const t=(r,n)=>{const{headers:i={}}=r;for(const s in i)if(s.toLowerCase()==="x-wp-nonce"&&i[s]===t.nonce)return n(r);return n({...r,headers:{...i,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t}const se=(e,t)=>{let r=e.path,n,i;return typeof e.namespace=="string"&&typeof e.endpoint=="string"&&(n=e.namespace.replace(/^\/|\/$/g,""),i=e.endpoint.replace(/^\//,""),i?r=n+"/"+i:r=n),delete e.namespace,delete e.endpoint,t({...e,path:r})},Te=e=>(t,r)=>se(t,n=>{let i=n.url,s=n.path,a;return typeof s=="string"&&(a=e,e.indexOf("?")!==-1&&(s=s.replace("?","&")),s=s.replace(/^\//,""),typeof a=="string"&&a.indexOf("?")!==-1&&(s=s.replace("?","&")),i=a+s),r({...n,url:i})});function ke(e){let t;try{t=new URL(e,"http://example.com").search.substring(1)}catch{}if(t)return t}function ae(e){let t="";const r=Object.entries(e);let n;for(;n=r.shift();){let[i,s]=n;if(Array.isArray(s)||s&&s.constructor===Object){const c=Object.entries(s).reverse();for(const[d,u]of c)r.unshift([`${i}[${d}]`,u])}else s!==void 0&&(s===null&&(s=""),t+="&"+[i,s].map(encodeURIComponent).join("="))}return t.substr(1)}function Me(e){try{return decodeURIComponent(e)}catch{return e}}function Le(e,t,r){const n=t.length,i=n-1;for(let s=0;s<n;s++){let a=t[s];!a&&Array.isArray(e)&&(a=e.length.toString()),a=["__proto__","constructor","prototype"].includes(a)?a.toUpperCase():a;const c=!isNaN(Number(t[s+1]));e[a]=s===i?r:e[a]||(c?[]:{}),Array.isArray(e[a])&&!c&&(e[a]={...e[a]}),e=e[a]}}function F(e){return(ke(e)||"").replace(/\+/g,"%20").split("&").reduce((t,r)=>{const[n,i=""]=r.split("=").filter(Boolean).map(Me);if(n){const s=n.replace(/\]/g,"").split("[");Le(t,s,i)}return t},Object.create(null))}function x(e="",t){if(!t||!Object.keys(t).length)return e;let r=e;const n=e.indexOf("?");return n!==-1&&(t=Object.assign(F(e),t),r=r.substr(0,n)),r+"?"+ae(t)}function j(e,t){return F(e)[t]}function V(e,t){return j(e,t)!==void 0}function Z(e,...t){const r=e.indexOf("?");if(r===-1)return e;const n=F(e),i=e.substr(0,r);t.forEach(a=>delete n[a]);const s=ae(n);return s?i+"?"+s:i}function W(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map(i=>i.split("=")).map(i=>i.map(decodeURIComponent)).sort((i,s)=>i[0].localeCompare(s[0])).map(i=>i.map(encodeURIComponent)).map(i=>i.join("=")).join("&"):n}function De(e){const t=Object.fromEntries(Object.entries(e).map(([r,n])=>[W(r),n]));return(r,n)=>{const{parse:i=!0}=r;let s=r.path;if(!s&&r.url){const{rest_route:d,...u}=F(r.url);typeof d=="string"&&(s=x(d,u))}if(typeof s!="string")return n(r);const a=r.method||"GET",c=W(s);if(a==="GET"&&t[c]){const d=t[c];return delete t[c],Y(d,!!i)}else if(a==="OPTIONS"&&t[a]&&t[a][c]){const d=t[a][c];return delete t[a][c],Y(d,!!i)}return n(r)}}function Y(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}const Fe=({path:e,url:t,...r},n)=>({...r,url:t&&x(t,n),path:e&&x(e,n)}),ee=e=>e.json?e.json():Promise.reject(e),Ie=e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}},te=e=>{const{next:t}=Ie(e.headers.get("link"));return t},Ce=e=>{const t=!!e.path&&e.path.indexOf("per_page=-1")!==-1,r=!!e.url&&e.url.indexOf("per_page=-1")!==-1;return t||r},oe=async(e,t)=>{if(e.parse===!1||!Ce(e))return t(e);const r=await y({...Fe(e,{per_page:100}),parse:!1}),n=await ee(r);if(!Array.isArray(n))return n;let i=te(r);if(!i)return n;let s=[].concat(n);for(;i;){const a=await y({...e,path:void 0,url:i,parse:!1}),c=await ee(a);s=s.concat(c),i=te(a)}return s},je=new Set(["PATCH","PUT","DELETE"]),He="GET",Ue=(e,t)=>{const{method:r=He}=e;return je.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},$e=(e,t)=>(typeof e.url=="string"&&!V(e.url,"_locale")&&(e.url=x(e.url,{_locale:"user"})),typeof e.path=="string"&&!V(e.path,"_locale")&&(e.path=x(e.path,{_locale:"user"})),t(e)),Ne=(e,t=!0)=>t?e.status===204?null:e.json?e.json():Promise.reject(e):e,ze=e=>{const t={code:"invalid_json",message:D("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch(()=>{throw t})},ce=(e,t=!0)=>Promise.resolve(Ne(e,t)).catch(r=>$(r,t));function $(e,t=!0){if(!t)throw e;return ze(e).then(r=>{const n={code:"unknown_error",message:D("An unknown error occurred.")};throw r||n})}function qe(e){const t=!!e.method&&e.method==="POST";return(!!e.path&&e.path.indexOf("/wp/v2/media")!==-1||!!e.url&&e.url.indexOf("/wp/v2/media")!==-1)&&t}const Ke=(e,t)=>{if(!qe(e))return t(e);let r=0;const n=5,i=s=>(r++,t({path:`/wp/v2/media/${s}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>r<n?i(s):(t({path:`/wp/v2/media/${s}?force=true`,method:"DELETE"}),Promise.reject())));return t({...e,parse:!1}).catch(s=>{if(!s.headers)return Promise.reject(s);const a=s.headers.get("x-wp-upload-attachment-id");return s.status>=500&&s.status<600&&a?i(a).catch(()=>e.parse!==!1?Promise.reject({code:"post_process",message:D("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(s)):$(s,e.parse)}).then(s=>ce(s,e.parse))},Be=e=>(t,r)=>{if(typeof t.url=="string"){const n=j(t.url,"wp_theme_preview");n===void 0?t.url=x(t.url,{wp_theme_preview:e}):n===""&&(t.url=Z(t.url,"wp_theme_preview"))}if(typeof t.path=="string"){const n=j(t.path,"wp_theme_preview");n===void 0?t.path=x(t.path,{wp_theme_preview:e}):n===""&&(t.path=Z(t.path,"wp_theme_preview"))}return r(t)},Ge={Accept:"application/json, */*;q=0.1"},Qe={credentials:"include"},ue=[$e,se,Ue,oe];function Je(e){ue.unshift(e)}const le=e=>{if(e.status>=200&&e.status<300)return e;throw e},Xe=e=>{const{url:t,path:r,data:n,parse:i=!0,...s}=e;let{body:a,headers:c}=e;return c={...Ge,...c},n&&(a=JSON.stringify(n),c["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,{...Qe,...s,body:a,headers:c}).then(u=>Promise.resolve(u).then(le).catch(w=>$(w,i)).then(w=>ce(w,i)),u=>{throw u&&u.name==="AbortError"?u:{code:"fetch_error",message:D("You are probably offline.")}})};let de=Xe;function Ve(e){de=e}function y(e){return ue.reduceRight((r,n)=>i=>n(i,r),de)(e).catch(r=>r.code!=="rest_cookie_invalid_nonce"?Promise.reject(r):window.fetch(y.nonceEndpoint).then(le).then(n=>n.text()).then(n=>(y.nonceMiddleware.nonce=n,y(e))))}y.use=Je;y.setFetchHandler=Ve;y.createNonceMiddleware=Re;y.createPreloadingMiddleware=De;y.createRootURLMiddleware=Te;y.fetchAllMiddleware=oe;y.mediaUploadMiddleware=Ke;y.createThemePreviewMiddleware=Be;function lt(){window.editorDelegate&&window.editorDelegate.onEditorLoaded(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorLoaded",body:{}})}function dt(){window.editorDelegate&&window.editorDelegate.onEditorContentChanged(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorContentChanged"})}function ft(e){window.editorDelegate&&window.editorDelegate.openMediaLibrary(JSON.stringify(e)),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"openMediaLibrary",body:e})}function T(){if(window.GBKit)return window.GBKit;if(window.editorDelegate)try{return JSON.parse(window.editorDelegate.getEditorConfiguration())}catch{return{}}try{return JSON.parse(localStorage.getItem("GBKit"))||{}}catch{return{}}}function Ze(){const{post:e}=T();return e?{id:e.id,title:{raw:decodeURIComponent(e.title)},content:{raw:decodeURIComponent(e.content)},type:e.type||"post"}:{type:"post",status:"draft",id:-1}}function We(){const{siteApiRoot:e="",authHeader:t}=T();y.use(y.createRootURLMiddleware(e)),y.use(Ye),y.use(et),y.use(tt(t)),y.use(rt),y.use(nt),y.use(y.createPreloadingMiddleware({"/wp/v2/types?context=view":{body:{post:{description:"",hierarchical:!1,has_archive:!1,name:"Posts",slug:"post",taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}},page:{description:"",hierarchical:!0,has_archive:!1,name:"Pages",slug:"page",taxonomies:[],rest_base:"pages",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}}}},"/wp/v2/types/post?context=edit":{body:{name:"Posts",slug:"post",supports:{title:!0,editor:!0,author:!0,thumbnail:!0,excerpt:!0,trackbacks:!0,"custom-fields":!0,comments:!0,revisions:!0,"post-formats":!0,autosave:!0},taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1}}}))}function Ye(e,t){return e.mode="cors",delete e.headers["x-wp-api-fetch-from-editor"],t(e)}function et(e,t){const{siteApiNamespace:r}=T();return e.path&&r&&!e.path.includes(r)&&(e.path=e.path.replace(/^(?<apiPath>\/?(?:[\w.-]+\/){2})/,`$<apiPath>${r}/`)),t(e)}function tt(e){return(t,r)=>(t.headers=t.headers||{},e&&(t.headers.Authorization=e),r(t))}function rt(e,t){return[/^\/wp\/v2\/posts\/-?\d+/,/^\/wp\/v2\/pages\/-?\d+/].some(i=>i.test(e.path))?Promise.resolve([]):t(e)}function nt(e,t){return e.path&&e.path.startsWith("/wp/v2/media")&&e.method==="POST"&&e.body instanceof FormData&&e.body.get("post")==="-1"&&e.body.delete("post"),t(e)}window.GBKit=T();window.wp=window.wp||{};window.wp.apiFetch=y;We();it();async function it(){try{const{themeStyles:e,siteURL:t}=T(),{styles:r,scripts:n}=await y({url:`${t}/wp-json/__experimental/wp-block-editor/v1/editor-assets`});await st([...r,...n].join(""));const{dispatch:i}=window.wp.data,{store:s}=window.wp.editor,{store:a}=window.wp.preferences;y({path:"/wp-block-editor/v1/settings"}).then(h=>{i(s).updateEditorSettings(h)}).catch(()=>{const h={defaultEditorStyles:[{css:fe}]};i(s).updateEditorSettings(h)}),i(a).setDefaults("core/edit-post",{themeStyles:e});const d={post:Ze()},{default:u}=await we(async()=>{const{default:h}=await import("./index-PsmJHRPp.js");return{default:h}},__vite__mapDeps([0,1]),import.meta.url),{createRoot:w,createElement:o,StrictMode:g}=window.wp.element;w(document.getElementById("root")).render(o(g,null,o(u,d)))}catch{window.location.href="index.html?error=remote_editor_load_error"}}async function st(e){const t=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(t.querySelectorAll('link[rel="stylesheet"],script')).filter(n=>n.id&&!ot.test(n.src));for(const n of r)await ct(n)}const at=["api-fetch"],ot=new RegExp(at.flatMap(e=>[`wp-content/plugins/gutenberg/build/${e.replace(/\//g,"\\/")}\\b`,`wp-includes/js/dist/${e.replace(/\//g,"\\/")}\\b`]).join("|"));function ct(e){return new Promise(t=>{const r=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach(n=>{e[n]&&(r[n]=e[n])}),e.innerHTML&&r.appendChild(document.createTextNode(e.innerHTML)),r.onload=()=>t(!0),r.onerror=()=>{t(!1)},document.body.appendChild(r),(r.nodeName.toLowerCase()==="link"||r.nodeName.toLowerCase()==="script"&&!r.src)&&t()})}export{dt as a,lt as e,ft as o};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Fhlsxj64.js","./index-0lszm8gR.css"])))=>i.map(i=>d[i]);
import fe from"@wordpress/block-editor/build-style/default-editor-styles.css?inline";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();const pe="modulepreload",he=function(e,t){return new URL(e,t).href},N={},we=function(t,r,n){let i=Promise.resolve();if(r&&r.length>0){const a=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),d=c?.nonce||c?.getAttribute("nonce");i=Promise.allSettled(r.map(l=>{if(l=he(l,n),l in N)return;N[l]=!0;const w=l.endsWith(".css"),o=w?'[rel="stylesheet"]':"";if(!!n)for(let _=a.length-1;_>=0;_--){const f=a[_];if(f.href===l&&(!w||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${l}"]${o}`))return;const h=document.createElement("link");if(h.rel=w?"stylesheet":pe,w||(h.as="script"),h.crossOrigin="",h.href=l,d&&h.setAttribute("nonce",d),document.head.appendChild(h),w)return new Promise((_,f)=>{h.addEventListener("load",_),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};var C={},z;function ge(){return z||(z=1,function(e){(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function r(c){return i(a(c),arguments)}function n(c,d){return r.apply(null,[c].concat(d||[]))}function i(c,d){var l=1,w=c.length,o,y="",h,_,f,A,S,P,O,u;for(h=0;h<w;h++)if(typeof c[h]=="string")y+=c[h];else if(typeof c[h]=="object"){if(f=c[h],f.keys)for(o=d[l],_=0;_<f.keys.length;_++){if(o==null)throw new Error(r('[sprintf] Cannot access property "%s" of undefined value "%s"',f.keys[_],f.keys[_-1]));o=o[f.keys[_]]}else f.param_no?o=d[f.param_no]:o=d[l++];if(t.not_type.test(f.type)&&t.not_primitive.test(f.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(f.type)&&typeof o!="number"&&isNaN(o))throw new TypeError(r("[sprintf] expecting number but found %T",o));switch(t.number.test(f.type)&&(O=o>=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?y+=o:(t.number.test(f.type)&&(!O||f.sign)?(u=O?"+":"-",o=o.toString().replace(t.sign,"")):u="",S=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",P=f.width-(u+o).length,A=f.width&&P>0?S.repeat(P):"",y+=f.align?u+o+A:S==="0"?u+A+o:A+u+o)}return y}var s=Object.create(null);function a(c){if(s[c])return s[c];for(var d=c,l,w=[],o=0;d;){if((l=t.text.exec(d))!==null)w.push(l[0]);else if((l=t.modulo.exec(d))!==null)w.push("%");else if((l=t.placeholder.exec(d))!==null){if(l[2]){o|=1;var y=[],h=l[2],_=[];if((_=t.key.exec(h))!==null)for(y.push(_[1]);(h=h.substring(_[0].length))!=="";)if((_=t.key_access.exec(h))!==null)y.push(_[1]);else if((_=t.index_access.exec(h))!==null)y.push(_[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");l[2]=y}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");w.push({placeholder:l[0],param_no:l[1],keys:l[2],sign:l[3],pad_char:l[4],align:l[5],width:l[6],precision:l[7],type:l[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");d=d.substring(l[0].length)}return s[c]=w}e.sprintf=r,e.vsprintf=n,typeof window<"u"&&(window.sprintf=r,window.vsprintf=n)})()}(C)),C}ge();var H,re,T,ne;H={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1};re=["(","?"];T={")":["("],":":["?","?:"]};ne=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/;function ye(e){for(var t=[],r=[],n,i,s,a;n=e.match(ne);){for(i=n[0],s=e.substr(0,n.index).trim(),s&&t.push(s);a=r.pop();){if(T[i]){if(T[i][0]===a){i=T[i][1]||i;break}}else if(re.indexOf(a)>=0||H[a]<H[i]){r.push(a);break}t.push(a)}T[i]||r.push(i),e=e.substr(n.index+i.length)}return e=e.trim(),e&&t.push(e),t.concat(r.reverse())}var me={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,r){if(e)throw t;return r}};function _e(e,t){var r=[],n,i,s,a,c,d;for(n=0;n<e.length;n++){if(c=e[n],a=me[c],a){for(i=a.length,s=Array(i);i--;)s[i]=r.pop();try{d=a.apply(null,s)}catch(l){return l}}else t.hasOwnProperty(c)?d=t[c]:d=+c;r.push(d)}return r[0]}function be(e){var t=ye(e);return function(r){return _e(t,r)}}function ve(e){var t=be(e);return function(r){return+t({n:r})}}var q={contextDelimiter:"",onMissingKey:null};function Ee(e){var t,r,n;for(t=e.split(";"),r=0;r<t.length;r++)if(n=t[r].trim(),n.indexOf("plural=")===0)return n.substr(7)}function j(e,t){var r;this.data=e,this.pluralForms={},this.options={};for(r in q)this.options[r]=t!==void 0&&r in t?t[r]:q[r]}j.prototype.getPluralForm=function(e,t){var r=this.pluralForms[e],n,i,s;return r||(n=this.data[e][""],s=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,typeof s!="function"&&(i=Ee(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),s=ve(i)),r=this.pluralForms[e]=s),r(t)};j.prototype.dcnpgettext=function(e,t,r,n,i){var s,a,c;return i===void 0?s=0:s=this.getPluralForm(e,i),a=r,t&&(a=t+this.options.contextDelimiter+r),c=this.data[e][a],c&&c[s]?c[s]:(this.options.onMissingKey&&this.options.onMissingKey(r,e),s===0?r:n)};const K={"":{plural_forms(e){return e===1?0:1}}},xe=/^i18n\.(n?gettext|has_translation)(_|$)/,Ae=(e,t,r)=>{const n=new j({}),i=new Set,s=()=>{i.forEach(u=>u())},a=u=>(i.add(u),()=>i.delete(u)),c=(u="default")=>n.data[u],d=(u,p="default")=>{n.data[p]={...n.data[p],...u},n.data[p][""]={...K[""],...n.data[p]?.[""]},delete n.pluralForms[p]},l=(u,p)=>{d(u,p),s()},w=(u,p="default")=>{n.data[p]={...n.data[p],...u,"":{...K[""],...n.data[p]?.[""],...u?.[""]}},delete n.pluralForms[p],s()},o=(u,p)=>{n.data={},n.pluralForms={},l(u,p)},y=(u="default",p,g,v,E)=>(n.data[u]||d(void 0,u),n.dcnpgettext(u,p,g,v,E)),h=(u="default")=>u,_=(u,p)=>{let g=y(p,void 0,u);return r?(g=r.applyFilters("i18n.gettext",g,u,p),r.applyFilters("i18n.gettext_"+h(p),g,u,p)):g},f=(u,p,g)=>{let v=y(g,p,u);return r?(v=r.applyFilters("i18n.gettext_with_context",v,u,p,g),r.applyFilters("i18n.gettext_with_context_"+h(g),v,u,p,g)):v},A=(u,p,g,v)=>{let E=y(v,void 0,u,p,g);return r?(E=r.applyFilters("i18n.ngettext",E,u,p,g,v),r.applyFilters("i18n.ngettext_"+h(v),E,u,p,g,v)):E},S=(u,p,g,v,E)=>{let k=y(E,v,u,p,g);return r?(k=r.applyFilters("i18n.ngettext_with_context",k,u,p,g,v,E),r.applyFilters("i18n.ngettext_with_context_"+h(E),k,u,p,g,v,E)):k},P=()=>f("ltr","text direction")==="rtl",O=(u,p,g)=>{const v=p?p+""+u:u;let E=!!n.data?.[g??"default"]?.[v];return r&&(E=r.applyFilters("i18n.has_translation",E,u,p,g),E=r.applyFilters("i18n.has_translation_"+h(g),E,u,p,g)),E};if(r){const u=p=>{xe.test(p)&&s()};r.addAction("hookAdded","core/i18n",u),r.addAction("hookRemoved","core/i18n",u)}return{getLocaleData:c,setLocaleData:l,addLocaleData:w,resetLocaleData:o,subscribe:a,__:_,_x:f,_n:A,_nx:S,isRTL:P,hasTranslation:O}};function ie(e){return typeof e!="string"||e===""?(console.error("The namespace must be a non-empty string."),!1):/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)?!0:(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}function U(e){return typeof e!="string"||e===""?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)?!0:(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}function B(e,t){return function(n,i,s,a=10){const c=e[t];if(!U(n)||!ie(i))return;if(typeof s!="function"){console.error("The hook callback must be a function.");return}if(typeof a!="number"){console.error("If specified, the hook priority must be a number.");return}const d={callback:s,priority:a,namespace:i};if(c[n]){const l=c[n].handlers;let w;for(w=l.length;w>0&&!(a>=l[w-1].priority);w--);w===l.length?l[w]=d:l.splice(w,0,d),c.__current.forEach(o=>{o.name===n&&o.currentIndex>=w&&o.currentIndex++})}else c[n]={handlers:[d],runs:0};n!=="hookAdded"&&e.doAction("hookAdded",n,i,s,a)}}function D(e,t,r=!1){return function(i,s){const a=e[t];if(!U(i)||!r&&!ie(s))return;if(!a[i])return 0;let c=0;if(r)c=a[i].handlers.length,a[i]={runs:a[i].runs,handlers:[]};else{const d=a[i].handlers;for(let l=d.length-1;l>=0;l--)d[l].namespace===s&&(d.splice(l,1),c++,a.__current.forEach(w=>{w.name===i&&w.currentIndex>=l&&w.currentIndex--}))}return i!=="hookRemoved"&&e.doAction("hookRemoved",i,s),c}}function G(e,t){return function(n,i){const s=e[t];return typeof i<"u"?n in s&&s[n].handlers.some(a=>a.namespace===i):n in s}}function M(e,t,r,n){return function(s,...a){const c=e[t];c[s]||(c[s]={handlers:[],runs:0}),c[s].runs++;const d=c[s].handlers;if(!d||!d.length)return r?a[0]:void 0;const l={name:s,currentIndex:0};async function w(){try{c.__current.add(l);let y=r?a[0]:void 0;for(;l.currentIndex<d.length;)y=await d[l.currentIndex].callback.apply(null,a),r&&(a[0]=y),l.currentIndex++;return r?y:void 0}finally{c.__current.delete(l)}}function o(){try{c.__current.add(l);let y=r?a[0]:void 0;for(;l.currentIndex<d.length;)y=d[l.currentIndex].callback.apply(null,a),r&&(a[0]=y),l.currentIndex++;return r?y:void 0}finally{c.__current.delete(l)}}return(n?w:o)()}}function Q(e,t){return function(){var n;const i=e[t];return(n=Array.from(i.__current).at(-1)?.name)!==null&&n!==void 0?n:null}}function J(e,t){return function(n){const i=e[t];return typeof n>"u"?i.__current.size>0:Array.from(i.__current).some(s=>s.name===n)}}function X(e,t){return function(n){const i=e[t];if(U(n))return i[n]&&i[n].runs?i[n].runs:0}}class Se{constructor(){this.actions=Object.create(null),this.actions.__current=new Set,this.filters=Object.create(null),this.filters.__current=new Set,this.addAction=B(this,"actions"),this.addFilter=B(this,"filters"),this.removeAction=D(this,"actions"),this.removeFilter=D(this,"filters"),this.hasAction=G(this,"actions"),this.hasFilter=G(this,"filters"),this.removeAllActions=D(this,"actions",!0),this.removeAllFilters=D(this,"filters",!0),this.doAction=M(this,"actions",!1,!1),this.doActionAsync=M(this,"actions",!1,!0),this.applyFilters=M(this,"filters",!0,!1),this.applyFiltersAsync=M(this,"filters",!0,!0),this.currentAction=Q(this,"actions"),this.currentFilter=Q(this,"filters"),this.doingAction=J(this,"actions"),this.doingFilter=J(this,"filters"),this.didAction=X(this,"actions"),this.didFilter=X(this,"filters")}}function Pe(){return new Se}const Oe=Pe(),b=Ae(void 0,void 0,Oe);b.getLocaleData.bind(b);b.setLocaleData.bind(b);b.resetLocaleData.bind(b);b.subscribe.bind(b);const L=b.__.bind(b);b._x.bind(b);b._n.bind(b);b._nx.bind(b);b.isRTL.bind(b);b.hasTranslation.bind(b);function Te(e){const t=(r,n)=>{const{headers:i={}}=r;for(const s in i)if(s.toLowerCase()==="x-wp-nonce"&&i[s]===t.nonce)return n(r);return n({...r,headers:{...i,"X-WP-Nonce":t.nonce}})};return t.nonce=e,t}const se=(e,t)=>{let r=e.path,n,i;return typeof e.namespace=="string"&&typeof e.endpoint=="string"&&(n=e.namespace.replace(/^\/|\/$/g,""),i=e.endpoint.replace(/^\//,""),i?r=n+"/"+i:r=n),delete e.namespace,delete e.endpoint,t({...e,path:r})},Re=e=>(t,r)=>se(t,n=>{let i=n.url,s=n.path,a;return typeof s=="string"&&(a=e,e.indexOf("?")!==-1&&(s=s.replace("?","&")),s=s.replace(/^\//,""),typeof a=="string"&&a.indexOf("?")!==-1&&(s=s.replace("?","&")),i=a+s),r({...n,url:i})});function ke(e){let t;try{t=new URL(e,"http://example.com").search.substring(1)}catch{}if(t)return t}function ae(e){let t="";const r=Object.entries(e);let n;for(;n=r.shift();){let[i,s]=n;if(Array.isArray(s)||s&&s.constructor===Object){const c=Object.entries(s).reverse();for(const[d,l]of c)r.unshift([`${i}[${d}]`,l])}else s!==void 0&&(s===null&&(s=""),t+="&"+[i,s].map(encodeURIComponent).join("="))}return t.substr(1)}function De(e){try{return decodeURIComponent(e)}catch{return e}}function Me(e,t,r){const n=t.length,i=n-1;for(let s=0;s<n;s++){let a=t[s];!a&&Array.isArray(e)&&(a=e.length.toString()),a=["__proto__","constructor","prototype"].includes(a)?a.toUpperCase():a;const c=!isNaN(Number(t[s+1]));e[a]=s===i?r:e[a]||(c?[]:{}),Array.isArray(e[a])&&!c&&(e[a]={...e[a]}),e=e[a]}}function F(e){return(ke(e)||"").replace(/\+/g,"%20").split("&").reduce((t,r)=>{const[n,i=""]=r.split("=").filter(Boolean).map(De);if(n){const s=n.replace(/\]/g,"").split("[");Me(t,s,i)}return t},Object.create(null))}function x(e="",t){if(!t||!Object.keys(t).length)return e;let r=e;const n=e.indexOf("?");return n!==-1&&(t=Object.assign(F(e),t),r=r.substr(0,n)),r+"?"+ae(t)}function I(e,t){return F(e)[t]}function V(e,t){return I(e,t)!==void 0}function Z(e,...t){const r=e.indexOf("?");if(r===-1)return e;const n=F(e),i=e.substr(0,r);t.forEach(a=>delete n[a]);const s=ae(n);return s?i+"?"+s:i}function W(e){const t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map(i=>i.split("=")).map(i=>i.map(decodeURIComponent)).sort((i,s)=>i[0].localeCompare(s[0])).map(i=>i.map(encodeURIComponent)).map(i=>i.join("=")).join("&"):n}function Le(e){const t=Object.fromEntries(Object.entries(e).map(([r,n])=>[W(r),n]));return(r,n)=>{const{parse:i=!0}=r;let s=r.path;if(!s&&r.url){const{rest_route:d,...l}=F(r.url);typeof d=="string"&&(s=x(d,l))}if(typeof s!="string")return n(r);const a=r.method||"GET",c=W(s);if(a==="GET"&&t[c]){const d=t[c];return delete t[c],Y(d,!!i)}else if(a==="OPTIONS"&&t[a]&&t[a][c]){const d=t[a][c];return delete t[a][c],Y(d,!!i)}return n(r)}}function Y(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}const Fe=({path:e,url:t,...r},n)=>({...r,url:t&&x(t,n),path:e&&x(e,n)}),ee=e=>e.json?e.json():Promise.reject(e),Ce=e=>{if(!e)return{};const t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}},te=e=>{const{next:t}=Ce(e.headers.get("link"));return t},He=e=>{const t=!!e.path&&e.path.indexOf("per_page=-1")!==-1,r=!!e.url&&e.url.indexOf("per_page=-1")!==-1;return t||r},oe=async(e,t)=>{if(e.parse===!1||!He(e))return t(e);const r=await m({...Fe(e,{per_page:100}),parse:!1}),n=await ee(r);if(!Array.isArray(n))return n;let i=te(r);if(!i)return n;let s=[].concat(n);for(;i;){const a=await m({...e,path:void 0,url:i,parse:!1}),c=await ee(a);s=s.concat(c),i=te(a)}return s},Ie=new Set(["PATCH","PUT","DELETE"]),je="GET",Ue=(e,t)=>{const{method:r=je}=e;return Ie.has(r.toUpperCase())&&(e={...e,headers:{...e.headers,"X-HTTP-Method-Override":r,"Content-Type":"application/json"},method:"POST"}),t(e)},$e=(e,t)=>(typeof e.url=="string"&&!V(e.url,"_locale")&&(e.url=x(e.url,{_locale:"user"})),typeof e.path=="string"&&!V(e.path,"_locale")&&(e.path=x(e.path,{_locale:"user"})),t(e)),Ne=(e,t=!0)=>t?e.status===204?null:e.json?e.json():Promise.reject(e):e,ze=e=>{const t={code:"invalid_json",message:L("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch(()=>{throw t})},ce=(e,t=!0)=>Promise.resolve(Ne(e,t)).catch(r=>$(r,t));function $(e,t=!0){if(!t)throw e;return ze(e).then(r=>{const n={code:"unknown_error",message:L("An unknown error occurred.")};throw r||n})}function qe(e){const t=!!e.method&&e.method==="POST";return(!!e.path&&e.path.indexOf("/wp/v2/media")!==-1||!!e.url&&e.url.indexOf("/wp/v2/media")!==-1)&&t}const Ke=(e,t)=>{if(!qe(e))return t(e);let r=0;const n=5,i=s=>(r++,t({path:`/wp/v2/media/${s}/post-process`,method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch(()=>r<n?i(s):(t({path:`/wp/v2/media/${s}?force=true`,method:"DELETE"}),Promise.reject())));return t({...e,parse:!1}).catch(s=>{if(!s.headers)return Promise.reject(s);const a=s.headers.get("x-wp-upload-attachment-id");return s.status>=500&&s.status<600&&a?i(a).catch(()=>e.parse!==!1?Promise.reject({code:"post_process",message:L("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(s)):$(s,e.parse)}).then(s=>ce(s,e.parse))},Be=e=>(t,r)=>{if(typeof t.url=="string"){const n=I(t.url,"wp_theme_preview");n===void 0?t.url=x(t.url,{wp_theme_preview:e}):n===""&&(t.url=Z(t.url,"wp_theme_preview"))}if(typeof t.path=="string"){const n=I(t.path,"wp_theme_preview");n===void 0?t.path=x(t.path,{wp_theme_preview:e}):n===""&&(t.path=Z(t.path,"wp_theme_preview"))}return r(t)},Ge={Accept:"application/json, */*;q=0.1"},Qe={credentials:"include"},le=[$e,se,Ue,oe];function Je(e){le.unshift(e)}const ue=e=>{if(e.status>=200&&e.status<300)return e;throw e},Xe=e=>{const{url:t,path:r,data:n,parse:i=!0,...s}=e;let{body:a,headers:c}=e;return c={...Ge,...c},n&&(a=JSON.stringify(n),c["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,{...Qe,...s,body:a,headers:c}).then(l=>Promise.resolve(l).then(ue).catch(w=>$(w,i)).then(w=>ce(w,i)),l=>{throw l&&l.name==="AbortError"?l:{code:"fetch_error",message:L("You are probably offline.")}})};let de=Xe;function Ve(e){de=e}function m(e){return le.reduceRight((r,n)=>i=>n(i,r),de)(e).catch(r=>r.code!=="rest_cookie_invalid_nonce"?Promise.reject(r):window.fetch(m.nonceEndpoint).then(ue).then(n=>n.text()).then(n=>(m.nonceMiddleware.nonce=n,m(e))))}m.use=Je;m.setFetchHandler=Ve;m.createNonceMiddleware=Te;m.createPreloadingMiddleware=Le;m.createRootURLMiddleware=Re;m.fetchAllMiddleware=oe;m.mediaUploadMiddleware=Ke;m.createThemePreviewMiddleware=Be;function ut(){window.editorDelegate&&window.editorDelegate.onEditorLoaded(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorLoaded",body:{}})}function dt(){window.editorDelegate&&window.editorDelegate.onEditorContentChanged(),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorContentChanged"})}function ft(e,t){window.editorDelegate&&window.editorDelegate.onEditorHistoryChanged(e,t),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"onEditorHistoryChanged",body:{hasUndo:e,hasRedo:t}})}function pt(e){window.editorDelegate&&window.editorDelegate.openMediaLibrary(JSON.stringify(e)),window.webkit&&window.webkit.messageHandlers.editorDelegate.postMessage({message:"openMediaLibrary",body:e})}function R(){if(window.GBKit)return window.GBKit;if(window.editorDelegate)try{return JSON.parse(window.editorDelegate.getEditorConfiguration())}catch{return{}}try{return JSON.parse(localStorage.getItem("GBKit"))||{}}catch{return{}}}function Ze(){const{post:e}=R();return e?{id:e.id,title:{raw:decodeURIComponent(e.title)},content:{raw:decodeURIComponent(e.content)},type:e.type||"post"}:{type:"post",status:"draft",id:-1}}function We(){const{siteApiRoot:e="",authHeader:t}=R();m.use(m.createRootURLMiddleware(e)),m.use(Ye),m.use(et),m.use(tt(t)),m.use(rt),m.use(nt),m.use(m.createPreloadingMiddleware({"/wp/v2/types?context=view":{body:{post:{description:"",hierarchical:!1,has_archive:!1,name:"Posts",slug:"post",taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}},page:{description:"",hierarchical:!0,has_archive:!1,name:"Pages",slug:"page",taxonomies:[],rest_base:"pages",rest_namespace:"wp/v2",template:[],template_lock:!1,_links:{}}}},"/wp/v2/types/post?context=edit":{body:{name:"Posts",slug:"post",supports:{title:!0,editor:!0,author:!0,thumbnail:!0,excerpt:!0,trackbacks:!0,"custom-fields":!0,comments:!0,revisions:!0,"post-formats":!0,autosave:!0},taxonomies:["category","post_tag"],rest_base:"posts",rest_namespace:"wp/v2",template:[],template_lock:!1}}}))}function Ye(e,t){return e.mode="cors",delete e.headers["x-wp-api-fetch-from-editor"],t(e)}function et(e,t){const{siteApiNamespace:r}=R();return e.path&&r&&!e.path.includes(r)&&(e.path=e.path.replace(/^(?<apiPath>\/?(?:[\w.-]+\/){2})/,`$<apiPath>${r}/`)),t(e)}function tt(e){return(t,r)=>(t.headers=t.headers||{},e&&(t.headers.Authorization=e),r(t))}function rt(e,t){return[/^\/wp\/v2\/posts\/-?\d+/,/^\/wp\/v2\/pages\/-?\d+/].some(i=>i.test(e.path))?Promise.resolve([]):t(e)}function nt(e,t){return e.path&&e.path.startsWith("/wp/v2/media")&&e.method==="POST"&&e.body instanceof FormData&&e.body.get("post")==="-1"&&e.body.delete("post"),t(e)}window.GBKit=R();window.wp=window.wp||{};window.wp.apiFetch=m;We();it();async function it(){try{const{themeStyles:e,siteURL:t}=R(),{styles:r,scripts:n}=await m({url:`${t}/wp-json/__experimental/wp-block-editor/v1/editor-assets`});await st([...r,...n].join(""));const{dispatch:i}=window.wp.data,{store:s}=window.wp.editor,{store:a}=window.wp.preferences;m({path:"/wp-block-editor/v1/settings"}).then(h=>{i(s).updateEditorSettings(h)}).catch(()=>{const h={defaultEditorStyles:[{css:fe}]};i(s).updateEditorSettings(h)}),i(a).setDefaults("core/edit-post",{themeStyles:e});const d={post:Ze()},{default:l}=await we(async()=>{const{default:h}=await import("./index-Fhlsxj64.js");return{default:h}},__vite__mapDeps([0,1]),import.meta.url),{createRoot:w,createElement:o,StrictMode:y}=window.wp.element;w(document.getElementById("root")).render(o(y,null,o(l,d)))}catch{window.location.href="index.html?error=remote_editor_load_error"}}async function st(e){const t=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(t.querySelectorAll('link[rel="stylesheet"],script')).filter(n=>n.id&&!ot.test(n.src));for(const n of r)await ct(n)}const at=["api-fetch"],ot=new RegExp(at.flatMap(e=>[`wp-content/plugins/gutenberg/build/${e.replace(/\//g,"\\/")}\\b`,`wp-includes/js/dist/${e.replace(/\//g,"\\/")}\\b`]).join("|"));function ct(e){return new Promise(t=>{const r=document.createElement(e.nodeName);["id","rel","src","href","type"].forEach(n=>{e[n]&&(r[n]=e[n])}),e.innerHTML&&r.appendChild(document.createTextNode(e.innerHTML)),r.onload=()=>t(!0),r.onerror=()=>{t(!1)},document.body.appendChild(r),(r.nodeName.toLowerCase()==="link"||r.nodeName.toLowerCase()==="script"&&!r.src)&&t()})}export{dt as a,ft as b,ut as e,pt as o};

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix AI 4 days ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Communicate undo/redo availability state to iOS host app.
Enable navigating editor history from the host app.
Communicate undo/redo availability state to Android host app.
Enable navigating editor history from the host app.
@dcalhoun dcalhoun force-pushed the feat/editor-history-navigation branch from c799883 to e9ae817 Compare January 8, 2025 21:03
@dcalhoun dcalhoun marked this pull request as ready for review January 9, 2025 15:28
Comment on lines +121 to +123
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest): Boolean {
val url = request.url.toString()
url.let {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to address deprecated method warning.

@dcalhoun dcalhoun requested review from kean and nbradbury January 9, 2025 15:30
@nbradbury
Copy link

nbradbury commented Jan 9, 2025

@dcalhoun Testing the Android app, I noticed that undo is one character at a time. This isn't an uncommon approach (in fact, this is how GitHub handles undo), but some people expect undoing a word at a time or even a sentence at a time. Is this planned for the future?

Update: Ah, it appears it only does the one character a time undo in the title. In the body, it works as I expected. This is probably fine.

single-char-undo.mp4

@nbradbury
Copy link

nbradbury commented Jan 9, 2025

@dcalhoun Image undo is a little wonky. If I add an image then undo it, it returns to showing me the "image box" (not sure what to call it) where I can choose a different image. I guess that makes sense - it's possible the user chose the wrong image - but if I undo that, the editor simply shows the / I typed to add a block. Is that intentional? I do see it works this way for other blocks, too, but I have to type / again and backspace to be able to choose a block.

image-undo.mp4

@dcalhoun
Copy link
Member Author

dcalhoun commented Jan 9, 2025

@nbradbury thank you for the thorough testing! 🙇🏻‍♂️

I noticed that undo is one character at a time

I've noted the same behavior. As you mention in your update, it does appear to occur more readily in the post title field—not sure why that is the case. Also, this behavior occurs in the web editor as well, so it is not specific to GutenbergKit's implementation. If a change is desired, we'll need to address it in Gutenberg. That is definitely possible, but I consider it outside of the scope of this work.

Image undo is a little wonky. If I add an image then undo it, it returns to showing me the "image box" (not sure what to call it) where I can choose a different image. I guess that makes sense - it's possible the user chose the wrong image - but if I undo that, the editor simply shows the / I typed to add a block. Is that intentional?

Similar to the pace of undo for characters vs words, this behavior matches the web editor. Its correctness is debatable, but I suggest we address it in Gutenberg in a separate scope of work.

@nbradbury
Copy link

If a change is desired, we'll need to address it in Gutenberg. That is definitely possible, but I consider it outside of the scope of this work ... Its correctness is debatable, but I suggest we address it in Gutenberg in a separate scope of work.

Agreed. I should've taken the time to test on the web before commenting here.

@dcalhoun dcalhoun merged commit 5a43a1b into trunk Jan 9, 2025
8 of 9 checks passed
@dcalhoun dcalhoun deleted the feat/editor-history-navigation branch January 9, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants