OwlCyberSecurity - MANAGER
Edit File: extendify-draft-d7528ef801b88338ea87.js
(()=>{var e={251:(e,t,n)=>{"use strict";var i=n(196),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var i,r={},c=null,u=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,i)&&!l.hasOwnProperty(i)&&(r[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===r[i]&&(r[i]=t[i]);return{$$typeof:s,type:e,key:c,ref:u,props:r,_owner:a.current}}t.Fragment=r,t.jsx=c,t.jsxs=c},893:(e,t,n)=>{"use strict";e.exports=n(251)},250:(e,t,n)=>{"use strict";var i=n(196),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=i.useState,o=i.useEffect,a=i.useLayoutEffect,l=i.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!s(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=r({inst:{value:n,getSnapshot:t}}),s=i[0].inst,u=i[1];return a((function(){s.value=n,s.getSnapshot=t,c(s)&&u({inst:s})}),[e,n,t]),o((function(){return c(s)&&u({inst:s}),e((function(){c(s)&&u({inst:s})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:u},139:(e,t,n)=>{"use strict";var i=n(196),s=n(688),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=s.useSyncExternalStore,a=i.useRef,l=i.useEffect,c=i.useMemo,u=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,i,s){var d=a(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=c((function(){function e(e){if(!l){if(l=!0,o=e,e=i(e),void 0!==s&&h.hasValue){var t=h.value;if(s(t,e))return a=t}return a=e}if(t=a,r(o,e))return t;var n=i(e);return void 0!==s&&s(t,n)?t:(o=e,a=n)}var o,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,i,s]);var m=o(e,d[0],d[1]);return l((function(){h.hasValue=!0,h.value=m}),[m]),u(m),m}},688:(e,t,n)=>{"use strict";e.exports=n(250)},798:(e,t,n)=>{"use strict";e.exports=n(139)},196:e=>{"use strict";e.exports=window.React},967:(e,t)=>{var n;!function(){"use strict";var i={}.hasOwnProperty;function s(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,r(n)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return s.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)i.call(e,n)&&e[n]&&(t=o(t,n));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(s.default=s,e.exports=s):void 0===(n=function(){return s}.apply(t,[]))||(e.exports=n)}()}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(196);const t=window.wp.components,i=window.wp.data,s=window.wp.editPost,r=window.wp.element,o=window.wp.hooks,a=window.wp.i18n,l=window.wp.plugins,c=window.wp.blockEditor,u=window.wp.blocks,d=({completion:t})=>{const n=(0,u.pasteHandler)({plainText:t}),i=(0,r.useRef)();return(0,e.createElement)("div",{ref:i,style:{fontSize:"clamp(1em 1em 1em)"},className:"completion relative max-h-60 overflow-y-auto break-words px-5 pt-4","data-test":"completion-input"},Array.isArray(n)?(0,e.createElement)("div",{dangerouslySetInnerHTML:{__html:(0,u.serialize)(n)}}):(0,e.createElement)("div",{dangerouslySetInnerHTML:{__html:n}}))},h=window.wp.primitives;var m=n(893);const p=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),f=({disabled:n,setInputText:i,setReady:s})=>{const r=[{label:(0,a.__)("A paragraph …","extendify-local"),onClickText:(0,a.__)("Write a paragraph about","extendify-local")},{label:(0,a.__)("Blog post …","extendify-local"),onClickText:(0,a.__)("Write a blog post about","extendify-local")},{label:(0,a.__)("An informative article …","extendify-local"),onClickText:(0,a.__)("Write an informative article about","extendify-local")},{label:(0,a.__)("Headline …","extendify-local"),onClickText:(0,a.__)("Write a headline for","extendify-local")},{label:(0,a.__)("List …","extendify-local"),onClickText:(0,a.__)("Write a list of","extendify-local")}];return(0,e.createElement)(t.MenuGroup,null,r.map((({label:r,onClickText:o})=>(0,e.createElement)(t.MenuItem,{key:r,onClick:()=>(i(`${o} `),void s(!1)),disabled:n,icon:p,iconPosition:"left"},r))))},g=(0,r.forwardRef)((function({icon:e,size:t=24,...n},i){return(0,r.cloneElement)(e,{width:t,height:t,...n,ref:i})})),y=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4zm.8-4l.7.7 2-2V12h1V9.2l2 2 .7-.7-2-2H12v-1H9.2l2-2-.7-.7-2 2V4h-1v2.8l-2-2-.7.7 2 2H4v1h2.8l-2 2z"})}),v=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M6.08 10.103h2.914L9.657 12h1.417L8.23 4H6.846L4 12h1.417l.663-1.897Zm1.463-4.137.994 2.857h-2l1.006-2.857ZM11 16H4v-1.5h7V16Zm1 0h8v-1.5h-8V16Zm-4 4H4v-1.5h4V20Zm7-1.5V20H9v-1.5h6Z"})}),x=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"m9.99609 14v-.2251l.00391.0001v6.225h1.5v-14.5h2.5v14.5h1.5v-14.5h3v-1.5h-8.50391c-2.76142 0-5 2.23858-5 5 0 2.7614 2.23858 5 5 5z"})}),w=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M4 6h12V4.5H4V6Zm16 4.5H4V9h16v1.5ZM4 15h16v-1.5H4V15Zm0 4.5h16V18H4v1.5Z"})}),b=()=>{const{getBlockInsertionPoint:e}=(0,i.useSelect)((e=>e("core/block-editor")),[]),{toggleBlockHighlight:t,showInsertionPoint:n,hideInsertionPoint:s}=(0,i.useDispatch)("core/block-editor");return{toggleHighlight:(e,{isHighlighted:n})=>{t(e[0],n)},toggleInsertionPoint:({isVisible:t})=>{if(!t)return void s();const{rootClientId:i,index:r}=e();n(i,r)}}},E=()=>{const{getSelectedBlockClientIds:e,getBlocksByClientId:t}=(0,i.useSelect)((e=>e(c.store)),[]),n=e();return{selectedText:(0,r.useCallback)((()=>t(n).map((({attributes:e})=>e.content)).join("\n\n")),[t,n])()}},S=((0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M8.79508 15.8769L4.62508 11.7069L3.20508 13.1169L8.79508 18.7069L20.7951 6.70687L19.3851 5.29688L8.79508 15.8769Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M14 17H4V19H14V17ZM20 9H4V11H20V9ZM4 15H20V13H4V15ZM4 5V7H20V5H4Z"})),(0,e.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M17.0909 9.81818L18 7.81818L20 6.90909L18 6L17.0909 4L16.1818 6L14.1818 6.90909L16.1818 7.81818L17.0909 9.81818Z",fill:"currentColor"}),(0,e.createElement)("path",{d:"M17.0909 14.1818L16.1818 16.1818L14.1818 17.0909L16.1818 18L17.0909 20L18 18L20 17.0909L18 16.1818L17.0909 14.1818Z",fill:"currentColor"}),(0,e.createElement)("path",{d:"M11.6364 10.1818L9.81818 6.18182L8 10.1818L4 12L8 13.8182L9.81818 17.8182L11.6364 13.8182L15.6364 12L11.6364 10.1818ZM10.5382 12.72L9.81818 14.3055L9.09818 12.72L7.51273 12L9.09818 11.28L9.81818 9.69455L10.5382 11.28L12.1236 12L10.5382 12.72Z",fill:"currentColor"}))),P=((0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M12 14.5C13.66 14.5 15 13.16 15 11.5V5.5C15 3.84 13.66 2.5 12 2.5C10.34 2.5 9 3.84 9 5.5V11.5C9 13.16 10.34 14.5 12 14.5Z"}),(0,e.createElement)("path",{d:"M17 11.5C17 14.26 14.76 16.5 12 16.5C9.24 16.5 7 14.26 7 11.5H5C5 15.03 7.61 17.93 11 18.42V21.5H13V18.42C16.39 17.93 19 15.03 19 11.5H17Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M2.99902 21.0025H6.74902L17.809 9.9425L14.059 6.1925L2.99902 17.2525V21.0025ZM4.99902 18.0825L14.059 9.0225L14.979 9.9425L5.91902 19.0025H4.99902V18.0825Z"}),(0,e.createElement)("path",{d:"M18.369 3.2925C17.979 2.9025 17.349 2.9025 16.959 3.2925L15.129 5.1225L18.879 8.8725L20.709 7.0425C21.099 6.6525 21.099 6.0225 20.709 5.6325L18.369 3.2925Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M4 9H20V11H4V9ZM4 13H14V15H4V13Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M19.5005 7.5L20.4405 5.44L22.5005 4.5L20.4405 3.56L19.5005 1.5L18.5605 3.56L16.5005 4.5L18.5605 5.44L19.5005 7.5Z"}),(0,e.createElement)("path",{d:"M8.00055 7.5L8.94055 5.44L11.0005 4.5L8.94055 3.56L8.00055 1.5L7.06055 3.56L5.00055 4.5L7.06055 5.44L8.00055 7.5Z"}),(0,e.createElement)("path",{d:"M19.5005 13L18.5605 15.06L16.5005 16L18.5605 16.94L19.5005 19L20.4405 16.94L22.5005 16L20.4405 15.06L19.5005 13Z"}),(0,e.createElement)("path",{d:"M17.2105 9.62L14.3805 6.79C14.1805 6.6 13.9305 6.5 13.6705 6.5C13.4105 6.5 13.1605 6.6 12.9605 6.79L1.79055 17.96C1.40055 18.35 1.40055 18.98 1.79055 19.37L4.62055 22.2C4.82055 22.4 5.07055 22.5 5.33055 22.5C5.59055 22.5 5.84055 22.4 6.04055 22.21L17.2105 11.04C17.6005 10.65 17.6005 10.01 17.2105 9.62ZM13.6705 8.92L15.0805 10.33L13.9105 11.5L12.5005 10.09L13.6705 8.92ZM5.33055 20.09L3.92055 18.68L11.0905 11.5L12.5005 12.91L5.33055 20.09Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M3.5,10.5C3.5,12.95 5.26,14.97 7.58,15.41L6.09,13.92L7.5,12.5L11.5,16.51L7.5,20.5L6.09,19.09L7.67,17.51L7.67,17.45C4.2,17.04 1.5,14.08 1.5,10.5C1.5,6.63 4.63,3.5 8.5,3.5L11.5,3.5L11.5,5.5L8.5,5.5C5.74,5.5 3.5,7.74 3.5,10.5Z"}),(0,e.createElement)("path",{d:"M22.5,10.5L22.5,3.5L13.5,3.5L13.5,10.5L22.5,10.5ZM20.5,8.5L15.5,8.5L15.5,5.5L20.5,5.5L20.5,8.5Z"}),(0,e.createElement)("rect",{x:"13.5",y:"12.5",width:"9",height:"7"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M18.6 19.5008H21V21.5008H15V15.5008H17V18.2308C18.83 16.7608 20 14.5208 20 12.0008C20 7.93078 16.94 4.56078 13 4.07078V2.05078C18.05 2.55078 22 6.81078 22 12.0008C22 14.9908 20.68 17.6708 18.6 19.5008ZM4 12.0008C4 9.48078 5.17 7.23078 7 5.77078V8.50078H9V2.50078H3V4.50078H5.4C3.32 6.33078 2 9.01078 2 12.0008C2 17.1908 5.95 21.4508 11 21.9508V19.9308C7.06 19.4408 4 16.0708 4 12.0008ZM16.24 8.11078L10.58 13.7708L7.75 10.9408L6.34 12.3508L10.58 16.5908L17.65 9.52078L16.24 8.11078Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M12 6V2L7 7L12 12V8C15.31 8 18 10.69 18 14C18 17.31 15.31 20 12 20C8.69 20 6 17.31 6 14H4C4 18.42 7.58 22 12 22C16.42 22 20 18.42 20 14C20 9.58 16.42 6 12 6Z"})),(0,e.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{d:"M16 9V19H8V9H16ZM14.5 3H9.5L8.5 4H5V6H19V4H15.5L14.5 3ZM18 7H6V19C6 20.1 6.9 21 8 21H16C17.1 21 18 20.1 18 19V7Z"})),(0,e.createElement)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24"},(0,e.createElement)(t.Path,{d:"M4 10.5h16V9H4v1.5ZM4 15h9v-1.5H4V15Z"}))),T=({disabled:n,setPrompt:s})=>{const{toggleHighlight:o}=b(),{selectedText:l}=E(),c=(0,i.useSelect)((e=>e("core/block-editor").getSelectedBlockClientIds()),[]);(0,r.useEffect)((()=>()=>{o(c,{isHighlighted:!1})}),[c,o]);const u=[{label:(0,a.__)("Improve writing","extendify-local"),promptType:"improve-writing",systemMessageKey:"edit",icon:(0,e.createElement)(g,{icon:y})},{label:(0,a.__)("Fix spelling & grammar","extendify-local"),promptType:"fix-spelling-grammar",icon:(0,e.createElement)(g,{icon:v})},{label:(0,a.__)("Simplify language","extendify-local"),promptType:"simplify-language",icon:(0,e.createElement)(g,{icon:x})},{label:(0,a.__)("Make shorter","extendify-local"),promptType:"make-shorter",icon:(0,e.createElement)(g,{icon:P})},{label:(0,a.__)("Make longer","extendify-local"),promptType:"make-longer",icon:(0,e.createElement)(g,{icon:w})}];return(0,e.createElement)(t.MenuGroup,null,u.map((({label:i,promptType:r,icon:a})=>(0,e.createElement)(t.MenuItem,{key:`${r}-${r}-edit`,onClick:()=>(e=>{s({text:l,promptType:e,systemMessageKey:"edit"})})(r),onMouseEnter:()=>o(c,{isHighlighted:!0}),onMouseLeave:()=>o(c,{isHighlighted:!1}),icon:a,iconPosition:"left",disabled:n,className:"group"},(0,e.createElement)("span",{className:"whitespace-normal text-left"},i)))))},C=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})});var _=n(967),k=n.n(_);const A=(0,e.createContext)(null);function V(t){const n=(0,e.useRef)(null);return null===n.current&&(n.current=t()),n.current}const L=(0,e.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class M extends e.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function D({children:t,isPresent:n}){const i=(0,e.useId)(),s=(0,e.useRef)(null),r=(0,e.useRef)({width:0,height:0,top:0,left:0}),{nonce:o}=(0,e.useContext)(L);return(0,e.useInsertionEffect)((()=>{const{width:e,height:t,top:a,left:l}=r.current;if(n||!s.current||!e||!t)return;s.current.dataset.motionPopId=i;const c=document.createElement("style");return o&&(c.nonce=o),document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`\n [data-motion-pop-id="${i}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${t}px !important;\n top: ${a}px !important;\n left: ${l}px !important;\n }\n `),()=>{document.head.removeChild(c)}}),[n]),(0,m.jsx)(M,{isPresent:n,childRef:s,sizeRef:r,children:e.cloneElement(t,{ref:s})})}const R=({children:t,initial:n,isPresent:i,onExitComplete:s,custom:r,presenceAffectsLayout:o,mode:a})=>{const l=V(I),c=(0,e.useId)(),u=(0,e.useMemo)((()=>({id:c,initial:n,isPresent:i,custom:r,onExitComplete:e=>{l.set(e,!0);for(const e of l.values())if(!e)return;s&&s()},register:e=>(l.set(e,!1),()=>l.delete(e))})),o?[Math.random()]:[i]);return(0,e.useMemo)((()=>{l.forEach(((e,t)=>l.set(t,!1)))}),[i]),e.useEffect((()=>{!i&&!l.size&&s&&s()}),[i]),"popLayout"===a&&(t=(0,m.jsx)(D,{isPresent:i,children:t})),(0,m.jsx)(A.Provider,{value:u,children:t})};function I(){return new Map}const B=(0,e.createContext)({}),j=e=>e;let O=j,F=j;const N=e=>e.key||"";function H(t){const n=[];return e.Children.forEach(t,(t=>{(0,e.isValidElement)(t)&&n.push(t)})),n}const U="undefined"!=typeof window,z=U?e.useLayoutEffect:e.useEffect,$=({children:t,exitBeforeEnter:n,custom:i,initial:s=!0,onExitComplete:r,presenceAffectsLayout:o=!0,mode:a="sync"})=>{F(!n,"Replace exitBeforeEnter with mode='wait'");const l=(0,e.useMemo)((()=>H(t)),[t]),c=l.map(N),u=(0,e.useRef)(!0),d=(0,e.useRef)(l),h=V((()=>new Map)),[p,f]=(0,e.useState)(l),[g,y]=(0,e.useState)(l);z((()=>{u.current=!1,d.current=l;for(let e=0;e<g.length;e++){const t=N(g[e]);c.includes(t)?h.delete(t):!0!==h.get(t)&&h.set(t,!1)}}),[g,c.length,c.join("-")]);const v=[];if(l!==p){let e=[...l];for(let t=0;t<g.length;t++){const n=g[t],i=N(n);c.includes(i)||(e.splice(t,0,n),v.push(n))}return"wait"===a&&v.length&&(e=v),y(H(e)),void f(l)}const{forceRender:x}=(0,e.useContext)(B);return(0,m.jsx)(m.Fragment,{children:g.map((e=>{const t=N(e),n=l===g||c.includes(t);return(0,m.jsx)(R,{isPresent:n,initial:!(u.current&&!s)&&void 0,custom:n?void 0:i,presenceAffectsLayout:o,mode:a,onExitComplete:n?void 0:()=>{if(!h.has(t))return;h.set(t,!0);let e=!0;h.forEach((t=>{t||(e=!1)})),e&&(null==x||x(),y(d.current),r&&r())},children:e},t)}))})},G=(0,e.createContext)({}),W=(0,e.createContext)({strict:!1}),Z=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),K="data-"+Z("framerAppearId"),q=["read","resolveKeyframes","update","preRender","render","postRender"];function Y(e,t){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=q.reduce(((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,i=!1,s=!1;const r=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(t){r.has(t)&&(l.schedule(t),e()),t(o)}const l={schedule:(e,s=!1,o=!1)=>{const a=o&&i?t:n;return s&&r.add(e),a.has(e)||a.add(e),e},cancel:e=>{n.delete(e),r.delete(e)},process:e=>{o=e,i?s=!0:(i=!0,[t,n]=[n,t],n.clear(),t.forEach(a),i=!1,s&&(s=!1,l.process(e)))}};return l}(r),e)),{}),{read:a,resolveKeyframes:l,update:c,preRender:u,render:d,postRender:h}=o,m=()=>{const r=performance.now();n=!1,s.delta=i?1e3/60:Math.max(Math.min(r-s.timestamp,40),1),s.timestamp=r,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),s.isProcessing=!1,n&&t&&(i=!1,e(m))};return{schedule:q.reduce(((t,r)=>{const a=o[r];return t[r]=(t,r=!1,o=!1)=>(n||(n=!0,i=!0,s.isProcessing||e(m)),a.schedule(t,r,o)),t}),{}),cancel:e=>{for(let t=0;t<q.length;t++)o[q[t]].cancel(e)},state:s,steps:o}}const{schedule:X,cancel:J}=Y(queueMicrotask,!1);function Q(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}const ee=(0,e.createContext)({});let te=!1;function ne(t,n,i,s,r){const{visualElement:o}=(0,e.useContext)(G),a=(0,e.useContext)(W),l=(0,e.useContext)(A),c=(0,e.useContext)(L).reducedMotion,u=(0,e.useRef)();s=s||a.renderer,!u.current&&s&&(u.current=s(t,{visualState:n,parent:o,props:i,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c}));const d=u.current,h=(0,e.useContext)(ee);!d||d.projection||!r||"html"!==d.type&&"svg"!==d.type||function(e,t,n,i){const{layoutId:s,layout:r,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:se(e.parent)),e.projection.setOptions({layoutId:s,layout:r,alwaysMeasureLayout:Boolean(o)||a&&Q(a),visualElement:e,animationType:"string"==typeof r?r:"both",initialPromotionConfig:i,layoutScroll:l,layoutRoot:c})}(u.current,i,r,h),(0,e.useInsertionEffect)((()=>{d&&d.update(i,l)}));const m=(0,e.useRef)(Boolean(i[K]&&!window.HandoffComplete));return z((()=>{d&&(d.updateFeatures(),X.render(d.render),m.current&&d.animationState&&d.animationState.animateChanges())})),(0,e.useEffect)((()=>{d&&(!m.current&&d.animationState&&d.animationState.animateChanges(),m.current&&(m.current=!1,te||(te=!0,queueMicrotask(ie))))})),d}function ie(){window.HandoffComplete=!0}function se(e){if(e)return!1!==e.options.allowProjection?e.projection:se(e.parent)}function re(t,n,i){return(0,e.useCallback)((e=>{e&&t.mount&&t.mount(e),n&&(e?n.mount(e):n.unmount()),i&&("function"==typeof i?i(e):Q(i)&&(i.current=e))}),[n])}function oe(e){return"string"==typeof e||Array.isArray(e)}function ae(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}const le=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ce=["initial",...le];function ue(e){return ae(e.animate)||ce.some((t=>oe(e[t])))}function de(e){return Boolean(ue(e)||e.variants)}function he(e){return Array.isArray(e)?e.join(" "):e}const me={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},pe={};for(const e in me)pe[e]={isEnabled:t=>me[e].some((e=>!!t[e]))};const fe=Symbol.for("motionComponentSymbol");function ge({preloadedFeatures:t,createVisualElement:n,useRender:i,useVisualState:s,Component:r}){t&&function(e){for(const t in e)pe[t]={...pe[t],...e[t]}}(t);const o=(0,e.forwardRef)((function(t,o){let a;const l={...(0,e.useContext)(L),...t,layoutId:ye(t)},{isStatic:c}=l,u=function(t){const{initial:n,animate:i}=function(e,t){if(ue(e)){const{initial:t,animate:n}=e;return{initial:!1===t||oe(t)?t:void 0,animate:oe(n)?n:void 0}}return!1!==e.inherit?t:{}}(t,(0,e.useContext)(G));return(0,e.useMemo)((()=>({initial:n,animate:i})),[he(n),he(i)])}(t),d=s(t,c);if(!c&&U){(0,e.useContext)(W).strict;const t=function(e){const{drag:t,layout:n}=pe;if(!t&&!n)return{};const i={...t,...n};return{MeasureLayout:(null==t?void 0:t.isEnabled(e))||(null==n?void 0:n.isEnabled(e))?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(l);a=t.MeasureLayout,u.visualElement=ne(r,d,l,n,t.ProjectionNode)}return(0,m.jsxs)(G.Provider,{value:u,children:[a&&u.visualElement?(0,m.jsx)(a,{visualElement:u.visualElement,...l}):null,i(r,t,re(d,u.visualElement,o),d,c,u.visualElement)]})}));return o[fe]=r,o}function ye({layoutId:t}){const n=(0,e.useContext)(B).id;return n&&void 0!==t?n+"-"+t:t}function ve(e){function t(t,n={}){return ge(e(t,n))}if("undefined"==typeof Proxy)return t;const n=new Map;return new Proxy(t,{get:(e,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const xe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function we(e){return"string"==typeof e&&!e.includes("-")&&!!(xe.indexOf(e)>-1||/[A-Z]/u.test(e))}const be={},Ee=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Se=new Set(Ee);function Pe(e,{layout:t,layoutId:n}){return Se.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!be[e]||"opacity"===e)}const Te=e=>Boolean(e&&e.getVelocity),Ce=(e,t)=>t&&"number"==typeof e?t.transform(e):e,_e=(e,t,n)=>n>t?t:n<e?e:n,ke={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},Ae={...ke,transform:e=>_e(0,1,e)},Ve={...ke,default:1},Le=e=>Math.round(1e5*e)/1e5,Me=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,De=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,Re=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function Ie(e){return"string"==typeof e}const Be=e=>({test:t=>Ie(t)&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),je=Be("deg"),Oe=Be("%"),Fe=Be("px"),Ne=Be("vh"),He=Be("vw"),Ue={...Oe,parse:e=>Oe.parse(e)/100,transform:e=>Oe.transform(100*e)},ze={...ke,transform:Math.round},$e={borderWidth:Fe,borderTopWidth:Fe,borderRightWidth:Fe,borderBottomWidth:Fe,borderLeftWidth:Fe,borderRadius:Fe,radius:Fe,borderTopLeftRadius:Fe,borderTopRightRadius:Fe,borderBottomRightRadius:Fe,borderBottomLeftRadius:Fe,width:Fe,maxWidth:Fe,height:Fe,maxHeight:Fe,size:Fe,top:Fe,right:Fe,bottom:Fe,left:Fe,padding:Fe,paddingTop:Fe,paddingRight:Fe,paddingBottom:Fe,paddingLeft:Fe,margin:Fe,marginTop:Fe,marginRight:Fe,marginBottom:Fe,marginLeft:Fe,rotate:je,rotateX:je,rotateY:je,rotateZ:je,scale:Ve,scaleX:Ve,scaleY:Ve,scaleZ:Ve,skew:je,skewX:je,skewY:je,distance:Fe,translateX:Fe,translateY:Fe,translateZ:Fe,x:Fe,y:Fe,z:Fe,perspective:Fe,transformPerspective:Fe,opacity:Ae,originX:Ue,originY:Ue,originZ:Fe,zIndex:ze,backgroundPositionX:Fe,backgroundPositionY:Fe,fillOpacity:Ae,strokeOpacity:Ae,numOctaves:ze},Ge={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},We=Ee.length,Ze=e=>t=>"string"==typeof t&&t.startsWith(e),Ke=Ze("--"),qe=Ze("var(--"),Ye=e=>!!qe(e)&&Xe.test(e.split("/*")[0].trim()),Xe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Je(e,t,n){const{style:i,vars:s,transformOrigin:r}=e;let o=!1,a=!1;for(const e in t){const n=t[e];if(Se.has(e))o=!0;else if(Ke(e))s[e]=n;else{const t=Ce(n,$e[e]);e.startsWith("origin")?(a=!0,r[e]=t):i[e]=t}}if(t.transform||(o||n?i.transform=function(e,t,n){let i="",s=!0;for(let r=0;r<We;r++){const o=Ee[r],a=e[o];if(void 0===a)continue;let l=!0;if(l="number"==typeof a?a===(o.startsWith("scale")?1:0):0===parseFloat(a),!l||n){const e=Ce(a,$e[o]);l||(s=!1,i+=`${Ge[o]||o}(${e}) `),n&&(t[o]=e)}}return i=i.trim(),n?i=n(t,s?"":i):s&&(i="none"),i}(t,e.transform,n):i.transform&&(i.transform="none")),a){const{originX:e="50%",originY:t="50%",originZ:n=0}=r;i.transformOrigin=`${e} ${t} ${n}`}}const Qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function et(e,t,n){for(const i in t)Te(t[i])||Pe(i,n)||(e[i]=t[i])}function tt(t,n){const i={},s=function(t,n){const i={};return et(i,t.style||{},t),Object.assign(i,function({transformTemplate:t},n){return(0,e.useMemo)((()=>{const e=Qe();return Je(e,n,t),Object.assign({},e.vars,e.style)}),[n])}(t,n)),i}(t,n);return t.drag&&!1!==t.dragListener&&(i.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),void 0===t.tabIndex&&(t.onTap||t.onTapStart||t.whileTap)&&(i.tabIndex=0),i.style=s,i}const nt=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function it(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||nt.has(e)}let st=e=>!it(e);try{(rt=require("@emotion/is-prop-valid").default)&&(st=e=>e.startsWith("on")?!it(e):rt(e))}catch(e){}var rt;function ot(e,t,n){return"string"==typeof e?e:Fe.transform(t+n*e)}const at={offset:"stroke-dashoffset",array:"stroke-dasharray"},lt={offset:"strokeDashoffset",array:"strokeDasharray"};function ct(e,{attrX:t,attrY:n,attrScale:i,originX:s,originY:r,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,d){if(Je(e,c,d),u)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:h,style:m,dimensions:p}=e;h.transform&&(p&&(m.transform=h.transform),delete h.transform),p&&(void 0!==s||void 0!==r||m.transform)&&(m.transformOrigin=function(e,t,n){return`${ot(t,e.x,e.width)} ${ot(n,e.y,e.height)}`}(p,void 0!==s?s:.5,void 0!==r?r:.5)),void 0!==t&&(h.x=t),void 0!==n&&(h.y=n),void 0!==i&&(h.scale=i),void 0!==o&&function(e,t,n=1,i=0,s=!0){e.pathLength=1;const r=s?at:lt;e[r.offset]=Fe.transform(-i);const o=Fe.transform(t),a=Fe.transform(n);e[r.array]=`${o} ${a}`}(h,o,a,l,!1)}const ut=()=>({...Qe(),attrs:{}}),dt=e=>"string"==typeof e&&"svg"===e.toLowerCase();function ht(t,n,i,s){const r=(0,e.useMemo)((()=>{const e=ut();return ct(e,n,dt(s),t.transformTemplate),{...e.attrs,style:{...e.style}}}),[n]);if(t.style){const e={};et(e,t.style,t),r.style={...e,...r.style}}return r}function mt(t=!1){return(n,i,s,{latestValues:r},o)=>{const a=(we(n)?ht:tt)(i,r,o,n),l=function(e,t,n){const i={};for(const s in e)"values"===s&&"object"==typeof e.values||(st(s)||!0===n&&it(s)||!t&&!it(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}(i,"string"==typeof n,t),c=n!==e.Fragment?{...l,...a,ref:s}:{},{children:u}=i,d=(0,e.useMemo)((()=>Te(u)?u.get():u),[u]);return(0,e.createElement)(n,{...c,children:d})}}function pt(e,{style:t,vars:n},i,s){Object.assign(e.style,t,s&&s.getProjectionStyles(i));for(const t in n)e.style.setProperty(t,n[t])}const ft=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function gt(e,t,n,i){pt(e,t,void 0,i);for(const n in t.attrs)e.setAttribute(ft.has(n)?n:Z(n),t.attrs[n])}function yt(e,t,n){var i;const{style:s}=e,r={};for(const o in s)(Te(s[o])||t.style&&Te(t.style[o])||Pe(o,e)||void 0!==(null===(i=null==n?void 0:n.getValue(o))||void 0===i?void 0:i.liveStyle))&&(r[o]=s[o]);return n&&s&&"string"==typeof s.willChange&&(n.applyWillChange=!1),r}function vt(e,t,n){const i=yt(e,t,n);for(const n in e)(Te(e[n])||Te(t[n]))&&(i[-1!==Ee.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]);return i}function xt(e){const t=[{},{}];return null==e||e.values.forEach(((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()})),t}function wt(e,t,n,i){if("function"==typeof t){const[s,r]=xt(i);t=t(void 0!==n?n:e.custom,s,r)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){const[s,r]=xt(i);t=t(void 0!==n?n:e.custom,s,r)}return t}const bt=e=>Array.isArray(e),Et=e=>Boolean(e&&"object"==typeof e&&e.mix&&e.toValue),St=e=>bt(e)?e[e.length-1]||0:e;function Pt(e){const t=Te(e)?e.get():e;return Et(t)?t.toValue():t}const Tt=new Set(["opacity","clipPath","filter","transform"]);function Ct(e){return Se.has(e)?"transform":Tt.has(e)?Z(e):void 0}function _t(e,t){-1===e.indexOf(t)&&e.push(t)}function kt(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const At=t=>(n,i)=>{const s=(0,e.useContext)(G),r=(0,e.useContext)(A),o=()=>function({applyWillChange:e=!1,scrapeMotionValuesFromProps:t,createRenderState:n,onMount:i},s,r,o,a){const l={latestValues:Mt(s,r,o,!a&&e,t),renderState:n()};return i&&(l.mount=e=>i(s,e,l)),l}(t,n,s,r,i);return i?o():V(o)};function Vt(e,t){const n=Ct(t);n&&_t(e,n)}function Lt(e,t,n){const i=Array.isArray(t)?t:[t];for(let t=0;t<i.length;t++){const s=wt(e,i[t]);if(s){const{transitionEnd:e,transition:t,...i}=s;n(i,e)}}}function Mt(e,t,n,i,s){var r;const o={},a=[],l=i&&void 0===(null===(r=e.style)||void 0===r?void 0:r.willChange),c=s(e,{});for(const e in c)o[e]=Pt(c[e]);let{initial:u,animate:d}=e;const h=ue(e),m=de(e);t&&m&&!h&&!1!==e.inherit&&(void 0===u&&(u=t.initial),void 0===d&&(d=t.animate));let p=!!n&&!1===n.initial;p=p||!1===u;const f=p?d:u;return f&&"boolean"!=typeof f&&!ae(f)&&Lt(e,f,((e,t)=>{for(const t in e){let n=e[t];Array.isArray(n)&&(n=n[p?n.length-1:0]),null!==n&&(o[t]=n)}for(const e in t)o[e]=t[e]})),l&&(d&&!1!==u&&!ae(d)&&Lt(e,d,(e=>{for(const t in e)Vt(a,t)})),a.length&&(o.willChange=a.join(","))),o}const{schedule:Dt,cancel:Rt,state:It,steps:Bt}=Y("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:j,!0),jt={useVisualState:At({scrapeMotionValuesFromProps:vt,createRenderState:ut,onMount:(e,t,{renderState:n,latestValues:i})=>{Dt.read((()=>{try{n.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch(e){n.dimensions={x:0,y:0,width:0,height:0}}})),Dt.render((()=>{ct(n,i,dt(t.tagName),e.transformTemplate),gt(t,n)}))}})},Ot={useVisualState:At({applyWillChange:!0,scrapeMotionValuesFromProps:yt,createRenderState:Qe})};function Ft(e,t,n,i={passive:!0}){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}const Nt=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function Ht(e,t="page"){return{point:{x:e[`${t}X`],y:e[`${t}Y`]}}}const Ut=e=>t=>Nt(t)&&e(t,Ht(t));function zt(e,t,n,i){return Ft(e,t,Ut(n),i)}const $t=(e,t)=>n=>t(e(n)),Gt=(...e)=>e.reduce($t);function Wt(e){let t=null;return()=>null===t&&(t=e,()=>{t=null})}const Zt=Wt("dragHorizontal"),Kt=Wt("dragVertical");function qt(e){let t=!1;if("y"===e)t=Kt();else if("x"===e)t=Zt();else{const e=Zt(),n=Kt();e&&n?t=()=>{e(),n()}:(e&&e(),n&&n())}return t}function Yt(){const e=qt(!0);return!e||(e(),!1)}class Xt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Jt(e,t){const n=t?"pointerenter":"pointerleave",i=t?"onHoverStart":"onHoverEnd";return zt(e.current,n,((n,s)=>{if("touch"===n.pointerType||Yt())return;const r=e.getProps();e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",t);const o=r[i];o&&Dt.postRender((()=>o(n,s)))}),{passive:!e.getProps()[i]})}const Qt=(e,t)=>!!t&&(e===t||Qt(e,t.parentElement));function en(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,Ht(n))}const tn=new WeakMap,nn=new WeakMap,sn=e=>{const t=tn.get(e.target);t&&t(e)},rn=e=>{e.forEach(sn)};const on={some:0,all:1},an={inView:{Feature:class extends Xt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:i="some",once:s}=e,r={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof i?i:on[i]};return function(e,t,n){const i=function({root:e,...t}){const n=e||document;nn.has(n)||nn.set(n,{});const i=nn.get(n),s=JSON.stringify(t);return i[s]||(i[s]=new IntersectionObserver(rn,{root:e,...t})),i[s]}(t);return tn.set(e,n),i.observe(e),()=>{tn.delete(e),i.unobserve(e)}}(this.node.current,r,(e=>{const{isIntersecting:t}=e;if(this.isInView===t)return;if(this.isInView=t,s&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:n,onViewportLeave:i}=this.node.getProps(),r=t?n:i;r&&r(e)}))}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Xt{constructor(){super(...arguments),this.removeStartListeners=j,this.removeEndListeners=j,this.removeAccessibleListeners=j,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const n=this.node.getProps(),i=zt(window,"pointerup",((e,t)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:i,globalTapTarget:s}=this.node.getProps(),r=s||Qt(this.node.current,e.target)?n:i;r&&Dt.update((()=>r(e,t)))}),{passive:!(n.onTap||n.onPointerUp)}),s=zt(window,"pointercancel",((e,t)=>this.cancelPress(e,t)),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=Gt(i,s),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=Ft(this.node.current,"keydown",(e=>{"Enter"!==e.key||this.isPressing||(this.removeEndListeners(),this.removeEndListeners=Ft(this.node.current,"keyup",(e=>{"Enter"===e.key&&this.checkPressEnd()&&en("up",((e,t)=>{const{onTap:n}=this.node.getProps();n&&Dt.postRender((()=>n(e,t)))}))})),en("down",((e,t)=>{this.startPress(e,t)})))})),t=Ft(this.node.current,"blur",(()=>{this.isPressing&&en("cancel",((e,t)=>this.cancelPress(e,t)))}));this.removeAccessibleListeners=Gt(e,t)}}startPress(e,t){this.isPressing=!0;const{onTapStart:n,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),n&&Dt.postRender((()=>n(e,t)))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Yt()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&Dt.postRender((()=>n(e,t)))}mount(){const e=this.node.getProps(),t=zt(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),n=Ft(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=Gt(t,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Xt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Gt(Ft(this.node.current,"focus",(()=>this.onFocus())),Ft(this.node.current,"blur",(()=>this.onBlur())))}unmount(){}}},hover:{Feature:class extends Xt{mount(){this.unmount=Gt(Jt(this.node,!0),Jt(this.node,!1))}unmount(){}}}};function ln(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i<n;i++)if(t[i]!==e[i])return!1;return!0}function cn(e,t,n){const i=e.getProps();return wt(i,t,void 0!==n?n:i.custom,e)}const un=e=>1e3*e,dn=e=>e/1e3,hn={type:"spring",stiffness:500,damping:25,restSpeed:10},mn={type:"keyframes",duration:.8},pn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},fn=(e,{keyframes:t})=>t.length>2?mn:Se.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:hn:pn;function gn(e,t){return e[t]||e.default||e}const yn=e=>null!==e;function vn(e,{repeat:t,repeatType:n="loop"},i){const s=e.filter(yn),r=t&&"loop"!==n&&t%2==1?0:s.length-1;return r&&void 0!==i?i:s[r]}let xn;function wn(){xn=void 0}const bn={now:()=>(void 0===xn&&bn.set(It.isProcessing?It.timestamp:performance.now()),xn),set:e=>{xn=e,queueMicrotask(wn)}},En=e=>/^0[^.\s]+$/u.test(e),Sn=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Pn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Tn(e,t,n=1){F(n<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);const[i,s]=function(e){const t=Pn.exec(e);if(!t)return[,];const[,n,i,s]=t;return[`--${null!=n?n:i}`,s]}(e);if(!i)return;const r=window.getComputedStyle(t).getPropertyValue(i);if(r){const e=r.trim();return Sn(e)?parseFloat(e):e}return Ye(s)?Tn(s,t,n+1):s}const Cn=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),kn=e=>e===ke||e===Fe,An=(e,t)=>parseFloat(e.split(", ")[t]),Vn=(e,t)=>(n,{transform:i})=>{if("none"===i||!i)return 0;const s=i.match(/^matrix3d\((.+)\)$/u);if(s)return An(s[1],t);{const t=i.match(/^matrix\((.+)\)$/u);return t?An(t[1],e):0}},Ln=new Set(["x","y","z"]),Mn=Ee.filter((e=>!Ln.has(e))),Dn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Vn(4,13),y:Vn(5,14)};Dn.translateX=Dn.x,Dn.translateY=Dn.y;const Rn=e=>t=>t.test(e),In=[ke,Fe,Oe,je,He,Ne,{test:e=>"auto"===e,parse:e=>e}],Bn=e=>In.find(Rn(e)),jn=new Set;let On=!1,Fn=!1;function Nn(){if(Fn){const e=Array.from(jn).filter((e=>e.needsMeasurement)),t=new Set(e.map((e=>e.element))),n=new Map;t.forEach((e=>{const t=function(e){const t=[];return Mn.forEach((n=>{const i=e.getValue(n);void 0!==i&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))})),t}(e);t.length&&(n.set(e,t),e.render())})),e.forEach((e=>e.measureInitialState())),t.forEach((e=>{e.render();const t=n.get(e);t&&t.forEach((([t,n])=>{var i;null===(i=e.getValue(t))||void 0===i||i.set(n)}))})),e.forEach((e=>e.measureEndState())),e.forEach((e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)}))}Fn=!1,On=!1,jn.forEach((e=>e.complete())),jn.clear()}function Hn(){jn.forEach((e=>{e.readKeyframes(),e.needsMeasurement&&(Fn=!0)}))}class Un{constructor(e,t,n,i,s,r=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=i,this.element=s,this.isAsync=r}scheduleResolve(){this.isScheduled=!0,this.isAsync?(jn.add(this),On||(On=!0,Dt.read(Hn),Dt.resolveKeyframes(Nn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:i}=this;for(let s=0;s<e.length;s++)if(null===e[s])if(0===s){const s=null==i?void 0:i.get(),r=e[e.length-1];if(void 0!==s)e[0]=s;else if(n&&t){const i=n.readValue(t,r);null!=i&&(e[0]=i)}void 0===e[0]&&(e[0]=r),i&&void 0===s&&i.set(e[0])}else e[s]=e[s-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),jn.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,jn.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const zn=(e,t)=>n=>Boolean(Ie(n)&&Re.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),$n=(e,t,n)=>i=>{if(!Ie(i))return i;const[s,r,o,a]=i.match(Me);return{[e]:parseFloat(s),[t]:parseFloat(r),[n]:parseFloat(o),alpha:void 0!==a?parseFloat(a):1}},Gn={...ke,transform:e=>Math.round((e=>_e(0,255,e))(e))},Wn={test:zn("rgb","red"),parse:$n("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:i=1})=>"rgba("+Gn.transform(e)+", "+Gn.transform(t)+", "+Gn.transform(n)+", "+Le(Ae.transform(i))+")"},Zn={test:zn("#"),parse:function(e){let t="",n="",i="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,i+=i,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}},transform:Wn.transform},Kn={test:zn("hsl","hue"),parse:$n("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:i=1})=>"hsla("+Math.round(e)+", "+Oe.transform(Le(t))+", "+Oe.transform(Le(n))+", "+Le(Ae.transform(i))+")"},qn={test:e=>Wn.test(e)||Zn.test(e)||Kn.test(e),parse:e=>Wn.test(e)?Wn.parse(e):Kn.test(e)?Kn.parse(e):Zn.parse(e),transform:e=>Ie(e)?e:e.hasOwnProperty("red")?Wn.transform(e):Kn.transform(e)},Yn="number",Xn="color",Jn="var",Qn="var(",ei="${}",ti=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ni(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[];let r=0;const o=t.replace(ti,(e=>(qn.test(e)?(i.color.push(r),s.push(Xn),n.push(qn.parse(e))):e.startsWith(Qn)?(i.var.push(r),s.push(Jn),n.push(e)):(i.number.push(r),s.push(Yn),n.push(parseFloat(e))),++r,ei))).split(ei);return{values:n,split:o,indexes:i,types:s}}function ii(e){return ni(e).values}function si(e){const{split:t,types:n}=ni(e),i=t.length;return e=>{let s="";for(let r=0;r<i;r++)if(s+=t[r],void 0!==e[r]){const t=n[r];s+=t===Yn?Le(e[r]):t===Xn?qn.transform(e[r]):e[r]}return s}}const ri=e=>"number"==typeof e?0:e,oi={test:function(e){var t,n;return isNaN(e)&&Ie(e)&&((null===(t=e.match(Me))||void 0===t?void 0:t.length)||0)+((null===(n=e.match(De))||void 0===n?void 0:n.length)||0)>0},parse:ii,createTransformer:si,getAnimatableNone:function(e){const t=ii(e);return si(e)(t.map(ri))}},ai=new Set(["brightness","contrast","saturate","opacity"]);function li(e){const[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[i]=n.match(Me)||[];if(!i)return e;const s=n.replace(i,"");let r=ai.has(t)?1:0;return i!==n&&(r*=100),t+"("+r+s+")"}const ci=/\b([a-z-]*)\(.*?\)/gu,ui={...oi,getAnimatableNone:e=>{const t=e.match(ci);return t?t.map(li).join(" "):e}},di={...$e,color:qn,backgroundColor:qn,outlineColor:qn,fill:qn,stroke:qn,borderColor:qn,borderTopColor:qn,borderRightColor:qn,borderBottomColor:qn,borderLeftColor:qn,filter:ui,WebkitFilter:ui},hi=e=>di[e];function mi(e,t){let n=hi(e);return n!==ui&&(n=oi),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const pi=new Set(["auto","none","0"]);class fi extends Un{constructor(e,t,n,i){super(e,t,n,i,null==i?void 0:i.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let i=e[n];if("string"==typeof i&&(i=i.trim(),Ye(i))){const s=Tn(i,t.current);void 0!==s&&(e[n]=s),n===e.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Cn.has(n)||2!==e.length)return;const[i,s]=e,r=Bn(i),o=Bn(s);if(r!==o)if(kn(r)&&kn(o))for(let t=0;t<e.length;t++){const n=e[t];"string"==typeof n&&(e[t]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)("number"==typeof(i=e[t])?0===i:null===i||"none"===i||"0"===i||En(i))&&n.push(t);var i;n.length&&function(e,t,n){let i,s=0;for(;s<e.length&&!i;){const t=e[s];"string"==typeof t&&!pi.has(t)&&ni(t).values.length&&(i=e[s]),s++}if(i&&n)for(const s of t)e[s]=mi(n,i)}(e,n,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:n}=this;if(!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Dn[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const i=t[t.length-1];void 0!==i&&e.getValue(n,i).jump(i,!1)}measureEndState(){var e;const{element:t,name:n,unresolvedKeyframes:i}=this;if(!t.current)return;const s=t.getValue(n);s&&s.jump(this.measuredOrigin,!1);const r=i.length-1,o=i[r];i[r]=Dn[n](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),(null===(e=this.removedTransforms)||void 0===e?void 0:e.length)&&this.removedTransforms.forEach((([e,n])=>{t.getValue(e).set(n)})),this.resolveNoneKeyframes()}}function gi(e){let t;return()=>(void 0===t&&(t=e()),t)}const yi=(e,t)=>!("zIndex"===t||"number"!=typeof e&&!Array.isArray(e)&&("string"!=typeof e||!oi.test(e)&&"0"!==e||e.startsWith("url(")));class vi{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:t,type:n,repeat:i,repeatDelay:s,repeatType:r,...o},this.updateFinishedPromise()}get resolved(){return this._resolved||this.hasAttemptedResolve||(Hn(),Nn()),this._resolved}onKeyframesResolved(e,t){this.hasAttemptedResolve=!0;const{name:n,type:i,velocity:s,delay:r,onComplete:o,onUpdate:a,isGenerator:l}=this.options;if(!l&&!function(e,t,n,i){const s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;const r=e[e.length-1],o=yi(s,t),a=yi(r,t);return O(o===a,`You are trying to animate ${t} from "${s}" to "${r}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${r} via the \`style\` property.`),!(!o||!a)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||"spring"===n&&i)}(e,n,i,s)){if(!r)return null==a||a(vn(e,this.options,t)),null==o||o(),void this.resolveFinishedPromise();this.options.duration=0}const c=this.initPlayback(e,t);!1!==c&&(this._resolved={keyframes:e,finalKeyframe:t,...c},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}updateFinishedPromise(){this.currentFinishedPromise=new Promise((e=>{this.resolveFinishedPromise=e}))}}function xi(e,t){return t?e*(1e3/t):0}const wi=5;function bi(e,t,n){const i=Math.max(t-wi,0);return xi(n-e(i),t-i)}const Ei=.001,Si=.01,Pi=10,Ti=.05,Ci=1;const _i=12;function ki(e,t){return e*Math.sqrt(1-t*t)}const Ai=["duration","bounce"],Vi=["stiffness","damping","mass"];function Li(e,t){return t.some((t=>void 0!==e[t]))}function Mi({keyframes:e,restDelta:t,restSpeed:n,...i}){const s=e[0],r=e[e.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:u,velocity:d,isResolvedFromDuration:h}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!Li(e,Vi)&&Li(e,Ai)){const n=function({duration:e=800,bounce:t=.25,velocity:n=0,mass:i=1}){let s,r;O(e<=un(Pi),"Spring duration must be 10 seconds or less");let o=1-t;o=_e(Ti,Ci,o),e=_e(Si,Pi,dn(e)),o<1?(s=t=>{const i=t*o,s=i*e,r=i-n,a=ki(t,o),l=Math.exp(-s);return Ei-r/a*l},r=t=>{const i=t*o*e,r=i*n+n,a=Math.pow(o,2)*Math.pow(t,2)*e,l=Math.exp(-i),c=ki(Math.pow(t,2),o);return(-s(t)+Ei>0?-1:1)*((r-a)*l)/c}):(s=t=>Math.exp(-t*e)*((t-n)*e+1)-Ei,r=t=>Math.exp(-t*e)*(e*e*(n-t)));const a=function(e,t,n){let i=n;for(let n=1;n<_i;n++)i-=e(i)/t(i);return i}(s,r,5/e);if(e=un(e),isNaN(a))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(a,2)*i;return{stiffness:t,damping:2*o*Math.sqrt(i*t),duration:e}}}(e);t={...t,...n,mass:1},t.isResolvedFromDuration=!0}return t}({...i,velocity:-dn(i.velocity||0)}),m=d||0,p=l/(2*Math.sqrt(a*c)),f=r-s,g=dn(Math.sqrt(a/c)),y=Math.abs(f)<5;let v;if(n||(n=y?.01:2),t||(t=y?.005:.5),p<1){const e=ki(g,p);v=t=>{const n=Math.exp(-p*g*t);return r-n*((m+p*g*f)/e*Math.sin(e*t)+f*Math.cos(e*t))}}else if(1===p)v=e=>r-Math.exp(-g*e)*(f+(m+g*f)*e);else{const e=g*Math.sqrt(p*p-1);v=t=>{const n=Math.exp(-p*g*t),i=Math.min(e*t,300);return r-n*((m+p*g*f)*Math.sinh(i)+e*f*Math.cosh(i))/e}}return{calculatedDuration:h&&u||null,next:e=>{const i=v(e);if(h)o.done=e>=u;else{let s=m;0!==e&&(s=p<1?bi(v,e,i):0);const a=Math.abs(s)<=n,l=Math.abs(r-i)<=t;o.done=a&&l}return o.value=o.done?r:i,o}}}function Di({keyframes:e,velocity:t=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},m=e=>void 0===a?l:void 0===l||Math.abs(a-e)<Math.abs(l-e)?a:l;let p=n*t;const f=d+p,g=void 0===o?f:o(f);g!==f&&(p=g-d);const y=e=>-p*Math.exp(-e/i),v=e=>g+y(e),x=e=>{const t=y(e),n=v(e);h.done=Math.abs(t)<=c,h.value=h.done?g:n};let w,b;const E=e=>{var t;t=h.value,(void 0!==a&&t<a||void 0!==l&&t>l)&&(w=e,b=Mi({keyframes:[h.value,m(h.value)],velocity:bi(v,e,h.value),damping:s,stiffness:r,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:e=>{let t=!1;return b||void 0!==w||(t=!0,x(e),E(e)),void 0!==w&&e>=w?b.next(e-w):(!t&&x(e),h)}}}const Ri=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function Ii(e,t,n,i){if(e===t&&n===i)return j;return s=>0===s||1===s?s:Ri(function(e,t,n,i,s){let r,o,a=0;do{o=t+(n-t)/2,r=Ri(o,i,s)-e,r>0?n=o:t=o}while(Math.abs(r)>1e-7&&++a<12);return o}(s,0,1,e,n),t,i)}const Bi=Ii(.42,0,1,1),ji=Ii(0,0,.58,1),Oi=Ii(.42,0,.58,1),Fi=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ni=e=>t=>1-e(1-t),Hi=e=>1-Math.sin(Math.acos(e)),Ui=Ni(Hi),zi=Fi(Hi),$i=Ii(.33,1.53,.69,.99),Gi=Ni($i),Wi=Fi(Gi),Zi={linear:j,easeIn:Bi,easeInOut:Oi,easeOut:ji,circIn:Hi,circInOut:zi,circOut:Ui,backIn:Gi,backInOut:Wi,backOut:$i,anticipate:e=>(e*=2)<1?.5*Gi(e):.5*(2-Math.pow(2,-10*(e-1)))},Ki=e=>{if(Array.isArray(e)){F(4===e.length,"Cubic bezier arrays must contain four numerical values.");const[t,n,i,s]=e;return Ii(t,n,i,s)}return"string"==typeof e?(F(void 0!==Zi[e],`Invalid easing type '${e}'`),Zi[e]):e},qi=(e,t,n)=>{const i=t-e;return 0===i?1:(n-e)/i},Yi=(e,t,n)=>e+(t-e)*n;function Xi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Ji(e,t){return n=>n>0?t:e}const Qi=(e,t,n)=>{const i=e*e,s=n*(t*t-i)+i;return s<0?0:Math.sqrt(s)},es=[Zn,Wn,Kn];function ts(e){const t=(n=e,es.find((e=>e.test(n))));var n;if(O(Boolean(t),`'${e}' is not an animatable color. Use the equivalent color code instead.`),!Boolean(t))return!1;let i=t.parse(e);return t===Kn&&(i=function({hue:e,saturation:t,lightness:n,alpha:i}){e/=360,n/=100;let s=0,r=0,o=0;if(t/=100){const i=n<.5?n*(1+t):n+t-n*t,a=2*n-i;s=Xi(a,i,e+1/3),r=Xi(a,i,e),o=Xi(a,i,e-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:i}}(i)),i}const ns=(e,t)=>{const n=ts(e),i=ts(t);if(!n||!i)return Ji(e,t);const s={...n};return e=>(s.red=Qi(n.red,i.red,e),s.green=Qi(n.green,i.green,e),s.blue=Qi(n.blue,i.blue,e),s.alpha=Yi(n.alpha,i.alpha,e),Wn.transform(s))},is=new Set(["none","hidden"]);function ss(e,t){return n=>Yi(e,t,n)}function rs(e){return"number"==typeof e?ss:"string"==typeof e?Ye(e)?Ji:qn.test(e)?ns:ls:Array.isArray(e)?os:"object"==typeof e?qn.test(e)?ns:as:Ji}function os(e,t){const n=[...e],i=n.length,s=e.map(((e,n)=>rs(e)(e,t[n])));return e=>{for(let t=0;t<i;t++)n[t]=s[t](e);return n}}function as(e,t){const n={...e,...t},i={};for(const s in n)void 0!==e[s]&&void 0!==t[s]&&(i[s]=rs(e[s])(e[s],t[s]));return e=>{for(const t in i)n[t]=i[t](e);return n}}const ls=(e,t)=>{const n=oi.createTransformer(t),i=ni(e),s=ni(t);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?is.has(e)&&!s.values.length||is.has(t)&&!i.values.length?function(e,t){return is.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):Gt(os(function(e,t){var n;const i=[],s={color:0,var:0,number:0};for(let r=0;r<t.values.length;r++){const o=t.types[r],a=e.indexes[o][s[o]],l=null!==(n=e.values[a])&&void 0!==n?n:0;i[r]=l,s[o]++}return i}(i,s),s.values),n):(O(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),Ji(e,t))};function cs(e,t,n){return"number"==typeof e&&"number"==typeof t&&"number"==typeof n?Yi(e,t,n):rs(e)(e,t)}function us({duration:e=300,keyframes:t,times:n,ease:i="easeInOut"}){const s=(e=>Array.isArray(e)&&"number"!=typeof e[0])(i)?i.map(Ki):Ki(i),r={done:!1,value:t[0]},o=function(e,t){return e.map((e=>e*t))}(n&&n.length===t.length?n:function(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const s=qi(0,t,i);e.push(Yi(n,1,s))}}(t,e.length-1),t}(t),e),a=function(e,t,{clamp:n=!0,ease:i,mixer:s}={}){const r=e.length;if(F(r===t.length,"Both input and output ranges must be the same length"),1===r)return()=>t[0];if(2===r&&e[0]===e[1])return()=>t[1];e[0]>e[r-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=function(e,t,n){const i=[],s=n||cs,r=e.length-1;for(let n=0;n<r;n++){let r=s(e[n],e[n+1]);if(t){const e=Array.isArray(t)?t[n]||j:t;r=Gt(e,r)}i.push(r)}return i}(t,i,s),a=o.length,l=t=>{let n=0;if(a>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const i=qi(e[n],e[n+1],t);return o[n](i)};return n?t=>l(_e(e[0],e[r-1],t)):l}(o,t,{ease:Array.isArray(s)?s:(l=t,c=s,l.map((()=>c||Oi)).splice(0,l.length-1))});var l,c;return{calculatedDuration:e,next:t=>(r.value=a(t),r.done=t>=e,r)}}const ds=e=>{const t=({timestamp:t})=>e(t);return{start:()=>Dt.update(t,!0),stop:()=>Rt(t),now:()=>It.isProcessing?It.timestamp:bn.now()}},hs={decay:Di,inertia:Di,tween:us,keyframes:us,spring:Mi},ms=e=>e/100;class ps extends vi{constructor({KeyframeResolver:e=Un,...t}){super(t),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:e}=this.options;e&&e()};const{name:n,motionValue:i,keyframes:s}=this.options,r=(e,t)=>this.onKeyframesResolved(e,t);n&&i&&i.owner?this.resolver=i.owner.resolveKeyframes(s,r,n,i):this.resolver=new e(s,r,n,i),this.resolver.scheduleResolve()}initPlayback(e){const{type:t="keyframes",repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:r=0}=this.options,o=hs[t]||us;let a,l;o!==us&&"number"!=typeof e[0]&&(a=Gt(ms,cs(e[0],e[1])),e=[0,100]);const c=o({...this.options,keyframes:e});"mirror"===s&&(l=o({...this.options,keyframes:[...e].reverse(),velocity:-r})),null===c.calculatedDuration&&(c.calculatedDuration=function(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}(c));const{calculatedDuration:u}=c,d=u+i;return{generator:c,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:d,totalDuration:d*(n+1)-i}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&e?this.state=this.pendingPlayState:this.pause()}tick(e,t=!1){const{resolved:n}=this;if(!n){const{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:r,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:l,totalDuration:c,resolvedDuration:u}=n;if(null===this.startTime)return s.next(0);const{delay:d,repeat:h,repeatType:m,repeatDelay:p,onUpdate:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-c/this.speed,this.startTime)),t?this.currentTime=e:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const g=this.currentTime-d*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>c;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=c);let v=this.currentTime,x=s;if(h){const e=Math.min(this.currentTime,c)/u;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,h+1),Boolean(t%2)&&("reverse"===m?(n=1-n,p&&(n-=p/u)):"mirror"===m&&(x=r)),v=_e(0,1,n)*u}const w=y?{done:!1,value:a[0]}:x.next(v);o&&(w.value=o(w.value));let{done:b}=w;y||null===l||(b=this.speed>=0?this.currentTime>=c:this.currentTime<=0);const E=null===this.holdTime&&("finished"===this.state||"running"===this.state&&b);return E&&void 0!==i&&(w.value=vn(a,this.options,i)),f&&f(w.value),E&&this.finish(),w}get duration(){const{resolved:e}=this;return e?dn(e.calculatedDuration):0}get time(){return dn(this.currentTime)}set time(e){e=un(e),this.currentTime=e,null!==this.holdTime||0===this.speed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=dn(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:e=ds,onPlay:t}=this.options;this.driver||(this.driver=e((e=>this.tick(e)))),t&&t();const n=this.driver.now();null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime&&"finished"!==this.state||(this.startTime=n),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;this._resolved?(this.state="paused",this.holdTime=null!==(e=this.currentTime)&&void 0!==e?e:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const fs=e=>Array.isArray(e)&&"number"==typeof e[0];function gs(e){return Boolean(!e||"string"==typeof e&&e in vs||fs(e)||Array.isArray(e)&&e.every(gs))}const ys=([e,t,n,i])=>`cubic-bezier(${e}, ${t}, ${n}, ${i})`,vs={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ys([0,.65,.55,1]),circOut:ys([.55,0,1,.45]),backIn:ys([.31,.01,.66,-.59]),backOut:ys([.33,1.53,.69,.99])};function xs(e){return ws(e)||vs.easeOut}function ws(e){return e?fs(e)?ys(e):Array.isArray(e)?e.map(xs):vs[e]:void 0}const bs=gi((()=>Object.hasOwnProperty.call(Element.prototype,"animate")));class Es extends vi{constructor(e){super(e);const{name:t,motionValue:n,keyframes:i}=this.options;this.resolver=new fi(i,((e,t)=>this.onKeyframesResolved(e,t)),t,n),this.resolver.scheduleResolve()}initPlayback(e,t){var n;let{duration:i=300,times:s,ease:r,type:o,motionValue:a,name:l}=this.options;if(!(null===(n=a.owner)||void 0===n?void 0:n.current))return!1;if("spring"===(c=this.options).type||!gs(c.ease)){const{onComplete:t,onUpdate:n,motionValue:a,...l}=this.options,c=function(e,t){const n=new ps({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:e[0]};const s=[];let r=0;for(;!i.done&&r<2e4;)i=n.sample(r),s.push(i.value),r+=10;return{times:void 0,keyframes:s,duration:r-10,ease:"linear"}}(e,l);1===(e=c.keyframes).length&&(e[1]=e[0]),i=c.duration,s=c.times,r=c.ease,o="keyframes"}var c;const u=function(e,t,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:a,times:l}={}){const c={[t]:n};l&&(c.offset=l);const u=ws(a);return Array.isArray(u)&&(c.easing=u),e.animate(c,{delay:i,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"})}(a.owner.current,l,e,{...this.options,duration:i,times:s,ease:r});return u.startTime=bn.now(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:n}=this.options;a.set(vn(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:s,type:o,ease:r,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return dn(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return dn(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.currentTime=un(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}attachTimeline(e){if(this._resolved){const{resolved:t}=this;if(!t)return j;const{animation:n}=t;n.timeline=e,n.onfinish=null}else this.pendingTimeline=e;return j}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;"finished"===t.playState&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:n,duration:i,type:s,ease:r,times:o}=e;if("idle"===t.playState||"finished"===t.playState)return;if(this.time){const{motionValue:e,onUpdate:t,onComplete:a,...l}=this.options,c=new ps({...l,keyframes:n,duration:i,type:s,ease:r,times:o,isGenerator:!0}),u=un(this.time);e.setWithVelocity(c.sample(u-10).value,c.sample(u).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:n,repeatDelay:i,repeatType:s,damping:r,type:o}=e;return bs()&&n&&Tt.has(n)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!i&&"mirror"!==s&&0!==r&&"inertia"!==o}}const Ss=gi((()=>void 0!==window.ScrollTimeline));class Ps{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){const t=this.animations.map((t=>{if(!Ss()||!t.attachTimeline)return t.pause(),function(e,n){let i;const s=()=>{const{currentTime:e}=n,s=(null===e?0:e.value)/100;i!==s&&(e=>{t.time=t.duration*e})(s),i=s};return Dt.update(s,!0),()=>Rt(s)}(0,e);t.attachTimeline(e)}));return()=>{t.forEach(((e,t)=>{e&&e(),this.animations[t].stop()}))}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach((t=>t[e]()))}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const Ts=(e,t,n,i={},s,r,o)=>a=>{const l=gn(i,e)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u-=un(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:e=>{t.set(e),l.onUpdate&&l.onUpdate(e)},onComplete:()=>{a(),l.onComplete&&l.onComplete(),o&&o()},onStop:o,name:e,motionValue:t,element:r?void 0:s};(function({when:e,delay:t,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length})(l)||(d={...d,...fn(e,d)}),d.duration&&(d.duration=un(d.duration)),d.repeatDelay&&(d.repeatDelay=un(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let h=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(d.duration=0,0===d.delay&&(h=!0)),h&&!r&&void 0!==t.get()){const e=vn(d.keyframes,l);if(void 0!==e)return Dt.update((()=>{d.onUpdate(e),d.onComplete()})),new Ps([])}return!r&&Es.supports(d)?new Es(d):new ps(d)};class Cs{constructor(){this.subscriptions=[]}add(e){return _t(this.subscriptions,e),()=>kt(this.subscriptions,e)}notify(e,t,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](e,t,n);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const _s={current:void 0};class ks{constructor(e,t={}){this.version="11.3.21",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{const n=bn.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){var t;this.current=e,this.updatedAt=bn.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Cs);const n=this.events[e].add(t);return"change"===e?()=>{n(),Dt.read((()=>{this.events.change.getSize()||this.stop()}))}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return _s.current&&_s.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=bn.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return xi(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise((t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()})).then((()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()}))}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function As(e,t){return new ks(e,t)}function Vs(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,As(n))}function Ls(e){return e.getProps()[K]}class Ms extends ks{constructor(){super(...arguments),this.output=[],this.counts=new Map}add(e){const t=Ct(e);if(!t)return;const n=this.counts.get(t)||0;this.counts.set(t,n+1),0===n&&(this.output.push(t),this.update());let i=!1;return()=>{if(i)return;i=!0;const e=this.counts.get(t)-1;this.counts.set(t,e),0===e&&(kt(this.output,t),this.update())}}update(){this.set(this.output.length?this.output.join(", "):"auto")}}function Ds(e,t){var n;if(!e.applyWillChange)return;let i=e.getValue("willChange");return i||(null===(n=e.props.style)||void 0===n?void 0:n.willChange)||(i=new Ms("auto"),e.addValue("willChange",i)),s=i,Boolean(Te(s)&&s.add)?i.add(t):void 0;var s}function Rs({protectedKeys:e,needsAnimating:t},n){const i=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,i}function Is(e,t,{delay:n=0,transitionOverride:i,type:s}={}){var r;let{transition:o=e.getDefaultTransition(),transitionEnd:a,...l}=t;i&&(o=i);const c=[],u=s&&e.animationState&&e.animationState.getState()[s];for(const t in l){const i=e.getValue(t,null!==(r=e.latestValues[t])&&void 0!==r?r:null),s=l[t];if(void 0===s||u&&Rs(u,t))continue;const a={delay:n,elapsed:0,...gn(o||{},t)};let d=!1;if(window.HandoffAppearAnimations){const n=Ls(e);if(n){const e=window.HandoffAppearAnimations(n,t,i,Dt);null!==e&&(a.elapsed=e,d=!0)}}i.start(Ts(t,i,s,e.shouldReduceMotion&&Se.has(t)?{type:!1}:a,e,d,Ds(e,t)));const h=i.animation;h&&c.push(h)}return a&&Promise.all(c).then((()=>{Dt.update((()=>{a&&function(e,t){const n=cn(e,t);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const t in r)Vs(e,t,St(r[t]))}(e,a)}))})),c}function Bs(e,t,n={}){var i;const s=cn(e,t,"exit"===n.type?null===(i=e.presenceContext)||void 0===i?void 0:i.custom:void 0);let{transition:r=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const o=s?()=>Promise.all(Is(e,s,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(i=0)=>{const{delayChildren:s=0,staggerChildren:o,staggerDirection:a}=r;return function(e,t,n=0,i=0,s=1,r){const o=[],a=(e.variantChildren.size-1)*i,l=1===s?(e=0)=>e*i:(e=0)=>a-e*i;return Array.from(e.variantChildren).sort(js).forEach(((e,i)=>{e.notify("AnimationStart",t),o.push(Bs(e,t,{...r,delay:n+l(i)}).then((()=>e.notify("AnimationComplete",t))))})),Promise.all(o)}(e,t,s+i,o,a,n)}:()=>Promise.resolve(),{when:l}=r;if(l){const[e,t]="beforeChildren"===l?[o,a]:[a,o];return e().then((()=>t()))}return Promise.all([o(),a(n.delay)])}function js(e,t){return e.sortNodePosition(t)}const Os=[...le].reverse(),Fs=le.length;function Ns(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Hs(){return{animate:Ns(!0),whileInView:Ns(),whileHover:Ns(),whileTap:Ns(),whileDrag:Ns(),whileFocus:Ns(),exit:Ns()}}let Us=0;const zs={animation:{Feature:class extends Xt{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=function(e){return t=>Promise.all(t.map((({animation:t,options:n})=>function(e,t,n={}){let i;if(e.notify("AnimationStart",t),Array.isArray(t)){const s=t.map((t=>Bs(e,t,n)));i=Promise.all(s)}else if("string"==typeof t)i=Bs(e,t,n);else{const s="function"==typeof t?cn(e,t,n.custom):t;i=Promise.all(Is(e,s,n))}return i.then((()=>{e.notify("AnimationComplete",t)}))}(e,t,n))))}(e),n=Hs(),i=!0;const s=t=>(n,i)=>{var s;const r=cn(e,i,"exit"===t?null===(s=e.presenceContext)||void 0===s?void 0:s.custom:void 0);if(r){const{transition:e,transitionEnd:t,...i}=r;n={...n,...i,...t}}return n};function r(r){const o=e.getProps(),a=e.getVariantContext(!0)||{},l=[],c=new Set;let u={},d=1/0;for(let t=0;t<Fs;t++){const p=Os[t],f=n[p],g=void 0!==o[p]?o[p]:a[p],y=oe(g),v=p===r?f.isActive:null;!1===v&&(d=t);let x=g===a[p]&&g!==o[p]&&y;if(x&&i&&e.manuallyAnimateOnMount&&(x=!1),f.protectedKeys={...u},!f.isActive&&null===v||!g&&!f.prevProp||ae(g)||"boolean"==typeof g)continue;let w=(h=f.prevProp,("string"==typeof(m=g)?m!==h:!!Array.isArray(m)&&!ln(m,h))||p===r&&f.isActive&&!x&&y||t>d&&y),b=!1;const E=Array.isArray(g)?g:[g];let S=E.reduce(s(p),{});!1===v&&(S={});const{prevResolvedValues:P={}}=f,T={...P,...S},C=t=>{w=!0,c.has(t)&&(b=!0,c.delete(t)),f.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in T){const t=S[e],n=P[e];if(u.hasOwnProperty(e))continue;let i=!1;i=bt(t)&&bt(n)?!ln(t,n):t!==n,i?null!=t?C(e):c.add(e):void 0!==t&&c.has(e)?C(e):f.protectedKeys[e]=!0}f.prevProp=g,f.prevResolvedValues=S,f.isActive&&(u={...u,...S}),i&&e.blockInitialAnimation&&(w=!1),!w||x&&!b||l.push(...E.map((e=>({animation:e,options:{type:p}}))))}var h,m;if(c.size){const t={};c.forEach((n=>{const i=e.getBaseTarget(n),s=e.getValue(n);s&&(s.liveStyle=!0),t[n]=null!=i?i:null})),l.push({animation:t})}let p=Boolean(l.length);return!i||!1!==o.initial&&o.initial!==o.animate||e.manuallyAnimateOnMount||(p=!1),i=!1,p?t(l):Promise.resolve()}return{animateChanges:r,setActive:function(t,i){var s;if(n[t].isActive===i)return Promise.resolve();null===(s=e.variantChildren)||void 0===s||s.forEach((e=>{var n;return null===(n=e.animationState)||void 0===n?void 0:n.setActive(t,i)})),n[t].isActive=i;const o=r(t);for(const e in n)n[e].protectedKeys={};return o},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=Hs(),i=!0}}}(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ae(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null===(e=this.unmountControls)||void 0===e||e.call(this)}}},exit:{Feature:class extends Xt{constructor(){super(...arguments),this.id=Us++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e);t&&!e&&i.then((()=>t(this.id)))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},$s=(e,t)=>Math.abs(e-t);class Gs{constructor(e,t,{transformPagePoint:n,contextWindow:i,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=Ks(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=$s(e.x,t.x),i=$s(e.y,t.y);return Math.sqrt(n**2+i**2)}(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;const{point:i}=e,{timestamp:s}=It;this.history.push({...i,timestamp:s});const{onStart:r,onMove:o}=this.handlers;t||(r&&r(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=Ws(t,this.transformPagePoint),Dt.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const{onEnd:n,onSessionEnd:i,resumeAnimation:s}=this.handlers;if(this.dragSnapToOrigin&&s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const r=Ks("pointercancel"===e.type?this.lastMoveEventInfo:Ws(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,r),i&&i(e,r)},!Nt(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.contextWindow=i||window;const r=Ws(Ht(e),this.transformPagePoint),{point:o}=r,{timestamp:a}=It;this.history=[{...o,timestamp:a}];const{onSessionStart:l}=t;l&&l(e,Ks(r,this.history)),this.removeListeners=Gt(zt(this.contextWindow,"pointermove",this.handlePointerMove),zt(this.contextWindow,"pointerup",this.handlePointerUp),zt(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Rt(this.updatePoint)}}function Ws(e,t){return t?{point:t(e.point)}:e}function Zs(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ks({point:e},t){return{point:e,delta:Zs(e,Ys(t)),offset:Zs(e,qs(t)),velocity:Xs(t,.1)}}function qs(e){return e[0]}function Ys(e){return e[e.length-1]}function Xs(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const s=Ys(e);for(;n>=0&&(i=e[n],!(s.timestamp-i.timestamp>un(t)));)n--;if(!i)return{x:0,y:0};const r=dn(s.timestamp-i.timestamp);if(0===r)return{x:0,y:0};const o={x:(s.x-i.x)/r,y:(s.y-i.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const Js=.9999,Qs=1.0001,er=-.01,tr=.01;function nr(e){return e.max-e.min}function ir(e,t,n,i=.5){e.origin=i,e.originPoint=Yi(t.min,t.max,e.origin),e.scale=nr(n)/nr(t),e.translate=Yi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Js&&e.scale<=Qs||isNaN(e.scale))&&(e.scale=1),(e.translate>=er&&e.translate<=tr||isNaN(e.translate))&&(e.translate=0)}function sr(e,t,n,i){ir(e.x,t.x,n.x,i?i.originX:void 0),ir(e.y,t.y,n.y,i?i.originY:void 0)}function rr(e,t,n){e.min=n.min+t.min,e.max=e.min+nr(t)}function or(e,t,n){e.min=t.min-n.min,e.max=e.min+nr(t)}function ar(e,t,n){or(e.x,t.x,n.x),or(e.y,t.y,n.y)}function lr(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function cr(e,t){let n=t.min-e.min,i=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,i]=[i,n]),{min:n,max:i}}const ur=.35;function dr(e,t,n){return{min:hr(e,t),max:hr(e,n)}}function hr(e,t){return"number"==typeof e?e:e[t]||0}const mr=()=>({x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}),pr=()=>({x:{min:0,max:0},y:{min:0,max:0}});function fr(e){return[e("x"),e("y")]}function gr({top:e,left:t,right:n,bottom:i}){return{x:{min:t,max:n},y:{min:e,max:i}}}function yr(e){return void 0===e||1===e}function vr({scale:e,scaleX:t,scaleY:n}){return!yr(e)||!yr(t)||!yr(n)}function xr(e){return vr(e)||wr(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function wr(e){return br(e.x)||br(e.y)}function br(e){return e&&"0%"!==e}function Er(e,t,n){return n+t*(e-n)}function Sr(e,t,n,i,s){return void 0!==s&&(e=Er(e,s,i)),Er(e,n,i)+t}function Pr(e,t=0,n=1,i,s){e.min=Sr(e.min,t,n,i,s),e.max=Sr(e.max,t,n,i,s)}function Tr(e,{x:t,y:n}){Pr(e.x,t.translate,t.scale,t.originPoint),Pr(e.y,n.translate,n.scale,n.originPoint)}const Cr=.999999999999,_r=1.0000000000001;function kr(e,t){e.min=e.min+t,e.max=e.max+t}function Ar(e,t,n,i,s=.5){Pr(e,t,n,Yi(e.min,e.max,s),i)}function Vr(e,t){Ar(e.x,t.x,t.scaleX,t.scale,t.originX),Ar(e.y,t.y,t.scaleY,t.scale,t.originY)}function Lr(e,t){return gr(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(e.getBoundingClientRect(),t))}const Mr=({current:e})=>e?e.ownerDocument.defaultView:null,Dr=new WeakMap;class Rr{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=pr(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:i}=this.getProps();this.panSession=new Gs(e,{onSessionStart:e=>{const{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(Ht(e,"page").point)},onStart:(e,t)=>{var n;const{drag:i,dragPropagation:s,onDragStart:r}=this.getProps();if(i&&!s&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=qt(i),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),fr((e=>{let t=this.getAxisMotionValue(e).get()||0;if(Oe.test(t)){const{projection:n}=this.visualElement;if(n&&n.layout){const i=n.layout.layoutBox[e];i&&(t=nr(i)*(parseFloat(t)/100))}}this.originPoint[e]=t})),r&&Dt.postRender((()=>r(e,t))),null===(n=this.removeWillChange)||void 0===n||n.call(this),this.removeWillChange=Ds(this.visualElement,"transform");const{animationState:o}=this.visualElement;o&&o.setActive("whileDrag",!0)},onMove:(e,t)=>{const{dragPropagation:n,dragDirectionLock:i,onDirectionLock:s,onDrag:r}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:o}=t;if(i&&null===this.currentDirection)return this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(o),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),r&&r(e,t)},onSessionEnd:(e,t)=>this.stop(e,t),resumeAnimation:()=>fr((e=>{var t;return"paused"===this.getAnimationState(e)&&(null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.play())}))},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:i,contextWindow:Mr(this.visualElement)})}stop(e,t){var n;null===(n=this.removeWillChange)||void 0===n||n.call(this);const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=t;this.startAnimation(s);const{onDragEnd:r}=this.getProps();r&&Dt.postRender((()=>r(e,t)))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,n){const{drag:i}=this.getProps();if(!n||!Ir(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let r=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(r=function(e,{min:t,max:n},i){return void 0!==t&&e<t?e=i?Yi(t,e,i.min):Math.max(e,t):void 0!==n&&e>n&&(e=i?Yi(n,e,i.max):Math.min(e,n)),e}(r,this.constraints[e],this.elastic[e])),s.set(r)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(e=this.visualElement.projection)||void 0===e?void 0:e.layout,s=this.constraints;t&&Q(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i)&&function(e,{top:t,left:n,bottom:i,right:s}){return{x:lr(e.x,n,s),y:lr(e.y,t,i)}}(i.layoutBox,t),this.elastic=function(e=ur){return!1===e?e=0:!0===e&&(e=ur),{x:dr(e,"left","right"),y:dr(e,"top","bottom")}}(n),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&fr((e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(i.layoutBox[e],this.constraints[e]))}))}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Q(e))return!1;const n=e.current;F(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=function(e,t,n){const i=Lr(e,n),{scroll:s}=t;return s&&(kr(i.x,s.offset.x),kr(i.y,s.offset.y)),i}(n,i.root,this.visualElement.getTransformPagePoint());let r=function(e,t){return{x:cr(e.x,t.x),y:cr(e.y,t.y)}}(i.layout.layoutBox,s);if(t){const e=t(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(r));this.hasMutatedConstraints=!!e,e&&(r=gr(e))}return r}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:i,dragTransition:s,dragSnapToOrigin:r,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{},l=fr((o=>{if(!Ir(o,t,this.currentDirection))return;let l=a&&a[o]||{};r&&(l={min:0,max:0});const c=i?200:1e6,u=i?40:1e7,d={type:"inertia",velocity:n?e[o]:0,bounceStiffness:c,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(o,d)}));return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return n.start(Ts(e,n,0,t,this.visualElement,!1,Ds(this.visualElement,e)))}stopAnimation(){fr((e=>this.getAxisMotionValue(e).stop()))}pauseAnimation(){fr((e=>{var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.pause()}))}getAnimationState(e){var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){fr((t=>{const{drag:n}=this.getProps();if(!Ir(t,n,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(t);if(i&&i.layout){const{min:n,max:r}=i.layout.layoutBox[t];s.set(e[t]-Yi(n,r,.5))}}))}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Q(t)||!n||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};fr((e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();i[e]=function(e,t){let n=.5;const i=nr(e),s=nr(t);return s>i?n=qi(t.min,t.max-i,e.min):i>s&&(n=qi(e.min,e.max-s,t.min)),_e(0,1,n)}({min:n,max:n},this.constraints[e])}}));const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),fr((t=>{if(!Ir(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:r}=this.constraints[t];n.set(Yi(s,r,i[t]))}))}addListeners(){if(!this.visualElement.current)return;Dr.set(this.visualElement,this);const e=zt(this.visualElement.current,"pointerdown",(e=>{const{drag:t,dragListener:n=!0}=this.getProps();t&&n&&this.start(e)})),t=()=>{const{dragConstraints:e}=this.getProps();Q(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,i=n.addEventListener("measure",t);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Dt.read(t);const s=Ft(window,"resize",(()=>this.scalePositionWithinConstraints())),r=n.addEventListener("didUpdate",(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(fr((t=>{const n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))})),this.visualElement.render())}));return()=>{s(),e(),i(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:r=ur,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:i,dragConstraints:s,dragElastic:r,dragMomentum:o}}}function Ir(e,t,n){return!(!0!==t&&t!==e||null!==n&&n!==e)}const Br=e=>(t,n)=>{e&&Dt.postRender((()=>e(t,n)))},jr={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Or(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Fr={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e){if(!Fe.test(e))return e;e=parseFloat(e)}return`${Or(e,t.target.x)}% ${Or(e,t.target.y)}%`}},Nr={correct:(e,{treeScale:t,projectionDelta:n})=>{const i=e,s=oi.parse(e);if(s.length>5)return i;const r=oi.createTransformer(e),o="number"!=typeof s[0]?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;s[0+o]/=a,s[1+o]/=l;const c=Yi(a,l,.5);return"number"==typeof s[2+o]&&(s[2+o]/=c),"number"==typeof s[3+o]&&(s[3+o]/=c),r(s)}};class Hr extends e.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:i}=this.props,{projection:s}=e;var r;r=zr,Object.assign(be,r),s&&(t.group&&t.group.add(s),n&&n.register&&i&&n.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",(()=>{this.safeToRemove()})),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),jr.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:i,isPresent:s}=this.props,r=n.projection;return r?(r.isPresent=s,i||e.layoutDependency!==t||void 0===t?r.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?r.promote():r.relegate()||Dt.postRender((()=>{const e=r.getStack();e&&e.members.length||this.safeToRemove()}))),null):null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),X.postRender((()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()})))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(i),n&&n.deregister&&n.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ur(t){const[n,i]=function(){const t=(0,e.useContext)(A);if(null===t)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=t,r=(0,e.useId)();(0,e.useEffect)((()=>s(r)),[]);const o=(0,e.useCallback)((()=>i&&i(r)),[r,i]);return!n&&i?[!1,o]:[!0]}(),s=(0,e.useContext)(B);return(0,m.jsx)(Hr,{...t,layoutGroup:s,switchLayoutGroup:(0,e.useContext)(ee),isPresent:n,safeToRemove:i})}const zr={borderRadius:{...Fr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Fr,borderTopRightRadius:Fr,borderBottomLeftRadius:Fr,borderBottomRightRadius:Fr,boxShadow:Nr},$r=["TopLeft","TopRight","BottomLeft","BottomRight"],Gr=$r.length,Wr=e=>"string"==typeof e?parseFloat(e):e,Zr=e=>"number"==typeof e||Fe.test(e);function Kr(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const qr=Xr(0,.5,Ui),Yr=Xr(.5,.95,j);function Xr(e,t,n){return i=>i<e?0:i>t?1:n(qi(e,t,i))}function Jr(e,t){e.min=t.min,e.max=t.max}function Qr(e,t){Jr(e.x,t.x),Jr(e.y,t.y)}function eo(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function to(e,t,n,i,s){return e=Er(e-=t,1/n,i),void 0!==s&&(e=Er(e,1/s,i)),e}function no(e,t,[n,i,s],r,o){!function(e,t=0,n=1,i=.5,s,r=e,o=e){if(Oe.test(t)&&(t=parseFloat(t),t=Yi(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let a=Yi(r.min,r.max,i);e===r&&(a-=t),e.min=to(e.min,t,n,a,s),e.max=to(e.max,t,n,a,s)}(e,t[n],t[i],t[s],t.scale,r,o)}const io=["x","scaleX","originX"],so=["y","scaleY","originY"];function ro(e,t,n,i){no(e.x,t,io,n?n.x:void 0,i?i.x:void 0),no(e.y,t,so,n?n.y:void 0,i?i.y:void 0)}function oo(e){return 0===e.translate&&1===e.scale}function ao(e){return oo(e.x)&&oo(e.y)}function lo(e,t){return e.min===t.min&&e.max===t.max}function co(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function uo(e,t){return co(e.x,t.x)&&co(e.y,t.y)}function ho(e){return nr(e.x)/nr(e.y)}function mo(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class po{constructor(){this.members=[]}add(e){_t(this.members,e),e.scheduleRender()}remove(e){if(kt(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex((t=>e===t));if(0===t)return!1;let n;for(let e=t;e>=0;e--){const t=this.members[e];if(!1!==t.isPresent){n=t;break}}return!!n&&(this.promote(n),!0)}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;!1===i&&n.hide()}}exitAnimationComplete(){this.members.forEach((e=>{const{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()}))}scheduleRender(){this.members.forEach((e=>{e.instance&&e.scheduleRender(!1)}))}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const fo=(e,t)=>e.depth-t.depth;class go{constructor(){this.children=[],this.isDirty=!1}add(e){_t(this.children,e),this.isDirty=!0}remove(e){kt(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(fo),this.isDirty=!1,this.children.forEach(e)}}const yo={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},vo="undefined"!=typeof window&&void 0!==window.MotionDebug,xo=["","X","Y","Z"],wo={visibility:"hidden"};let bo=0;function Eo(e,t,n,i){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),i&&(i[e]=0))}function So(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return!1;const{visualElement:t}=e.options;return!!t&&(!!Ls(t)||!(!e.parent||e.parent.hasCheckedOptimisedAppear)&&So(e.parent))}function Po({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(e={},n=(null==t?void 0:t())){this.id=bo++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,vo&&(yo.totalNodes=yo.resolvedTargetDeltas=yo.recalculatedProjection=0),this.nodes.forEach(_o),this.nodes.forEach(Ro),this.nodes.forEach(Io),this.nodes.forEach(ko),vo&&window.MotionDebug.record(yo)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new go)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Cs),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){const n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,n=this.root.hasTreeAnimated){if(this.instance)return;var i;this.isSVG=(i=t)instanceof SVGElement&&"svg"!==i.tagName,this.instance=t;const{layoutId:s,layout:r,visualElement:o}=this.options;if(o&&!o.current&&o.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(r||s)&&(this.isLayoutDirty=!0),e){let n;const i=()=>this.root.updateBlockedByResize=!1;e(t,(()=>{this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){const n=bn.now(),i=({timestamp:t})=>{const s=t-n;s>=250&&(Rt(i),e(s-250))};return Dt.read(i,!0),()=>Rt(i)}(i),jr.hasAnimatedSinceResize&&(jr.hasAnimatedSinceResize=!1,this.nodes.forEach(Do))}))}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&o&&(s||r)&&this.addEventListener("didUpdate",(({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:i})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const s=this.options.transition||o.getDefaultTransition()||Ho,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!uo(this.targetLayout,i)||n,c=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,c);const t={...gn(s,"layout"),onPlay:r,onComplete:a};(o.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||Do(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=i}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Rt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Bo),this.animationId++)}getTransformTemplate(){const{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.HandoffCancelAllAnimations&&So(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){const t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}const{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;const i=this.getTransformTemplate();this.prevTransformTemplateValue=i?i(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Vo);this.isUpdating||this.nodes.forEach(Lo),this.isUpdating=!1,this.nodes.forEach(Mo),this.nodes.forEach(To),this.nodes.forEach(Co),this.clearAllSnapshots();const e=bn.now();It.delta=_e(0,1e3/60,e-It.timestamp),It.timestamp=e,It.isProcessing=!0,Bt.update.process(It),Bt.preRender.process(It),Bt.render.process(It),It.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,X.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ao),this.sharedNodes.forEach(jo)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Dt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Dt.postRender((()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()}))}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();const e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=pr(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){const t=i(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!s)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!ao(this.projectionDelta),n=this.getTransformTemplate(),i=n?n(this.latestValues,""):void 0,r=i!==this.prevTransformTemplateValue;e&&(t||xr(this.latestValues)||r)&&(s(this.instance,i),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){const t=this.measurePageBox();let n=this.removeElementScroll(t);var i;return e&&(n=this.removeTransform(n)),$o((i=n).x),$o(i.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var e;const{visualElement:t}=this.options;if(!t)return pr();const n=t.measureViewportBox();if(!(null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)&&!this.path.some(Wo)){const{scroll:e}=this.root;e&&(kr(n.x,e.offset.x),kr(n.y,e.offset.y))}return n}removeElementScroll(e){var t;const n=pr();if(Qr(n,e),null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)return n;for(let t=0;t<this.path.length;t++){const i=this.path[t],{scroll:s,options:r}=i;i!==this.root&&s&&r.layoutScroll&&(s.wasRoot&&Qr(n,e),kr(n.x,s.offset.x),kr(n.y,s.offset.y))}return n}applyTransform(e,t=!1){const n=pr();Qr(n,e);for(let e=0;e<this.path.length;e++){const i=this.path[e];!t&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Vr(n,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),xr(i.latestValues)&&Vr(n,i.latestValues)}return xr(this.latestValues)&&Vr(n,this.latestValues),n}removeTransform(e){const t=pr();Qr(t,e);for(let e=0;e<this.path.length;e++){const n=this.path[e];if(!n.instance)continue;if(!xr(n.latestValues))continue;vr(n.latestValues)&&n.updateSnapshot();const i=pr();Qr(i,n.measurePageBox()),ro(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,i)}return xr(this.latestValues)&&ro(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==It.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==n;if(!(e||i&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:r}=this.options;if(this.layout&&(s||r)){if(this.resolvedRelativeTargetAt=It.timestamp,!this.targetDelta&&!this.relativeTarget){const e=this.getClosestProjectingParent();e&&e.layout&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=pr(),this.relativeTargetOrigin=pr(),ar(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),Qr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var o,a,l;if(this.target||(this.target=pr(),this.targetWithTransforms=pr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),o=this.target,a=this.relativeTarget,l=this.relativeParent.target,rr(o.x,a.x,l.x),rr(o.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Qr(this.target,this.layout.layoutBox),Tr(this.target,this.targetDelta)):Qr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const e=this.getClosestProjectingParent();e&&Boolean(e.resumingFrom)===Boolean(this.resumingFrom)&&!e.options.layoutScroll&&e.target&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=pr(),this.relativeTargetOrigin=pr(),ar(this.relativeTargetOrigin,this.target,e.target),Qr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}vo&&yo.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!vr(this.parent.latestValues)&&!wr(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var e;const t=this.getLead(),n=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty))&&(i=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===It.timestamp&&(i=!1),i)return;const{layout:s,layoutId:r}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!s&&!r)return;Qr(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,a=this.treeScale.y;!function(e,t,n,i=!1){const s=n.length;if(!s)return;let r,o;t.x=t.y=1;for(let a=0;a<s;a++){r=n[a],o=r.projectionDelta;const{visualElement:s}=r.options;s&&s.props.style&&"contents"===s.props.style.display||(i&&r.options.layoutScroll&&r.scroll&&r!==r.root&&Vr(e,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Tr(e,o)),i&&xr(r.latestValues)&&Vr(e,r.latestValues))}t.x<_r&&t.x>Cr&&(t.x=1),t.y<_r&&t.y>Cr&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=pr());const{target:l}=t;l?(this.projectionDelta&&this.prevProjectionDelta?(eo(this.prevProjectionDelta.x,this.projectionDelta.x),eo(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),sr(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===a&&mo(this.projectionDelta.x,this.prevProjectionDelta.x)&&mo(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),vo&&yo.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null===(t=this.options.visualElement)||void 0===t||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=mr(),this.projectionDelta=mr(),this.projectionDeltaWithTransform=mr()}setAnimationOrigin(e,t=!1){const n=this.snapshot,i=n?n.latestValues:{},s={...this.latestValues},r=mr();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const o=pr(),a=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),c=!l||l.members.length<=1,u=Boolean(a&&!c&&!0===this.options.crossfade&&!this.path.some(No));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;var l,h,m,p,f,g;Oo(r.x,e.x,n),Oo(r.y,e.y,n),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ar(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,f=o,g=n,Fo(m.x,p.x,f.x,g),Fo(m.y,p.y,f.y,g),d&&(l=this.relativeTarget,h=d,lo(l.x,h.x)&&lo(l.y,h.y))&&(this.isProjectionDirty=!1),d||(d=pr()),Qr(d,this.relativeTarget)),a&&(this.animationValues=s,function(e,t,n,i,s,r){s?(e.opacity=Yi(0,void 0!==n.opacity?n.opacity:1,qr(i)),e.opacityExit=Yi(void 0!==t.opacity?t.opacity:1,0,Yr(i))):r&&(e.opacity=Yi(void 0!==t.opacity?t.opacity:1,void 0!==n.opacity?n.opacity:1,i));for(let s=0;s<Gr;s++){const r=`border${$r[s]}Radius`;let o=Kr(t,r),a=Kr(n,r);void 0===o&&void 0===a||(o||(o=0),a||(a=0),0===o||0===a||Zr(o)===Zr(a)?(e[r]=Math.max(Yi(Wr(o),Wr(a),i),0),(Oe.test(a)||Oe.test(o))&&(e[r]+="%")):e[r]=a)}(t.rotate||n.rotate)&&(e.rotate=Yi(t.rotate||0,n.rotate||0,i))}(s,i,this.latestValues,n,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Rt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Dt.update((()=>{jr.hasAnimatedSinceResize=!0,this.currentAnimation=function(e,t,n){const i=Te(0)?0:As(0);return i.start(Ts("",i,1e3,n)),i.animation}(0,0,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0}))}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let{targetWithTransforms:t,target:n,layout:i,latestValues:s}=e;if(t&&n&&i){if(this!==e&&this.layout&&i&&Go(this.options.animationType,this.layout.layoutBox,i.layoutBox)){n=this.target||pr();const t=nr(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const i=nr(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+i}Qr(t,n),Vr(t,s),sr(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new po),this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;const{layoutId:t}=this.options;return t&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;const{layoutId:t}=this.options;return t?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){const{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){const i=this.getStack();i&&i.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const{visualElement:e}=this.options;if(!e)return;let t=!1;const{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const i={};n.z&&Eo("z",e,i,this.animationValues);for(let t=0;t<xo.length;t++)Eo(`rotate${xo[t]}`,e,i,this.animationValues),Eo(`skew${xo[t]}`,e,i,this.animationValues);e.render();for(const t in i)e.setStaticValue(t,i[t]),this.animationValues&&(this.animationValues[t]=i[t]);e.scheduleRender()}getProjectionStyles(e){var t,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return wo;const i={visibility:""},s=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,i.opacity="",i.pointerEvents=Pt(null==e?void 0:e.pointerEvents)||"",i.transform=s?s(this.latestValues,""):"none",i;const r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){const t={};return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=Pt(null==e?void 0:e.pointerEvents)||""),this.hasProjected&&!xr(this.latestValues)&&(t.transform=s?s({},""):"none",this.hasProjected=!1),t}const o=r.animationValues||r.latestValues;this.applyTransformsToTarget(),i.transform=function(e,t,n){let i="";const s=e.x.translate/t.x,r=e.y.translate/t.y,o=(null==n?void 0:n.z)||0;if((s||r||o)&&(i=`translate3d(${s}px, ${r}px, ${o}px) `),1===t.x&&1===t.y||(i+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:e,rotate:t,rotateX:s,rotateY:r,skewX:o,skewY:a}=n;e&&(i=`perspective(${e}px) ${i}`),t&&(i+=`rotate(${t}deg) `),s&&(i+=`rotateX(${s}deg) `),r&&(i+=`rotateY(${r}deg) `),o&&(i+=`skewX(${o}deg) `),a&&(i+=`skewY(${a}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return 1===a&&1===l||(i+=`scale(${a}, ${l})`),i||"none"}(this.projectionDeltaWithTransform,this.treeScale,o),s&&(i.transform=s(o,i.transform));const{x:a,y:l}=this.projectionDelta;i.transformOrigin=`${100*a.origin}% ${100*l.origin}% 0`,r.animationValues?i.opacity=r===this?null!==(n=null!==(t=o.opacity)&&void 0!==t?t:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:i.opacity=r===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0;for(const e in be){if(void 0===o[e])continue;const{correct:t,applyTo:n}=be[e],s="none"===i.transform?o[e]:t(o[e],r);if(n){const e=n.length;for(let t=0;t<e;t++)i[n[t]]=s}else i[e]=s}return this.options.layoutId&&(i.pointerEvents=r===this?Pt(null==e?void 0:e.pointerEvents)||"":"none"),i}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach((e=>{var t;return null===(t=e.currentAnimation)||void 0===t?void 0:t.stop()})),this.root.nodes.forEach(Vo),this.root.sharedNodes.clear()}}}function To(e){e.updateLayout()}function Co(e){var t;const n=(null===(t=e.resumeFrom)||void 0===t?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:t,measuredBox:i}=e.layout,{animationType:s}=e.options,r=n.source!==e.layout.source;"size"===s?fr((e=>{const i=r?n.measuredBox[e]:n.layoutBox[e],s=nr(i);i.min=t[e].min,i.max=i.min+s})):Go(s,n.layoutBox,t)&&fr((i=>{const s=r?n.measuredBox[i]:n.layoutBox[i],o=nr(t[i]);s.max=s.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[i].max=e.relativeTarget[i].min+o)}));const o=mr();sr(o,t,n.layoutBox);const a=mr();r?sr(a,e.applyTransform(i,!0),n.measuredBox):sr(a,t,n.layoutBox);const l=!ao(o);let c=!1;if(!e.resumeFrom){const i=e.getClosestProjectingParent();if(i&&!i.resumeFrom){const{snapshot:s,layout:r}=i;if(s&&r){const o=pr();ar(o,n.layoutBox,s.layoutBox);const a=pr();ar(a,t,r.layoutBox),uo(o,a)||(c=!0),i.options.layoutRoot&&(e.relativeTarget=a,e.relativeTargetOrigin=o,e.relativeParent=i)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function _o(e){vo&&yo.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ko(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function Ao(e){e.clearSnapshot()}function Vo(e){e.clearMeasurements()}function Lo(e){e.isLayoutDirty=!1}function Mo(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function Do(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function Ro(e){e.resolveTargetDelta()}function Io(e){e.calcProjection()}function Bo(e){e.resetSkewAndRotation()}function jo(e){e.removeLeadSnapshot()}function Oo(e,t,n){e.translate=Yi(t.translate,0,n),e.scale=Yi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function Fo(e,t,n,i){e.min=Yi(t.min,n.min,i),e.max=Yi(t.max,n.max,i)}function No(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const Ho={duration:.45,ease:[.4,0,.1,1]},Uo=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),zo=Uo("applewebkit/")&&!Uo("chrome/")?Math.round:j;function $o(e){e.min=zo(e.min),e.max=zo(e.max)}function Go(e,t,n){return"position"===e||"preserve-aspect"===e&&(i=ho(t),s=ho(n),.2,!(Math.abs(i-s)<=.2));var i,s}function Wo(e){var t;return e!==e.root&&(null===(t=e.scroll)||void 0===t?void 0:t.wasRoot)}const Zo=Po({attachResizeListener:(e,t)=>Ft(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Ko={current:void 0},qo=Po({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Ko.current){const e=new Zo({});e.mount(window),e.setOptions({layoutScroll:!0}),Ko.current=e}return Ko.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),Yo={pan:{Feature:class extends Xt{constructor(){super(...arguments),this.removePointerDownListener=j}onPointerDown(e){this.session=new Gs(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Mr(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:Br(e),onStart:Br(t),onMove:n,onEnd:(e,t)=>{delete this.session,i&&Dt.postRender((()=>i(e,t)))}}}mount(){this.removePointerDownListener=zt(this.node.current,"pointerdown",(e=>this.onPointerDown(e)))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends Xt{constructor(e){super(e),this.removeGroupControls=j,this.removeListeners=j,this.controls=new Rr(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||j}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:qo,MeasureLayout:Ur}},Xo={current:null},Jo={current:!1},Qo=new WeakMap,ea=[...In,qn,oi],ta=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],na=ce.length;class ia{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:r},o={}){this.applyWillChange=!1,this.resolveKeyframes=(e,t,n,i)=>new this.KeyframeResolver(e,t,n,i,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Un,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.isRenderScheduled=!1,this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.isRenderScheduled=!1,this.scheduleRender=()=>{this.isRenderScheduled||(this.isRenderScheduled=!0,Dt.render(this.render,!1,!0))};const{latestValues:a,renderState:l}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.blockInitialAnimation=Boolean(s),this.isControllingVariants=ue(t),this.isVariantNode=de(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:c,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==a[e]&&Te(t)&&t.set(a[e],!1)}}mount(e){this.current=e,Qo.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach(((e,t)=>this.bindToMotionValue(t,e))),Jo.current||function(){if(Jo.current=!0,U)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Xo.current=e.matches;e.addListener(t),t()}else Xo.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Xo.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Qo.delete(this.current),this.projection&&this.projection.unmount(),Rt(this.notifyUpdate),Rt(this.render),this.valueSubscriptions.forEach((e=>e())),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){const n=Se.has(e),i=t.on("change",(t=>{this.latestValues[e]=t,this.props.onUpdate&&Dt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)})),s=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,(()=>{i(),s(),t.owner&&t.stop()}))}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in pe){const t=pe[e];if(!t)continue;const{isEnabled:n,Feature:i}=t;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):pr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<ta.length;t++){const n=ta[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const i=e["on"+n];i&&(this.propEventSubscriptions[n]=this.on(n,i))}this.prevMotionValues=function(e,t,n){for(const i in t){const s=t[i],r=n[i];if(Te(s))e.addValue(i,s);else if(Te(r))e.addValue(i,As(s,{owner:e}));else if(r!==s)if(e.hasValue(i)){const t=e.getValue(i);!0===t.liveStyle?t.jump(s):t.hasAnimated||t.set(s)}else{const t=e.getStaticValue(i);e.addValue(i,As(void 0!==t?t:s,{owner:e}))}}for(const i in n)void 0===t[i]&&e.removeValue(i);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const e=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(e.initial=this.props.initial),e}const t={};for(let e=0;e<na;e++){const n=ce[e],i=this.props[n];(oe(i)||!1===i)&&(t[n]=i)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=As(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){var n;let i=void 0===this.latestValues[e]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,e))&&void 0!==n?n:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];var s;return null!=i&&("string"==typeof i&&(Sn(i)||En(i))?i=parseFloat(i):(s=i,!ea.find(Rn(s))&&oi.test(t)&&(i=mi(e,t))),this.setBaseTarget(e,Te(i)?i.get():i)),Te(i)?i.get():i}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:n}=this.props;let i;if("string"==typeof n||"object"==typeof n){const s=wt(this.props,n,null===(t=this.presenceContext)||void 0===t?void 0:t.custom);s&&(i=s[e])}if(n&&void 0!==i)return i;const s=this.getBaseTargetFromProps(this.props,e);return void 0===s||Te(s)?void 0!==this.initialValues[e]&&void 0===i?void 0:this.baseTarget[e]:s}on(e,t){return this.events[e]||(this.events[e]=new Cs),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class sa extends ia{constructor(){super(...arguments),this.KeyframeResolver=fi}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}}class ra extends sa{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=pt}readValueFromInstance(e,t){if(Se.has(t)){const e=hi(t);return e&&e.default||0}{const i=(n=e,window.getComputedStyle(n)),s=(Ke(t)?i.getPropertyValue(t):i[t])||0;return"string"==typeof s?s.trim():s}var n}measureInstanceViewportBox(e,{transformPagePoint:t}){return Lr(e,t)}build(e,t,n){Je(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return yt(e,t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Te(e)&&(this.childSubscription=e.on("change",(e=>{this.current&&(this.current.textContent=`${e}`)})))}}class oa extends sa{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=pr}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Se.has(t)){const e=hi(t);return e&&e.default||0}return t=ft.has(t)?t:Z(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return vt(e,t,n)}build(e,t,n){ct(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,i){gt(e,t,0,i)}mount(e){this.isSVGTag=dt(e.tagName),super.mount(e)}}const aa=(t,n)=>we(t)?new oa(n):new ra(n,{allowProjection:t!==e.Fragment}),la={...zs,...an,...Yo,layout:{ProjectionNode:qo,MeasureLayout:Ur}},ca=ve(((e,t)=>function(e,{forwardMotionProps:t=!1},n,i){return{...we(e)?jt:Ot,preloadedFeatures:n,useRender:mt(t),createVisualElement:i,Component:e}}(e,t,la,aa))),ua=({value:t,className:n,onChange:i,onKeyDown:s,disabled:o,placeholder:a})=>{const l=(0,r.useRef)(null),[c,u]=(0,r.useState)("auto");return(0,r.useLayoutEffect)((()=>{const e=document.createElement("textarea");e.value=t||a,e.rows=1;const n=window.getComputedStyle(l.current);["paddingTop","paddingBottom","paddingLeft","paddingRight","width","fontFamily","fontSize","borderWidth"].forEach((t=>e.style[t]=n[t])),Object.assign(e.style,{position:"absolute",left:"-9999px"}),document.body.appendChild(e),u(`${e.scrollHeight}px`),document.body.removeChild(e)}),[t,a]),(0,r.useEffect)((()=>{const e=l.current;if(!e)return;if(document.activeElement===e)return;const t=e.value.length;e.focus(),e.setSelectionRange(t,t)}),[t]),(0,e.createElement)($,null,(0,e.createElement)(ca.div,{className:"m-0.5 w-full",key:"input",animate:{height:c},transition:{duration:.2},style:{lineHeight:0}},(0,e.createElement)("label",{htmlFor:"draft-ai-textarea",className:"sr-only"},a),(0,e.createElement)("textarea",{ref:l,id:"draft-ai-textarea",disabled:o,className:n,value:t,rows:1,onChange:i,onKeyDown:s,onScroll:e=>{e.target.scrollTop=0},placeholder:a})))},da=({inputText:n,setInputText:i,ready:s,setReady:r,setPrompt:o,loading:l})=>{const{selectedText:c}=E(),u=e=>{e.preventDefault(),s&&!l&&(i(""),r(!1),o({text:c||n,promptType:c?"custom-requests":"create",systemMessageKey:c?"edit":"generate",details:{followup:c?n:void 0}}))};return(0,e.createElement)("form",{className:"relative flex items-start",onSubmit:u},(0,e.createElement)(g,{icon:S,className:"absolute left-2 top-3.5 h-5 w-5 fill-current text-wp-theme-main"}),(0,e.createElement)(ua,{disabled:l,placeholder:l?(0,a.__)("AI is writing...","extendify-local"):c?(0,a.__)("Ask AI to edit","extendify-local"):(0,a.__)("Ask AI to generate text","extendify-local"),value:n,className:"h-full w-full resize-none overflow-hidden rounded-none border-transparent bg-transparent px-10 py-3 outline-none focus:ring-1 focus:ring-wp-theme-main",onChange:e=>{i(e.target.value),r(e.target.value.length>0)},onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),u(e))}}),l&&(0,e.createElement)("div",{className:"absolute right-4 top-3.5 h-4 w-4 p-1 text-gray-700"},(0,e.createElement)(t.Spinner,{style:{margin:"0"}})),!l&&(0,e.createElement)("button",{type:"submit",disabled:!s,"aria-label":(0,a.__)("Submit","extendify-local"),className:k()("absolute right-2 top-3.5 border-none bg-transparent p-0",{"cursor-pointer text-gray-700 hover:text-design-main":s,"text-gray-500":!s})},(0,e.createElement)(g,{icon:C,onClick:u,className:"h-6 w-6 fill-current"})))},ha=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"})}),ma=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M2 12c0 3.6 2.4 5.5 6 5.5h.5V19l3-2.5-3-2.5v2H8c-2.5 0-4.5-1.5-4.5-4s2-4.5 4.5-4.5h3.5V6H8c-3.6 0-6 2.4-6 6zm19.5-1h-8v1.5h8V11zm0 5h-8v1.5h8V16zm0-10h-8v1.5h8V6z"})}),pa=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,m.jsx)(h.Path,{d:"M9 12h2v-2h2V8h-2V6H9v2H7v2h2v2zm1 4c3.9 0 7-3.1 7-7s-3.1-7-7-7-7 3.1-7 7 3.1 7 7 7zm0-12c2.8 0 5 2.2 5 5s-2.2 5-5 5-5-2.2-5-5 2.2-5 5-5zM3 19h14v-2H3v2z"})}),fa=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M12 4V2.2L9 4.8l3 2.5V5.5c3.6 0 6.5 2.9 6.5 6.5 0 2.9-1.9 5.3-4.5 6.2v.2l-.1-.2c-.4.1-.7.2-1.1.2l.2 1.5c.3 0 .6-.1 1-.2 3.5-.9 6-4 6-7.7 0-4.4-3.6-8-8-8zm-7.9 7l1.5.2c.1-1.2.5-2.3 1.2-3.2l-1.1-.9C4.8 8.2 4.3 9.6 4.1 11zm1.5 1.8l-1.5.2c.1.7.3 1.4.5 2 .3.7.6 1.3 1 1.8l1.2-.8c-.3-.5-.6-1-.8-1.5s-.4-1.1-.4-1.7zm1.5 5.5c1.1.9 2.4 1.4 3.8 1.6l.2-1.5c-1.1-.1-2.2-.5-3.1-1.2l-.9 1.1z"})}),ga=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})}),ya=({prompt:n,completion:s,loading:o,setPrompt:l,setInputText:d})=>{const{toggleHighlight:h,toggleInsertionPoint:m}=b(),{insertBlocks:p,replaceBlocks:f}=(0,i.useDispatch)(c.store),{getSelectedBlock:y,getSelectedBlockClientIds:v,getBlockRootClientId:x,getBlockIndex:w,getBlock:E}=(0,i.useSelect)((e=>e(c.store)),[]),S=y(),P=v(),T=e=>{const t=(0,u.pasteHandler)({plainText:e});return Array.isArray(t)?t:[(0,u.createBlock)("core/paragraph",{content:t})]},C=({replaceContent:e=!1,position:t})=>{l({text:"",promptType:"",systemMessageKey:""});const n=S?S?.clientId:P[0],i=E(n),r=T(s);if(!n||"end"===t)return void p(r);if("top"===t)return void p(r,0);const o=""===i?.attributes?.content,a=x(n),c=w(P.at(-1),a);if(!e&&!o)return void p(r,c+1,a);const u=(e,t)=>Object.prototype.hasOwnProperty.call(e?.attributes,"content")&&Object.prototype.hasOwnProperty.call(t?.attributes,"content"),d=1===r.length&&u(i,r[0]),h=r.map((e=>({...e,name:d?i.name:e.name,attributes:{...i.attributes,content:(u(e,i),e?.attributes?.content)}})));f(P,h)};return(0,r.useEffect)((()=>()=>{h(P,{isHighlighted:!1})}),[P,h]),(0,e.createElement)(t.MenuGroup,null,(0,e.createElement)(t.MenuItem,{onClick:()=>C({replaceContent:!0}),onMouseEnter:()=>h(P,{isHighlighted:!0}),onMouseLeave:()=>h(P,{isHighlighted:!1}),disabled:o||!(()=>{const e=S||E(P[0]);if(!e)return!1;if(["core/list-item","core/button"].includes(e?.name)){const t=T(s);return t[0]?.name===e?.name}return!0})(),icon:ha,iconPosition:"left","data-test":"replace-selected"},(0,a.__)("Replace selected block text","extendify-local")),(0,e.createElement)(t.MenuItem,{onClick:()=>C({replaceContent:!1,position:"top"}),disabled:o,iconPosition:"left","data-test":"insert-top"},(0,e.createElement)("div",{className:"-ml-1"},(0,e.createElement)(g,{icon:ma,className:"rotate-180"})),(0,e.createElement)("div",{className:"px-1"},(0,a.__)("Insert at top","extendify-local"))),(0,e.createElement)(t.MenuItem,{onClick:()=>C({replaceContent:!1}),onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),disabled:o||!(()=>{const e=S||E(P[0]);return!e||!["core/list-item","core/button"].includes(e?.name)})(),icon:pa,iconPosition:"left","data-test":"insert-after"},(0,a.__)("Insert after the selected text","extendify-local")),(0,e.createElement)(t.MenuItem,{onClick:()=>C({replaceContent:!1,position:"end"}),disabled:o,icon:ma,iconPosition:"left","data-test":"insert-bottom"},(0,a.__)("Insert at bottom","extendify-local")),(0,e.createElement)(t.__experimentalDivider,null),(0,e.createElement)(t.MenuItem,{onClick:()=>{d(""),l({text:"",promptType:"",systemMessageKey:""}),setTimeout((()=>l(n)))},disabled:o,icon:fa,iconPosition:"left","data-test":"try-again-button"},(0,a.__)("Try again","extendify-local")),(0,e.createElement)(t.MenuItem,{onClick:()=>{d(""),l({text:"",promptType:"",systemMessageKey:""})},disabled:o,icon:ga,iconPosition:"left","data-test":"discard-button"},(0,a.__)("Discard","extendify-local")))},va=p,xa=({loading:n})=>{const[s,o]=(0,r.useState)(),{clearSelectedBlock:l}=(0,i.useDispatch)(c.store),{selectedText:u}=E();if((0,r.useEffect)((()=>{o(u)}),[o,u]),s)return(0,e.createElement)("div",{className:"mb-4 flex space-x-2 overflow-hidden rounded-sm border-none bg-gray-100 p-3","data-test":"existing-text-container"},(0,e.createElement)("div",null,(0,e.createElement)(g,{icon:va,className:"fill-current"})),(0,e.createElement)("div",null,(0,e.createElement)("div",{className:"mb-1 hyphens-auto text-pretty text-gray-800",dangerouslySetInnerHTML:{__html:s.split(" ").length<=20?s:`${s.split(" ",14).join(" ")}... ${s.slice(s.lastIndexOf(" ")-14)}`}}),(0,e.createElement)("div",{className:"mt-3 flex w-full justify-end"},(0,e.createElement)(t.Button,{size:"compact",onClick:l,disabled:n,icon:ga,iconPosition:"right",className:"relative cursor-pointer flex-row-reverse rounded bg-gray-300 text-gray-800 hover:bg-gray-400","data-test":"remove-selection"},(0,a.__)("Remove selection","extendify-local")))))},wa=window.wp.apiFetch;var ba=n.n(wa);const Ea=e=>{try{return JSON.parse(e)}catch(e){return{}}},Sa=e=>{let t;const n=new Set,i=(e,i)=>{const s="function"==typeof e?e(t):e;if(!Object.is(s,t)){const e=t;t=(null!=i?i:"object"!=typeof s||null===s)?s:Object.assign({},t,s),n.forEach((n=>n(t,e)))}},s=()=>t,r={setState:i,getState:s,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},o=t=e(i,s,r);return r};var Pa=n(798);const{useDebugValue:Ta}=e,{useSyncExternalStoreWithSelector:Ca}=Pa;let _a=!1;const ka=e=>e,Aa=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?Sa(e):Sa)(e):e,n=(e,n)=>function(e,t=ka,n){n&&!_a&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),_a=!0);const i=Ca(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ta(i),i}(t,e,n);return Object.assign(n,t),n},Va=e=>e?Aa(e):Aa,La=new Map,Ma=e=>{const t=La.get(e);return t?Object.fromEntries(Object.entries(t.stores).map((([e,t])=>[e,t.getState()]))):{}},Da=(e,t={})=>(n,i,s)=>{const{enabled:r,anonymousActionType:o,store:a,...l}=t;let c;try{c=(null==r||r)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!c)return r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(n,i,s);const{connection:u,...d}=((e,t,n)=>{if(void 0===e)return{type:"untracked",connection:t.connect(n)};const i=La.get(n.name);if(i)return{type:"tracked",store:e,...i};const s={connection:t.connect(n),stores:{}};return La.set(n.name,s),{type:"tracked",store:e,...s}})(a,c,l);let h=!0;s.setState=(e,t,r)=>{const c=n(e,t);if(!h)return c;const d=void 0===r?{type:o||"anonymous"}:"string"==typeof r?{type:r}:r;return void 0===a?(null==u||u.send(d,i()),c):(null==u||u.send({...d,type:`${a}/${d.type}`},{...Ma(l.name),[a]:s.getState()}),c)};const m=(...e)=>{const t=h;h=!1,n(...e),h=t},p=e(s.setState,i,s);if("untracked"===d.type?null==u||u.init(p):(d.stores[d.store]=s,null==u||u.init(Object.fromEntries(Object.entries(d.stores).map((([e,t])=>[e,e===d.store?p:t.getState()]))))),s.dispatchFromDevtools&&"function"==typeof s.dispatch){let e=!1;const t=s.dispatch;s.dispatch=(...n)=>{"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return u.subscribe((e=>{var t;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):Ra(e.payload,(e=>{if("__setState"!==e.type)s.dispatchFromDevtools&&"function"==typeof s.dispatch&&s.dispatch(e);else{if(void 0===a)return void m(e.state);1!==Object.keys(e.state).length&&console.error('\n [zustand devtools middleware] Unsupported __setState action format. \n When using \'store\' option in devtools(), the \'state\' should have only one key, which is a value of \'store\' that was passed in devtools(),\n and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }\n ');const t=e.state[a];if(null==t)return;JSON.stringify(s.getState())!==JSON.stringify(t)&&m(t)}}));case"DISPATCH":switch(e.payload.type){case"RESET":return m(p),void 0===a?null==u?void 0:u.init(s.getState()):null==u?void 0:u.init(Ma(l.name));case"COMMIT":return void 0===a?void(null==u||u.init(s.getState())):null==u?void 0:u.init(Ma(l.name));case"ROLLBACK":return Ra(e.state,(e=>{if(void 0===a)return m(e),void(null==u||u.init(s.getState()));m(e[a]),null==u||u.init(Ma(l.name))}));case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Ra(e.state,(e=>{void 0!==a?JSON.stringify(s.getState())!==JSON.stringify(e[a])&&m(e[a]):m(e)}));case"IMPORT_STATE":{const{nextLiftedState:n}=e.payload,i=null==(t=n.computedStates.slice(-1)[0])?void 0:t.state;if(!i)return;return m(void 0===a?i:i[a]),void(null==u||u.send(null,n))}case"PAUSE_RECORDING":return h=!h}return}})),p},Ra=(e,t)=>{let n;try{n=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==n&&t(n)};function Ia(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var i;const s=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),r=null!=(i=n.getItem(e))?i:null;return r instanceof Promise?r.then(s):s(r)},setItem:(e,i)=>n.setItem(e,JSON.stringify(i,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const Ba=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>Ba(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>Ba(t)(e)}}},ja=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?(console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),((e,t)=>(n,i,s)=>{let r={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1;const a=new Set,l=new Set;let c;try{c=r.getStorage()}catch(e){}if(!c)return e(((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...e)}),i,s);const u=Ba(r.serialize),d=()=>{const e=r.partialize({...i()});let t;const n=u({state:e,version:r.version}).then((e=>c.setItem(r.name,e))).catch((e=>{t=e}));if(t)throw t;return n},h=s.setState;s.setState=(e,t)=>{h(e,t),d()};const m=e(((...e)=>{n(...e),d()}),i,s);let p;const f=()=>{var e;if(!c)return;o=!1,a.forEach((e=>e(i())));const t=(null==(e=r.onRehydrateStorage)?void 0:e.call(r,i()))||void 0;return Ba(c.getItem.bind(c))(r.name).then((e=>{if(e)return r.deserialize(e)})).then((e=>{if(e){if("number"!=typeof e.version||e.version===r.version)return e.state;if(r.migrate)return r.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}})).then((e=>{var t;return p=r.merge(e,null!=(t=i())?t:m),n(p,!0),d()})).then((()=>{null==t||t(p,void 0),o=!0,l.forEach((e=>e(p)))})).catch((e=>{null==t||t(void 0,e)}))};return s.persist={setOptions:e=>{r={...r,...e},e.getStorage&&(c=e.getStorage())},clearStorage:()=>{null==c||c.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>f(),hasHydrated:()=>o,onHydrate:e=>(a.add(e),()=>{a.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},f(),p||m})(e,t)):((e,t)=>(n,i,s)=>{let r={storage:Ia((()=>localStorage)),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1;const a=new Set,l=new Set;let c=r.storage;if(!c)return e(((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...e)}),i,s);const u=()=>{const e=r.partialize({...i()});return c.setItem(r.name,{state:e,version:r.version})},d=s.setState;s.setState=(e,t)=>{d(e,t),u()};const h=e(((...e)=>{n(...e),u()}),i,s);let m;s.getInitialState=()=>h;const p=()=>{var e,t;if(!c)return;o=!1,a.forEach((e=>{var t;return e(null!=(t=i())?t:h)}));const s=(null==(t=r.onRehydrateStorage)?void 0:t.call(r,null!=(e=i())?e:h))||void 0;return Ba(c.getItem.bind(c))(r.name).then((e=>{if(e){if("number"!=typeof e.version||e.version===r.version)return[!1,e.state];if(r.migrate)return[!0,r.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]})).then((e=>{var t;const[s,o]=e;if(m=r.merge(o,null!=(t=i())?t:h),n(m,!0),s)return u()})).then((()=>{null==s||s(m,void 0),m=i(),o=!0,l.forEach((e=>e(m)))})).catch((e=>{null==s||s(void 0,e)}))};return s.persist={setOptions:e=>{r={...r,...e},e.storage&&(c=e.storage)},clearStorage:()=>{null==c||c.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>p(),hasHydrated:()=>o,onHydrate:e=>(a.add(e),()=>{a.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},r.skipHydration||p(),m||h})(e,t),Oa="/extendify/v1/draft/user-settings",Fa={getItem:async()=>await ba()({path:Oa}),setItem:async(e,t)=>await ba()({path:Oa,method:"POST",data:{state:t}})},Na={aiImageOptions:{prompt:"",style:"vivid",size:"1024x1024"},imageCredits:{remaining:10,total:10,refresh:void 0}},Ha=Va(ja(Da((e=>({...Na,...Ea(window.extDraftData?.globalState)?.state,updateImageCredits({remaining:t,total:n,refresh:i}){e((e=>({imageCredits:{...e.imageCredits,...t&&{remaining:t},...n&&{total:n},...i&&{refresh:i}}})))},subtractOneCredit(){e((e=>({imageCredits:{...e.imageCredits,remaining:e.imageCredits.remaining-1,refresh:new Date(Date.now()+864e5).getTime()}})))},resetImageCredits(){e({imageCredits:Na.imageCredits})},setAiImageOption(t,n){e((e=>({aiImageOptions:{...e.aiImageOptions,[t]:n}})))}})),{name:"Extendify Draft Globals"}),{name:"extendify_draft_settings",storage:Ia((()=>Fa)),skipHydration:!0,partialize:e=>({...e,aiImageOptions:{...e.aiImageOptions,prompt:""}})})),Ua="https://ai.extendify.com",za=["siteId","partnerId","wpVersion","wpLanguage","devbuild","isBlockTheme","showAIConsent","userGaveConsent","userId"],$a={...Object.fromEntries(Object.entries(window.extSharedData).filter((([e])=>za.includes(e))))},Ga=async(e="")=>{const t=new URLSearchParams({...$a});e&&t.append("query",e);const n=await fetch(`${Ua}/api/draft/image/unsplash?${t.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error("Bad response from server");const i=await n.json();if(!Array.isArray(i))throw new Error("Bad response from server");return{images:i,total:n.headers.get("X-Total"),perPage:n.headers.get("X-Per-Page"),requestID:n.headers.get("X-Request-Id")}},Wa="/extendify/v1/shared/activity",Za={getItem:()=>ba()({path:Wa}),setItem:(e,t)=>ba()({path:Wa,method:"POST",data:{state:t}})},Ka=Ea(window.extSharedData.activity),qa={actions:{}},Ya=Va(ja(Da(((e,t)=>{var n;return{...qa,...null!==(n=Ka?.state)&&void 0!==n?n:{},incrementActivity:n=>{e((e=>({...e,actions:{...e.actions,[n]:Number(t().actions[n]||0)+1}})))}}}),{name:"Extendify Activity"}),{name:"extendify_shared_activity",storage:Ia((()=>Za)),skipHydration:!0})),Xa=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fillRule:"evenodd",d:"M1.33333 1h9.33337c.1841 0 .3333.14924.3333.33333v5.57118L9.0152 4.97484c-.19406-.18867-.50302-.18867-.69708 0L5.93734 7.28948 3.98622 6.02487c-.17383-.11267-.39915-.10648-.56653.01557L1 7.8048V1.33333C1 1.14924 1.14924 1 1.33333 1ZM1 9.04241v1.62429c0 .1841.14924.3333.33333.3333h9.33337c.1841 0 .3333-.1492.3333-.3333V8.26877l-.0152.01565-2.31814-2.25373-2.31813 2.25373c-.16726.16261-.42473.18796-.62049.06108L3.73095 7.05109 1 9.04241ZM0 1.33333C0 .596954.596954 0 1.33333 0h9.33337C11.403 0 12 .596954 12 1.33333v9.33337C12 11.403 11.403 12 10.6667 12H1.33333C.596954 12 0 11.403 0 10.6667V1.33333Z",clipRule:"evenodd"})),Ja=({usedCredits:n,total:i})=>n<i?(0,e.createElement)("div",{className:"flex items-center justify-center gap-2"},(0,e.createElement)(t.Icon,{className:"fill-gray-700",icon:Xa,size:"12px"}),(0,e.createElement)("p",{className:"mb-0 text-[12px] text-gray-700"},(0,a.sprintf)( // translators: %1$s is the number of used credits, %2$s is the total credits (0,a.__)("%1$s of %2$s daily image credits used","extendify-local"),n,i))):(0,e.createElement)("div",{className:"flex gap-3 border-y-0 border-l-4 border-r-0 border-solid border-[#3858E9] bg-gray-100 p-3"},(0,e.createElement)("div",null,(0,e.createElement)(t.Icon,{icon:Xa,className:"fill-gray-900",size:"12px"})),(0,e.createElement)("div",{className:"flex flex-col gap-2"},(0,e.createElement)("p",{className:"mb-0 text-[12px] font-bold text-gray-700"},(0,a.sprintf)( // translators: %1$s is the number of used credits, %2$s is the total credits (0,a.__)("%1$s of %2$s daily image credits used","extendify-local"),n,i)),(0,e.createElement)("p",{className:"mb-0 text-gray-900"},(0,a.__)("You can still explore and find great images on Unsplash until your credits reset.","extendify-local")),(0,e.createElement)(t.Button,{href:"https://unsplash.com/",variant:"primary",target:"_blank",className:"justify-center text-center"},(0,a.__)("Search on Unsplash","extendify-local")))),Qa=({isGenerating:n,errorMessage:i})=>{const{imageCredits:s,resetImageCredits:o,aiImageOptions:l,setAiImageOption:c}=Ha(),u=s.total-s.remaining,[d,h]=(0,r.useState)(0),{size:m,prompt:p}=l;return(0,r.useEffect)((()=>{const e=()=>{h((e=>e+1)),s.refresh&&(new Date(Number(s.refresh))>new Date||o())};0===d&&e();const t=setTimeout(e,1e3);return()=>clearTimeout(t)}),[s,o,d]),(0,e.createElement)(e.Fragment,null,n?null:(0,e.createElement)("div",null,(0,e.createElement)(t.TextareaControl,{id:"draft-ai-image-textarea",placeholder:(0,a.__)("Tell AI about the image you would like to create","extendify-local"),label:(0,a.__)("Image Prompt","extendify-local"),hideLabelFromVision:!0,rows:"7",value:p,onChange:e=>c("prompt",e)}),(0,e.createElement)(t.__experimentalToggleGroupControl,{isBlock:!0,label:(0,a.__)("Aspect Ratio","extendify-local"),onChange:e=>c("size",e),value:m},(0,e.createElement)(t.__experimentalToggleGroupControlOptionIcon,{className:"m-auto",type:"button",icon:nl,label:(0,a.__)("Square: 1:1","extendify-local"),value:"1024x1024"}),(0,e.createElement)(t.__experimentalToggleGroupControlOptionIcon,{className:"m-auto",type:"button",icon:el,label:(0,a.__)("Landscape: 4:3","extendify-local"),value:"1792x1024"}),(0,e.createElement)(t.__experimentalToggleGroupControlOptionIcon,{className:"m-auto",type:"button",icon:tl,label:(0,a.__)("Portrait: 3:4","extendify-local"),value:"1024x1792"}))),i.length>0&&(0,e.createElement)("p",{className:"mb-0 text-red-500"},i),(0,e.createElement)(t.Button,{type:"submit",className:"w-full justify-center",variant:"primary",disabled:n||!p||u>=s.total},n?(0,a.__)("Generating image...","extendify-local"):(0,a.__)("Generate image","extendify-local")),n?(0,e.createElement)(t.Button,{type:"submit",className:"w-full justify-center bg-gray-200 text-gray-800"},(0,a.__)("Cancel","extendify-local")):(0,e.createElement)(Ja,{usedCredits:u,total:s.total}))},el=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{padding:"7px 4px"}},(0,e.createElement)("path",{fillRule:"evenodd",d:"M0 1c0-.552285.447715-1 1-1h14c.5523 0 1 .447715 1 1v8c0 .55228-.4477 1-1 1H1c-.552285 0-1-.44772-1-1V1Z",clipRule:"evenodd"})),tl=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{padding:"4px 6px"}},(0,e.createElement)("path",{fillRule:"evenodd",d:"M9.66669 3.5e-7C10.219 3.7e-7 10.6667.447716 10.6667 1v14c0 .5523-.4477 1-1.00001 1h-8c-.55229 0-1.000003-.4477-1.000003-1L.666688 1C.666688.447715 1.1144-2e-8 1.66669 0l8 3.5e-7Z",clipRule:"evenodd"})),nl=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",style:{padding:"6px"}},(0,e.createElement)("path",{fillRule:"evenodd",d:"M11.3333-4e-8c.5523 2e-8 1 .44771504 1 1.00000004v10c0 .5523-.4477 1-1 1H1.33333c-.552283 0-.999998-.4477-.999998-1V.999999C.333332.447715.781047-5e-7 1.33333-4.8e-7L11.3333-4e-8Z",clipRule:"evenodd"})),il=e=>new Promise(((t,n)=>{e.onload=()=>t(e),e.onerror=e=>n(e)})),sl=async(e,t,n,i,s={alt:"",caption:""})=>{let r;await((e,t,n={})=>fetch(`${Ua}/api/draft/image/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,source:t,...n})}))(e,n,{unsplashId:i});try{r=await(async(e,t={})=>{var n,i;const s=new Image;s.src=e,s.crossOrigin="anonymous",await il(s);const r=document.createElement("canvas");r.width=s.width,r.height=s.height;const o=r.getContext("2d");if(!o)return;o.drawImage(s,0,0);const a=await new Promise((e=>{r.toBlob((t=>{t&&e(t)}),"image/jpeg")})),l=new FormData;return l.append("file",new File([a],t.filename)),l.append("alt_text",null!==(n=t.alt)&&void 0!==n?n:""),l.append("caption",null!==(i=t.caption)&&void 0!==i?i:""),l.append("status","publish"),await ba()({path:"wp/v2/media",method:"POST",body:l})})(t,{alt:s.alt,filename:"image.jpg",caption:s.caption})}catch(e){r=await(async(e,t={})=>{var n,i;const s=new FormData;return s.append("source",e),s.append("alt_text",null!==(n=t.alt)&&void 0!==n?n:""),s.append("caption",null!==(i=t.caption)&&void 0!==i?i:""),await ba()({path:"/extendify/v1/draft/upload-image",method:"POST",body:s})})(t,{alt:s.alt,filename:"image.jpg",caption:s.caption})}return r},rl=(e,t,n)=>{if("core/image"===e.name&&n(e.clientId,{id:t.id,caption:t.caption.raw,url:t.source_url,alt:t.alt_text}),"core/media-text"===e.name&&n(e.clientId,{mediaId:t.id,caption:t.caption.raw,mediaUrl:t.source_url,mediaAlt:t.alt_text,mediaType:"image"}),"core/gallery"===e.name){const n=(0,u.createBlock)("core/image",{id:t.id,caption:t.caption.raw,url:t.source_url,alt:t.alt_text});(0,u.insertBlock)(n,null,e.clientId)}"core/cover"===e.name&&n(e.clientId,{id:t.id,url:t.source_url,alt:t.alt_text,backgroundType:"image",dimRatio:50,hasParallax:!1,isDark:!0,isRepeated:!1,layout:{type:"constrained"},tagName:"div",useFeaturedImage:!1})},ol=({prompt:n,size:o,isGenerating:l,id:u,src:d,clearImageResponse:h})=>{const{openGeneralSidebar:m}=(0,i.useDispatch)(s.store),{updateBlockAttributes:p}=(0,i.useDispatch)(c.store),[f,g]=(0,r.useState)(!1),y=(0,i.useSelect)((e=>e(c.store).getSelectedBlock()),[]),[v,x]=o.split("x");return""!==d||l?(0,e.createElement)("div",{className:"flex flex-col gap-5"},(0,e.createElement)($,null,l?(0,e.createElement)(ca.div,{initial:{opacity:1},exit:{opacity:0},className:"flex aspect-square w-full items-center justify-center",style:{background:"linear-gradient(135deg, #E8E8E8 47.92%, #F3F3F3 60.42%, #E8E8E8 72.92%)"}},(0,e.createElement)(t.Spinner,{style:{height:"48px",width:"48px"}})):(0,e.createElement)(ca.div,{initial:{opacity:0},animate:{opacity:1},className:"bg-gray-100",style:{aspectRatio:Number(v)/Number(x)}},(0,e.createElement)("img",{src:d,className:"block w-full",style:{aspectRatio:Number(v)/Number(x)}}))),l?(0,e.createElement)("p",null,(0,a.__)("Generating your image: ","extendify-local"),(0,e.createElement)("span",{className:"font-bold"},'"',n,'"')):(0,e.createElement)("form",{onSubmit:async e=>{e.preventDefault(),g(!0);const t=await sl(u,d,"ai-generated");t&&(await rl(y,t,p),g(!1),m("edit-post/block"),h())},className:"flex flex-col gap-5"},(0,e.createElement)(t.Button,{type:"submit",autoFocus:!0,className:"w-full justify-center",variant:"primary",disabled:f},f? // translators: "Importing image" means the image is being added to the WordPress post editor (0,a.__)("Importing image...","extendify-local"):(0,a.__)("Use this image","extendify-local")),(0,e.createElement)(t.Button,{className:"w-full justify-center bg-gray-200 text-gray-800 disabled:bg-gray-300 disabled:text-gray-700",onClick:h,disabled:f},(0,a.__)("Delete image","extendify-local")))):null},al=(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"12",fill:"none"},(0,e.createElement)("path",{fill:"#1E1E1E",fillRule:"evenodd",d:"M6.445 12.004.986 6l5.46-6.005 1.109 1.01L3.014 6l4.541 4.995-1.11 1.01Z",clipRule:"evenodd"})),ll=Va(Da((e=>({imageDetails:{src:"",id:void 0},setImageDetails:t=>{e((e=>({...e,imageDetails:t})))}})),{name:"Extendify Draft AI Image"}));const cl=[{slug:"ai-image",title:(0,a.__)("AI Image","extendify-local"),component:()=>{const{imageCredits:n,updateImageCredits:i,subtractOneCredit:s,aiImageOptions:o}=Ha(),[l,c]=(0,r.useState)(!1),[u,d]=(0,r.useState)(""),h=(0,r.useRef)(null),m=0===n.remaining,{imageDetails:p,setImageDetails:f}=ll(),{goBack:g}=dc();return(0,r.useEffect)((()=>{p.src||l||document.getElementById("draft-ai-image-textarea")?.focus()}),[p.src,l]),(0,e.createElement)(t.Panel,null,(0,e.createElement)("div",{className:"flex h-12 items-center gap-1 pl-1"},(0,e.createElement)("button",{className:"h-9 w-9 cursor-pointer border-0 bg-transparent",onClick:g,type:"button","aria-label":(0,a.__)("Go Back","extendify-local")},al),(0,e.createElement)(t.__experimentalHeading,{className:"mb-0"},(0,a.__)("AI Image Generator","extendify-local"))),(0,e.createElement)(t.PanelBody,{className:"-mt-4 border-t-0"},(0,e.createElement)(t.BaseControl,{label:(0,a.__)("Image Description","extendify-local")},(0,e.createElement)(ol,{prompt:o.prompt,size:o.size,isGenerating:l,id:p?.id,src:p?.src,clearImageResponse:()=>f({src:"",id:void 0})}),p.src?null:(0,e.createElement)("form",{onSubmit:async e=>{if(e.preventDefault(),d(""),m||l)h.current?.abort();else try{c(!0),s(),h.current=new AbortController;const{imageCredits:e,images:t,id:n}=await(async(e,t)=>{const n=await fetch(`${Ua}/api/draft/image`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},signal:t,body:JSON.stringify({...e,globalState:Ha.getState(),...$a})}),i=await n.json(),s={remaining:n.headers.get("x-ratelimit-remaining"),total:n.headers.get("x-ratelimit-limit"),refresh:n.headers.get("x-ratelimit-reset")};if(!n.ok){if(i.status&&"content-policy-violation"===i.status)throw{message:(0,a.__)("Your request was rejected as a result of our safety system. Your prompt may contain text that is not allowed by our safety system.","extendify-local"),imageCredits:s};throw{message:(0,a.__)("Service temporarily unavailable","extendify-local"),imageCredits:s}}return{images:i,imageCredits:s,id:n.headers.get("x-request-id")}})(o,h.current.signal);i(e),f({src:t[0].url,id:n})}catch(e){if(20===e?.code)return;if(!e?.imageCredits)return await new Promise((e=>setTimeout(e,1e3))),d(e.message),void i({remaining:n.remaining});i(e.imageCredits),d(e.message)}finally{c(!1)}},className:"flex flex-col gap-5"},(0,e.createElement)(Qa,{isGenerating:l,errorMessage:u})))))}}],ul=[{slug:"home",title:(0,a.__)("Home","extendify-local"),component:()=>{const{navigateTo:n}=dc();return(0,e.createElement)(t.PanelBody,null,(0,e.createElement)(t.BaseControl,{id:"extendify-draft-image-gen",label:(0,a.__)("AI Image Generator","extendify-local"),help:(0,a.__)("Use AI to generate custom images based on your description.","extendify-local")},(0,e.createElement)(t.Button,{variant:"primary",id:"extendify-draft-image-gen-button",className:"w-full justify-center",onClick:()=>n("ai-image")},(0,a.__)("Add a prompt","extendify-local"))),(0,e.createElement)(t.__experimentalSpacer,{marginY:"5"}),(0,e.createElement)(t.__experimentalDivider,null),(0,e.createElement)(t.BaseControl,{id:"extendify-draft-image-stock-photos",label:(0,a.__)("Discover Stock Photos","extendify-local"),help:(0,a.__)("Search and add free stock photos from Unsplash.com","extendify-local")},(0,e.createElement)(t.Button,{variant:"primary",className:"w-full justify-center",onClick:()=>n("unsplash")},(0,a.__)("Search Unsplash","extendify-local"))))}}],dl=({image:n,skeletonHeight:i,isInsertingImage:s,onClick:o})=>{const[a,l]=(0,r.useState)(""),[c,u]=(0,r.useState)(!1),d=n?.width?Number(n?.width)/Number(n?.height):122/i;return(0,r.useEffect)((()=>{if(!n?.user?.links?.html)return void l("");const e=new URL(n.user.links.html);e.searchParams.set("utm_source","extendify"),e.searchParams.set("utm_medium","referral"),l(e.toString())}),[n]),(0,r.useInsertionEffect)((()=>{if(!n?.urls||c)return;const e=new Image;e.src=n.urls.thumb||n.urls.small,il(e).then((()=>u(!0)))}),[n,c]),(0,e.createElement)(ca.div,{className:"relative mb-1",initial:{aspectRatio:d},animate:{aspectRatio:d}},(0,e.createElement)($,null,c?null:(0,e.createElement)(ca.div,{className:"absolute inset-0 z-10 bg-white",initial:{opacity:1},animate:{opacity:1},exit:{opacity:0}},(0,e.createElement)("div",{className:"animate-pulse absolute inset-0 z-10 bg-gray-150"}))),(0,e.createElement)("div",{className:"group relative"},(0,e.createElement)("button",{type:"button",className:k()("relative block border-0 p-0",{"cursor-pointer bg-transparent":!s,"bg-black":s}),onClick:()=>o(n),disabled:s},s&&s?.id===n?.id&&(0,e.createElement)("div",{className:"absolute inset-0 flex items-center justify-center"},(0,e.createElement)(t.Spinner,{style:{height:"24px",width:"24px"}})),(0,e.createElement)("img",{src:n?.urls?.thumb||n?.urls?.small,className:k()("block transition-opacity duration-300",{"opacity-50":s}),alt:n?.alt_description})),n?.user?.name&&a?(0,e.createElement)("a",{href:a,target:"_blank",className:k()("absolute bottom-1 bg-black/70 px-1 text-white no-underline opacity-0",{"group-focus-within:opacity-100 group-hover:opacity-100":!s}),rel:"noopener noreferrer"},`${n.user?.name}`):null))},hl=({imageData:t,isInsertingImage:n,onClick:i,loading:s})=>{var r;const o=null!==(r=t?.images?.length)&&void 0!==r?r:10;return s||t.images.length?(0,e.createElement)("div",{className:"columns-2 gap-1"},Array.from({length:o}).map(((s,r)=>{var o;const a=[150,175,200];return(0,e.createElement)(dl,{key:null!==(o=t?.images?.[r]?.id)&&void 0!==o?o:r,image:t?.images?.[r],skeletonHeight:a[r%a.length],isInsertingImage:n,onClick:i})}))):(0,a.__)("No images found.","extendify-local")};var ml=n(688);const pl=()=>{},fl=pl(),gl=Object,yl=e=>e===fl,vl=e=>"function"==typeof e,xl=(e,t)=>({...e,...t}),wl=new WeakMap;let bl=0;const El=e=>{const t=typeof e,n=e&&e.constructor,i=n==Date;let s,r;if(gl(e)!==e||i||n==RegExp)s=i?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(s=wl.get(e),s)return s;if(s=++bl+"~",wl.set(e,s),n==Array){for(s="@",r=0;r<e.length;r++)s+=El(e[r])+",";wl.set(e,s)}if(n==gl){s="#";const t=gl.keys(e).sort();for(;!yl(r=t.pop());)yl(e[r])||(s+=r+":"+El(e[r])+",");wl.set(e,s)}}return s},Sl=new WeakMap,Pl={},Tl={},Cl="undefined",_l=typeof window!=Cl,kl=typeof document!=Cl,Al=(e,t)=>{const n=Sl.get(e);return[()=>!yl(t)&&e.get(t)||Pl,i=>{if(!yl(t)){const s=e.get(t);t in Tl||(Tl[t]=s),n[5](t,xl(s,i),s||Pl)}},n[6],()=>!yl(t)&&t in Tl?Tl[t]:!yl(t)&&e.get(t)||Pl]};let Vl=!0;const[Ll,Ml]=_l&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[pl,pl],Dl={isOnline:()=>Vl,isVisible:()=>{const e=kl&&document.visibilityState;return yl(e)||"hidden"!==e}},Rl={initFocus:e=>(kl&&document.addEventListener("visibilitychange",e),Ll("focus",e),()=>{kl&&document.removeEventListener("visibilitychange",e),Ml("focus",e)}),initReconnect:e=>{const t=()=>{Vl=!0,e()},n=()=>{Vl=!1};return Ll("online",t),Ll("offline",n),()=>{Ml("online",t),Ml("offline",n)}}},Il=!e.useId,Bl=!_l||"Deno"in window,jl=Bl?e.useEffect:e.useLayoutEffect,Ol="undefined"!=typeof navigator&&navigator.connection,Fl=!Bl&&Ol&&(["slow-2g","2g"].includes(Ol.effectiveType)||Ol.saveData),Nl=e=>{if(vl(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?El(e):"",t]};let Hl=0;const Ul=()=>++Hl;async function zl(...e){const[t,n,i,s]=e,r=xl({populateCache:!0,throwOnError:!0},"boolean"==typeof s?{revalidate:s}:s||{});let o=r.populateCache;const a=r.rollbackOnError;let l=r.optimisticData;const c=r.throwOnError;if(vl(n)){const e=n,i=[],s=t.keys();for(const n of s)!/^\$(inf|sub)\$/.test(n)&&e(t.get(n)._k)&&i.push(n);return Promise.all(i.map(u))}return u(n);async function u(n){const[s]=Nl(n);if(!s)return;const[u,d]=Al(t,s),[h,m,p,f]=Sl.get(t),g=()=>{const e=h[s];return(vl(r.revalidate)?r.revalidate(u().data,n):!1!==r.revalidate)&&(delete p[s],delete f[s],e&&e[0])?e[0](2).then((()=>u().data)):u().data};if(e.length<3)return g();let y,v=i;const x=Ul();m[s]=[x,0];const w=!yl(l),b=u(),E=b.data,S=b._c,P=yl(S)?E:S;if(w&&(l=vl(l)?l(P,E):l,d({data:l,_c:P})),vl(v))try{v=v(P)}catch(e){y=e}if(v&&vl(v.then)){if(v=await v.catch((e=>{y=e})),x!==m[s][0]){if(y)throw y;return v}y&&w&&(e=>"function"==typeof a?a(e):!1!==a)(y)&&(o=!0,d({data:P,_c:fl}))}if(o&&!y)if(vl(o)){const e=o(v,P);d({data:e,error:fl,_c:fl})}else d({data:v,error:fl,_c:fl});if(m[s][1]=Ul(),Promise.resolve(g()).then((()=>{d({_c:fl})})),!y)return v;if(c)throw y}}const $l=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},Gl=(e,t)=>{if(!Sl.has(e)){const n=xl(Rl,t),i={},s=zl.bind(fl,e);let r=pl;const o={},a=(e,t)=>{const n=o[e]||[];return o[e]=n,n.push(t),()=>n.splice(n.indexOf(t),1)},l=(t,n,i)=>{e.set(t,n);const s=o[t];if(s)for(const e of s)e(n,i)},c=()=>{if(!Sl.has(e)&&(Sl.set(e,[i,{},{},{},s,l,a]),!Bl)){const t=n.initFocus(setTimeout.bind(fl,$l.bind(fl,i,0))),s=n.initReconnect(setTimeout.bind(fl,$l.bind(fl,i,1)));r=()=>{t&&t(),s&&s(),Sl.delete(e)}}};return c(),[e,s,c,r]}return[e,Sl.get(e)[4]]},[Wl,Zl]=Gl(new Map),Kl=xl({onLoadingSlow:pl,onSuccess:pl,onError:pl,onErrorRetry:(e,__,t,n,i)=>{const s=t.errorRetryCount,r=i.retryCount,o=~~((Math.random()+.5)*(1<<(r<8?r:8)))*t.errorRetryInterval;!yl(s)&&r>s||setTimeout(n,o,i)},onDiscarded:pl,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Fl?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:Fl?5e3:3e3,compare:(e,t)=>El(e)==El(t),isPaused:()=>!1,cache:Wl,mutate:Zl,fallback:{}},Dl),ql=(e,t)=>{const n=xl(e,t);if(t){const{use:i,fallback:s}=e,{use:r,fallback:o}=t;i&&r&&(n.use=i.concat(r)),s&&o&&(n.fallback=xl(s,o))}return n},Yl=(0,e.createContext)({}),Xl=_l&&window.__SWR_DEVTOOLS_USE__,Jl=Xl?window.__SWR_DEVTOOLS_USE__:[],Ql=e=>vl(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],ec=Jl.concat((e=>(t,n,i)=>e(t,n&&((...e)=>{const[i]=Nl(t),[,,,s]=Sl.get(Wl);if(i.startsWith("$inf$"))return n(...e);const r=s[i];return yl(r)?n(...e):(delete s[i],r)}),i)));Xl&&(window.__SWR_DEVTOOLS_REACT__=e);const tc=e.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),nc={dedupe:!0};gl.defineProperty((t=>{const{value:n}=t,i=(0,e.useContext)(Yl),s=vl(n),r=(0,e.useMemo)((()=>s?n(i):n),[s,i,n]),o=(0,e.useMemo)((()=>s?r:ql(i,r)),[s,i,r]),a=r&&r.provider,l=(0,e.useRef)(fl);a&&!l.current&&(l.current=Gl(a(o.cache||Wl),r));const c=l.current;return c&&(o.cache=c[0],o.mutate=c[1]),jl((()=>{if(c)return c[2]&&c[2](),c[3]}),[]),(0,e.createElement)(Yl.Provider,xl(t,{value:o}))}),"defaultValue",{value:Kl});const ic=(sc=(t,n,i)=>{const{cache:s,compare:r,suspense:o,fallbackData:a,revalidateOnMount:l,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:d,refreshWhenOffline:h,keepPreviousData:m}=i,[p,f,g,y]=Sl.get(s),[v,x]=Nl(t),w=(0,e.useRef)(!1),b=(0,e.useRef)(!1),E=(0,e.useRef)(v),S=(0,e.useRef)(n),P=(0,e.useRef)(i),T=()=>P.current,C=()=>T().isVisible()&&T().isOnline(),[_,k,A,V]=Al(s,v),L=(0,e.useRef)({}).current,M=yl(a)?i.fallback[v]:a,D=(e,t)=>{for(const n in L){const i=n;if("data"===i){if(!r(e[i],t[i])){if(!yl(e[i]))return!1;if(!r(U,t[i]))return!1}}else if(t[i]!==e[i])return!1}return!0},R=(0,e.useMemo)((()=>{const e=!!v&&!!n&&(yl(l)?!T().isPaused()&&!o&&(!!yl(c)||c):l),t=t=>{const n=xl(t);return delete n._k,e?{isValidating:!0,isLoading:!0,...n}:n},i=_(),s=V(),r=t(i),a=i===s?r:t(s);let u=r;return[()=>{const e=t(_());return D(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>a]}),[s,v]),I=(0,ml.useSyncExternalStore)((0,e.useCallback)((e=>A(v,((t,n)=>{D(n,t)||e()}))),[s,v]),R[0],R[1]),B=!w.current,j=p[v]&&p[v].length>0,O=I.data,F=yl(O)?M:O,N=I.error,H=(0,e.useRef)(F),U=m?yl(O)?H.current:O:F,z=!(j&&!yl(N))&&(B&&!yl(l)?l:!T().isPaused()&&(o?!yl(F)&&c:yl(F)||c)),$=!!(v&&n&&B&&z),G=yl(I.isValidating)?$:I.isValidating,W=yl(I.isLoading)?$:I.isLoading,Z=(0,e.useCallback)((async e=>{const t=S.current;if(!v||!t||b.current||T().isPaused())return!1;let n,s,o=!0;const a=e||{},l=!g[v]||!a.dedupe,c=()=>Il?!b.current&&v===E.current&&w.current:v===E.current,u={isValidating:!1,isLoading:!1},d=()=>{k(u)},h=()=>{const e=g[v];e&&e[1]===s&&delete g[v]},m={isValidating:!0};yl(_().data)&&(m.isLoading=!0);try{if(l&&(k(m),i.loadingTimeout&&yl(_().data)&&setTimeout((()=>{o&&c()&&T().onLoadingSlow(v,i)}),i.loadingTimeout),g[v]=[t(x),Ul()]),[n,s]=g[v],n=await n,l&&setTimeout(h,i.dedupingInterval),!g[v]||g[v][1]!==s)return l&&c()&&T().onDiscarded(v),!1;u.error=fl;const e=f[v];if(!yl(e)&&(s<=e[0]||s<=e[1]||0===e[1]))return d(),l&&c()&&T().onDiscarded(v),!1;const a=_().data;u.data=r(a,n)?a:n,l&&c()&&T().onSuccess(n,v,i)}catch(e){h();const t=T(),{shouldRetryOnError:n}=t;t.isPaused()||(u.error=e,l&&c()&&(t.onError(e,v,t),(!0===n||vl(n)&&n(e))&&(T().revalidateOnFocus&&T().revalidateOnReconnect&&!C()||t.onErrorRetry(e,v,t,(e=>{const t=p[v];t&&t[0]&&t[0](3,e)}),{retryCount:(a.retryCount||0)+1,dedupe:!0}))))}return o=!1,d(),!0}),[v,s]),K=(0,e.useCallback)(((...e)=>zl(s,E.current,...e)),[]);if(jl((()=>{S.current=n,P.current=i,yl(O)||(H.current=O)})),jl((()=>{if(!v)return;const e=Z.bind(fl,nc);let t=0;const n=((e,t,n)=>{const i=t[e]||(t[e]=[]);return i.push(n),()=>{const e=i.indexOf(n);e>=0&&(i[e]=i[i.length-1],i.pop())}})(v,p,((n,i={})=>{if(0==n){const n=Date.now();T().revalidateOnFocus&&n>t&&C()&&(t=n+T().focusThrottleInterval,e())}else if(1==n)T().revalidateOnReconnect&&C()&&e();else{if(2==n)return Z();if(3==n)return Z(i)}}));return b.current=!1,E.current=v,w.current=!0,k({_k:x}),z&&(yl(F)||Bl?e():(i=e,_l&&typeof window.requestAnimationFrame!=Cl?window.requestAnimationFrame(i):setTimeout(i,1))),()=>{b.current=!0,n()};var i}),[v]),jl((()=>{let e;function t(){const t=vl(u)?u(_().data):u;t&&-1!==e&&(e=setTimeout(n,t))}function n(){_().error||!d&&!T().isVisible()||!h&&!T().isOnline()?t():Z(nc).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[u,d,h,v]),(0,e.useDebugValue)(U),o&&yl(F)&&v){if(!Il&&Bl)throw new Error("Fallback data is required when using suspense in SSR.");S.current=n,P.current=i,b.current=!1;const e=y[v];if(!yl(e)){const t=K(e);tc(t)}if(!yl(N))throw N;{const e=Z(nc);yl(U)||(e.status="fulfilled",e.value=!0),tc(e)}}return{mutate:K,get data(){return L.data=!0,U},get error(){return L.error=!0,N},get isValidating(){return L.isValidating=!0,G},get isLoading(){return L.isLoading=!0,W}}},function(...t){const n=xl(Kl,(0,e.useContext)(Yl)),[i,s,r]=Ql(t),o=ql(n,r);let a=sc;const{use:l}=o,c=(l||[]).concat(ec);for(let e=c.length;e--;)a=c[e](a);return a(i,s||o.fetcher||null,o)});var sc;const rc=((e,t)=>(...n)=>{const[i,s,r]=Ql(n),o=(r.use||[]).concat(t);return e(i,s,{...r,use:o})})(ic,(e=>(t,n,i)=>(i.revalidateOnFocus=!1,i.revalidateIfStale=!1,i.revalidateOnReconnect=!1,e(t,n,i)))),oc=[{slug:"unsplash",title:(0,a.__)("Unsplash","extendify-local"),component:()=>{const{goBack:n}=dc(),[s,o]=(0,r.useState)(""),[l,u]=(0,r.useState)(""),[d,h]=(0,r.useState)(!1),{data:m,loading:p}=(e=>{const{data:t,error:n}=rc(e||"unsplash",Ga);return{data:t,error:n,loading:!t&&!n}})(l),[f,g]=(0,r.useState)(null),y=(0,i.useSelect)((e=>e(c.store).getSelectedBlock()),[]),{updateBlockAttributes:v}=(0,i.useDispatch)(c.store);return(0,r.useEffect)((()=>{h(!1)}),[l]),(0,r.useEffect)((()=>{if(!s)return u("");const e=setTimeout((()=>u(s)),300);return()=>clearTimeout(e)}),[s]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"flex h-12 items-center gap-1 pl-1"},(0,e.createElement)("button",{className:"h-9 w-9 cursor-pointer border-0 bg-transparent",onClick:n,type:"button","aria-label":(0,a.__)("Go Back","extendify-local")},al),(0,e.createElement)(t.__experimentalHeading,{className:"mb-0"},(0,a.__)("Photos from Unsplash","extendify-local"))),(0,e.createElement)(t.__experimentalDivider,{className:"my-0 border-gray-150"}),(0,e.createElement)("div",{className:"flex flex-col gap-2 p-4"},(0,e.createElement)(t.SearchControl,{autoFocus:!0,className:k()({"pointer-events-none bg-gray-150 opacity-50":f}),disabled:f,"aria-disabled":f,onChange:e=>{f||o(e)},value:s}),(0,e.createElement)(hl,{imageData:m,isInsertingImage:f,onClick:async e=>{if(!f){g(e);try{const t=await sl(m.requestID,e.urls?.regular,"unsplash",e.id);await rl(y,t,v)}catch(e){console.log(e)}finally{g(null)}}},loading:p||d})))}}],ac=[...ul,...cl,...oc],lc="/extendify/v1/draft/router-data",cc={getItem:async()=>await ba()({path:lc}),setItem:async(e,t)=>await ba()({path:lc,method:"POST",data:{state:t}})},uc=Va(ja(Da(((e,t)=>({history:[],viewedPages:[],current:null,goBack:()=>{if(t().history.length<2)return;const n=t().history[1];Ya.getState().incrementActivity(`draft-${n.slug}-back`),e((e=>({history:e.history.slice(1),current:n})))},setCurrent:n=>{n&&t().history[0]?.slug!==n.slug&&e((e=>{const t=(new Date).toISOString(),i=t,s=e.viewedPages.find((e=>e.slug===n.slug));return{history:[n,...e.history].filter(Boolean),current:n,viewedPages:[...e.viewedPages.filter((e=>e.slug!==n.slug)),s?{...s,count:s.count+1,lastViewedAt:t}:{slug:n.slug,firstViewedAt:i,lastViewedAt:t,count:1}]}}))}})),{name:"Extendify Draft Router"}),{name:"extendify-draft-router",storage:Ia((()=>cc)),skipHydration:!0,partialize:({viewedPages:e})=>({viewedPages:e})})),dc=()=>{var t;const{current:n,setCurrent:i,history:s,goBack:o}=uc(),a=null!==(t=n?.component)&&void 0!==t?t:()=>null;return(0,r.useEffect)((()=>{n||i(ac[0])}),[n,i]),{current:n,CurrentPage:(0,r.useCallback)((()=>(0,e.createElement)("div",{role:"region","aria-live":"polite",className:"h-full"},(0,e.createElement)("h1",{className:"sr-only"},n?.title),(0,e.createElement)(a,null))),[n]),navigateTo:e=>{const t=ac.find((t=>t.slug===e));if(!t)return i(ac[0]);Ya.getState().incrementActivity(`draft-${t.slug}`),i(t)},goBack:o,history:s}},hc=({setUserGaveConsent:t})=>{const{consentTermsHTML:n}=window.extSharedData;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"p-6"},(0,e.createElement)("h2",{className:"mb-2 mt-0 text-lg"},(0,a.__)("Terms of Use","extendify-local")),(0,e.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:n}}),(0,e.createElement)("button",{className:"mt-4 w-full cursor-pointer rounded border-0 bg-wp-theme-main px-4 py-2 text-center text-white",type:"button",onClick:()=>(async()=>{t(!0),window.extSharedData.userGaveConsent="1",await ba()({path:"/extendify/v1/shared/update-user-meta",method:"POST",data:{option:"ai_consent",value:!0}})})(),"data-test":"draft-terms-button"},(0,a.__)("Accept","extendify-local"))))},mc=()=>{var n;const{selectedText:s}=E(),[o,l]=(0,r.useState)(""),[h,m]=(0,r.useState)(!1),[p,g]=(0,r.useState)({text:"",promptType:"",systemMessageKey:"",details:{}}),{completion:y,loading:v,error:x}=((e,t,n,i)=>{const[s,o]=(0,r.useState)(""),[l,c]=(0,r.useState)(null),[u,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{let s,r=!1;const l=new TextDecoder;return e?((async()=>{o(""),c(!1),d(!0);const u=await(async(e,t,n,i)=>{const s=await fetch(`${Ua}/api/draft/completion`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e,promptType:t,systemMessageKey:n,details:i,globalState:Ha.getState(),...$a})});if(!s.ok)throw new Error((0,a.__)("Service temporarily unavailable","extendify-local"));return s})(e,t,n,i);s=u.body.getReader();let h=!1;for(;!h;){const{value:e,done:t}=await s.read();if(h=t,e&&!r){const t=l.decode(e);o((e=>e+t))}}})().finally((()=>{r||d(!1)})).catch((e=>{r||c(e)})),()=>{r=!0,s&&s.cancel()}):(d(!1),o(""),void(r=!0))}),[e,n,t,i]),{completion:s,error:l,loading:u}})(p.text,p.promptType,p.systemMessageKey,p.details),{selectedBlockClientIds:w,getBlock:b,getBlocks:S}=(0,i.useSelect)((e=>{const t=e(c.store);return{selectedBlockClientIds:t.getSelectedBlockClientIds(),getBlock:t.getBlock,getBlocks:t.getBlocks}}),[]),{insertBlocks:P,selectBlock:C}=(0,i.useDispatch)(c.store),{showAIConsent:_,userGaveConsent:k}=window.extSharedData,{CurrentPage:A,navigateTo:V}=dc(),[L,M]=(0,r.useState)(k),D=_&&!L;(0,r.useEffect)((()=>{const e=e=>{D||g(e.detail)};return window.addEventListener("extendify-draft:set-prompt",e),()=>window.removeEventListener("extendify-draft:set-prompt",e)}),[D]),(0,r.useEffect)((()=>{const e=new URLSearchParams(window.location.search);if(e.has("ext-add-image-block")){e.delete("ext-add-image-block"),window.history.replaceState({},"",window.location.pathname+"?"+e.toString());const t=S().find((e=>"core/image"===e.name));V("ai-image"),t?C(t.clientId):P((0,u.createBlock)("core/image",{}),1)}}),[C,P,V,S]),(0,r.useEffect)((()=>{x&&l(p.text)}),[x,p.text]);const R=()=>{if(0===w.length)return!1;const e=b(w[0]);return!!e&&void 0!==e?.attributes?.content&&""!==e?.attributes?.content};return D?(0,e.createElement)(hc,{setUserGaveConsent:M}):(()=>{if(0===w.length)return!1;const e=b(w[0]);return!!e&&["core/image","core/media-text","core/gallery","core/cover"].includes(e.name)})()?(0,e.createElement)(A,null):(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t.Panel,null,(0,e.createElement)(t.PanelBody,null,s&&(0,e.createElement)(xa,{loading:v}),(0,e.createElement)("div",{className:"mb-4 overflow-hidden rounded-sm border-none bg-gray-100"},!y&&(0,e.createElement)(da,{inputText:o,setInputText:l,ready:h,setReady:m,setPrompt:g,loading:v}),y&&(0,e.createElement)(d,{completion:y}),x&&(0,e.createElement)("div",{className:"mb-4 mt-2 px-4"},(0,e.createElement)("p",{className:"m-0 text-xs font-semibold text-red-500"},x.message))),(y||v)&&!x&&(0,e.createElement)(ya,{prompt:p,completion:y,setPrompt:g,setInputText:l,loading:v}),!v&&!y&&R()&&(0,e.createElement)(t.BaseControl,null,(0,e.createElement)(T,{completion:y,disabled:v,setInputText:l,setPrompt:g})),!v&&!y&&!R()&&(0,e.createElement)(t.BaseControl,{label:(0,a.__)("Suggested prompts","extendify-local")},(0,e.createElement)(f,{disabled:v,setInputText:l,setReady:m})))),window.extSharedData?.devbuild&&(0,e.createElement)(t.Panel,null,(0,e.createElement)(t.PanelBody,{title:"Debug",initialOpen:!1},(0,e.createElement)("label",null,"prompt text:"),(0,e.createElement)("pre",{className:"whitespace-pre-wrap"},p.text),(0,e.createElement)("label",null,"prompt system message:"),(0,e.createElement)("pre",{className:"whitespace-pre-wrap"},p.systemMessageKey),(0,e.createElement)("label",null,"completion:"),(0,e.createElement)("pre",{className:"whitespace-pre-wrap"},y),(0,e.createElement)("label",null,"error:"),(0,e.createElement)("pre",{className:"whitespace-pre-wrap"},null!==(n=x?.message)&&void 0!==n?n:""),(0,e.createElement)("label",null,"loading: ",v?(0,e.createElement)("span",null,"true"):(0,e.createElement)("span",null,"false")))))},pc=(e,t)=>"function"==typeof r.createRoot?(0,r.createRoot)(t).render(e):((0,r.render)(e,t),{unmount:()=>{(0,r.unmountComponentAtNode)(t)}}),fc=["core/image","core/media-text","core/gallery","core/cover"],gc=()=>{const{openGeneralSidebar:n}=(0,i.useDispatch)(s.store);return(0,e.createElement)(t.MenuItem,{icon:S,onClick:async()=>{n("extendify-draft/draft"),await new Promise((e=>requestAnimationFrame(e)));const e=document.getElementById("extendify-draft-image-gen-button");e?.focus(),e?.classList.add("animate-pulse-flash")}},(0,a.__)("Get Personalized Image","extendify-local"))},yc=()=>{const{openGeneralSidebar:n}=(0,i.useDispatch)(s.store);return(0,e.createElement)(t.ToolbarGroup,{className:"extendify-draft"},(0,e.createElement)(t.ToolbarButton,{className:"py-1.5 pl-2 pr-3 text-white before:bg-editor-main before:content-[''] hover:before:bg-editor-main-darker",icon:S,onClick:async()=>{n("extendify-draft/draft"),await new Promise((e=>requestAnimationFrame(e)));const e=document.getElementById("extendify-draft-image-gen-button");e?.focus(),e?.classList.add("animate-pulse-flash")}},(0,a.__)("Ask AI","extendify-local")))},vc=({name:t,attributes:n})=>((0,r.useEffect)((()=>{if(!fc.includes(t))return;let n,i,s,r,o;return(async()=>{await new Promise((e=>r=requestAnimationFrame(e)));const t=Array.from(document.querySelectorAll('[data-toolbar-item="true"]'))?.find((e=>e.textContent===(0,a.__)("Replace")||e.textContent===(0,a.__)("Add")));t&&(o=new MutationObserver((t=>{if("true"===t[0].target.getAttribute("aria-expanded")){const t=".block-editor-media-replace-flow__media-upload-menu",r=document.querySelector(t);if(!r)return;return n=document.createElement("div"),r.prepend(n),void(s=requestAnimationFrame((()=>{i=pc((0,e.createElement)(gc,null),n)})))}cancelAnimationFrame(s),i?.unmount(),n?.remove()})),o.observe(t,{attributes:!0,childList:!1,subtree:!1}))})(),()=>{[s,r].forEach(cancelAnimationFrame),i?.unmount(),n?.remove(),o?.disconnect()}}),[t,n]),fc.includes(t)?(0,e.createElement)(yc,null):null),xc=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M17.5 10h-1.7l-3.7 10.5h1.7l.9-2.6h3.9l.9 2.6h1.7L17.5 10zm-2.2 6.3 1.4-4 1.4 4h-2.8zm-4.8-3.8c1.6-1.8 2.9-3.6 3.7-5.7H16V5.2h-5.8V3H8.8v2.2H3v1.5h9.6c-.7 1.6-1.8 3.1-3.1 4.6C8.6 10.2 7.8 9 7.2 8H5.6c.6 1.4 1.7 2.9 2.9 4.4l-2.4 2.4c-.3.4-.7.8-1.1 1.2l1 1 1.2-1.2c.8-.8 1.6-1.5 2.3-2.3.8.9 1.7 1.7 2.5 2.5l.6-1.5c-.7-.6-1.4-1.3-2.1-2z"})}),wc=(0,m.jsx)(h.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(h.Path,{d:"M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"})}),bc=({text:n,closePopup:i,openDraft:s,updatePrompt:r})=>{const o=[{language:(0,a.__)("Bulgarian","extendify-local"),code:"bg_BG"},{language:(0,a.__)("Catalan","extendify-local"),code:"ca"},{language:(0,a.__)("Czech","extendify-local"),code:"cs_CZ"},{language:(0,a.__)("Danish","extendify-local"),code:"da_DK"},{language:(0,a.__)("Dutch","extendify-local"),code:"nl_NL"},{language:(0,a.__)("Dutch (Belgium)","extendify-local"),code:"de_BE"},{language:(0,a.__)("English","extendify-local"),code:"en"},{language:(0,a.__)("Estonian","extendify-local"),code:"et"},{language:(0,a.__)("Finnish","extendify-local"),code:"fi"},{language:(0,a.__)("French (Belgium)","extendify-local"),code:"fr_BE"},{language:(0,a.__)("French (Canada)","extendify-local"),code:"fr_CA"},{language:(0,a.__)("French (France)","extendify-local"),code:"fr_FR"},{language:(0,a.__)("German","extendify-local"),code:"de_DE"},{language:(0,a.__)("German (Switzerland)","extendify-local"),code:"de_CH"},{language:(0,a.__)("Hungarian","extendify-local"),code:"hu_HU"},{language:(0,a.__)("Indonesian","extendify-local"),code:"id_ID"},{language:(0,a.__)("Italian","extendify-local"),code:"it_IT"},{language:(0,a.__)("Japanese","extendify-local"),code:"jp"},{language:(0,a.__)("Norwegian","extendify-local"),code:"nb_NO"},{language:(0,a.__)("Polish","extendify-local"),code:"pl_PL"},{language:(0,a.__)("Portuguese (Brazil)","extendify-local"),code:"pt_BR"},{language:(0,a.__)("Portuguese (Portugal)","extendify-local"),code:"pt_PT"},{language:(0,a.__)("Russian","extendify-local"),code:"ru_RU"},{language:(0,a.__)("Slovak","extendify-local"),code:"sk_SK"},{language:(0,a.__)("Spanish (Spain)","extendify-local"),code:"es_ES"},{language:(0,a.__)("Swedish","extendify-local"),code:"sv_SE"},{language:(0,a.__)("Turkish","extendify-local"),code:"tr_TR"},{language:(0,a.__)("Ukrainian","extendify-local"),code:"uk"},{language:(0,a.__)("Vietnamese","extendify-local"),code:"vi"}];return(0,e.createElement)(t.Dropdown,{className:"my-container-class-name flex w-full items-center justify-between",contentClassName:"my-dropdown-content-classname",popoverProps:{placement:"right-start"},renderToggle:({isOpen:n,onToggle:i})=>(0,e.createElement)("div",{className:"group flex w-full items-center justify-between hover:text-design-main"},(0,e.createElement)(t.MenuItem,{className:"flex w-full justify-between",icon:xc,iconPosition:"left",variant:void 0,onClick:i,"aria-expanded":n},(0,a.__)("Translate","extendify-local")),(0,e.createElement)(g,{icon:wc,size:24,className:"fill-current group-hover:text-current"})),renderContent:()=>(0,e.createElement)(t.MenuGroup,{className:"extendify-draft",label:(0,e.createElement)("div",{className:"flex items-center gap-2"},(0,e.createElement)(g,{className:"fill-gray-900",size:16,icon:S}),(0,a.__)("Translate to...","extendify-local"))},o.map((({language:o,code:a,promptType:l="translate",systemMessageKey:c="edit"})=>(0,e.createElement)(t.MenuItem,{key:`${l}-${a}-${c}`,style:{width:"100%"},isSelected:!1,disabled:!1,variant:void 0,onClick:()=>{s?.(),i?.(),window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>r({text:n,promptType:l,systemMessageKey:c,details:{languageInto:o}})))))}},o))))})},Ec=["core/paragraph","core/list-item","core/verse","core/preformatted","core/heading"],Sc=(n,r)=>{const{clientId:o}=r,{getBlockName:l,getBlock:u}=(0,i.useSelect)((e=>e(c.store)),[]),{getActiveGeneralSidebarName:d}=(0,i.useSelect)((e=>e(s.store)),[]),{openGeneralSidebar:h}=(0,i.useDispatch)(s.store);if(!Ec.includes(l(o)))return(0,e.createElement)(n,{...r});const m=u(o)?.attributes?.content||"",p=()=>h("extendify-draft/draft"),f=e=>window.dispatchEvent(new CustomEvent("extendify-draft:set-prompt",{detail:e}));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n,{...r}),(0,e.createElement)(c.BlockControls,null,(0,e.createElement)(t.ToolbarGroup,{className:"extendify-draft"},(0,e.createElement)(t.Dropdown,{renderContent:({onClose:t})=>(0,e.createElement)(Pc,{text:m,closePopup:t,openDraft:p,updatePrompt:f}),renderToggle:({isOpen:n,onToggle:i})=>(0,e.createElement)(t.ToolbarButton,{className:"py-1.5 pl-2 pr-3 text-white before:bg-editor-main before:content-[''] hover:before:bg-editor-main-darker",onClick:()=>{if(!m)return"extendify-draft/draft"===d()?h("edit-post/block"):p();i()},"aria-expanded":n,"aria-haspopup":"true",icon:S},(0,a.__)("Ask AI","extendify-local"))}))))},Pc=({text:n,closePopup:i,openDraft:s,updatePrompt:r})=>{const o=[{label:(0,a.__)("Improve writing","extendify-local"),promptType:"improve-writing",systemMessageKey:"edit",icon:(0,e.createElement)(g,{icon:y}),disabled:()=>!1},{label:(0,a.__)("Fix spelling & grammar","extendify-local"),promptType:"fix-spelling-grammar",systemMessageKey:"edit",icon:(0,e.createElement)(g,{icon:v}),disabled:()=>!1},{label:(0,a.__)("Simplify language","extendify-local"),promptType:"simplify-language",systemMessageKey:"edit",icon:(0,e.createElement)(g,{icon:x}),disabled:()=>!1},{label:(0,a.__)("Make shorter","extendify-local"),promptType:"make-shorter",systemMessageKey:"edit",icon:(0,e.createElement)(g,{icon:P}),disabled:()=>!1},{label:(0,a.__)("Make longer","extendify-local"),promptType:"make-longer",systemMessageKey:"edit",icon:(0,e.createElement)(g,{icon:w}),disabled:()=>!1}];return(0,e.createElement)(t.NavigableMenu,{orientation:"vertical",role:"menu",style:{minWidth:"200px"}},(0,e.createElement)(t.MenuGroup,{className:"extendify-draft"},(0,e.createElement)(t.MenuItem,{key:"custom-prompt",style:{width:"100%"},isSelected:!1,disabled:!1,iconPosition:"left",icon:S,variant:void 0,onClick:()=>{s?.(),i?.(),window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>document.getElementById("draft-ai-textarea").focus()))))}},(0,a.__)("Custom prompt","extendify-local")),o.map((({label:o,promptType:a,systemMessageKey:l,disabled:c,icon:u})=>(0,e.createElement)(t.MenuItem,{key:`${a}-${a}-${l}`,style:{width:"100%"},isSelected:!1,disabled:c(),iconPosition:"left",icon:u,variant:void 0,onClick:()=>{s?.(),i?.(),window.requestAnimationFrame((()=>window.requestAnimationFrame((()=>r({text:n,promptType:a,systemMessageKey:l})))))}},o))),(0,e.createElement)(bc,{text:n,closePopup:i,openDraft:s,updatePrompt:r})))};(0,l.registerPlugin)("extendify-draft",{render:()=>(0,e.createElement)(Tc,null,(0,e.createElement)(s.PluginSidebarMoreMenuItem,{target:"draft"},(0,a.__)("Draft","extendify-local")),(0,e.createElement)(s.PluginSidebar,{name:"draft",icon:S,title:(0,a.__)("AI Tools","extendify-local"),className:"extendify-draft h-full"},(0,e.createElement)(t.Flex,{direction:"column",expanded:!0,justify:"space-between"},(0,e.createElement)(t.FlexBlock,null,(0,e.createElement)(mc,null)))))});const Tc=({children:e})=>{const{openGeneralSidebar:t}=(0,i.useDispatch)(s.store),n=(0,i.useSelect)((e=>e(s.store).getActiveGeneralSidebarName())),o=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(o.current)return;const e=requestAnimationFrame((()=>{o.current=!0,document.querySelector(".components-modal__screen-overlay .components-modal__header > button")?.click(),"extendify-draft/draft"!==n&&t("extendify-draft/draft")}));return()=>cancelAnimationFrame(e)}),[t,n]),e};(0,o.addFilter)("editor.BlockEdit","extendify-draft/draft-toolbar",(e=>t=>Sc(e,t))),(0,o.addFilter)("editor.BlockEdit","extendify-draft/draft-image",(n=>o=>((n,o)=>{const{openGeneralSidebar:l}=(0,i.useDispatch)(s.store),{clientId:u,name:d}=o;return(0,r.useEffect)((()=>{if(!fc.includes(d))return;const n=document.querySelector('iframe[name="editor-canvas"]')?.contentDocument,i=n?n.querySelector(`[data-block="${u}"]`):document.querySelector(`[data-block="${u}"]`);if(!i)return;const s=Object.assign(document.createElement("div"),{className:"components-form-file-upload"});let r;i.querySelector(".block-editor-media-placeholder .components-form-file-upload")?.after(s);const o=(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t.Button,{variant:"primary",onClick:async()=>{l("extendify-draft/draft"),await new Promise((e=>requestAnimationFrame(e)));const e=document.getElementById("extendify-draft-image-gen-button");e?.focus(),e?.classList.add("animate-pulse-flash")}},(0,a.__)("Get Personalized Image","extendify-local")),(0,e.createElement)("span",{"aria-hidden":"true"})),c=requestAnimationFrame((()=>{r=pc(o,s)}));return()=>{cancelAnimationFrame(c),r?.unmount(),s?.remove()}}),[u,l,d]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n,{...o}),(0,e.createElement)(c.BlockControls,null,(0,e.createElement)(vc,{...o})))})(n,o)))})()})();