!function(){var e,t,n={738:function(){window.bcfWpMenuClassChange=function(e){document.querySelector("body").classList.remove("bcf-add-new-font-page"),"add-fonts"===e&&document.querySelector("body").classList.add("bcf-add-new-font-page")}},679:function(e,t,n){"use strict";var r=n(296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||o}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,d=Object.getOwnPropertyDescriptor,m=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(p){var o=m(n);o&&o!==p&&e(t,o,r)}var i=u(n);f&&(i=i.concat(f(n)));for(var l=s(t),v=s(n),h=0;h=0;u--){var f=o[u];"."===f?m(o,u):".."===f?(m(o,u),c++):c&&(m(o,u),c--)}if(!l)for(;c--;c)o.unshift("..");!l||""===o[0]||o[0]&&d(o[0])||o.unshift("");var p=o.join("/");return n&&"/"!==p.substr(-1)&&(p+="/"),p},v=!0,h="Invariant failed";function g(e,t){if(!e){if(v)throw new Error(h);var n="function"==typeof t?t():t,r=n?"".concat(h,": ").concat(n):h;throw new Error(r)}}function _(e){return"/"===e.charAt(0)?e:"/"+e}function y(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function b(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function E(e){var t=e.pathname,n=e.search,r=e.hash,o=t||"/";return n&&"?"!==n&&(o+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(o+="#"===r.charAt(0)?r:"#"+r),o}function w(e,t,n,r){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",o=t.indexOf("#");-1!==o&&(r=t.substr(o),t=t.substr(0,o));var a=t.indexOf("?");return-1!==a&&(n=t.substr(a),t=t.substr(0,a)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=f({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(e){throw e instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):e}return n&&(o.key=n),r?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=p(o.pathname,r.pathname)):o.pathname=r.pathname:o.pathname||(o.pathname="/"),o}function x(){var e=null,t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,o){if(null!=e){var a="function"==typeof e?e(t,n):e;"string"==typeof a?"function"==typeof r?r(a,o):o(!0):o(!1!==a)}else o(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r=0||(o[n]=e[n]);return o}o(663),o(679);var P=1073741823,A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==o.g?o.g:{},R=r().createContext||function(e,t){var n,o,a,i="__create-react-context-"+((A[a="__global_unique_id__"]=(A[a]||0)+1)+"__"),l=function(e){function n(){for(var t,n,r,o=arguments.length,a=new Array(o),i=0;i`"${e}"`)).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,oe),r}var ae,ie=((ae=ie||{})[ae.None=0]="None",ae[ae.RenderStrategy=1]="RenderStrategy",ae[ae.Static=2]="Static",ae),le=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(le||{});function se({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:a=!0,name:i}){let l=ue(t,e);if(a)return ce(l,n,r,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=l;if(e)return ce(t,n,r,i)}if(1&s){let{unmount:e=!0,...t}=l;return oe(e?0:1,{0(){return null},1(){return ce({...t,hidden:!0,style:{display:"none"}},n,r,i)}})}return ce(l,n,r,i)}function ce(e,n={},r,o){var a;let{as:i=r,children:l,refName:s="ref",...c}=me(e,["unmount","static"]),u=void 0!==e.ref?{[s]:e.ref}:{},f="function"==typeof l?l(n):l;"className"in c&&c.className&&"function"==typeof c.className&&(c.className=c.className(n));let d={};if(n){let e=!1,t=[];for(let[r,o]of Object.entries(n))"boolean"==typeof o&&(e=!0),!0===o&&t.push(r);e&&(d["data-headlessui-state"]=t.join(" "))}if(i===t.Fragment&&Object.keys(de(c)).length>0){if(!(0,t.isValidElement)(f)||Array.isArray(f)&&f.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(c).map((e=>` - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>` - ${e}`)).join("\n")].join("\n"));let e=re(null==(a=f.props)?void 0:a.className,c.className),n=e?{className:e}:{};return(0,t.cloneElement)(f,Object.assign({},ue(f.props,de(me(c,["ref"]))),d,u,function(...e){return{ref:e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}}(f.ref,u.ref),n))}return(0,t.createElement)(i,Object.assign({},me(c,["ref"]),i!==t.Fragment&&u,i!==t.Fragment&&d),f)}function ue(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map((e=>[e,void 0]))));for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function fe(e){var n;return Object.assign((0,t.forwardRef)(e),{displayName:null!=(n=e.displayName)?n:e.name})}function de(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function me(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}let pe=(0,t.createContext)(null);pe.displayName="OpenClosedContext";var ve=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ve||{});function he(){return(0,t.useContext)(pe)}function ge({value:e,children:n}){return t.createElement(pe.Provider,{value:e},n)}var _e=Object.defineProperty,ye=(e,t,n)=>(((e,t,n)=>{t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let be=new class{constructor(){ye(this,"current",this.detect()),ye(this,"handoffState","pending"),ye(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}},Ee=(e,n)=>{be.isServer?(0,t.useEffect)(e,n):(0,t.useLayoutEffect)(e,n)};function we(){let e=(0,t.useRef)(!1);return Ee((()=>(e.current=!0,()=>{e.current=!1})),[]),e}function xe(e){let n=(0,t.useRef)(e);return Ee((()=>{n.current=e}),[e]),n}function Ne(){let[e,n]=(0,t.useState)(be.isHandoffComplete);return e&&!1===be.isHandoffComplete&&n(!1),(0,t.useEffect)((()=>{!0!==e&&n(!0)}),[e]),(0,t.useEffect)((()=>be.handoff()),[]),e}let Ce=function(e){let n=xe(e);return t.useCallback(((...e)=>n.current(...e)),[n])},Se=Symbol();function ke(e,t=!0){return Object.assign(e,{[Se]:t})}function Fe(...e){let n=(0,t.useRef)(e);(0,t.useEffect)((()=>{n.current=e}),[e]);let r=Ce((e=>{for(let t of n.current)null!=t&&("function"==typeof t?t(e):t.current=e)}));return e.every((e=>null==e||(null==e?void 0:e[Se])))?void 0:r}function Te(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}function Oe(){let e=[],t={addEventListener(e,n,r,o){return e.addEventListener(n,r,o),t.add((()=>e.removeEventListener(n,r,o)))},requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add((()=>cancelAnimationFrame(n)))},nextFrame(...e){return t.requestAnimationFrame((()=>t.requestAnimationFrame(...e)))},setTimeout(...e){let n=setTimeout(...e);return t.add((()=>clearTimeout(n)))},microTask(...e){let n={current:!0};return Te((()=>{n.current&&e[0]()})),t.add((()=>{n.current=!1}))},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add((()=>{Object.assign(e.style,{[t]:r})}))},group(e){let t=Oe();return e(t),this.add((()=>t.dispose()))},add(t){return e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}},dispose(){for(let t of e.splice(0))t()}};return t}function Le(e,...t){e&&t.length>0&&e.classList.add(...t)}function Pe(e,...t){e&&t.length>0&&e.classList.remove(...t)}function Ae(){let[e]=(0,t.useState)(Oe);return(0,t.useEffect)((()=>()=>e.dispose()),[e]),e}function Re({container:e,direction:t,classes:n,onStart:r,onStop:o}){let a=we(),i=Ae(),l=xe(t);Ee((()=>{let t=Oe();i.add(t.dispose);let s=e.current;if(s&&"idle"!==l.current&&a.current)return t.dispose(),r.current(l.current),t.add(function(e,t,n,r){let o=n?"enter":"leave",a=Oe(),i=void 0!==r?function(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}(r):()=>{};"enter"===o&&(e.removeAttribute("hidden"),e.style.display="");let l=oe(o,{enter:()=>t.enter,leave:()=>t.leave}),s=oe(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=oe(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return Pe(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),Le(e,...l,...c),a.nextFrame((()=>{Pe(e,...c),Le(e,...s),function(e,t){let n=Oe();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[a,i]=[r,o].map((e=>{let[t=0]=e.split(",").filter(Boolean).map((e=>e.includes("ms")?parseFloat(e):1e3*parseFloat(e))).sort(((e,t)=>t-e));return t})),l=a+i;if(0!==l){n.group((n=>{n.setTimeout((()=>{t(),n.dispose()}),l),n.addEventListener(e,"transitionrun",(e=>{e.target===e.currentTarget&&n.dispose()}))}));let r=n.addEventListener(e,"transitionend",(e=>{e.target===e.currentTarget&&(t(),r())}))}else t();n.add((()=>t())),n.dispose}(e,(()=>(Pe(e,...l),Le(e,...t.entered),i())))})),a.dispose}(s,n.current,"enter"===l.current,(()=>{t.dispose(),o.current(l.current)}))),t.dispose}),[t])}function Me(e=""){return e.split(" ").filter((e=>e.trim().length>1))}let $e=(0,t.createContext)(null);$e.displayName="TransitionContext";var je=(e=>(e.Visible="visible",e.Hidden="hidden",e))(je||{});let De=(0,t.createContext)(null);function Ie(e){return"children"in e?Ie(e.children):e.current.filter((({el:e})=>null!==e.current)).filter((({state:e})=>"visible"===e)).length>0}function He(e,n){let r=xe(e),o=(0,t.useRef)([]),a=we(),i=Ae(),l=Ce(((e,t=le.Hidden)=>{let n=o.current.findIndex((({el:t})=>t===e));-1!==n&&(oe(t,{[le.Unmount](){o.current.splice(n,1)},[le.Hidden](){o.current[n].state="hidden"}}),i.microTask((()=>{var e;!Ie(o)&&a.current&&(null==(e=r.current)||e.call(r))})))})),s=Ce((e=>{let t=o.current.find((({el:t})=>t===e));return t?"visible"!==t.state&&(t.state="visible"):o.current.push({el:e,state:"visible"}),()=>l(e,le.Unmount)})),c=(0,t.useRef)([]),u=(0,t.useRef)(Promise.resolve()),f=(0,t.useRef)({enter:[],leave:[],idle:[]}),d=Ce(((e,t,r)=>{c.current.splice(0),n&&(n.chains.current[t]=n.chains.current[t].filter((([t])=>t!==e))),null==n||n.chains.current[t].push([e,new Promise((e=>{c.current.push(e)}))]),null==n||n.chains.current[t].push([e,new Promise((e=>{Promise.all(f.current[t].map((([e,t])=>t))).then((()=>e()))}))]),"enter"===t?u.current=u.current.then((()=>null==n?void 0:n.wait.current)).then((()=>r(t))):r(t)})),m=Ce(((e,t,n)=>{Promise.all(f.current[t].splice(0).map((([e,t])=>t))).then((()=>{var e;null==(e=c.current.shift())||e()})).then((()=>n(t)))}));return(0,t.useMemo)((()=>({children:o,register:s,unregister:l,onStart:d,onStop:m,wait:u,chains:f})),[s,l,o,d,m,f,u])}function Be(){}De.displayName="NestingContext";let Ve=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Ue(e){var t;let n={};for(let r of Ve)n[r]=null!=(t=e[r])?t:Be;return n}let We=ie.RenderStrategy,Ze=fe((function(e,n){let{show:r,appear:o=!1,unmount:a,...i}=e,l=(0,t.useRef)(null),s=Fe(l,n);Ne();let c=he();if(void 0===r&&null!==c&&(r=(c&ve.Open)===ve.Open),![!0,!1].includes(r))throw new Error("A is used but it is missing a `show={true | false}` prop.");let[u,f]=(0,t.useState)(r?"visible":"hidden"),d=He((()=>{f("hidden")})),[m,p]=(0,t.useState)(!0),v=(0,t.useRef)([r]);Ee((()=>{!1!==m&&v.current[v.current.length-1]!==r&&(v.current.push(r),p(!1))}),[v,r]);let h=(0,t.useMemo)((()=>({show:r,appear:o,initial:m})),[r,o,m]);(0,t.useEffect)((()=>{if(r)f("visible");else if(Ie(d)){let e=l.current;if(!e)return;let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&f("hidden")}else f("hidden")}),[r,d]);let g={unmount:a};return t.createElement(De.Provider,{value:d},t.createElement($e.Provider,{value:h},se({ourProps:{...g,as:t.Fragment,children:t.createElement(ze,{ref:s,...g,...i})},theirProps:{},defaultTag:t.Fragment,features:We,visible:"visible"===u,name:"Transition"})))})),ze=fe((function(e,n){let{beforeEnter:r,afterEnter:o,beforeLeave:a,afterLeave:i,enter:l,enterFrom:s,enterTo:c,entered:u,leave:f,leaveFrom:d,leaveTo:m,...p}=e,v=(0,t.useRef)(null),h=Fe(v,n),g=p.unmount?le.Unmount:le.Hidden,{show:_,appear:y,initial:b}=function(){let e=(0,t.useContext)($e);if(null===e)throw new Error("A is used but it is missing a parent or .");return e}(),[E,w]=(0,t.useState)(_?"visible":"hidden"),x=function(){let e=(0,t.useContext)(De);if(null===e)throw new Error("A is used but it is missing a parent or .");return e}(),{register:N,unregister:C}=x,S=(0,t.useRef)(null);(0,t.useEffect)((()=>N(v)),[N,v]),(0,t.useEffect)((()=>{if(g===le.Hidden&&v.current)return _&&"visible"!==E?void w("visible"):oe(E,{hidden:()=>C(v),visible:()=>N(v)})}),[E,v,N,C,_,g]);let k=xe({enter:Me(l),enterFrom:Me(s),enterTo:Me(c),entered:Me(u),leave:Me(f),leaveFrom:Me(d),leaveTo:Me(m)}),F=function(e){let n=(0,t.useRef)(Ue(e));return(0,t.useEffect)((()=>{n.current=Ue(e)}),[e]),n}({beforeEnter:r,afterEnter:o,beforeLeave:a,afterLeave:i}),T=Ne();(0,t.useEffect)((()=>{if(T&&"visible"===E&&null===v.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[v,E,T]);let O=b&&!y,L=!T||O||S.current===_?"idle":_?"enter":"leave",P=function(e=0){let[n,r]=(0,t.useState)(e),o=(0,t.useCallback)((e=>r((t=>t|e))),[n]),a=(0,t.useCallback)((e=>Boolean(n&e)),[n]),i=(0,t.useCallback)((e=>r((t=>t&~e))),[r]),l=(0,t.useCallback)((e=>r((t=>t^e))),[r]);return{flags:n,addFlag:o,hasFlag:a,removeFlag:i,toggleFlag:l}}(0),A=Ce((e=>oe(e,{enter:()=>{P.addFlag(ve.Opening),F.current.beforeEnter()},leave:()=>{P.addFlag(ve.Closing),F.current.beforeLeave()},idle:()=>{}}))),R=Ce((e=>oe(e,{enter:()=>{P.removeFlag(ve.Opening),F.current.afterEnter()},leave:()=>{P.removeFlag(ve.Closing),F.current.afterLeave()},idle:()=>{}}))),M=He((()=>{w("hidden"),C(v)}),x);Re({container:v,classes:k,direction:L,onStart:xe((e=>{M.onStart(v,e,A)})),onStop:xe((e=>{M.onStop(v,e,R),"leave"===e&&!Ie(M)&&(w("hidden"),C(v))}))}),(0,t.useEffect)((()=>{O&&(g===le.Hidden?S.current=null:S.current=_)}),[_,O,E]);let $=p,j={ref:h};return y&&_&&be.isServer&&($={...$,className:re(p.className,...k.current.enter,...k.current.enterFrom)}),t.createElement(De.Provider,{value:M},t.createElement(ge,{value:oe(E,{visible:ve.Open,hidden:ve.Closed})|P.flags},se({ourProps:j,theirProps:$,defaultTag:"div",features:We,visible:"visible"===E,name:"Transition.Child"})))})),qe=fe((function(e,n){let r=null!==(0,t.useContext)($e),o=null!==he();return t.createElement(t.Fragment,null,!r&&o?t.createElement(Ze,{ref:n,...e}):t.createElement(ze,{ref:n,...e}))})),Ge=Object.assign(Ze,{Child:qe,Root:Ze});var Ye,Je=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Je||{});let Ke=null!=(Ye=t.useId)?Ye:function(){let e=Ne(),[n,r]=t.useState(e?()=>be.nextId():null);return Ee((()=>{null===n&&r(be.nextId())}),[n]),null!=n?""+n:void 0};var Xe=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Xe||{});let Qe=fe((function(e,t){let{features:n=1,...r}=e;return se({ourProps:{ref:t,"aria-hidden":2==(2&n)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&n)&&2!=(2&n)&&{display:"none"}}},theirProps:r,slot:{},defaultTag:"div",name:"Hidden"})}));function et(e){return be.isServer?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let tt=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var nt,rt=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(rt||{}),ot=((nt=ot||{})[nt.Error=0]="Error",nt[nt.Overflow=1]="Overflow",nt[nt.Success=2]="Success",nt[nt.Underflow=3]="Underflow",nt),at=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(at||{});var it=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(it||{});function lt(e){null==e||e.focus({preventScroll:!0})}let st=["textarea","input"].join(",");function ct(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?function(e,t=(e=>e)){return e.slice().sort(((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let a=r.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(tt)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}(e);o.length>0&&i.length>1&&(i=i.filter((e=>!o.includes(e)))),r=null!=r?r:a.activeElement;let l,s=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,i.indexOf(r))-1;if(4&t)return Math.max(0,i.indexOf(r))+1;if(8&t)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=32&t?{preventScroll:!0}:{},f=0,d=i.length;do{if(f>=d||f+d<=0)return 0;let e=c+f;if(16&t)e=(e+d)%d;else{if(e<0)return 3;if(e>=d)return 1}l=i[e],null==l||l.focus(u),f+=s}while(l!==a.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,st))&&n}(l)&&l.select(),l.hasAttribute("tabindex")||l.setAttribute("tabindex","0"),2}var ut=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ut||{});function ft(...e){return(0,t.useMemo)((()=>et(...e)),[...e])}function dt(e,n,r,o){let a=xe(r);(0,t.useEffect)((()=>{function t(e){a.current(e)}return(e=null!=e?e:window).addEventListener(n,t,o),()=>e.removeEventListener(n,t,o)}),[e,n,o])}function mt(e,n){let r=(0,t.useRef)([]),o=Ce(e);(0,t.useEffect)((()=>{let e=[...r.current];for(let[t,a]of n.entries())if(r.current[t]!==a){let t=o(n,e);return r.current=n,t}}),[o,...n])}function pt(e){if(!e)return new Set;if("function"==typeof e)return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}var vt=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(vt||{});let ht=fe((function(e,n){let r=(0,t.useRef)(null),o=Fe(r,n),{initialFocus:a,containers:i,features:l=30,...s}=e;Ne()||(l=1);let c=ft(r);!function({ownerDocument:e},n){let r=function(e=!0){let n=(0,t.useRef)(_t.slice());return mt((([e],[t])=>{!0===t&&!1===e&&Te((()=>{n.current.splice(0)})),!1===t&&!0===e&&(n.current=_t.slice())}),[e,_t,n]),Ce((()=>{var e;return null!=(e=n.current.find((e=>null!=e&&e.isConnected)))?e:null}))}(n);mt((()=>{n||(null==e?void 0:e.activeElement)===(null==e?void 0:e.body)&<(r())}),[n]);let o=(0,t.useRef)(!1);(0,t.useEffect)((()=>(o.current=!1,()=>{o.current=!0,Te((()=>{o.current&<(r())}))})),[])}({ownerDocument:c},Boolean(16&l));let u=function({ownerDocument:e,container:n,initialFocus:r},o){let a=(0,t.useRef)(null),i=we();return mt((()=>{if(!o)return;let t=n.current;t&&Te((()=>{if(!i.current)return;let n=null==e?void 0:e.activeElement;if(null!=r&&r.current){if((null==r?void 0:r.current)===n)return void(a.current=n)}else if(t.contains(n))return void(a.current=n);null!=r&&r.current?lt(r.current):ct(t,rt.First)===ot.Error&&console.warn("There are no focusable elements inside the "),a.current=null==e?void 0:e.activeElement}))}),[o]),a}({ownerDocument:c,container:r,initialFocus:a},Boolean(2&l));!function({ownerDocument:e,container:t,containers:n,previousActiveElement:r},o){let a=we();dt(null==e?void 0:e.defaultView,"focus",(e=>{if(!o||!a.current)return;let i=pt(n);t.current instanceof HTMLElement&&i.add(t.current);let l=r.current;if(!l)return;let s=e.target;s&&s instanceof HTMLElement?yt(i,s)?(r.current=s,lt(s)):(e.preventDefault(),e.stopPropagation(),lt(l)):lt(r.current)}),!0)}({ownerDocument:c,container:r,containers:i,previousActiveElement:u},Boolean(8&l));let f=function(){let e=(0,t.useRef)(0);return function(e,n,r){let o=xe(n);(0,t.useEffect)((()=>{function t(e){o.current(e)}return window.addEventListener(e,t,r),()=>window.removeEventListener(e,t,r)}),[e,r])}("keydown",(t=>{"Tab"===t.key&&(e.current=t.shiftKey?1:0)}),!0),e}(),d=Ce((e=>{let t=r.current;t&&oe(f.current,{[ut.Forwards]:()=>{ct(t,rt.First,{skipElements:[e.relatedTarget]})},[ut.Backwards]:()=>{ct(t,rt.Last,{skipElements:[e.relatedTarget]})}})})),m=Ae(),p=(0,t.useRef)(!1),v={ref:o,onKeyDown(e){"Tab"==e.key&&(p.current=!0,m.requestAnimationFrame((()=>{p.current=!1})))},onBlur(e){let t=pt(i);r.current instanceof HTMLElement&&t.add(r.current);let n=e.relatedTarget;n instanceof HTMLElement&&"true"!==n.dataset.headlessuiFocusGuard&&(yt(t,n)||(p.current?ct(r.current,oe(f.current,{[ut.Forwards]:()=>rt.Next,[ut.Backwards]:()=>rt.Previous})|rt.WrapAround,{relativeTo:e.target}):e.target instanceof HTMLElement&<(e.target)))}};return t.createElement(t.Fragment,null,Boolean(4&l)&&t.createElement(Qe,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:Xe.Focusable}),se({ourProps:v,theirProps:s,defaultTag:"div",name:"FocusTrap"}),Boolean(4&l)&&t.createElement(Qe,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:Xe.Focusable}))})),gt=Object.assign(ht,{features:vt}),_t=[];if("undefined"!=typeof window&&"undefined"!=typeof document){let e=function(e){e.target instanceof HTMLElement&&e.target!==document.body&&_t[0]!==e.target&&(_t.unshift(e.target),_t=_t.filter((e=>null!=e&&e.isConnected)),_t.splice(10))};window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})}function yt(e,t){for(let n of e)if(n.contains(t))return!0;return!1}let bt=(0,t.createContext)(!1);function Et(){return(0,t.useContext)(bt)}function wt(e){return t.createElement(bt.Provider,{value:e.force},e.children)}let xt=t.Fragment,Nt=t.Fragment,Ct=(0,t.createContext)(null),St=fe((function(e,n){let r=e,o=(0,t.useRef)(null),i=Fe(ke((e=>{o.current=e})),n),l=ft(o),s=function(e){let n=Et(),r=(0,t.useContext)(Ct),o=ft(e),[a,i]=(0,t.useState)((()=>{if(!n&&null!==r||be.isServer)return null;let e=null==o?void 0:o.getElementById("headlessui-portal-root");if(e)return e;if(null===o)return null;let t=o.createElement("div");return t.setAttribute("id","headlessui-portal-root"),o.body.appendChild(t)}));return(0,t.useEffect)((()=>{null!==a&&(null!=o&&o.body.contains(a)||null==o||o.body.appendChild(a))}),[a,o]),(0,t.useEffect)((()=>{n||null!==r&&i(r.current)}),[r,i,n]),a}(o),[c]=(0,t.useState)((()=>{var e;return be.isServer?null:null!=(e=null==l?void 0:l.createElement("div"))?e:null})),u=Ne(),f=(0,t.useRef)(!1);return Ee((()=>{if(f.current=!1,s&&c)return s.contains(c)||(c.setAttribute("data-headlessui-portal",""),s.appendChild(c)),()=>{f.current=!0,Te((()=>{var e;f.current&&(!s||!c||(c instanceof Node&&s.contains(c)&&s.removeChild(c),s.childNodes.length<=0&&(null==(e=s.parentElement)||e.removeChild(s))))}))}}),[s,c]),u&&s&&c?(0,a.createPortal)(se({ourProps:{ref:i},theirProps:r,defaultTag:xt,name:"Portal"}),c):null})),kt=fe((function(e,n){let{target:r,...o}=e,a={ref:Fe(n)};return t.createElement(Ct.Provider,{value:r},se({ourProps:a,theirProps:o,defaultTag:Nt,name:"Popover.Group"}))})),Ft=Object.assign(St,{Group:kt}),Tt=(0,t.createContext)(null);function Ot(){let e=(0,t.useContext)(Tt);if(null===e){let e=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Ot),e}return e}let Lt=fe((function(e,t){let n=Ke(),{id:r=`headlessui-description-${n}`,...o}=e,a=Ot(),i=Fe(t);return Ee((()=>a.register(r)),[r,a.register]),se({ourProps:{ref:i,...a.props,id:r},theirProps:o,slot:a.slot||{},defaultTag:"p",name:a.name||"Description"})})),Pt=Object.assign(Lt,{}),At=(0,t.createContext)((()=>{}));At.displayName="StackContext";var Rt=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(Rt||{});function Mt({children:e,onUpdate:n,type:r,element:o,enabled:a}){let i=(0,t.useContext)(At),l=Ce(((...e)=>{null==n||n(...e),i(...e)}));return Ee((()=>{let e=void 0===a||!0===a;return e&&l(0,r,o),()=>{e&&l(1,r,o)}}),[l,r,o,a]),t.createElement(At.Provider,{value:l},e)}function $t(e,n,r){let o=xe(n);(0,t.useEffect)((()=>{function t(e){o.current(e)}return document.addEventListener(e,t,r),()=>document.removeEventListener(e,t,r)}),[e,r])}const jt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:Dt,useEffect:It,useLayoutEffect:Ht,useDebugValue:Bt}=n;function Vt(e){const t=e.getSnapshot,n=e.value;try{const e=t();return!jt(n,e)}catch{return!0}}const Ut="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t,n){return t()}:function(e,t,n){const r=t(),[{inst:o},a]=Dt({inst:{value:r,getSnapshot:t}});return Ht((()=>{o.value=r,o.getSnapshot=t,Vt(o)&&a({inst:o})}),[e,r,t]),It((()=>(Vt(o)&&a({inst:o}),e((()=>{Vt(o)&&a({inst:o})})))),[e]),Bt(r),r},Wt="useSyncExternalStore"in n?(e=>e.useSyncExternalStore)(n):Ut;function Zt(){let e;return{before({doc:t}){var n;let r=t.documentElement;e=(null!=(n=t.defaultView)?n:window).innerWidth-r.clientWidth},after({doc:t,d:n}){let r=t.documentElement,o=r.clientWidth-r.offsetWidth,a=e-o;n.style(r,"paddingRight",`${a}px`)}}}function zt(){if(!(/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0))return{};let e;return{before(){e=window.pageYOffset},after({doc:t,d:n,meta:r}){function o(e){return r.containers.flatMap((e=>e())).some((t=>t.contains(e)))}n.style(t.body,"marginTop",`-${e}px`),window.scrollTo(0,0);let a=null;n.addEventListener(t,"click",(e=>{if(e.target instanceof HTMLElement)try{let n=e.target.closest("a");if(!n)return;let{hash:r}=new URL(n.href),i=t.querySelector(r);i&&!o(i)&&(a=i)}catch{}}),!0),n.addEventListener(t,"touchmove",(e=>{e.target instanceof HTMLElement&&!o(e.target)&&e.preventDefault()}),{passive:!1}),n.add((()=>{window.scrollTo(0,window.pageYOffset+e),a&&a.isConnected&&(a.scrollIntoView({block:"nearest"}),a=null)}))}}}function qt(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Gt=function(e,t){let n=new Map,r=new Set;return{getSnapshot(){return n},subscribe(e){return r.add(e),()=>r.delete(e)},dispatch(e,...o){let a=t[e].call(n,...o);a&&(n=a,r.forEach((e=>e())))}}}(0,{PUSH(e,t){var n;let r=null!=(n=this.get(e))?n:{doc:e,count:0,d:Oe(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:qt(n)},o=[zt(),Zt(),{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}];o.forEach((({before:e})=>null==e?void 0:e(r))),o.forEach((({after:e})=>null==e?void 0:e(r)))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Gt.subscribe((()=>{let e=Gt.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e="hidden"===t.get(n.doc),r=0!==n.count;(r&&!e||!r&&e)&&Gt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),0===n.count&&Gt.dispatch("TEARDOWN",n)}}));let Yt=new Map,Jt=new Map;function Kt(e,t=!0){Ee((()=>{var n;if(!t)return;let r="function"==typeof e?e():e.current;if(!r)return;let o=null!=(n=Jt.get(r))?n:0;return Jt.set(r,o+1),0!==o||(Yt.set(r,{"aria-hidden":r.getAttribute("aria-hidden"),inert:r.inert}),r.setAttribute("aria-hidden","true"),r.inert=!0),function(){var e;if(!r)return;let t=null!=(e=Jt.get(r))?e:1;if(1===t?Jt.delete(r):Jt.set(r,t-1),1!==t)return;let n=Yt.get(r);n&&(null===n["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",n["aria-hidden"]),r.inert=n.inert,Yt.delete(r))}}),[e,t])}var Xt=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Xt||{}),Qt=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Qt||{});let en={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},tn=(0,t.createContext)(null);function nn(e){let n=(0,t.useContext)(tn);if(null===n){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,nn),t}return n}function rn(e,t){return oe(t.type,en,e,t)}tn.displayName="DialogContext";let on=ie.RenderStrategy|ie.Static,an=fe((function(e,n){let r=Ke(),{id:o=`headlessui-dialog-${r}`,open:a,onClose:i,initialFocus:l,__demoMode:s=!1,...c}=e,[u,f]=(0,t.useState)(0),d=he();void 0===a&&null!==d&&(a=(d&ve.Open)===ve.Open);let m=(0,t.useRef)(null),p=Fe(m,n),v=(0,t.useRef)(null),h=ft(m),g=e.hasOwnProperty("open")||null!==d,_=e.hasOwnProperty("onClose");if(!g&&!_)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!g)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!_)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof a)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a}`);if("function"!=typeof i)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${i}`);let y=a?0:1,[b,E]=(0,t.useReducer)(rn,{titleId:null,descriptionId:null,panelRef:(0,t.createRef)()}),w=Ce((()=>i(!1))),x=Ce((e=>E({type:0,id:e}))),N=!!Ne()&&!s&&0===y,C=u>1,S=null!==(0,t.useContext)(tn),k=C?"parent":"leaf",F=null!==d&&(d&ve.Closing)===ve.Closing,T=!S&&!F&&N,O=(0,t.useCallback)((()=>{var e,t;return null!=(t=Array.from(null!=(e=null==h?void 0:h.querySelectorAll("body > *"))?e:[]).find((e=>"headlessui-portal-root"!==e.id&&e.contains(v.current)&&e instanceof HTMLElement)))?t:null}),[v]);Kt(O,T);let L=!!C||N,P=(0,t.useCallback)((()=>{var e,t;return null!=(t=Array.from(null!=(e=null==h?void 0:h.querySelectorAll("[data-headlessui-portal]"))?e:[]).find((e=>e.contains(v.current)&&e instanceof HTMLElement)))?t:null}),[v]);Kt(P,L);let A=Ce((()=>{var e,t;return[...Array.from(null!=(e=null==h?void 0:h.querySelectorAll("html > *, body > *, [data-headlessui-portal]"))?e:[]).filter((e=>!(e===document.body||e===document.head||!(e instanceof HTMLElement)||e.contains(v.current)||b.panelRef.current&&e.contains(b.panelRef.current)))),null!=(t=b.panelRef.current)?t:m.current]}));!function(e,n,r=!0){let o=(0,t.useRef)(!1);function a(t,r){if(!o.current||t.defaultPrevented)return;let a=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),i=r(t);if(null!==i&&i.getRootNode().contains(i)){for(let e of a){if(null===e)continue;let n=e instanceof HTMLElement?e:e.current;if(null!=n&&n.contains(i)||t.composed&&t.composedPath().includes(n))return}return!function(e,t=0){var n;return e!==(null==(n=et(e))?void 0:n.body)&&oe(t,{0(){return e.matches(tt)},1(){let t=e;for(;null!==t;){if(t.matches(tt))return!0;t=t.parentElement}return!1}})}(i,it.Loose)&&-1!==i.tabIndex&&t.preventDefault(),n(t,i)}}(0,t.useEffect)((()=>{requestAnimationFrame((()=>{o.current=r}))}),[r]);let i=(0,t.useRef)(null);$t("mousedown",(e=>{var t,n;o.current&&(i.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)}),!0),$t("click",(e=>{i.current&&(a(e,(()=>i.current)),i.current=null)}),!0),$t("blur",(e=>a(e,(()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null))),!0)}((()=>A()),w,!(!N||C));let R=!(C||0!==y);dt(null==h?void 0:h.defaultView,"keydown",(e=>{R&&(e.defaultPrevented||e.key===Je.Escape&&(e.preventDefault(),e.stopPropagation(),w()))})),function(e,t,n=(()=>[document.body])){!function(e,t,n){let r=Wt((i=Gt).subscribe,i.getSnapshot,i.getSnapshot),o=e?r.get(e):void 0,a=!!o&&o.count>0;var i;Ee((()=>{if(e&&t)return Gt.dispatch("PUSH",e,n),()=>Gt.dispatch("POP",e,n)}),[t,e])}(e,t,(e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],n]}}))}(h,!(F||0!==y||S),A),(0,t.useEffect)((()=>{if(0!==y||!m.current)return;let e=new ResizeObserver((e=>{for(let t of e){let e=t.target.getBoundingClientRect();0===e.x&&0===e.y&&0===e.width&&0===e.height&&w()}}));return e.observe(m.current),()=>e.disconnect()}),[y,m,w]);let[M,$]=function(){let[e,n]=(0,t.useState)([]);return[e.length>0?e.join(" "):void 0,(0,t.useMemo)((()=>function(e){let r=Ce((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),o=(0,t.useMemo)((()=>({register:r,slot:e.slot,name:e.name,props:e.props})),[r,e.slot,e.name,e.props]);return t.createElement(Tt.Provider,{value:o},e.children)}),[n])]}(),j=(0,t.useMemo)((()=>[{dialogState:y,close:w,setTitleId:x},b]),[y,b,w,x]),D=(0,t.useMemo)((()=>({open:0===y})),[y]),I={ref:p,id:o,role:"dialog","aria-modal":0===y||void 0,"aria-labelledby":b.titleId,"aria-describedby":M};return t.createElement(Mt,{type:"Dialog",enabled:0===y,element:m,onUpdate:Ce(((e,t)=>{"Dialog"===t&&oe(e,{[Rt.Add]:()=>f((e=>e+1)),[Rt.Remove]:()=>f((e=>e-1))})}))},t.createElement(wt,{force:!0},t.createElement(Ft,null,t.createElement(tn.Provider,{value:j},t.createElement(Ft.Group,{target:m},t.createElement(wt,{force:!1},t.createElement($,{slot:D,name:"Dialog.Description"},t.createElement(gt,{initialFocus:l,containers:A,features:N?oe(k,{parent:gt.features.RestoreFocus,leaf:gt.features.All&~gt.features.FocusLock}):gt.features.None},se({ourProps:I,theirProps:c,slot:D,defaultTag:"div",features:on,visible:0===y,name:"Dialog"})))))))),t.createElement(Qe,{features:Xe.Hidden,ref:v}))})),ln=fe((function(e,n){let r=Ke(),{id:o=`headlessui-dialog-backdrop-${r}`,...a}=e,[{dialogState:i},l]=nn("Dialog.Backdrop"),s=Fe(n);(0,t.useEffect)((()=>{if(null===l.panelRef.current)throw new Error("A component is being used, but a component is missing.")}),[l.panelRef]);let c=(0,t.useMemo)((()=>({open:0===i})),[i]);return t.createElement(wt,{force:!0},t.createElement(Ft,null,se({ourProps:{ref:s,id:o,"aria-hidden":!0},theirProps:a,slot:c,defaultTag:"div",name:"Dialog.Backdrop"})))})),sn=fe((function(e,n){let r=Ke(),{id:o=`headlessui-dialog-panel-${r}`,...a}=e,[{dialogState:i},l]=nn("Dialog.Panel"),s=Fe(n,l.panelRef),c=(0,t.useMemo)((()=>({open:0===i})),[i]),u=Ce((e=>{e.stopPropagation()}));return se({ourProps:{ref:s,id:o,onClick:u},theirProps:a,slot:c,defaultTag:"div",name:"Dialog.Panel"})})),cn=fe((function(e,n){let r=Ke(),{id:o=`headlessui-dialog-overlay-${r}`,...a}=e,[{dialogState:i,close:l}]=nn("Dialog.Overlay"),s=Fe(n),c=Ce((e=>{if(e.target===e.currentTarget){if(function(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),l()}}));return se({ourProps:{ref:s,id:o,"aria-hidden":!0,onClick:c},theirProps:a,slot:(0,t.useMemo)((()=>({open:0===i})),[i]),defaultTag:"div",name:"Dialog.Overlay"})})),un=fe((function(e,n){let r=Ke(),{id:o=`headlessui-dialog-title-${r}`,...a}=e,[{dialogState:i,setTitleId:l}]=nn("Dialog.Title"),s=Fe(n);(0,t.useEffect)((()=>(l(o),()=>l(null))),[o,l]);let c=(0,t.useMemo)((()=>({open:0===i})),[i]);return se({ourProps:{ref:s,id:o},theirProps:a,slot:c,defaultTag:"h2",name:"Dialog.Title"})})),fn=Object.assign(an,{Backdrop:ln,Panel:sn,Overlay:cn,Title:un,Description:Pt});var dn=r().createContext(null),mn=function(e){e()},pn=function(){return mn},vn={notify:function(){},get:function(){return[]}};function hn(e,t){var n,r=vn;function o(){i.onStateChange&&i.onStateChange()}function a(){n||(n=t?t.addNestedSub(o):e.subscribe(o),r=function(){var e=pn(),t=null,n=null;return{clear:function(){t=null,n=null},notify:function(){e((function(){for(var e=t;e;)e.callback(),e=e.next}))},get:function(){for(var e=[],n=t;n;)e.push(n),n=n.next;return e},subscribe:function(e){var r=!0,o=n={callback:e,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){r&&null!==t&&(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}())}var i={addNestedSub:function(e){return a(),r.subscribe(e)},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:o,isSubscribed:function(){return Boolean(n)},trySubscribe:a,tryUnsubscribe:function(){n&&(n(),n=void 0,r.clear(),r=vn)},getListeners:function(){return r}};return i}var gn="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function yn(){return(0,t.useContext)(dn)}function bn(e){void 0===e&&(e=dn);var n=e===dn?yn:function(){return(0,t.useContext)(e)};return function(){return n().store}}o(864);var En=bn();function wn(e){void 0===e&&(e=dn);var t=e===dn?En:bn(e);return function(){return t().dispatch}}var xn=wn(),Nn=function(e,t){return e===t};function Cn(e){void 0===e&&(e=dn);var n=e===dn?yn:function(){return(0,t.useContext)(e)};return function(e,r){void 0===r&&(r=Nn);var o=n(),a=function(e,n,r,o){var a,i=(0,t.useReducer)((function(e){return e+1}),0)[1],l=(0,t.useMemo)((function(){return hn(r,o)}),[r,o]),s=(0,t.useRef)(),c=(0,t.useRef)(),u=(0,t.useRef)(),f=(0,t.useRef)(),d=r.getState();try{if(e!==c.current||d!==u.current||s.current){var m=e(d);a=void 0!==f.current&&n(m,f.current)?f.current:m}else a=f.current}catch(e){throw s.current&&(e.message+="\nThe error may be correlated with this previous error:\n"+s.current.stack+"\n\n"),e}return gn((function(){c.current=e,u.current=d,f.current=a,s.current=void 0})),gn((function(){function e(){try{var e=r.getState();if(e===u.current)return;var t=c.current(e);if(n(t,f.current))return;f.current=t,u.current=e}catch(e){s.current=e}i()}return l.onStateChange=e,l.trySubscribe(),e(),function(){return l.tryUnsubscribe()}}),[r,l]),a}(e,r,o.store,o.subscription);return(0,t.useDebugValue)(a),a}}var Sn,kn=Cn();Sn=a.unstable_batchedUpdates,mn=Sn;const Fn=n=>{let{id:r,variation:o,localDataLength:a,handleVariationRemove:i,handleVariationChange:l}=n;const[s,c]=(0,t.useState)(!1),[u,f]=(0,t.useState)(o.font_url?o.font_url:"");let d;const m=Object.entries(bsf_custom_fonts_admin.fontWeightList).map((t=>{let[n,r]=t;return(0,e.createElement)("option",{value:n,key:n}," ",r," ")}));return(0,e.createElement)("div",{key:r,className:"border border-light rounded-sm variation-file-field mb-4"},s?(0,e.createElement)("div",{className:"relative p-4 bg-theme-bg edit-font-variation-wrap"},(0,e.createElement)("div",{className:"mb-4 border-b border-light pb-4"},(0,e.createElement)("div",{className:"flex items-center gap-x-4"},(0,e.createElement)("input",{name:`variation[${o.id}][font_file]`,type:"hidden",value:o.font_file}),(0,e.createElement)("input",{name:`variation[${o.id}][font_url]`,type:"hidden",value:o.font_url}),(0,e.createElement)("button",{onClick:e=>(e=>{e.preventDefault(),d||(d=wp.media({title:(0,ee.__)("Select or Upload Font","custom-fonts"),button:{text:(0,ee.__)("Use Font","custom-fonts")},multiple:!0}),d.on("select",(function(){var t=d.state().get("selection").map((function(e){return e.toJSON(),e}));let n=[];for(let e=0;e=1?(0,ee.__)("Font files:","custom-fonts"):(0,ee.__)("No file chosen","custom-fonts")," "),(0,e.createElement)("div",{className:"font-triggers"},(0,e.createElement)("svg",{onClick:()=>c(!1),width:"12",height:"8",viewBox:"0 0 12 8",className:"arrow-icon h-[40px]",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M2.00039 7.19995L6.00039 3.19995L10.0004 7.19995L11.6004 6.39995L6.00039 0.799951L0.400391 6.39995L2.00039 7.19995Z",fill:"#7E7E7E"})),a>1&&(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-pointer remove-icon h-[40px]",onClick:()=>i(o.id)},(0,e.createElement)("path",{d:"M8.00078 0.800049C4.00078 0.800049 0.800781 4.00005 0.800781 8.00005C0.800781 12 4.00078 15.2 8.00078 15.2C12.0008 15.2 15.2008 12 15.2008 8.00005C15.2008 4.00005 12.0008 0.800049 8.00078 0.800049ZM8.00078 13.6C4.88078 13.6 2.40078 11.12 2.40078 8.00005C2.40078 4.88005 4.88078 2.40005 8.00078 2.40005C11.1208 2.40005 13.6008 4.88005 13.6008 8.00005C13.6008 11.12 11.1208 13.6 8.00078 13.6ZM4.80078 7.20005V8.80005H11.2008V7.20005H4.80078Z",fill:"rgb(230 80 84 / 1)"})))),Array.isArray(u)&&u.length>=1&&u.map(((t,n)=>{return(0,e.createElement)("div",{className:"text-xs text-neutral mt-1.5",key:n},`${(0,ee.__)("File ","custom-fonts")} ${n+1}: ${r=t,r.split("/").at(-1)}`);var r})),(0,e.createElement)("div",{className:"text-xs text-neutral mt-1.5 italic"},`${(0,ee.__)("Supported file types: ","custom-fonts")} .otf, .ttf, .woff, .woff2`)),(0,e.createElement)("div",{className:"grid grid-cols-2 gap-x-3"},(0,e.createElement)("div",{className:"col-span-1"},(0,e.createElement)("label",{className:"w-full text-sm text-heading",htmlFor:`variation[${o.id}][font_style]`},(0,ee.__)("Font Style:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{name:`variation[${o.id}][font_style]`,value:o.font_style,onChange:e=>l(e,o.id,"font_style"),className:"w-full"},(0,e.createElement)("option",{value:"normal"}," ",(0,ee.__)("Normal","custom-fonts")," "),(0,e.createElement)("option",{value:"italic"}," ",(0,ee.__)("Italic","custom-fonts")," "),(0,e.createElement)("option",{value:"oblique"}," ",(0,ee.__)("Oblique","custom-fonts")," ")))),(0,e.createElement)("div",{className:"col-span-1"},(0,e.createElement)("label",{className:"w-full text-sm text-heading",htmlFor:`variation[${o.id}][font_weight]`},(0,ee.__)("Font Weight:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{name:`variation[${o.id}][font_weight]`,value:void 0===o.font_weight?"400":o.font_weight,className:"w-full",onChange:e=>l(e,o.id,"font_weight")},m))))):(0,e.createElement)("div",{className:"flex items-center justify-between p-3.5 relative",onClick:e=>{e.preventDefault(),e.stopPropagation(),c(!0)}},(0,e.createElement)("h2",{className:"text-sm font-semibold text-secondary"},u.length>=1?(0,ee.__)("Font files chosen","custom-fonts"):(0,ee.__)("No file chosen","custom-fonts")),(0,e.createElement)("div",{className:"flex items-center justify-end gap-x-4 font-triggers"},(0,e.createElement)("svg",{onClick:()=>c(!0),width:"12",height:"8",viewBox:"0 0 12 8",className:"arrow-icon h-[40px]",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M2.00039 0.800049L6.00039 4.80005L10.0004 0.800049L11.6004 1.60005L6.00039 7.20005L0.400391 1.60005L2.00039 0.800049Z",fill:"#7E7E7E"})),a>1&&(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-pointer remove-icon h-[40px]",onClick:()=>i(o.id)},(0,e.createElement)("path",{d:"M8.00078 0.800049C4.00078 0.800049 0.800781 4.00005 0.800781 8.00005C0.800781 12 4.00078 15.2 8.00078 15.2C12.0008 15.2 15.2008 12 15.2008 8.00005C15.2008 4.00005 12.0008 0.800049 8.00078 0.800049ZM8.00078 13.6C4.88078 13.6 2.40078 11.12 2.40078 8.00005C2.40078 4.88005 4.88078 2.40005 8.00078 2.40005C11.1208 2.40005 13.6008 4.88005 13.6008 8.00005C13.6008 11.12 11.1208 13.6 8.00078 13.6ZM4.80078 7.20005V8.80005H11.2008V7.20005H4.80078Z",fill:"rgb(230 80 84 / 1)"})))))};var Tn=n=>{let{fontId:r}=n;const[o,a]=(0,t.useState)(!1),i=xn(),l=kn((e=>e.fonts)),s=parseInt(r);let c={};l.forEach((function(e){s===e.id&&(c=e)}));const[u,f]=(0,t.useState)(c["fonts-data"]),[d,m]=(0,t.useState)(!1);(0,t.useEffect)((()=>{i({type:"SET_EDIT_FONT",payload:u})}),[u]);const p=(e,t)=>{const n=e.target.value;f((e=>({...e,[t]:n})))},v=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const o=u.variations.map((o=>{if(o.id===t){if(r.length>0){let e=[];return r.map(((t,n)=>e.push(t))),{...o,font_url:e}}return{...o,[n]:e.target.value}}return o}));f({...u,variations:o})},h=e=>{const t=u.variations.filter((t=>t.id!==e));f({...u,variations:t})};return(0,e.createElement)("div",null,(0,e.createElement)("div",null,(0,e.createElement)("p",{className:"mb-5 text-xl font-semibold"},(0,ee.__)("Edit Font","custom-fonts")),(0,e.createElement)("div",{className:"mb-5"},(0,e.createElement)("div",{onClick:()=>{a(!o)},className:"flex items-center gap-x-2 hover:cursor-pointer"},(0,e.createElement)("label",{className:"text-sm text-heading",htmlFor:""},(0,ee.__)("Advanced Options","custom-fonts")),(0,e.createElement)("svg",{width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:o?"rotate-90":"transition-transform duration-300"},(0,e.createElement)("path",{d:"M0.400391 0.800049L5.20039 4.02405L0.400391 7.20005L0.400391 0.800049Z",fill:"#007CBA"}))),o&&(0,e.createElement)("div",{className:"transition-opacity duration-300 ease-in-out mt-3 "+(o?"opacity-100 block":"opacity-0 hidden")},(0,e.createElement)("div",{className:"mb-3"},(0,e.createElement)("label",{className:"w-full text-[13px] text-heading",htmlFor:"font_fallback"},(0,ee.__)("Font Fallback:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("input",{className:"w-full",type:"text",name:"font_fallback",value:u.font_fallback,onChange:e=>p(e,"font_fallback")})),(0,e.createElement)("span",{className:"mt-1.5 text-xs text-neutral"},(0,ee.__)("Separate font names with comma(,). eg.","custom-fonts"),"Arial, Serif")),(0,e.createElement)("div",{className:"mb-5"},(0,e.createElement)("label",{className:"w-full text-[13px] text-heading",htmlFor:"font_display"},(0,ee.__)("Font Display:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{className:"w-full",name:"font_display",value:u.font_display,onChange:e=>p(e,"font_display")},(0,e.createElement)("option",{value:"auto"}," ",(0,ee.__)("auto","custom-fonts")," "),(0,e.createElement)("option",{value:"block"}," ",(0,ee.__)("block","custom-fonts")," "),(0,e.createElement)("option",{value:"swap"}," ",(0,ee.__)("swap","custom-fonts")," "),(0,e.createElement)("option",{value:"fallback"}," ",(0,ee.__)("fallback","custom-fonts")," "),(0,e.createElement)("option",{value:"optional"}," ",(0,ee.__)("optional","custom-fonts")," ")))))),u.variations.map((t=>(0,e.createElement)(Fn,{key:t.id,variation:t,localDataLength:u.variations.length,handleVariationRemove:h,handleVariationChange:v}))),(0,e.createElement)("div",{className:"flex items-center gap-x-1 my-5 cursor-pointer",onClick:()=>{const e={id:u.variations[u.variations.length-1].id+1,font_file:"",font_url:"",font_style:"normal",font_weight:"400"},t=[...u.variations,e];f((e=>({...e,variations:t})))}},(0,e.createElement)("div",{className:"text-sm text-primary"},(0,ee.__)("Add Font Variation","custom-fonts")),(0,e.createElement)("div",null,(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M7.9998 0.800049C3.9998 0.800049 0.799805 4.00005 0.799805 8.00005C0.799805 12 3.9998 15.2 7.9998 15.2C11.9998 15.2 15.1998 12 15.1998 8.00005C15.1998 4.00005 11.9998 0.800049 7.9998 0.800049ZM7.9998 13.6C4.8798 13.6 2.3998 11.12 2.3998 8.00005C2.3998 4.88005 4.8798 2.40005 7.9998 2.40005C11.1198 2.40005 13.5998 4.88005 13.5998 8.00005C13.5998 11.12 11.1198 13.6 7.9998 13.6ZM8.7998 4.80005H7.1998V7.20005H4.7998V8.80005H7.1998V11.2H8.7998V8.80005H11.1998V7.20005H8.7998V4.80005Z",fill:"#007CBA"})))),(0,e.createElement)("button",{type:"button",className:"bcf-save-font inline-flex components-button is-primary mb-5",onClick:e=>{if(e.preventDefault(),""===u.font_name)return void window.alert((0,ee.__)("Make sure to provide valid details.","custom-fonts"));m("loading");const t=new window.FormData;t.append("action","bcf_edit_font"),t.append("security",bsf_custom_fonts_admin.edit_font_nonce),t.append("font_type","local"),t.append("font_id",r),t.append("font_data",JSON.stringify(u)),ne()({url:bsf_custom_fonts_admin.ajax_url,method:"POST",body:t}).then((e=>{e.success&&setTimeout((()=>{window.location=`${bsf_custom_fonts_admin.app_base_url}`}),500),m(!1)}))},disabled:"loading"===d},(0,ee.__)("Save Font","custom-fonts"),"loading"===d&&(0,e.createElement)("svg",{className:"animate-spin -mr-1 ml-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},(0,e.createElement)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.createElement)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})))))};const On=t=>{let{id:n,variation:r}=t;return(0,e.createElement)("div",{key:n,className:"text-sm font-normal text-heading mt-3.5 edit-gfont-variation-item","data-varweight":r},(e=>{void 0===e&&(e="400");let t=e,n=e;switch("italic"===e&&(n="400italic"),n.includes("italic")&&(t=`${n.replace("italic","")} `+(0,ee.__)("Italic","custom-fonts")),e){case"100":case"100italic":return(0,ee.__)("Thin ","custom-fonts")+t;case"200":case"200italic":return(0,ee.__)("Extra Light ","custom-fonts")+t;case"300":case"300italic":return(0,ee.__)("Light ","custom-fonts")+t;case"400":case"400italic":return(0,ee.__)("Regular ","custom-fonts")+t;case"500":case"500italic":return(0,ee.__)("Medium ","custom-fonts")+t;case"600":case"600italic":return(0,ee.__)("Semi Bold ","custom-fonts")+t;case"700":case"700italic":return(0,ee.__)("Bold ","custom-fonts")+t;case"800":case"800italic":return(0,ee.__)("Extra Bold ","custom-fonts")+t;case"900":case"900italic":return(0,ee.__)("Ultra-Bold ","custom-fonts")+t;default:return t}})(r))};var Ln=n=>{let{fontId:r,fontName:o}=n;const a=kn((e=>e.fonts)),i=parseInt(r);let l={},s=null;a.forEach((function(e){if(i===e.id&&void 0!==bsf_custom_fonts_admin.googleFonts[e.title]){const t=bsf_custom_fonts_admin.googleFonts[e.title];s=t[0]?t[0]:[],l=e}}));let c={};void 0!==l["fonts-data"]&&l["fonts-data"].length||l["fonts-data"];const[u,f]=(0,t.useState)(!1);return(0,e.createElement)("div",null,(0,e.createElement)("div",null,(0,e.createElement)("p",{className:"mb-5 text-xl font-semibold"},(0,ee.__)("Edit Font","custom-fonts")),(0,e.createElement)("div",{className:"geditfontwrapper"},(0,e.createElement)("div",{className:"my-5 border border-light rounded-sm p-3.5"},(0,e.createElement)("h3",{className:"text-base font-semibold text-heading"},(0,ee.__)("Selected Variant","custom-fonts")),(0,e.createElement)("div",{className:"flex flex-col gap-y-3.5"},(0,e.createElement)("div",{className:"gvariations-wrapper"},s.map((t=>(0,e.createElement)(On,{key:t,variation:t})))))),(0,e.createElement)("div",{className:"my-5"},(0,e.createElement)("button",{type:"button",className:"bcf-save-font inline-flex components-button is-primary mb-5",onClick:e=>{e.preventDefault(),f("loading");const t=new window.FormData,n=document.getElementById("gfont-edit-variation-data").innerHTML;t.append("action","bcf_edit_font"),t.append("security",bsf_custom_fonts_admin.edit_font_nonce),t.append("font_type","google"),t.append("font_id",r),t.append("font_data",n),ne()({url:bsf_custom_fonts_admin.ajax_url,method:"POST",body:t}).then((e=>{e.success&&setTimeout((()=>{window.location=`${bsf_custom_fonts_admin.app_base_url}`}),500),f(!1)}))},disabled:"loading"===u},(0,ee.__)("Save Font","custom-fonts"),"loading"===u&&(0,e.createElement)("svg",{className:"animate-spin -mr-1 ml-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},(0,e.createElement)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.createElement)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})))))))},Pn=window.wp.components;const An=t=>{let{id:n,weight:r,font:o,isInGoogleState:a,addWeight:i,removeWeight:l}=t;return(0,e.createElement)("div",{key:n,className:"py-5"},(0,e.createElement)("div",{className:"flex justify-between items-center"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"text-sm font-normal text-neutral mb-3.5"},(e=>{void 0===e&&(e="400");let t=e,n=e;switch("italic"===e&&(n="400italic"),n.includes("italic")&&(t=`${n.replace("italic","")} `+(0,ee.__)("Italic","custom-fonts")),e){case"100":case"100italic":return(0,ee.__)("Thin ","custom-fonts")+t;case"200":case"200italic":return(0,ee.__)("Extra Light ","custom-fonts")+t;case"300":case"300italic":return(0,ee.__)("Light ","custom-fonts")+t;case"400":case"400italic":return(0,ee.__)("Regular ","custom-fonts")+t;case"500":case"500italic":return(0,ee.__)("Medium ","custom-fonts")+t;case"600":case"600italic":return(0,ee.__)("Semi Bold ","custom-fonts")+t;case"700":case"700italic":return(0,ee.__)("Bold ","custom-fonts")+t;case"800":case"800italic":return(0,ee.__)("Extra Bold ","custom-fonts")+t;case"900":case"900italic":return(0,ee.__)("Ultra-Bold ","custom-fonts")+t;default:return t}})(r)),(0,e.createElement)("div",{className:"text-5xl",style:{fontFamily:o,fontStyle:(e=>(void 0===e&&(e="400"),e.includes("italic")?"italic":"normal"))(r),fontWeight:(e=>(void 0===e&&(e="400"),e.includes("italic")?e.replace("italic",""):e))(r),fontSize:"var(--bsf-custom-font-size)"}},(0,ee.__)("How vexingly quick daft zebras jump!","custom-fonts"))),(0,e.createElement)("div",null,!a&&(0,e.createElement)("button",{className:"flex items-center components-button is-secondary","data-font_weight":r,onClick:i},(0,e.createElement)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-font_weight":r,onClick:i},(0,e.createElement)("path",{d:"M8.00078 1.30005C4.00078 1.30005 0.800781 4.50005 0.800781 8.50005C0.800781 12.5 4.00078 15.7 8.00078 15.7C12.0008 15.7 15.2008 12.5 15.2008 8.50005C15.2008 4.50005 12.0008 1.30005 8.00078 1.30005ZM8.00078 14.1C4.88078 14.1 2.40078 11.62 2.40078 8.50005C2.40078 5.38005 4.88078 2.90005 8.00078 2.90005C11.1208 2.90005 13.6008 5.38005 13.6008 8.50005C13.6008 11.62 11.1208 14.1 8.00078 14.1ZM8.80078 5.30005H7.20078V7.70005H4.80078V9.30005H7.20078V11.7H8.80078V9.30005H11.2008V7.70005H8.80078V5.30005Z",fill:"#007CBA"})),(0,e.createElement)("span",{className:"ml-2","data-font_weight":r},(0,ee.__)("Add","custom-fonts"))),a&&(0,e.createElement)("button",{className:"flex text-danger components-button is-secondary border border-danger","data-font_weight":r,onClick:l},(0,e.createElement)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-font_weight":r,onClick:l},(0,e.createElement)("path",{d:"M8.00078 1.30005C4.00078 1.30005 0.800781 4.50005 0.800781 8.50005C0.800781 12.5 4.00078 15.7 8.00078 15.7C12.0008 15.7 15.2008 12.5 15.2008 8.50005C15.2008 4.50005 12.0008 1.30005 8.00078 1.30005ZM8.00078 14.1C4.88078 14.1 2.40078 11.62 2.40078 8.50005C2.40078 5.38005 4.88078 2.90005 8.00078 2.90005C11.1208 2.90005 13.6008 5.38005 13.6008 8.50005C13.6008 11.62 11.1208 14.1 8.00078 14.1ZM4.80078 7.70005V9.30005H11.2008V7.70005H4.80078Z",fill:"rgb(230 80 84 / 1)"})),(0,e.createElement)("span",{className:"ml-2","data-font_weight":r},(0,ee.__)("Remove","custom-fonts"))))))};var Rn=n=>{let{fontId:r,fontName:o}=n;const a=xn(),i=parseInt(r);let l=null;const[s,c]=(0,t.useState)(""),u=kn((e=>e.fonts));let f={},d=null;u.forEach((function(e){if(i===e.id&&void 0!==bsf_custom_fonts_admin.googleFonts[e.title]){const t=bsf_custom_fonts_admin.googleFonts[e.title];d=t[0]?t[0]:[],f=e}})),void 0!==f["fonts-data"]&&f["fonts-data"].length||(l=f["fonts-data"]);const[m,p]=(0,t.useState)(l);if(null===d)return;(0,t.useEffect)((()=>{let e="";Object.keys(m.variations).map((t=>{const n=m.variations[t].font_weight.toString();e+=`.gvariations-wrapper > [data-varweight='${n}'] { display: block }`})),c(e),document.getElementById("gfont-edit-variation-data").innerHTML="",document.getElementById("gfont-edit-variation-data").innerHTML=JSON.stringify(m),a({type:"SET_EDIT_FONT",payload:m})}),[m]);const v=(e,t,n)=>{const r=e.replace(/ /g,"+");return`${bsf_custom_fonts_admin.googleFontAPI}=${r}:${t}&display=fallback&ver=${n+1}`},h=e=>{const t=e.target.dataset.font_weight.toString(),n=m.variations;if(void 0===t)return;let r=t.includes("italic")?"italic":"normal";n.push({id:(n.length+1).toString(),font_file:"",font_style:r,font_weight:t}),p({...m,variations:n})},g=e=>{const t=e.target.dataset.font_weight.toString(),n=m.variations.filter((e=>e.font_weight!=t));p({...m,variations:n})},_=e=>{if(!m.variations.length)return!1;const t=[];return Object.keys(m.variations).map((e=>{t.push(m.variations[e].font_weight)})),!!t.includes(e)};return d&&Object.keys(d).map(((t,n)=>(0,e.createElement)("div",{key:n},(0,e.createElement)("style",{id:`bcf-gfont-${m.font_name}-variation-css`}," ",s," "),(0,e.createElement)("link",{rel:"stylesheet",id:`bcf-google-font-${n}-link`,href:v(m.font_name,d[t],n),media:"all"}),(0,e.createElement)(An,{key:n,weight:d[t],font:m.font_name,isInGoogleState:_(d[t]),addWeight:h,removeWeight:g}))))},Mn=t=>{const{weight:n,font:r,fontUrl:o,style:a}=t;if(""!==o)return(0,e.createElement)("div",{className:"py-5"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"text-sm font-normal text-neutral mb-3.5"}," ",((e,t)=>{void 0===e&&(e="400");let n=e,r=e;switch("italic"===e&&(r="400italic"),r.includes("italic")&&(n=`${r.replace("italic","")} `+(0,ee.__)("Italic","custom-fonts")),"italic"!==t&&"oblique"!==t||(n="italic"===t?`${n} Italic`:`${n} Oblique`),e){case"100":case"100italic":return(0,ee.__)("Thin ","custom-fonts")+n;case"200":case"200italic":return(0,ee.__)("Extra Light ","custom-fonts")+n;case"300":case"300italic":return(0,ee.__)("Light ","custom-fonts")+n;case"400":case"400italic":return(0,ee.__)("Regular ","custom-fonts")+n;case"500":case"500italic":return(0,ee.__)("Medium ","custom-fonts")+n;case"600":case"600italic":return(0,ee.__)("Semi Bold ","custom-fonts")+n;case"700":case"700italic":return(0,ee.__)("Bold ","custom-fonts")+n;case"800":case"800italic":return(0,ee.__)("Extra Bold ","custom-fonts")+n;case"900":case"900italic":return(0,ee.__)("Ultra-Bold ","custom-fonts")+n;default:return n}})(n,a)," "),(0,e.createElement)("div",{className:"text-5xl",style:{fontFamily:r,fontWeight:n,fontStyle:a,fontSize:"var(--bsf-custom-font-size)"}},(0,ee.__)("How vexingly quick daft zebras jump!","custom-fonts"))))},$n=t=>{const n=kn((e=>e.editFont));if(null==n)return;if(!n.variations.length||""===n.font_name)return;const r=n.variations,o=n.font_name,a=e=>{let t="";return e.includes(".woff2")?t="format('woff2')":e.includes(".woff")?t="format('woff')":e.includes(".svg")?t="format('svg')":e.includes(".ttf")?t="format('truetype')":e.includes(".otf")?t="format('OpenType')":e.includes(".eot")&&(t="url('"+e+"?#iefix') format('embedded-opentype')"),t};return(0,e.createElement)("div",{className:"local-fonts-preview-wrapper"},(0,e.createElement)("style",{id:"bcf-local-font-css"}," ",(()=>{let e=`@font-face {\r\n\tfont-family: '${o}';`,t="";return r.map((n=>{let r=n.font_url,o=n.font_weight,i=""===n.font_style?"normal":n.font_style,l="";Array.isArray(r)?r.map(((e,t)=>{l+=" url('"+e+"') ",l+=a(e),t!==r.length-1&&(l+=",")})):(l+="url('"+r+"') ",l+=a(r)),t+=`${e}\r\n\tfont-style: ${i};\r\n\tfont-weight: ${o};\r\n\tsrc: ${l};\r\n}\r\n`})),t})()," "),r&&r.map((t=>(0,e.createElement)(Mn,{font:o,weight:t.font_weight,fontUrl:t.font_url,style:""===t.font_style?"normal":t.font_style,key:parseInt(t.font_weight)+1e3}))))},jn=n=>{const{openPopup:r,setOpenPopup:o,font:a,fontName:i,fontType:l}=n,[s,c]=(0,t.useState)(r),[u,f]=(0,t.useState)("20"),d=(0,t.useRef)(null),m=()=>{o(!r)};return(0,t.useEffect)((()=>{c(r)}),[r]),(0,e.createElement)(Ge.Root,{show:s,as:t.Fragment},(0,e.createElement)(fn,{as:"div",className:"ast-edit-font__dialog fixed backdrop-blur-sm inset-0 overflow-y-auto",initialFocus:d,onClose:m},(0,e.createElement)("div",{className:"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"},(0,e.createElement)(Ge.Child,{as:t.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0"},(0,e.createElement)("div",{className:"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"})),(0,e.createElement)("span",{className:"hidden sm:inline-block sm:align-middle sm:h-screen","aria-hidden":"true"},"​"),(0,e.createElement)(Ge.Child,{as:t.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"},(0,e.createElement)(fn.Panel,{className:"bcf-edit-dialog-panel"},(0,e.createElement)("div",{className:"inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-[100%] sm:max-h-[50%] sm:w-full"},(0,e.createElement)("div",{className:"bcf-edit-modal-close-wrapper absolute right-[-15px] p-0 top-[-15px] w-[25px] h-[25px]"},(0,e.createElement)("button",{type:"button",className:"mt-3 inline-flex justify-center border shadow-none border-slate-200 padding-[5px] bg-[#F6F7F7] text-base font-medium text-slate-800 focus:bg-[#F6F7F7] hover:bg-[#F6F7F7] focus:outline-none sm:mt-0 sm:text-xs bold border-none w-[20px] h-[20px] p-[3px] rounded-full shadow-md",onClick:m,ref:d},(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",width:"20",height:"12","aria-hidden":"true",focusable:"false",className:"mr-[2px]"},(0,e.createElement)("path",{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})))),(0,e.createElement)("div",{className:"grid grid-cols-12 sm:max-h-[60vh] overflow-auto"},(0,e.createElement)("style",{id:`bcf-font-${a}-preview-size-css`}," ",`:root { --bsf-custom-font-size: ${u}px }`," "),(0,e.createElement)("div",{id:"gfont-edit-variation-data",hidden:!0}),(0,e.createElement)("div",{className:"col-span-4 bg-white px-4 pt-5 pb-4 lg:p-[2em] sm:p-6"},(0,e.createElement)("div",null,"local"===l&&(0,e.createElement)(Tn,{fontId:a,fontName:i}),"google"===l&&(0,e.createElement)(Ln,{fontId:a,fontName:i}))),(0,e.createElement)("div",{className:"col-span-8 bg-[#F6F7F7] px-4 pt-5 pb-4 lg:p-[2em] sm:p-6"},(0,e.createElement)("div",{className:"border-b border-light pb-5 flex justify-between items-center"},(0,e.createElement)("div",{className:"text-base font-medium text-secondary"},(0,ee.__)("Font Preview","custom-fonts")),(0,e.createElement)("div",{className:"w-[314px] pr-[20px]"},(0,e.createElement)(Pn.RangeControl,{className:"bcf-font-size-range",onChange:e=>f(e),min:1,max:100,step:1,value:parseInt(u)}))),(0,e.createElement)("div",{className:"py-5 divide-y"},(0,e.createElement)("div",null,"local"===l&&(0,e.createElement)($n,{fontId:a,fontName:i}),"google"===l&&(0,e.createElement)(Rn,{fontId:a,fontName:i})))))))))))},Dn=n=>{let{item:r}=n;const[o,a]=(0,t.useState)(!1),[i,l]=(0,t.useState)(!1),[s,c]=(0,t.useState)(r.id),[u,f]=(0,t.useState)(r["font-type"]?r["font-type"]:"local"),[d,m]=(0,t.useState)(r.title),[p,v]=(0,t.useState)(!1),[h,g]=(0,t.useState)((0,ee.__)("Remove","custom-fonts")),_=kn((e=>e.editFont)),[y,b]=(0,t.useState)(_),E=xn();(0,t.useEffect)((()=>{p?(b(y),E({type:"SET_EDIT_FONT",payload:y})):(b(null),E({type:"SET_EDIT_FONT",payload:null}))}),[p]);const w=(e,t,n)=>{let r=""===e||"local"===e?t:n;return void 0===r||""===r?"normal":r.includes("italic")?"italic":t};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:(o||i?"bg-white active-state":"")+" bg-white transition-colors hover:bg-[#f6f7f7]"},(0,e.createElement)("div",{className:"flex items-center title-area justify-between py-5 border-b border-light list-font-title hover:cursor-pointer",onClick:e=>{e.preventDefault(),e.stopPropagation(),a(!o)}},(t=>{if("local"===(t["font-type"]?t["font-type"]:"local"))return(0,e.createElement)("style",{id:`bcf-custom-font-${t.id}-css`}," ",t["fonts-face"]," ");{const n=t.title.replace(/ /g,"+");return(0,e.createElement)("link",{rel:"stylesheet",id:`bcf-custom-font-${t.id}-css`,href:`${bsf_custom_fonts_admin.googleFontAPI}=${n}&ver=${t.id}`,media:"all"})}})(r),(0,e.createElement)("div",{className:"flex items-center px-6 mobile:block"},(0,e.createElement)("h1",{className:"text-xl",style:{fontFamily:r.title,fontWeight:"normal",fontSize:"1.5rem"}}," ",r.title," "),(0,e.createElement)("div",{className:"sm:ml-3 mobile:mt-3 text-sm"}," ",`(${r["fonts-data"].variations?r["fonts-data"].variations.length:0} ${(0,ee.__)("variants","custom-fonts")})`," ")),(0,e.createElement)("div",{className:"flex px-6"},i?(0,e.createElement)("div",{className:"flex gap-x-6"},(0,e.createElement)("div",{className:"text-secondary cursor-pointer"},(0,ee.sprintf)(/* translators: %s: Font name. */ (0,ee.__)('Remove "%s" font?',"custom-fonts"),r.title)),(0,e.createElement)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!1)},className:"text-neutral cursor-pointer"},(0,ee.__)("Cancel","custom-fonts")),(0,e.createElement)("div",{className:"text-danger cursor-pointer",onClick:e=>{e.preventDefault(),e.stopPropagation(),g((0,ee.__)("Removing...","custom-fonts"));const t=new window.FormData;t.append("action","bcf_delete_font"),t.append("security",bsf_custom_fonts_admin.delete_font_nonce),t.append("font_id",e.target.dataset.font_id),ne()({url:bsf_custom_fonts_admin.ajax_url,method:"POST",body:t}).then((e=>{e.success&&setTimeout((()=>{window.location.reload()}),500)}))},"data-font_id":r.id,"data-font_type":r["font-type"],data_font_name:r.title},h)):(0,e.createElement)("div",{className:"flex gap-x-6"},(0,e.createElement)("div",{onClick:e=>{e.stopPropagation();const t=e.target.dataset.font_id,n=e.target.dataset.font_type,r=e.target.dataset.font_name;v(!p),c(t),f(n),m(r)},"data-font_id":r.id,"data-font_type":r["font-type"],data_font_name:r.title,className:"text-primary cursor-pointer"},(0,ee.__)("Edit","custom-fonts")),(0,e.createElement)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),l(!0)},className:"text-danger cursor-pointer"},(0,ee.__)("Remove","custom-fonts"))),(0,e.createElement)("div",{onClick:()=>a(!o),className:"sm:ml-11 mobile:ml-2 cursor-pointer"},(0,e.createElement)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:(o?"rotate-180":"")+" transition-transform duration-150 ease-in-out"},(0,e.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.23017 7.20938C5.52875 6.92228 6.00353 6.93159 6.29063 7.23017L10 11.1679L13.7094 7.23017C13.9965 6.93159 14.4713 6.92228 14.7698 7.20938C15.0684 7.49647 15.0777 7.97125 14.7906 8.26983L10.5406 12.7698C10.3992 12.9169 10.204 13 10 13C9.79599 13 9.60078 12.9169 9.45938 12.7698L5.20938 8.26983C4.92228 7.97125 4.93159 7.49647 5.23017 7.20938Z",fill:"#7E7E7E"}))))),o&&r["fonts-data"].variations&&(0,e.createElement)("div",{className:"px-6 list-font-variations bg-[#f6f7f7]"},r["fonts-data"].variations.map(((t,n)=>{return(0,e.createElement)("div",{key:n,className:"py-5 font-variation-item"},((t,n,r,o)=>{if("local"===t)return"";const a=n.replace(/ /g,"+");return(0,e.createElement)("link",{rel:"stylesheet",id:`bcf-google-font-${o}-link`,href:`${bsf_custom_fonts_admin.googleFontAPI}=${a}:${r}&display=fallback&ver=${o+1}`,media:"all"})})(r["font-type"],r.title,t.font_weight,n),(0,e.createElement)("div",{className:"text-sm text-neutral mb-3 font-normal"}," ",((e,t,n)=>{void 0===e&&(e="400");let r=e,o="google"===t?e:n;switch("italic"===e&&(o="400italic"),o.includes("italic")&&(r=`${o.replace("italic","")} `+(0,ee.__)("Italic","custom-fonts")),e){case"100":case"100italic":return(0,ee.__)("Thin ","custom-fonts")+r;case"200":case"200italic":return(0,ee.__)("Extra Light ","custom-fonts")+r;case"300":case"300italic":return(0,ee.__)("Light ","custom-fonts")+r;case"400":case"400italic":return(0,ee.__)("Regular ","custom-fonts")+r;case"500":case"500italic":return(0,ee.__)("Medium ","custom-fonts")+r;case"600":case"600italic":return(0,ee.__)("Semi Bold ","custom-fonts")+r;case"700":case"700italic":return(0,ee.__)("Bold ","custom-fonts")+r;case"800":case"800italic":return(0,ee.__)("Extra Bold ","custom-fonts")+r;case"900":case"900italic":return(0,ee.__)("Ultra-Bold ","custom-fonts")+r;default:return r}})(t.font_weight,r["font-type"],t.font_style)," "),(0,e.createElement)("h3",{className:"text-xl text-heading",style:{fontFamily:r.title,fontSize:"1.3rem",fontStyle:w(r["font-type"],t.font_style,t.font_weight),fontWeight:(o=t.font_weight,void 0===o&&(o="400"),o.includes("italic")?o.replace("italic",""):o)}},(0,ee.__)("How vexingly quick daft zebras jump!","custom-fonts")));var o})))),(0,e.createElement)(jn,{font:s,fontType:u,fontName:d,openPopup:p,setOpenPopup:v}))},In=()=>(0,e.createElement)("div",{className:"inline text-center"},(0,e.createElement)("span",{className:"text-center mb-6"},(0,e.createElement)("svg",{className:"my-0 mx-auto",width:"65",height:"64",viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("rect",{x:"0.5",width:"64",height:"64",rx:"32",fill:"white"}),(0,e.createElement)("path",{d:"M19.5 34H24.6459C25.7822 34 26.821 34.642 27.3292 35.6584L27.6708 36.3416C28.179 37.358 29.2178 38 30.3541 38H34.6459C35.7822 38 36.821 37.358 37.3292 36.3416L37.6708 35.6584C38.179 34.642 39.2178 34 40.3541 34H45.5M19.5 34.4511V40C19.5 41.6569 20.8431 43 22.5 43H42.5C44.1569 43 45.5 41.6569 45.5 40V34.4511C45.5 34.152 45.4553 33.8547 45.3673 33.5688L42.1516 23.1177C41.7643 21.859 40.6013 21 39.2843 21H25.7157C24.3987 21 23.2357 21.859 22.8484 23.1177L19.6327 33.5688C19.5447 33.8547 19.5 34.152 19.5 34.4511Z",stroke:"#007CBA",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),(0,e.createElement)("h3",{className:"text-base font-semibold mt-6 mb-1"},(0,ee.__)("Find your fonts here","custom-fonts")),(0,e.createElement)("p",{className:"text-sm mb-6"},(0,ee.__)("Once you have add fonts, come back here to find them again easily.","custom-fonts"))),Hn=()=>(0,e.createElement)("div",{className:"border border-light bcf-font-list-wrap skeleton-wrap"},Array.from({length:5}).map(((t,n)=>(0,e.createElement)("div",{key:n,className:"flex items-center justify-between py-5 border-b border-light list-font-title"},(0,e.createElement)("div",{className:"flex items-center px-6"},(0,e.createElement)("div",{className:"bg-gray-300 p-2 h-7 w-40 animate-pulse"}),(0,e.createElement)("div",{className:"ml-3 text-sm"},(0,e.createElement)("div",{className:"bg-gray-300 p-3 w-16 animate-pulse"}))),(0,e.createElement)("div",{className:"flex px-6"},(0,e.createElement)("div",{className:"flex gap-x-6"},(0,e.createElement)("div",{className:"bg-gray-300 p-3 h-1.5 w-12 animate-pulse"}),(0,e.createElement)("div",{className:"text-danger cursor-pointer"},(0,e.createElement)("div",{className:"bg-gray-300 p-3 h-1.5 w-12 animate-pulse"}))),(0,e.createElement)("div",{className:"ml-11 cursor-pointer"},(0,e.createElement)("div",{className:"bg-gray-300 p-3 h-1.5 w-2 rounded-full animate-pulse"}))))))),Bn=()=>{const t=kn((e=>e.fonts));return 0==bsf_custom_fonts_admin.fontPostCount?(0,e.createElement)(In,null):null==t?(0,e.createElement)(Hn,null):(0,e.createElement)("div",{className:"border border-light bcf-font-list-wrap"},t&&t.map(((t,n)=>(0,e.createElement)(Dn,{item:t,key:n}))))},Vn=()=>(0,e.createElement)("div",{className:""},(0,e.createElement)("div",{className:"bg-white border-b border-slate-200"},(0,e.createElement)("div",{className:"max-w-3xl mx-auto px-6 py-4 lg:max-w-full"},(0,e.createElement)("div",{className:"relative py-0"},(0,e.createElement)("div",{className:"flex iphone:flex-col lg:flex-row md:flex-row justify-between items-center"},(0,e.createElement)("div",null,(0,e.createElement)("h2",{className:"text-base font-medium tablet:mb-3"},(0,ee._x)("Custom Fonts","Page title","custom-fonts"))),(0,e.createElement)("div",{className:"relative"},(0,e.createElement)(K,{to:{pathname:"themes.php",search:"?page=bsf-custom-fonts&path=add-fonts"},className:"flex components-button is-secondary"},(0,ee.__)("Add New Font","custom-fonts"))))))),(0,e.createElement)("div",{className:"max-w-3xl mx-auto px-6 py-6 lg:max-w-full"},(0,e.createElement)(Bn,null),(0,e.createElement)("div",{className:"mt-6 text-center"},(0,e.createElement)(K,{to:{pathname:"themes.php",search:"?page=bsf-custom-fonts&path=add-fonts"},className:"components-button is-primary"},(0,ee.__)("Add New Font","custom-fonts")))));const Un=n=>{let{id:r,variation:o,localDataLength:a,handleVariationRemove:i,handleVariationChange:l}=n;const[s,c]=(0,t.useState)(!0),[u,f]=(0,t.useState)([]);let d;const m=Object.entries(bsf_custom_fonts_admin.fontWeightList).map((t=>{let[n,r]=t;return(0,e.createElement)("option",{value:n,key:n}," ",r," ")}));return(0,e.createElement)("div",{key:r,className:"border border-light rounded-sm variation-file-field mb-4"},s?(0,e.createElement)("div",{className:"relative p-4 bg-theme-bg"},(0,e.createElement)("div",{className:"mb-4 border-b border-light pb-4"},(0,e.createElement)("div",{className:"flex items-center gap-x-4"},(0,e.createElement)("input",{name:`variation[${o.id}][font_file]`,type:"hidden",value:o.font_file}),(0,e.createElement)("input",{name:`variation[${o.id}][font_url]`,type:"hidden",value:o.font_url}),(0,e.createElement)("button",{onClick:e=>(e=>{e.preventDefault(),d||(d=wp.media({title:(0,ee.__)("Select or Upload Font","custom-fonts"),button:{text:(0,ee.__)("Use Font","custom-fonts")},multiple:!0}),d.on("select",(function(){var t=d.state().get("selection").map((function(e){return e.toJSON(),e}));let n=[];for(let e=0;e=1?(0,ee.__)("Chosen files:","custom-fonts"):(0,ee.__)("No file chosen","custom-fonts")," "),(0,e.createElement)("div",{className:"font-triggers"},(0,e.createElement)("svg",{onClick:()=>c(!1),width:"12",height:"8",viewBox:"0 0 12 8",className:"arrow-icon h-[40px]",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M2.00039 7.19995L6.00039 3.19995L10.0004 7.19995L11.6004 6.39995L6.00039 0.799951L0.400391 6.39995L2.00039 7.19995Z",fill:"#7E7E7E"})),a>1&&(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-pointer remove-icon h-[40px]",onClick:()=>i(o.id)},(0,e.createElement)("path",{d:"M8.00078 0.800049C4.00078 0.800049 0.800781 4.00005 0.800781 8.00005C0.800781 12 4.00078 15.2 8.00078 15.2C12.0008 15.2 15.2008 12 15.2008 8.00005C15.2008 4.00005 12.0008 0.800049 8.00078 0.800049ZM8.00078 13.6C4.88078 13.6 2.40078 11.12 2.40078 8.00005C2.40078 4.88005 4.88078 2.40005 8.00078 2.40005C11.1208 2.40005 13.6008 4.88005 13.6008 8.00005C13.6008 11.12 11.1208 13.6 8.00078 13.6ZM4.80078 7.20005V8.80005H11.2008V7.20005H4.80078Z",fill:"rgb(230 80 84 / 1)"})))),Array.isArray(u)&&u.length>=1&&u.map(((t,n)=>{return(0,e.createElement)("div",{className:"text-xs text-neutral mt-1.5",key:n},`${(0,ee.__)("File ","custom-fonts")} ${n+1}: ${r=t,r.split("/").pop()}`);var r})),(0,e.createElement)("div",{className:"text-xs text-neutral mt-1.5 italic"},`${(0,ee.__)("Supported file types: ","custom-fonts")} .otf, .ttf, .woff, .woff2`)),(0,e.createElement)("div",{className:"grid grid-cols-2 gap-x-3"},(0,e.createElement)("div",{className:"col-span-1"},(0,e.createElement)("label",{className:"w-full text-sm text-heading",htmlFor:`variation[${o.id}][font_style]`},(0,ee.__)("Font Style:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{name:`variation[${o.id}][font_style]`,value:o.font_style,onChange:e=>l(e,o.id,"font_style"),className:"w-full"},(0,e.createElement)("option",{value:"normal"}," ",(0,ee.__)("Normal","custom-fonts")," "),(0,e.createElement)("option",{value:"italic"}," ",(0,ee.__)("Italic","custom-fonts")," "),(0,e.createElement)("option",{value:"oblique"}," ",(0,ee.__)("Oblique","custom-fonts")," ")))),(0,e.createElement)("div",{className:"col-span-1"},(0,e.createElement)("label",{className:"w-full text-sm text-heading",htmlFor:`variation[${o.id}][font_weight]`},(0,ee.__)("Font Weight:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{name:`variation[${o.id}][font_weight]`,value:void 0===o.font_weight?"400":o.font_weight,className:"w-full",onChange:e=>l(e,o.id,"font_weight")},m))))):(0,e.createElement)("div",{className:"flex items-center justify-between p-3.5 relative",onClick:e=>{e.preventDefault(),e.stopPropagation(),c(!0)}},(0,e.createElement)("h2",{className:"text-sm font-semibold text-secondary"},u.length>=1?(0,ee.__)("Font files chosen","custom-fonts"):(0,ee.__)("No file chosen","custom-fonts")),(0,e.createElement)("div",{className:"flex items-center justify-end gap-x-4 font-triggers"},(0,e.createElement)("svg",{onClick:()=>c(!0),width:"12",height:"8",viewBox:"0 0 12 8",className:"arrow-icon h-[40px]",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M2.00039 0.800049L6.00039 4.80005L10.0004 0.800049L11.6004 1.60005L6.00039 7.20005L0.400391 1.60005L2.00039 0.800049Z",fill:"#7E7E7E"})),a>1&&(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"cursor-pointer remove-icon h-[40px]",onClick:()=>i(o.id)},(0,e.createElement)("path",{d:"M8.00078 0.800049C4.00078 0.800049 0.800781 4.00005 0.800781 8.00005C0.800781 12 4.00078 15.2 8.00078 15.2C12.0008 15.2 15.2008 12 15.2008 8.00005C15.2008 4.00005 12.0008 0.800049 8.00078 0.800049ZM8.00078 13.6C4.88078 13.6 2.40078 11.12 2.40078 8.00005C2.40078 4.88005 4.88078 2.40005 8.00078 2.40005C11.1208 2.40005 13.6008 4.88005 13.6008 8.00005C13.6008 11.12 11.1208 13.6 8.00078 13.6ZM4.80078 7.20005V8.80005H11.2008V7.20005H4.80078Z",fill:"rgb(230 80 84 / 1)"})))))};var Wn=()=>{const[n,r]=(0,t.useState)(!1),o=xn(),[a,i]=(0,t.useState)({font_name:"",font_fallback:"",font_display:"",variations:[{id:1,font_file:"",font_url:"",font_style:"normal",font_weight:"400"}]}),[l,s]=(0,t.useState)(!1);(0,t.useEffect)((()=>{o({type:"SET_LOCAL_FONT",payload:a})}),[a]);const c=(e,t)=>{const n=e.target.value;i((e=>({...e,[t]:n})))},u=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];const o=a.variations.map((o=>{if(o.id===t){if(r.length>0){let e=[];return r.map(((t,n)=>e.push(t))),{...o,font_url:e}}return{...o,[n]:e.target.value}}return o}));i({...a,variations:o})},f=e=>{const t=a.variations.filter((t=>t.id!==e));i({...a,variations:t})};return(0,e.createElement)("div",null,(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"mb-5"},(0,e.createElement)("label",{className:"w-full text-sm text-heading",htmlFor:"font_name"},(0,ee.__)("Font Name","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("input",{name:"font_name",value:a.font_name,onChange:e=>c(e,"font_name"),className:"w-full",type:"text"}))),(0,e.createElement)("div",{className:"mb-5"},(0,e.createElement)("div",{onClick:()=>{r(!n)},className:"flex items-center gap-x-2 hover:cursor-pointer"},(0,e.createElement)("label",{className:"text-sm text-heading",htmlFor:""},(0,ee.__)("Advanced Options","custom-fonts")),(0,e.createElement)("svg",{width:"6",height:"8",viewBox:"0 0 6 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:n?"rotate-90":"transition-transform duration-300"},(0,e.createElement)("path",{d:"M0.400391 0.800049L5.20039 4.02405L0.400391 7.20005L0.400391 0.800049Z",fill:"#007CBA"}))),n&&(0,e.createElement)("div",{className:"transition-opacity duration-300 ease-in-out mt-3 "+(n?"opacity-100 block":"opacity-0 hidden")},(0,e.createElement)("div",{className:"mb-3"},(0,e.createElement)("label",{className:"w-full text-[13px] text-heading",htmlFor:"font_fallback"},(0,ee.__)("Font Fallback:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("input",{className:"w-full",type:"text",name:"font_fallback",value:a.font_fallback,onChange:e=>c(e,"font_fallback")})),(0,e.createElement)("span",{className:"mt-1.5 text-xs text-neutral"},(0,ee.__)("Separate font names with comma(,). eg.","custom-fonts"),"Arial, Serif")),(0,e.createElement)("div",{className:"mb-5"},(0,e.createElement)("label",{className:"w-full text-[13px] text-heading",htmlFor:"font_display"},(0,ee.__)("Font Display:","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{className:"w-full",name:"font_display",value:a.font_display,onChange:e=>c(e,"font_display")},(0,e.createElement)("option",{value:"auto"}," ",(0,ee.__)("auto","custom-fonts")," "),(0,e.createElement)("option",{value:"block"}," ",(0,ee.__)("block","custom-fonts")," "),(0,e.createElement)("option",{value:"swap"}," ",(0,ee.__)("swap","custom-fonts")," "),(0,e.createElement)("option",{value:"fallback"}," ",(0,ee.__)("fallback","custom-fonts")," "),(0,e.createElement)("option",{value:"optional"}," ",(0,ee.__)("optional","custom-fonts")," ")))))),a.variations.map((t=>(0,e.createElement)(Un,{key:t,variation:t,localDataLength:a.variations.length,handleVariationRemove:f,handleVariationChange:u}))),(0,e.createElement)("div",{className:"flex items-center gap-x-1 my-5 cursor-pointer",onClick:()=>{const e={id:a.variations[a.variations.length-1].id+1,font_file:"",font_url:"",font_style:"normal",font_weight:"400"},t=[...a.variations,e];i((e=>({...e,variations:t})))}},(0,e.createElement)("div",{className:"text-sm text-primary"},(0,ee.__)("Add Font Variation","custom-fonts")),(0,e.createElement)("div",null,(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M7.9998 0.800049C3.9998 0.800049 0.799805 4.00005 0.799805 8.00005C0.799805 12 3.9998 15.2 7.9998 15.2C11.9998 15.2 15.1998 12 15.1998 8.00005C15.1998 4.00005 11.9998 0.800049 7.9998 0.800049ZM7.9998 13.6C4.8798 13.6 2.3998 11.12 2.3998 8.00005C2.3998 4.88005 4.8798 2.40005 7.9998 2.40005C11.1198 2.40005 13.5998 4.88005 13.5998 8.00005C13.5998 11.12 11.1198 13.6 7.9998 13.6ZM8.7998 4.80005H7.1998V7.20005H4.7998V8.80005H7.1998V11.2H8.7998V8.80005H11.1998V7.20005H8.7998V4.80005Z",fill:"#007CBA"})))),(0,e.createElement)("button",{type:"button",className:"bcf-save-font inline-flex components-button is-primary mobile:mb-5",onClick:e=>{if(e.preventDefault(),""===a.font_name)return void window.alert((0,ee.__)("Make sure to provide valid details.","custom-fonts"));s("loading");const t=new window.FormData;t.append("action","bcf_add_new_local_font"),t.append("security",bsf_custom_fonts_admin.add_font_nonce),t.append("font_type","local"),t.append("font_data",JSON.stringify(a)),ne()({url:bsf_custom_fonts_admin.ajax_url,method:"POST",body:t}).then((e=>{e.success&&setTimeout((()=>{window.location=`${bsf_custom_fonts_admin.app_base_url}`}),500),s(!1)}))},disabled:"loading"===l},(0,ee.__)("Save Font","custom-fonts"),"loading"===l&&(0,e.createElement)("svg",{className:"animate-spin -mr-1 ml-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},(0,e.createElement)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.createElement)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})))))};const Zn=t=>{let{id:n,variation:r,handleVariationRemove:o}=t;return(0,e.createElement)("div",{key:n,className:"flex items-center justify-between"},(0,e.createElement)("div",{className:"text-sm font-normal text-heading"},(e=>{void 0===e&&(e="400");let t=e,n=e;switch("italic"===e&&(n="400italic"),n.includes("italic")&&(t=`${n.replace("italic","")} `+(0,ee.__)("Italic","custom-fonts")),e){case"100":case"100italic":return(0,ee.__)("Thin ","custom-fonts")+t;case"200":case"200italic":return(0,ee.__)("Extra Light ","custom-fonts")+t;case"300":case"300italic":return(0,ee.__)("Light ","custom-fonts")+t;case"400":case"400italic":return(0,ee.__)("Regular ","custom-fonts")+t;case"500":case"500italic":return(0,ee.__)("Medium ","custom-fonts")+t;case"600":case"600italic":return(0,ee.__)("Semi Bold ","custom-fonts")+t;case"700":case"700italic":return(0,ee.__)("Bold ","custom-fonts")+t;case"800":case"800italic":return(0,ee.__)("Extra Bold ","custom-fonts")+t;case"900":case"900italic":return(0,ee.__)("Ultra-Bold ","custom-fonts")+t;default:return t}})(r.font_weight)),(0,e.createElement)("div",null,(0,e.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:()=>o(r.id)},(0,e.createElement)("path",{d:"M8.00078 0.800049C4.00078 0.800049 0.800781 4.00005 0.800781 8.00005C0.800781 12 4.00078 15.2 8.00078 15.2C12.0008 15.2 15.2008 12 15.2008 8.00005C15.2008 4.00005 12.0008 0.800049 8.00078 0.800049ZM8.00078 13.6C4.88078 13.6 2.40078 11.12 2.40078 8.00005C2.40078 4.88005 4.88078 2.40005 8.00078 2.40005C11.1208 2.40005 13.6008 4.88005 13.6008 8.00005C13.6008 11.12 11.1208 13.6 8.00078 13.6ZM4.80078 7.20005V8.80005H11.2008V7.20005H4.80078Z",fill:"rgb(230 80 84 / 1)"}))))};var zn=()=>{const n=kn((e=>e.googleFont)),r=bsf_custom_fonts_admin.googleFonts,o=xn(),[a,i]=(0,t.useState)(""),[l,s]=(0,t.useState)(!1),c=e=>{const t=n.variations.filter((t=>t.id!==e));o({type:"SET_GOOGLE_FONT",payload:{font_name:n.font_name?n.font_name:"",font_fallback:n.font_fallback?n.font_fallback:"",font_display:n.font_display?n.font_display:"",variations:t}})};return(0,e.createElement)("div",null,(0,e.createElement)("div",null,(0,e.createElement)("div",null,(0,e.createElement)("label",{className:"w-full text-sm text-heading",htmlFor:""},(0,ee.__)("Select Font","custom-fonts")),(0,e.createElement)("div",{className:"mt-1.5"},(0,e.createElement)("select",{className:"w-full",name:"bcf-google-font-selection",id:"bcf-google-font-selection",value:a,onChange:function(e){i(e.target.value);const t=new CustomEvent("bcf:googleFontSelection:change",{bubbles:!0,detail:{e:e,name:e.target.name,value:e.target.value}});document.dispatchEvent(t),o({type:"SET_GOOGLE_FONT",payload:{font_name:e.target.value,font_fallback:"",font_display:"",variations:[]}})}},(0,e.createElement)("option",{value:""}," ",(0,ee.__)("Select a font family...","custom-fonts")," "),Object.keys(r).map((t=>(0,e.createElement)("option",{value:t,key:t,disabled:bsf_custom_fonts_admin.existingGoogleFonts.includes(t)},t)))))),n&&n.variations&&n.variations.length>0&&(0,e.createElement)("div",{className:"my-5 border border-light rounded-sm p-3.5"},(0,e.createElement)("h3",{className:"text-base font-semibold text-heading"},(0,ee.__)("Selected Variant","custom-fonts")),(0,e.createElement)("div",{className:"mt-3.5 flex flex-col gap-y-3.5"},n.variations.map((t=>(0,e.createElement)(Zn,{key:t.id+1,variation:t,handleVariationRemove:c}))))),(0,e.createElement)("div",{className:"my-5"},(0,e.createElement)("button",{type:"button",className:"bcf-save-font inline-flex components-button is-primary",onClick:e=>{if(e.preventDefault(),""===n.font_name)return void window.alert((0,ee.__)("Make sure to provide valid details.","custom-fonts"));s("loading");const t=new window.FormData;t.append("action","bcf_add_new_google_font"),t.append("security",bsf_custom_fonts_admin.add_font_nonce),t.append("font_type","google"),t.append("font_data",JSON.stringify(n)),ne()({url:bsf_custom_fonts_admin.ajax_url,method:"POST",body:t}).then((e=>{e.success&&setTimeout((()=>{window.location=`${bsf_custom_fonts_admin.app_base_url}`}),500),s(!1)}))},disabled:"loading"===l},(0,ee.__)("Save Font","custom-fonts"),"loading"===l&&(0,e.createElement)("svg",{className:"animate-spin -mr-1 ml-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},(0,e.createElement)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.createElement)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"}))))))},qn=t=>{const{weight:n,font:r,isInGoogleState:o}=t,a=kn((e=>e.googleFont)),i=xn();return(0,e.createElement)("div",{className:"py-5"},(0,e.createElement)("div",{className:"flex justify-between items-center"},(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"text-sm font-normal text-neutral mb-3.5"},(e=>{void 0===e&&(e="400");let t=e,n=e;switch("italic"===e&&(n="400italic"),n.includes("italic")&&(t=`${n.replace("italic","")} `+(0,ee.__)("Italic","custom-fonts")),e){case"100":case"100italic":return(0,ee.__)("Thin ","custom-fonts")+t;case"200":case"200italic":return(0,ee.__)("Extra Light ","custom-fonts")+t;case"300":case"300italic":return(0,ee.__)("Light ","custom-fonts")+t;case"400":case"400italic":return(0,ee.__)("Regular ","custom-fonts")+t;case"500":case"500italic":return(0,ee.__)("Medium ","custom-fonts")+t;case"600":case"600italic":return(0,ee.__)("Semi Bold ","custom-fonts")+t;case"700":case"700italic":return(0,ee.__)("Bold ","custom-fonts")+t;case"800":case"800italic":return(0,ee.__)("Extra Bold ","custom-fonts")+t;case"900":case"900italic":return(0,ee.__)("Ultra-Bold ","custom-fonts")+t;default:return t}})(n)),(0,e.createElement)("div",{className:"text-5xl",style:{fontFamily:r,fontWeight:(e=>(void 0===e&&(e="400"),e.includes("italic")?e.replace("italic",""):e))(n),fontStyle:(e=>(void 0===e&&(e="400"),e.includes("italic")?"italic":"normal"))(n),fontSize:"var(--bsf-custom-font-size)"}},(0,ee.__)("How vexingly quick daft zebras jump!","custom-fonts"))),(0,e.createElement)("div",null,!o&&(0,e.createElement)("button",{className:"flex items-center components-button is-secondary","data-font_weight":n,onClick:e=>{e.preventDefault(),e.stopPropagation();const t=e.target.dataset.font_weight,n=a.variations;if(void 0===t)return;let r=t.includes("italic")?"italic":"normal";n.push({id:n.length+1,font_file:"",font_style:r,font_weight:t}),i({type:"SET_GOOGLE_FONT",payload:{font_name:a.font_name,font_fallback:a.font_fallback,font_display:a.font_display,variations:n}})}},(0,e.createElement)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-font_weight":n},(0,e.createElement)("path",{d:"M8.00078 1.30005C4.00078 1.30005 0.800781 4.50005 0.800781 8.50005C0.800781 12.5 4.00078 15.7 8.00078 15.7C12.0008 15.7 15.2008 12.5 15.2008 8.50005C15.2008 4.50005 12.0008 1.30005 8.00078 1.30005ZM8.00078 14.1C4.88078 14.1 2.40078 11.62 2.40078 8.50005C2.40078 5.38005 4.88078 2.90005 8.00078 2.90005C11.1208 2.90005 13.6008 5.38005 13.6008 8.50005C13.6008 11.62 11.1208 14.1 8.00078 14.1ZM8.80078 5.30005H7.20078V7.70005H4.80078V9.30005H7.20078V11.7H8.80078V9.30005H11.2008V7.70005H8.80078V5.30005Z",fill:"#007CBA"})),(0,e.createElement)("span",{className:"ml-2","data-font_weight":n},(0,ee.__)("Add","custom-fonts"))),o&&(0,e.createElement)("button",{className:"flex text-danger items-center components-button is-secondary border border-danger","data-font_weight":n,onClick:e=>{e.preventDefault(),e.stopPropagation();const t=a.variations.filter((e=>e.font_weight!==n));i({type:"SET_GOOGLE_FONT",payload:{font_name:a.font_name?a.font_name:"",font_fallback:a.font_fallback?a.font_fallback:"",font_display:a.font_display?a.font_display:"",variations:t}})}},(0,e.createElement)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg","data-font_weight":n},(0,e.createElement)("path",{d:"M8.00078 1.30005C4.00078 1.30005 0.800781 4.50005 0.800781 8.50005C0.800781 12.5 4.00078 15.7 8.00078 15.7C12.0008 15.7 15.2008 12.5 15.2008 8.50005C15.2008 4.50005 12.0008 1.30005 8.00078 1.30005ZM8.00078 14.1C4.88078 14.1 2.40078 11.62 2.40078 8.50005C2.40078 5.38005 4.88078 2.90005 8.00078 2.90005C11.1208 2.90005 13.6008 5.38005 13.6008 8.50005C13.6008 11.62 11.1208 14.1 8.00078 14.1ZM4.80078 7.70005V9.30005H11.2008V7.70005H4.80078Z",fill:"rgb(230 80 84 / 1)"})),(0,e.createElement)("span",{className:"ml-2","data-font_weight":n},(0,ee.__)("Remove","custom-fonts"))))))},Gn=()=>{const t=kn((e=>e.googleFont));if(void 0===t)return;const n=t.font_name,r=bsf_custom_fonts_admin.googleFonts[n];if(void 0===r)return;const o=r[0]?r[0]:[],a=(e,t,n)=>{const r=e.replace(/ /g,"+");return`${bsf_custom_fonts_admin.googleFontAPI}=${r}:${t}&display=fallback&ver=${n+1}`},i=e=>{if(!t.variations.length)return!1;const n=[];return Object.keys(t.variations).map((e=>{n.push(t.variations[e].font_weight)})),!!n.includes(e)};return o&&Object.keys(o).map(((t,r)=>(0,e.createElement)("div",{key:r,className:"google-fonts-preview-wrapper"},(0,e.createElement)("style",{id:`bcf-google-font-${r}-css`}," ",".preview-font-name {display: none;}"," "),(0,e.createElement)("link",{rel:"stylesheet",id:`bcf-google-font-${r}-link`,href:a(n,o[t],r),media:"all"}),(0,e.createElement)(qn,{font:n,weight:o[t],isInGoogleState:i(o[t]),key:t}))))},Yn=()=>{const t=kn((e=>e.localFont));if(null==t)return;if(!t.variations.length||""===t.font_name)return;const n=t.variations,r=t.font_name,o=e=>{let t="";return e.includes(".woff2")?t="format('woff2')":e.includes(".woff")?t="format('woff')":e.includes(".svg")?t="format('svg')":e.includes(".ttf")?t="format('truetype')":e.includes(".otf")?t="format('OpenType')":e.includes(".eot")&&(t="url('"+e+"?#iefix') format('embedded-opentype')"),t};return(0,e.createElement)("div",{className:"local-fonts-preview-wrapper"},(0,e.createElement)("style",{id:"bcf-local-font-css"}," ",`${(()=>{let e=`@font-face {\r\n\tfont-family: '${r}';`,t="";return n.map((n=>{let r=n.font_url,a=n.font_weight,i=""===n.font_style?"normal":n.font_style,l="";Array.isArray(r)?r.map(((e,t)=>{l+=" url('"+e+"') ",l+=o(e),t!==r.length-1&&(l+=",")})):(l+="url('"+r+"') ",l+=o(r)),t+=`${e}\r\n\tfont-style: ${i};\r\n\tfont-weight: ${a};\r\n\tsrc: ${l};\r\n}\r\n`})),t})()} ${(()=>{let e=".preview-font-name {display: none;}",t=n.length,r=0;return n.map((e=>{""===e.font_url&&(r+=1)})),t===r&&(e=".preview-font-name {display: block;}"),e})()}`," "),n&&n.map((t=>(0,e.createElement)(Mn,{font:r,weight:t.font_weight,fontUrl:t.font_url,style:""===t.font_style?"normal":t.font_style,key:parseInt(t.font_weight)+1e3}))))},Jn=()=>{const[n,r]=(0,t.useState)("local"),[o,a]=(0,t.useState)("30"),i=e=>{r(e)};return(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"grid grid-cols-12"},(0,e.createElement)("style",{id:"bcf-fonts-preview-size-css"}," ",`:root { --bsf-custom-font-size: ${o}px }`," "),(0,e.createElement)("div",{className:"col-span-3 tablet:col-span-5 mobile:col-span-12 px-6 bg-white md:min-h-screen lg:px-[2em]"},(0,e.createElement)("div",{className:"flex items-center mb-5 border-b border-light"},(0,e.createElement)(K,{to:{pathname:"themes.php",search:"?page=bsf-custom-fonts"},className:"mr-4 cursor-pointer py-3 px-0 focus:shadow-none focus:outline-none"},(0,e.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M7.2002 9.99985L3.2002 5.99985L7.20019 1.99985L6.40019 0.399853L0.800195 5.99985L6.4002 11.5999L7.2002 9.99985Z",fill:"#7E7E7E"}))),(0,e.createElement)("div",{onClick:()=>i("local"),className:"text-base font-medium leading-8 hover:text-heading cursor-pointer px-4 py-4 border-b-2 border-white hover:border-b-primary "+("local"===n?"text-heading border-b-primary":"text-neutral")},(0,ee.__)("Local Fonts","custom-fonts")),(0,e.createElement)("div",{onClick:()=>i("google"),className:"text-base font-medium leading-8 hover:text-heading cursor-pointer px-4 py-4 border-b-2 border-white hover:border-b-primary "+("google"===n?"text-heading border-b-primary":"text-neutral")},(0,ee.__)("Google Fonts","custom-fonts"))),(0,e.createElement)("div",null,"local"===n&&(0,e.createElement)(Wn,null),"google"===n&&(0,e.createElement)(zn,null))),(0,e.createElement)("div",{className:"col-span-9 tablet:col-span-7 mobile:col-span-12 pt-4 pb-5 px-6 lg:px-[2em]"},(0,e.createElement)("div",{className:"pb-3 flex justify-between items-center tablet:block"},(0,e.createElement)("div",{className:"text-base font-medium text-secondary"},(0,ee.__)("Font Preview","custom-fonts")),(0,e.createElement)("div",{className:"w-[314px]"},(0,e.createElement)(Pn.RangeControl,{className:"bcf-font-size-range",onChange:e=>a(e),min:1,max:100,step:1,value:parseInt(o)}))),(0,e.createElement)("div",{className:"py-5 divide-y border-t border-light"},(0,e.createElement)("div",{className:"text-sm text-neutral pb-5 preview-font-name"},(0,e.createElement)("p",null,"local"===n&&(0,ee.__)("Font preview will appear here. Please select a font file.","custom-fonts"),"google"===n&&(0,ee.__)("Font preview will appear here. Please select a font.","custom-fonts"))),"local"===n&&(0,e.createElement)(Yn,null),"google"===n&&(0,e.createElement)(Gn,null)))))},Kn=function(){const t=new URLSearchParams(W(j).location.search),n=t.get("page"),r=t.get("path"),o=t.get("event");let a=(0,e.createElement)("p",null," Fallback Route Page ");return bsf_custom_fonts_admin.home_slug===n&&(a="getting-started"===o?(0,e.createElement)(Vn,null):"add-fonts"===r?(0,e.createElement)(Jn,null):(0,e.createElement)(Vn,null),bcfWpMenuClassChange(r)),(0,e.createElement)(e.Fragment,null,a)};function Xn(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Qn="function"==typeof Symbol&&Symbol.observable||"@@observable",er=function(){return Math.random().toString(36).substring(7).split("").join(".")},tr={INIT:"@@redux/INIT"+er(),REPLACE:"@@redux/REPLACE"+er(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+er()}};var nr,rr=function e(t,n,r){var o;if("function"==typeof n&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(Xn(0));if("function"==typeof n&&void 0===r&&(r=n,n=void 0),void 0!==r){if("function"!=typeof r)throw new Error(Xn(1));return r(e)(t,n)}if("function"!=typeof t)throw new Error(Xn(2));var a=t,i=n,l=[],s=l,c=!1;function u(){s===l&&(s=l.slice())}function f(){if(c)throw new Error(Xn(3));return i}function d(e){if("function"!=typeof e)throw new Error(Xn(4));if(c)throw new Error(Xn(5));var t=!0;return u(),s.push(e),function(){if(t){if(c)throw new Error(Xn(6));t=!1,u();var n=s.indexOf(e);s.splice(n,1),l=null}}}function m(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Xn(7));if(void 0===e.type)throw new Error(Xn(8));if(c)throw new Error(Xn(9));try{c=!0,i=a(i,e)}finally{c=!1}for(var t=l=s,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;switch(wp.hooks.applyFilters("custom_fonts_dashboard/data_reducer_action",t.type)){case"UPDATE_INITIAL_STATE":return{...t.payload};case"UPDATE_INITIAL_STATE_FLAG":return{...e,initialStateSetFlag:t.payload};case"SET_FONTS":return{...e,fonts:[...t.fonts]};case"SET_LOCAL_FONT":return{...e,localFont:t.payload};case"SET_EDIT_FONT":return{...e,editFont:t.payload};case"SET_GOOGLE_FONT":return!("googleFont"in e)||"googleFont"in e&&e.googleFont.font_name!==t.payload.font_name?{...e,googleFont:{font_name:t.payload.font_name,font_fallback:"",font_display:"",variations:[]}}:{...e,googleFont:{font_name:t.payload.font_name,font_fallback:t.payload.font_fallback?t.payload.font_fallback:"",font_display:t.payload.font_display?t.payload.font_display:"fallback",variations:t.payload.variations?t.payload.variations:[]}};case"SET_FONTS_DATA":return{...e,fonts:[...t.fonts],fonts_pagination:t.pagination,found_posts:t.found_posts,active_fonts_count:t.active_fonts_count,trash_fonts_count:t.trash_fonts_count,draft_fonts_count:t.draft_fonts_count,fonts_count:t.found_posts,fonts_limit_over:!1};case"UPDATE_SETTINGS_SAVED_NOTIFICATION":return{...e,settingsSavedNotification:t.payload};default:return e}}),wp.hooks.applyFilters("custom_fonts_dashboard/datastore",{initialStateSetFlag:!1,settingsSavedNotification:"",fonts:null,googleFont:null,localFont:null,editFont:null,fonts_pagination:{},found_posts:"",active_fonts_count:"",trash_fonts_count:"",draft_fonts_count:"",fonts_count:"",fonts_limit_over:!1}),window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__());rr.getState().initialStateSetFlag||(nr=rr,ne()({path:"/bsf-custom-fonts/v1/admin/settings/"}).then((e=>{const t={initialStateSetFlag:!0,fonts:e.fonts,found_posts:e.found_posts,active_fonts_count:e.active_fonts_count,trash_fonts_count:e.trash_fonts_count,draft_fonts_count:e.draft_fonts_count};nr.dispatch({type:"UPDATE_INITIAL_STATE",payload:t})}))),i().render((0,e.createElement)((function(e){var n=e.store,o=e.context,a=e.children,i=(0,t.useMemo)((function(){var e=hn(n);return{store:n,subscription:e}}),[n]),l=(0,t.useMemo)((function(){return n.getState()}),[n]);gn((function(){var e=i.subscription;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),l!==n.getState()&&e.notifyNestedSubs(),function(){e.tryUnsubscribe(),e.onStateChange=null}}),[i,l]);var s=o||dn;return r().createElement(s.Provider,{value:i},a)}),{store:rr},(0,e.createElement)((()=>(0,e.createElement)(Z,null,(0,e.createElement)(U,null,(0,e.createElement)(V,{path:"/"},(0,e.createElement)(Kn,null))))),null)),document.getElementById("bsf-custom-font-dashboard-app"))}()}();