/*! This file is auto-generated */ (()=>{var e,t,s={4660:e=>{e.exports=function(){function e(t,s,n){function i(o,a){if(!s[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=s[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,s,n)}return s[o].exports}for(var r=void 0,o=0;o=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(e,t));for(var s="",o=0;o>>6,t[o++]=128|63&s):s<65536?(t[o++]=224|s>>>12,t[o++]=128|s>>>6&63,t[o++]=128|63&s):(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63,t[o++]=128|s>>>6&63,t[o++]=128|63&s);return t},s.buf2binstring=function(e){return l(e,e.length)},s.binstring2buf=function(e){for(var t=new n.Buf8(e.length),s=0,i=t.length;s4)c[n++]=65533,s+=r-1;else{for(i&=2===r?31:3===r?15:7;r>1&&s1?c[n++]=65533:i<65536?c[n++]=i:(i-=65536,c[n++]=55296|i>>10&1023,c[n++]=56320|1023&i)}return l(c,n)},s.utf8border=function(e,t){var s;for((t=t||e.length)>e.length&&(t=e.length),s=t-1;s>=0&&128==(192&e[s]);)s--;return s<0||0===s?t:s+o[e[s]]>t?s:t}},{"./common":1}],3:[function(e,t,s){"use strict";function n(e,t,s,n){for(var i=65535&e|0,r=e>>>16&65535|0,o=0;0!==s;){s-=o=s>2e3?2e3:s;do{r=r+(i=i+t[n++]|0)|0}while(--o);i%=65521,r%=65521}return i|r<<16|0}t.exports=n},{}],4:[function(e,t,s){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(e,t,s){"use strict";function n(){for(var e,t=[],s=0;s<256;s++){e=s;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t}var i=n();function r(e,t,s,n){var r=i,o=n+s;e^=-1;for(var a=n;a>>8^r[255&(e^t[a])];return-1^e}t.exports=r},{}],6:[function(e,t,s){"use strict";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=n},{}],7:[function(e,t,s){"use strict";var n=30,i=12;t.exports=function(e,t){var s,r,o,a,l,c,u,d,h,p,f,m,g,v,y,x,b,w,_,S,j,C,k,E,P;s=e.state,r=e.next_in,E=e.input,o=r+(e.avail_in-5),a=e.next_out,P=e.output,l=a-(t-e.avail_out),c=a+(e.avail_out-257),u=s.dmax,d=s.wsize,h=s.whave,p=s.wnext,f=s.window,m=s.hold,g=s.bits,v=s.lencode,y=s.distcode,x=(1<>>=_=w>>>24,g-=_,0==(_=w>>>16&255))P[a++]=65535&w;else{if(!(16&_)){if(0==(64&_)){w=v[(65535&w)+(m&(1<<_)-1)];continue t}if(32&_){s.mode=i;break e}e.msg="invalid literal/length code",s.mode=n;break e}S=65535&w,(_&=15)&&(g<_&&(m+=E[r++]<>>=_,g-=_),g<15&&(m+=E[r++]<>>=_=w>>>24,g-=_,!(16&(_=w>>>16&255))){if(0==(64&_)){w=y[(65535&w)+(m&(1<<_)-1)];continue s}e.msg="invalid distance code",s.mode=n;break e}if(j=65535&w,g<(_&=15)&&(m+=E[r++]<u){e.msg="invalid distance too far back",s.mode=n;break e}if(m>>>=_,g-=_,j>(_=a-l)){if((_=j-_)>h&&s.sane){e.msg="invalid distance too far back",s.mode=n;break e}if(C=0,k=f,0===p){if(C+=d-_,_2;)P[a++]=k[C++],P[a++]=k[C++],P[a++]=k[C++],S-=3;S&&(P[a++]=k[C++],S>1&&(P[a++]=k[C++]))}else{C=a-j;do{P[a++]=P[C++],P[a++]=P[C++],P[a++]=P[C++],S-=3}while(S>2);S&&(P[a++]=P[C++],S>1&&(P[a++]=P[C++]))}break}}break}}while(r>3,m&=(1<<(g-=S<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ne(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ie(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=_,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32($),t.distcode=t.distdyn=new n.Buf32(ee),t.sane=1,t.back=-1,f):v}function re(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ie(e)):v}function oe(e,t){var s,n;return e&&e.state?(n=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?v:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=s,n.wbits=t,re(e))):v}function ae(e,t){var s,n;return e?(n=new ne,e.state=n,n.window=null,(s=oe(e,t))!==f&&(e.state=null),s):v}function le(e){return ae(e,te)}var ce,ue,de=!0;function he(e){if(de){var t;for(ce=new n.Buf32(512),ue=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,ce,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(u,e.lens,0,32,ue,0,e.work,{bits:5}),de=!1}e.lencode=ce,e.lenbits=9,e.distcode=ue,e.distbits=5}function pe(e,t,s,i){var r,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(n.arraySet(o.window,t,s-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),n.arraySet(o.window,t,s-i,r,o.wnext),(i-=r)?(n.arraySet(o.window,t,s-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,s.check=r(s.check,ke,2,0),oe=0,ae=0,s.mode=S;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&oe)<<8)+(oe>>8))%31){e.msg="incorrect header check",s.mode=J;break}if((15&oe)!==w){e.msg="unknown compression method",s.mode=J;break}if(ae-=4,we=8+(15&(oe>>>=4)),0===s.wbits)s.wbits=we;else if(we>s.wbits){e.msg="invalid window size",s.mode=J;break}s.dmax=1<>8&1),512&s.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,s.check=r(s.check,ke,2,0)),oe=0,ae=0,s.mode=j;case j:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>8&255,ke[2]=oe>>>16&255,ke[3]=oe>>>24&255,s.check=r(s.check,ke,4,0)),oe=0,ae=0,s.mode=C;case C:for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<>8),512&s.flags&&(ke[0]=255&oe,ke[1]=oe>>>8&255,s.check=r(s.check,ke,2,0)),oe=0,ae=0,s.mode=k;case k:if(1024&s.flags){for(;ae<16;){if(0===ie)break e;ie--,oe+=$[te++]<>>8&255,s.check=r(s.check,ke,2,0)),oe=0,ae=0}else s.head&&(s.head.extra=null);s.mode=E;case E:if(1024&s.flags&&((ue=s.length)>ie&&(ue=ie),ue&&(s.head&&(we=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),n.arraySet(s.head.extra,$,te,ue,we)),512&s.flags&&(s.check=r(s.check,$,ue,te)),ie-=ue,te+=ue,s.length-=ue),s.length))break e;s.length=0,s.mode=P;case P:if(2048&s.flags){if(0===ie)break e;ue=0;do{we=$[te+ue++],s.head&&we&&s.length<65536&&(s.head.name+=String.fromCharCode(we))}while(we&&ue>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=M;break;case O:for(;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>=7&ae,ae-=7&ae,s.mode=K;break}for(;ae<3;){if(0===ie)break e;ie--,oe+=$[te++]<>>=1)){case 0:s.mode=F;break;case 1:if(he(s),s.mode=z,t===p){oe>>>=2,ae-=2;break e}break;case 2:s.mode=B;break;case 3:e.msg="invalid block type",s.mode=J}oe>>>=2,ae-=2;break;case F:for(oe>>>=7&ae,ae-=7&ae;ae<32;){if(0===ie)break e;ie--,oe+=$[te++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=J;break}if(s.length=65535&oe,oe=0,ae=0,s.mode=V,t===p)break e;case V:s.mode=R;case R:if(ue=s.length){if(ue>ie&&(ue=ie),ue>re&&(ue=re),0===ue)break e;n.arraySet(ee,$,te,ue,ne),ie-=ue,te+=ue,re-=ue,ne+=ue,s.length-=ue;break}s.mode=M;break;case B:for(;ae<14;){if(0===ie)break e;ie--,oe+=$[te++]<>>=5,ae-=5,s.ndist=1+(31&oe),oe>>>=5,ae-=5,s.ncode=4+(15&oe),oe>>>=4,ae-=4,s.nlen>286||s.ndist>30){e.msg="too many length or distance symbols",s.mode=J;break}s.have=0,s.mode=D;case D:for(;s.have>>=3,ae-=3}for(;s.have<19;)s.lens[Ee[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,Se={bits:s.lenbits},_e=a(l,s.lens,0,19,s.lencode,0,s.work,Se),s.lenbits=Se.bits,_e){e.msg="invalid code lengths set",s.mode=J;break}s.have=0,s.mode=L;case L:for(;s.have>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=me,ae-=me,s.lens[s.have++]=ve;else{if(16===ve){for(je=me+2;ae>>=me,ae-=me,0===s.have){e.msg="invalid bit length repeat",s.mode=J;break}we=s.lens[s.have-1],ue=3+(3&oe),oe>>>=2,ae-=2}else if(17===ve){for(je=me+3;ae>>=me)),oe>>>=3,ae-=3}else{for(je=me+7;ae>>=me)),oe>>>=7,ae-=7}if(s.have+ue>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=J;break}for(;ue--;)s.lens[s.have++]=we}}if(s.mode===J)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=J;break}if(s.lenbits=9,Se={bits:s.lenbits},_e=a(c,s.lens,0,s.nlen,s.lencode,0,s.work,Se),s.lenbits=Se.bits,_e){e.msg="invalid literal/lengths set",s.mode=J;break}if(s.distbits=6,s.distcode=s.distdyn,Se={bits:s.distbits},_e=a(u,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,Se),s.distbits=Se.bits,_e){e.msg="invalid distances set",s.mode=J;break}if(s.mode=z,t===p)break e;case z:s.mode=G;case G:if(ie>=6&&re>=258){e.next_out=ne,e.avail_out=re,e.next_in=te,e.avail_in=ie,s.hold=oe,s.bits=ae,o(e,ce),ne=e.next_out,ee=e.output,re=e.avail_out,te=e.next_in,$=e.input,ie=e.avail_in,oe=s.hold,ae=s.bits,s.mode===M&&(s.back=-1);break}for(s.back=0;ge=(Ce=s.lencode[oe&(1<>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>ye)])>>>16&255,ve=65535&Ce,!(ye+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=ye,ae-=ye,s.back+=ye}if(oe>>>=me,ae-=me,s.back+=me,s.length=ve,0===ge){s.mode=Z;break}if(32&ge){s.back=-1,s.mode=M;break}if(64&ge){e.msg="invalid literal/length code",s.mode=J;break}s.extra=15&ge,s.mode=H;case H:if(s.extra){for(je=s.extra;ae>>=s.extra,ae-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=U;case U:for(;ge=(Ce=s.distcode[oe&(1<>>16&255,ve=65535&Ce,!((me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>ye)])>>>16&255,ve=65535&Ce,!(ye+(me=Ce>>>24)<=ae);){if(0===ie)break e;ie--,oe+=$[te++]<>>=ye,ae-=ye,s.back+=ye}if(oe>>>=me,ae-=me,s.back+=me,64&ge){e.msg="invalid distance code",s.mode=J;break}s.offset=ve,s.extra=15&ge,s.mode=W;case W:if(s.extra){for(je=s.extra;ae>>=s.extra,ae-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=J;break}s.mode=q;case q:if(0===re)break e;if(ue=ce-re,s.offset>ue){if((ue=s.offset-ue)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=J;break}ue>s.wnext?(ue-=s.wnext,de=s.wsize-ue):de=s.wnext-ue,ue>s.length&&(ue=s.length),fe=s.window}else fe=ee,de=ne-s.offset,ue=s.length;ue>re&&(ue=re),re-=ue,s.length-=ue;do{ee[ne++]=fe[de++]}while(--ue);0===s.length&&(s.mode=G);break;case Z:if(0===re)break e;ee[ne++]=s.length,re--,s.mode=G;break;case K:if(s.wrap){for(;ae<32;){if(0===ie)break e;ie--,oe|=$[te++]<=1&&0===z[A];A--);if(M>A&&(M=A),0===A)return m[g++]=20971520,m[g++]=20971520,y.bits=1,0;for(O=1;O0&&(e===a||1!==A))return-1;for(G[1]=0,I=1;Ir||e===c&&R>o)return 1;for(;;){C=I-F,v[T]j?(k=H[U+v[T]],E=D[L+v[T]]):(k=96,E=0),x=1<>F)+(b-=x)]=C<<24|k<<16|E|0}while(0!==b);for(x=1<>=1;if(0!==x?(B&=x-1,B+=x):B=0,T++,0==--z[I]){if(I===A)break;I=t[s+v[T]]}if(I>M&&(B&_)!==w){for(0===F&&(F=M),S+=O,V=1<<(N=I-F);N+Fr||e===c&&R>o)return 1;m[w=B&_]=M<<24|N<<16|S-g|0}}return 0!==B&&(m[S+B]=I-F<<24|64<<16|0),y.bits=M,0}},{"../utils/common":1}],10:[function(e,t,s){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(e,t,s){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=n},{}],"/lib/inflate.js":[function(e,t,s){"use strict";var n=e("./zlib/inflate"),i=e("./utils/common"),r=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),l=e("./zlib/zstream"),c=e("./zlib/gzheader"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var s=n.inflateInit2(this.strm,t.windowBits);if(s!==o.Z_OK)throw new Error(a[s]);if(this.header=new c,n.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(s=n.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[s])}function h(e,t){var s=new d(t);if(s.push(e,!0),s.err)throw s.msg||a[s.err];return s.result}function p(e,t){return(t=t||{}).raw=!0,h(e,t)}d.prototype.push=function(e,t){var s,a,l,c,d,h=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?h.input=r.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new i.Buf8(p),h.next_out=0,h.avail_out=p),(s=n.inflate(h,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(s=n.inflateSetDictionary(this.strm,f)),s===o.Z_BUF_ERROR&&!0===m&&(s=o.Z_OK,m=!1),s!==o.Z_STREAM_END&&s!==o.Z_OK)return this.onEnd(s),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&s!==o.Z_STREAM_END&&(0!==h.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(h.output,h.next_out),c=h.next_out-l,d=r.buf2string(h.output,l),h.next_out=c,h.avail_out=p-c,c&&i.arraySet(h.output,h.output,l,c,0),this.onData(d)):this.onData(i.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(m=!0)}while((h.avail_in>0||0===h.avail_out)&&s!==o.Z_STREAM_END);return s===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(s=n.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),h.avail_out=0,!0)},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},s.Inflate=d,s.inflate=h,s.inflateRaw=p,s.ungzip=h},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},8572:e=>{e.exports=function(){function e(t,s,n){function i(o,a){if(!s[o]){if(!t[o]){if(r)return r(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=s[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,s,n)}return s[o].exports}for(var r=void 0,o=0;o0},a.prototype.readMoreInput=function(){if(!(this.bit_end_pos_>256))if(this.eos_){if(this.bit_pos_>this.bit_end_pos_)throw new Error("Unexpected end of input "+this.bit_pos_+" "+this.bit_end_pos_)}else{var e=this.buf_ptr_,t=this.input_.read(this.buf_,e,n);if(t<0)throw new Error("Unexpected end of input");if(t=8;)this.val_>>>=8,this.val_|=this.buf_[this.pos_&r]<<24,++this.pos_,this.bit_pos_=this.bit_pos_-8>>>0,this.bit_end_pos_=this.bit_end_pos_-8>>>0},a.prototype.readBits=function(e){32-this.bit_pos_>>this.bit_pos_&o[e];return this.bit_pos_+=e,t},t.exports=a},{}],2:[function(e,t,s){s.lookup=new Uint8Array([0,0,0,0,0,0,0,0,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,12,16,12,12,20,12,16,24,28,12,12,32,12,36,12,44,44,44,44,44,44,44,44,44,44,32,32,24,40,28,12,12,48,52,52,52,48,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,48,52,52,52,52,52,24,12,28,12,12,12,56,60,60,60,56,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,56,60,60,60,60,60,24,12,28,12,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,56,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,15,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,22,22,22,22,23,23,23,23,24,24,24,24,25,25,25,25,26,26,26,26,27,27,27,27,28,28,28,28,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,33,33,34,34,34,34,35,35,35,35,36,36,36,36,37,37,37,37,38,38,38,38,39,39,39,39,40,40,40,40,41,41,41,41,42,42,42,42,43,43,43,43,44,44,44,44,45,45,45,45,46,46,46,46,47,47,47,47,48,48,48,48,49,49,49,49,50,50,50,50,51,51,51,51,52,52,52,52,53,53,53,53,54,54,54,54,55,55,55,55,56,56,56,56,57,57,57,57,58,58,58,58,59,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),s.lookupOffsets=new Uint16Array([1024,1536,1280,1536,0,256,768,512])},{}],3:[function(e,t,s){var n=e("./streams").BrotliInput,i=e("./streams").BrotliOutput,r=e("./bit_reader"),o=e("./dictionary"),a=e("./huffman").HuffmanCode,l=e("./huffman").BrotliBuildHuffmanTable,c=e("./context"),u=e("./prefix"),d=e("./transform"),h=8,p=16,f=256,m=704,g=26,v=6,y=2,x=8,b=255,w=1080,_=18,S=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),j=16,C=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),k=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),E=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function P(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function I(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<1&&0===r)throw new Error("Invalid size byte");i.meta_block_length|=r<<8*n}}else for(n=0;n4&&0===o)throw new Error("Invalid size nibble");i.meta_block_length|=o<<4*n}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function A(e,t,s){var n;return s.fillBitWindow(),(n=e[t+=s.val_>>>s.bit_pos_&b].bits-x)>0&&(s.bit_pos_+=x,t+=e[t].value,t+=s.val_>>>s.bit_pos_&(1<0;){var m,g=0;if(n.readMoreInput(),n.fillBitWindow(),g+=n.val_>>>n.bit_pos_&31,n.bit_pos_+=d[g].bits,(m=255&d[g].value)>m);else{var v,y,x=m-14,b=0;if(m===p&&(b=r),c!==b&&(o=0,c=b),v=o,o>0&&(o-=2,o<<=x),i+(y=(o+=n.readBits(x)+3)-v)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var w=0;w0;++p){var y,b=S[p],w=0;n.fillBitWindow(),w+=n.val_>>>n.bit_pos_&15,n.bit_pos_+=v[w].bits,y=v[w].value,f[b]=y,0!==y&&(m-=32>>y,++g)}if(1!==g&&0!==m)throw new Error("[ReadHuffmanCode] invalid num_codes or space");M(f,e,o,n)}if(0===(r=l(t,s,x,o,e)))throw new Error("[ReadHuffmanCode] BuildHuffmanTable failed: ");return r}function F(e,t,s){var n,i;return n=A(e,t,s),i=u.kBlockLengthPrefixCode[n].nbits,u.kBlockLengthPrefixCode[n].offset+s.readBits(i)}function V(e,t,s){var n;return e>>5]),this.htrees=new Uint32Array(t)}function L(e,t){var s,n,i={num_htrees:null,context_map:null},r=0;t.readMoreInput();var o=i.num_htrees=I(t)+1,l=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(r=t.readBits(4)+1),s=[],n=0;n=e)throw new Error("[DecodeContextMap] i >= context_map_size");l[n]=0,++n}else l[n]=c-r,++n}return t.readBits(1)&&B(l,e),i}function z(e,t,s,n,i,r,o){var a,l=2*s,c=s,u=A(t,s*w,o);(a=0===u?i[l+(1&r[c])]:1===u?i[l+(r[c]-1&1)]+1:u-2)>=e&&(a-=e),n[s]=a,i[l+(1&r[c])]=a,++r[c]}function G(e,t,s,n,i,o){var a,l=i+1,c=s&i,u=o.pos_&r.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)0;)o.readMoreInput(),n[c++]=o.readBits(8),c===l&&(e.write(n,l),c=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)n[c]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++c,--t;if(u+(a=o.bit_end_pos_-o.bit_pos_>>3)>r.IBUF_MASK){for(var d=r.IBUF_MASK+1-u,h=0;h=l)for(e.write(n,l),c-=l,h=0;h=l;){if(a=l-c,o.input_.read(n,c,a)t.buffer.length){var ye=new Uint8Array(S+se);ye.set(t.buffer),t.buffer=ye}if(C=ve.input_end,Z=ve.is_uncompressed,ve.is_metadata)for(H(_);se>0;--se)_.readMoreInput(),_.readBits(8);else if(0!==se)if(Z)_.bit_pos_=_.bit_pos_+7&-8,G(t,se,S,h,l,_),S+=se;else{for(s=0;s<3;++s)re[s]=I(_)+1,re[s]>=2&&(N(re[s]+2,x,s*w,_),N(g,b,s*w,_),ne[s]=F(b,s*w,_),ae[s]=1);for(_.readMoreInput(),X=(1<<(K=_.readBits(2)))-1,J=(Y=j+(_.readBits(4)<0;){var we,_e,Se,je,Ce,ke,Ee,Pe,Ie,Te,Oe,Ae;for(_.readMoreInput(),0===ne[1]&&(z(re[1],x,1,ie,oe,ae,_),ne[1]=F(b,w,_),te=U[1].htrees[ie[1]]),--ne[1],(_e=(we=A(U[1].codes,te,_))>>6)>=2?(_e-=2,Ee=-1):Ee=0,Se=u.kInsertRangeLut[_e]+(we>>3&7),je=u.kCopyRangeLut[_e]+(7&we),Ce=u.kInsertLengthPrefixCode[Se].offset+_.readBits(u.kInsertLengthPrefixCode[Se].nbits),ke=u.kCopyLengthPrefixCode[je].offset+_.readBits(u.kCopyLengthPrefixCode[je].nbits),R=h[S-1&l],B=h[S-2&l],Ie=0;Ie4?3:ke-2))],(Ee=A(U[2].codes,U[2].htrees[fe],_))>=Y&&(Ae=(Ee-=Y)&X,Ee=Y+((Me=(2+(1&(Ee>>=K))<<(Oe=1+(Ee>>1)))-4)+_.readBits(Oe)<(E=S=o.minDictionaryWordLength&&ke<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+S+" distance: "+Pe+" len: "+ke+" bytes left: "+se);var Me=o.offsetsByLength[ke],Ne=Pe-E-1,Fe=o.sizeBitsByLength[ke],Ve=Ne>>Fe;if(Me+=(Ne&(1<=p){t.write(h,i);for(var Be=0;Be0&&(T[3&M]=Pe,++M),ke>se)throw new Error("Invalid backward reference. pos: "+S+" distance: "+Pe+" len: "+ke+" bytes left: "+se);for(Ie=0;Ie>=1;return(e&s-1)+s}function o(e,t,s,i,r){do{e[t+(i-=s)]=new n(r.bits,r.value)}while(i>0)}function a(e,t,s){for(var n=1<0;--w[u])o(e,t+h,p,v,new n(255&u,65535&x[d++])),h=r(h,u);for(m=y-1,f=-1,u=s+1,p=2;u<=i;++u,p<<=1)for(;w[u]>0;--w[u])(h&m)!==f&&(t+=v,y+=v=1<<(g=a(w,u,s)),e[b+(f=h&m)]=new n(g+s&255,t-b-f&65535)),o(e,t+(h>>s),p,v,new n(u-s&255,65535&x[d++])),h=r(h,u);return y}},{}],8:[function(e,t,s){"use strict";s.byteLength=u,s.toByteArray=h,s.fromByteArray=m;for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var s=e.indexOf("=");return-1===s&&(s=t),[s,s===t?0:4-s%4]}function u(e){var t=c(e),s=t[0],n=t[1];return 3*(s+n)/4-n}function d(e,t,s){return 3*(t+s)/4-s}function h(e){for(var t,s=c(e),n=s[0],o=s[1],a=new r(d(e,n,o)),l=0,u=o>0?n-4:n,h=0;h>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===o&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t),1===o&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a}function p(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function f(e,t,s){for(var n,i=[],r=t;rl?l:a+o));return 1===i?(t=e[s-1],r.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[s-2]<<8)+e[s-1],r.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],9:[function(e,t,s){function n(e,t){this.offset=e,this.nbits=t}s.kBlockLengthPrefixCode=[new n(1,2),new n(5,2),new n(9,2),new n(13,2),new n(17,3),new n(25,3),new n(33,3),new n(41,3),new n(49,4),new n(65,4),new n(81,4),new n(97,4),new n(113,5),new n(145,5),new n(177,5),new n(209,5),new n(241,6),new n(305,6),new n(369,7),new n(497,8),new n(753,9),new n(1265,10),new n(2289,11),new n(4337,12),new n(8433,13),new n(16625,24)],s.kInsertLengthPrefixCode=[new n(0,0),new n(1,0),new n(2,0),new n(3,0),new n(4,0),new n(5,0),new n(6,1),new n(8,1),new n(10,2),new n(14,2),new n(18,3),new n(26,3),new n(34,4),new n(50,4),new n(66,5),new n(98,5),new n(130,6),new n(194,7),new n(322,8),new n(578,9),new n(1090,10),new n(2114,12),new n(6210,14),new n(22594,24)],s.kCopyLengthPrefixCode=[new n(2,0),new n(3,0),new n(4,0),new n(5,0),new n(6,0),new n(7,0),new n(8,0),new n(9,0),new n(10,1),new n(12,1),new n(14,2),new n(18,2),new n(22,3),new n(30,3),new n(38,4),new n(54,4),new n(70,5),new n(102,5),new n(134,6),new n(198,7),new n(326,8),new n(582,9),new n(1094,10),new n(2118,24)],s.kInsertRangeLut=[0,0,8,8,0,16,8,16,16],s.kCopyRangeLut=[0,8,0,8,16,0,16,8,16]},{}],10:[function(e,t,s){function n(e){this.buffer=e,this.pos=0}function i(e){this.buffer=e,this.pos=0}n.prototype.read=function(e,t,s){this.pos+s>this.buffer.length&&(s=this.buffer.length-this.pos);for(var n=0;nthis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},s.BrotliOutput=i},{}],11:[function(e,t,s){var n=e("./dictionary"),i=0,r=1,o=2,a=3,l=4,c=5,u=6,d=7,h=8,p=9,f=10,m=11,g=12,v=13,y=14,x=15,b=16,w=17,_=18,S=20;function j(e,t,s){this.prefix=new Uint8Array(e.length),this.transform=t,this.suffix=new Uint8Array(s.length);for(var n=0;n'),new j("",i,"\n"),new j("",a,""),new j("",i,"]"),new j("",i," for "),new j("",y,""),new j("",o,""),new j("",i," a "),new j("",i," that "),new j(" ",f,""),new j("",i,". "),new j(".",i,""),new j(" ",i,", "),new j("",x,""),new j("",i," with "),new j("",i,"'"),new j("",i," from "),new j("",i," by "),new j("",b,""),new j("",w,""),new j(" the ",i,""),new j("",l,""),new j("",i,". The "),new j("",m,""),new j("",i," on "),new j("",i," as "),new j("",i," is "),new j("",d,""),new j("",r,"ing "),new j("",i,"\n\t"),new j("",i,":"),new j(" ",i,". "),new j("",i,"ed "),new j("",S,""),new j("",_,""),new j("",u,""),new j("",i,"("),new j("",f,", "),new j("",h,""),new j("",i," at "),new j("",i,"ly "),new j(" the ",i," of "),new j("",c,""),new j("",p,""),new j(" ",f,", "),new j("",f,'"'),new j(".",i,"("),new j("",m," "),new j("",f,'">'),new j("",i,'="'),new j(" ",i,"."),new j(".com/",i,""),new j(" the ",i," of the "),new j("",f,"'"),new j("",i,". This "),new j("",i,","),new j(".",i," "),new j("",f,"("),new j("",f,"."),new j("",i," not "),new j(" ",i,'="'),new j("",i,"er "),new j(" ",m," "),new j("",i,"al "),new j(" ",m,""),new j("",i,"='"),new j("",m,'"'),new j("",f,". "),new j(" ",i,"("),new j("",i,"ful "),new j(" ",f,". "),new j("",i,"ive "),new j("",i,"less "),new j("",m,"'"),new j("",i,"est "),new j(" ",f,"."),new j("",m,'">'),new j(" ",i,"='"),new j("",f,","),new j("",i,"ize "),new j("",m,"."),new j(" ",i,""),new j(" ",i,","),new j("",f,'="'),new j("",m,'="'),new j("",i,"ous "),new j("",m,", "),new j("",f,"='"),new j(" ",f,","),new j(" ",m,'="'),new j(" ",m,", "),new j("",m,","),new j("",m,"("),new j("",m,". "),new j(" ",m,"."),new j("",m,"='"),new j(" ",m,". "),new j(" ",f,'="'),new j(" ",m,"='"),new j(" ",f,"='")];function k(e,t){return e[t]<192?(e[t]>=97&&e[t]<=122&&(e[t]^=32),1):e[t]<224?(e[t+1]^=32,2):(e[t+2]^=5,3)}s.kTransforms=C,s.kNumTransforms=C.length,s.transformDictionaryWord=function(e,t,s,i,r){var o,a=C[r].prefix,l=C[r].suffix,c=C[r].transform,u=ci&&(u=i);for(var v=0;v0;){var y=k(e,o);o+=y,i-=y}for(var x=0;x{var t={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",Ấ:"A",Ắ:"A",Ẳ:"A",Ẵ:"A",Ặ:"A",Æ:"AE",Ầ:"A",Ằ:"A",Ȃ:"A",Ả:"A",Ạ:"A",Ẩ:"A",Ẫ:"A",Ậ:"A",Ç:"C",Ḉ:"C",È:"E",É:"E",Ê:"E",Ë:"E",Ế:"E",Ḗ:"E",Ề:"E",Ḕ:"E",Ḝ:"E",Ȇ:"E",Ẻ:"E",Ẽ:"E",Ẹ:"E",Ể:"E",Ễ:"E",Ệ:"E",Ì:"I",Í:"I",Î:"I",Ï:"I",Ḯ:"I",Ȋ:"I",Ỉ:"I",Ị:"I",Ð:"D",Ñ:"N",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",Ố:"O",Ṍ:"O",Ṓ:"O",Ȏ:"O",Ỏ:"O",Ọ:"O",Ổ:"O",Ỗ:"O",Ộ:"O",Ờ:"O",Ở:"O",Ỡ:"O",Ớ:"O",Ợ:"O",Ù:"U",Ú:"U",Û:"U",Ü:"U",Ủ:"U",Ụ:"U",Ử:"U",Ữ:"U",Ự:"U",Ý:"Y",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",ấ:"a",ắ:"a",ẳ:"a",ẵ:"a",ặ:"a",æ:"ae",ầ:"a",ằ:"a",ȃ:"a",ả:"a",ạ:"a",ẩ:"a",ẫ:"a",ậ:"a",ç:"c",ḉ:"c",è:"e",é:"e",ê:"e",ë:"e",ế:"e",ḗ:"e",ề:"e",ḕ:"e",ḝ:"e",ȇ:"e",ẻ:"e",ẽ:"e",ẹ:"e",ể:"e",ễ:"e",ệ:"e",ì:"i",í:"i",î:"i",ï:"i",ḯ:"i",ȋ:"i",ỉ:"i",ị:"i",ð:"d",ñ:"n",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",ố:"o",ṍ:"o",ṓ:"o",ȏ:"o",ỏ:"o",ọ:"o",ổ:"o",ỗ:"o",ộ:"o",ờ:"o",ở:"o",ỡ:"o",ớ:"o",ợ:"o",ù:"u",ú:"u",û:"u",ü:"u",ủ:"u",ụ:"u",ử:"u",ữ:"u",ự:"u",ý:"y",ÿ:"y",Ā:"A",ā:"a",Ă:"A",ă:"a",Ą:"A",ą:"a",Ć:"C",ć:"c",Ĉ:"C",ĉ:"c",Ċ:"C",ċ:"c",Č:"C",č:"c",C̆:"C",c̆:"c",Ď:"D",ď:"d",Đ:"D",đ:"d",Ē:"E",ē:"e",Ĕ:"E",ĕ:"e",Ė:"E",ė:"e",Ę:"E",ę:"e",Ě:"E",ě:"e",Ĝ:"G",Ǵ:"G",ĝ:"g",ǵ:"g",Ğ:"G",ğ:"g",Ġ:"G",ġ:"g",Ģ:"G",ģ:"g",Ĥ:"H",ĥ:"h",Ħ:"H",ħ:"h",Ḫ:"H",ḫ:"h",Ĩ:"I",ĩ:"i",Ī:"I",ī:"i",Ĭ:"I",ĭ:"i",Į:"I",į:"i",İ:"I",ı:"i",IJ:"IJ",ij:"ij",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",Ḱ:"K",ḱ:"k",K̆:"K",k̆:"k",Ĺ:"L",ĺ:"l",Ļ:"L",ļ:"l",Ľ:"L",ľ:"l",Ŀ:"L",ŀ:"l",Ł:"l",ł:"l",Ḿ:"M",ḿ:"m",M̆:"M",m̆:"m",Ń:"N",ń:"n",Ņ:"N",ņ:"n",Ň:"N",ň:"n",ʼn:"n",N̆:"N",n̆:"n",Ō:"O",ō:"o",Ŏ:"O",ŏ:"o",Ő:"O",ő:"o",Œ:"OE",œ:"oe",P̆:"P",p̆:"p",Ŕ:"R",ŕ:"r",Ŗ:"R",ŗ:"r",Ř:"R",ř:"r",R̆:"R",r̆:"r",Ȓ:"R",ȓ:"r",Ś:"S",ś:"s",Ŝ:"S",ŝ:"s",Ş:"S",Ș:"S",ș:"s",ş:"s",Š:"S",š:"s",Ţ:"T",ţ:"t",ț:"t",Ț:"T",Ť:"T",ť:"t",Ŧ:"T",ŧ:"t",T̆:"T",t̆:"t",Ũ:"U",ũ:"u",Ū:"U",ū:"u",Ŭ:"U",ŭ:"u",Ů:"U",ů:"u",Ű:"U",ű:"u",Ų:"U",ų:"u",Ȗ:"U",ȗ:"u",V̆:"V",v̆:"v",Ŵ:"W",ŵ:"w",Ẃ:"W",ẃ:"w",X̆:"X",x̆:"x",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Y̆:"Y",y̆:"y",Ź:"Z",ź:"z",Ż:"Z",ż:"z",Ž:"Z",ž:"z",ſ:"s",ƒ:"f",Ơ:"O",ơ:"o",Ư:"U",ư:"u",Ǎ:"A",ǎ:"a",Ǐ:"I",ǐ:"i",Ǒ:"O",ǒ:"o",Ǔ:"U",ǔ:"u",Ǖ:"U",ǖ:"u",Ǘ:"U",ǘ:"u",Ǚ:"U",ǚ:"u",Ǜ:"U",ǜ:"u",Ứ:"U",ứ:"u",Ṹ:"U",ṹ:"u",Ǻ:"A",ǻ:"a",Ǽ:"AE",ǽ:"ae",Ǿ:"O",ǿ:"o",Þ:"TH",þ:"th",Ṕ:"P",ṕ:"p",Ṥ:"S",ṥ:"s",X́:"X",x́:"x",Ѓ:"Г",ѓ:"г",Ќ:"К",ќ:"к",A̋:"A",a̋:"a",E̋:"E",e̋:"e",I̋:"I",i̋:"i",Ǹ:"N",ǹ:"n",Ồ:"O",ồ:"o",Ṑ:"O",ṑ:"o",Ừ:"U",ừ:"u",Ẁ:"W",ẁ:"w",Ỳ:"Y",ỳ:"y",Ȁ:"A",ȁ:"a",Ȅ:"E",ȅ:"e",Ȉ:"I",ȉ:"i",Ȍ:"O",ȍ:"o",Ȑ:"R",ȑ:"r",Ȕ:"U",ȕ:"u",B̌:"B",b̌:"b",Č̣:"C",č̣:"c",Ê̌:"E",ê̌:"e",F̌:"F",f̌:"f",Ǧ:"G",ǧ:"g",Ȟ:"H",ȟ:"h",J̌:"J",ǰ:"j",Ǩ:"K",ǩ:"k",M̌:"M",m̌:"m",P̌:"P",p̌:"p",Q̌:"Q",q̌:"q",Ř̩:"R",ř̩:"r",Ṧ:"S",ṧ:"s",V̌:"V",v̌:"v",W̌:"W",w̌:"w",X̌:"X",x̌:"x",Y̌:"Y",y̌:"y",A̧:"A",a̧:"a",B̧:"B",b̧:"b",Ḑ:"D",ḑ:"d",Ȩ:"E",ȩ:"e",Ɛ̧:"E",ɛ̧:"e",Ḩ:"H",ḩ:"h",I̧:"I",i̧:"i",Ɨ̧:"I",ɨ̧:"i",M̧:"M",m̧:"m",O̧:"O",o̧:"o",Q̧:"Q",q̧:"q",U̧:"U",u̧:"u",X̧:"X",x̧:"x",Z̧:"Z",z̧:"z",й:"и",Й:"И",ё:"е",Ё:"Е"},s=Object.keys(t).join("|"),n=new RegExp(s,"g"),i=new RegExp(s,"");function r(e){return t[e]}var o=function(e){return e.replace(n,r)};e.exports=o,e.exports.has=function(e){return!!e.match(i)},e.exports.remove=o},8477:(e,t,s)=>{"use strict"; /** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var n=s(1609);var i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,o=n.useEffect,a=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!i(e,s)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),n=r({inst:{value:s,getSnapshot:t}}),i=n[0].inst,u=n[1];return a((function(){i.value=s,i.getSnapshot=t,c(i)&&u({inst:i})}),[e,s,t]),o((function(){return c(i)&&u({inst:i}),e((function(){c(i)&&u({inst:i})}))}),[e]),l(s),s};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u},422:(e,t,s)=>{"use strict";e.exports=s(8477)},1609:e=>{"use strict";e.exports=window.React}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(s,n){if(1&n&&(s=this(s)),8&n)return s;if("object"==typeof s&&s){if(4&n&&s.__esModule)return s;if(16&n&&"function"==typeof s.then)return s}var r=Object.create(null);i.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&n&&s;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>o[e]=()=>s[e]));return o.default=()=>s,i.d(r,o),r},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";i.r(r),i.d(r,{PluginMoreMenuItem:()=>ak,PluginSidebar:()=>lk,PluginSidebarMoreMenuItem:()=>ck,PluginTemplateSettingPanel:()=>Dn,initializeEditor:()=>uk,reinitializeEditor:()=>dk,store:()=>Kt});var e={};i.r(e),i.d(e,{__experimentalSetPreviewDeviceType:()=>$e,addTemplate:()=>tt,closeGeneralSidebar:()=>yt,openGeneralSidebar:()=>vt,openNavigationPanelToMenu:()=>ut,removeTemplate:()=>st,revertTemplate:()=>gt,setEditedEntity:()=>rt,setEditedPostContext:()=>at,setHasPageContentFocus:()=>bt,setHomeTemplateId:()=>ot,setIsInserterOpened:()=>ht,setIsListViewOpened:()=>pt,setIsNavigationPanelOpened:()=>dt,setIsSaveViewOpened:()=>mt,setNavigationMenu:()=>it,setNavigationPanelActiveMenu:()=>ct,setPage:()=>lt,setTemplate:()=>et,setTemplatePart:()=>nt,switchEditorMode:()=>xt,toggleDistractionFree:()=>wt,toggleFeature:()=>Qe,updateSettings:()=>ft});var t={};i.r(t),i.d(t,{setCanvasMode:()=>_t,setEditorCanvasContainerView:()=>St});var s={};i.r(s),i.d(s,{__experimentalGetInsertionPoint:()=>Ft,__experimentalGetPreviewDeviceType:()=>Ct,getCanUserCreateMedia:()=>kt,getCurrentTemplateNavigationPanelSubMenu:()=>Lt,getCurrentTemplateTemplateParts:()=>Bt,getEditedPostContext:()=>At,getEditedPostId:()=>Ot,getEditedPostType:()=>Tt,getEditorMode:()=>Dt,getHomeTemplateId:()=>It,getNavigationPanelActiveMenu:()=>zt,getPage:()=>Mt,getReusableBlocks:()=>Et,getSettings:()=>Pt,hasPageContentFocus:()=>Ut,isFeatureActive:()=>jt,isInserterOpened:()=>Nt,isListViewOpened:()=>Vt,isNavigationOpened:()=>Gt,isPage:()=>Ht,isSaveViewOpened:()=>Rt});var n={};i.r(n),i.d(n,{getCanvasMode:()=>Wt,getEditorCanvasContainerView:()=>qt});const o=window.wp.blocks,a=window.wp.blockLibrary,l=window.wp.data,c=window.wp.deprecated;var u=i.n(c);const d=window.wp.element,h=window.wp.editor,f=window.wp.preferences,m=window.wp.widgets,g=window.wp.hooks,v=window.wp.compose,y=window.wp.blockEditor,x=window.wp.components,b=window.wp.i18n,w=window.wp.notices,_=window.wp.coreData;var S={grad:.9,turn:360,rad:360/(2*Math.PI)},j=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},C=function(e,t,s){return void 0===t&&(t=0),void 0===s&&(s=Math.pow(10,t)),Math.round(s*e)/s+0},k=function(e,t,s){return void 0===t&&(t=0),void 0===s&&(s=1),e>s?s:e>t?e:t},E=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},P=function(e){return{r:k(e.r,0,255),g:k(e.g,0,255),b:k(e.b,0,255),a:k(e.a)}},I=function(e){return{r:C(e.r),g:C(e.g),b:C(e.b),a:C(e.a,3)}},T=/^#([0-9a-f]{3,8})$/i,O=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},A=function(e){var t=e.r,s=e.g,n=e.b,i=e.a,r=Math.max(t,s,n),o=r-Math.min(t,s,n),a=o?r===t?(s-n)/o:r===s?2+(n-t)/o:4+(t-s)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:i}},M=function(e){var t=e.h,s=e.s,n=e.v,i=e.a;t=t/360*6,s/=100,n/=100;var r=Math.floor(t),o=n*(1-s),a=n*(1-(t-r)*s),l=n*(1-(1-t+r)*s),c=r%6;return{r:255*[n,a,o,o,l,n][c],g:255*[l,n,n,a,o,o][c],b:255*[o,o,l,n,n,a][c],a:i}},N=function(e){return{h:E(e.h),s:k(e.s,0,100),l:k(e.l,0,100),a:k(e.a)}},F=function(e){return{h:C(e.h),s:C(e.s),l:C(e.l),a:C(e.a,3)}},V=function(e){return M((s=(t=e).s,{h:t.h,s:(s*=((n=t.l)<50?n:100-n)/100)>0?2*s/(n+s)*100:0,v:n+s,a:t.a}));var t,s,n},R=function(e){return{h:(t=A(e)).h,s:(i=(200-(s=t.s))*(n=t.v)/100)>0&&i<200?s*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,s,n,i},B=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,L=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,z=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G={string:[[function(e){var t=T.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?C(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?C(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=L.exec(e)||z.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:P({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=B.exec(e)||D.exec(e);if(!t)return null;var s,n,i=N({h:(s=t[1],n=t[2],void 0===n&&(n="deg"),Number(s)*(S[n]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return V(i)},"hsl"]],object:[[function(e){var t=e.r,s=e.g,n=e.b,i=e.a,r=void 0===i?1:i;return j(t)&&j(s)&&j(n)?P({r:Number(t),g:Number(s),b:Number(n),a:Number(r)}):null},"rgb"],[function(e){var t=e.h,s=e.s,n=e.l,i=e.a,r=void 0===i?1:i;if(!j(t)||!j(s)||!j(n))return null;var o=N({h:Number(t),s:Number(s),l:Number(n),a:Number(r)});return V(o)},"hsl"],[function(e){var t=e.h,s=e.s,n=e.v,i=e.a,r=void 0===i?1:i;if(!j(t)||!j(s)||!j(n))return null;var o=function(e){return{h:E(e.h),s:k(e.s,0,100),v:k(e.v,0,100),a:k(e.a)}}({h:Number(t),s:Number(s),v:Number(n),a:Number(r)});return M(o)},"hsv"]]},H=function(e,t){for(var s=0;s=.5},e.prototype.toHex=function(){return t=(e=I(this.rgba)).r,s=e.g,n=e.b,r=(i=e.a)<1?O(C(255*i)):"","#"+O(t)+O(s)+O(n)+r;var e,t,s,n,i,r},e.prototype.toRgb=function(){return I(this.rgba)},e.prototype.toRgbString=function(){return t=(e=I(this.rgba)).r,s=e.g,n=e.b,(i=e.a)<1?"rgba("+t+", "+s+", "+n+", "+i+")":"rgb("+t+", "+s+", "+n+")";var e,t,s,n,i},e.prototype.toHsl=function(){return F(R(this.rgba))},e.prototype.toHslString=function(){return t=(e=F(R(this.rgba))).h,s=e.s,n=e.l,(i=e.a)<1?"hsla("+t+", "+s+"%, "+n+"%, "+i+")":"hsl("+t+", "+s+"%, "+n+"%)";var e,t,s,n,i},e.prototype.toHsv=function(){return e=A(this.rgba),{h:C(e.h),s:C(e.s),v:C(e.v),a:C(e.a,3)};var e},e.prototype.invert=function(){return Y({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),Y(W(this.rgba,-e))},e.prototype.grayscale=function(){return Y(W(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),Y(Z(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),Y(Z(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?Y({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):C(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=R(this.rgba);return"number"==typeof e?Y({h:e,s:t.s,l:t.l,a:t.a}):C(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Y(e).toHex()},e}(),Y=function(e){return e instanceof K?e:new K(e)},X=[],J=function(e){var t=e/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},Q=function(e){return.2126*J(e.r)+.7152*J(e.g)+.0722*J(e.b)};function $(e){return e?JSON.parse(JSON.stringify(e)):{}}const ee=window.wp.privateApis,{lock:te,unlock:se}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-site"),{GlobalStylesContext:ne}=se(y.privateApis),{mergeBaseAndUserConfigs:ie}=se(h.privateApis);function re(e,t){if(!t||"string"!=typeof t)return e;if("object"!=typeof e||!e||!Object.keys(e).length)return e;for(const s in e)s===t?delete e[s]:"object"==typeof e[s]&&re(e[s],t);return e}function oe({property:e}){const{variationsFromTheme:t}=(0,l.useSelect)((e=>({variationsFromTheme:e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()||[]})),[]),{user:s}=(0,d.useContext)(ne);return(0,d.useMemo)((()=>{const n=re($(s),e);n.title=(0,b.__)("Default");const i=t.filter((t=>le(t,e))).map((e=>ie(n,e)));return[n,...i]}),[e,s,t])}const ae=(e,t)=>{if(!e)return{};const s={};return Object.keys(e).forEach((n=>{if(n===t)s[n]=e[n];else if("object"==typeof e[n]){const i=ae(e[n],t);Object.keys(i).length&&(s[n]=i)}})),s};function le(e,t){const s=ae($(e),t);return JSON.stringify(s?.styles)===JSON.stringify(e?.styles)&&JSON.stringify(s?.settings)===JSON.stringify(e?.settings)}const{useGlobalSetting:ce,useGlobalStyle:ue}=se(y.privateApis);function de(){const[e="black"]=ue("color.text"),[t="white"]=ue("color.background"),[s=e]=ue("elements.h1.color.text"),[n=s]=ue("elements.link.color.text"),[i=n]=ue("elements.button.color.background"),[r]=ce("color.palette.core"),[o]=ce("color.palette.theme"),[a]=ce("color.palette.custom"),l=(null!=o?o:[]).concat(null!=a?a:[]).concat(null!=r?r:[]),c=l.filter((({color:t})=>t===e)),u=l.filter((({color:e})=>e===i)),d=c.concat(u).concat(l).filter((({color:e})=>e!==t)).slice(0,2);return{paletteColors:l,highlightedColors:d}}function he(){const e=oe({property:"color"});return e?.length?e.filter((e=>{const{settings:t,styles:s,title:n}=e;return n===(0,b.__)("Default")||Object.keys(t).length>0||Object.keys(s).length>0})):[]}function pe(){const e=oe({property:"typography"});return e?.length?e.filter((e=>{const{settings:t,styles:s,title:n}=e;return n===(0,b.__)("Default")||Object.keys(t).length>0||Object.keys(s).length>0})):[]}function fe(e,t,s){return e&&"object"==typeof e?(t.reduce(((e,n,i)=>(void 0===e[n]&&(Number.isInteger(t[i+1])?e[n]=[]:e[n]={}),i===t.length-1&&(e[n]=s),e[n])),e),e):e}!function(e){e.forEach((function(e){X.indexOf(e)<0&&(e(K,G),X.push(e))}))}([function(e){e.prototype.luminance=function(){return e=Q(this.rgba),void 0===(t=2)&&(t=0),void 0===s&&(s=Math.pow(10,t)),Math.round(s*e)/s+0;var e,t,s},e.prototype.contrast=function(t){void 0===t&&(t="#FFF");var s,n,i,r,o,a,l,c=t instanceof e?t:new e(t);return r=this.rgba,o=c.toRgb(),s=(a=Q(r))>(l=Q(o))?(a+.05)/(l+.05):(l+.05)/(a+.05),void 0===(n=2)&&(n=0),void 0===i&&(i=Math.pow(10,n)),Math.floor(i*s)/i+0},e.prototype.isReadable=function(e,t){return void 0===e&&(e="#FFF"),void 0===t&&(t={}),this.contrast(e)>=(o=void 0===(r=(s=t).size)?"normal":r,"AAA"===(i=void 0===(n=s.level)?"AA":n)&&"normal"===o?7:"AA"===i&&"large"===o?3:4.5);var s,n,i,r,o}}]);const me=window.ReactJSXRuntime,{cleanEmptyObject:ge,GlobalStylesContext:ve}=se(y.privateApis),ye={...o.__EXPERIMENTAL_STYLE_PROPERTY,blockGap:{value:["spacing","blockGap"]}},xe={"border.color":"color","color.background":"color","color.text":"color","elements.link.color.text":"color","elements.link.:hover.color.text":"color","elements.link.typography.fontFamily":"font-family","elements.link.typography.fontSize":"font-size","elements.button.color.text":"color","elements.button.color.background":"color","elements.button.typography.fontFamily":"font-family","elements.button.typography.fontSize":"font-size","elements.caption.color.text":"color","elements.heading.color":"color","elements.heading.color.background":"color","elements.heading.typography.fontFamily":"font-family","elements.heading.gradient":"gradient","elements.heading.color.gradient":"gradient","elements.h1.color":"color","elements.h1.color.background":"color","elements.h1.typography.fontFamily":"font-family","elements.h1.color.gradient":"gradient","elements.h2.color":"color","elements.h2.color.background":"color","elements.h2.typography.fontFamily":"font-family","elements.h2.color.gradient":"gradient","elements.h3.color":"color","elements.h3.color.background":"color","elements.h3.typography.fontFamily":"font-family","elements.h3.color.gradient":"gradient","elements.h4.color":"color","elements.h4.color.background":"color","elements.h4.typography.fontFamily":"font-family","elements.h4.color.gradient":"gradient","elements.h5.color":"color","elements.h5.color.background":"color","elements.h5.typography.fontFamily":"font-family","elements.h5.color.gradient":"gradient","elements.h6.color":"color","elements.h6.color.background":"color","elements.h6.typography.fontFamily":"font-family","elements.h6.color.gradient":"gradient","color.gradient":"gradient",blockGap:"spacing","typography.fontSize":"font-size","typography.fontFamily":"font-family"},be={"border.color":"borderColor","color.background":"backgroundColor","color.text":"textColor","color.gradient":"gradient","typography.fontSize":"fontSize","typography.fontFamily":"fontFamily"},we=["border","color","spacing","typography"],_e=(e,t)=>{let s=e;return t.forEach((e=>{s=s?.[e]})),s},Se=["borderColor","borderWidth","borderStyle"],je=["top","right","bottom","left"];function Ce(e,t,s){if(!t?.[e]||s?.[e]?.style)return[];const{color:n,style:i,width:r}=t[e];return!(n||r)||i?[]:[{path:["border",e,"style"],value:"solid"}]}function ke(e,t,s){const n=function(e,t){const{supportedPanels:s}=(0,l.useSelect)((s=>({supportedPanels:se(s(o.store)).getSupportedStyles(e,t)})),[e,t]);return s}(e),i=s?.styles?.blocks?.[e];return(0,d.useMemo)((()=>{const e=n.flatMap((e=>{if(!ye[e])return[];const{value:s}=ye[e],n=s.join("."),i=t[be[n]],r=i?`var:preset|${xe[n]}|${i}`:_e(t.style,s);if("linkColor"===e){const e=r?[{path:s,value:r}]:[],n=["elements","link",":hover","color","text"],i=_e(t.style,n);return i&&e.push({path:n,value:i}),e}if(Se.includes(e)&&r){const e=[{path:s,value:r}];return je.forEach((t=>{const n=[...s];n.splice(-1,0,t),e.push({path:n,value:r})})),e}return r?[{path:s,value:r}]:[]}));return function(e,t,s){if(!e&&!t)return[];const n=[...Ce("top",e,s),...Ce("right",e,s),...Ce("bottom",e,s),...Ce("left",e,s)],{color:i,style:r,width:o}=e||{};return(t||i||o)&&!r&&je.forEach((e=>{s?.[e]?.style||n.push({path:["border",e,"style"],value:"solid"})})),n}(t.style?.border,t.borderColor,i?.border).forEach((t=>e.push(t))),e}),[n,t,i])}function Ee({name:e,attributes:t,setAttributes:s}){const{user:n,setUserConfig:i}=(0,d.useContext)(ve),r=ke(e,t,n),{__unstableMarkNextChangeAsNotPersistent:a}=(0,l.useDispatch)(y.store),{createSuccessNotice:c}=(0,l.useDispatch)(w.store),u=(0,d.useCallback)((()=>{if(0!==r.length&&r.length>0){const{style:l}=t,u=$(l),d=$(n);for(const{path:t,value:s}of r)fe(u,t,void 0),fe(d,["styles","blocks",e,...t],s);const h={borderColor:void 0,backgroundColor:void 0,textColor:void 0,gradient:void 0,fontSize:void 0,fontFamily:void 0,style:ge(u)};a(),s(h),i(d,{undoIgnore:!0}),c((0,b.sprintf)((0,b.__)("%s styles applied."),(0,o.getBlockType)(e).title),{type:"snackbar",actions:[{label:(0,b.__)("Undo"),onClick(){a(),s(t),i(n,{undoIgnore:!0})}}]})}}),[a,t,r,c,e,s,i,n]);return(0,me.jsxs)(x.BaseControl,{className:"edit-site-push-changes-to-global-styles-control",help:(0,b.sprintf)((0,b.__)("Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks."),(0,o.getBlockType)(e).title),children:[(0,me.jsx)(x.BaseControl.VisualLabel,{children:(0,b.__)("Styles")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"secondary",__experimentalIsFocusable:!0,disabled:0===r.length,onClick:u,children:(0,b.__)("Apply globally")})]})}function Pe(e){const t=(0,y.useBlockEditingMode)(),s=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]),n=we.some((t=>(0,o.hasBlockSupport)(e.name,t)));return"default"===t&&n&&s?(0,me.jsx)(y.InspectorAdvancedControls,{children:(0,me.jsx)(Ee,{...e})}):null}const Ie=(0,v.createHigherOrderComponent)((e=>t=>(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(e,{...t}),t.isSelected&&(0,me.jsx)(Pe,{...t})]})));(0,g.addFilter)("editor.BlockEdit","core/edit-site/push-changes-to-global-styles",Ie);const Te=(0,l.combineReducers)({settings:function(e={},t){return"UPDATE_SETTINGS"===t.type?{...e,...t.settings}:e},editedPost:function(e={},t){switch(t.type){case"SET_EDITED_POST":return{postType:t.postType,id:t.id,context:t.context};case"SET_EDITED_POST_CONTEXT":return{...e,context:t.context}}return e},saveViewPanel:function(e=!1,t){switch(t.type){case"SET_IS_SAVE_VIEW_OPENED":return t.isOpen;case"SET_CANVAS_MODE":return!1}return e},canvasMode:function(e="init",t){return"SET_CANVAS_MODE"===t.type?t.mode:e},editorCanvasContainerView:function(e=void 0,t){return"SET_EDITOR_CANVAS_CONTAINER_VIEW"===t.type?t.view:e}}),Oe=window.wp.patterns,Ae="wp_navigation",Me="wp_template",Ne="wp_template_part",Fe={custom:"custom",theme:"theme",plugin:"plugin"},Ve="uncategorized",Re="all-parts",{PATTERN_TYPES:Be,PATTERN_DEFAULT_CATEGORY:De,PATTERN_USER_CATEGORY:Le,EXCLUDED_PATTERN_SOURCES:ze,PATTERN_SYNC_TYPES:Ge}=se(Oe.privateApis),He=[Ne,Ae,Be.user],Ue={[Me]:(0,b.__)("Template"),[Ne]:(0,b.__)("Template part"),[Be.user]:(0,b.__)("Pattern"),[Ae]:(0,b.__)("Navigation")},We="grid",qe="table",Ze="list",Ke="is",Ye="isAny",Xe="isNone",{interfaceStore:Je}=se(h.privateApis);function Qe(e){return function({registry:t}){u()("dispatch( 'core/edit-site' ).toggleFeature( featureName )",{since:"6.0",alternative:"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )"}),t.dispatch(f.store).toggle("core/edit-site",e)}}const $e=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).__experimentalSetPreviewDeviceType",{since:"6.5",version:"6.7",hint:"registry.dispatch( editorStore ).setDeviceType"}),t.dispatch(h.store).setDeviceType(e)};function et(){return u()("dispatch( 'core/edit-site' ).setTemplate",{since:"6.5",version:"6.8",hint:"The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}const tt=e=>async({dispatch:t,registry:s})=>{u()("dispatch( 'core/edit-site' ).addTemplate",{since:"6.5",version:"6.8",hint:"use saveEntityRecord directly"});const n=await s.dispatch(_.store).saveEntityRecord("postType",Me,e);e.content&&s.dispatch(_.store).editEntityRecord("postType",Me,n.id,{blocks:(0,o.parse)(e.content)},{undoIgnore:!0}),t({type:"SET_EDITED_POST",postType:Me,id:n.id})},st=e=>({registry:t})=>se(t.dispatch(h.store)).removeTemplates([e]);function nt(e){return{type:"SET_EDITED_POST",postType:Ne,id:e}}function it(e){return{type:"SET_EDITED_POST",postType:Ae,id:e}}function rt(e,t,s){return{type:"SET_EDITED_POST",postType:e,id:t,context:s}}function ot(){return u()("dispatch( 'core/edit-site' ).setHomeTemplateId",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function at(e){return{type:"SET_EDITED_POST_CONTEXT",context:e}}function lt(){return u()("dispatch( 'core/edit-site' ).setPage",{since:"6.5",version:"6.8",hint:"The setPage is not needed anymore, the correct entity is resolved from the URL automatically."}),{type:"NOTHING"}}function ct(){return u()("dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function ut(){return u()("dispatch( 'core/edit-site' ).openNavigationPanelToMenu",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}function dt(){return u()("dispatch( 'core/edit-site' ).setIsNavigationPanelOpened",{since:"6.2",version:"6.4"}),{type:"NOTHING"}}const ht=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsInserterOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsInserterOpened"}),t.dispatch(h.store).setIsInserterOpened(e)},pt=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).setIsListViewOpened",{since:"6.5",alternative:"dispatch( 'core/editor').setIsListViewOpened"}),t.dispatch(h.store).setIsListViewOpened(e)};function ft(e){return{type:"UPDATE_SETTINGS",settings:e}}function mt(e){return{type:"SET_IS_SAVE_VIEW_OPENED",isOpen:e}}const gt=(e,t)=>({registry:s})=>se(s.dispatch(h.store)).revertTemplate(e,t),vt=e=>({registry:t})=>{t.dispatch(Je).enableComplementaryArea("core",e)},yt=()=>({registry:e})=>{e.dispatch(Je).disableComplementaryArea("core")},xt=e=>({registry:t})=>{u()("dispatch( 'core/edit-site' ).switchEditorMode",{since:"6.6",alternative:"dispatch( 'core/editor').switchEditorMode"}),t.dispatch(h.store).switchEditorMode(e)},bt=e=>({dispatch:t,registry:s})=>{u()("dispatch( 'core/edit-site' ).setHasPageContentFocus",{since:"6.5"}),e&&s.dispatch(y.store).clearSelectedBlock(),t({type:"SET_HAS_PAGE_CONTENT_FOCUS",hasPageContentFocus:e})},wt=()=>({registry:e})=>{u()("dispatch( 'core/edit-site' ).toggleDistractionFree",{since:"6.6",alternative:"dispatch( 'core/editor').toggleDistractionFree"}),e.dispatch(h.store).toggleDistractionFree()},_t=e=>({registry:t,dispatch:s})=>{const n=()=>{t.batch((()=>{const n=window.matchMedia("(min-width: 782px)").matches;t.dispatch(y.store).clearSelectedBlock(),t.dispatch(h.store).setDeviceType("Desktop"),t.dispatch(y.store).__unstableSetEditorMode("edit");const i=t.select(h.store).isPublishSidebarOpened();s({type:"SET_CANVAS_MODE",mode:e});const r="edit"===e;i&&!r&&t.dispatch(h.store).closePublishSidebar(),n&&r&&t.select(f.store).get("core","showListViewByDefault")&&!t.select(f.store).get("core","distractionFree")?t.dispatch(h.store).setIsListViewOpened(!0):t.dispatch(h.store).setIsListViewOpened(!1),t.dispatch(h.store).setIsInserterOpened(!1)}))};if(document.startViewTransition){document.documentElement.classList.add(`canvas-mode-${e}-transition`);document.startViewTransition((()=>n())).finished.finally((()=>{document.documentElement.classList.remove(`canvas-mode-${e}-transition`)}))}else n()},St=e=>({dispatch:t})=>{t({type:"SET_EDITOR_CANVAS_CONTAINER_VIEW",view:e})},jt=(0,l.createRegistrySelector)((e=>(t,s)=>(u()("select( 'core/edit-site' ).isFeatureActive",{since:"6.0",alternative:"select( 'core/preferences' ).get"}),!!e(f.store).get("core/edit-site",s)))),Ct=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetPreviewDeviceType",{since:"6.5",version:"6.7",alternative:"select( 'core/editor' ).getDeviceType"}),e(h.store).getDeviceType()))),kt=(0,l.createRegistrySelector)((e=>()=>e(_.store).canUser("create","media"))),Et=(0,l.createRegistrySelector)((e=>()=>{u()("select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )",{since:"6.5",version:"6.8"});return"web"===d.Platform.OS?e(_.store).getEntityRecords("postType","wp_block",{per_page:-1}):[]}));function Pt(e){return e.settings}function It(){u()("select( 'core/edit-site' ).getHomeTemplateId",{since:"6.2",version:"6.4"})}function Tt(e){return e.editedPost.postType}function Ot(e){return e.editedPost.id}function At(e){return e.editedPost.context}function Mt(e){return{context:e.editedPost.context}}const Nt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isInserterOpened",{since:"6.5",alternative:"select( 'core/editor' ).isInserterOpened"}),e(h.store).isInserterOpened()))),Ft=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).__experimentalGetInsertionPoint",{since:"6.5",version:"6.7"}),se(e(h.store)).getInsertionPoint()))),Vt=(0,l.createRegistrySelector)((e=>()=>(u()("select( 'core/edit-site' ).isListViewOpened",{since:"6.5",alternative:"select( 'core/editor' ).isListViewOpened"}),e(h.store).isListViewOpened())));function Rt(e){return e.saveViewPanel}const Bt=(0,l.createRegistrySelector)((e=>()=>se(e(h.store)).getCurrentTemplateTemplateParts())),Dt=(0,l.createRegistrySelector)((e=>()=>e(f.store).get("core","editorMode")));function Lt(){u()("dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu",{since:"6.2",version:"6.4"})}function zt(){u()("dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu",{since:"6.2",version:"6.4"})}function Gt(){u()("dispatch( 'core/edit-site' ).isNavigationOpened",{since:"6.2",version:"6.4"})}function Ht(e){return!!e.editedPost.context?.postId}function Ut(){return u()("select( 'core/edit-site' ).hasPageContentFocus",{since:"6.5"}),!1}function Wt(e){return e.canvasMode}function qt(e){return e.editorCanvasContainerView}const Zt={reducer:Te,actions:e,selectors:s},Kt=(0,l.createReduxStore)("core/edit-site",Zt);(0,l.register)(Kt),se(Kt).registerPrivateSelectors(n),se(Kt).registerPrivateActions(t);const Yt=window.wp.plugins,Xt=window.wp.router;function Jt(e){var t,s,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t{const{getSite:t,getUnstableBase:s,getEntityRecords:n}=e(_.store),i=t(),r=s(),o=n("postType",Me,{per_page:-1}),a="page"===i?.show_on_front&&["number","string"].includes(typeof i.page_on_front)&&+i.page_on_front?i.page_on_front.toString():null,l="page"===i?.show_on_front&&["number","string"].includes(typeof i.page_for_posts)?i.page_for_posts.toString():null;let c;if(o){const e=o.find((e=>"front-page"===e.slug));c=!!e&&e.id}return{hasLoadedAllDependencies:!!r&&!!i,homepageId:a,postsPageId:l,url:r?.home,frontPageTemplateId:c}}),[]),a=(0,l.useSelect)((a=>{if(os.includes(t)&&e)return;const{getEditedEntityRecord:l,getEntityRecords:c,getDefaultTemplateId:u,__experimentalGetTemplateForLink:d}=a(_.store);function h(e,t){if("page"===e&&n===t){if(void 0===o)return;if(o)return o}const s=l("postType",e,t);if(!s)return;if("page"===e&&i===t)return d(s.link)?.id;const r=s.template;if(r){const e=c("postType",Me,{per_page:-1})?.find((({slug:e})=>e===r));if(e)return e.id}let a;return a=s.slug?"page"===e?`${e}-${s.slug}`:`single-${e}-${s.slug}`:"page"===e?"page":`single-${e}`,u({slug:a})}if(s){if(t&&e&&as.includes(t))return h(t,e);if(n)return h("page",n);if(r){const e=d(r);return e?.id}}}),[n,i,s,r,e,t,o]),c=(0,d.useMemo)((()=>os.includes(t)&&e?{}:t&&e&&as.includes(t)?{postType:t,postId:e}:n?{postType:"page",postId:n}:{}),[n,t,e]);return os.includes(t)&&e?{isReady:!0,postType:t,postId:e,context:c}:s?{isReady:void 0!==a,postType:Me,postId:a,context:c}:{isReady:!1}}(e),{setEditedEntity:r}=(0,l.useDispatch)(Kt);(0,d.useEffect)((()=>{i&&r(t,s,n)}),[i,t,s,n,r])}const cs=window.wp.htmlEntities,us=window.wp.primitives,ds=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z"})}),hs=window.wp.keycodes,ps=window.wp.url,fs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,me.jsx)(us.Path,{d:"M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"})});const ms=function({className:e}){const{isRequestingSite:t,siteIconUrl:s}=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e(_.store),s=t("root","__unstableBase",void 0);return{isRequestingSite:!s,siteIconUrl:s?.site_icon_url}}),[]);if(t&&!s)return(0,me.jsx)("div",{className:"edit-site-site-icon__image"});const n=s?(0,me.jsx)("img",{className:"edit-site-site-icon__image",alt:(0,b.__)("Site Icon"),src:s}):(0,me.jsx)(x.Icon,{className:"edit-site-site-icon__icon",icon:fs,size:48});return(0,me.jsx)("div",{className:Qt(e,"edit-site-site-icon"),children:n})},gs=(0,d.memo)((0,d.forwardRef)((({isTransparent:e},t)=>{const{dashboardLink:s,homeUrl:n,siteTitle:i}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt)),{getSite:s,getUnstableBase:n}=e(_.store),i=s();return{dashboardLink:t().__experimentalDashboardLink||"index.php",homeUrl:n()?.home,siteTitle:!i?.title&&i?.url?(0,ps.filterURLForDisplay)(i?.url):i?.title}}),[]),{open:r}=(0,l.useDispatch)(es.store);return(0,me.jsx)("div",{className:"edit-site-site-hub",children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",spacing:"0",children:[(0,me.jsx)("div",{className:Qt("edit-site-site-hub__view-mode-toggle-container",{"has-transparent-background":e}),children:(0,me.jsx)(x.Button,{ref:t,href:s,label:(0,b.__)("Go to the Dashboard"),className:"edit-site-layout__view-mode-toggle",style:{transform:"scale(0.5)",borderRadius:4},children:(0,me.jsx)(ms,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,me.jsxs)(x.__experimentalHStack,{children:[(0,me.jsx)("div",{className:"edit-site-site-hub__title",children:(0,me.jsx)(x.Button,{variant:"link",href:n,target:"_blank",label:(0,b.__)("View site (opens in a new tab)"),children:(0,cs.decodeEntities)(i)})}),(0,me.jsx)(x.__experimentalHStack,{spacing:0,expanded:!1,className:"edit-site-site-hub__actions",children:(0,me.jsx)(x.Button,{className:"edit-site-site-hub_toggle-command-center",icon:ds,onClick:()=>r(),label:(0,b.__)("Open command palette"),shortcut:hs.displayShortcut.primary("k")})})]})]})})}))),vs=gs,ys={position:void 0,userSelect:void 0,cursor:void 0,width:void 0,height:void 0,top:void 0,right:void 0,bottom:void 0,left:void 0},xs=320,bs=1300,ws=9/19.5,_s={width:"100%",height:"100%"};function Ss(e,t){const s=1-Math.max(0,Math.min(1,(e-xs)/(bs-xs))),n=((e,t,s)=>e+(t-e)*s)(t,ws,s);return e/n}const js=function e({isFullWidth:t,isOversized:s,setIsOversized:n,isReady:i,children:r,defaultSize:o,innerContentStyle:a}){const c=(0,v.useReducedMotion)(),[u,h]=(0,d.useState)(_s),[p,f]=(0,d.useState)(),[m,g]=(0,d.useState)(!1),[y,w]=(0,d.useState)(!1),[_,S]=(0,d.useState)(1),j=(0,l.useSelect)((e=>se(e(Kt)).getCanvasMode()),[]),{setCanvasMode:C}=se((0,l.useDispatch)(Kt)),k={type:"tween",duration:m?0:.5},E=(0,d.useRef)(null),P=(0,v.useInstanceId)(e,"edit-site-resizable-frame-handle-help"),I=o.width/o.height,T={default:{flexGrow:0,height:u.height},fullWidth:{flexGrow:1,height:u.height}},O=m?"active":y?"visible":"hidden";return(0,me.jsx)(x.ResizableBox,{as:x.__unstableMotion.div,ref:E,initial:!1,variants:T,animate:t?"fullWidth":"default",onAnimationComplete:e=>{"fullWidth"===e&&h({width:"100%",height:"100%"})},whileHover:"view"===j?{scale:1.005,transition:{duration:c?0:.5,ease:"easeOut"}}:{},transition:k,size:u,enable:{top:!1,right:!1,bottom:!1,left:i,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},resizeRatio:_,handleClasses:void 0,handleStyles:{left:ys,right:ys},minWidth:xs,maxWidth:t?"100%":"150%",maxHeight:"100%",onFocus:()=>w(!0),onBlur:()=>w(!1),onMouseOver:()=>w(!0),onMouseOut:()=>w(!1),handleComponent:{left:"view"===j&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.Tooltip,{text:(0,b.__)("Drag to resize"),children:(0,me.jsx)(x.__unstableMotion.button,{role:"separator","aria-orientation":"vertical",className:Qt("edit-site-resizable-frame__handle",{"is-resizing":m}),variants:{hidden:{opacity:0,left:0},visible:{opacity:1,left:-14},active:{opacity:1,left:-14,scaleY:1.3}},animate:O,"aria-label":(0,b.__)("Drag to resize"),"aria-describedby":P,"aria-valuenow":E.current?.resizable?.offsetWidth||void 0,"aria-valuemin":xs,"aria-valuemax":o.width,onKeyDown:e=>{if(!["ArrowLeft","ArrowRight"].includes(e.key))return;e.preventDefault();const t=20*(e.shiftKey?5:1)*("ArrowLeft"===e.key?1:-1),s=Math.min(Math.max(xs,E.current.resizable.offsetWidth+t),o.width);h({width:s,height:Ss(s,I)})},initial:"hidden",exit:"hidden",whileFocus:"active",whileHover:"active"},"handle")}),(0,me.jsx)("div",{hidden:!0,id:P,children:(0,b.__)("Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.")})]})},onResizeStart:(e,t,s)=>{f(s.offsetWidth),g(!0)},onResize:(e,t,i,r)=>{const a=r.width/_,l=Math.abs(a),c=r.width<0?l:(o.width-p)/2,u=Math.min(l,c),d=0===l?0:u/l;S(1-d+2*d);const f=p+r.width;n(f>o.width),h({height:s?"100%":Ss(f,I)})},onResizeStop:(e,t,i)=>{if(g(!1),!s)return;n(!1);i.ownerDocument.documentElement.offsetWidth-i.offsetWidth>200?h(_s):C("edit")},className:Qt("edit-site-resizable-frame__inner",{"is-resizing":m}),showHandle:!1,children:(0,me.jsx)("div",{className:"edit-site-resizable-frame__inner-content",style:a,children:r})})},{useLocation:Cs,useHistory:ks}=se(Xt.privateApis);function Es(){return void 0!==(0,ps.getQueryArg)(window.location.href,"wp_theme_preview")}function Ps(){return Es()?(0,ps.getQueryArg)(window.location.href,"wp_theme_preview"):null}const{useHistory:Is}=se(Xt.privateApis);const Ts=window.wp.apiFetch;var Os=i.n(Ts);const{EntitiesSavedStatesExtensible:As,NavigableRegion:Ms}=se(h.privateApis),Ns=({onClose:e})=>{var t,s;const n=(0,h.useEntitiesSavedStatesIsDirty)();let i;i=n.isDirty?(0,b.__)("Activate & Save"):(0,b.__)("Activate");const r=function(){const[e,t]=(0,d.useState)();return(0,d.useEffect)((()=>{const e=(0,ps.addQueryArgs)("/wp/v2/themes?status=active",{context:"edit",wp_theme_preview:""});Os()({path:e}).then((e=>t(e[0]))).catch((()=>{}))}),[]),e}(),o=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()),[]),a=(0,me.jsx)("p",{children:(0,b.sprintf)((0,b.__)("Saving your changes will change your active theme from %1$s to %2$s."),null!==(t=r?.name?.rendered)&&void 0!==t?t:"...",null!==(s=o?.name?.rendered)&&void 0!==s?s:"...")}),c=function(){const e=Is(),{startResolution:t,finishResolution:s}=(0,l.useDispatch)(_.store);return async()=>{if(Es()){const n="themes.php?action=activate&stylesheet="+Ps()+"&_wpnonce="+window.WP_BLOCK_THEME_ACTIVATE_NONCE;t("activateTheme"),await window.fetch(n),s("activateTheme");const{params:i}=e.getLocationWithParams();e.replace({...i,wp_theme_preview:void 0})}}}();return(0,me.jsx)(As,{...n,additionalPrompt:a,close:e,onSave:async e=>(await c(),e),saveEnabled:!0,saveLabel:i})},Fs=({onClose:e,renderDialog:t})=>Es()?(0,me.jsx)(Ns,{onClose:e}):(0,me.jsx)(h.EntitiesSavedStates,{close:e,renderDialog:t});function Vs(){const{isSaveViewOpen:e,canvasMode:t,isDirty:s,isSaving:n}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:s,isResolving:n}=e(_.store),i=t(),r=n("activateTheme"),{isSaveViewOpened:o,getCanvasMode:a}=se(e(Kt));return{isSaveViewOpen:o(),canvasMode:a(),isDirty:i.length>0,isSaving:i.some((e=>s(e.kind,e.name,e.key)))||r}}),[]),{setIsSaveViewOpened:i}=(0,l.useDispatch)(Kt),r=()=>i(!1);if("view"===t)return e?(0,me.jsx)(x.Modal,{className:"edit-site-save-panel__modal",onRequestClose:r,__experimentalHideHeader:!0,contentLabel:(0,b.__)("Save site, content, and template changes"),children:(0,me.jsx)(Fs,{onClose:r})}):null;const o=Es()||s,a=n||!o;return(0,me.jsxs)(Ms,{className:Qt("edit-site-layout__actions",{"is-entity-save-view-open":e}),ariaLabel:(0,b.__)("Save panel"),children:[(0,me.jsx)("div",{className:Qt("edit-site-editor__toggle-save-panel",{"screen-reader-text":e}),children:(0,me.jsx)(x.Button,{variant:"secondary",className:"edit-site-editor__toggle-save-panel-button",onClick:()=>i(!0),"aria-haspopup":"dialog",disabled:a,__experimentalIsFocusable:!0,children:(0,b.__)("Open save panel")})}),e&&(0,me.jsx)(Fs,{onClose:r,renderDialog:!0})]})}const Rs=function(){const{registerShortcut:e}=(0,l.useDispatch)($t.store);return(0,d.useEffect)((()=>{e({name:"core/edit-site/save",category:"global",description:(0,b.__)("Save your changes."),keyCombination:{modifier:"primary",character:"s"}})}),[e]),null};const Bs=function(){const{__experimentalGetDirtyEntityRecords:e,isSavingEntityRecord:t}=(0,l.useSelect)(_.store),{hasNonPostEntityChanges:s}=(0,l.useSelect)(h.store),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),{setIsSaveViewOpened:i}=(0,l.useDispatch)(Kt);return(0,$t.useShortcut)("core/edit-site/save",(r=>{r.preventDefault();const o=e(),a=!!o.length,l=o.some((e=>t(e.kind,e.name,e.key))),c=s(),u="view"===n();(a&&c&&!l||u)&&i(!0)})),null},Ds=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"})}),Ls=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})}),zs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"})}),Gs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"})}),Hs=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"})}),Us=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"})}),Ws=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})}),{useGlobalStylesReset:qs}=se(y.privateApis),{useHistory:Zs,useLocation:Ks}=se(Xt.privateApis);function Ys(){const{openGeneralSidebar:e,setCanvasMode:t}=se((0,l.useDispatch)(Kt)),{params:s}=Ks(),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),i=Zs(),r=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-styles",label:(0,b.__)("Open styles"),callback:({close:r})=>{r(),s.postId||i.push({path:"/wp_global_styles",canvas:"edit"}),s.postId&&"edit"!==n()&&t("edit"),e("edit-site/global-styles")},icon:Ds}]:[]),[i,e,t,n,r,s.postId])}}function Xs(){const{openGeneralSidebar:e,setCanvasMode:t}=se((0,l.useDispatch)(Kt)),{params:s}=Ks(),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),{set:i}=(0,l.useDispatch)(f.store),r=Zs(),o=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>o?[{name:"core/edit-site/toggle-styles-welcome-guide",label:(0,b.__)("Learn about styles"),callback:({close:o})=>{o(),s.postId||r.push({path:"/wp_global_styles",canvas:"edit"}),s.postId&&"edit"!==n()&&t("edit"),e("edit-site/global-styles"),i("core/edit-site","welcomeGuideStyles",!0),setTimeout((()=>{i("core/edit-site","welcomeGuideStyles",!0)}),500)},icon:Ls}]:[]),[r,e,t,n,o,i,s.postId])}}function Js(){const[e,t]=qs();return{isLoading:!1,commands:(0,d.useMemo)((()=>e?[{name:"core/edit-site/reset-global-styles",label:(0,b.__)("Reset styles"),icon:(0,b.isRTL)()?zs:Gs,callback:({close:e})=>{e(),t()}}]:[]),[e,t])}}function Qs(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:s}=se((0,l.useDispatch)(Kt)),{params:n}=Ks(),i=Zs(),{canEditCSS:r}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{getCanvasMode:o}=se((0,l.useSelect)(Kt));return{isLoading:!1,commands:(0,d.useMemo)((()=>r?[{name:"core/edit-site/open-styles-css",label:(0,b.__)("Customize CSS"),icon:Hs,callback:({close:r})=>{r(),n.postId||i.push({path:"/wp_global_styles",canvas:"edit"}),n.postId&&"edit"!==o()&&s("edit"),e("edit-site/global-styles"),t("global-styles-css")}}]:[]),[i,e,t,r,o,s,n.postId])}}function $s(){const{openGeneralSidebar:e,setEditorCanvasContainerView:t,setCanvasMode:s}=se((0,l.useDispatch)(Kt)),{getCanvasMode:n}=se((0,l.useSelect)(Kt)),{params:i}=Ks(),r=Zs(),o=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return!!i?._links?.["version-history"]?.[0]?.count}),[]);return{isLoading:!1,commands:(0,d.useMemo)((()=>o?[{name:"core/edit-site/open-global-styles-revisions",label:(0,b.__)("Style revisions"),icon:Us,callback:({close:o})=>{o(),i.postId||r.push({path:"/wp_global_styles",canvas:"edit"}),i.postId&&"edit"!==n()&&s("edit"),e("edit-site/global-styles"),t("global-styles-revisions")}}]:[]),[o,r,e,t,n,s,i.postId])}}const en=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"})}),tn=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,me.jsx)(us.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})]}),sn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});function nn(e,t){const{record:s,title:n,description:i,isLoaded:r,icon:o}=(0,l.useSelect)((s=>{const{getEditedPostType:n,getEditedPostId:i}=s(Kt),{getEditedEntityRecord:r,hasFinishedResolution:o}=s(_.store),{__experimentalGetTemplateInfo:a}=s(h.store),l=null!=e?e:n(),c=null!=t?t:i(),u=r("postType",l,c),d=c&&o("getEditedEntityRecord",["postType",l,c]),p=a(u);return{record:u,title:p.title,description:p.description,isLoaded:d,icon:p.icon}}),[e,t]);return{isLoaded:r,icon:o,record:s,getTitle:()=>n?(0,cs.decodeEntities)(n):null,getDescription:()=>i?(0,cs.decodeEntities)(i):null}}const{useHistory:rn}=se(Xt.privateApis);function on(e,t,s=!1){const n=rn();const i=(0,ps.getQueryArgs)(window.location.href),r=(0,ps.removeQueryArgs)(window.location.href,...Object.keys(i));Es()&&(e={...e,wp_theme_preview:Ps()});return{href:(0,ps.addQueryArgs)(r,e),onClick:function(i){i?.preventDefault(),s?n.replace(e,t):n.push(e,t)}}}function an({params:e={},state:t,replace:s=!1,children:n,...i}){const{href:r,onClick:o}=on(e,t,s);return(0,me.jsx)("a",{href:r,onClick:o,...i,children:n})}const{useHistory:ln}=se(Xt.privateApis);function cn(){const{record:e}=nn(),{isPage:t,canvasMode:s,templateId:n,currentPostType:i}=(0,l.useSelect)((e=>{const{isPage:t,getCanvasMode:s}=se(e(Kt)),{getCurrentPostType:n,getCurrentTemplateId:i}=e(h.store);return{isPage:t(),canvasMode:s(),templateId:i(),currentPostType:n()}}),[]),{onClick:r}=on({postType:"wp_template",postId:n}),{setRenderingMode:o}=(0,l.useDispatch)(h.store);if(!t||"edit"!==s)return{isLoading:!1,commands:[]};const a=[];return"wp_template"!==i?a.push({name:"core/switch-to-template-focus",label:(0,b.sprintf)((0,b.__)("Edit template: %s"),(0,cs.decodeEntities)(e.title)),icon:en,callback:({close:e})=>{r(),e()}}):a.push({name:"core/switch-to-page-focus",label:(0,b.__)("Back to page"),icon:tn,callback:({close:e})=>{o("template-locked"),e()}}),{isLoading:!1,commands:a}}function un(){const{isLoaded:e,record:t}=nn(),{removeTemplate:s,revertTemplate:n}=(0,l.useDispatch)(Kt),i=ln(),r=(0,l.useSelect)((e=>e(Kt).isPage()&&"wp_template"!==e(h.store).getCurrentPostType()),[]);if(!e)return{isLoading:!0,commands:[]};const o=[];if(function(e){return!!e&&e?.source===Fe.custom&&e?.has_theme_file}(t)&&!r){const e=t.type===Me?(0,b.sprintf)((0,b.__)("Reset template: %s"),(0,cs.decodeEntities)(t.title)):(0,b.sprintf)((0,b.__)("Reset template part: %s"),(0,cs.decodeEntities)(t.title));o.push({name:"core/reset-template",label:e,icon:(0,b.isRTL)()?zs:Gs,callback:({close:e})=>{n(t),e()}})}if(function(e){return!!e&&e.source===Fe.custom&&!e.has_theme_file}(t)&&!r){const e=t.type===Me?(0,b.sprintf)((0,b.__)("Delete template: %s"),(0,cs.decodeEntities)(t.title)):(0,b.sprintf)((0,b.__)("Delete template part: %s"),(0,cs.decodeEntities)(t.title));o.push({name:"core/remove-template",label:e,icon:sn,callback:({close:e})=>{s(t),i.push({postType:t.type}),e()}})}return{isLoading:!e,commands:o}}const dn=1e4;function hn(){const{isLoaded:e}=nn(),[t,s]=(0,d.useState)(!1),n=(0,l.useSelect)((e=>{const s=e(_.store).hasResolvingSelectors();return!t&&!s}),[t]);return(0,d.useEffect)((()=>{let e;return t||(e=setTimeout((()=>{s(!0)}),dn)),()=>{clearTimeout(e)}}),[t]),(0,d.useEffect)((()=>{if(n){const e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[n]),!t||!e}function pn({nonAnimatedSrc:e,animatedSrc:t}){return(0,me.jsxs)("picture",{className:"edit-site-welcome-guide__image",children:[(0,me.jsx)("source",{srcSet:e,media:"(prefers-reduced-motion: reduce)"}),(0,me.jsx)("img",{src:t,width:"312",height:"240",alt:""})]})}function fn(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isBlockBasedTheme:s}=(0,l.useSelect)((e=>({isActive:!!e(f.store).get("core/edit-site","welcomeGuide"),isBlockBasedTheme:e(_.store).getCurrentTheme()?.is_block_theme})),[]);return t&&s?(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-editor",contentLabel:(0,b.__)("Welcome to the site editor"),finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuide"),pages:[{image:(0,me.jsx)(pn,{nonAnimatedSrc:"https://s.w.org/images/block-editor/edit-your-site.svg?1",animatedSrc:"https://s.w.org/images/block-editor/edit-your-site.gif?1"}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Edit your site")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Design everything on your site — from the header right down to the footer — using blocks.")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,d.createInterpolateElement)((0,b.__)("Click to start designing your blocks, and choose your typography, layout, and colors."),{StylesIconImage:(0,me.jsx)("img",{alt:(0,b.__)("styles"),src:"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"})})})]})}]}):null}const{interfaceStore:mn}=se(h.privateApis);function gn(){const{toggle:e}=(0,l.useDispatch)(f.store),{isActive:t,isStylesOpen:s}=(0,l.useSelect)((e=>{const t=e(mn).getActiveComplementaryArea("core");return{isActive:!!e(f.store).get("core/edit-site","welcomeGuideStyles"),isStylesOpen:"edit-site/global-styles"===t}}),[]);if(!t||!s)return null;const n=(0,b.__)("Welcome to Styles");return(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-styles",contentLabel:n,finishButtonText:(0,b.__)("Get started"),onFinish:()=>e("core/edit-site","welcomeGuideStyles"),pages:[{image:(0,me.jsx)(pn,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.svg?1",animatedSrc:"https://s.w.org/images/block-editor/welcome-to-styles.gif?1"}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:n}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.")})]})},{image:(0,me.jsx)(pn,{nonAnimatedSrc:"https://s.w.org/images/block-editor/set-the-design.svg?1",animatedSrc:"https://s.w.org/images/block-editor/set-the-design.gif?1"}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Set the design")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!")})]})},{image:(0,me.jsx)(pn,{nonAnimatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.svg?1",animatedSrc:"https://s.w.org/images/block-editor/personalize-blocks.gif?1"}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Personalize blocks")}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.")})]})},{image:(0,me.jsx)(pn,{nonAnimatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.svg",animatedSrc:"https://s.w.org/images/block-editor/welcome-documentation.gif"}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:(0,b.__)("Learn more")}),(0,me.jsxs)("p",{className:"edit-site-welcome-guide__text",children:[(0,b.__)("New to block themes and styling your site?")," ",(0,me.jsx)(x.ExternalLink,{href:(0,b.__)("https://wordpress.org/documentation/article/styles-overview/"),children:(0,b.__)("Here’s a detailed guide to learn how to make the most of it.")})]})]})}]})}function vn(){const{toggle:e}=(0,l.useDispatch)(f.store),t=(0,l.useSelect)((e=>{const t=!!e(f.store).get("core/edit-site","welcomeGuidePage"),s=!!e(f.store).get("core/edit-site","welcomeGuide"),{isPage:n}=e(Kt);return t&&!s&&n()}),[]);if(!t)return null;const s=(0,b.__)("Editing a page");return(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-page",contentLabel:s,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuidePage"),pages:[{image:(0,me.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,me.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-page.mp4",type:"video/mp4"})}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("It’s now possible to edit page content in the site editor. To customise other parts of the page like the header and footer switch to editing the template using the settings sidebar.")})]})}]})}function yn(){const{toggle:e}=(0,l.useDispatch)(f.store),t=(0,l.useSelect)((e=>{const t=!!e(f.store).get("core/edit-site","welcomeGuideTemplate"),s=!!e(f.store).get("core/edit-site","welcomeGuide"),{isPage:n}=e(Kt),{getCurrentPostType:i}=e(h.store);return t&&!s&&n()&&"wp_template"===i()}),[]);if(!t)return null;const s=(0,b.__)("Editing a template");return(0,me.jsx)(x.Guide,{className:"edit-site-welcome-guide guide-template",contentLabel:s,finishButtonText:(0,b.__)("Continue"),onFinish:()=>e("core/edit-site","welcomeGuideTemplate"),pages:[{image:(0,me.jsx)("video",{className:"edit-site-welcome-guide__video",autoPlay:!0,loop:!0,muted:!0,width:"312",height:"240",children:(0,me.jsx)("source",{src:"https://s.w.org/images/block-editor/editing-your-template.mp4",type:"video/mp4"})}),content:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("h1",{className:"edit-site-welcome-guide__heading",children:s}),(0,me.jsx)("p",{className:"edit-site-welcome-guide__text",children:(0,b.__)("Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.")})]})}]})}function xn(){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(fn,{}),(0,me.jsx)(gn,{}),(0,me.jsx)(vn,{}),(0,me.jsx)(yn,{})]})}const{useGlobalStylesOutput:bn}=se(y.privateApis);function wn(){return function(){const e=(0,l.useSelect)((e=>e(Kt).getEditedPostType())),[t,s]=bn(e!==Me),{getSettings:n}=(0,l.useSelect)(Kt),{updateSettings:i}=(0,l.useDispatch)(Kt);(0,d.useEffect)((()=>{var e;if(!t||!s)return;const r=n(),o=Object.values(null!==(e=r.styles)&&void 0!==e?e:[]).filter((e=>!e.isGlobalStyles));i({...r,styles:[...o,...t],__experimentalFeatures:s})}),[t,s,i,n])}(),null}const{Theme:_n}=se(x.privateApis),{useGlobalStyle:Sn}=se(y.privateApis);function jn({id:e}){var t;const[s]=Sn("color.text"),[n]=Sn("color.background"),{highlightedColors:i}=de(),r=null!==(t=i[0]?.color)&&void 0!==t?t:s,{elapsed:o,total:a}=(0,l.useSelect)((e=>{var t,s;const n=e(_.store).countSelectorsByStatus(),i=null!==(t=n.resolving)&&void 0!==t?t:0,r=null!==(s=n.finished)&&void 0!==s?s:0;return{elapsed:r,total:r+i}}),[]);return(0,me.jsx)("div",{className:"edit-site-canvas-loader",children:(0,me.jsx)(_n,{accent:r,background:n,children:(0,me.jsx)(x.ProgressBar,{id:e,max:a,value:o})})})}function Cn({clientId:e,onClose:t}){const{getBlocks:s}=(0,l.useSelect)(y.store),{replaceBlocks:n}=(0,l.useDispatch)(y.store);return(0,l.useSelect)((t=>t(y.store).canRemoveBlock(e)),[e])?(0,me.jsx)(x.MenuItem,{onClick:()=>{n(e,s(e)),t()},children:(0,b.__)("Detach")}):null}const kn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),{CreateTemplatePartModal:En}=se(h.privateApis);function Pn({clientIds:e,blocks:t}){const[s,n]=(0,d.useState)(!1),{replaceBlocks:i}=(0,l.useDispatch)(y.store),{createSuccessNotice:r}=(0,l.useDispatch)(w.store),{canCreate:a}=(0,l.useSelect)((e=>{const{supportsTemplatePartsMode:t}=e(Kt).getSettings();return{canCreate:!t}}),[]);if(!a)return null;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.MenuItem,{icon:kn,onClick:()=>{n(!0)},"aria-expanded":s,"aria-haspopup":"dialog",children:(0,b.__)("Create template part")}),s&&(0,me.jsx)(En,{closeModal:()=>{n(!1)},blocks:t,onCreate:async t=>{i(e,(0,o.createBlock)("core/template-part",{slug:t.slug,theme:t.theme})),r((0,b.__)("Template part created."),{type:"snackbar"})}})]})}function In(){return(0,me.jsx)(y.BlockSettingsMenuControls,{children:({selectedClientIds:e,onClose:t})=>(0,me.jsx)(Tn,{clientIds:e,onClose:t})})}function Tn({clientIds:e,onClose:t}){const{isContentOnly:s,blocks:n}=(0,l.useSelect)((t=>{const{getBlocksByClientId:s,getBlockEditingMode:n}=t(y.store);return{blocks:s(e),isContentOnly:1===e.length&&"contentOnly"===n(e[0])}}),[e]);return s?null:1===n.length&&"core/template-part"===n[0]?.name?(0,me.jsx)(Cn,{clientId:e[0],onClose:t}):(0,me.jsx)(Pn,{clientIds:e,blocks:n})}const{useHistory:On}=se(Xt.privateApis);const{useBlockEditorSettings:An}=se(h.privateApis),{useLocation:Mn,useHistory:Nn}=se(Xt.privateApis);function Fn(){const e=function(){const e=On();return(0,d.useCallback)((t=>{e.push({...t,focusMode:!0,canvas:"edit"})}),[e])}(),{templateSlug:t,canvasMode:s,settings:n,postWithTemplate:i}=(0,l.useSelect)((e=>{const{getEditedPostType:t,getEditedPostId:s,getEditedPostContext:n,getCanvasMode:i,getSettings:r}=se(e(Kt)),{getEditedEntityRecord:o}=e(_.store),a=o("postType",t(),s()),l=n();return{templateSlug:a.slug,canvasMode:i(),settings:r(),postWithTemplate:l?.postId}}),[]),r=function(e){const t=e?.match(/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/);let s,n,i,r=!1;if(t)t[1]?s=t[2]?t[2]:t[1]:t[3]&&(s=t[6]?t[6]:t[4],n=t[7]),s="tag"===s?"post_tag":s;else{const t=e?.match(/^(author)$|^author-(.+)$/);t&&(r=!0,t[2]&&(i=t[2]))}return(0,l.useSelect)((e=>{const{getEntityRecords:t,getTaxonomy:o,getAuthors:a}=e(_.store);let l,c;if(s&&(l=o(s)?.labels?.singular_name),n){const e=t("taxonomy",s,{slug:n,per_page:1});e&&e[0]&&(c=e[0].name)}if(r&&(l="Author",i)){const e=a({slug:i});e&&e[0]&&(c=e[0].name)}return{archiveTypeLabel:l,archiveNameLabel:c}}),[i,r,s,n])}(t),o=i?"template-locked":"post-only",a=function(){const e=Mn(),t=(0,v.usePrevious)(e),s=Nn();return(0,d.useMemo)((()=>{const n=e.params.focusMode||e.params.postId&&He.includes(e.params.postType),i="edit"===t?.params.canvas;return n&&i?()=>s.back():void 0}),[e,s])}();return(0,d.useMemo)((()=>({...n,richEditingEnabled:!0,supportsTemplateMode:!0,focusMode:"view"!==s,defaultRenderingMode:o,onNavigateToEntityRecord:e,onNavigateToPreviousEntityRecord:a,__experimentalArchiveTitleTypeLabel:r.archiveTypeLabel,__experimentalArchiveTitleNameLabel:r.archiveNameLabel,__unstableIsPreviewMode:"view"===s})),[n,s,o,e,a,r.archiveTypeLabel,r.archiveNameLabel])}const{Fill:Vn,Slot:Rn}=(0,x.createSlotFill)("PluginTemplateSettingPanel"),Bn=({children:e})=>{u()("wp.editSite.PluginTemplateSettingPanel",{since:"6.6",version:"6.8",alternative:"wp.editor.PluginDocumentSettingPanel"});return(0,l.useSelect)((e=>"wp_template"===e(h.store).getCurrentPostType()),[])?(0,me.jsx)(Vn,{children:e}):null};Bn.Slot=Rn;const Dn=Bn,Ln=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),zn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"})}),Gn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"})}),Hn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})});function Un({className:e,...t}){return(0,me.jsx)(x.Icon,{className:Qt(e,"edit-site-global-styles-icon-with-current-color"),...t})}function Wn({icon:e,children:t,...s}){return(0,me.jsxs)(x.__experimentalItem,{...s,children:[e&&(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[(0,me.jsx)(Un,{icon:e,size:24}),(0,me.jsx)(x.FlexItem,{children:t})]}),!e&&t]})}function qn(e){return(0,me.jsx)(x.__experimentalNavigatorButton,{as:Wn,...e})}const Zn=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"})}),Kn=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"})}),Yn=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M12 8c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zm0 6.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5zM12.8 3h-1.5v3h1.5V3zm-1.6 18h1.5v-3h-1.5v3zm6.8-9.8v1.5h3v-1.5h-3zm-12 0H3v1.5h3v-1.5zm9.7 5.6 2.1 2.1 1.1-1.1-2.1-2.1-1.1 1.1zM8.3 7.2 6.2 5.1 5.1 6.2l2.1 2.1 1.1-1.1zM5.1 17.8l1.1 1.1 2.1-2.1-1.1-1.1-2.1 2.1zM18.9 6.2l-1.1-1.1-2.1 2.1 1.1 1.1 2.1-2.1z"})}),{useHasDimensionsPanel:Xn,useHasTypographyPanel:Jn,useHasColorPanel:Qn,useGlobalSetting:$n,useSettingsForBlockElement:ei}=se(y.privateApis);const ti=function(){const[e]=$n(""),t=ei(e),s=Jn(t),n=Qn(t),i=Xn(t);return(0,me.jsx)(me.Fragment,{children:(0,me.jsxs)(x.__experimentalItemGroup,{children:[s&&(0,me.jsx)(qn,{icon:Zn,path:"/typography","aria-label":(0,b.__)("Typography styles"),children:(0,b.__)("Typography")}),n&&(0,me.jsx)(qn,{icon:Kn,path:"/colors","aria-label":(0,b.__)("Colors styles"),children:(0,b.__)("Colors")}),(0,me.jsx)(qn,{icon:Yn,path:"/shadows","aria-label":(0,b.__)("Shadow styles"),children:(0,b.__)("Shadows")}),i&&(0,me.jsx)(qn,{icon:en,path:"/layout","aria-label":(0,b.__)("Layout styles"),children:(0,b.__)("Layout")})]})})};function si(e){const t=/^(?!generic\([ a-zA-Z\-]+\)$)(?!^[a-zA-Z\-]+$).+/,s=e.trim(),n=e=>(e=e.trim()).match(t)?`"${e=e.replace(/^["']|["']$/g,"")}"`:e;return s.includes(",")?s.split(",").map(n).filter((e=>""!==e)).join(", "):n(s)}function ni(e){if(!e)return"";let t=e.trim();return t.includes(",")&&(t=t.split(",").find((e=>""!==e.trim())).trim()),t=t.replace(/^["']|["']$/g,""),window.navigator.userAgent.toLowerCase().includes("firefox")&&(t=`"${t}"`),t}function ii(e){const t={fontFamily:si(e.fontFamily)};if(!Array.isArray(e.fontFace))return t.fontWeight="400",t.fontStyle="normal",t;if(e.fontFace){const i=e.fontFace.filter((e=>e?.fontStyle&&"normal"===e.fontStyle.toLowerCase()));if(i.length>0){t.fontStyle="normal";const e=function(e){const t=[];return e.forEach((e=>{const s=String(e.fontWeight).split(" ");if(2===s.length){const e=parseInt(s[0]),n=parseInt(s[1]);for(let s=e;s<=n;s+=100)t.push(s)}else 1===s.length&&t.push(parseInt(s[0]))})),t}(i),r=(s=400,0===(n=e).length?null:(n.sort(((e,t)=>Math.abs(s-e)-Math.abs(s-t))),n[0]));t.fontWeight=String(r)||"400"}else t.fontStyle=e.fontFace.length&&e.fontFace[0].fontStyle||"normal",t.fontWeight=e.fontFace.length&&String(e.fontFace[0].fontWeight)||"400"}var s,n;return t}function ri(e){return e?`is-style-${e}`:""}function oi(e,t){if(!Array.isArray(e)||!t)return null;const s=t.replace("var(","").replace(")",""),n=s?.split("--").slice(-1)[0];return e.find((e=>e.slug===n))}const{GlobalStylesContext:ai}=se(y.privateApis),{mergeBaseAndUserConfigs:li}=se(h.privateApis);function ci({fontSize:e,variation:t}){const{base:s}=(0,d.useContext)(ai);let n=s;t&&(n=li(s,t));const[i,r]=function(e){const t=e?.settings?.typography?.fontFamilies?.theme,s=e?.styles?.typography?.fontFamily,n=oi(t,s),i=e?.styles?.elements?.heading?.typography?.fontFamily;let r;return r=i?oi(t,e?.styles?.elements?.heading?.typography?.fontFamily):n,[n,r]}(n),o=i?ii(i):{},a=r?ii(r):{};return e&&(o.fontSize=e,a.fontSize=e),(0,me.jsxs)(x.__unstableMotion.div,{animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:.3,type:"tween"},style:{textAlign:"center"},children:[(0,me.jsx)("span",{style:a,children:(0,b._x)("A","Uppercase letter A")}),(0,me.jsx)("span",{style:o,children:(0,b._x)("a","Lowercase letter A")})]})}function ui({normalizedColorSwatchSize:e,ratio:t}){const{highlightedColors:s}=de(),n=e*t;return s.map((({slug:e,color:t},s)=>(0,me.jsx)(x.__unstableMotion.div,{style:{height:n,width:n,background:t,borderRadius:n/2},animate:{scale:1,opacity:1},initial:{scale:.1,opacity:0},transition:{delay:1===s?.2:.1}},`${e}-${s}`)))}const{useGlobalStyle:di,useGlobalStylesOutput:hi}=se(y.privateApis),pi=248,fi=152,mi={leading:!0,trailing:!0};function gi({children:e,label:t,isFocused:s,withHoverView:n}){const[i="white"]=di("color.background"),[r]=di("color.gradient"),[o]=hi(),a=(0,v.useReducedMotion)(),[l,c]=(0,d.useState)(!1),[u,{width:h}]=(0,v.useResizeObserver)(),[p,f]=(0,d.useState)(h),[m,g]=(0,d.useState)(),b=(0,v.useThrottle)(f,250,mi);(0,d.useLayoutEffect)((()=>{h&&b(h)}),[h,b]),(0,d.useLayoutEffect)((()=>{const e=p?p/pi:1,t=e-(m||0);!(Math.abs(t)>.1)&&m||g(e)}),[p,m]);const w=m||(h?h/pi:1),_=(0,d.useMemo)((()=>o?[...o,{css:"html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}",isGlobalStyles:!0}]:o),[o]),S=!!h;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("div",{style:{position:"relative"},children:u}),S&&(0,me.jsxs)(y.__unstableIframe,{className:"edit-site-global-styles-preview__iframe",style:{height:fi*w},onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),tabIndex:-1,children:[(0,me.jsx)(y.__unstableEditorStyles,{styles:_}),(0,me.jsx)(x.__unstableMotion.div,{style:{height:fi*w,width:"100%",background:null!=r?r:i,cursor:n?"pointer":void 0},initial:"start",animate:(l||s)&&!a&&t?"hover":"start",children:[].concat(e).map(((e,t)=>e({ratio:w,key:t})))})]})]})}const{useGlobalStyle:vi}=se(y.privateApis),yi={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},xi={hover:{opacity:1},start:{opacity:.5}},bi={hover:{scale:1,opacity:1},start:{scale:0,opacity:0}},wi=({label:e,isFocused:t,withHoverView:s,variation:n})=>{const[i]=vi("typography.fontWeight"),[r="serif"]=vi("typography.fontFamily"),[o=r]=vi("elements.h1.typography.fontFamily"),[a=i]=vi("elements.h1.typography.fontWeight"),[l="black"]=vi("color.text"),[c=l]=vi("elements.h1.color.text"),{paletteColors:u}=de();return(0,me.jsxs)(gi,{label:e,isFocused:t,withHoverView:s,children:[({ratio:e,key:t})=>(0,me.jsx)(x.__unstableMotion.div,{variants:yi,style:{height:"100%",overflow:"hidden"},children:(0,me.jsxs)(x.__experimentalHStack,{spacing:10*e,justify:"center",style:{height:"100%",overflow:"hidden"},children:[(0,me.jsx)(ci,{fontSize:65*e,variation:n}),(0,me.jsx)(x.__experimentalVStack,{spacing:4*e,children:(0,me.jsx)(ui,{normalizedColorSwatchSize:32,ratio:e})})]})},t),({key:e})=>(0,me.jsx)(x.__unstableMotion.div,{variants:s&&xi,style:{height:"100%",width:"100%",position:"absolute",top:0,overflow:"hidden",filter:"blur(60px)",opacity:.1},children:(0,me.jsx)(x.__experimentalHStack,{spacing:0,justify:"flex-start",style:{height:"100%",overflow:"hidden"},children:u.slice(0,4).map((({color:e},t)=>(0,me.jsx)("div",{style:{height:"100%",background:e,flexGrow:1}},t)))})},e),({ratio:t,key:s})=>(0,me.jsx)(x.__unstableMotion.div,{variants:bi,style:{height:"100%",width:"100%",overflow:"hidden",position:"absolute",top:0},children:(0,me.jsx)(x.__experimentalVStack,{spacing:3*t,justify:"center",style:{height:"100%",overflow:"hidden",padding:10*t,boxSizing:"border-box"},children:e&&(0,me.jsx)("div",{style:{fontSize:40*t,fontFamily:o,color:c,fontWeight:a,lineHeight:"1em",textAlign:"center"},children:e})})},s)]})},{useGlobalStyle:_i}=se(y.privateApis);const Si=function(){const[e]=_i("css"),{hasVariations:t,canEditCSS:s}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s,__experimentalGetCurrentThemeGlobalStylesVariations:n}=e(_.store),i=s(),r=i?t("root","globalStyles",i):void 0;return{hasVariations:!!n()?.length,canEditCSS:!!r?._links?.["wp:action-edit-css"]}}),[]);return(0,me.jsxs)(x.Card,{size:"small",className:"edit-site-global-styles-screen-root",children:[(0,me.jsx)(x.CardBody,{children:(0,me.jsxs)(x.__experimentalVStack,{spacing:4,children:[(0,me.jsx)(x.Card,{children:(0,me.jsx)(x.CardMedia,{children:(0,me.jsx)(wi,{})})}),t&&(0,me.jsx)(x.__experimentalItemGroup,{children:(0,me.jsx)(qn,{path:"/variations","aria-label":(0,b.__)("Browse styles"),children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Browse styles")}),(0,me.jsx)(Un,{icon:(0,b.isRTL)()?Gn:Hn})]})})}),(0,me.jsx)(ti,{})]})}),(0,me.jsx)(x.CardDivider,{}),(0,me.jsxs)(x.CardBody,{children:[(0,me.jsx)(x.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Customize the appearance of specific blocks for the whole site.")}),(0,me.jsx)(x.__experimentalItemGroup,{children:(0,me.jsx)(qn,{path:"/blocks","aria-label":(0,b.__)("Blocks styles"),children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Blocks")}),(0,me.jsx)(Un,{icon:(0,b.isRTL)()?Gn:Hn})]})})})]}),s&&!!e&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.CardDivider,{}),(0,me.jsxs)(x.CardBody,{children:[(0,me.jsx)(x.__experimentalSpacer,{as:"p",paddingTop:2,paddingX:"13px",marginBottom:4,children:(0,b.__)("Add your own CSS to customize the appearance and layout of your site.")}),(0,me.jsx)(x.__experimentalItemGroup,{children:(0,me.jsx)(qn,{path:"/css","aria-label":(0,b.__)("Additional CSS"),children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Additional CSS")}),(0,me.jsx)(Un,{icon:(0,b.isRTL)()?Gn:Hn})]})})})]})]})]})},ji=window.wp.a11y,{useGlobalStyle:Ci}=se(y.privateApis);function ki(e){const t=(0,l.useSelect)((t=>{const{getBlockStyles:s}=t(o.store);return s(e)}),[e]),[s]=Ci("variations",e);return function(e,t){return e?.filter((e=>"block"===e.source||t.includes(e.name)))}(t,Object.keys(null!=s?s:{}))}function Ei({name:e}){const t=ki(e);return(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map(((t,s)=>t?.isDefault?null:(0,me.jsx)(qn,{path:"/blocks/"+encodeURIComponent(e)+"/variations/"+encodeURIComponent(t.name),"aria-label":t.label,children:t.label},s)))})}const Pi=function({title:e,description:t,onBack:s}){return(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)(x.__experimentalView,{children:(0,me.jsx)(x.__experimentalSpacer,{marginBottom:0,paddingX:4,paddingY:3,children:(0,me.jsxs)(x.__experimentalHStack,{spacing:2,children:[(0,me.jsx)(x.__experimentalNavigatorToParentButton,{style:{minWidth:24,padding:0},icon:(0,b.isRTL)()?Hn:Gn,size:"small",label:(0,b.__)("Back"),onClick:s}),(0,me.jsx)(x.__experimentalSpacer,{children:(0,me.jsx)(x.__experimentalHeading,{className:"edit-site-global-styles-header",level:2,size:13,children:e})})]})})}),t&&(0,me.jsx)("p",{className:"edit-site-global-styles-header__description",children:t})]})},{useHasDimensionsPanel:Ii,useHasTypographyPanel:Ti,useHasBorderPanel:Oi,useGlobalSetting:Ai,useSettingsForBlockElement:Mi,useHasColorPanel:Ni}=se(y.privateApis);function Fi(e){const[t]=Ai("",e),s=Mi(t,e),n=Ti(s),i=Ni(s),r=Oi(s),o=Ii(s),a=r||o,l=!!ki(e)?.length;return n||i||a||l}function Vi({block:e}){if(!Fi(e.name))return null;const t=(0,b.sprintf)((0,b.__)("%s block styles"),e.title);return(0,me.jsx)(qn,{path:"/blocks/"+encodeURIComponent(e.name),"aria-label":t,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[(0,me.jsx)(y.BlockIcon,{icon:e.icon}),(0,me.jsx)(x.FlexItem,{children:e.title})]})})}const Ri=(0,d.memo)((function({filterValue:e}){const t=function(){const e=(0,l.useSelect)((e=>e(o.store).getBlockTypes()),[]),{core:t,noncore:s}=e.reduce(((e,t)=>{const{core:s,noncore:n}=e;return(t.name.startsWith("core/")?s:n).push(t),e}),{core:[],noncore:[]});return[...t,...s]}(),s=(0,v.useDebounce)(ji.speak,500),{isMatchingSearchTerm:n}=(0,l.useSelect)(o.store),i=e?t.filter((t=>n(t,e))):t,r=(0,d.useRef)();return(0,d.useEffect)((()=>{if(!e)return;const t=r.current.childElementCount,n=(0,b.sprintf)((0,b._n)("%d result found.","%d results found.",t),t);s(n,t)}),[e,s]),(0,me.jsx)("div",{ref:r,className:"edit-site-block-types-item-list",children:i.map((e=>(0,me.jsx)(Vi,{block:e},"menu-itemblock-"+e.name)))})}));const Bi=function(){const[e,t]=(0,d.useState)(""),s=(0,d.useDeferredValue)(e);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Blocks"),description:(0,b.__)("Customize the appearance of specific blocks and for the whole site.")}),(0,me.jsx)(x.SearchControl,{__nextHasNoMarginBottom:!0,className:"edit-site-block-types-search",onChange:t,value:e,label:(0,b.__)("Search for blocks"),placeholder:(0,b.__)("Search")}),(0,me.jsx)(Ri,{filterValue:s})]})},Di=({name:e,variation:t=""})=>{var s;const n=(0,o.getBlockType)(e)?.example,i=(0,d.useMemo)((()=>{if(!n)return null;let s=n;return t&&(s={...s,attributes:{...s.attributes,className:ri(t)}}),(0,o.getBlockFromExample)(e,s)}),[e,n,t]),r=null!==(s=n?.viewportWidth)&&void 0!==s?s:null;return n?(0,me.jsx)(x.__experimentalSpacer,{marginX:4,marginBottom:4,children:(0,me.jsx)("div",{className:"edit-site-global-styles__block-preview-panel",style:{maxHeight:150,boxSizing:"initial"},children:(0,me.jsx)(y.BlockPreview,{blocks:i,viewportWidth:r,minHeight:150,additionalStyles:[{css:"\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:150px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;align-items:center;justify-content:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t"}]})})}):null};const Li=function({children:e,level:t}){return(0,me.jsx)(x.__experimentalHeading,{className:"edit-site-global-styles-subtitle",level:null!=t?t:2,children:e})};function zi(e){if(!e)return e;const t=e.color||e.width;return!e.style&&t?{...e,style:"solid"}:!e.style||t?e:void 0}const{useHasDimensionsPanel:Gi,useHasTypographyPanel:Hi,useHasBorderPanel:Ui,useGlobalSetting:Wi,useSettingsForBlockElement:qi,useHasColorPanel:Zi,useHasFiltersPanel:Ki,useHasImageSettingsPanel:Yi,useGlobalStyle:Xi,BorderPanel:Ji,ColorPanel:Qi,TypographyPanel:$i,DimensionsPanel:er,FiltersPanel:tr,ImageSettingsPanel:sr,AdvancedPanel:nr}=se(y.privateApis);const ir=function({name:e,variation:t}){let s=[];t&&(s=["variations",t].concat(s));const n=s.join("."),[i]=Xi(n,e,"user",{shouldDecodeEncode:!1}),[r,a]=Xi(n,e,"all",{shouldDecodeEncode:!1}),[c]=Wi("",e,"user"),[u,h]=Wi("",e),p=qi(u,e),f=(0,o.getBlockType)(e);p?.spacing?.blockGap&&f?.supports?.spacing?.blockGap&&(!0===f?.supports?.spacing?.__experimentalSkipSerialization||f?.supports?.spacing?.__experimentalSkipSerialization?.some?.((e=>"blockGap"===e)))&&(p.spacing.blockGap=!1),p?.dimensions?.aspectRatio&&"core/group"===e&&(p.dimensions.aspectRatio=!1);const m=ki(e),g=Hi(p),v=Zi(p),y=Ui(p),w=Gi(p),S=Ki(p),j=Yi(e,c,p),C=!!m?.length&&!t,{canEditCSS:k}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),E=t?m.find((e=>e.name===t)):null,P=(0,d.useMemo)((()=>({...r,layout:p.layout})),[r,p.layout]),I=(0,d.useMemo)((()=>({...i,layout:c.layout})),[i,c.layout]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:t?E?.label:f.title}),(0,me.jsx)(Di,{name:e,variation:t}),C&&(0,me.jsx)("div",{className:"edit-site-global-styles-screen-variations",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(Li,{children:(0,b.__)("Style Variations")}),(0,me.jsx)(Ei,{name:e})]})}),v&&(0,me.jsx)(Qi,{inheritedValue:r,value:i,onChange:a,settings:p}),g&&(0,me.jsx)($i,{inheritedValue:r,value:i,onChange:a,settings:p}),w&&(0,me.jsx)(er,{inheritedValue:P,value:I,onChange:e=>{const t={...e};delete t.layout,a(t),e.layout!==c.layout&&h({...c,layout:e.layout})},settings:p,includeLayoutControls:!0}),y&&(0,me.jsx)(Ji,{inheritedValue:r,value:i,onChange:e=>{if(!e?.border)return void a(e);const{radius:t,...s}=e.border,n=function(e){return e?(0,x.__experimentalHasSplitBorders)(e)?{top:zi(e.top),right:zi(e.right),bottom:zi(e.bottom),left:zi(e.left)}:zi(e):e}(s),i=(0,x.__experimentalHasSplitBorders)(n)?{color:null,style:null,width:null,...n}:{top:n,right:n,bottom:n,left:n};a({...e,border:{...i,radius:t}})},settings:p}),S&&(0,me.jsx)(tr,{inheritedValue:P,value:I,onChange:a,settings:p,includeLayoutControls:!0}),j&&(0,me.jsx)(sr,{onChange:e=>{h(void 0===e?{...u,lightbox:void 0}:{...u,lightbox:{...u.lightbox,...e}})},value:c,inheritedValue:p}),k&&(0,me.jsxs)(x.PanelBody,{title:(0,b.__)("Advanced"),initialOpen:!1,children:[(0,me.jsx)("p",{children:(0,b.sprintf)((0,b.__)("Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value."),f?.title)}),(0,me.jsx)(nr,{value:i,onChange:a,inheritedValue:r})]})]})},{useGlobalStyle:rr}=se(y.privateApis);function or({parentMenu:e,element:t,label:s}){var n;const i="text"!==t&&t?`elements.${t}.`:"",r="link"===t?{textDecoration:"underline"}:{},[o]=rr(i+"typography.fontFamily"),[a]=rr(i+"typography.fontStyle"),[l]=rr(i+"typography.fontWeight"),[c]=rr(i+"typography.letterSpacing"),[u]=rr(i+"color.background"),[d]=rr("color.background"),[h]=rr(i+"color.gradient"),[p]=rr(i+"color.text"),f=(0,b.sprintf)((0,b.__)("Typography %s styles"),s);return(0,me.jsx)(qn,{path:e+"/typography/"+t,"aria-label":f,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles-screen-typography__indicator",style:{fontFamily:null!=o?o:"serif",background:null!==(n=null!=h?h:u)&&void 0!==n?n:d,color:p,fontStyle:a,fontWeight:l,letterSpacing:c,...r},children:(0,b.__)("Aa")}),(0,me.jsx)(x.FlexItem,{children:s})]})})}const ar=function(){return(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(Li,{level:3,children:(0,b.__)("Elements")}),(0,me.jsxs)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[(0,me.jsx)(or,{parentMenu:"",element:"text",label:(0,b.__)("Text")}),(0,me.jsx)(or,{parentMenu:"",element:"link",label:(0,b.__)("Links")}),(0,me.jsx)(or,{parentMenu:"",element:"heading",label:(0,b.__)("Headings")}),(0,me.jsx)(or,{parentMenu:"",element:"caption",label:(0,b.__)("Captions")}),(0,me.jsx)(or,{parentMenu:"",element:"button",label:(0,b.__)("Buttons")})]})]})},{mergeBaseAndUserConfigs:lr}=se(h.privateApis),{GlobalStylesContext:cr,areGlobalStyleConfigsEqual:ur}=se(y.privateApis);function dr({variation:e,children:t,isPill:s,property:n}){const[i,r]=(0,d.useState)(!1),{base:o,user:a,setUserConfig:l}=(0,d.useContext)(cr),c=(0,d.useMemo)((()=>{let t=lr(o,e);return n&&(t=ae(t,n)),{user:e,base:o,merged:t,setUserConfig:()=>{}}}),[e,o,n]),u=()=>l(e),h=(0,d.useMemo)((()=>ur(a,e)),[a,e]);let p=e?.title;return e?.description&&(p=(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),e?.title,e?.description)),(0,me.jsx)(cr.Provider,{value:c,children:(0,me.jsx)("div",{className:Qt("edit-site-global-styles-variations_item",{"is-active":h}),role:"button",onClick:u,onKeyDown:e=>{e.keyCode===hs.ENTER&&(e.preventDefault(),u())},tabIndex:"0","aria-label":p,"aria-current":h,onFocus:()=>r(!0),onBlur:()=>r(!1),children:(0,me.jsx)("div",{className:Qt("edit-site-global-styles-variations_item-preview",{"is-pill":s}),children:t(i)})})})}function hr({title:e,gap:t=2}){const s=pe();return s?.length<=1?null:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[e&&(0,me.jsx)(Li,{level:3,children:e}),(0,me.jsx)(x.__experimentalGrid,{columns:3,gap:t,className:"edit-site-global-styles-style-variations-container",children:s&&s.length&&s.map(((e,t)=>(0,me.jsx)(dr,{variation:e,property:"typography",children:t=>(0,me.jsx)(gi,{label:e?.title,isFocused:t,children:({ratio:t,key:s})=>(0,me.jsx)(x.__experimentalVStack,{spacing:10*t,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,me.jsx)(ci,{variation:e,fontSize:85*t})},s)})},t)))})]})}const pr=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z"}),(0,me.jsx)(us.Path,{d:"m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z"})]}),fr="/wp/v2/font-families",mr="/wp/v2/font-collections";async function gr(e){const t={path:fr,method:"POST",body:e},s=await Os()(t);return{id:s.id,...s.font_family_settings,fontFace:[]}}async function vr(e,t){const s={path:`${fr}/${e}/font-faces`,method:"POST",body:t},n=await Os()(s);return{id:n.id,...n.font_face_settings}}async function yr(e){const t={path:`${fr}?slug=${e}&_embed=true`,method:"GET"},s=await Os()(t);if(!s||0===s.length)return null;const n=s[0];return{id:n.id,...n.font_family_settings,fontFace:n?._embedded?.font_faces.map((e=>e.font_face_settings))||[]}}async function xr(e){const t={path:`${fr}/${e}?force=true`,method:"DELETE"};return await Os()(t)}const br=["otf","ttf","woff","woff2"],wr={100:(0,b._x)("Thin","font weight"),200:(0,b._x)("Extra-light","font weight"),300:(0,b._x)("Light","font weight"),400:(0,b._x)("Normal","font weight"),500:(0,b._x)("Medium","font weight"),600:(0,b._x)("Semi-bold","font weight"),700:(0,b._x)("Bold","font weight"),800:(0,b._x)("Extra-bold","font weight"),900:(0,b._x)("Black","font weight")},_r={normal:(0,b._x)("Normal","font style"),italic:(0,b._x)("Italic","font style")},{File:Sr}=window,{kebabCase:jr}=se(x.privateApis);function Cr(e,t={}){return e.name||!e.fontFamily&&!e.slug||(e.name=e.fontFamily||e.slug),{...e,...t}}function kr(e){return`${wr[e.fontWeight]||e.fontWeight} ${"normal"===e.fontStyle?"":_r[e.fontStyle]||e.fontStyle}`}function Er(e=[],t=[]){const s=new Map;for(const t of e)s.set(`${t.fontWeight}${t.fontStyle}`,t);for(const e of t)s.set(`${e.fontWeight}${e.fontStyle}`,e);return Array.from(s.values())}function Pr(e=[],t=[]){const s=new Map;for(const t of e)s.set(t.slug,{...t});for(const e of t)if(s.has(e.slug)){const{fontFace:t,...n}=e,i=Er(s.get(e.slug).fontFace,t);s.set(e.slug,{...n,fontFace:i})}else s.set(e.slug,{...e});return Array.from(s.values())}async function Ir(e,t,s="all"){let n;if("string"==typeof t)n=`url(${t})`;else{if(!(t instanceof Sr))return;n=await t.arrayBuffer()}const i=new window.FontFace(ni(e.fontFamily),n,{style:e.fontStyle,weight:e.fontWeight}),r=await i.load();if("document"!==s&&"all"!==s||document.fonts.add(r),"iframe"===s||"all"===s){document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts.add(r)}}function Tr(e,t="all"){const s=t=>{t.forEach((s=>{s.family===ni(e?.fontFamily)&&s.weight===e?.fontWeight&&s.style===e?.fontStyle&&t.delete(s)}))};if("document"!==t&&"all"!==t||s(document.fonts),"iframe"===t||"all"===t){s(document.querySelector('iframe[name="editor-canvas"]').contentDocument.fonts)}}function Or(e){if(!e)return;let t;var s;return t=Array.isArray(e)?e[0]:e,t.startsWith("file:.")?void 0:(("string"!=typeof(s=t)||s===decodeURIComponent(s))&&(t=encodeURI(t)),t)}function Ar(e){const t=new FormData,{fontFace:s,category:n,...i}=e,r={...i,slug:jr(e.slug)};return t.append("font_family_settings",JSON.stringify(r)),t}function Mr(e){if(e?.fontFace){const t=e.fontFace.map(((e,t)=>{const s={...e},n=new FormData;if(s.file){const e=Array.isArray(s.file)?s.file:[s.file],i=[];e.forEach(((e,s)=>{const r=`file-${t}-${s}`;n.append(r,e,e.name),i.push(r)})),s.src=1===i.length?i[0]:i,delete s.file,n.append("font_face_settings",JSON.stringify(s))}else n.append("font_face_settings",JSON.stringify(s));return n}));return t}}async function Nr(e,t){const s=[];for(const n of t)try{const t=await vr(e,n);s.push({status:"fulfilled",value:t})}catch(e){s.push({status:"rejected",reason:e})}const n={errors:[],successes:[]};return s.forEach(((e,s)=>{if("fulfilled"===e.status){const i=e.value;i.id?n.successes.push(i):n.errors.push({data:t[s],message:`Error: ${i.message}`})}else n.errors.push({data:t[s],message:e.reason.message})})),n}function Fr(e,t){return-1!==t.findIndex((t=>t.fontWeight===e.fontWeight&&t.fontStyle===e.fontStyle))}function Vr(e,t,s){const n=t=>t.slug===e.slug,i=s.find(n);return t?(i=>{const r=e=>e.fontWeight===t.fontWeight&&e.fontStyle===t.fontStyle;if(!i)return[...s,{...e,fontFace:[t]}];let o=i.fontFace||[];return o=o.find(r)?o.filter((e=>!r(e))):[...o,t],0===o.length?s.filter((e=>!n(e))):s.map((e=>n(e)?{...e,fontFace:o}:e))})(i):(t=>t?s.filter((e=>!n(e))):[...s,e])(i)}const{useGlobalSetting:Rr}=se(y.privateApis),Br=(0,d.createContext)({});const Dr=function({children:e}){const{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{globalStylesId:s}=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return{globalStylesId:t()}})),n=(0,_.useEntityRecord)("root","globalStyles",s),[i,r]=(0,d.useState)(!1),[o,a]=(0,d.useState)(0),[c,u]=(0,d.useState)(null),h=()=>{a(Date.now())},{records:p=[],isResolving:f}=(0,_.useEntityRecords)("postType","wp_font_family",{refreshKey:o,_embed:!0}),m=(p||[]).map((e=>({id:e.id,...e.font_family_settings,fontFace:e?._embedded?.font_faces.map((e=>e.font_face_settings))||[]})))||[],[g,v]=Rr("typography.fontFamilies"),y=async e=>{const s=n.record;fe(s,["settings","typography","fontFamilies"],e),await t("root","globalStyles",s)},[x,w]=(0,d.useState)(!1),[S,j]=(0,d.useState)(null),C=g?.theme?g.theme.map((e=>Cr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],k=g?.custom?g.custom.map((e=>Cr(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],E=m?m.map((e=>Cr(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[];(0,d.useEffect)((()=>{x||j(null)}),[x]);const[P]=(0,d.useState)(new Set),I=e=>e.reduce(((e,t)=>{const s=t?.fontFace&&t.fontFace?.length>0?t?.fontFace.map((e=>`${e.fontStyle+e.fontWeight}`)):["normal400"];return e[t.slug]=s,e}),{}),T=e=>I("theme"===e?C:k),O=(e,t,s,n)=>t||s?!!T(n)[e]?.includes(t+s):!!T(n)[e],A=e=>{var t;const s=(null!==(t=g?.[e.source])&&void 0!==t?t:[]).filter((t=>t.slug!==e.slug)),n={...g,[e.source]:s};return v(n),e.fontFace&&e.fontFace.forEach((e=>{Tr(e,"all")})),n},M=e=>{const t=N(e),s={...g,custom:Pr(g?.custom,t)};return v(s),F(t),s},N=e=>e.map((({id:e,fontFace:t,...s})=>({...s,...t&&t.length>0?{fontFace:t.map((({id:e,...t})=>t))}:{}}))),F=e=>{e.forEach((e=>{e.fontFace&&e.fontFace.forEach((e=>{Ir(e,Or(e.src),"all")}))}))},[V,R]=(0,d.useState)([]),B=async()=>{const e=await async function(){const e={path:`${mr}?_fields=slug,name,description`,method:"GET"};return await Os()(e)}();R(e)};return(0,d.useEffect)((()=>{B()}),[]),(0,me.jsx)(Br.Provider,{value:{libraryFontSelected:S,handleSetLibraryFontSelected:e=>{if(u(null),!e)return void j(null);const t=("theme"===e.source?C:E).find((t=>t.slug===e.slug));j({...t||e,source:e.source})},fontFamilies:g,baseCustomFonts:E,isFontActivated:O,getFontFacesActivated:(e,t)=>T(t)[e]||[],loadFontFaceAsset:async e=>{if(!e.src)return;const t=Or(e.src);t&&!P.has(t)&&(Ir(e,t,"document"),P.add(t))},installFonts:async function(e){r(!0);try{const t=[];let s=[];for(const n of e){let e=!1,i=await yr(n.slug);i||(e=!0,i=await gr(Ar(n)));const r=i.fontFace&&n.fontFace?i.fontFace.filter((e=>Fr(e,n.fontFace))):[];i.fontFace&&n.fontFace&&(n.fontFace=n.fontFace.filter((e=>!Fr(e,i.fontFace))));let o=[],a=[];if(n?.fontFace?.length>0){const e=await Nr(i.id,Mr(n));o=e?.successes,a=e?.errors}(o?.length>0||r?.length>0)&&(i.fontFace=[...o],t.push(i)),i&&!n?.fontFace?.length&&t.push(i),e&&n?.fontFace?.length>0&&0===o?.length&&await xr(i.id),s=s.concat(a)}if(s=s.reduce(((e,t)=>e.includes(t.message)?e:[...e,t.message]),[]),t.length>0){const e=M(t);await y(e),h()}if(s.length>0){const e=new Error((0,b.__)("There was an error installing fonts."));throw e.installationErrors=s,e}}finally{r(!1)}},uninstallFontFamily:async function(e){try{const t=await xr(e.id);if(t.deleted){const t=A(e);await y(t)}return h(),t}catch(e){throw console.error("There was an error uninstalling the font family:",e),e}},toggleActivateFont:(e,t)=>{var s;const n=Vr(e,t,null!==(s=g?.[e.source])&&void 0!==s?s:[]);v({...g,[e.source]:n});O(e.slug,t?.fontStyle,t?.fontWeight,e.source)?Ir(t,Or(t?.src),"all"):Tr(t,"all")},getAvailableFontsOutline:I,modalTabOpen:x,setModalTabOpen:w,refreshLibrary:h,notice:c,setNotice:u,saveFontFamilies:y,isResolvingLibrary:f,isInstalling:i,collections:V,getFontCollection:async e=>{try{if(!!V.find((t=>t.slug===e))?.font_families)return;const t=await async function(e){const t={path:`${mr}/${e}`,method:"GET"};return await Os()(t)}(e),s=V.map((s=>s.slug===e?{...s,...t}:s));R(s)}catch(e){throw console.error(e),e}}},children:e})};const Lr=function({font:e,text:t}){const s=(0,d.useRef)(null),n=function(e){return e.fontStyle||e.fontWeight?e:e.fontFace&&e.fontFace.length?e.fontFace.find((e=>"normal"===e.fontStyle&&"400"===e.fontWeight))||e.fontFace[0]:{fontStyle:"normal",fontWeight:"400",fontFamily:e.fontFamily,fake:!0}}(e),i=ii(e);t=t||e.name;const r=e.preview,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),{loadFontFaceAsset:u}=(0,d.useContext)(Br),h=null!=r?r:function(e){return e.preview?e.preview:e.src?Array.isArray(e.src)?e.src[0]:e.src:void 0}(n),p=h&&h.match(/\.(png|jpg|jpeg|gif|svg)$/i);var f;const m={fontSize:"18px",lineHeight:1,opacity:l?"1":"0",...i,...{fontFamily:si((f=n).fontFamily),fontStyle:f.fontStyle||"normal",fontWeight:f.fontWeight||"400"}};return(0,d.useEffect)((()=>{const e=new window.IntersectionObserver((([e])=>{a(e.isIntersecting)}),{});return e.observe(s.current),()=>e.disconnect()}),[s]),(0,d.useEffect)((()=>{(async()=>{o&&(!p&&n.src&&await u(n),c(!0))})()}),[n,o,u,p]),(0,me.jsx)("div",{ref:s,children:p?(0,me.jsx)("img",{src:h,loading:"lazy",alt:t,className:"font-library-modal__font-variant_demo-image"}):(0,me.jsx)(x.__experimentalText,{style:m,className:"font-library-modal__font-variant_demo-text",children:t})})};const zr=function({font:e,onClick:t,variantsText:s,navigatorPath:n}){const i=e.fontFace?.length||1,r={cursor:t?"pointer":"default"},o=(0,x.__experimentalUseNavigator)();return(0,me.jsx)(x.Button,{onClick:()=>{t(),n&&o.goTo(n)},style:r,className:"font-library-modal__font-card",children:(0,me.jsxs)(x.Flex,{justify:"space-between",wrap:!1,children:[(0,me.jsx)(Lr,{font:e}),(0,me.jsxs)(x.Flex,{justify:"flex-end",children:[(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.__experimentalText,{className:"font-library-modal__font-card__count",children:s||(0,b.sprintf)((0,b._n)("%d variant","%d variants",i),i)})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Icon,{icon:Hn})})]})]})})},{kebabCase:Gr}=se(x.privateApis);const Hr=function({face:e,font:t}){const{isFontActivated:s,toggleActivateFont:n}=(0,d.useContext)(Br),i=t?.fontFace?.length>0?s(t.slug,e.fontStyle,e.fontWeight,t.source):s(t.slug,null,null,t.source),r=()=>{t?.fontFace?.length>0?n(t,e):n(t)},o=t.name+" "+kr(e),a=Gr(`${t.slug}-${kr(e)}`);return(0,me.jsx)("div",{className:"font-library-modal__font-card",children:(0,me.jsxs)(x.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,me.jsx)(x.CheckboxControl,{checked:i,onChange:r,__nextHasNoMarginBottom:!0,id:a}),(0,me.jsx)("label",{htmlFor:a,children:(0,me.jsx)(Lr,{font:e,text:o,onClick:r})})]})})};function Ur(e){switch(e){case"normal":return 400;case"bold":return 700;case"bolder":return 500;case"lighter":return 300;default:return parseInt(e,10)}}function Wr(e){return e.sort(((e,t)=>"normal"===e.fontStyle&&"normal"!==t.fontStyle?-1:"normal"===t.fontStyle&&"normal"!==e.fontStyle?1:e.fontStyle===t.fontStyle?Ur(e.fontWeight)-Ur(t.fontWeight):e.fontStyle.localeCompare(t.fontStyle)))}const{useGlobalSetting:qr}=se(y.privateApis);function Zr({font:e,isOpen:t,setIsOpen:s,setNotice:n,uninstallFontFamily:i,handleSetLibraryFontSelected:r}){const o=(0,x.__experimentalUseNavigator)();return(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:t,cancelButtonText:(0,b.__)("Cancel"),confirmButtonText:(0,b.__)("Delete"),onCancel:()=>{s(!1)},onConfirm:async()=>{n(null),s(!1);try{await i(e),o.goBack(),r(null),n({type:"success",message:(0,b.__)("Font family uninstalled successfully.")})}catch(e){n({type:"error",message:(0,b.__)("There was an error uninstalling the font family. ")+e.message})}},size:"medium",children:e&&(0,b.sprintf)((0,b.__)('Are you sure you want to delete "%s" font and all its variants and assets?'),e.name)})}const Kr=function(){const{baseCustomFonts:e,libraryFontSelected:t,handleSetLibraryFontSelected:s,refreshLibrary:n,uninstallFontFamily:i,isResolvingLibrary:r,isInstalling:o,saveFontFamilies:a,getFontFacesActivated:c,notice:u,setNotice:h,fontFamilies:p}=(0,d.useContext)(Br),[f,m]=(0,d.useState)(!1),[g]=qr("typography.fontFamilies",void 0,"base"),v=(0,l.useSelect)((e=>{const{__experimentalGetCurrentGlobalStylesId:t}=e(_.store);return t()})),y=(0,_.useEntityRecord)("root","globalStyles",v),w=!!y?.edits?.settings?.typography?.fontFamilies,S=p?.theme?p.theme.map((e=>Cr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],j=new Set(S.map((e=>e.slug))),C=g?.theme?S.concat(g.theme.filter((e=>!j.has(e.slug))).map((e=>Cr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name)))):[],k="custom"===t?.source&&t?.id,E=(0,l.useSelect)((e=>{const{canUser:t}=e(_.store);return k&&t("delete","font-families",k)}),[k]),P=!!t&&"theme"!==t?.source&&E,I=e=>{const t=e?.fontFace?.length>0?e.fontFace.length:1,s=c(e.slug,e.source).length;return(0,b.sprintf)((0,b.__)("%1$s/%2$s variants active"),s,t)};return(0,d.useEffect)((()=>{s(t),n()}),[]),(0,me.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[r&&(0,me.jsx)("div",{className:"font-library-modal__loading",children:(0,me.jsx)(x.ProgressBar,{})}),!r&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalNavigatorProvider,{initialPath:t?"/fontFamily":"/",children:[(0,me.jsx)(x.__experimentalNavigatorScreen,{path:"/",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"8",children:[u&&(0,me.jsx)(x.Notice,{status:u.type,onRemove:()=>h(null),children:u.message}),e.length>0&&(0,me.jsxs)(x.__experimentalVStack,{children:[(0,me.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b.__)("Installed Fonts")}),(0,me.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:e.map((e=>(0,me.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,me.jsx)(zr,{font:e,navigatorPath:"/fontFamily",variantsText:I(e),onClick:()=>{s(e)}})},e.slug)))})]}),C.length>0&&(0,me.jsxs)(x.__experimentalVStack,{children:[(0,me.jsx)("h2",{className:"font-library-modal__fonts-title",children:(0,b.__)("Theme Fonts")}),(0,me.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:C.map((e=>(0,me.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,me.jsx)(zr,{font:e,navigatorPath:"/fontFamily",variantsText:I(e),onClick:()=>{s(e)}})},e.slug)))})]})]})}),(0,me.jsxs)(x.__experimentalNavigatorScreen,{path:"/fontFamily",children:[(0,me.jsx)(Zr,{font:t,isOpen:f,setIsOpen:m,setNotice:h,uninstallFontFamily:i,handleSetLibraryFontSelected:s}),(0,me.jsxs)(x.Flex,{justify:"flex-start",children:[(0,me.jsx)(x.__experimentalNavigatorToParentButton,{icon:Gn,size:"small",onClick:()=>{s(null)},label:(0,b.__)("Back")}),(0,me.jsx)(x.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:t?.name})]}),u&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalSpacer,{margin:1}),(0,me.jsx)(x.Notice,{status:u.type,onRemove:()=>h(null),children:u.message}),(0,me.jsx)(x.__experimentalSpacer,{margin:1})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsx)(x.__experimentalText,{children:(0,b.__)("Choose font variants. Keep in mind that too many variants could make your site slower.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)(x.__experimentalSpacer,{margin:8}),(e=>e?e.fontFace&&e.fontFace.length?Wr(e.fontFace):[{fontFamily:e.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[])(t).map(((e,s)=>(0,me.jsx)(Hr,{font:t,face:e},`face${s}`)))]})]})]}),(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-end",className:"font-library-modal__tabpanel-layout__footer",children:[o&&(0,me.jsx)(x.ProgressBar,{}),P&&(0,me.jsx)(x.Button,{isDestructive:!0,variant:"tertiary",onClick:()=>{m(!0)},children:(0,b.__)("Delete")}),(0,me.jsx)(x.Button,{variant:"primary",onClick:()=>{a(p)},disabled:!w,__experimentalIsFocusable:!0,children:(0,b.__)("Update")})]})]})]})};function Yr(e,t,s){return t?!!s[e]?.[`${t.fontStyle}-${t.fontWeight}`]:!!s[e]}const Xr=function(){return(0,me.jsx)("div",{className:"font-library__google-fonts-confirm",children:(0,me.jsx)(x.Card,{children:(0,me.jsxs)(x.CardBody,{children:[(0,me.jsx)(x.__experimentalHeading,{level:2,children:(0,b.__)("Connect to Google Fonts")}),(0,me.jsx)(x.__experimentalSpacer,{margin:6}),(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("To install fonts from Google you must give permission to connect directly to Google servers. The fonts you install will be downloaded from Google and stored on your site. Your site will then use these locally-hosted fonts.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:3}),(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("You can alternatively upload files directly on the Upload tab.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:6}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"primary",onClick:()=>{window.localStorage.setItem("wp-font-library-google-fonts-permission","true"),window.dispatchEvent(new Event("storage"))},children:(0,b.__)("Allow access to Google Fonts")})]})})})},{kebabCase:Jr}=se(x.privateApis);const Qr=function({face:e,font:t,handleToggleVariant:s,selected:n}){const i=()=>{t?.fontFace?s(t,e):s(t)},r=t.name+" "+kr(e),o=Jr(`${t.slug}-${kr(e)}`);return(0,me.jsx)("div",{className:"font-library-modal__font-card",children:(0,me.jsxs)(x.Flex,{justify:"flex-start",align:"center",gap:"1rem",children:[(0,me.jsx)(x.CheckboxControl,{checked:n,onChange:i,__nextHasNoMarginBottom:!0,id:o}),(0,me.jsx)("label",{htmlFor:o,children:(0,me.jsx)(Lr,{font:e,text:r,onClick:i})})]})})},$r={slug:"all",name:(0,b._x)("All","font categories")},eo="wp-font-library-google-fonts-permission";const to=function({slug:e}){var t;const s="google-fonts"===e,n=()=>"true"===window.localStorage.getItem(eo),[i,r]=(0,d.useState)(null),[o,a]=(0,d.useState)([]),[l,c]=(0,d.useState)(1),[u,h]=(0,d.useState)({}),[p,f]=(0,d.useState)(s&&!n()),{collections:m,getFontCollection:g,installFonts:y,isInstalling:w,notice:_,setNotice:S}=(0,d.useContext)(Br),j=m.find((t=>t.slug===e));(0,d.useEffect)((()=>{const e=()=>{f(s&&!n())};return e(),window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[e,s]);const C=()=>{window.localStorage.setItem(eo,"false"),window.dispatchEvent(new Event("storage"))};(0,d.useEffect)((()=>{(async()=>{try{await g(e),B()}catch(e){_||S({type:"error",message:e?.message})}})()}),[e,g,S,_]),(0,d.useEffect)((()=>{r(null),S(null)}),[e,S]),(0,d.useEffect)((()=>{a([])}),[i]);const k=(0,d.useMemo)((()=>{var e;return null!==(e=j?.font_families)&&void 0!==e?e:[]}),[j]),E=null!==(t=j?.categories)&&void 0!==t?t:[],P=[$r,...E],I=(0,d.useMemo)((()=>function(e,t){const{category:s,search:n}=t;let i=e||[];return s&&"all"!==s&&(i=i.filter((e=>-1!==e.categories.indexOf(s)))),n&&(i=i.filter((e=>e.font_family_settings.name.toLowerCase().includes(n.toLowerCase())))),i}(k,u)),[k,u]),T=!j?.font_families&&!_,O=Math.max(window.innerHeight,500),A=Math.floor((O-417)/61),M=Math.ceil(I.length/A),N=(l-1)*A,F=l*A,V=I.slice(N,F),R=(0,v.debounce)((e=>{h({...u,search:e}),c(1)}),300),B=()=>{h({}),c(1)},D=(e,t)=>{const s=Vr(e,t,o);a(s)},L=function(e){return e.reduce(((e,t)=>({...e,[t.slug]:(t?.fontFace||[]).reduce(((e,t)=>({...e,[`${t.fontStyle}-${t.fontWeight}`]:!0})),{})})),{})}(o);if(p)return(0,me.jsx)(Xr,{});const z=()=>"google-fonts"!==e||p||i?null:(0,me.jsx)(x.DropdownMenu,{icon:zn,label:(0,b.__)("Actions"),popoverProps:{position:"bottom left"},controls:[{title:(0,b.__)("Revoke access to Google Fonts"),onClick:C}]});return(0,me.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[T&&(0,me.jsx)("div",{className:"font-library-modal__loading",children:(0,me.jsx)(x.ProgressBar,{})}),!T&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalNavigatorProvider,{initialPath:"/",className:"font-library-modal__tabpanel-layout",children:[(0,me.jsxs)(x.__experimentalNavigatorScreen,{path:"/",children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsxs)(x.__experimentalVStack,{children:[(0,me.jsx)(x.__experimentalHeading,{level:2,size:13,children:j.name}),(0,me.jsx)(x.__experimentalText,{children:j.description})]}),(0,me.jsx)(z,{})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsxs)(x.Flex,{children:[(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.SearchControl,{className:"font-library-modal__search",value:u.search,placeholder:(0,b.__)("Font name…"),label:(0,b.__)("Search"),onChange:R,__nextHasNoMarginBottom:!0,hideLabelFromVision:!1})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.SelectControl,{label:(0,b.__)("Category"),value:u.category,onChange:e=>{h({...u,category:e}),c(1)},children:P&&P.map((e=>(0,me.jsx)("option",{value:e.slug,children:e.name},e.slug)))})})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),!!j?.font_families?.length&&!I.length&&(0,me.jsx)(x.__experimentalText,{children:(0,b.__)("No fonts found. Try with a different search term")}),(0,me.jsxs)("div",{className:"font-library-modal__fonts-grid__main",children:[(0,me.jsx)("ul",{role:"list",className:"font-library-modal__fonts-list",children:V.map((e=>(0,me.jsx)("li",{className:"font-library-modal__fonts-list-item",children:(0,me.jsx)(zr,{font:e.font_family_settings,navigatorPath:"/fontFamily",onClick:()=>{r(e.font_family_settings)}})},e.font_family_settings.slug)))})," "]})]}),(0,me.jsxs)(x.__experimentalNavigatorScreen,{path:"/fontFamily",children:[(0,me.jsxs)(x.Flex,{justify:"flex-start",children:[(0,me.jsx)(x.__experimentalNavigatorToParentButton,{icon:Gn,size:"small",onClick:()=>{r(null),S(null)},label:(0,b.__)("Back")}),(0,me.jsx)(x.__experimentalHeading,{level:2,size:13,className:"edit-site-global-styles-header",children:i?.name})]}),_&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalSpacer,{margin:1}),(0,me.jsx)(x.Notice,{status:_.type,onRemove:()=>S(null),children:_.message}),(0,me.jsx)(x.__experimentalSpacer,{margin:1})]}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsx)(x.__experimentalText,{children:(0,b.__)("Select font variants to install.")}),(0,me.jsx)(x.__experimentalSpacer,{margin:4}),(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)(x.__experimentalSpacer,{margin:8}),(G=i,G?G.fontFace&&G.fontFace.length?Wr(G.fontFace):[{fontFamily:G.fontFamily,fontStyle:"normal",fontWeight:"400"}]:[]).map(((e,t)=>(0,me.jsx)(Qr,{font:i,face:e,handleToggleVariant:D,selected:Yr(i.slug,i.fontFace?e:null,L)},`face${t}`)))]}),(0,me.jsx)(x.__experimentalSpacer,{margin:16})]})]}),i&&(0,me.jsx)(x.Flex,{justify:"flex-end",className:"font-library-modal__tabpanel-layout__footer",children:(0,me.jsx)(x.Button,{variant:"primary",onClick:async()=>{S(null);const e=o[0];try{e?.fontFace&&await Promise.all(e.fontFace.map((async e=>{e.src&&(e.file=await async function(e){e=Array.isArray(e)?e:[e];const t=await Promise.all(e.map((async e=>fetch(new Request(e)).then((t=>{if(!t.ok)throw new Error(`Error downloading font face asset from ${e}. Server responded with status: ${t.status}`);return t.blob()})).then((t=>{const s=e.split("/").pop();return new Sr([t],s,{type:t.type})})))));return 1===t.length?t[0]:t}(e.src))})))}catch(e){return void S({type:"error",message:(0,b.__)("Error installing the fonts, could not be downloaded.")})}try{await y([e]),S({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){S({type:"error",message:e.message})}a([])},isBusy:w,disabled:0===o.length||w,__experimentalIsFocusable:!0,children:(0,b.__)("Install")})}),!i&&(0,me.jsxs)(x.Flex,{justify:"center",className:"font-library-modal__tabpanel-layout__footer",children:[(0,me.jsx)(x.Button,{label:(0,b.__)("First page"),size:"compact",onClick:()=>c(1),disabled:1===l,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"«"})}),(0,me.jsx)(x.Button,{label:(0,b.__)("Previous page"),size:"compact",onClick:()=>c(l-1),disabled:1===l,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"‹"})}),(0,me.jsx)(x.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2,children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("Page of %s","paging"),M),{CurrentPageControl:(0,me.jsx)(x.SelectControl,{"aria-label":(0,b.__)("Current page"),value:l,options:[...Array(M)].map(((e,t)=>({label:t+1,value:t+1}))),onChange:e=>c(parseInt(e)),size:"compact",__nextHasNoMarginBottom:!0})})}),(0,me.jsx)(x.Button,{label:(0,b.__)("Next page"),size:"compact",onClick:()=>c(l+1),disabled:l===M,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"›"})}),(0,me.jsx)(x.Button,{label:(0,b.__)("Last page"),size:"compact",onClick:()=>c(M),disabled:l===M,__experimentalIsFocusable:!0,children:(0,me.jsx)("span",{children:"»"})})]})]})]});var G};var so=i(8572),no=i.n(so),io=i(4660),ro=i.n(io);globalThis.fetch;class oo{constructor(e,t={},s){this.type=e,this.detail=t,this.msg=s,Object.defineProperty(this,"__mayPropagate",{enumerable:!1,writable:!0}),this.__mayPropagate=!0}preventDefault(){}stopPropagation(){this.__mayPropagate=!1}valueOf(){return this}toString(){return this.msg?`[${this.type} event]: ${this.msg}`:`[${this.type} event]`}}class ao{constructor(){this.listeners={}}addEventListener(e,t,s){let n=this.listeners[e]||[];s?n.unshift(t):n.push(t),this.listeners[e]=n}removeEventListener(e,t){let s=this.listeners[e]||[],n=s.findIndex((e=>e===t));n>-1&&(s.splice(n,1),this.listeners[e]=s)}dispatch(e){let t=this.listeners[e.type];if(t)for(let s=0,n=t.length;s{let t=e.replace(/get(Big)?/,"").toLowerCase(),s=parseInt(e.replace(/[^\d]/g,""))/8;Object.defineProperty(this,t,{get:()=>this.getValue(e,s)})}))}get currentPosition(){return this.start+this.offset}set currentPosition(e){this.start=e,this.offset=0}skip(e=0,t=8){this.offset+=e*t/8}getValue(e,t){let s=this.start+this.offset;this.offset+=t;try{return this.data[e](s)}catch(s){throw console.error("parser",e,t,this),console.error("parser",this.start,this.offset),s}}flags(e){if(8===e||16===e||32===e||64===e)return this[`uint${e}`].toString(2).padStart(e,0).split("").map((e=>"1"===e));console.error("Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long"),console.trace()}get tag(){const e=this.uint32;return t=[e>>24&255,e>>16&255,e>>8&255,255&e],Array.from(t).map((e=>String.fromCharCode(e))).join("");var t}get fixed(){return this.int16+Math.round(1e3*this.uint16/65356)/1e3}get legacyFixed(){let e=this.uint16,t=this.uint16.toString(16).padStart(4,0);return parseFloat(`${e}.${t}`)}get uint24(){return(this.uint8<<16)+(this.uint8<<8)+this.uint8}get uint128(){let e=0;for(let t=0;t<5;t++){let t=this.uint8;if(e=128*e+(127&t),t<128)break}return e}get longdatetime(){return new Date(lo+1e3*parseInt(this.int64.toString()))}get fword(){return this.int16}get ufword(){return this.uint16}get Offset16(){return this.uint16}get Offset32(){return this.uint32}get F2DOT14(){const e=p.uint16;return[0,1,-2,-1][e>>14]+(16383&e)/16384}verifyLength(){this.offset!=this.length&&console.error(`unexpected parsed table size (${this.offset}) for "${this.name}" (expected ${this.length})`)}readBytes(e=0,t=0,s=8,n=!1){if(0===(e=e||this.length))return[];t&&(this.currentPosition=t);const i=`${n?"":"u"}int${s}`,r=[];for(;e--;)r.push(this[i]);return r}}class uo{constructor(e){const t={enumerable:!1,get:()=>e};Object.defineProperty(this,"parser",t);const s=e.currentPosition,n={enumerable:!1,get:()=>s};Object.defineProperty(this,"start",n)}load(e){Object.keys(e).forEach((t=>{let s=Object.getOwnPropertyDescriptor(e,t);s.get?this[t]=s.get.bind(this):void 0!==s.value&&(this[t]=s.value)})),this.parser.length&&this.parser.verifyLength()}}class ho extends uo{constructor(e,t,s){const{parser:n,start:i}=super(new co(e,t,s)),r={enumerable:!1,get:()=>n};Object.defineProperty(this,"p",r);const o={enumerable:!1,get:()=>i};Object.defineProperty(this,"tableStart",o)}}function po(e,t,s){let n;Object.defineProperty(e,t,{get:()=>n||(n=s(),n),enumerable:!0})}class fo extends ho{constructor(e,t,s){const{p:n}=super({offset:0,length:12},t,"sfnt");this.version=n.uint32,this.numTables=n.uint16,this.searchRange=n.uint16,this.entrySelector=n.uint16,this.rangeShift=n.uint16,n.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new mo(n))),this.tables={},this.directory.forEach((e=>{po(this.tables,e.tag.trim(),(()=>s(this.tables,{tag:e.tag,offset:e.offset,length:e.length},t)))}))}}class mo{constructor(e){this.tag=e.tag,this.checksum=e.uint32,this.offset=e.uint32,this.length=e.uint32}}const go=ro().inflate||void 0;let vo;class yo extends ho{constructor(e,t,s){const{p:n}=super({offset:0,length:44},t,"woff");this.signature=n.tag,this.flavor=n.uint32,this.length=n.uint32,this.numTables=n.uint16,n.uint16,this.totalSfntSize=n.uint32,this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.metaOffset=n.uint32,this.metaLength=n.uint32,this.metaOrigLength=n.uint32,this.privOffset=n.uint32,this.privLength=n.uint32,n.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new xo(n))),bo(this,t,s)}}class xo{constructor(e){this.tag=e.tag,this.offset=e.uint32,this.compLength=e.uint32,this.origLength=e.uint32,this.origChecksum=e.uint32}}function bo(e,t,s){e.tables={},e.directory.forEach((n=>{po(e.tables,n.tag.trim(),(()=>{let i=0,r=t;if(n.compLength!==n.origLength){const e=t.buffer.slice(n.offset,n.offset+n.compLength);let s;if(go)s=go(new Uint8Array(e));else{if(!vo){const e="no brotli decoder available to decode WOFF2 font";throw font.onerror&&font.onerror(e),new Error(e)}s=vo(new Uint8Array(e))}r=new DataView(s.buffer)}else i=n.offset;return s(e.tables,{tag:n.tag,offset:i,length:n.origLength},r)}))}))}const wo=no();let _o;class So extends ho{constructor(e,t,s){const{p:n}=super({offset:0,length:48},t,"woff2");this.signature=n.tag,this.flavor=n.uint32,this.length=n.uint32,this.numTables=n.uint16,n.uint16,this.totalSfntSize=n.uint32,this.totalCompressedSize=n.uint32,this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.metaOffset=n.uint32,this.metaLength=n.uint32,this.metaOrigLength=n.uint32,this.privOffset=n.uint32,this.privLength=n.uint32,n.verifyLength(),this.directory=[...new Array(this.numTables)].map((e=>new jo(n)));let i,r=n.currentPosition;this.directory[0].offset=0,this.directory.forEach(((e,t)=>{let s=this.directory[t+1];s&&(s.offset=e.offset+(void 0!==e.transformLength?e.transformLength:e.origLength))}));let o=t.buffer.slice(r);if(wo)i=wo(new Uint8Array(o));else{if(!_o){const t="no brotli decoder available to decode WOFF2 font";throw e.onerror&&e.onerror(t),new Error(t)}i=new Uint8Array(_o(o))}!function(e,t,s){e.tables={},e.directory.forEach((n=>{po(e.tables,n.tag.trim(),(()=>{const i=n.offset,r=i+(n.transformLength?n.transformLength:n.origLength),o=new DataView(t.slice(i,r).buffer);try{return s(e.tables,{tag:n.tag,offset:0,length:n.origLength},o)}catch(e){console.error(e)}}))}))}(this,i,s)}}class jo{constructor(e){this.flags=e.uint8;const t=this.tagNumber=63&this.flags;this.tag=63===t?e.tag:["cmap","head","hhea","hmtx","maxp","name","OS/2","post","cvt ","fpgm","glyf","loca","prep","CFF ","VORG","EBDT","EBLC","gasp","hdmx","kern","LTSH","PCLT","VDMX","vhea","vmtx","BASE","GDEF","GPOS","GSUB","EBSC","JSTF","MATH","CBDT","CBLC","COLR","CPAL","SVG ","sbix","acnt","avar","bdat","bloc","bsln","cvar","fdsc","feat","fmtx","fvar","gvar","hsty","just","lcar","mort","morx","opbd","prop","trak","Zapf","Silf","Glat","Gloc","Feat","Sill"][63&t];let s=0!==(this.transformVersion=(192&this.flags)>>6);"glyf"!==this.tag&&"loca"!==this.tag||(s=3!==this.transformVersion),this.origLength=e.uint128,s&&(this.transformLength=e.uint128)}}const Co={};let ko=!1;function Eo(e,t,s){let n=t.tag.replace(/[^\w\d]/g,""),i=Co[n];return i?new i(t,s,e):(console.warn(`lib-font has no definition for ${n}. The table was skipped.`),{})}function Po(){let e=0;function t(s,n){if(!ko)return e>10?n(new Error("loading took too long")):(e++,setTimeout((()=>t(s)),250));s(Eo)}return new Promise(((e,s)=>t(e)))}async function Io(e,t,s={}){if(!globalThis.document)return;let n=function(e,t){let s=e.lastIndexOf("."),n=(e.substring(s+1)||"").toLowerCase(),i={ttf:"truetype",otf:"opentype",woff:"woff",woff2:"woff2"}[n];if(i)return i;let r={eot:"The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.",svg:"The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.",fon:"The .fon format is not supported: this is an ancient Windows bitmap font format.",ttc:"Based on the current CSS specification, font collections are not (yet?) supported."}[n];if(r||(r=`${e} is not a known webfont format.`),t)throw new Error(r);console.warn(`Could not load font: ${r}`)}(t,s.errorOnStyle);if(!n)return;let i=document.createElement("style");i.className="injected-by-Font-js";let r=[];return s.styleRules&&(r=Object.entries(s.styleRules).map((([e,t])=>`${e}: ${t};`))),i.textContent=`\n@font-face {\n font-family: "${e}";\n ${r.join("\n\t")}\n src: url("${t}") format("${n}");\n}`,globalThis.document.head.appendChild(i),i}Promise.all([Promise.resolve().then((function(){return Qo})),Promise.resolve().then((function(){return $o})),Promise.resolve().then((function(){return ea})),Promise.resolve().then((function(){return sa})),Promise.resolve().then((function(){return na})),Promise.resolve().then((function(){return oa})),Promise.resolve().then((function(){return aa})),Promise.resolve().then((function(){return ca})),Promise.resolve().then((function(){return ba})),Promise.resolve().then((function(){return Aa})),Promise.resolve().then((function(){return Il})),Promise.resolve().then((function(){return Tl})),Promise.resolve().then((function(){return Ml})),Promise.resolve().then((function(){return Vl})),Promise.resolve().then((function(){return Rl})),Promise.resolve().then((function(){return Bl})),Promise.resolve().then((function(){return Ll})),Promise.resolve().then((function(){return zl})),Promise.resolve().then((function(){return Gl})),Promise.resolve().then((function(){return Hl})),Promise.resolve().then((function(){return Ul})),Promise.resolve().then((function(){return Wl})),Promise.resolve().then((function(){return Zl})),Promise.resolve().then((function(){return Ql})),Promise.resolve().then((function(){return ec})),Promise.resolve().then((function(){return tc})),Promise.resolve().then((function(){return sc})),Promise.resolve().then((function(){return nc})),Promise.resolve().then((function(){return ic})),Promise.resolve().then((function(){return ac})),Promise.resolve().then((function(){return hc})),Promise.resolve().then((function(){return mc})),Promise.resolve().then((function(){return vc})),Promise.resolve().then((function(){return bc})),Promise.resolve().then((function(){return wc})),Promise.resolve().then((function(){return _c})),Promise.resolve().then((function(){return jc})),Promise.resolve().then((function(){return Cc})),Promise.resolve().then((function(){return Ic})),Promise.resolve().then((function(){return Tc})),Promise.resolve().then((function(){return Ac}))]).then((e=>{e.forEach((e=>{let t=Object.keys(e)[0];Co[t]=e[t]})),ko=!0}));const To=[0,1,0,0],Oo=[79,84,84,79],Ao=[119,79,70,70],Mo=[119,79,70,50];function No(e,t){if(e.length===t.length){for(let s=0;s{globalThis.document&&!this.options.skipStyleSheet&&await Io(this.name,e,this.options),this.loadFont(e)})()}async loadFont(e,t){fetch(e).then((e=>function(e){if(!e.ok)throw new Error(`HTTP ${e.status} - ${e.statusText}`);return e}(e)&&e.arrayBuffer())).then((s=>this.fromDataBuffer(s,t||e))).catch((s=>{const n=new oo("error",s,`Failed to load font at ${t||e}`);this.dispatch(n),this.onerror&&this.onerror(n)}))}async fromDataBuffer(e,t){this.fontData=new DataView(e);let s=function(e){const t=[e.getUint8(0),e.getUint8(1),e.getUint8(2),e.getUint8(3)];return No(t,To)||No(t,Oo)?"SFNT":No(t,Ao)?"WOFF":No(t,Mo)?"WOFF2":void 0}(this.fontData);if(!s)throw new Error(`${t} is either an unsupported font format, or not a font at all.`);await this.parseBasicData(s);const n=new oo("load",{font:this});this.dispatch(n),this.onload&&this.onload(n)}async parseBasicData(e){return Po().then((t=>("SFNT"===e&&(this.opentype=new fo(this,this.fontData,t)),"WOFF"===e&&(this.opentype=new yo(this,this.fontData,t)),"WOFF2"===e&&(this.opentype=new So(this,this.fontData,t)),this.opentype)))}getGlyphId(e){return this.opentype.tables.cmap.getGlyphId(e)}reverse(e){return this.opentype.tables.cmap.reverse(e)}supports(e){return 0!==this.getGlyphId(e)}supportsVariation(e){return!1!==this.opentype.tables.cmap.supportsVariation(e)}measureText(e,t=16){if(this.__unloaded)throw new Error("Cannot measure text: font was unloaded. Please reload before calling measureText()");let s=document.createElement("div");s.textContent=e,s.style.fontFamily=this.name,s.style.fontSize=`${t}px`,s.style.color="transparent",s.style.background="transparent",s.style.top="0",s.style.left="0",s.style.position="absolute",document.body.appendChild(s);let n=s.getBoundingClientRect();document.body.removeChild(s);const i=this.opentype.tables["OS/2"];return n.fontSize=t,n.ascender=i.sTypoAscender,n.descender=i.sTypoDescender,n}unload(){if(this.styleElement.parentNode){this.styleElement.parentNode.removeElement(this.styleElement);const e=new oo("unload",{font:this});this.dispatch(e),this.onunload&&this.onunload(e)}this._unloaded=!0}load(){if(this.__unloaded){delete this.__unloaded,document.head.appendChild(this.styleElement);const e=new oo("load",{font:this});this.dispatch(e),this.onload&&this.onload(e)}}}globalThis.Font=Fo;class Vo extends uo{constructor(e,t,s){super(e),this.plaformID=t,this.encodingID=s}}class Ro extends Vo{constructor(e,t,s){super(e,t,s),this.format=0,this.length=e.uint16,this.language=e.uint16,this.glyphIdArray=[...new Array(256)].map((t=>e.uint8))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.")),0<=e&&e<=255}reverse(e){return console.warn("reverse not implemented for cmap subtable format 0"),{}}getSupportedCharCodes(){return[{start:1,end:256}]}}class Bo extends Vo{constructor(e,t,s){super(e,t,s),this.format=2,this.length=e.uint16,this.language=e.uint16,this.subHeaderKeys=[...new Array(256)].map((t=>e.uint16));const n=Math.max(...this.subHeaderKeys),i=e.currentPosition;po(this,"subHeaders",(()=>(e.currentPosition=i,[...new Array(n)].map((t=>new Do(e))))));const r=i+8*n;po(this,"glyphIndexArray",(()=>(e.currentPosition=r,[...new Array(n)].map((t=>e.uint16)))))}supports(e){e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented."));const t=e&&255,s=e&&65280,n=this.subHeaders[s],i=this.subHeaders[n],r=i.firstCode,o=r+i.entryCount;return r<=t&&t<=o}reverse(e){return console.warn("reverse not implemented for cmap subtable format 2"),{}}getSupportedCharCodes(e=!1){return e?this.subHeaders.map((e=>({firstCode:e.firstCode,lastCode:e.lastCode}))):this.subHeaders.map((e=>({start:e.firstCode,end:e.lastCode})))}}class Do{constructor(e){this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.first+this.entryCount,this.idDelta=e.int16,this.idRangeOffset=e.uint16}}class Lo extends Vo{constructor(e,t,s){super(e,t,s),this.format=4,this.length=e.uint16,this.language=e.uint16,this.segCountX2=e.uint16,this.segCount=this.segCountX2/2,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16;const n=e.currentPosition;po(this,"endCode",(()=>e.readBytes(this.segCount,n,16)));const i=n+2+this.segCountX2;po(this,"startCode",(()=>e.readBytes(this.segCount,i,16)));const r=i+this.segCountX2;po(this,"idDelta",(()=>e.readBytes(this.segCount,r,16,!0)));const o=r+this.segCountX2;po(this,"idRangeOffset",(()=>e.readBytes(this.segCount,o,16)));const a=o+this.segCountX2,l=this.length-(a-this.tableStart);po(this,"glyphIdArray",(()=>e.readBytes(l,a,16))),po(this,"segments",(()=>this.buildSegments(o,a,e)))}buildSegments(e,t,s){return[...new Array(this.segCount)].map(((t,n)=>{let i=this.startCode[n],r=this.endCode[n],o=this.idDelta[n],a=this.idRangeOffset[n],l=e+2*n,c=[];if(0===a)for(let e=i+o,t=r+o;e<=t;e++)c.push(e);else for(let e=0,t=r-i;e<=t;e++)s.currentPosition=l+a+2*e,c.push(s.uint16);return{startCode:i,endCode:r,idDelta:o,idRangeOffset:a,glyphIDs:c}}))}reverse(e){let t=this.segments.find((t=>t.glyphIDs.includes(e)));if(!t)return{};const s=t.startCode+t.glyphIDs.indexOf(e);return{code:s,unicode:String.fromCodePoint(s)}}getGlyphId(e){if(e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343)return 0;if(65534==(65534&e)||65535==(65535&e))return 0;let t=this.segments.find((t=>t.startCode<=e&&e<=t.endCode));return t?t.glyphIDs[e-t.startCode]:0}supports(e){return 0!==this.getGlyphId(e)}getSupportedCharCodes(e=!1){return e?this.segments:this.segments.map((e=>({start:e.startCode,end:e.endCode})))}}class zo extends Vo{constructor(e,t,s){super(e,t,s),this.format=6,this.length=e.uint16,this.language=e.uint16,this.firstCode=e.uint16,this.entryCount=e.uint16,this.lastCode=this.firstCode+this.entryCount-1;po(this,"glyphIdArray",(()=>[...new Array(this.entryCount)].map((t=>e.uint16))))}supports(e){if(e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.")),ethis.firstCode+this.entryCount)return{};const t=e-this.firstCode;return{code:t,unicode:String.fromCodePoint(t)}}reverse(e){let t=this.glyphIdArray.indexOf(e);if(t>-1)return this.firstCode+t}getSupportedCharCodes(e=!1){return e?[{firstCode:this.firstCode,lastCode:this.lastCode}]:[{start:this.firstCode,end:this.lastCode}]}}class Go extends Vo{constructor(e,t,s){super(e,t,s),this.format=8,e.uint16,this.length=e.uint32,this.language=e.uint32,this.is32=[...new Array(8192)].map((t=>e.uint8)),this.numGroups=e.uint32;po(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new Ho(e)))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.")),-1!==this.groups.findIndex((t=>t.startcharCode<=e&&e<=t.endcharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 8"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startcharCode,end:e.endcharCode})))}}class Ho{constructor(e){this.startcharCode=e.uint32,this.endcharCode=e.uint32,this.startGlyphID=e.uint32}}class Uo extends Vo{constructor(e,t,s){super(e,t,s),this.format=10,e.uint16,this.length=e.uint32,this.language=e.uint32,this.startCharCode=e.uint32,this.numChars=e.uint32,this.endCharCode=this.startCharCode+this.numChars;po(this,"glyphs",(()=>[...new Array(this.numChars)].map((t=>e.uint16))))}supports(e){return e.charCodeAt&&(e=-1,console.warn("supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.")),!(ethis.startCharCode+this.numChars)&&e-this.startCharCode)}reverse(e){return console.warn("reverse not implemented for cmap subtable format 10"),{}}getSupportedCharCodes(e=!1){return e?[{startCharCode:this.startCharCode,endCharCode:this.endCharCode}]:[{start:this.startCharCode,end:this.endCharCode}]}}class Wo extends Vo{constructor(e,t,s){super(e,t,s),this.format=12,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;po(this,"groups",(()=>[...new Array(this.numGroups)].map((t=>new qo(e)))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),55296<=e&&e<=57343||65534==(65534&e)||65535==(65535&e)?0:-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){for(let t of this.groups){let s=t.startGlyphID;if(s>e)continue;if(s===e)return t.startCharCode;if(s+(t.endCharCode-t.startCharCode)({start:e.startCharCode,end:e.endCharCode})))}}class qo{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.startGlyphID=e.uint32}}class Zo extends Vo{constructor(e,t,s){super(e,t,s),this.format=13,e.uint16,this.length=e.uint32,this.language=e.uint32,this.numGroups=e.uint32;po(this,"groups",[...new Array(this.numGroups)].map((t=>new Ko(e))))}supports(e){return e.charCodeAt&&(e=e.charCodeAt(0)),-1!==this.groups.findIndex((t=>t.startCharCode<=e&&e<=t.endCharCode))}reverse(e){return console.warn("reverse not implemented for cmap subtable format 13"),{}}getSupportedCharCodes(e=!1){return e?this.groups:this.groups.map((e=>({start:e.startCharCode,end:e.endCharCode})))}}class Ko{constructor(e){this.startCharCode=e.uint32,this.endCharCode=e.uint32,this.glyphID=e.uint32}}class Yo extends Vo{constructor(e,t,s){super(e,t,s),this.subTableStart=e.currentPosition,this.format=14,this.length=e.uint32,this.numVarSelectorRecords=e.uint32,po(this,"varSelectors",(()=>[...new Array(this.numVarSelectorRecords)].map((t=>new Xo(e)))))}supports(){return console.warn("supports not implemented for cmap subtable format 14"),0}getSupportedCharCodes(){return console.warn("getSupportedCharCodes not implemented for cmap subtable format 14"),[]}reverse(e){return console.warn("reverse not implemented for cmap subtable format 14"),{}}supportsVariation(e){let t=this.varSelector.find((t=>t.varSelector===e));return t||!1}getSupportedVariations(){return this.varSelectors.map((e=>e.varSelector))}}class Xo{constructor(e){this.varSelector=e.uint24,this.defaultUVSOffset=e.Offset32,this.nonDefaultUVSOffset=e.Offset32}}class Jo{constructor(e,t){const s=this.platformID=e.uint16,n=this.encodingID=e.uint16,i=this.offset=e.Offset32;po(this,"table",(()=>(e.currentPosition=t+i,function(e,t,s){const n=e.uint16;return 0===n?new Ro(e,t,s):2===n?new Bo(e,t,s):4===n?new Lo(e,t,s):6===n?new zo(e,t,s):8===n?new Go(e,t,s):10===n?new Uo(e,t,s):12===n?new Wo(e,t,s):13===n?new Zo(e,t,s):14===n?new Yo(e,t,s):{}}(e,s,n))))}}var Qo=Object.freeze({__proto__:null,cmap:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numTables=s.uint16,this.encodingRecords=[...new Array(this.numTables)].map((e=>new Jo(s,this.tableStart)))}getSubTable(e){return this.encodingRecords[e].table}getSupportedEncodings(){return this.encodingRecords.map((e=>({platformID:e.platformID,encodingId:e.encodingID})))}getSupportedCharCodes(e,t){const s=this.encodingRecords.findIndex((s=>s.platformID===e&&s.encodingID===t));if(-1===s)return!1;return this.getSubTable(s).getSupportedCharCodes()}reverse(e){for(let t=0;t{let i=this.getSubTable(n);return!!i.getGlyphId&&(t=i.getGlyphId(e),0!==t)})),t}supports(e){return this.encodingRecords.some(((t,s)=>{const n=this.getSubTable(s);return n.supports&&!1!==n.supports(e)}))}supportsVariation(e){return this.encodingRecords.some(((t,s)=>{const n=this.getSubTable(s);return n.supportsVariation&&!1!==n.supportsVariation(e)}))}}});var $o=Object.freeze({__proto__:null,head:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.load({majorVersion:s.uint16,minorVersion:s.uint16,fontRevision:s.fixed,checkSumAdjustment:s.uint32,magicNumber:s.uint32,flags:s.flags(16),unitsPerEm:s.uint16,created:s.longdatetime,modified:s.longdatetime,xMin:s.int16,yMin:s.int16,xMax:s.int16,yMax:s.int16,macStyle:s.flags(16),lowestRecPPEM:s.uint16,fontDirectionHint:s.uint16,indexToLocFormat:s.uint16,glyphDataFormat:s.uint16})}}});var ea=Object.freeze({__proto__:null,hhea:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.ascender=s.fword,this.descender=s.fword,this.lineGap=s.fword,this.advanceWidthMax=s.ufword,this.minLeftSideBearing=s.fword,this.minRightSideBearing=s.fword,this.xMaxExtent=s.fword,this.caretSlopeRise=s.int16,this.caretSlopeRun=s.int16,this.caretOffset=s.int16,s.int16,s.int16,s.int16,s.int16,this.metricDataFormat=s.int16,this.numberOfHMetrics=s.uint16,s.verifyLength()}}});class ta{constructor(e,t){this.advanceWidth=e,this.lsb=t}}var sa=Object.freeze({__proto__:null,hmtx:class extends ho{constructor(e,t,s){const{p:n}=super(e,t),i=s.hhea.numberOfHMetrics,r=s.maxp.numGlyphs,o=n.currentPosition;if(po(this,"hMetrics",(()=>(n.currentPosition=o,[...new Array(i)].map((e=>new ta(n.uint16,n.int16)))))),i(n.currentPosition=e,[...new Array(r-i)].map((e=>n.int16)))))}}}});var na=Object.freeze({__proto__:null,maxp:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.legacyFixed,this.numGlyphs=s.uint16,1===this.version&&(this.maxPoints=s.uint16,this.maxContours=s.uint16,this.maxCompositePoints=s.uint16,this.maxCompositeContours=s.uint16,this.maxZones=s.uint16,this.maxTwilightPoints=s.uint16,this.maxStorage=s.uint16,this.maxFunctionDefs=s.uint16,this.maxInstructionDefs=s.uint16,this.maxStackElements=s.uint16,this.maxSizeOfInstructions=s.uint16,this.maxComponentElements=s.uint16,this.maxComponentDepth=s.uint16),s.verifyLength()}}});class ia{constructor(e,t){this.length=e,this.offset=t}}class ra{constructor(e,t){this.platformID=e.uint16,this.encodingID=e.uint16,this.languageID=e.uint16,this.nameID=e.uint16,this.length=e.uint16,this.offset=e.Offset16,po(this,"string",(()=>(e.currentPosition=t.stringStart+this.offset,function(e,t){const{platformID:s,length:n}=t;if(0===n)return"";if(0===s||3===s){const t=[];for(let s=0,i=n/2;snew ra(s,this))),1===this.format&&(this.langTagCount=s.uint16,this.langTagRecords=[...new Array(this.langTagCount)].map((e=>new ia(s.uint16,s.Offset16)))),this.stringStart=this.tableStart+this.stringOffset}get(e){let t=this.nameRecords.find((t=>t.nameID===e));if(t)return t.string}}});var aa=Object.freeze({__proto__:null,OS2:class extends ho{constructor(e,t){const{p:s}=super(e,t);return this.version=s.uint16,this.xAvgCharWidth=s.int16,this.usWeightClass=s.uint16,this.usWidthClass=s.uint16,this.fsType=s.uint16,this.ySubscriptXSize=s.int16,this.ySubscriptYSize=s.int16,this.ySubscriptXOffset=s.int16,this.ySubscriptYOffset=s.int16,this.ySuperscriptXSize=s.int16,this.ySuperscriptYSize=s.int16,this.ySuperscriptXOffset=s.int16,this.ySuperscriptYOffset=s.int16,this.yStrikeoutSize=s.int16,this.yStrikeoutPosition=s.int16,this.sFamilyClass=s.int16,this.panose=[...new Array(10)].map((e=>s.uint8)),this.ulUnicodeRange1=s.flags(32),this.ulUnicodeRange2=s.flags(32),this.ulUnicodeRange3=s.flags(32),this.ulUnicodeRange4=s.flags(32),this.achVendID=s.tag,this.fsSelection=s.uint16,this.usFirstCharIndex=s.uint16,this.usLastCharIndex=s.uint16,this.sTypoAscender=s.int16,this.sTypoDescender=s.int16,this.sTypoLineGap=s.int16,this.usWinAscent=s.uint16,this.usWinDescent=s.uint16,0===this.version?s.verifyLength():(this.ulCodePageRange1=s.flags(32),this.ulCodePageRange2=s.flags(32),1===this.version?s.verifyLength():(this.sxHeight=s.int16,this.sCapHeight=s.int16,this.usDefaultChar=s.uint16,this.usBreakChar=s.uint16,this.usMaxContext=s.uint16,this.version<=4?s.verifyLength():(this.usLowerOpticalPointSize=s.uint16,this.usUpperOpticalPointSize=s.uint16,5===this.version?s.verifyLength():void 0)))}}});const la=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];var ca=Object.freeze({__proto__:null,post:class extends ho{constructor(e,t){const{p:s}=super(e,t);if(this.version=s.legacyFixed,this.italicAngle=s.fixed,this.underlinePosition=s.fword,this.underlineThickness=s.fword,this.isFixedPitch=s.uint32,this.minMemType42=s.uint32,this.maxMemType42=s.uint32,this.minMemType1=s.uint32,this.maxMemType1=s.uint32,1===this.version||3===this.version)return s.verifyLength();if(this.numGlyphs=s.uint16,2===this.version){this.glyphNameIndex=[...new Array(this.numGlyphs)].map((e=>s.uint16)),this.namesOffset=s.currentPosition,this.glyphNameOffsets=[1];for(let e=0;es.int8)))}getGlyphName(e){if(2!==this.version)return console.warn(`post table version ${this.version} does not support glyph name lookups`),"";let t=this.glyphNameIndex[e];if(t<258)return la[t];let s=this.glyphNameOffsets[e],n=this.glyphNameOffsets[e+1]-s-1;if(0===n)return".notdef.";this.parser.currentPosition=this.namesOffset+s;return this.parser.readBytes(n,this.namesOffset+s,8,!0).map((e=>String.fromCharCode(e))).join("")}}});class ua extends ho{constructor(e,t){const{p:s}=super(e,t,"AxisTable");this.baseTagListOffset=s.Offset16,this.baseScriptListOffset=s.Offset16,po(this,"baseTagList",(()=>new da({offset:e.offset+this.baseTagListOffset},t))),po(this,"baseScriptList",(()=>new ha({offset:e.offset+this.baseScriptListOffset},t)))}}class da extends ho{constructor(e,t){const{p:s}=super(e,t,"BaseTagListTable");this.baseTagCount=s.uint16,this.baselineTags=[...new Array(this.baseTagCount)].map((e=>s.tag))}}class ha extends ho{constructor(e,t){const{p:s}=super(e,t,"BaseScriptListTable");this.baseScriptCount=s.uint16;const n=s.currentPosition;po(this,"baseScriptRecords",(()=>(s.currentPosition=n,[...new Array(this.baseScriptCount)].map((e=>new pa(this.start,s))))))}}class pa{constructor(e,t){this.baseScriptTag=t.tag,this.baseScriptOffset=t.Offset16,po(this,"baseScriptTable",(()=>(t.currentPosition=e+this.baseScriptOffset,new fa(t))))}}class fa{constructor(e){this.start=e.currentPosition,this.baseValuesOffset=e.Offset16,this.defaultMinMaxOffset=e.Offset16,this.baseLangSysCount=e.uint16,this.baseLangSysRecords=[...new Array(this.baseLangSysCount)].map((t=>new ma(this.start,e))),po(this,"baseValues",(()=>(e.currentPosition=this.start+this.baseValuesOffset,new ga(e)))),po(this,"defaultMinMax",(()=>(e.currentPosition=this.start+this.defaultMinMaxOffset,new va(e))))}}class ma{constructor(e,t){this.baseLangSysTag=t.tag,this.minMaxOffset=t.Offset16,po(this,"minMax",(()=>(t.currentPosition=e+this.minMaxOffset,new va(t))))}}class ga{constructor(e){this.parser=e,this.start=e.currentPosition,this.defaultBaselineIndex=e.uint16,this.baseCoordCount=e.uint16,this.baseCoords=[...new Array(this.baseCoordCount)].map((t=>e.Offset16))}getTable(e){return this.parser.currentPosition=this.start+this.baseCoords[e],new xa(this.parser)}}class va{constructor(e){this.minCoord=e.Offset16,this.maxCoord=e.Offset16,this.featMinMaxCount=e.uint16;const t=e.currentPosition;po(this,"featMinMaxRecords",(()=>(e.currentPosition=t,[...new Array(this.featMinMaxCount)].map((t=>new ya(e))))))}}class ya{constructor(e){this.featureTableTag=e.tag,this.minCoord=e.Offset16,this.maxCoord=e.Offset16}}class xa{constructor(e){this.baseCoordFormat=e.uint16,this.coordinate=e.int16,2===this.baseCoordFormat&&(this.referenceGlyph=e.uint16,this.baseCoordPoint=e.uint16),3===this.baseCoordFormat&&(this.deviceTable=e.Offset16)}}var ba=Object.freeze({__proto__:null,BASE:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.horizAxisOffset=s.Offset16,this.vertAxisOffset=s.Offset16,po(this,"horizAxis",(()=>new ua({offset:e.offset+this.horizAxisOffset},t))),po(this,"vertAxis",(()=>new ua({offset:e.offset+this.vertAxisOffset},t))),1===this.majorVersion&&1===this.minorVersion&&(this.itemVarStoreOffset=s.Offset32,po(this,"itemVarStore",(()=>new ua({offset:e.offset+this.itemVarStoreOffset},t))))}}});class wa{constructor(e){this.classFormat=e.uint16,1===this.classFormat&&(this.startGlyphID=e.uint16,this.glyphCount=e.uint16,this.classValueArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.classFormat&&(this.classRangeCount=e.uint16,this.classRangeRecords=[...new Array(this.classRangeCount)].map((t=>new _a(e))))}}class _a{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.class=e.uint16}}class Sa extends uo{constructor(e){super(e),this.coverageFormat=e.uint16,1===this.coverageFormat&&(this.glyphCount=e.uint16,this.glyphArray=[...new Array(this.glyphCount)].map((t=>e.uint16))),2===this.coverageFormat&&(this.rangeCount=e.uint16,this.rangeRecords=[...new Array(this.rangeCount)].map((t=>new ja(e))))}}class ja{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.startCoverageIndex=e.uint16}}class Ca{constructor(e,t){this.table=e,this.parser=t,this.start=t.currentPosition,this.format=t.uint16,this.variationRegionListOffset=t.Offset32,this.itemVariationDataCount=t.uint16,this.itemVariationDataOffsets=[...new Array(this.itemVariationDataCount)].map((e=>t.Offset32))}}class ka extends uo{constructor(e){super(e),this.coverageOffset=e.Offset16,this.glyphCount=e.uint16,this.attachPointOffsets=[...new Array(this.glyphCount)].map((t=>e.Offset16))}getPoint(e){return this.parser.currentPosition=this.start+this.attachPointOffsets[e],new Ea(this.parser)}}class Ea{constructor(e){this.pointCount=e.uint16,this.pointIndices=[...new Array(this.pointCount)].map((t=>e.uint16))}}class Pa extends uo{constructor(e){super(e),this.coverageOffset=e.Offset16,po(this,"coverage",(()=>(e.currentPosition=this.start+this.coverageOffset,new Sa(e)))),this.ligGlyphCount=e.uint16,this.ligGlyphOffsets=[...new Array(this.ligGlyphCount)].map((t=>e.Offset16))}getLigGlyph(e){return this.parser.currentPosition=this.start+this.ligGlyphOffsets[e],new Ia(this.parser)}}class Ia extends uo{constructor(e){super(e),this.caretCount=e.uint16,this.caretValueOffsets=[...new Array(this.caretCount)].map((t=>e.Offset16))}getCaretValue(e){return this.parser.currentPosition=this.start+this.caretValueOffsets[e],new Ta(this.parser)}}class Ta{constructor(e){this.caretValueFormat=e.uint16,1===this.caretValueFormat&&(this.coordinate=e.int16),2===this.caretValueFormat&&(this.caretValuePointIndex=e.uint16),3===this.caretValueFormat&&(this.coordinate=e.int16,this.deviceOffset=e.Offset16)}}class Oa extends uo{constructor(e){super(e),this.markGlyphSetTableFormat=e.uint16,this.markGlyphSetCount=e.uint16,this.coverageOffsets=[...new Array(this.markGlyphSetCount)].map((t=>e.Offset32))}getMarkGlyphSet(e){return this.parser.currentPosition=this.start+this.coverageOffsets[e],new Sa(this.parser)}}var Aa=Object.freeze({__proto__:null,GDEF:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.glyphClassDefOffset=s.Offset16,po(this,"glyphClassDefs",(()=>{if(0!==this.glyphClassDefOffset)return s.currentPosition=this.tableStart+this.glyphClassDefOffset,new wa(s)})),this.attachListOffset=s.Offset16,po(this,"attachList",(()=>{if(0!==this.attachListOffset)return s.currentPosition=this.tableStart+this.attachListOffset,new ka(s)})),this.ligCaretListOffset=s.Offset16,po(this,"ligCaretList",(()=>{if(0!==this.ligCaretListOffset)return s.currentPosition=this.tableStart+this.ligCaretListOffset,new Pa(s)})),this.markAttachClassDefOffset=s.Offset16,po(this,"markAttachClassDef",(()=>{if(0!==this.markAttachClassDefOffset)return s.currentPosition=this.tableStart+this.markAttachClassDefOffset,new wa(s)})),this.minorVersion>=2&&(this.markGlyphSetsDefOffset=s.Offset16,po(this,"markGlyphSetsDef",(()=>{if(0!==this.markGlyphSetsDefOffset)return s.currentPosition=this.tableStart+this.markGlyphSetsDefOffset,new Oa(s)}))),3===this.minorVersion&&(this.itemVarStoreOffset=s.Offset32,po(this,"itemVarStore",(()=>{if(0!==this.itemVarStoreOffset)return s.currentPosition=this.tableStart+this.itemVarStoreOffset,new Ca(s)})))}}});class Ma extends uo{static EMPTY={scriptCount:0,scriptRecords:[]};constructor(e){super(e),this.scriptCount=e.uint16,this.scriptRecords=[...new Array(this.scriptCount)].map((t=>new Na(e)))}}class Na{constructor(e){this.scriptTag=e.tag,this.scriptOffset=e.Offset16}}class Fa extends uo{constructor(e){super(e),this.defaultLangSys=e.Offset16,this.langSysCount=e.uint16,this.langSysRecords=[...new Array(this.langSysCount)].map((t=>new Va(e)))}}class Va{constructor(e){this.langSysTag=e.tag,this.langSysOffset=e.Offset16}}class Ra{constructor(e){this.lookupOrder=e.Offset16,this.requiredFeatureIndex=e.uint16,this.featureIndexCount=e.uint16,this.featureIndices=[...new Array(this.featureIndexCount)].map((t=>e.uint16))}}class Ba extends uo{static EMPTY={featureCount:0,featureRecords:[]};constructor(e){super(e),this.featureCount=e.uint16,this.featureRecords=[...new Array(this.featureCount)].map((t=>new Da(e)))}}class Da{constructor(e){this.featureTag=e.tag,this.featureOffset=e.Offset16}}class La extends uo{constructor(e){super(e),this.featureParams=e.Offset16,this.lookupIndexCount=e.uint16,this.lookupListIndices=[...new Array(this.lookupIndexCount)].map((t=>e.uint16))}getFeatureParams(){if(this.featureParams>0){const e=this.parser;e.currentPosition=this.start+this.featureParams;const t=this.featureTag;if("size"===t)return new Ga(e);if(t.startsWith("cc"))return new za(e);if(t.startsWith("ss"))return new Ha(e)}}}class za{constructor(e){this.format=e.uint16,this.featUiLabelNameId=e.uint16,this.featUiTooltipTextNameId=e.uint16,this.sampleTextNameId=e.uint16,this.numNamedParameters=e.uint16,this.firstParamUiLabelNameId=e.uint16,this.charCount=e.uint16,this.character=[...new Array(this.charCount)].map((t=>e.uint24))}}class Ga{constructor(e){this.designSize=e.uint16,this.subfamilyIdentifier=e.uint16,this.subfamilyNameID=e.uint16,this.smallEnd=e.uint16,this.largeEnd=e.uint16}}class Ha{constructor(e){this.version=e.uint16,this.UINameID=e.uint16}}function Ua(e){e.parser.currentPosition-=2,delete e.coverageOffset,delete e.getCoverageTable}class Wa extends uo{constructor(e){super(e),this.substFormat=e.uint16,this.coverageOffset=e.Offset16}getCoverageTable(){let e=this.parser;return e.currentPosition=this.start+this.coverageOffset,new Sa(e)}}class qa{constructor(e){this.glyphSequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class Za extends Wa{constructor(e){super(e),this.deltaGlyphID=e.int16}}class Ka extends Wa{constructor(e){super(e),this.sequenceCount=e.uint16,this.sequenceOffsets=[...new Array(this.sequenceCount)].map((t=>e.Offset16))}getSequence(e){let t=this.parser;return t.currentPosition=this.start+this.sequenceOffsets[e],new Ya(t)}}class Ya{constructor(e){this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class Xa extends Wa{constructor(e){super(e),this.alternateSetCount=e.uint16,this.alternateSetOffsets=[...new Array(this.alternateSetCount)].map((t=>e.Offset16))}getAlternateSet(e){let t=this.parser;return t.currentPosition=this.start+this.alternateSetOffsets[e],new Ja(t)}}class Ja{constructor(e){this.glyphCount=e.uint16,this.alternateGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}class Qa extends Wa{constructor(e){super(e),this.ligatureSetCount=e.uint16,this.ligatureSetOffsets=[...new Array(this.ligatureSetCount)].map((t=>e.Offset16))}getLigatureSet(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureSetOffsets[e],new $a(t)}}class $a extends uo{constructor(e){super(e),this.ligatureCount=e.uint16,this.ligatureOffsets=[...new Array(this.ligatureCount)].map((t=>e.Offset16))}getLigature(e){let t=this.parser;return t.currentPosition=this.start+this.ligatureOffsets[e],new el(t)}}class el{constructor(e){this.ligatureGlyph=e.uint16,this.componentCount=e.uint16,this.componentGlyphIDs=[...new Array(this.componentCount-1)].map((t=>e.uint16))}}class tl extends Wa{constructor(e){super(e),1===this.substFormat&&(this.subRuleSetCount=e.uint16,this.subRuleSetOffsets=[...new Array(this.subRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.classDefOffset=e.Offset16,this.subClassSetCount=e.uint16,this.subClassSetOffsets=[...new Array(this.subClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(Ua(this),this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.coverageOffsets=[...new Array(this.glyphCount)].map((t=>e.Offset16)),this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new qa(e))))}getSubRuleSet(e){if(1!==this.substFormat)throw new Error(`lookup type 5.${this.substFormat} has no subrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.subRuleSetOffsets[e],new sl(t)}getSubClassSet(e){if(2!==this.substFormat)throw new Error(`lookup type 5.${this.substFormat} has no subclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.subClassSetOffsets[e],new il(t)}getCoverageTable(e){if(3!==this.substFormat&&!e)return super.getCoverageTable();if(!e)throw new Error(`lookup type 5.${this.substFormat} requires an coverage table index.`);let t=this.parser;return t.currentPosition=this.start+this.coverageOffsets[e],new Sa(t)}}class sl extends uo{constructor(e){super(e),this.subRuleCount=e.uint16,this.subRuleOffsets=[...new Array(this.subRuleCount)].map((t=>e.Offset16))}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.subRuleOffsets[e],new nl(t)}}class nl{constructor(e){this.glyphCount=e.uint16,this.substitutionCount=e.uint16,this.inputSequence=[...new Array(this.glyphCount-1)].map((t=>e.uint16)),this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new qa(e)))}}class il extends uo{constructor(e){super(e),this.subClassRuleCount=e.uint16,this.subClassRuleOffsets=[...new Array(this.subClassRuleCount)].map((t=>e.Offset16))}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.subClassRuleOffsets[e],new rl(t)}}class rl extends nl{constructor(e){super(e)}}class ol extends Wa{constructor(e){super(e),1===this.substFormat&&(this.chainSubRuleSetCount=e.uint16,this.chainSubRuleSetOffsets=[...new Array(this.chainSubRuleSetCount)].map((t=>e.Offset16))),2===this.substFormat&&(this.backtrackClassDefOffset=e.Offset16,this.inputClassDefOffset=e.Offset16,this.lookaheadClassDefOffset=e.Offset16,this.chainSubClassSetCount=e.uint16,this.chainSubClassSetOffsets=[...new Array(this.chainSubClassSetCount)].map((t=>e.Offset16))),3===this.substFormat&&(Ua(this),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map((t=>e.Offset16)),this.inputGlyphCount=e.uint16,this.inputCoverageOffsets=[...new Array(this.inputGlyphCount)].map((t=>e.Offset16)),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[...new Array(this.lookaheadGlyphCount)].map((t=>e.Offset16)),this.seqLookupCount=e.uint16,this.seqLookupRecords=[...new Array(this.substitutionCount)].map((t=>new dl(e))))}getChainSubRuleSet(e){if(1!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} has no chainsubrule sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleSetOffsets[e],new al(t)}getChainSubClassSet(e){if(2!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} has no chainsubclass sets.`);let t=this.parser;return t.currentPosition=this.start+this.chainSubClassSetOffsets[e],new cl(t)}getCoverageFromOffset(e){if(3!==this.substFormat)throw new Error(`lookup type 6.${this.substFormat} does not use contextual coverage offsets.`);let t=this.parser;return t.currentPosition=this.start+e,new Sa(t)}}class al extends uo{constructor(e){super(e),this.chainSubRuleCount=e.uint16,this.chainSubRuleOffsets=[...new Array(this.chainSubRuleCount)].map((t=>e.Offset16))}getSubRule(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new ll(t)}}class ll{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map((t=>e.uint16)),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map((t=>e.uint16)),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map((t=>e.uint16)),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.SubstCount)].map((t=>new qa(e)))}}class cl extends uo{constructor(e){super(e),this.chainSubClassRuleCount=e.uint16,this.chainSubClassRuleOffsets=[...new Array(this.chainSubClassRuleCount)].map((t=>e.Offset16))}getSubClass(e){let t=this.parser;return t.currentPosition=this.start+this.chainSubRuleOffsets[e],new ul(t)}}class ul{constructor(e){this.backtrackGlyphCount=e.uint16,this.backtrackSequence=[...new Array(this.backtrackGlyphCount)].map((t=>e.uint16)),this.inputGlyphCount=e.uint16,this.inputSequence=[...new Array(this.inputGlyphCount-1)].map((t=>e.uint16)),this.lookaheadGlyphCount=e.uint16,this.lookAheadSequence=[...new Array(this.lookAheadGlyphCount)].map((t=>e.uint16)),this.substitutionCount=e.uint16,this.substLookupRecords=[...new Array(this.substitutionCount)].map((t=>new dl(e)))}}class dl extends uo{constructor(e){super(e),this.sequenceIndex=e.uint16,this.lookupListIndex=e.uint16}}class hl extends uo{constructor(e){super(e),this.substFormat=e.uint16,this.extensionLookupType=e.uint16,this.extensionOffset=e.Offset32}}class pl extends Wa{constructor(e){super(e),this.backtrackGlyphCount=e.uint16,this.backtrackCoverageOffsets=[...new Array(this.backtrackGlyphCount)].map((t=>e.Offset16)),this.lookaheadGlyphCount=e.uint16,this.lookaheadCoverageOffsets=[new Array(this.lookaheadGlyphCount)].map((t=>e.Offset16)),this.glyphCount=e.uint16,this.substituteGlyphIDs=[...new Array(this.glyphCount)].map((t=>e.uint16))}}var fl={buildSubtable:function(e,t){const s=new[void 0,Za,Ka,Xa,Qa,tl,ol,hl,pl][e](t);return s.type=e,s}};class ml extends uo{constructor(e){super(e)}}class gl extends ml{constructor(e){super(e),console.log("lookup type 1")}}class vl extends ml{constructor(e){super(e),console.log("lookup type 2")}}class yl extends ml{constructor(e){super(e),console.log("lookup type 3")}}class xl extends ml{constructor(e){super(e),console.log("lookup type 4")}}class bl extends ml{constructor(e){super(e),console.log("lookup type 5")}}class wl extends ml{constructor(e){super(e),console.log("lookup type 6")}}class _l extends ml{constructor(e){super(e),console.log("lookup type 7")}}class Sl extends ml{constructor(e){super(e),console.log("lookup type 8")}}class jl extends ml{constructor(e){super(e),console.log("lookup type 9")}}var Cl={buildSubtable:function(e,t){const s=new[void 0,gl,vl,yl,xl,bl,wl,_l,Sl,jl][e](t);return s.type=e,s}};class kl extends uo{static EMPTY={lookupCount:0,lookups:[]};constructor(e){super(e),this.lookupCount=e.uint16,this.lookups=[...new Array(this.lookupCount)].map((t=>e.Offset16))}}class El extends uo{constructor(e,t){super(e),this.ctType=t,this.lookupType=e.uint16,this.lookupFlag=e.uint16,this.subTableCount=e.uint16,this.subtableOffsets=[...new Array(this.subTableCount)].map((t=>e.Offset16)),this.markFilteringSet=e.uint16}get rightToLeft(){return!0&this.lookupFlag}get ignoreBaseGlyphs(){return!0&this.lookupFlag}get ignoreLigatures(){return!0&this.lookupFlag}get ignoreMarks(){return!0&this.lookupFlag}get useMarkFilteringSet(){return!0&this.lookupFlag}get markAttachmentType(){return!0&this.lookupFlag}getSubTable(e){const t="GSUB"===this.ctType?fl:Cl;return this.parser.currentPosition=this.start+this.subtableOffsets[e],t.buildSubtable(this.lookupType,this.parser)}}class Pl extends ho{constructor(e,t,s){const{p:n,tableStart:i}=super(e,t,s);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.scriptListOffset=n.Offset16,this.featureListOffset=n.Offset16,this.lookupListOffset=n.Offset16,1===this.majorVersion&&1===this.minorVersion&&(this.featureVariationsOffset=n.Offset32);const r=!(this.scriptListOffset||this.featureListOffset||this.lookupListOffset);po(this,"scriptList",(()=>r?Ma.EMPTY:(n.currentPosition=i+this.scriptListOffset,new Ma(n)))),po(this,"featureList",(()=>r?Ba.EMPTY:(n.currentPosition=i+this.featureListOffset,new Ba(n)))),po(this,"lookupList",(()=>r?kl.EMPTY:(n.currentPosition=i+this.lookupListOffset,new kl(n)))),this.featureVariationsOffset&&po(this,"featureVariations",(()=>r?FeatureVariations.EMPTY:(n.currentPosition=i+this.featureVariationsOffset,new FeatureVariations(n))))}getSupportedScripts(){return this.scriptList.scriptRecords.map((e=>e.scriptTag))}getScriptTable(e){let t=this.scriptList.scriptRecords.find((t=>t.scriptTag===e));this.parser.currentPosition=this.scriptList.start+t.scriptOffset;let s=new Fa(this.parser);return s.scriptTag=e,s}ensureScriptTable(e){return"string"==typeof e?this.getScriptTable(e):e}getSupportedLangSys(e){const t=0!==(e=this.ensureScriptTable(e)).defaultLangSys,s=e.langSysRecords.map((e=>e.langSysTag));return t&&s.unshift("dflt"),s}getDefaultLangSysTable(e){let t=(e=this.ensureScriptTable(e)).defaultLangSys;if(0!==t){this.parser.currentPosition=e.start+t;let s=new Ra(this.parser);return s.langSysTag="",s.defaultForScript=e.scriptTag,s}}getLangSysTable(e,t="dflt"){if("dflt"===t)return this.getDefaultLangSysTable(e);let s=(e=this.ensureScriptTable(e)).langSysRecords.find((e=>e.langSysTag===t));this.parser.currentPosition=e.start+s.langSysOffset;let n=new Ra(this.parser);return n.langSysTag=t,n}getFeatures(e){return e.featureIndices.map((e=>this.getFeature(e)))}getFeature(e){let t;if(t=parseInt(e)==e?this.featureList.featureRecords[e]:this.featureList.featureRecords.find((t=>t.featureTag===e)),!t)return;this.parser.currentPosition=this.featureList.start+t.featureOffset;let s=new La(this.parser);return s.featureTag=t.featureTag,s}getLookups(e){return e.lookupListIndices.map((e=>this.getLookup(e)))}getLookup(e,t){let s=this.lookupList.lookups[e];return this.parser.currentPosition=this.lookupList.start+s,new El(this.parser,t)}}var Il=Object.freeze({__proto__:null,GSUB:class extends Pl{constructor(e,t){super(e,t,"GSUB")}getLookup(e){return super.getLookup(e,"GSUB")}}});var Tl=Object.freeze({__proto__:null,GPOS:class extends Pl{constructor(e,t){super(e,t,"GPOS")}getLookup(e){return super.getLookup(e,"GPOS")}}});class Ol extends uo{constructor(e){super(e),this.numEntries=e.uint16,this.documentRecords=[...new Array(this.numEntries)].map((t=>new Al(e)))}getDocument(e){let t=this.documentRecords[e];if(!t)return"";let s=this.start+t.svgDocOffset;return this.parser.currentPosition=s,this.parser.readBytes(t.svgDocLength)}getDocumentForGlyph(e){let t=this.documentRecords.findIndex((t=>t.startGlyphID<=e&&e<=t.endGlyphID));return-1===t?"":this.getDocument(t)}}class Al{constructor(e){this.startGlyphID=e.uint16,this.endGlyphID=e.uint16,this.svgDocOffset=e.Offset32,this.svgDocLength=e.uint32}}var Ml=Object.freeze({__proto__:null,SVG:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.offsetToSVGDocumentList=s.Offset32,s.currentPosition=this.tableStart+this.offsetToSVGDocumentList,this.documentList=new Ol(s)}}});class Nl{constructor(e){this.tag=e.tag,this.minValue=e.fixed,this.defaultValue=e.fixed,this.maxValue=e.fixed,this.flags=e.flags(16),this.axisNameID=e.uint16}}class Fl{constructor(e,t,s){let n=e.currentPosition;this.subfamilyNameID=e.uint16,e.uint16,this.coordinates=[...new Array(t)].map((t=>e.fixed)),e.currentPosition-n(s.currentPosition=n,[...new Array(this.axisCount)].map((e=>new Nl(s))))));const i=n+this.axisCount*this.axisSize;po(this,"instances",(()=>{let e=[];for(let t=0;te.tag))}getAxis(e){return this.axes.find((t=>t.tag===e))}}});var Rl=Object.freeze({__proto__:null,cvt:class extends ho{constructor(e,t){const{p:s}=super(e,t),n=e.length/2;po(this,"items",(()=>[...new Array(n)].map((e=>s.fword))))}}});var Bl=Object.freeze({__proto__:null,fpgm:class extends ho{constructor(e,t){const{p:s}=super(e,t);po(this,"instructions",(()=>[...new Array(e.length)].map((e=>s.uint8))))}}});class Dl{constructor(e){this.rangeMaxPPEM=e.uint16,this.rangeGaspBehavior=e.uint16}}var Ll=Object.freeze({__proto__:null,gasp:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numRanges=s.uint16;po(this,"gaspRanges",(()=>[...new Array(this.numRanges)].map((e=>new Dl(s)))))}}});var zl=Object.freeze({__proto__:null,glyf:class extends ho{constructor(e,t){super(e,t)}getGlyphData(e,t){return this.parser.currentPosition=this.tableStart+e,this.parser.readBytes(t)}}});var Gl=Object.freeze({__proto__:null,loca:class extends ho{constructor(e,t,s){const{p:n}=super(e,t),i=s.maxp.numGlyphs+1;0===s.head.indexToLocFormat?(this.x2=!0,po(this,"offsets",(()=>[...new Array(i)].map((e=>n.Offset16))))):po(this,"offsets",(()=>[...new Array(i)].map((e=>n.Offset32))))}getGlyphDataOffsetAndLength(e){let t=this.offsets[e]*this.x2?2:1;return{offset:t,length:(this.offsets[e+1]*this.x2?2:1)-t}}}});var Hl=Object.freeze({__proto__:null,prep:class extends ho{constructor(e,t){const{p:s}=super(e,t);po(this,"instructions",(()=>[...new Array(e.length)].map((e=>s.uint8))))}}});var Ul=Object.freeze({__proto__:null,CFF:class extends ho{constructor(e,t){const{p:s}=super(e,t);po(this,"data",(()=>s.readBytes()))}}});var Wl=Object.freeze({__proto__:null,CFF2:class extends ho{constructor(e,t){const{p:s}=super(e,t);po(this,"data",(()=>s.readBytes()))}}});class ql{constructor(e){this.glyphIndex=e.uint16,this.vertOriginY=e.int16}}var Zl=Object.freeze({__proto__:null,VORG:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.defaultVertOriginY=s.int16,this.numVertOriginYMetrics=s.uint16,po(this,"vertORiginYMetrics",(()=>[...new Array(this.numVertOriginYMetrics)].map((e=>new ql(s)))))}}});class Kl{constructor(e){this.indexSubTableArrayOffset=e.Offset32,this.indexTablesSize=e.uint32,this.numberofIndexSubTables=e.uint32,this.colorRef=e.uint32,this.hori=new Xl(e),this.vert=new Xl(e),this.startGlyphIndex=e.uint16,this.endGlyphIndex=e.uint16,this.ppemX=e.uint8,this.ppemY=e.uint8,this.bitDepth=e.uint8,this.flags=e.int8}}class Yl{constructor(e){this.hori=new Xl(e),this.vert=new Xl(e),this.ppemX=e.uint8,this.ppemY=e.uint8,this.substitutePpemX=e.uint8,this.substitutePpemY=e.uint8}}class Xl{constructor(e){this.ascender=e.int8,this.descender=e.int8,this.widthMax=e.uint8,this.caretSlopeNumerator=e.int8,this.caretSlopeDenominator=e.int8,this.caretOffset=e.int8,this.minOriginSB=e.int8,this.minAdvanceSB=e.int8,this.maxBeforeBL=e.int8,this.minAfterBL=e.int8,this.pad1=e.int8,this.pad2=e.int8}}class Jl extends ho{constructor(e,t,s){const{p:n}=super(e,t,s);this.majorVersion=n.uint16,this.minorVersion=n.uint16,this.numSizes=n.uint32,po(this,"bitMapSizes",(()=>[...new Array(this.numSizes)].map((e=>new Kl(n)))))}}var Ql=Object.freeze({__proto__:null,EBLC:Jl});class $l extends ho{constructor(e,t,s){const{p:n}=super(e,t,s);this.majorVersion=n.uint16,this.minorVersion=n.uint16}}var ec=Object.freeze({__proto__:null,EBDT:$l});var tc=Object.freeze({__proto__:null,EBSC:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.majorVersion=s.uint16,this.minorVersion=s.uint16,this.numSizes=s.uint32,po(this,"bitmapScales",(()=>[...new Array(this.numSizes)].map((e=>new Yl(s)))))}}});var sc=Object.freeze({__proto__:null,CBLC:class extends Jl{constructor(e,t){super(e,t,"CBLC")}}});var nc=Object.freeze({__proto__:null,CBDT:class extends $l{constructor(e,t){super(e,t,"CBDT")}}});var ic=Object.freeze({__proto__:null,sbix:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.flags=s.flags(16),this.numStrikes=s.uint32,po(this,"strikeOffsets",(()=>[...new Array(this.numStrikes)].map((e=>s.Offset32))))}}});class rc{constructor(e){this.gID=e.uint16,this.firstLayerIndex=e.uint16,this.numLayers=e.uint16}}class oc{constructor(e){this.gID=e.uint16,this.paletteIndex=e.uint16}}var ac=Object.freeze({__proto__:null,COLR:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numBaseGlyphRecords=s.uint16,this.baseGlyphRecordsOffset=s.Offset32,this.layerRecordsOffset=s.Offset32,this.numLayerRecords=s.uint16}getBaseGlyphRecord(e){let t=this.tableStart+this.baseGlyphRecordsOffset;this.parser.currentPosition=t;let s=new rc(this.parser),n=s.gID,i=this.tableStart+this.layerRecordsOffset-6;this.parser.currentPosition=i;let r=new rc(this.parser),o=r.gID;if(n===e)return s;if(o===e)return r;for(;t!==i;){let s=t+(i-t)/12;this.parser.currentPosition=s;let n=new rc(this.parser),r=n.gID;if(r===e)return n;r>e?i=s:rnew oc(p)))}}});class lc{constructor(e){this.blue=e.uint8,this.green=e.uint8,this.red=e.uint8,this.alpha=e.uint8}}class cc{constructor(e,t){this.paletteTypes=[...new Array(t)].map((t=>e.uint32))}}class uc{constructor(e,t){this.paletteLabels=[...new Array(t)].map((t=>e.uint16))}}class dc{constructor(e,t){this.paletteEntryLabels=[...new Array(t)].map((t=>e.uint16))}}var hc=Object.freeze({__proto__:null,CPAL:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numPaletteEntries=s.uint16;const n=this.numPalettes=s.uint16;this.numColorRecords=s.uint16,this.offsetFirstColorRecord=s.Offset32,this.colorRecordIndices=[...new Array(this.numPalettes)].map((e=>s.uint16)),po(this,"colorRecords",(()=>(s.currentPosition=this.tableStart+this.offsetFirstColorRecord,[...new Array(this.numColorRecords)].map((e=>new lc(s)))))),1===this.version&&(this.offsetPaletteTypeArray=s.Offset32,this.offsetPaletteLabelArray=s.Offset32,this.offsetPaletteEntryLabelArray=s.Offset32,po(this,"paletteTypeArray",(()=>(s.currentPosition=this.tableStart+this.offsetPaletteTypeArray,new cc(s,n)))),po(this,"paletteLabelArray",(()=>(s.currentPosition=this.tableStart+this.offsetPaletteLabelArray,new uc(s,n)))),po(this,"paletteEntryLabelArray",(()=>(s.currentPosition=this.tableStart+this.offsetPaletteEntryLabelArray,new dc(s,n)))))}}});class pc{constructor(e){this.format=e.uint32,this.length=e.uint32,this.offset=e.Offset32}}class fc{constructor(e){e.uint16,e.uint16,this.signatureLength=e.uint32,this.signature=e.readBytes(this.signatureLength)}}var mc=Object.freeze({__proto__:null,DSIG:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint32,this.numSignatures=s.uint16,this.flags=s.uint16,this.signatureRecords=[...new Array(this.numSignatures)].map((e=>new pc(s)))}getData(e){const t=this.signatureRecords[e];return this.parser.currentPosition=this.tableStart+t.offset,new fc(this.parser)}}});class gc{constructor(e,t){this.pixelSize=e.uint8,this.maxWidth=e.uint8,this.widths=e.readBytes(t)}}var vc=Object.freeze({__proto__:null,hdmx:class extends ho{constructor(e,t,s){const{p:n}=super(e,t),i=s.hmtx.numGlyphs;this.version=n.uint16,this.numRecords=n.int16,this.sizeDeviceRecord=n.int32,this.records=[...new Array(numRecords)].map((e=>new gc(n,i)))}}});class yc{constructor(e){this.version=e.uint16,this.length=e.uint16,this.coverage=e.flags(8),this.format=e.uint8,0===this.format&&(this.nPairs=e.uint16,this.searchRange=e.uint16,this.entrySelector=e.uint16,this.rangeShift=e.uint16,po(this,"pairs",(()=>[...new Array(this.nPairs)].map((t=>new xc(e)))))),2===this.format&&console.warn("Kern subtable format 2 is not supported: this parser currently only parses universal table data.")}get horizontal(){return this.coverage[0]}get minimum(){return this.coverage[1]}get crossstream(){return this.coverage[2]}get override(){return this.coverage[3]}}class xc{constructor(e){this.left=e.uint16,this.right=e.uint16,this.value=e.fword}}var bc=Object.freeze({__proto__:null,kern:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.nTables=s.uint16,po(this,"tables",(()=>{let e=this.tableStart+4;const t=[];for(let n=0;n[...new Array(this.mergeClassCount)].map((e=>s.readBytes(this.mergeClassCount))))),console.warn("Full MERG parsing is currently not supported."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}}});class Sc{constructor(e,t){this.tableStart=e,this.parser=t,this.tag=t.tag,this.dataOffset=t.Offset32,this.dataLength=t.uint32}getData(){return this.parser.currentField=this.tableStart+this.dataOffset,this.parser.readBytes(this.dataLength)}}var jc=Object.freeze({__proto__:null,meta:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint32,this.flags=s.uint32,s.uint32,this.dataMapsCount=s.uint32,this.dataMaps=[...new Array(this.dataMapsCount)].map((e=>new Sc(this.tableStart,s)))}}});var Cc=Object.freeze({__proto__:null,PCLT:class extends ho{constructor(e,t){super(e,t),console.warn("This font uses a PCLT table, which is currently not supported by this parser."),console.warn("If you need this table parsed, please file an issue, or better yet, a PR.")}}});class kc{constructor(e){this.bCharSet=e.uint8,this.xRatio=e.uint8,this.yStartRatio=e.uint8,this.yEndRatio=e.uint8}}class Ec{constructor(e){this.recs=e.uint16,this.startsz=e.uint8,this.endsz=e.uint8,this.records=[...new Array(this.recs)].map((t=>new Pc(e)))}}class Pc{constructor(e){this.yPelHeight=e.uint16,this.yMax=e.int16,this.yMin=e.int16}}var Ic=Object.freeze({__proto__:null,VDMX:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.uint16,this.numRecs=s.uint16,this.numRatios=s.uint16,this.ratRanges=[...new Array(this.numRatios)].map((e=>new kc(s))),this.offsets=[...new Array(this.numRatios)].map((e=>s.Offset16)),this.VDMXGroups=[...new Array(this.numRecs)].map((e=>new Ec(s)))}}});var Tc=Object.freeze({__proto__:null,vhea:class extends ho{constructor(e,t){const{p:s}=super(e,t);this.version=s.fixed,this.ascent=this.vertTypoAscender=s.int16,this.descent=this.vertTypoDescender=s.int16,this.lineGap=this.vertTypoLineGap=s.int16,this.advanceHeightMax=s.int16,this.minTopSideBearing=s.int16,this.minBottomSideBearing=s.int16,this.yMaxExtent=s.int16,this.caretSlopeRise=s.int16,this.caretSlopeRun=s.int16,this.caretOffset=s.int16,this.reserved=s.int16,this.reserved=s.int16,this.reserved=s.int16,this.reserved=s.int16,this.metricDataFormat=s.int16,this.numOfLongVerMetrics=s.uint16,s.verifyLength()}}});class Oc{constructor(e,t){this.advanceHeight=e,this.topSideBearing=t}}var Ac=Object.freeze({__proto__:null,vmtx:class extends ho{constructor(e,t,s){super(e,t);const n=s.vhea.numOfLongVerMetrics,i=s.maxp.numGlyphs,r=p.currentPosition;if(lazy(this,"vMetrics",(()=>(p.currentPosition=r,[...new Array(n)].map((e=>new Oc(p.uint16,p.int16)))))),n(p.currentPosition=e,[...new Array(i-n)].map((e=>p.int16)))))}}}});const{kebabCase:Mc}=se(x.privateApis);const Nc=function(){const{installFonts:e,notice:t,setNotice:s}=(0,d.useContext)(Br),[n,i]=(0,d.useState)(!1),r=async e=>{s(null),i(!0);const t=new Set,n=[...e];let r=!1;const l=n.map((async e=>{const s=await async function(e){const t=new Fo("Uploaded Font");try{const s=await a(e);return await t.fromDataBuffer(s,"font"),!0}catch(e){return!1}}(e);if(!s)return r=!0,null;if(t.has(e.name))return null;const n=e.name.split(".").pop().toLowerCase();return br.includes(n)?(t.add(e.name),e):null})),c=(await Promise.all(l)).filter((e=>null!==e));if(c.length>0)o(c);else{const e=r?(0,b.__)("Sorry, you are not allowed to upload this file type."):(0,b.__)("No fonts found to install.");s({type:"error",message:e}),i(!1)}},o=async e=>{const t=await Promise.all(e.map((async e=>{const t=await l(e);return await Ir(t,t.file,"all"),t})));c(t)};async function a(e){return new Promise(((t,s)=>{const n=new window.FileReader;n.readAsArrayBuffer(e),n.onload=()=>t(n.result),n.onerror=s}))}const l=async e=>{const t=await a(e),s=new Fo("Uploaded Font");s.fromDataBuffer(t,e.name);const n=(await new Promise((e=>s.onload=e))).detail.font,{name:i}=n.opentype.tables,r=i.get(16)||i.get(1),o=i.get(2).toLowerCase().includes("italic"),l=n.opentype.tables["OS/2"].usWeightClass||"normal",c=!!n.opentype.tables.fvar&&n.opentype.tables.fvar.axes.find((({tag:e})=>"wght"===e));return{file:e,fontFamily:r,fontStyle:o?"italic":"normal",fontWeight:(c?`${c.minValue} ${c.maxValue}`:null)||l}},c=async t=>{const n=function(e){const t=e.reduce(((e,t)=>(e[t.fontFamily]||(e[t.fontFamily]={name:t.fontFamily,fontFamily:t.fontFamily,slug:Mc(t.fontFamily.toLowerCase()),fontFace:[]}),e[t.fontFamily].fontFace.push(t),e)),{});return Object.values(t)}(t);try{await e(n),s({type:"success",message:(0,b.__)("Fonts were installed successfully.")})}catch(e){s({type:"error",message:e.message,errors:e?.installationErrors})}i(!1)};return(0,me.jsxs)("div",{className:"font-library-modal__tabpanel-layout",children:[(0,me.jsx)(x.DropZone,{onFilesDrop:e=>{r(e)}}),(0,me.jsxs)(x.__experimentalVStack,{className:"font-library-modal__local-fonts",children:[t&&(0,me.jsxs)(x.Notice,{status:t.type,__unstableHTML:!0,onRemove:()=>s(null),children:[t.message,t.errors&&(0,me.jsx)("ul",{children:t.errors.map(((e,t)=>(0,me.jsx)("li",{children:e},t)))})]}),n&&(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)("div",{className:"font-library-modal__upload-area",children:(0,me.jsx)(x.ProgressBar,{})})}),!n&&(0,me.jsx)(x.FormFileUpload,{accept:br.map((e=>`.${e}`)).join(","),multiple:!0,onChange:e=>{r(e.target.files)},render:({openFileDialog:e})=>(0,me.jsx)(x.Button,{className:"font-library-modal__upload-area",onClick:e,children:(0,b.__)("Upload font")})}),(0,me.jsx)(x.__experimentalSpacer,{margin:2}),(0,me.jsx)(x.__experimentalText,{className:"font-library-modal__upload-area__text",children:(0,b.__)("Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.")})]})]})},{Tabs:Fc}=se(x.privateApis),Vc={id:"installed-fonts",title:(0,b._x)("Library","Font library")},Rc={id:"upload-fonts",title:(0,b.__)("Upload")};const Bc=function({onRequestClose:e,defaultTabId:t="installed-fonts"}){const{collections:s,setNotice:n}=(0,d.useContext)(Br),i=(0,l.useSelect)((e=>{const{canUser:t}=e(_.store);return t("create","font-families")}),[]),r=[Vc];return i&&(r.push(Rc),r.push(...(e=>e.map((({slug:t,name:s})=>({id:t,title:1===e.length&&"google-fonts"===t?(0,b.__)("Install Fonts"):s}))))(s||[]))),(0,me.jsx)(x.Modal,{title:(0,b.__)("Fonts"),onRequestClose:e,isFullScreen:!0,className:"font-library-modal",children:(0,me.jsx)("div",{className:"font-library-modal__tabs",children:(0,me.jsxs)(Fc,{defaultTabId:t,onSelect:()=>{n(null)},children:[(0,me.jsx)(Fc.TabList,{children:r.map((({id:e,title:t})=>(0,me.jsx)(Fc.Tab,{tabId:e,children:t},e)))}),r.map((({id:e})=>{let t;switch(e){case"upload-fonts":t=(0,me.jsx)(Nc,{});break;case"installed-fonts":t=(0,me.jsx)(Kr,{});break;default:t=(0,me.jsx)(to,{slug:e})}return(0,me.jsx)(Fc.TabPanel,{tabId:e,focusable:!1,children:t},e)}))]})})})};const Dc=function({font:e}){const{handleSetLibraryFontSelected:t,setModalTabOpen:s}=(0,d.useContext)(Br),n=e?.fontFace?.length||1,i=ii(e);return(0,me.jsx)(x.__experimentalItem,{onClick:()=>{t(e),s("installed-fonts")},children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.FlexItem,{style:i,children:e.name}),(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles-screen-typography__font-variants-count",children:(0,b.sprintf)((0,b._n)("%d variant","%d variants",n),n)})]})})},{useGlobalSetting:Lc}=se(y.privateApis);function zc(){const{modalTabOpen:e,setModalTabOpen:t}=(0,d.useContext)(Br),[s]=Lc("typography.fontFamilies"),n=s?.theme?s.theme.map((e=>Cr(e,{source:"theme"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],i=s?.custom?s.custom.map((e=>Cr(e,{source:"custom"}))).sort(((e,t)=>e.name.localeCompare(t.name))):[],r=0t(null),defaultTabId:e}),(0,me.jsxs)(x.__experimentalVStack,{spacing:2,children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(Li,{level:3,children:(0,b.__)("Fonts")}),(0,me.jsx)(x.Button,{onClick:()=>t("installed-fonts"),label:(0,b.__)("Manage fonts"),icon:pr,size:"small"})]}),r?(0,me.jsxs)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:[i.map((e=>(0,me.jsx)(Dc,{font:e},e.slug))),n.map((e=>(0,me.jsx)(Dc,{font:e},e.slug)))]}):(0,me.jsxs)(me.Fragment,{children:[(0,b.__)("No fonts installed."),(0,me.jsx)(x.Button,{className:"edit-site-global-styles-font-families__add-fonts",variant:"secondary",onClick:()=>t("upload-fonts"),children:(0,b.__)("Add fonts")})]})]})]})}const Gc=({...e})=>(0,me.jsx)(Dr,{children:(0,me.jsx)(zc,{...e})});const Hc=function(){const e=(0,l.useSelect)((e=>e(h.store).getEditorSettings().fontLibraryEnabled),[]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Typography"),description:(0,b.__)("Typography styles and the application of those styles on site elements.")}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:7,children:[!window.__experimentalDisableFontLibrary&&e&&(0,me.jsx)(Gc,{}),(0,me.jsx)(ar,{}),(0,me.jsx)(hr,{title:(0,b.__)("Presets")})]})})]})},{useGlobalStyle:Uc,useGlobalSetting:Wc,useSettingsForBlockElement:qc,TypographyPanel:Zc}=se(y.privateApis);function Kc({element:e,headingLevel:t}){let s=[];"heading"===e?s=s.concat(["elements",t]):e&&"text"!==e&&(s=s.concat(["elements",e]));const n=s.join("."),[i]=Uc(n,void 0,"user",{shouldDecodeEncode:!1}),[r,o]=Uc(n,void 0,"all",{shouldDecodeEncode:!1}),[a]=Wc(""),l=qc(a,void 0,"heading"===e?t:e);return(0,me.jsx)(Zc,{inheritedValue:r,value:i,onChange:o,settings:l})}const{useGlobalStyle:Yc}=se(y.privateApis);function Xc({name:e,element:t,headingLevel:s}){var n;let i="";"heading"===t?i=`elements.${s}.`:t&&"text"!==t&&(i=`elements.${t}.`);const[r]=Yc(i+"typography.fontFamily",e),[o]=Yc(i+"color.gradient",e),[a]=Yc(i+"color.background",e),[l]=Yc("color.background"),[c]=Yc(i+"color.text",e),[u]=Yc(i+"typography.fontSize",e),[d]=Yc(i+"typography.fontStyle",e),[h]=Yc(i+"typography.fontWeight",e),[p]=Yc(i+"typography.letterSpacing",e),f="link"===t?{textDecoration:"underline"}:{};return(0,me.jsx)("div",{className:"edit-site-typography-preview",style:{fontFamily:null!=r?r:"serif",background:null!==(n=null!=o?o:a)&&void 0!==n?n:l,color:c,fontSize:u,fontStyle:d,fontWeight:h,letterSpacing:p,...f},children:"Aa"})}const Jc={text:{description:(0,b.__)("Manage the fonts used on the site."),title:(0,b.__)("Text")},link:{description:(0,b.__)("Manage the fonts and typography used on the links."),title:(0,b.__)("Links")},heading:{description:(0,b.__)("Manage the fonts and typography used on headings."),title:(0,b.__)("Headings")},caption:{description:(0,b.__)("Manage the fonts and typography used on captions."),title:(0,b.__)("Captions")},button:{description:(0,b.__)("Manage the fonts and typography used on buttons."),title:(0,b.__)("Buttons")}};const Qc=function({element:e}){const[t,s]=(0,d.useState)("heading");return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:Jc[e].title,description:Jc[e].description}),(0,me.jsx)(x.__experimentalSpacer,{marginX:4,children:(0,me.jsx)(Xc,{element:e,headingLevel:t})}),"heading"===e&&(0,me.jsx)(x.__experimentalSpacer,{marginX:4,marginBottom:"1em",children:(0,me.jsxs)(x.__experimentalToggleGroupControl,{label:(0,b.__)("Select heading level"),hideLabelFromVision:!0,value:t,onChange:s,isBlock:!0,size:"__unstable-large",__nextHasNoMarginBottom:!0,children:[(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"heading",label:(0,b._x)("All","heading levels")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h1",label:(0,b.__)("H1")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h2",label:(0,b.__)("H2")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h3",label:(0,b.__)("H3")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h4",label:(0,b.__)("H4")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h5",label:(0,b.__)("H5")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"h6",label:(0,b.__)("H6")})]})}),(0,me.jsx)(Kc,{element:e,headingLevel:t})]})};const $c=(0,d.forwardRef)((function({icon:e,size:t=24,...s},n){return(0,d.cloneElement)(e,{width:t,height:t,...s,ref:n})})),eu=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/SVG",children:(0,me.jsx)(us.Path,{d:"M17.192 6.75L15.47 5.03l1.06-1.06 3.537 3.53-3.537 3.53-1.06-1.06 1.723-1.72h-3.19c-.602 0-.993.202-1.28.498-.309.319-.538.792-.695 1.383-.13.488-.222 1.023-.296 1.508-.034.664-.116 1.413-.303 2.117-.193.721-.513 1.467-1.068 2.04-.575.594-1.359.954-2.357.954H4v-1.5h4.003c.601 0 .993-.202 1.28-.498.308-.319.538-.792.695-1.383.149-.557.216-1.093.288-1.662l.039-.31a9.653 9.653 0 0 1 .272-1.653c.193-.722.513-1.467 1.067-2.04.576-.594 1.36-.954 2.358-.954h3.19zM8.004 6.75c.8 0 1.46.23 1.988.628a6.24 6.24 0 0 0-.684 1.396 1.725 1.725 0 0 0-.024-.026c-.287-.296-.679-.498-1.28-.498H4v-1.5h4.003zM12.699 14.726c-.161.459-.38.94-.684 1.396.527.397 1.188.628 1.988.628h3.19l-1.722 1.72 1.06 1.06L20.067 16l-3.537-3.53-1.06 1.06 1.723 1.72h-3.19c-.602 0-.993-.202-1.28-.498a1.96 1.96 0 0 1-.024-.026z"})});const tu=function({className:e,...t}){return(0,me.jsx)(x.Flex,{className:Qt("edit-site-global-styles__color-indicator-wrapper",e),...t})},{useGlobalSetting:su}=se(y.privateApis),nu=[];const iu=function({name:e}){const[t]=su("color.palette.custom"),[s]=su("color.palette.theme"),[n]=su("color.palette.default"),[i]=su("color.defaultPalette",e),[r]=function(e){const[t,s]=ce("color.palette.theme",e);return window.__experimentalEnableColorRandomizer?[function(){const e=Math.floor(225*Math.random()),n=t.map((t=>{const{color:s}=t,n=Y(s).rotate(e).toHex();return{...t,color:n}}));s(n)}]:[]}(),o=(0,d.useMemo)((()=>[...t||nu,...s||nu,...n&&i?n:nu]),[t,s,n,i]),a=e?"/blocks/"+encodeURIComponent(e)+"/colors/palette":"/colors/palette",l=o.length>0?(0,b.__)("Edit palette"):(0,b.__)("Add colors");return(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(Li,{level:3,children:(0,b.__)("Palette")}),(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:(0,me.jsx)(qn,{path:a,"aria-label":l,children:(0,me.jsxs)(x.__experimentalHStack,{direction:"row",children:[o.length<=0&&(0,me.jsx)(x.FlexItem,{children:(0,b.__)("Add colors")}),(0,me.jsx)(x.__experimentalZStack,{isLayered:!1,offset:-8,children:o.slice(0,5).map((({color:e},t)=>(0,me.jsx)(tu,{children:(0,me.jsx)(x.ColorIndicator,{colorValue:e})},`${e}-${t}`)))}),(0,me.jsx)($c,{icon:(0,b.isRTL)()?Gn:Hn})]})})}),window.__experimentalEnableColorRandomizer&&s?.length>0&&(0,me.jsx)(x.Button,{variant:"secondary",icon:eu,onClick:r,children:(0,b.__)("Randomize colors")})]})},{useGlobalStyle:ru,useGlobalSetting:ou,useSettingsForBlockElement:au,ColorPanel:lu}=se(y.privateApis);const cu=function(){const[e]=ru("",void 0,"user",{shouldDecodeEncode:!1}),[t,s]=ru("",void 0,"all",{shouldDecodeEncode:!1}),[n]=ou(""),i=au(n);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Colors"),description:(0,b.__)("Palette colors and the application of those colors on site elements.")}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:7,children:[(0,me.jsx)(iu,{}),(0,me.jsx)(lu,{inheritedValue:t,value:e,onChange:s,settings:i})]})})]})};function uu(){const{paletteColors:e}=de();return e.slice(0,5).map((({slug:e,color:t},s)=>(0,me.jsx)("div",{style:{flexGrow:1,height:"100%",background:t}},`${e}-${s}`)))}const du={start:{scale:1,opacity:1},hover:{scale:0,opacity:0}},hu=({label:e,isFocused:t,withHoverView:s})=>(0,me.jsx)(gi,{label:e,isFocused:t,withHoverView:s,children:({key:e})=>(0,me.jsx)(x.__unstableMotion.div,{variants:du,style:{height:"100%",overflow:"hidden"},children:(0,me.jsx)(x.__experimentalHStack,{spacing:0,justify:"center",style:{height:"100%",overflow:"hidden"},children:(0,me.jsx)(uu,{})})},e)});function pu({title:e,gap:t=2}){const s=he();return s?.length<=1?null:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[e&&(0,me.jsx)(Li,{level:3,children:e}),(0,me.jsx)(x.__experimentalGrid,{spacing:t,children:s.map(((e,t)=>(0,me.jsx)(dr,{variation:e,isPill:!0,property:"color",children:()=>(0,me.jsx)(hu,{})},t)))})]})}const{useGlobalSetting:fu}=se(y.privateApis),mu={placement:"bottom-start",offset:8};function gu({name:e}){const[t,s]=fu("color.palette.theme",e),[n]=fu("color.palette.theme",e,"base"),[i,r]=fu("color.palette.default",e),[o]=fu("color.palette.default",e,"base"),[a,l]=fu("color.palette.custom",e),[c]=fu("color.defaultPalette",e),u=(0,v.useViewportMatch)("small","<")?mu:void 0;return(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-global-styles-color-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:t!==n,canOnlyChangeValues:!0,colors:t,onChange:s,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:u}),!!i&&!!i.length&&!!c&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,colors:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelHeadingLevel:3,popoverProps:u}),(0,me.jsx)(x.__experimentalPaletteEdit,{colors:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelHeadingLevel:3,slugPrefix:"custom-",popoverProps:u}),(0,me.jsx)(pu,{title:(0,b.__)("Palettes")})]})}const{useGlobalSetting:vu}=se(y.privateApis),yu={placement:"bottom-start",offset:8},xu=()=>{};function bu({name:e}){const[t,s]=vu("color.gradients.theme",e),[n]=vu("color.gradients.theme",e,"base"),[i,r]=vu("color.gradients.default",e),[o]=vu("color.gradients.default",e,"base"),[a,l]=vu("color.gradients.custom",e),[c]=vu("color.defaultGradients",e),[u]=vu("color.duotone.custom")||[],[d]=vu("color.duotone.default")||[],[h]=vu("color.duotone.theme")||[],[p]=vu("color.defaultDuotone"),f=[...u||[],...h||[],...d&&p?d:[]],m=(0,v.useViewportMatch)("small","<")?yu:void 0;return(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-global-styles-gradient-palette-panel",spacing:8,children:[!!t&&!!t.length&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:t!==n,canOnlyChangeValues:!0,gradients:t,onChange:s,paletteLabel:(0,b.__)("Theme"),paletteLabelHeadingLevel:3,popoverProps:m}),!!i&&!!i.length&&!!c&&(0,me.jsx)(x.__experimentalPaletteEdit,{canReset:i!==o,canOnlyChangeValues:!0,gradients:i,onChange:r,paletteLabel:(0,b.__)("Default"),paletteLabelLevel:3,popoverProps:m}),(0,me.jsx)(x.__experimentalPaletteEdit,{gradients:a,onChange:l,paletteLabel:(0,b.__)("Custom"),paletteLabelLevel:3,slugPrefix:"custom-",popoverProps:m}),!!f&&!!f.length&&(0,me.jsxs)("div",{children:[(0,me.jsx)(Li,{level:3,children:(0,b.__)("Duotone")}),(0,me.jsx)(x.__experimentalSpacer,{margin:3}),(0,me.jsx)(x.DuotonePicker,{duotonePalette:f,disableCustomDuotone:!0,disableCustomColors:!0,clearable:!1,onChange:xu})]})]})}const{Tabs:wu}=se(x.privateApis);const _u=function({name:e}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Edit palette"),description:(0,b.__)("The combination of colors used across the site and in color pickers.")}),(0,me.jsxs)(wu,{children:[(0,me.jsxs)(wu.TabList,{children:[(0,me.jsx)(wu.Tab,{tabId:"color",children:(0,b.__)("Color")}),(0,me.jsx)(wu.Tab,{tabId:"gradient",children:(0,b.__)("Gradient")})]}),(0,me.jsx)(wu.TabPanel,{tabId:"color",focusable:!1,children:(0,me.jsx)(gu,{name:e})}),(0,me.jsx)(wu.TabPanel,{tabId:"gradient",focusable:!1,children:(0,me.jsx)(bu,{name:e})})]})]})},Su=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"})}),{useGlobalSetting:ju}=se(y.privateApis),Cu="6px 6px 9px rgba(0, 0, 0, 0.2)";function ku(){const[e]=ju("shadow.presets.default"),[t]=ju("shadow.defaultPresets"),[s]=ju("shadow.presets.theme"),[n,i]=ju("shadow.presets.custom");return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Shadows"),description:(0,b.__)("Manage and create shadow styles for use across the site.")}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen",children:(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-global-styles__shadows-panel",spacing:7,children:[t&&(0,me.jsx)(Eu,{label:(0,b.__)("Default"),shadows:e||[],category:"default"}),s&&s.length>0&&(0,me.jsx)(Eu,{label:(0,b.__)("Theme"),shadows:s||[],category:"theme"}),(0,me.jsx)(Eu,{label:(0,b.__)("Custom"),shadows:n||[],category:"custom",canCreate:!0,onCreate:e=>{i([...n||[],e])}})]})})]})}function Eu({label:e,shadows:t,category:s,canCreate:n,onCreate:i}){const r=()=>{const e=function(e,t){const s=new RegExp(`^${t}([\\d]+)$`),n=e.reduce(((e,t)=>{if("string"==typeof t?.slug){const n=t?.slug.match(s);if(n){const t=parseInt(n[1],10);if(t>e)return t}}return e}),0);return n+1}(t,"shadow-");i({name:(0,b.sprintf)((0,b.__)("Shadow %s"),e),shadow:Cu,slug:`shadow-${e}`})};return(0,me.jsxs)(x.__experimentalVStack,{spacing:2,children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,me.jsx)(Li,{level:3,children:e})}),n&&(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,me.jsx)(x.Button,{size:"small",icon:Su,label:(0,b.__)("Add shadow"),onClick:()=>{r()}})})]}),t.length>0&&(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:t.map((e=>(0,me.jsx)(Pu,{shadow:e,category:s},e.slug)))})]})}function Pu({shadow:e,category:t}){return(0,me.jsx)(qn,{path:`/shadows/edit/${t}/${e.slug}`,"aria-label":(0,b.sprintf)("Edit shadow %s",e.name),icon:Yn,children:e.name})}const Iu=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M7 11.5h10V13H7z"})}),Tu={px:{max:20,step:1},"%":{max:100,step:1},vw:{max:100,step:1},vh:{max:100,step:1},em:{max:10,step:.1},rm:{max:10,step:.1},svw:{max:100,step:1},lvw:{max:100,step:1},dvw:{max:100,step:1},svh:{max:100,step:1},lvh:{max:100,step:1},dvh:{max:100,step:1},vi:{max:100,step:1},svi:{max:100,step:1},lvi:{max:100,step:1},dvi:{max:100,step:1},vb:{max:100,step:1},svb:{max:100,step:1},lvb:{max:100,step:1},dvb:{max:100,step:1},vmin:{max:100,step:1},svmin:{max:100,step:1},lvmin:{max:100,step:1},dvmin:{max:100,step:1},vmax:{max:100,step:1},svmax:{max:100,step:1},lvmax:{max:100,step:1},dvmax:{max:100,step:1}};const{useGlobalSetting:Ou}=se(y.privateApis),{DropdownMenuV2:Au,DropdownMenuItemV2:Mu,DropdownMenuItemLabelV2:Nu}=se(x.privateApis),Fu=[{label:(0,b.__)("Rename"),action:"rename"},{label:(0,b.__)("Delete"),action:"delete"}],Vu=[{label:(0,b.__)("Reset"),action:"reset"}];function Ru(){const{params:{category:e,slug:t},goTo:s}=(0,x.__experimentalUseNavigator)(),[n,i]=Ou(`shadow.presets.${e}`),[r]=Ou(`shadow.presets.${e}`,void 0,"base"),[o,a]=(0,d.useState)((()=>(n||[]).find((e=>e.slug===t)))),l=(0,d.useMemo)((()=>(r||[]).find((e=>e.slug===t))),[r,t]),[c,u]=(0,d.useState)(!1),[h,p]=(0,d.useState)(!1),[f,m]=(0,d.useState)(o.name);return o?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(Pi,{title:o.name}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.__experimentalSpacer,{marginTop:2,marginBottom:0,paddingX:4,children:(0,me.jsx)(Au,{trigger:(0,me.jsx)(x.Button,{size:"small",icon:zn,label:(0,b.__)("Menu")}),children:("custom"===e?Fu:Vu).map((e=>(0,me.jsx)(Mu,{onClick:()=>(e=>{if("reset"===e){const e=n.map((e=>e.slug===t?l:e));a(l),i(e)}else"delete"===e?u(!0):"rename"===e&&p(!0)})(e.action),disabled:"reset"===e.action&&o.shadow===l.shadow,children:(0,me.jsx)(Nu,{children:e.label})},e.action)))})})})]}),(0,me.jsxs)("div",{className:"edit-site-global-styles-screen",children:[(0,me.jsx)(Bu,{shadow:o.shadow}),(0,me.jsx)(Du,{shadow:o.shadow,onChange:e=>{a({...o,shadow:e});const s=n.map((s=>s.slug===t?{...o,shadow:e}:s));i(s)}})]}),c&&(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{(()=>{const e=n.filter((e=>e.slug!==t));i(e),s("/shadows")})(),u(!1)},onCancel:()=>{u(!1)},confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.sprintf)('Are you sure you want to delete "%s"?',o.name)}),h&&(0,me.jsx)(x.Modal,{title:(0,b.__)("Rename"),onRequestClose:()=>p(!1),size:"small",children:(0,me.jsxs)("form",{onSubmit:e=>{e.preventDefault(),(e=>{if(!e)return;const s=n.map((s=>s.slug===t?{...o,name:e}:s));a({...o,name:e}),i(s)})(f),p(!1)},children:[(0,me.jsx)(x.__experimentalInputControl,{autoComplete:"off",label:(0,b.__)("Name"),placeholder:(0,b.__)("Shadow name"),value:f,onChange:e=>m(e)}),(0,me.jsx)(x.__experimentalSpacer,{marginBottom:6}),(0,me.jsxs)(x.Flex,{className:"block-editor-shadow-edit-modal__actions",justify:"flex-end",expanded:!1,children:[(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{variant:"tertiary",onClick:()=>p(!1),children:(0,b.__)("Cancel")})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{variant:"primary",type:"submit",children:(0,b.__)("Save")})})]})]})})]}):(0,me.jsx)(Pi,{title:""})}function Bu({shadow:e}){const t={boxShadow:e};return(0,me.jsx)(x.__experimentalSpacer,{marginBottom:4,marginTop:-2,children:(0,me.jsx)(x.__experimentalHStack,{align:"center",justify:"center",className:"edit-site-global-styles__shadow-preview-panel",children:(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-preview-block",style:t})})})}function Du({shadow:e,onChange:t}){const s=(0,d.useMemo)((()=>function(e){return(e.match(/(?:[^,(]|\([^)]*\))+/g)||[]).map((e=>e.trim()))}(e)),[e]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalVStack,{spacing:2,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(x.Flex,{align:"center",className:"edit-site-global-styles__shadows-panel__title",children:(0,me.jsx)(Li,{level:3,children:(0,b.__)("Shadows")})}),(0,me.jsx)(x.FlexItem,{className:"edit-site-global-styles__shadows-panel__options-container",children:(0,me.jsx)(x.Button,{size:"small",icon:Su,label:(0,b.__)("Add shadow"),onClick:()=>{s.push(Cu),t(s.join(", "))}})})]})}),(0,me.jsx)(x.__experimentalSpacer,{}),(0,me.jsx)(x.__experimentalItemGroup,{isBordered:!0,isSeparated:!0,children:s.map(((e,n)=>(0,me.jsx)(Lu,{shadow:e,onChange:e=>((e,n)=>{s[e]=n,t(s.join(", "))})(n,e),canRemove:s.length>1,onRemove:()=>(e=>{s.splice(e,1),t(s.join(", "))})(n)},n)))})]})}function Lu({shadow:e,onChange:t,canRemove:s,onRemove:n}){const i=(0,d.useMemo)((()=>function(e){const t={x:"0",y:"0",blur:"0",spread:"0",color:"#000",inset:!1};if(!e)return t;if(e.includes("none"))return t;const s=/((?:^|\s+)(-?\d*\.?\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\s|$)(?![^(]*\))){1,4}/g,n=e.match(s)||[];if(1!==n.length)return t;const i=n[0].split(" ").map((e=>e.trim())).filter((e=>e));if(i.length<2)return t;const r=e.match(/inset/gi)||[];if(r.length>1)return t;const o=1===r.length;let a=e.replace(s,"").trim();o&&(a=a.replace("inset","").replace("INSET","").trim());let l=(a.match(/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\(?[\d*\.?\d+%?,?\/?\s]*\)$/gi)||[]).map((e=>e?.trim())).filter((e=>e));if(l.length>1)return t;if(0===l.length&&(l=a.trim().split(" ").filter((e=>e)),l.length>1))return t;const[c,u,d,h]=i;return{x:c,y:u,blur:d||t.blur,spread:h||t.spread,inset:o,color:a||t.color}}(e)),[e]),r=e=>{t(function(e){const t=`${e.x||"0px"} ${e.y||"0px"} ${e.blur||"0px"} ${e.spread||"0px"}`;return`${e.inset?"inset":""} ${t} ${e.color||""}`.trim()}(e))};return(0,me.jsx)(x.Dropdown,{popoverProps:{placement:"left-start",offset:36,shift:!0},className:"edit-site-global-styles__shadow-editor__dropdown",renderToggle:({onToggle:e,isOpen:t})=>{const r={onClick:e,className:Qt("edit-site-global-styles__shadow-editor__dropdown-toggle",{"is-open":t}),"aria-expanded":t},o={onClick:n,className:Qt("edit-site-global-styles__shadow-editor__remove-button",{"is-open":t}),ariaLabel:(0,b.__)("Remove shadow"),tooltip:(0,b.__)("Remove shadow")};return(0,me.jsxs)(x.__experimentalHStack,{align:"center",justify:"flex-start",spacing:0,children:[(0,me.jsx)(x.FlexItem,{style:{flexGrow:1},children:(0,me.jsx)(x.Button,{icon:Yn,...r,children:i.inset?(0,b.__)("Inner shadow"):(0,b.__)("Drop shadow")})}),s&&(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{icon:Iu,...o})})]})},renderContent:()=>(0,me.jsx)(x.__experimentalDropdownContentWrapper,{paddingSize:"none",children:(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-editor__dropdown-content",children:(0,me.jsx)(zu,{shadowObj:i,onChange:r})})})})}function zu({shadowObj:e,onChange:t}){const s=(s,n)=>{const i={...e,[s]:n};t(i)};return(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-editor-panel",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:2,children:[(0,me.jsx)(x.__experimentalHeading,{level:5,children:(0,b.__)("Shadow")}),(0,me.jsx)("div",{className:"edit-site-global-styles__shadow-editor-color-palette",children:(0,me.jsx)(x.ColorPalette,{clearable:!1,enableAlpha:!0,__experimentalIsRenderedInSidebar:!0,value:e.color,onChange:e=>s("color",e)})}),(0,me.jsxs)(x.__experimentalToggleGroupControl,{value:e.inset?"inset":"outset",isBlock:!0,onChange:e=>s("inset","inset"===e),hideLabelFromVision:!0,__next40pxDefaultSize:!0,children:[(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"outset",label:(0,b.__)("Outset")}),(0,me.jsx)(x.__experimentalToggleGroupControlOption,{value:"inset",label:(0,b.__)("Inset")})]}),(0,me.jsxs)(x.__experimentalGrid,{columns:2,gap:4,children:[(0,me.jsx)(Gu,{label:(0,b.__)("X Position"),value:e.x,hasNegativeRange:!0,onChange:e=>s("x",e)}),(0,me.jsx)(Gu,{label:(0,b.__)("Y Position"),value:e.y,hasNegativeRange:!0,onChange:e=>s("y",e)}),(0,me.jsx)(Gu,{label:(0,b.__)("Blur"),value:e.blur,onChange:e=>s("blur",e)}),(0,me.jsx)(Gu,{label:(0,b.__)("Spread"),value:e.spread,hasNegativeRange:!0,onChange:e=>s("spread",e)})]})]})})}function Gu({label:e,value:t,onChange:s,hasNegativeRange:n}){var i,r,o;const[a,l]=(0,d.useState)(!1),[c,u]=(0,x.__experimentalParseQuantityAndUnitFromRawValue)(t);return(0,me.jsxs)(x.__experimentalVStack,{justify:"flex-start",children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",children:[(0,me.jsx)(Li,{children:e}),(0,me.jsx)(x.Button,{label:(0,b.__)("Use custom size"),icon:pr,onClick:()=>{l(!a)},isPressed:a,size:"small"})]}),a?(0,me.jsx)(x.__experimentalUnitControl,{label:e,hideLabelFromVision:!0,__next40pxDefaultSize:!0,value:t,onChange:e=>{const t=void 0!==e&&!isNaN(parseFloat(e));s(t?e:"0px")}}):(0,me.jsx)(x.RangeControl,{value:null!=c?c:0,onChange:e=>{s(void 0!==e?[e,u||"px"].join(""):"0px")},withInputField:!1,__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,min:n?-(null!==(i=Tu[null!=u?u:"px"]?.max)&&void 0!==i?i:10):0,max:null!==(r=Tu[null!=u?u:"px"]?.max)&&void 0!==r?r:10,step:null!==(o=Tu[null!=u?u:"px"]?.step)&&void 0!==o?o:.1})]})}function Hu(){return(0,me.jsx)(ku,{})}function Uu(){return(0,me.jsx)(Ru,{})}const{useGlobalStyle:Wu,useGlobalSetting:qu,useSettingsForBlockElement:Zu,DimensionsPanel:Ku}=se(y.privateApis),Yu={contentSize:!0,wideSize:!0,padding:!0,margin:!0,blockGap:!0,minHeight:!0,childLayout:!1};function Xu(){const[e]=Wu("",void 0,"user",{shouldDecodeEncode:!1}),[t,s]=Wu("",void 0,"all",{shouldDecodeEncode:!1}),[n]=qu("",void 0,"user"),[i,r]=qu(""),o=Zu(i),a=(0,d.useMemo)((()=>({...t,layout:o.layout})),[t,o.layout]),l=(0,d.useMemo)((()=>({...e,layout:n.layout})),[e,n.layout]);return(0,me.jsx)(Ku,{inheritedValue:a,value:l,onChange:e=>{const t={...e};if(delete t.layout,s(t),e.layout!==n.layout){const t={...n,layout:e.layout};t.layout?.definitions&&delete t.layout.definitions,r(t)}},settings:o,includeLayoutControls:!0,defaultControls:Yu})}const Ju={backgroundSize:"auto"},{useGlobalStyle:Qu,useGlobalSetting:$u,useGlobalStyleLinks:ed,BackgroundPanel:td}=se(y.privateApis);function sd(e){return!!e?.background?.backgroundImage?.id||!!e?.background?.backgroundImage?.url||"string"==typeof e?.background?.backgroundImage}function nd(){const[e]=Qu("",void 0,"user",{shouldDecodeEncode:!1}),[t,s]=Qu("",void 0,"all",{shouldDecodeEncode:!1}),n=ed(),[i]=$u(""),r={backgroundImage:!0,backgroundSize:sd(e)||sd(t)};return(0,me.jsx)(td,{inheritedValue:t,value:e,onChange:s,settings:i,defaultValues:Ju,defaultControls:r,themeFileURIs:n?.["wp:theme-file"]})}const{useHasBackgroundPanel:id,useHasDimensionsPanel:rd,useGlobalSetting:od,useSettingsForBlockElement:ad}=se(y.privateApis);const ld=function(){const[e]=od(""),t=ad(e),s=rd(t),n=id(t);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Layout")}),s&&(0,me.jsx)(Xu,{}),n&&(0,me.jsx)(nd,{})]})},{GlobalStylesContext:cd}=se(y.privateApis);function ud({gap:e=2}){const{user:t}=(0,d.useContext)(cd),[s,n]=(0,d.useState)(t),i=s?.styles;(0,d.useEffect)((()=>{n(t)}),[t]);const r=(0,l.useSelect)((e=>e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()),[]),o=r?.filter((e=>!le(e,"color")&&!le(e,"typography"))),a=(0,d.useMemo)((()=>[...[{title:(0,b.__)("Default"),settings:{},styles:{}},...null!=o?o:[]].map((e=>{var t;const s={...e?.styles?.blocks}||{};i?.blocks&&Object.keys(i.blocks).forEach((e=>{if(i.blocks[e].css){const t=s[e]||{},n={css:`${s[e]?.css||""} ${i.blocks[e].css.trim()||""}`};s[e]={...t,...n}}}));const n=i?.css||e.styles?.css?{css:`${e.styles?.css||""} ${i?.css||""}`}:{},r=Object.keys(s).length>0?{blocks:s}:{},o={...e.styles,...n,...r};return{...e,settings:null!==(t=e.settings)&&void 0!==t?t:{},styles:o}}))]),[o,i?.blocks,i?.css]);return(0,me.jsx)(x.__experimentalGrid,{columns:2,className:"edit-site-global-styles-style-variations-container",gap:e,children:a.map(((e,t)=>(0,me.jsx)(dr,{variation:e,children:t=>(0,me.jsx)(wi,{label:e?.title,withHoverView:!0,isFocused:t,variation:e})},t)))})}const dd=function(){return(0,y.useZoomOut)(),(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("Browse styles"),description:(0,b.__)("Choose a variation to change the look of the site.")}),(0,me.jsx)(x.Card,{size:"small",isBorderless:!0,className:"edit-site-global-styles-screen-style-variations",children:(0,me.jsx)(x.CardBody,{children:(0,me.jsx)(ud,{})})})]})},hd=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})}),{EditorContentSlotFill:pd,ResizableEditor:fd}=se(h.privateApis);function md(e){switch(e){case"style-book":return(0,b.__)("Style Book");case"global-styles-revisions":case"global-styles-revisions:style-book":return(0,b.__)("Style Revisions");default:return""}}const gd=function({children:e,closeButtonLabel:t,onClose:s,enableResizing:n=!1}){const{editorCanvasContainerView:i,showListViewByDefault:r}=(0,l.useSelect)((e=>({editorCanvasContainerView:se(e(Kt)).getEditorCanvasContainerView(),showListViewByDefault:e(f.store).get("core","showListViewByDefault")})),[]),[o,a]=(0,d.useState)(!1),{setEditorCanvasContainerView:c}=se((0,l.useDispatch)(Kt)),{setIsListViewOpened:u}=(0,l.useDispatch)(h.store),p=(0,v.useFocusOnMount)("firstElement"),m=(0,v.useFocusReturn)();function g(){u(r),c(void 0),a(!0),"function"==typeof s&&s()}const y=Array.isArray(e)?d.Children.map(e,((e,t)=>0===t?(0,d.cloneElement)(e,{ref:m}):e)):(0,d.cloneElement)(e,{ref:m});if(o)return null;const w=md(i),_=s||t;return(0,me.jsx)(pd.Fill,{children:(0,me.jsx)("div",{className:"edit-site-editor-canvas-container",children:(0,me.jsx)(fd,{enableResizing:n,children:(0,me.jsxs)("section",{className:"edit-site-editor-canvas-container__section",ref:_?p:null,onKeyDown:function(e){e.keyCode!==hs.ESCAPE||e.defaultPrevented||(e.preventDefault(),g())},"aria-label":w,children:[_&&(0,me.jsx)(x.Button,{className:"edit-site-editor-canvas-container__close-button",icon:hd,label:t||(0,b.__)("Close"),onClick:g}),y]})})})})},{ExperimentalBlockEditorProvider:vd,useGlobalStyle:yd,GlobalStylesContext:xd,useGlobalStylesOutputWithConfig:bd}=se(y.privateApis),{mergeBaseAndUserConfigs:wd}=se(h.privateApis),{CompositeV2:_d,CompositeItemV2:Sd,useCompositeStoreV2:jd,Tabs:Cd}=se(x.privateApis);function kd(e){return!e||0===Object.keys(e).length}function Ed(){return[{name:"core/heading",title:(0,b.__)("Headings"),category:"text",blocks:[(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:1}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:2}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:3}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:4}),(0,o.createBlock)("core/heading",{content:(0,b.__)("Code Is Poetry"),level:5})]},...(0,o.getBlockTypes)().filter((e=>{const{name:t,example:s,supports:n}=e;return"core/heading"!==t&&!!s&&!1!==n.inserter})).map((e=>({name:e.name,title:e.title,category:e.category,blocks:(0,o.getBlockFromExample)(e.name,e.example)})))]}const Pd=({category:e,examples:t,isSelected:s,onClick:n,onSelect:i,settings:r,sizes:o,title:a})=>{const[l,c]=(0,d.useState)(!1),u={role:"button",onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:e=>{if(e.defaultPrevented)return;const{keyCode:t}=e;!n||t!==hs.ENTER&&t!==hs.SPACE||(e.preventDefault(),n(e))},onClick:e=>{e.defaultPrevented||n&&(e.preventDefault(),n(e))},readonly:!0},h=n?"body { cursor: pointer; } body * { pointer-events: none; }":"";return(0,me.jsxs)(y.__unstableIframe,{className:Qt("edit-site-style-book__iframe",{"is-focused":l&&!!n,"is-button":!!n}),name:"style-book-canvas",tabIndex:0,...n?u:{},children:[(0,me.jsx)(y.__unstableEditorStyles,{styles:r.styles}),(0,me.jsx)("style",{children:'.is-root-container { display: flow-root; }\n\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n'+h}),(0,me.jsx)(Id,{className:Qt("edit-site-style-book__examples",{"is-wide":o.width>600}),examples:t,category:e,label:a?(0,b.sprintf)((0,b.__)("Examples of blocks in the %s category"),a):(0,b.__)("Examples of blocks"),isSelected:s,onSelect:i},e)]})},Id=(0,d.memo)((({className:e,examples:t,category:s,label:n,isSelected:i,onSelect:r})=>{const o=jd({orientation:"vertical"});return(0,me.jsx)(_d,{store:o,className:e,"aria-label":n,role:"grid",children:t.filter((e=>!s||e.category===s)).map((e=>(0,me.jsx)(Td,{id:`example-${e.name}`,title:e.title,blocks:e.blocks,isSelected:i(e.name),onClick:()=>{r?.(e.name)}},e.name)))})})),Td=({id:e,title:t,blocks:s,isSelected:n,onClick:i})=>{const r=(0,l.useSelect)((e=>e(y.store).getSettings()),[]),o=(0,d.useMemo)((()=>({...r,focusMode:!1,__unstableIsPreviewMode:!0})),[r]),a=(0,d.useMemo)((()=>Array.isArray(s)?s:[s]),[s]);return(0,me.jsx)("div",{role:"row",children:(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsxs)(Sd,{className:Qt("edit-site-style-book__example",{"is-selected":n}),id:e,"aria-label":(0,b.sprintf)((0,b.__)("Open %s styles in Styles panel"),t),render:(0,me.jsx)("div",{}),role:"button",onClick:i,children:[(0,me.jsx)("span",{className:"edit-site-style-book__example-title",children:t}),(0,me.jsx)("div",{className:"edit-site-style-book__example-preview","aria-hidden":!0,children:(0,me.jsx)(x.Disabled,{className:"edit-site-style-book__example-preview__content",children:(0,me.jsx)(vd,{value:a,settings:o,children:(0,me.jsx)(y.BlockList,{renderAppender:!1})})})})]})})})},Od=function({enableResizing:e=!0,isSelected:t,onClick:s,onSelect:n,showCloseButton:i=!0,onClose:r,showTabs:a=!0,userConfig:c={}}){const[u,h]=(0,v.useResizeObserver)(),[p]=yd("color.text"),[f]=yd("color.background"),[m]=(0,d.useState)(Ed),g=(0,d.useMemo)((()=>(0,o.getCategories)().filter((e=>m.some((t=>t.category===e.slug)))).map((e=>({name:e.slug,title:e.title,icon:e.icon})))),[m]),{base:x}=(0,d.useContext)(xd),w=(0,d.useMemo)((()=>kd(c)||kd(x)?{}:wd(x,c)),[x,c]),_=(0,l.useSelect)((e=>e(y.store).getSettings()),[]),S=(0,d.useMemo)((()=>({..._,__unstableIsPreviewMode:!0})),[_]),[j]=bd(w);return S.styles=kd(j)||kd(c)?S.styles:j,(0,me.jsx)(gd,{onClose:r,enableResizing:e,closeButtonLabel:i?(0,b.__)("Close"):null,children:(0,me.jsxs)("div",{className:Qt("edit-site-style-book",{"is-wide":h.width>600,"is-button":!!s}),style:{color:p,background:f},children:[u,a?(0,me.jsx)("div",{className:"edit-site-style-book__tabs",children:(0,me.jsxs)(Cd,{children:[(0,me.jsx)(Cd.TabList,{children:g.map((e=>(0,me.jsx)(Cd.Tab,{tabId:e.name,children:e.title},e.name)))}),g.map((e=>(0,me.jsx)(Cd.TabPanel,{tabId:e.name,focusable:!1,children:(0,me.jsx)(Pd,{category:e.name,examples:m,isSelected:t,onSelect:n,settings:S,sizes:h,title:e.title})},e.name)))]})}):(0,me.jsx)(Pd,{examples:m,isSelected:t,onClick:s,onSelect:n,settings:S,sizes:h})]})})},{useGlobalStyle:Ad,AdvancedPanel:Md}=se(y.privateApis);const Nd=function(){const e=(0,b.__)("Add your own CSS to customize the appearance and layout of your site."),[t]=Ad("",void 0,"user",{shouldDecodeEncode:!1}),[s,n]=Ad("",void 0,"all",{shouldDecodeEncode:!1});return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:(0,b.__)("CSS"),description:(0,me.jsxs)(me.Fragment,{children:[e,(0,me.jsx)(x.ExternalLink,{href:"https://developer.wordpress.org/advanced-administration/wordpress/css/",className:"edit-site-global-styles-screen-css-help-link",children:(0,b.__)("Learn more about CSS")})]})}),(0,me.jsx)("div",{className:"edit-site-global-styles-screen-css",children:(0,me.jsx)(Md,{value:t,onChange:n,inheritedValue:s})})]})},{ExperimentalBlockEditorProvider:Fd,GlobalStylesContext:Vd,useGlobalStylesOutputWithConfig:Rd}=se(y.privateApis),{mergeBaseAndUserConfigs:Bd}=se(h.privateApis);function Dd(e){return!e||0===Object.keys(e).length}const Ld=function({userConfig:e,blocks:t}){const{base:s}=(0,d.useContext)(Vd),n=(0,d.useMemo)((()=>Dd(e)||Dd(s)?{}:Bd(s,e)),[s,e]),i=(0,d.useMemo)((()=>Array.isArray(t)?t:[t]),[t]),r=(0,l.useSelect)((e=>e(y.store).getSettings()),[]),o=(0,d.useMemo)((()=>({...r,__unstableIsPreviewMode:!0})),[r]),[a]=Rd(n),c=Dd(a)||Dd(e)?o.styles:a;return(0,me.jsx)(gd,{title:(0,b.__)("Revisions"),closeButtonLabel:(0,b.__)("Close revisions"),enableResizing:!0,children:(0,me.jsxs)(y.__unstableIframe,{className:"edit-site-revisions__iframe",name:"revisions",tabIndex:0,children:[(0,me.jsx)(y.__unstableEditorStyles,{styles:c}),(0,me.jsx)("style",{children:".is-root-container { display: flow-root; }"}),(0,me.jsx)(x.Disabled,{className:"edit-site-revisions__example-preview__content",children:(0,me.jsx)(Fd,{value:i,settings:o,children:(0,me.jsx)(y.BlockList,{renderAppender:!1})})})]})})},zd={per_page:-1,_fields:"id,name,avatar_urls",context:"view",capabilities:["edit_theme_options"]},Gd={per_page:100,page:1},Hd=[],{GlobalStylesContext:Ud}=se(y.privateApis);function Wd({query:e}={}){const{user:t}=(0,d.useContext)(Ud),s={...Gd,...e},{authors:n,currentUser:i,isDirty:r,revisions:o,isLoadingGlobalStylesRevisions:a,revisionsCount:c}=(0,l.useSelect)((e=>{var t;const{__experimentalGetDirtyEntityRecords:n,getCurrentUser:i,getUsers:r,getRevisions:o,__experimentalGetCurrentGlobalStylesId:a,getEntityRecord:l,isResolving:c}=e(_.store),u=n(),d=i(),h=u.length>0,p=a(),f=p?l("root","globalStyles",p):void 0,m=null!==(t=f?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0,g=o("root","globalStyles",p,s)||Hd;return{authors:r(zd)||Hd,currentUser:d,isDirty:h,revisions:g,isLoadingGlobalStylesRevisions:c("getRevisions",["root","globalStyles",p,s]),revisionsCount:m}}),[e]);return(0,d.useMemo)((()=>{if(!n.length||a)return{revisions:Hd,hasUnsavedChanges:r,isLoading:!0,revisionsCount:c};const e=o.map((e=>({...e,author:n.find((t=>t.id===e.author))})));if(o.length){if("unsaved"!==e[0].id&&1===s.page&&(e[0].isLatest=!0),r&&t&&Object.keys(t).length>0&&i&&1===s.page){const s={id:"unsaved",styles:t?.styles,settings:t?.settings,_links:t?._links,author:{name:i?.name,avatar_urls:i?.avatar_urls},modified:new Date};e.unshift(s)}s.page===Math.ceil(c/s.per_page)&&e.push({id:"parent",styles:{},settings:{}})}return{revisions:e,hasUnsavedChanges:r,isLoading:!1,revisionsCount:c}}),[r,o,i,n,t,a])}const qd=window.wp.date,{getGlobalStylesChanges:Zd}=se(y.privateApis);function Kd({revision:e,previousRevision:t}){const s=Zd(e,t,{maxResults:7});return s.length?(0,me.jsx)("ul",{"data-testid":"global-styles-revision-changes",className:"edit-site-global-styles-screen-revisions__changes",children:s.map((e=>(0,me.jsx)("li",{children:e},e)))}):null}const Yd=function({userRevisions:e,selectedRevisionId:t,onChange:s,canApplyRevision:n,onApplyRevision:i}){const{currentThemeName:r,currentUser:o}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getCurrentUser:s}=e(_.store),n=t();return{currentThemeName:n?.name?.rendered||n?.stylesheet,currentUser:s()}}),[]),a=(0,qd.getDate)().getTime(),{datetimeAbbreviated:c}=(0,qd.getSettings)().formats;return(0,me.jsx)("ol",{className:"edit-site-global-styles-screen-revisions__revisions-list","aria-label":(0,b.__)("Global styles revisions list"),role:"group",children:e.map(((l,u)=>{const{id:d,author:h,modified:p}=l,f="unsaved"===d,m=f?o:h,g=m?.name||(0,b.__)("User"),v=m?.avatar_urls?.[48],y=t?t===d:0===u,w=!n&&y,_="parent"===d,S=(0,qd.getDate)(p),j=p&&a-S.getTime()>864e5?(0,qd.dateI18n)(c,S):(0,qd.humanTimeDiff)(p),C=function(e,t,s,n){return"parent"===e?(0,b.__)("Reset the styles to the theme defaults"):"unsaved"===e?(0,b.sprintf)((0,b.__)("Unsaved changes by %s"),t):n?(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s. This revision matches current editor styles."),t,s):(0,b.sprintf)((0,b.__)("Changes saved by %1$s on %2$s"),t,s)}(d,g,(0,qd.dateI18n)(c,S),w);return(0,me.jsxs)("li",{className:Qt("edit-site-global-styles-screen-revisions__revision-item",{"is-selected":y,"is-active":w,"is-reset":_}),"aria-current":y,children:[(0,me.jsx)(x.Button,{className:"edit-site-global-styles-screen-revisions__revision-button",__experimentalIsFocusable:!0,disabled:y,onClick:()=>{s(l)},"aria-label":C,children:_?(0,me.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[(0,b.__)("Default styles"),(0,me.jsx)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:r})]}):(0,me.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__description",children:[f?(0,me.jsx)("span",{className:"edit-site-global-styles-screen-revisions__date",children:(0,b.__)("(Unsaved)")}):(0,me.jsx)("time",{className:"edit-site-global-styles-screen-revisions__date",dateTime:p,children:j}),(0,me.jsxs)("span",{className:"edit-site-global-styles-screen-revisions__meta",children:[(0,me.jsx)("img",{alt:g,src:v}),g]}),y&&(0,me.jsx)(Kd,{revision:l,previousRevision:us(1),__experimentalIsFocusable:!0,disabled:r||1===e,label:(0,b.__)("First page"),icon:Xd,size:"compact"}),(0,me.jsx)(x.Button,{variant:o,onClick:()=>s(e-1),__experimentalIsFocusable:!0,disabled:r||1===e,label:(0,b.__)("Previous page"),icon:Gn,size:"compact"})]}),(0,me.jsx)(x.__experimentalText,{variant:"muted",children:(0,b.sprintf)((0,b._x)("%1$s of %2$s","paging"),e,t)}),(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,me.jsx)(x.Button,{variant:o,onClick:()=>s(e+1),__experimentalIsFocusable:!0,disabled:r||e===t,label:(0,b.__)("Next page"),icon:Hn,size:"compact"}),(0,me.jsx)(x.Button,{variant:o,onClick:()=>s(t),__experimentalIsFocusable:!0,disabled:r||e===t,label:(0,b.__)("Last page"),icon:Jd,size:"compact"})]})]})}const{GlobalStylesContext:$d,areGlobalStyleConfigsEqual:eh}=se(y.privateApis);const th=function(){const{goTo:e}=(0,x.__experimentalUseNavigator)(),{user:t,setUserConfig:s}=(0,d.useContext)($d),{blocks:n,editorCanvasContainerView:i}=(0,l.useSelect)((e=>({editorCanvasContainerView:se(e(Kt)).getEditorCanvasContainerView(),blocks:e(y.store).getBlocks()})),[]),[r,o]=(0,d.useState)(1),[a,c]=(0,d.useState)([]),{revisions:u,isLoading:h,hasUnsavedChanges:p,revisionsCount:f}=Wd({query:{per_page:10,page:r}}),m=Math.ceil(f/10),[g,v]=(0,d.useState)(t),[w,_]=(0,d.useState)(!1),{setEditorCanvasContainerView:S}=se((0,l.useDispatch)(Kt)),j=eh(g,t),C=()=>{e("/");S("global-styles-revisions:style-book"===i?"style-book":void 0)},k=e=>{s((()=>e)),_(!1),C()};(0,d.useEffect)((()=>{i&&i.startsWith("global-styles-revisions")||e("/")}),[i]),(0,d.useEffect)((()=>{!h&&u.length&&c(u)}),[u,h]);const E=u[0],P=g?.id,I=!!E?.id&&!j&&!P;(0,d.useEffect)((()=>{I&&v(E)}),[I,E]);const T=!!P&&"unsaved"!==P&&!j,O=!!a.length;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(Pi,{title:f&&(0,b.sprintf)((0,b.__)("Revisions (%s)"),f),description:(0,b.__)('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'),onBack:C}),!O&&(0,me.jsx)(x.Spinner,{className:"edit-site-global-styles-screen-revisions__loading"}),O&&("global-styles-revisions:style-book"===i?(0,me.jsx)(Od,{userConfig:g,isSelected:()=>{},onClose:()=>{S("global-styles-revisions")}}):(0,me.jsx)(Ld,{blocks:n,userConfig:g,closeButtonLabel:(0,b.__)("Close revisions")})),(0,me.jsx)(Yd,{onChange:v,selectedRevisionId:P,userRevisions:a,canApplyRevision:T,onApplyRevision:()=>p?_(!0):k(g)}),m>1&&(0,me.jsx)("div",{className:"edit-site-global-styles-screen-revisions__footer",children:(0,me.jsx)(Qd,{className:"edit-site-global-styles-screen-revisions__pagination",currentPage:r,numPages:m,changePage:o,totalItems:f,disabled:h,label:(0,b.__)("Global Styles pagination navigation")})}),w&&(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:w,confirmButtonText:(0,b.__)("Apply"),onConfirm:()=>k(g),onCancel:()=>_(!1),size:"medium",children:(0,b.__)("Are you sure you want to apply this revision? Any unsaved changes will be lost.")})]})},{useGlobalStylesReset:sh}=se(y.privateApis),{Slot:nh,Fill:ih}=(0,x.createSlotFill)("GlobalStylesMenu");function rh(){const[e,t]=sh(),{toggle:s}=(0,l.useDispatch)(f.store),{canEditCSS:n}=(0,l.useSelect)((e=>{const{getEntityRecord:t,__experimentalGetCurrentGlobalStylesId:s}=e(_.store),n=s(),i=n?t("root","globalStyles",n):void 0;return{canEditCSS:!!i?._links?.["wp:action-edit-css"]}}),[]),{setEditorCanvasContainerView:i}=se((0,l.useDispatch)(Kt)),{goTo:r}=(0,x.__experimentalUseNavigator)(),o=()=>{i("global-styles-css"),r("/css")};return(0,me.jsx)(ih,{children:(0,me.jsx)(x.DropdownMenu,{icon:zn,label:(0,b.__)("More"),toggleProps:{size:"compact"},children:({onClose:i})=>(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.MenuGroup,{children:[n&&(0,me.jsx)(x.MenuItem,{onClick:o,children:(0,b.__)("Additional CSS")}),(0,me.jsx)(x.MenuItem,{onClick:()=>{s("core/edit-site","welcomeGuideStyles"),i()},children:(0,b.__)("Welcome Guide")})]}),(0,me.jsx)(x.MenuGroup,{children:(0,me.jsx)(x.MenuItem,{onClick:()=>{t(),i()},disabled:!e,children:(0,b.__)("Reset styles")})})]})})})}function oh({className:e,...t}){return(0,me.jsx)(x.__experimentalNavigatorScreen,{className:["edit-site-global-styles-sidebar__navigator-screen",e].filter(Boolean).join(" "),...t})}function ah({parentMenu:e,blockStyles:t,blockName:s}){return t.map(((t,n)=>(0,me.jsx)(oh,{path:e+"/variations/"+t.name,children:(0,me.jsx)(ir,{name:s,variation:t.name})},n)))}function lh({name:e,parentMenu:t=""}){const s=(0,l.useSelect)((t=>{const{getBlockStyles:s}=t(o.store);return s(e)}),[e]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(oh,{path:t+"/colors/palette",children:(0,me.jsx)(_u,{name:e})}),!!s?.length&&(0,me.jsx)(ah,{parentMenu:t,blockStyles:s,blockName:e})]})}function ch(){const e=(0,x.__experimentalUseNavigator)(),{path:t}=e.location;return(0,me.jsx)(Od,{isSelected:e=>t===`/blocks/${encodeURIComponent(e)}`||t.startsWith(`/blocks/${encodeURIComponent(e)}/`),onSelect:t=>{e.goTo("/blocks/"+encodeURIComponent(t))}})}function uh(){const e=(0,x.__experimentalUseNavigator)(),{selectedBlockName:t,selectedBlockClientId:s}=(0,l.useSelect)((e=>{const{getSelectedBlockClientId:t,getBlockName:s}=e(y.store),n=t();return{selectedBlockName:s(n),selectedBlockClientId:n}}),[]),n=Fi(t);(0,d.useEffect)((()=>{if(!s||!n)return;const i=e.location.path;if("/blocks"!==i&&!i.startsWith("/blocks/"))return;const r="/blocks/"+encodeURIComponent(t);r!==i&&e.goTo(r,{skipFocus:!0})}),[s,t,n])}function dh(){const{goTo:e,location:t}=(0,x.__experimentalUseNavigator)(),s=(0,l.useSelect)((e=>se(e(Kt)).getEditorCanvasContainerView()),[]),n=t?.path,i="/revisions"===n;(0,d.useEffect)((()=>{switch(s){case"global-styles-revisions":case"global-styles-revisions:style-book":e("/revisions");break;case"global-styles-css":e("/css");break;case"style-book":i&&e("/");break;default:if("/"!==n&&!i)return;e("/")}}),[s,i,e])}const hh=function(){const e=(0,o.getBlockTypes)(),t=(0,l.useSelect)((e=>se(e(Kt)).getEditorCanvasContainerView()),[]);return(0,me.jsxs)(x.__experimentalNavigatorProvider,{className:"edit-site-global-styles-sidebar__navigator-provider",initialPath:"/",children:[(0,me.jsx)(oh,{path:"/",children:(0,me.jsx)(Si,{})}),(0,me.jsx)(oh,{path:"/variations",children:(0,me.jsx)(dd,{})}),(0,me.jsx)(oh,{path:"/blocks",children:(0,me.jsx)(Bi,{})}),(0,me.jsx)(oh,{path:"/typography",children:(0,me.jsx)(Hc,{})}),(0,me.jsx)(oh,{path:"/typography/text",children:(0,me.jsx)(Qc,{element:"text"})}),(0,me.jsx)(oh,{path:"/typography/link",children:(0,me.jsx)(Qc,{element:"link"})}),(0,me.jsx)(oh,{path:"/typography/heading",children:(0,me.jsx)(Qc,{element:"heading"})}),(0,me.jsx)(oh,{path:"/typography/caption",children:(0,me.jsx)(Qc,{element:"caption"})}),(0,me.jsx)(oh,{path:"/typography/button",children:(0,me.jsx)(Qc,{element:"button"})}),(0,me.jsx)(oh,{path:"/colors",children:(0,me.jsx)(cu,{})}),(0,me.jsx)(oh,{path:"/shadows",children:(0,me.jsx)(Hu,{})}),(0,me.jsx)(oh,{path:"/shadows/edit/:category/:slug",children:(0,me.jsx)(Uu,{})}),(0,me.jsx)(oh,{path:"/layout",children:(0,me.jsx)(ld,{})}),(0,me.jsx)(oh,{path:"/css",children:(0,me.jsx)(Nd,{})}),(0,me.jsx)(oh,{path:"/revisions",children:(0,me.jsx)(th,{})}),e.map((e=>(0,me.jsx)(oh,{path:"/blocks/"+encodeURIComponent(e.name),children:(0,me.jsx)(ir,{name:e.name})},"menu-block-"+e.name))),(0,me.jsx)(lh,{}),e.map((e=>(0,me.jsx)(lh,{name:e.name,parentMenu:"/blocks/"+encodeURIComponent(e.name)},"screens-block-"+e.name))),"style-book"===t&&(0,me.jsx)(ch,{}),(0,me.jsx)(rh,{}),(0,me.jsx)(uh,{}),(0,me.jsx)(dh,{})]})},{ComplementaryArea:ph,ComplementaryAreaMoreMenuItem:fh}=se(h.privateApis);function mh({className:e,identifier:t,title:s,icon:n,children:i,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(ph,{className:e,scope:"core",identifier:t,title:s,smallScreenTitle:s,icon:n,closeLabel:r,header:o,headerClassName:a,panelClassName:l,isActiveByDefault:c,children:i}),(0,me.jsx)(fh,{scope:"core",identifier:t,icon:n,children:s})]})}const{interfaceStore:gh}=se(h.privateApis);function vh(){const{shouldClearCanvasContainerView:e,isStyleBookOpened:t,showListViewByDefault:s,hasRevisions:n,isRevisionsOpened:i,isRevisionsStyleBookOpened:r}=(0,l.useSelect)((e=>{const{getActiveComplementaryArea:t}=e(gh),{getEditorCanvasContainerView:s,getCanvasMode:n}=se(e(Kt)),i=s(),r="visual"===e(h.store).getEditorMode(),o="edit"===n(),a=e(f.store).get("core","showListViewByDefault"),{getEntityRecord:l,__experimentalGetCurrentGlobalStylesId:c}=e(_.store),u=c(),d=u?l("root","globalStyles",u):void 0;return{isStyleBookOpened:"style-book"===i,shouldClearCanvasContainerView:"edit-site/global-styles"!==t("core")||!r||!o,showListViewByDefault:a,hasRevisions:!!d?._links?.["version-history"]?.[0]?.count,isRevisionsStyleBookOpened:"global-styles-revisions:style-book"===i,isRevisionsOpened:"global-styles-revisions"===i}}),[]),{setEditorCanvasContainerView:o}=se((0,l.useDispatch)(Kt));(0,d.useEffect)((()=>{e&&o(void 0)}),[e]);const{setIsListViewOpened:a}=(0,l.useDispatch)(h.store),{goTo:c}=(0,x.__experimentalUseNavigator)();return(0,me.jsx)(mh,{className:"edit-site-global-styles-sidebar",identifier:"edit-site/global-styles",title:(0,b.__)("Styles"),icon:Ds,closeLabel:(0,b.__)("Close Styles"),panelClassName:"edit-site-global-styles-sidebar__panel",header:(0,me.jsxs)(x.Flex,{className:"edit-site-global-styles-sidebar__header",gap:1,children:[(0,me.jsx)(x.FlexBlock,{style:{minWidth:"min-content"},children:(0,me.jsx)("h2",{className:"edit-site-global-styles-sidebar__header-title",children:(0,b.__)("Styles")})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{icon:Ln,label:(0,b.__)("Style Book"),isPressed:t||r,__experimentalIsFocusable:!0,disabled:e,onClick:()=>{i?o("global-styles-revisions:style-book"):r?o("global-styles-revisions"):(a(t&&s),o(t?void 0:"style-book"))},size:"compact"})}),(0,me.jsx)(x.FlexItem,{children:(0,me.jsx)(x.Button,{label:(0,b.__)("Revisions"),icon:Us,onClick:()=>(a(!1),r?(c("/"),void o("style-book")):i?(c("/"),void o(void 0)):(c("/revisions"),void o(t?"global-styles-revisions:style-book":"global-styles-revisions"))),__experimentalIsFocusable:!0,disabled:!n,isPressed:i||r,size:"compact"})}),(0,me.jsx)(nh,{})]}),children:(0,me.jsx)(hh,{})})}const{useLocation:yh}=se(Xt.privateApis);function xh({className:e="edit-site-save-button__button",variant:t="primary",showTooltip:s=!0,showReviewMessage:n,icon:i,size:r,__next40pxDefaultSize:o=!1}){const{params:a}=yh(),{setIsSaveViewOpened:c}=(0,l.useDispatch)(Kt),{saveDirtyEntities:u}=se((0,l.useDispatch)(h.store)),{dirtyEntityRecords:d}=(0,h.useEntitiesSavedStatesIsDirty)(),{isSaving:p,isSaveViewOpen:f,previewingThemeName:m}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:t,isResolving:s}=e(_.store),{isSaveViewOpened:n}=e(Kt),i=s("activateTheme"),r=Ps();return{isSaving:d.some((e=>t(e.kind,e.name,e.key)))||i,isSaveViewOpen:n(),previewingThemeName:r?e(_.store).getTheme(r)?.name?.rendered:void 0}}),[d]),g=!!d.length;let v;1===d.length&&(a.postId?v=`${d[0].key}`===a.postId&&d[0].name===a.postType:a.path?.includes("wp_global_styles")&&(v="globalStyles"===d[0].name));const y=p||!g&&!Es(),w=Es()?p?(0,b.sprintf)((0,b.__)("Activating %s"),m):y?(0,b.__)("Saved"):g?(0,b.sprintf)((0,b.__)("Activate %s & Save"),m):(0,b.sprintf)((0,b.__)("Activate %s"),m):p?(0,b.__)("Saving"):y?(0,b.__)("Saved"):!v&&n?(0,b.sprintf)((0,b._n)("Review %d change…","Review %d changes…",d.length),d.length):(0,b.__)("Save"),S=v?()=>u({dirtyEntityRecords:d}):()=>c(!0);return(0,me.jsx)(x.Button,{variant:t,className:e,"aria-disabled":y,"aria-expanded":f,isBusy:p,onClick:y?void 0:S,label:w,shortcut:y?void 0:hs.displayShortcut.primary("s"),showTooltip:s,icon:i,__next40pxDefaultSize:o,size:r,children:w})}const bh=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"})}),wh=window.wp.blob;function _h(){const{createErrorNotice:e}=(0,l.useDispatch)(w.store);return(0,me.jsx)(x.MenuItem,{role:"menuitem",icon:bh,onClick:async function(){try{const e=await Os()({path:"/wp-block-editor/v1/export",parse:!1,headers:{Accept:"application/zip"}}),t=await e.blob(),s=e.headers.get("content-disposition").match(/=(.+)\.zip/),n=s[1]?s[1]:"edit-site-export";(0,wh.downloadBlob)(n+".zip",t,"application/zip")}catch(t){let s={};try{s=await t.json()}catch(e){}const n=s.message&&"unknown_error"!==s.code?s.message:(0,b.__)("An error occurred while creating the site export.");e(n,{type:"snackbar"})}},info:(0,b.__)("Download your theme with updated templates and styles."),children:(0,b._x)("Export","site exporter menu item")})}function Sh(){const{toggle:e}=(0,l.useDispatch)(f.store);return(0,me.jsx)(x.MenuItem,{onClick:()=>e("core/edit-site","welcomeGuide"),children:(0,b.__)("Welcome Guide")})}const{ToolsMoreMenuGroup:jh,PreferencesModal:Ch}=se(h.privateApis);function kh(){const e=(0,l.useSelect)((e=>e(_.store).getCurrentTheme().is_block_theme),[]);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(jh,{children:[e&&(0,me.jsx)(_h,{}),(0,me.jsx)(Sh,{})]}),(0,me.jsx)(Ch,{})]})}const{useLocation:Eh}=se(Xt.privateApis);const Ph=function(){const{record:e,getTitle:t,isLoaded:s}=nn();let n;var i;s&&(n=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s"),t(),null!==(i=Ue[e.type])&&void 0!==i?i:Ue[Me])),function(e){const t=Eh(),s=(0,l.useSelect)((e=>e(_.store).getEntityRecord("root","site")?.title),[]),n=(0,d.useRef)(!0);(0,d.useEffect)((()=>{n.current=!1}),[t]),(0,d.useEffect)((()=>{if(!n.current&&e&&s){const t=(0,b.sprintf)((0,b.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),(0,cs.decodeEntities)(e),(0,cs.decodeEntities)(s));document.title=t,(0,ji.speak)(e,"assertive")}}),[e,s,t])}(s&&n)},{Editor:Ih,BackButton:Th}=se(h.privateApis),{useHistory:Oh}=se(Xt.privateApis),{BlockKeyboardShortcuts:Ah}=se(a.privateApis);function Mh({isLoading:e}){const{editedPostType:t,editedPostId:s,contextPostType:n,contextPostId:i,editorMode:r,canvasMode:o,isEditingPage:a,supportsGlobalStyles:c,showIconLabels:u,editorCanvasView:p,currentPostIsTrashed:m}=(0,l.useSelect)((e=>{const{getEditedPostContext:t,getCanvasMode:s,isPage:n,getEditedPostType:i,getEditedPostId:r}=se(e(Kt)),{get:o}=e(f.store),{getCurrentTheme:a}=e(_.store),{getEditorMode:l}=e(h.store),c=t();return{editedPostType:i(),editedPostId:r(),contextPostType:c?.postId?c.postType:void 0,contextPostId:c?.postId?c.postId:void 0,editorMode:l(),canvasMode:s(),isEditingPage:n(),supportsGlobalStyles:a()?.is_block_theme,showIconLabels:o("core","showIconLabels"),editorCanvasView:se(e(Kt)).getEditorCanvasContainerView(),currentPostIsTrashed:"trash"===e(h.store).getCurrentPostAttribute("status")}}),[]);Ph();const g=Es(),y=!function(){const e=(0,x.__experimentalUseSlotFills)(pd.privateKey);return!!e?.length}(),S=function(){const{canvasMode:e,currentPostIsTrashed:t}=(0,l.useSelect)((e=>{const{getCanvasMode:t}=se(e(Kt));return{canvasMode:t(),currentPostIsTrashed:"trash"===e(h.store).getCurrentPostAttribute("status")}}),[]),{setCanvasMode:s}=se((0,l.useDispatch)(Kt)),[n,i]=(0,d.useState)(!1);(0,d.useEffect)((()=>{"edit"===e&&i(!1)}),[e]);const r={"aria-label":(0,b.__)("Edit"),"aria-disabled":t,title:null,role:"button",tabIndex:0,onFocus:()=>i(!0),onBlur:()=>i(!1),onKeyDown:e=>{const{keyCode:n}=e;n!==hs.ENTER&&n!==hs.SPACE||t||(e.preventDefault(),s("edit"))},onClick:()=>{s("edit")},onClickCapture:e=>{t&&(e.preventDefault(),e.stopPropagation())},readonly:!0};return{className:Qt("edit-site-visual-editor__editor-canvas",{"is-focused":n&&"view"===e}),..."view"===e?r:{}}}(),j="edit"===o,C="view"===o||"visual"===r,k=!!i,E=(0,v.useInstanceId)(jn,"edit-site-editor__loading-progress"),P=Fn(),I=(0,d.useMemo)((()=>[...P.styles,{css:`body{${"view"===o?"min-height: 100vh; "+(m?"":"cursor: pointer;"):""}}}`}]),[P.styles,o,m]),{setCanvasMode:T}=se((0,l.useDispatch)(Kt)),{createSuccessNotice:O}=(0,l.useDispatch)(w.store),A=Oh(),M=(0,d.useCallback)(((e,t)=>{switch(e){case"move-to-trash":case"delete-post":A.push({postType:t[0].type});break;case"duplicate-post":{const e=t[0],s="string"==typeof e.title?e.title:e.title?.rendered;O((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,cs.decodeEntities)(s)),{type:"snackbar",id:"duplicate-post-action",actions:[{label:(0,b.__)("Edit"),onClick:()=>{A.push({postId:e.id,postType:e.type,canvas:"edit"})}}]})}}}),[A,O]),N=!e;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(wn,{}),(0,me.jsx)(h.EditorKeyboardShortcutsRegister,{}),j&&(0,me.jsx)(Ah,{}),C&&(0,me.jsx)(In,{}),N?null:(0,me.jsx)(jn,{id:E}),j&&(0,me.jsx)(xn,{}),N&&(0,me.jsxs)(Ih,{postType:k?n:t,postId:k?i:s,templateId:k?s:void 0,settings:P,className:Qt("edit-site-editor__editor-interface",{"show-icon-labels":u}),styles:I,enableRegionNavigation:!1,customSaveButton:g&&(0,me.jsx)(xh,{size:"compact"}),forceDisableBlockTools:!y,title:y?void 0:md(p),iframeProps:S,onActionPerformed:M,extraSidebarPanels:!a&&(0,me.jsx)(Dn.Slot,{}),children:[j&&(0,me.jsx)(Th,{children:({length:e})=>e<=1&&(0,me.jsx)(x.Button,{label:(0,b.__)("Open Navigation"),className:"edit-site-layout__view-mode-toggle",onClick:()=>T("view"),children:(0,me.jsx)(ms,{className:"edit-site-layout__view-mode-toggle-icon"})})}),(0,me.jsx)(kh,{}),c&&(0,me.jsx)(vh,{})]})]})}const Nh=(0,d.memo)((function({view:e,onChangeView:t,paginationInfo:{totalItems:s=0,totalPages:n}}){var i;if(!s||!n)return null;const r=null!==(i=e.page)&&void 0!==i?i:1;return!!s&&1!==n&&(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,spacing:6,justify:"end",className:"dataviews-pagination",children:[(0,me.jsx)(x.__experimentalHStack,{justify:"flex-start",expanded:!1,spacing:2,className:"dataviews-pagination__page-selection",children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b._x)("Page of %s","paging"),n),{CurrentPageControl:(0,me.jsx)(x.SelectControl,{"aria-label":(0,b.__)("Current page"),value:e.page?.toString(),options:Array.from(Array(n)).map(((e,t)=>{const s=t+1;return{value:s.toString(),label:s.toString()}})),onChange:s=>{t({...e,page:+s})},size:"compact",__nextHasNoMarginBottom:!0})})}),(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,spacing:1,children:[(0,me.jsx)(x.Button,{onClick:()=>t({...e,page:r-1}),disabled:1===r,__experimentalIsFocusable:!0,label:(0,b.__)("Previous page"),icon:Gn,showTooltip:!0,size:"compact",tooltipPosition:"top"}),(0,me.jsx)(x.Button,{onClick:()=>t({...e,page:r+1}),disabled:r>=n,__experimentalIsFocusable:!0,label:(0,b.__)("Next page"),icon:Hn,showTooltip:!0,size:"compact",tooltipPosition:"top"})]})]})})),Fh=Nh,{lock:Vh,unlock:Rh}=(0,ee.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/dataviews"),Bh="is",Dh="isNot",Lh="isAny",zh="isNone",Gh="isAll",Hh="isNotAll",Uh=[Bh,Dh,Lh,zh,Gh,Hh],Wh={[Bh]:{key:"is-filter",label:(0,b.__)("Is")},[Dh]:{key:"is-not-filter",label:(0,b.__)("Is not")},[Lh]:{key:"is-any-filter",label:(0,b.__)("Is any")},[zh]:{key:"is-none-filter",label:(0,b.__)("Is none")},[Gh]:{key:"is-all-filter",label:(0,b.__)("Is all")},[Hh]:{key:"is-not-all-filter",label:(0,b.__)("Is not all")}},qh=["asc","desc"],Zh={asc:"↑",desc:"↓"},Kh={asc:"ascending",desc:"descending"},Yh={asc:(0,b.__)("Sort ascending"),desc:(0,b.__)("Sort descending")},Xh="table",Jh="grid",Qh=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z"})}),$h=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})}),ep=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})}),tp=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})}),sp=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z"})}),np=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M4.67 10.664s-2.09 1.11-2.917 1.582l.494.87 1.608-.914.002.002c.343.502.86 1.17 1.563 1.84.348.33.742.663 1.185.976L5.57 16.744l.858.515 1.02-1.701a9.1 9.1 0 0 0 4.051 1.18V19h1v-2.263a9.1 9.1 0 0 0 4.05-1.18l1.021 1.7.858-.514-1.034-1.723c.442-.313.837-.646 1.184-.977.703-.669 1.22-1.337 1.563-1.839l.002-.003 1.61.914.493-.87c-1.75-.994-2.918-1.58-2.918-1.58l-.003.005a8.29 8.29 0 0 1-.422.689 10.097 10.097 0 0 1-1.36 1.598c-1.218 1.16-3.042 2.293-5.544 2.293-2.503 0-4.327-1.132-5.546-2.293a10.099 10.099 0 0 1-1.359-1.599 8.267 8.267 0 0 1-.422-.689l-.003-.005Z"})});function ip({selection:e,onSelectionChange:t,item:s,data:n,getItemId:i,primaryField:r,disabled:o}){const a=i(s),l=!o&&e.includes(a);let c;return c=r?.getValue&&s?(0,b.sprintf)(l?(0,b.__)("Deselect item: %s"):(0,b.__)("Select item: %s"),r.getValue({item:s})):l?(0,b.__)("Select a new item"):(0,b.__)("Deselect item"),(0,me.jsx)(x.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,"aria-label":c,"aria-disabled":o,checked:l,onChange:()=>{o||t(l?n.filter((t=>{const s=i?.(t);return s!==a&&e.includes(s)})):n.filter((t=>{const s=i?.(t);return s===a||e.includes(s)})))}})}const{DropdownMenuV2:rp,DropdownMenuGroupV2:op,DropdownMenuItemV2:ap,DropdownMenuItemLabelV2:lp,kebabCase:cp}=Rh(x.privateApis);function up({action:e,onClick:t,items:s}){const n="string"==typeof e.label?e.label:e.label(s);return(0,me.jsx)(x.Button,{label:n,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t})}function dp({action:e,onClick:t,items:s}){const n="string"==typeof e.label?e.label:e.label(s);return(0,me.jsx)(ap,{onClick:t,hideOnClick:!("RenderModal"in e),children:(0,me.jsx)(lp,{children:n})})}function hp({action:e,items:t,closeModal:s}){const n="string"==typeof e.label?e.label:e.label(t);return(0,me.jsx)(x.Modal,{title:e.modalHeader||n,__experimentalHideHeader:!!e.hideModalHeader,onRequestClose:null!=s?s:()=>{},overlayClassName:`dataviews-action-modal dataviews-action-modal__${cp(e.id)}`,children:(0,me.jsx)(e.RenderModal,{items:t,closeModal:s,onActionStart:e.onActionStart,onActionPerformed:e.onActionPerformed})})}function pp({action:e,items:t,ActionTrigger:s,isBusy:n}){const[i,r]=(0,d.useState)(!1),o={action:e,onClick:()=>{r(!0)},items:t,isBusy:n};return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(s,{...o}),i&&(0,me.jsx)(hp,{action:e,items:t,closeModal:()=>r(!1)})]})}function fp({actions:e,item:t}){return(0,me.jsx)(op,{children:e.map((e=>"RenderModal"in e?(0,me.jsx)(pp,{action:e,items:[t],ActionTrigger:dp},e.id):(0,me.jsx)(dp,{action:e,onClick:()=>e.callback([t]),items:[t]},e.id)))})}function mp({item:e,actions:t,isCompact:s}){const{primaryActions:n,eligibleActions:i}=(0,d.useMemo)((()=>{const s=t.filter((t=>!t.isEligible||t.isEligible(e)));return{primaryActions:s.filter((e=>e.isPrimary&&!!e.icon)),eligibleActions:s}}),[t,e]);return s?(0,me.jsx)(gp,{item:e,actions:i}):(0,me.jsxs)(x.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-item-actions",style:{flexShrink:"0",width:"auto"},children:[!!n.length&&n.map((t=>"RenderModal"in t?(0,me.jsx)(pp,{action:t,items:[e],ActionTrigger:up},t.id):(0,me.jsx)(up,{action:t,onClick:()=>t.callback([e]),items:[e]},t.id))),(0,me.jsx)(gp,{item:e,actions:i})]})}function gp({item:e,actions:t}){return(0,me.jsx)(rp,{trigger:(0,me.jsx)(x.Button,{size:"compact",icon:zn,label:(0,b.__)("Actions"),__experimentalIsFocusable:!0,disabled:!t.length,className:"dataviews-all-actions-button"}),placement:"bottom-end",children:(0,me.jsx)(fp,{actions:t,item:e})})}function vp(e){let t=e.filterBy?.operators;return t&&Array.isArray(t)||(t=[Lh,zh]),t=t.filter((e=>Uh.includes(e))),(t.includes(Bh)||t.includes(Dh))&&(t=t.filter((e=>[Bh,Dh].includes(e)))),t}const{DropdownMenuV2:yp,DropdownMenuGroupV2:xp,DropdownMenuItemV2:bp,DropdownMenuSeparatorV2:wp}=Rh(x.privateApis);function _p(e,t){return(0,d.useMemo)((()=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))),[e,t])}function Sp({action:e,selectedItems:t,setActionWithModal:s,onMenuOpenChange:n}){const i=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]),{RenderModal:r,hideModalHeader:o}=e,a=(0,d.useCallback)((()=>{s(void 0)}),[s]),l="string"==typeof e.label?e.label:e.label(t);return(0,me.jsx)(x.Modal,{title:o?void 0:l,__experimentalHideHeader:!!o,onRequestClose:a,overlayClassName:"dataviews-action-modal",children:(0,me.jsx)(r,{items:i,closeModal:a,onActionPerformed:()=>n(!1)})})}function jp({action:e,selectedItems:t,setActionWithModal:s}){const n=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]),i="RenderModal"in e;return(0,me.jsx)(bp,{disabled:0===n.length,hideOnClick:!i,onClick:async()=>{i?s(e):await e.callback(n)},suffix:n.length>0?n.length:void 0,children:e.label},e.id)}function Cp({actions:e,selectedItems:t,setActionWithModal:s}){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(xp,{children:e.map((e=>(0,me.jsx)(jp,{action:e,selectedItems:t,setActionWithModal:s},e.id)))}),(0,me.jsx)(wp,{})]})}function kp({data:e,actions:t,selection:s,onSelectionChange:n,getItemId:i}){const r=(0,d.useMemo)((()=>t.filter((e=>e.supportsBulk))),[t]),[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(),u=(0,d.useMemo)((()=>e.filter((e=>r.some((t=>!t.isEligible||t.isEligible(e)))))),[e,r]),h=u.length,p=(0,d.useMemo)((()=>e.filter((e=>s.includes(i(e))&&u.includes(e)))),[s,e,i,u]),f=p.length===h;return 0===r.length?null:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(yp,{open:o,onOpenChange:a,label:(0,b.__)("Bulk actions"),style:{minWidth:"240px"},trigger:(0,me.jsx)(x.Button,{className:"dataviews-bulk-edit-button",__next40pxDefaultSize:!0,variant:"tertiary",size:"compact",children:p.length?(0,b.sprintf)((0,b._n)("Edit %d item","Edit %d items",p.length),p.length):(0,b.__)("Bulk edit")}),children:[(0,me.jsx)(Cp,{actions:r,setActionWithModal:c,selectedItems:p}),(0,me.jsxs)(xp,{children:[(0,me.jsx)(bp,{disabled:f,hideOnClick:!1,onClick:()=>{n(u)},suffix:h,children:(0,b.__)("Select all")}),(0,me.jsx)(bp,{disabled:0===s.length,hideOnClick:!1,onClick:()=>{n([])},children:(0,b.__)("Deselect")})]})]}),l&&(0,me.jsx)(Sp,{action:l,selectedItems:p,setActionWithModal:c,onMenuOpenChange:a})]})}const{DropdownMenuV2:Ep,DropdownMenuGroupV2:Pp,DropdownMenuItemV2:Ip,DropdownMenuRadioItemV2:Tp,DropdownMenuItemLabelV2:Op,DropdownMenuSeparatorV2:Ap}=Rh(x.privateApis);function Mp({children:e}){return d.Children.toArray(e).filter(Boolean).map(((e,t)=>(0,me.jsxs)(d.Fragment,{children:[t>0&&(0,me.jsx)(Ap,{}),e]},t)))}const Np=(0,d.forwardRef)((function({field:e,view:t,onChangeView:s,onHide:n,setOpenedFilter:i},r){const o=!1!==e.enableHiding,a=!1!==e.enableSorting,l=t.sort?.field===e.id,c=vp(e),u=!(t.filters?.some((t=>e.id===t.field))||!e.elements?.length||!c.length||e.filterBy?.isPrimary);return a||o||u?(0,me.jsx)(Ep,{align:"start",trigger:(0,me.jsxs)(x.Button,{size:"compact",className:"dataviews-view-table-header-button",ref:r,variant:"tertiary",children:[e.header,t.sort&&l&&(0,me.jsx)("span",{"aria-hidden":"true",children:Zh[t.sort.direction]})]}),style:{minWidth:"240px"},children:(0,me.jsxs)(Mp,{children:[a&&(0,me.jsx)(Pp,{children:qh.map((n=>{const i=t.sort&&l&&t.sort.direction===n,r=`${e.id}-${n}`;return(0,me.jsx)(Tp,{name:"view-table-sorting",value:r,checked:i,onChange:()=>{s({...t,sort:{field:e.id,direction:n}})},children:(0,me.jsx)(Op,{children:Yh[n]})},r)}))}),u&&(0,me.jsx)(Pp,{children:(0,me.jsx)(Ip,{prefix:(0,me.jsx)(x.Icon,{icon:sp}),onClick:()=>{i(e.id),s({...t,page:1,filters:[...t.filters||[],{field:e.id,value:void 0,operator:c[0]}]})},children:(0,me.jsx)(Op,{children:(0,b.__)("Add filter")})})}),o&&(0,me.jsx)(Ip,{prefix:(0,me.jsx)(x.Icon,{icon:np}),onClick:()=>{n(e),s({...t,hiddenFields:t.hiddenFields.concat(e.id)})},children:(0,me.jsx)(Op,{children:(0,b.__)("Hide")})})]})}):e.header}));function Fp({selection:e,onSelectionChange:t,data:s,actions:n,getItemId:i}){const r=(0,d.useMemo)((()=>s.filter((e=>n.some((t=>t.supportsBulk&&(!t.isEligible||t.isEligible(e))))))),[s,n]),o=s.filter((t=>e.includes(i(t))&&r.includes(t))),a=o.length===r.length;return(0,me.jsx)(x.CheckboxControl,{className:"dataviews-view-table-selection-checkbox",__nextHasNoMarginBottom:!0,checked:a,indeterminate:!a&&!!o.length,onChange:()=>{t(a?[]:r)},"aria-label":a?(0,b.__)("Deselect all"):(0,b.__)("Select all")})}function Vp({hasBulkActions:e,item:t,actions:s,id:n,visibleFields:i,primaryField:r,selection:o,getItemId:a,onSelectionChange:l,data:c}){const u=_p(s,t),h=u&&o.includes(n),[p,f]=(0,d.useState)(!1),m=(0,d.useRef)(!1);return(0,me.jsxs)("tr",{className:Qt("dataviews-view-table__row",{"is-selected":u&&h,"is-hovered":p,"has-bulk-actions":u}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},onTouchStart:()=>{m.current=!0},onClick:()=>{u&&(m.current||"Range"===document.getSelection()?.type||l(h?c.filter((e=>{const t=a?.(e);return t!==n&&o.includes(t)})):c.filter((e=>{const t=a?.(e);return t===n||o.includes(t)}))))},children:[e&&(0,me.jsx)("td",{className:"dataviews-view-table__checkbox-column",style:{width:"1%"},children:(0,me.jsx)("div",{className:"dataviews-view-table__cell-content-wrapper",children:(0,me.jsx)(ip,{item:t,selection:o,onSelectionChange:l,getItemId:a,data:c,primaryField:r,disabled:!u})})}),i.map((e=>(0,me.jsx)("td",{style:{width:e.width||void 0,minWidth:e.minWidth||void 0,maxWidth:e.maxWidth||void 0},children:(0,me.jsx)("div",{className:Qt("dataviews-view-table__cell-content-wrapper",{"dataviews-view-table__primary-field":r?.id===e.id}),children:e.render({item:t})})},e.id))),!!s?.length&&(0,me.jsx)("td",{className:"dataviews-view-table__actions-column",onClick:e=>e.stopPropagation(),children:(0,me.jsx)(mp,{item:t,actions:s})})]})}const Rp=function({actions:e,data:t,fields:s,getItemId:n,isLoading:i=!1,onChangeView:r,onSelectionChange:o,selection:a,setOpenedFilter:l,view:c}){const u=(0,d.useRef)(new Map),h=(0,d.useRef)(),[p,f]=(0,d.useState)(),m=function(e,t){return(0,d.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}(e,t);(0,d.useEffect)((()=>{h.current&&(h.current.focus(),h.current=void 0)}));const g=(0,d.useId)();if(p)return h.current=p,void f(void 0);const v=e=>{const t=u.current.get(e.id),s=t?u.current.get(t.fallback):void 0;f(s?.node)},y=s.filter((e=>!c.hiddenFields.includes(e.id)&&![c.layout.mediaField].includes(e.id))),w=!!t?.length,_=s.find((e=>e.id===c.layout.primaryField));return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)("table",{className:"dataviews-view-table","aria-busy":i,"aria-describedby":g,children:[(0,me.jsx)("thead",{children:(0,me.jsxs)("tr",{className:"dataviews-view-table__row",children:[m&&(0,me.jsx)("th",{className:"dataviews-view-table__checkbox-column",style:{width:"1%"},"data-field-id":"selection",scope:"col",children:(0,me.jsx)(Fp,{selection:a,onSelectionChange:o,data:t,actions:e,getItemId:n})}),y.map(((e,t)=>(0,me.jsx)("th",{style:{width:e.width||void 0,minWidth:e.minWidth||void 0,maxWidth:e.maxWidth||void 0},"data-field-id":e.id,"aria-sort":c.sort?.field===e.id?Kh[c.sort.direction]:void 0,scope:"col",children:(0,me.jsx)(Np,{ref:s=>{s?u.current.set(e.id,{node:s,fallback:y[t>0?t-1:1]?.id}):u.current.delete(e.id)},field:e,view:c,onChangeView:r,onHide:v,setOpenedFilter:l})},e.id))),!!e?.length&&(0,me.jsx)("th",{"data-field-id":"actions",className:"dataviews-view-table__actions-column",children:(0,me.jsx)("span",{className:"dataviews-view-table-header",children:(0,b.__)("Actions")})})]})}),(0,me.jsx)("tbody",{children:w&&t.map(((s,i)=>(0,me.jsx)(Vp,{item:s,hasBulkActions:m,actions:e,id:n(s)||i.toString(),visibleFields:y,primaryField:_,selection:a,getItemId:n,onSelectionChange:o,data:t},n(s))))})]}),(0,me.jsx)("div",{className:Qt({"dataviews-loading":i,"dataviews-no-results":!w&&!i}),id:g,children:!w&&(0,me.jsx)("p",{children:i?(0,me.jsx)(x.Spinner,{}):(0,b.__)("No results")})})]})};function Bp({selection:e,data:t,onSelectionChange:s,getItemId:n,item:i,actions:r,mediaField:o,primaryField:a,visibleFields:l,badgeFields:c,columnFields:u}){const d=_p(r,i),h=n(i),p=e.includes(h);return(0,me.jsxs)(x.__experimentalVStack,{spacing:0,className:Qt("dataviews-view-grid__card",{"is-selected":d&&p}),onClickCapture:i=>{if(i.ctrlKey||i.metaKey){if(i.stopPropagation(),i.preventDefault(),!d)return;s(p?t.filter((t=>{const s=n?.(t);return s!==h&&e.includes(s)})):t.filter((t=>{const s=n?.(t);return s===h||e.includes(s)})))}},children:[(0,me.jsx)("div",{className:"dataviews-view-grid__media",children:o?.render({item:i})}),(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",className:"dataviews-view-grid__title-actions",children:[(0,me.jsx)(ip,{item:i,selection:e,onSelectionChange:s,getItemId:n,data:t,primaryField:a,disabled:!d}),(0,me.jsx)(x.__experimentalHStack,{className:"dataviews-view-grid__primary-field",children:a?.render({item:i})}),(0,me.jsx)(mp,{item:i,actions:r,isCompact:!0})]}),!!c?.length&&(0,me.jsx)(x.__experimentalHStack,{className:"dataviews-view-grid__badge-fields",spacing:2,wrap:!0,alignment:"top",justify:"flex-start",children:c.map((e=>{const t=e.render({item:i});return t?(0,me.jsx)(x.FlexItem,{className:"dataviews-view-grid__field-value",children:t},e.id):null}))}),!!l?.length&&(0,me.jsx)(x.__experimentalVStack,{className:"dataviews-view-grid__fields",spacing:3,children:l.map((e=>{const t=e.render({item:i});return t?(0,me.jsx)(x.Flex,{className:Qt("dataviews-view-grid__field",u?.includes(e.id)?"is-column":"is-row"),gap:1,justify:"flex-start",expanded:!0,style:{height:"auto"},direction:u?.includes(e.id)?"column":"row",children:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.FlexItem,{className:"dataviews-view-grid__field-name",children:e.header}),(0,me.jsx)(x.FlexItem,{className:"dataviews-view-grid__field-value",style:{maxHeight:"none"},children:t})]})},e.id):null}))})]},h)}const{useCompositeStoreV2:Dp,CompositeV2:Lp,CompositeItemV2:zp,CompositeRowV2:Gp,DropdownMenuV2:Hp}=Rh(x.privateApis);function Up({actions:e,id:t,isSelected:s,item:n,mediaField:i,onSelect:r,primaryField:o,store:a,visibleFields:l}){const c=(0,d.useRef)(null),u=`${t}-label`,h=`${t}-description`,[p,f]=(0,d.useState)(!1);(0,d.useEffect)((()=>{s&&c.current?.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})}),[s]);const{primaryAction:m,eligibleActions:g}=(0,d.useMemo)((()=>{const t=e.filter((e=>!e.isEligible||e.isEligible(n))),s=t.filter((e=>e.isPrimary&&!!e.icon));return{primaryAction:s?.[0],eligibleActions:t}}),[e,n]),[v,y]=(0,d.useState)(!1),w=m&&("string"==typeof m.label?m.label:m.label([n]));return(0,me.jsx)(Gp,{ref:c,render:(0,me.jsx)("li",{}),role:"row",className:Qt({"is-selected":s,"is-hovered":p}),onMouseEnter:()=>{f(!0)},onMouseLeave:()=>{f(!1)},children:(0,me.jsxs)(x.__experimentalHStack,{className:"dataviews-view-list__item-wrapper",alignment:"center",spacing:0,children:[(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(zp,{store:a,render:(0,me.jsx)("div",{}),role:"button",id:t,"aria-pressed":s,"aria-labelledby":u,"aria-describedby":h,className:"dataviews-view-list__item",onClick:()=>r(n),children:(0,me.jsxs)(x.__experimentalHStack,{spacing:3,justify:"start",alignment:"flex-start",children:[(0,me.jsx)("div",{className:"dataviews-view-list__media-wrapper",children:i?.render({item:n})||(0,me.jsx)("div",{className:"dataviews-view-list__media-placeholder"})}),(0,me.jsxs)(x.__experimentalVStack,{spacing:0,children:[(0,me.jsx)("span",{className:"dataviews-view-list__primary-field",id:u,children:o?.render({item:n})}),(0,me.jsx)("div",{className:"dataviews-view-list__fields",id:h,children:l.map((e=>(0,me.jsxs)("div",{className:"dataviews-view-list__field",children:[(0,me.jsx)(x.VisuallyHidden,{as:"span",className:"dataviews-view-list__field-label",children:e.header}),(0,me.jsx)("span",{className:"dataviews-view-list__field-value",children:e.render({item:n})})]},e.id)))})]})]})})}),g?.length>0&&(0,me.jsxs)(x.__experimentalHStack,{spacing:1,justify:"flex-end",className:"dataviews-view-list__item-actions",style:{flexShrink:"0",width:"auto"},children:[m&&"RenderModal"in m&&(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(zp,{store:a,render:(0,me.jsx)(x.Button,{label:w,icon:m.icon,isDestructive:m.isDestructive,size:"compact",onClick:()=>y(!0)}),children:v&&(0,me.jsx)(hp,{action:m,items:[n],closeModal:()=>y(!1)})})}),m&&!("RenderModal"in m)&&(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(zp,{store:a,render:(0,me.jsx)(x.Button,{label:w,icon:m.icon,isDestructive:m.isDestructive,size:"compact",onClick:()=>m.callback([n])})})},m.id),(0,me.jsx)("div",{role:"gridcell",children:(0,me.jsx)(Hp,{trigger:(0,me.jsx)(zp,{store:a,render:(0,me.jsx)(x.Button,{size:"compact",icon:zn,label:(0,b.__)("Actions"),__experimentalIsFocusable:!0,disabled:!e.length,onKeyDown:e=>{"ArrowDown"===e.key&&(e.preventDefault(),a.move(a.down())),"ArrowUp"===e.key&&(e.preventDefault(),a.move(a.up()))}})}),placement:"bottom-end",children:(0,me.jsx)(fp,{actions:g,item:n})})})]})]})})}const Wp=[{type:Xh,label:(0,b.__)("Table"),component:Rp,icon:Qh},{type:Jh,label:(0,b.__)("Grid"),component:function({actions:e,data:t,fields:s,getItemId:n,isLoading:i,onSelectionChange:r,selection:o,view:a}){const l=s.find((e=>e.id===a.layout.mediaField)),c=s.find((e=>e.id===a.layout.primaryField)),{visibleFields:u,badgeFields:d}=s.reduce(((e,t)=>{if(a.hiddenFields.includes(t.id)||[a.layout.mediaField,a.layout.primaryField].includes(t.id))return e;return e[a.layout.badgeFields?.includes(t.id)?"badgeFields":"visibleFields"].push(t),e}),{visibleFields:[],badgeFields:[]}),h=!!t?.length;return(0,me.jsxs)(me.Fragment,{children:[h&&(0,me.jsx)(x.__experimentalGrid,{gap:8,columns:2,alignment:"top",className:"dataviews-view-grid","aria-busy":i,children:t.map((s=>(0,me.jsx)(Bp,{selection:o,data:t,onSelectionChange:r,getItemId:n,item:s,actions:e,mediaField:l,primaryField:c,visibleFields:u,badgeFields:d,columnFields:a.layout.columnFields},n(s))))}),!h&&(0,me.jsx)("div",{className:Qt({"dataviews-loading":i,"dataviews-no-results":!i}),children:(0,me.jsx)("p",{children:i?(0,me.jsx)(x.Spinner,{}):(0,b.__)("No results")})})]})},icon:$h},{type:"list",label:(0,b.__)("List"),component:function e(t){const{actions:s,data:n,fields:i,getItemId:r,isLoading:o,onSelectionChange:a,selection:l,view:c}=t,u=(0,v.useInstanceId)(e,"view-list"),h=n?.findLast((e=>l.includes(r(e)))),p=i.find((e=>e.id===c.layout.mediaField)),f=i.find((e=>e.id===c.layout.primaryField)),m=i.filter((e=>!c.hiddenFields.includes(e.id)&&![c.layout.primaryField,c.layout.mediaField].includes(e.id))),g=(0,d.useCallback)((e=>a([e])),[a]),y=(0,d.useCallback)((e=>e?`${u}-${r(e)}`:void 0),[u,r]),w=Dp({defaultActiveId:y(h)}),_=w.useState((e=>e.items.some((t=>t.id===e.activeId))));(0,d.useEffect)((()=>{_||(w.down()?w.move(w.down()):w.up()&&w.move(w.up()))}),[_]);const S=n?.length;return S?(0,me.jsx)(Lp,{id:u,render:(0,me.jsx)("ul",{}),className:"dataviews-view-list",role:"grid",store:w,children:n.map((e=>{const t=y(e);return(0,me.jsx)(Up,{id:t,actions:s,item:e,isSelected:e===h,onSelect:g,mediaField:p,primaryField:f,store:w,visibleFields:m},t)}))}):(0,me.jsx)("div",{className:Qt({"dataviews-loading":o,"dataviews-no-results":!S&&!o}),children:!S&&(0,me.jsx)("p",{children:o?(0,me.jsx)(x.Spinner,{}):(0,b.__)("No results")})})},icon:(0,b.isRTL)()?ep:tp}],{DropdownMenuV2:qp,DropdownMenuGroupV2:Zp,DropdownMenuItemV2:Kp,DropdownMenuRadioItemV2:Yp,DropdownMenuCheckboxItemV2:Xp,DropdownMenuItemLabelV2:Jp}=Rh(x.privateApis);function Qp({view:e,onChangeView:t,supportedLayouts:s}){let n=Wp;if(s&&(n=n.filter((e=>s.includes(e.type)))),1===n.length)return null;const i=n.find((t=>e.type===t.type));return(0,me.jsx)(qp,{trigger:(0,me.jsx)(Kp,{suffix:(0,me.jsx)("span",{"aria-hidden":"true",children:i?.label}),children:(0,me.jsx)(Jp,{children:(0,b.__)("Layout")})}),children:n.map((s=>(0,me.jsx)(Yp,{value:s.type,name:"view-actions-available-view",checked:s.type===e.type,hideOnClick:!0,onChange:s=>{switch(s.target.value){case"list":case"grid":case"table":return t({...e,type:s.target.value,layout:{}})}throw new Error("Invalid dataview")},children:(0,me.jsx)(Jp,{children:s.label})},s.type)))})}const $p=[10,20,50,100];function ef({view:e,onChangeView:t}){return(0,me.jsx)(qp,{trigger:(0,me.jsx)(Kp,{suffix:(0,me.jsx)("span",{"aria-hidden":"true",children:e.perPage}),children:(0,me.jsx)(Jp,{children:(0,b.__)("Items per page")})}),children:$p.map((s=>(0,me.jsx)(Yp,{value:s,name:"view-actions-page-size",checked:e.perPage===s,onChange:()=>{t({...e,perPage:s,page:1})},children:(0,me.jsx)(Jp,{children:s})},s)))})}function tf({view:e,onChangeView:t,fields:s}){const n=s.filter((t=>!1!==t.enableHiding&&t.id!==e.layout.mediaField));return n?.length?(0,me.jsx)(qp,{trigger:(0,me.jsx)(Kp,{children:(0,me.jsx)(Jp,{children:(0,b.__)("Fields")})}),children:n?.map((s=>(0,me.jsx)(Xp,{value:s.id,checked:!e.hiddenFields?.includes(s.id),onChange:()=>{t({...e,hiddenFields:e.hiddenFields?.includes(s.id)?e.hiddenFields.filter((e=>e!==s.id)):[...e.hiddenFields||[],s.id]})},children:(0,me.jsx)(Jp,{children:s.header})},s.id)))}):null}function sf({fields:e,view:t,onChangeView:s}){const n=e.filter((e=>!1!==e.enableSorting));if(!n?.length)return null;const i=e.find((e=>e.id===t.sort?.field));return(0,me.jsx)(qp,{trigger:(0,me.jsx)(Kp,{suffix:(0,me.jsx)("span",{"aria-hidden":"true",children:i?.header}),children:(0,me.jsx)(Jp,{children:(0,b.__)("Sort by")})}),children:n?.map((e=>{const n=t.sort?.direction;return(0,me.jsx)(qp,{trigger:(0,me.jsx)(Kp,{children:(0,me.jsx)(Jp,{children:e.header})}),style:{minWidth:"220px"},children:qh.map((r=>{const o=void 0!==i&&n===r&&e.id===i.id,a=`${e.id}-${r}`;return(0,me.jsx)(Yp,{name:"view-actions-sorting",value:a,checked:o,onChange:()=>{s({...t,sort:{field:e.id,direction:r}})},children:(0,me.jsx)(Jp,{children:Yh[r]})},a)}))},e.id)}))})}const nf=(0,d.memo)((function({fields:e,view:t,onChangeView:s,supportedLayouts:n}){return(0,me.jsx)(qp,{trigger:(0,me.jsx)(x.Button,{size:"compact",icon:pr,label:(0,b.__)("View options")}),children:(0,me.jsxs)(Zp,{children:[(0,me.jsx)(Qp,{view:t,onChangeView:s,supportedLayouts:n}),(0,me.jsx)(sf,{fields:e,view:t,onChangeView:s}),(0,me.jsx)(tf,{fields:e,view:t,onChangeView:s}),(0,me.jsx)(ef,{view:t,onChangeView:s})]})})}));var rf={id:null};function of(e,t){return t&&e.item(t)||null}var af=Symbol("FOCUS_SILENTLY");function lf(e,t,s){if(!t)return!1;if(t===s)return!1;const n=e.item(t.id);return!!n&&(!s||n.element!==s)}var cf=Object.defineProperty,uf=Object.defineProperties,df=Object.getOwnPropertyDescriptors,hf=Object.getOwnPropertySymbols,pf=Object.prototype.hasOwnProperty,ff=Object.prototype.propertyIsEnumerable,mf=(e,t,s)=>t in e?cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,gf=(e,t)=>{for(var s in t||(t={}))pf.call(t,s)&&mf(e,s,t[s]);if(hf)for(var s of hf(t))ff.call(t,s)&&mf(e,s,t[s]);return e},vf=(e,t)=>uf(e,df(t)),yf=(e,t)=>{var s={};for(var n in e)pf.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&hf)for(var n of hf(e))t.indexOf(n)<0&&ff.call(e,n)&&(s[n]=e[n]);return s},xf=i(1609),bf=i.t(xf,2),wf=Object.defineProperty,_f=Object.defineProperties,Sf=Object.getOwnPropertyDescriptors,jf=Object.getOwnPropertySymbols,Cf=Object.prototype.hasOwnProperty,kf=Object.prototype.propertyIsEnumerable,Ef=(e,t,s)=>t in e?wf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Pf=(e,t)=>{for(var s in t||(t={}))Cf.call(t,s)&&Ef(e,s,t[s]);if(jf)for(var s of jf(t))kf.call(t,s)&&Ef(e,s,t[s]);return e},If=(e,t)=>_f(e,Sf(t)),Tf=(e,t)=>{var s={};for(var n in e)Cf.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&jf)for(var n of jf(e))t.indexOf(n)<0&&kf.call(e,n)&&(s[n]=e[n]);return s};function Of(...e){}function Af(e,t){return"function"==typeof Object.hasOwn?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t)}function Mf(...e){return(...t)=>{for(const s of e)"function"==typeof s&&s(...t)}}function Nf(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Ff(e){return e}function Vf(e,t){if(!e){if("string"!=typeof t)throw new Error("Invariant failed");throw new Error(t)}}function Rf(e){return e.disabled||!0===e["aria-disabled"]||"true"===e["aria-disabled"]}function Bf(...e){for(const t of e)if(void 0!==t)return t}function Df(e){return function(e){return!!e&&!!(0,xf.isValidElement)(e)&&"ref"in e}(e)?e.ref:null}var Lf,zf="undefined"!=typeof window&&!!(null==(Lf=window.document)?void 0:Lf.createElement);function Gf(e){return e?e.ownerDocument||e:document}function Hf(e,t=!1){const{activeElement:s}=Gf(e);if(!(null==s?void 0:s.nodeName))return null;if("IFRAME"===s.tagName&&s.contentDocument)return Hf(s.contentDocument.body,t);if(t){const e=s.getAttribute("aria-activedescendant");if(e){const t=Gf(s).getElementById(e);if(t)return t}}return s}function Uf(e,t){return e===t||e.contains(t)}function Wf(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==qf.indexOf(e.type)}var qf=["button","color","file","image","reset","submit"];function Zf(e,t){return"matches"in e?e.matches(t):"msMatchesSelector"in e?e.msMatchesSelector(t):e.webkitMatchesSelector(t)}function Kf(e){try{const t=e instanceof HTMLInputElement&&null!==e.selectionStart,s="TEXTAREA"===e.tagName;return t||s||!1}catch(e){return!1}}function Yf(e,t){const s=null==e?void 0:e.getAttribute("role");return s&&-1!==["dialog","menu","listbox","tree","grid"].indexOf(s)?s:t}function Xf(e,t){var s;const n=Yf(e);if(!n)return t;return null!=(s={menu:"menuitem",listbox:"option",tree:"treeitem",grid:"gridcell"}[n])?s:t}function Jf(e){if(!e)return null;if(e.clientHeight&&e.scrollHeight>e.clientHeight){const{overflowY:t}=getComputedStyle(e);if("visible"!==t&&"hidden"!==t)return e}else if(e.clientWidth&&e.scrollWidth>e.clientWidth){const{overflowX:t}=getComputedStyle(e);if("visible"!==t&&"hidden"!==t)return e}return Jf(e.parentElement)||document.scrollingElement||document.body}function Qf(e,...t){/text|search|password|tel|url/i.test(e.type)&&e.setSelectionRange(...t)}function $f(){return zf&&!!navigator.maxTouchPoints}function em(){return!!zf&&/mac|iphone|ipad|ipod/i.test(navigator.platform)}function tm(){return zf&&em()&&/apple/i.test(navigator.vendor)}function sm(e){return Boolean(e.currentTarget&&!Uf(e.currentTarget,e.target))}function nm(e){return e.target===e.currentTarget}function im(e,t){const s=new FocusEvent("blur",t),n=e.dispatchEvent(s),i=If(Pf({},t),{bubbles:!0});return e.dispatchEvent(new FocusEvent("focusout",i)),n}function rm(e,t){const s=new MouseEvent("click",t);return e.dispatchEvent(s)}function om(e,t){const s=t||e.currentTarget,n=e.relatedTarget;return!n||!Uf(s,n)}function am(e,t,s){const n=requestAnimationFrame((()=>{e.removeEventListener(t,i,!0),s()})),i=()=>{cancelAnimationFrame(n),s()};return e.addEventListener(t,i,{once:!0,capture:!0}),n}function lm(e,t,s,n=window){const i=[];try{n.document.addEventListener(e,t,s);for(const r of Array.from(n.frames))i.push(lm(e,t,s,r))}catch(e){}return()=>{try{n.document.removeEventListener(e,t,s)}catch(e){}i.forEach((e=>e()))}}var cm=gf({},bf),um=cm.useId,dm=(cm.useDeferredValue,cm.useInsertionEffect),hm=zf?xf.useLayoutEffect:xf.useEffect;function pm(e){const t=(0,xf.useRef)(e);return hm((()=>{t.current=e})),t}function fm(e){const t=(0,xf.useRef)((()=>{throw new Error("Cannot call an event handler while rendering.")}));return dm?dm((()=>{t.current=e})):t.current=e,(0,xf.useCallback)(((...e)=>{var s;return null==(s=t.current)?void 0:s.call(t,...e)}),[])}function mm(...e){return(0,xf.useMemo)((()=>{if(e.some(Boolean))return t=>{e.forEach((e=>function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)))}}),e)}function gm(e){if(um){const t=um();return e||t}const[t,s]=(0,xf.useState)(e);return hm((()=>{if(e||t)return;const n=Math.random().toString(36).substr(2,6);s(`id-${n}`)}),[e,t]),e||t}function vm(e,t){const s=e=>{if("string"==typeof e)return e},[n,i]=(0,xf.useState)((()=>s(t)));return hm((()=>{const n=e&&"current"in e?e.current:e;i((null==n?void 0:n.tagName.toLowerCase())||s(t))}),[e,t]),n}function ym(e,t){const s=(0,xf.useRef)(!1);(0,xf.useEffect)((()=>{if(s.current)return e();s.current=!0}),t),(0,xf.useEffect)((()=>()=>{s.current=!1}),[])}Symbol("setNextState");function xm(e){return fm("function"==typeof e?e:()=>e)}function bm(e,t,s=[]){const n=(0,xf.useCallback)((s=>(e.wrapElement&&(s=e.wrapElement(s)),t(s))),[...s,e.wrapElement]);return vf(gf({},e),{wrapElement:n})}var wm=!1,_m=0,Sm=0;function jm(e){(function(e){const t=e.movementX||e.screenX-_m,s=e.movementY||e.screenY-Sm;return _m=e.screenX,Sm=e.screenY,t||s||!1})(e)&&(wm=!0)}function Cm(){wm=!1}function km(e){return xf.forwardRef(((t,s)=>e(gf({ref:s},t))))}function Em(e){const t=km(e);return xf.memo(t)}function Pm(e,t){const s=t,{as:n,wrapElement:i,render:r}=s,o=yf(s,["as","wrapElement","render"]);let a;const l=mm(t.ref,Df(r));if(n&&"string"!=typeof n)a=(0,me.jsx)(n,vf(gf({},o),{render:r}));else if(xf.isValidElement(r)){const e=vf(gf({},r.props),{ref:l});a=xf.cloneElement(r,function(e,t){const s=gf({},e);for(const n in t){if(!Af(t,n))continue;if("className"===n){const n="className";s[n]=e[n]?`${e[n]} ${t[n]}`:t[n];continue}if("style"===n){const n="style";s[n]=e[n]?gf(gf({},e[n]),t[n]):t[n];continue}const i=t[n];if("function"==typeof i&&n.startsWith("on")){const t=e[n];if("function"==typeof t){s[n]=(...e)=>{i(...e),t(...e)};continue}}s[n]=i}return s}(o,e))}else if(r)a=r(o);else if("function"==typeof t.children){0;const e=o,{children:s}=e,n=yf(e,["children"]);a=t.children(n)}else a=n?(0,me.jsx)(n,gf({},o)):(0,me.jsx)(e,gf({},o));return i?i(a):a}function Im(e){return(t={})=>{const s=e(t),n={};for(const e in s)Af(s,e)&&void 0!==s[e]&&(n[e]=s[e]);return n}}function Tm(e=[],t=[]){const s=xf.createContext(void 0),n=xf.createContext(void 0),i=()=>xf.useContext(s),r=t=>e.reduceRight(((e,s)=>(0,me.jsx)(s,vf(gf({},t),{children:e}))),(0,me.jsx)(s.Provider,gf({},t)));return{context:s,scopedContext:n,useContext:i,useScopedContext:(e=!1)=>{const t=xf.useContext(n),s=i();return e?t:t||s},useProviderContext:()=>{const e=xf.useContext(n),t=i();if(!e||e!==t)return t},ContextProvider:r,ScopedContextProvider:e=>(0,me.jsx)(r,vf(gf({},e),{children:t.reduceRight(((t,s)=>(0,me.jsx)(s,vf(gf({},e),{children:t}))),(0,me.jsx)(n.Provider,gf({},e)))}))}}var Om=Tm(),Am=Om.useContext,Mm=(Om.useScopedContext,Om.useProviderContext,Tm([Om.ContextProvider],[Om.ScopedContextProvider])),Nm=Mm.useContext,Fm=(Mm.useScopedContext,Mm.useProviderContext),Vm=Mm.ContextProvider,Rm=Mm.ScopedContextProvider,Bm=(0,xf.createContext)(void 0),Dm=(0,xf.createContext)(void 0),Lm="";function zm(){Lm=""}function Gm(e,t){var s;const n=(null==(s=e.element)?void 0:s.textContent)||e.children;return!!n&&Nf(n).trim().toLowerCase().startsWith(t.toLowerCase())}function Hm(e,t,s){if(!s)return e;const n=e.find((e=>e.id===s));return n&&Gm(n,t)?Lm!==t&&Gm(n,Lm)?e:(Lm=t,function(e,t,s=!1){const n=e.findIndex((e=>e.id===t));return[...e.slice(n+1),...s?[rf]:[],...e.slice(0,n)]}(e.filter((e=>Gm(e,Lm))),s).filter((e=>e.id!==s))):e}var Um=Im((e=>{var t=e,{store:s,typeahead:n=!0}=t,i=yf(t,["store","typeahead"]);const r=Nm();Vf(s=s||r,!1);const o=i.onKeyDownCapture,a=(0,xf.useRef)(0),l=fm((e=>{if(null==o||o(e),e.defaultPrevented)return;if(!n)return;if(!s)return;const{items:t,activeId:i}=s.getState();if(!function(e){const t=e.target;return(!t||!Kf(t))&&(!(" "!==e.key||!Lm.length)||1===e.key.length&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&/^[\p{Letter}\p{Number}]$/u.test(e.key))}(e))return zm();let r=function(e){return e.filter((e=>!e.disabled))}(t);if(!function(e,t){if(nm(e))return!0;const s=e.target;return!!s&&t.some((e=>e.element===s))}(e,r))return zm();e.preventDefault(),window.clearTimeout(a.current),a.current=window.setTimeout((()=>{Lm=""}),500);const l=e.key.toLowerCase();Lm+=l,r=Hm(r,l,i);const c=r.find((e=>Gm(e,Lm)));c?s.move(c.id):zm()}));return i=vf(gf({},i),{onKeyDownCapture:l})})),Wm=km((e=>Pm("div",Um(e))));var qm="input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";function Zm(e){return!!Zf(e,qm)&&(!!function(e){const t=e;return t.offsetWidth>0||t.offsetHeight>0||e.getClientRects().length>0}(e)&&!function(e,t){if("closest"in e)return e.closest(t);do{if(Zf(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}(e,"[inert]"))}function Km(e){const t=Hf(e);if(!t)return!1;if(t===e)return!0;const s=t.getAttribute("aria-activedescendant");return!!s&&s===e.id}function Ym(e){const t=Hf(e);if(!t)return!1;if(Uf(e,t))return!0;const s=t.getAttribute("aria-activedescendant");return!!s&&("id"in e&&(s===e.id||!!e.querySelector(`#${CSS.escape(s)}`)))}function Xm(e){const t=e.relatedTarget;return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE?t:null}var Jm=Symbol("composite-hover");var Qm=Im((e=>{var t=e,{store:s,focusOnHover:n=!0,blurOnHoverEnd:i=!!n}=t,r=yf(t,["store","focusOnHover","blurOnHoverEnd"]);const o=Nm();Vf(s=s||o,!1);const a=((0,xf.useEffect)((()=>{lm("mousemove",jm,!0),lm("mousedown",Cm,!0),lm("mouseup",Cm,!0),lm("keydown",Cm,!0),lm("scroll",Cm,!0)}),[]),fm((()=>wm))),l=r.onMouseMove,c=xm(n),u=fm((e=>{if(null==l||l(e),!e.defaultPrevented&&a()&&c(e)){if(!Ym(e.currentTarget)){const e=null==s?void 0:s.getState().baseElement;e&&!Km(e)&&e.focus()}null==s||s.setActiveId(e.currentTarget.id)}})),d=r.onMouseLeave,h=xm(i),p=fm((e=>{var t;null==d||d(e),e.defaultPrevented||a()&&(function(e){const t=Xm(e);return!!t&&Uf(e.currentTarget,t)}(e)||function(e){let t=Xm(e);if(!t)return!1;do{if(Af(t,Jm)&&t[Jm])return!0;t=t.parentElement}while(t);return!1}(e)||c(e)&&h(e)&&(null==s||s.setActiveId(null),null==(t=null==s?void 0:s.getState().baseElement)||t.focus()))})),f=(0,xf.useCallback)((e=>{e&&(e[Jm]=!0)}),[]);return r=vf(gf({},r),{ref:mm(f,r.ref),onMouseMove:u,onMouseLeave:p})})),$m=Em((e=>Pm("div",Qm(e))));function eg(e,t){const s=e.__unstableInternals;return Vf(s,"Invalid store"),s[t]}function tg(e,...t){let s=e,n=s,i=Symbol(),r=Of;const o=new Set,a=new Set,l=new Set,c=new Set,u=new Set,d=new WeakMap,h=new WeakMap,p=(e,t,s=c)=>(s.add(t),h.set(t,e),()=>{var e;null==(e=d.get(t))||e(),d.delete(t),h.delete(t),s.delete(t)}),f=(e,r,o=!1)=>{if(!Af(s,e))return;const l=function(e,t){if(function(e){return"function"==typeof e}(e))return e(function(e){return"function"==typeof e}(t)?t():t);return e}(r,s[e]);if(l===s[e])return;o||t.forEach((t=>{var s;null==(s=null==t?void 0:t.setState)||s.call(t,e,l)}));const p=s;s=If(Pf({},s),{[e]:l});const f=Symbol();i=f,a.add(e);const m=(t,n,i)=>{var r;const o=h.get(t);o&&!o.some((t=>i?i.has(t):t===e))||(null==(r=d.get(t))||r(),d.set(t,t(s,n)))};c.forEach((e=>{m(e,p)})),queueMicrotask((()=>{if(i!==f)return;const e=s;u.forEach((e=>{m(e,n,a)})),n=e,a.clear()}))},m={getState:()=>s,setState:f,__unstableInternals:{setup:e=>(l.add(e),()=>l.delete(e)),init:()=>{const e=o.size,n=Symbol();o.add(n);const i=()=>{o.delete(n),o.size||r()};if(e)return i;const a=(c=s,Object.keys(c)).map((e=>Mf(...t.map((t=>{var s;const n=null==(s=null==t?void 0:t.getState)?void 0:s.call(t);if(n&&Af(n,e))return rg(t,[e],(t=>{f(e,t[e],!0)}))})))));var c;const u=[];l.forEach((e=>u.push(e())));const d=t.map(ng);return r=Mf(...a,...u,...d),i},subscribe:(e,t)=>p(e,t),sync:(e,t)=>(d.set(t,t(s,s)),p(e,t)),batch:(e,t)=>(d.set(t,t(s,n)),p(e,t,u)),pick:e=>tg(function(e,t){const s={};for(const n of t)Af(e,n)&&(s[n]=e[n]);return s}(s,e),m),omit:e=>tg(function(e,t){const s=Pf({},e);for(const e of t)Af(s,e)&&delete s[e];return s}(s,e),m)}};return m}function sg(e,...t){if(e)return eg(e,"setup")(...t)}function ng(e,...t){if(e)return eg(e,"init")(...t)}function ig(e,...t){if(e)return eg(e,"subscribe")(...t)}function rg(e,...t){if(e)return eg(e,"sync")(...t)}function og(e,...t){if(e)return eg(e,"batch")(...t)}function ag(e,...t){if(e)return eg(e,"omit")(...t)}function lg(...e){const t=e.reduce(((e,t)=>{var s;const n=null==(s=null==t?void 0:t.getState)?void 0:s.call(t);return n?Pf(Pf({},e),n):e}),{});return tg(t,...e)}var cg=i(422),{useSyncExternalStore:ug}=cg,dg=()=>()=>{};function hg(e,t=Ff){const s=xf.useCallback((t=>e?ig(e,null,t):dg()),[e]),n=()=>{const s="string"==typeof t?t:null,n="function"==typeof t?t:null,i=null==e?void 0:e.getState();return n?n(i):i&&s&&Af(i,s)?i[s]:void 0};return ug(s,n,n)}function pg(e,t,s,n){const i=Af(t,s)?t[s]:void 0,r=n?t[n]:void 0,o=pm({value:i,setValue:r});hm((()=>rg(e,[s],((e,t)=>{const{value:n,setValue:i}=o.current;i&&e[s]!==t[s]&&e[s]!==n&&i(e[s])}))),[e,s]),hm((()=>{if(void 0!==i)return e.setState(s,i),og(e,[s],(()=>{void 0!==i&&e.setState(s,i)}))}))}function fg(e,t,s){return ym(t,[s.store]),pg(e,s,"items","setItems"),e}function mg(e,t,s){return pg(e=fg(e,t,s),s,"activeId","setActiveId"),pg(e,s,"includesBaseElement"),pg(e,s,"virtualFocus"),pg(e,s,"orientation"),pg(e,s,"rtl"),pg(e,s,"focusLoop"),pg(e,s,"focusWrap"),pg(e,s,"focusShift"),e}function gg(e,t,s){return ym(t,[s.store,s.disclosure]),pg(e,s,"open","setOpen"),pg(e,s,"mounted","setMounted"),pg(e,s,"animated"),e}function vg(e,t,s){return gg(e,t,s)}function yg(e,t,s){return ym(t,[s.popover]),pg(e=vg(e,t,s),s,"placement"),e}function xg(e={}){return function(e={}){const t=lg(e.store,ag(e.disclosure,["contentElement","disclosureElement"])),s=null==t?void 0:t.getState(),n=Bf(e.open,null==s?void 0:s.open,e.defaultOpen,!1),i=Bf(e.animated,null==s?void 0:s.animated,!1),r=tg({open:n,animated:i,animating:!!i&&n,mounted:n,contentElement:Bf(null==s?void 0:s.contentElement,null),disclosureElement:Bf(null==s?void 0:s.disclosureElement,null)},t);return sg(r,(()=>rg(r,["animated","animating"],(e=>{e.animated||r.setState("animating",!1)})))),sg(r,(()=>ig(r,["open"],(()=>{r.getState().animated&&r.setState("animating",!0)})))),sg(r,(()=>rg(r,["open","animating"],(e=>{r.setState("mounted",e.open||e.animating)})))),If(Pf({},r),{setOpen:e=>r.setState("open",e),show:()=>r.setState("open",!0),hide:()=>r.setState("open",!1),toggle:()=>r.setState("open",(e=>!e)),stopAnimation:()=>r.setState("animating",!1),setContentElement:e=>r.setState("contentElement",e),setDisclosureElement:e=>r.setState("disclosureElement",e)})}(e)}function bg(e){const t=e.map(((e,t)=>[t,e]));let s=!1;return t.sort((([e,t],[n,i])=>{const r=t.element,o=i.element;return r===o?0:r&&o?function(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}(r,o)?(e>n&&(s=!0),-1):(et)):e}function wg(e={}){var t;e.store;const s=null==(t=e.store)?void 0:t.getState(),n=Bf(e.items,null==s?void 0:s.items,e.defaultItems,[]),i=new Map(n.map((e=>[e.id,e]))),r={items:n,renderedItems:Bf(null==s?void 0:s.renderedItems,[])},o=function(e){return null==e?void 0:e.__unstablePrivateStore}(e.store),a=tg({items:n,renderedItems:r.renderedItems},o),l=tg(r,e.store),c=e=>{const t=bg(e);a.setState("renderedItems",t),l.setState("renderedItems",t)};sg(l,(()=>ng(a))),sg(a,(()=>og(a,["items"],(e=>{l.setState("items",e.items)})))),sg(a,(()=>og(a,["renderedItems"],(e=>{let t=!0,s=requestAnimationFrame((()=>{const{renderedItems:t}=l.getState();e.renderedItems!==t&&c(e.renderedItems)}));if("function"!=typeof IntersectionObserver)return()=>cancelAnimationFrame(s);const n=function(e){var t;const s=e.find((e=>!!e.element)),n=[...e].reverse().find((e=>!!e.element));let i=null==(t=null==s?void 0:s.element)?void 0:t.parentElement;for(;i&&(null==n?void 0:n.element);){if(n&&i.contains(n.element))return i;i=i.parentElement}return Gf(i).body}(e.renderedItems),i=new IntersectionObserver((()=>{t?t=!1:(cancelAnimationFrame(s),s=requestAnimationFrame((()=>c(e.renderedItems))))}),{root:n});for(const t of e.renderedItems)t.element&&i.observe(t.element);return()=>{cancelAnimationFrame(s),i.disconnect()}}))));const u=(e,t,s=!1)=>{let n;t((t=>{const s=t.findIndex((({id:t})=>t===e.id)),r=t.slice();if(-1!==s){n=t[s];const o=Pf(Pf({},n),e);r[s]=o,i.set(e.id,o)}else r.push(e),i.set(e.id,e);return r}));return()=>{t((t=>{if(!n)return s&&i.delete(e.id),t.filter((({id:t})=>t!==e.id));const r=t.findIndex((({id:t})=>t===e.id));if(-1===r)return t;const o=t.slice();return o[r]=n,i.set(e.id,n),o}))}},d=e=>u(e,(e=>a.setState("items",e)),!0);return If(Pf({},l),{registerItem:d,renderItem:e=>Mf(d(e),u(e,(e=>a.setState("renderedItems",e)))),item:e=>{if(!e)return null;let t=i.get(e);if(!t){const{items:s}=l.getState();t=s.find((t=>t.id===e)),t&&i.set(e,t)}return t||null},__unstablePrivateStore:a})}function _g(e){const t=[];for(const s of e)t.push(...s);return t}function Sg(e){return e.slice().reverse()}var jg={id:null};function Cg(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}function kg(e,t){return e.filter((e=>e.rowId===t))}function Eg(e){const t=[];for(const s of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===s.rowId}));e?e.push(s):t.push([s])}return t}function Pg(e){let t=0;for(const{length:s}of e)s>t&&(t=s);return t}function Ig(e,t,s){const n=Pg(e);for(const i of e)for(let e=0;erg(r,["renderedItems","activeId"],(e=>{r.setState("activeId",(t=>{var s;return void 0!==t?t:null==(s=Cg(e.renderedItems))?void 0:s.id}))}))));const o=(e,t,s,n)=>{var i,o;const{activeId:a,rtl:l,focusLoop:c,focusWrap:u,includesBaseElement:d}=r.getState(),h=l&&"vertical"!==t?Sg(e):e;if(null==a)return null==(i=Cg(h))?void 0:i.id;const p=h.find((e=>e.id===a));if(!p)return null==(o=Cg(h))?void 0:o.id;const f=!!p.rowId,m=h.indexOf(p),g=h.slice(m+1),v=kg(g,p.rowId);if(void 0!==n){const e=function(e,t){return e.filter((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(v,a),t=e.slice(n)[0]||e[e.length-1];return null==t?void 0:t.id}const y=function(e){return"vertical"===e?"horizontal":"horizontal"===e?"vertical":void 0}(f?t||"horizontal":t),x=c&&c!==y,b=f&&u&&u!==y;if(s=s||!f&&x&&d,x){const e=function(e,t,s=!1){const n=e.findIndex((e=>e.id===t));return[...e.slice(n+1),...s?[jg]:[],...e.slice(0,n)]}(b&&!s?h:kg(h,p.rowId),a,s),t=Cg(e,a);return null==t?void 0:t.id}if(b){const e=Cg(s?v:g,a);return s?(null==e?void 0:e.id)||null:null==e?void 0:e.id}const w=Cg(v,a);return!w&&s?null:null==w?void 0:w.id};return If(Pf(Pf({},n),r),{setBaseElement:e=>r.setState("baseElement",e),setActiveId:e=>r.setState("activeId",e),move:e=>{void 0!==e&&(r.setState("activeId",e),r.setState("moves",(e=>e+1)))},first:()=>{var e;return null==(e=Cg(r.getState().renderedItems))?void 0:e.id},last:()=>{var e;return null==(e=Cg(Sg(r.getState().renderedItems)))?void 0:e.id},next:e=>{const{renderedItems:t,orientation:s}=r.getState();return o(t,s,!1,e)},previous:e=>{var t;const{renderedItems:s,orientation:n,includesBaseElement:i}=r.getState(),a=!!!(null==(t=Cg(s))?void 0:t.rowId)&&i;return o(Sg(s),n,a,e)},down:e=>{const{activeId:t,renderedItems:s,focusShift:n,focusLoop:i,includesBaseElement:a}=r.getState(),l=n&&!e,c=Tg(_g(Ig(Eg(s),t,l)));return o(c,"vertical",i&&"horizontal"!==i&&a,e)},up:e=>{const{activeId:t,renderedItems:s,focusShift:n,includesBaseElement:i}=r.getState(),a=n&&!e,l=Tg(Sg(_g(Ig(Eg(s),t,a))));return o(l,"vertical",i,e)}})}var Ag=tm()&&$f();function Mg(e={}){var t;e.store;const s=null==(t=e.store)?void 0:t.getState(),n=Bf(e.activeId,null==s?void 0:s.activeId,e.defaultActiveId,null),i=Og(If(Pf({},e),{activeId:n,includesBaseElement:Bf(e.includesBaseElement,null==s?void 0:s.includesBaseElement,!0),orientation:Bf(e.orientation,null==s?void 0:s.orientation,"vertical"),focusLoop:Bf(e.focusLoop,null==s?void 0:s.focusLoop,!0),focusWrap:Bf(e.focusWrap,null==s?void 0:s.focusWrap,!0),virtualFocus:Bf(e.virtualFocus,null==s?void 0:s.virtualFocus,!Ag)})),r=function(e={}){var t=e,{popover:s}=t,n=Tf(t,["popover"]);const i=lg(n.store,ag(s,["arrowElement","anchorElement","contentElement","popoverElement","disclosureElement"])),r=null==i?void 0:i.getState(),o=xg(If(Pf({},n),{store:i})),a=Bf(n.placement,null==r?void 0:r.placement,"bottom"),l=tg(If(Pf({},o.getState()),{placement:a,currentPlacement:a,anchorElement:Bf(null==r?void 0:r.anchorElement,null),popoverElement:Bf(null==r?void 0:r.popoverElement,null),arrowElement:Bf(null==r?void 0:r.arrowElement,null),rendered:Symbol("rendered")}),o,i);return If(Pf(Pf({},o),l),{setAnchorElement:e=>l.setState("anchorElement",e),setPopoverElement:e=>l.setState("popoverElement",e),setArrowElement:e=>l.setState("arrowElement",e),render:()=>l.setState("rendered",Symbol("rendered"))})}(If(Pf({},e),{placement:Bf(e.placement,null==s?void 0:s.placement,"bottom-start")})),o=Bf(e.value,null==s?void 0:s.value,e.defaultValue,""),a=Bf(e.selectedValue,null==s?void 0:s.selectedValue,e.defaultSelectedValue,""),l=Array.isArray(a),c=tg(If(Pf(Pf({},i.getState()),r.getState()),{value:o,selectedValue:a,resetValueOnSelect:Bf(e.resetValueOnSelect,null==s?void 0:s.resetValueOnSelect,l),resetValueOnHide:Bf(e.resetValueOnHide,null==s?void 0:s.resetValueOnHide,l),activeValue:null==s?void 0:s.activeValue}),i,r,e.store);return sg(c,(()=>rg(c,["resetValueOnHide","mounted"],(e=>{e.resetValueOnHide&&(e.mounted||c.setState("value",o))})))),sg(c,(()=>rg(c,["resetValueOnSelect","selectedValue"],(e=>{e.resetValueOnSelect&&c.setState("value",o)})))),sg(c,(()=>og(c,["mounted"],(e=>{e.mounted||(c.setState("activeId",n),c.setState("moves",0))})))),sg(c,(()=>rg(c,["moves","activeId"],((e,t)=>{e.moves===t.moves&&c.setState("activeValue",void 0)})))),sg(c,(()=>og(c,["moves","renderedItems"],((e,t)=>{if(e.moves===t.moves)return;const{activeId:s}=c.getState(),n=i.item(s);c.setState("activeValue",null==n?void 0:n.value)})))),If(Pf(Pf(Pf({},r),i),c),{setValue:e=>c.setState("value",e),setSelectedValue:e=>c.setState("selectedValue",e)})}function Ng(e={}){const[t,s]=function(e,t){const[s,n]=xf.useState((()=>e(t)));hm((()=>ng(s)),[s]);const i=xf.useCallback((e=>hg(s,e)),[s]);return[xf.useMemo((()=>vf(gf({},s),{useState:i})),[s,i]),fm((()=>{n((s=>e(gf(gf({},t),s.getState()))))}))]}(Mg,e);return function(e,t,s){return pg(e=mg(e=yg(e,t,s),t,s),s,"value","setValue"),pg(e,s,"selectedValue","setSelectedValue"),pg(e,s,"resetValueOnHide"),pg(e,s,"resetValueOnSelect"),e}(t,s,e)}var Fg=Tm(),Vg=(Fg.useContext,Fg.useScopedContext,Fg.useProviderContext),Rg=Tm([Fg.ContextProvider],[Fg.ScopedContextProvider]),Bg=(Rg.useContext,Rg.useScopedContext,Rg.useProviderContext,Rg.ContextProvider),Dg=Rg.ScopedContextProvider,Lg=((0,xf.createContext)(void 0),(0,xf.createContext)(void 0),Tm([Bg],[Dg])),zg=(Lg.useContext,Lg.useScopedContext,Lg.useProviderContext),Gg=Lg.ContextProvider,Hg=Lg.ScopedContextProvider,Ug=Tm([Gg,Vm],[Hg,Rm]),Wg=(Ug.useContext,Ug.useScopedContext),qg=Ug.useProviderContext,Zg=Ug.ContextProvider,Kg=Ug.ScopedContextProvider,Yg=(0,xf.createContext)(void 0),Xg=(0,xf.createContext)(!1);function Jg(e={}){const t=Ng(e);return(0,me.jsx)(Zg,{value:t,children:e.children})}var Qg=Im((e=>{var t=e,{store:s}=t,n=yf(t,["store"]);const i=qg();Vf(s=s||i,!1);const r=s.useState((e=>{var t;return null==(t=e.baseElement)?void 0:t.id}));return n=gf({htmlFor:r},n)})),$g=Em((e=>Pm("label",Qg(e))));var ev=Im((e=>{var t=e,{store:s}=t,n=yf(t,["store"]);const i=zg();return s=s||i,n=vf(gf({},n),{ref:mm(null==s?void 0:s.setAnchorElement,n.ref)})}));km((e=>Pm("div",ev(e))));var tv=(0,xf.createContext)(!0),sv=tm(),nv=["text","search","url","tel","email","password","number","date","month","week","time","datetime","datetime-local"];function iv(e){return!("input"!==e.tagName.toLowerCase()||!e.type)&&("radio"===e.type||"checkbox"===e.type)}function rv(e,t,s,n,i){return e?t?s&&!n?-1:void 0:s?i:i||0:i}function ov(e,t){return fm((s=>{null==e||e(s),s.defaultPrevented||t&&(s.stopPropagation(),s.preventDefault())}))}var av=!0;function lv(e){const t=e.target;t&&"hasAttribute"in t&&(t.hasAttribute("data-focus-visible")||(av=!1))}function cv(e){e.metaKey||e.ctrlKey||e.altKey||(av=!0)}var uv=Im((e=>{var t=e,{focusable:s=!0,accessibleWhenDisabled:n,autoFocus:i,onFocusVisible:r}=t,o=yf(t,["focusable","accessibleWhenDisabled","autoFocus","onFocusVisible"]);const a=(0,xf.useRef)(null);(0,xf.useEffect)((()=>{s&&(lm("mousedown",lv,!0),lm("keydown",cv,!0))}),[s]),sv&&(0,xf.useEffect)((()=>{if(!s)return;const e=a.current;if(!e)return;if(!iv(e))return;const t=function(e){return"labels"in e?e.labels:null}(e);if(!t)return;const n=()=>queueMicrotask((()=>e.focus()));return t.forEach((e=>e.addEventListener("mouseup",n))),()=>{t.forEach((e=>e.removeEventListener("mouseup",n)))}}),[s]);const l=s&&Rf(o),c=!!l&&!n,[u,d]=(0,xf.useState)(!1);(0,xf.useEffect)((()=>{s&&c&&u&&d(!1)}),[s,c,u]),(0,xf.useEffect)((()=>{if(!s)return;if(!u)return;const e=a.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return;const t=new IntersectionObserver((()=>{Zm(e)||d(!1)}));return t.observe(e),()=>t.disconnect()}),[s,u]);const h=ov(o.onKeyPressCapture,l),p=ov(o.onMouseDownCapture,l),f=ov(o.onClickCapture,l),m=o.onMouseDown,g=fm((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!s)return;const t=e.currentTarget;if(!sv)return;if(sm(e))return;if(!Wf(t)&&!iv(t))return;let n=!1;const i=()=>{n=!0};t.addEventListener("focusin",i,{capture:!0,once:!0}),am(t,"mouseup",(()=>{t.removeEventListener("focusin",i,!0),n||function(e){!Ym(e)&&Zm(e)&&e.focus()}(t)}))})),v=(e,t)=>{if(t&&(e.currentTarget=t),!s)return;const n=e.currentTarget;n&&Km(n)&&(null==r||r(e),e.defaultPrevented||d(!0))},y=o.onKeyDownCapture,x=fm((e=>{if(null==y||y(e),e.defaultPrevented)return;if(!s)return;if(u)return;if(e.metaKey)return;if(e.altKey)return;if(e.ctrlKey)return;if(!nm(e))return;const t=e.currentTarget;queueMicrotask((()=>v(e,t)))})),b=o.onFocusCapture,w=fm((e=>{if(null==b||b(e),e.defaultPrevented)return;if(!s)return;if(!nm(e))return void d(!1);const t=e.currentTarget,n=()=>v(e,t);av||function(e){const{tagName:t,readOnly:s,type:n}=e;return"TEXTAREA"===t&&!s||"SELECT"===t&&!s||("INPUT"!==t||s?!!e.isContentEditable:nv.includes(n))}(e.target)?queueMicrotask(n):!function(e){return"combobox"===e.getAttribute("role")&&!!e.dataset.name}(e.target)?d(!1):am(e.target,"focusout",n)})),_=o.onBlur,S=fm((e=>{null==_||_(e),s&&om(e)&&d(!1)})),j=(0,xf.useContext)(tv),C=fm((e=>{s&&i&&e&&j&&queueMicrotask((()=>{Km(e)||Zm(e)&&e.focus()}))})),k=vm(a,o.as),E=s&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e||"a"===e}(k),P=s&&function(e){return!e||"button"===e||"input"===e||"select"===e||"textarea"===e}(k),I=c?gf({pointerEvents:"none"},o.style):o.style;return o=vf(gf({"data-focus-visible":s&&u?"":void 0,"data-autofocus":!!i||void 0,"aria-disabled":!!l||void 0},o),{ref:mm(a,C,o.ref),style:I,tabIndex:rv(s,c,E,P,o.tabIndex),disabled:!(!P||!c)||void 0,contentEditable:l?void 0:o.contentEditable,onKeyPressCapture:h,onClickCapture:f,onMouseDownCapture:p,onMouseDown:g,onKeyDownCapture:x,onFocusCapture:w,onBlur:S})}));km((e=>Pm("div",e=uv(e))));function dv(e,t,s){return fm((n=>{var i;if(null==t||t(n),n.defaultPrevented)return;if(n.isPropagationStopped())return;if(!nm(n))return;if(function(e){return"Shift"===e.key||"Control"===e.key||"Alt"===e.key||"Meta"===e.key}(n))return;if(function(e){const t=e.target;return!(t&&!Kf(t)||1!==e.key.length||e.ctrlKey||e.metaKey)}(n))return;const r=e.getState(),o=null==(i=of(e,r.activeId))?void 0:i.element;if(!o)return;const a=n,{view:l}=a,c=yf(a,["view"]);o!==(null==s?void 0:s.current)&&o.focus(),function(e,t,s){const n=new KeyboardEvent(t,s);return e.dispatchEvent(n)}(o,n.type,c)||n.preventDefault(),n.currentTarget.contains(o)&&n.stopPropagation()}))}var hv=Im((e=>{var t=e,{store:s,composite:n=!0,focusOnMove:i=n,moveOnKeyPress:r=!0}=t,o=yf(t,["store","composite","focusOnMove","moveOnKeyPress"]);const a=Fm();Vf(s=s||a,!1);const l=(0,xf.useRef)(null),c=function(e){const[t,s]=(0,xf.useState)(!1),n=(0,xf.useCallback)((()=>s(!0)),[]),i=e.useState((t=>of(e,t.activeId)));return(0,xf.useEffect)((()=>{const e=null==i?void 0:i.element;t&&e&&(s(!1),e.focus({preventScroll:!0}))}),[i,t]),n}(s),u=s.useState("moves");(0,xf.useEffect)((()=>{var e;if(!s)return;if(!u)return;if(!n)return;if(!i)return;const{activeId:t}=s.getState(),r=null==(e=of(s,t))?void 0:e.element;var o,a;r&&("scrollIntoView"in(o=r)?(o.focus({preventScroll:!0}),o.scrollIntoView(Pf({block:"nearest",inline:"nearest"},a))):o.focus())}),[s,u,n,i]),hm((()=>{if(!s)return;if(!u)return;if(!n)return;const{baseElement:e,activeId:t}=s.getState();if(!(null===t))return;if(!e)return;const i=l.current;l.current=null,i&&im(i,{relatedTarget:e}),Km(e)||e.focus()}),[s,u,n]);const d=s.useState("activeId"),h=s.useState("virtualFocus");hm((()=>{var e;if(!s)return;if(!n)return;if(!h)return;const t=l.current;if(l.current=null,!t)return;const i=(null==(e=of(s,d))?void 0:e.element)||Hf(t);i!==t&&im(t,{relatedTarget:i})}),[s,d,h,n]);const p=dv(s,o.onKeyDownCapture,l),f=dv(s,o.onKeyUpCapture,l),m=o.onFocusCapture,g=fm((e=>{if(null==m||m(e),e.defaultPrevented)return;if(!s)return;const{virtualFocus:t}=s.getState();if(!t)return;const n=e.relatedTarget,i=function(e){const t=e[af];return delete e[af],t}(e.currentTarget);nm(e)&&i&&(e.stopPropagation(),l.current=n)})),v=o.onFocus,y=fm((e=>{if(null==v||v(e),e.defaultPrevented)return;if(!n)return;if(!s)return;const{relatedTarget:t}=e,{virtualFocus:i}=s.getState();i?nm(e)&&!lf(s,t)&&queueMicrotask(c):nm(e)&&s.setActiveId(null)})),x=o.onBlurCapture,b=fm((e=>{var t;if(null==x||x(e),e.defaultPrevented)return;if(!s)return;const{virtualFocus:n,activeId:i}=s.getState();if(!n)return;const r=null==(t=of(s,i))?void 0:t.element,o=e.relatedTarget,a=lf(s,o),c=l.current;if(l.current=null,nm(e)&&a)o===r?c&&c!==o&&im(c,e):r?im(r,e):c&&im(c,e),e.stopPropagation();else{!lf(s,e.target)&&r&&im(r,e)}})),w=o.onKeyDown,_=xm(r),S=fm((e=>{var t;if(null==w||w(e),e.defaultPrevented)return;if(!s)return;if(!nm(e))return;const{orientation:n,items:i,renderedItems:r,activeId:o}=s.getState(),a=of(s,o);if(null==(t=null==a?void 0:a.element)?void 0:t.isConnected)return;const l="horizontal"!==n,c="vertical"!==n,u=function(e){return e.some((e=>!!e.rowId))}(r);if(("ArrowLeft"===e.key||"ArrowRight"===e.key||"Home"===e.key||"End"===e.key)&&Kf(e.currentTarget))return;const d={ArrowUp:(u||l)&&(()=>{if(u){const e=i&&function(e){return function(e,t){return e.find((e=>t?!e.disabled&&e.id!==t:!e.disabled))}(_g(Sg(function(e){const t=[];for(const s of e){const e=t.find((e=>{var t;return(null==(t=e[0])?void 0:t.rowId)===s.rowId}));e?e.push(s):t.push([s])}return t}(e))))}(i);return null==e?void 0:e.id}return null==s?void 0:s.last()}),ArrowRight:(u||c)&&s.first,ArrowDown:(u||l)&&s.first,ArrowLeft:(u||c)&&s.last,Home:s.first,End:s.last,PageUp:s.first,PageDown:s.last},h=d[e.key];if(h){const t=h();if(void 0!==t){if(!_(e))return;e.preventDefault(),s.move(t)}}}));o=bm(o,(e=>(0,me.jsx)(Vm,{value:s,children:e})),[s]);const j=s.useState((e=>{var t;if(s&&n&&e.virtualFocus)return null==(t=of(s,e.activeId))?void 0:t.id}));o=vf(gf({"aria-activedescendant":j},o),{ref:mm(n?s.setBaseElement:null,o.ref),onKeyDownCapture:p,onKeyUpCapture:f,onFocusCapture:g,onFocus:y,onBlurCapture:b,onKeyDown:S});const C=s.useState((e=>n&&(e.virtualFocus||null===e.activeId)));return o=uv(gf({focusable:C},o))}));km((e=>Pm("div",hv(e))));const pv=window.ReactDOM;function fv(e,t,s){if(!s)return!1;const n=e.find((e=>!e.disabled&&e.value));return(null==n?void 0:n.value)===t}function mv(e,t){return!!t&&(null!=e&&(e=Nf(e),t.length>e.length&&0===t.toLowerCase().indexOf(e.toLowerCase())))}var gv=Im((e=>{var t=e,{store:s,focusable:n=!0,autoSelect:i=!1,getAutoSelectId:r,showOnChange:o=!0,setValueOnChange:a=!0,showOnMouseDown:l=!0,setValueOnClick:c=!0,showOnKeyDown:u=!0,moveOnKeyPress:d=!0,autoComplete:h="list"}=t,p=yf(t,["store","focusable","autoSelect","getAutoSelectId","showOnChange","setValueOnChange","showOnMouseDown","setValueOnClick","showOnKeyDown","moveOnKeyPress","autoComplete"]);const f=qg();Vf(s=s||f,!1);const m=(0,xf.useRef)(null),[g,v]=(0,xf.useReducer)((()=>[]),[]),y=(0,xf.useRef)(!1),x=(0,xf.useRef)(!1),b=s.useState((e=>!!i&&e.virtualFocus)),w="inline"===h||"both"===h,[_,S]=(0,xf.useState)(w);!function(e,t){const s=(0,xf.useRef)(!1);hm((()=>{if(s.current)return e();s.current=!0}),t),hm((()=>()=>{s.current=!1}),[])}((()=>{w&&S(!0)}),[w]);const j=s.useState("value"),C=s.useState((e=>w&&_?e.activeValue:void 0)),k=s.useState("renderedItems"),E=s.useState("open"),P=s.useState("contentElement"),I=(0,xf.useMemo)((()=>{if(!w)return j;if(!_)return j;if(fv(k,C,b)){if(mv(j,C)){const e=(null==C?void 0:C.slice(j.length))||"";return j+e}return j}return C||j}),[w,_,k,C,b,j]);(0,xf.useEffect)((()=>{const e=m.current;if(!e)return;const t=()=>S(!0);return e.addEventListener("combobox-item-move",t),()=>{e.removeEventListener("combobox-item-move",t)}}),[]),(0,xf.useEffect)((()=>{if(!w)return;if(!_)return;if(!C)return;fv(k,C,b)&&mv(j,C)&&queueMicrotask((()=>{const e=m.current;e&&Qf(e,j.length,C.length)}))}),[g,w,_,C,k,b,j]);const T=(0,xf.useRef)(null),O=fm(r),A=(0,xf.useRef)(null);(0,xf.useEffect)((()=>{if(!E)return;if(!P)return;const e=Jf(P);if(!e)return;T.current=e;const t=()=>{y.current=!1},n=()=>{if(!s)return;if(!y.current)return;const{activeId:e}=s.getState();null!==e&&e!==A.current&&(y.current=!1)},i={passive:!0,capture:!0};return e.addEventListener("wheel",t,i),e.addEventListener("scroll",n,i),()=>{e.removeEventListener("wheel",t,!0),e.removeEventListener("scroll",n,!0)}}),[E,P,s]),hm((()=>{j&&(x.current||(y.current=!0))}),[j]),hm((()=>{E||(y.current=!1)}),[E]);const M=s.useState("resetValueOnSelect");ym((()=>{var e;const t=y.current;if(!s)return;if(!(b&&t||M))return;const{baseElement:n,contentElement:i,activeId:r}=s.getState();if(!n||Km(n)){if(null==i?void 0:i.hasAttribute("data-placing")){const e=new MutationObserver(v);return e.observe(i,{attributeFilter:["data-placing"]}),()=>e.disconnect()}if(b&&t){const e=O(k),t=void 0!==e?e:s.first();A.current=t,s.move(null!=t?t:null)}else{const t=null==(e=s.item(r))?void 0:e.element;t&&"scrollIntoView"in t&&t.scrollIntoView({block:"nearest",inline:"nearest"})}}}),[s,g,j,b,M,O,k]),(0,xf.useEffect)((()=>{if(!w)return;const e=m.current;if(!e)return;const t=[e,P].filter((e=>!!e)),n=e=>{t.every((t=>om(e,t)))&&(null==s||s.setValue(I))};return t.forEach((e=>e.addEventListener("focusout",n))),()=>{t.forEach((e=>e.removeEventListener("focusout",n)))}}),[w,P,s,I]);const N=p.onChange,F=xm(o),V=xm(a),R=fm((e=>{if(null==N||N(e),e.defaultPrevented)return;if(!s)return;const{value:t,selectionStart:n,selectionEnd:i}=e.target,r=e.nativeEvent;if(y.current=!0,function(e){return"input"===e.type}(r)&&(r.isComposing&&(y.current=!1,x.current=!0),w)){const e="insertText"===r.inputType||"insertCompositionText"===r.inputType,s=n===t.length;S(e&&s)}if(V(e)){const r=t===s.getState().value;(0,pv.flushSync)((()=>null==s?void 0:s.setValue(t))),Qf(e.currentTarget,n,i),w&&b&&r&&v()}F(e)&&s.show(),b&&y.current||s.setActiveId(null)})),B=p.onCompositionEnd,D=fm((e=>{y.current=!0,x.current=!1,null==B||B(e),e.defaultPrevented||b&&v()})),L=p.onMouseDown,z=xm(c),G=xm(l),H=fm((e=>{null==L||L(e),e.defaultPrevented||e.button||e.ctrlKey||s&&(s.setActiveId(null),z(e)&&s.setValue(I),G(e)&&am(e.currentTarget,"mouseup",s.show))})),U=p.onKeyDown,W=xm(u),q=fm((e=>{if(null==U||U(e),e.repeat||(y.current=!1),e.defaultPrevented)return;if(e.ctrlKey)return;if(e.altKey)return;if(e.shiftKey)return;if(e.metaKey)return;if(!s)return;const{open:t,activeId:n}=s.getState();t||null===n&&("ArrowUp"!==e.key&&"ArrowDown"!==e.key||W(e)&&(e.preventDefault(),s.show()))})),Z=p.onBlur,K=fm((e=>{y.current=!1,null==Z||Z(e),e.defaultPrevented})),Y=gm(p.id),X=function(e){return"inline"===e||"list"===e||"both"===e||"none"===e}(h)?h:void 0,J=s.useState((e=>null===e.activeId));return p=vf(gf({id:Y,role:"combobox","aria-autocomplete":X,"aria-haspopup":Yf(P,"listbox"),"aria-expanded":E,"aria-controls":null==P?void 0:P.id,"data-active-item":J||void 0,value:I},p),{ref:mm(m,p.ref),onChange:R,onCompositionEnd:D,onMouseDown:H,onKeyDown:q,onBlur:K}),p=hv(vf(gf({store:s,focusable:n},p),{moveOnKeyPress:e=>!function(e,...t){const s="function"==typeof e?e(...t):e;return null!=s&&!s}(d,e)&&(w&&S(!0),!0)})),p=ev(gf({store:s},p)),gf({autoComplete:"off"},p)})),vv=km((e=>Pm("input",gv(e))));function yv(e,t){const s=setTimeout(t,e);return()=>clearTimeout(s)}function xv(...e){return e.join(", ").split(", ").reduce(((e,t)=>{const s=1e3*parseFloat(t||"0s");return s>e?s:e}),0)}function bv(e,t,s){return!(s||!1===t||e&&!t)}var wv=Im((e=>{var t=e,{store:s,alwaysVisible:n}=t,i=yf(t,["store","alwaysVisible"]);const r=Vg();Vf(s=s||r,!1);const o=gm(i.id),[a,l]=(0,xf.useState)(null),c=s.useState("open"),u=s.useState("mounted"),d=s.useState("animated"),h=s.useState("contentElement");hm((()=>{if(d){if(null==h?void 0:h.isConnected)return function(e){let t=requestAnimationFrame((()=>{t=requestAnimationFrame(e)}));return()=>cancelAnimationFrame(t)}((()=>{l(c?"enter":"leave")}));l(null)}}),[d,h,c]),hm((()=>{if(!s)return;if(!d)return;if(!h)return;if(!a)return;if("enter"===a&&!c)return;if("leave"===a&&c)return;if("number"==typeof d){return yv(d,s.stopAnimation)}const{transitionDuration:e,animationDuration:t,transitionDelay:n,animationDelay:i}=getComputedStyle(h),r=xv(n,i)+xv(e,t);return r?yv(r,s.stopAnimation):void 0}),[s,d,h,c,a]);const p=bv(u,(i=bm(i,(e=>(0,me.jsx)(Dg,{value:s,children:e})),[s])).hidden,n),f=p?vf(gf({},i.style),{display:"none"}):i.style;return i=vf(gf({id:o,"data-enter":"enter"===a?"":void 0,"data-leave":"leave"===a?"":void 0,hidden:p},i),{ref:mm(o?s.setContentElement:null,i.ref),style:f})})),_v=km((e=>Pm("div",wv(e))));km((e=>{var t=e,{unmountOnHide:s}=t,n=yf(t,["unmountOnHide"]);const i=Vg();return!1===hg(n.store||i,(e=>!s||(null==e?void 0:e.mounted)))?null:(0,me.jsx)(_v,gf({},n))}));var Sv=Im((e=>{var t=e,{store:s,focusable:n=!0,alwaysVisible:i}=t,r=yf(t,["store","focusable","alwaysVisible"]);const o=qg();Vf(s=s||o,!1);const a=(0,xf.useRef)(null),l=gm(r.id),c=r.onKeyDown,u=fm((e=>{null==c||c(e),e.defaultPrevented||"Escape"===e.key&&(null==s||s.move(null))})),d=(0,xf.useRef)(!1),h=r.onFocusVisible,p=fm((e=>{if(null==h||h(e),e.defaultPrevented)return;if("focus"!==e.type)return;if(!s)return;const{virtualFocus:t}=s.getState();if(!t)return;const{relatedTarget:n,currentTarget:i}=e;n&&i.contains(n)||(d.current=!0,s.setState("virtualFocus",!1))})),f=r.onBlur,m=fm((e=>{null==f||f(e),e.defaultPrevented||d.current&&om(e)&&(d.current=!1,null==s||s.setState("virtualFocus",!0))}));r=bm(r,(e=>(0,me.jsx)(Kg,{value:s,children:e})),[s]);const g=bv(s.useState("mounted"),r.hidden,i),v=g?vf(gf({},r.style),{display:"none"}):r.style,y=s.useState((e=>Array.isArray(e.selectedValue))),x=function(e,t,s){const[n,i]=(0,xf.useState)(s);return hm((()=>{const s=e&&"current"in e?e.current:e,n=null==s?void 0:s.getAttribute(t);null!=n&&i(n)}),[e,t]),n}(a,"role",r.role);return r=vf(gf({id:l,hidden:g,role:"listbox",tabIndex:n?-1:void 0,"aria-multiselectable":("listbox"===x||"tree"===x||"grid"===x)&&y||void 0},r),{ref:mm(l?s.setContentElement:null,a,r.ref),style:v,onKeyDown:u,onFocusVisible:p,onBlur:m}),r=uv(gf({focusable:n},r))})),jv=km((e=>Pm("div",Sv(e))));function Cv(e){if(!e.isTrusted)return!1;const t=e.currentTarget;return"Enter"===e.key?Wf(t)||"SUMMARY"===t.tagName||"A"===t.tagName:" "===e.key&&(Wf(t)||"SUMMARY"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName)}var kv=Symbol("command"),Ev=Im((e=>{var t=e,{clickOnEnter:s=!0,clickOnSpace:n=!0}=t,i=yf(t,["clickOnEnter","clickOnSpace"]);const r=(0,xf.useRef)(null),o=vm(r,i.as),a=i.type,[l,c]=(0,xf.useState)((()=>!!o&&Wf({tagName:o,type:a})));(0,xf.useEffect)((()=>{r.current&&c(Wf(r.current))}),[]);const[u,d]=(0,xf.useState)(!1),h=(0,xf.useRef)(!1),p=Rf(i),[f,m]=function(e,t,s){const n=e.onLoadedMetadataCapture,i=(0,xf.useMemo)((()=>Object.assign((()=>{}),vf(gf({},n),{[t]:s}))),[n,t,s]);return[null==n?void 0:n[t],{onLoadedMetadataCapture:i}]}(i,kv,!0),g=i.onKeyDown,v=fm((e=>{null==g||g(e);const t=e.currentTarget;if(e.defaultPrevented)return;if(f)return;if(p)return;if(!nm(e))return;if(Kf(t))return;if(t.isContentEditable)return;const i=s&&"Enter"===e.key,r=n&&" "===e.key,o="Enter"===e.key&&!s,a=" "===e.key&&!n;if(o||a)e.preventDefault();else if(i||r){const s=Cv(e);if(i){if(!s){e.preventDefault();const s=e,{view:n}=s,i=yf(s,["view"]),r=()=>rm(t,i);zf&&/firefox\//i.test(navigator.userAgent)?am(t,"keyup",r):queueMicrotask(r)}}else r&&(h.current=!0,s||(e.preventDefault(),d(!0)))}})),y=i.onKeyUp,x=fm((e=>{if(null==y||y(e),e.defaultPrevented)return;if(f)return;if(p)return;if(e.metaKey)return;const t=n&&" "===e.key;if(h.current&&t&&(h.current=!1,!Cv(e))){e.preventDefault(),d(!1);const t=e.currentTarget,s=e,{view:n}=s,i=yf(s,["view"]);queueMicrotask((()=>rm(t,i)))}}));return i=vf(gf(gf({"data-active":u?"":void 0,type:l?"button":void 0},m),i),{ref:mm(r,i.ref),onKeyDown:v,onKeyUp:x}),i=uv(i)}));km((e=>Pm("button",e=Ev(e))));var Pv=Im((e=>{var t=e,{store:s,shouldRegisterItem:n=!0,getItem:i=Ff,element:r}=t,o=yf(t,["store","shouldRegisterItem","getItem","element"]);const a=Am();s=s||a;const l=gm(o.id),c=(0,xf.useRef)(r);return(0,xf.useEffect)((()=>{const e=c.current;if(!l)return;if(!e)return;if(!n)return;const t=i({id:l,element:e});return null==s?void 0:s.renderItem(t)}),[l,n,i,s]),o=vf(gf({},o),{ref:mm(c,o.ref)})}));km((e=>Pm("div",Pv(e))));function Iv(e,t=!1){const{top:s}=e.getBoundingClientRect();return t?s+e.clientHeight:s}function Tv(e,t,s,n=!1){var i;if(!t)return;if(!s)return;const{renderedItems:r}=t.getState(),o=Jf(e);if(!o)return;const a=function(e,t=!1){const s=e.clientHeight,{top:n}=e.getBoundingClientRect(),i=1.5*Math.max(.875*s,s-40),r=t?s-i+n:i+n;return"HTML"===e.tagName?r+e.scrollTop:r}(o,n);let l,c;for(let e=0;e=0){void 0!==c&&c{var t=e,{store:s,rowId:n,preventScrollOnKeyDown:i=!1,moveOnKeyPress:r=!0,tabbable:o=!1,getItem:a,"aria-setsize":l,"aria-posinset":c}=t,u=yf(t,["store","rowId","preventScrollOnKeyDown","moveOnKeyPress","tabbable","getItem","aria-setsize","aria-posinset"]);const d=Nm();s=s||d;const h=gm(u.id),p=(0,xf.useRef)(null),f=(0,xf.useContext)(Dm),m=hg(s,(e=>n||(e&&(null==f?void 0:f.baseElement)&&f.baseElement===e.baseElement?f.id:void 0))),g=Rf(u)&&!u.accessibleWhenDisabled,v=(0,xf.useCallback)((e=>{const t=vf(gf({},e),{id:h||e.id,rowId:m,disabled:!!g});return a?a(t):t}),[h,m,g,a]),y=u.onFocus,x=(0,xf.useRef)(!1),b=fm((e=>{if(null==y||y(e),e.defaultPrevented)return;if(sm(e))return;if(!h)return;if(!s)return;const{activeId:t,virtualFocus:n,baseElement:i}=s.getState();if(function(e,t){return!nm(e)&&lf(t,e.target)}(e,s))return;if(t!==h&&s.setActiveId(h),!n)return;if(!nm(e))return;if((r=e.currentTarget).isContentEditable||Kf(r)||"INPUT"===r.tagName&&!Wf(r))return;var r;if(!(null==i?void 0:i.isConnected))return;x.current=!0;e.relatedTarget===i||lf(s,e.relatedTarget)?function(e){e[af]=!0,e.focus({preventScroll:!0})}(i):i.focus()})),w=u.onBlurCapture,_=fm((e=>{if(null==w||w(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState();(null==t?void 0:t.virtualFocus)&&x.current&&(x.current=!1,e.preventDefault(),e.stopPropagation())})),S=u.onKeyDown,j=xm(i),C=xm(r),k=fm((e=>{if(null==S||S(e),e.defaultPrevented)return;if(!nm(e))return;if(!s)return;const{currentTarget:t}=e,n=s.getState(),i=s.item(h),r=!!(null==i?void 0:i.rowId),o="horizontal"!==n.orientation,a="vertical"!==n.orientation,l=()=>!!r||(!!a||(!n.baseElement||!Kf(n.baseElement))),c={ArrowUp:(r||o)&&s.up,ArrowRight:(r||a)&&s.next,ArrowDown:(r||o)&&s.down,ArrowLeft:(r||a)&&s.previous,Home:()=>{if(l())return!r||e.ctrlKey?null==s?void 0:s.first():null==s?void 0:s.previous(-1)},End:()=>{if(l())return!r||e.ctrlKey?null==s?void 0:s.last():null==s?void 0:s.next(-1)},PageUp:()=>Tv(t,s,null==s?void 0:s.up,!0),PageDown:()=>Tv(t,s,null==s?void 0:s.down)}[e.key];if(c){const t=c();if(j(e)||void 0!==t){if(!C(e))return;e.preventDefault(),s.move(t)}}})),E=hg(s,(e=>(null==e?void 0:e.baseElement)||void 0)),P=(0,xf.useMemo)((()=>({id:h,baseElement:E})),[h,E]);u=bm(u,(e=>(0,me.jsx)(Bm.Provider,{value:P,children:e})),[P]);const I=hg(s,(e=>!!e&&e.activeId===h)),T=hg(s,"virtualFocus"),O=function(e,t){const s=t.role,[n,i]=(0,xf.useState)(s);return hm((()=>{const t=e.current;t&&i(t.getAttribute("role")||s)}),[s]),n}(p,u);let A;I&&(!function(e){return"option"===e||"treeitem"===e}(O)?T&&function(e){return"option"===e||"tab"===e||"treeitem"===e||"gridcell"===e||"row"===e||"columnheader"===e||"rowheader"===e}(O)&&(A=!0):A=!0);const M=hg(s,(e=>null!=l?l:e&&(null==f?void 0:f.ariaSetSize)&&f.baseElement===e.baseElement?f.ariaSetSize:void 0)),N=hg(s,(e=>{if(null!=c)return c;if(!e)return;if(!(null==f?void 0:f.ariaPosInSet))return;if(f.baseElement!==e.baseElement)return;const t=e.renderedItems.filter((e=>e.rowId===m));return f.ariaPosInSet+t.findIndex((e=>e.id===h))})),F=hg(s,(e=>!(null==e?void 0:e.renderedItems.length)||!e.virtualFocus&&(!!o||e.activeId===h)));return u=vf(gf({id:h,"aria-selected":A,"data-active-item":I?"":void 0},u),{ref:mm(p,u.ref),tabIndex:F?u.tabIndex:-1,onFocus:b,onBlurCapture:_,onKeyDown:k}),u=Ev(u),u=Pv(vf(gf({store:s},u),{getItem:v,shouldRegisterItem:!!h&&u.shouldRegisterItem})),vf(gf({},u),{"aria-setsize":M,"aria-posinset":N})}));Em((e=>Pm("button",Ov(e))));var Av=Im((e=>{var t=e,{store:s,value:n,hideOnClick:i,selectValueOnClick:r=!0,setValueOnClick:o,focusOnHover:a=!1,moveOnKeyPress:l=!0,getItem:c}=t,u=yf(t,["store","value","hideOnClick","selectValueOnClick","setValueOnClick","focusOnHover","moveOnKeyPress","getItem"]);const d=Wg();Vf(s=s||d,!1);const h=(0,xf.useCallback)((e=>{const t=vf(gf({},e),{value:n});return c?c(t):t}),[n,c]),p=s.useState((e=>Array.isArray(e.selectedValue)));o=null!=o?o:!p,i=null!=i?i:null!=n&&!p;const f=u.onClick,m=xm(o),g=xm(r),v=xm(i),y=fm((e=>{null==f||f(e),e.defaultPrevented||function(e){const t=e.currentTarget;if(!t)return!1;const s=t.tagName.toLowerCase();return!!e.altKey&&("a"===s||"button"===s&&"submit"===t.type||"input"===s&&"submit"===t.type)}(e)||function(e){const t=e.currentTarget;if(!t)return!1;const s=em();if(s&&!e.metaKey)return!1;if(!s&&!e.ctrlKey)return!1;const n=t.tagName.toLowerCase();return"a"===n||"button"===n&&"submit"===t.type||"input"===n&&"submit"===t.type}(e)||(null!=n&&(g(e)&&(null==s||s.setSelectedValue((e=>Array.isArray(e)?e.includes(n)?e.filter((e=>e!==n)):[...e,n]:n))),m(e)&&(null==s||s.setValue(n))),v(e)&&(null==s||s.move(null),null==s||s.hide()))})),x=u.onKeyDown,b=fm((e=>{if(null==x||x(e),e.defaultPrevented)return;const t=null==s?void 0:s.getState().baseElement;if(!t)return;if(Km(t))return;(1===e.key.length||"Backspace"===e.key||"Delete"===e.key)&&(queueMicrotask((()=>t.focus())),Kf(t)&&(null==s||s.setValue(t.value)))})),w=s.useState((e=>function(e,t){if(null!=t)return null!=e&&(Array.isArray(e)?e.includes(t):e===t)}(e.selectedValue,n)));p&&null!=w&&(u=gf({"aria-selected":w},u)),u=bm(u,(e=>(0,me.jsx)(Yg.Provider,{value:n,children:(0,me.jsx)(Xg.Provider,{value:null!=w&&w,children:e})})),[n,w]);const _=s.useState("contentElement");u=vf(gf({role:Xf(_),children:n},u),{onClick:y,onKeyDown:b});const S=xm(l);return u=Ov(vf(gf({store:s},u),{getItem:h,moveOnKeyPress:e=>{if(!S(e))return!1;const t=new Event("combobox-item-move"),n=null==s?void 0:s.getState().baseElement;return null==n||n.dispatchEvent(t),!0}})),u=Qm(gf({store:s,focusOnHover:a},u))})),Mv=Em((e=>Pm("div",Av(e))));function Nv(e){return Nf(e).toLowerCase()}var Fv=Im((e=>{var t=e,{store:s,value:n}=t,i=yf(t,["store","value"]);const r=Wg();s=s||r;const o=(0,xf.useContext)(Yg),a=null!=n?n:o;Vf(s,!1);const l=s.useState((e=>a&&e.value?e.value:void 0)),c=(0,xf.useMemo)((()=>a&&l?function(e,t){t=Nv(t);let s=Nv(e).indexOf(t);const n=[];for(;-1!==s;)0!==s&&n.push((0,me.jsx)("span",{"data-autocomplete-value":"",children:e.substr(0,s)},n.length)),n.push((0,me.jsx)("span",{"data-user-value":"",children:e.substr(s,t.length)},n.length)),s=Nv(e=e.substr(s+t.length)).indexOf(t);return e&&n.push((0,me.jsx)("span",{"data-autocomplete-value":"",children:e},n.length)),n}(a,l):a),[a,l]);return i=gf({children:c},i)})),Vv=km((e=>Pm("span",Fv(e))));var Rv=i(9681),Bv=i.n(Rv);const Dv=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),{CompositeV2:Lv,CompositeItemV2:zv,useCompositeStoreV2:Gv}=Rh(x.privateApis),Hv=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Circle,{cx:12,cy:12,r:3})});function Uv(e=""){return Bv()(e.trim().toLowerCase())}const Wv=[],qv=(e,t)=>e.singleSelection?t?.value:Array.isArray(t?.value)?t.value:!Array.isArray(t?.value)&&t?.value?[t.value]:Wv,Zv=(e,t,s)=>e.singleSelection?s:Array.isArray(t?.value)?t.value.includes(s)?t.value.filter((e=>e!==s)):[...t.value,s]:[s];function Kv({view:e,filter:t,onChangeView:s}){const n=Gv({virtualFocus:!0,focusLoop:!0,defaultActiveId:1===t.operators?.length?void 0:null}),i=e.filters.find((e=>e.field===t.field)),r=qv(t,i);return(0,me.jsx)(Lv,{store:n,role:"listbox",className:"dataviews-search-widget-listbox","aria-label":(0,b.sprintf)((0,b.__)("List of: %1$s"),t.name),onFocusVisible:()=>{n.getState().activeId||n.move(n.first())},render:(0,me.jsx)(Wm,{store:n}),children:t.elements.map((o=>(0,me.jsxs)($m,{store:n,render:(0,me.jsx)(zv,{render:(0,me.jsx)("div",{"aria-label":o.label,role:"option",className:"dataviews-search-widget-listitem"}),onClick:()=>{const n=i?[...e.filters.map((e=>e.field===t.field?{...e,operator:i.operator||t.operators[0],value:Zv(t,i,o.value)}:e))]:[...e.filters,{field:t.field,operator:t.operators[0],value:Zv(t,i,o.value)}];s({...e,page:1,filters:n})}}),children:[(0,me.jsxs)("span",{className:"dataviews-search-widget-listitem-check",children:[t.singleSelection&&r===o.value&&(0,me.jsx)(x.Icon,{icon:Hv}),!t.singleSelection&&r.includes(o.value)&&(0,me.jsx)(x.Icon,{icon:Dv})]}),(0,me.jsxs)("span",{children:[o.label,!!o.description&&(0,me.jsx)("span",{className:"dataviews-search-widget-listitem-description",children:o.description})]})]},o.value)))})}function Yv({view:e,filter:t,onChangeView:s}){const[n,i]=(0,d.useState)(""),r=(0,d.useDeferredValue)(n),o=e.filters.find((e=>e.field===t.field)),a=qv(t,o),l=(0,d.useMemo)((()=>{const e=Uv(r);return t.elements.filter((t=>Uv(t.label).includes(e)))}),[t.elements,r]);return(0,me.jsxs)(Jg,{resetValueOnSelect:!1,selectedValue:a,setSelectedValue:n=>{const i=o?[...e.filters.map((e=>e.field===t.field?{...e,operator:o.operator||t.operators[0],value:n}:e))]:[...e.filters,{field:t.field,operator:t.operators[0],value:n}];s({...e,page:1,filters:i})},setValue:i,children:[(0,me.jsxs)("div",{className:"dataviews-search-widget-filter-combobox__wrapper",children:[(0,me.jsx)($g,{render:(0,me.jsx)(x.VisuallyHidden,{children:(0,b.__)("Search items")}),children:(0,b.__)("Search items")}),(0,me.jsx)(vv,{autoSelect:"always",placeholder:(0,b.__)("Search"),className:"dataviews-search-widget-filter-combobox__input"}),(0,me.jsx)("div",{className:"dataviews-search-widget-filter-combobox__icon",children:(0,me.jsx)(x.Icon,{icon:ds})})]}),(0,me.jsxs)(jv,{className:"dataviews-search-widget-filter-combobox-list",alwaysVisible:!0,children:[l.map((e=>(0,me.jsxs)(Mv,{value:e.value,className:"dataviews-search-widget-listitem",hideOnClick:!1,setValueOnClick:!1,focusOnHover:!0,children:[(0,me.jsxs)("span",{className:"dataviews-search-widget-listitem-check",children:[t.singleSelection&&a===e.value&&(0,me.jsx)(x.Icon,{icon:Hv}),!t.singleSelection&&a.includes(e.value)&&(0,me.jsx)(x.Icon,{icon:Dv})]}),(0,me.jsxs)("span",{children:[(0,me.jsx)(Vv,{className:"dataviews-search-widget-filter-combobox-item-value",value:e.label}),!!e.description&&(0,me.jsx)("span",{className:"dataviews-search-widget-listitem-description",children:e.description})]})]},e.value))),!l.length&&(0,me.jsx)("p",{children:(0,b.__)("No results found")})]})]})}function Xv(e){const t=e.filter.elements.length>10?Yv:Kv;return(0,me.jsx)(t,{...e})}const Jv="Enter",Qv=" ",$v=({activeElements:e,filterInView:t,filter:s})=>{if(void 0===e||0===e.length)return s.name;const n={Name:(0,me.jsx)("span",{className:"dataviews-filter-summary__filter-text-name"}),Value:(0,me.jsx)("span",{className:"dataviews-filter-summary__filter-text-value"})};return t?.operator===Lh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is any: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===zh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is none: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===Gh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is all: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===Hh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is not all: %2$s"),s.name,e.map((e=>e.label)).join(", ")),n):t?.operator===Bh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is: %2$s"),s.name,e[0].label),n):t?.operator===Dh?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("%1$s is not: %2$s"),s.name,e[0].label),n):(0,b.sprintf)((0,b.__)("Unknown status for %1$s"),s.name)};function ey({filter:e,view:t,onChangeView:s}){const n=e.operators?.map((e=>({value:e,label:Wh[e]?.label}))),i=t.filters.find((t=>t.field===e.field)),r=i?.operator||e.operators[0];return n.length>1&&(0,me.jsxs)(x.__experimentalHStack,{spacing:2,justify:"flex-start",className:"dataviews-filter-summary__operators-container",children:[(0,me.jsx)(x.FlexItem,{className:"dataviews-filter-summary__operators-filter-name",children:e.name}),(0,me.jsx)(x.SelectControl,{label:(0,b.__)("Conditions"),value:r,options:n,onChange:n=>{const r=n,o=i?[...t.filters.map((t=>t.field===e.field?{...t,operator:r}:t))]:[...t.filters,{field:e.field,operator:r,value:void 0}];s({...t,page:1,filters:o})},size:"small",__nextHasNoMarginBottom:!0,hideLabelFromVision:!0})]})}function ty({addFilterRef:e,openedFilter:t,...s}){const n=(0,d.useRef)(null),{filter:i,view:r,onChangeView:o}=s,a=r.filters.find((e=>e.field===i.field)),l=i.elements.filter((e=>i.singleSelection?e.value===a?.value:a?.value?.includes(e.value))),c=i.isPrimary,u=void 0!==a?.value,h=!c||u;return(0,me.jsx)(x.Dropdown,{defaultOpen:t===i.field,contentClassName:"dataviews-filter-summary__popover",popoverProps:{placement:"bottom-start",role:"dialog"},onClose:()=>{n.current?.focus()},renderToggle:({isOpen:t,onToggle:s})=>(0,me.jsxs)("div",{className:"dataviews-filter-summary__chip-container",children:[(0,me.jsx)(x.Tooltip,{text:(0,b.sprintf)((0,b.__)("Filter by: %1$s"),i.name.toLowerCase()),placement:"top",children:(0,me.jsx)("div",{className:Qt("dataviews-filter-summary__chip",{"has-reset":h,"has-values":u}),role:"button",tabIndex:0,onClick:s,onKeyDown:e=>{[Jv,Qv].includes(e.key)&&(s(),e.preventDefault())},"aria-pressed":t,"aria-expanded":t,ref:n,children:(0,me.jsx)($v,{activeElements:l,filterInView:a,filter:i})})}),h&&(0,me.jsx)(x.Tooltip,{text:c?(0,b.__)("Reset"):(0,b.__)("Remove"),placement:"top",children:(0,me.jsx)("button",{className:Qt("dataviews-filter-summary__chip-remove",{"has-values":u}),onClick:()=>{o({...r,page:1,filters:r.filters.filter((e=>e.field!==i.field))}),c?n.current?.focus():e.current?.focus()},children:(0,me.jsx)(x.Icon,{icon:hd})})})]}),renderContent:()=>(0,me.jsxs)(x.__experimentalVStack,{spacing:0,justify:"flex-start",children:[(0,me.jsx)(ey,{...s}),(0,me.jsx)(Xv,{...s})]})})}const{DropdownMenuV2:sy,DropdownMenuItemV2:ny,DropdownMenuItemLabelV2:iy}=Rh(x.privateApis);const ry=(0,d.forwardRef)((function({filters:e,view:t,onChangeView:s,setOpenedFilter:n},i){if(!e.length||e.every((({isPrimary:e})=>e)))return null;const r=e.filter((e=>!e.isVisible));return(0,me.jsx)(sy,{trigger:(0,me.jsx)(x.Button,{__experimentalIsFocusable:!0,size:"compact",className:"dataviews-filters-button",variant:"tertiary",disabled:!r.length,ref:i,children:(0,b.__)("Add filter")}),children:r.map((e=>(0,me.jsx)(ny,{onClick:()=>{n(e.field),s({...t,page:1,filters:[...t.filters||[],{field:e.field,value:void 0,operator:e.operators[0]}]})},children:(0,me.jsx)(iy,{children:e.name})},e.field)))})}));function oy({filters:e,view:t,onChangeView:s}){const n=!t.search&&!t.filters?.some((t=>{return void 0!==t.value||(s=t.field,!e.some((e=>e.field===s&&e.isPrimary)));var s}));return(0,me.jsx)(x.Button,{disabled:n,__experimentalIsFocusable:!0,size:"compact",variant:"tertiary",className:"dataviews-filters__reset-button",onClick:()=>{s({...t,page:1,search:"",filters:[]})},children:(0,b.__)("Reset")})}const ay=(0,d.memo)((function({fields:e,view:t,onChangeView:s,openedFilter:n,setOpenedFilter:i}){const r=(0,d.useRef)(null),o=[];e.forEach((e=>{if(!e.elements?.length)return;const s=vp(e);if(0===s.length)return;const n=!!e.filterBy?.isPrimary;o.push({field:e.id,name:e.header,elements:e.elements,singleSelection:s.some((e=>[Bh,Dh].includes(e))),operators:s,isVisible:n||t.filters.some((t=>t.field===e.id&&Uh.includes(t.operator))),isPrimary:n})})),o.sort(((e,t)=>e.isPrimary&&!t.isPrimary?-1:!e.isPrimary&&t.isPrimary?1:e.name.localeCompare(t.name)));const a=(0,me.jsx)(ry,{filters:o,view:t,onChangeView:s,ref:r,setOpenedFilter:i},"add-filter"),l=[...o.map((e=>e.isVisible?(0,me.jsx)(ty,{filter:e,view:t,onChangeView:s,addFilterRef:r,openedFilter:n},e.field):null)),a];return l.length>1&&l.push((0,me.jsx)(oy,{filters:o,view:t,onChangeView:s},"reset-filters")),(0,me.jsx)(x.__experimentalHStack,{justify:"flex-start",style:{width:"fit-content"},wrap:!0,children:l})})),ly=ay,cy=(0,d.memo)((function({label:e,view:t,onChangeView:s}){const[n,i,r]=(0,v.useDebouncedInput)(t.search);(0,d.useEffect)((()=>{var e;i(null!==(e=t.search)&&void 0!==e?e:"")}),[t.search,i]);const o=(0,d.useRef)(s),a=(0,d.useRef)(t);(0,d.useEffect)((()=>{o.current=s,a.current=t}),[s,t]),(0,d.useEffect)((()=>{o.current({...a.current,page:1,search:r})}),[r]);const l=e||(0,b.__)("Search");return(0,me.jsx)(x.SearchControl,{__nextHasNoMarginBottom:!0,onChange:i,value:n,label:l,placeholder:l,size:"compact"})})),uy=cy;function dy(e){return e.map((e=>{const t=e.getValue||(({item:t})=>t[e.id]);return{...e,header:e.header||e.id,getValue:t,render:e.render||t}}))}const hy={init:{bottom:-48},open:{bottom:24,transition:{bottom:{type:"tween",duration:.2,ease:[0,0,.2,1]}}},exit:{opacity:0,bottom:24,transition:{opacity:{type:"tween",duration:.2,ease:[0,0,.2,1]}}}};function py({action:e,onClick:t,isBusy:s,items:n}){const i="string"==typeof e.label?e.label:e.label(n);return(0,me.jsx)(x.ToolbarButton,{disabled:s,label:i,icon:e.icon,isDestructive:e.isDestructive,size:"compact",onClick:t,isBusy:s,__experimentalIsFocusable:!0,tooltipPosition:"top"})}const fy=[];function my({action:e,selectedItems:t,actionInProgress:s,setActionInProgress:n}){const i=(0,d.useMemo)((()=>t.filter((t=>!e.isEligible||e.isEligible(t)))),[e,t]);return"RenderModal"in e?(0,me.jsx)(pp,{action:e,items:i,ActionTrigger:py},e.id):(0,me.jsx)(py,{action:e,onClick:()=>{n(e.id),e.callback(t)},items:i,isBusy:s===e.id},e.id)}function gy(e,t,s,n,i,r){return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.ToolbarGroup,{children:(0,me.jsx)("div",{className:"dataviews-bulk-actions__selection-count",children:1===e.length?(0,b.__)("1 item selected"):(0,b.sprintf)((0,b._n)("%s item selected","%s items selected",e.length),e.length)})}),(0,me.jsx)(x.ToolbarGroup,{children:t.map((e=>(0,me.jsx)(my,{action:e,selectedItems:s,actionInProgress:n,setActionInProgress:i},e.id)))}),(0,me.jsx)(x.ToolbarGroup,{children:(0,me.jsx)(x.ToolbarButton,{icon:hd,showTooltip:!0,tooltipPosition:"top",label:(0,b.__)("Cancel"),disabled:!!n,onClick:()=>{r(fy)}})})]})}function vy({selection:e,actionsToShow:t,selectedItems:s,onSelectionChange:n}){const[i,r]=(0,d.useState)(null),o=(0,d.useRef)(null);return i?(o.current||(o.current=gy(e,t,s,i,r,n)),o.current):(o.current&&(o.current=null),gy(e,t,s,i,r,n))}function yy({data:e,selection:t,actions:s=fy,onSelectionChange:n,getItemId:i}){const r=(0,v.useReducedMotion)(),o=(0,d.useMemo)((()=>e.filter((e=>t.includes(i(e))))),[t,e,i]),a=(0,d.useMemo)((()=>s.filter((e=>e.supportsBulk&&e.icon&&o.some((t=>!e.isEligible||e.isEligible(t)))))),[s,o]);return t&&0===t.length||0===a.length?null:(0,me.jsx)(x.__unstableAnimatePresence,{children:(0,me.jsx)(x.__unstableMotion.div,{layout:!r,initial:"init",animate:"open",exit:"exit",variants:r?void 0:hy,className:"dataviews-bulk-actions",children:(0,me.jsx)(x.Toolbar,{label:(0,b.__)("Bulk actions"),children:(0,me.jsx)("div",{className:"dataviews-bulk-actions-toolbar-wrapper",children:(0,me.jsx)(vy,{selection:t,actionsToShow:a,selectedItems:o,onSelectionChange:n})})})})})}const xy=e=>e.id,by=()=>{};function wy({view:e,onChangeView:t,fields:s,search:n=!0,searchLabel:i,actions:r=[],data:o,getItemId:a=xy,isLoading:l=!1,paginationInfo:c,supportedLayouts:u,selection:h,setSelection:p,onSelectionChange:f=by}){const[m,g]=(0,d.useState)([]);let v,y;void 0!==h&&void 0!==p?(v=h,y=p):(v=m,y=g);const[b,w]=(0,d.useState)(null),_=(0,d.useCallback)((e=>{y(e.map((e=>a(e)))),f(e)}),[y,a,f]),S=Wp.find((t=>t.type===e.type))?.component,j=(0,d.useMemo)((()=>dy(s)),[s]),C=function(e,t){return(0,d.useMemo)((()=>t.some((t=>e.some((e=>e.supportsBulk&&(!e.isEligible||e.isEligible(t))))))),[e,t])}(r,o),k=(0,d.useMemo)((()=>v.filter((e=>o.some((t=>a(t)===e))))),[v,o,a]);return(0,me.jsxs)("div",{className:"dataviews-wrapper",children:[(0,me.jsxs)(x.__experimentalHStack,{alignment:"top",justify:"start",className:"dataviews-filters__view-actions",children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"start",className:"dataviews-filters__container",wrap:!0,children:[n&&(0,me.jsx)(uy,{label:i,view:e,onChangeView:t}),(0,me.jsx)(ly,{fields:j,view:e,onChangeView:t,openedFilter:b,setOpenedFilter:w})]}),[Xh,Jh].includes(e.type)&&C&&(0,me.jsx)(kp,{actions:r,data:o,onSelectionChange:_,selection:k,getItemId:a}),(0,me.jsx)(nf,{fields:j,view:e,onChangeView:t,supportedLayouts:u})]}),(0,me.jsx)(S,{actions:r,data:o,fields:j,getItemId:a,isLoading:l,onChangeView:t,onSelectionChange:_,selection:k,setOpenedFilter:w,view:e}),(0,me.jsx)(Fh,{view:e,onChangeView:t,paginationInfo:c}),[Xh,Jh].includes(e.type)&&C&&(0,me.jsx)(yy,{data:o,actions:r,selection:k,onSelectionChange:_,getItemId:a})]})}function _y({title:e,subTitle:t,actions:s}){return(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-page-header",as:"header",spacing:0,children:[(0,me.jsxs)(x.__experimentalHStack,{className:"edit-site-page-header__page-title",children:[(0,me.jsx)(x.__experimentalHeading,{as:"h2",level:3,weight:500,className:"edit-site-page-header__title",children:e}),(0,me.jsx)(x.FlexItem,{className:"edit-site-page-header__actions",children:s})]}),t&&(0,me.jsx)(x.__experimentalText,{variant:"muted",as:"p",className:"edit-site-page-header__sub-title",children:t})]})}const{NavigableRegion:Sy}=se(h.privateApis);function jy({title:e,subTitle:t,actions:s,children:n,className:i,hideTitleFromUI:r=!1}){const o=Qt("edit-site-page",i);return(0,me.jsx)(Sy,{className:o,ariaLabel:e,children:(0,me.jsxs)("div",{className:"edit-site-page-content",children:[!r&&e&&(0,me.jsx)(_y,{title:e,subTitle:t,actions:s}),n]})})}const Cy=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"M14.5 5.5h-7V7h7V5.5ZM7.5 9h7v1.5h-7V9Zm7 3.5h-7V14h7v-1.5Z"}),(0,me.jsx)(us.Path,{d:"M16 2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2ZM6 3.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5Z"}),(0,me.jsx)(us.Path,{d:"M20 8v11c0 .69-.31 1-.999 1H6v1.5h13.001c1.52 0 2.499-.982 2.499-2.5V8H20Z"})]}),ky=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z"})}),Ey=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z"})}),Py=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 0 4-4H8a4 4 0 0 0 4 4Z"})}),Iy=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8 4a4 4 0 0 1-4-4h4V8a4 4 0 0 1 0 8Z"})}),Ty=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 18.5A6.5 6.5 0 0 1 6.93 7.931l9.139 9.138A6.473 6.473 0 0 1 12 18.5Zm5.123-2.498a6.5 6.5 0 0 0-9.124-9.124l9.124 9.124ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"})}),Oy={[qe]:{primaryField:"title"},[We]:{mediaField:"featured-image",primaryField:"title"},[Ze]:{primaryField:"title",mediaField:"featured-image"}},Ay={type:Ze,search:"",filters:[],page:1,perPage:20,sort:{field:"date",direction:"desc"},hiddenFields:["date","featured-image"],layout:{...Oy[Ze]}},My={page:[{title:(0,b.__)("All pages"),slug:"all",icon:Cy,view:Ay},{title:(0,b.__)("Published"),slug:"published",icon:ky,view:{...Ay,filters:[{field:"status",operator:Ye,value:"publish"}]}},{title:(0,b.__)("Scheduled"),slug:"future",icon:Ey,view:{...Ay,filters:[{field:"status",operator:Ye,value:"future"}]}},{title:(0,b.__)("Drafts"),slug:"drafts",icon:Py,view:{...Ay,filters:[{field:"status",operator:Ye,value:"draft"}]}},{title:(0,b.__)("Pending"),slug:"pending",icon:Iy,view:{...Ay,filters:[{field:"status",operator:Ye,value:"pending"}]}},{title:(0,b.__)("Private"),slug:"private",icon:Ty,view:{...Ay,filters:[{field:"status",operator:Ye,value:"private"}]}},{title:(0,b.__)("Trash"),slug:"trash",icon:sn,view:{...Ay,filters:[{field:"status",operator:Ye,value:"trash"}]}}]};function Ny({onSave:e,onClose:t}){const[s,n]=(0,d.useState)(!1),[i,r]=(0,d.useState)(""),{saveEntityRecord:a}=(0,l.useDispatch)(_.store),{createErrorNotice:c,createSuccessNotice:u}=(0,l.useDispatch)(w.store),{resolveSelect:h}=(0,l.useRegistry)();return(0,me.jsx)(x.Modal,{title:(0,b.__)("Draft a new page"),onRequestClose:t,children:(0,me.jsx)("form",{onSubmit:async function(t){if(t.preventDefault(),!s){n(!0);try{const t=await h(_.store).getPostType("page"),s=await a("postType","page",{status:"draft",title:i,slug:i||(0,b.__)("No title"),content:t.template&&t.template.length?(0,o.serialize)((0,o.synchronizeBlocksWithTemplate)([],t.template)):void 0},{throwOnError:!0});e(s),u((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,cs.decodeEntities)(s.title?.rendered||i)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the page.");c(t,{type:"snackbar"})}finally{n(!1)}}},children:(0,me.jsxs)(x.__experimentalVStack,{spacing:3,children:[(0,me.jsx)(x.TextControl,{__next40pxDefaultSize:!0,label:(0,b.__)("Page title"),onChange:r,placeholder:(0,b.__)("No title"),value:i}),(0,me.jsxs)(x.__experimentalHStack,{spacing:2,justify:"end",children:[(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:s,"aria-disabled":s,children:(0,b.__)("Create draft")})]})]})})})}const Fy=function({id:e,size:t=["large","medium","thumbnail"],...s}){const{record:n}=(0,_.useEntityRecord)("root","media",e),i=t.find((e=>!!n?.media_details?.sizes[e])),r=n?.media_details?.sizes[i]?.source_url||n?.source_url;return r?(0,me.jsx)("img",{...s,src:r,alt:n.alt_text}):null},Vy=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),{useHistory:Ry}=se(Xt.privateApis),By=()=>{const e=Ry();return(0,d.useMemo)((()=>({id:"edit-post",label:(0,b.__)("Edit"),isPrimary:!0,icon:Vy,isEligible:e=>"trash"!==e.status&&e.type!==Be.theme,callback(t){const s=t[0];e.push({postId:s.id,postType:s.type,canvas:"edit"})}})),[e])},{usePostActions:Dy}=se(h.privateApis),{useLocation:Ly,useHistory:zy}=se(Xt.privateApis),Gy=[],Hy=e=>(0,qd.dateI18n)((0,qd.getSettings)().formats.datetimeAbbreviated,(0,qd.getDate)(e));const Uy=[{value:"draft",label:(0,b.__)("Draft")},{value:"future",label:(0,b.__)("Scheduled")},{value:"pending",label:(0,b.__)("Pending Review")},{value:"private",label:(0,b.__)("Private")},{value:"publish",label:(0,b.__)("Published")},{value:"trash",label:(0,b.__)("Trash")}],Wy="draft,future,pending,private,publish";function qy({item:e,viewType:t}){const s="trash"===e.status,{onClick:n}=on({postId:e.id,postType:e.type,canvas:"edit"}),i=!!e.featured_media,r=t===We?["large","full","medium","thumbnail"]:["thumbnail","medium","large","full"],o=i?(0,me.jsx)(Fy,{className:"edit-site-page-pages__featured-image",id:e.featured_media,size:r}):null,a=t!==Ze&&!s;return(0,me.jsx)("div",{className:`edit-site-page-pages__featured-image-wrapper is-layout-${t}`,children:a?(0,me.jsx)("button",{className:"page-pages-preview-field__button",type:"button",onClick:n,"aria-label":e.title?.rendered||(0,b.__)("(no title)"),children:o}):o})}function Zy(e){return e.id.toString()}function Ky(){var e,t;const s="page",[n,i]=function(e){const{params:{activeView:t="all",isCustom:s="false",layout:n}}=Ly(),i=zy(),r=(0,d.useMemo)((()=>{const i="false"===s&&My[e].find((({slug:e})=>e===t))?.view;return"false"===s&&n?{...i,type:n,layout:{...Oy[n]||{}}}:i}),[s,t,n,e]),[o,a]=(0,d.useState)(r);(0,d.useEffect)((()=>{r&&a(r)}),[r]);const c=(0,l.useSelect)((e=>{if("true"!==s)return;const{getEditedEntityRecord:n}=e(_.store);return n("postType","wp_dataviews",Number(t))}),[t,s]),{editEntityRecord:u}=(0,l.useDispatch)(_.store),h=(0,d.useMemo)((()=>{const e=c?.content&&JSON.parse(c?.content);return e?{...e,layout:{...Oy[e?.type]||{}}}:e}),[c?.content]),p=(0,d.useCallback)((e=>{u("postType","wp_dataviews",c?.id,{content:JSON.stringify(e)})}),[u,c?.id]),f=(0,d.useCallback)((e=>{if(e.type!==o?.type){const{params:t}=i.getLocationWithParams();i.push({...t,layout:e.type})}a(e)}),[i,o?.type]);return"false"===s?[o,f]:"true"===s&&h?[h,p]:[My[e][0].view,f]}(s),r=zy(),{params:{postId:o}}=Ly(),[a,c]=(0,d.useState)([o]),u=(0,d.useCallback)((e=>{var t;const{params:s}=r.getLocationWithParams();"false"===(null!==(t=s.isCustom)&&void 0!==t?t:"false")&&n?.type===Ze&&r.push({...s,postId:1===e.length?e[0].id:void 0})}),[r,n?.type]),h=(0,d.useMemo)((()=>{const e={};return n.filters.forEach((t=>{"status"===t.field&&t.operator===Ye&&(e.status=t.value),"author"===t.field&&t.operator===Ye?e.author=t.value:"author"===t.field&&t.operator===Xe&&(e.author_exclude=t.value)})),e.status&&""!==e.status||(e.status=Wy),{per_page:n.perPage,page:n.page,_embed:"author",order:n.sort?.direction,orderby:n.sort?.field,search:n.search,...e}}),[n]),{records:p,isResolving:f,totalItems:m,totalPages:g}=(0,_.useEntityRecords)("postType",s,h),y=null!==(e=p?.map((e=>Zy(e))))&&void 0!==e?e:[],w=(null!==(t=(0,v.usePrevious)(y))&&void 0!==t?t:[]).filter((e=>!y.includes(e))).includes(o);(0,d.useEffect)((()=>{w&&r.push({...r.getLocationWithParams().params,postId:void 0})}),[w,r]);const{records:S,isResolving:j}=(0,_.useEntityRecords)("root","user",{per_page:-1}),C=(0,d.useMemo)((()=>({totalItems:m,totalPages:g})),[m,g]),{frontPageId:k,postsPageId:E,addNewLabel:P,canCreatePage:I}=(0,l.useSelect)((e=>{const{getEntityRecord:t,getPostType:s,canUser:n}=e(_.store),i=t("root","site");return{frontPageId:i?.page_on_front,postsPageId:i?.page_for_posts,addNewLabel:s("page")?.labels?.add_new_item,canCreatePage:n("create","pages")}})),T=(0,d.useMemo)((()=>[{id:"featured-image",header:(0,b.__)("Featured Image"),getValue:({item:e})=>e.featured_media,render:({item:e})=>(0,me.jsx)(qy,{item:e,viewType:n.type}),enableSorting:!1,width:"1%"},{header:(0,b.__)("Title"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>{const t=[qe,We].includes(n.type)&&"trash"!==e.status?(0,me.jsx)(an,{params:{postId:e.id,postType:e.type,canvas:"edit"},children:(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")}):(0,me.jsx)("span",{children:(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")});let s="";return e.id===k?s=(0,me.jsx)("span",{className:"edit-site-page-pages__title-badge",children:(0,b.__)("Front Page")}):e.id===E&&(s=(0,me.jsx)("span",{className:"edit-site-page-pages__title-badge",children:(0,b.__)("Posts Page")})),(0,me.jsxs)(x.__experimentalHStack,{className:"edit-site-page-pages-title",alignment:"center",justify:"flex-start",children:[t,s]})},maxWidth:300,enableHiding:!1},{header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e._embedded?.author[0]?.name,elements:S?.map((({id:e,name:t})=>({value:e,label:t})))||[]},{header:(0,b.__)("Status"),id:"status",getValue:({item:e})=>{var t;return null!==(t=Uy.find((({value:t})=>t===e.status))?.label)&&void 0!==t?t:e.status},elements:Uy,enableSorting:!1,filterBy:{operators:[Ye]}},{header:(0,b.__)("Date"),id:"date",render:({item:e})=>{if(["draft","private"].includes(e.status))return(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Modified: "),Hy(e.date)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})});if("future"===e.status)return(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Scheduled: "),Hy(e.date)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})});const t=(0,qd.getDate)(e.modified)>(0,qd.getDate)(e.date)?e.modified:e.date;if("pending"===e.status)return(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Modified: "),Hy(t)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})});return"publish"===e.status?(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)("Published: "),Hy(t)),{span:(0,me.jsx)("span",{}),time:(0,me.jsx)("time",{})}):(0,me.jsx)("time",{children:Hy(e.date)})}}]),[S,n.type,k,E]),O=Dy({postType:"page",context:"list"}),A=By(),M=(0,d.useMemo)((()=>[A,...O]),[O,A]),N=(0,d.useCallback)((e=>{e.type!==n.type&&(e={...e,layout:{...Oy[e.type]}}),i(e)}),[n.type,i]),[F,V]=(0,d.useState)(!1),R=()=>V(!1);return(0,me.jsx)(jy,{title:(0,b.__)("Pages"),actions:P&&I&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.Button,{variant:"primary",onClick:()=>V(!0),__next40pxDefaultSize:!0,children:P}),F&&(0,me.jsx)(Ny,{onSave:({type:e,id:t})=>{r.push({postId:t,postType:e,canvas:"edit"}),R()},onClose:R})]}),children:(0,me.jsx)(wy,{paginationInfo:C,fields:T,actions:M,data:p||Gy,isLoading:f||j,view:n,onChangeView:N,selection:a,setSelection:c,onSelectionChange:u,getItemId:Zy})})}function Yy(e=""){return Bv()(e.trim().toLowerCase())}const Xy=[];function Jy(e,t,s){if(!e)return{data:Xy,paginationInfo:{totalItems:0,totalPages:0}};const n=dy(s);let i=[...e];if(t.search){const e=Yy(t.search);i=i.filter((t=>n.filter((e=>e.enableGlobalSearch)).map((e=>Yy(e.getValue({item:t})))).some((t=>t.includes(e)))))}if(t.filters.length>0&&t.filters.forEach((e=>{const t=n.find((t=>t.id===e.field));t&&(e.operator===Lh&&e?.value?.length>0?i=i.filter((s=>{const n=t.getValue({item:s});return Array.isArray(n)?e.value.some((e=>n.includes(e))):"string"==typeof n&&e.value.includes(n)})):e.operator===zh&&e?.value?.length>0?i=i.filter((s=>{const n=t.getValue({item:s});return Array.isArray(n)?!e.value.some((e=>n.includes(e))):"string"==typeof n&&!e.value.includes(n)})):e.operator===Gh&&e?.value?.length>0?i=i.filter((s=>e.value.every((e=>t.getValue({item:s})?.includes(e))))):e.operator===Hh&&e?.value?.length>0?i=i.filter((s=>e.value.every((e=>!t.getValue({item:s})?.includes(e))))):e.operator===Bh?i=i.filter((s=>e.value===t.getValue({item:s}))):e.operator===Dh&&(i=i.filter((s=>e.value!==t.getValue({item:s})))))})),t.sort){const e=t.sort.field,s=n.find((t=>t.id===e));s&&i.sort(((e,n)=>{var i,r;const o=null!==(i=s.getValue({item:e}))&&void 0!==i?i:"",a=null!==(r=s.getValue({item:n}))&&void 0!==r?r:"";return"asc"===t.sort?.direction?o.localeCompare(a):a.localeCompare(o)}))}let r=i.length,o=1;if(void 0!==t.page&&void 0!==t.perPage){const e=(t.page-1)*t.perPage;r=i?.length||0,o=Math.ceil(r/t.perPage),i=i?.slice(e,e+t.perPage)}return{data:i,paginationInfo:{totalItems:r,totalPages:o}}}const Qy=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M15 11h-.2V9c0-1.5-1.2-2.8-2.8-2.8S9.2 7.5 9.2 9v2H9c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h6c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm-1.8 0h-2.5V9c0-.7.6-1.2 1.2-1.2s1.2.6 1.2 1.2v2z"})}),$y=(0,window.wp.priorityQueue.createQueue)();function ex({children:e,placeholder:t}){const[s,n]=(0,d.useState)(!1);return(0,d.useEffect)((()=>{const e={};return $y.add(e,(()=>{(0,d.flushSync)((()=>{n(!0)}))})),()=>{$y.cancel(e)}}),[]),s?e:t}const tx=(e,t,s)=>t===s.findIndex((t=>e.name===t.name));function sx(){var e;const t=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt));return t()}),[]),s=null!==(e=t.__experimentalAdditionalBlockPatterns)&&void 0!==e?e:t.__experimentalBlockPatterns,n=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()),[]),i=(0,d.useMemo)((()=>[...s||[],...n||[]].filter(tx)),[s,n]);return(0,d.useMemo)((()=>{const{__experimentalAdditionalBlockPatterns:e,...s}=t;return{...s,__experimentalBlockPatterns:i,__unstableIsPreviewMode:!0}}),[t,i])}const{extractWords:nx,getNormalizedSearchTerms:ix,normalizeString:rx}=se(y.privateApis),ox=e=>e.name||"",ax=e=>e.title,lx=e=>e.description||"",cx=e=>e.keywords||[],ux=()=>!1,dx=(e=[],t="",s={})=>{const n=ix(t),i=s.categoryId!==De&&!n.length,r={...s,onlyFilterByCategory:i},o=i?0:1,a=e.map((e=>[e,hx(e,t,r)])).filter((([,e])=>e>o));return 0===n.length||a.sort((([,e],[,t])=>t-e)),a.map((([e])=>e))};function hx(e,t,s){const{categoryId:n,getName:i=ox,getTitle:r=ax,getDescription:o=lx,getKeywords:a=cx,hasCategory:l=ux,onlyFilterByCategory:c}=s;let u=n===De||n===Re||n===Le&&e.type===Be.user||l(e,n)?1:0;if(!u||c)return u;const d=i(e),h=r(e),p=o(e),f=a(e),m=rx(t),g=rx(h);if(m===g)u+=30;else if(g.startsWith(m))u+=20;else{const e=[d,h,p,...f].join(" ");0===((e,t)=>e.filter((e=>!ix(t).some((t=>t.includes(e))))))(nx(m),e).length&&(u+=10)}return u}const px=[],fx=(e,t)=>e&&t?e+"//"+t:null,mx=(0,l.createSelector)(((e,t,s="")=>{var n;const{getEntityRecords:i,isResolving:r}=e(_.store),{__experimentalGetDefaultTemplatePartAreas:a}=e(h.store),l={per_page:-1},c=(null!==(n=i("postType",Ne,l))&&void 0!==n?n:px).map((e=>(e=>({blocks:(0,o.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0}),categories:[e.area],description:e.description||"",isCustom:e.source===Fe.custom,keywords:e.keywords||[],id:fx(e.theme,e.slug),name:fx(e.theme,e.slug),title:(0,cs.decodeEntities)(e.title.rendered),type:e.type,_links:e._links,templatePart:e}))(e))),u=(a()||[]).map((e=>e.area)),d=r("getEntityRecords",["postType",Ne,l]),p=dx(c,s,{categoryId:t,hasCategory:(e,t)=>t!==Ve?e.templatePart.area===t:e.templatePart.area===t||!u.includes(e.templatePart.area)});return{patterns:p,isResolving:d}}),(e=>[e(_.store).getEntityRecords("postType",Ne,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Ne,{per_page:-1}]),e(h.store).__experimentalGetDefaultTemplatePartAreas()])),gx=(0,l.createSelector)((e=>{var t;const{getSettings:s}=se(e(Kt)),{isResolving:n}=e(_.store),i=s();return{patterns:[...(null!==(t=i.__experimentalAdditionalBlockPatterns)&&void 0!==t?t:i.__experimentalBlockPatterns)||[],...e(_.store).getBlockPatterns()||[]].filter((e=>!ze.includes(e.source))).filter(tx).filter((e=>!1!==e.inserter)).map((e=>({...e,keywords:e.keywords||[],type:Be.theme,blocks:(0,o.parse)(e.content,{__unstableSkipMigrationLogs:!0})}))),isResolving:n("getBlockPatterns")}}),(e=>[e(_.store).getBlockPatterns(),e(_.store).isResolving("getBlockPatterns"),se(e(Kt)).getSettings()])),vx=(0,l.createSelector)(((e,t,s,n="")=>{const{patterns:i,isResolving:r}=gx(e),{patterns:o,isResolving:a}=yx(e);let l=[...i||[],...o||[]];return s&&(l=l.filter((e=>e.type===Be.user?e.syncStatus===s:s===Ge.unsynced))),l=dx(l,n,t?{categoryId:t,hasCategory:(e,t)=>e.categories?.includes(t)}:{hasCategory:e=>!e.hasOwnProperty("categories")}),{patterns:l,isResolving:r||a}}),(e=>[gx(e),yx(e)])),yx=(0,l.createSelector)(((e,t,s="")=>{const{getEntityRecords:n,isResolving:i,getUserPatternCategories:r}=e(_.store),a={per_page:-1},l=n("postType",Be.user,a),c=r(),u=new Map;c.forEach((e=>u.set(e.id,e)));let d=l?l.map((e=>((e,t)=>({blocks:(0,o.parse)(e.content.raw,{__unstableSkipMigrationLogs:!0}),...e.wp_pattern_category.length>0&&{categories:e.wp_pattern_category.map((e=>t&&t.get(e)?t.get(e).slug:e))},termLabels:e.wp_pattern_category.map((e=>t?.get(e)?t.get(e).label:e)),id:e.id,name:e.slug,syncStatus:e.wp_pattern_sync_status||Ge.full,title:e.title.raw,type:e.type,description:e.excerpt.raw,patternPost:e}))(e,u))):px;const h=i("getEntityRecords",["postType",Be.user,a]);return t&&(d=d.filter((e=>e.syncStatus===t))),d=dx(d,s,{hasCategory:()=>!0}),{patterns:d,isResolving:h,categories:c}}),(e=>[e(_.store).getEntityRecords("postType",Be.user,{per_page:-1}),e(_.store).isResolving("getEntityRecords",["postType",Be.user,{per_page:-1}]),e(_.store).getUserPatternCategories()])),xx=(e,t,{search:s="",syncStatus:n}={})=>(0,l.useSelect)((i=>{if(e===Ne)return mx(i,t,s);if(e===Be.user&&t){return vx(i,"uncategorized"===t?"":t,n,s)}return e===Be.user?yx(i,n,s):{patterns:px,isResolving:!1}}),[t,e,s,n]),bx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})}),wx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"})}),{useHistory:_x}=se(Xt.privateApis),{CreatePatternModal:Sx,useAddPatternCategory:jx}=se(Oe.privateApis),{CreateTemplatePartModal:Cx}=se(h.privateApis);function kx(){const e=_x(),[t,s]=(0,d.useState)(!1),[n,i]=(0,d.useState)(!1),{createPatternFromFile:r}=se((0,l.useDispatch)(Oe.store)),{createSuccessNotice:o,createErrorNotice:a}=(0,l.useDispatch)(w.store),c=(0,d.useRef)(),{isBlockBasedTheme:u,addNewPatternLabel:h,addNewTemplatePartLabel:p,canCreatePattern:f,canCreateTemplatePart:m}=(0,l.useSelect)((e=>{const{getCurrentTheme:t,getPostType:s,canUser:n}=e(_.store);return{isBlockBasedTheme:t()?.is_block_theme,addNewPatternLabel:s(Be.user)?.labels?.add_new_item,addNewTemplatePartLabel:s(Ne)?.labels?.add_new_item,canCreatePattern:n("create","blocks"),canCreateTemplatePart:n("create","template-parts")}}),[]);function g(){s(!1),i(!1)}const v=[];f&&v.push({icon:bx,onClick:()=>s(!0),title:h}),u&&m&&v.push({icon:kn,onClick:()=>i(!0),title:p}),f&&v.push({icon:wx,onClick:()=>{c.current.click()},title:(0,b.__)("Import pattern from JSON")});const{categoryMap:y,findOrCreateTerm:S}=jx();return 0===v.length?null:(0,me.jsxs)(me.Fragment,{children:[h&&(0,me.jsx)(x.DropdownMenu,{controls:v,icon:null,toggleProps:{variant:"primary",showTooltip:!1,__next40pxDefaultSize:!0},text:h,label:h}),t&&(0,me.jsx)(Sx,{onClose:()=>s(!1),onSuccess:function({pattern:t}){s(!1),e.push({postId:t.id,postType:Be.user,canvas:"edit"})},onError:g}),n&&(0,me.jsx)(Cx,{closeModal:()=>i(!1),blocks:[],onCreate:function(t){i(!1),e.push({postId:t.id,postType:Ne,canvas:"edit"})},onError:g}),(0,me.jsx)("input",{type:"file",accept:".json",hidden:!0,ref:c,onChange:async t=>{const s=t.target.files?.[0];if(s)try{const{params:{postType:t,categoryId:n}}=e.getLocationWithParams();let i;if(t!==Ne){const e=y.values().find((e=>e.name===n));e&&(i=e.id||await S(e.label))}const a=await r(s,i?[i]:void 0);i||"my-patterns"===n||e.push({postType:Be.user,categoryId:De}),o((0,b.sprintf)((0,b.__)('Imported "%s" from JSON.'),a.title.raw),{type:"snackbar",id:"import-pattern-success"})}catch(e){a(e.message,{type:"snackbar",id:"import-pattern-error"})}finally{t.target.value=""}}})]})}function Ex(){const e=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:s}=se(e(Kt)),n=s();return null!==(t=n.__experimentalAdditionalBlockPatternCategories)&&void 0!==t?t:n.__experimentalBlockPatternCategories}));return[...e||[],...(0,l.useSelect)((e=>e(_.store).getBlockPatternCategories()))||[]]}();e.push({name:Ve,label:(0,b.__)("Uncategorized")});const t=function(){const e=(0,l.useSelect)((e=>{var t;const{getSettings:s}=se(e(Kt));return null!==(t=s().__experimentalAdditionalBlockPatterns)&&void 0!==t?t:s().__experimentalBlockPatterns})),t=(0,l.useSelect)((e=>e(_.store).getBlockPatterns()));return(0,d.useMemo)((()=>[...e||[],...t||[]].filter((e=>!ze.includes(e.source))).filter(tx).filter((e=>!1!==e.inserter))),[e,t])}(),{patterns:s,categories:n}=xx(Be.user),i=(0,d.useMemo)((()=>{const i={},r=[];e.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),n.forEach((e=>{i[e.name]||(i[e.name]={...e,count:0})})),t.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),s.forEach((e=>{e.categories?.forEach((e=>{i[e]&&(i[e].count+=1)})),e.categories?.length||(i.uncategorized.count+=1)})),[...e,...n].forEach((e=>{i[e.name].count&&!r.find((t=>t.name===e.name))&&r.push(i[e.name])}));const o=r.sort(((e,t)=>e.label.localeCompare(t.label)));return o.unshift({name:Le,label:(0,b.__)("My patterns"),count:s.length}),o.unshift({name:De,label:(0,b.__)("All patterns"),description:(0,b.__)("A list of all patterns from all sources."),count:t.length+s.length}),o}),[e,t,n,s]);return{patternCategories:i,hasPatterns:!!i.length}}const{RenamePatternCategoryModal:Px}=se(Oe.privateApis);function Ix({category:e,onClose:t}){const[s,n]=(0,d.useState)(!1);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.MenuItem,{onClick:()=>n(!0),children:(0,b.__)("Rename")}),s&&(0,me.jsx)(Tx,{category:e,onClose:()=>{n(!1),t()}})]})}function Tx({category:e,onClose:t}){const s={id:e.id,slug:e.slug,name:e.label},n=Ex();return(0,me.jsx)(Px,{category:s,existingCategories:n,onClose:t,overlayClassName:"edit-site-list__rename-modal"})}const{useHistory:Ox}=se(Xt.privateApis);function Ax({category:e,onClose:t}){const[s,n]=(0,d.useState)(!1),i=Ox(),{createSuccessNotice:r,createErrorNotice:o}=(0,l.useDispatch)(w.store),{deleteEntityRecord:a,invalidateResolution:c}=(0,l.useDispatch)(_.store);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.MenuItem,{isDestructive:!0,onClick:()=>n(!0),children:(0,b.__)("Delete")}),(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:s,onConfirm:async()=>{try{await a("taxonomy","wp_pattern_category",e.id,{force:!0},{throwOnError:!0}),c("getUserPatternCategories"),c("getEntityRecords",["postType",Be.user,{per_page:-1}]),r((0,b.sprintf)((0,b.__)('"%s" deleted.'),e.label),{type:"snackbar",id:"pattern-category-delete"}),t?.(),i.push({postType:Be.user,categoryId:De})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while deleting the pattern category.");o(t,{type:"snackbar",id:"pattern-category-delete"})}},onCancel:()=>n(!1),confirmButtonText:(0,b.__)("Delete"),className:"edit-site-patterns__delete-modal",title:(0,b.sprintf)((0,b.__)('Delete "%s"?'),(0,cs.decodeEntities)(e.label)),size:"medium",__experimentalHideHeader:!1,children:(0,b.sprintf)((0,b.__)('Are you sure you want to delete the category "%s"? The patterns will not be deleted.'),(0,cs.decodeEntities)(e.label))})]})}function Mx({categoryId:e,type:t,titleId:s,descriptionId:n}){const{patternCategories:i}=Ex(),r=(0,l.useSelect)((e=>e(h.store).__experimentalGetDefaultTemplatePartAreas()),[]);let o,a,c;if(t===Ne){const t=r.find((t=>t.area===e));o=t?.label||(0,b.__)("All Template Parts"),a=t?.description||(0,b.__)("Includes every template part defined for any area.")}else t===Be.user&&e&&(c=i.find((t=>t.name===e)),o=c?.label,a=c?.description);return o?(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-patterns__section-header",spacing:0,children:[(0,me.jsxs)(x.__experimentalHStack,{justify:"space-between",className:"edit-site-patterns__title",children:[(0,me.jsx)(x.__experimentalHeading,{as:"h2",level:3,id:s,weight:500,children:o}),(0,me.jsxs)(x.__experimentalHStack,{expanded:!1,children:[(0,me.jsx)(kx,{}),!!c?.id&&(0,me.jsx)(x.DropdownMenu,{icon:zn,label:(0,b.__)("Actions"),toggleProps:{className:"edit-site-patterns__button",describedBy:(0,b.sprintf)((0,b.__)("Action menu for %s pattern category"),o),size:"compact"},children:({onClose:e})=>(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(Ix,{category:c,onClose:e}),(0,me.jsx)(Ax,{category:c,onClose:e})]})})]})]}),a?(0,me.jsx)(x.__experimentalText,{variant:"muted",as:"p",id:n,className:"edit-site-patterns__sub-title",children:a}):null]}):null}const Nx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"})}),Fx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M12 3.3c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"})}),Vx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",d:"M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",clipRule:"evenodd"})});function Rx(e,t){return(0,l.useSelect)((s=>{const{getEntityRecord:n,getMedia:i,getUser:r,getEditedEntityRecord:o}=s(_.store),a=o("postType",e,t),l=a?.original_source,c=a?.author_text;switch(l){case"theme":return{type:l,icon:en,text:c,isCustomized:a.source===Fe.custom};case"plugin":return{type:l,icon:Nx,text:c,isCustomized:a.source===Fe.custom};case"site":{const e=n("root","__unstableBase");return{type:l,icon:Fx,imageUrl:e?.site_logo?i(e.site_logo)?.source_url:void 0,text:c,isCustomized:!1}}default:{const e=r(a.author);return{type:"user",icon:Vx,imageUrl:e?.avatar_urls?.[48],text:c,isCustomized:!1}}}}),[e,t])}const{ExperimentalBlockEditorProvider:Bx,useGlobalStyle:Dx}=se(y.privateApis),{usePostActions:Lx}=se(h.privateApis),{useLocation:zx}=se(Xt.privateApis),Gx=[],Hx={[qe]:{primaryField:"title"},[We]:{mediaField:"preview",primaryField:"title",badgeFields:["sync-status"]}},Ux={type:We,search:"",page:1,perPage:20,hiddenFields:[],layout:{...Hx[We]},filters:[]},Wx=[{value:Ge.full,label:(0,b._x)("Synced","pattern (singular)"),description:(0,b.__)("Patterns that are kept in sync across the site.")},{value:Ge.unsynced,label:(0,b._x)("Not synced","pattern (singular)"),description:(0,b.__)("Patterns that can be changed freely without affecting the site.")}];function qx({item:e,onClick:t,ariaDescribedBy:s,children:n}){return(0,me.jsx)("button",{className:"page-patterns-preview-field__button",type:"button",onClick:e.type!==Be.theme?t:void 0,"aria-label":e.title,"aria-describedby":s,"aria-disabled":e.type===Be.theme,children:n})}function Zx({item:e,viewType:t}){const s=(0,d.useId)(),n=e.type===Be.user,i=e.type===Ne,r=!e.blocks?.length,[o]=Dx("color.background"),{onClick:a}=on({postType:e.type,postId:n?e.id:e.name,canvas:"edit"});return(0,me.jsxs)("div",{className:`page-patterns-preview-field is-viewtype-${t}`,style:{backgroundColor:o},children:[(0,me.jsxs)(qx,{item:e,onClick:a,ariaDescribedBy:e.description?s:void 0,children:[r&&i&&(0,b.__)("Empty template part"),r&&!i&&(0,b.__)("Empty pattern"),!r&&(0,me.jsx)(ex,{children:(0,me.jsx)(y.BlockPreview,{blocks:e.blocks,viewportWidth:e.viewportWidth})})]}),e.description&&(0,me.jsx)("div",{hidden:!0,id:s,children:e.description})]})}function Kx({item:e,viewType:t}){const[s,n]=(0,d.useState)(!1),{text:i,icon:r,imageUrl:o}=Rx(e.type,e.id),a=t!==Ze;return(0,me.jsxs)(x.__experimentalHStack,{alignment:"left",spacing:1,children:[a&&o&&(0,me.jsx)("div",{className:Qt("page-templates-author-field__avatar",{"is-loaded":s}),children:(0,me.jsx)("img",{onLoad:()=>n(!0),alt:"",src:o})}),a&&!o&&(0,me.jsx)("div",{className:"page-templates-author-field__icon",children:(0,me.jsx)($c,{icon:r})}),(0,me.jsx)("span",{className:"page-templates-author-field__name",children:i})]})}function Yx({item:e}){const t=e.type===Be.user,{onClick:s}=on({postType:e.type,postId:t?e.id:e.name,canvas:"edit"});return(0,me.jsxs)(x.__experimentalHStack,{alignment:"center",justify:"flex-start",spacing:2,children:[(0,me.jsx)(x.Flex,{as:"div",gap:0,justify:"left",className:"edit-site-patterns__pattern-title",children:e.type===Be.theme?e.title:(0,me.jsx)(x.Button,{variant:"link",onClick:s,tabIndex:"-1",children:e.title||e.name})}),e.type===Be.theme&&(0,me.jsx)(x.Tooltip,{placement:"top",text:(0,b.__)("This pattern cannot be edited."),children:(0,me.jsx)($c,{className:"edit-site-patterns__pattern-lock-icon",icon:Qy,size:24})})]})}function Xx(){const{params:{postType:e,categoryId:t}}=zx(),s=e||Be.user,n=t||De,[i,r]=(0,d.useState)(Ux),o=(0,v.usePrevious)(n),a=i.filters?.find((({field:e})=>"sync-status"===e))?.value,{patterns:l,isResolving:c}=xx(s,n,{search:i.search,syncStatus:a}),{records:u}=(0,_.useEntityRecords)("postType",Ne,{per_page:-1}),h=(0,d.useMemo)((()=>{if(!u)return Gx;const e=new Set;return u.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[u]),p=(0,d.useMemo)((()=>{const e=[{header:(0,b.__)("Preview"),id:"preview",render:({item:e})=>(0,me.jsx)(Zx,{item:e,viewType:i.type}),enableSorting:!1,enableHiding:!1,width:"1%"},{header:(0,b.__)("Title"),id:"title",render:({item:e})=>(0,me.jsx)(Yx,{item:e}),enableHiding:!1}];return s===Be.user?e.push({header:(0,b.__)("Sync status"),id:"sync-status",render:({item:e})=>(0,me.jsx)("span",{className:`edit-site-patterns__field-sync-status-${e.syncStatus}`,children:(Wx.find((({value:t})=>t===e.syncStatus))||Wx.find((({value:e})=>e===Ge.unsynced))).label}),elements:Wx,filterBy:{operators:[Ke],isPrimary:!0},enableSorting:!1}):s===Ne&&e.push({header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.templatePart.author_text,render:({item:e})=>(0,me.jsx)(Kx,{viewType:i.type,item:e}),elements:h,filterBy:{isPrimary:!0},width:"1%"}),e}),[i.type,s,h]);(0,d.useEffect)((()=>{o!==n&&r(Ux)}),[n,o]);const{data:f,paginationInfo:m}=(0,d.useMemo)((()=>{const e={...i};return delete e.search,s!==Ne&&(e.filters=[]),Jy(l,e,p)}),[l,i,p,s]),g=Lx({postType:Ne,context:"list"}),y=Lx({postType:Be.user,context:"list"}),x=By(),w=(0,d.useMemo)((()=>s===Ne?[x,...g].filter(Boolean):[x,...y].filter(Boolean)),[x,s,g,y]),S=(0,d.useCallback)((e=>{e.type!==i.type&&(e={...e,layout:{...Hx[e.type]}}),r(e)}),[i.type,r]),j=(0,d.useId)(),C=sx();return(0,me.jsx)(Bx,{settings:C,children:(0,me.jsxs)(jy,{title:(0,b.__)("Patterns content"),className:"edit-site-page-patterns-dataviews",hideTitleFromUI:!0,children:[(0,me.jsx)(Mx,{categoryId:n,type:s,titleId:`${j}-title`,descriptionId:`${j}-description`}),(0,me.jsx)(wy,{paginationInfo:m,fields:p,actions:w,data:f||Gx,getItemId:e=>e.name,isLoading:c,view:i,onChangeView:S,supportedLayouts:[We,qe]})]})})}const Jx=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"})}),Qx=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M17.8 2l-.9.3c-.1 0-3.6 1-5.2 2.1C10 5.5 9.3 6.5 8.9 7.1c-.6.9-1.7 4.7-1.7 6.3l-.9 2.3c-.2.4 0 .8.4 1 .1 0 .2.1.3.1.3 0 .6-.2.7-.5l.6-1.5c.3 0 .7-.1 1.2-.2.7-.1 1.4-.3 2.2-.5.8-.2 1.6-.5 2.4-.8.7-.3 1.4-.7 1.9-1.2s.8-1.2 1-1.9c.2-.7.3-1.6.4-2.4.1-.8.1-1.7.2-2.5 0-.8.1-1.5.2-2.1V2zm-1.9 5.6c-.1.8-.2 1.5-.3 2.1-.2.6-.4 1-.6 1.3-.3.3-.8.6-1.4.9-.7.3-1.4.5-2.2.8-.6.2-1.3.3-1.8.4L15 7.5c.3-.3.6-.7 1-1.1 0 .4 0 .8-.1 1.2zM6 20h8v-1.5H6V20z"})}),$x=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z"})}),eb=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M11.934 7.406a1 1 0 0 0 .914.594H19a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5H5a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5h5.764a.5.5 0 0 1 .447.276l.723 1.63Zm1.064-1.216a.5.5 0 0 0 .462.31H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5.764a2 2 0 0 1 1.789 1.106l.445 1.084ZM8.5 10.5h7V12h-7v-1.5Zm7 3.5h-7v1.5h7V14Z"})}),tb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"})}),sb=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"})}),nb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",d:"M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",clipRule:"evenodd"})}),ib=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z"})}),rb=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M4.75 4a.75.75 0 0 0-.75.75v7.826c0 .2.08.39.22.53l6.72 6.716a2.313 2.313 0 0 0 3.276-.001l5.61-5.611-.531-.53.532.528a2.315 2.315 0 0 0 0-3.264L13.104 4.22a.75.75 0 0 0-.53-.22H4.75ZM19 12.576a.815.815 0 0 1-.236.574l-5.61 5.611a.814.814 0 0 1-1.153 0L5.5 12.264V5.5h6.763l6.5 6.502a.816.816 0 0 1 .237.574ZM8.75 9.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),ob=(0,me.jsxs)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,me.jsx)(us.Path,{d:"m7 6.5 4 2.5-4 2.5z"}),(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"m5 3c-1.10457 0-2 .89543-2 2v14c0 1.1046.89543 2 2 2h14c1.1046 0 2-.8954 2-2v-14c0-1.10457-.8954-2-2-2zm14 1.5h-14c-.27614 0-.5.22386-.5.5v10.7072l3.62953-2.6465c.25108-.1831.58905-.1924.84981-.0234l2.92666 1.8969 3.5712-3.4719c.2911-.2831.7545-.2831 1.0456 0l2.9772 2.8945v-9.3568c0-.27614-.2239-.5-.5-.5zm-14.5 14.5v-1.4364l4.09643-2.987 2.99567 1.9417c.2936.1903.6798.1523.9307-.0917l3.4772-3.3806 3.4772 3.3806.0228-.0234v2.5968c0 .2761-.2239.5-.5.5h-14c-.27614 0-.5-.2239-.5-.5z"})]}),ab=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"})}),lb={},cb=(e,t)=>{let s=e;return t.split(".").forEach((e=>{s=s?.[e]})),s},ub=(e,t)=>(e||[]).map((e=>({...e,name:(0,cs.decodeEntities)(cb(e,t))}))),db=()=>(0,l.useSelect)((e=>e(_.store).getEntityRecords("postType",Me,{per_page:-1})),[]),hb=()=>(0,l.useSelect)((e=>e(h.store).__experimentalGetDefaultTemplateTypes()),[]),pb=()=>{const e=(0,l.useSelect)((e=>e(_.store).getPostTypes({per_page:-1})),[]);return(0,d.useMemo)((()=>{const t=["attachment"];return e?.filter((({viewable:e,slug:s})=>e&&!t.includes(s)))}),[e])};function fb(){const e=pb(),t=(0,d.useMemo)((()=>e?.filter((e=>e.has_archive))),[e]),s=db(),n=(0,d.useMemo)((()=>e?.reduce(((e,{labels:t})=>{const s=t.singular_name.toLowerCase();return e[s]=(e[s]||0)+1,e}),{})),[e]),i=(0,d.useCallback)((({labels:e,slug:t})=>{const s=e.singular_name.toLowerCase();return n[s]>1&&s!==t}),[n]);return(0,d.useMemo)((()=>t?.filter((e=>!(s||[]).some((t=>t.slug==="archive-"+e.slug)))).map((e=>{let t;return t=i(e)?(0,b.sprintf)((0,b.__)("Archive: %1$s (%2$s)"),e.labels.singular_name,e.slug):(0,b.sprintf)((0,b.__)("Archive: %s"),e.labels.singular_name),{slug:"archive-"+e.slug,description:(0,b.sprintf)((0,b.__)("Displays an archive with the latest posts of type: %s."),e.labels.singular_name),title:t,icon:e.icon?.startsWith("dashicons-")?e.icon.slice(10):eb,templatePrefix:"archive"}}))||[]),[t,s,i])}const mb=e=>{const t=pb(),s=db(),n=hb(),i=(0,d.useMemo)((()=>t?.reduce(((e,{labels:t})=>{const s=(t.template_name||t.singular_name).toLowerCase();return e[s]=(e[s]||0)+1,e}),{})),[t]),r=(0,d.useCallback)((({labels:e,slug:t})=>{const s=(e.template_name||e.singular_name).toLowerCase();return i[s]>1&&s!==t}),[i]),o=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let s=t;return"page"!==t&&(s=`single-${s}`),e[t]=s,e}),{})),[t]),a=bb("postType",o),l=(s||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,s)=>{const{slug:i,labels:c,icon:u}=s,d=o[i],h=n?.find((({slug:e})=>e===d)),p=l?.includes(d),f=r(s);let m=c.template_name||(0,b.sprintf)((0,b.__)("Single item: %s"),c.singular_name);f&&(m=c.template_name?(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.template_name,i):(0,b.sprintf)((0,b.__)("Single item: %1$s (%2$s)"),c.singular_name,i));const g=h?{...h,templatePrefix:o[i]}:{slug:d,title:m,description:(0,b.sprintf)((0,b.__)("Displays a single item: %s."),c.singular_name),icon:u?.startsWith("dashicons-")?u.slice(10):ab,templatePrefix:o[i]},v=a?.[i]?.hasEntities;return v&&(g.onClick=t=>{e({type:"postType",slug:i,config:{recordNamePath:"title.rendered",queryArgs:({search:e})=>({_fields:"id,title,slug,link",orderBy:e?"relevance":"modified",exclude:a[i].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${o[i]}-${e.slug}`;return{title:t,slug:t,templatePrefix:o[i]}}},labels:c,hasGeneralTemplate:p,template:t})}),p&&!v||t.push(g),t}),[]),u=(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:s}=t;let n="postTypesMenuItems";return"page"===s&&(n="defaultPostTypesMenuItems"),e[n].push(t),e}),{defaultPostTypesMenuItems:[],postTypesMenuItems:[]})),[c]);return u},gb=e=>{const t=(()=>{const e=(0,l.useSelect)((e=>e(_.store).getTaxonomies({per_page:-1})),[]);return(0,d.useMemo)((()=>e?.filter((({visibility:e})=>e?.publicly_queryable))),[e])})(),s=db(),n=hb(),i=(0,d.useMemo)((()=>t?.reduce(((e,{slug:t})=>{let s=t;return["category","post_tag"].includes(t)||(s=`taxonomy-${s}`),"post_tag"===t&&(s="tag"),e[t]=s,e}),{})),[t]),r=t?.reduce(((e,{labels:t})=>{const s=(t.template_name||t.singular_name).toLowerCase();return e[s]=(e[s]||0)+1,e}),{}),o=bb("taxonomy",i),a=(s||[]).map((({slug:e})=>e)),c=(t||[]).reduce(((t,s)=>{const{slug:l,labels:c}=s,u=i[l],d=n?.find((({slug:e})=>e===u)),h=a?.includes(u),p=((e,t)=>{if(["category","post_tag"].includes(t))return!1;const s=(e.template_name||e.singular_name).toLowerCase();return r[s]>1&&s!==t})(c,l);let f=c.template_name||c.singular_name;p&&(f=c.template_name?(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.template_name,l):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),c.singular_name,l));const m=d?{...d,templatePrefix:i[l]}:{slug:u,title:f,description:(0,b.sprintf)((0,b.__)("Displays taxonomy: %s."),c.singular_name),icon:nb,templatePrefix:i[l]},g=o?.[l]?.hasEntities;return g&&(m.onClick=t=>{e({type:"taxonomy",slug:l,config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"count",exclude:o[l].existingEntitiesIds}),getSpecificTemplate:e=>{const t=`${i[l]}-${e.slug}`;return{title:t,slug:t,templatePrefix:i[l]}}},labels:c,hasGeneralTemplate:h,template:t})}),h&&!g||t.push(m),t}),[]);return(0,d.useMemo)((()=>c.reduce(((e,t)=>{const{slug:s}=t;let n="taxonomiesMenuItems";return["category","tag"].includes(s)&&(n="defaultTaxonomiesMenuItems"),e[n].push(t),e}),{defaultTaxonomiesMenuItems:[],taxonomiesMenuItems:[]})),[c])},vb={user:"author"},yb={user:{who:"authors"}};const xb=(e,t,s={})=>{const n=(e=>{const t=db();return(0,d.useMemo)((()=>Object.entries(e||{}).reduce(((e,[s,n])=>{const i=(t||[]).reduce(((e,t)=>{const s=`${n}-`;return t.slug.startsWith(s)&&e.push(t.slug.substring(s.length)),e}),[]);return i.length&&(e[s]=i),e}),{})),[e,t])})(t);return(0,l.useSelect)((t=>Object.entries(n||{}).reduce(((n,[i,r])=>{const o=t(_.store).getEntityRecords(e,i,{_fields:"id",context:"view",slug:r,...s[i]});return o?.length&&(n[i]=o),n}),{})),[n])},bb=(e,t,s=lb)=>{const n=xb(e,t,s),i=(0,l.useSelect)((i=>Object.keys(t||{}).reduce(((t,r)=>{const o=n?.[r]?.map((({id:e})=>e))||[];return t[r]=!!i(_.store).getEntityRecords(e,r,{per_page:1,_fields:"id",context:"view",exclude:o,...s[r]})?.length,t}),{})),[t,n,e,s]);return(0,d.useMemo)((()=>Object.keys(t||{}).reduce(((e,t)=>{const s=n?.[t]?.map((({id:e})=>e))||[];return e[t]={hasEntities:i[t],existingEntitiesIds:s},e}),{})),[t,n,i])},{CompositeV2:wb,CompositeItemV2:_b,useCompositeStoreV2:Sb}=se(x.privateApis),jb=[];function Cb({suggestion:e,search:t,onSelect:s,entityForSuggestions:n}){const i="edit-site-custom-template-modal__suggestions_list__list-item";return(0,me.jsxs)(_b,{render:(0,me.jsx)(x.Button,{role:"option",className:i,onClick:()=>s(n.config.getSpecificTemplate(e))}),children:[(0,me.jsx)(x.__experimentalText,{size:"body",lineHeight:1.53846153846,weight:500,className:`${i}__title`,children:(0,me.jsx)(x.TextHighlight,{text:(0,cs.decodeEntities)(e.name),highlight:t})}),e.link&&(0,me.jsx)(x.__experimentalText,{size:"body",lineHeight:1.53846153846,className:`${i}__info`,children:e.link})]})}function kb({entityForSuggestions:e,onSelect:t}){const s=Sb({orientation:"vertical"}),[n,i,r]=(0,v.useDebouncedInput)(),o=function(e,t){const{config:s}=e,n=(0,d.useMemo)((()=>({order:"asc",context:"view",search:t,per_page:t?20:10,...s.queryArgs(t)})),[t,s]),{records:i,hasResolved:r}=(0,_.useEntityRecords)(e.type,e.slug,n),[o,a]=(0,d.useState)(jb);return(0,d.useEffect)((()=>{if(!r)return;let e=jb;i?.length&&(e=i,s.recordNamePath&&(e=ub(e,s.recordNamePath))),a(e)}),[i,r]),o}(e,r),{labels:a}=e,[l,c]=(0,d.useState)(!1);return!l&&o?.length>9&&c(!0),(0,me.jsxs)(me.Fragment,{children:[l&&(0,me.jsx)(x.SearchControl,{__nextHasNoMarginBottom:!0,onChange:i,value:n,label:a.search_items,placeholder:a.search_items}),!!o?.length&&(0,me.jsx)(wb,{store:s,role:"listbox",className:"edit-site-custom-template-modal__suggestions_list","aria-label":(0,b.__)("Suggestions list"),children:o.map((s=>(0,me.jsx)(Cb,{suggestion:s,search:r,onSelect:t,entityForSuggestions:e},s.slug)))}),r&&!o?.length&&(0,me.jsx)(x.__experimentalText,{as:"p",className:"edit-site-custom-template-modal__no-results",children:a.not_found})]})}const Eb=function({onSelect:e,entityForSuggestions:t}){const[s,n]=(0,d.useState)(t.hasGeneralTemplate);return(0,me.jsxs)(x.__experimentalVStack,{spacing:4,className:"edit-site-custom-template-modal__contents-wrapper",alignment:"left",children:[!s&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("Select whether to create a single template for all items or a specific one.")}),(0,me.jsxs)(x.Flex,{className:"edit-site-custom-template-modal__contents",gap:"4",align:"initial",children:[(0,me.jsxs)(x.FlexItem,{isBlock:!0,as:x.Button,onClick:()=>{const{slug:s,title:n,description:i,templatePrefix:r}=t.template;e({slug:s,title:n,description:i,templatePrefix:r})},children:[(0,me.jsx)(x.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.all_items}),(0,me.jsx)(x.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For all items")})]}),(0,me.jsxs)(x.FlexItem,{isBlock:!0,as:x.Button,onClick:()=>{n(!0)},children:[(0,me.jsx)(x.__experimentalText,{as:"span",weight:500,lineHeight:1.53846153846,children:t.labels.singular_name}),(0,me.jsx)(x.__experimentalText,{as:"span",lineHeight:1.53846153846,children:(0,b.__)("For a specific item")})]})]})]}),s&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalText,{as:"p",children:(0,b.__)("This template will be used only for the specific item chosen.")}),(0,me.jsx)(kb,{entityForSuggestions:t,onSelect:e})]})]})};var Pb=function(){return Pb=Object.assign||function(e){for(var t,s=1,n=arguments.length;s{e()},children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"primary",type:"submit",isBusy:r,"aria-disabled":r,children:(0,b.__)("Create")})]})]})})},{useHistory:Fb}=se(Xt.privateApis),Vb=["front-page","home","single","page","index","archive","author","category","date","tag","search","404"],Rb={"front-page":Jx,home:Qx,single:$x,page:tn,archive:eb,search:ds,404:tb,index:sb,category:$h,author:Vx,taxonomy:nb,date:ib,tag:rb,attachment:ob};function Bb({title:e,direction:t,className:s,description:n,icon:i,onClick:r,children:o}){return(0,me.jsx)(x.Button,{className:s,onClick:r,label:n,showTooltip:!!n,children:(0,me.jsxs)(x.Flex,{as:"span",spacing:2,align:"center",justify:"center",style:{width:"100%"},direction:t,children:[(0,me.jsx)("div",{className:"edit-site-add-new-template__template-icon",children:(0,me.jsx)(x.Icon,{icon:i})}),(0,me.jsxs)(x.__experimentalVStack,{className:"edit-site-add-new-template__template-name",alignment:"center",spacing:0,children:[(0,me.jsx)(x.__experimentalText,{align:"center",weight:500,lineHeight:1.53846153846,children:e}),o]})]})})}const Db={templatesList:1,customTemplate:2,customGenericTemplate:3};function Lb({onClose:e}){const[t,s]=(0,d.useState)(Db.templatesList),[n,i]=(0,d.useState)({}),[r,o]=(0,d.useState)(!1),a=function(e,t){const s=db(),n=hb(),i=(s||[]).map((({slug:e})=>e)),r=(n||[]).filter((e=>Vb.includes(e.slug)&&!i.includes(e.slug))),o=s=>{t?.(),e(s)},a=[...r],{defaultTaxonomiesMenuItems:l,taxonomiesMenuItems:c}=gb(o),{defaultPostTypesMenuItems:u,postTypesMenuItems:d}=mb(o),h=function(e){const t=db(),s=hb(),n=bb("root",vb,yb);let i=s?.find((({slug:e})=>"author"===e));i||(i={description:(0,b.__)("Displays latest posts written by a single author."),slug:"author",title:"Author"});const r=!!t?.find((({slug:e})=>"author"===e));if(n.user?.hasEntities&&(i={...i,templatePrefix:"author"},i.onClick=t=>{e({type:"root",slug:"user",config:{queryArgs:({search:e})=>({_fields:"id,name,slug,link",orderBy:e?"name":"registered_date",exclude:n.user.existingEntitiesIds,who:"authors"}),getSpecificTemplate:e=>{const t=`author-${e.slug}`;return{title:t,slug:t,templatePrefix:"author"}}},labels:{singular_name:(0,b.__)("Author"),search_items:(0,b.__)("Search Authors"),not_found:(0,b.__)("No authors found."),all_items:(0,b.__)("All Authors")},hasGeneralTemplate:r,template:t})}),!r||n.user?.hasEntities)return i}(o);[...l,...u,h].forEach((e=>{if(!e)return;const t=a.findIndex((t=>t.slug===e.slug));t>-1?a[t]=e:a.push(e)})),a?.sort(((e,t)=>Vb.indexOf(e.slug)-Vb.indexOf(t.slug)));const p=[...a,...fb(),...d,...c];return p}(i,(()=>s(Db.customTemplate))),c=Fb(),{saveEntityRecord:u}=(0,l.useDispatch)(_.store),{createErrorNotice:h,createSuccessNotice:p}=(0,l.useDispatch)(w.store),{homeUrl:f}=(0,l.useSelect)((e=>{const{getUnstableBase:t}=e(_.store);return{homeUrl:t()?.home}}),[]),m={"front-page":f,date:(0,b.sprintf)((0,b.__)("E.g. %s"),f+"/"+(new Date).getFullYear())};async function g(e,t=!0){if(!r){o(!0);try{const{title:s,description:n,slug:i}=e,r=await u("postType",Me,{description:n,slug:i.toString(),status:"publish",title:s,is_wp_suggestion:t},{throwOnError:!0});c.push({postId:r.id,postType:Me,canvas:"edit"}),p((0,b.sprintf)((0,b.__)('"%s" successfully created.'),(0,cs.decodeEntities)(r.title?.rendered||s)),{type:"snackbar"})}catch(e){const t=e.message&&"unknown_error"!==e.code?e.message:(0,b.__)("An error occurred while creating the template.");h(t,{type:"snackbar"})}finally{o(!1)}}}const v=()=>{e(),s(Db.templatesList)};let y=(0,b.__)("Add template");return t===Db.customTemplate?y=(0,b.sprintf)((0,b.__)("Add template: %s"),n.labels.singular_name):t===Db.customGenericTemplate&&(y=(0,b.__)("Create custom template")),(0,me.jsxs)(x.Modal,{title:y,className:Qt("edit-site-add-new-template__modal",{"edit-site-add-new-template__modal_template_list":t===Db.templatesList,"edit-site-custom-template-modal":t===Db.customTemplate}),onRequestClose:v,overlayClassName:t===Db.customGenericTemplate?"edit-site-custom-generic-template__modal":void 0,children:[t===Db.templatesList&&(0,me.jsxs)(x.__experimentalGrid,{columns:3,gap:4,align:"flex-start",justify:"center",className:"edit-site-add-new-template__template-list__contents",children:[(0,me.jsx)(x.Flex,{className:"edit-site-add-new-template__template-list__prompt",children:(0,b.__)("Select what the new template should apply to:")}),a.map((e=>{const{title:t,slug:s,onClick:n}=e;return(0,me.jsx)(Bb,{title:t,direction:"column",className:"edit-site-add-new-template__template-button",description:m[s],icon:Rb[s]||en,onClick:()=>n?n(e):g(e)},s)})),(0,me.jsx)(Bb,{title:(0,b.__)("Custom template"),direction:"row",className:"edit-site-add-new-template__custom-template-button",icon:Vy,onClick:()=>s(Db.customGenericTemplate),children:(0,me.jsx)(x.__experimentalText,{lineHeight:1.53846153846,children:(0,b.__)("A custom template can be manually applied to any post or page.")})})]}),t===Db.customTemplate&&(0,me.jsx)(Eb,{onSelect:g,entityForSuggestions:n}),t===Db.customGenericTemplate&&(0,me.jsx)(Nb,{onClose:v,createTemplate:g})]})}const zb=(0,d.memo)((function(){const[e,t]=(0,d.useState)(!1),{postType:s}=(0,l.useSelect)((e=>{const{getPostType:t}=e(_.store);return{postType:t(Me)}}),[]);return s?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.Button,{variant:"primary",onClick:()=>t(!0),label:s.labels.add_new_item,__next40pxDefaultSize:!0,children:s.labels.add_new_item}),e&&(0,me.jsx)(Lb,{onClose:()=>t(!1)})]}):null})),{usePostActions:Gb}=se(h.privateApis),{ExperimentalBlockEditorProvider:Hb,useGlobalStyle:Ub}=se(y.privateApis),{useHistory:Wb,useLocation:qb}=se(Xt.privateApis),Zb=[],Kb={[qe]:{primaryField:"title"},[We]:{mediaField:"preview",primaryField:"title",columnFields:["description"]},[Ze]:{primaryField:"title",mediaField:"preview"}},Yb={type:We,search:"",page:1,perPage:20,sort:{field:"title",direction:"asc"},hiddenFields:["preview"],layout:Kb[We],filters:[]};function Xb({item:e,viewType:t}){if(t===Ze)return(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)");const s={params:{postId:e.id,postType:e.type,canvas:"edit"}};return(0,me.jsx)(an,{...s,children:(0,cs.decodeEntities)(e.title?.rendered)||(0,b.__)("(no title)")})}function Jb({item:e,viewType:t}){const[s,n]=(0,d.useState)(!1),{text:i,icon:r,imageUrl:o}=Rx(e.type,e.id),a=t!==Ze;return(0,me.jsxs)(x.__experimentalHStack,{alignment:"left",spacing:1,children:[a&&o&&(0,me.jsx)("div",{className:Qt("page-templates-author-field__avatar",{"is-loaded":s}),children:(0,me.jsx)("img",{onLoad:()=>n(!0),alt:"",src:o})}),a&&!o&&(0,me.jsx)("div",{className:"page-templates-author-field__icon",children:(0,me.jsx)(x.Icon,{icon:r})}),(0,me.jsx)("span",{className:"page-templates-author-field__name",children:i})]})}function Qb({item:e,viewType:t}){const s=sx(),[n="white"]=Ub("color.background"),i=(0,d.useMemo)((()=>(0,o.parse)(e.content.raw)),[e.content.raw]),{onClick:r}=on({postId:e.id,postType:e.type,canvas:"edit"}),a=!i?.length;return(0,me.jsx)(Hb,{settings:s,children:(0,me.jsxs)("div",{className:`page-templates-preview-field is-viewtype-${t}`,style:{backgroundColor:n},children:[t===Ze&&!a&&(0,me.jsx)(ex,{children:(0,me.jsx)(y.BlockPreview,{blocks:i})}),t!==Ze&&(0,me.jsxs)("button",{className:"page-templates-preview-field__button",type:"button",onClick:r,"aria-label":e.title?.rendered||e.title,children:[a&&(0,b.__)("Empty template"),!a&&(0,me.jsx)(ex,{children:(0,me.jsx)(y.BlockPreview,{blocks:i})})]})]})})}function $b(){const{params:e}=qb(),{activeView:t="all",layout:s,postId:n}=e,[i,r]=(0,d.useState)([n]),o=(0,d.useMemo)((()=>{const e=null!=s?s:Yb.type;return{...Yb,type:e,layout:Kb[e],filters:"all"!==t?[{field:"author",operator:"isAny",value:[t]}]:[]}}),[s,t]),[a,l]=(0,d.useState)(o);(0,d.useEffect)((()=>{l((e=>({...e,filters:"all"!==t?[{field:"author",operator:Ye,value:[t]}]:[]})))}),[t]);const{records:c,isResolving:u}=(0,_.useEntityRecords)("postType",Me,{per_page:-1}),h=Wb(),p=(0,d.useCallback)((t=>{a?.type===Ze&&h.push({...e,postId:1===t.length?t[0].id:void 0})}),[h,e,a?.type]),f=(0,d.useMemo)((()=>{if(!c)return Zb;const e=new Set;return c.forEach((t=>{e.add(t.author_text)})),Array.from(e).map((e=>({value:e,label:e})))}),[c]),m=(0,d.useMemo)((()=>[{header:(0,b.__)("Preview"),id:"preview",render:({item:e})=>(0,me.jsx)(Qb,{item:e,viewType:a.type}),minWidth:120,maxWidth:120,enableSorting:!1},{header:(0,b.__)("Template"),id:"title",getValue:({item:e})=>e.title?.rendered,render:({item:e})=>(0,me.jsx)(Xb,{item:e,viewType:a.type}),maxWidth:400,enableHiding:!1,enableGlobalSearch:!0},{header:(0,b.__)("Description"),id:"description",render:({item:e})=>e.description?(0,me.jsx)("span",{className:"page-templates-description",children:(0,cs.decodeEntities)(e.description)}):a.type===qe&&(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalText,{variant:"muted","aria-hidden":"true",children:"—"}),(0,me.jsx)(x.VisuallyHidden,{children:(0,b.__)("No description.")})]}),maxWidth:400,minWidth:320,enableSorting:!1,enableGlobalSearch:!0},{header:(0,b.__)("Author"),id:"author",getValue:({item:e})=>e.author_text,render:({item:e})=>(0,me.jsx)(Jb,{viewType:a.type,item:e}),elements:f,width:"1%"}]),[f,a.type]),{data:g,paginationInfo:v}=(0,d.useMemo)((()=>Jy(c,a,m)),[c,a,m]),y=Gb({postType:Me,context:"list"}),w=By(),S=(0,d.useMemo)((()=>[w,...y]),[y,w]),j=(0,d.useCallback)((t=>{t.type!==a.type&&(t={...t,layout:{...Kb[t.type]}},h.push({...e,layout:t.type})),l(t)}),[a.type,l,h,e]);return(0,me.jsx)(jy,{className:"edit-site-page-templates",title:(0,b.__)("Templates"),actions:(0,me.jsx)(zb,{}),children:(0,me.jsx)(wy,{paginationInfo:v,fields:m,actions:S,data:g,isLoading:u,view:a,onChangeView:j,onSelectionChange:p,selection:i,setSelection:r})})}function ew(e){return(0,me.jsx)(x.Button,{...e,className:Qt("edit-site-sidebar-button",e.className)})}const tw=window.wp.dom,sw=(0,d.createContext)((()=>{}));function nw(){let e={direction:null,focusSelector:null};return{get:()=>e,navigate(t,s=null){e={direction:t,focusSelector:"forward"===t&&s?s:e.focusSelector}}}}function iw({children:e}){const t=(0,d.useContext)(sw),s=(0,d.useRef)(),[n,i]=(0,d.useState)(null);(0,d.useLayoutEffect)((()=>{const{direction:e,focusSelector:n}=t.get();!function(e,t,s){let n;if("back"===t&&s&&(n=e.querySelector(s)),null!==t&&!n){const[t]=tw.focus.tabbable.find(e);n=null!=t?t:e}n?.focus()}(s.current,e,n),i(e)}),[t]);const r=Qt("edit-site-sidebar__screen-wrapper",{"slide-from-left":"back"===n,"slide-from-right":"forward"===n});return(0,me.jsx)("div",{ref:s,className:r,children:e})}function rw({routeKey:e,children:t}){const[s]=(0,d.useState)(nw);return(0,me.jsx)(sw.Provider,{value:s,children:(0,me.jsx)("div",{className:"edit-site-sidebar__content",children:(0,me.jsx)(iw,{children:t},e)})})}const{useHistory:ow,useLocation:aw}=se(Xt.privateApis);function lw({isRoot:e,title:t,actions:s,meta:n,content:i,footer:r,description:o,backPath:a}){const{dashboardLink:c,dashboardLinkText:u,previewingThemeName:h}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt)),s=Ps();return{dashboardLink:t().__experimentalDashboardLink,dashboardLinkText:t().__experimentalDashboardLinkText,previewingThemeName:s?e(_.store).getTheme(s)?.name?.rendered:void 0}}),[]),p=aw(),f=ow(),{navigate:m}=(0,d.useContext)(sw),g=null!=a?a:p.state?.backPath,v=(0,b.isRTL)()?Hn:Gn;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.__experimentalVStack,{className:Qt("edit-site-sidebar-navigation-screen__main",{"has-footer":!!r}),spacing:0,justify:"flex-start",children:[(0,me.jsxs)(x.__experimentalHStack,{spacing:3,alignment:"flex-start",className:"edit-site-sidebar-navigation-screen__title-icon",children:[!e&&(0,me.jsx)(ew,{onClick:()=>{f.push(g),m("back")},icon:v,label:(0,b.__)("Back"),showTooltip:!1}),e&&(0,me.jsx)(ew,{icon:v,label:u||(0,b.__)("Go to the Dashboard"),href:c||"index.php"}),(0,me.jsx)(x.__experimentalHeading,{className:"edit-site-sidebar-navigation-screen__title",color:"#e0e0e0",level:1,size:20,children:Es()?(0,b.sprintf)("Previewing %1$s: %2$s",h,t):t}),s&&(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen__actions",children:s})]}),n&&(0,me.jsx)(me.Fragment,{children:(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen__meta",children:n})}),(0,me.jsxs)("div",{className:"edit-site-sidebar-navigation-screen__content",children:[o&&(0,me.jsx)("p",{className:"edit-site-sidebar-navigation-screen__description",children:o}),i]})]}),r&&(0,me.jsx)("footer",{className:"edit-site-sidebar-navigation-screen__footer",children:r})]})}const cw=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z"})}),uw=(0,me.jsx)(us.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,me.jsx)(us.Path,{d:"M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z"})}),{useHistory:dw}=se(Xt.privateApis);function hw({className:e,icon:t,withChevron:s=!1,suffix:n,uid:i,params:r,onClick:o,children:a,...l}){const c=dw(),{navigate:u}=(0,d.useContext)(sw);return(0,me.jsx)(x.__experimentalItem,{className:Qt("edit-site-sidebar-navigation-item",{"with-suffix":!s&&n},e),onClick:function(e){o?(o(e),u("forward")):r&&(e.preventDefault(),c.push(r),u("forward",`[id="${i}"]`))},id:i,...l,children:(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",children:[t&&(0,me.jsx)($c,{style:{fill:"currentcolor"},icon:t,size:24}),(0,me.jsx)(x.FlexBlock,{children:a}),s&&(0,me.jsx)($c,{icon:(0,b.isRTL)()?cw:uw,className:"edit-site-sidebar-navigation-item__drilldown-indicator",size:24}),!s&&n]})})}function pw({children:e}){return(0,me.jsx)(x.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__label",children:e})}function fw({label:e,children:t,className:s,...n}){return(0,me.jsx)(x.__experimentalHStack,{spacing:5,alignment:"left",className:Qt("edit-site-sidebar-navigation-details-screen-panel__row",s),...n,children:t},e)}function mw({children:e}){return(0,me.jsx)(x.__experimentalText,{className:"edit-site-sidebar-navigation-details-screen-panel__value",children:e})}function gw({record:e,...t}){var s,n;const i={},r=null!==(s=e?._links?.["predecessor-version"]?.[0]?.id)&&void 0!==s?s:null,o=null!==(n=e?._links?.["version-history"]?.[0]?.count)&&void 0!==n?n:0;return r&&o>1&&(i.href=(0,ps.addQueryArgs)("revision.php",{revision:e?._links["predecessor-version"][0].id}),i.as="a"),(0,me.jsx)(x.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-details-footer",children:(0,me.jsx)(hw,{"aria-label":(0,b.__)("Revisions"),...i,...t,children:(0,me.jsxs)(fw,{justify:"space-between",children:[(0,me.jsx)(pw,{children:(0,b.__)("Last modified")}),(0,me.jsx)(mw,{children:(0,d.createInterpolateElement)((0,b.sprintf)((0,b.__)(""),(0,qd.humanTimeDiff)(e.modified)),{time:(0,me.jsx)("time",{dateTime:e.modified})})}),(0,me.jsx)(x.Icon,{className:"edit-site-sidebar-navigation-screen-details-footer__icon",icon:Us})]})})})}const vw=()=>{};function yw(e){const{openGeneralSidebar:t}=(0,l.useDispatch)(Kt),{setCanvasMode:s}=se((0,l.useDispatch)(Kt));return(0,l.useSelect)((e=>!!e(_.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length),[])?(0,me.jsx)(hw,{...e,params:{path:"/wp_global_styles"},uid:"global-styles-navigation-item"}):(0,me.jsx)(hw,{...e,onClick:()=>{s("edit"),t("edit-site/global-styles")}})}function xw(){const{storedSettings:e}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt));return{storedSettings:t()}}),[]),t=he(),s=pe();return(0,me.jsx)(y.BlockEditorProvider,{settings:e,onChange:vw,onInput:vw,children:(0,me.jsxs)(x.__experimentalVStack,{spacing:10,className:"edit-site-global-styles-variation-container",children:[(0,me.jsx)(ud,{gap:3}),t?.length&&(0,me.jsx)(pu,{title:(0,b.__)("Palettes"),gap:3}),s?.length&&(0,me.jsx)(hr,{title:(0,b.__)("Typography"),gap:3})]})})}function bw({backPath:e}){const{revisions:t,isLoading:s}=Wd(),{openGeneralSidebar:n}=(0,l.useDispatch)(Kt),{setIsListViewOpened:i}=(0,l.useDispatch)(h.store),r=(0,v.useViewportMatch)("medium","<"),{setCanvasMode:o,setEditorCanvasContainerView:a}=se((0,l.useDispatch)(Kt)),{isViewMode:c,isStyleBookOpened:u,revisionsCount:p}=(0,l.useSelect)((e=>{var t;const{getCanvasMode:s,getEditorCanvasContainerView:n}=se(e(Kt)),{getEntityRecord:i,__experimentalGetCurrentGlobalStylesId:r}=e(_.store),o=r(),a=o?i("root","globalStyles",o):void 0;return{isViewMode:"view"===s(),isStyleBookOpened:"style-book"===n(),revisionsCount:null!==(t=a?._links?.["version-history"]?.[0]?.count)&&void 0!==t?t:0}}),[]),{set:m}=(0,l.useDispatch)(f.store),g=(0,d.useCallback)((async()=>Promise.all([m("core","distractionFree",!1),o("edit"),n("edit-site/global-styles")])),[o,n,m]),y=(0,d.useCallback)((async()=>{await g(),a("style-book"),i(!1)}),[g,a,i]),x=(0,d.useCallback)((async()=>{await g(),a("global-styles-revisions")}),[g,a]),w=p>0,S=t?.[0]?.modified,j=w&&!s&&S;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(lw,{title:(0,b.__)("Styles"),description:(0,b.__)("Choose a different style combination for the theme styles."),backPath:e,content:(0,me.jsx)(xw,{}),footer:j&&(0,me.jsx)(gw,{record:t?.[0],onClick:x}),actions:(0,me.jsxs)(me.Fragment,{children:[!r&&(0,me.jsx)(ew,{icon:Ln,label:(0,b.__)("Style Book"),onClick:()=>a(u?void 0:"style-book"),isPressed:u}),(0,me.jsx)(ew,{icon:Vy,label:(0,b.__)("Edit styles"),onClick:async()=>await g()})]})}),u&&!r&&c&&(0,me.jsx)(Od,{enableResizing:!1,isSelected:()=>!1,onClick:y,onSelect:y,showCloseButton:!1,showTabs:!1})]})}const ww=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z"})});function _w(){const{setEditorCanvasContainerView:e}=se((0,l.useDispatch)(Kt));return(0,d.useEffect)((()=>{e(void 0)}),[e]),(0,me.jsx)(lw,{isRoot:!0,title:(0,b.__)("Design"),description:(0,b.__)("Customize the appearance of your website using the block editor."),content:(0,me.jsx)(me.Fragment,{children:(0,me.jsxs)(x.__experimentalItemGroup,{children:[(0,me.jsx)(hw,{uid:"navigation-navigation-item",params:{postType:Ae},withChevron:!0,icon:ww,children:(0,b.__)("Navigation")}),(0,me.jsx)(yw,{uid:"styles-navigation-item",withChevron:!0,icon:Ds,children:(0,b.__)("Styles")}),(0,me.jsx)(hw,{uid:"page-navigation-item",params:{postType:"page"},withChevron:!0,icon:tn,children:(0,b.__)("Pages")}),(0,me.jsx)(hw,{uid:"template-navigation-item",params:{postType:Me},withChevron:!0,icon:en,children:(0,b.__)("Templates")}),(0,me.jsx)(hw,{uid:"patterns-navigation-item",params:{postType:Be.user},withChevron:!0,icon:bx,children:(0,b.__)("Patterns")})]})})})}const Sw={per_page:100,status:["publish","draft"],order:"desc",orderby:"date"},jw=e=>e?.trim()?.length>0;function Cw({menuTitle:e,onClose:t,onSave:s}){const[n,i]=(0,d.useState)(e),r=n!==e&&jw(n);return(0,me.jsx)(x.Modal,{title:(0,b.__)("Rename"),onRequestClose:t,children:(0,me.jsx)("form",{className:"sidebar-navigation__rename-modal-form",children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"3",children:[(0,me.jsx)(x.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,value:n,placeholder:(0,b.__)("Navigation title"),onChange:i}),(0,me.jsxs)(x.__experimentalHStack,{justify:"right",children:[(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,variant:"tertiary",onClick:t,children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{__next40pxDefaultSize:!0,__experimentalIsFocusable:!0,disabled:!r,variant:"primary",type:"submit",onClick:e=>{e.preventDefault(),r&&(s({title:n}),t())},children:(0,b.__)("Save")})]})]})})})}function kw({onClose:e,onConfirm:t}){return(0,me.jsx)(x.__experimentalConfirmDialog,{isOpen:!0,onConfirm:()=>{t(),e()},onCancel:e,confirmButtonText:(0,b.__)("Delete"),size:"medium",children:(0,b.__)("Are you sure you want to delete this Navigation Menu?")})}const{useHistory:Ew}=se(Xt.privateApis),Pw={position:"bottom right"};function Iw(e){const{onDelete:t,onSave:s,onDuplicate:n,menuTitle:i,menuId:r}=e,[o,a]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),u=Ew(),h=()=>{a(!1),c(!1)};return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.DropdownMenu,{className:"sidebar-navigation__more-menu",label:(0,b.__)("Actions"),icon:zn,popoverProps:Pw,children:({onClose:e})=>(0,me.jsx)("div",{children:(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(x.MenuItem,{onClick:()=>{a(!0),e()},children:(0,b.__)("Rename")}),(0,me.jsx)(x.MenuItem,{onClick:()=>{u.push({postId:r,postType:"wp_navigation",canvas:"edit"})},children:(0,b.__)("Edit")}),(0,me.jsx)(x.MenuItem,{onClick:()=>{n(),e()},children:(0,b.__)("Duplicate")}),(0,me.jsx)(x.MenuItem,{isDestructive:!0,onClick:()=>{c(!0),e()},children:(0,b.__)("Delete")})]})})}),l&&(0,me.jsx)(kw,{onClose:h,onConfirm:t}),o&&(0,me.jsx)(Cw,{onClose:h,menuTitle:i,onSave:s})]})}const Tw=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Ow=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Aw={className:"block-editor-block-settings-menu__popover",placement:"bottom-start"},{useHistory:Mw}=se(Xt.privateApis);function Nw(e){const t=Mw(),{block:s}=e,{clientId:n}=s,{moveBlocksDown:i,moveBlocksUp:r,removeBlocks:o}=(0,l.useDispatch)(y.store),a=(0,b.sprintf)((0,b.__)("Remove %s"),(0,y.BlockTitle)({clientId:n,maximumLength:25})),c=(0,b.sprintf)((0,b.__)("Go to %s"),(0,y.BlockTitle)({clientId:n,maximumLength:25})),u=(0,l.useSelect)((e=>{const{getBlockRootClientId:t}=e(y.store);return t(n)}),[n]),h=(0,d.useCallback)((e=>{const{attributes:s,name:n}=e;if("post-type"===s.kind&&s.id&&s.type&&t){const{params:e}=t.getLocationWithParams();t.push({postType:s.type,postId:s.id,canvas:"edit"},{backPath:e})}if("core/page-list-item"===n&&s.id&&t){const{params:e}=t.getLocationWithParams();t.push({postType:"page",postId:s.id,canvas:"edit"},{backPath:e})}}),[t]);return(0,me.jsx)(x.DropdownMenu,{icon:zn,label:(0,b.__)("Options"),className:"block-editor-block-settings-menu",popoverProps:Aw,noIcons:!0,...e,children:({onClose:e})=>(0,me.jsxs)(me.Fragment,{children:[(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(x.MenuItem,{icon:Tw,onClick:()=>{r([n],u),e()},children:(0,b.__)("Move up")}),(0,me.jsx)(x.MenuItem,{icon:Ow,onClick:()=>{i([n],u),e()},children:(0,b.__)("Move down")}),"page"===s.attributes?.type&&s.attributes?.id&&(0,me.jsx)(x.MenuItem,{onClick:()=>{h(s),e()},children:c})]}),(0,me.jsx)(x.MenuGroup,{children:(0,me.jsx)(x.MenuItem,{onClick:()=>{o([n],!1),e()},children:a})})]})})}const{PrivateListView:Fw}=se(y.privateApis),Vw=["postType","page",{per_page:100,_fields:["id","link","menu_order","parent","title","type"],orderby:"menu_order",order:"asc"}];function Rw({rootClientId:e}){const{listViewRootClientId:t,isLoading:s}=(0,l.useSelect)((t=>{const{areInnerBlocksControlled:s,getBlockName:n,getBlockCount:i,getBlockOrder:r}=t(y.store),{isResolving:o}=t(_.store),a=r(e),l=1===a.length&&"core/page-list"===n(a[0])&&i(a[0])>0,c=o("getEntityRecords",Vw);return{listViewRootClientId:l?a[0]:e,isLoading:!s(e)||c}}),[e]),{replaceBlock:n,__unstableMarkNextChangeAsNotPersistent:i}=(0,l.useDispatch)(y.store),r=(0,d.useCallback)((e=>{"core/navigation-link"!==e.name||e.attributes.url||(i(),n(e.clientId,(0,o.createBlock)("core/navigation-link",e.attributes)))}),[i,n]);return(0,me.jsxs)(me.Fragment,{children:[!s&&(0,me.jsx)(Fw,{rootClientId:t,onSelect:r,blockSettingsMenu:Nw,showAppender:!1}),(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor",children:(0,me.jsx)(y.BlockList,{})})]})}const Bw=()=>{};function Dw({navigationMenuId:e}){const{storedSettings:t}=(0,l.useSelect)((e=>{const{getSettings:t}=se(e(Kt));return{storedSettings:t()}}),[]),s=(0,d.useMemo)((()=>e?[(0,o.createBlock)("core/navigation",{ref:e})]:[]),[e]);return e&&s?.length?(0,me.jsx)(y.BlockEditorProvider,{settings:t,value:s,onChange:Bw,onInput:Bw,children:(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-navigation-menus__content",children:(0,me.jsx)(Rw,{rootClientId:s[0].clientId})})}):null}function Lw(e,t,s){return e?.rendered?"publish"===s?(0,cs.decodeEntities)(e?.rendered):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),(0,cs.decodeEntities)(e?.rendered),s):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}function zw({navigationMenu:e,backPath:t,handleDelete:s,handleDuplicate:n,handleSave:i}){const r=e?.title?.rendered;return(0,me.jsx)($w,{actions:(0,me.jsx)(me.Fragment,{children:(0,me.jsx)(Iw,{menuId:e?.id,menuTitle:(0,cs.decodeEntities)(r),onDelete:s,onSave:i,onDuplicate:n})}),backPath:t,title:Lw(e?.title,e?.id,e?.status),description:(0,b.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),children:(0,me.jsx)(Dw,{navigationMenuId:e?.id})})}const{useLocation:Gw}=se(Xt.privateApis),Hw="wp_navigation";function Uw({backPath:e}){const{params:{postId:t}}=Gw(),{record:s,isResolving:n}=(0,_.useEntityRecord)("postType",Hw,t),{isSaving:i,isDeleting:r}=(0,l.useSelect)((e=>{const{isSavingEntityRecord:s,isDeletingEntityRecord:n}=e(_.store);return{isSaving:s("postType",Hw,t),isDeleting:n("postType",Hw,t)}}),[t]),o=n||i||r,a=s?.title?.rendered||s?.slug,{handleSave:c,handleDelete:u,handleDuplicate:d}=Yw(),h=()=>u(s),p=e=>c(s,e),f=()=>d(s);return o?(0,me.jsx)($w,{description:(0,b.__)("Navigation Menus are a curated collection of blocks that allow visitors to get around your site."),backPath:e,children:(0,me.jsx)(x.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):o||s?s?.content?.raw?(0,me.jsx)(zw,{navigationMenu:s,backPath:e,handleDelete:h,handleSave:p,handleDuplicate:f}):(0,me.jsx)($w,{actions:(0,me.jsx)(Iw,{menuId:s?.id,menuTitle:(0,cs.decodeEntities)(a),onDelete:h,onSave:p,onDuplicate:f}),backPath:e,title:Lw(s?.title,s?.id,s?.status),description:(0,b.__)("This Navigation Menu is empty.")}):(0,me.jsx)($w,{description:(0,b.__)("Navigation Menu missing."),backPath:e})}const{useHistory:Ww}=se(Xt.privateApis);function qw(){const{deleteEntityRecord:e}=(0,l.useDispatch)(_.store),{createSuccessNotice:t,createErrorNotice:s}=(0,l.useDispatch)(w.store),n=Ww();return async i=>{const r=i?.id;try{await e("postType",Hw,r,{force:!0},{throwOnError:!0}),t((0,b.__)("Navigation Menu successfully deleted."),{type:"snackbar"}),n.push({postType:"wp_navigation"})}catch(e){s((0,b.sprintf)((0,b.__)("Unable to delete Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Zw(){const{getEditedEntityRecord:e}=(0,l.useSelect)((e=>{const{getEditedEntityRecord:t}=e(_.store);return{getEditedEntityRecord:t}}),[]),{editEntityRecord:t,__experimentalSaveSpecifiedEntityEdits:s}=(0,l.useDispatch)(_.store),{createSuccessNotice:n,createErrorNotice:i}=(0,l.useDispatch)(w.store);return async(r,o)=>{if(!o)return;const a=r?.id,l=e("postType",Ae,a);t("postType",Hw,a,o);const c=Object.keys(o);try{await s("postType",Hw,a,c,{throwOnError:!0}),n((0,b.__)("Renamed Navigation Menu"),{type:"snackbar"})}catch(e){t("postType",Hw,a,l),i((0,b.sprintf)((0,b.__)("Unable to rename Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Kw(){const e=Ww(),{saveEntityRecord:t}=(0,l.useDispatch)(_.store),{createSuccessNotice:s,createErrorNotice:n}=(0,l.useDispatch)(w.store);return async i=>{const r=i?.title?.rendered||i?.slug;try{const n=await t("postType",Hw,{title:(0,b.sprintf)((0,b.__)("%s (Copy)"),r),content:i?.content?.raw,status:"publish"},{throwOnError:!0});n&&(s((0,b.__)("Duplicated Navigation Menu"),{type:"snackbar"}),e.push({postType:Hw,postId:n.id}))}catch(e){n((0,b.sprintf)((0,b.__)("Unable to duplicate Navigation Menu (%s)."),e?.message),{type:"snackbar"})}}}function Yw(){return{handleDelete:qw(),handleSave:Zw(),handleDuplicate:Kw()}}function Xw(e,t,s){return e?"publish"===s?(0,cs.decodeEntities)(e):(0,b.sprintf)((0,b.__)("%1$s (%2$s)"),(0,cs.decodeEntities)(e),s):(0,b.sprintf)((0,b.__)("(no title %s)"),t)}let Jw=!1;function Qw({backPath:e}){const{records:t,isResolving:s,hasResolved:n}=(0,_.useEntityRecords)("postType",Ae,Sw),i=s&&!n,{getNavigationFallbackId:r}=se((0,l.useSelect)(_.store)),o=t?.[0];o&&(Jw=!0),o||s||!n||Jw||r();const{handleSave:a,handleDelete:c,handleDuplicate:u}=Yw(),d=!!t?.length;return i?(0,me.jsx)($w,{backPath:e,children:(0,me.jsx)(x.Spinner,{className:"edit-site-sidebar-navigation-screen-navigation-menus__loading"})}):i||d?1===t?.length?(0,me.jsx)(zw,{navigationMenu:o,backPath:e,handleDelete:()=>c(o),handleDuplicate:()=>u(o),handleSave:e=>a(o,e)}):(0,me.jsx)($w,{backPath:e,children:(0,me.jsx)(x.__experimentalItemGroup,{children:t?.map((({id:e,title:t,status:s},n)=>(0,me.jsx)(e_,{postId:e,withChevron:!0,icon:ww,children:Xw(t?.rendered,n+1,s)},e)))})}):(0,me.jsx)($w,{description:(0,b.__)("No Navigation Menus found."),backPath:e})}function $w({children:e,actions:t,title:s,description:n,backPath:i}){return(0,me.jsx)(lw,{title:s||(0,b.__)("Navigation"),actions:t,description:n||(0,b.__)("Manage your Navigation Menus."),backPath:i,content:e})}const e_=({postId:e,...t})=>{const s=on({postId:e,postType:"wp_navigation"});return(0,me.jsx)(hw,{...s,...t})},{useLocation:t_}=se(Xt.privateApis);function s_({title:e,slug:t,customViewId:s,type:n,icon:i,isActive:r,isCustom:o,suffix:a}){const{params:{postType:l,layout:c}}=t_(),u=i||Wp.find((e=>e.type===n)).icon;let d=o?s:t;"all"===d&&(d=void 0);const h=on({postType:l,layout:c,activeView:d,isCustom:o?"true":void 0});return(0,me.jsxs)(x.__experimentalHStack,{justify:"flex-start",className:Qt("edit-site-sidebar-dataviews-dataview-item",{"is-selected":r}),children:[(0,me.jsx)(hw,{icon:u,...h,"aria-current":r?"true":void 0,children:e}),a]})}const n_=[];function i_({template:e,isActive:t}){const{text:s,icon:n}=Rx(e.type,e.id);return(0,me.jsx)(s_,{slug:s,title:s,icon:n,isActive:t,isCustom:!1},s)}function r_({activeView:e,title:t}){const{records:s}=(0,_.useEntityRecords)("postType",Me,{per_page:-1}),n=(0,d.useMemo)((()=>{var e;const t=s?.reduce(((e,t)=>{const s=t.author_text;return s&&!e[s]&&(e[s]=t),e}),{});return null!==(e=t&&Object.values(t))&&void 0!==e?e:n_}),[s]);return(0,me.jsxs)(x.__experimentalItemGroup,{children:[(0,me.jsx)(s_,{slug:"all",title:t,icon:en,isActive:"all"===e,isCustom:!1}),n.map((t=>(0,me.jsx)(i_,{template:t,isActive:e===t.author_text},t.author_text)))]})}const{useLocation:o_}=se(Xt.privateApis);function a_({backPath:e}){const{params:{activeView:t="all"}}=o_();return(0,me.jsx)(lw,{title:(0,b.__)("Templates"),description:(0,b.__)("Create new templates, or reset any customizations made to the templates supplied by your theme."),backPath:e,content:(0,me.jsx)(r_,{activeView:t,title:(0,b.__)("All templates")})})}const l_=(0,me.jsx)(us.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,me.jsx)(us.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"})});function c_({count:e,icon:t,id:s,isActive:n,label:i,type:r}){const o=on({categoryId:s!==Re&&s!==De?s:void 0,postType:r===Ne?Ne:Be.user});if(e)return(0,me.jsx)(hw,{...o,icon:t,suffix:(0,me.jsx)("span",{children:e}),"aria-current":n?"true":void 0,children:i})}const u_=e=>{const t=e||[],s=(0,l.useSelect)((e=>e(h.store).__experimentalGetDefaultTemplatePartAreas()),[]),n={header:{},footer:{},sidebar:{},uncategorized:{}};s.forEach((e=>n[e.area]={...e,templateParts:[]}));return t.reduce(((e,t)=>(e[e[t.area]?t.area:Ve].templateParts.push(t),e)),n)};const{useLocation:d_}=se(Xt.privateApis);function h_({templatePartAreas:e,patternCategories:t,currentCategory:s,currentType:n}){const[i,...r]=t;return(0,me.jsxs)(x.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:[(0,me.jsx)(c_,{count:Object.values(e).map((({templateParts:e})=>e?.length||0)).reduce(((e,t)=>e+t),0),icon:(0,h.getTemplatePartIcon)(),label:(0,b.__)("All template parts"),id:Re,type:Ne,isActive:s===Re&&n===Ne},"all"),Object.entries(e).map((([e,{label:t,templateParts:i}])=>(0,me.jsx)(c_,{count:i?.length,icon:(0,h.getTemplatePartIcon)(e),label:t,id:e,type:Ne,isActive:s===e&&n===Ne},e))),(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-patterns__divider"}),i&&(0,me.jsx)(c_,{count:i.count,label:i.label,icon:l_,id:i.name,type:Be.user,isActive:s===`${i.name}`&&n===Be.user},i.name),r.map((e=>(0,me.jsx)(c_,{count:e.count,label:e.label,icon:l_,id:e.name,type:Be.user,isActive:s===`${e.name}`&&n===Be.user},e.name)))]})}function p_({backPath:e}){const{params:{postType:t,categoryId:s}}=d_(),n=t||Be.user,i=s||(n===Be.user?De:Re),{templatePartAreas:r,hasTemplateParts:o,isLoading:a}=function(){const{records:e,isResolving:t}=(0,_.useEntityRecords)("postType",Ne,{per_page:-1});return{hasTemplateParts:!!e&&!!e.length,isLoading:t,templatePartAreas:u_(e)}}(),{patternCategories:c,hasPatterns:u}=Ex(),d=(0,l.useSelect)((e=>e(_.store).getCurrentTheme()?.is_block_theme),[]);return(0,me.jsx)(lw,{isRoot:!d,title:(0,b.__)("Patterns"),description:(0,b.__)("Manage what patterns are available when editing the site."),backPath:e,content:(0,me.jsxs)(me.Fragment,{children:[a&&(0,b.__)("Loading items…"),!a&&(0,me.jsxs)(me.Fragment,{children:[!o&&!u&&(0,me.jsx)(x.__experimentalItemGroup,{className:"edit-site-sidebar-navigation-screen-patterns__group",children:(0,me.jsx)(x.__experimentalItem,{children:(0,b.__)("No items found")})}),(0,me.jsx)(h_,{templatePartAreas:r,patternCategories:c,currentCategory:i,currentType:n})]})]})})}const{useHistory:f_}=se(Xt.privateApis);function m_({type:e,setIsAdding:t}){const s=f_(),{saveEntityRecord:n}=(0,l.useDispatch)(_.store),[i,r]=(0,d.useState)(""),[o,a]=(0,d.useState)(!1);return(0,me.jsx)("form",{onSubmit:async r=>{r.preventDefault(),a(!0);const{getEntityRecords:o}=(0,l.resolveSelect)(_.store);let c;const u=await o("taxonomy","wp_dataviews_type",{slug:e});if(u&&u.length>0)c=u[0].id;else{const t=await n("taxonomy","wp_dataviews_type",{name:e});t&&t.id&&(c=t.id)}const d=await n("postType","wp_dataviews",{title:i,status:"publish",wp_dataviews_type:c,content:JSON.stringify(My[e][0].view)}),{params:{postType:h}}=s.getLocationWithParams();s.push({postType:h,activeView:d.id,isCustom:"true"}),a(!1),t(!1)},children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"5",children:[(0,me.jsx)(x.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:i,onChange:r,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,me.jsxs)(x.__experimentalHStack,{justify:"right",children:[(0,me.jsx)(x.Button,{variant:"tertiary",onClick:()=>{t(!1)},children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{variant:"primary",type:"submit","aria-disabled":!i||o,isBusy:o,children:(0,b.__)("Create")})]})]})})}function g_({type:e}){const[t,s]=(0,d.useState)(!1);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(hw,{icon:Su,onClick:()=>{s(!0)},className:"dataviews__siderbar-content-add-new-item",children:(0,b.__)("New view")}),t&&(0,me.jsx)(x.Modal,{title:(0,b.__)("Add new view"),onRequestClose:()=>{s(!1)},children:(0,me.jsx)(m_,{type:e,setIsAdding:s})})]})}const{useHistory:v_}=se(Xt.privateApis),y_=[];function x_({dataviewId:e,currentTitle:t,setIsRenaming:s}){const{editEntityRecord:n}=(0,l.useDispatch)(_.store),[i,r]=(0,d.useState)(t);return(0,me.jsx)("form",{onSubmit:async t=>{t.preventDefault(),await n("postType","wp_dataviews",e,{title:i}),s(!1)},children:(0,me.jsxs)(x.__experimentalVStack,{spacing:"5",children:[(0,me.jsx)(x.TextControl,{__nextHasNoMarginBottom:!0,label:(0,b.__)("Name"),value:i,onChange:r,placeholder:(0,b.__)("My view"),className:"patterns-create-modal__name-input"}),(0,me.jsxs)(x.__experimentalHStack,{justify:"right",children:[(0,me.jsx)(x.Button,{variant:"tertiary",onClick:()=>{s(!1)},children:(0,b.__)("Cancel")}),(0,me.jsx)(x.Button,{variant:"primary",type:"submit","aria-disabled":!i,children:(0,b.__)("Rename")})]})]})})}function b_({dataviewId:e,isActive:t}){const s=v_(),{dataview:n}=(0,l.useSelect)((t=>{const{getEditedEntityRecord:s}=t(_.store);return{dataview:s("postType","wp_dataviews",e)}}),[e]),{deleteEntityRecord:i}=(0,l.useDispatch)(_.store),r=(0,d.useMemo)((()=>JSON.parse(n.content).type),[n.content]),[o,a]=(0,d.useState)(!1);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(s_,{title:n.title,type:r,isActive:t,isCustom:!0,customViewId:e,suffix:(0,me.jsx)(x.DropdownMenu,{icon:zn,label:(0,b.__)("Actions"),className:"edit-site-sidebar-dataviews-dataview-item__dropdown-menu",toggleProps:{style:{color:"inherit"},size:"small"},children:({onClose:e})=>(0,me.jsxs)(x.MenuGroup,{children:[(0,me.jsx)(x.MenuItem,{onClick:()=>{a(!0),e()},children:(0,b.__)("Rename")}),(0,me.jsx)(x.MenuItem,{onClick:async()=>{if(await i("postType","wp_dataviews",n.id,{force:!0}),t){const{params:{postType:e}}=s.getLocationWithParams();s.replace({postType:e})}e()},isDestructive:!0,children:(0,b.__)("Delete")})]})})}),o&&(0,me.jsx)(x.Modal,{title:(0,b.__)("Rename view"),onRequestClose:()=>{a(!1)},children:(0,me.jsx)(x_,{dataviewId:e,setIsRenaming:a,currentTitle:n.title})})]})}function w_({type:e,activeView:t,isCustom:s}){const n=function(e){return(0,l.useSelect)((t=>{const{getEntityRecords:s}=t(_.store),n=s("taxonomy","wp_dataviews_type",{slug:e});if(!n||0===n.length)return y_;return s("postType","wp_dataviews",{wp_dataviews_type:n[0].id,orderby:"date",order:"asc"})||y_}))}(e);return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("div",{className:"edit-site-sidebar-navigation-screen-dataviews__group-header",children:(0,me.jsx)(x.__experimentalHeading,{level:2,children:(0,b.__)("Custom Views")})}),(0,me.jsxs)(x.__experimentalItemGroup,{children:[n.map((e=>(0,me.jsx)(b_,{dataviewId:e.id,isActive:s&&Number(t)===e.id},e.id))),(0,me.jsx)(g_,{type:e})]})]})}const{useLocation:__}=se(Xt.privateApis);function S_(){const{params:{postType:e,activeView:t="all",isCustom:s="false"}}=__();if(!e)return null;const n="true"===s;return(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(x.__experimentalItemGroup,{children:My[e].map((e=>(0,me.jsx)(s_,{slug:e.slug,title:e.title,icon:e.icon,type:e.view.type,isActive:!n&&e.slug===t,isCustom:!1},e.slug)))}),window?.__experimentalCustomViews&&(0,me.jsx)(w_,{activeView:t,type:e,isCustom:!0})]})}const{useLocation:j_,useHistory:C_}=se(Xt.privateApis);function k_(){const e=hn(),{params:t}=j_(),{postType:s,postId:n,path:i,layout:r,isCustom:o,canvas:a}=t;if(function(){const e=C_(),{params:t}=j_();(0,d.useEffect)((()=>{const{postType:s,path:n,categoryType:i,...r}=t;"/wp_template_part/all"===n&&e.replace({postType:Ne}),"/page"===n&&e.replace({postType:"page",...r}),"/wp_template"===n&&e.replace({postType:Me,...r}),"/patterns"===n&&e.replace({postType:i===Ne?Ne:Be.user,...r}),"/navigation"===n&&e.replace({postType:Ae,...r})}),[e,t])}(),"page"===s){const t="list"===r||!r;return{key:"pages",areas:{sidebar:(0,me.jsx)(lw,{title:(0,b.__)("Pages"),backPath:{},content:(0,me.jsx)(S_,{})}),content:(0,me.jsx)(Ky,{}),preview:(t||"edit"===a)&&(0,me.jsx)(Mh,{isLoading:e}),mobile:"edit"===a?(0,me.jsx)(Mh,{isLoading:e}):(0,me.jsx)(Ky,{})},widths:{content:t?380:void 0}}}if(s===Me){const t="true"!==o&&"list"===r;return{key:"templates",areas:{sidebar:(0,me.jsx)(a_,{backPath:{}}),content:(0,me.jsx)($b,{}),preview:(t||"edit"===a)&&(0,me.jsx)(Mh,{isLoading:e}),mobile:(0,me.jsx)($b,{})},widths:{content:t?380:void 0}}}return[Ne,Be.user].includes(s)?{key:"patterns",areas:{sidebar:(0,me.jsx)(p_,{backPath:{}}),content:(0,me.jsx)(Xx,{}),mobile:(0,me.jsx)(Xx,{}),preview:"edit"===a&&(0,me.jsx)(Mh,{isLoading:e})}}:"/wp_global_styles"===i?{key:"styles",areas:{sidebar:(0,me.jsx)(bw,{backPath:{}}),preview:(0,me.jsx)(Mh,{isLoading:e}),mobile:"edit"===a&&(0,me.jsx)(Mh,{isLoading:e})}}:s===Ae?n?{key:"navigation",areas:{sidebar:(0,me.jsx)(Uw,{backPath:{postType:Ae}}),preview:(0,me.jsx)(Mh,{isLoading:e}),mobile:"edit"===a&&(0,me.jsx)(Mh,{isLoading:e})}}:{key:"navigation",areas:{sidebar:(0,me.jsx)(Qw,{backPath:{}}),preview:(0,me.jsx)(Mh,{isLoading:e}),mobile:"edit"===a&&(0,me.jsx)(Mh,{isLoading:e})}}:{key:"default",areas:{sidebar:(0,me.jsx)(_w,{}),preview:(0,me.jsx)(Mh,{isLoading:e}),mobile:"edit"===a&&(0,me.jsx)(Mh,{isLoading:e})}}}var E_=H_(),P_=e=>D_(e,E_),I_=H_();P_.write=e=>D_(e,I_);var T_=H_();P_.onStart=e=>D_(e,T_);var O_=H_();P_.onFrame=e=>D_(e,O_);var A_=H_();P_.onFinish=e=>D_(e,A_);var M_=[];P_.setTimeout=(e,t)=>{let s=P_.now()+t,n=()=>{let e=M_.findIndex((e=>e.cancel==n));~e&&M_.splice(e,1),R_-=~e?1:0},i={time:s,handler:e,cancel:n};return M_.splice(N_(s),0,i),R_+=1,L_(),i};var N_=e=>~(~M_.findIndex((t=>t.time>e))||~M_.length);P_.cancel=e=>{T_.delete(e),O_.delete(e),A_.delete(e),E_.delete(e),I_.delete(e)},P_.sync=e=>{B_=!0,P_.batchedUpdates(e),B_=!1},P_.throttle=e=>{let t;function s(){try{e(...t)}finally{t=null}}function n(...e){t=e,P_.onStart(s)}return n.handler=e,n.cancel=()=>{T_.delete(s),t=null},n};var F_=typeof window<"u"?window.requestAnimationFrame:()=>{};P_.use=e=>F_=e,P_.now=typeof performance<"u"?()=>performance.now():Date.now,P_.batchedUpdates=e=>e(),P_.catch=console.error,P_.frameLoop="always",P_.advance=()=>{"demand"!==P_.frameLoop?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):G_()};var V_=-1,R_=0,B_=!1;function D_(e,t){B_?(t.delete(e),e(0)):(t.add(e),L_())}function L_(){V_<0&&(V_=0,"demand"!==P_.frameLoop&&F_(z_))}function z_(){~V_&&(F_(z_),P_.batchedUpdates(G_))}function G_(){let e=V_;V_=P_.now();let t=N_(V_);t&&(U_(M_.splice(0,t),(e=>e.handler())),R_-=t),R_?(T_.flush(),E_.flush(e?Math.min(64,V_-e):16.667),O_.flush(),I_.flush(),A_.flush()):V_=-1}function H_(){let e=new Set,t=e;return{add(s){R_+=t!=e||e.has(s)?0:1,e.add(s)},delete:s=>(R_-=t==e&&e.has(s)?1:0,e.delete(s)),flush(s){t.size&&(e=new Set,R_-=t.size,U_(t,(t=>t(s)&&e.add(t))),R_+=e.size,t=e)}}}function U_(e,t){e.forEach((e=>{try{t(e)}catch(e){P_.catch(e)}}))}var W_=Object.defineProperty,q_={};function Z_(){}((e,t)=>{for(var s in t)W_(e,s,{get:t[s],enumerable:!0})})(q_,{assign:()=>aS,colors:()=>iS,createStringInterpolator:()=>eS,skipAnimation:()=>rS,to:()=>tS,willAdvance:()=>oS});var K_={arr:Array.isArray,obj:e=>!!e&&"Object"===e.constructor.name,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,und:e=>void 0===e};function Y_(e,t){if(K_.arr(e)){if(!K_.arr(t)||e.length!==t.length)return!1;for(let s=0;se.forEach(t);function J_(e,t,s){if(K_.arr(e))for(let n=0;nK_.und(e)?[]:K_.arr(e)?e:[e];function $_(e,t){if(e.size){let s=Array.from(e);e.clear(),X_(s,t)}}var eS,tS,sS=(e,...t)=>$_(e,(e=>e(...t))),nS=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),iS=null,rS=!1,oS=Z_,aS=e=>{e.to&&(tS=e.to),e.now&&(P_.now=e.now),void 0!==e.colors&&(iS=e.colors),null!=e.skipAnimation&&(rS=e.skipAnimation),e.createStringInterpolator&&(eS=e.createStringInterpolator),e.requestAnimationFrame&&P_.use(e.requestAnimationFrame),e.batchedUpdates&&(P_.batchedUpdates=e.batchedUpdates),e.willAdvance&&(oS=e.willAdvance),e.frameLoop&&(P_.frameLoop=e.frameLoop)},lS=new Set,cS=[],uS=[],dS=0,hS={get idle(){return!lS.size&&!cS.length},start(e){dS>e.priority?(lS.add(e),P_.onStart(pS)):(fS(e),P_(gS))},advance:gS,sort(e){if(dS)P_.onFrame((()=>hS.sort(e)));else{let t=cS.indexOf(e);~t&&(cS.splice(t,1),mS(e))}},clear(){cS=[],lS.clear()}};function pS(){lS.forEach(fS),lS.clear(),P_(gS)}function fS(e){cS.includes(e)||mS(e)}function mS(e){cS.splice(function(e,t){let s=e.findIndex(t);return s<0?e.length:s}(cS,(t=>t.priority>e.priority)),0,e)}function gS(e){let t=uS;for(let s=0;s0}var vS="[-+]?\\d*\\.?\\d+",yS=vS+"%";function xS(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var bS=new RegExp("rgb"+xS(vS,vS,vS)),wS=new RegExp("rgba"+xS(vS,vS,vS,vS)),_S=new RegExp("hsl"+xS(vS,yS,yS)),SS=new RegExp("hsla"+xS(vS,yS,yS,vS)),jS=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,CS=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,kS=/^#([0-9a-fA-F]{6})$/,ES=/^#([0-9a-fA-F]{8})$/;function PS(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+6*(t-e)*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function IS(e,t,s){let n=s<.5?s*(1+t):s+t-s*t,i=2*s-n,r=PS(i,n,e+1/3),o=PS(i,n,e),a=PS(i,n,e-1/3);return Math.round(255*r)<<24|Math.round(255*o)<<16|Math.round(255*a)<<8}function TS(e){let t=parseInt(e,10);return t<0?0:t>255?255:t}function OS(e){return(parseFloat(e)%360+360)%360/360}function AS(e){let t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function MS(e){let t=parseFloat(e);return t<0?0:t>100?1:t/100}function NS(e){let t=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=kS.exec(e))?parseInt(t[1]+"ff",16)>>>0:iS&&void 0!==iS[e]?iS[e]:(t=bS.exec(e))?(TS(t[1])<<24|TS(t[2])<<16|TS(t[3])<<8|255)>>>0:(t=wS.exec(e))?(TS(t[1])<<24|TS(t[2])<<16|TS(t[3])<<8|AS(t[4]))>>>0:(t=jS.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=ES.exec(e))?parseInt(t[1],16)>>>0:(t=CS.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=_S.exec(e))?(255|IS(OS(t[1]),MS(t[2]),MS(t[3])))>>>0:(t=SS.exec(e))?(IS(OS(t[1]),MS(t[2]),MS(t[3]))|AS(t[4]))>>>0:null}(e);return null===t?e:(t=t||0,`rgba(${(4278190080&t)>>>24}, ${(16711680&t)>>>16}, ${(65280&t)>>>8}, ${(255&t)/255})`)}var FS=(e,t,s)=>{if(K_.fun(e))return e;if(K_.arr(e))return FS({range:e,output:t,extrapolate:s});if(K_.str(e.output[0]))return eS(e);let n=e,i=n.output,r=n.range||[0,1],o=n.extrapolateLeft||n.extrapolate||"extend",a=n.extrapolateRight||n.extrapolate||"extend",l=n.easing||(e=>e);return e=>{let t=function(e,t){for(var s=1;s=e);++s);return s-1}(e,r);return function(e,t,s,n,i,r,o,a,l){let c=l?l(e):e;if(cs){if("identity"===a)return c;"clamp"===a&&(c=s)}return n===i?n:t===s?e<=t?n:i:(t===-1/0?c=-c:s===1/0?c-=t:c=(c-t)/(s-t),c=r(c),n===-1/0?c=-c:i===1/0?c+=n:c=c*(i-n)+n,c)}(e,r[t],r[t+1],i[t],i[t+1],l,o,a,n.map)}};var VS=1.70158,RS=1.525*VS,BS=VS+1,DS=2*Math.PI/3,LS=2*Math.PI/4.5,zS=e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,GS={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2,easeInCubic:e=>e*e*e,easeOutCubic:e=>1-Math.pow(1-e,3),easeInOutCubic:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1-Math.pow(1-e,4),easeInOutQuart:e=>e<.5?8*e*e*e*e:1-Math.pow(-2*e+2,4)/2,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1-Math.pow(1-e,5),easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1-Math.pow(-2*e+2,5)/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>0===e?0:Math.pow(2,10*e-10),easeOutExpo:e=>1===e?1:1-Math.pow(2,-10*e),easeInOutExpo:e=>0===e?0:1===e?1:e<.5?Math.pow(2,20*e-10)/2:(2-Math.pow(2,-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-Math.pow(e,2)),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-Math.pow(2*e,2)))/2:(Math.sqrt(1-Math.pow(-2*e+2,2))+1)/2,easeInBack:e=>BS*e*e*e-VS*e*e,easeOutBack:e=>1+BS*Math.pow(e-1,3)+VS*Math.pow(e-1,2),easeInOutBack:e=>e<.5?Math.pow(2*e,2)*(2*(RS+1)*e-RS)/2:(Math.pow(2*e-2,2)*((RS+1)*(2*e-2)+RS)+2)/2,easeInElastic:e=>0===e?0:1===e?1:-Math.pow(2,10*e-10)*Math.sin((10*e-10.75)*DS),easeOutElastic:e=>0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*DS)+1,easeInOutElastic:e=>0===e?0:1===e?1:e<.5?-Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*LS)/2:Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*LS)/2+1,easeInBounce:e=>1-zS(1-e),easeOutBounce:zS,easeInOutBounce:e=>e<.5?(1-zS(1-2*e))/2:(1+zS(2*e-1))/2,steps:(e,t="end")=>s=>{let n=(s="end"===t?Math.min(s,.999):Math.max(s,.001))*e;return((e,t,s)=>Math.min(Math.max(s,e),t))(0,1,("end"===t?Math.floor(n):Math.ceil(n))/e)}},HS=Symbol.for("FluidValue.get"),US=Symbol.for("FluidValue.observers"),WS=e=>Boolean(e&&e[HS]),qS=e=>e&&e[HS]?e[HS]():e,ZS=e=>e[US]||null;function KS(e,t){let s=e[US];s&&s.forEach((e=>{!function(e,t){e.eventObserved?e.eventObserved(t):e(t)}(e,t)}))}var YS=class{[HS];[US];constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");XS(this,e)}},XS=(e,t)=>ej(e,HS,t);function JS(e,t){if(e[HS]){let s=e[US];s||ej(e,US,s=new Set),s.has(t)||(s.add(t),e.observerAdded&&e.observerAdded(s.size,t))}return t}function QS(e,t){let s=e[US];if(s&&s.has(t)){let n=s.size-1;n?s.delete(t):e[US]=null,e.observerRemoved&&e.observerRemoved(n,t)}}var $S,ej=(e,t,s)=>Object.defineProperty(e,t,{value:s,writable:!0,configurable:!0}),tj=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,sj=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,nj=new RegExp(`(${tj.source})(%|[a-z]+)`,"i"),ij=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,rj=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,oj=e=>{let[t,s]=aj(e);if(!t||nS())return e;let n=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(n)return n.trim();if(s&&s.startsWith("--")){return window.getComputedStyle(document.documentElement).getPropertyValue(s)||e}return s&&rj.test(s)?oj(s):s||e},aj=e=>{let t=rj.exec(e);if(!t)return[,];let[,s,n]=t;return[s,n]},lj=(e,t,s,n,i)=>`rgba(${Math.round(t)}, ${Math.round(s)}, ${Math.round(n)}, ${i})`,cj=e=>{$S||($S=iS?new RegExp(`(${Object.keys(iS).join("|")})(?!\\w)`,"g"):/^\b$/);let t=e.output.map((e=>qS(e).replace(rj,oj).replace(sj,NS).replace($S,NS))),s=t.map((e=>e.match(tj).map(Number))),n=s[0].map(((e,t)=>s.map((e=>{if(!(t in e))throw Error('The arity of each "output" value must be equal');return e[t]})))).map((t=>FS({...e,output:t})));return e=>{let s=!nj.test(t[0])&&t.find((e=>nj.test(e)))?.replace(tj,""),i=0;return t[0].replace(tj,(()=>`${n[i++](e)}${s||""}`)).replace(ij,lj)}},uj="react-spring: ",dj=e=>{let t=e,s=!1;if("function"!=typeof t)throw new TypeError(`${uj}once requires a function parameter`);return(...e)=>{s||(t(...e),s=!0)}},hj=dj(console.warn);dj(console.warn);function pj(e){return K_.str(e)&&("#"==e[0]||/\d/.test(e)||!nS()&&rj.test(e)||e in(iS||{}))}new WeakMap;new Set,new WeakMap,new WeakMap,new WeakMap;var fj=nS()?xf.useEffect:xf.useLayoutEffect;function mj(){let e=(0,xf.useState)()[1],t=(()=>{let e=(0,xf.useRef)(!1);return fj((()=>(e.current=!0,()=>{e.current=!1})),[]),e})();return()=>{t.current&&e(Math.random())}}var gj=[];var vj=Symbol.for("Animated:node"),yj=e=>e&&e[vj],xj=(e,t)=>((e,t,s)=>Object.defineProperty(e,t,{value:s,writable:!0,configurable:!0}))(e,vj,t),bj=e=>e&&e[vj]&&e[vj].getPayload(),wj=class{payload;constructor(){xj(this,this)}getPayload(){return this.payload||[]}},_j=class extends wj{constructor(e){super(),this._value=e,K_.num(this._value)&&(this.lastPosition=this._value)}done=!0;elapsedTime;lastPosition;lastVelocity;v0;durationProgress=0;static create(e){return new _j(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return K_.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value!==e&&(this._value=e,!0)}reset(){let{done:e}=this;this.done=!1,K_.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}},Sj=class extends _j{_string=null;_toString;constructor(e){super(0),this._toString=FS({output:[e,e]})}static create(e){return new Sj(e)}getValue(){return this._string??(this._string=this._toString(this._value))}setValue(e){if(K_.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else{if(!super.setValue(e))return!1;this._string=null}return!0}reset(e){e&&(this._toString=FS({output:[this.getValue(),e]})),this._value=0,super.reset()}},jj={dependencies:null},Cj=class extends wj{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){let t={};return J_(this.source,((s,n)=>{(e=>!!e&&e[vj]===e)(s)?t[n]=s.getValue(e):WS(s)?t[n]=qS(s):e||(t[n]=s)})),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&X_(this.payload,(e=>e.reset()))}_makePayload(e){if(e){let t=new Set;return J_(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){jj.dependencies&&WS(e)&&jj.dependencies.add(e);let t=bj(e);t&&X_(t,(e=>this.add(e)))}},kj=class extends Cj{constructor(e){super(e)}static create(e){return new kj(e)}getValue(){return this.source.map((e=>e.getValue()))}setValue(e){let t=this.getPayload();return e.length==t.length?t.map(((t,s)=>t.setValue(e[s]))).some(Boolean):(super.setValue(e.map(Ej)),!0)}};function Ej(e){return(pj(e)?Sj:_j).create(e)}function Pj(e){let t=yj(e);return t?t.constructor:K_.arr(e)?kj:pj(e)?Sj:_j}var Ij=(e,t)=>{let s=!K_.fun(e)||e.prototype&&e.prototype.isReactComponent;return(0,xf.forwardRef)(((n,i)=>{let r=(0,xf.useRef)(null),o=s&&(0,xf.useCallback)((e=>{r.current=function(e,t){return e&&(K_.fun(e)?e(t):e.current=t),t}(i,e)}),[i]),[a,l]=function(e,t){let s=new Set;return jj.dependencies=s,e.style&&(e={...e,style:t.createAnimatedStyle(e.style)}),e=new Cj(e),jj.dependencies=null,[e,s]}(n,t),c=mj(),u=()=>{let e=r.current;s&&!e||!1===(!!e&&t.applyAnimatedValues(e,a.getValue(!0)))&&c()},d=new Tj(u,l),h=(0,xf.useRef)();fj((()=>(h.current=d,X_(l,(e=>JS(e,d))),()=>{h.current&&(X_(h.current.deps,(e=>QS(e,h.current))),P_.cancel(h.current.update))}))),(0,xf.useEffect)(u,[]),(e=>{(0,xf.useEffect)(e,gj)})((()=>()=>{let e=h.current;X_(e.deps,(t=>QS(t,e)))}));let p=t.getComponentProps(a.getValue());return xf.createElement(e,{...p,ref:o})}))},Tj=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){"change"==e.type&&P_.write(this.update)}};var Oj=Symbol.for("AnimatedComponent"),Aj=e=>K_.str(e)?e:e&&K_.str(e.displayName)?e.displayName:K_.fun(e)&&e.name||null;function Mj(e,...t){return K_.fun(e)?e(...t):e}var Nj=(e,t)=>!0===e||!!(t&&e&&(K_.fun(e)?e(t):Q_(e).includes(t))),Fj=(e,t)=>K_.obj(e)?t&&e[t]:e,Vj=(e,t)=>!0===e.default?e[t]:e.default?e.default[t]:void 0,Rj=e=>e,Bj=(e,t=Rj)=>{let s=Dj;e.default&&!0!==e.default&&(e=e.default,s=Object.keys(e));let n={};for(let i of s){let s=t(e[i],i);K_.und(s)||(n[i]=s)}return n},Dj=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Lj={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function zj(e){let t=function(e){let t={},s=0;if(J_(e,((e,n)=>{Lj[n]||(t[n]=e,s++)})),s)return t}(e);if(t){let s={to:t};return J_(e,((e,n)=>n in t||(s[n]=e))),s}return{...e}}function Gj(e){return e=qS(e),K_.arr(e)?e.map(Gj):pj(e)?q_.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Hj(e){return K_.fun(e)||K_.arr(e)&&K_.obj(e[0])}var Uj={tension:170,friction:26,mass:1,damping:1,easing:GS.linear,clamp:!1},Wj=class{tension;friction;frequency;damping;mass;velocity=0;restVelocity;precision;progress;duration;easing;clamp;bounce;decay;round;constructor(){Object.assign(this,Uj)}};function qj(e,t){if(K_.und(t.decay)){let s=!K_.und(t.tension)||!K_.und(t.friction);(s||!K_.und(t.frequency)||!K_.und(t.damping)||!K_.und(t.mass))&&(e.duration=void 0,e.decay=void 0),s&&(e.frequency=void 0)}else e.duration=void 0}var Zj=[],Kj=class{changed=!1;values=Zj;toValues=null;fromValues=Zj;to;from;config=new Wj;immediate=!1};function Yj(e,{key:t,props:s,defaultProps:n,state:i,actions:r}){return new Promise(((o,a)=>{let l,c,u=Nj(s.cancel??n?.cancel,t);if(u)p();else{K_.und(s.pause)||(i.paused=Nj(s.pause,t));let e=n?.pause;!0!==e&&(e=i.paused||Nj(e,t)),l=Mj(s.delay||0,t),e?(i.resumeQueue.add(h),r.pause()):(r.resume(),h())}function d(){i.resumeQueue.add(h),i.timeouts.delete(c),c.cancel(),l=c.time-P_.now()}function h(){l>0&&!q_.skipAnimation?(i.delayed=!0,c=P_.setTimeout(p,l),i.pauseQueue.add(d),i.timeouts.add(c)):p()}function p(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(d),i.timeouts.delete(c),e<=(i.cancelId||0)&&(u=!0);try{r.start({...s,callId:e,cancel:u},o)}catch(e){a(e)}}}))}var Xj=(e,t)=>1==t.length?t[0]:t.some((e=>e.cancelled))?$j(e.get()):t.every((e=>e.noop))?Jj(e.get()):Qj(e.get(),t.every((e=>e.finished))),Jj=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),Qj=(e,t,s=!1)=>({value:e,finished:t,cancelled:s}),$j=e=>({value:e,cancelled:!0,finished:!1});function eC(e,t,s,n){let{callId:i,parentId:r,onRest:o}=t,{asyncTo:a,promise:l}=s;return r||e!==a||t.reset?s.promise=(async()=>{s.asyncId=i,s.asyncTo=e;let c,u,d,h=Bj(t,((e,t)=>"onRest"===t?void 0:e)),p=new Promise(((e,t)=>(c=e,u=t))),f=e=>{let t=i<=(s.cancelId||0)&&$j(n)||i!==s.asyncId&&Qj(n,!1);if(t)throw e.result=t,u(e),e},m=(e,t)=>{let r=new sC,o=new nC;return(async()=>{if(q_.skipAnimation)throw tC(s),o.result=Qj(n,!1),u(o),o;f(r);let a=K_.obj(e)?{...e}:{...t,to:e};a.parentId=i,J_(h,((e,t)=>{K_.und(a[t])&&(a[t]=e)}));let l=await n.start(a);return f(r),s.paused&&await new Promise((e=>{s.resumeQueue.add(e)})),l})()};if(q_.skipAnimation)return tC(s),Qj(n,!1);try{let t;t=K_.arr(e)?(async e=>{for(let t of e)await m(t)})(e):Promise.resolve(e(m,n.stop.bind(n))),await Promise.all([t.then(c),p]),d=Qj(n.get(),!0,!1)}catch(e){if(e instanceof sC)d=e.result;else{if(!(e instanceof nC))throw e;d=e.result}}finally{i==s.asyncId&&(s.asyncId=r,s.asyncTo=r?a:void 0,s.promise=r?l:void 0)}return K_.fun(o)&&P_.batchedUpdates((()=>{o(d,n,n.item)})),d})():l}function tC(e,t){$_(e.timeouts,(e=>e.cancel())),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var sC=class extends Error{result;constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},nC=class extends Error{result;constructor(){super("SkipAnimationSignal")}},iC=e=>e instanceof oC,rC=1,oC=class extends YS{id=rC++;_priority=0;get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){let e=yj(this);return e&&e.getValue()}to(...e){return q_.to(this,e)}interpolate(...e){return hj(`${uj}The "interpolate" function is deprecated in v9 (use "to" instead)`),q_.to(this,e)}toJSON(){return this.get()}observerAdded(e){1==e&&this._attach()}observerRemoved(e){0==e&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){KS(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||hS.sort(this),KS(this,{type:"priority",parent:this,priority:e})}},aC=Symbol.for("SpringPhase"),lC=e=>(1&e[aC])>0,cC=e=>(2&e[aC])>0,uC=e=>(4&e[aC])>0,dC=(e,t)=>t?e[aC]|=3:e[aC]&=-3,hC=(e,t)=>t?e[aC]|=4:e[aC]&=-5,pC=class extends oC{key;animation=new Kj;queue;defaultProps={};_state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_pendingCalls=new Set;_lastCallId=0;_lastToId=0;_memoizedDuration=0;constructor(e,t){if(super(),!K_.und(e)||!K_.und(t)){let s=K_.obj(e)?{...e}:{...t,from:e};K_.und(s.default)&&(s.default=!0),this.start(s)}}get idle(){return!(cC(this)||this._state.asyncTo)||uC(this)}get goal(){return qS(this.animation.to)}get velocity(){let e=yj(this);return e instanceof _j?e.lastVelocity||0:e.getPayload().map((e=>e.lastVelocity||0))}get hasAnimated(){return lC(this)}get isAnimating(){return cC(this)}get isPaused(){return uC(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,s=!1,n=this.animation,{config:i,toValues:r}=n,o=bj(n.to);!o&&WS(n.to)&&(r=Q_(qS(n.to))),n.values.forEach(((a,l)=>{if(a.done)return;let c=a.constructor==Sj?1:o?o[l].lastPosition:r[l],u=n.immediate,d=c;if(!u){if(d=a.lastPosition,i.tension<=0)return void(a.done=!0);let t,s=a.elapsedTime+=e,r=n.fromValues[l],o=null!=a.v0?a.v0:a.v0=K_.arr(i.velocity)?i.velocity[l]:i.velocity,h=i.precision||(r==c?.005:Math.min(1,.001*Math.abs(c-r)));if(K_.und(i.duration))if(i.decay){let e=!0===i.decay?.998:i.decay,n=Math.exp(-(1-e)*s);d=r+o/(1-e)*(1-n),u=Math.abs(a.lastPosition-d)<=h,t=o*n}else{t=null==a.lastVelocity?o:a.lastVelocity;let s,n=i.restVelocity||h/10,l=i.clamp?0:i.bounce,p=!K_.und(l),f=r==c?a.v0>0:rn,s||(u=Math.abs(c-d)<=h,!u));++e){p&&(m=d==c||d>c==f,m&&(t=-t*l,d=c)),t+=(1e-6*-i.tension*(d-c)+.001*-i.friction*t)/i.mass*g,d+=t*g}}else{let n=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,a.durationProgress>0&&(a.elapsedTime=i.duration*a.durationProgress,s=a.elapsedTime+=e)),n=(i.progress||0)+s/this._memoizedDuration,n=n>1?1:n<0?0:n,a.durationProgress=n),d=r+i.easing(n)*(c-r),t=(d-a.lastPosition)/e,u=1==n}a.lastVelocity=t,Number.isNaN(d)&&(console.warn("Got NaN while animating:",this),u=!0)}o&&!o[l].done&&(u=!1),u?a.done=!0:t=!1,a.setValue(d,i.round)&&(s=!0)}));let a=yj(this),l=a.getValue();if(t){let e=qS(n.to);l===e&&!s||i.decay?s&&i.decay&&this._onChange(l):(a.setValue(e),this._onChange(e)),this._stop()}else s&&this._onChange(l)}set(e){return P_.batchedUpdates((()=>{this._stop(),this._focus(e),this._set(e)})),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(cC(this)){let{to:e,config:t}=this.animation;P_.batchedUpdates((()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()}))}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let s;return K_.und(e)?(s=this.queue||[],this.queue=[]):s=[K_.obj(e)?e:{...t,to:e}],Promise.all(s.map((e=>this._update(e)))).then((e=>Xj(this,e)))}stop(e){let{to:t}=this.animation;return this._focus(this.get()),tC(this._state,e&&this._lastCallId),P_.batchedUpdates((()=>this._stop(t,e))),this}reset(){this._update({reset:!0})}eventObserved(e){"change"==e.type?this._start():"priority"==e.type&&(this.priority=e.priority+1)}_prepareNode(e){let t=this.key||"",{to:s,from:n}=e;s=K_.obj(s)?s[t]:s,(null==s||Hj(s))&&(s=void 0),n=K_.obj(n)?n[t]:n,null==n&&(n=void 0);let i={to:s,from:n};return lC(this)||(e.reverse&&([s,n]=[n,s]),n=qS(n),K_.und(n)?yj(this)||this._set(s):this._set(n)),i}_update({...e},t){let{key:s,defaultProps:n}=this;e.default&&Object.assign(n,Bj(e,((e,t)=>/^on/.test(t)?Fj(e,s):e))),xC(this,e,"onProps"),bC(this,"onProps",e,this);let i=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");let r=this._state;return Yj(++this._lastCallId,{key:s,props:e,defaultProps:n,state:r,actions:{pause:()=>{uC(this)||(hC(this,!0),sS(r.pauseQueue),bC(this,"onPause",Qj(this,fC(this,this.animation.to)),this))},resume:()=>{uC(this)&&(hC(this,!1),cC(this)&&this._resume(),sS(r.resumeQueue),bC(this,"onResume",Qj(this,fC(this,this.animation.to)),this))},start:this._merge.bind(this,i)}}).then((s=>{if(e.loop&&s.finished&&(!t||!s.noop)){let t=mC(e);if(t)return this._update(t,!0)}return s}))}_merge(e,t,s){if(t.cancel)return this.stop(!0),s($j(this));let n=!K_.und(e.to),i=!K_.und(e.from);if(n||i){if(!(t.callId>this._lastToId))return s($j(this));this._lastToId=t.callId}let{key:r,defaultProps:o,animation:a}=this,{to:l,from:c}=a,{to:u=l,from:d=c}=e;i&&!n&&(!t.default||K_.und(u))&&(u=d),t.reverse&&([u,d]=[d,u]);let h=!Y_(d,c);h&&(a.from=d),d=qS(d);let p=!Y_(u,l);p&&this._focus(u);let f=Hj(t.to),{config:m}=a,{decay:g,velocity:v}=m;(n||i)&&(m.velocity=0),t.config&&!f&&function(e,t,s){s&&(qj(s={...s},t),t={...s,...t}),qj(e,t),Object.assign(e,t);for(let t in Uj)null==e[t]&&(e[t]=Uj[t]);let{mass:n,frequency:i,damping:r}=e;K_.und(i)||(i<.01&&(i=.01),r<0&&(r=0),e.tension=Math.pow(2*Math.PI/i,2)*n,e.friction=4*Math.PI*r*n/i)}(m,Mj(t.config,r),t.config!==o.config?Mj(o.config,r):void 0);let y=yj(this);if(!y||K_.und(u))return s(Qj(this,!0));let x=K_.und(t.reset)?i&&!t.default:!K_.und(d)&&Nj(t.reset,r),b=x?d:this.get(),w=Gj(u),_=K_.num(w)||K_.arr(w)||pj(w),S=!f&&(!_||Nj(o.immediate||t.immediate,r));if(p){let e=Pj(u);if(e!==y.constructor){if(!S)throw Error(`Cannot animate between ${y.constructor.name} and ${e.name}, as the "to" prop suggests`);y=this._set(w)}}let j=y.constructor,C=WS(u),k=!1;if(!C){let e=x||!lC(this)&&h;(p||e)&&(k=Y_(Gj(b),w),C=!k),(!Y_(a.immediate,S)&&!S||!Y_(m.decay,g)||!Y_(m.velocity,v))&&(C=!0)}if(k&&cC(this)&&(a.changed&&!x?C=!0:C||this._stop(l)),!f&&((C||WS(l))&&(a.values=y.getPayload(),a.toValues=WS(u)?null:j==Sj?[1]:Q_(w)),a.immediate!=S&&(a.immediate=S,!S&&!x&&this._set(l)),C)){let{onRest:e}=a;X_(yC,(e=>xC(this,t,e)));let n=Qj(this,fC(this,l));sS(this._pendingCalls,n),this._pendingCalls.add(s),a.changed&&P_.batchedUpdates((()=>{a.changed=!x,e?.(n,this),x?Mj(o.onRest,n):a.onStart?.(n,this)}))}x&&this._set(b),f?s(eC(t.to,t,this._state,this)):C?this._start():cC(this)&&!p?this._pendingCalls.add(s):s(Jj(b))}_focus(e){let t=this.animation;e!==t.to&&(ZS(this)&&this._detach(),t.to=e,ZS(this)&&this._attach())}_attach(){let e=0,{to:t}=this.animation;WS(t)&&(JS(t,this),iC(t)&&(e=t.priority+1)),this.priority=e}_detach(){let{to:e}=this.animation;WS(e)&&QS(e,this)}_set(e,t=!0){let s=qS(e);if(!K_.und(s)){let e=yj(this);if(!e||!Y_(s,e.getValue())){let n=Pj(s);e&&e.constructor==n?e.setValue(s):xj(this,n.create(s)),e&&P_.batchedUpdates((()=>{this._onChange(s,t)}))}}return yj(this)}_onStart(){let e=this.animation;e.changed||(e.changed=!0,bC(this,"onStart",Qj(this,fC(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Mj(this.animation.onChange,e,this)),Mj(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){let e=this.animation;yj(this).reset(qS(e.to)),e.immediate||(e.fromValues=e.values.map((e=>e.lastPosition))),cC(this)||(dC(this,!0),uC(this)||this._resume())}_resume(){q_.skipAnimation?this.finish():hS.start(this)}_stop(e,t){if(cC(this)){dC(this,!1);let s=this.animation;X_(s.values,(e=>{e.done=!0})),s.toValues&&(s.onChange=s.onPause=s.onResume=void 0),KS(this,{type:"idle",parent:this});let n=t?$j(this.get()):Qj(this.get(),fC(this,e??s.to));sS(this._pendingCalls,n),s.changed&&(s.changed=!1,bC(this,"onRest",n,this))}}};function fC(e,t){let s=Gj(t);return Y_(Gj(e.get()),s)}function mC(e,t=e.loop,s=e.to){let n=Mj(t);if(n){let i=!0!==n&&zj(n),r=(i||e).reverse,o=!i||i.reset;return gC({...e,loop:t,default:!1,pause:void 0,to:!r||Hj(s)?s:void 0,from:o?e.from:void 0,reset:o,...i})}}function gC(e){let{to:t,from:s}=e=zj(e),n=new Set;return K_.obj(t)&&vC(t,n),K_.obj(s)&&vC(s,n),e.keys=n.size?Array.from(n):null,e}function vC(e,t){J_(e,((e,s)=>null!=e&&t.add(s)))}var yC=["onStart","onRest","onChange","onPause","onResume"];function xC(e,t,s){e.animation[s]=t[s]!==Vj(t,s)?Fj(t[s],e.key):void 0}function bC(e,t,...s){e.animation[t]?.(...s),e.defaultProps[t]?.(...s)}var wC=["onStart","onChange","onRest"],_C=1,SC=class{id=_C++;springs={};queue=[];ref;_flush;_initialProps;_lastAsyncId=0;_active=new Set;_changed=new Set;_started=!1;_item;_state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set};_events={onStart:new Map,onChange:new Map,onRest:new Map};constructor(e,t){this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start({default:!0,...e})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every((e=>e.idle&&!e.isDelayed&&!e.isPaused))}get item(){return this._item}set item(e){this._item=e}get(){let e={};return this.each(((t,s)=>e[s]=t.get())),e}set(e){for(let t in e){let s=e[t];K_.und(s)||this.springs[t].set(s)}}update(e){return e&&this.queue.push(gC(e)),this}start(e){let{queue:t}=this;return e?t=Q_(e).map(gC):this.queue=[],this._flush?this._flush(this,t):(PC(this,t),jC(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){let s=this.springs;X_(Q_(t),(t=>s[t].stop(!!e)))}else tC(this._state,this._lastAsyncId),this.each((t=>t.stop(!!e)));return this}pause(e){if(K_.und(e))this.start({pause:!0});else{let t=this.springs;X_(Q_(e),(e=>t[e].pause()))}return this}resume(e){if(K_.und(e))this.start({pause:!1});else{let t=this.springs;X_(Q_(e),(e=>t[e].resume()))}return this}each(e){J_(this.springs,e)}_onFrame(){let{onStart:e,onChange:t,onRest:s}=this._events,n=this._active.size>0,i=this._changed.size>0;(n&&!this._started||i&&!this._started)&&(this._started=!0,$_(e,(([e,t])=>{t.value=this.get(),e(t,this,this._item)})));let r=!n&&this._started,o=i||r&&s.size?this.get():null;i&&t.size&&$_(t,(([e,t])=>{t.value=o,e(t,this,this._item)})),r&&(this._started=!1,$_(s,(([e,t])=>{t.value=o,e(t,this,this._item)})))}eventObserved(e){if("change"==e.type)this._changed.add(e.parent),e.idle||this._active.add(e.parent);else{if("idle"!=e.type)return;this._active.delete(e.parent)}P_.onFrame(this._onFrame)}};function jC(e,t){return Promise.all(t.map((t=>CC(e,t)))).then((t=>Xj(e,t)))}async function CC(e,t,s){let{keys:n,to:i,from:r,loop:o,onRest:a,onResolve:l}=t,c=K_.obj(t.default)&&t.default;o&&(t.loop=!1),!1===i&&(t.to=null),!1===r&&(t.from=null);let u=K_.arr(i)||K_.fun(i)?i:void 0;u?(t.to=void 0,t.onRest=void 0,c&&(c.onRest=void 0)):X_(wC,(s=>{let n=t[s];if(K_.fun(n)){let i=e._events[s];t[s]=({finished:e,cancelled:t})=>{let s=i.get(n);s?(e||(s.finished=!1),t&&(s.cancelled=!0)):i.set(n,{value:null,finished:e||!1,cancelled:t||!1})},c&&(c[s]=t[s])}}));let d=e._state;t.pause===!d.paused?(d.paused=t.pause,sS(t.pause?d.pauseQueue:d.resumeQueue)):d.paused&&(t.pause=!0);let h=(n||Object.keys(e.springs)).map((s=>e.springs[s].start(t))),p=!0===t.cancel||!0===Vj(t,"cancel");(u||p&&d.asyncId)&&h.push(Yj(++e._lastAsyncId,{props:t,state:d,actions:{pause:Z_,resume:Z_,start(t,s){p?(tC(d,e._lastAsyncId),s($j(e))):(t.onRest=a,s(eC(u,t,d,e)))}}})),d.paused&&await new Promise((e=>{d.resumeQueue.add(e)}));let f=Xj(e,await Promise.all(h));if(o&&f.finished&&(!s||!f.noop)){let s=mC(t,o,i);if(s)return PC(e,[s]),CC(e,s,!0)}return l&&P_.batchedUpdates((()=>l(f,e,e.item))),f}function kC(e,t){let s=new pC;return s.key=e,t&&JS(s,t),s}function EC(e,t,s){t.keys&&X_(t.keys,(n=>{(e[n]||(e[n]=s(n)))._prepareNode(t)}))}function PC(e,t){X_(t,(t=>{EC(e.springs,t,(t=>kC(t,e)))}))}var IC=({children:e,...t})=>{let s=(0,xf.useContext)(TC),n=t.pause||!!s.pause,i=t.immediate||!!s.immediate;t=function(e,t){let[s]=(0,xf.useState)((()=>({inputs:t,result:e()}))),n=(0,xf.useRef)(),i=n.current,r=i;return r?Boolean(t&&r.inputs&&function(e,t){if(e.length!==t.length)return!1;for(let s=0;s{n.current=r,i==s&&(s.inputs=s.result=void 0)}),[r]),r.result}((()=>({pause:n,immediate:i})),[n,i]);let{Provider:r}=TC;return xf.createElement(r,{value:t},e)},TC=function(e,t){return Object.assign(e,xf.createContext(t)),e.Provider._context=e,e.Consumer._context=e,e}(IC,{});IC.Provider=TC.Provider,IC.Consumer=TC.Consumer;var OC=class extends oC{constructor(e,t){super(),this.source=e,this.calc=FS(...t);let s=this._get(),n=Pj(s);xj(this,n.create(s))}key;idle=!0;calc;_active=new Set;advance(e){let t=this._get();Y_(t,this.get())||(yj(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&MC(this._active)&&NC(this)}_get(){let e=K_.arr(this.source)?this.source.map(qS):Q_(qS(this.source));return this.calc(...e)}_start(){this.idle&&!MC(this._active)&&(this.idle=!1,X_(bj(this),(e=>{e.done=!1})),q_.skipAnimation?(P_.batchedUpdates((()=>this.advance())),NC(this)):hS.start(this))}_attach(){let e=1;X_(Q_(this.source),(t=>{WS(t)&&JS(t,this),iC(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))})),this.priority=e,this._start()}_detach(){X_(Q_(this.source),(e=>{WS(e)&&QS(e,this)})),this._active.clear(),NC(this)}eventObserved(e){"change"==e.type?e.idle?this.advance():(this._active.add(e.parent),this._start()):"idle"==e.type?this._active.delete(e.parent):"priority"==e.type&&(this.priority=Q_(this.source).reduce(((e,t)=>Math.max(e,(iC(t)?t.priority:0)+1)),0))}};function AC(e){return!1!==e.idle}function MC(e){return!e.size||Array.from(e).every(AC)}function NC(e){e.idle||(e.idle=!0,X_(bj(e),(e=>{e.done=!0})),KS(e,{type:"idle",parent:e}))}q_.assign({createStringInterpolator:cj,to:(e,t)=>new OC(e,t)});hS.advance;var FC=/^--/;function VC(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||FC.test(e)||BC.hasOwnProperty(e)&&BC[e]?(""+t).trim():t+"px"}var RC={};var BC={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},DC=["Webkit","Ms","Moz","O"];BC=Object.keys(BC).reduce(((e,t)=>(DC.forEach((s=>e[((e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1))(s,t)]=e[t])),e)),BC);var LC=/^(matrix|translate|scale|rotate|skew)/,zC=/^(translate)/,GC=/^(rotate|skew)/,HC=(e,t)=>K_.num(e)&&0!==e?e+t:e,UC=(e,t)=>K_.arr(e)?e.every((e=>UC(e,t))):K_.num(e)?e===t:parseFloat(e)===t,WC=class extends Cj{constructor({x:e,y:t,z:s,...n}){let i=[],r=[];(e||t||s)&&(i.push([e||0,t||0,s||0]),r.push((e=>[`translate3d(${e.map((e=>HC(e,"px"))).join(",")})`,UC(e,0)]))),J_(n,((e,t)=>{if("transform"===t)i.push([e||""]),r.push((e=>[e,""===e]));else if(LC.test(t)){if(delete n[t],K_.und(e))return;let s=zC.test(t)?"px":GC.test(t)?"deg":"";i.push(Q_(e)),r.push("rotate3d"===t?([e,t,n,i])=>[`rotate3d(${e},${t},${n},${HC(i,s)})`,UC(i,0)]:e=>[`${t}(${e.map((e=>HC(e,s))).join(",")})`,UC(e,t.startsWith("scale")?1:0)])}})),i.length&&(n.transform=new qC(i,r)),super(n)}},qC=class extends YS{constructor(e,t){super(),this.inputs=e,this.transforms=t}_value=null;get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return X_(this.inputs,((s,n)=>{let i=qS(s[0]),[r,o]=this.transforms[n](K_.arr(i)?i:s.map(qS));e+=" "+r,t=t&&o})),t?"none":e}observerAdded(e){1==e&&X_(this.inputs,(e=>X_(e,(e=>WS(e)&&JS(e,this)))))}observerRemoved(e){0==e&&X_(this.inputs,(e=>X_(e,(e=>WS(e)&&QS(e,this)))))}eventObserved(e){"change"==e.type&&(this._value=null),KS(this,e)}};q_.assign({batchedUpdates:pv.unstable_batchedUpdates,createStringInterpolator:cj,colors:{transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199}});var ZC=((e,{applyAnimatedValues:t=(()=>!1),createAnimatedStyle:s=(e=>new Cj(e)),getComponentProps:n=(e=>e)}={})=>{let i={applyAnimatedValues:t,createAnimatedStyle:s,getComponentProps:n},r=e=>{let t=Aj(e)||"Anonymous";return(e=K_.str(e)?r[e]||(r[e]=Ij(e,i)):e[Oj]||(e[Oj]=Ij(e,i))).displayName=`Animated(${t})`,e};return J_(e,((t,s)=>{K_.arr(e)&&(s=Aj(t)),r[s]=r(t)})),{animated:r}})(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],{applyAnimatedValues:function(e,t){if(!e.nodeType||!e.setAttribute)return!1;let s="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName,{style:n,children:i,scrollTop:r,scrollLeft:o,viewBox:a,...l}=t,c=Object.values(l),u=Object.keys(l).map((t=>s||e.hasAttribute(t)?t:RC[t]||(RC[t]=t.replace(/([A-Z])/g,(e=>"-"+e.toLowerCase())))));void 0!==i&&(e.textContent=i);for(let t in n)if(n.hasOwnProperty(t)){let s=VC(t,n[t]);FC.test(t)?e.style.setProperty(t,s):e.style[t]=s}u.forEach(((t,s)=>{e.setAttribute(t,c[s])})),void 0!==r&&(e.scrollTop=r),void 0!==o&&(e.scrollLeft=o),void 0!==a&&e.setAttribute("viewBox",a)},createAnimatedStyle:e=>new WC(e),getComponentProps:({scrollTop:e,scrollLeft:t,...s})=>s});ZC.animated;const KC=function({triggerAnimationOnChange:e}){const t=(0,d.useRef)(),{previous:s,prevRect:n}=(0,d.useMemo)((()=>{return{previous:t.current&&(e=t.current,{top:e.offsetTop,left:e.offsetLeft}),prevRect:t.current&&t.current.getBoundingClientRect()};var e}),[e]);return(0,d.useLayoutEffect)((()=>{if(!s||!t.current)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=new SC({x:0,y:0,width:n.width,height:n.height,config:{duration:400,easing:GS.easeInOutQuint},onChange({value:e}){if(!t.current)return;let{x:s,y:n,width:i,height:r}=e;s=Math.round(s),n=Math.round(n),i=Math.round(i),r=Math.round(r);const o=0===s&&0===n;t.current.style.transformOrigin="center center",t.current.style.transform=o?null:`translate3d(${s}px,${n}px,0)`,t.current.style.width=o?null:`${i}px`,t.current.style.height=o?null:`${r}px`}});t.current.style.transform=void 0;const i=t.current.getBoundingClientRect(),r=Math.round(n.left-i.left),o=Math.round(n.top-i.top),a=i.width,l=i.height;return e.start({x:0,y:0,width:a,height:l,from:{x:r,y:o,width:n.width,height:n.height}}),()=>{e.stop(),e.set({x:0,y:0,width:n.width,height:n.height})}}),[s,n]),t};function YC(){const{isDisabled:e,isSaving:t}=(0,l.useSelect)((e=>{const{__experimentalGetDirtyEntityRecords:t,isSavingEntityRecord:s}=e(_.store),n=t(),i=n.some((e=>s(e.kind,e.name,e.key)));return{isSaving:i,isDisabled:i||!n.length&&!Es()}}),[]);return(0,me.jsx)(x.__experimentalHStack,{className:"edit-site-save-hub",alignment:"right",spacing:4,children:(0,me.jsx)(xh,{className:"edit-site-save-hub__button",variant:e?null:"primary",showTooltip:!1,icon:e&&!t?Dv:null,showReviewMessage:!0,__next40pxDefaultSize:!0})})}const{useCommands:XC}=se(ts.privateApis),{useCommandContext:JC}=se(es.privateApis),{useGlobalStyle:QC}=se(y.privateApis),{NavigableRegion:$C}=se(h.privateApis),ek=.3;function tk(){ls(),function(){const e=ks(),{params:t}=Cs(),s=(0,l.useSelect)((e=>se(e(Kt)).getCanvasMode()),[]),{setCanvasMode:n}=se((0,l.useDispatch)(Kt)),i=(0,d.useRef)(s),{canvas:r}=t,o=(0,d.useRef)(r),a=(0,d.useRef)(t);(0,d.useEffect)((()=>{a.current=t}),[t]),(0,d.useEffect)((()=>{i.current=s,"init"!==s&&("edit"===s&&o.current!==s&&e.push({...a.current,canvas:"edit"}),"view"===s&&void 0!==o.current&&e.push({...a.current,canvas:void 0}))}),[s,e]),(0,d.useEffect)((()=>{o.current=r,"edit"!==r&&"view"!==i.current?n("view"):"edit"===r&&"edit"!==i.current&&n("edit")}),[r,n])}(),XC(),(0,es.useCommandLoader)({name:"core/edit-site/page-content-focus",hook:cn,context:"entity-edit"}),(0,es.useCommandLoader)({name:"core/edit-site/manipulate-document",hook:un}),function(){const e=(0,l.useSelect)((e=>{const{getUnstableBase:t}=e(_.store);return t()?.home}),[]);(0,es.useCommand)({name:"core/edit-site/view-site",label:(0,b.__)("View site"),callback:({close:t})=>{t(),window.open(e,"_blank")},icon:Ws}),(0,es.useCommandLoader)({name:"core/edit-site/open-styles",hook:Ys}),(0,es.useCommandLoader)({name:"core/edit-site/toggle-styles-welcome-guide",hook:Xs}),(0,es.useCommandLoader)({name:"core/edit-site/reset-global-styles",hook:Js}),(0,es.useCommandLoader)({name:"core/edit-site/open-styles-css",hook:Qs}),(0,es.useCommandLoader)({name:"core/edit-site/open-styles-revisions",hook:$s})}();const e=(0,v.useViewportMatch)("medium","<"),t=(0,d.useRef)(),{isDistractionFree:s,hasFixedToolbar:n,hasBlockSelected:i,canvasMode:r,previousShortcut:o,nextShortcut:a}=(0,l.useSelect)((e=>{const{getAllShortcutKeyCombinations:t}=e($t.store),{getCanvasMode:s}=se(e(Kt));return{canvasMode:s(),previousShortcut:t("core/editor/previous-region"),nextShortcut:t("core/editor/next-region"),hasFixedToolbar:e(f.store).get("core","fixedToolbar"),isDistractionFree:e(f.store).get("core","distractionFree"),hasBlockSelected:e(y.store).getBlockSelectionStart()}}),[]),c=(0,x.__unstableUseNavigateRegions)({previous:o,next:a}),u=(0,v.useReducedMotion)(),[p,m]=(0,v.useResizeObserver)(),[g]=(0,v.useResizeObserver)(),w=hn(),[S,j]=(0,d.useState)(!1),{key:C,areas:k,widths:E}=k_(),P=KC({triggerAnimationOnChange:r+"__"+C});let I="site-editor";"edit"===r&&(I="entity-edit"),i&&(I="block-selection-edit"),JC(I);const[T]=QC("color.background"),[O]=QC("color.gradient"),A=(0,v.usePrevious)(r);return(0,d.useEffect)((()=>{"edit"===A&&t.current?.focus()}),[r]),"init"===r?null:(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(es.CommandMenu,{}),(0,me.jsx)(Rs,{}),(0,me.jsx)(Bs,{}),g,(0,me.jsxs)("div",{...c,ref:c.ref,className:Qt("edit-site-layout",c.className,{"is-distraction-free":s&&"edit"===r,"is-full-canvas":"edit"===r,"has-fixed-toolbar":n,"is-block-toolbar-visible":i}),children:[(0,me.jsxs)("div",{className:"edit-site-layout__content",children:[(!e||!k.mobile)&&(0,me.jsx)($C,{ariaLabel:(0,b.__)("Navigation"),className:"edit-site-layout__sidebar-region",children:(0,me.jsx)(x.__unstableAnimatePresence,{children:"view"===r&&(0,me.jsxs)(x.__unstableMotion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{type:"tween",duration:u||e?0:ek,ease:"easeOut"},className:"edit-site-layout__sidebar",children:[(0,me.jsx)(vs,{ref:t,isTransparent:S}),(0,me.jsx)(rw,{routeKey:C,children:k.sidebar}),(0,me.jsx)(YC,{})]})})}),(0,me.jsx)(h.EditorSnackbars,{}),e&&k.mobile&&(0,me.jsx)("div",{className:"edit-site-layout__mobile",children:k.mobile}),!e&&k.content&&"edit"!==r&&(0,me.jsx)("div",{className:"edit-site-layout__area",style:{maxWidth:E?.content},children:k.content}),!e&&k.preview&&(0,me.jsxs)("div",{className:"edit-site-layout__canvas-container",children:[p,!!m.width&&(0,me.jsx)("div",{className:Qt("edit-site-layout__canvas",{"is-right-aligned":S}),ref:P,children:(0,me.jsx)(is,{children:(0,me.jsx)(js,{isReady:!w,isFullWidth:"edit"===r,defaultSize:{width:m.width-24,height:m.height},isOversized:S,setIsOversized:j,innerContentStyle:{background:null!=O?O:T},children:k.preview})})})]})]}),(0,me.jsx)(Vs,{})]})]})}const{RouterProvider:sk}=se(Xt.privateApis),{GlobalStylesProvider:nk}=se(h.privateApis);function ik(){const{createErrorNotice:e}=(0,l.useDispatch)(w.store);return(0,me.jsx)(x.SlotFillProvider,{children:(0,me.jsxs)(nk,{children:[(0,me.jsx)(h.UnsavedChangesWarning,{}),(0,me.jsxs)(sk,{children:[(0,me.jsx)(tk,{}),(0,me.jsx)(Yt.PluginArea,{onError:function(t){e((0,b.sprintf)((0,b.__)('The "%s" plugin has encountered an error and cannot be rendered.'),t))}})]})]})})}const rk=(0,ps.getPath)(window.location.href)?.includes("site-editor.php"),ok=e=>{u()(`wp.editPost.${e}`,{since:"6.6",alternative:`wp.editor.${e}`})};function ak(e){return rk?(ok("PluginMoreMenuItem"),(0,me.jsx)(h.PluginMoreMenuItem,{...e})):null}function lk(e){return rk?(ok("PluginSidebar"),(0,me.jsx)(h.PluginSidebar,{...e})):null}function ck(e){return rk?(ok("PluginSidebarMoreMenuItem"),(0,me.jsx)(h.PluginSidebarMoreMenuItem,{...e})):null}function uk(e,t){const s=document.getElementById(e),n=(0,d.createRoot)(s);(0,l.dispatch)(o.store).reapplyBlockTypeFilters();const i=(0,a.__experimentalGetCoreBlocks)().filter((({name:e})=>"core/freeform"!==e));return(0,a.registerCoreBlocks)(i),(0,l.dispatch)(o.store).setFreeformFallbackBlockName("core/html"),(0,m.registerLegacyWidgetBlock)({inserter:!1}),(0,m.registerWidgetGroupBlock)({inserter:!1}),(0,l.dispatch)(f.store).setDefaults("core/edit-site",{welcomeGuide:!0,welcomeGuideStyles:!0,welcomeGuidePage:!0,welcomeGuideTemplate:!0}),(0,l.dispatch)(f.store).setDefaults("core",{allowRightClickOverrides:!0,distractionFree:!1,editorMode:"visual",fixedToolbar:!1,focusMode:!1,inactivePanels:[],keepCaretInsideBlock:!1,openPanels:["post-status"],showBlockBreadcrumbs:!0,showListViewByDefault:!1}),(0,l.dispatch)(Kt).updateSettings(t),(0,l.dispatch)(h.store).updateEditorSettings({defaultTemplateTypes:t.defaultTemplateTypes,defaultTemplatePartAreas:t.defaultTemplatePartAreas}),window.addEventListener("dragover",(e=>e.preventDefault()),!1),window.addEventListener("drop",(e=>e.preventDefault()),!1),n.render((0,me.jsx)(ik,{})),n}function dk(){u()("wp.editSite.reinitializeEditor",{since:"6.2",version:"6.3"})}})(),(window.wp=window.wp||{}).editSite=r})();