@emailmaker/filemanager 0.10.78 → 0.10.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,62 @@
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import i,{useState as o,useEffect as a,createContext as s,useContext as l,useCallback as c,useRef as u,useMemo as d,createElement as h,memo as f,forwardRef as p,useImperativeHandle as g,Children as m,isValidElement as v,Fragment as y,useId as b,cloneElement as w,useLayoutEffect as x,useInsertionEffect as C}from"react";import{createRoot as _}from"react-dom/client";import{Spin as S,theme as A,ConfigProvider as k,App as E,Form as I,Input as T,Typography as F,Select as O,Tooltip as P,Button as M,Space as R,Segmented as L,Checkbox as N,Dropdown as j,Image as D,Col as z,Card as B,Row as U,Table as V,Empty as H,Pagination as W,Tree as $,Modal as q,Progress as G,Menu as Y,Divider as X,List as K,Avatar as Z,Layout as J,Radio as Q,Tag as ee,Carousel as te}from"antd";import re from"antd/es/alert/ErrorBoundary";import ne,{LoadingOutlined as ie,BarsOutlined as oe,AppstoreOutlined as ae,DownOutlined as se,RightOutlined as le,LinkOutlined as ce,UploadOutlined as ue,FileOutlined as de,FolderAddOutlined as he,FolderOpenOutlined as fe,FolderOutlined as pe,EyeOutlined as ge,CloseOutlined as me,LikeOutlined as ve,HistoryOutlined as ye,ExclamationCircleOutlined as be,FileImageOutlined as we,CheckCircleOutlined as xe,ArrowRightOutlined as Ce,ArrowLeftOutlined as _e,CheckOutlined as Se}from"@ant-design/icons";import*as Ae from"react-dom";import{createPortal as ke,flushSync as Ee}from"react-dom";function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Te(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ie(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ie(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fe(e){return Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fe(e)}function Oe(e){var t=function(e,t){if("object"!=Fe(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==Fe(t)?t:t+""}function Pe(e,t,r){return(t=Oe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Me(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(r),!0).forEach(function(t){Pe(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Me(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var Le={},Ne=[];function je(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var r=Ne.reduce(function(e,t){return t(null!=e?e:"","warning")},t);r&&console.error("Warning: ".concat(r))}}function De(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console){var r=Ne.reduce(function(e,t){return t(null!=e?e:"","note")},t);r&&console.warn("Note: ".concat(r))}}function ze(e,t,r){t||Le[r]||(e(!1,r),Le[r]=!0)}function Be(e,t){ze(je,e,t)}function Ue(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=new Set;return function e(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=n.has(t);if(Be(!a,"Warning: There may be circular references"),a)return!1;if(t===i)return!0;if(r&&o>1)return!1;n.add(t);var s=o+1;if(Array.isArray(t)){if(!Array.isArray(i)||t.length!==i.length)return!1;for(var l=0;l<t.length;l++)if(!e(t[l],i[l],s))return!1;return!0}if(t&&i&&"object"===Fe(t)&&"object"===Fe(i)){var c=Object.keys(t);return c.length===Object.keys(i).length&&c.every(function(r){return e(t[r],i[r],s)})}return!1}(e,t)}function Ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function He(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Oe(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Be.preMessage=function(e){Ne.push(e)},Be.resetWarned=function(){Le={}},Be.noteOnce=function(e,t){ze(De,e,t)};function We(e){return e.join("%")}var $e=function(){function e(t){Ve(this,e),Pe(this,"instanceId",void 0),Pe(this,"cache",new Map),Pe(this,"extracted",new Set),this.instanceId=t}return He(e,[{key:"get",value:function(e){return this.opGet(We(e))}},{key:"opGet",value:function(e){return this.cache.get(e)||null}},{key:"update",value:function(e,t){return this.opUpdate(We(e),t)}},{key:"opUpdate",value:function(e,t){var r=t(this.cache.get(e));null===r?this.cache.delete(e):this.cache.set(e,r)}}]),e}(),qe=["children"],Ge="data-css-hash",Ye="__cssinjs_instance__";function Xe(){var e=Math.random().toString(12).slice(2);if("undefined"!=typeof document&&document.head&&document.body){var t=document.body.querySelectorAll("style[".concat(Ge,"]"))||[],r=document.head.firstChild;Array.from(t).forEach(function(t){t[Ye]=t[Ye]||e,t[Ye]===e&&document.head.insertBefore(t,r)});var n={};Array.from(document.querySelectorAll("style[".concat(Ge,"]"))).forEach(function(t){var r,i=t.getAttribute(Ge);n[i]?t[Ye]===e&&(null===(r=t.parentNode)||void 0===r||r.removeChild(t)):n[i]=!0})}return new $e(e)}var Ke=n.createContext({hashPriority:"low",cache:Xe(),defaultCache:!0}),Ze=function(e){var t,r,i,o,a=e.children,s=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,qe),l=n.useContext(Ke),c=(t=function(){var e=Re({},l);Object.keys(s).forEach(function(t){var r=s[t];void 0!==s[t]&&(e[t]=r)});var t=s.cache;return e.cache=e.cache||Xe(),e.defaultCache=!t&&l.defaultCache,e},r=[l,s],i=function(e,t){return!Ue(e[0],t[0],!0)||!Ue(e[1],t[1],!0)},"value"in(o=n.useRef({})).current&&!i(o.current.condition,r)||(o.current.value=t(),o.current.condition=r),o.current.value);return n.createElement(Ke.Provider,{value:c},a)};var Je=function(){function e(){Ve(this,e),Pe(this,"cache",void 0),Pe(this,"keys",void 0),Pe(this,"cacheCallTimes",void 0),this.cache=new Map,this.keys=[],this.cacheCallTimes=0}return He(e,[{key:"size",value:function(){return this.keys.length}},{key:"internalGet",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i={map:this.cache};return e.forEach(function(e){var t;i?i=null===(t=i)||void 0===t||null===(t=t.map)||void 0===t?void 0:t.get(e):i=void 0}),null!==(t=i)&&void 0!==t&&t.value&&n&&(i.value[1]=this.cacheCallTimes++),null===(r=i)||void 0===r?void 0:r.value}},{key:"get",value:function(e){var t;return null===(t=this.internalGet(e,!0))||void 0===t?void 0:t[0]}},{key:"has",value:function(e){return!!this.internalGet(e)}},{key:"set",value:function(t,r){var n=this;if(!this.has(t)){if(this.size()+1>e.MAX_CACHE_SIZE+e.MAX_CACHE_OFFSET){var i=this.keys.reduce(function(e,t){var r=Te(e,2)[1];return n.internalGet(t)[1]<r?[t,n.internalGet(t)[1]]:e},[this.keys[0],this.cacheCallTimes]),o=Te(i,1)[0];this.delete(o)}this.keys.push(t)}var a=this.cache;t.forEach(function(e,i){if(i===t.length-1)a.set(e,{value:[r,n.cacheCallTimes++]});else{var o=a.get(e);o?o.map||(o.map=new Map):a.set(e,{map:new Map}),a=a.get(e).map}})}},{key:"deleteByPath",value:function(e,t){var r,n=e.get(t[0]);if(1===t.length)return n.map?e.set(t[0],{map:n.map}):e.delete(t[0]),null===(r=n.value)||void 0===r?void 0:r[0];var i=this.deleteByPath(n.map,t.slice(1));return n.map&&0!==n.map.size||n.value||e.delete(t[0]),i}},{key:"delete",value:function(e){if(this.has(e))return this.keys=this.keys.filter(function(t){return!function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(t,e)}),this.deleteByPath(this.cache,e)}}]),e}();function Qe(e,t,r){if(arguments.length>4&&void 0!==arguments[4]&&arguments[4])return e;var n=Re(Re({},arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}),{},Pe(Pe({},"data-token-hash",t),Ge,r)),i=Object.keys(n).map(function(e){var t=n[e];return t?"".concat(e,'="').concat(t,'"'):null}).filter(function(e){return e}).join(" ");return"<style ".concat(i,">").concat(e,"</style>")}Pe(Je,"MAX_CACHE_SIZE",20),Pe(Je,"MAX_CACHE_OFFSET",5),new Je,"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,Re({},n).useInsertionEffect,Re({},n).useInsertionEffect;if(process.env.NODE_ENV,"production"!==process.env.NODE_ENV&&"undefined"!=typeof module&&module&&module.hot&&"undefined"!=typeof window){var et="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:null;if(et&&"function"==typeof et.webpackHotUpdate){var tt=et.webpackHotUpdate;et.webpackHotUpdate=function(){return setTimeout(function(){0},0),tt.apply(void 0,arguments)}}}process.env.NODE_ENV;var rt="comm",nt="rule",it="decl",ot=Math.abs,at=String.fromCharCode;function st(e){return e.trim()}function lt(e,t,r){return e.replace(t,r)}function ct(e,t,r){return e.indexOf(t,r)}function ut(e,t){return 0|e.charCodeAt(t)}function dt(e,t,r){return e.slice(t,r)}function ht(e){return e.length}function ft(e,t){return t.push(e),e}var pt=1,gt=1,mt=0,vt=0,yt=0,bt="";function wt(e,t,r,n,i,o,a,s){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:pt,column:gt,length:a,return:"",siblings:s}}function xt(){return yt=vt>0?ut(bt,--vt):0,gt--,10===yt&&(gt=1,pt--),yt}function Ct(){return yt=vt<mt?ut(bt,vt++):0,gt++,10===yt&&(gt=1,pt++),yt}function _t(){return ut(bt,vt)}function St(){return vt}function At(e,t){return dt(bt,e,t)}function kt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Et(e){return st(At(vt-1,Ft(91===e?e+2:40===e?e+1:e)))}function It(e){for(;(yt=_t())&&yt<33;)Ct();return kt(e)>2||kt(yt)>3?"":" "}function Tt(e,t){for(;--t&&Ct()&&!(yt<48||yt>102||yt>57&&yt<65||yt>70&&yt<97););return At(e,St()+(t<6&&32==_t()&&32==Ct()))}function Ft(e){for(;Ct();)switch(yt){case e:return vt;case 34:case 39:34!==e&&39!==e&&Ft(yt);break;case 40:41===e&&Ft(e);break;case 92:Ct()}return vt}function Ot(e,t){for(;Ct()&&e+yt!==57&&(e+yt!==84||47!==_t()););return"/*"+At(t,vt-1)+"*"+at(47===e?e:Ct())}function Pt(e){for(;!kt(_t());)Ct();return At(e,vt)}function Mt(e){return function(e){return bt="",e}(Rt("",null,null,null,[""],e=function(e){return pt=gt=1,mt=ht(bt=e),vt=0,[]}(e),0,[0],e))}function Rt(e,t,r,n,i,o,a,s,l){for(var c=0,u=0,d=a,h=0,f=0,p=0,g=1,m=1,v=1,y=0,b="",w=i,x=o,C=n,_=b;m;)switch(p=y,y=Ct()){case 40:if(108!=p&&58==ut(_,d-1)){-1!=ct(_+=lt(Et(y),"&","&\f"),"&\f",ot(c?s[c-1]:0))&&(v=-1);break}case 34:case 39:case 91:_+=Et(y);break;case 9:case 10:case 13:case 32:_+=It(p);break;case 92:_+=Tt(St()-1,7);continue;case 47:switch(_t()){case 42:case 47:ft(Nt(Ot(Ct(),St()),t,r,l),l),5!=kt(p||1)&&5!=kt(_t()||1)||!ht(_)||" "===dt(_,-1,void 0)||(_+=" ");break;default:_+="/"}break;case 123*g:s[c++]=ht(_)*v;case 125*g:case 59:case 0:switch(y){case 0:case 125:m=0;case 59+u:-1==v&&(_=lt(_,/\f/g,"")),f>0&&(ht(_)-d||0===g&&47===p)&&ft(f>32?jt(_+";",n,r,d-1,l):jt(lt(_," ","")+";",n,r,d-2,l),l);break;case 59:_+=";";default:if(ft(C=Lt(_,t,r,c,u,i,s,b,w=[],x=[],d,o),o),123===y)if(0===u)Rt(_,t,C,C,w,o,d,s,x);else{switch(h){case 99:if(110===ut(_,3))break;case 108:if(97===ut(_,2))break;default:u=0;case 100:case 109:case 115:}u?Rt(e,C,C,n&&ft(Lt(e,C,C,0,0,i,s,b,i,w=[],d,x),x),i,x,d,s,n?w:x):Rt(_,C,C,C,[""],x,0,s,x)}}c=u=f=0,g=v=1,b=_="",d=a;break;case 58:d=1+ht(_),f=p;default:if(g<1)if(123==y)--g;else if(125==y&&0==g++&&125==xt())continue;switch(_+=at(y),y*g){case 38:v=u>0?1:(_+="\f",-1);break;case 44:s[c++]=(ht(_)-1)*v,v=1;break;case 64:45===_t()&&(_+=Et(Ct())),h=_t(),u=d=ht(b=_+=Pt(St())),y++;break;case 45:45===p&&2==ht(_)&&(g=0)}}return o}function Lt(e,t,r,n,i,o,a,s,l,c,u,d){for(var h=i-1,f=0===i?o:[""],p=function(e){return e.length}(f),g=0,m=0,v=0;g<n;++g)for(var y=0,b=dt(e,h+1,h=ot(m=a[g])),w=e;y<p;++y)(w=st(m>0?f[y]+" "+b:lt(b,/&\f/g,f[y])))&&(l[v++]=w);return wt(e,t,r,0===i?nt:s,l,c,u,d)}function Nt(e,t,r,n){return wt(e,t,r,rt,at(yt),dt(e,2,-2),0,n)}function jt(e,t,r,n,i){return wt(e,t,r,it,dt(e,0,n),dt(e,n+1,-1),n,i)}function Dt(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function zt(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case it:return e.return=e.return||e.value;case rt:return"";case"@keyframes":return e.return=e.value+"{"+Dt(e.children,n)+"}";case nt:if(!ht(e.value=e.props.join(",")))return""}return ht(r=Dt(e.children,n))?e.return=e.value+"{"+r+"}":""}function Bt(e){return e.notSplit=!0,e}Pe(Pe(Pe({},"style",function(e,t,r){var n=Te(e,6),i=n[0],o=n[1],a=n[2],s=n[3],l=n[4],c=n[5],u=(r||{}).plain;if(l)return null;var d=i,h={"data-rc-order":"prependQueue","data-rc-priority":"".concat(c)};return d=Qe(i,o,a,h,u),s&&Object.keys(s).forEach(function(e){if(!t[e]){t[e]=!0;var r=function(e){return Dt(Mt(e),zt).replace(/\{%%%\:[^;];}/g,";")}(s[e]),n=Qe(r,o,"_effect-".concat(e),h,u);e.startsWith("@layer")?d=n+d:d+=n}}),[c,a,d]}),"token",function(e,t,r){var n=Te(e,5),i=n[2],o=n[3],a=n[4],s=(r||{}).plain;if(!o)return null;var l=i._tokenKey;return[-999,l,Qe(o,a,l,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},s)]}),"cssVar",function(e,t,r){var n=Te(e,4),i=n[1],o=n[2],a=n[3],s=(r||{}).plain;if(!i)return null;return[-999,o,Qe(i,a,o,{"data-rc-order":"prependQueue","data-rc-priority":"".concat(-999)},s)]}),Bt(["borderTop","borderBottom"]),Bt(["borderTop"]),Bt(["borderBottom"]),Bt(["borderLeft","borderRight"]),Bt(["borderLeft"]),Bt(["borderRight"]);const Ut={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};function Vt(e,t){return t}function Ht(e,t){return e.filter(e=>void 0!==e)}var Wt;function $t(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:function(e){if(!Yt.includes(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(void 0===t)return!0;const r=t.prototype;if(null===r||"object"!=typeof r||!Yt.includes(Object.prototype.toString.call(r)))return!1;if(!r.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)?1:e instanceof Set?3:e instanceof Map?4:5}function qt(e,t){return"object"==typeof e&&Object.prototype.propertyIsEnumerable.call(e,t)}function Gt(e){let t=0,r=e[0]?.[Symbol.iterator]();return{[Symbol.iterator]:()=>({next(){for(;;){if(void 0===r)return{done:!0,value:void 0};const n=r.next();if(!0!==n.done)return{done:!1,value:n.value};t+=1,r=e[t]?.[Symbol.iterator]()}}})}}!function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"}(Wt||(Wt={}));const Yt=["[object Object]","[object Module]"];const Xt={mergeRecords:function(e,t,r){const n={};for(const i of function(e){const t=new Set;for(const r of e)for(const e of[...Object.keys(r),...Object.getOwnPropertySymbols(r)])t.add(e);return t}(e)){const o=[];for(const t of e)qt(t,i)&&o.push(t[i]);if(0===o.length)continue;const a=t.metaDataUpdater(r,{key:i,parents:e}),s=Zt(o,t,a);s!==Ut.skip&&("__proto__"===i?Object.defineProperty(n,i,{value:s,configurable:!0,enumerable:!0,writable:!0}):n[i]=s)}return n},mergeArrays:function(e){return e.flat()},mergeSets:function(e){return new Set(Gt(e))},mergeMaps:function(e){return new Map(Gt(e))},mergeOthers:function(e){return e.at(-1)}};function Kt(...e){return function(e,t){const r=function(e,t){return{defaultMergeFunctions:Xt,mergeFunctions:{...Xt,...Object.fromEntries(Object.entries(e).filter(([e,t])=>Object.hasOwn(Xt,e)).map(([e,t])=>!1===t?[e,Xt.mergeOthers]:[e,t]))},metaDataUpdater:e.metaDataUpdater??Vt,deepmerge:t,useImplicitDefaultMerging:e.enableImplicitDefaultMerging??!1,filterValues:!1===e.filterValues?void 0:e.filterValues??Ht,actions:Ut}}(e,n);function n(...e){return Zt(e,r,t)}return n}({})(...e)}function Zt(e,t,r){const n=t.filterValues?.(e,r)??e;if(0===n.length)return;if(1===n.length)return Jt(n,t,r);const i=$t(n[0]);if(0!==i&&5!==i)for(let e=1;e<n.length;e++)if($t(n[e])!==i)return Jt(n,t,r);switch(i){case 1:return function(e,t,r){const n=t.mergeFunctions.mergeRecords(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords)return t.defaultMergeFunctions.mergeRecords(e,t,r);return n}(n,t,r);case 2:return function(e,t,r){const n=t.mergeFunctions.mergeArrays(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays)return t.defaultMergeFunctions.mergeArrays(e);return n}(n,t,r);case 3:return function(e,t,r){const n=t.mergeFunctions.mergeSets(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets)return t.defaultMergeFunctions.mergeSets(e);return n}(n,t,r);case 4:return function(e,t,r){const n=t.mergeFunctions.mergeMaps(e,t,r);if(n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps)return t.defaultMergeFunctions.mergeMaps(e);return n}(n,t,r);default:return Jt(n,t,r)}}function Jt(e,t,r){const n=t.mergeFunctions.mergeOthers(e,t,r);return n===Ut.defaultMerge||t.useImplicitDefaultMerging&&void 0===n&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):n}const Qt="my_files",er="gif",tr="stock_images",rr="icons",nr="ai",ir="editor",or="Trash",ar="light",sr="dark",lr="system",cr="(prefers-color-scheme: dark)",ur=!1,dr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiBmaWxsPSIjRjVGNUY1Ii8+CjxwYXRoIGQ9Ik0yNCAzMkw0MCA0OEw1NiAzMkw2NCA0MEw2NCA2NEgyNFYzMloiIGZpbGw9IiNEOUQ5RDkiLz4KPC9zdmc+",hr=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif"],fr=["jpg","jpeg","png","bmp","webp","svg","ico","tiff","tif","gif"],pr={keywords:"",color:"",orientation:""};S.setDefaultIndicator(e(()=>e(ie,{style:{fontSize:48,height:"100%"},spin:!0}),{}));const gr={hashed:!1,algorithm:A.defaultAlgorithm,token:{colorLink:"#1677ff",colorInfo:"#722ed1",colorTextBase:"#000000",colorBgLayout:"#f0f2f5",borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,borderWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},components:{Progress:{colorFillSecondary:"#ffffff"},Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},mr={hashed:!1,algorithm:A.darkAlgorithm,token:{colorBgBase:"#1F1F1F",colorInfo:"#9254de",colorLink:"#1890ff",colorLinkHover:"#69c0ff",wireframe:!1,borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,borderWidth:1,colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},components:{Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},vr=({externalTheme:t=ar,children:r,customThemeToken:n})=>{const i=matchMedia(cr).matches?sr:ar,s=t===lr?i:t,[l,c]=o(s),[u,d]=o("light"===l?gr:mr);return a(()=>{c(s)},[s]),a(()=>{const e="light"===l?gr:mr,t=n?Kt(e.token,n):e.token;d(Object.assign(Object.assign({},e),{token:t}))},[d,l,n]),e("div",{id:"file-manager-element-id",style:{height:"100%"},children:e(k,{theme:u,children:e(Ze,{transformers:[],children:e(E,{style:{height:"100%"},children:r})})})})},yr={fileManager:{locale:"en_US",mode:"fileManager",theme:"light",enabledTabs:["editor"]},imageCenter:{locale:"en_US",mode:"imageCenter",theme:"light",enabledTabs:["stock","gif","editor"]},plugin:{locale:"en_US",mode:"plugin",theme:"light",enabledTabs:["editor","stock","gif","ai"]}},br=(e="fileManager",t)=>"imageCenter"===e&&t?t:Object.assign({},yr[e]);let wr=!1;const xr=()=>{if(wr)return;window.addEventListener("error",e=>!(!e.message||!e.message.includes("ResizeObserver loop completed with undelivered notifications"))&&(e.stopImmediatePropagation(),e.preventDefault(),!0),!0);const e=window.onerror;window.onerror=(t,r,n,i,o)=>!("string"!=typeof t||!t.includes("ResizeObserver loop completed with undelivered notifications"))||!!e&&e(t,r,n,i,o),window.addEventListener("unhandledrejection",e=>{var t,r;(null===(r=null===(t=e.reason)||void 0===t?void 0:t.message)||void 0===r?void 0:r.includes("ResizeObserver loop completed with undelivered notifications"))&&e.preventDefault()});const t=console.error;if(console.error=(...e)=>{var r;((null===(r=e[0])||void 0===r?void 0:r.toString())||"").includes("ResizeObserver loop completed with undelivered notifications")||t.apply(console,e)},"undefined"!=typeof window){const e=()=>{try{["webpackHotUpdate","__webpack_require__","__webpack_hash__"].forEach(e=>{if(window[e]){const e=window.__webpack_require__;e&&"object"==typeof e&&null!==e&&"cache"in e&&console.warn("✅ Webpack detected, additional protection from ResizeObserver errors activated")}})}catch(e){console.warn("Error when searching for webpack objects:",e)}};e(),setTimeout(e,1e3)}wr=!0},Cr=()=>{wr=!1},_r=e=>{if(!e)return"image/png";const t=e.toLowerCase();return t.includes("jpeg")||t.includes("jpg")||t.includes("pjpeg")?"image/jpeg":t.includes("png")?"image/png":t.includes("gif")?"image/gif":t.includes("webp")?"image/webp":t.includes("svg")?"image/svg+xml":"image/png"},Sr=e=>{if(!e.startsWith("data:"))return null;const t=e.match(/^data:([^;,]+)/);return t?t[1]:null},Ar=(e,t="image/png")=>{let r=t;if("string"==typeof e&&e.startsWith("data:")){const t=Sr(e);t&&t.startsWith("image/")&&(r=t)}return _r(r)},kr=e=>{const t=_r(e).split("/")[1];return"svg+xml"===t?"svg":t||"png"};function Er(e){var t;switch(null===(t=e.trim().split(".").pop())||void 0===t?void 0:t.toLowerCase()){case"svg":return"image/svg+xml";case"png":return"image/png";case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return}}function Ir(e){var t,r,n,i;if(null===(r=null===(t=e.type)||void 0===t?void 0:t.startsWith)||void 0===r?void 0:r.call(t,"image/"))return!0;const o=(null!==(n=e.name)&&void 0!==n?n:"").trim();if(Er(o))return!0;const a=(null!==(i=e.type)&&void 0!==i?i:"").toLowerCase();return!!a.includes("svg")||("text/xml"===a||"application/xml"===a||"text/plain"===a)&&o.toLowerCase().endsWith(".svg")}const Tr=/^data:(.+?);base64,(.+)$/i,Fr=e=>{const t=(e=>{if("function"!=typeof globalThis.atob)throw new Error("Base64 decoding is not supported in the current environment.");return globalThis.atob(e)})(e),r=t.length,n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n},Or=(e,t)=>{const r=e.replace(/\s/g,""),n=Fr(r),i=new ArrayBuffer(n.length);return new Uint8Array(i).set(n),new Blob([i],{type:t})},Pr=(e,t="application/octet-stream")=>{if(e instanceof Blob)return e;if("string"==typeof e){const r=e.trim(),n=r.match(Tr);if(n){const[,e,t]=n;return Or(t,e)}return Or(r,t)}throw new Error("Unsupported data type. Expected Blob or base64 string.")},Mr={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"y","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"ts","ч":"ch","ш":"sh","щ":"sch","ъ":"","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ё":"Yo","Ж":"Zh","З":"Z","И":"I","Й":"Y","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"Ts","Ч":"Ch","Ш":"Sh","Щ":"Sch","Ъ":"","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya"},Rr=/[<>:"/\\|?*()#\x00-\x1f]/g,Lr={transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0};function Nr(e,t){let r=e;return t.transliterate&&(r=r.normalize("NFC").split("").map(e=>{var t;return null!==(t=Mr[e])&&void 0!==t?t:e}).join("")),t.removeForbiddenChars&&(r=r.replace(Rr,"_")),t.replaceSpaces&&(r=r.replace(/\s+/g,"_")),t.toLowerCase&&(r=r.toLowerCase()),r=r.replace(/_{2,}/g,"_"),r=r.replace(/^_+|_+$/g,""),r.length>255&&(r=r.substring(0,255)),r}function jr(e,t){const r=Object.assign(Object.assign({},Lr),null==t?void 0:t.fileNameProcessing),n=e.lastIndexOf(".");let i,o;n>0?(i=e.substring(0,n),o=e.substring(n).toLowerCase()):(i=e,o="");return(Nr(i,r)||"unnamed_file")+o}function Dr(e,t){return Nr(e,Object.assign(Object.assign({},Lr),null==t?void 0:t.folderNameProcessing))||"unnamed_folder"}function zr(e){return!0===(null==e?void 0:e.dedupeUploadNamesOnClient)}const Br=e=>"string"==typeof e,Ur=()=>{let e,t;const r=new Promise((r,n)=>{e=r,t=n});return r.resolve=e,r.reject=t,r},Vr=e=>null==e?"":""+e,Hr=/###/g,Wr=e=>e&&e.indexOf("###")>-1?e.replace(Hr,"."):e,$r=e=>!e||Br(e),qr=(e,t,r)=>{const n=Br(t)?t.split("."):t;let i=0;for(;i<n.length-1;){if($r(e))return{};const t=Wr(n[i]);!e[t]&&r&&(e[t]=new r),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return $r(e)?{}:{obj:e,k:Wr(n[i])}},Gr=(e,t,r)=>{const{obj:n,k:i}=qr(e,t,Object);if(void 0!==n||1===t.length)return void(n[i]=r);let o=t[t.length-1],a=t.slice(0,t.length-1),s=qr(e,a,Object);for(;void 0===s.obj&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),s=qr(e,a,Object),s?.obj&&void 0!==s.obj[`${s.k}.${o}`]&&(s.obj=void 0);s.obj[`${s.k}.${o}`]=r},Yr=(e,t)=>{const{obj:r,k:n}=qr(e,t);if(r&&Object.prototype.hasOwnProperty.call(r,n))return r[n]},Xr=(e,t,r)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?Br(e[n])||e[n]instanceof String||Br(t[n])||t[n]instanceof String?r&&(e[n]=t[n]):Xr(e[n],t[n],r):e[n]=t[n]);return e},Kr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Zr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const Jr=e=>Br(e)?e.replace(/[&<>"'\/]/g,e=>Zr[e]):e;const Qr=[" ",",","?","!",";"],en=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const r=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,r),this.regExpQueue.push(e),r}}(20),tn=(e,t,r=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const n=t.split(r);let i=e;for(let e=0;e<n.length;){if(!i||"object"!=typeof i)return;let t,o="";for(let a=e;a<n.length;++a)if(a!==e&&(o+=r),o+=n[a],t=i[o],void 0!==t){if(["string","number","boolean"].indexOf(typeof t)>-1&&a<n.length-1)continue;e+=a-e+1;break}i=t}return i},rn=e=>e?.replace("_","-"),nn={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class on{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||nn,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,r,n){return n&&!this.debug?null:(Br(e[0])&&(e[0]=`${r}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new on(this.logger,{prefix:`${this.prefix}:${e}:`,...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new on(this.logger,e)}}var an=new on;class sn{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);const r=this.observers[e].get(t)||0;this.observers[e].set(t,r+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e,...t){if(this.observers[e]){Array.from(this.observers[e].entries()).forEach(([e,r])=>{for(let n=0;n<r;n++)e(...t)})}if(this.observers["*"]){Array.from(this.observers["*"].entries()).forEach(([r,n])=>{for(let i=0;i<n;i++)r.apply(r,[e,...t])})}}}class ln extends sn{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,r,n={}){const i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,o=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],r&&(Array.isArray(r)?a.push(...r):Br(r)&&i?a.push(...r.split(i)):a.push(r)));const s=Yr(this.data,a);return!s&&!t&&!r&&e.indexOf(".")>-1&&(e=a[0],t=a[1],r=a.slice(2).join(".")),!s&&o&&Br(r)?tn(this.data?.[e]?.[t],r,i):s}addResource(e,t,r,n,i={silent:!1}){const o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let a=[e,t];r&&(a=a.concat(o?r.split(o):r)),e.indexOf(".")>-1&&(a=e.split("."),n=t,t=a[1]),this.addNamespaces(t),Gr(this.data,a,n),i.silent||this.emit("added",e,t,r,n)}addResources(e,t,r,n={silent:!1}){for(const n in r)(Br(r[n])||Array.isArray(r[n]))&&this.addResource(e,t,n,r[n],{silent:!0});n.silent||this.emit("added",e,t,r)}addResourceBundle(e,t,r,n,i,o={silent:!1,skipCopy:!1}){let a=[e,t];e.indexOf(".")>-1&&(a=e.split("."),n=r,r=t,t=a[1]),this.addNamespaces(t);let s=Yr(this.data,a)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),n?Xr(s,r,i):s={...s,...r},Gr(this.data,a,s),o.silent||this.emit("added",e,t,r)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var cn={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,n,i){return e.forEach(e=>{t=this.processors[e]?.process(t,r,n,i)??t}),t}};const un=Symbol("i18next/PATH_KEY");function dn(e,t){const{[un]:r}=e(function(){const e=[],t=Object.create(null);let r;return t.get=(n,i)=>(r?.revoke?.(),i===un?e:(e.push(i),r=Proxy.revocable(n,t),r.proxy)),Proxy.revocable(Object.create(null),t).proxy}());return r.join(t?.keySeparator??".")}const hn={},fn=e=>!Br(e)&&"boolean"!=typeof e&&"number"!=typeof e;class pn extends sn{constructor(e,t={}){super(),((e,t,r)=>{e.forEach(e=>{t[e]&&(r[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=an.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){const r={...t};if(null==e)return!1;const n=this.resolve(e,r);return void 0!==n?.res}extractFromKey(e,t){let r=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===r&&(r=":");const n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let i=t.ns||this.options.defaultNS||[];const o=r&&e.indexOf(r)>-1,a=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||((e,t,r)=>{t=t||"",r=r||"";const n=Qr.filter(e=>t.indexOf(e)<0&&r.indexOf(e)<0);if(0===n.length)return!0;const i=en.getRegExp(`(${n.map(e=>"?"===e?"\\?":e).join("|")})`);let o=!i.test(e);if(!o){const t=e.indexOf(r);t>0&&!i.test(e.substring(0,t))&&(o=!0)}return o})(e,r,n));if(o&&!a){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:Br(i)?[i]:i};const o=e.split(r);(r!==n||r===n&&this.options.ns.indexOf(o[0])>-1)&&(i=o.shift()),e=o.join(n)}return{key:e,namespaces:Br(i)?[i]:i}}translate(e,t,r){let n="object"==typeof t?{...t}:t;if("object"!=typeof n&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof n&&(n={...n}),n||(n={}),null==e)return"";"function"==typeof e&&(e=dn(e,{...this.options,...n})),Array.isArray(e)||(e=[String(e)]);const i=void 0!==n.returnDetails?n.returnDetails:this.options.returnDetails,o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(e[e.length-1],n),l=s[s.length-1];let c=void 0!==n.nsSeparator?n.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const u=n.lng||this.language,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===u?.toLowerCase())return d?i?{res:`${l}${c}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:`${l}${c}${a}`:i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l,usedParams:this.getUsedParamsDetails(n)}:a;const h=this.resolve(e,n);let f=h?.res;const p=h?.usedKey||a,g=h?.exactUsedKey||a,m=void 0!==n.joinArrays?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,y=void 0!==n.count&&!Br(n.count),b=pn.hasDefaultValue(n),w=y?this.pluralResolver.getSuffix(u,n.count,n):"",x=n.ordinal&&y?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",C=y&&!n.ordinal&&0===n.count,_=C&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${w}`]||n[`defaultValue${x}`]||n.defaultValue;let S=f;v&&!f&&b&&(S=_);const A=fn(S),k=Object.prototype.toString.apply(S);if(!(v&&S&&A&&["[object Number]","[object Function]","[object RegExp]"].indexOf(k)<0)||Br(m)&&Array.isArray(S))if(v&&Br(m)&&Array.isArray(f))f=f.join(m),f&&(f=this.extendTranslation(f,e,n,r));else{let t=!1,i=!1;!this.isValidLookup(f)&&b&&(t=!0,f=_),this.isValidLookup(f)||(i=!0,f=a);const s=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&i?void 0:f,d=b&&_!==f&&this.options.updateMissing;if(i||t||d){if(this.logger.log(d?"updateKey":"missingKey",u,l,a,d?_:f),o){const e=this.resolve(a,{...n,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let r=0;r<t.length;r++)e.push(t[r]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(n.lng||this.language):e.push(n.lng||this.language);const r=(e,t,r)=>{const i=b&&r!==f?r:s;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,i,d,n):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,i,d,n),this.emit("missingKey",e,l,t,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&y?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,n);C&&n[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{r([e],a+t,n[`defaultValue${t}`]||_)})}):r(e,a,_))}f=this.extendTranslation(f,e,n,h,r),i&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}${c}${a}`),(i||t)&&this.options.parseMissingKeyHandler&&(f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${c}${a}`:a,t?f:void 0,n))}else{if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(p,S,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(h.res=e,h.usedParams=this.getUsedParamsDetails(n),h):e}if(o){const e=Array.isArray(S),t=e?[]:{},r=e?g:p;for(const e in S)if(Object.prototype.hasOwnProperty.call(S,e)){const i=`${r}${o}${e}`;t[e]=b&&!f?this.translate(i,{...n,defaultValue:fn(_)?_[e]:void 0,joinArrays:!1,ns:s}):this.translate(i,{...n,joinArrays:!1,ns:s}),t[e]===i&&(t[e]=S[e])}f=t}}return i?(h.res=f,h.usedParams=this.getUsedParamsDetails(n),h):f}extendTranslation(e,t,r,n,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const o=Br(e)&&(void 0!==r?.interpolation?.skipOnVariables?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(o){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let s=r.replace&&!Br(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,r.lng||this.language||n.usedLng,r),o){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(r.nest=!1)}!r.lng&&n&&n.res&&(r.lng=this.language||n.usedLng),!1!==r.nest&&(e=this.interpolator.nest(e,(...e)=>i?.[0]!==e[0]||r.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),r)),r.interpolation&&this.interpolator.reset()}const o=r.postProcess||this.options.postProcess,a=Br(o)?[o]:o;return null!=e&&a?.length&&!1!==r.applyPostProcessor&&(e=cn.handle(a,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),e}resolve(e,t={}){let r,n,i,o,a;return Br(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(r))return;const s=this.extractFromKey(e,t),l=s.key;n=l;let c=s.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const u=void 0!==t.count&&!Br(t.count),d=u&&!t.ordinal&&0===t.count,h=void 0!==t.context&&(Br(t.context)||"number"==typeof t.context)&&""!==t.context,f=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);c.forEach(e=>{this.isValidLookup(r)||(a=e,hn[`${f[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(a)||(hn[`${f[0]}-${e}`]=!0,this.logger.warn(`key "${n}" for languages "${f.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),f.forEach(n=>{if(this.isValidLookup(r))return;o=n;const a=[l];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(a,l,n,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(n,t.count,t));const r=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&0===e.indexOf(i)&&a.push(l+e.replace(i,this.options.pluralSeparator)),a.push(l+e),d&&a.push(l+r)),h){const n=`${l}${this.options.contextSeparator||"_"}${t.context}`;a.push(n),u&&(t.ordinal&&0===e.indexOf(i)&&a.push(n+e.replace(i,this.options.pluralSeparator)),a.push(n+e),d&&a.push(n+r))}}let s;for(;s=a.pop();)this.isValidLookup(r)||(i=s,r=this.getResource(n,e,s,t))}))})}),{res:r,usedKey:n,exactUsedKey:i,usedLng:o,usedNS:a}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,r,n={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,r,n):this.resourceStore.getResource(e,t,r,n)}getUsedParamsDetails(e={}){const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=e.replace&&!Br(e.replace);let n=r?e.replace:e;if(r&&void 0!==e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!r){n={...n};for(const e of t)delete n[e]}return n}static hasDefaultValue(e){const t="defaultValue";for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t===r.substring(0,12)&&void 0!==e[r])return!0;return!1}}class gn{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=an.create("languageUtils")}getScriptPartFromCode(e){if(!(e=rn(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=rn(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(Br(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const r=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(r)||(t=r)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const r=this.getScriptPartFromCode(e);if(this.isSupportedCode(r))return t=r;const n=this.getLanguagePartFromCode(e);if(this.isSupportedCode(n))return t=n;t=this.options.supportedLngs.find(e=>e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:e.indexOf("-")>0&&n.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===n||0===e.indexOf(n)&&n.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),Br(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let r=e[t];return r||(r=e[this.getScriptPartFromCode(t)]),r||(r=e[this.formatLanguageCode(t)]),r||(r=e[this.getLanguagePartFromCode(t)]),r||(r=e.default),r||[]}toResolveHierarchy(e,t){const r=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),n=[],i=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return Br(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(e))):Br(e)&&i(this.formatLanguageCode(e)),r.forEach(e=>{n.indexOf(e)<0&&i(this.formatLanguageCode(e))}),n}}const mn={zero:0,one:1,two:2,few:3,many:4,other:5},vn={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class yn{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=an.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){const r=rn("dev"===e?"en":e),n=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:n});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(r,{type:n})}catch(r){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),vn;if(!e.match(/-|_/))return vn;const n=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(n,t)}return this.pluralRulesCache[i]=o,o}needsPlural(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,r={}){return this.getSuffixes(e,r).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let r=this.getRule(e,t);return r||(r=this.getRule("dev",t)),r?r.resolvedOptions().pluralCategories.sort((e,t)=>mn[e]-mn[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,r={}){const n=this.getRule(e,r);return n?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,r))}}const bn=(e,t,r,n=".",i=!0)=>{let o=((e,t,r)=>{const n=Yr(e,r);return void 0!==n?n:Yr(t,r)})(e,t,r);return!o&&i&&Br(r)&&(o=tn(e,r,n),void 0===o&&(o=tn(t,r,n))),o},wn=e=>e.replace(/\$/g,"$$$$");class xn{constructor(e={}){this.logger=an.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:r,useRawValueToEscape:n,prefix:i,prefixEscaped:o,suffix:a,suffixEscaped:s,formatSeparator:l,unescapeSuffix:c,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:f,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:m,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:Jr,this.escapeValue=void 0===r||r,this.useRawValueToEscape=void 0!==n&&n,this.prefix=i?Kr(i):o||"{{",this.suffix=a?Kr(a):s||"}}",this.formatSeparator=l||",",this.unescapePrefix=c?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=d?Kr(d):h||Kr("$t("),this.nestingSuffix=f?Kr(f):p||Kr(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=m||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,r,n){let i,o,a;const s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const i=bn(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,r,{...n,...t,interpolationkey:e}):i}const i=e.split(this.formatSeparator),o=i.shift().trim(),a=i.join(this.formatSeparator).trim();return this.format(bn(t,s,o,this.options.keySeparator,this.options.ignoreJSONStructure),a,r,{...n,...t,interpolationkey:o})};this.resetRegExp();const c=n?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=void 0!==n?.interpolation?.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>wn(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?wn(this.escape(e)):wn(e)}].forEach(t=>{for(a=0;i=t.regex.exec(e);){const r=i[1].trim();if(o=l(r),void 0===o)if("function"==typeof c){const t=c(e,i,n);o=Br(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,r))o="";else{if(u){o=i[0];continue}this.logger.warn(`missed to pass in variable ${r} for interpolating ${e}`),o=""}else Br(o)||this.useRawValueToEscape||(o=Vr(o));const s=t.safeValue(o);if(e=e.replace(i[0],s),u?(t.regex.lastIndex+=o.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,a++,a>=this.maxReplaces)break}}),e}nest(e,t,r={}){let n,i,o;const a=(e,t)=>{const r=this.nestingOptionsSeparator;if(e.indexOf(r)<0)return e;const n=e.split(new RegExp(`${r}[ ]*{`));let i=`{${n[1]}`;e=n[0],i=this.interpolate(i,o);const a=i.match(/'/g),s=i.match(/"/g);((a?.length??0)%2==0&&!s||s.length%2!=0)&&(i=i.replace(/'/g,'"'));try{o=JSON.parse(i),t&&(o={...t,...o})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${r}${i}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,e};for(;n=this.nestingRegexp.exec(e);){let s=[];o={...r},o=o.replace&&!Br(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const l=/{.*}/.test(n[1])?n[1].lastIndexOf("}")+1:n[1].indexOf(this.formatSeparator);if(-1!==l&&(s=n[1].slice(l).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),n[1]=n[1].slice(0,l)),i=t(a.call(this,n[1].trim(),o),o),i&&n[0]===e&&!Br(i))return i;Br(i)||(i=Vr(i)),i||(this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`),i=""),s.length&&(i=s.reduce((e,t)=>this.format(e,t,r.lng,{...r,interpolationkey:n[1].trim()}),i.trim())),e=e.replace(n[0],i),this.regexp.lastIndex=0}return e}}const Cn=e=>{const t={};return(r,n,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const a=n+JSON.stringify(o);let s=t[a];return s||(s=e(rn(n),i),t[a]=s),s(r)}},_n=e=>(t,r,n)=>e(rn(r),n)(t);class Sn{constructor(e={}){this.logger=an.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";const r=t.cacheInBuiltFormats?Cn:_n;this.formats={number:r((e,t)=>{const r=new Intl.NumberFormat(e,{...t});return e=>r.format(e)}),currency:r((e,t)=>{const r=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>r.format(e)}),datetime:r((e,t)=>{const r=new Intl.DateTimeFormat(e,{...t});return e=>r.format(e)}),relativetime:r((e,t)=>{const r=new Intl.RelativeTimeFormat(e,{...t});return e=>r.format(e,t.range||"day")}),list:r((e,t)=>{const r=new Intl.ListFormat(e,{...t});return e=>r.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=Cn(t)}format(e,t,r,n={}){const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(e=>e.indexOf(")")>-1)){const e=i.findIndex(e=>e.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}const o=i.reduce((e,t)=>{const{formatName:i,formatOptions:o}=(e=>{let t=e.toLowerCase().trim();const r={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const i=n[1].substring(0,n[1].length-1);"currency"===t&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(e=>{if(e){const[t,...n]=e.split(":"),i=n.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();r[o]||(r[o]=i),"false"===i&&(r[o]=!1),"true"===i&&(r[o]=!0),isNaN(i)||(r[o]=parseInt(i,10))}})}return{formatName:t,formatOptions:r}})(t);if(this.formats[i]){let t=e;try{const a=n?.formatParams?.[n.interpolationkey]||{},s=a.locale||a.lng||n.locale||n.lng||r;t=this.formats[i](e,s,{...o,...n,...a})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e);return o}}class An extends sn{constructor(e,t,r,n={}){super(),this.backend=e,this.store=t,this.services=r,this.languageUtils=r.languageUtils,this.options=n,this.logger=an.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(r,n.backend,n)}queueLoad(e,t,r,n){const i={},o={},a={},s={};return e.forEach(e=>{let n=!0;t.forEach(t=>{const a=`${e}|${t}`;!r.reload&&this.store.hasResourceBundle(e,t)?this.state[a]=2:this.state[a]<0||(1===this.state[a]?void 0===o[a]&&(o[a]=!0):(this.state[a]=1,n=!1,void 0===o[a]&&(o[a]=!0),void 0===i[a]&&(i[a]=!0),void 0===s[t]&&(s[t]=!0)))}),n||(a[e]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(s)}}loaded(e,t,r){const n=e.split("|"),i=n[0],o=n[1];t&&this.emit("failedLoading",i,o,t),!t&&r&&this.store.addResourceBundle(i,o,r,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&r&&(this.state[e]=0);const a={};this.queue.forEach(r=>{((e,t,r)=>{const{obj:n,k:i}=qr(e,t,Object);n[i]=n[i]||[],n[i].push(r)})(r.loaded,[i],o),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(r,e),t&&r.errors.push(t),0!==r.pendingCount||r.done||(Object.keys(r.loaded).forEach(e=>{a[e]||(a[e]={});const t=r.loaded[e];t.length&&t.forEach(t=>{void 0===a[e][t]&&(a[e][t]=!0)})}),r.done=!0,r.errors.length?r.callback(r.errors):r.callback())}),this.emit("loaded",a),this.queue=this.queue.filter(e=>!e.done)}read(e,t,r,n=0,i=this.retryTimeout,o){if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:r,tried:n,wait:i,callback:o});this.readingCalls++;const a=(a,s)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}a&&s&&n<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,r,n+1,2*i,o)},i):o(a,s)},s=this.backend[r].bind(this.backend);if(2!==s.length)return s(e,t,a);try{const r=s(e,t);r&&"function"==typeof r.then?r.then(e=>a(null,e)).catch(a):a(null,r)}catch(e){a(e)}}prepareLoading(e,t,r={},n){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();Br(e)&&(e=this.languageUtils.toResolveHierarchy(e)),Br(t)&&(t=[t]);const i=this.queueLoad(e,t,r,n);if(!i.toLoad.length)return i.pending.length||n(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,r){this.prepareLoading(e,t,{},r)}reload(e,t,r){this.prepareLoading(e,t,{reload:!0},r)}loadOne(e,t=""){const r=e.split("|"),n=r[0],i=r[1];this.read(n,i,"read",void 0,void 0,(r,o)=>{r&&this.logger.warn(`${t}loading namespace ${i} for language ${n} failed`,r),!r&&o&&this.logger.log(`${t}loaded namespace ${i} for language ${n}`,o),this.loaded(e,r,o)})}saveMissing(e,t,r,n,i,o={},a=()=>{}){if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=r&&""!==r){if(this.backend?.create){const s={...o,isUpdate:i},l=this.backend.create.bind(this.backend);if(l.length<6)try{let i;i=5===l.length?l(e,t,r,n,s):l(e,t,r,n),i&&"function"==typeof i.then?i.then(e=>a(null,e)).catch(a):a(null,i)}catch(e){a(e)}else l(e,t,r,n,a,s)}e&&e[0]&&this.store.addResource(e[0],t,r,n)}}else this.logger.warn(`did not save key "${r}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const kn=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),Br(e[1])&&(t.defaultValue=e[1]),Br(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const r=e[3]||e[2];Object.keys(r).forEach(e=>{t[e]=r[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),En=e=>(Br(e.ns)&&(e.ns=[e.ns]),Br(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Br(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),In=()=>{};class Tn extends sn{constructor(e={},t){var r;if(super(),this.options=En(e),this.services={},this.logger=an,this.modules={external:[]},r=this,Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach(e=>{"function"==typeof r[e]&&(r[e]=r[e].bind(r))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(Br(e.ns)?e.defaultNS=e.ns:e.ns.indexOf("translation")<0&&(e.defaultNS=e.ns[0]));const r=kn();this.options={...r,...this.options,...En(e)},this.options.interpolation={...r.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator);const n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?an.init(n(this.modules.logger),this.options):an.init(null,this.options),e=this.modules.formatter?this.modules.formatter:Sn;const t=new gn(this.options);this.store=new ln(this.options.resources,this.options);const i=this.services;i.logger=an,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new yn(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!e||this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format||(i.formatter=n(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new xn(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new An(n(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=n(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=n(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new pn(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=In),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});const i=Ur(),o=()=>{const e=(e,r)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),i.resolve(r),t(e,r)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?o():setTimeout(o,0),i}loadResources(e,t=In){let r=t;const n=Br(e)?e:this.language;if("function"==typeof e&&(r=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===n?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return r();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(n)t(n);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),r(e)})}else r(null)}reloadResources(e,t,r){const n=Ur();return"function"==typeof e&&(r=e,e=void 0),"function"==typeof t&&(r=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),r||(r=In),this.services.backendConnector.reload(e,t,e=>{n.resolve(),r(e)}),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&cn.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){const t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&this.languages.indexOf(e)<0&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;const r=Ur();this.emit("languageChanging",e);const n=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,o)=>{o?this.isLanguageChangingTo===e&&(n(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,r.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const r=Br(t)?t:t&&t[0],o=this.store.hasLanguageSomeTranslations(r)?r:this.services.languageUtils.getBestMatchFromCodes(Br(t)?[t]:t);o&&(this.language||n(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,e=>{i(e,o)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),r}getFixedT(e,t,r){const n=(e,t,...i)=>{let o;o="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(i)):{...t},o.lng=o.lng||n.lng,o.lngs=o.lngs||n.lngs,o.ns=o.ns||n.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||r||n.keyPrefix);const a=this.options.keySeparator||".";let s;return o.keyPrefix&&Array.isArray(e)?s=e.map(e=>("function"==typeof e&&(e=dn(e,{...this.options,...t})),`${o.keyPrefix}${a}${e}`)):("function"==typeof e&&(e=dn(e,{...this.options,...t})),s=o.keyPrefix?`${o.keyPrefix}${a}${e}`:e),this.t(s,o)};return Br(e)?n.lng=e:n.lngs=e,n.ns=t,n.keyPrefix=r,n}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===r.toLowerCase())return!0;const o=(e,t)=>{const r=this.services.backendConnector.state[`${e}|${t}`];return-1===r||0===r||2===r};if(t.precheck){const e=t.precheck(this,o);if(void 0!==e)return e}return!!this.hasResourceBundle(r,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(r,e)||n&&!o(i,e)))}loadNamespaces(e,t){const r=Ur();return this.options.ns?(Br(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}loadLanguages(e,t){const r=Ur();Br(e)&&(e=[e]);const n=this.options.preload||[],i=e.filter(e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=n.concat(i),this.loadResources(e=>{r.resolve(),t&&t(e)}),r):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{const t=new Intl.Locale(e);if(t&&t.getTextInfo){const e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}const t=this.services?.languageUtils||new gn(kn());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){return new Tn(e,t)}cloneInstance(e={},t=In){const r=e.forkResourceStore;r&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},i=new Tn(n);void 0===e.debug&&void 0===e.prefix||(i.logger=i.logger.clone(e));if(["store","services","language"].forEach(e=>{i[e]=this[e]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((r,n)=>(r[n]={...e[t][n]},r),e[t]),e),{});i.store=new ln(e,n),i.services.resourceStore=i.store}return i.translator=new pn(i.services,n),i.translator.on("*",(e,...t)=>{i.emit(e,...t)}),i.init(n,t),i.translator.options=n,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Fn=Tn.createInstance();Fn.createInstance=Tn.createInstance,Fn.createInstance,Fn.dir,Fn.init,Fn.loadResources,Fn.reloadResources,Fn.use,Fn.changeLanguage,Fn.getFixedT,Fn.t,Fn.exists,Fn.setDefaultNamespace,Fn.hasLoadedNamespace,Fn.loadNamespaces,Fn.loadLanguages;var On="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};const Pn={},Mn=(e,t,r,n)=>{jn(r)&&Pn[r]||(jn(r)&&(Pn[r]=new Date),((e,t,r,n)=>{const i=[r,{code:t,...n||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,"warn","react-i18next::",!0);jn(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)})(e,t,r,n))},Rn=(e,t)=>()=>{if(e.isInitialized)t();else{const r=()=>{setTimeout(()=>{e.off("initialized",r)},0),t()};e.on("initialized",r)}},Ln=(e,t,r)=>{e.loadNamespaces(t,Rn(e,r))},Nn=(e,t,r,n)=>{if(jn(r)&&(r=[r]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ln(e,r,n);r.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,Rn(e,n))},jn=e=>"string"==typeof e,Dn=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,zn={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Bn=e=>zn[e];let Un={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(Dn,Bn)};let Vn;const Hn={type:"3rdParty",init(e){((e={})=>{Un={...Un,...e}})(e.options.react),(e=>{Vn=e})(e)}},Wn=s();class $n{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const qn=(e,t,r,n)=>e.getFixedT(t,r,n),Gn=(e,t={})=>{const{i18n:r}=t,{i18n:n,defaultNS:i}=l(Wn)||{},s=r||n||Vn;if(s&&!s.reportNamespaces&&(s.reportNamespaces=new $n),!s){Mn(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const e=(e,t)=>{return jn(t)?t:"object"==typeof(r=t)&&null!==r&&jn(t.defaultValue)?t.defaultValue:Array.isArray(e)?e[e.length-1]:e;var r},t=[e,{},!1];return t.t=e,t.i18n={},t.ready=!1,t}s.options.react?.wait&&Mn(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...Un,...s.options.react,...t},{useSuspense:h,keyPrefix:f}=d;let p=i||s.options?.defaultNS;p=jn(p)?[p]:p||["translation"],s.reportNamespaces.addUsedNamespaces?.(p);const g=(s.isInitialized||s.initializedStoreOnce)&&p.every(e=>((e,t,r={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:r.lng,precheck:(t,n)=>{if(r.bindI18n&&r.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!n(t.isLanguageChangingTo,e))return!1}}):(Mn(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,s,d)),m=((e,t,r,n)=>c(qn(e,t,r,n),[e,t,r,n]))(s,t.lng||null,"fallback"===d.nsMode?p:p[0],f),v=()=>m,y=()=>qn(s,t.lng||null,"fallback"===d.nsMode?p:p[0],f),[b,w]=o(v);let x=p.join();t.lng&&(x=`${t.lng}${x}`);const C=((e,t)=>{const r=u();return a(()=>{r.current=e},[e,t]),r.current})(x),_=u(!0);a(()=>{const{bindI18n:e,bindI18nStore:r}=d;_.current=!0,g||h||(t.lng?Nn(s,t.lng,p,()=>{_.current&&w(y)}):Ln(s,p,()=>{_.current&&w(y)})),g&&C&&C!==x&&_.current&&w(y);const n=()=>{_.current&&w(y)};return e&&s?.on(e,n),r&&s?.store.on(r,n),()=>{_.current=!1,s&&e&&e?.split(" ").forEach(e=>s.off(e,n)),r&&s&&r.split(" ").forEach(e=>s.store.off(e,n))}},[s,x]),a(()=>{_.current&&g&&w(v)},[s,f,g]);const S=[b,s,g];if(S.t=b,S.i18n=s,S.ready=g,g)return S;if(!g&&!h)return S;throw new Promise(e=>{t.lng?Nn(s,t.lng,p,()=>e()):Ln(s,p,()=>e())})};function Yn({i18n:e,defaultNS:t,children:r}){const n=d(()=>({i18n:e,defaultNS:t}),[e,t]);return h(Wn.Provider,{value:n},r)}var Xn,Kn,Zn,Jn,Qn,ei={};function ti(){if(Kn)return Xn;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function r(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function n(e,t){return function(e,t){if(t.get)return t.get.call(e);return t.value}(e,o(e,t,"get"))}function i(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,o(e,t,"set"),r),r}function o(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function a(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}Kn=1;var s=function(t){if(!t)return[];Array.isArray(t)||(t=[t]);for(var r={},n=0;n<t.length;++n){var i,o=t[n];if(o&&"object"===e(o)&&(o=String(o)),"string"!=typeof o){var a="Locales should be strings, ".concat(JSON.stringify(o)," isn't.");throw new TypeError(a)}var s=o.split("-");if(!s.every(function(e){return/[a-z0-9]+/i.test(e)})){var l=JSON.stringify(o),c="The locale ".concat(l," is not a structurally valid BCP 47 language tag.");throw new RangeError(c)}var u=s[0].toLowerCase();s[0]=null!==(i={in:"id",iw:"he",ji:"yi"}[u])&&void 0!==i?i:u,r[s.join("-")]=!0}return Object.keys(r)};function l(t){switch(e(t)){case"number":return t;case"bigint":throw new TypeError("Cannot convert a BigInt value to a number");default:return Number(t)}}return Xn=function(e,r,o,c){var u=function(e){do{if(r(e))return e;e=e.replace(/-?[^-]*$/,"")}while(e);return null},d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,g=new WeakMap,m=function(){function m(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,m),a(this,d,{writable:!0,value:void 0}),a(this,h,{writable:!0,value:void 0}),a(this,f,{writable:!0,value:void 0}),a(this,p,{writable:!0,value:void 0}),a(this,g,{writable:!0,value:void 0}),i(this,d,function(t){for(var r=s(t),n=0;n<r.length;++n){var i=u(r[n]);if(i)return i}var o=(new e).resolvedOptions().locale;return u(o)}(t)),i(this,f,r(n(this,d))),i(this,h,c(n(this,d))),i(this,p,function(e){var t=Object.prototype.hasOwnProperty.call(e,"type")&&e.type;if(!t)return"cardinal";if("cardinal"===t||"ordinal"===t)return t;throw new RangeError("Not a valid plural type: "+JSON.stringify(t))}(o)),i(this,g,new e("en",o))}var v,y,b;return v=m,b=[{key:"supportedLocalesOf",value:function(e){return s(e).filter(u)}}],(y=[{key:"resolvedOptions",value:function(){var e=n(this,g).resolvedOptions(),t=e.minimumIntegerDigits,r=e.minimumFractionDigits,i=e.maximumFractionDigits,a=e.minimumSignificantDigits,s=e.maximumSignificantDigits,l=e.roundingPriority,c={locale:n(this,d),type:n(this,p),minimumIntegerDigits:t,minimumFractionDigits:r,maximumFractionDigits:i};return"number"==typeof a&&(c.minimumSignificantDigits=a,c.maximumSignificantDigits=s),c.pluralCategories=o(n(this,d),"ordinal"===n(this,p)).slice(0),c.roundingPriority=l||"auto",c}},{key:"select",value:function(e){if(!(this instanceof m))throw new TypeError("select() called on incompatible ".concat(this));if("number"!=typeof e&&(e=Number(e)),!isFinite(e))return"other";var t=n(this,g).format(Math.abs(e));return n(this,f).call(this,t,"ordinal"===n(this,p))}},{key:"selectRange",value:function(e,t){if(!(this instanceof m))throw new TypeError("selectRange() called on incompatible ".concat(this));if(void 0===e)throw new TypeError("start is undefined");if(void 0===t)throw new TypeError("end is undefined");var r=l(e),i=l(t);if(!isFinite(r))throw new RangeError("start must be finite");if(!isFinite(i))throw new RangeError("end must be finite");return n(this,h).call(this,this.select(r),this.select(i))}}])&&t(v.prototype,y),b&&t(v,b),Object.defineProperty(v,"prototype",{writable:!1}),m}();return"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(m.prototype,Symbol.toStringTag,{value:"Intl.PluralRules",writable:!1,configurable:!0}),Object.defineProperty(m,"prototype",{writable:!1}),m},Xn}!function(){if(Qn)return ei;Qn=1;var e=function(){if(Jn)return Zn;function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function t(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}Jn=1;var r=e(ti());function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==On||"undefined"!=typeof self&&self;var i={exports:{}};!function(e){var t=function(e,t){return t?"other":1==e?"one":"other"},r=function(e,t){return t?"other":0==e||1==e?"one":"other"},n=function(e,t){return t?"other":e>=0&&e<=1?"one":"other"},i=function(e,t){var r=!String(e).split(".")[1];return t?"other":1==e&&r?"one":"other"},o=function(e,t){return"other"},a=function(e,t){return t?"other":1==e?"one":2==e?"two":"other"};!function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),e.exports=r}(0,{af:t,ak:r,am:n,an:t,ar:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-2);return t?"other":0==e?"zero":1==e?"one":2==e?"two":n>=3&&n<=10?"few":n>=11&&n<=99?"many":"other"},ars:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-2);return t?"other":0==e?"zero":1==e?"one":2==e?"two":n>=3&&n<=10?"few":n>=11&&n<=99?"many":"other"},as:function(e,t){return t?1==e||5==e||7==e||8==e||9==e||10==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},asa:t,ast:i,az:function(e,t){var r=String(e).split(".")[0],n=r.slice(-1),i=r.slice(-2),o=r.slice(-3);return t?1==n||2==n||5==n||7==n||8==n||20==i||50==i||70==i||80==i?"one":3==n||4==n||100==o||200==o||300==o||400==o||500==o||600==o||700==o||800==o||900==o?"few":0==r||6==n||40==i||60==i||90==i?"many":"other":1==e?"one":"other"},bal:function(e,t){return 1==e?"one":"other"},be:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1),o=n&&r[0].slice(-2);return t?2!=i&&3!=i||12==o||13==o?"other":"few":1==i&&11!=o?"one":i>=2&&i<=4&&(o<12||o>14)?"few":n&&0==i||i>=5&&i<=9||o>=11&&o<=14?"many":"other"},bem:t,bez:t,bg:t,bho:r,bm:o,bn:function(e,t){return t?1==e||5==e||7==e||8==e||9==e||10==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},bo:o,br:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1),o=n&&r[0].slice(-2),a=n&&r[0].slice(-6);return t?"other":1==i&&11!=o&&71!=o&&91!=o?"one":2==i&&12!=o&&72!=o&&92!=o?"two":(3==i||4==i||9==i)&&(o<10||o>19)&&(o<70||o>79)&&(o<90||o>99)?"few":0!=e&&n&&0==a?"many":"other"},brx:t,bs:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},ca:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?1==e||3==e?"one":2==e?"two":4==e?"few":"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},ce:t,ceb:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=i.slice(-1);return t?"other":o&&(1==n||2==n||3==n)||o&&4!=a&&6!=a&&9!=a||!o&&4!=s&&6!=s&&9!=s?"one":"other"},cgg:t,chr:t,ckb:t,cs:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1];return t?"other":1==e&&i?"one":n>=2&&n<=4&&i?"few":i?"other":"many"},cy:function(e,t){return t?0==e||7==e||8==e||9==e?"zero":1==e?"one":2==e?"two":3==e||4==e?"few":5==e||6==e?"many":"other":0==e?"zero":1==e?"one":2==e?"two":3==e?"few":6==e?"many":"other"},da:function(e,t){var r=String(e).split("."),n=r[0],i=Number(r[0])==e;return t||1!=e&&(i||0!=n&&1!=n)?"other":"one"},de:i,doi:n,dsb:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-2),s=i.slice(-2);return t?"other":o&&1==a||1==s?"one":o&&2==a||2==s?"two":o&&(3==a||4==a)||3==s||4==s?"few":"other"},dv:t,dz:o,ee:t,el:t,en:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e,o=i&&r[0].slice(-1),a=i&&r[0].slice(-2);return t?1==o&&11!=a?"one":2==o&&12!=a?"two":3==o&&13!=a?"few":"other":1==e&&n?"one":"other"},eo:t,es:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?"other":1==e?"one":0!=n&&0==o&&i?"many":"other"},et:i,eu:t,fa:n,ff:function(e,t){return t?"other":e>=0&&e<2?"one":"other"},fi:i,fil:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=i.slice(-1);return t?1==e?"one":"other":o&&(1==n||2==n||3==n)||o&&4!=a&&6!=a&&9!=a||!o&&4!=s&&6!=s&&9!=s?"one":"other"},fo:t,fr:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?1==e?"one":"other":e>=0&&e<2?"one":0!=n&&0==o&&i?"many":"other"},fur:t,fy:i,ga:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?1==e?"one":"other":1==e?"one":2==e?"two":n&&e>=3&&e<=6?"few":n&&e>=7&&e<=10?"many":"other"},gd:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?1==e||11==e?"one":2==e||12==e?"two":3==e||13==e?"few":"other":1==e||11==e?"one":2==e||12==e?"two":n&&e>=3&&e<=10||n&&e>=13&&e<=19?"few":"other"},gl:i,gsw:t,gu:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},guw:r,gv:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-1),a=n.slice(-2);return t?"other":i&&1==o?"one":i&&2==o?"two":!i||0!=a&&20!=a&&40!=a&&60!=a&&80!=a?i?"other":"many":"few"},ha:t,haw:t,he:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1];return t?"other":1==n&&i||0==n&&!i?"one":2==n&&i?"two":"other"},hi:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":e>=0&&e<=1?"one":"other"},hnj:o,hr:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},hsb:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-2),s=i.slice(-2);return t?"other":o&&1==a||1==s?"one":o&&2==a||2==s?"two":o&&(3==a||4==a)||3==s||4==s?"few":"other"},hu:function(e,t){return t?1==e||5==e?"one":"other":1==e?"one":"other"},hy:function(e,t){return t?1==e?"one":"other":e>=0&&e<2?"one":"other"},ia:i,id:o,ig:o,ii:o,io:i,is:function(e,t){var r=String(e).split("."),n=r[0],i=(r[1]||"").replace(/0+$/,""),o=Number(r[0])==e,a=n.slice(-1),s=n.slice(-2);return t?"other":o&&1==a&&11!=s||i%10==1&&i%100!=11?"one":"other"},it:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},iu:a,ja:o,jbo:o,jgo:t,jmc:t,jv:o,jw:o,ka:function(e,t){var r=String(e).split(".")[0],n=r.slice(-2);return t?1==r?"one":0==r||n>=2&&n<=20||40==n||60==n||80==n?"many":"other":1==e?"one":"other"},kab:function(e,t){return t?"other":e>=0&&e<2?"one":"other"},kaj:t,kcg:t,kde:o,kea:o,kk:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1);return t?6==i||9==i||n&&0==i&&0!=e?"many":"other":1==e?"one":"other"},kkj:t,kl:t,km:o,kn:n,ko:o,ks:t,ksb:t,ksh:function(e,t){return t?"other":0==e?"zero":1==e?"one":"other"},ku:t,kw:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-2),o=n&&r[0].slice(-3),a=n&&r[0].slice(-5),s=n&&r[0].slice(-6);return t?n&&e>=1&&e<=4||i>=1&&i<=4||i>=21&&i<=24||i>=41&&i<=44||i>=61&&i<=64||i>=81&&i<=84?"one":5==e||5==i?"many":"other":0==e?"zero":1==e?"one":2==i||22==i||42==i||62==i||82==i||n&&0==o&&(a>=1e3&&a<=2e4||4e4==a||6e4==a||8e4==a)||0!=e&&1e5==s?"two":3==i||23==i||43==i||63==i||83==i?"few":1==e||1!=i&&21!=i&&41!=i&&61!=i&&81!=i?"other":"many"},ky:t,lag:function(e,t){var r=String(e).split(".")[0];return t?"other":0==e?"zero":0!=r&&1!=r||0==e?"other":"one"},lb:t,lg:t,lij:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e;return t?11==e||8==e||i&&e>=80&&e<=89||i&&e>=800&&e<=899?"many":"other":1==e&&n?"one":"other"},lkt:o,ln:r,lo:function(e,t){return t&&1==e?"one":"other"},lt:function(e,t){var r=String(e).split("."),n=r[1]||"",i=Number(r[0])==e,o=i&&r[0].slice(-1),a=i&&r[0].slice(-2);return t?"other":1==o&&(a<11||a>19)?"one":o>=2&&o<=9&&(a<11||a>19)?"few":0!=n?"many":"other"},lv:function(e,t){var r=String(e).split("."),n=r[1]||"",i=n.length,o=Number(r[0])==e,a=o&&r[0].slice(-1),s=o&&r[0].slice(-2),l=n.slice(-2),c=n.slice(-1);return t?"other":o&&0==a||s>=11&&s<=19||2==i&&l>=11&&l<=19?"zero":1==a&&11!=s||2==i&&1==c&&11!=l||2!=i&&1==c?"one":"other"},mas:t,mg:r,mgo:t,mk:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?1==a&&11!=s?"one":2==a&&12!=s?"two":7!=a&&8!=a||17==s||18==s?"other":"many":o&&1==a&&11!=s||1==l&&11!=c?"one":"other"},ml:t,mn:t,mo:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e&&r[0].slice(-2);return t?1==e?"one":"other":1==e&&n?"one":!n||0==e||1!=e&&i>=1&&i<=19?"few":"other"},mr:function(e,t){return t?1==e?"one":2==e||3==e?"two":4==e?"few":"other":1==e?"one":"other"},ms:function(e,t){return t&&1==e?"one":"other"},mt:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-2);return t?"other":1==e?"one":2==e?"two":0==e||n>=3&&n<=10?"few":n>=11&&n<=19?"many":"other"},my:o,nah:t,naq:a,nb:t,nd:t,ne:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?n&&e>=1&&e<=4?"one":"other":1==e?"one":"other"},nl:i,nn:t,nnh:t,no:t,nqo:o,nr:t,nso:r,ny:t,nyn:t,om:t,or:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?1==e||5==e||n&&e>=7&&e<=9?"one":2==e||3==e?"two":4==e?"few":6==e?"many":"other":1==e?"one":"other"},os:t,osa:o,pa:r,pap:t,pcm:n,pl:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-1),a=n.slice(-2);return t?"other":1==e&&i?"one":i&&o>=2&&o<=4&&(a<12||a>14)?"few":i&&1!=n&&(0==o||1==o)||i&&o>=5&&o<=9||i&&a>=12&&a<=14?"many":"other"},prg:function(e,t){var r=String(e).split("."),n=r[1]||"",i=n.length,o=Number(r[0])==e,a=o&&r[0].slice(-1),s=o&&r[0].slice(-2),l=n.slice(-2),c=n.slice(-1);return t?"other":o&&0==a||s>=11&&s<=19||2==i&&l>=11&&l<=19?"zero":1==a&&11!=s||2==i&&1==c&&11!=l||2!=i&&1==c?"one":"other"},ps:t,pt:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?"other":0==n||1==n?"one":0!=n&&0==o&&i?"many":"other"},pt_PT:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},rm:t,ro:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e&&r[0].slice(-2);return t?1==e?"one":"other":1==e&&n?"one":!n||0==e||1!=e&&i>=1&&i<=19?"few":"other"},rof:t,ru:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-1),a=n.slice(-2);return t?"other":i&&1==o&&11!=a?"one":i&&o>=2&&o<=4&&(a<12||a>14)?"few":i&&0==o||i&&o>=5&&o<=9||i&&a>=11&&a<=14?"many":"other"},rwk:t,sah:o,saq:t,sat:a,sc:function(e,t){var r=!String(e).split(".")[1];return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&r?"one":"other"},scn:function(e,t){var r=!String(e).split(".")[1];return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&r?"one":"other"},sd:t,sdh:t,se:a,seh:t,ses:o,sg:o,sh:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},shi:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?"other":e>=0&&e<=1?"one":n&&e>=2&&e<=10?"few":"other"},si:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"";return t?"other":0==e||1==e||0==n&&1==i?"one":"other"},sk:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1];return t?"other":1==e&&i?"one":n>=2&&n<=4&&i?"few":i?"other":"many"},sl:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-2);return t?"other":i&&1==o?"one":i&&2==o?"two":i&&(3==o||4==o)||!i?"few":"other"},sma:a,smi:a,smj:a,smn:a,sms:a,sn:t,so:t,sq:function(e,t){var r=String(e).split("."),n=Number(r[0])==e,i=n&&r[0].slice(-1),o=n&&r[0].slice(-2);return t?1==e?"one":4==i&&14!=o?"many":"other":1==e?"one":"other"},sr:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=n.slice(-2),l=i.slice(-1),c=i.slice(-2);return t?"other":o&&1==a&&11!=s||1==l&&11!=c?"one":o&&a>=2&&a<=4&&(s<12||s>14)||l>=2&&l<=4&&(c<12||c>14)?"few":"other"},ss:t,ssy:t,st:t,su:o,sv:function(e,t){var r=String(e).split("."),n=!r[1],i=Number(r[0])==e,o=i&&r[0].slice(-1),a=i&&r[0].slice(-2);return t?1!=o&&2!=o||11==a||12==a?"other":"one":1==e&&n?"one":"other"},sw:i,syr:t,ta:t,te:t,teo:t,th:o,ti:r,tig:t,tk:function(e,t){var r=String(e).split("."),n=Number(r[0])==e&&r[0].slice(-1);return t?6==n||9==n||10==e?"few":"other":1==e?"one":"other"},tl:function(e,t){var r=String(e).split("."),n=r[0],i=r[1]||"",o=!r[1],a=n.slice(-1),s=i.slice(-1);return t?1==e?"one":"other":o&&(1==n||2==n||3==n)||o&&4!=a&&6!=a&&9!=a||!o&&4!=s&&6!=s&&9!=s?"one":"other"},tn:t,to:o,tpi:o,tr:t,ts:t,tzm:function(e,t){var r=String(e).split("."),n=Number(r[0])==e;return t?"other":0==e||1==e||n&&e>=11&&e<=99?"one":"other"},ug:t,uk:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),s=o&&r[0].slice(-2),l=n.slice(-1),c=n.slice(-2);return t?3==a&&13!=s?"few":"other":i&&1==l&&11!=c?"one":i&&l>=2&&l<=4&&(c<12||c>14)?"few":i&&0==l||i&&l>=5&&l<=9||i&&c>=11&&c<=14?"many":"other"},und:o,ur:i,uz:t,ve:t,vec:function(e,t){var r=String(e).split("."),n=r[0],i=!r[1],o=n.slice(-6);return t?11==e||8==e||80==e||800==e?"many":"other":1==e&&i?"one":0!=n&&0==o&&i?"many":"other"},vi:function(e,t){return t&&1==e?"one":"other"},vo:t,vun:t,wa:r,wae:t,wo:o,xh:t,xog:t,yi:i,yo:o,yue:o,zh:o,zu:n})}(i);var o=n(i.exports),a=t({__proto__:null,default:o},[i.exports]),s={exports:{}};!function(e){var t="zero",r="one",n="two",i="few",o="many",a="other",s={cardinal:[r,a],ordinal:[a]},l={cardinal:[r,a],ordinal:[r,a]},c={cardinal:[a],ordinal:[a]},u={cardinal:[r,n,a],ordinal:[a]};!function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),e.exports=r}(0,{af:s,ak:s,am:s,an:s,ar:{cardinal:[t,r,n,i,o,a],ordinal:[a]},ars:{cardinal:[t,r,n,i,o,a],ordinal:[a]},as:{cardinal:[r,a],ordinal:[r,n,i,o,a]},asa:s,ast:s,az:{cardinal:[r,a],ordinal:[r,i,o,a]},bal:l,be:{cardinal:[r,i,o,a],ordinal:[i,a]},bem:s,bez:s,bg:s,bho:s,bm:c,bn:{cardinal:[r,a],ordinal:[r,n,i,o,a]},bo:c,br:{cardinal:[r,n,i,o,a],ordinal:[a]},brx:s,bs:{cardinal:[r,i,a],ordinal:[a]},ca:{cardinal:[r,o,a],ordinal:[r,n,i,a]},ce:s,ceb:s,cgg:s,chr:s,ckb:s,cs:{cardinal:[r,i,o,a],ordinal:[a]},cy:{cardinal:[t,r,n,i,o,a],ordinal:[t,r,n,i,o,a]},da:s,de:s,doi:s,dsb:{cardinal:[r,n,i,a],ordinal:[a]},dv:s,dz:c,ee:s,el:s,en:{cardinal:[r,a],ordinal:[r,n,i,a]},eo:s,es:{cardinal:[r,o,a],ordinal:[a]},et:s,eu:s,fa:s,ff:s,fi:s,fil:l,fo:s,fr:{cardinal:[r,o,a],ordinal:[r,a]},fur:s,fy:s,ga:{cardinal:[r,n,i,o,a],ordinal:[r,a]},gd:{cardinal:[r,n,i,a],ordinal:[r,n,i,a]},gl:s,gsw:s,gu:{cardinal:[r,a],ordinal:[r,n,i,o,a]},guw:s,gv:{cardinal:[r,n,i,o,a],ordinal:[a]},ha:s,haw:s,he:u,hi:{cardinal:[r,a],ordinal:[r,n,i,o,a]},hnj:c,hr:{cardinal:[r,i,a],ordinal:[a]},hsb:{cardinal:[r,n,i,a],ordinal:[a]},hu:l,hy:l,ia:s,id:c,ig:c,ii:c,io:s,is:s,it:{cardinal:[r,o,a],ordinal:[o,a]},iu:u,ja:c,jbo:c,jgo:s,jmc:s,jv:c,jw:c,ka:{cardinal:[r,a],ordinal:[r,o,a]},kab:s,kaj:s,kcg:s,kde:c,kea:c,kk:{cardinal:[r,a],ordinal:[o,a]},kkj:s,kl:s,km:c,kn:s,ko:c,ks:s,ksb:s,ksh:{cardinal:[t,r,a],ordinal:[a]},ku:s,kw:{cardinal:[t,r,n,i,o,a],ordinal:[r,o,a]},ky:s,lag:{cardinal:[t,r,a],ordinal:[a]},lb:s,lg:s,lij:{cardinal:[r,a],ordinal:[o,a]},lkt:c,ln:s,lo:{cardinal:[a],ordinal:[r,a]},lt:{cardinal:[r,i,o,a],ordinal:[a]},lv:{cardinal:[t,r,a],ordinal:[a]},mas:s,mg:s,mgo:s,mk:{cardinal:[r,a],ordinal:[r,n,o,a]},ml:s,mn:s,mo:{cardinal:[r,i,a],ordinal:[r,a]},mr:{cardinal:[r,a],ordinal:[r,n,i,a]},ms:{cardinal:[a],ordinal:[r,a]},mt:{cardinal:[r,n,i,o,a],ordinal:[a]},my:c,nah:s,naq:u,nb:s,nd:s,ne:l,nl:s,nn:s,nnh:s,no:s,nqo:c,nr:s,nso:s,ny:s,nyn:s,om:s,or:{cardinal:[r,a],ordinal:[r,n,i,o,a]},os:s,osa:c,pa:s,pap:s,pcm:s,pl:{cardinal:[r,i,o,a],ordinal:[a]},prg:{cardinal:[t,r,a],ordinal:[a]},ps:s,pt:{cardinal:[r,o,a],ordinal:[a]},pt_PT:{cardinal:[r,o,a],ordinal:[a]},rm:s,ro:{cardinal:[r,i,a],ordinal:[r,a]},rof:s,ru:{cardinal:[r,i,o,a],ordinal:[a]},rwk:s,sah:c,saq:s,sat:u,sc:{cardinal:[r,a],ordinal:[o,a]},scn:{cardinal:[r,a],ordinal:[o,a]},sd:s,sdh:s,se:u,seh:s,ses:c,sg:c,sh:{cardinal:[r,i,a],ordinal:[a]},shi:{cardinal:[r,i,a],ordinal:[a]},si:s,sk:{cardinal:[r,i,o,a],ordinal:[a]},sl:{cardinal:[r,n,i,a],ordinal:[a]},sma:u,smi:u,smj:u,smn:u,sms:u,sn:s,so:s,sq:{cardinal:[r,a],ordinal:[r,o,a]},sr:{cardinal:[r,i,a],ordinal:[a]},ss:s,ssy:s,st:s,su:c,sv:l,sw:s,syr:s,ta:s,te:s,teo:s,th:c,ti:s,tig:s,tk:{cardinal:[r,a],ordinal:[i,a]},tl:l,tn:s,to:c,tpi:c,tr:s,ts:s,tzm:s,ug:s,uk:{cardinal:[r,i,o,a],ordinal:[i,a]},und:c,ur:s,uz:s,ve:s,vec:{cardinal:[r,o,a],ordinal:[o,a]},vi:{cardinal:[a],ordinal:[r,a]},vo:s,vun:s,wa:s,wae:s,wo:c,xh:s,xog:s,yi:s,yo:c,yue:c,zh:c,zu:s})}(s);var l=n(s.exports),c=t({__proto__:null,default:l},[s.exports]),u={exports:{}};!function(e){var t,r=function(e,t){return"other"},n=function(e,t){return"other"===e&&"one"===t?"one":"other"},i=function(e,t){return t||"other"};t={af:r,ak:n,am:i,an:r,ar:function(e,t){return"few"===t?"few":"many"===t?"many":"zero"===e&&"one"===t||"zero"===e&&"two"===t?"zero":"other"},as:i,az:i,be:i,bg:r,bn:i,bs:i,ca:r,cs:i,cy:i,da:i,de:i,el:i,en:r,es:r,et:r,eu:r,fa:n,fi:r,fil:i,fr:i,ga:i,gl:i,gsw:i,gu:i,he:r,hi:i,hr:i,hu:i,hy:i,ia:r,id:r,io:r,is:i,it:i,ja:r,ka:function(e,t){return e||"other"},kk:i,km:r,kn:i,ko:r,ky:i,lij:i,lo:r,lt:i,lv:function(e,t){return"one"===t?"one":"other"},mk:r,ml:i,mn:i,mr:i,ms:r,my:r,nb:r,ne:i,nl:i,no:r,or:n,pa:i,pcm:r,pl:i,ps:i,pt:i,ro:function(e,t){return"few"===t||"one"===t?"few":"other"},ru:i,sc:i,scn:i,sd:n,si:function(e,t){return"one"===e&&"one"===t?"one":"other"},sk:i,sl:function(e,t){return"few"===t||"one"===t?"few":"two"===t?"two":"other"},sq:i,sr:i,sv:r,sw:i,ta:i,te:i,th:r,tk:i,tr:i,ug:i,uk:i,ur:r,uz:i,vi:r,yue:r,zh:r,zu:i},Object.defineProperty(t,"__esModule",{value:!0}),e.exports=t}(u);var d=n(u.exports),h=o||a,f=l||c,p=d||t({__proto__:null,default:d},[u.exports]),g=function(e){return"pt-PT"===e?"pt_PT":e},m=r.default(Intl.NumberFormat,function(e){return h[g(e)]},function(e,t){return f[g(e)][t?"ordinal":"cardinal"]},function(e){return p[g(e)]});return Zn=m}();function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e);if("undefined"==typeof Intl)void 0!==On?On.Intl={PluralRules:r.default}:"undefined"!=typeof window?window.Intl={PluralRules:r.default}:ei.Intl={PluralRules:r.default},r.default.polyfill=!0;else if(Intl.PluralRules&&Intl.PluralRules.prototype.selectRange){var n=["en","es","ru","zh"];Intl.PluralRules.supportedLocalesOf(n).length<n.length&&(Intl.PluralRules=r.default,r.default.polyfill=!0)}else Intl.PluralRules=r.default,r.default.polyfill=!0}();var ri={Folder:"Folder",Folders:"Folders",Files:"Files",File:"File","Select the destination folder":"Select the destination folder","Filter by type":"Filter by type","All types":"All types","File name":"File name",Size:"Size",Date:"Date",Actions:"Actions",Delete:"Delete",Move:"Move",Copy:"Copy",Refresh:"Refresh","Add folder":"Add folder","Add file":"Add file","Add file by URL":"Add file by URL","Please select an image file":"Please select an image file","File deleted":"File deleted","Error when deleting a file":"Error when deleting a file","Folder deleted":"Folder deleted","Error when deleting a folder":"Error when deleting a folder","Delete folder":"Delete folder","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Are you sure you want to delete this folder? This action will also delete all files and subfolders.","File moved":"File moved","Error when moving a file":"Error when moving a file","has been successfully uploaded":"has been successfully uploaded","Failed to download file":"Failed to download file","Failed to load JSON data":"Failed to load JSON data","Invalid file URL":"Invalid file URL","Unable to validate file URL":"Unable to validate file URL","Error when uploading a file":"Error when uploading a file","successfully uploaded":"successfully uploaded","Error when downloading a file by URL":"Error when downloading a file by URL","Error loading files":"Error loading files","File Manager not configured":"File Manager not configured","Type to search...":"Type to search...","Failed to create folder":"Failed to create folder",Cancel:"Cancel",Submit:"Submit",months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},files:"files","No available folders":"No available folders","My files":"My files",GIF:"GIF","Stock images":"Stock images",Icons:"Icons",AI:"AI","AI image generation":"AI image generation","Search GIFs":"Search GIFs","That`s all we could find.":"That`s all we could find.","Search image":"Search image",All:"All",Landscape:"Landscape",Portrait:"Portrait",Squarish:"Squarish",Black:"Black","Black and White":"Black and White",White:"White",Orange:"Orange",Red:"Red",Purple:"Purple",Magenta:"Magenta",Green:"Green",Teal:"Teal",Blue:"Blue","Photo by":"Photo by",on:"on",selected:"selected",Deselected:"Deselected","Select all":"Select all",Rename:"Rename","Rename file":"Rename file {{currentFileName}}","Selected files":"Selected files: {{count}}",selected_files_one:"Selected {{count}} file",selected_files_other:"Selected {{count}} files",Edit:"Edit","Move to":"Move to","New folder":"New folder","Image search...":"Image search...","Search icons":"Search icons","By name":"By name","By size":"By size","By date":"By date",List:"List",Grid:"Grid",Main:"Main","total pages":"Total {{total}} items",Name:"Name",Untitled:"Untitled",Dimensions:"Dimensions",error:"error",created:"created","API-endpoint for file upload is not configured":"API-endpoint for file upload is not configured","The URL must point to an image":"The URL must point to an image","Image upload...":"Image upload...",Unknown:"Unknown","Error downloading file by URL":"Error downloading file by URL","File not found":"File not found","File renamed to":"File renamed to ","Failed to rename the file":"Failed to rename the file","Folder renamed to":"Folder renamed to","Rename folder":"Rename folder","New folder name":"New folder name","Enter a new folder name":"Enter a new folder name","Please drag and drop image files only":"Please drag and drop image files only","Upload file by URL":"Upload file by URL","Upload file":"Upload file","Creating a new folder":"Creating a new folder",Create:"Create","Folder name":"Folder name","Enter the name of the folder":"Enter the name of the folder","Enter the name":"Enter the name","A folder will be created inside:":"A folder will be created inside:","selected folder":"selected folder","The folder will be created in the root directory":"The folder will be created in the root directory","Failed to load folders":"Failed to load folders","Folder name cannot be empty":"Folder name cannot be empty","Folder creation provider is not configured":"Folder creation provider is not configured","Folder created":"Folder created","Folder rename is disabled by config":"Folder rename is disabled by config","Folder rename provider is not configured":"Folder rename provider is not configured","Unexpected response when renaming folder":"Unexpected response when renaming folder","Folder renamed":"Folder renamed","Failed to rename folder":"Failed to rename folder","Failed to load folder items count":"Failed to load folder items count","Failed to load subfolders":"Failed to load subfolders",Download:"Download","image URL":"image URL","Enter the URL of the image":"Enter the URL of the image","URL too long":"URL is too long","Only http and https URLs are supported":"Only http and https URLs are supported","Private and local URLs are not allowed":"Private and local URLs are not allowed","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"New file name","Enter a new file name":"Enter a new file name","Copy to folder":"Copy to folder",Added:"Added {{date}}","File uploaded successfully":"File {{fileName}} uploaded successfully","Successfully uploaded":"Successfully uploaded {{successCount}} of {{count}} file","Successfully uploaded files":"Successfully uploaded {{successCount}} of {{count}} files",Uploaded:"Uploaded: {{names}}",uploads_success_summary:"Uploaded {{successCount}} of {{totalCount}} files",Failed:"Failed: {{names}}",uploads_fail_summary:"Failed to upload {{failCount}} of {{totalCount}} files","File with this name already exists.":"File with this name already exists.","File not found or no longer available.":"File not found or no longer available.","You don't have permission to access this file.":"You don't have permission to access this file.","File is too large to upload.":"File is too large to upload.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}","This file type is not allowed.":"This file type is not allowed.","File name is not valid.":"File name is not valid.","File name is not valid. Allowed characters: {{allowedChars}}":"File name is not valid. Allowed characters: {{allowedChars}}","Failed to read the file.":"Failed to read the file.","Failed to write the file.":"Failed to write the file.","The file appears to be corrupted.":"The file appears to be corrupted.","File integrity check failed.":"File integrity check failed.","Folder not found or no longer available.":"Folder not found or no longer available.","Folder with this name already exists.":"Folder with this name already exists.","A folder with that name already exists. Please enter a different folder name.":"A folder with that name already exists. Please enter a different folder name.","You don't have permission to access this folder.":"You don't have permission to access this folder.","Folder name is not valid.":"Folder name is not valid.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Folder name is not valid. Allowed characters: {{allowedChars}}","Failed to read the folder contents.":"Failed to read the folder contents.","Failed to write to the folder.":"Failed to write to the folder.","Folder storage quota exceeded.":"Folder storage quota exceeded.","Folder is not empty.":"Folder is not empty.","Server error while processing the folder.":"Server error while processing the folder.","Folder operation took too long.":"Folder operation took too long.","Network error. Please check your connection and try again.":"Network error. Please check your connection and try again.","The operation took too long. Please try again.":"The operation took too long. Please try again.","Server error. Please try again later.":"Server error. Please try again later.","Service is temporarily unavailable. Please try again later.":"Service is temporarily unavailable. Please try again later.","Too many requests. Please try again a bit later.":"Too many requests. Please try again a bit later.","Authentication failed. Please sign in again.":"Authentication failed. Please sign in again.","You are not allowed to perform this action.":"You are not allowed to perform this action.","Some of the provided data is invalid.":"Some of the provided data is invalid.","This operation is not supported.":"This operation is not supported.","Request payload is too large.":"Request payload is too large.","This media type is not supported.":"This media type is not supported.","You have exceeded the upload quota.":"You have exceeded the upload quota.","Network error while uploading the file.":"Network error while uploading the file.","File upload took too long.":"File upload took too long.","Server error while uploading the file.":"Server error while uploading the file.","The specified URL is not valid.":"The specified URL is not valid.","The specified URL is not reachable.":"The specified URL is not reachable.","Content type at the URL is not allowed.":"Content type at the URL is not allowed.","Failed to download file from the URL.":"Failed to download file from the URL.","Network error while downloading the file.":"Network error while downloading the file.","File download took too long.":"File download took too long.","Server error while downloading the file.":"Server error while downloading the file.","Some items could not be processed.":"Some items could not be processed.","Failed to process all items in the batch.":"Failed to process all items in the batch.","Some items in the batch are in a conflicting state.":"Some items in the batch are in a conflicting state.","Some items in the batch did not pass validation.":"Some items in the batch did not pass validation.","AI service returned an invalid response.":"AI service returned an invalid response.","Failed to generate image using AI.":"Failed to generate image using AI.","You have reached the AI image generation limit.":"You have reached the AI image generation limit.","Error in external integration.":"Error in external integration.","Error in a third-party service.":"Error in a third-party service.","An unknown error occurred.":"An unknown error occurred.","Renaming is not allowed for this item.":"Renaming is not allowed for this item.","Moving is not allowed for this item.":"Moving is not allowed for this item.","Copying is not allowed for this item.":"Copying is not allowed for this item.","Deleting is not allowed for this item.":"Deleting is not allowed for this item.","Cannot move an item into itself.":"Cannot move an item into itself.","Cannot move an item into its descendant folder.":"Cannot move an item into its descendant folder.","Cannot copy an item into itself.":"Cannot copy an item into itself.","Configuration error occurred.":"Configuration error occurred.","Storage quota exceeded. Please free up space.":"Storage quota exceeded. Please free up space.","File is locked by another process or user.":"File is locked by another process or user.","File version conflict. Please refresh and try again.":"File version conflict. Please refresh and try again.","Batch operation exceeds the maximum number of items allowed.":"Batch operation exceeds the maximum number of items allowed.",Moved:"Moved: {{names}}",move_success_summary:"Moved {{successCount}} of {{totalCount}} items",move_fail_summary:"Failed to move {{failCount}} of {{totalCount}} items",Copied:"Copied: {{names}}",copy_success_summary:"Copied {{successCount}} of {{totalCount}} items",copy_fail_summary:"Failed to copy {{failCount}} of {{totalCount}} items","Failed to upload":"Failed to upload {{failCount}} of {{count}} file","Failed to upload files":"Failed to upload {{failCount}} of {{count}} files","No folders yet":"No folders yet","Drag files to upload":"Drag files to upload","Drop files here to upload":"Drop files here to upload","Newest first":"Newest first","Oldest first":"Oldest first","Largest first":"Largest first","Smallest first":"Smallest first","A-Z":"A-Z","Z-A":"Z-A","By type":"By type","Evaluating the task":"Evaluating the task","Something went wrong, please try again":"Something went wrong, please try again","Sort by":"Sort by","preview text":"The image preview is trying to load ...","Use this variant":"Use this variant","Confirm deletion":"Confirm deletion","Are you sure you want to delete the selected items?":"Are you sure you want to delete the selected items?","Move to Trash":"Move to Trash","Are you sure you want to move the selected items to the Trash?":"Are you sure you want to move the selected items to the Trash?","Permanently delete":"Permanently delete","Delete permanently":"Delete permanently","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Are you sure you want to permanently delete the selected items? This action cannot be undone.",Clear:"Clear","Clear Trash":"Clear Trash","Are you sure you want to permanently delete all items from Trash?":"Are you sure you want to permanently delete all items from Trash?","Trash cleared successfully":"Trash cleared successfully","{{count}} items permanently deleted":"{{count}} items permanently deleted","Trash partially cleared":"Trash partially cleared","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} items deleted, {{failed}} items failed","Failed to clear trash":"Failed to clear trash","Error clearing trash":"Error clearing trash","Deleting items...":"Deleting items...",delete_files_permanent_one:"This action will permanently delete {{count}} file",delete_files_permanent_other:"This action will permanently delete {{count}} files",delete_folder_permanent:"This action will permanently delete the folder '{{name}}' and all its contents, including {{count}} items.",delete_mixed_permanent:"This action will permanently delete {{total}} selected items, including {{folders}} folders and all {{images}} images within them.",permanent_delete_warning:"Deleting files that were used in emails will cause problems with displaying images in old emails. Are you sure you want to permanently delete the selection?",move_files_to_trash_one:"This will move {{count}} file to the Trash.",move_files_to_trash_other:"This will move {{count}} files to the Trash.",move_folder_to_trash:"This will move the folder '{{name}}' and all its contents ({{count}} items) to the Trash.",move_mixed_to_trash:"This will move {{total}} selected items to the Trash, including {{folders}} folders and {{images}} images.",delete_count_confirm_trash_one:"Move {{count}} file to Trash?",delete_count_confirm_trash_other:"Move {{count}} files to Trash?",delete_count_confirm_permanent_one:"Permanently delete {{count}} file?",delete_count_confirm_permanent_other:"Permanently delete {{count}} files?",delete_count_confirm_one:"Delete {{count}} file?",delete_count_confirm_other:"Delete {{count}} files?",item:"item",items:"items",Trash:"Deleted",Choose:"Choose",Stock:"Stock","Select an image from our library":"Select an image from our library","AI generation":"AI generation","Creating an image on demand":"Creating an image on demand","Search file or folder":"Search file or folder","Click here to select a file":"Click here to select a file","Create folder":"Create folder",Done:"Done","Move here":"Move here","Copy here":"Copy here","File URL":"File URL","There's nothing here":"There's nothing here","Try using a different search query.":"Try using a different search query.","Millions of free stock images":"Millions of free stock images","Enter a search query and we'll find the perfect image for you":"Enter a search query and we'll find the perfect image for you","Millions of icons":"Millions of icons","Lucide icons":"Lucide icons","Thousands of icons":"Thousands of icons","Enter a search query and we'll find the perfect icon for you":"Enter a search query and we'll find the perfect icon for you","Enter your query and we will find the right one for you":"Enter your query and we will find the right one for you","Over 350,000 live images":"Over 350,000 live images","The folder will be created in the root directory.":"The folder will be created in the root directory.",undo:"UNDO",moved_to_trash_one:"Moved {{count}} item to Trash",moved_to_trash_other:"Moved {{count}} items to Trash",restored_items_one:"Restored {{count}} item",restored_items_other:"Restored {{count}} items",Type:"Type","Generate image":"Generate image","For example:":"For example:","A beautiful image of a sunset over a calm ocean.":"A beautiful image of a sunset over a calm ocean.",Insert:"Insert",Error:"Error","Upload progress":"Upload {{completed}}/{{total}}","Uploading files":"Uploading {{completed}}/{{total}} files","Uploaded files":"Uploaded {{success}} of {{total}} files","Upload error files":"Upload error {{errorCount}} files","Applies to all {{count}} files":"(applies to all {{count}} files)","Some files failed to upload":"Some files failed to upload. Please check file size and format.",upload_error_hint_invalid_name:"Rename the file: use only letters, numbers, hyphens and underscores.",upload_error_hint_size:"Reduce the file size or choose a different file.",upload_error_hint_format:"Use an allowed format: JPG, PNG, or GIF.",upload_error_hint_exists:"A file with this name already exists in the folder. Rename the file.","Images generated successfully":"Images generated successfully","Trash is empty":"Trash is empty","Deleted files will be displayed here":"Deleted files will be displayed here","Supported files:":"Supported files:","Stroke width":"Stroke thickness:",Color1:"Color1:",Color2:"Color2:",Color3:"Color3: ","Global search":"Global search","Family search":"Family search","Choose for template":"Choose for template",Back:"Back","Editing: {{name}}":"Editing: {{name}}","Editing image":"Editing image",Save:"Save","Loading editor...":"Loading editor...","Error loading image":"Error loading image","Error saving image":"Error saving image","Error initializing editor":"Error initializing editor","Close File Manager":"Close File Manager","Are you sure you want to close? Unsaved changes will be lost.":"Are you sure you want to close? Unsaved changes will be lost.","Are you sure you want to close the file manager?":"Are you sure you want to close the file manager?",Close:"Close",KB:"KB","No files":"No files","Folder is empty or files not found":"Folder is empty or files not found","Search files...":"Search files...",Success:"Success","Image updated successfully":"Image updated successfully","Failed to save changes":"Failed to save changes: {{error}}","Unknown error":"Unknown error","Select destination folder":"Select destination folder","Error moving":"Error moving","Error deleting":"Error deleting","Error copying":"Error copying","Error renaming":"Error renaming","Failed to refresh folder tree":"Failed to refresh folder tree","Failed to refresh file list":"Failed to refresh file list","Errors occurred while moving":"Errors occurred while moving","Errors occurred while copying":"Errors occurred while copying","(error)":"(error)","(circular reference)":"(circular reference)","File too large. Maximum size: {{size}}":"File too large. Maximum size: {{size}}","File too small. Minimum size: {{size}}":"File too small. Minimum size: {{size}}","Unsupported file type":"Unsupported file type","Unsupported file type: {{type}}":"Unsupported file type: {{type}}",unknown:"unknown","Failed to load files":"Failed to load files","Failed to load files in folder":"Could not load folder contents ({{folderName}})","Failed to load subfolders in folder":'Could not load subfolders in "{{folderName}}"',"Failed to load folder items count in folder":'Could not get item count for "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider for folder deletion is not configured","DataProvider for file upload is not configured":"DataProvider for file upload is not configured","Error uploading file {{fileName}}":"Error uploading file {{fileName}}","Error uploading file":"Error uploading file","Cannot upload files to Trash":"Cannot upload files to Trash","Please fill in all fields":"Please fill in all fields","Upload by URL is not supported":"Upload by URL is not supported","File name is too long. Maximum {{max}} characters":"File name is too long. Maximum {{max}} characters","File name contains invalid characters":"File name contains invalid characters","Large file may take a long time to upload":"Large file may take a long time to upload","File unavailable: {{status}} {{statusText}}":"File unavailable: {{status}} {{statusText}}","File too large: {{size}}":"File too large: {{size}}","Unsupported file type: {{contentType}}":"Unsupported file type: {{contentType}}","Invalid server response: folder ID is missing":"Invalid server response: folder ID is missing","Error: folder cannot be its own parent":"Error: folder cannot be its own parent","Upload to Trash is forbidden":"Upload to Trash is forbidden","renameFolder is not implemented in dataProviders":"renameFolder is not implemented in dataProviders","renameFile is not implemented in dataProviders":"renameFile is not implemented in dataProviders",Deleted:"Deleted",Clean:"Clean","Circular dependency detected: folder cannot be its own parent":"Circular dependency detected: folder cannot be its own parent","Save as copy and choose":"Save as copy and choose","Save and choose":"Save and choose",pixie:{"added drawing":"Added Drawing","added frame":"Added Frame","added image":"Added Image","added shape":"Added Shape","added sticker":"Added Sticker","added text":"Added Text","applied filters":"Applied Filters",apply:"Apply",background:"Background","background color":"Background color",beach:"Beach","brush color":"Brush Color","brush size":"Brush Size","brush type":"Brush Type",bubbles:"Bubbles",Cancel:"Cancel","changed style":"Changed Style","Circle Brush":"Circle Brush",close:"Close",color:"Color",corners:"Corners",crop:"Crop",Custom:"Custom","deleted object":"Deleted object","Diamond Brush":"Diamond Brush",doodles:"Doodles",draw:"Draw",emoticons:"Emoticons","Eraser Brush":"Eraser Brush",filter:"Filter",font:"Font","font size":"Font Size",frame:"Frame",gradient:"Gradient",height:"Height",history:"History","H Line Brush":"H Line Brush",image:"Image",initial:"Initial",landmarks:"Landmarks","loaded state":"Loaded State","loading canvas":"Loading Canvas","loading image":"Loading Image","loading state":"Loading State","maintain aspect ratio":"Maintain aspect ratio",merge:"Merge","merged objects":"Merged Objects","new text":"New Text",objects:"Objects",opacity:"Opacity",outline:"Outline","outline color":"Outline Color","Pencil Brush":"Pencil Brush","processing image":"Processing Image",quality:"Quality",radius:"Radius","replace image":"Replace Image","replaced background image":"Replaced Background Image",resize:"Resize","resized image":"Resized Image","rounded corner":"Rounded Corner",save:"Save",shadow:"Shadow","shadow color":"Shadow Color",shapes:"Shapes","Spray Brush":"Spray Brush",square:"Square","Square Brush":"Square Brush",stickers:"Stickers",text:"Text",texture:"Texture",transportation:"Transportation","V Line Brush":"V Line Brush",width:"Width",grayscale:"Grayscale","black & White":"Black & White",sharpen:"Sharpen",invert:"Invert",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Brownie",sepia:"Sepia","remove Color":"Remove Color",brightness:"Brightness",gamma:"Gamma",noise:"Noise",pixelate:"Pixelate",blur:"Blur",emboss:"Emboss","blend Color":"Blend Color",distance:"Distance",red:"Red",green:"Green",blue:"Blue",blocksize:"Blocksize",alpha:"Alpha",add:"Add",multiply:"Multiply",subtract:"Subtract",diff:"Diff",screen:"Screen",lighten:"Lighten",darken:"Darken","select an option...":"Select an option..."}},ni={Files:"Файлы",selected:"выбрано",Deselected:"Отменить выбор",Refresh:"Обновить","Select all":"Выбрать все",Rename:"Переименовать","Rename file":"Переименовать файл {{currentFileName}}","Select the destination folder":"Выберите папку назначения","Selected files:":"Выбрано файлов:","Selected files":"Выбрано файлов: {{count}}",selected_files_one:"Выбран {{count}} файл",selected_files_few:"Выбрано {{count}} файла",selected_files_many:"Выбрано {{count}} файлов",selected_files_other:"Выбрано {{count}} файлов",Copy:"Дублировать",Edit:"Изменить",Move:"Переместить","Move to":"Переместить",Delete:"Удалить","New folder":"Новая папка","Image search...":"Поиск изображений...","Search icons":"Найти иконки","By name":"По имени","By size":"По размеру","By date":"По дате",List:"Список",Grid:"Плитки",Main:"Главная",Folders:"Папки","total pages":"Всего {{total}} элементов",Name:"Имя",Untitled:"Без названия",Size:"Размер",Dimensions:"Размер",Date:"Дата",error:"ошибка",Folder:"Папка",created:"создана","Failed to create folder":"Не удалось создать папку","File deleted":"Файл удален","Files deleted":"Файлы удалены","Error when deleting a file":"Ошибка при удалении файла","Folder deleted":"Папка удалена","Error when deleting a folder":"Ошибка при удалении папки","Delete folder":"Удалить папку","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Вы уверены, что хотите удалить эту папку? Это действие также удалит все файлы и подпапки.","API-endpoint for file upload is not configured":"API-endpoint для загрузки файлов не настроен","Please select an image file":"Пожалуйста, выберите файл изображения",File:"Файл","has been successfully uploaded":"успешно загружен","The URL must point to an image":"URL должен указывать на изображение","Image upload...":"Загрузка изображения...",Unknown:"Неизвестно","Error downloading file by URL":"Ошибка загрузки файла по URL","successfully uploaded":"успешно загружен","Error when downloading a file by URL":"Ошибка при загрузке файла по URL","Error when uploading a file":"Ошибка при загрузке файла","Error loading files":"Ошибка загрузки файлов","File not found":"Файл не найден","File renamed to":"Файл переименован на ","Failed to rename the file":"Не удалось переименовать файл","Folder renamed to":"Папка переименована на","Rename folder":"Переименовать папку","New folder name":"Новое название папки","Enter a new folder name":"Введите новое название папки","Please drag and drop image files only":"Пожалуйста, перетащите только файлы изображений","Upload file by URL":"Загрузить файл по URL","Upload file":"Загрузить файл","Creating a new folder":"Создание новой папки",Create:"Создать",Cancel:"Отмена","Folder name":"Название папки","Enter the name of the folder":"Введите название папки","Enter the name":"Введите название","A folder will be created inside:":"Папка будет создана внутри:","selected folder":"выбранной папки","The folder will be created in the root directory":"Папка будет создана в корневом каталоге","Failed to load folders":"Не удалось загрузить папки","Folder name cannot be empty":"Название папки не может быть пустым","Folder creation provider is not configured":"Провайдер создания папок не настроен","Folder created":"Папка создана","Folder rename is disabled by config":"Переименование папок отключено конфигурацией","Folder rename provider is not configured":"Провайдер переименования папок не настроен","Unexpected response when renaming folder":"Неожиданный ответ при переименовании папки","Folder renamed":"Папка переименована","Failed to rename folder":"Не удалось переименовать папку","Failed to load folder items count":"Не удалось получить количество файлов в папке","Failed to load subfolders":"Не удалось загрузить подпапки",Download:"Загрузить","image URL":"URL изображения","Enter the URL of the image":"Введите URL изображения","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Поддерживаемые форматы: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Новое имя файла","Enter a new file name":"Введите новое имя файла","Copy to folder":"Копировать в папку",Added:"Добавлено {{date}}","File uploaded successfully":"Файл {{fileName}} успешно загружен","Successfully uploaded":"Успешно загружено {{successCount}} из {{count}} файла","Successfully uploaded files":"Успешно загружено {{successCount}} из {{count}} файлов",uploads_success_summary:"Загружено {{successCount}} из {{totalCount}} файлов",uploads_fail_summary:"Не удалось загрузить {{failCount}} из {{totalCount}} файлов","File with this name already exists.":"Файл с таким именем уже существует.","File not found or no longer available.":"Файл не найден или уже был удалён.","You don't have permission to access this file.":"У вас нет прав доступа к этому файлу.","File is too large to upload.":"Файл слишком большой для загрузки.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"Файл слишком большой ({{fileSize}}). Максимально допустимый размер — {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Превышено максимальное количество файлов. Допустимо: {{allowed}}, выбрано: {{received}}","This file type is not allowed.":"Этот тип файла не поддерживается.","File name is not valid.":"Недопустимое имя файла.","File name is not valid. Allowed characters: {{allowedChars}}":"Недопустимое имя файла. Допустимые символы: {{allowedChars}}","Failed to read the file.":"Не удалось прочитать файл.","Failed to write the file.":"Не удалось записать файл.","The file appears to be corrupted.":"Файл повреждён или имеет неверный формат.","File integrity check failed.":"Проверка целостности файла завершилась неудачно.","Folder not found or no longer available.":"Папка не найдена или уже была удалена.","Folder with this name already exists.":"Папка с таким именем уже существует.","A folder with that name already exists. Please enter a different folder name.":"Папка с таким именем уже существует. Введите другое имя папки.","You don't have permission to access this folder.":"У вас нет прав доступа к этой папке.","Folder name is not valid.":"Недопустимое имя папки.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Не удалось создать папку. Допустимые символы в названии папки: {{allowedChars}}","Failed to read the folder contents.":"Не удалось прочитать содержимое папки.","Failed to write to the folder.":"Не удалось выполнить операцию с папкой.","Folder storage quota exceeded.":"Превышена квота хранения для папки.","Folder is not empty.":"Папка не пуста.","Server error while processing the folder.":"Ошибка сервера при обработке папки.","Folder operation took too long.":"Операция с папкой выполнялась слишком долго.","Network error. Please check your connection and try again.":"Ошибка сети. Проверьте подключение к интернету и повторите попытку.","The operation took too long. Please try again.":"Операция выполнялась слишком долго. Попробуйте ещё раз.","Server error. Please try again later.":"Ошибка на сервере. Повторите попытку позже.","Service is temporarily unavailable. Please try again later.":"Сервис временно недоступен. Повторите попытку позже.","Too many requests. Please try again a bit later.":"Слишком много запросов. Попробуйте ещё раз немного позже.","Authentication failed. Please sign in again.":"Не удалось пройти аутентификацию. Пожалуйста, войдите снова.","You are not allowed to perform this action.":"У вас нет прав для выполнения этого действия.","Some of the provided data is invalid.":"Некоторые из переданных данных некорректны.","This operation is not supported.":"Эта операция не поддерживается.","Request payload is too large.":"Тело запроса слишком большое.","This media type is not supported.":"Этот тип данных не поддерживается.","You have exceeded the upload quota.":"Превышена квота на загрузку файлов.","Network error while uploading the file.":"Сетевая ошибка при загрузке файла.","File upload took too long.":"Загрузка файла выполнялась слишком долго.","Server error while uploading the file.":"Ошибка сервера при загрузке файла.","The specified URL is not valid.":"Указан некорректный URL.","The specified URL is not reachable.":"Указанный URL недоступен.","Content type at the URL is not allowed.":"Тип содержимого по указанному URL не поддерживается.","Failed to download file from the URL.":"Не удалось скачать файл по указанному URL.","Network error while downloading the file.":"Сетевая ошибка при скачивании файла.","File download took too long.":"Скачивание файла выполнялось слишком долго.","Server error while downloading the file.":"Ошибка сервера при скачивании файла.","Some items could not be processed.":"Не все элементы были обработаны успешно.","Failed to process all items in the batch.":"Не удалось обработать ни один элемент в пакетной операции.","Some items in the batch are in a conflicting state.":"Некоторые элементы в пакетной операции находятся в конфликтующем состоянии.","Some items in the batch did not pass validation.":"Некоторые элементы в пакетной операции не прошли валидацию.","AI service returned an invalid response.":"Сервис AI вернул некорректный ответ.","Failed to generate image using AI.":"Не удалось создать изображение с помощью AI.","You have reached the AI image generation limit.":"Достигнут лимит генерации изображений AI.","Error in external integration.":"Ошибка во внешней интеграции.","Error in a third-party service.":"Ошибка во внешнем сервисе.","An unknown error occurred.":"Произошла неизвестная ошибка.","Renaming is not allowed for this item.":"Переименование не разрешено для этого элемента.","Moving is not allowed for this item.":"Перемещение не разрешено для этого элемента.","Copying is not allowed for this item.":"Копирование не разрешено для этого элемента.","Deleting is not allowed for this item.":"Удаление не разрешено для этого элемента.","Cannot move an item into itself.":"Нельзя переместить элемент в самого себя.","Cannot move an item into its descendant folder.":"Нельзя переместить элемент в дочернюю папку.","Cannot copy an item into itself.":"Нельзя скопировать элемент в самого себя.","Configuration error occurred.":"Произошла ошибка конфигурации.","Storage quota exceeded. Please free up space.":"Превышена квота хранилища. Освободите место.","File is locked by another process or user.":"Файл заблокирован другим процессом или пользователем.","File version conflict. Please refresh and try again.":"Конфликт версий файла. Обновите страницу и попробуйте снова.","Batch operation exceeds the maximum number of items allowed.":"Пакетная операция превышает максимально допустимое количество элементов.",Moved:"Перемещены: {{names}}",move_success_summary:"Перемещено {{successCount}} из {{totalCount}} объектов",move_fail_summary:"Не удалось переместить {{failCount}} из {{totalCount}} объектов",Copied:"Скопированы: {{names}}",copy_success_summary:"Скопировано {{successCount}} из {{totalCount}} объектов",copy_fail_summary:"Не удалось скопировать {{failCount}} из {{totalCount}} объектов",Uploaded:"Загружены: {{names}}",Failed:"Не удалось: {{names}}","Failed to upload":"Не удалось загрузить {{failCount}} из {{count}} файла","Failed to upload files":"Не удалось загрузить {{failCount}} из {{count}} файлов",months:{january:"января",february:"февраля",march:"марта",april:"апреля",may:"мая",june:"июня",july:"июля",august:"августа",september:"сентября",october:"октября",november:"ноября",december:"декабря"},files:"файлов","No available folders":"Нет доступных папок","My files":"Мои файлы",GIF:"GIF","Stock images":"Стоковые изображения",Icons:"Иконки",AI:"AI","AI image generation":"AI генерация изображений","Search GIFs":"Найти GIF","That`s all we could find.":"Это все, что мы смогли найти.","Search image":"Найти изображение",All:"Все",Landscape:"Горизонтальные",Portrait:"Вертикальные",Squarish:"Квадратные",Black:"Черный","Black and White":"Черно-белый",White:"Белый",Orange:"Оранжевый",Red:"Красный",Purple:"Фиолетовый",Magenta:"Пурпурный",Green:"Зеленый",Teal:"Бирюзовый",Blue:"Синий","Photo by":"Фото",on:"на","File Manager":"Файловый менеджер","File Manager not configured":"Файловый менеджер не настроен","Filter by type":"Фильтр по типу","All types":"Все типы","File name":"Имя файла",Actions:"Действия","Add file":"Добавить файл","Add folder":"Добавить папку","Add file by URL":"Добавить файл по URL","File moved":"Файл перемещён","Files moved":"Файлы перемещены","Error when moving a file":"Ошибка при перемещении файла","Files copied":"Файлы скопированы","Failed to download file":"Не удалось скачать файл","Failed to load JSON data":"Не удалось загрузить данные JSON","Invalid file URL":"Некорректный URL файла","Unable to validate file URL":"Не удалось проверить файл по URL","Type to search...":"Введите для поиска...",Submit:"Отправить","No folders yet":"Папок пока нет","Drag files to upload":"Перетащите файлы для загрузки","Drop files here to upload":"Отпустите файлы здесь, чтобы загрузить их","Newest first":"Сначала новые","Oldest first":"Сначала старые","Largest first":"Сначала большие","Smallest first":"Сначала маленькие","A-Z":"По алфавиту А-Я","Z-A":"По алфавиту Я-А","By type":"По типу","Evaluating the task":"Оценка задания","Something went wrong, please try again":"Что-то пошло не так, пожалуйста, попробуйте еще раз","Sort by":"Сортировать по","preview text":"Изображение загружается ...","Use this variant":"Использовать этот вариант","Confirm deletion":"Подтвердить удаление","Are you sure you want to delete the selected items?":"Вы уверены, что хотите удалить выбранные элементы?","Move to Trash":"Переместить в корзину","Are you sure you want to move the selected items to the Trash?":"Вы уверены, что хотите переместить выбранные элементы в корзину?","Permanently delete":"Полное удаление","Delete permanently":"Удалить безвозвратно","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Вы уверены, что хотите безвозвратно удалить выбранные элементы? Это действие нельзя отменить.",Clear:"Очистить","Clear Trash":"Очистить корзину","Are you sure you want to permanently delete all items from Trash?":"Вы уверены, что хотите безвозвратно удалить все элементы из корзины?","Trash cleared successfully":"Корзина успешно очищена","{{count}} items permanently deleted":"{{count}} элементов безвозвратно удалено","Trash partially cleared":"Корзина частично очищена","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} элементов удалено, {{failed}} не удалось удалить","Failed to clear trash":"Не удалось очистить корзину","Error clearing trash":"Ошибка при очистке корзины","Deleting items...":"Удаление элементов...",delete_files_permanent_one:"Это действие безвозвратно удалит {{count}} файл",delete_files_permanent_few:"Это действие безвозвратно удалит {{count}} файла",delete_files_permanent_many:"Это действие безвозвратно удалит {{count}} файлов",delete_files_permanent_other:"Это действие безвозвратно удалит {{count}} файлов",delete_folder_permanent:"Это действие безвозвратно удалит папку «{{name}}» и всё её содержимое, включая {{count}} элементов.",delete_mixed_permanent:"Это действие безвозвратно удалит {{total}} выбранных элементов, включая {{folders}} папок и все {{images}} изображений внутри них.",permanent_delete_warning:"Удаление файлов, которые были использованы в письмах, приведет к проблемам с отображением картинок в старых письмах. Вы уверены, что хотите полностью удалить выбранное?",move_files_to_trash_one:"Это действие переместит в корзину {{count}} файл.",move_files_to_trash_few:"Это действие переместит в корзину {{count}} файла.",move_files_to_trash_many:"Это действие переместит в корзину {{count}} файлов.",move_files_to_trash_other:"Это действие переместит в корзину {{count}} файлов.",move_folder_to_trash:"Это действие переместит в корзину папку «{{name}}» и всё её содержимое ({{count}} элементов).",move_mixed_to_trash:"Это действие переместит в корзину {{total}} выбранных элементов, включая {{folders}} папок и {{images}} изображений.",delete_count_confirm_trash_one:"Переместить в корзину {{count}} файл?",delete_count_confirm_trash_few:"Переместить в корзину {{count}} файла?",delete_count_confirm_trash_many:"Переместить в корзину {{count}} файлов?",delete_count_confirm_trash_other:"Переместить в корзину {{count}} файлов?",delete_count_confirm_permanent_one:"Удалить навсегда {{count}} файл?",delete_count_confirm_permanent_few:"Удалить навсегда {{count}} файла?",delete_count_confirm_permanent_many:"Удалить навсегда {{count}} файлов?",delete_count_confirm_permanent_other:"Удалить навсегда {{count}} файлов?",delete_count_confirm_one:"Удалить {{count}} файл?",delete_count_confirm_few:"Удалить {{count}} файла?",delete_count_confirm_many:"Удалить {{count}} файлов?",delete_count_confirm_other:"Удалить {{count}} файлов?",item:"файл",items:"файлов",Trash:"Корзина",Choose:"Выбрать",Stock:"Фотосток","Select an image from our library":"Выберите изображение из нашей библиотеки","AI generation":"AI генерация","Creating an image on demand":"Создание изображения по запросу","Search file or folder":"Найти файл или папку","Click here to select a file":"Нажмите здесь, чтобы выбрать файл","Supported files:":"Поддерживаемые файлы:","Create folder":"Создать папку",Done:"Готово","Move here":"Переместить сюда","Copy here":"Копировать сюда","File URL":"URL файла","There's nothing here":"Здесь ничего нет","Try using a different search query.":"Попробуйте использовать другой поисковый запрос.","Millions of free stock images":"Миллионы бесплатных стоковых изображений","Enter a search query and we'll find the perfect image for you":"Введите поисковый запрос, и мы найдем для вас идеальное изображение","Millions of icons":"Миллионы иконок","Lucide icons":"Иконки Lucide","Thousands of icons":"Тысячи иконок","Enter a search query and we'll find the perfect icon for you":"Введите поисковый запрос, и мы найдем для вас идеальную иконку","Enter your query and we will find the right one for you":"Введите запрос и мы найдем для вас подходящее","Over 350,000 live images":"Более 350 000 живых изображений","The folder will be created in the root directory.":"Папка будет создана в корневом каталоге.",undo:"ОТМЕНА",moved_to_trash_one:"Перемещён {{count}} элемент в корзину",moved_to_trash_few:"Перемещено {{count}} элемента в корзину",moved_to_trash_many:"Перемещено {{count}} элементов в корзину",moved_to_trash_other:"Перемещено {{count}} элементов в корзину",restored_items_one:"Восстановлён {{count}} элемент",restored_items_few:"Восстановлено {{count}} элемента",restored_items_many:"Восстановлено {{count}} элементов",restored_items_other:"Восстановлено {{count}} элементов",Type:"Тип","Generate image":"Cгенерировать изображение","A beautiful image of a sunset over a calm ocean.":"Красивое изображение заката над спокойным океаном.","For example:":"Например:",Insert:"Вставить",Error:"Ошибка","Upload progress":"Загрузка {{completed}}/{{total}}","Uploading files":"Загрузка {{completed}}/{{total}} файлов","Uploaded files":"Загружено {{success}} из {{total}} файлов","Upload error files":"Ошибка загрузки {{errorCount}} файлов","Applies to all {{count}} files":"(применительно ко всем {{count}} файлам)","Some files failed to upload":"Некоторые файлы не удалось загрузить. Проверьте размер и формат файлов.",upload_error_hint_invalid_name:"Переименуйте файл: используйте только буквы, цифры, дефис и подчёркивание.",upload_error_hint_size:"Уменьшите размер файла или выберите другой.",upload_error_hint_format:"Используйте допустимый формат: JPG, PNG или GIF.",upload_error_hint_exists:"Файл с таким именем уже есть в папке. Переименуйте файл.","Images generated successfully":"Изображения успешно сгенерированы","Trash is empty":"Корзина пуста","Deleted files will be displayed here":"Здесь будут отображаться удаленные файлы","Stroke width":"Толщина:",Style:"Стиль",Color1:"Цвет 1:",Color2:"Цвет 2:",Color3:"Цвет 3: ","Global search":"Глобальный поиск","Family search":"Поиск по семейству","Choose for template":"Выбрать для загрузки в шаблон",Back:"Назад","Editing: {{name}}":"Редактирование: {{name}}","Editing image":"Редактирование изображения",Save:"Сохранить","Loading editor...":"Загрузка редактора…","Error loading image":"Ошибка загрузки изображения","Error saving image":"Ошибка при сохранении изображения","Error initializing editor":"Ошибка инициализации редактора","Close File Manager":"Закрыть файловый менеджер","Are you sure you want to close? Unsaved changes will be lost.":"Вы уверены, что хотите закрыть? Несохраненные изменения будут потеряны.","Are you sure you want to close the file manager?":"Вы уверены, что хотите закрыть файловый менеджер?",Close:"Закрыть",KB:"КБ","No files":"Нет файлов","Folder is empty or files not found":"Папка пуста или файлы не найдены","Search files...":"Поиск файлов...",Success:"Успех","Image updated successfully":"Изображение успешно обновлено","Failed to save changes":"Не удалось сохранить изменения: {{error}}","Unknown error":"Неизвестная ошибка","Select destination folder":"Выберите папку назначения","Error moving":"Ошибка при перемещении","Error deleting":"Ошибка при удалении","Error copying":"Ошибка при копировании","Error renaming":"Ошибка при переименовании","Failed to refresh folder tree":"Не удалось обновить дерево папок","Failed to refresh file list":"Не удалось обновить список файлов","Errors occurred while moving":"При перемещении произошли ошибки","Errors occurred while copying":"При копировании произошли ошибки","(error)":"(ошибка)","(circular reference)":"(циклическая ссылка)","File too large. Maximum size: {{size}}":"Файл слишком большой. Максимальный размер: {{size}}","File too small. Minimum size: {{size}}":"Файл слишком маленький. Минимальный размер: {{size}}","Unsupported file type":"Неподдерживаемый тип файла","Unsupported file type: {{type}}":"Неподдерживаемый тип файла: {{type}}",unknown:"неизвестный","Failed to load files":"Не удалось загрузить файлы","Failed to load files in folder":"Не удалось загрузить содержимое папки «{{folderName}}»","Failed to load subfolders in folder":"Не удалось загрузить подпапки в «{{folderName}}»","Failed to load folder items count in folder":"Не удалось получить число элементов в «{{folderName}}»","DataProvider for folder deletion is not configured":"DataProvider для удаления папок не настроен","DataProvider for file upload is not configured":"DataProvider для загрузки файлов не настроен","Error uploading file {{fileName}}":"Ошибка при загрузке файла {{fileName}}","Error uploading file":"Ошибка при загрузке файла","Cannot upload files to Trash":"Нельзя загружать файлы в корзину","Please fill in all fields":"Заполните все поля","URL too long":"URL слишком длинный","Only http and https URLs are supported":"Поддерживаются только URL с протоколом http и https","Private and local URLs are not allowed":"Локальные и приватные URL запрещены","Upload by URL is not supported":"Загрузка по URL не поддерживается","File name is too long. Maximum {{max}} characters":"Имя файла слишком длинное. Максимум {{max}} символов","File name contains invalid characters":"Имя файла содержит недопустимые символы","Large file may take a long time to upload":"Большой файл может загружаться долго","File unavailable: {{status}} {{statusText}}":"Файл недоступен: {{status}} {{statusText}}","File too large: {{size}}":"Файл слишком большой: {{size}}","Unsupported file type: {{contentType}}":"Неподдерживаемый тип файла: {{contentType}}","Invalid server response: folder ID is missing":"Некорректный ответ от сервера: отсутствует ID папки","Error: folder cannot be its own parent":"Ошибка: папка не может быть родителем самой себя","Upload to Trash is forbidden":"Загрузка в корзину запрещена","renameFolder is not implemented in dataProviders":"renameFolder не реализован в dataProviders","renameFile is not implemented in dataProviders":"renameFile не реализован в dataProviders",Deleted:"Удаленные файлы",Clean:"Очистить","Circular dependency detected: folder cannot be its own parent":"Обнаружена циклическая зависимость: папка не может быть родителем самой себя","Save as copy and choose":"Сохранить как копию и выбрать","Save and choose":"Сохранить и выбрать",pixie:{"added drawing":"Добавление рисунка","added frame":"Добавление рамки","added image":"Добавление изображения","added shape":"Добавление фигуры","added sticker":"Добавление стикера","added text":"Добавление текста","applied filters":"Применение фильтр",apply:"Применить",background:"Фон","background color":"Фоновый цвет",beach:"Пляж","brush color":"Цвет кисти","brush size":"Размер кисти","brush type":"Тип кисти",bubbles:"Пузырьки",Cancel:"Отмена","changed style":"Изменение стиля","Circle Brush":"Круги",close:"Закрыть",color:"Цвет",corners:"Углы",crop:"Обрезать",Custom:"Пользовательский","deleted object":"Удаление объекта","Diamond Brush":"Алмаз",doodles:"Цветные",draw:"Рисунок",emoticons:"Смайлики","Eraser Brush":"Ластик",filter:"Фильтр",font:"Шрифт","font size":"Размер шрифта",frame:"Рамка",gradient:"Градиент",height:"Высота",history:"История","H Line Brush":"Н-образная",image:"Изображение",initial:"Начальный",landmarks:"Достопримечательности","loaded state":"Загрузка состояния","loading canvas":"Загрузка","loading image":"Загрузка","loading state":"Загрузка","maintain aspect ratio":"Maintain aspect ratio",merge:"Объединение","merged objects":"Объединение объектов","new text":"Новая надпись",objects:"Объект",opacity:"Прозрачность",outline:"Контур","outline color":"Цвет контура","Pencil Brush":"Карандаш","processing image":"Загрузка",quality:"Качество",radius:"Радиус","replace image":"Replace Image","replaced background image":"Удаление фонового изображения",resize:"Размер","resized image":"Изменение размера","rounded corner":"Загругление углов",save:"Сохранить",shadow:"Тень","shadow color":"Цвет тени",shapes:"Фигуры","Spray Brush":"Спрей",square:"Квардрат","Square Brush":"Квардрат",stickers:"Стикеры",text:"Надпись",texture:"Текстура",transportation:"Транспорт","V Line Brush":"V-образная",width:"Ширина",grayscale:"Оттенки серого","black & White":"Черно-белый",sharpen:"Резкость",invert:"Инверсия",vintage:"Винтаж",polaroid:"Полароид",kodachrome:"Кодахром",technicolor:"Техниколор",brownie:"Коричневый",sepia:"Сепия","remove Color":"Удалить цвет",brightness:"Яркость",gamma:"Гамма",noise:"Шум",pixelate:"Пиксельизация",blur:"Размытие",emboss:"Тиснение","blend Color":"Смешать цвет",distance:"Расстояние",red:"Красный",green:"Зеленый",blue:"Синий",blocksize:"Размер блока",alpha:"Альфа",add:"Добавить",multiply:"Умножить",subtract:"Вычесть",diff:"Разница",screen:"Экран",lighten:"Осветлить",darken:"Затемнить","select an option...":"Выберите опцию..."}},ii={Files:"Файли",selected:"обрано",Deselected:"Скасувати вибір",Refresh:"Оновити","Select all":"Вибрати все",Rename:"Перейменувати","Rename file":"Перейменувати файл {{currentFileName}}","Select the destination folder":"Виберіть папку призначення","Selected files:":"Обрано файлів:","Selected files":"Обрано файлів: {{count}}",selected_files_one:"Обрано {{count}} файл",selected_files_few:"Обрано {{count}} файли",selected_files_many:"Обрано {{count}} файлів",selected_files_other:"Обрано {{count}} файлів",Copy:"Дублювати",Edit:"Змінити",Move:"Перемістити","Move to":"Перемістити",Delete:"Видалити","New folder":"Нова папка","Image search...":"Пошук зображень...","Search icons":"Знайти іконки","By name":"За назвою","By size":"За розміром","By date":"За датою",List:"Список",Grid:"Плитки",Main:"Головна",Folders:"Папки","total pages":"Всього {{total}} елементів",Name:"Назва",Untitled:"Без назви",Size:"Розмір",Dimensions:"Розмір",Date:"Дата",error:"помилка",Folder:"Папка",created:"створена","Failed to create folder":"Не вдалося створити папку","File deleted":"Файл видалено","Error when deleting a file":"Помилка при видаленні файлу","Folder deleted":"Папку видалено","Error when deleting a folder":"Помилка при видаленні папки","Delete folder":"Видалити папку","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Ви впевнені, що хочете видалити цю папку? Ця дія також видалить усі файли та підпапки.","API-endpoint for file upload is not configured":"API-endpoint для завантаження файлів не налаштовано","Please select an image file":"Будь ласка, виберіть файл зображення",File:"Файл","has been successfully uploaded":"успішно завантажено","The URL must point to an image":"URL повинен вказувати на зображення","Image upload...":"Завантаження зображення...",Unknown:"Невідомо","Error downloading file by URL":"Помилка завантаження файлу за URL","successfully uploaded":"успішно завантажено","Error when downloading a file by URL":"Помилка при завантаженні файлу за URL","Error when uploading a file":"Помилка при завантаженні файлу","Error loading files":"Помилка завантаження файлів","File not found":"Файл не знайдено","File renamed to":"Файл перейменовано на ","Failed to rename the file":"Не вдалося перейменувати файл","Folder renamed to":"Папку перейменовано на","Rename folder":"Перейменувати папку","New folder name":"Нова назва папки","Enter a new folder name":"Введіть нову назву папки","Please drag and drop image files only":"Будь ласка, перетягуйте лише файли зображень","Upload file by URL":"Завантажити файл за URL","Upload file":"Завантажити файл","Creating a new folder":"Створення нової папки",Create:"Створити",Cancel:"Скасувати","Folder name":"Назва папки","Enter the name of the folder":"Введіть назву папки","Enter the name":"Введіть назву","A folder will be created inside:":"Папка буде створена всередині:","selected folder":"обраної папки","The folder will be created in the root directory":"Папка буде створена в кореневому каталозі","Failed to load folders":"Не вдалося завантажити папки","Folder name cannot be empty":"Назва папки не може бути порожньою","Folder creation provider is not configured":"Постачальник створення папок не налаштований","Folder created":"Папку створено","Folder rename is disabled by config":"Перейменування папок вимкнено в налаштуваннях","Folder rename provider is not configured":"Постачальник перейменування папок не налаштований","Unexpected response when renaming folder":"Неочікувана відповідь під час перейменування папки","Folder renamed":"Папку перейменовано","Failed to rename folder":"Не вдалося перейменувати папку","Failed to load folder items count":"Не вдалося отримати кількість елементів у папці","Failed to load subfolders":"Не вдалося завантажити підпапки",Download:"Завантажити","image URL":"URL зображення","Enter the URL of the image":"Введіть URL зображення","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Підтримувані формати: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Нова назва файлу","Enter a new file name":"Введіть нову назву файлу","Copy to folder":"Копіювати в папку",Added:"Додано {{date}}","File uploaded successfully":"Файл {{fileName}} успішно завантажено","Successfully uploaded":"Успішно завантажено {{successCount}} з {{count}} файлу","Successfully uploaded files":"Успішно завантажено {{successCount}} з {{count}} файлів",uploads_success_summary:"Завантажено {{successCount}} з {{totalCount}} файлів",uploads_fail_summary:"Не вдалося завантажити {{failCount}} з {{totalCount}} файлів","File with this name already exists.":"Файл з такою назвою вже існує.","File not found or no longer available.":"Файл не знайдено або його вже видалено.","You don't have permission to access this file.":"У вас немає прав доступу до цього файлу.","File is too large to upload.":"Файл занадто великий для завантаження.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"Файл занадто великий ({{fileSize}}). Дозволений максимальний розмір — {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Перевищено максимальну кількість файлів. Дозволено: {{allowed}}, обрано: {{received}}","This file type is not allowed.":"Цей тип файлу не підтримується.","File name is not valid.":"Неприпустима назва файлу.","File name is not valid. Allowed characters: {{allowedChars}}":"Неприпустима назва файлу. Допустимі символи: {{allowedChars}}","Failed to read the file.":"Не вдалося прочитати файл.","Failed to write the file.":"Не вдалося записати файл.","The file appears to be corrupted.":"Файл пошкоджений або має неправильний формат.","File integrity check failed.":"Перевірка цілісності файлу завершилась невдало.","Folder not found or no longer available.":"Папку не знайдено або її вже видалено.","Folder with this name already exists.":"Папка з такою назвою вже існує.","A folder with that name already exists. Please enter a different folder name.":"Папка з такою назвою вже існує. Введіть інше ім'я папки.","You don't have permission to access this folder.":"У вас немає прав доступу до цієї папки.","Folder name is not valid.":"Неприпустима назва папки.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Не вдалося створити папку. Допустимі символи в назві папки: {{allowedChars}}","Failed to read the folder contents.":"Не вдалося прочитати вміст папки.","Failed to write to the folder.":"Не вдалося виконати операцію з папкою.","Folder storage quota exceeded.":"Перевищено квоту зберігання для папки.","Folder is not empty.":"Папка не порожня.","Server error while processing the folder.":"Помилка сервера під час обробки папки.","Folder operation took too long.":"Операція з папкою зайняла надто багато часу.","Network error. Please check your connection and try again.":"Помилка мережі. Перевірте підключення до інтернету та повторіть спробу.","The operation took too long. Please try again.":"Операція виконувалася надто довго. Спробуйте ще раз.","Server error. Please try again later.":"Помилка на сервері. Повторіть спробу пізніше.","Service is temporarily unavailable. Please try again later.":"Сервіс тимчасово недоступний. Повторіть спробу пізніше.","Too many requests. Please try again a bit later.":"Занадто багато запитів. Спробуйте ще раз пізніше.","Authentication failed. Please sign in again.":"Не вдалося пройти автентифікацію. Будь ласка, увійдіть знову.","You are not allowed to perform this action.":"У вас немає прав для виконання цієї дії.","Some of the provided data is invalid.":"Деякі з переданих даних є некоректними.","This operation is not supported.":"Ця операція не підтримується.","Request payload is too large.":"Тіло запиту занадто велике.","This media type is not supported.":"Цей тип даних не підтримується.","You have exceeded the upload quota.":"Перевищено квоту на завантаження файлів.","Network error while uploading the file.":"Помилка мережі під час завантаження файлу.","File upload took too long.":"Завантаження файлу тривало надто довго.","Server error while uploading the file.":"Помилка сервера під час завантаження файлу.","The specified URL is not valid.":"Вказано некоректну URL-адресу.","The specified URL is not reachable.":"Вказана URL-адреса недоступна.","Content type at the URL is not allowed.":"Тип вмісту за вказаною URL-адресою не підтримується.","Failed to download file from the URL.":"Не вдалося завантажити файл за вказаною URL-адресою.","Network error while downloading the file.":"Помилка мережі під час завантаження файлу.","File download took too long.":"Завантаження файлу тривало надто довго.","Server error while downloading the file.":"Помилка сервера під час завантаження файлу.","Some items could not be processed.":"Не всі елементи були оброблені успішно.","Failed to process all items in the batch.":"Не вдалося обробити жоден елемент у пакетній операції.","Some items in the batch are in a conflicting state.":"Деякі елементи в пакетній операції перебувають у конфліктному стані.","Some items in the batch did not pass validation.":"Деякі елементи в пакетній операції не пройшли валідацію.","AI service returned an invalid response.":"Сервіс ШІ повернув некоректну відповідь.","Failed to generate image using AI.":"Не вдалося створити зображення за допомогою ШІ.","You have reached the AI image generation limit.":"Досягнуто ліміту генерації зображень ШІ.","Error in external integration.":"Помилка у зовнішній інтеграції.","Error in a third-party service.":"Помилка у зовнішньому сервісі.","An unknown error occurred.":"Сталася невідома помилка.","Renaming is not allowed for this item.":"Перейменування не дозволено для цього елемента.","Moving is not allowed for this item.":"Переміщення не дозволено для цього елемента.","Copying is not allowed for this item.":"Копіювання не дозволено для цього елемента.","Deleting is not allowed for this item.":"Видалення не дозволено для цього елемента.","Cannot move an item into itself.":"Не можна перемістити елемент у самого себе.","Cannot move an item into its descendant folder.":"Не можна перемістити елемент у дочірню папку.","Cannot copy an item into itself.":"Не можна скопіювати елемент у самого себе.","Configuration error occurred.":"Сталася помилка конфігурації.","Storage quota exceeded. Please free up space.":"Перевищено квоту сховища. Звільніть місце.","File is locked by another process or user.":"Файл заблоковано іншим процесом або користувачем.","File version conflict. Please refresh and try again.":"Конфлікт версій файлу. Оновіть сторінку та спробуйте ще раз.","Batch operation exceeds the maximum number of items allowed.":"Пакетна операція перевищує максимально допустиму кількість елементів.",Moved:"Переміщено: {{names}}",move_success_summary:"Переміщено {{successCount}} з {{totalCount}} елементів",move_fail_summary:"Не вдалося перемістити {{failCount}} з {{totalCount}} елементів",Copied:"Скопійовано: {{names}}",copy_success_summary:"Скопійовано {{successCount}} з {{totalCount}} елементів",copy_fail_summary:"Не вдалося скопіювати {{failCount}} з {{totalCount}} елементів",Uploaded:"Завантажено: {{names}}",Failed:"Не вдалося завантажити: {{names}}","Failed to upload":"Не вдалося завантажити {{failCount}} з {{count}} файлу","Failed to upload files":"Не вдалося завантажити {{failCount}} з {{count}} файлів",months:{january:"січня",february:"лютого",march:"березня",april:"квітня",may:"травня",june:"червня",july:"липня",august:"серпня",september:"вересня",october:"жовтня",november:"листопада",december:"грудня"},files:"файлів","No available folders":"Немає доступних папок","My files":"Мої файли",GIF:"GIF","Stock images":"Стокові зображення",AI:"AI","AI image generation":"AI генерація зображень","Search GIFs":"Знайти GIF","That`s all we could find.":"Це все, що ми змогли знайти.","Search image":"Знайти зображення",All:"Всі",Landscape:"Горизонтальні",Portrait:"Вертикальні",Squarish:"Квадратні",Black:"Чорний","Black and White":"Чорно-білий",White:"Білий",Orange:"Помаранчевий",Red:"Червоний",Purple:"Фіолетовий",Magenta:"Пурпурний",Green:"Зелений",Teal:"Бірюзовий",Blue:"Синій","Photo by":"Фото",on:"на","File Manager":"Файловий менеджер","File Manager not configured":"Файловий менеджер не налаштовано","Filter by type":"Фільтр за типом","All types":"Всі типи","File name":"Назва файлу",Actions:"Дії","Add file":"Додати файл","Add folder":"Додати папку","Add file by URL":"Додати файл за URL","File moved":"Файл переміщено","Error when moving a file":"Помилка при переміщенні файлу","Failed to download file":"Не вдалося завантажити файл","Failed to load JSON data":"Не вдалося завантажити дані JSON","Invalid file URL":"Некоректний URL файлу","Unable to validate file URL":"Не вдалося перевірити файл за URL","Type to search...":"Введіть для пошуку...",Submit:"Надіслати","No folders yet":"Папок поки немає","Drag files to upload":"Перетягніть файли для завантаження","Drop files here to upload":"Відпустіть файли тут, щоб завантажити їх","Newest first":"Спочатку нові","Oldest first":"Спочатку старі","Largest first":"Спочатку великі","Smallest first":"Спочатку маленькі","A-Z":"За алфавітом А-Я","Z-A":"За алфавітом Я-А","By type":"За типом","Evaluating the task":"Оцінка завдання","Something went wrong, please try again":"Щось пішло не так, будь ласка, спробуйте ще раз","Sort by":"Сортувати за","preview text":"Зображення завантажується ...","Use this variant":"Використати цей варіант","Confirm deletion":"Підтвердити видалення","Are you sure you want to delete the selected items?":"Ви впевнені, що хочете видалити обрані елементи?","Move to Trash":"Перемістити в кошик","Are you sure you want to move the selected items to the Trash?":"Ви впевнені, що хочете перемістити обрані елементи в кошик?","Permanently delete":"Повне видалення","Delete permanently":"Видалити безповоротно","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Ви впевнені, що хочете безповоротно видалити обрані елементи? Цю дію не можна скасувати.",Clear:"Очистити","Clear Trash":"Очистити кошик","Are you sure you want to permanently delete all items from Trash?":"Ви впевнені, що хочете безповоротно видалити всі елементи з кошика?","Trash cleared successfully":"Кошик успішно очищено","{{count}} items permanently deleted":"{{count}} елементів безповоротно видалено","Trash partially cleared":"Кошик частково очищено","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} елементів видалено, {{failed}} не вдалося видалити","Failed to clear trash":"Не вдалося очистити кошик","Error clearing trash":"Помилка при очищенні кошика","Deleting items...":"Видалення елементів...",delete_files_permanent_one:"Ця дія безповоротно видалить {{count}} файл",delete_files_permanent_few:"Ця дія безповоротно видалить {{count}} файли",delete_files_permanent_many:"Ця дія безповоротно видалить {{count}} файлів",delete_files_permanent_other:"Ця дія безповоротно видалить {{count}} файлів",delete_folder_permanent:"Ця дія безповоротно видалить папку «{{name}}» і все її вміст, включаючи {{count}} елементів.",delete_mixed_permanent:"Ця дія безповоротно видалить {{total}} обраних елементів, включаючи {{folders}} папок і всі {{images}} зображень всередині них.",permanent_delete_warning:"Видалення файлів, які були використані в листах, призведе до проблем з відображенням зображень у старих листах. Ви впевнені, що хочете повністю видалити обране?",move_files_to_trash_one:"Ця дія перемістить у кошик {{count}} файл.",move_files_to_trash_few:"Ця дія перемістить у кошик {{count}} файли.",move_files_to_trash_many:"Ця дія перемістить у кошик {{count}} файлів.",move_files_to_trash_other:"Ця дія перемістить у кошик {{count}} файлів.",move_folder_to_trash:"Ця дія перемістить у кошик папку «{{name}}» і все її вміст ({{count}} елементів).",move_mixed_to_trash:"Ця дія перемістить у кошик {{total}} обраних елементів, включаючи {{folders}} папок і {{images}} зображень.",delete_count_confirm_trash_one:"Перемістити в кошик {{count}} файл?",delete_count_confirm_trash_few:"Перемістити в кошик {{count}} файли?",delete_count_confirm_trash_many:"Перемістити в кошик {{count}} файлів?",delete_count_confirm_trash_other:"Перемістити в кошик {{count}} файлів?",delete_count_confirm_permanent_one:"Видалити назавжди {{count}} файл?",delete_count_confirm_permanent_few:"Видалити назавжди {{count}} файли?",delete_count_confirm_permanent_many:"Видалити назавжди {{count}} файлів?",delete_count_confirm_permanent_other:"Видалити назавжди {{count}} файлів?",delete_count_confirm_one:"Видалити {{count}} файл?",delete_count_confirm_few:"Видалити {{count}} файли?",delete_count_confirm_many:"Видалити {{count}} файлів?",delete_count_confirm_other:"Видалити {{count}} файлів?",item:"файл",items:"файлів",Trash:"Видалені",Choose:"Обрати",Stock:"Фотосток","Select an image from our library":"Виберіть зображення з нашої бібліотеки","AI generation":"AI генерація","Creating an image on demand":"Створення зображення на замовлення","Search file or folder":"Знайти файл або папку","Click here to select a file":"Натисніть тут, щоб вибрати файл","Supported files:":"Підтримувані файли:","Create folder":"Створити папку",Done:"Готово","Move here":"Перемістити сюди","Copy here":"Копіювати сюди","File URL":"URL файлу","There's nothing here":"Тут нічого немає","Try using a different search query.":"Спробуйте використовувати інший пошуковий запит.","Millions of free stock images":"Мільйони безкоштовних стокових зображень","Enter a search query and we'll find the perfect image for you":"Введіть пошуковий запит, і ми знайдемо для вас ідеальне зображення","Millions of icons":"Мільйони іконок","Lucide icons":"Іконки Lucide","Thousands of icons":"Тисячі іконок","Enter a search query and we'll find the perfect icon for you":"Введіть пошуковий запит, і ми знайдемо для вас ідеальну іконку","Enter your query and we will find the right one for you":"Введіть запит і ми знайдемо для вас відповідне","Over 350,000 live images":"Понад 350 000 живих зображень","The folder will be created in the root directory.":"Папка буде створена в кореневому каталозі.",undo:"СКАСУВАТИ",moved_to_trash_one:"Переміщено {{count}} елемент у кошик",moved_to_trash_few:"Переміщено {{count}} елементи у кошик",moved_to_trash_many:"Переміщено {{count}} елементів у кошик",moved_to_trash_other:"Переміщено {{count}} елементів у кошик",restored_items_one:"Відновлено {{count}} елемент",restored_items_few:"Відновлено {{count}} елементи",restored_items_many:"Відновлено {{count}} елементів",restored_items_other:"Відновлено {{count}} елементів",Type:"Тип","Generate image":"Створити зображення","A beautiful image of a sunset over a calm ocean.":"Красиве зображення заходу сонця над спокійним океаном.","For example:":"Наприклад:",Insert:"Вставити",Error:"Помилка","Upload progress":"Завантаження {{completed}}/{{total}}","Uploading files":"Завантаження {{completed}}/{{total}} файлів","Uploaded files":"Завантажено {{success}} з {{total}} файлів","Upload error files":"Помилка завантаження {{errorCount}} файлів","Applies to all {{count}} files":"(стосується всіх {{count}} файлів)","Some files failed to upload":"Деякі файли не вдалося завантажити. Перевірте розмір та формат файлів.",upload_error_hint_invalid_name:"Перейменуйте файл: використовуйте лише літери, цифри, дефіс та підкреслення.",upload_error_hint_size:"Зменшіть розмір файлу або оберіть інший.",upload_error_hint_format:"Оберіть дозволений формат: JPG, PNG або GIF.",upload_error_hint_exists:"Файл з такою назвою вже є в папці. Перейменуйте файл.","Images generated successfully":"Зображення успішно створено","Choose for template":"Вибрати для завантаження в шаблон","Trash is empty":"Кошик порожній","Deleted files will be displayed here":"Тут будуть відображатися видалені файли","Editing: {{name}}":"Редагування: {{name}}","Editing image":"Редагування зображення",Save:"Зберегти","Loading editor...":"Завантаження редактора…","Error loading image":"Помилка завантаження зображення","Error saving image":"Помилка при збереженні зображення","Error initializing editor":"Помилка ініціалізації редактора","Close File Manager":"Закрити файловий менеджер","Are you sure you want to close? Unsaved changes will be lost.":"Ви впевнені, що хочете закрити? Незбережені зміни будуть втрачені.","Are you sure you want to close the file manager?":"Ви впевнені, що хочете закрити файловий менеджер?",Close:"Закрити",KB:"КБ","No files":"Немає файлів","Folder is empty or files not found":"Папка порожня або файли не знайдені","Search files...":"Пошук файлів...",Success:"Успіх","Image updated successfully":"Зображення успішно оновлено","Failed to save changes":"Не вдалося зберегти зміни: {{error}}","Unknown error":"Невідома помилка","Select destination folder":"Виберіть папку призначення","Error moving":"Помилка при переміщенні","Error deleting":"Помилка при видаленні","Error copying":"Помилка при копіюванні","Error renaming":"Помилка при перейменуванні","Failed to refresh folder tree":"Не вдалося оновити дерево папок","Failed to refresh file list":"Не вдалося оновити список файлів","Errors occurred while moving":"Під час переміщення виникли помилки","Errors occurred while copying":"Під час копіювання виникли помилки","(error)":"(помилка)","(circular reference)":"(циклічне посилання)","File too large. Maximum size: {{size}}":"Файл занадто великий. Максимальний розмір: {{size}}","File too small. Minimum size: {{size}}":"Файл занадто маленький. Мінімальний розмір: {{size}}","Unsupported file type":"Непідтримуваний тип файлу","Unsupported file type: {{type}}":"Непідтримуваний тип файлу: {{type}}",unknown:"невідомий","Failed to load files":"Не вдалося завантажити файли","Failed to load files in folder":"Не вдалося завантажити вміст папки «{{folderName}}»","Failed to load subfolders in folder":"Не вдалося завантажити підпапки в «{{folderName}}»","Failed to load folder items count in folder":"Не вдалося отримати кількість елементів у «{{folderName}}»","DataProvider for folder deletion is not configured":"DataProvider для видалення папок не налаштовано","DataProvider for file upload is not configured":"DataProvider для завантаження файлів не налаштовано","Error uploading file {{fileName}}":"Помилка при завантаженні файлу {{fileName}}","Error uploading file":"Помилка при завантаженні файлу","Cannot upload files to Trash":"Не можна завантажувати файли в кошик","Please fill in all fields":"Заповніть усі поля","URL too long":"URL занадто довгий","Only http and https URLs are supported":"Підтримуються лише URL з протоколом http та https","Private and local URLs are not allowed":"Локальні та приватні URL заборонені","Upload by URL is not supported":"Завантаження за URL не підтримується","File name is too long. Maximum {{max}} characters":"Ім'я файлу занадто довге. Максимум {{max}} символів","File name contains invalid characters":"Ім'я файлу містить неприпустимі символи","Large file may take a long time to upload":"Великий файл може завантажуватися довго","File unavailable: {{status}} {{statusText}}":"Файл недоступний: {{status}} {{statusText}}","File too large: {{size}}":"Файл занадто великий: {{size}}","Unsupported file type: {{contentType}}":"Непідтримуваний тип файлу: {{contentType}}","Invalid server response: folder ID is missing":"Некорректна відповідь сервера: відсутній ID папки","Error: folder cannot be its own parent":"Помилка: папка не може бути батьком самої себе","Upload to Trash is forbidden":"Завантаження в кошик заборонено","renameFolder is not implemented in dataProviders":"renameFolder не реалізовано в dataProviders","renameFile is not implemented in dataProviders":"renameFile не реалізовано в dataProviders",Clean:"Очистити","Circular dependency detected: folder cannot be its own parent":"Виявлено циклічну залежність: папка не може бути батьком самої себе","Save as copy and choose":"Зберегти як копію і вибрати","Save and choose":"Зберегти і вибрати",pixie:{"added drawing":"Додавання малюнка","added frame":"Додавання рамки","added image":"Додавання зображення","added shape":"Додавання фігури","added sticker":"Додавання стікера","added text":"Додавання тексту","applied filters":"Застосування фільтр",apply:"Застосувати",background:"Фон","background color":"Фоновий колір",beach:"Пляж","brush color":"Колір кисті","brush size":"Розмір кисті","brush type":"Тип кисті",bubbles:"Пузирці",Cancel:"Скасувати","changed style":"Зміна стилю","Circle Brush":"Кола",close:"Закрити",color:"Колір",corners:"Кути",crop:"Обрізати",Custom:"Користувацький","deleted object":"Видалення об'єкта","Diamond Brush":"Алмаз",doodles:"Кольорові",draw:"Малюнок",emoticons:"Смайлики","Eraser Brush":"Гумка",filter:"Фільтр",font:"Шрифт","font size":"Розмір шрифту",frame:"Рамка",gradient:"Градієнт",height:"Висота",history:"Історія","H Line Brush":"Н-подібна",image:"Зображення",initial:"Початковий",landmarks:"Пам'ятки","loaded state":"Завантаження стану","loading canvas":"Завантаження","loading image":"Завантаження","loading state":"Завантаження","maintain aspect ratio":"Maintain aspect ratio",merge:"Об'єднання","merged objects":"Об'єднання об'єктів","new text":"Новий напис",objects:"Об'єкт",opacity:"Прозорість",outline:"Контур","outline color":"Колір контуру","Pencil Brush":"Олівець","processing image":"Завантаження",quality:"Якість",radius:"Радіус","replace image":"Replace Image","replaced background image":"Видалення фонового зображення",resize:"Розмір","resized image":"Зміна розміру","rounded corner":"Заокруглення кутів",save:"Зберегти",shadow:"Тінь","shadow color":"Колір тіні",shapes:"Фігури","Spray Brush":"Спрей",square:"Квадрат","Square Brush":"Квадрат",stickers:"Стікери",text:"Напис",texture:"Текстура",transportation:"Транспорт","V Line Brush":"V-подібна",width:"Ширина",grayscale:"Відтінки сірого","black & White":"Чорно-білий",sharpen:"Різкість",invert:"Інверсія",vintage:"Вінтаж",polaroid:"Полароїд",kodachrome:"Кодахром",technicolor:"Техніколор",brownie:"Коричневий",sepia:"Сепія","remove Color":"Видалити колір",brightness:"Яскравість",gamma:"Гамма",noise:"Шум",pixelate:"Пікселізація",blur:"Розмиття",emboss:"Тиснення","blend Color":"Змішати колір",distance:"Відстань",red:"Червоний",green:"Зелений",blue:"Синій",blocksize:"Розмір блоку",alpha:"Альфа",add:"Додати",multiply:"Помножити",subtract:"Відняти",diff:"Різниця",screen:"Екран",lighten:"Освітлити",darken:"Затемнити","select an option...":"Виберіть опцію..."}},oi={Files:"Arquivos",selected:"selecionado(s)",Deselected:"Desmarcar",Refresh:"Atualizar","Select all":"Selecionar tudo",Rename:"Renomear","Rename file":"Renomear arquivo {{currentFileName}}","Select the destination folder":"Selecionar a pasta de destino","Selected files:":"Arquivos selecionados:","Selected files":"Arquivos selecionados: {{count}}",selected_files_one:"{{count}} arquivo selecionado",selected_files_few:"{{count}} arquivos selecionados",selected_files_many:"{{count}} arquivos selecionados",selected_files_other:"{{count}} arquivos selecionados",Copy:"Duplicar",Edit:"Editar",Move:"Mover","Move to":"Mover para",Delete:"Excluir","New folder":"Nova pasta","Image search...":"Busca de imagens...","Search icons":"Encontrar ícones","By name":"Por nome","By size":"Por tamanho","By date":"Por data",List:"Lista",Grid:"Grade",Main:"Principal",Folders:"Pastas","total pages":"Total de {{total}} itens",Name:"Nome",Untitled:"Sem título",Size:"Tamanho",Dimensions:"Dimensões",Date:"Data",error:"erro",Folder:"Pasta",created:"criada","Failed to create folder":"Falha ao criar pasta","File deleted":"Arquivo excluído","Error when deleting a file":"Erro ao excluir arquivo","Folder deleted":"Pasta excluída","Error when deleting a folder":"Erro ao excluir pasta","Delete folder":"Excluir pasta","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"Tem certeza que deseja excluir esta pasta? Esta ação também excluirá todos os arquivos e subpastas.","API-endpoint for file upload is not configured":"Endpoint da API para upload de arquivos não está configurado","Please select an image file":"Por favor, selecione um arquivo de imagem",File:"Arquivo","has been successfully uploaded":"foi carregado com sucesso","The URL must point to an image":"A URL deve apontar para uma imagem","Image upload...":"Carregando imagem...",Unknown:"Desconhecido","Error downloading file by URL":"Erro ao baixar arquivo por URL","successfully uploaded":"carregado com sucesso","Error when downloading a file by URL":"Erro ao baixar arquivo por URL","Error when uploading a file":"Erro ao enviar arquivo","Error loading files":"Erro ao carregar arquivos","File not found":"Arquivo não encontrado","File renamed to":"Arquivo renomeado para","Failed to rename the file":"Falha ao renomear o arquivo","Folder renamed to":"Pasta renomeada para","Rename folder":"Renomear pasta","New folder name":"Novo nome da pasta","Enter a new folder name":"Digite um novo nome para a pasta","Please drag and drop image files only":"Por favor, arraste e solte apenas arquivos de imagem","Upload file by URL":"Carregar arquivo por URL","Upload file":"Carregar arquivo","Creating a new folder":"Criando uma nova pasta",Create:"Criar",Cancel:"Cancelar","Folder name":"Nome da pasta","Enter the name of the folder":"Digite o nome da pasta","Enter the name":"Digite o nome","A folder will be created inside:":"A pasta será criada dentro de:","selected folder":"pasta selecionada","The folder will be created in the root directory":"A pasta será criada no diretório raiz","Failed to load folders":"Não foi possível carregar as pastas","Folder name cannot be empty":"O nome da pasta não pode estar vazio","Folder creation provider is not configured":"O provedor de criação de pastas não está configurado","Folder created":"Pasta criada","Folder rename is disabled by config":"Renomear pastas está desabilitado pela configuração","Folder rename provider is not configured":"O provedor de renomeação de pastas não está configurado","Unexpected response when renaming folder":"Resposta inesperada ao renomear a pasta","Folder renamed":"Pasta renomeada","Failed to rename folder":"Não foi possível renomear a pasta","Failed to load folder items count":"Não foi possível obter a contagem de itens da pasta","Failed to load subfolders":"Não foi possível carregar as subpastas",Download:"Baixar","image URL":"URL da imagem","Enter the URL of the image":"Digite a URL da imagem","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Formatos suportados: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Novo nome do arquivo","Enter a new file name":"Digite um novo nome para o arquivo","Copy to folder":"Copiar para pasta",Added:"Adicionado em {{date}}","File uploaded successfully":"Arquivo {{fileName}} carregado com sucesso","Successfully uploaded":"{{successCount}} de {{count}} arquivo carregado com sucesso","Successfully uploaded files":"{{successCount}} de {{count}} arquivos carregados com sucesso",uploads_success_summary:"Enviados {{successCount}} de {{totalCount}} arquivos",uploads_fail_summary:"Falhou ao enviar {{failCount}} de {{totalCount}} arquivos","File with this name already exists.":"Já existe um arquivo com esse nome.","File not found or no longer available.":"O arquivo não foi encontrado ou já foi excluído.","You don't have permission to access this file.":"Você não tem permissão para acessar este arquivo.","File is too large to upload.":"O arquivo é grande demais para ser enviado.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"O arquivo é grande demais ({{fileSize}}). Tamanho máximo permitido: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Número máximo de arquivos excedido. Permitido: {{allowed}}, recebido: {{received}}","This file type is not allowed.":"Este tipo de arquivo não é permitido.","File name is not valid.":"O nome do arquivo não é válido.","File name is not valid. Allowed characters: {{allowedChars}}":"O nome do arquivo não é válido. Caracteres permitidos: {{allowedChars}}","Failed to read the file.":"Não foi possível ler o arquivo.","Failed to write the file.":"Não foi possível gravar o arquivo.","The file appears to be corrupted.":"O arquivo parece estar corrompido.","File integrity check failed.":"A verificação de integridade do arquivo falhou.","Folder not found or no longer available.":"A pasta não foi encontrada ou já foi excluída.","Folder with this name already exists.":"Já existe uma pasta com esse nome.","A folder with that name already exists. Please enter a different folder name.":"Já existe uma pasta com esse nome. Digite um nome diferente para a pasta.","You don't have permission to access this folder.":"Você não tem permissão para acessar esta pasta.","Folder name is not valid.":"O nome da pasta não é válido.","Folder name is not valid. Allowed characters: {{allowedChars}}":"Não foi possível criar a pasta. Caracteres permitidos no nome: {{allowedChars}}","Failed to read the folder contents.":"Não foi possível ler o conteúdo da pasta.","Failed to write to the folder.":"Não foi possível gravar na pasta.","Folder storage quota exceeded.":"A cota de armazenamento da pasta foi excedida.","Folder is not empty.":"A pasta não está vazia.","Server error while processing the folder.":"Erro do servidor ao processar a pasta.","Folder operation took too long.":"A operação com a pasta demorou demais.","Network error. Please check your connection and try again.":"Erro de rede. Verifique sua conexão e tente novamente.","The operation took too long. Please try again.":"A operação demorou demais. Tente novamente.","Server error. Please try again later.":"Erro no servidor. Tente novamente mais tarde.","Service is temporarily unavailable. Please try again later.":"O serviço está temporariamente indisponível. Tente novamente mais tarde.","Too many requests. Please try again a bit later.":"Muitas solicitações. Tente novamente mais tarde.","Authentication failed. Please sign in again.":"Falha na autenticação. Faça login novamente.","You are not allowed to perform this action.":"Você não tem permissão para executar esta ação.","Some of the provided data is invalid.":"Alguns dos dados fornecidos são inválidos.","This operation is not supported.":"Esta operação não é suportada.","Request payload is too large.":"O corpo da requisição é grande demais.","This media type is not supported.":"Este tipo de mídia não é suportado.","You have exceeded the upload quota.":"Você excedeu a cota de upload de arquivos.","Network error while uploading the file.":"Erro de rede ao enviar o arquivo.","File upload took too long.":"O envio do arquivo demorou demais.","Server error while uploading the file.":"Erro do servidor ao enviar o arquivo.","The specified URL is not valid.":"A URL especificada não é válida.","The specified URL is not reachable.":"A URL especificada não está acessível.","Content type at the URL is not allowed.":"O tipo de conteúdo na URL não é permitido.","Failed to download file from the URL.":"Não foi possível baixar o arquivo da URL.","Network error while downloading the file.":"Erro de rede ao baixar o arquivo.","File download took too long.":"O download do arquivo demorou demais.","Server error while downloading the file.":"Erro do servidor ao baixar o arquivo.","Some items could not be processed.":"Nem todos os itens foram processados com sucesso.","Failed to process all items in the batch.":"Nenhum item do lote pôde ser processado.","Some items in the batch are in a conflicting state.":"Alguns itens do lote estão em estado de conflito.","Some items in the batch did not pass validation.":"Alguns itens do lote não passaram na validação.","AI service returned an invalid response.":"O serviço de IA retornou uma resposta inválida.","Failed to generate image using AI.":"Falha ao gerar imagem usando IA.","You have reached the AI image generation limit.":"Você atingiu o limite de geração de imagens por IA.","Error in external integration.":"Erro em uma integração externa.","Error in a third-party service.":"Erro em um serviço de terceiros.","An unknown error occurred.":"Ocorreu um erro desconhecido.","Renaming is not allowed for this item.":"Renomear não é permitido para este item.","Moving is not allowed for this item.":"Mover não é permitido para este item.","Copying is not allowed for this item.":"Copiar não é permitido para este item.","Deleting is not allowed for this item.":"Excluir não é permitido para este item.","Cannot move an item into itself.":"Não é possível mover um item para dentro de si mesmo.","Cannot move an item into its descendant folder.":"Não é possível mover um item para sua pasta descendente.","Cannot copy an item into itself.":"Não é possível copiar um item para dentro de si mesmo.","Configuration error occurred.":"Ocorreu um erro de configuração.","Storage quota exceeded. Please free up space.":"Cota de armazenamento excedida. Libere espaço.","File is locked by another process or user.":"O arquivo está bloqueado por outro processo ou usuário.","File version conflict. Please refresh and try again.":"Conflito de versão do arquivo. Atualize a página e tente novamente.","Batch operation exceeds the maximum number of items allowed.":"A operação em lote excede o número máximo de itens permitidos.",Moved:"Movidos: {{names}}",move_success_summary:"Movidos {{successCount}} de {{totalCount}} itens",move_fail_summary:"Falhou ao mover {{failCount}} de {{totalCount}} itens",Copied:"Copiados: {{names}}",copy_success_summary:"Copiados {{successCount}} de {{totalCount}} itens",copy_fail_summary:"Falhou ao copiar {{failCount}} de {{totalCount}} itens",Uploaded:"Arquivos enviados: {{names}}",Failed:"Falha ao enviar: {{names}}","Failed to upload":"Falha ao carregar {{failCount}} de {{count}} arquivo","Failed to upload files":"Falha ao carregar {{failCount}} de {{count}} arquivos",months:{january:"janeiro",february:"fevereiro",march:"março",april:"abril",may:"maio",june:"junho",july:"julho",august:"agosto",september:"setembro",october:"outubro",november:"novembro",december:"dezembro"},files:"arquivos","No available folders":"Nenhuma pasta disponível","My files":"Meus arquivos",GIF:"GIF","Stock images":"Imagens de stock",AI:"IA","AI image generation":"Geração de imagens por IA","Search GIFs":"Buscar GIFs","That`s all we could find.":"Isso é tudo que conseguimos encontrar.","Search image":"Buscar imagem",All:"Todos",Landscape:"Paisagem",Portrait:"Retrato",Squarish:"Quadrados",Black:"Preto","Black and White":"Preto e branco",White:"Branco",Orange:"Laranja",Red:"Vermelho",Purple:"Roxo",Magenta:"Magenta",Green:"Verde",Teal:"Verde-azulado",Blue:"Azul","Photo by":"Foto por",on:"em","File Manager":"Gerenciador de arquivos","File Manager not configured":"Gerenciador de arquivos não configurado","Filter by type":"Filtrar por tipo","All types":"Todos os tipos","File name":"Nome do arquivo",Actions:"Ações","Add file":"Adicionar arquivo","Add folder":"Adicionar pasta","Add file by URL":"Adicionar arquivo por URL","File moved":"Arquivo movido","Error when moving a file":"Erro ao mover arquivo","Failed to download file":"Não foi possível baixar o arquivo","Failed to load JSON data":"Não foi possível carregar os dados JSON","Invalid file URL":"URL de arquivo inválida","Unable to validate file URL":"Não foi possível validar a URL do arquivo","Type to search...":"Digite para buscar...",Submit:"Enviar","No folders yet":"Nenhuma pasta ainda","Drag files to upload":"Arraste arquivos para carregar","Drop files here to upload":"Solte os arquivos aqui para carregá-los","Newest first":"Mais recentes primeiro","Oldest first":"Mais antigos primeiro","Largest first":"Maiores primeiro","Smallest first":"Menores primeiro","A-Z":"A-Z","Z-A":"Z-A","By type":"Por tipo","Evaluating the task":"Avaliando a tarefa","Something went wrong, please try again":"Algo deu errado, por favor tente novamente","Sort by":"Ordenar por","preview text":"Carregando imagem...","Use this variant":"Usar esta variante","Confirm deletion":"Confirmar exclusão","Are you sure you want to delete the selected items?":"Tem certeza que deseja excluir os itens selecionados?","Move to Trash":"Mover para lixeira","Are you sure you want to move the selected items to the Trash?":"Tem certeza que deseja mover os itens selecionados para a lixeira?","Permanently delete":"Exclusão permanente","Delete permanently":"Excluir permanentemente","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"Tem certeza que deseja excluir permanentemente os itens selecionados? Esta ação não pode ser desfeita.",Clear:"Limpar","Clear Trash":"Limpar lixeira","Are you sure you want to permanently delete all items from Trash?":"Tem certeza que deseja excluir permanentemente todos os itens da lixeira?","Trash cleared successfully":"Lixeira limpa com sucesso","{{count}} items permanently deleted":"{{count}} itens excluídos permanentemente","Trash partially cleared":"Lixeira parcialmente limpa","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} itens excluídos, {{failed}} falharam","Failed to clear trash":"Falha ao limpar lixeira","Error clearing trash":"Erro ao limpar lixeira","Deleting items...":"Excluindo itens...",delete_files_permanent_one:"Esta ação excluirá permanentemente {{count}} arquivo",delete_files_permanent_few:"Esta ação excluirá permanentemente {{count}} arquivos",delete_files_permanent_many:"Esta ação excluirá permanentemente {{count}} arquivos",delete_files_permanent_other:"Esta ação excluirá permanentemente {{count}} arquivos",delete_folder_permanent:"Esta ação excluirá permanentemente a pasta «{{name}}» e todo seu conteúdo, incluindo {{count}} itens.",delete_mixed_permanent:"Esta ação excluirá permanentemente {{total}} itens selecionados, incluindo {{folders}} pastas e todas as {{images}} imagens dentro delas.",permanent_delete_warning:"Excluir arquivos que foram usados em e-mails causará problemas na exibição de imagens em e-mails antigos. Tem certeza de que deseja excluir permanentemente a seleção?",move_files_to_trash_one:"Esta ação moverá {{count}} arquivo para a lixeira.",move_files_to_trash_few:"Esta ação moverá {{count}} arquivos para a lixeira.",move_files_to_trash_many:"Esta ação moverá {{count}} arquivos para a lixeira.",move_files_to_trash_other:"Esta ação moverá {{count}} arquivos para a lixeira.",move_folder_to_trash:"Esta ação moverá a pasta «{{name}}» e todo seu conteúdo ({{count}} itens) para a lixeira.",move_mixed_to_trash:"Esta ação moverá {{total}} itens selecionados para a lixeira, incluindo {{folders}} pastas e {{images}} imagens.",delete_count_confirm_trash_one:"Mover {{count}} arquivo para a lixeira?",delete_count_confirm_trash_few:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_trash_many:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_trash_other:"Mover {{count}} arquivos para a lixeira?",delete_count_confirm_permanent_one:"Excluir permanentemente {{count}} arquivo?",delete_count_confirm_permanent_few:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_permanent_many:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_permanent_other:"Excluir permanentemente {{count}} arquivos?",delete_count_confirm_one:"Excluir {{count}} arquivo?",delete_count_confirm_few:"Excluir {{count}} arquivos?",delete_count_confirm_many:"Excluir {{count}} arquivos?",delete_count_confirm_other:"Excluir {{count}} arquivos?",item:"arquivo",items:"arquivos",Trash:"Lixeira",Choose:"Escolher",Stock:"Banco de imagens","Select an image from our library":"Selecione uma imagem da nossa biblioteca","AI generation":"Geração por IA","Creating an image on demand":"Criando uma imagem sob demanda","Search file or folder":"Buscar arquivo ou pasta","Click here to select a file":"Clique aqui para selecionar um arquivo","Supported files:":"Arquivos suportados:","Create folder":"Criar pasta",Done:"Concluído","Move here":"Mover aqui","Copy here":"Copiar aqui","File URL":"URL do arquivo","There's nothing here":"Não há nada aqui","Try using a different search query.":"Tente usar uma consulta de pesquisa diferente.","Millions of free stock images":"Milhões de imagens de stock gratuitas","Enter a search query and we'll find the perfect image for you":"Digite uma consulta de busca e encontraremos a imagem perfeita para você","Millions of icons":"Milhões de ícones","Lucide icons":"Ícones Lucide","Thousands of icons":"Milhares de ícones","Enter a search query and we'll find the perfect icon for you":"Digite uma consulta de busca e encontraremos o ícone perfeito para você","Enter your query and we will find the right one for you":"Digite sua consulta e nós encontraremos a ideal para você","Over 350,000 live images":"Mais de 350.000 imagens ao vivo","The folder will be created in the root directory.":"A pasta será criada no diretório raiz.",undo:"DESFAZER",moved_to_trash_one:"{{count}} item movido para a lixeira",moved_to_trash_few:"{{count}} itens movidos para a lixeira",moved_to_trash_many:"{{count}} itens movidos para a lixeira",moved_to_trash_other:"{{count}} itens movidos para a lixeira",restored_items_one:"{{count}} item restaurado",restored_items_few:"{{count}} itens restaurados",restored_items_many:"{{count}} itens restaurados",restored_items_other:"{{count}} itens restaurados",Type:"Tipo","Generate image":"Gerar imagem","A beautiful image of a sunset over a calm ocean.":"Uma imagem bonita de um pôr do sol sobre um oceano tranquilo.","For example:":"Por exemplo:",Insert:"Inserir",Error:"Erro","Upload progress":"Enviando {{completed}}/{{total}}","Uploading files":"Enviando {{completed}}/{{total}} arquivos","Uploaded files":"Enviados {{success}} de {{total}} arquivos","Upload error files":"Erro ao enviar {{errorCount}} arquivos","Applies to all {{count}} files":"(aplica-se a todos os {{count}} arquivos)","Some files failed to upload":"Alguns arquivos não puderam ser enviados. Verifique o tamanho e o formato dos arquivos.",upload_error_hint_invalid_name:"Renomeie o arquivo: use apenas letras, números, hífens e sublinhados.",upload_error_hint_size:"Reduza o tamanho do arquivo ou escolha outro.",upload_error_hint_format:"Use um formato permitido: JPG, PNG ou GIF.",upload_error_hint_exists:"Já existe um arquivo com este nome na pasta. Renomeie o arquivo.","Images generated successfully":"Imagens geradas com sucesso","Choose for template":"Selecionar para carregar no modelo","Trash is empty":"A lixeira está vazia","Deleted files will be displayed here":"Os arquivos excluídos serão exibidos aqui","Editing: {{name}}":"Editando: {{name}}","Editing image":"Editando imagem",Save:"Salvar","Loading editor...":"Carregando editor...","Error loading image":"Erro ao carregar a imagem","Error saving image":"Erro ao salvar a imagem","Error initializing editor":"Erro ao inicializar o editor","Close File Manager":"Fechar gerenciador de arquivos","Are you sure you want to close? Unsaved changes will be lost.":"Tem certeza de que deseja fechar? As alterações não salvas serão perdidas.","Are you sure you want to close the file manager?":"Tem certeza de que deseja fechar o gerenciador de arquivos?",Close:"Fechar",KB:"KB","No files":"Nenhum arquivo","Folder is empty or files not found":"A pasta está vazia ou os arquivos não foram encontrados","Search files...":"Buscar arquivos...",Success:"Sucesso","Image updated successfully":"Imagem atualizada com sucesso","Failed to save changes":"Falha ao salvar alterações: {{error}}","Unknown error":"Erro desconhecido","Select destination folder":"Selecione a pasta de destino","Error moving":"Erro ao mover","Error deleting":"Erro ao excluir","Error copying":"Erro ao copiar","Error renaming":"Erro ao renomear","Failed to refresh folder tree":"Falha ao atualizar a árvore de pastas","Failed to refresh file list":"Falha ao atualizar a lista de arquivos","Errors occurred while moving":"Ocorreram erros ao mover","Errors occurred while copying":"Ocorreram erros ao copiar","(error)":"(erro)","(circular reference)":"(referência circular)","File too large. Maximum size: {{size}}":"Arquivo muito grande. Tamanho máximo: {{size}}","File too small. Minimum size: {{size}}":"Arquivo muito pequeno. Tamanho mínimo: {{size}}","Unsupported file type":"Tipo de arquivo não suportado","Unsupported file type: {{type}}":"Tipo de arquivo não suportado: {{type}}",unknown:"desconhecido","Failed to load files":"Falha ao carregar arquivos","Failed to load files in folder":"Não foi possível carregar o conteúdo da pasta ({{folderName}})","Failed to load subfolders in folder":'Não foi possível carregar subpastas em "{{folderName}}"',"Failed to load folder items count in folder":'Não foi possível obter a contagem de itens em "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider para exclusão de pastas não está configurado","DataProvider for file upload is not configured":"DataProvider para upload de arquivos não está configurado","Error uploading file {{fileName}}":"Erro ao carregar o arquivo {{fileName}}","Error uploading file":"Erro ao carregar o arquivo","Cannot upload files to Trash":"Não é possível carregar arquivos para a lixeira","Please fill in all fields":"Por favor, preencha todos os campos","URL too long":"URL muito longa","Only http and https URLs are supported":"Apenas URLs com protocolo http e https são suportadas","Private and local URLs are not allowed":"URLs locais e privadas não são permitidas","Upload by URL is not supported":"Upload por URL não é suportado","File name is too long. Maximum {{max}} characters":"O nome do arquivo é muito longo. Máximo de {{max}} caracteres","File name contains invalid characters":"O nome do arquivo contém caracteres inválidos","Large file may take a long time to upload":"Um arquivo grande pode demorar muito para ser carregado","File unavailable: {{status}} {{statusText}}":"Arquivo indisponível: {{status}} {{statusText}}","File too large: {{size}}":"Arquivo muito grande: {{size}}","Unsupported file type: {{contentType}}":"Tipo de arquivo não suportado: {{contentType}}","Invalid server response: folder ID is missing":"Resposta do servidor inválida: ID da pasta ausente","Error: folder cannot be its own parent":"Erro: a pasta não pode ser seu próprio pai","Upload to Trash is forbidden":"Enviar para a lixeira é proibido","renameFolder is not implemented in dataProviders":"renameFolder não está implementado em dataProviders","renameFile is not implemented in dataProviders":"renameFile não está implementado em dataProviders",Clean:"Limpar","Circular dependency detected: folder cannot be its own parent":"Dependência circular detectada: a pasta não pode ser seu próprio pai","Save as copy and choose":"Salvar como cópia e escolher","Save and choose":"Salvar e escolher",pixie:{"added drawing":"Desenho adicionado","added frame":"Moldura adicionada","added image":"Imagem adicionada","added shape":"Forma adicionada","added sticker":"Adesivo adicionado","added text":"Texto adicionado","applied filters":"Filtros aplicados",apply:"Aplicar",background:"Fundo","background color":"Cor de fundo",beach:"Praia","brush color":"Cor do pincel","brush size":"Tamanho do pincel","brush type":"Tipo de pincel",bubbles:"Bolhas",Cancel:"Cancelar","changed style":"Estilo alterado","Circle Brush":"Círculo",close:"Fechar",color:"Cor",corners:"Cantos",crop:"Cortar",Custom:"Personalizado","deleted object":"Objeto excluído","Diamond Brush":"Diamante",doodles:"Rabiscos",draw:"Desenhar",emoticons:"Emoticons","Eraser Brush":"Borracha",filter:"Filtro",font:"Fonte","font size":"Tamanho da fonte",frame:"Moldura",gradient:"Gradiente",height:"Altura",history:"Histórico","H Line Brush":"Linha H",image:"Imagem",initial:"Inicial",landmarks:"Pontos turísticos","loaded state":"Estado carregado","loading canvas":"Carregando tela","loading image":"Carregando imagem","loading state":"Carregando estado","maintain aspect ratio":"Manter proporção",merge:"Mesclar","merged objects":"Objetos mesclados","new text":"Novo texto",objects:"Objetos",opacity:"Opacidade",outline:"Contorno","outline color":"Cor do contorno","Pencil Brush":"Lápis","processing image":"Processando imagem",quality:"Qualidade",radius:"Raio","replace image":"Substituir imagem","replaced background image":"Imagem de fundo substituída",resize:"Redimensionar","resized image":"Imagem redimensionada","rounded corner":"Canto arredondado",save:"Salvar",shadow:"Sombra","shadow color":"Cor da sombra",shapes:"Formas","Spray Brush":"Spray",square:"Quadrado","Square Brush":"Quadrado",stickers:"Adesivos",text:"Texto",texture:"Textura",transportation:"Transporte","V Line Brush":"Linha V",width:"Largura",grayscale:"Tons de cinza","black & White":"Preto e branco",sharpen:"Nitidez",invert:"Inverter",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Sépia quente",sepia:"Sépia","remove Color":"Remover cor",brightness:"Brilho",gamma:"Gamma",noise:"Ruído",pixelate:"Pixelar",blur:"Desfocar",emboss:"Relevo","blend Color":"Misturar cor",distance:"Distância",red:"Vermelho",green:"Verde",blue:"Azul",blocksize:"Tamanho do bloco",alpha:"Alfa",add:"Adicionar",multiply:"Multiplicar",subtract:"Subtrair",diff:"Diferença",screen:"Tela",lighten:"Clarear",darken:"Escurecer","select an option...":"Selecione uma opção..."}};const ai={en:{translation:ri},ru:{translation:ni},es:{translation:{Files:"Archivos",selected:"seleccionado(s)",Deselected:"Deseleccionar",Refresh:"Actualizar","Select all":"Seleccionar todo",Rename:"Renombrar","Rename file":"Renombrar archivo {{currentFileName}}","Select the destination folder":"Seleccionar la carpeta de destino","Selected files:":"Archivos seleccionados:","Selected files":"Archivos seleccionados: {{count}}",selected_files_one:"{{count}} archivo seleccionado",selected_files_few:"{{count}} archivos seleccionados",selected_files_many:"{{count}} archivos seleccionados",selected_files_other:"{{count}} archivos seleccionados",Copy:"Duplicar",Edit:"Editar",Move:"Mover","Move to":"Mover a",Delete:"Eliminar","New folder":"Nueva carpeta","Image search...":"Búsqueda de imágenes...","Search icons":"Buscar iconos","By name":"Por nombre","By size":"Por tamaño","By date":"Por fecha",List:"Lista",Grid:"Cuadrícula",Main:"Principal",Folders:"Carpetas","total pages":"{{total}} elementos en total",Name:"Nombre",Untitled:"Sin título",Size:"Tamaño",Dimensions:"Dimensiones",Date:"Fecha",error:"error",Folder:"Carpeta",created:"creada","Failed to create folder":"Error al crear la carpeta","File deleted":"Archivo eliminado","Error when deleting a file":"Error al eliminar el archivo","Folder deleted":"Carpeta eliminada","Error when deleting a folder":"Error al eliminar la carpeta","Delete folder":"Eliminar carpeta","Are you sure you want to delete this folder? This action will also delete all files and subfolders.":"¿Está seguro de que desea eliminar esta carpeta? Esta acción también eliminará todos los archivos y subcarpetas.","API-endpoint for file upload is not configured":"El endpoint API para la carga de archivos no está configurado","Please select an image file":"Por favor, seleccione un archivo de imagen",File:"Archivo","has been successfully uploaded":"se ha cargado exitosamente","The URL must point to an image":"La URL debe apuntar a una imagen","Image upload...":"Cargando imagen...",Unknown:"Desconocido","Error downloading file by URL":"Error al descargar el archivo por URL","successfully uploaded":"cargado exitosamente","Error when downloading a file by URL":"Error al descargar un archivo por URL","Error when uploading a file":"Error al cargar el archivo","Error loading files":"Error al cargar archivos","File not found":"Archivo no encontrado","File renamed to":"Archivo renombrado a","Failed to rename the file":"Error al renombrar el archivo","Folder renamed to":"Carpeta renombrada a","Rename folder":"Renombrar carpeta","New folder name":"Nuevo nombre de la carpeta","Enter a new folder name":"Ingrese un nuevo nombre para la carpeta","Please drag and drop image files only":"Por favor, arrastre y suelte solo archivos de imagen","Upload file by URL":"Cargar archivo por URL","Upload file":"Cargar archivo","Creating a new folder":"Creando una nueva carpeta",Create:"Crear",Cancel:"Cancelar","Folder name":"Nombre de la carpeta","Enter the name of the folder":"Ingrese el nombre de la carpeta","Enter the name":"Ingrese el nombre","A folder will be created inside:":"La carpeta se creará dentro de:","selected folder":"carpeta seleccionada","The folder will be created in the root directory":"La carpeta se creará en el directorio raíz","Failed to load folders":"No se pudieron cargar las carpetas","Folder name cannot be empty":"El nombre de la carpeta no puede estar vacío","Folder creation provider is not configured":"El proveedor de creación de carpetas no está configurado","Folder created":"Carpeta creada","Folder rename is disabled by config":"El renombrado de carpetas está deshabilitado por la configuración","Folder rename provider is not configured":"El proveedor para renombrar carpetas no está configurado","Unexpected response when renaming folder":"Respuesta inesperada al renombrar la carpeta","Folder renamed":"Carpeta renombrada","Failed to rename folder":"No se pudo renombrar la carpeta","Failed to load folder items count":"No se pudo obtener la cantidad de elementos de la carpeta","Failed to load subfolders":"No se pudieron cargar las subcarpetas",Download:"Descargar","image URL":"URL de la imagen","Enter the URL of the image":"Ingrese la URL de la imagen","Supported formats: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP":"Formatos admitidos: JPG, JPEG, PNG, GIF, WEBP, SVG, BMP","New file name":"Nuevo nombre del archivo","Enter a new file name":"Ingrese un nuevo nombre para el archivo","Copy to folder":"Copiar a carpeta",Added:"Añadido el {{date}}","File uploaded successfully":"Archivo {{fileName}} cargado exitosamente","Successfully uploaded":"{{successCount}} de {{count}} archivo cargado exitosamente","Successfully uploaded files":"{{successCount}} de {{count}} archivos cargados exitosamente",uploads_success_summary:"Se cargaron {{successCount}} de {{totalCount}} archivos",uploads_fail_summary:"No se pudieron cargar {{failCount}} de {{totalCount}} archivos","File with this name already exists.":"Ya existe un archivo con este nombre.","File not found or no longer available.":"El archivo no se encontró o ya fue eliminado.","You don't have permission to access this file.":"No tiene permisos para acceder a este archivo.","File is too large to upload.":"El archivo es demasiado grande para subir.","File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.":"El archivo es demasiado grande ({{fileSize}}). Tamaño máximo permitido: {{maxSize}}.","Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}":"Se ha superado el número máximo de archivos. Permitido: {{allowed}}, recibido: {{received}}","This file type is not allowed.":"Este tipo de archivo no está permitido.","File name is not valid.":"El nombre del archivo no es válido.","File name is not valid. Allowed characters: {{allowedChars}}":"El nombre del archivo no es válido. Caracteres permitidos: {{allowedChars}}","Failed to read the file.":"No se pudo leer el archivo.","Failed to write the file.":"No se pudo escribir el archivo.","The file appears to be corrupted.":"El archivo parece estar dañado.","File integrity check failed.":"La verificación de integridad del archivo falló.","Folder not found or no longer available.":"La carpeta no se encontró o ya fue eliminada.","Folder with this name already exists.":"Ya existe una carpeta con este nombre.","A folder with that name already exists. Please enter a different folder name.":"Ya existe una carpeta con ese nombre. Introduzca un nombre de carpeta diferente.","You don't have permission to access this folder.":"No tiene permisos para acceder a esta carpeta.","Folder name is not valid.":"El nombre de la carpeta no es válido.","Folder name is not valid. Allowed characters: {{allowedChars}}":"No se pudo crear la carpeta. Caracteres permitidos en el nombre: {{allowedChars}}","Failed to read the folder contents.":"No se pudo leer el contenido de la carpeta.","Failed to write to the folder.":"No se pudo escribir en la carpeta.","Folder storage quota exceeded.":"Se superó la cuota de almacenamiento de la carpeta.","Folder is not empty.":"La carpeta no está vacía.","Server error while processing the folder.":"Error del servidor al procesar la carpeta.","Folder operation took too long.":"La operación con la carpeta tardó demasiado.","Network error. Please check your connection and try again.":"Error de red. Compruebe su conexión e inténtelo de nuevo.","The operation took too long. Please try again.":"La operación tardó demasiado. Inténtelo de nuevo.","Server error. Please try again later.":"Error del servidor. Inténtelo de nuevo más tarde.","Service is temporarily unavailable. Please try again later.":"El servicio no está disponible temporalmente. Inténtelo de nuevo más tarde.","Too many requests. Please try again a bit later.":"Demasiadas solicitudes. Inténtelo de nuevo más tarde.","Authentication failed. Please sign in again.":"Error de autenticación. Inicie sesión de nuevo.","You are not allowed to perform this action.":"No tiene permisos para realizar esta acción.","Some of the provided data is invalid.":"Algunos de los datos proporcionados no son válidos.","This operation is not supported.":"Esta operación no está soportada.","Request payload is too large.":"El cuerpo de la solicitud es demasiado grande.","This media type is not supported.":"Este tipo de contenido no está soportado.","You have exceeded the upload quota.":"Se ha superado la cuota de subida de archivos.","Network error while uploading the file.":"Error de red al subir el archivo.","File upload took too long.":"La subida del archivo tardó demasiado.","Server error while uploading the file.":"Error del servidor al subir el archivo.","The specified URL is not valid.":"La URL especificada no es válida.","The specified URL is not reachable.":"La URL especificada no es accesible.","Content type at the URL is not allowed.":"El tipo de contenido en la URL no está permitido.","Failed to download file from the URL.":"No se pudo descargar el archivo desde la URL.","Network error while downloading the file.":"Error de red al descargar el archivo.","File download took too long.":"La descarga del archivo tardó demasiado.","Server error while downloading the file.":"Error del servidor al descargar el archivo.","Some items could not be processed.":"No todos los elementos se procesaron correctamente.","Failed to process all items in the batch.":"No se pudo procesar ningún elemento del lote.","Some items in the batch are in a conflicting state.":"Algunos elementos del lote están en estado de conflicto.","Some items in the batch did not pass validation.":"Algunos elementos del lote no pasaron la validación.","AI service returned an invalid response.":"El servicio de IA devolvió una respuesta no válida.","Failed to generate image using AI.":"No se pudo generar la imagen usando IA.","You have reached the AI image generation limit.":"Se alcanzó el límite de generación de imágenes con IA.","Error in external integration.":"Error en la integración externa.","Error in a third-party service.":"Error en un servicio de terceros.","An unknown error occurred.":"Se ha producido un error desconocido.","Renaming is not allowed for this item.":"No se permite renombrar este elemento.","Moving is not allowed for this item.":"No se permite mover este elemento.","Copying is not allowed for this item.":"No se permite copiar este elemento.","Deleting is not allowed for this item.":"No se permite eliminar este elemento.","Cannot move an item into itself.":"No se puede mover un elemento dentro de sí mismo.","Cannot move an item into its descendant folder.":"No se puede mover un elemento a su carpeta descendiente.","Cannot copy an item into itself.":"No se puede copiar un elemento dentro de sí mismo.","Configuration error occurred.":"Se produjo un error de configuración.","Storage quota exceeded. Please free up space.":"Se superó la cuota de almacenamiento. Libere espacio.","File is locked by another process or user.":"El archivo está bloqueado por otro proceso o usuario.","File version conflict. Please refresh and try again.":"Conflicto de versión del archivo. Actualice la página e inténtelo de nuevo.","Batch operation exceeds the maximum number of items allowed.":"La operación por lotes excede el número máximo de elementos permitidos.",Moved:"Movidos: {{names}}",move_success_summary:"Se movieron {{successCount}} de {{totalCount}} elementos",move_fail_summary:"No se pudieron mover {{failCount}} de {{totalCount}} elementos",Copied:"Copiados: {{names}}",copy_success_summary:"Se copiaron {{successCount}} de {{totalCount}} elementos",copy_fail_summary:"No se pudieron copiar {{failCount}} de {{totalCount}} elementos",Uploaded:"Archivos cargados: {{names}}",Failed:"No se pudieron cargar: {{names}}","Failed to upload":"Error al cargar {{failCount}} de {{count}} archivo","Failed to upload files":"Error al cargar {{failCount}} de {{count}} archivos",months:{january:"enero",february:"febrero",march:"marzo",april:"abril",may:"mayo",june:"junio",july:"julio",august:"agosto",september:"septiembre",october:"octubre",november:"noviembre",december:"diciembre"},files:"archivos","No available folders":"No hay carpetas disponibles","My files":"Mis archivos",GIF:"GIF","Stock images":"Imágenes de stock",AI:"IA","AI image generation":"Generación de imágenes con IA","Search GIFs":"Buscar GIFs","That`s all we could find.":"Es todo lo que pudimos encontrar.","Search image":"Buscar imagen",All:"Todos",Landscape:"Horizontal",Portrait:"Vertical",Squarish:"Cuadrado",Black:"Negro","Black and White":"Blanco y negro",White:"Blanco",Orange:"Naranja",Red:"Rojo",Purple:"Morado",Magenta:"Magenta",Green:"Verde",Teal:"Verde azulado",Blue:"Azul","Photo by":"Foto de",on:"en","File Manager":"Administrador de archivos","File Manager not configured":"Administrador de archivos no configurado","Filter by type":"Filtrar por tipo","All types":"Todos los tipos","File name":"Nombre del archivo",Actions:"Acciones","Add file":"Añadir archivo","Add folder":"Añadir carpeta","Add file by URL":"Añadir archivo por URL","File moved":"Archivo movido","Error when moving a file":"Error al mover el archivo","Failed to download file":"No se pudo descargar el archivo","Failed to load JSON data":"No se pudieron cargar los datos JSON","Invalid file URL":"URL de archivo inválida","Unable to validate file URL":"No se pudo validar la URL del archivo","Type to search...":"Escriba para buscar...",Submit:"Enviar","No folders yet":"Aún no hay carpetas","Drag files to upload":"Arrastre archivos para cargarlos","Drop files here to upload":"Suelte los archivos aquí para cargarlos","Newest first":"Los más nuevos primero","Oldest first":"Los más antiguos primero","Largest first":"Los más grandes primero","Smallest first":"Los más pequeños primero","A-Z":"A-Z","Z-A":"Z-A","By type":"Por tipo","Evaluating the task":"Evaluando la tarea","Something went wrong, please try again":"Algo salió mal, por favor intente nuevamente","Sort by":"Ordenar por","preview text":"Cargando imagen...","Use this variant":"Usar esta variante","Confirm deletion":"Confirmar eliminación","Are you sure you want to delete the selected items?":"¿Está seguro de que desea eliminar los elementos seleccionados?","Move to Trash":"Mover a la papelera","Are you sure you want to move the selected items to the Trash?":"¿Está seguro de que desea mover los elementos seleccionados a la papelera?","Permanently delete":"Eliminación permanente","Delete permanently":"Eliminar permanentemente","Are you sure you want to permanently delete the selected items? This action cannot be undone.":"¿Está seguro de que desea eliminar permanentemente los elementos seleccionados? Esta acción no se puede deshacer.",Clear:"Limpiar","Clear Trash":"Vaciar papelera","Are you sure you want to permanently delete all items from Trash?":"¿Está seguro de que desea eliminar permanentemente todos los elementos de la papelera?","Trash cleared successfully":"Papelera vaciada con éxito","{{count}} items permanently deleted":"{{count}} elementos eliminados permanentemente","Trash partially cleared":"Papelera parcialmente vaciada","{{succeeded}} items deleted, {{failed}} items failed":"{{succeeded}} elementos eliminados, {{failed}} fallaron","Failed to clear trash":"Error al vaciar papelera","Error clearing trash":"Error al vaciar papelera","Deleting items...":"Eliminando elementos...",delete_files_permanent_one:"Esta acción eliminará permanentemente {{count}} archivo",delete_files_permanent_few:"Esta acción eliminará permanentemente {{count}} archivos",delete_files_permanent_many:"Esta acción eliminará permanentemente {{count}} archivos",delete_files_permanent_other:"Esta acción eliminará permanentemente {{count}} archivos",delete_folder_permanent:"Esta acción eliminará permanentemente la carpeta «{{name}}» y todo su contenido, incluyendo {{count}} elementos.",delete_mixed_permanent:"Esta acción eliminará permanentemente {{total}} elementos seleccionados, incluyendo {{folders}} carpetas y todas las {{images}} imágenes dentro de ellas.",permanent_delete_warning:"Eliminar archivos que se usaron en correos provocará problemas para mostrar imágenes en correos antiguos. ¿Está seguro de que desea eliminar permanentemente la selección?",move_files_to_trash_one:"Esta acción moverá {{count}} archivo a la papelera.",move_files_to_trash_few:"Esta acción moverá {{count}} archivos a la papelera.",move_files_to_trash_many:"Esta acción moverá {{count}} archivos a la papelera.",move_files_to_trash_other:"Esta acción moverá {{count}} archivos a la papelera.",move_folder_to_trash:"Esta acción moverá la carpeta «{{name}}» y todo su contenido ({{count}} elementos) a la papelera.",move_mixed_to_trash:"Esta acción moverá {{total}} elementos seleccionados a la papelera, incluyendo {{folders}} carpetas y {{images}} imágenes.",delete_count_confirm_trash_one:"¿Mover {{count}} archivo a la papelera?",delete_count_confirm_trash_few:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_trash_many:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_trash_other:"¿Mover {{count}} archivos a la papelera?",delete_count_confirm_permanent_one:"¿Eliminar permanentemente {{count}} archivo?",delete_count_confirm_permanent_few:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_permanent_many:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_permanent_other:"¿Eliminar permanentemente {{count}} archivos?",delete_count_confirm_one:"¿Eliminar {{count}} archivo?",delete_count_confirm_few:"¿Eliminar {{count}} archivos?",delete_count_confirm_many:"¿Eliminar {{count}} archivos?",delete_count_confirm_other:"¿Eliminar {{count}} archivos?",item:"archivo",items:"archivos",Trash:"Papelera",Choose:"Elegir",Stock:"Banco de imágenes","Select an image from our library":"Seleccione una imagen de nuestra biblioteca","AI generation":"Generación con IA","Creating an image on demand":"Creando una imagen bajo demanda","Search file or folder":"Buscar archivo o carpeta","Click here to select a file":"Haz clic aquí para seleccionar un archivo","Supported files:":"Archivos admitidos:","Create folder":"Crear carpeta",Done:"Hecho","Move here":"Mover aquí","Copy here":"Copiar aquí","File URL":"URL del archivo","There's nothing here":"Aquí no hay nada","Try using a different search query.":"Prueba a utilizar una consulta de búsqueda diferente.","Millions of free stock images":"Millones de imágenes de stock gratuitas","Enter a search query and we'll find the perfect image for you":"Ingrese una consulta de búsqueda y encontraremos la imagen perfecta para usted","Millions of icons":"Millones de iconos","Lucide icons":"Iconos Lucide","Thousands of icons":"Miles de iconos","Enter a search query and we'll find the perfect icon for you":"Ingrese una consulta de búsqueda y encontraremos el ícono perfecto para usted","Enter your query and we will find the right one for you":"Ingrese su consulta y nosotros encontraremos la adecuada para usted","Over 350,000 live images":"Más de 350,000 imágenes en vivo","The folder will be created in the root directory.":"La carpeta se creará en el directorio raíz.",undo:"DESHACER",moved_to_trash_one:"{{count}} elemento movido a la papelera",moved_to_trash_few:"{{count}} elementos movidos a la papelera",moved_to_trash_many:"{{count}} elementos movidos a la papelera",moved_to_trash_other:"{{count}} elementos movidos a la papelera",restored_items_one:"{{count}} elemento restaurado",restored_items_few:"{{count}} elementos restaurados",restored_items_many:"{{count}} elementos restaurados",restored_items_other:"{{count}} elementos restaurados",Type:"Tipo","Generate image":"Generar imagen","A beautiful image of a sunset over a calm ocean.":"Una imagen hermosa de un atardecer sobre un océano tranquilo.","For example:":"Por ejemplo:",Insert:"Insertar",Error:"Error","Upload progress":"Cargando {{completed}}/{{total}}","Uploading files":"Cargando {{completed}}/{{total}} archivos","Uploaded files":"Cargados {{success}} de {{total}} archivos","Upload error files":"Error al cargar {{errorCount}} archivos","Applies to all {{count}} files":"(se aplica a todos los {{count}} archivos)","Some files failed to upload":"Algunos archivos no se pudieron cargar. Verifique el tamaño y el formato de los archivos.",upload_error_hint_invalid_name:"Renombre el archivo: use solo letras, números, guiones y guiones bajos.",upload_error_hint_size:"Reduzca el tamaño del archivo o elija otro.",upload_error_hint_format:"Use un formato permitido: JPG, PNG o GIF.",upload_error_hint_exists:"Ya existe un archivo con este nombre en la carpeta. Renombre el archivo.","Images generated successfully":"Imágenes generadas correctamente","Choose for template":"Seleccionar para cargar en la plantilla","Trash is empty":"La papelera está vacía","Deleted files will be displayed here":"Los archivos eliminados se mostrarán aquí","Editing: {{name}}":"Editando: {{name}}","Editing image":"Editando imagen",Save:"Guardar","Loading editor...":"Cargando editor...","Error loading image":"Error al cargar la imagen","Error saving image":"Error al guardar la imagen","Error initializing editor":"Error al inicializar el editor","Close File Manager":"Cerrar administrador de archivos","Are you sure you want to close? Unsaved changes will be lost.":"¿Está seguro de que desea cerrar? Los cambios no guardados se perderán.","Are you sure you want to close the file manager?":"¿Está seguro de que desea cerrar el administrador de archivos?",Close:"Cerrar",KB:"KB","No files":"No hay archivos","Folder is empty or files not found":"La carpeta está vacía o no se encontraron archivos","Search files...":"Buscar archivos...",Success:"Éxito","Image updated successfully":"Imagen actualizada exitosamente","Failed to save changes":"Error al guardar los cambios: {{error}}","Unknown error":"Error desconocido","Select destination folder":"Seleccione la carpeta de destino","Error moving":"Error al mover","Error deleting":"Error al eliminar","Error copying":"Error al copiar","Error renaming":"Error al renombrar","Failed to refresh folder tree":"Error al actualizar el árbol de carpetas","Failed to refresh file list":"Error al actualizar la lista de archivos","Errors occurred while moving":"Ocurrieron errores al mover","Errors occurred while copying":"Ocurrieron errores al copiar","(error)":"(error)","(circular reference)":"(referencia circular)","File too large. Maximum size: {{size}}":"El archivo es demasiado grande. Tamaño máximo: {{size}}","File too small. Minimum size: {{size}}":"El archivo es demasiado pequeño. Tamaño mínimo: {{size}}","Unsupported file type":"Tipo de archivo no admitido","Unsupported file type: {{type}}":"Tipo de archivo no admitido: {{type}}",unknown:"desconocido","Failed to load files":"Error al cargar archivos","Failed to load files in folder":"No se pudo cargar el contenido de la carpeta ({{folderName}})","Failed to load subfolders in folder":'No se pudieron cargar las subcarpetas en "{{folderName}}"',"Failed to load folder items count in folder":'No se pudo obtener el recuento de elementos en "{{folderName}}"',"DataProvider for folder deletion is not configured":"DataProvider para eliminar carpetas no está configurado","DataProvider for file upload is not configured":"DataProvider para cargar archivos no está configurado","Error uploading file {{fileName}}":"Error al cargar el archivo {{fileName}}","Error uploading file":"Error al cargar el archivo","Cannot upload files to Trash":"No se pueden cargar archivos a la papelera","Please fill in all fields":"Por favor, complete todos los campos","URL too long":"La URL es demasiado larga","Only http and https URLs are supported":"Solo se admiten URLs con protocolo http y https","Private and local URLs are not allowed":"No se permiten URLs locales ni privadas","Upload by URL is not supported":"La carga por URL no está admitida","File name is too long. Maximum {{max}} characters":"El nombre del archivo es demasiado largo. Máximo {{max}} caracteres","File name contains invalid characters":"El nombre del archivo contiene caracteres no válidos","Large file may take a long time to upload":"Un archivo grande puede tardar mucho en cargarse","File unavailable: {{status}} {{statusText}}":"Archivo no disponible: {{status}} {{statusText}}","File too large: {{size}}":"Archivo demasiado grande: {{size}}","Unsupported file type: {{contentType}}":"Tipo de archivo no admitido: {{contentType}}","Invalid server response: folder ID is missing":"Respuesta del servidor inválida: falta el ID de la carpeta","Error: folder cannot be its own parent":"Error: la carpeta no puede ser su propio padre","Upload to Trash is forbidden":"Cargar a la papelera está prohibido","renameFolder is not implemented in dataProviders":"renameFolder no está implementado en dataProviders","renameFile is not implemented in dataProviders":"renameFile no está implementado en dataProviders",Clean:"Limpiar","Circular dependency detected: folder cannot be its own parent":"Dependencia circular detectada: la carpeta no puede ser su propio padre","Save as copy and choose":"Guardar como copia y elegir","Save and choose":"Guardar y elegir",pixie:{"added drawing":"Dibujo añadido","added frame":"Marco añadido","added image":"Imagen añadida","added shape":"Forma añadida","added sticker":"Pegatina añadida","added text":"Texto añadido","applied filters":"Filtros aplicados",apply:"Aplicar",background:"Fondo","background color":"Color de fondo",beach:"Playa","brush color":"Color del pincel","brush size":"Tamaño del pincel","brush type":"Tipo de pincel",bubbles:"Burbujas",Cancel:"Cancelar","changed style":"Estilo cambiado","Circle Brush":"Círculo",close:"Cerrar",color:"Color",corners:"Esquinas",crop:"Recortar",Custom:"Personalizado","deleted object":"Objeto eliminado","Diamond Brush":"Diamante",doodles:"Garabatos",draw:"Dibujar",emoticons:"Emoticonos","Eraser Brush":"Borrador",filter:"Filtro",font:"Fuente","font size":"Tamaño de fuente",frame:"Marco",gradient:"Gradiente",height:"Alto",history:"Historial","H Line Brush":"Línea H",image:"Imagen",initial:"Inicial",landmarks:"Monumentos","loaded state":"Estado cargado","loading canvas":"Cargando lienzo","loading image":"Cargando imagen","loading state":"Cargando estado","maintain aspect ratio":"Mantener proporción",merge:"Fusionar","merged objects":"Objetos fusionados","new text":"Nuevo texto",objects:"Objetos",opacity:"Opacidad",outline:"Contorno","outline color":"Color del contorno","Pencil Brush":"Lápiz","processing image":"Procesando imagen",quality:"Calidad",radius:"Radio","replace image":"Reemplazar imagen","replaced background image":"Imagen de fondo reemplazada",resize:"Redimensionar","resized image":"Imagen redimensionada","rounded corner":"Esquina redondeada",save:"Guardar",shadow:"Sombra","shadow color":"Color de la sombra",shapes:"Formas","Spray Brush":"Spray",square:"Cuadrado","Square Brush":"Cuadrado",stickers:"Pegatinas",text:"Texto",texture:"Textura",transportation:"Transporte","V Line Brush":"Línea V",width:"Ancho",grayscale:"Escala de grises","black & White":"Blanco y negro",sharpen:"Enfocar",invert:"Invertir",vintage:"Vintage",polaroid:"Polaroid",kodachrome:"Kodachrome",technicolor:"Technicolor",brownie:"Sepia cálido",sepia:"Sepia","remove Color":"Eliminar color",brightness:"Brillo",gamma:"Gamma",noise:"Ruido",pixelate:"Pixelar",blur:"Desenfocar",emboss:"Relieve","blend Color":"Mezclar color",distance:"Distancia",red:"Rojo",green:"Verde",blue:"Azul",blocksize:"Tamaño de bloque",alpha:"Alfa",add:"Añadir",multiply:"Multiplicar",subtract:"Restar",diff:"Diferencia",screen:"Pantalla",lighten:"Aclarar",darken:"Oscurecer","select an option...":"Seleccione una opción..."}}},uk:{translation:ii},"pt-br":{translation:oi},pt:{translation:oi},br:{translation:oi},"pt-BR":{translation:oi}};Fn.use(Hn).init({resources:ai,lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});Object.values({images:["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"],documents:["application/pdf","text/plain","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],archives:["application/zip","application/x-rar-compressed","application/x-7z-compressed"],videos:["video/mp4","video/avi","video/quicktime","video/x-msvideo"],audio:["audio/mpeg","audio/wav","audio/ogg"]}).flat();const si=e=>{if(0===e)return"0 Bytes";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]},li=e=>{if(!e||e<=0)return"";const t=1048576;if(e<t){return`${Math.round(e/1024)} Kb`}return`${(e/t).toFixed(2)} Mb`},ci=e=>{if(null==e)return"";if("number"==typeof e)return li(e);const t=String(e).trim();if(!t)return"";const r=Number(t);return Number.isNaN(r)?t:li(r)},ui=(e,t)=>{const r=t.filter(e=>"string"==typeof e),n=new Set(r.map(e=>e.toLowerCase())),i="string"==typeof e?e:String(null!=e?e:"");if(!n.has(i.toLowerCase()))return i;const o=i.lastIndexOf("."),a=o>0?i.slice(0,o):i,s=o>0?i.slice(o):"";let l,c=1;do{l=`${a}_${c}${s}`,c++}while(n.has(l.toLowerCase()));return l};async function di(e,t,r,n,i){if(!i||!(null==e?void 0:e.getFiles))return t;try{let i=[];const{files:o}=await e.getFiles({folderId:n?void 0:null!=r?r:void 0,noFolder:n,itemType:"all",page:1,limit:1e4});if(i=(o||[]).map(e=>e.name).filter(e=>!!e),!n&&(null==e?void 0:e.getFolders)){const t=(await e.getFolders({parentId:null!=r?r:null,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);i=[...i,...t]}return ui(t,i)}catch(e){return console.warn("Could not fetch files for duplicate check:",e),t}}const hi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m6 9 6 6 6-6"}));hi.displayName="ChevronDown";const fi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M12 20.472a6 6 0 1 0 5.58-10.262m-11.16 0a6 6 0 1 0 7.16 3.58M18 8A6 6 0 1 1 6 8a6 6 0 0 1 12 0Z"}));fi.displayName="Colors";const pi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M16 16v2.8c0 1.12 0 1.68-.218 2.108a2 2 0 0 1-.874.874C14.48 22 13.92 22 12.8 22H5.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C2 20.48 2 19.92 2 18.8v-7.6c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C3.52 8 4.08 8 5.2 8H8m3.2 8h7.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C22 14.48 22 13.92 22 12.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C20.48 2 19.92 2 18.8 2h-7.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C8 3.52 8 4.08 8 5.2v7.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C9.52 16 10.08 16 11.2 16Z"}));pi.displayName="Copy04";const gi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M10 6h4.8c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C18 7.52 18 8.08 18 9.2V14M2 6h4m12 12v4m4-4H9.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C6 16.48 6 15.92 6 14.8V2"}));gi.displayName="Crop02";const mi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0-7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"}));mi.displayName="DotsVertical";const vi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm7 7 3 3m0 0 3-3m-3 3v-6"}));vi.displayName="FolderDownload";const yi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm7 7h6"}));yi.displayName="FolderMinus";const bi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm10 10v-6m-3 3h6"}));bi.displayName="FolderPlus";const wi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m13 7-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 0 0-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 18.72 2 17.88 2 16.2V7Zm13.5 10.5L14 16m1-2.5a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z"}));wi.displayName="FolderSearch";const xi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M8.4 3H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 3.76 3 4.04 3 4.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 10 4.04 10 4.6 10h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C10 9.24 10 8.96 10 8.4V4.6c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C9.24 3 8.96 3 8.4 3Zm11 0h-3.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C14 3.76 14 4.04 14 4.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 10 15.04 10 15.6 10h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C21 9.24 21 8.96 21 8.4V4.6c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C20.24 3 19.96 3 19.4 3Zm0 11h-3.8c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C14 14.76 14 15.04 14 15.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C14.76 21 15.04 21 15.6 21h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C21 20.24 21 19.96 21 19.4v-3.8c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C20.24 14 19.96 14 19.4 14Zm-11 0H4.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C3 14.76 3 15.04 3 15.6v3.8c0 .56 0 .84.109 1.054a1 1 0 0 0 .437.437C3.76 21 4.04 21 4.6 21h3.8c.56 0 .84 0 1.054-.109a1 1 0 0 0 .437-.437C10 20.24 10 19.96 10 19.4v-3.8c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C9.24 14 8.96 14 8.4 14Z"}));xi.displayName="Grid01";const Ci=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m4.272 20.728 6.597-6.597c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668l6.553 6.553M14 15l2.869-2.869c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L22 15M10 9a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM6.8 21h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 18.72 22 17.88 22 16.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 21 5.12 21 6.8 21Z"}));Ci.displayName="Image03";const _i=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7"}));_i.displayName="Link01";const Si=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M21 12H9m12-6H9m12 12H9m-4-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0-6a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm0 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}));Si.displayName="List";const Ai=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M9.5 8.965c0-.477 0-.716.1-.849a.5.5 0 0 1 .364-.199c.166-.012.367.117.769.375l4.72 3.035c.349.224.523.336.583.478a.5.5 0 0 1 0 .39c-.06.142-.234.254-.583.478l-4.72 3.035c-.402.258-.603.387-.769.375a.5.5 0 0 1-.364-.2c-.1-.132-.1-.371-.1-.848v-6.07Z"}),n.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));Ai.displayName="PlaySquare";const ki=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M12 8v8m-4-4h8m6 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));ki.displayName="PlusCircle";const Ei=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M20.453 12.893A8.5 8.5 0 0 1 4.638 16.25l-.25-.433m-.842-4.71A8.5 8.5 0 0 1 19.361 7.75l.25.433M3.493 18.066l.732-2.732 2.732.732m10.085-8.132 2.732.732.732-2.732"}));Ei.displayName="RefreshCw05";const Ii=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M14 22H6.8m0 0c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C2 19.72 2 18.88 2 17.2M6.8 22h.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C12 19.72 12 18.88 12 17.2v-.4c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C9.72 12 8.88 12 7.2 12h-.4c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 14.28 2 15.12 2 16.8v.4m0 0V10m8-8h4m8 8v4m-4 8c.93 0 1.395 0 1.776-.102a3 3 0 0 0 2.122-2.122C22 19.395 22 18.93 22 18m0-12c0-.93 0-1.395-.102-1.776a3 3 0 0 0-2.122-2.122C19.395 2 18.93 2 18 2M6 2c-.93 0-1.395 0-1.776.102a3 3 0 0 0-2.122 2.122C2 4.605 2 5.07 2 6"}));Ii.displayName="Scale01";const Ti=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"m21 21-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"}));Ti.displayName="SearchMd";const Fi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M4.5 22v-5m0-10V2M2 4.5h5m-5 15h5M13 3l-1.734 4.509c-.282.733-.423 1.1-.643 1.408a3 3 0 0 1-.706.707c-.308.219-.675.36-1.408.642L4 12l4.509 1.734c.733.282 1.1.423 1.408.643.273.194.512.433.707.706.219.308.36.675.642 1.408L13 21l1.734-4.509c.282-.733.423-1.1.643-1.408.194-.273.433-.512.706-.707.308-.219.675-.36 1.408-.642L22 12l-4.509-1.734c-.733-.282-1.1-.423-1.408-.642a3 3 0 0 1-.706-.707c-.22-.308-.36-.675-.643-1.408L13 3Z"}));Fi.displayName="Stars02";const Oi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M13 7H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C2 8.52 2 9.08 2 10.2v3.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C3.52 17 4.08 17 5.2 17H13m4-10h1.8c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 8.52 22 9.08 22 10.2v3.6c0 1.12 0 1.68-.218 2.108a2 2 0 0 1-.874.874C20.48 17 19.92 17 18.8 17H17m0 4V3m2.5 0h-5m5 18h-5"}));Oi.displayName="TextInput";const Pi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M7 22V11m-5 2v7a2 2 0 0 0 2 2h13.426a3 3 0 0 0 2.965-2.544l1.077-7A3 3 0 0 0 18.503 9H15a1 1 0 0 1-1-1V4.466A2.466 2.466 0 0 0 11.534 2a.822.822 0 0 0-.75.488l-3.52 7.918A1 1 0 0 1 6.35 11H4a2 2 0 0 0-2 2Z"}));Pi.displayName="ThumbsUp";const Mi=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M9 3h6M3 6h18m-2 0-.701 10.52c-.105 1.578-.158 2.367-.499 2.965a3 3 0 0 1-1.298 1.215c-.62.3-1.41.3-2.993.3h-3.018c-1.582 0-2.373 0-2.993-.3A3 3 0 0 1 6.2 19.485c-.34-.598-.394-1.387-.499-2.966L5 6m5 4.5v5m4-5v5"}));Mi.displayName="Trash03";const Ri=({size:e=24,color:t="currentColor",...r})=>n.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...r},n.createElement("path",{d:"M9 3h6M3 6h18m-2 0-.701 10.52c-.105 1.578-.158 2.367-.499 2.965a3 3 0 0 1-1.298 1.215c-.62.3-1.41.3-2.993.3h-3.018c-1.582 0-2.373 0-2.993-.3A3 3 0 0 1 6.2 19.485c-.34-.598-.394-1.387-.499-2.966L5 6"}));Ri.displayName="Trash04";const Li=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"mixed-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm4-8h2v2H5V1zm0 4h2v2H5V5zm0 4h2v2H5V9zm4-8h2v2H9V1zm0 4h2v2H9V5zm0 4h2v2H9V9z"})}),Ni=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"landscape-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M1 3h10v6H1V3zm1 1v4h8V4H2z"})}),ji=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"portrait-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M3 1h6v10H3V1zm1 1v8h4V2H4z"})}),Di=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"square-view",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M1 1h10v10H1V1zm1 1v8h8V2H2z"})}),zi=()=>t("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"ai-icon",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:[e("path",{d:"M2.45454 11.7273C2.45454 11.7273 2.16994 10.446 1.66154 9.88113C1.15314 9.31625 0 9 0 9C0 9 1.15314 8.68374 1.66154 8.11887C2.16994 7.554 2.45454 6.27273 2.45454 6.27273C2.45454 6.27273 2.73915 7.554 3.24755 8.11887C3.75594 8.68374 4.90909 9 4.90909 9C4.90909 9 3.75594 9.31625 3.24755 9.88113C2.73915 10.446 2.45454 11.7273 2.45454 11.7273Z"}),e("path",{d:"M7.63636 9C7.63636 9 7.1304 6.94996 6.22658 6.04614C5.32276 5.14233 3.27273 4.63636 3.27273 4.63636C3.27273 4.63636 5.32276 4.1304 6.22658 3.22657C7.1304 2.32275 7.63636 0.272728 7.63636 0.272728C7.63636 0.272728 8.14233 2.32275 9.04615 3.22657C9.94996 4.1304 12 4.63636 12 4.63636C12 4.63636 9.94996 5.14233 9.04615 6.04614C8.14233 6.94996 7.63636 9 7.63636 9Z"}),e("path",{d:"M1.63636 4.09091C1.63636 4.09091 1.44663 3.19402 1.10769 2.7986C0.768758 2.40318 0 2.18182 0 2.18182C0 2.18182 0.768758 1.96046 1.10769 1.56503C1.44663 1.16961 1.63636 0.272728 1.63636 0.272728C1.63636 0.272728 1.8261 1.16961 2.16503 1.56503C2.50397 1.96046 3.27273 2.18182 3.27273 2.18182C3.27273 2.18182 2.50397 2.40318 2.16503 2.7986C1.8261 3.19402 1.63636 4.09091 1.63636 4.09091Z"}),e("path",{d:"M10.6364 11.7273C10.6364 11.7273 10.4782 11.0866 10.1958 10.8042C9.91336 10.5218 9.27273 10.3636 9.27273 10.3636C9.27273 10.3636 9.91336 10.2055 10.1958 9.92307C10.4782 9.64064 10.6364 9 10.6364 9C10.6364 9 10.7945 9.64064 11.0769 9.92307C11.3594 10.2055 12 10.3636 12 10.3636C12 10.3636 11.3594 10.5218 11.0769 10.8042C10.7945 11.0866 10.6364 11.7273 10.6364 11.7273Z"})]}),Bi=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"light-mode",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6 7.81819C6.50303 7.81819 6.93182 7.64092 7.28637 7.28637C7.64092 6.93182 7.81819 6.50303 7.81819 6C7.81819 5.49697 7.64092 5.06818 7.28637 4.71363C6.93182 4.35908 6.50303 4.18181 6 4.18181C5.49697 4.18181 5.06818 4.35908 4.71363 4.71363C4.35908 5.06818 4.18181 5.49697 4.18181 6C4.18181 6.50303 4.35908 6.93182 4.71363 7.28637C5.06818 7.64092 5.49697 7.81819 6 7.81819ZM6 8.72727C5.24545 8.72727 4.60227 8.46136 4.07045 7.92955C3.53864 7.39773 3.27273 6.75455 3.27273 6C3.27273 5.24545 3.53864 4.60227 4.07045 4.07045C4.60227 3.53864 5.24545 3.27273 6 3.27273C6.75455 3.27273 7.39773 3.53864 7.92955 4.07045C8.46136 4.60227 8.72727 5.24545 8.72727 6C8.72727 6.75455 8.46136 7.39773 7.92955 7.92955C7.39773 8.46136 6.75455 8.72727 6 8.72727ZM2.18182 6.45454H0V5.54546H2.18182V6.45454ZM12 6.45454H9.81818V5.54546H12V6.45454ZM5.54546 2.18182V0H6.45454V2.18182H5.54546ZM5.54546 12V9.81818H6.45454V12H5.54546ZM3 3.6091L1.63182 2.28637L2.28181 1.61819L3.5909 2.98182L3 3.6091ZM9.72727 10.3727L8.39546 9.00454L9.0091 8.38182L10.3682 9.71363L9.72727 10.3727ZM8.38182 2.9909L9.71363 1.63182L10.3818 2.27273L9.02727 3.6L8.38182 2.9909ZM1.62727 9.71819L2.98636 8.38636L3.61818 9.0091L2.28637 10.3682L1.62727 9.71819Z"})}),Ui=()=>e("svg",{viewBox:"0 0 12 12",focusable:"false","data-icon":"dark-mode",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:e("path",{d:"M6 11C4.61111 11 3.43056 10.5139 2.45833 9.54167C1.48611 8.56944 1 7.38889 1 6C1 4.61111 1.48611 3.43056 2.45833 2.45833C3.43056 1.48611 4.61111 1 6 1C6.09259 1 6.1875 1.00309 6.28472 1.00926C6.38194 1.01543 6.49382 1.02469 6.62036 1.03704C6.2716 1.32408 5.99769 1.68442 5.79861 2.11806C5.59954 2.55169 5.5 3.01234 5.5 3.5C5.5 4.33333 5.79167 5.04167 6.375 5.625C6.95833 6.20833 7.66667 6.5 8.5 6.5C8.99074 6.5 9.45216 6.40509 9.88426 6.21528C10.3164 6.02546 10.6759 5.76544 10.963 5.43519C10.9753 5.54939 10.9846 5.65047 10.9907 5.73843C10.9969 5.82639 11 5.91358 11 6C11 7.38889 10.5139 8.56944 9.54167 9.54167C8.56944 10.5139 7.38889 11 6 11ZM6 10.0741C6.94444 10.0741 7.77469 9.7909 8.49075 9.22454C9.20681 8.65818 9.67594 7.97376 9.89815 7.17129C9.68211 7.25463 9.45474 7.3179 9.21606 7.36111C8.97737 7.40431 8.73869 7.42592 8.5 7.42592C7.41242 7.42592 6.4862 7.0435 5.72135 6.27865C4.9565 5.5138 4.57408 4.58758 4.57408 3.5C4.57408 3.29012 4.59414 3.06944 4.63426 2.83796C4.67438 2.60648 4.74229 2.35185 4.83797 2.07407C3.99229 2.3395 3.29552 2.83487 2.74768 3.56018C2.19984 4.28549 1.92592 5.09876 1.92592 6C1.92592 7.12963 2.32252 8.09105 3.11574 8.88426C3.90895 9.67748 4.87037 10.0741 6 10.0741Z"})}),Vi=()=>t("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{opacity:"0.5",d:"M6 19H49C54.5229 19 59 23.4772 59 29V46C59 51.5228 54.5228 56 49 56H14C9.58172 56 6 52.4183 6 48V19Z",fill:"#91CAFF"}),e("path",{d:"M6 19L34.866 18.5L30.7172 11.0737C29.6569 9.17588 27.6531 8 25.4792 8H10C7.79086 8 6 9.79086 6 12V19Z",fill:"#2884FF"}),e("path",{d:"M34.6663 18.6667L31.6916 12.7171C30.8354 11.0048 30.4073 10.1486 29.7687 9.5231C29.2039 8.96995 28.5232 8.54926 27.7759 8.29149C26.9308 8 25.9736 8 24.0591 8H13.8663C10.8794 8 9.38592 8 8.24506 8.5813C7.24153 9.09262 6.42563 9.90852 5.91431 10.9121C5.33301 12.0529 5.33301 13.5464 5.33301 16.5333V18.6667M5.33301 18.6667H45.8663C50.3468 18.6667 52.587 18.6667 54.2983 19.5386C55.8036 20.3056 57.0274 21.5294 57.7944 23.0347C58.6663 24.746 58.6663 26.9862 58.6663 31.4667V43.2C58.6663 47.6804 58.6663 49.9206 57.7944 51.6319C57.0274 53.1372 55.8036 54.3611 54.2983 55.1281C52.587 56 50.3468 56 45.8663 56H18.133C13.6526 56 11.4124 56 9.70108 55.1281C8.19579 54.3611 6.97194 53.1372 6.20496 51.6319C5.33301 49.9206 5.33301 47.6804 5.33301 43.2V18.6667Z",stroke:"#2884FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Hi=()=>t("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{opacity:"0.5",d:"M6 19H49C54.5229 19 59 23.4772 59 29V46C59 51.5228 54.5228 56 49 56H14C9.58172 56 6 52.4183 6 48V19Z",fill:"#91CAFF"}),e("path",{d:"M6 19L34.866 18.5L30.7172 11.0737C29.6569 9.17588 27.6531 8 25.4792 8H10C7.79086 8 6 9.79086 6 12V19Z",stroke:"currentColor"}),e("path",{d:"M34.6663 18.6667L31.6916 12.7171C30.8354 11.0048 30.4073 10.1486 29.7687 9.5231C29.2039 8.96995 28.5232 8.54926 27.7759 8.29149C26.9308 8 25.9736 8 24.0591 8H13.8663C10.8794 8 9.38592 8 8.24506 8.5813C7.24153 9.09262 6.42563 9.90852 5.91431 10.9121C5.33301 12.0529 5.33301 13.5464 5.33301 16.5333V18.6667M5.33301 18.6667H45.8663C50.3468 18.6667 52.587 18.6667 54.2983 19.5386C55.8036 20.3056 57.0274 21.5294 57.7944 23.0347C58.6663 24.746 58.6663 26.9862 58.6663 31.4667V43.2C58.6663 47.6804 58.6663 49.9206 57.7944 51.6319C57.0274 53.1372 55.8036 54.3611 54.2983 55.1281C52.587 56 50.3468 56 45.8663 56H18.133C13.6526 56 11.4124 56 9.70108 55.1281C8.19579 54.3611 6.97194 53.1372 6.20496 51.6319C5.33301 49.9206 5.33301 47.6804 5.33301 43.2V18.6667Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Wi=()=>e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M10.8337 5.83333L9.90404 3.9741C9.6365 3.439 9.50271 3.17144 9.30313 2.97597C9.12664 2.80311 8.91393 2.67164 8.68039 2.59109C8.4163 2.5 8.11716 2.5 7.5189 2.5H4.33366C3.40024 2.5 2.93353 2.5 2.57701 2.68166C2.2634 2.84144 2.00844 3.09641 1.84865 3.41002C1.66699 3.76654 1.66699 4.23325 1.66699 5.16667V5.83333M1.66699 5.83333H14.3337C15.7338 5.83333 16.4339 5.83333 16.9686 6.10582C17.439 6.3455 17.8215 6.72795 18.0612 7.19836C18.3337 7.73314 18.3337 8.4332 18.3337 9.83333V13.5C18.3337 14.9001 18.3337 15.6002 18.0612 16.135C17.8215 16.6054 17.439 16.9878 16.9686 17.2275C16.4339 17.5 15.7338 17.5 14.3337 17.5H5.66699C4.26686 17.5 3.5668 17.5 3.03202 17.2275C2.56161 16.9878 2.17916 16.6054 1.93948 16.135C1.66699 15.6002 1.66699 14.9001 1.66699 13.5V5.83333Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),$i=()=>e("svg",{width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M32 24.5L24 16.5M24 16.5L16 24.5M24 16.5V34.9C24 37.6814 24 39.0721 25.101 40.6292C25.8326 41.6638 27.9388 42.9406 29.1944 43.1108C31.0842 43.3668 31.8019 42.9924 33.2371 42.2437C39.6333 38.9071 44 32.2135 44 24.5C44 13.4543 35.0457 4.5 24 4.5C12.9543 4.5 4 13.4543 4 24.5C4 31.9028 8.02199 38.3663 14 41.8244",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})}),qi=()=>t("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("rect",{width:"56",height:"56",rx:"24",fill:"#8946FB"}),e("path",{d:"M28 36.4722C29.0615 37.4223 30.4633 38 32 38C35.3137 38 38 35.3137 38 32C38 29.2331 36.1271 26.9036 33.5798 26.2102M22.4202 26.2102C19.8729 26.9036 18 29.2331 18 32C18 35.3137 20.6863 38 24 38C27.3137 38 30 35.3137 30 32C30 31.2195 29.851 30.4738 29.5798 29.7898M34 24C34 27.3137 31.3137 30 28 30C24.6863 30 22 27.3137 22 24C22 20.6863 24.6863 18 28 18C31.3137 18 34 20.6863 34 24Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Gi=()=>t("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("rect",{width:"56",height:"56",rx:"24",fill:"#7ED846"}),e("path",{d:"M20.5 38V33M20.5 23V18M18 20.5H23M18 35.5H23M29 19L27.2658 23.5089C26.9838 24.2421 26.8428 24.6087 26.6235 24.9171C26.4292 25.1904 26.1904 25.4292 25.9171 25.6235C25.6087 25.8428 25.2421 25.9838 24.5089 26.2658L20 28L24.5089 29.7342C25.2421 30.0162 25.6087 30.1572 25.9171 30.3765C26.1904 30.5708 26.4292 30.8096 26.6235 31.0829C26.8428 31.3913 26.9838 31.7579 27.2658 32.4911L29 37L30.7342 32.4911C31.0162 31.7579 31.1572 31.3913 31.3765 31.0829C31.5708 30.8096 31.8096 30.5708 32.0829 30.3765C32.3913 30.1572 32.7579 30.0162 33.4911 29.7342L38 28L33.4911 26.2658C32.7579 25.9838 32.3913 25.8428 32.0829 25.6235C31.8096 25.4292 31.5708 25.1904 31.3765 24.9171C31.1572 24.6087 31.0162 24.2421 30.7342 23.5089L29 19Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Yi=()=>t("svg",{width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M19 18.4307C19 17.4761 19 16.9988 19.1995 16.7324C19.3733 16.5001 19.6394 16.3549 19.9288 16.3342C20.2608 16.3105 20.6622 16.5686 21.4652 17.0848L30.9064 23.1541C31.6032 23.602 31.9516 23.826 32.0719 24.1108C32.177 24.3596 32.177 24.6404 32.0719 24.8892C31.9516 25.174 31.6032 25.398 30.9064 25.8459L21.4652 31.9152C20.6622 32.4314 20.2608 32.6895 19.9288 32.6658C19.6394 32.6451 19.3733 32.4998 19.1995 32.2676C19 32.0012 19 31.5239 19 30.5693V18.4307Z",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M6 16.1C6 12.7397 6 11.0595 6.65396 9.77606C7.2292 8.64708 8.14708 7.7292 9.27606 7.15396C10.5595 6.5 12.2397 6.5 15.6 6.5H32.4C35.7603 6.5 37.4405 6.5 38.7239 7.15396C39.8529 7.7292 40.7708 8.64708 41.346 9.77606C42 11.0595 42 12.7397 42 16.1V32.9C42 36.2603 42 37.9405 41.346 39.2239C40.7708 40.3529 39.8529 41.2708 38.7239 41.846C37.4405 42.5 35.7603 42.5 32.4 42.5H15.6C12.2397 42.5 10.5595 42.5 9.27606 41.846C8.14708 41.2708 7.2292 40.3529 6.65396 39.2239C6 37.9405 6 36.2603 6 32.9V16.1Z",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),Xi=()=>e("svg",{width:"48",height:"49",viewBox:"0 0 48 49",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M24 41.4444C26.123 43.3446 28.9266 44.5 32 44.5C38.6274 44.5 44 39.1274 44 32.5C44 26.9662 40.2541 22.3072 35.1596 20.9203M12.8404 20.9203C7.74587 22.3072 4 26.9661 4 32.5C4 39.1274 9.37258 44.5 16 44.5C22.6274 44.5 28 39.1274 28 32.5C28 30.939 27.7019 29.4476 27.1596 28.0797M36 16.5C36 23.1274 30.6274 28.5 24 28.5C17.3726 28.5 12 23.1274 12 16.5C12 9.87258 17.3726 4.5 24 4.5C30.6274 4.5 36 9.87258 36 16.5Z",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})}),Ki=t=>e(ne,Object.assign({component:Li},t)),Zi=t=>e(ne,Object.assign({component:Ni},t)),Ji=t=>e(ne,Object.assign({component:ji},t)),Qi=t=>e(ne,Object.assign({component:Di},t)),eo=t=>e(ne,Object.assign({component:zi},t)),to=t=>e(ne,Object.assign({component:Bi},t)),ro=t=>e(ne,Object.assign({component:Ui},t)),no=t=>e(ne,Object.assign({component:Vi},t)),io=t=>e(ne,Object.assign({component:Hi},t)),oo=t=>e(ne,Object.assign({component:Wi},t)),ao=t=>e(ne,Object.assign({component:$i},t)),so=t=>e(ne,Object.assign({component:qi},t)),lo=t=>e(ne,Object.assign({component:Gi},t)),co=t=>e(ne,Object.assign({component:Yi},t)),uo=t=>e(ne,Object.assign({component:Xi},t)),ho=s({state:{},actions:{},options:{}}),fo=()=>l(ho),po=({children:t,options:r})=>{var n,i,s;const[l,u]=o([]),[h,f]=o([]),[p,g]=o(null),[m,v]=o(r.searchQuery||""),[y,b]=o(r.sortBySize||"name"),{config:w}=r,x=c(e=>{var t,r,n;if(e===er){const e=!1!==(null===(t=null==w?void 0:w.features)||void 0===t?void 0:t.enableGif),r=!(null==w?void 0:w.enabledTabs)||w.enabledTabs.includes("gif");return e&&r}if(e===tr){const e=!1!==(null===(r=null==w?void 0:w.features)||void 0===r?void 0:r.enableStockImages),t=!(null==w?void 0:w.enabledTabs)||w.enabledTabs.includes("stock");return e&&t}if(e===rr){const e=!1!==(null===(n=null==w?void 0:w.features)||void 0===n?void 0:n.enableIconStock),t=!(null==w?void 0:w.enabledTabs)||w.enabledTabs.includes("icons");return e&&t}return!0},[null==w?void 0:w.enabledTabs,null===(n=null==w?void 0:w.features)||void 0===n?void 0:n.enableGif,null===(i=null==w?void 0:w.features)||void 0===i?void 0:i.enableIconStock,null===(s=null==w?void 0:w.features)||void 0===s?void 0:s.enableStockImages]),[C,_]=o("date"),[S,A]=o("desc"),[k,E]=o([{id:"folders",name:"Папки"}]),[T,F]=o(""),[O,P]=o(!1),[M,R]=o(Qt);a(()=>{(null==w?void 0:w.activeLibraryItem)&&R&&R(x(w.activeLibraryItem)?w.activeLibraryItem:Qt)},[null==w?void 0:w.activeLibraryItem,x,R]),a(()=>{x(M)||R(Qt)},[M,x]);const[L,N]=o({current:1,pageSize:20,total:0}),[j]=I.useForm(),[D]=I.useForm(),[z]=I.useForm(),[B]=I.useForm(),[U]=I.useForm(),[V]=I.useForm(),[H,W]=o(!1),[$,q]=o(!1),[G,Y]=o(!1),[X,K]=o(!1),[Z,J]=o(!1),[Q,ee]=o(!1),[te,re]=o(!1),[ne,ie]=o(null),[oe,ae]=o(null),[se,le]=o(null),ce=(e,t)=>{E(r=>r.map(r=>r.id===e?Object.assign(Object.assign({},r),{name:t}):r))},ue=c(e=>{N(t=>Object.assign(Object.assign({},t),e))},[N]),de=d(()=>{var e;return{folders:l,files:h,selectedFolder:p,searchTerm:m,sortField:y,sortBy:C,sortOrder:S,pathHistory:k,currentMenuFile:T,loading:O,pagination:L,isModalVisible:H,isUrlModalVisible:$,isRenameModalVisible:G,isMoveModalVisible:X,isRenameFolderModalVisible:Z,isCopyModalVisible:Q,isDeleteConfirmVisible:te,form:j,urlForm:D,renameForm:z,moveForm:B,renameFolderForm:U,copyForm:V,fileToRename:ne,folderToRename:oe,activeLibraryItem:M,multiSelect:null===(e=null==w?void 0:w.multiSelect)||void 0===e||e,undoDeletion:se}},[M,null==w?void 0:w.multiSelect,V,T,ne,h,l,j,Q,te,H,X,Z,G,$,O,B,L,k,U,z,m,p,C,y,S,se,D,oe]),he=d(()=>({setFolders:u,setFiles:f,setSelectedFolder:g,setSearchTerm:v,setSortField:b,setSortBy:_,setSortOrder:A,setPathHistory:E,setLoading:P,setPagination:ue,setIsModalVisible:W,setIsUrlModalVisible:q,setIsRenameModalVisible:Y,setIsMoveModalVisible:K,setIsRenameFolderModalVisible:J,setIsCopyModalVisible:ee,setIsDeleteConfirmVisible:re,setFileToRename:ie,setFolderToRename:ae,setUndoDeletion:le,updatePathHistoryOnFolderRename:ce,setActiveLibraryItem:e=>R(x(e)?e:Qt),setCurrentMenuFile:F}),[ue,x]),fe=d(()=>({state:de,actions:he,options:r}),[he,r,de]);return e(ho.Provider,{value:fe,children:t})},go=()=>{const{options:e}=fo(),{customIcons:t}=e,r=i.useCallback((e,r,n)=>{const o=null==t?void 0:t[e];return o?i.createElement(o,n):i.createElement(r,n)},[t]);return i.useMemo(()=>({RootFolderIcon:e=>r("rootFolder",pe,e),FolderIcon:e=>r("folder",no,e),FolderOpenIcon:e=>r("folderOpen",fe,e),AddFolderIcon:e=>r("addFolder",he,e),FileIcon:e=>r("file",de,e),UploadIcon:e=>r("upload",ue,e),UploadByUrlIcon:e=>r("uploadByUrl",ce,e),ExpandArrowIcon:e=>r("expandArrow",le,e),CollapseArrowIcon:e=>r("collapseArrow",se,e),ExpandFolderIcon:e=>r("expandArrow",bi,e),CollapseFolderIcon:e=>r("collapseArrow",yi,e),FolderPreviewIcon:e=>r("folderPreview",io,e),EmptyFolderIcon:e=>r("folderPreview",oo,e),GridViewIcon:e=>r("gridView",ae,e),ListViewIcon:e=>r("listView",oe,e),DropZoneFileIcon:e=>r("folderPreview",ao,e),BigStockIcon:e=>r("folderPreview",so,e),BigAIIcon:e=>r("folderPreview",lo,e),GifPlayIcon:e=>r("folderPreview",co,e),StockBigIcon:e=>r("folderPreview",uo,e),MixedViewIcon:e=>r("mixedView",Ki,e),LandscapeViewIcon:e=>r("landscapeView",Zi,e),PortraitViewIcon:e=>r("portraitView",Ji,e),SquareViewIcon:e=>r("squareView",Qi,e),LightModeIcon:e=>r("lightMode",to,e),DarkModeIcon:e=>r("darkMode",ro,e),AiIcon_2:e=>r("aiIcon_2",eo,e),NoFilesIcon:e=>r("noFiles",wi,e),ThumbsUpIcon:e=>r("thumbsUp",Pi,e),getCustomIcon:r}),[r])};var mo="noFilesContainer",vo="noFilesImage",yo="noFilesTitle",bo="noFilesDescription";const wo=()=>{const{t:r}=Gn(),{NoFilesIcon:n}=go();return t("div",{className:mo,children:[e(n,{className:vo,size:48,strokeWidth:1.4}),e("h2",{className:yo,children:r("There's nothing here")}),e("div",{className:bo,children:r("Try using a different search query.")})]})};var xo,Co={exports:{}},_o=Co.exports;
2
+ /**
3
+ * @license
4
+ * Lodash <https://lodash.com/>
5
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
6
+ * Released under MIT license <https://lodash.com/license>
7
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
8
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
9
+ */var So=(xo||(xo=1,function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",o="__lodash_placeholder__",a=32,s=128,l=256,c=1/0,u=9007199254740991,d=NaN,h=4294967295,f=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",a],["partialRight",64],["rearg",l]],p="[object Arguments]",g="[object Array]",m="[object Boolean]",v="[object Date]",y="[object Error]",b="[object Function]",w="[object GeneratorFunction]",x="[object Map]",C="[object Number]",_="[object Object]",S="[object Promise]",A="[object RegExp]",k="[object Set]",E="[object String]",I="[object Symbol]",T="[object WeakMap]",F="[object ArrayBuffer]",O="[object DataView]",P="[object Float32Array]",M="[object Float64Array]",R="[object Int8Array]",L="[object Int16Array]",N="[object Int32Array]",j="[object Uint8Array]",D="[object Uint8ClampedArray]",z="[object Uint16Array]",B="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,$=/[&<>"']/g,q=RegExp(W.source),G=RegExp($.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,K=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,J=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),re=/^\s+/,ne=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,pe=/^\[object .+?Constructor\]$/,ge=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,be=/['\n\r\u2028\u2029\\]/g,we="\\ud800-\\udfff",xe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ce="\\u2700-\\u27bf",_e="a-z\\xdf-\\xf6\\xf8-\\xff",Se="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\ufe0e\\ufe0f",ke="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="['’]",Ie="["+we+"]",Te="["+ke+"]",Fe="["+xe+"]",Oe="\\d+",Pe="["+Ce+"]",Me="["+_e+"]",Re="[^"+we+ke+Oe+Ce+_e+Se+"]",Le="\\ud83c[\\udffb-\\udfff]",Ne="[^"+we+"]",je="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",ze="["+Se+"]",Be="\\u200d",Ue="(?:"+Me+"|"+Re+")",Ve="(?:"+ze+"|"+Re+")",He="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",$e="(?:"+Fe+"|"+Le+")?",qe="["+Ae+"]?",Ge=qe+$e+"(?:"+Be+"(?:"+[Ne,je,De].join("|")+")"+qe+$e+")*",Ye="(?:"+[Pe,je,De].join("|")+")"+Ge,Xe="(?:"+[Ne+Fe+"?",Fe,je,De,Ie].join("|")+")",Ke=RegExp(Ee,"g"),Ze=RegExp(Fe,"g"),Je=RegExp(Le+"(?="+Le+")|"+Xe+Ge,"g"),Qe=RegExp([ze+"?"+Me+"+"+He+"(?="+[Te,ze,"$"].join("|")+")",Ve+"+"+We+"(?="+[Te,ze+Ue,"$"].join("|")+")",ze+"?"+Ue+"+"+He,ze+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Oe,Ye].join("|"),"g"),et=RegExp("["+Be+we+xe+Ae+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,rt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],nt=-1,it={};it[P]=it[M]=it[R]=it[L]=it[N]=it[j]=it[D]=it[z]=it[B]=!0,it[p]=it[g]=it[F]=it[m]=it[O]=it[v]=it[y]=it[b]=it[x]=it[C]=it[_]=it[A]=it[k]=it[E]=it[T]=!1;var ot={};ot[p]=ot[g]=ot[F]=ot[O]=ot[m]=ot[v]=ot[P]=ot[M]=ot[R]=ot[L]=ot[N]=ot[x]=ot[C]=ot[_]=ot[A]=ot[k]=ot[E]=ot[I]=ot[j]=ot[D]=ot[z]=ot[B]=!0,ot[y]=ot[b]=ot[T]=!1;var at={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,lt=parseInt,ct="object"==typeof On&&On&&On.Object===Object&&On,ut="object"==typeof self&&self&&self.Object===Object&&self,dt=ct||ut||Function("return this")(),ht=t&&!t.nodeType&&t,ft=ht&&e&&!e.nodeType&&e,pt=ft&&ft.exports===ht,gt=pt&&ct.process,mt=function(){try{var e=ft&&ft.require&&ft.require("util").types;return e||gt&&gt.binding&&gt.binding("util")}catch(e){}}(),vt=mt&&mt.isArrayBuffer,yt=mt&&mt.isDate,bt=mt&&mt.isMap,wt=mt&&mt.isRegExp,xt=mt&&mt.isSet,Ct=mt&&mt.isTypedArray;function _t(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function St(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(n,a,r(a),e)}return n}function At(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););return e}function kt(e,t){for(var r=null==e?0:e.length;r--&&!1!==t(e[r],r,e););return e}function Et(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(!t(e[r],r,e))return!1;return!0}function It(e,t){for(var r=-1,n=null==e?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}function Tt(e,t){return!(null==e||!e.length)&&zt(e,t,0)>-1}function Ft(e,t,r){for(var n=-1,i=null==e?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}function Ot(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}function Pt(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}function Mt(e,t,r,n){var i=-1,o=null==e?0:e.length;for(n&&o&&(r=e[++i]);++i<o;)r=t(r,e[i],i,e);return r}function Rt(e,t,r,n){var i=null==e?0:e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}function Lt(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var Nt=Ht("length");function jt(e,t,r){var n;return r(e,function(e,r,i){if(t(e,r,i))return n=r,!1}),n}function Dt(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function zt(e,t,r){return t==t?function(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}(e,t,r):Dt(e,Ut,r)}function Bt(e,t,r,n){for(var i=r-1,o=e.length;++i<o;)if(n(e[i],t))return i;return-1}function Ut(e){return e!=e}function Vt(e,t){var r=null==e?0:e.length;return r?qt(e,t)/r:d}function Ht(e){return function(t){return null==t?r:t[e]}}function Wt(e){return function(t){return null==e?r:e[t]}}function $t(e,t,r,n,i){return i(e,function(e,i,o){r=n?(n=!1,e):t(r,e,i,o)}),r}function qt(e,t){for(var n,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==r&&(n=n===r?a:n+a)}return n}function Gt(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Yt(e){return e?e.slice(0,dr(e)+1).replace(re,""):e}function Xt(e){return function(t){return e(t)}}function Kt(e,t){return Ot(t,function(t){return e[t]})}function Zt(e,t){return e.has(t)}function Jt(e,t){for(var r=-1,n=e.length;++r<n&&zt(t,e[r],0)>-1;);return r}function Qt(e,t){for(var r=e.length;r--&&zt(t,e[r],0)>-1;);return r}var er=Wt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),tr=Wt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rr(e){return"\\"+at[e]}function nr(e){return et.test(e)}function ir(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}function or(e,t){return function(r){return e(t(r))}}function ar(e,t){for(var r=-1,n=e.length,i=0,a=[];++r<n;){var s=e[r];s!==t&&s!==o||(e[r]=o,a[i++]=r)}return a}function sr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}function lr(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=[e,e]}),r}function cr(e){return nr(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):Nt(e)}function ur(e){return nr(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function dr(e){for(var t=e.length;t--&&ne.test(e.charAt(t)););return t}var hr=Wt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function e(t){var ne,we=(t=null==t?dt:fr.defaults(dt.Object(),t,fr.pick(dt,rt))).Array,xe=t.Date,Ce=t.Error,_e=t.Function,Se=t.Math,Ae=t.Object,ke=t.RegExp,Ee=t.String,Ie=t.TypeError,Te=we.prototype,Fe=_e.prototype,Oe=Ae.prototype,Pe=t["__core-js_shared__"],Me=Fe.toString,Re=Oe.hasOwnProperty,Le=0,Ne=(ne=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+ne:"",je=Oe.toString,De=Me.call(Ae),ze=dt._,Be=ke("^"+Me.call(Re).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=pt?t.Buffer:r,Ve=t.Symbol,He=t.Uint8Array,We=Ue?Ue.allocUnsafe:r,$e=or(Ae.getPrototypeOf,Ae),qe=Ae.create,Ge=Oe.propertyIsEnumerable,Ye=Te.splice,Xe=Ve?Ve.isConcatSpreadable:r,Je=Ve?Ve.iterator:r,et=Ve?Ve.toStringTag:r,at=function(){try{var e=uo(Ae,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=xe&&xe.now!==dt.Date.now&&xe.now,ht=t.setTimeout!==dt.setTimeout&&t.setTimeout,ft=Se.ceil,gt=Se.floor,mt=Ae.getOwnPropertySymbols,Nt=Ue?Ue.isBuffer:r,Wt=t.isFinite,pr=Te.join,gr=or(Ae.keys,Ae),mr=Se.max,vr=Se.min,yr=xe.now,br=t.parseInt,wr=Se.random,xr=Te.reverse,Cr=uo(t,"DataView"),_r=uo(t,"Map"),Sr=uo(t,"Promise"),Ar=uo(t,"Set"),kr=uo(t,"WeakMap"),Er=uo(Ae,"create"),Ir=kr&&new kr,Tr={},Fr=jo(Cr),Or=jo(_r),Pr=jo(Sr),Mr=jo(Ar),Rr=jo(kr),Lr=Ve?Ve.prototype:r,Nr=Lr?Lr.valueOf:r,jr=Lr?Lr.toString:r;function Dr(e){if(es(e)&&!Ha(e)&&!(e instanceof Vr)){if(e instanceof Ur)return e;if(Re.call(e,"__wrapped__"))return Do(e)}return new Ur(e)}var zr=function(){function e(){}return function(t){if(!Qa(t))return{};if(qe)return qe(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function Br(){}function Ur(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Vr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Hr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Wr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function $r(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function qr(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new $r;++t<r;)this.add(e[t])}function Gr(e){var t=this.__data__=new Wr(e);this.size=t.size}function Yr(e,t){var r=Ha(e),n=!r&&Va(e),i=!r&&!n&&Ga(e),o=!r&&!n&&!i&&ls(e),a=r||n||i||o,s=a?Gt(e.length,Ee):[],l=s.length;for(var c in e)!t&&!Re.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yo(c,l))||s.push(c);return s}function Xr(e){var t=e.length;return t?e[Gn(0,t-1)]:r}function Kr(e,t){return Ro(Ii(e),an(t,0,e.length))}function Zr(e){return Ro(Ii(e))}function Jr(e,t,n){(n!==r&&!za(e[t],n)||n===r&&!(t in e))&&nn(e,t,n)}function Qr(e,t,n){var i=e[t];Re.call(e,t)&&za(i,n)&&(n!==r||t in e)||nn(e,t,n)}function en(e,t){for(var r=e.length;r--;)if(za(e[r][0],t))return r;return-1}function tn(e,t,r,n){return dn(e,function(e,i,o){t(n,e,r(e),o)}),n}function rn(e,t){return e&&Ti(t,Fs(t),e)}function nn(e,t,r){"__proto__"==t&&at?at(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function on(e,t){for(var n=-1,i=t.length,o=we(i),a=null==e;++n<i;)o[n]=a?r:As(e,t[n]);return o}function an(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function sn(e,t,n,i,o,a){var s,l=1&t,c=2&t,u=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!Qa(e))return e;var d=Ha(e);if(d){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Re.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!l)return Ii(e,s)}else{var h=po(e),f=h==b||h==w;if(Ga(e))return Ci(e,l);if(h==_||h==p||f&&!o){if(s=c||f?{}:mo(e),!l)return c?function(e,t){return Ti(e,fo(e),t)}(e,function(e,t){return e&&Ti(t,Os(t),e)}(s,e)):function(e,t){return Ti(e,ho(e),t)}(e,rn(s,e))}else{if(!ot[h])return o?e:{};s=function(e,t,r){var n,i=e.constructor;switch(t){case F:return _i(e);case m:case v:return new i(+e);case O:return function(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case P:case M:case R:case L:case N:case j:case D:case z:case B:return Si(e,r);case x:return new i;case C:case E:return new i(e);case A:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case k:return new i;case I:return n=e,Nr?Ae(Nr.call(n)):{}}}(e,h,l)}}a||(a=new Gr);var g=a.get(e);if(g)return g;a.set(e,s),os(e)?e.forEach(function(r){s.add(sn(r,t,n,r,e,a))}):ts(e)&&e.forEach(function(r,i){s.set(i,sn(r,t,n,i,e,a))});var y=d?r:(u?c?no:ro:c?Os:Fs)(e);return At(y||e,function(r,i){y&&(r=e[i=r]),Qr(s,i,sn(r,t,n,i,e,a))}),s}function ln(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ae(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function cn(e,t,i){if("function"!=typeof e)throw new Ie(n);return Fo(function(){e.apply(r,i)},t)}function un(e,t,r,n){var i=-1,o=Tt,a=!0,s=e.length,l=[],c=t.length;if(!s)return l;r&&(t=Ot(t,Xt(r))),n?(o=Ft,a=!1):t.length>=200&&(o=Zt,a=!1,t=new qr(t));e:for(;++i<s;){var u=e[i],d=null==r?u:r(u);if(u=n||0!==u?u:0,a&&d==d){for(var h=c;h--;)if(t[h]===d)continue e;l.push(u)}else o(t,d,n)||l.push(u)}return l}Dr.templateSettings={escape:Y,evaluate:X,interpolate:K,variable:"",imports:{_:Dr}},Dr.prototype=Br.prototype,Dr.prototype.constructor=Dr,Ur.prototype=zr(Br.prototype),Ur.prototype.constructor=Ur,Vr.prototype=zr(Br.prototype),Vr.prototype.constructor=Vr,Hr.prototype.clear=function(){this.__data__=Er?Er(null):{},this.size=0},Hr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hr.prototype.get=function(e){var t=this.__data__;if(Er){var n=t[e];return n===i?r:n}return Re.call(t,e)?t[e]:r},Hr.prototype.has=function(e){var t=this.__data__;return Er?t[e]!==r:Re.call(t,e)},Hr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Er&&t===r?i:t,this},Wr.prototype.clear=function(){this.__data__=[],this.size=0},Wr.prototype.delete=function(e){var t=this.__data__,r=en(t,e);return!(r<0||(r==t.length-1?t.pop():Ye.call(t,r,1),--this.size,0))},Wr.prototype.get=function(e){var t=this.__data__,n=en(t,e);return n<0?r:t[n][1]},Wr.prototype.has=function(e){return en(this.__data__,e)>-1},Wr.prototype.set=function(e,t){var r=this.__data__,n=en(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},$r.prototype.clear=function(){this.size=0,this.__data__={hash:new Hr,map:new(_r||Wr),string:new Hr}},$r.prototype.delete=function(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t},$r.prototype.get=function(e){return lo(this,e).get(e)},$r.prototype.has=function(e){return lo(this,e).has(e)},$r.prototype.set=function(e,t){var r=lo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},qr.prototype.add=qr.prototype.push=function(e){return this.__data__.set(e,i),this},qr.prototype.has=function(e){return this.__data__.has(e)},Gr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Gr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Gr.prototype.get=function(e){return this.__data__.get(e)},Gr.prototype.has=function(e){return this.__data__.has(e)},Gr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!_r||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new $r(n)}return r.set(e,t),this.size=r.size,this};var dn=Pi(bn),hn=Pi(wn,!0);function fn(e,t){var r=!0;return dn(e,function(e,n,i){return r=!!t(e,n,i)}),r}function pn(e,t,n){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(l===r?s==s&&!ss(s):n(s,l)))var l=s,c=a}return c}function gn(e,t){var r=[];return dn(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r}function mn(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=vo),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?mn(s,t-1,r,n,i):Pt(i,s):n||(i[i.length]=s)}return i}var vn=Mi(),yn=Mi(!0);function bn(e,t){return e&&vn(e,t,Fs)}function wn(e,t){return e&&yn(e,t,Fs)}function xn(e,t){return It(t,function(t){return Ka(e[t])})}function Cn(e,t){for(var n=0,i=(t=yi(t,e)).length;null!=e&&n<i;)e=e[No(t[n++])];return n&&n==i?e:r}function _n(e,t,r){var n=t(e);return Ha(e)?n:Pt(n,r(e))}function Sn(e){return null==e?e===r?"[object Undefined]":"[object Null]":et&&et in Ae(e)?function(e){var t=Re.call(e,et),n=e[et];try{e[et]=r;var i=!0}catch(e){}var o=je.call(e);return i&&(t?e[et]=n:delete e[et]),o}(e):function(e){return je.call(e)}(e)}function An(e,t){return e>t}function kn(e,t){return null!=e&&Re.call(e,t)}function En(e,t){return null!=e&&t in Ae(e)}function In(e,t,n){for(var i=n?Ft:Tt,o=e[0].length,a=e.length,s=a,l=we(a),c=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Ot(d,Xt(t))),c=vr(d.length,c),l[s]=!n&&(t||o>=120&&d.length>=120)?new qr(s&&d):r}d=e[0];var h=-1,f=l[0];e:for(;++h<o&&u.length<c;){var p=d[h],g=t?t(p):p;if(p=n||0!==p?p:0,!(f?Zt(f,g):i(u,g,n))){for(s=a;--s;){var m=l[s];if(!(m?Zt(m,g):i(e[s],g,n)))continue e}f&&f.push(g),u.push(p)}}return u}function Tn(e,t,n){var i=null==(e=Eo(e,t=yi(t,e)))?e:e[No(Xo(t))];return null==i?r:_t(i,e,n)}function Fn(e){return es(e)&&Sn(e)==p}function On(e,t,n,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,n,i,o,a){var s=Ha(e),l=Ha(t),c=s?g:po(e),u=l?g:po(t),d=(c=c==p?_:c)==_,h=(u=u==p?_:u)==_,f=c==u;if(f&&Ga(e)){if(!Ga(t))return!1;s=!0,d=!1}if(f&&!d)return a||(a=new Gr),s||ls(e)?eo(e,t,n,i,o,a):function(e,t,r,n,i,o,a){switch(r){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case F:return!(e.byteLength!=t.byteLength||!o(new He(e),new He(t)));case m:case v:case C:return za(+e,+t);case y:return e.name==t.name&&e.message==t.message;case A:case E:return e==t+"";case x:var s=ir;case k:var l=1&n;if(s||(s=sr),e.size!=t.size&&!l)return!1;var c=a.get(e);if(c)return c==t;n|=2,a.set(e,t);var u=eo(s(e),s(t),n,i,o,a);return a.delete(e),u;case I:if(Nr)return Nr.call(e)==Nr.call(t)}return!1}(e,t,c,n,i,o,a);if(!(1&n)){var b=d&&Re.call(e,"__wrapped__"),w=h&&Re.call(t,"__wrapped__");if(b||w){var S=b?e.value():e,T=w?t.value():t;return a||(a=new Gr),o(S,T,n,i,a)}}return!!f&&(a||(a=new Gr),function(e,t,n,i,o,a){var s=1&n,l=ro(e),c=l.length,u=ro(t),d=u.length;if(c!=d&&!s)return!1;for(var h=c;h--;){var f=l[h];if(!(s?f in t:Re.call(t,f)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);for(var v=s;++h<c;){var y=e[f=l[h]],b=t[f];if(i)var w=s?i(b,y,f,t,e,a):i(y,b,f,e,t,a);if(!(w===r?y===b||o(y,b,n,i,a):w)){m=!1;break}v||(v="constructor"==f)}if(m&&!v){var x=e.constructor,C=t.constructor;x==C||!("constructor"in e)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof C&&C instanceof C||(m=!1)}return a.delete(e),a.delete(t),m}(e,t,n,i,o,a))}(e,t,n,i,On,o))}function Pn(e,t,n,i){var o=n.length,a=o,s=!i;if(null==e)return!a;for(e=Ae(e);o--;){var l=n[o];if(s&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++o<a;){var c=(l=n[o])[0],u=e[c],d=l[1];if(s&&l[2]){if(u===r&&!(c in e))return!1}else{var h=new Gr;if(i)var f=i(u,d,c,e,t,h);if(!(f===r?On(d,u,3,i,h):f))return!1}}return!0}function Mn(e){return!(!Qa(e)||(t=e,Ne&&Ne in t))&&(Ka(e)?Be:pe).test(jo(e));var t}function Rn(e){return"function"==typeof e?e:null==e?rl:"object"==typeof e?Ha(e)?Bn(e[0],e[1]):zn(e):dl(e)}function Ln(e){if(!_o(e))return gr(e);var t=[];for(var r in Ae(e))Re.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Nn(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var r in Ae(e))t.push(r);return t}(e);var t=_o(e),r=[];for(var n in e)("constructor"!=n||!t&&Re.call(e,n))&&r.push(n);return r}function jn(e,t){return e<t}function Dn(e,t){var r=-1,n=$a(e)?we(e.length):[];return dn(e,function(e,i,o){n[++r]=t(e,i,o)}),n}function zn(e){var t=co(e);return 1==t.length&&t[0][2]?Ao(t[0][0],t[0][1]):function(r){return r===e||Pn(r,e,t)}}function Bn(e,t){return wo(e)&&So(t)?Ao(No(e),t):function(n){var i=As(n,e);return i===r&&i===t?ks(n,e):On(t,i,3)}}function Un(e,t,n,i,o){e!==t&&vn(t,function(a,s){if(o||(o=new Gr),Qa(a))!function(e,t,n,i,o,a,s){var l=Io(e,n),c=Io(t,n),u=s.get(c);if(u)Jr(e,n,u);else{var d=a?a(l,c,n+"",e,t,s):r,h=d===r;if(h){var f=Ha(c),p=!f&&Ga(c),g=!f&&!p&&ls(c);d=c,f||p||g?Ha(l)?d=l:qa(l)?d=Ii(l):p?(h=!1,d=Ci(c,!0)):g?(h=!1,d=Si(c,!0)):d=[]:ns(c)||Va(c)?(d=l,Va(l)?d=ms(l):Qa(l)&&!Ka(l)||(d=mo(c))):h=!1}h&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Jr(e,n,d)}}(e,t,s,n,Un,i,o);else{var l=i?i(Io(e,s),a,s+"",e,t,o):r;l===r&&(l=a),Jr(e,s,l)}},Os)}function Vn(e,t){var n=e.length;if(n)return yo(t+=t<0?n:0,n)?e[t]:r}function Hn(e,t,r){t=t.length?Ot(t,function(e){return Ha(e)?function(t){return Cn(t,1===e.length?e[0]:e)}:e}):[rl];var n=-1;t=Ot(t,Xt(so()));var i=Dn(e,function(e,r,i){var o=Ot(t,function(t){return t(e)});return{criteria:o,index:++n,value:e}});return function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}(i,function(e,t){return function(e,t,r){for(var n=-1,i=e.criteria,o=t.criteria,a=i.length,s=r.length;++n<a;){var l=Ai(i[n],o[n]);if(l)return n>=s?l:l*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)})}function Wn(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Cn(e,a);r(s,a)&&Jn(o,yi(a,e),s)}return o}function $n(e,t,r,n){var i=n?Bt:zt,o=-1,a=t.length,s=e;for(e===t&&(t=Ii(t)),r&&(s=Ot(e,Xt(r)));++o<a;)for(var l=0,c=t[o],u=r?r(c):c;(l=i(s,u,l,n))>-1;)s!==e&&Ye.call(s,l,1),Ye.call(e,l,1);return e}function qn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;yo(i)?Ye.call(e,i,1):ui(e,i)}}return e}function Gn(e,t){return e+gt(wr()*(t-e+1))}function Yn(e,t){var r="";if(!e||t<1||t>u)return r;do{t%2&&(r+=e),(t=gt(t/2))&&(e+=e)}while(t);return r}function Xn(e,t){return Oo(ko(e,t,rl),e+"")}function Kn(e){return Xr(zs(e))}function Zn(e,t){var r=zs(e);return Ro(r,an(t,0,r.length))}function Jn(e,t,n,i){if(!Qa(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,l=e;null!=l&&++o<a;){var c=No(t[o]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var d=l[c];(u=i?i(d,c,l):r)===r&&(u=Qa(d)?d:yo(t[o+1])?[]:{})}Qr(l,c,u),l=l[c]}return e}var Qn=Ir?function(e,t){return Ir.set(e,t),e}:rl,ei=at?function(e,t){return at(e,"toString",{configurable:!0,enumerable:!1,value:Qs(t),writable:!0})}:rl;function ti(e){return Ro(zs(e))}function ri(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=we(i);++n<i;)o[n]=e[n+t];return o}function ni(e,t){var r;return dn(e,function(e,n,i){return!(r=t(e,n,i))}),!!r}function ii(e,t,r){var n=0,i=null==e?n:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;n<i;){var o=n+i>>>1,a=e[o];null!==a&&!ss(a)&&(r?a<=t:a<t)?n=o+1:i=o}return i}return oi(e,t,rl,r)}function oi(e,t,n,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,l=null===t,c=ss(t),u=t===r;o<a;){var d=gt((o+a)/2),h=n(e[d]),f=h!==r,p=null===h,g=h==h,m=ss(h);if(s)var v=i||g;else v=u?g&&(i||f):l?g&&f&&(i||!p):c?g&&f&&!p&&(i||!m):!p&&!m&&(i?h<=t:h<t);v?o=d+1:a=d}return vr(a,4294967294)}function ai(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r],s=t?t(a):a;if(!r||!za(s,l)){var l=s;o[i++]=0===a?0:a}}return o}function si(e){return"number"==typeof e?e:ss(e)?d:+e}function li(e){if("string"==typeof e)return e;if(Ha(e))return Ot(e,li)+"";if(ss(e))return jr?jr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,r){var n=-1,i=Tt,o=e.length,a=!0,s=[],l=s;if(r)a=!1,i=Ft;else if(o>=200){var c=t?null:Yi(e);if(c)return sr(c);a=!1,i=Zt,l=new qr}else l=t?[]:s;e:for(;++n<o;){var u=e[n],d=t?t(u):u;if(u=r||0!==u?u:0,a&&d==d){for(var h=l.length;h--;)if(l[h]===d)continue e;t&&l.push(d),s.push(u)}else i(l,d,r)||(l!==s&&l.push(d),s.push(u))}return s}function ui(e,t){return null==(e=Eo(e,t=yi(t,e)))||delete e[No(Xo(t))]}function di(e,t,r,n){return Jn(e,t,r(Cn(e,t)),n)}function hi(e,t,r,n){for(var i=e.length,o=n?i:-1;(n?o--:++o<i)&&t(e[o],o,e););return r?ri(e,n?0:o,n?o+1:i):ri(e,n?o+1:0,n?i:o)}function fi(e,t){var r=e;return r instanceof Vr&&(r=r.value()),Mt(t,function(e,t){return t.func.apply(t.thisArg,Pt([e],t.args))},r)}function pi(e,t,r){var n=e.length;if(n<2)return n?ci(e[0]):[];for(var i=-1,o=we(n);++i<n;)for(var a=e[i],s=-1;++s<n;)s!=i&&(o[i]=un(o[i]||a,e[s],t,r));return ci(mn(o,1),t,r)}function gi(e,t,n){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var l=i<a?t[i]:r;n(s,e[i],l)}return s}function mi(e){return qa(e)?e:[]}function vi(e){return"function"==typeof e?e:rl}function yi(e,t){return Ha(e)?e:wo(e,t)?[e]:Lo(vs(e))}var bi=Xn;function wi(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ri(e,t,n)}var xi=ct||function(e){return dt.clearTimeout(e)};function Ci(e,t){if(t)return e.slice();var r=e.length,n=We?We(r):new e.constructor(r);return e.copy(n),n}function _i(e){var t=new e.constructor(e.byteLength);return new He(t).set(new He(e)),t}function Si(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ai(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=ss(e),s=t!==r,l=null===t,c=t==t,u=ss(t);if(!l&&!u&&!a&&e>t||a&&s&&c&&!l&&!u||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!u&&e<t||u&&n&&o&&!i&&!a||l&&n&&o||!s&&o||!c)return-1}return 0}function ki(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,l=t.length,c=mr(o-a,0),u=we(l+c),d=!n;++s<l;)u[s]=t[s];for(;++i<a;)(d||i<o)&&(u[r[i]]=e[i]);for(;c--;)u[s++]=e[i++];return u}function Ei(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,l=-1,c=t.length,u=mr(o-s,0),d=we(u+c),h=!n;++i<u;)d[i]=e[i];for(var f=i;++l<c;)d[f+l]=t[l];for(;++a<s;)(h||i<o)&&(d[f+r[a]]=e[i++]);return d}function Ii(e,t){var r=-1,n=e.length;for(t||(t=we(n));++r<n;)t[r]=e[r];return t}function Ti(e,t,n,i){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var l=t[a],c=i?i(n[l],e[l],l,n,e):r;c===r&&(c=e[l]),o?nn(n,l,c):Qr(n,l,c)}return n}function Fi(e,t){return function(r,n){var i=Ha(r)?St:tn,o=t?t():{};return i(r,e,so(n,2),o)}}function Oi(e){return Xn(function(t,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&bo(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Ae(t);++i<o;){var l=n[i];l&&e(t,l,i,a)}return t})}function Pi(e,t){return function(r,n){if(null==r)return r;if(!$a(r))return e(r,n);for(var i=r.length,o=t?i:-1,a=Ae(r);(t?o--:++o<i)&&!1!==n(a[o],o,a););return r}}function Mi(e){return function(t,r,n){for(var i=-1,o=Ae(t),a=n(t),s=a.length;s--;){var l=a[e?s:++i];if(!1===r(o[l],l,o))break}return t}}function Ri(e){return function(t){var n=nr(t=vs(t))?ur(t):r,i=n?n[0]:t.charAt(0),o=n?wi(n,1).join(""):t.slice(1);return i[e]()+o}}function Li(e){return function(t){return Mt(Ks(Vs(t).replace(Ke,"")),e,"")}}function Ni(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=zr(e.prototype),n=e.apply(r,t);return Qa(n)?n:r}}function ji(e){return function(t,n,i){var o=Ae(t);if(!$a(t)){var a=so(n,3);t=Fs(t),n=function(e){return a(o[e],e,o)}}var s=e(t,n,i);return s>-1?o[a?t[s]:s]:r}}function Di(e){return to(function(t){var i=t.length,o=i,a=Ur.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ie(n);if(a&&!l&&"wrapper"==oo(s))var l=new Ur([],!0)}for(o=l?o:i;++o<i;){var c=oo(s=t[o]),u="wrapper"==c?io(s):r;l=u&&xo(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?l[oo(u[0])].apply(l,u[3]):1==s.length&&xo(s)?l[c]():l.thru(s)}return function(){var e=arguments,r=e[0];if(l&&1==e.length&&Ha(r))return l.plant(r).value();for(var n=0,o=i?t[n].apply(this,e):r;++n<i;)o=t[n].call(this,o);return o}})}function zi(e,t,n,i,o,a,l,c,u,d){var h=t&s,f=1&t,p=2&t,g=24&t,m=512&t,v=p?r:Ni(e);return function s(){for(var y=arguments.length,b=we(y),w=y;w--;)b[w]=arguments[w];if(g)var x=ao(s),C=function(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}(b,x);if(i&&(b=ki(b,i,o,g)),a&&(b=Ei(b,a,l,g)),y-=C,g&&y<d){var _=ar(b,x);return qi(e,t,zi,s.placeholder,n,b,_,c,u,d-y)}var S=f?n:this,A=p?S[e]:e;return y=b.length,c?b=function(e,t){for(var n=e.length,i=vr(t.length,n),o=Ii(e);i--;){var a=t[i];e[i]=yo(a,n)?o[a]:r}return e}(b,c):m&&y>1&&b.reverse(),h&&u<y&&(b.length=u),this&&this!==dt&&this instanceof s&&(A=v||Ni(A)),A.apply(S,b)}}function Bi(e,t){return function(r,n){return function(e,t,r,n){return bn(e,function(e,i,o){t(n,r(e),i,o)}),n}(r,e,t(n),{})}}function Ui(e,t){return function(n,i){var o;if(n===r&&i===r)return t;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=li(n),i=li(i)):(n=si(n),i=si(i)),o=e(n,i)}return o}}function Vi(e){return to(function(t){return t=Ot(t,Xt(so())),Xn(function(r){var n=this;return e(t,function(e){return _t(e,n,r)})})})}function Hi(e,t){var n=(t=t===r?" ":li(t)).length;if(n<2)return n?Yn(t,e):t;var i=Yn(t,ft(e/cr(t)));return nr(t)?wi(ur(i),0,e).join(""):i.slice(0,e)}function Wi(e){return function(t,n,i){return i&&"number"!=typeof i&&bo(t,n,i)&&(n=i=r),t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,r,n){for(var i=-1,o=mr(ft((t-e)/(r||1)),0),a=we(o);o--;)a[n?o:++i]=e,e+=r;return a}(t,n,i=i===r?t<n?1:-1:hs(i),e)}}function $i(e){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=gs(t),r=gs(r)),e(t,r)}}function qi(e,t,n,i,o,s,l,c,u,d){var h=8&t;t|=h?a:64,4&(t&=~(h?64:a))||(t&=-4);var f=[e,t,o,h?s:r,h?l:r,h?r:s,h?r:l,c,u,d],p=n.apply(r,f);return xo(e)&&To(p,f),p.placeholder=i,Po(p,e,t)}function Gi(e){var t=Se[e];return function(e,r){if(e=gs(e),(r=null==r?0:vr(fs(r),292))&&Wt(e)){var n=(vs(e)+"e").split("e");return+((n=(vs(t(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return t(e)}}var Yi=Ar&&1/sr(new Ar([,-0]))[1]==c?function(e){return new Ar(e)}:sl;function Xi(e){return function(t){var r=po(t);return r==x?ir(t):r==k?lr(t):function(e,t){return Ot(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,i,c,u,d,h,f){var p=2&t;if(!p&&"function"!=typeof e)throw new Ie(n);var g=c?c.length:0;if(g||(t&=-97,c=u=r),h=h===r?h:mr(fs(h),0),f=f===r?f:fs(f),g-=u?u.length:0,64&t){var m=c,v=u;c=u=r}var y=p?r:io(e),b=[e,t,i,c,u,m,v,d,h,f];if(y&&function(e,t){var r=e[1],n=t[1],i=r|n,a=i<131,c=n==s&&8==r||n==s&&r==l&&e[7].length<=t[8]||384==n&&t[7].length<=t[8]&&8==r;if(!a&&!c)return e;1&n&&(e[2]=t[2],i|=1&r?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?ki(d,u,t[4]):u,e[4]=d?ar(e[3],o):t[4]}(u=t[5])&&(d=e[5],e[5]=d?Ei(d,u,t[6]):u,e[6]=d?ar(e[5],o):t[6]),(u=t[7])&&(e[7]=u),n&s&&(e[8]=null==e[8]?t[8]:vr(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(b,y),e=b[0],t=b[1],i=b[2],c=b[3],u=b[4],!(f=b[9]=b[9]===r?p?0:e.length:mr(b[9]-g,0))&&24&t&&(t&=-25),t&&1!=t)w=8==t||16==t?function(e,t,n){var i=Ni(e);return function o(){for(var a=arguments.length,s=we(a),l=a,c=ao(o);l--;)s[l]=arguments[l];var u=a<3&&s[0]!==c&&s[a-1]!==c?[]:ar(s,c);return(a-=u.length)<n?qi(e,t,zi,o.placeholder,r,s,u,r,r,n-a):_t(this&&this!==dt&&this instanceof o?i:e,this,s)}}(e,t,f):t!=a&&33!=t||u.length?zi.apply(r,b):function(e,t,r,n){var i=1&t,o=Ni(e);return function t(){for(var a=-1,s=arguments.length,l=-1,c=n.length,u=we(c+s),d=this&&this!==dt&&this instanceof t?o:e;++l<c;)u[l]=n[l];for(;s--;)u[l++]=arguments[++a];return _t(d,i?r:this,u)}}(e,t,i,c);else var w=function(e,t,r){var n=1&t,i=Ni(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(n?r:this,arguments)}}(e,t,i);return Po((y?Qn:To)(w,b),e,t)}function Zi(e,t,n,i){return e===r||za(e,Oe[n])&&!Re.call(i,n)?t:e}function Ji(e,t,n,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Un(e,t,r,Ji,a),a.delete(t)),e}function Qi(e){return ns(e)?r:e}function eo(e,t,n,i,o,a){var s=1&n,l=e.length,c=t.length;if(l!=c&&!(s&&c>l))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var h=-1,f=!0,p=2&n?new qr:r;for(a.set(e,t),a.set(t,e);++h<l;){var g=e[h],m=t[h];if(i)var v=s?i(m,g,h,t,e,a):i(g,m,h,e,t,a);if(v!==r){if(v)continue;f=!1;break}if(p){if(!Lt(t,function(e,t){if(!Zt(p,t)&&(g===e||o(g,e,n,i,a)))return p.push(t)})){f=!1;break}}else if(g!==m&&!o(g,m,n,i,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function to(e){return Oo(ko(e,r,Wo),e+"")}function ro(e){return _n(e,Fs,ho)}function no(e){return _n(e,Os,fo)}var io=Ir?function(e){return Ir.get(e)}:sl;function oo(e){for(var t=e.name+"",r=Tr[t],n=Re.call(Tr,t)?r.length:0;n--;){var i=r[n],o=i.func;if(null==o||o==e)return i.name}return t}function ao(e){return(Re.call(Dr,"placeholder")?Dr:e).placeholder}function so(){var e=Dr.iteratee||nl;return e=e===nl?Rn:e,arguments.length?e(arguments[0],arguments[1]):e}function lo(e,t){var r,n,i=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function co(e){for(var t=Fs(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,So(i)]}return t}function uo(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return Mn(n)?n:r}var ho=mt?function(e){return null==e?[]:(e=Ae(e),It(mt(e),function(t){return Ge.call(e,t)}))}:pl,fo=mt?function(e){for(var t=[];e;)Pt(t,ho(e)),e=$e(e);return t}:pl,po=Sn;function go(e,t,r){for(var n=-1,i=(t=yi(t,e)).length,o=!1;++n<i;){var a=No(t[n]);if(!(o=null!=e&&r(e,a)))break;e=e[a]}return o||++n!=i?o:!!(i=null==e?0:e.length)&&Ja(i)&&yo(a,i)&&(Ha(e)||Va(e))}function mo(e){return"function"!=typeof e.constructor||_o(e)?{}:zr($e(e))}function vo(e){return Ha(e)||Va(e)||!!(Xe&&e&&e[Xe])}function yo(e,t){var r=typeof e;return!!(t=null==t?u:t)&&("number"==r||"symbol"!=r&&me.test(e))&&e>-1&&e%1==0&&e<t}function bo(e,t,r){if(!Qa(r))return!1;var n=typeof t;return!!("number"==n?$a(r)&&yo(t,r.length):"string"==n&&t in r)&&za(r[t],e)}function wo(e,t){if(Ha(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ss(e))||J.test(e)||!Z.test(e)||null!=t&&e in Ae(t)}function xo(e){var t=oo(e),r=Dr[t];if("function"!=typeof r||!(t in Vr.prototype))return!1;if(e===r)return!0;var n=io(r);return!!n&&e===n[0]}(Cr&&po(new Cr(new ArrayBuffer(1)))!=O||_r&&po(new _r)!=x||Sr&&po(Sr.resolve())!=S||Ar&&po(new Ar)!=k||kr&&po(new kr)!=T)&&(po=function(e){var t=Sn(e),n=t==_?e.constructor:r,i=n?jo(n):"";if(i)switch(i){case Fr:return O;case Or:return x;case Pr:return S;case Mr:return k;case Rr:return T}return t});var Co=Pe?Ka:gl;function _o(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Oe)}function So(e){return e==e&&!Qa(e)}function Ao(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in Ae(n))}}function ko(e,t,n){return t=mr(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=mr(r.length-t,0),a=we(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=we(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),_t(e,this,s)}}function Eo(e,t){return t.length<2?e:Cn(e,ri(t,0,-1))}function Io(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var To=Mo(Qn),Fo=ht||function(e,t){return dt.setTimeout(e,t)},Oo=Mo(ei);function Po(e,t,r){var n=t+"";return Oo(e,function(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return At(f,function(r){var n="_."+r[0];t&r[1]&&!Tt(e,n)&&e.push(n)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(n),r)))}function Mo(e){var t=0,n=0;return function(){var i=yr(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ro(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var a=Gn(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var Lo=function(e){var t=Ma(e,function(e){return 500===r.size&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,function(e,r,n,i){t.push(n?i.replace(ce,"$1"):r||e)}),t});function No(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function jo(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Do(e){if(e instanceof Vr)return e.clone();var t=new Ur(e.__wrapped__,e.__chain__);return t.__actions__=Ii(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var zo=Xn(function(e,t){return qa(e)?un(e,mn(t,1,qa,!0)):[]}),Bo=Xn(function(e,t){var n=Xo(t);return qa(n)&&(n=r),qa(e)?un(e,mn(t,1,qa,!0),so(n,2)):[]}),Uo=Xn(function(e,t){var n=Xo(t);return qa(n)&&(n=r),qa(e)?un(e,mn(t,1,qa,!0),r,n):[]});function Vo(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),Dt(e,so(t,3),i)}function Ho(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return n!==r&&(o=fs(n),o=n<0?mr(i+o,0):vr(o,i-1)),Dt(e,so(t,3),o,!0)}function Wo(e){return null!=e&&e.length?mn(e,1):[]}function $o(e){return e&&e.length?e[0]:r}var qo=Xn(function(e){var t=Ot(e,mi);return t.length&&t[0]===e[0]?In(t):[]}),Go=Xn(function(e){var t=Xo(e),n=Ot(e,mi);return t===Xo(n)?t=r:n.pop(),n.length&&n[0]===e[0]?In(n,so(t,2)):[]}),Yo=Xn(function(e){var t=Xo(e),n=Ot(e,mi);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?In(n,r,t):[]});function Xo(e){var t=null==e?0:e.length;return t?e[t-1]:r}var Ko=Xn(Zo);function Zo(e,t){return e&&e.length&&t&&t.length?$n(e,t):e}var Jo=to(function(e,t){var r=null==e?0:e.length,n=on(e,t);return qn(e,Ot(t,function(e){return yo(e,r)?+e:e}).sort(Ai)),n});function Qo(e){return null==e?e:xr.call(e)}var ea=Xn(function(e){return ci(mn(e,1,qa,!0))}),ta=Xn(function(e){var t=Xo(e);return qa(t)&&(t=r),ci(mn(e,1,qa,!0),so(t,2))}),ra=Xn(function(e){var t=Xo(e);return t="function"==typeof t?t:r,ci(mn(e,1,qa,!0),r,t)});function na(e){if(!e||!e.length)return[];var t=0;return e=It(e,function(e){if(qa(e))return t=mr(e.length,t),!0}),Gt(t,function(t){return Ot(e,Ht(t))})}function ia(e,t){if(!e||!e.length)return[];var n=na(e);return null==t?n:Ot(n,function(e){return _t(t,r,e)})}var oa=Xn(function(e,t){return qa(e)?un(e,t):[]}),aa=Xn(function(e){return pi(It(e,qa))}),sa=Xn(function(e){var t=Xo(e);return qa(t)&&(t=r),pi(It(e,qa),so(t,2))}),la=Xn(function(e){var t=Xo(e);return t="function"==typeof t?t:r,pi(It(e,qa),r,t)}),ca=Xn(na),ua=Xn(function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,ia(e,n)});function da(e){var t=Dr(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var fa=to(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return on(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vr&&yo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:r}),new Ur(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(o)}),pa=Fi(function(e,t,r){Re.call(e,r)?++e[r]:nn(e,r,1)}),ga=ji(Vo),ma=ji(Ho);function va(e,t){return(Ha(e)?At:dn)(e,so(t,3))}function ya(e,t){return(Ha(e)?kt:hn)(e,so(t,3))}var ba=Fi(function(e,t,r){Re.call(e,r)?e[r].push(t):nn(e,r,[t])}),wa=Xn(function(e,t,r){var n=-1,i="function"==typeof t,o=$a(e)?we(e.length):[];return dn(e,function(e){o[++n]=i?_t(t,e,r):Tn(e,t,r)}),o}),xa=Fi(function(e,t,r){nn(e,r,t)});function Ca(e,t){return(Ha(e)?Ot:Dn)(e,so(t,3))}var _a=Fi(function(e,t,r){e[r?0:1].push(t)},function(){return[[],[]]}),Sa=Xn(function(e,t){if(null==e)return[];var r=t.length;return r>1&&bo(e,t[0],t[1])?t=[]:r>2&&bo(t[0],t[1],t[2])&&(t=[t[0]]),Hn(e,mn(t,1),[])}),Aa=ut||function(){return dt.Date.now()};function ka(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ki(e,s,r,r,r,r,t)}function Ea(e,t){var i;if("function"!=typeof t)throw new Ie(n);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ia=Xn(function(e,t,r){var n=1;if(r.length){var i=ar(r,ao(Ia));n|=a}return Ki(e,n,t,r,i)}),Ta=Xn(function(e,t,r){var n=3;if(r.length){var i=ar(r,ao(Ta));n|=a}return Ki(t,n,e,r,i)});function Fa(e,t,i){var o,a,s,l,c,u,d=0,h=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ie(n);function g(t){var n=o,i=a;return o=a=r,d=t,l=e.apply(i,n)}function m(e){var n=e-u;return u===r||n>=t||n<0||f&&e-d>=s}function v(){var e=Aa();if(m(e))return y(e);c=Fo(v,function(e){var r=t-(e-u);return f?vr(r,s-(e-d)):r}(e))}function y(e){return c=r,p&&o?g(e):(o=a=r,l)}function b(){var e=Aa(),n=m(e);if(o=arguments,a=this,u=e,n){if(c===r)return function(e){return d=e,c=Fo(v,t),h?g(e):l}(u);if(f)return xi(c),c=Fo(v,t),g(u)}return c===r&&(c=Fo(v,t)),l}return t=gs(t)||0,Qa(i)&&(h=!!i.leading,s=(f="maxWait"in i)?mr(gs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),b.cancel=function(){c!==r&&xi(c),d=0,o=u=a=c=r},b.flush=function(){return c===r?l:y(Aa())},b}var Oa=Xn(function(e,t){return cn(e,1,t)}),Pa=Xn(function(e,t,r){return cn(e,gs(t)||0,r)});function Ma(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ie(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Ma.Cache||$r),r}function Ra(e){if("function"!=typeof e)throw new Ie(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ma.Cache=$r;var La=bi(function(e,t){var r=(t=1==t.length&&Ha(t[0])?Ot(t[0],Xt(so())):Ot(mn(t,1),Xt(so()))).length;return Xn(function(n){for(var i=-1,o=vr(n.length,r);++i<o;)n[i]=t[i].call(this,n[i]);return _t(e,this,n)})}),Na=Xn(function(e,t){var n=ar(t,ao(Na));return Ki(e,a,r,t,n)}),ja=Xn(function(e,t){var n=ar(t,ao(ja));return Ki(e,64,r,t,n)}),Da=to(function(e,t){return Ki(e,l,r,r,r,t)});function za(e,t){return e===t||e!=e&&t!=t}var Ba=$i(An),Ua=$i(function(e,t){return e>=t}),Va=Fn(function(){return arguments}())?Fn:function(e){return es(e)&&Re.call(e,"callee")&&!Ge.call(e,"callee")},Ha=we.isArray,Wa=vt?Xt(vt):function(e){return es(e)&&Sn(e)==F};function $a(e){return null!=e&&Ja(e.length)&&!Ka(e)}function qa(e){return es(e)&&$a(e)}var Ga=Nt||gl,Ya=yt?Xt(yt):function(e){return es(e)&&Sn(e)==v};function Xa(e){if(!es(e))return!1;var t=Sn(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!ns(e)}function Ka(e){if(!Qa(e))return!1;var t=Sn(e);return t==b||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==fs(e)}function Ja(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=bt?Xt(bt):function(e){return es(e)&&po(e)==x};function rs(e){return"number"==typeof e||es(e)&&Sn(e)==C}function ns(e){if(!es(e)||Sn(e)!=_)return!1;var t=$e(e);if(null===t)return!0;var r=Re.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Me.call(r)==De}var is=wt?Xt(wt):function(e){return es(e)&&Sn(e)==A},os=xt?Xt(xt):function(e){return es(e)&&po(e)==k};function as(e){return"string"==typeof e||!Ha(e)&&es(e)&&Sn(e)==E}function ss(e){return"symbol"==typeof e||es(e)&&Sn(e)==I}var ls=Ct?Xt(Ct):function(e){return es(e)&&Ja(e.length)&&!!it[Sn(e)]},cs=$i(jn),us=$i(function(e,t){return e<=t});function ds(e){if(!e)return[];if($a(e))return as(e)?ur(e):Ii(e);if(Je&&e[Je])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Je]());var t=po(e);return(t==x?ir:t==k?sr:zs)(e)}function hs(e){return e?(e=gs(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=hs(e),r=t%1;return t==t?r?t-r:t:0}function ps(e){return e?an(fs(e),0,h):0}function gs(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var r=fe.test(e);return r||ge.test(e)?lt(e.slice(2),r?2:8):he.test(e)?d:+e}function ms(e){return Ti(e,Os(e))}function vs(e){return null==e?"":li(e)}var ys=Oi(function(e,t){if(_o(t)||$a(t))Ti(t,Fs(t),e);else for(var r in t)Re.call(t,r)&&Qr(e,r,t[r])}),bs=Oi(function(e,t){Ti(t,Os(t),e)}),ws=Oi(function(e,t,r,n){Ti(t,Os(t),e,n)}),xs=Oi(function(e,t,r,n){Ti(t,Fs(t),e,n)}),Cs=to(on),_s=Xn(function(e,t){e=Ae(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&bo(t[0],t[1],o)&&(i=1);++n<i;)for(var a=t[n],s=Os(a),l=-1,c=s.length;++l<c;){var u=s[l],d=e[u];(d===r||za(d,Oe[u])&&!Re.call(e,u))&&(e[u]=a[u])}return e}),Ss=Xn(function(e){return e.push(r,Ji),_t(Ms,r,e)});function As(e,t,n){var i=null==e?r:Cn(e,t);return i===r?n:i}function ks(e,t){return null!=e&&go(e,t,En)}var Es=Bi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),e[t]=r},Qs(rl)),Is=Bi(function(e,t,r){null!=t&&"function"!=typeof t.toString&&(t=je.call(t)),Re.call(e,t)?e[t].push(r):e[t]=[r]},so),Ts=Xn(Tn);function Fs(e){return $a(e)?Yr(e):Ln(e)}function Os(e){return $a(e)?Yr(e,!0):Nn(e)}var Ps=Oi(function(e,t,r){Un(e,t,r)}),Ms=Oi(function(e,t,r,n){Un(e,t,r,n)}),Rs=to(function(e,t){var r={};if(null==e)return r;var n=!1;t=Ot(t,function(t){return t=yi(t,e),n||(n=t.length>1),t}),Ti(e,no(e),r),n&&(r=sn(r,7,Qi));for(var i=t.length;i--;)ui(r,t[i]);return r}),Ls=to(function(e,t){return null==e?{}:function(e,t){return Wn(e,t,function(t,r){return ks(e,r)})}(e,t)});function Ns(e,t){if(null==e)return{};var r=Ot(no(e),function(e){return[e]});return t=so(t),Wn(e,r,function(e,r){return t(e,r[0])})}var js=Xi(Fs),Ds=Xi(Os);function zs(e){return null==e?[]:Kt(e,Fs(e))}var Bs=Li(function(e,t,r){return t=t.toLowerCase(),e+(r?Us(t):t)});function Us(e){return Xs(vs(e).toLowerCase())}function Vs(e){return(e=vs(e))&&e.replace(ve,er).replace(Ze,"")}var Hs=Li(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()}),Ws=Li(function(e,t,r){return e+(r?" ":"")+t.toLowerCase()}),$s=Ri("toLowerCase"),qs=Li(function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}),Gs=Li(function(e,t,r){return e+(r?" ":"")+Xs(t)}),Ys=Li(function(e,t,r){return e+(r?" ":"")+t.toUpperCase()}),Xs=Ri("toUpperCase");function Ks(e,t,n){return e=vs(e),(t=n?r:t)===r?function(e){return tt.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Xn(function(e,t){try{return _t(e,r,t)}catch(e){return Xa(e)?e:new Ce(e)}}),Js=to(function(e,t){return At(t,function(t){t=No(t),nn(e,t,Ia(e[t],e))}),e});function Qs(e){return function(){return e}}var el=Di(),tl=Di(!0);function rl(e){return e}function nl(e){return Rn("function"==typeof e?e:sn(e,1))}var il=Xn(function(e,t){return function(r){return Tn(r,e,t)}}),ol=Xn(function(e,t){return function(r){return Tn(e,r,t)}});function al(e,t,r){var n=Fs(t),i=xn(t,n);null!=r||Qa(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=xn(t,Fs(t)));var o=!(Qa(r)&&"chain"in r&&!r.chain),a=Ka(e);return At(i,function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ii(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Pt([this.value()],arguments))})}),e}function sl(){}var ll=Vi(Ot),cl=Vi(Et),ul=Vi(Lt);function dl(e){return wo(e)?Ht(No(e)):function(e){return function(t){return Cn(t,e)}}(e)}var hl=Wi(),fl=Wi(!0);function pl(){return[]}function gl(){return!1}var ml,vl=Ui(function(e,t){return e+t},0),yl=Gi("ceil"),bl=Ui(function(e,t){return e/t},1),wl=Gi("floor"),xl=Ui(function(e,t){return e*t},1),Cl=Gi("round"),_l=Ui(function(e,t){return e-t},0);return Dr.after=function(e,t){if("function"!=typeof t)throw new Ie(n);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Dr.ary=ka,Dr.assign=ys,Dr.assignIn=bs,Dr.assignInWith=ws,Dr.assignWith=xs,Dr.at=Cs,Dr.before=Ea,Dr.bind=Ia,Dr.bindAll=Js,Dr.bindKey=Ta,Dr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ha(e)?e:[e]},Dr.chain=da,Dr.chunk=function(e,t,n){t=(n?bo(e,t,n):t===r)?1:mr(fs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=we(ft(i/t));o<i;)s[a++]=ri(e,o,o+=t);return s},Dr.compact=function(e){for(var t=-1,r=null==e?0:e.length,n=0,i=[];++t<r;){var o=e[t];o&&(i[n++]=o)}return i},Dr.concat=function(){var e=arguments.length;if(!e)return[];for(var t=we(e-1),r=arguments[0],n=e;n--;)t[n-1]=arguments[n];return Pt(Ha(r)?Ii(r):[r],mn(t,1))},Dr.cond=function(e){var t=null==e?0:e.length,r=so();return e=t?Ot(e,function(e){if("function"!=typeof e[1])throw new Ie(n);return[r(e[0]),e[1]]}):[],Xn(function(r){for(var n=-1;++n<t;){var i=e[n];if(_t(i[0],this,r))return _t(i[1],this,r)}})},Dr.conforms=function(e){return function(e){var t=Fs(e);return function(r){return ln(r,e,t)}}(sn(e,1))},Dr.constant=Qs,Dr.countBy=pa,Dr.create=function(e,t){var r=zr(e);return null==t?r:rn(r,t)},Dr.curry=function e(t,n,i){var o=Ki(t,8,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Dr.curryRight=function e(t,n,i){var o=Ki(t,16,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Dr.debounce=Fa,Dr.defaults=_s,Dr.defaultsDeep=Ss,Dr.defer=Oa,Dr.delay=Pa,Dr.difference=zo,Dr.differenceBy=Bo,Dr.differenceWith=Uo,Dr.drop=function(e,t,n){var i=null==e?0:e.length;return i?ri(e,(t=n||t===r?1:fs(t))<0?0:t,i):[]},Dr.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ri(e,0,(t=i-(t=n||t===r?1:fs(t)))<0?0:t):[]},Dr.dropRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0,!0):[]},Dr.dropWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!0):[]},Dr.fill=function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&bo(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=fs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:fs(i))<0&&(i+=o),i=n>i?0:ps(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Dr.filter=function(e,t){return(Ha(e)?It:gn)(e,so(t,3))},Dr.flatMap=function(e,t){return mn(Ca(e,t),1)},Dr.flatMapDeep=function(e,t){return mn(Ca(e,t),c)},Dr.flatMapDepth=function(e,t,n){return n=n===r?1:fs(n),mn(Ca(e,t),n)},Dr.flatten=Wo,Dr.flattenDeep=function(e){return null!=e&&e.length?mn(e,c):[]},Dr.flattenDepth=function(e,t){return null!=e&&e.length?mn(e,t=t===r?1:fs(t)):[]},Dr.flip=function(e){return Ki(e,512)},Dr.flow=el,Dr.flowRight=tl,Dr.fromPairs=function(e){for(var t=-1,r=null==e?0:e.length,n={};++t<r;){var i=e[t];n[i[0]]=i[1]}return n},Dr.functions=function(e){return null==e?[]:xn(e,Fs(e))},Dr.functionsIn=function(e){return null==e?[]:xn(e,Os(e))},Dr.groupBy=ba,Dr.initial=function(e){return null!=e&&e.length?ri(e,0,-1):[]},Dr.intersection=qo,Dr.intersectionBy=Go,Dr.intersectionWith=Yo,Dr.invert=Es,Dr.invertBy=Is,Dr.invokeMap=wa,Dr.iteratee=nl,Dr.keyBy=xa,Dr.keys=Fs,Dr.keysIn=Os,Dr.map=Ca,Dr.mapKeys=function(e,t){var r={};return t=so(t,3),bn(e,function(e,n,i){nn(r,t(e,n,i),e)}),r},Dr.mapValues=function(e,t){var r={};return t=so(t,3),bn(e,function(e,n,i){nn(r,n,t(e,n,i))}),r},Dr.matches=function(e){return zn(sn(e,1))},Dr.matchesProperty=function(e,t){return Bn(e,sn(t,1))},Dr.memoize=Ma,Dr.merge=Ps,Dr.mergeWith=Ms,Dr.method=il,Dr.methodOf=ol,Dr.mixin=al,Dr.negate=Ra,Dr.nthArg=function(e){return e=fs(e),Xn(function(t){return Vn(t,e)})},Dr.omit=Rs,Dr.omitBy=function(e,t){return Ns(e,Ra(so(t)))},Dr.once=function(e){return Ea(2,e)},Dr.orderBy=function(e,t,n,i){return null==e?[]:(Ha(t)||(t=null==t?[]:[t]),Ha(n=i?r:n)||(n=null==n?[]:[n]),Hn(e,t,n))},Dr.over=ll,Dr.overArgs=La,Dr.overEvery=cl,Dr.overSome=ul,Dr.partial=Na,Dr.partialRight=ja,Dr.partition=_a,Dr.pick=Ls,Dr.pickBy=Ns,Dr.property=dl,Dr.propertyOf=function(e){return function(t){return null==e?r:Cn(e,t)}},Dr.pull=Ko,Dr.pullAll=Zo,Dr.pullAllBy=function(e,t,r){return e&&e.length&&t&&t.length?$n(e,t,so(r,2)):e},Dr.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?$n(e,t,r,n):e},Dr.pullAt=Jo,Dr.range=hl,Dr.rangeRight=fl,Dr.rearg=Da,Dr.reject=function(e,t){return(Ha(e)?It:gn)(e,Ra(so(t,3)))},Dr.remove=function(e,t){var r=[];if(!e||!e.length)return r;var n=-1,i=[],o=e.length;for(t=so(t,3);++n<o;){var a=e[n];t(a,n,e)&&(r.push(a),i.push(n))}return qn(e,i),r},Dr.rest=function(e,t){if("function"!=typeof e)throw new Ie(n);return Xn(e,t=t===r?t:fs(t))},Dr.reverse=Qo,Dr.sampleSize=function(e,t,n){return t=(n?bo(e,t,n):t===r)?1:fs(t),(Ha(e)?Kr:Zn)(e,t)},Dr.set=function(e,t,r){return null==e?e:Jn(e,t,r)},Dr.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Jn(e,t,n,i)},Dr.shuffle=function(e){return(Ha(e)?Zr:ti)(e)},Dr.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&bo(e,t,n)?(t=0,n=i):(t=null==t?0:fs(t),n=n===r?i:fs(n)),ri(e,t,n)):[]},Dr.sortBy=Sa,Dr.sortedUniq=function(e){return e&&e.length?ai(e):[]},Dr.sortedUniqBy=function(e,t){return e&&e.length?ai(e,so(t,2)):[]},Dr.split=function(e,t,n){return n&&"number"!=typeof n&&bo(e,t,n)&&(t=n=r),(n=n===r?h:n>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=li(t))&&nr(e)?wi(ur(e),0,n):e.split(t,n):[]},Dr.spread=function(e,t){if("function"!=typeof e)throw new Ie(n);return t=null==t?0:mr(fs(t),0),Xn(function(r){var n=r[t],i=wi(r,0,t);return n&&Pt(i,n),_t(e,this,i)})},Dr.tail=function(e){var t=null==e?0:e.length;return t?ri(e,1,t):[]},Dr.take=function(e,t,n){return e&&e.length?ri(e,0,(t=n||t===r?1:fs(t))<0?0:t):[]},Dr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ri(e,(t=i-(t=n||t===r?1:fs(t)))<0?0:t,i):[]},Dr.takeRightWhile=function(e,t){return e&&e.length?hi(e,so(t,3),!1,!0):[]},Dr.takeWhile=function(e,t){return e&&e.length?hi(e,so(t,3)):[]},Dr.tap=function(e,t){return t(e),e},Dr.throttle=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw new Ie(n);return Qa(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Fa(e,t,{leading:i,maxWait:t,trailing:o})},Dr.thru=ha,Dr.toArray=ds,Dr.toPairs=js,Dr.toPairsIn=Ds,Dr.toPath=function(e){return Ha(e)?Ot(e,No):ss(e)?[e]:Ii(Lo(vs(e)))},Dr.toPlainObject=ms,Dr.transform=function(e,t,r){var n=Ha(e),i=n||Ga(e)||ls(e);if(t=so(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:Qa(e)&&Ka(o)?zr($e(e)):{}}return(i?At:bn)(e,function(e,n,i){return t(r,e,n,i)}),r},Dr.unary=function(e){return ka(e,1)},Dr.union=ea,Dr.unionBy=ta,Dr.unionWith=ra,Dr.uniq=function(e){return e&&e.length?ci(e):[]},Dr.uniqBy=function(e,t){return e&&e.length?ci(e,so(t,2)):[]},Dr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?ci(e,r,t):[]},Dr.unset=function(e,t){return null==e||ui(e,t)},Dr.unzip=na,Dr.unzipWith=ia,Dr.update=function(e,t,r){return null==e?e:di(e,t,vi(r))},Dr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:di(e,t,vi(n),i)},Dr.values=zs,Dr.valuesIn=function(e){return null==e?[]:Kt(e,Os(e))},Dr.without=oa,Dr.words=Ks,Dr.wrap=function(e,t){return Na(vi(t),e)},Dr.xor=aa,Dr.xorBy=sa,Dr.xorWith=la,Dr.zip=ca,Dr.zipObject=function(e,t){return gi(e||[],t||[],Qr)},Dr.zipObjectDeep=function(e,t){return gi(e||[],t||[],Jn)},Dr.zipWith=ua,Dr.entries=js,Dr.entriesIn=Ds,Dr.extend=bs,Dr.extendWith=ws,al(Dr,Dr),Dr.add=vl,Dr.attempt=Zs,Dr.camelCase=Bs,Dr.capitalize=Us,Dr.ceil=yl,Dr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=gs(n))==n?n:0),t!==r&&(t=(t=gs(t))==t?t:0),an(gs(e),t,n)},Dr.clone=function(e){return sn(e,4)},Dr.cloneDeep=function(e){return sn(e,5)},Dr.cloneDeepWith=function(e,t){return sn(e,5,t="function"==typeof t?t:r)},Dr.cloneWith=function(e,t){return sn(e,4,t="function"==typeof t?t:r)},Dr.conformsTo=function(e,t){return null==t||ln(e,t,Fs(t))},Dr.deburr=Vs,Dr.defaultTo=function(e,t){return null==e||e!=e?t:e},Dr.divide=bl,Dr.endsWith=function(e,t,n){e=vs(e),t=li(t);var i=e.length,o=n=n===r?i:an(fs(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Dr.eq=za,Dr.escape=function(e){return(e=vs(e))&&G.test(e)?e.replace($,tr):e},Dr.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Dr.every=function(e,t,n){var i=Ha(e)?Et:fn;return n&&bo(e,t,n)&&(t=r),i(e,so(t,3))},Dr.find=ga,Dr.findIndex=Vo,Dr.findKey=function(e,t){return jt(e,so(t,3),bn)},Dr.findLast=ma,Dr.findLastIndex=Ho,Dr.findLastKey=function(e,t){return jt(e,so(t,3),wn)},Dr.floor=wl,Dr.forEach=va,Dr.forEachRight=ya,Dr.forIn=function(e,t){return null==e?e:vn(e,so(t,3),Os)},Dr.forInRight=function(e,t){return null==e?e:yn(e,so(t,3),Os)},Dr.forOwn=function(e,t){return e&&bn(e,so(t,3))},Dr.forOwnRight=function(e,t){return e&&wn(e,so(t,3))},Dr.get=As,Dr.gt=Ba,Dr.gte=Ua,Dr.has=function(e,t){return null!=e&&go(e,t,kn)},Dr.hasIn=ks,Dr.head=$o,Dr.identity=rl,Dr.includes=function(e,t,r,n){e=$a(e)?e:zs(e),r=r&&!n?fs(r):0;var i=e.length;return r<0&&(r=mr(i+r,0)),as(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&zt(e,t,r)>-1},Dr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:fs(r);return i<0&&(i=mr(n+i,0)),zt(e,t,i)},Dr.inRange=function(e,t,n){return t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,r){return e>=vr(t,r)&&e<mr(t,r)}(e=gs(e),t,n)},Dr.invoke=Ts,Dr.isArguments=Va,Dr.isArray=Ha,Dr.isArrayBuffer=Wa,Dr.isArrayLike=$a,Dr.isArrayLikeObject=qa,Dr.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sn(e)==m},Dr.isBuffer=Ga,Dr.isDate=Ya,Dr.isElement=function(e){return es(e)&&1===e.nodeType&&!ns(e)},Dr.isEmpty=function(e){if(null==e)return!0;if($a(e)&&(Ha(e)||"string"==typeof e||"function"==typeof e.splice||Ga(e)||ls(e)||Va(e)))return!e.length;var t=po(e);if(t==x||t==k)return!e.size;if(_o(e))return!Ln(e).length;for(var r in e)if(Re.call(e,r))return!1;return!0},Dr.isEqual=function(e,t){return On(e,t)},Dr.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?On(e,t,r,n):!!i},Dr.isError=Xa,Dr.isFinite=function(e){return"number"==typeof e&&Wt(e)},Dr.isFunction=Ka,Dr.isInteger=Za,Dr.isLength=Ja,Dr.isMap=ts,Dr.isMatch=function(e,t){return e===t||Pn(e,t,co(t))},Dr.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,Pn(e,t,co(t),n)},Dr.isNaN=function(e){return rs(e)&&e!=+e},Dr.isNative=function(e){if(Co(e))throw new Ce("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Mn(e)},Dr.isNil=function(e){return null==e},Dr.isNull=function(e){return null===e},Dr.isNumber=rs,Dr.isObject=Qa,Dr.isObjectLike=es,Dr.isPlainObject=ns,Dr.isRegExp=is,Dr.isSafeInteger=function(e){return Za(e)&&e>=-9007199254740991&&e<=u},Dr.isSet=os,Dr.isString=as,Dr.isSymbol=ss,Dr.isTypedArray=ls,Dr.isUndefined=function(e){return e===r},Dr.isWeakMap=function(e){return es(e)&&po(e)==T},Dr.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sn(e)},Dr.join=function(e,t){return null==e?"":pr.call(e,t)},Dr.kebabCase=Hs,Dr.last=Xo,Dr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=fs(n))<0?mr(i+o,0):vr(o,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):Dt(e,Ut,o,!0)},Dr.lowerCase=Ws,Dr.lowerFirst=$s,Dr.lt=cs,Dr.lte=us,Dr.max=function(e){return e&&e.length?pn(e,rl,An):r},Dr.maxBy=function(e,t){return e&&e.length?pn(e,so(t,2),An):r},Dr.mean=function(e){return Vt(e,rl)},Dr.meanBy=function(e,t){return Vt(e,so(t,2))},Dr.min=function(e){return e&&e.length?pn(e,rl,jn):r},Dr.minBy=function(e,t){return e&&e.length?pn(e,so(t,2),jn):r},Dr.stubArray=pl,Dr.stubFalse=gl,Dr.stubObject=function(){return{}},Dr.stubString=function(){return""},Dr.stubTrue=function(){return!0},Dr.multiply=xl,Dr.nth=function(e,t){return e&&e.length?Vn(e,fs(t)):r},Dr.noConflict=function(){return dt._===this&&(dt._=ze),this},Dr.noop=sl,Dr.now=Aa,Dr.pad=function(e,t,r){e=vs(e);var n=(t=fs(t))?cr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Hi(gt(i),r)+e+Hi(ft(i),r)},Dr.padEnd=function(e,t,r){e=vs(e);var n=(t=fs(t))?cr(e):0;return t&&n<t?e+Hi(t-n,r):e},Dr.padStart=function(e,t,r){e=vs(e);var n=(t=fs(t))?cr(e):0;return t&&n<t?Hi(t-n,r)+e:e},Dr.parseInt=function(e,t,r){return r||null==t?t=0:t&&(t=+t),br(vs(e).replace(re,""),t||0)},Dr.random=function(e,t,n){if(n&&"boolean"!=typeof n&&bo(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=hs(e),t===r?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=wr();return vr(e+o*(t-e+st("1e-"+((o+"").length-1))),t)}return Gn(e,t)},Dr.reduce=function(e,t,r){var n=Ha(e)?Mt:$t,i=arguments.length<3;return n(e,so(t,4),r,i,dn)},Dr.reduceRight=function(e,t,r){var n=Ha(e)?Rt:$t,i=arguments.length<3;return n(e,so(t,4),r,i,hn)},Dr.repeat=function(e,t,n){return t=(n?bo(e,t,n):t===r)?1:fs(t),Yn(vs(e),t)},Dr.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dr.result=function(e,t,n){var i=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=r);++i<o;){var a=null==e?r:e[No(t[i])];a===r&&(i=o,a=n),e=Ka(a)?a.call(e):a}return e},Dr.round=Cl,Dr.runInContext=e,Dr.sample=function(e){return(Ha(e)?Xr:Kn)(e)},Dr.size=function(e){if(null==e)return 0;if($a(e))return as(e)?cr(e):e.length;var t=po(e);return t==x||t==k?e.size:Ln(e).length},Dr.snakeCase=qs,Dr.some=function(e,t,n){var i=Ha(e)?Lt:ni;return n&&bo(e,t,n)&&(t=r),i(e,so(t,3))},Dr.sortedIndex=function(e,t){return ii(e,t)},Dr.sortedIndexBy=function(e,t,r){return oi(e,t,so(r,2))},Dr.sortedIndexOf=function(e,t){var r=null==e?0:e.length;if(r){var n=ii(e,t);if(n<r&&za(e[n],t))return n}return-1},Dr.sortedLastIndex=function(e,t){return ii(e,t,!0)},Dr.sortedLastIndexBy=function(e,t,r){return oi(e,t,so(r,2),!0)},Dr.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var r=ii(e,t,!0)-1;if(za(e[r],t))return r}return-1},Dr.startCase=Gs,Dr.startsWith=function(e,t,r){return e=vs(e),r=null==r?0:an(fs(r),0,e.length),t=li(t),e.slice(r,r+t.length)==t},Dr.subtract=_l,Dr.sum=function(e){return e&&e.length?qt(e,rl):0},Dr.sumBy=function(e,t){return e&&e.length?qt(e,so(t,2)):0},Dr.template=function(e,t,n){var i=Dr.templateSettings;n&&bo(e,t,n)&&(t=r),e=vs(e),t=ws({},t,i,Zi);var o,a,s=ws({},t.imports,i.imports,Zi),l=Fs(s),c=Kt(s,l),u=0,d=t.interpolate||ye,h="__p += '",f=ke((t.escape||ye).source+"|"+d.source+"|"+(d===K?ue:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),p="//# sourceURL="+(Re.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(f,function(t,r,n,i,s,l){return n||(n=i),h+=e.slice(u,l).replace(be,rr),r&&(o=!0,h+="' +\n__e("+r+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),n&&(h+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),u=l+t.length,t}),h+="';\n";var g=Re.call(t,"variable")&&t.variable;if(g){if(le.test(g))throw new Ce("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(U,""):h).replace(V,"$1").replace(H,"$1;"),h="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var m=Zs(function(){return _e(l,p+"return "+h).apply(r,c)});if(m.source=h,Xa(m))throw m;return m},Dr.times=function(e,t){if((e=fs(e))<1||e>u)return[];var r=h,n=vr(e,h);t=so(t),e-=h;for(var i=Gt(n,t);++r<e;)t(r);return i},Dr.toFinite=hs,Dr.toInteger=fs,Dr.toLength=ps,Dr.toLower=function(e){return vs(e).toLowerCase()},Dr.toNumber=gs,Dr.toSafeInteger=function(e){return e?an(fs(e),-9007199254740991,u):0===e?e:0},Dr.toString=vs,Dr.toUpper=function(e){return vs(e).toUpperCase()},Dr.trim=function(e,t,n){if((e=vs(e))&&(n||t===r))return Yt(e);if(!e||!(t=li(t)))return e;var i=ur(e),o=ur(t);return wi(i,Jt(i,o),Qt(i,o)+1).join("")},Dr.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.slice(0,dr(e)+1);if(!e||!(t=li(t)))return e;var i=ur(e);return wi(i,0,Qt(i,ur(t))+1).join("")},Dr.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.replace(re,"");if(!e||!(t=li(t)))return e;var i=ur(e);return wi(i,Jt(i,ur(t))).join("")},Dr.truncate=function(e,t){var n=30,i="...";if(Qa(t)){var o="separator"in t?t.separator:o;n="length"in t?fs(t.length):n,i="omission"in t?li(t.omission):i}var a=(e=vs(e)).length;if(nr(e)){var s=ur(e);a=s.length}if(n>=a)return e;var l=n-cr(i);if(l<1)return i;var c=s?wi(s,0,l).join(""):e.slice(0,l);if(o===r)return c+i;if(s&&(l+=c.length-l),is(o)){if(e.slice(l).search(o)){var u,d=c;for(o.global||(o=ke(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var h=u.index;c=c.slice(0,h===r?l:h)}}else if(e.indexOf(li(o),l)!=l){var f=c.lastIndexOf(o);f>-1&&(c=c.slice(0,f))}return c+i},Dr.unescape=function(e){return(e=vs(e))&&q.test(e)?e.replace(W,hr):e},Dr.uniqueId=function(e){var t=++Le;return vs(e)+t},Dr.upperCase=Ys,Dr.upperFirst=Xs,Dr.each=va,Dr.eachRight=ya,Dr.first=$o,al(Dr,(ml={},bn(Dr,function(e,t){Re.call(Dr.prototype,t)||(ml[t]=e)}),ml),{chain:!1}),Dr.VERSION="4.17.21",At(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dr[e].placeholder=Dr}),At(["drop","take"],function(e,t){Vr.prototype[e]=function(n){n=n===r?1:mr(fs(n),0);var i=this.__filtered__&&!t?new Vr(this):this.clone();return i.__filtered__?i.__takeCount__=vr(n,i.__takeCount__):i.__views__.push({size:vr(n,h),type:e+(i.__dir__<0?"Right":"")}),i},Vr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),At(["filter","map","takeWhile"],function(e,t){var r=t+1,n=1==r||3==r;Vr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:so(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}}),At(["head","last"],function(e,t){var r="take"+(t?"Right":"");Vr.prototype[e]=function(){return this[r](1).value()[0]}}),At(["initial","tail"],function(e,t){var r="drop"+(t?"":"Right");Vr.prototype[e]=function(){return this.__filtered__?new Vr(this):this[r](1)}}),Vr.prototype.compact=function(){return this.filter(rl)},Vr.prototype.find=function(e){return this.filter(e).head()},Vr.prototype.findLast=function(e){return this.reverse().find(e)},Vr.prototype.invokeMap=Xn(function(e,t){return"function"==typeof e?new Vr(this):this.map(function(r){return Tn(r,e,t)})}),Vr.prototype.reject=function(e){return this.filter(Ra(so(e)))},Vr.prototype.slice=function(e,t){e=fs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=fs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vr.prototype.toArray=function(){return this.take(h)},bn(Vr.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Dr[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Dr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,l=t instanceof Vr,c=s[0],u=l||Ha(t),d=function(e){var t=o.apply(Dr,Pt([e],s));return i&&h?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(l=u=!1);var h=this.__chain__,f=!!this.__actions__.length,p=a&&!h,g=l&&!f;if(!a&&u){t=g?t:new Vr(this);var m=e.apply(t,s);return m.__actions__.push({func:ha,args:[d],thisArg:r}),new Ur(m,h)}return p&&g?e.apply(this,s):(m=this.thru(d),p?i?m.value()[0]:m.value():m)})}),At(["pop","push","shift","sort","splice","unshift"],function(e){var t=Te[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Dr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ha(i)?i:[],e)}return this[r](function(r){return t.apply(Ha(r)?r:[],e)})}}),bn(Vr.prototype,function(e,t){var r=Dr[t];if(r){var n=r.name+"";Re.call(Tr,n)||(Tr[n]=[]),Tr[n].push({name:t,func:r})}}),Tr[zi(r,2).name]=[{name:"wrapper",func:r}],Vr.prototype.clone=function(){var e=new Vr(this.__wrapped__);return e.__actions__=Ii(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ii(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ii(this.__views__),e},Vr.prototype.reverse=function(){if(this.__filtered__){var e=new Vr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ha(e),n=t<0,i=r?e.length:0,o=function(e,t,r){for(var n=-1,i=r.length;++n<i;){var o=r[n],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=vr(t,e+a);break;case"takeRight":e=mr(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,l=s-a,c=n?s:a-1,u=this.__iteratees__,d=u.length,h=0,f=vr(l,this.__takeCount__);if(!r||!n&&i==l&&f==l)return fi(e,this.__actions__);var p=[];e:for(;l--&&h<f;){for(var g=-1,m=e[c+=t];++g<d;){var v=u[g],y=v.iteratee,b=v.type,w=y(m);if(2==b)m=w;else if(!w){if(1==b)continue e;break e}}p[h++]=m}return p},Dr.prototype.at=fa,Dr.prototype.chain=function(){return da(this)},Dr.prototype.commit=function(){return new Ur(this.value(),this.__chain__)},Dr.prototype.next=function(){this.__values__===r&&(this.__values__=ds(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Dr.prototype.plant=function(e){for(var t,n=this;n instanceof Br;){var i=Do(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Dr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vr){var t=e;return this.__actions__.length&&(t=new Vr(this)),(t=t.reverse()).__actions__.push({func:ha,args:[Qo],thisArg:r}),new Ur(t,this.__chain__)}return this.thru(Qo)},Dr.prototype.toJSON=Dr.prototype.valueOf=Dr.prototype.value=function(){return fi(this.__wrapped__,this.__actions__)},Dr.prototype.first=Dr.prototype.head,Je&&(Dr.prototype[Je]=function(){return this}),Dr}();ft?((ft.exports=fr)._=fr,ht._=fr):dt._=fr}).call(_o)}(Co,Co.exports)),Co.exports);const Ao=e=>null===e.parentId||"null"===e.parentId||!e.parentId,ko=async(e,t,r)=>{var n;if("file"===(null==t?void 0:t.itemType))return e;let i=[];if(!r)return e;{const e=await r({parentId:t.folderId});i=Array.isArray(e)?e:[]}let o=((e,t)=>{const r=Array.isArray(e)?e:[];return(n=t.folderId)&&"root"!==n&&"folders"!==n&&"null"!==n&&null!==n?r.filter(e=>e.parentId===t.folderId):r.filter(Ao);var n})(i,t);if(null===(n=null==t?void 0:t.search)||void 0===n?void 0:n.trim()){const e=t.search.trim().toLowerCase();o=o.filter(t=>{var r;return null===(r=t.name)||void 0===r?void 0:r.toLowerCase().includes(e)})}if(0===o.length)return e;const a=o.map(e=>({id:e.id,name:e.name,size:void 0,date:"-",isFolder:!0,folderId:e.parentId||"",type:"",selected:!1,extension:"",childCount:e.childCount}));if("folder"===(null==t?void 0:t.itemType))return a;const s=e.filter(e=>!e.isFolder);return[...a,...s]},Eo=e=>{var t,r,n,i;const{state:o,actions:s,options:l}=fo(),{searchTerm:d,sortBy:h,sortOrder:f,selectedFolder:p,pagination:g,pathHistory:m}=o,{setSearchTerm:v,setSortBy:y,setSortOrder:b,setPagination:w}=s,x=e||s.fetchFiles,C=u(null),_=u(So.debounce(e=>{const t=JSON.stringify(e);C.current!==t&&(C.current=t,null==x||x(e))},150)).current,S=c(()=>{const e=p||"";if(!e)return;const t=[...Array.isArray(m)?m:[]].reverse().find(t=>t.id===e);return null==t?void 0:t.name},[p,m]),A=c(()=>{var e;const t=null===(e=null==l?void 0:l.config)||void 0===e?void 0:e.disablePagination;return{folderId:p||"",folderName:S(),search:(null==d?void 0:d.trim())||void 0,page:t?void 0:g.current,limit:t?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}},[p,S,d,g.current,g.pageSize,h,f,null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination]),k=c(e=>{var t,r;if(v&&v(e),w&&w({current:1,pageSize:g.pageSize,total:0}),x){const n={folderId:p||"",folderName:S(),search:(null==e?void 0:e.trim())||void 0,page:(null===(t=null==l?void 0:l.config)||void 0===t?void 0:t.disablePagination)?void 0:1,limit:(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)?void 0:g.pageSize,sortBy:h,sortOrder:f,itemType:"all"};x(n)}else console.error("🔎 useSortAndFilter: fetchFiles НЕ ОПРЕДЕЛЕНА!")},[v,w,g.pageSize,x,p,S,h,f,null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination]),E=c((e,t)=>{var r,n;null==y||y(e),null==b||b(t),x&&_({folderId:p||"",folderName:S(),search:(null==d?void 0:d.trim())||void 0,page:(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)?void 0:g.current,limit:(null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination)?void 0:g.pageSize,sortBy:e,sortOrder:t,itemType:"all"})},[y,b,_,p,S,d,g.current,g.pageSize,null===(n=null==l?void 0:l.config)||void 0===n?void 0:n.disablePagination]),I=c((e,t)=>{var r;(null===(r=null==l?void 0:l.config)||void 0===r?void 0:r.disablePagination)||(w&&w({current:e,pageSize:t||g.pageSize,total:g.total}),x&&_({folderId:p||"",folderName:S(),search:(null==d?void 0:d.trim())||void 0,page:e,limit:t||g.pageSize,sortBy:h,sortOrder:f,itemType:"all"}))},[w,g.pageSize,g.total,_,p,S,d,h,f,null===(i=null==l?void 0:l.config)||void 0===i?void 0:i.disablePagination]);return a(()=>{if(x){const e=A();_(Object.assign(Object.assign({},e),{page:1}))}},[p]),a(()=>{x&&_(A())},[]),a(()=>()=>{var e;null===(e=_.cancel)||void 0===e||e.call(_)},[_]),{state:{searchTerm:d||"",sortBy:h||"name",sortOrder:f||"asc"},actions:{setSearchTerm:v||(()=>{}),setSortBy:y||(()=>{}),setSortOrder:b||(()=>{}),handleSearch:k,handleSort:E,handlePaginationChange:I,getCurrentQueryParams:A}}},Io=new Map;function To(e){const t="id"in e&&void 0!==e.id?String(e.id):"unknown",r="data"in e?e.data:void 0;return`${e.type}:${t}:${function(e){if(null==e)return"";try{return JSON.stringify(e,Object.keys(e).sort())}catch(t){return String(e)}}(r)}`}const Fo=()=>{var e,t;const{notification:r}=E.useApp(),n=fo(),{options:i}=n,o=c(async e=>{let t;if(i.handleNotify){try{t=await i.handleNotify(e)}catch(e){console.error(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("error"===e.type&&i.handleError){try{t=await i.handleError(e)}catch(e){console.error(e)}if(!1===t)return!1;"object"==typeof t&&t&&(e=t)}if("success"===e.type&&i.handleSuccess){try{t=await i.handleSuccess(e)}catch(e){console.error(e)}if(t)return!1}return t},[i]),a=c(async function(e,t=!1){var n,a,s,l;try{void 0===e.visibility&&(e.visibility=!t);const c=await o(e);"object"==typeof c&&(e=c);const u=null!==(a=null===(n=i.config)||void 0===n?void 0:n.notificationDedupeTtlMs)&&void 0!==a?a:12e3,d="error"===e.type&&!0===e.notificationDedupe;d&&function(e,t){if(t<=0)return;const r=To(e),n=Date.now(),i=Io.get(r);void 0!==i&&n-i<t&&(e.visibility=!1)}(e,u);if(!(!1!==e.visibility&&!1!==c&&!1!==(null===(s=i.config)||void 0===s?void 0:s.showNotifications)))return e;const h=r[e.type];"function"==typeof h?(h(e),d&&(l=e,u<=0||Io.set(To(l),Date.now()))):console.warn(`Unknown notification type: ${e.type}`,e)}catch(e){console.error(e)}return e},[r,o,null===(e=i.config)||void 0===e?void 0:e.notificationDedupeTtlMs,null===(t=i.config)||void 0===t?void 0:t.showNotifications]);return d(()=>({error:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"error"}),t),success:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"success"}),t),warning:(e,t=!1)=>a(Object.assign(Object.assign({},e),{type:"warning"}),t),notify:a}),[a])},Oo={FileNotFound:"File not found or no longer available.",FileAlreadyExists:"File with this name already exists.",FileInvalidName:"File name is not valid. Allowed characters: {{allowedChars}}",FileAccessDenied:"You don't have permission to access this file.",FileReadError:"Failed to read the file.",FileWriteError:"Failed to write the file.",FileTooLarge:"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.",FileTypeNotAllowed:"This file type is not allowed.",FileCorrupted:"The file appears to be corrupted.",FileChecksumMismatch:"File integrity check failed.",FileStorageQuotaExceeded:"Storage quota exceeded. Please free up space.",FileLocked:"File is locked by another process or user.",FileVersionConflict:"File version conflict. Please refresh and try again.",FolderNotFound:"Folder not found or no longer available.",FolderAlreadyExists:"Folder with this name already exists.",FolderInvalidName:"Folder name is not valid. Allowed characters: {{allowedChars}}",FolderAccessDenied:"You don't have permission to access this folder.",FolderReadError:"Failed to read the folder contents.",FolderWriteError:"Failed to write to the folder.",FolderQuotaExceeded:"Folder storage quota exceeded.",FolderNotEmpty:"Folder is not empty.",FolderBackendError:"Server error while processing the folder.",FolderTimeout:"Folder operation took too long.",RenameNotAllowed:"Renaming is not allowed for this item.",MoveNotAllowed:"Moving is not allowed for this item.",CopyNotAllowed:"Copying is not allowed for this item.",DeleteNotAllowed:"Deleting is not allowed for this item.",MoveIntoSelf:"Cannot move an item into itself.",MoveIntoDescendant:"Cannot move an item into its descendant folder.",CopyIntoSelf:"Cannot copy an item into itself.",UnsupportedOperation:"This operation is not supported.",ConfigError:"Configuration error occurred.",FileUploadQuotaExceeded:"You have exceeded the upload quota.",FileUploadNetworkError:"Network error while uploading the file.",FileUploadTimeout:"File upload took too long.",FileUploadBackendError:"Server error while uploading the file.",UploadUrlInvalid:"The specified URL is not valid.",UploadUrlNotReachable:"The specified URL is not reachable.",UploadUrlContentTypeNotAllowed:"Content type at the URL is not allowed.",UploadUrlDownloadFailed:"Failed to download file from the URL.",FileLookupFailed:"Failed to find existing file by URL.",FileProxyFailed:"Failed to load file through proxy.",FileProxyNotConfigured:"File proxy is not configured.",FileDownloadNetworkError:"Network error while downloading the file.",FileDownloadTimeout:"File download took too long.",FileDownloadBackendError:"Server error while downloading the file.",BatchPartialFailure:"Some items could not be processed.",BatchAllFailed:"Failed to process all items in the batch.",BatchConflict:"Some items in the batch are in a conflicting state.",BatchValidationFailed:"Some items in the batch did not pass validation.",BatchItemLimitExceeded:"Batch operation exceeds the maximum number of items allowed.",ValidationError:"Some of the provided data is invalid.",PayloadTooLarge:"File is too large ({{fileSize}}). Maximum allowed size: {{maxSize}}.",UnsupportedMediaType:"This media type is not supported.",NetworkError:"Network error. Please check your connection and try again.",BackendError:"Server error. Please try again later.",Timeout:"The operation took too long. Please try again.",AuthenticationFailed:"Authentication failed. Please sign in again.",AuthorizationFailed:"You are not allowed to perform this action.",RateLimitExceeded:"Too many requests. Please try again a bit later.",ServiceUnavailable:"Service is temporarily unavailable. Please try again later.",AIResponseInvalid:"AI service returned an invalid response.",AIImageGenerationFailed:"Failed to generate image using AI.",AIImageGenerationLimitExceeded:"You have reached the AI image generation limit.",IntegrationError:"Error in external integration.",ThirdPartyError:"Error in a third-party service.",UnknownError:"An unknown error occurred."},Po={FileTooLarge:"File is too large to upload.",PayloadTooLarge:"File is too large to upload."},Mo=(e,t,r)=>{var n,i,o;if(!e)return;const a=Oo[e];if(!a)return;const s=null!==(n=null==r?void 0:r.fileSize)&&void 0!==n?n:"",l=null!==(i=null==r?void 0:r.maxSize)&&void 0!==i?i:"";if(("FileTooLarge"===e||"PayloadTooLarge"===e)&&!(!!s&&!!l)){const r=Po[e];return r?t(r):t(a,{fileSize:"?",maxSize:"?"})}return t(a,{allowedChars:null!==(o=null==r?void 0:r.allowedChars)&&void 0!==o?o:"a-z A-Z 0-9 . _ -",fileSize:s,maxSize:l})},Ro=e=>{if(!e||"string"!=typeof e)return;const t=e.toLowerCase();return(t.includes("maximum number of files")||t.includes("number of files exceeded"))&&(t.includes("allowed")||t.includes("received"))?"BatchItemLimitExceeded":t.includes("exceeds")||t.includes("maximum")||t.includes("too large")||t.includes("size limit")||t.includes("object size")||t.includes("размер")||t.includes("превышен")?"PayloadTooLarge":t.includes("403")||t.includes("forbidden")||t.includes("access denied")||t.includes("доступ запрещён")?"AuthorizationFailed":t.includes("404")||t.includes("not found")||t.includes("не найден")?"UploadUrlNotReachable":t.includes("already exists")||t.includes("уже существует")||t.includes("дубликат")?"FileAlreadyExists":t.includes("invalid")&&(t.includes("name")||t.includes("имя")||t.includes("назва"))?"FileInvalidName":t.includes("type")&&(t.includes("not allowed")||t.includes("не поддерживается"))?"FileTypeNotAllowed":void 0},Lo=e=>{var t,r,n,i,o,a,s,l,c,u,d,h,f,p,g,m,v,y;if(!e)return{message:"Unknown error",raw:e};if("string"==typeof e)return{message:e};if(e instanceof Error){const o=e;return{message:null!==(t=o.message)&&void 0!==t?t:e.message,code:o.code,status:null!==(r=o.status)&&void 0!==r?r:o.httpStatus,stack:null!==(n=o.stack)&&void 0!==n?n:e.stack,raw:null!==(i=o.raw)&&void 0!==i?i:e}}if("object"==typeof e){const t=e,r=null!==(o=t.data)&&void 0!==o?o:t,n=null!==(a=null==r?void 0:r.data)&&void 0!==a?a:r,i=null!==(c=null!==(l=null!==(s=t.message)&&void 0!==s?s:null==r?void 0:r.message)&&void 0!==l?l:t.error)&&void 0!==c?c:t.reason,b=null!==(h=null!==(d=null!==(u=t.status)&&void 0!==u?u:t.httpStatus)&&void 0!==d?d:null==n?void 0:n.status)&&void 0!==h?h:null==r?void 0:r.status,w=null!==(f=t.code)&&void 0!==f?f:null==r?void 0:r.code,x=t.stack,C=null!==(p=t.raw)&&void 0!==p?p:e,_=null!==(m=null!==(g=t.fileSize)&&void 0!==g?g:null==n?void 0:n.fileSize)&&void 0!==m?m:null==r?void 0:r.fileSize,S=null!==(y=null!==(v=t.maxSize)&&void 0!==v?v:null==n?void 0:n.maxSize)&&void 0!==y?y:null==r?void 0:r.maxSize;if(i||w||b||x||C)return Object.assign(Object.assign({message:i,code:w,status:b,stack:x,raw:C},null!=_&&{fileSize:_}),null!=S&&{maxSize:S})}return{message:String(e),raw:e}};const No=(e,t,r)=>{const n=Lo(e),i=null==n?void 0:n.code;if("FileTooLarge"===i&&null!=(null==r?void 0:r.fileSize)&&null!=(null==r?void 0:r.maxSize))return t("File too large ({{size}}). Maximum allowed size: {{maxSize}}",{size:si(r.fileSize),maxSize:si(r.maxSize)});if(("BatchItemLimitExceeded"===i||"exceeded_max_files"===i)&&(null==n?void 0:n.message)){const{allowed:e,received:r}=function(e){const t=e.match(/Allowed:\s*(\d+)/i),r=e.match(/received:\s*(\d+)/i);return{allowed:t?parseInt(t[1],10):void 0,received:r?parseInt(r[1],10):void 0}}(n.message);if(null!=e&&null!=r)return t("Maximum number of files exceeded. Allowed: {{allowed}}, received: {{received}}",{allowed:e,received:r})}if((null==n?void 0:n.message)&&"Unknown error"!==n.message)return n.message;const o=null!=(null==r?void 0:r.fileSize)&&null!=(null==r?void 0:r.maxSize)?{fileSize:si(r.fileSize),maxSize:si(r.maxSize)}:void 0,a=Mo(i,t,o);return null!=a?a:t("Error uploading file")},jo=e=>{const t=Lo(e);return"path_folder_not_found"===(null==t?void 0:t.code)},Do=["file_get_contents","open stream","failed to open stream","http request failed","curl_error"];const zo=(e,t,r)=>{var n;if(!e)return t("Error when downloading a file by URL");const i=null!==(n=(e=>{const t=Ro(e);if("AuthorizationFailed"===t){const t=(e||"").toLowerCase();if(t.includes("download")||t.includes("url")||t.includes("file_get_contents")||t.includes("failed to download"))return"UploadUrlNotReachable"}return t})(null==e?void 0:e.message))&&void 0!==n?n:null==e?void 0:e.code,o=Mo(i,t,r);if(o)return o;const a=(null==e?void 0:e.message)&&"string"==typeof e.message?e.message.trim():null;return a&&function(e){if(!e||e.length>200)return!1;const t=e.toLowerCase();return!Do.some(e=>t.includes(e))}(a)?a:t("Failed to download file from the URL.")},Bo=e=>Array.isArray(e)?e.filter(e=>(null==e?void 0:e.id)&&"folders"!==e.id).map(e=>e.name).filter(Boolean).join("/"):"",Uo=e=>{const t=e.trim();if(!t)return"";const r=t.toLowerCase(),n=[r.indexOf(" and "),r.indexOf(" or "),t.indexOf(","),t.indexOf(";"),r.indexOf(". ")].filter(e=>e>=0);if(0===n.length)return t;const i=Math.min(...n);return t.slice(0,i).trim()||t},Vo=(e,t)=>{const r=(e=>{var t,r,n,i;if(e&&"object"==typeof e){const o=e,a=null!==(n=null===(r=null===(t=o.data)||void 0===t?void 0:t.data)||void 0===r?void 0:r.path_folder)&&void 0!==n?n:null===(i=o.data)||void 0===i?void 0:i.path_folder;if("string"==typeof a&&a.trim())return Uo(a)||null}const o=Lo(e),a=null==o?void 0:o.message;if(!a)return null;const s=a.toLowerCase(),l=["не существует:","not exists:","not exist:","not found:"];for(const e of l){const t=s.indexOf(e);if(t>=0){const r=a.slice(t+e.length).trim();return Uo(r)||null}}const c=["not exists ","not exist ","not found "];for(const e of c){const t=s.indexOf(e);if(t>=0){const r=a.slice(t+e.length).trim();return Uo(r)||null}}return null})(e);return r?(e=>{const t=e.split("/").filter(Boolean);return t.length<=1?"":(t.pop(),t.join("/"))})(r):Bo(t)},Ho=async e=>{var t;const{options:r,pathFolder:n,dataProviders:i}=e;if(null==i?void 0:i.clearCache)return void await i.clearCache(n||null);const o=null===(t=null==r?void 0:r.apiEndpoints)||void 0===t?void 0:t.clearCache;if(!o)return;const a=o.includes("?");let s=o;n&&n.length>0&&(s=`${o}${a?"&":"?"}path_folder=${encodeURIComponent(n)}`);const l=await fetch(s,{method:"POST"});if(!l.ok)throw new Error(`Cache clear failed: ${l.status}`)},Wo=()=>{var e,t;const{state:r,actions:i,options:o}=fo(),{t:a}=Gn(),s=Fo(),{folders:l,selectedFolder:u,pathHistory:d,form:h,loading:f,isModalVisible:p}=r,{setFolders:g,setLoading:m,setIsModalVisible:v}=i,{dataProviders:y,config:b}=o,w=c(e=>(Array.isArray(e)?e:[]).filter(e=>e&&e.id&&e.name).map(e=>({id:e.id,name:e.name,parentId:e.folderId?e.folderId:null})),[]),x=c(async(e=!1)=>{null==m||m(!0);try{let e=[];const t="lazy"===(null==b?void 0:b.folderTreeLoading);if(!(null==y?void 0:y.getFolders)){if(null==y?void 0:y.getFiles){const e=async r=>{const{files:n}=await y.getFiles({itemType:"folder",folderId:null!=r?r:void 0}),i=w(n);if(t)return i;const o=await Promise.all(i.map(t=>e(t.id)));return[...i,...o.flat()]},r=await e(null);return void(g&&g(e=>{const n=Array.isArray(e)?e:[];if(!t){const e=r,t=e.filter(e=>e.id===e.parentId);return t.length>0&&console.warn("Folders with cyclic dependencies detected:",t),e}const i=n.filter(e=>e.parentId),o=[...i,...r],a=o.filter(e=>e.id===e.parentId);return a.length>0&&console.warn("Folders with cyclic dependencies detected:",a),o}))}return void console.error("DataProvider for folders is not defined")}{const r=!t;e=await y.getFolders({parentId:null,deep:r})}const r=Array.isArray(e)?e:[];null==g||g(r);const n=r.filter(e=>e.id===e.parentId);n.length>0&&console.warn("Folders with cyclic dependencies detected:",n)}catch(t){console.error("Error loading folders:",t);const r=Lo(t);if(!e&&(404===(null==r?void 0:r.status)||"FileNotFound"===(null==r?void 0:r.code))){const e=Vo(t,d||[]);try{return await Ho({options:o,pathFolder:e,dataProviders:null==o?void 0:o.dataProviders}),void await x(!0)}catch(e){console.error("Cache clear failed:",e)}}const n=Mo(null==r?void 0:r.code,a);s.error({id:"FOLDERS_FETCH_FAILED",message:null!=n?n:a("Failed to load folders"),description:a("Folders"),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{reason:t instanceof Error?t.message:String(t),folderId:null,folderName:a("Folders")}})}finally{null==m||m(!1)}},[null==y?void 0:y.getFiles,null==y?void 0:y.getFolders,g,m,null==b?void 0:b.folderTreeLoading,w,s,a,d,o]),C=c(()=>x(),[x]),_=c(async e=>{try{let t,r;if(null==y?void 0:y.getFolders){t=await y.getFolders({parentId:e,deep:!1});const n=Array.isArray(l)?l:[],i=new Set(t.map(e=>e.id)),o=n.filter(t=>t.parentId!==e||i.has(t.id));r=[...o,...t.filter(e=>!o.some(t=>t.id===e.id))]}else{if(!(null==y?void 0:y.getFiles))return[];{const{files:n}=await y.getFiles({itemType:"folder",folderId:null!=e?e:void 0});t=w(n);const i=Array.isArray(l)?l:[],o=new Set(t.map(e=>e.id)),a=i.filter(t=>t.parentId!==e||o.has(t.id));r=[...a,...t.filter(e=>!a.some(t=>t.id===e.id))]}}let n=r,i=0;for(;i!==n.length;){i=n.length;const e=new Set(n.map(e=>e.id));n=n.filter(t=>!t.parentId||e.has(t.parentId))}return null==g||g(n),t}catch(e){return console.error("Error loading child folders:",e),[]}},[y,l,g,w]),S=c(()=>{var e;const t=null!==(e=null==b?void 0:b.defaultFolderName)&&void 0!==e?e:a("New folder");h.setFieldsValue({folderName:t}),null==v||v(!0)},[h,v,a,null==b?void 0:b.defaultFolderName]),A=c(async(e,t)=>{const r=[...(Array.isArray(l)?l:[]).filter(t=>t.id!==e.id),e];if(null==g||g(r),e.parentId&&(await _(e.parentId),await new Promise(e=>setTimeout(e,50))),!(null==t?void 0:t.preserveSelection)&&i.setSelectedFolder&&i.setSelectedFolder(e.id),!(null==t?void 0:t.preserveSelection)&&i.setPathHistory){const t=Array.isArray(r)?r:[],n=(e,r=new Set)=>{if(r.has(e))return console.warn(`Cycle detected in the path to the folder with id=${e}`),[];const i=t.find(t=>t.id===e);if(!i)return[];const o=new Set(r);return o.add(e),i.parentId?[...n(i.parentId,o),{id:i.id,name:i.name}]:[{id:i.id,name:i.name}]},o=n(e.id),s=[{id:"folders",name:a("Folders")},...o];i.setPathHistory(s)}},[l,g,i,r.pathHistory,_,a]),k=c(async e=>{try{if(null==y?void 0:y.getFolders){const t=await y.getFolders(),r=Array.isArray(t)?t:[];return r.some(t=>t.id===e)}if(null==y?void 0:y.getFiles){const t=new Set,r=async n=>{const{files:i}=await y.getFiles({itemType:"folder",folderId:null!=n?n:void 0}),o=w(i);for(const n of o){if(t.has(n.id))continue;if(t.add(n.id),n.id===e)return!0;if(await r(n.id))return!0}return!1};return await r(null)}}catch(e){console.warn("⚠️ Error checking the folder:",e)}return!1},[null==y?void 0:y.getFolders,null==y?void 0:y.getFiles,w]),E=c(async e=>{var t;let r,n,i=null;try{const o=await(e?e.validateFields():h.validateFields());if(r=o.folderName.trim(),!r){const e=o.targetFolder||(u&&"folders"!==u?u:null);return void s.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderName:r,folderId:null!=e?e:null,reason:"emptyName",is_force_create:!!o.is_force_create}})}n=Dr(r,b);const c=o.targetFolder;if(c)i="folders"!==c?c:null;else if(u&&"folders"!==u)i=u;else if(Array.isArray(d)&&d.length>1){const e=d[d.length-1];i=(null==e?void 0:e.id)&&"folders"!==e.id?e.id:null}if(zr(b)&&(null==y?void 0:y.getFolders))try{const e=(await y.getFolders({parentId:i,deep:!1})||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean);if(e.includes(r.trim().toLowerCase()))return void s.error({id:"FOLDER_ALREADY_EXISTS",message:a("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:r,folderId:i}})}catch(e){}let f;if(!(null==y?void 0:y.createFolder))return void s.error({id:"FOLDER_CREATE_PROVIDER_NOT_CONFIGURED",message:a("Folder creation provider is not configured"),placement:"bottomRight",data:{folderName:n,folderId:null!=i?i:null,is_force_create:!!o.is_force_create}});f=await y.createFolder({name:n,parentId:i,is_force_create:!!o.is_force_create}),(e=>{if(!e||!e.id)throw new Error(a("Invalid server response: folder ID is missing"));if(e.id===e.parentId&&e.parentId)throw console.error("Circular dependency detected: folder cannot be its own parent"),new Error(a("Error: folder cannot be its own parent"))})(f);const p={id:f.id,name:f.name,parentId:null!=i?i:null,childCount:f.childCount},m=[...(Array.isArray(l)?l:[]).filter(e=>e.id!==p.id),p];if(null==g||g(m),s.success({id:"FOLDER_CREATE_SUCCESS",message:a("Folder created"),placement:"bottomRight",data:{itemIds:[p.id],folderId:null!==(t=p.parentId)&&void 0!==t?t:null,folderName:p.name}}),e||null==v||v(!1),(async()=>{try{await A(p,{preserveSelection:Boolean(e)}),await C(),await new Promise(e=>setTimeout(e,200));await k(f.id)||console.warn("⚠️ Could not confirm the creation of the folder on the server, but continuing...")}catch(e){console.error("Error performing background operations after creating the folder:",e)}})(),e)return f}catch(e){console.error("❌ Error creating the folder:",e);const t=Lo(e),o=Mo(null==t?void 0:t.code,a);s.error({id:"FOLDER_CREATE_FAILED",message:null!=o?o:a("Failed to create folder"),placement:"bottomRight",innerException:e,data:{folderName:n||r,folderId:null!=i?i:null,reason:e instanceof Error?e.message:String(e)}})}},[h,u,y,A,C,k,v,s,a,l,g,b,d]),I=c(()=>{null==v||v(!1)},[v]),T=c((e,t=new Set)=>{const r=Array.isArray(l)?l:[];return e.map(e=>{if(t.has(e.id))return console.warn(`Cycle detected in the folder structure with id=${e.id}. Skipping child elements processing.`),{key:e.id,label:e.name+" "+a("(error)"),icon:n.createElement(pe,{style:{color:"red"}})};const i=new Set(t);i.add(e.id);const o=r.filter(t=>t.parentId===e.id&&t.id!==e.id);return{key:e.id,label:e.name,children:o.length>0?T(o,i):void 0}})},[l]),F=c(()=>{const e=Array.isArray(l)?l:[],t={key:"folders",label:a("Folders"),children:[]},r=e.filter(e=>null===e.parentId||!e.parentId);return t.children=T(r),[t]},[l,a,T]),O=c(async(e,t)=>{var r,n,c,u;let d;try{const h=t.trim(),f=null==l?void 0:l.find(t=>t.id===e);if(!h)return void s.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:a("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:e,folderName:t,reason:"emptyName"}});d=Dr(h,b);if(!(!1!==(null===(r=null==b?void 0:b.features)||void 0===r?void 0:r.enableRenameFolder)))return void s.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:a("Folder rename is disabled by config"),placement:"bottomRight",data:{itemId:e,itemName:null!==(n=null==f?void 0:f.name)&&void 0!==n?n:d}});if(!(null===(c=o.dataProviders)||void 0===c?void 0:c.renameFolder))return void s.error({id:"FOLDER_RENAME_FAILED",message:a("Folder rename provider is not configured"),placement:"bottomRight",data:{itemId:e,itemName:d,error:{message:"providerNotConfigured"}}});const p=await o.dataProviders.renameFolder(e,d);if(!(null==p?void 0:p.id))return void s.error({id:"FOLDER_RENAME_FAILED",message:a("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:e,itemName:d,error:{message:"invalidResponse"}}});await C(),e!==p.id&&i.setSelectedFolder&&i.setSelectedFolder(p.id),s.success({id:"FOLDER_RENAME_SUCCESS",message:a("Folder renamed"),placement:"bottomRight",data:{itemId:p.id,itemName:p.name,folderId:null!==(u=p.parentId)&&void 0!==u?u:null}})}catch(r){console.error("Error renaming the folder:",r),s.error({id:"FOLDER_RENAME_FAILED",message:a("Failed to rename folder"),placement:"bottomRight",innerException:r,data:{itemId:e,itemName:d||t,error:{message:r instanceof Error?r.message:String(r)}}})}},[C,l,null===(e=o.dataProviders)||void 0===e?void 0:e.renameFolder,null===(t=null==b?void 0:b.features)||void 0===t?void 0:t.enableRenameFolder,b,i.setSelectedFolder,s,a]);return{state:{folders:l,isCreatingFolder:p,loading:f},actions:{fetchFolders:C,fetchChildFolders:_,handleCreateFolder:S,handleModalOk:E,handleModalCancel:I,generateMenuItems:F,renameFolder:O}}},$o=()=>{const{options:e,actions:t}=fo(),{dataProviders:r,config:n}=e,{setUndoDeletion:i}=t,{t:o}=Gn(),a=Fo(),s=c(async({items:e,selectedFolder:t,getItemNameById:s,showNotifications:l=!1})=>{let c=0,u=0;const d=[],h=async t=>{if(null==r?void 0:r.deleteItems)try{const n=await r.deleteItems(e.map(e=>e.id),{permanent:t}),i=n.detailed;if(i){const e=i.filter(e=>e.success),t=i.filter(e=>!e.success),r=t.filter(e=>{var t;const r=null!==(t=e.innerException)&&void 0!==t?t:e.error;return jo(r)}),n=t.filter(e=>{var t;const r=null!==(t=e.innerException)&&void 0!==t?t:e.error;return!jo(r)});return c+=e.length+r.length,u+=n.length,void n.forEach(e=>{var t;const r=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),n=null!==(t=e.innerException)&&void 0!==t?t:e.error,i=Lo(n);d.push({itemId:r,itemName:s(r),error:i})})}if(n.success)c+=e.length;else{const t=n.error;if(jo(t))c+=e.length;else if(t){u+=e.length;const r=Lo(t);d.push({error:r})}else u+=e.length}return}catch(r){if(jo(r))c+=e.length;else{const n=t?"Ошибка при удалении":"Ошибка при перемещении в корзину";console.error(n,r),u+=e.length;const i=Lo(r);d.push({error:i})}}const n=t?"DataProvider для удаления файлов не настроен":"DataProvider для перемещения не настроен";console.warn(n)},f=(null==n?void 0:n.enableTrashFolder)&&"Trash"===t;return(null==n?void 0:n.enableTrashFolder)&&!f?await h(!1):await h(!0),c>0&&(null==n?void 0:n.enableTrashFolder)&&!f&&(null==i||i({itemIds:e.map(e=>e.id),sourceFolderId:t||"folders"})),l&&(c>0&&a.success({id:"FILES_DELETE_SUCCESS",message:o("Files deleted"),placement:"bottomRight",data:{successCount:c,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:t||null}}),u>0&&a.error({id:"FILES_DELETE_ERROR",message:o("Error when deleting a file"),placement:"bottomRight",data:{failCount:u,totalCount:e.length,itemIds:e.map(e=>e.id),itemNames:e.map(e=>s(e.id)),folderId:t||null,errors:d}})),{successCount:c,failCount:u,errorDetails:d}},[r,n,i,o,a]);return{deleteItems:s}};class qo extends Error{constructor(e,t,r,n){super(e),this.code=t,this.status=r,this.details=n,this.name="FileManagerApiError",Error.captureStackTrace&&Error.captureStackTrace(this,qo)}}const Go=/^(localhost|127\.0\.0\.1|0\.0\.0\.0|::1)$/i,Yo=/^(10\.|172\.(1[6-9]|2[0-9]|3[01])\.|192\.168\.)/;function Xo(e,t){const r=e.trim();if(!r)throw new qo(t("Enter the URL of the image"),"UploadUrlInvalid");if(r.length>8192)throw new qo(t("URL too long"),"UploadUrlInvalid");let n;try{n=new URL(r)}catch(e){throw new qo(t("The specified URL is not valid."),"UploadUrlInvalid")}const i=n.protocol.toLowerCase();if("http:"!==i&&"https:"!==i)throw new qo(t("Only http and https URLs are supported"),"UploadUrlInvalid");const o=n.hostname.toLowerCase();if(Go.test(o)&&("undefined"==typeof window||!Go.test(window.location.hostname.toLowerCase())))throw new qo(t("Private and local URLs are not allowed"),"UploadUrlInvalid");if(Yo.test(o))throw new qo(t("Private and local URLs are not allowed"),"UploadUrlInvalid")}function Ko(e,t){return new Promise(function(r,n){let i;return Zo(e).then(function(e){try{return i=e,r(new Blob([t.slice(0,2),i,t.slice(2)],{type:"image/jpeg"}))}catch(e){return n(e)}},n)})}const Zo=e=>new Promise((t,r)=>{const n=new FileReader;n.addEventListener("load",({target:{result:e}})=>{const n=new DataView(e);let i=0;if(65496!==n.getUint16(i))return r("not a valid JPEG");for(i+=2;;){const o=n.getUint16(i);if(65498===o)break;const a=n.getUint16(i+2);if(65505===o&&1165519206===n.getUint32(i+4)){const o=i+10;let s;switch(n.getUint16(o)){case 18761:s=!0;break;case 19789:s=!1;break;default:return r("TIFF header contains invalid endian")}if(42!==n.getUint16(o+2,s))return r("TIFF header contains invalid version");const l=n.getUint32(o+4,s),c=o+l+2+12*n.getUint16(o+l,s);for(let e=o+l+2;e<c;e+=12)if(274==n.getUint16(e,s)){if(3!==n.getUint16(e+2,s))return r("Orientation data type is invalid");if(1!==n.getUint32(e+4,s))return r("Orientation data count is invalid");n.setUint16(e+8,1,s);break}return t(e.slice(i,i+2+a))}i+=2+a}return t(new Blob)}),n.readAsArrayBuffer(e)});var Jo={},Qo={get exports(){return Jo},set exports(e){Jo=e}};!function(){var e,t,r={};Qo.exports=r,r.parse=function(e,t){for(var n=r.bin.readUshort,i=r.bin.readUint,o=0,a={},s=new Uint8Array(e),l=s.length-4;101010256!=i(s,l);)l--;o=l,o+=4;var c=n(s,o+=4);n(s,o+=2);var u=i(s,o+=2),d=i(s,o+=4);o+=4,o=d;for(var h=0;h<c;h++){i(s,o),o+=4,o+=4,o+=4,i(s,o+=4),u=i(s,o+=4);var f=i(s,o+=4),p=n(s,o+=4),g=n(s,o+2),m=n(s,o+4);o+=6;var v=i(s,o+=8);o+=4,o+=p+g+m,r._readLocal(s,v,a,u,f,t)}return a},r._readLocal=function(e,t,n,i,o,a){var s=r.bin.readUshort,l=r.bin.readUint;l(e,t),s(e,t+=4),s(e,t+=2);var c=s(e,t+=2);l(e,t+=2),l(e,t+=4),t+=4;var u=s(e,t+=8),d=s(e,t+=2);t+=2;var h=r.bin.readUTF8(e,t,u);if(t+=u,t+=d,a)n[h]={size:o,csize:i};else{var f=new Uint8Array(e.buffer,t);if(0==c)n[h]=new Uint8Array(f.buffer.slice(t,t+i));else{if(8!=c)throw"unknown compression method: "+c;var p=new Uint8Array(o);r.inflateRaw(f,p),n[h]=p}}},r.inflateRaw=function(e,t){return r.F.inflate(e,t)},r.inflate=function(e,t){return e[0],e[1],r.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),t)},r.deflate=function(e,t){null==t&&(t={level:6});var n=0,i=new Uint8Array(50+Math.floor(1.1*e.length));i[n]=120,i[n+1]=156,n+=2,n=r.F.deflateRaw(e,i,n,t.level);var o=r.adler(e,0,e.length);return i[n+0]=o>>>24&255,i[n+1]=o>>>16&255,i[n+2]=o>>>8&255,i[n+3]=o>>>0&255,new Uint8Array(i.buffer,0,n+4)},r.deflateRaw=function(e,t){null==t&&(t={level:6});var n=new Uint8Array(50+Math.floor(1.1*e.length)),i=r.F.deflateRaw(e,n,i,t.level);return new Uint8Array(n.buffer,0,i)},r.encode=function(e,t){null==t&&(t=!1);var n=0,i=r.bin.writeUint,o=r.bin.writeUshort,a={};for(var s in e){var l=!r._noNeed(s)&&!t,c=e[s],u=r.crc.crc(c,0,c.length);a[s]={cpr:l,usize:c.length,crc:u,file:l?r.deflateRaw(c):c}}for(var s in a)n+=a[s].file.length+30+46+2*r.bin.sizeUTF8(s);n+=22;var d=new Uint8Array(n),h=0,f=[];for(var s in a){var p=a[s];f.push(h),h=r._writeHeader(d,h,s,p,0)}var g=0,m=h;for(var s in a)p=a[s],f.push(h),h=r._writeHeader(d,h,s,p,1,f[g++]);var v=h-m;return i(d,h,101010256),h+=4,o(d,h+=4,g),o(d,h+=2,g),i(d,h+=2,v),i(d,h+=4,m),h+=4,h+=2,d.buffer},r._noNeed=function(e){var t=e.split(".").pop().toLowerCase();return-1!="png,jpg,jpeg,zip".indexOf(t)},r._writeHeader=function(e,t,n,i,o,a){var s=r.bin.writeUint,l=r.bin.writeUshort,c=i.file;return s(e,t,0==o?67324752:33639248),t+=4,1==o&&(t+=2),l(e,t,20),l(e,t+=2,0),l(e,t+=2,i.cpr?8:0),s(e,t+=2,0),s(e,t+=4,i.crc),s(e,t+=4,c.length),s(e,t+=4,i.usize),l(e,t+=4,r.bin.sizeUTF8(n)),l(e,t+=2,0),t+=2,1==o&&(t+=2,t+=2,s(e,t+=6,a),t+=4),t+=r.bin.writeUTF8(e,t,n),0==o&&(e.set(c,t),t+=c.length),t},r.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}return e}(),update:function(e,t,n,i){for(var o=0;o<i;o++)e=r.crc.table[255&(e^t[n+o])]^e>>>8;return e},crc:function(e,t,n){return 4294967295^r.crc.update(4294967295,e,t,n)}},r.adler=function(e,t,r){for(var n=1,i=0,o=t,a=t+r;o<a;){for(var s=Math.min(o+5552,a);o<s;)i+=n+=e[o++];n%=65521,i%=65521}return i<<16|n},r.bin={readUshort:function(e,t){return e[t]|e[t+1]<<8},writeUshort:function(e,t,r){e[t]=255&r,e[t+1]=r>>8&255},readUint:function(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])},writeUint:function(e,t,r){e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255},readASCII:function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},writeASCII:function(e,t,r){for(var n=0;n<r.length;n++)e[t+n]=r.charCodeAt(n)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,n){for(var i,o="",a=0;a<n;a++)o+="%"+r.bin.pad(e[t+a].toString(16));try{i=decodeURIComponent(o)}catch(i){return r.bin.readASCII(e,t,n)}return i},writeUTF8:function(e,t,r){for(var n=r.length,i=0,o=0;o<n;o++){var a=r.charCodeAt(o);if(4294967168&a)if(4294965248&a)if(4294901760&a){if(4292870144&a)throw"e";e[t+i]=240|a>>18,e[t+i+1]=128|a>>12&63,e[t+i+2]=128|a>>6&63,e[t+i+3]=128|63&a,i+=4}else e[t+i]=224|a>>12,e[t+i+1]=128|a>>6&63,e[t+i+2]=128|63&a,i+=3;else e[t+i]=192|a>>6,e[t+i+1]=128|63&a,i+=2;else e[t+i]=a,i++}return i},sizeUTF8:function(e){for(var t=e.length,r=0,n=0;n<t;n++){var i=e.charCodeAt(n);if(4294967168&i)if(4294965248&i)if(4294901760&i){if(4292870144&i)throw"e";r+=4}else r+=3;else r+=2;else r++}return r}},r.F={},r.F.deflateRaw=function(e,t,n,i){var o=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],a=r.F.U,s=r.F._goodIndex;r.F._hash;var l=r.F._putsE,c=0,u=n<<3,d=0,h=e.length;if(0==i){for(;c<h;)l(t,u,c+(S=Math.min(65535,h-c))==h?1:0),u=r.F._copyExact(e,c,S,t,u+8),c+=S;return u>>>3}var f=a.lits,p=a.strt,g=a.prev,m=0,v=0,y=0,b=0,w=0,x=0;for(h>2&&(p[x=r.F._hash(e,0)]=0),c=0;c<h;c++){if(w=x,c+1<h-2){x=r.F._hash(e,c+1);var C=c+1&32767;g[C]=p[x],p[x]=C}if(d<=c){(m>14e3||v>26697)&&h-c>100&&(d<c&&(f[m]=c-d,m+=2,d=c),u=r.F._writeBlock(c==h-1||d==h?1:0,f,m,b,e,y,c-y,t,u),m=v=b=0,y=c);var _=0;c<h-2&&(_=r.F._bestMatch(e,c,g,w,Math.min(o[2],h-c),o[3]));var S=_>>>16,A=65535&_;if(0!=_){A=65535&_;var k=s(S=_>>>16,a.of0);a.lhst[257+k]++;var E=s(A,a.df0);a.dhst[E]++,b+=a.exb[k]+a.dxb[E],f[m]=S<<23|c-d,f[m+1]=A<<16|k<<8|E,m+=2,d=c+S}else a.lhst[e[c]]++;v++}}for(y==c&&0!=e.length||(d<c&&(f[m]=c-d,m+=2,d=c),u=r.F._writeBlock(1,f,m,b,e,y,c-y,t,u),m=0,v=0,m=v=b=0,y=c);7&u;)u++;return u>>>3},r.F._bestMatch=function(e,t,n,i,o,a){var s=32767&t,l=n[s],c=s-l+32768&32767;if(l==s||i!=r.F._hash(e,t-c))return 0;for(var u=0,d=0,h=Math.min(32767,t);c<=h&&0!=--a&&l!=s;){if(0==u||e[t+u]==e[t+u-c]){var f=r.F._howLong(e,t,c);if(f>u){if(d=c,(u=f)>=o)break;c+2<f&&(f=c+2);for(var p=0,g=0;g<f-2;g++){var m=t-c+g+32768&32767,v=m-n[m]+32768&32767;v>p&&(p=v,l=m)}}}c+=(s=l)-(l=n[s])+32768&32767}return u<<16|d},r.F._howLong=function(e,t,r){if(e[t]!=e[t-r]||e[t+1]!=e[t+1-r]||e[t+2]!=e[t+2-r])return 0;var n=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]==e[t-r];)t++;return t-n},r.F._hash=function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(e,t,n,i,o,a,s,l,c){var u,d,h,f,p,g,m,v,y,b=r.F.U,w=r.F._putsF,x=r.F._putsE;b.lhst[256]++,d=(u=r.F.getTrees())[0],h=u[1],f=u[2],p=u[3],g=u[4],m=u[5],v=u[6],y=u[7];var C=32+(c+3&7?8-(c+3&7):0)+(s<<3),_=i+r.F.contSize(b.fltree,b.lhst)+r.F.contSize(b.fdtree,b.dhst),S=i+r.F.contSize(b.ltree,b.lhst)+r.F.contSize(b.dtree,b.dhst);S+=14+3*m+r.F.contSize(b.itree,b.ihst)+(2*b.ihst[16]+3*b.ihst[17]+7*b.ihst[18]);for(var A=0;A<286;A++)b.lhst[A]=0;for(A=0;A<30;A++)b.dhst[A]=0;for(A=0;A<19;A++)b.ihst[A]=0;var k=C<_&&C<S?0:_<S?1:2;if(w(l,c,e),w(l,c+1,k),c+=3,0==k){for(;7&c;)c++;c=r.F._copyExact(o,a,s,l,c)}else{var E,I;if(1==k&&(E=b.fltree,I=b.fdtree),2==k){r.F.makeCodes(b.ltree,d),r.F.revCodes(b.ltree,d),r.F.makeCodes(b.dtree,h),r.F.revCodes(b.dtree,h),r.F.makeCodes(b.itree,f),r.F.revCodes(b.itree,f),E=b.ltree,I=b.dtree,x(l,c,p-257),x(l,c+=5,g-1),x(l,c+=5,m-4),c+=4;for(var T=0;T<m;T++)x(l,c+3*T,b.itree[1+(b.ordr[T]<<1)]);c+=3*m,c=r.F._codeTiny(v,b.itree,l,c),c=r.F._codeTiny(y,b.itree,l,c)}for(var F=a,O=0;O<n;O+=2){for(var P=t[O],M=P>>>23,R=F+(8388607&P);F<R;)c=r.F._writeLit(o[F++],E,l,c);if(0!=M){var L=t[O+1],N=L>>16,j=L>>8&255,D=255&L;x(l,c=r.F._writeLit(257+j,E,l,c),M-b.of0[j]),c+=b.exb[j],w(l,c=r.F._writeLit(D,I,l,c),N-b.df0[D]),c+=b.dxb[D],F+=M}}c=r.F._writeLit(256,E,l,c)}return c},r.F._copyExact=function(e,t,r,n,i){var o=i>>>3;return n[o]=r,n[o+1]=r>>>8,n[o+2]=255-n[o],n[o+3]=255-n[o+1],o+=4,n.set(new Uint8Array(e.buffer,t,r),o),i+(r+4<<3)},r.F.getTrees=function(){for(var e=r.F.U,t=r.F._hufTree(e.lhst,e.ltree,15),n=r.F._hufTree(e.dhst,e.dtree,15),i=[],o=r.F._lenCodes(e.ltree,i),a=[],s=r.F._lenCodes(e.dtree,a),l=0;l<i.length;l+=2)e.ihst[i[l]]++;for(l=0;l<a.length;l+=2)e.ihst[a[l]]++;for(var c=r.F._hufTree(e.ihst,e.itree,7),u=19;u>4&&0==e.itree[1+(e.ordr[u-1]<<1)];)u--;return[t,n,c,o,s,u,i,a]},r.F.getSecond=function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(e[r+1]);return t},r.F.nonZero=function(e){for(var t="",r=0;r<e.length;r+=2)0!=e[r+1]&&(t+=(r>>1)+",");return t},r.F.contSize=function(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n]*e[1+(n<<1)];return r},r.F._codeTiny=function(e,t,n,i){for(var o=0;o<e.length;o+=2){var a=e[o],s=e[o+1];i=r.F._writeLit(a,t,n,i);var l=16==a?2:17==a?3:7;a>15&&(r.F._putsE(n,i,s,l),i+=l)}return i},r.F._lenCodes=function(e,t){for(var r=e.length;2!=r&&0==e[r-1];)r-=2;for(var n=0;n<r;n+=2){var i=e[n+1],o=n+3<r?e[n+3]:-1,a=n+5<r?e[n+5]:-1,s=0==n?-1:e[n-1];if(0==i&&o==i&&a==i){for(var l=n+5;l+2<r&&e[l+2]==i;)l+=2;(c=Math.min(l+1-n>>>1,138))<11?t.push(17,c-3):t.push(18,c-11),n+=2*c-2}else if(i==s&&o==i&&a==i){for(l=n+5;l+2<r&&e[l+2]==i;)l+=2;var c=Math.min(l+1-n>>>1,6);t.push(16,c-3),n+=2*c-2}else t.push(i,0)}return r>>>1},r.F._hufTree=function(e,t,n){var i=[],o=e.length,a=t.length,s=0;for(s=0;s<a;s+=2)t[s]=0,t[s+1]=0;for(s=0;s<o;s++)0!=e[s]&&i.push({lit:s,f:e[s]});var l=i.length,c=i.slice(0);if(0==l)return 0;if(1==l){var u=i[0].lit;return c=0==u?1:0,t[1+(u<<1)]=1,t[1+(c<<1)]=1,1}i.sort(function(e,t){return e.f-t.f});var d=i[0],h=i[1],f=0,p=1,g=2;for(i[0]={lit:-1,f:d.f+h.f,l:d,r:h,d:0};p!=l-1;)d=f!=p&&(g==l||i[f].f<i[g].f)?i[f++]:i[g++],h=f!=p&&(g==l||i[f].f<i[g].f)?i[f++]:i[g++],i[p++]={lit:-1,f:d.f+h.f,l:d,r:h};var m=r.F.setDepth(i[p-1],0);for(m>n&&(r.F.restrictDepth(c,n,m),m=n),s=0;s<l;s++)t[1+(c[s].lit<<1)]=c[s].d;return m},r.F.setDepth=function(e,t){return-1!=e.lit?(e.d=t,t):Math.max(r.F.setDepth(e.l,t+1),r.F.setDepth(e.r,t+1))},r.F.restrictDepth=function(e,t,r){var n=0,i=1<<r-t,o=0;for(e.sort(function(e,t){return t.d==e.d?e.f-t.f:t.d-e.d}),n=0;n<e.length&&e[n].d>t;n++){var a=e[n].d;e[n].d=t,o+=i-(1<<r-a)}for(o>>>=r-t;o>0;)(a=e[n].d)<t?(e[n].d++,o-=1<<t-a-1):n++;for(;n>=0;n--)e[n].d==t&&o<0&&(e[n].d--,o++);0!=o&&console.log("debt left")},r.F._goodIndex=function(e,t){var r=0;return t[16|r]<=e&&(r|=16),t[8|r]<=e&&(r|=8),t[4|r]<=e&&(r|=4),t[2|r]<=e&&(r|=2),t[1|r]<=e&&(r|=1),r},r.F._writeLit=function(e,t,n,i){return r.F._putsF(n,i,t[e<<1]),i+t[1+(e<<1)]},r.F.inflate=function(e,t){var n=Uint8Array;if(3==e[0]&&0==e[1])return t||new n(0);var i=r.F,o=i._bitsF,a=i._bitsE,s=i._decodeTiny,l=i.makeCodes,c=i.codes2map,u=i._get17,d=i.U,h=null==t;h&&(t=new n(e.length>>>2<<3));for(var f,p,g=0,m=0,v=0,y=0,b=0,w=0,x=0,C=0,_=0;0==g;)if(g=o(e,_,1),m=o(e,_+1,2),_+=3,0!=m){if(h&&(t=r.F._check(t,C+(1<<17))),1==m&&(f=d.flmap,p=d.fdmap,w=511,x=31),2==m){v=a(e,_,5)+257,y=a(e,_+5,5)+1,b=a(e,_+10,4)+4,_+=14;for(var S=0;S<38;S+=2)d.itree[S]=0,d.itree[S+1]=0;var A=1;for(S=0;S<b;S++){var k=a(e,_+3*S,3);d.itree[1+(d.ordr[S]<<1)]=k,k>A&&(A=k)}_+=3*b,l(d.itree,A),c(d.itree,A,d.imap),f=d.lmap,p=d.dmap,_=s(d.imap,(1<<A)-1,v+y,e,_,d.ttree);var E=i._copyOut(d.ttree,0,v,d.ltree);w=(1<<E)-1;var I=i._copyOut(d.ttree,v,y,d.dtree);x=(1<<I)-1,l(d.ltree,E),c(d.ltree,E,f),l(d.dtree,I),c(d.dtree,I,p)}for(;;){var T=f[u(e,_)&w];_+=15&T;var F=T>>>4;if(F>>>8==0)t[C++]=F;else{if(256==F)break;var O=C+F-254;if(F>264){var P=d.ldef[F-257];O=C+(P>>>3)+a(e,_,7&P),_+=7&P}var M=p[u(e,_)&x];_+=15&M;var R=M>>>4,L=d.ddef[R],N=(L>>>4)+o(e,_,15&L);for(_+=15&L,h&&(t=r.F._check(t,C+(1<<17)));C<O;)t[C]=t[C++-N],t[C]=t[C++-N],t[C]=t[C++-N],t[C]=t[C++-N];C=O}}}else{7&_&&(_+=8-(7&_));var j=4+(_>>>3),D=e[j-4]|e[j-3]<<8;h&&(t=r.F._check(t,C+D)),t.set(new n(e.buffer,e.byteOffset+j,D),C),_=j+D<<3,C+=D}return t.length==C?t:t.slice(0,C)},r.F._check=function(e,t){var r=e.length;if(t<=r)return e;var n=new Uint8Array(Math.max(r<<1,t));return n.set(e,0),n},r.F._decodeTiny=function(e,t,n,i,o,a){for(var s=r.F._bitsE,l=r.F._get17,c=0;c<n;){var u=e[l(i,o)&t];o+=15&u;var d=u>>>4;if(d<=15)a[c]=d,c++;else{var h=0,f=0;16==d?(f=3+s(i,o,2),o+=2,h=a[c-1]):17==d?(f=3+s(i,o,3),o+=3):18==d&&(f=11+s(i,o,7),o+=7);for(var p=c+f;c<p;)a[c]=h,c++}}return o},r.F._copyOut=function(e,t,r,n){for(var i=0,o=0,a=n.length>>>1;o<r;){var s=e[o+t];n[o<<1]=0,n[1+(o<<1)]=s,s>i&&(i=s),o++}for(;o<a;)n[o<<1]=0,n[1+(o<<1)]=0,o++;return i},r.F.makeCodes=function(e,t){for(var n,i,o,a,s=r.F.U,l=e.length,c=s.bl_count,u=0;u<=t;u++)c[u]=0;for(u=1;u<l;u+=2)c[e[u]]++;var d=s.next_code;for(n=0,c[0]=0,i=1;i<=t;i++)n=n+c[i-1]<<1,d[i]=n;for(o=0;o<l;o+=2)0!=(a=e[o+1])&&(e[o]=d[a],d[a]++)},r.F.codes2map=function(e,t,n){for(var i=e.length,o=r.F.U.rev15,a=0;a<i;a+=2)if(0!=e[a+1])for(var s=a>>1,l=e[a+1],c=s<<4|l,u=t-l,d=e[a]<<u,h=d+(1<<u);d!=h;)n[o[d]>>>15-t]=c,d++},r.F.revCodes=function(e,t){for(var n=r.F.U.rev15,i=15-t,o=0;o<e.length;o+=2){var a=e[o]<<t-e[o+1];e[o]=n[a]>>>i}},r.F._putsE=function(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8},r.F._putsF=function(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},r.F._bitsE=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},r.F._bitsF=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},r.F._get17=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},r.F._get25=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},r.F.U=(e=Uint16Array,t=Uint32Array,{next_code:new e(16),bl_count:new e(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new e(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new e(512),fltree:[],fdmap:new e(32),fdtree:[],lmap:new e(32768),ltree:[],ttree:[],dmap:new e(32768),dtree:[],imap:new e(512),itree:[],rev15:new e(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new e(65536),prev:new e(32768)}),function(){for(var e=r.F.U,t=0;t<32768;t++){var n=t;n=(4278255360&(n=(4042322160&(n=(3435973836&(n=(2863311530&n)>>>1|(1431655765&n)<<1))>>>2|(858993459&n)<<2))>>>4|(252645135&n)<<4))>>>8|(16711935&n)<<8,e.rev15[t]=(n>>>16|n<<16)>>>17}function i(e,t,r){for(;0!=t--;)e.push(0,r)}for(t=0;t<32;t++)e.ldef[t]=e.of0[t]<<3|e.exb[t],e.ddef[t]=e.df0[t]<<4|e.dxb[t];i(e.fltree,144,8),i(e.fltree,112,9),i(e.fltree,24,7),i(e.fltree,8,8),r.F.makeCodes(e.fltree,9),r.F.codes2map(e.fltree,9,e.flmap),r.F.revCodes(e.fltree,9),i(e.fdtree,32,5),r.F.makeCodes(e.fdtree,5),r.F.codes2map(e.fdtree,5,e.fdmap),r.F.revCodes(e.fdtree,5),i(e.itree,19,0),i(e.ltree,286,0),i(e.dtree,30,0),i(e.ttree,320,0)}()}();var ea=function(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}({__proto__:null,default:Jo},[Jo]);const ta=function(){var e={nextZero(e,t){for(;0!=e[t];)t++;return t},readUshort:(e,t)=>e[t]<<8|e[t+1],writeUshort(e,t,r){e[t]=r>>8&255,e[t+1]=255&r},readUint:(e,t)=>16777216*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]),writeUint(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r},readASCII(e,t,r){let n="";for(let i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},writeASCII(e,t,r){for(let n=0;n<r.length;n++)e[t+n]=r.charCodeAt(n)},readBytes(e,t,r){const n=[];for(let i=0;i<r;i++)n.push(e[t+i]);return n},pad:e=>e.length<2?`0${e}`:e,readUTF8(t,r,n){let i,o="";for(let i=0;i<n;i++)o+=`%${e.pad(t[r+i].toString(16))}`;try{i=decodeURIComponent(o)}catch(i){return e.readASCII(t,r,n)}return i}};function t(t,r,n,i){const a=r*n,s=o(i),l=Math.ceil(r*s/8),c=new Uint8Array(4*a),u=new Uint32Array(c.buffer),{ctype:d}=i,{depth:h}=i,f=e.readUshort;if(6==d){const e=a<<2;if(8==h)for(var p=0;p<e;p+=4)c[p]=t[p],c[p+1]=t[p+1],c[p+2]=t[p+2],c[p+3]=t[p+3];if(16==h)for(p=0;p<e;p++)c[p]=t[p<<1]}else if(2==d){const e=i.tabs.tRNS;if(null==e){if(8==h)for(p=0;p<a;p++){var g=3*p;u[p]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g]}if(16==h)for(p=0;p<a;p++)g=6*p,u[p]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g]}else{var m=e[0];const r=e[1],n=e[2];if(8==h)for(p=0;p<a;p++){var v=p<<2;g=3*p,u[p]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g],t[g]==m&&t[g+1]==r&&t[g+2]==n&&(c[v+3]=0)}if(16==h)for(p=0;p<a;p++)v=p<<2,g=6*p,u[p]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g],f(t,g)==m&&f(t,g+2)==r&&f(t,g+4)==n&&(c[v+3]=0)}}else if(3==d){const e=i.tabs.PLTE,o=i.tabs.tRNS,s=o?o.length:0;if(1==h)for(var y=0;y<n;y++){var b=y*l,w=y*r;for(p=0;p<r;p++){v=w+p<<2;var x=3*(C=t[b+(p>>3)]>>7-(7&p)&1);c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255}}if(2==h)for(y=0;y<n;y++)for(b=y*l,w=y*r,p=0;p<r;p++)v=w+p<<2,x=3*(C=t[b+(p>>2)]>>6-((3&p)<<1)&3),c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255;if(4==h)for(y=0;y<n;y++)for(b=y*l,w=y*r,p=0;p<r;p++)v=w+p<<2,x=3*(C=t[b+(p>>1)]>>4-((1&p)<<2)&15),c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255;if(8==h)for(p=0;p<a;p++){var C;v=p<<2,x=3*(C=t[p]),c[v]=e[x],c[v+1]=e[x+1],c[v+2]=e[x+2],c[v+3]=C<s?o[C]:255}}else if(4==d){if(8==h)for(p=0;p<a;p++){v=p<<2;var _=t[S=p<<1];c[v]=_,c[v+1]=_,c[v+2]=_,c[v+3]=t[S+1]}if(16==h)for(p=0;p<a;p++){var S;v=p<<2,_=t[S=p<<2],c[v]=_,c[v+1]=_,c[v+2]=_,c[v+3]=t[S+2]}}else if(0==d)for(m=i.tabs.tRNS?i.tabs.tRNS:-1,y=0;y<n;y++){const e=y*l,n=y*r;if(1==h)for(var A=0;A<r;A++){var k=(_=255*(t[e+(A>>>3)]>>>7-(7&A)&1))==255*m?0:255;u[n+A]=k<<24|_<<16|_<<8|_}else if(2==h)for(A=0;A<r;A++)k=(_=85*(t[e+(A>>>2)]>>>6-((3&A)<<1)&3))==85*m?0:255,u[n+A]=k<<24|_<<16|_<<8|_;else if(4==h)for(A=0;A<r;A++)k=(_=17*(t[e+(A>>>1)]>>>4-((1&A)<<2)&15))==17*m?0:255,u[n+A]=k<<24|_<<16|_<<8|_;else if(8==h)for(A=0;A<r;A++)k=(_=t[e+A])==m?0:255,u[n+A]=k<<24|_<<16|_<<8|_;else if(16==h)for(A=0;A<r;A++)_=t[e+(A<<1)],k=f(t,e+(A<<1))==m?0:255,u[n+A]=k<<24|_<<16|_<<8|_}return c}function r(e,t,r,s){const l=o(e),c=Math.ceil(r*l/8),u=new Uint8Array((c+1+e.interlace)*s);return t=e.tabs.CgBI?i(t,u):n(t,u),0==e.interlace?t=a(t,e,0,r,s):1==e.interlace&&(t=function(e,t){const r=t.width,n=t.height,i=o(t),s=i>>3,l=Math.ceil(r*i/8),c=new Uint8Array(n*l);let u=0;const d=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],f=[8,8,8,4,4,2,2],p=[8,8,4,4,2,2,1];let g=0;for(;g<7;){const o=f[g],v=p[g];let y=0,b=0,w=d[g];for(;w<n;)w+=o,b++;let x=h[g];for(;x<r;)x+=v,y++;const C=Math.ceil(y*i/8);a(e,t,u,y,b);let _=0,S=d[g];for(;S<n;){let t=h[g],n=u+_*C<<3;for(;t<r;){var m;if(1==i&&(m=(m=e[n>>3])>>7-(7&n)&1,c[S*l+(t>>3)]|=m<<7-(7&t)),2==i&&(m=(m=e[n>>3])>>6-(7&n)&3,c[S*l+(t>>2)]|=m<<6-((3&t)<<1)),4==i&&(m=(m=e[n>>3])>>4-(7&n)&15,c[S*l+(t>>1)]|=m<<4-((1&t)<<2)),i>=8){const r=S*l+t*s;for(let t=0;t<s;t++)c[r+t]=e[(n>>3)+t]}n+=i,t+=v}_++,S+=o}y*b!=0&&(u+=b*(1+C)),g+=1}return c}(t,e)),t}function n(e,t){return i(new Uint8Array(e.buffer,2,e.length-6),t)}var i=function(){const e={H:{}};return e.H.N=function(t,r){const n=Uint8Array;let i,o,a=0,s=0,l=0,c=0,u=0,d=0,h=0,f=0,p=0;if(3==t[0]&&0==t[1])return r||new n(0);const g=e.H,m=g.b,v=g.e,y=g.R,b=g.n,w=g.A,x=g.Z,C=g.m,_=null==r;for(_&&(r=new n(t.length>>>2<<5));0==a;)if(a=m(t,p,1),s=m(t,p+1,2),p+=3,0!=s){if(_&&(r=e.H.W(r,f+(1<<17))),1==s&&(i=C.J,o=C.h,d=511,h=31),2==s){l=v(t,p,5)+257,c=v(t,p+5,5)+1,u=v(t,p+10,4)+4,p+=14;let e=1;for(var S=0;S<38;S+=2)C.Q[S]=0,C.Q[S+1]=0;for(S=0;S<u;S++){const r=v(t,p+3*S,3);C.Q[1+(C.X[S]<<1)]=r,r>e&&(e=r)}p+=3*u,b(C.Q,e),w(C.Q,e,C.u),i=C.w,o=C.d,p=y(C.u,(1<<e)-1,l+c,t,p,C.v);const r=g.V(C.v,0,l,C.C);d=(1<<r)-1;const n=g.V(C.v,l,c,C.D);h=(1<<n)-1,b(C.C,r),w(C.C,r,i),b(C.D,n),w(C.D,n,o)}for(;;){const e=i[x(t,p)&d];p+=15&e;const n=e>>>4;if(n>>>8==0)r[f++]=n;else{if(256==n)break;{let e=f+n-254;if(n>264){const r=C.q[n-257];e=f+(r>>>3)+v(t,p,7&r),p+=7&r}const i=o[x(t,p)&h];p+=15&i;const a=i>>>4,s=C.c[a],l=(s>>>4)+m(t,p,15&s);for(p+=15&s;f<e;)r[f]=r[f++-l],r[f]=r[f++-l],r[f]=r[f++-l],r[f]=r[f++-l];f=e}}}}else{7&p&&(p+=8-(7&p));const i=4+(p>>>3),o=t[i-4]|t[i-3]<<8;_&&(r=e.H.W(r,f+o)),r.set(new n(t.buffer,t.byteOffset+i,o),f),p=i+o<<3,f+=o}return r.length==f?r:r.slice(0,f)},e.H.W=function(e,t){const r=e.length;if(t<=r)return e;const n=new Uint8Array(r<<1);return n.set(e,0),n},e.H.R=function(t,r,n,i,o,a){const s=e.H.e,l=e.H.Z;let c=0;for(;c<n;){const e=t[l(i,o)&r];o+=15&e;const n=e>>>4;if(n<=15)a[c]=n,c++;else{let e=0,t=0;16==n?(t=3+s(i,o,2),o+=2,e=a[c-1]):17==n?(t=3+s(i,o,3),o+=3):18==n&&(t=11+s(i,o,7),o+=7);const r=c+t;for(;c<r;)a[c]=e,c++}}return o},e.H.V=function(e,t,r,n){let i=0,o=0;const a=n.length>>>1;for(;o<r;){const r=e[o+t];n[o<<1]=0,n[1+(o<<1)]=r,r>i&&(i=r),o++}for(;o<a;)n[o<<1]=0,n[1+(o<<1)]=0,o++;return i},e.H.n=function(t,r){const n=e.H.m,i=t.length;let o,a,s,l;const c=n.j;for(var u=0;u<=r;u++)c[u]=0;for(u=1;u<i;u+=2)c[t[u]]++;const d=n.K;for(o=0,c[0]=0,a=1;a<=r;a++)o=o+c[a-1]<<1,d[a]=o;for(s=0;s<i;s+=2)l=t[s+1],0!=l&&(t[s]=d[l],d[l]++)},e.H.A=function(t,r,n){const i=t.length,o=e.H.m.r;for(let e=0;e<i;e+=2)if(0!=t[e+1]){const i=e>>1,a=t[e+1],s=i<<4|a,l=r-a;let c=t[e]<<l;const u=c+(1<<l);for(;c!=u;)n[o[c]>>>15-r]=s,c++}},e.H.l=function(t,r){const n=e.H.m.r,i=15-r;for(let e=0;e<t.length;e+=2){const o=t[e]<<r-t[e+1];t[e]=n[o]>>>i}},e.H.M=function(e,t,r){r<<=7&t;const n=t>>>3;e[n]|=r,e[n+1]|=r>>>8},e.H.I=function(e,t,r){r<<=7&t;const n=t>>>3;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16},e.H.e=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1},e.H.b=function(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1},e.H.Z=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)},e.H.i=function(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16|e[3+(t>>>3)]<<24)>>>(7&t)},e.H.m=function(){const e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),function(){const t=e.H.m;for(var r=0;r<32768;r++){let e=r;e=(2863311530&e)>>>1|(1431655765&e)<<1,e=(3435973836&e)>>>2|(858993459&e)<<2,e=(4042322160&e)>>>4|(252645135&e)<<4,e=(4278255360&e)>>>8|(16711935&e)<<8,t.r[r]=(e>>>16|e<<16)>>>17}function n(e,t,r){for(;0!=t--;)e.push(0,r)}for(r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];n(t._,144,8),n(t._,112,9),n(t._,24,7),n(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),n(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),n(t.Q,19,0),n(t.C,286,0),n(t.D,30,0),n(t.v,320,0)}(),e.H.N}();function o(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth}function a(e,t,r,n,i){let a=o(t);const l=Math.ceil(n*a/8);let c,u;a=Math.ceil(a/8);let d=e[r],h=0;if(d>1&&(e[r]=[0,0,1][d-2]),3==d)for(h=a;h<l;h++)e[h+1]=e[h+1]+(e[h+1-a]>>>1)&255;for(let t=0;t<i;t++)if(c=r+t*l,u=c+t+1,d=e[u-1],h=0,0==d)for(;h<l;h++)e[c+h]=e[u+h];else if(1==d){for(;h<a;h++)e[c+h]=e[u+h];for(;h<l;h++)e[c+h]=e[u+h]+e[c+h-a]}else if(2==d)for(;h<l;h++)e[c+h]=e[u+h]+e[c+h-l];else if(3==d){for(;h<a;h++)e[c+h]=e[u+h]+(e[c+h-l]>>>1);for(;h<l;h++)e[c+h]=e[u+h]+(e[c+h-l]+e[c+h-a]>>>1)}else{for(;h<a;h++)e[c+h]=e[u+h]+s(0,e[c+h-l],0);for(;h<l;h++)e[c+h]=e[u+h]+s(e[c+h-a],e[c+h-l],e[c+h-a-l])}return e}function s(e,t,r){const n=e+t-r,i=n-e,o=n-t,a=n-r;return i*i<=o*o&&i*i<=a*a?e:o*o<=a*a?t:r}function l(t,r,n){n.width=e.readUint(t,r),r+=4,n.height=e.readUint(t,r),r+=4,n.depth=t[r],r++,n.ctype=t[r],r++,n.compress=t[r],r++,n.filter=t[r],r++,n.interlace=t[r],r++}function c(e,t,r,n,i,o,a,s,l){const c=Math.min(t,i),u=Math.min(r,o);let d=0,h=0;for(let r=0;r<u;r++)for(let o=0;o<c;o++)if(a>=0&&s>=0?(d=r*t+o<<2,h=(s+r)*i+a+o<<2):(d=(-s+r)*t-a+o<<2,h=r*i+o<<2),0==l)n[h]=e[d],n[h+1]=e[d+1],n[h+2]=e[d+2],n[h+3]=e[d+3];else if(1==l){var f=e[d+3]*(1/255),p=e[d]*f,g=e[d+1]*f,m=e[d+2]*f,v=n[h+3]*(1/255),y=n[h]*v,b=n[h+1]*v,w=n[h+2]*v;const t=1-f,r=f+v*t,i=0==r?0:1/r;n[h+3]=255*r,n[h+0]=(p+y*t)*i,n[h+1]=(g+b*t)*i,n[h+2]=(m+w*t)*i}else if(2==l)f=e[d+3],p=e[d],g=e[d+1],m=e[d+2],v=n[h+3],y=n[h],b=n[h+1],w=n[h+2],f==v&&p==y&&g==b&&m==w?(n[h]=0,n[h+1]=0,n[h+2]=0,n[h+3]=0):(n[h]=p,n[h+1]=g,n[h+2]=m,n[h+3]=f);else if(3==l){if(f=e[d+3],p=e[d],g=e[d+1],m=e[d+2],v=n[h+3],y=n[h],b=n[h+1],w=n[h+2],f==v&&p==y&&g==b&&m==w)continue;if(f<220&&v>20)return!1}return!0}return{decode:function(t){const o=new Uint8Array(t);let a=8;const s=e,c=s.readUshort,u=s.readUint,d={tabs:{},frames:[]},h=new Uint8Array(o.length);let f,p=0,g=0;const m=[137,80,78,71,13,10,26,10];for(var v=0;v<8;v++)if(o[v]!=m[v])throw"The input is not a PNG file!";for(;a<o.length;){const e=s.readUint(o,a);a+=4;const t=s.readASCII(o,a,4);if(a+=4,"IHDR"==t)l(o,a,d);else if("iCCP"==t){for(var y=a;0!=o[y];)y++;s.readASCII(o,a,y-a),o[y+1];const r=o.slice(y+2,a+e);let l=null;try{l=n(r)}catch(e){l=i(r)}d.tabs[t]=l}else if("CgBI"==t)d.tabs[t]=o.slice(a,a+4);else if("IDAT"==t){for(v=0;v<e;v++)h[p+v]=o[a+v];p+=e}else if("acTL"==t)d.tabs[t]={num_frames:u(o,a),num_plays:u(o,a+4)},f=new Uint8Array(o.length);else if("fcTL"==t){0!=g&&((S=d.frames[d.frames.length-1]).data=r(d,f.slice(0,g),S.rect.width,S.rect.height),g=0);const e={x:u(o,a+12),y:u(o,a+16),width:u(o,a+4),height:u(o,a+8)};let t=c(o,a+22);t=c(o,a+20)/(0==t?100:t);const n={rect:e,delay:Math.round(1e3*t),dispose:o[a+24],blend:o[a+25]};d.frames.push(n)}else if("fdAT"==t){for(v=0;v<e-4;v++)f[g+v]=o[a+v+4];g+=e-4}else if("pHYs"==t)d.tabs[t]=[s.readUint(o,a),s.readUint(o,a+4),o[a+8]];else if("cHRM"==t)for(d.tabs[t]=[],v=0;v<8;v++)d.tabs[t].push(s.readUint(o,a+4*v));else if("tEXt"==t||"zTXt"==t){null==d.tabs[t]&&(d.tabs[t]={});var b=s.nextZero(o,a),w=s.readASCII(o,a,b-a),x=a+e-b-1;if("tEXt"==t)_=s.readASCII(o,b+1,x);else{var C=n(o.slice(b+2,b+2+x));_=s.readUTF8(C,0,C.length)}d.tabs[t][w]=_}else if("iTXt"==t){null==d.tabs[t]&&(d.tabs[t]={}),b=0,y=a,b=s.nextZero(o,y),w=s.readASCII(o,y,b-y);const r=o[y=b+1];var _;o[y+1],y+=2,b=s.nextZero(o,y),s.readASCII(o,y,b-y),y=b+1,b=s.nextZero(o,y),s.readUTF8(o,y,b-y),x=e-((y=b+1)-a),0==r?_=s.readUTF8(o,y,x):(C=n(o.slice(y,y+x)),_=s.readUTF8(C,0,C.length)),d.tabs[t][w]=_}else if("PLTE"==t)d.tabs[t]=s.readBytes(o,a,e);else if("hIST"==t){const e=d.tabs.PLTE.length/3;for(d.tabs[t]=[],v=0;v<e;v++)d.tabs[t].push(c(o,a+2*v))}else if("tRNS"==t)3==d.ctype?d.tabs[t]=s.readBytes(o,a,e):0==d.ctype?d.tabs[t]=c(o,a):2==d.ctype&&(d.tabs[t]=[c(o,a),c(o,a+2),c(o,a+4)]);else if("gAMA"==t)d.tabs[t]=s.readUint(o,a)/1e5;else if("sRGB"==t)d.tabs[t]=o[a];else if("bKGD"==t)0==d.ctype||4==d.ctype?d.tabs[t]=[c(o,a)]:2==d.ctype||6==d.ctype?d.tabs[t]=[c(o,a),c(o,a+2),c(o,a+4)]:3==d.ctype&&(d.tabs[t]=o[a]);else if("IEND"==t)break;a+=e,s.readUint(o,a),a+=4}var S;return 0!=g&&((S=d.frames[d.frames.length-1]).data=r(d,f.slice(0,g),S.rect.width,S.rect.height)),d.data=r(d,h,d.width,d.height),delete d.compress,delete d.interlace,delete d.filter,d},toRGBA8:function(e){const r=e.width,n=e.height;if(null==e.tabs.acTL)return[t(e.data,r,n,e).buffer];const i=[];null==e.frames[0].data&&(e.frames[0].data=e.data);const o=r*n*4,a=new Uint8Array(o),s=new Uint8Array(o),l=new Uint8Array(o);for(let d=0;d<e.frames.length;d++){const h=e.frames[d],f=h.rect.x,p=h.rect.y,g=h.rect.width,m=h.rect.height,v=t(h.data,g,m,e);if(0!=d)for(var u=0;u<o;u++)l[u]=a[u];if(0==h.blend?c(v,g,m,a,r,n,f,p,0):1==h.blend&&c(v,g,m,a,r,n,f,p,1),i.push(a.buffer.slice(0)),0==h.dispose);else if(1==h.dispose)c(s,g,m,a,r,n,f,p,0);else if(2==h.dispose)for(u=0;u<o;u++)a[u]=l[u]}return i},_paeth:s,_copyTile:c,_bin:e}}();!function(){const{_copyTile:e}=ta,{_bin:t}=ta,r=ta._paeth;var n={table:function(){const e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let e=0;e<8;e++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}return e}(),update(e,t,r,i){for(let o=0;o<i;o++)e=n.table[255&(e^t[r+o])]^e>>>8;return e},crc:(e,t,r)=>4294967295^n.update(4294967295,e,t,r)};function i(e,t,r,n){t[r]+=e[0]*n>>4,t[r+1]+=e[1]*n>>4,t[r+2]+=e[2]*n>>4,t[r+3]+=e[3]*n>>4}function o(e){return Math.max(0,Math.min(255,e))}function a(e,t){const r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],o=e[3]-t[3];return r*r+n*n+i*i+o*o}function s(e,t,r,n,s,l,c){null==c&&(c=1);const u=n.length,d=[];for(var h=0;h<u;h++){const e=n[h];d.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255])}for(h=0;h<u;h++){let e=4294967295;for(var f=0,p=0;p<u;p++){var g=a(d[h],d[p]);p!=h&&g<e&&(e=g,f=p)}}const m=new Uint32Array(s.buffer),v=new Int16Array(t*r*4),y=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(h=0;h<y.length;h++)y[h]=255*((y[h]+.5)/16-.5);for(let s=0;s<r;s++)for(let w=0;w<t;w++){var b;h=4*(s*t+w),2!=c?b=[o(e[h]+v[h]),o(e[h+1]+v[h+1]),o(e[h+2]+v[h+2]),o(e[h+3]+v[h+3])]:(g=y[4*(3&s)+(3&w)],b=[o(e[h]+g),o(e[h+1]+g),o(e[h+2]+g),o(e[h+3]+g)]),f=0;let x=16777215;for(p=0;p<u;p++){const e=a(b,d[p]);e<x&&(x=e,f=p)}const C=d[f],_=[b[0]-C[0],b[1]-C[1],b[2]-C[2],b[3]-C[3]];1==c&&(w!=t-1&&i(_,v,h+4,7),s!=r-1&&(0!=w&&i(_,v,h+4*t-4,3),i(_,v,h+4*t,5),w!=t-1&&i(_,v,h+4*t+4,1))),l[h>>2]=f,m[h>>2]=n[f]}}function l(e,r,i,o,a){null==a&&(a={});const{crc:s}=n,l=t.writeUint,c=t.writeUshort,u=t.writeASCII;let d=8;const h=e.frames.length>1;let f,p=!1,g=33+(h?20:0);if(null!=a.sRGB&&(g+=13),null!=a.pHYs&&(g+=21),null!=a.iCCP&&(f=pako.deflate(a.iCCP),g+=21+f.length+4),3==e.ctype){for(var m=e.plte.length,v=0;v<m;v++)e.plte[v]>>>24!=255&&(p=!0);g+=8+3*m+4+(p?8+1*m+4:0)}for(var y=0;y<e.frames.length;y++)h&&(g+=38),g+=(C=e.frames[y]).cimg.length+12,0!=y&&(g+=4);g+=12;const b=new Uint8Array(g),w=[137,80,78,71,13,10,26,10];for(v=0;v<8;v++)b[v]=w[v];if(l(b,d,13),d+=4,u(b,d,"IHDR"),d+=4,l(b,d,r),d+=4,l(b,d,i),d+=4,b[d]=e.depth,d++,b[d]=e.ctype,d++,b[d]=0,d++,b[d]=0,d++,b[d]=0,d++,l(b,d,s(b,d-17,17)),d+=4,null!=a.sRGB&&(l(b,d,1),d+=4,u(b,d,"sRGB"),d+=4,b[d]=a.sRGB,d++,l(b,d,s(b,d-5,5)),d+=4),null!=a.iCCP){const e=13+f.length;l(b,d,e),d+=4,u(b,d,"iCCP"),d+=4,u(b,d,"ICC profile"),d+=11,d+=2,b.set(f,d),d+=f.length,l(b,d,s(b,d-(e+4),e+4)),d+=4}if(null!=a.pHYs&&(l(b,d,9),d+=4,u(b,d,"pHYs"),d+=4,l(b,d,a.pHYs[0]),d+=4,l(b,d,a.pHYs[1]),d+=4,b[d]=a.pHYs[2],d++,l(b,d,s(b,d-13,13)),d+=4),h&&(l(b,d,8),d+=4,u(b,d,"acTL"),d+=4,l(b,d,e.frames.length),d+=4,l(b,d,null!=a.loop?a.loop:0),d+=4,l(b,d,s(b,d-12,12)),d+=4),3==e.ctype){for(l(b,d,3*(m=e.plte.length)),d+=4,u(b,d,"PLTE"),d+=4,v=0;v<m;v++){const t=3*v,r=e.plte[v],n=255&r,i=r>>>8&255,o=r>>>16&255;b[d+t+0]=n,b[d+t+1]=i,b[d+t+2]=o}if(d+=3*m,l(b,d,s(b,d-3*m-4,3*m+4)),d+=4,p){for(l(b,d,m),d+=4,u(b,d,"tRNS"),d+=4,v=0;v<m;v++)b[d+v]=e.plte[v]>>>24&255;d+=m,l(b,d,s(b,d-m-4,m+4)),d+=4}}let x=0;for(y=0;y<e.frames.length;y++){var C=e.frames[y];h&&(l(b,d,26),d+=4,u(b,d,"fcTL"),d+=4,l(b,d,x++),d+=4,l(b,d,C.rect.width),d+=4,l(b,d,C.rect.height),d+=4,l(b,d,C.rect.x),d+=4,l(b,d,C.rect.y),d+=4,c(b,d,o[y]),d+=2,c(b,d,1e3),d+=2,b[d]=C.dispose,d++,b[d]=C.blend,d++,l(b,d,s(b,d-30,30)),d+=4);const t=C.cimg;l(b,d,(m=t.length)+(0==y?0:4)),d+=4;const r=d;u(b,d,0==y?"IDAT":"fdAT"),d+=4,0!=y&&(l(b,d,x++),d+=4),b.set(t,d),d+=m,l(b,d,s(b,r,d-r)),d+=4}return l(b,d,0),d+=4,u(b,d,"IEND"),d+=4,l(b,d,s(b,d-4,4)),d+=4,b.buffer}function c(e,t,r){for(let n=0;n<e.frames.length;n++){const i=e.frames[n];i.rect.width;const o=i.rect.height,a=new Uint8Array(o*i.bpl+o);i.cimg=f(i.img,o,i.bpp,i.bpl,a,t,r)}}function u(t,r,n,i,o){const a=o[0],l=o[1],c=o[2],u=o[3],f=o[4],p=o[5];let m=6,v=8,y=255;for(var b=0;b<t.length;b++){const e=new Uint8Array(t[b]);for(var w=e.length,x=0;x<w;x+=4)y&=e[x+3]}const C=255!=y,_=function(t,r,n,i,o,a){const s=[];for(var l=0;l<t.length;l++){const d=new Uint8Array(t[l]),f=new Uint32Array(d.buffer);var c;let g=0,m=0,v=r,y=n,b=i?1:0;if(0!=l){const w=a||i||1==l||0!=s[l-2].dispose?1:2;let x=0,C=1e9;for(let e=0;e<w;e++){var u=new Uint8Array(t[l-1-e]);const i=new Uint32Array(t[l-1-e]);let a=r,s=n,c=-1,d=-1;for(let e=0;e<n;e++)for(let t=0;t<r;t++)f[p=e*r+t]!=i[p]&&(t<a&&(a=t),t>c&&(c=t),e<s&&(s=e),e>d&&(d=e));-1==c&&(a=s=c=d=0),o&&(!(1&~a)&&a--,!(1&~s)&&s--);const h=(c-a+1)*(d-s+1);h<C&&(C=h,x=e,g=a,m=s,v=c-a+1,y=d-s+1)}u=new Uint8Array(t[l-1-x]),1==x&&(s[l-1].dispose=2),c=new Uint8Array(v*y*4),e(u,r,n,c,v,y,-g,-m,0),b=e(d,r,n,c,v,y,-g,-m,3)?1:0,1==b?h(d,r,n,c,{x:g,y:m,width:v,height:y}):e(d,r,n,c,v,y,-g,-m,0)}else c=d.slice(0);s.push({rect:{x:g,y:m,width:v,height:y},img:c,blend:b,dispose:0})}if(i)for(l=0;l<s.length;l++){if(1==(g=s[l]).blend)continue;const e=g.rect,i=s[l-1].rect,a=Math.min(e.x,i.x),c=Math.min(e.y,i.y),u={x:a,y:c,width:Math.max(e.x+e.width,i.x+i.width)-a,height:Math.max(e.y+e.height,i.y+i.height)-c};s[l-1].dispose=1,l-1!=0&&d(t,r,n,s,l-1,u,o),d(t,r,n,s,l,u,o)}let f=0;if(1!=t.length)for(var p=0;p<s.length;p++){var g;f+=(g=s[p]).rect.width*g.rect.height}return s}(t,r,n,a,l,c),S={},A=[],k=[];if(0!=i){const e=[];for(x=0;x<_.length;x++)e.push(_[x].img.buffer);const t=function(e){let t=0;for(var r=0;r<e.length;r++)t+=e[r].byteLength;const n=new Uint8Array(t);let i=0;for(r=0;r<e.length;r++){const t=new Uint8Array(e[r]),o=t.length;for(let e=0;e<o;e+=4){let r=t[e],o=t[e+1],a=t[e+2];const s=t[e+3];0==s&&(r=o=a=0),n[i+e]=r,n[i+e+1]=o,n[i+e+2]=a,n[i+e+3]=s}i+=o}return n.buffer}(e),r=g(t,i);for(x=0;x<r.plte.length;x++)A.push(r.plte[x].est.rgba);let n=0;for(x=0;x<_.length;x++){const e=(I=_[x]).img.length;var E=new Uint8Array(r.inds.buffer,n>>2,e>>2);k.push(E);const t=new Uint8Array(r.abuf,n,e);p&&s(I.img,I.rect.width,I.rect.height,A,t,E),I.img.set(t),n+=e}}else for(b=0;b<_.length;b++){var I=_[b];const e=new Uint32Array(I.img.buffer);var T=I.rect.width;for(w=e.length,E=new Uint8Array(w),k.push(E),x=0;x<w;x++){const t=e[x];if(0!=x&&t==e[x-1])E[x]=E[x-1];else if(x>T&&t==e[x-T])E[x]=E[x-T];else{let e=S[t];if(null==e&&(S[t]=e=A.length,A.push(t),A.length>=300))break;E[x]=e}}}const F=A.length;for(F<=256&&0==f&&(v=F<=2?1:F<=4?2:F<=16?4:8,v=Math.max(v,u)),b=0;b<_.length;b++){(I=_[b]).rect.x,I.rect.y,T=I.rect.width;const e=I.rect.height;let t=I.img;new Uint32Array(t.buffer);let r=4*T,n=4;if(F<=256&&0==f){r=Math.ceil(v*T/8);var O=new Uint8Array(r*e);const i=k[b];for(let t=0;t<e;t++){x=t*r;const e=t*T;if(8==v)for(var P=0;P<T;P++)O[x+P]=i[e+P];else if(4==v)for(P=0;P<T;P++)O[x+(P>>1)]|=i[e+P]<<4-4*(1&P);else if(2==v)for(P=0;P<T;P++)O[x+(P>>2)]|=i[e+P]<<6-2*(3&P);else if(1==v)for(P=0;P<T;P++)O[x+(P>>3)]|=i[e+P]<<7-1*(7&P)}t=O,m=3,n=1}else if(0==C&&1==_.length){O=new Uint8Array(T*e*3);const i=T*e;for(x=0;x<i;x++){const e=3*x,r=4*x;O[e]=t[r],O[e+1]=t[r+1],O[e+2]=t[r+2]}t=O,m=2,n=3,r=3*T}I.img=t,I.bpl=r,I.bpp=n}return{ctype:m,depth:v,plte:A,frames:_}}function d(t,r,n,i,o,a,s){const l=Uint8Array,c=Uint32Array,u=new l(t[o-1]),d=new c(t[o-1]),f=o+1<t.length?new l(t[o+1]):null,p=new l(t[o]),g=new c(p.buffer);let m=r,v=n,y=-1,b=-1;for(let e=0;e<a.height;e++)for(let t=0;t<a.width;t++){const n=a.x+t,s=a.y+e,l=s*r+n,c=g[l];0==c||0==i[o-1].dispose&&d[l]==c&&(null==f||0!=f[4*l+3])||(n<m&&(m=n),n>y&&(y=n),s<v&&(v=s),s>b&&(b=s))}-1==y&&(m=v=y=b=0),s&&(!(1&~m)&&m--,!(1&~v)&&v--),a={x:m,y:v,width:y-m+1,height:b-v+1};const w=i[o];w.rect=a,w.blend=1,w.img=new Uint8Array(a.width*a.height*4),0==i[o-1].dispose?(e(u,r,n,w.img,a.width,a.height,-a.x,-a.y,0),h(p,r,n,w.img,a)):e(p,r,n,w.img,a.width,a.height,-a.x,-a.y,0)}function h(t,r,n,i,o){e(t,r,n,i,o.width,o.height,-o.x,-o.y,2)}function f(e,t,r,n,i,o,a){const s=[];let l,c=[0,1,2,3,4];-1!=o?c=[o]:(t*n>5e5||1==r)&&(c=[0]),a&&(l={level:0});const u=ea;for(var d=0;d<c.length;d++){for(let o=0;o<t;o++)p(i,e,o,n,r,c[d]);s.push(u.deflate(i,l))}let h,f=1e9;for(d=0;d<s.length;d++)s[d].length<f&&(h=d,f=s[d].length);return s[h]}function p(e,t,n,i,o,a){const s=n*i;let l=s+n;if(e[l]=a,l++,0==a)if(i<500)for(var c=0;c<i;c++)e[l+c]=t[s+c];else e.set(new Uint8Array(t.buffer,s,i),l);else if(1==a){for(c=0;c<o;c++)e[l+c]=t[s+c];for(c=o;c<i;c++)e[l+c]=t[s+c]-t[s+c-o]+256&255}else if(0==n){for(c=0;c<o;c++)e[l+c]=t[s+c];if(2==a)for(c=o;c<i;c++)e[l+c]=t[s+c];if(3==a)for(c=o;c<i;c++)e[l+c]=t[s+c]-(t[s+c-o]>>1)+256&255;if(4==a)for(c=o;c<i;c++)e[l+c]=t[s+c]-r(t[s+c-o],0,0)+256&255}else{if(2==a)for(c=0;c<i;c++)e[l+c]=t[s+c]+256-t[s+c-i]&255;if(3==a){for(c=0;c<o;c++)e[l+c]=t[s+c]+256-(t[s+c-i]>>1)&255;for(c=o;c<i;c++)e[l+c]=t[s+c]+256-(t[s+c-i]+t[s+c-o]>>1)&255}if(4==a){for(c=0;c<o;c++)e[l+c]=t[s+c]+256-r(0,t[s+c-i],0)&255;for(c=o;c<i;c++)e[l+c]=t[s+c]+256-r(t[s+c-o],t[s+c-i],t[s+c-o-i])&255}}}function g(e,t){const r=new Uint8Array(e),n=r.slice(0),i=new Uint32Array(n.buffer),o=m(n,t),a=o[0],s=o[1],l=r.length,c=new Uint8Array(l>>2);let u;if(r.length<2e7)for(var d=0;d<l;d+=4)u=v(a,h=r[d]*(1/255),f=r[d+1]*(1/255),p=r[d+2]*(1/255),g=r[d+3]*(1/255)),c[d>>2]=u.ind,i[d>>2]=u.est.rgba;else for(d=0;d<l;d+=4){var h=r[d]*(1/255),f=r[d+1]*(1/255),p=r[d+2]*(1/255),g=r[d+3]*(1/255);for(u=a;u.left;)u=y(u.est,h,f,p,g)<=0?u.left:u.right;c[d>>2]=u.ind,i[d>>2]=u.est.rgba}return{abuf:n.buffer,inds:c,plte:s}}function m(e,t,r){null==r&&(r=1e-4);const n=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=x(e,i.i0,i.i1),i.est=C(i.bst);const o=[i];for(;o.length<t;){let t=0,i=0;for(var a=0;a<o.length;a++)o[a].est.L>t&&(t=o[a].est.L,i=a);if(t<r)break;const s=o[i],l=b(e,n,s.i0,s.i1,s.est.e,s.est.eMq255);if(s.i0>=l||s.i1<=l){s.est.L=0;continue}const c={i0:s.i0,i1:l,bst:null,est:null,tdst:0,left:null,right:null};c.bst=x(e,c.i0,c.i1),c.est=C(c.bst);const u={i0:l,i1:s.i1,bst:null,est:null,tdst:0,left:null,right:null};for(u.bst={R:[],m:[],N:s.bst.N-c.bst.N},a=0;a<16;a++)u.bst.R[a]=s.bst.R[a]-c.bst.R[a];for(a=0;a<4;a++)u.bst.m[a]=s.bst.m[a]-c.bst.m[a];u.est=C(u.bst),s.left=c,s.right=u,o[i]=c,o.push(u)}for(o.sort((e,t)=>t.bst.N-e.bst.N),a=0;a<o.length;a++)o[a].ind=a;return[i,o]}function v(e,t,r,n,i){if(null==e.left)return e.tdst=function(e,t,r,n,i){const o=t-e[0],a=r-e[1],s=n-e[2],l=i-e[3];return o*o+a*a+s*s+l*l}(e.est.q,t,r,n,i),e;const o=y(e.est,t,r,n,i);let a=e.left,s=e.right;o>0&&(a=e.right,s=e.left);const l=v(a,t,r,n,i);if(l.tdst<=o*o)return l;const c=v(s,t,r,n,i);return c.tdst<l.tdst?c:l}function y(e,t,r,n,i){const{e:o}=e;return o[0]*t+o[1]*r+o[2]*n+o[3]*i-e.eMq}function b(e,t,r,n,i,o){for(n-=4;r<n;){for(;w(e,r,i)<=o;)r+=4;for(;w(e,n,i)>o;)n-=4;if(r>=n)break;const a=t[r>>2];t[r>>2]=t[n>>2],t[n>>2]=a,r+=4,n-=4}for(;w(e,r,i)>o;)r-=4;return r+4}function w(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]+e[t+3]*r[3]}function x(e,t,r){const n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],o=r-t>>2;for(let o=t;o<r;o+=4){const t=e[o]*(1/255),r=e[o+1]*(1/255),a=e[o+2]*(1/255),s=e[o+3]*(1/255);i[0]+=t,i[1]+=r,i[2]+=a,i[3]+=s,n[0]+=t*t,n[1]+=t*r,n[2]+=t*a,n[3]+=t*s,n[5]+=r*r,n[6]+=r*a,n[7]+=r*s,n[10]+=a*a,n[11]+=a*s,n[15]+=s*s}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:i,N:o}}function C(e){const{R:t}=e,{m:r}=e,{N:n}=e,i=r[0],o=r[1],a=r[2],s=r[3],l=0==n?0:1/n,c=[t[0]-i*i*l,t[1]-i*o*l,t[2]-i*a*l,t[3]-i*s*l,t[4]-o*i*l,t[5]-o*o*l,t[6]-o*a*l,t[7]-o*s*l,t[8]-a*i*l,t[9]-a*o*l,t[10]-a*a*l,t[11]-a*s*l,t[12]-s*i*l,t[13]-s*o*l,t[14]-s*a*l,t[15]-s*s*l],u=c,d=_;let h=[Math.random(),Math.random(),Math.random(),Math.random()],f=0,p=0;if(0!=n)for(let e=0;e<16&&(h=d.multVec(u,h),p=Math.sqrt(d.dot(h,h)),h=d.sml(1/p,h),!(0!=e&&Math.abs(p-f)<1e-9));e++)f=p;const g=[i*l,o*l,a*l,s*l];return{Cov:c,q:g,e:h,L:f,eMq255:d.dot(d.sml(255,g),h),eMq:d.dot(h,g),rgba:(Math.round(255*g[3])<<24|Math.round(255*g[2])<<16|Math.round(255*g[1])<<8|Math.round(255*g[0]))>>>0}}var _={multVec:(e,t)=>[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]],dot:(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],sml:(e,t)=>[e*t[0],e*t[1],e*t[2],e*t[3]]};ta.encode=function(e,t,r,n,i,o,a){null==n&&(n=0),null==a&&(a=!1);const s=u(e,t,r,n,[!1,!1,!1,0,a,!1]);return c(s,-1),l(s,t,r,i,o)},ta.encodeLL=function(e,t,r,n,i,o,a,s){const u={ctype:0+(1==n?0:2)+(0==i?0:4),depth:o,frames:[]},d=(n+i)*o,h=d*t;for(let n=0;n<e.length;n++)u.frames.push({rect:{x:0,y:0,width:t,height:r},img:new Uint8Array(e[n]),blend:0,dispose:1,bpp:Math.ceil(d/8),bpl:Math.ceil(h/8)});return c(u,0,!0),l(u,t,r,a,s)},ta.encode.compress=u,ta.encode.dither=s,ta.quantize=g,ta.quantize.getKDtree=m,ta.quantize.getNearest=v}();const ra={toArrayBuffer(e,t){const r=e.width,n=e.height,i=r<<2,o=e.getContext("2d").getImageData(0,0,r,n),a=new Uint32Array(o.data.buffer),s=(32*r+31)/32<<2,l=s*n,c=122+l,u=new ArrayBuffer(c),d=new DataView(u),h=1<<20;let f,p,g,m,v=h,y=0,b=0,w=0;function x(e){d.setUint16(b,e,!0),b+=2}function C(e){d.setUint32(b,e,!0),b+=4}function _(e){b+=e}x(19778),C(c),_(4),C(122),C(108),C(r),C(-n>>>0),x(1),x(32),C(3),C(l),C(2835),C(2835),_(8),C(16711680),C(65280),C(255),C(4278190080),C(1466527264),function e(){for(;y<n&&v>0;){for(m=122+y*s,f=0;f<i;)v--,p=a[w++],g=p>>>24,d.setUint32(m+f,p<<8|g),f+=4;y++}w<a.length?(v=h,setTimeout(e,ra._dly)):t(u)}()},toBlob(e,t){this.toArrayBuffer(e,e=>{t(new Blob([e],{type:"image/bmp"}))})},_dly:9};var na={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},ia={[na.CHROME]:16384,[na.FIREFOX]:11180,[na.DESKTOP_SAFARI]:16384,[na.IE]:8192,[na.IOS]:4096,[na.ETC]:8192};const oa="undefined"!=typeof window,aa="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,sa=oa&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),la=(oa||aa)&&(sa&&sa.getOriginalSymbol(window,"File")||"undefined"!=typeof File&&File),ca=(oa||aa)&&(sa&&sa.getOriginalSymbol(window,"FileReader")||"undefined"!=typeof FileReader&&FileReader);function ua(e,t,r=Date.now()){return new Promise(n=>{const i=e.split(","),o=i[0].match(/:(.*?);/)[1],a=globalThis.atob(i[1]);let s=a.length;const l=new Uint8Array(s);for(;s--;)l[s]=a.charCodeAt(s);const c=new Blob([l],{type:o});c.name=t,c.lastModified=r,n(c)})}function da(e){return new Promise((t,r)=>{const n=new ca;n.onload=()=>t(n.result),n.onerror=e=>r(e),n.readAsDataURL(e)})}function ha(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>t(n),n.onerror=e=>r(e),n.src=e})}function fa(){if(void 0!==fa.cachedResult)return fa.cachedResult;let e=na.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=na.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=na.IOS:/Safari/i.test(t)?e=na.DESKTOP_SAFARI:/Firefox/i.test(t)?e=na.FIREFOX:(/MSIE/i.test(t)||1==!!document.documentMode)&&(e=na.IE),fa.cachedResult=e,fa.cachedResult}function pa(e,t){const r=fa(),n=ia[r];let i=e,o=t,a=i*o;const s=i>o?o/i:i/o;for(;a>n*n;){const e=(n+i)/2,t=(n+o)/2;e<t?(o=t,i=t*s):(o=e*s,i=e),a=i*o}return{width:i,height:o}}function ga(e,t){let r,n;try{if(r=new OffscreenCanvas(e,t),n=r.getContext("2d"),null===n)throw new Error("getContext of OffscreenCanvas returns null")}catch(e){r=document.createElement("canvas"),n=r.getContext("2d")}return r.width=e,r.height=t,[r,n]}function ma(e,t){const{width:r,height:n}=pa(e.width,e.height),[i,o]=ga(r,n);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,i.width,i.height)),o.drawImage(e,0,0,i.width,i.height),i}function va(){return void 0!==va.cachedResult||(va.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"undefined"!=typeof document&&"ontouchend"in document),va.cachedResult}function ya(e,t={}){return new Promise(function(r,n){let i,o;var a=function(){try{return o=ma(i,t.fileType||e.type),r([i,o])}catch(e){return n(e)}},s=function(t){try{var r=function(e){try{throw e}catch(e){return n(e)}};try{let t;return da(e).then(function(e){try{return t=e,ha(t).then(function(e){try{return i=e,function(){try{return a()}catch(e){return n(e)}}()}catch(e){return r(e)}},r)}catch(e){return r(e)}},r)}catch(e){r(e)}}catch(e){return n(e)}};try{if(va()||[na.DESKTOP_SAFARI,na.MOBILE_SAFARI].includes(fa()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then(function(e){try{return i=e,a()}catch(e){return s()}},s)}catch(e){s()}})}function ba(e,t,r,n,i=1){return new Promise(function(o,a){let s;if("image/png"===t){let c,u,d;return c=e.getContext("2d"),({data:u}=c.getImageData(0,0,e.width,e.height)),d=ta.encode([u.buffer],e.width,e.height,4096*i),s=new Blob([d],{type:t}),s.name=r,s.lastModified=n,l.call(this)}{if("image/bmp"===t)return new Promise(t=>ra.toBlob(e,t)).then(function(e){try{return s=e,s.name=r,s.lastModified=n,h.call(this)}catch(e){return a(e)}}.bind(this),a);{if("function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:i}).then(function(e){try{return s=e,s.name=r,s.lastModified=n,f.call(this)}catch(e){return a(e)}}.bind(this),a);{let p;return p=e.toDataURL(t,i),ua(p,r,n).then(function(e){try{return s=e,f.call(this)}catch(e){return a(e)}}.bind(this),a)}function f(){return h.call(this)}}function h(){return l.call(this)}}function l(){return o(s)}})}function wa(e){e.width=0,e.height=0}function xa(){return new Promise(function(e,t){let r,n,i,o;return void 0!==xa.cachedResult?e(xa.cachedResult):ua("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(a){try{return r=a,ya(r).then(function(a){try{return n=a[1],ba(n,r.type,r.name,r.lastModified).then(function(r){try{return i=r,wa(n),ya(i).then(function(r){try{return o=r[0],xa.cachedResult=1===o.width&&2===o.height,e(xa.cachedResult)}catch(e){return t(e)}},t)}catch(e){return t(e)}},t)}catch(e){return t(e)}},t)}catch(e){return t(e)}},t)})}function Ca(e){return new Promise((t,r)=>{const n=new ca;n.onload=e=>{const r=new DataView(e.target.result);if(65496!=r.getUint16(0,!1))return t(-2);const n=r.byteLength;let i=2;for(;i<n;){if(r.getUint16(i+2,!1)<=8)return t(-1);const e=r.getUint16(i,!1);if(i+=2,65505==e){if(1165519206!=r.getUint32(i+=2,!1))return t(-1);const e=18761==r.getUint16(i+=6,!1);i+=r.getUint32(i+4,e);const n=r.getUint16(i,e);i+=2;for(let o=0;o<n;o++)if(274==r.getUint16(i+12*o,e))return t(r.getUint16(i+12*o+8,e))}else{if(65280&~e)break;i+=r.getUint16(i,!1)}}return t(-1)},n.onerror=e=>r(e),n.readAsArrayBuffer(e)})}function _a(e,t){const{width:r}=e,{height:n}=e,{maxWidthOrHeight:i}=t;let o,a=e;return isFinite(i)&&(r>i||n>i)&&([a,o]=ga(r,n),r>n?(a.width=i,a.height=n/r*i):(a.width=r/n*i,a.height=i),o.drawImage(e,0,0,a.width,a.height),wa(e)),a}function Sa(e,t){const{width:r}=e,{height:n}=e,[i,o]=ga(r,n);switch(t>4&&t<9?(i.width=n,i.height=r):(i.width=r,i.height=n),t){case 2:o.transform(-1,0,0,1,r,0);break;case 3:o.transform(-1,0,0,-1,r,n);break;case 4:o.transform(1,0,0,-1,0,n);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,n,0);break;case 7:o.transform(0,-1,-1,0,n,r);break;case 8:o.transform(0,-1,1,0,0,r)}return o.drawImage(e,0,0,r,n),wa(e),i}function Aa(e,t,r=0){return new Promise(function(n,i){let o,a,s,l,c,u,d,h,f,p,g,m,v,y,b,w,x,C,_,S;function A(e=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=e,t.onProgress(Math.min(o,100))}function k(e){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(e,o),100),t.onProgress(o)}return o=r,a=t.maxIteration||10,s=1024*t.maxSizeMB*1024,A(),ya(e,t).then(function(r){try{return[,l]=r,A(),c=_a(l,t),A(),new Promise(function(r,n){var i;if(!(i=t.exifOrientation))return Ca(e).then(function(e){try{return i=e,o.call(this)}catch(e){return n(e)}}.bind(this),n);function o(){return r(i)}return o.call(this)}).then(function(r){try{return u=r,A(),xa().then(function(r){try{return d=r?c:Sa(c,u),A(),h=t.initialQuality||1,f=t.fileType||e.type,ba(d,f,e.name,e.lastModified,h).then(function(r){try{{if(p=r,A(),g=p.size>s,m=p.size>e.size,!g&&!m)return k(100),n(p);var o;function u(){if(a--&&(b>s||b>v)){let t,r;return t=S?.95*_.width:_.width,r=S?.95*_.height:_.height,[x,C]=ga(t,r),C.drawImage(_,0,0,t,r),h*="image/png"===f?.85:.95,ba(x,f,e.name,e.lastModified,h).then(function(e){try{return w=e,wa(_),_=x,b=w.size,k(Math.min(99,Math.floor((y-b)/(y-s)*100))),u}catch(e){return i(e)}},i)}return[1]}return v=e.size,y=p.size,b=y,_=d,S=!t.alwaysKeepResolution&&g,(o=function(e){for(;e;){if(e.then)return void e.then(o,i);try{if(e.pop){if(e.length)return e.pop()?E.call(this):e;e=u}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))(u);function E(){return wa(_),wa(x),wa(c),wa(d),wa(l),k(100),n(w)}}}catch(I){return i(I)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)})}let ka;function Ea(e,t){return new Promise((r,n)=>{ka||(ka=function(e){const t=[];return t.push(e),URL.createObjectURL(new Blob(t))}("\nlet scriptImported = false\nself.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n})\n"));const i=new Worker(ka);i.addEventListener("message",function(e){if(t.signal&&t.signal.aborted)i.terminate();else if(void 0===e.data.progress){if(e.data.error)return n(new Error(e.data.error)),void i.terminate();r(e.data.file),i.terminate()}else t.onProgress(e.data.progress)}),i.addEventListener("error",n),t.signal&&t.signal.addEventListener("abort",()=>{n(t.signal.reason),i.terminate()}),i.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})})}function Ia(e,t){return new Promise(function(r,n){let i,o,a,s,l,c;if(i={...t},a=0,({onProgress:s}=i),i.maxSizeMB=i.maxSizeMB||Number.POSITIVE_INFINITY,l="boolean"!=typeof i.useWebWorker||i.useWebWorker,delete i.useWebWorker,i.onProgress=e=>{a=e,"function"==typeof s&&s(a)},!(e instanceof Blob||e instanceof la))return n(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return n(new Error("The file given is not an image"));if(c="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!l||"function"!=typeof Worker||c)return Aa(e,i).then(function(e){try{return o=e,h.call(this)}catch(e){return n(e)}}.bind(this),n);var u=function(){try{return h.call(this)}catch(e){return n(e)}}.bind(this),d=function(t){try{return Aa(e,i).then(function(e){try{return o=e,u()}catch(e){return n(e)}},n)}catch(e){return n(e)}};try{return i.libURL=i.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ea(e,i).then(function(e){try{return o=e,u()}catch(e){return d()}},d)}catch(e){d()}function h(){try{o.name=e.name,o.lastModified=e.lastModified}catch(e){}try{i.preserveExif&&"image/jpeg"===e.type&&(!i.fileType||i.fileType&&i.fileType===e.type)&&(o=Ko(e,o))}catch(e){}return r(o)}})}function Ta(e,t){var r;if(null==e?void 0:e.extension){const t=e.extension.toLowerCase(),r={jpg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},jpeg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},png:{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},gif:{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},webp:{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},svg:{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(r[t])return r[t]}if(null==e?void 0:e.type){const t=_r(e.type),r={"image/jpeg":{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},"image/png":{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},"image/gif":{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},"image/webp":{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},"image/svg+xml":{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(r[t])return r[t]}if(null==e?void 0:e.name){const t=null===(r=e.name.split(".").pop())||void 0===r?void 0:r.toLowerCase();if(t){const e={jpg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},jpeg:{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"},png:{extension:"png",mimeType:"image/png",format:"png",pixieFormat:"png"},gif:{extension:"gif",mimeType:"image/gif",format:"gif",pixieFormat:"png"},webp:{extension:"webp",mimeType:"image/webp",format:"webp",pixieFormat:"png"},svg:{extension:"svg",mimeType:"image/svg+xml",format:"svg",pixieFormat:"svg"}};if(e[t])return e[t]}}if(t){const e=_r(t),r=kr(e);let n="jpeg";return"png"===r?n="png":"svg"===r?n="svg":"jpeg"===r&&(n="jpeg"),{extension:r,mimeType:e,format:r,pixieFormat:n}}return{extension:"jpeg",mimeType:"image/jpeg",format:"jpeg",pixieFormat:"jpeg"}}Ia.getDataUrlFromFile=da,Ia.getFilefromDataUrl=ua,Ia.loadImage=ha,Ia.drawImageInCanvas=ma,Ia.drawFileInCanvas=ya,Ia.canvasToFile=ba,Ia.getExifOrientation=Ca,Ia.handleMaxWidthOrHeight=_a,Ia.followExifOrientation=Sa,Ia.cleanupCanvasMemory=wa,Ia.isAutoOrientationInBrowser=xa,Ia.approximateBelowMaximumCanvasSizeOfBrowser=pa,Ia.copyExifWithoutOrientation=Ko,Ia.getBrowserName=fa,Ia.version="2.0.2";const Fa={MAX_SIZE_MB:.48,MAX_WIDTH_OR_HEIGHT:2e3,QUALITY:.8},Oa=["gif","svg"];function Pa(e,t){const{colorHex:r,colorHex2:n,colorHex3:i}=t,o=[`--icon-grad-1: ${r}`,`--icon-grad-2: ${n}`,`--icon-stroke-1: ${r}`,`--icon-stroke-2: ${n}`,`--icon-stroke-3: ${i}`,`--icon-fill-1: ${r}`,`--icon-fill-2: ${n}`,`--icon-fill-3: ${i}`,`color: ${r}`].join(";");let a=e.replace(/<svg([^>]*)>/i,(e,t)=>{let r=t;return/style="/i.test(r)?r=r.replace(/style="([^"]*)"/i,(e,t)=>`style="${t};${o}"`):r+=` style="${o}"`,`<svg${r}>`});return a=a.replace(/var\(--icon-color-1\)/g,r).replace(/var\(--icon-color-2\)/g,n).replace(/var\(--icon-color-3\)/g,i).replace(/var\(--icon-fill-1\)/g,r).replace(/var\(--icon-fill-2\)/g,n).replace(/var\(--icon-fill-3\)/g,i).replace(/var\(--icon-stroke-1\)/g,r).replace(/var\(--icon-stroke-2\)/g,n).replace(/var\(--icon-stroke-3\)/g,i).replace(/var\(--icon-grad-1\)/g,r).replace(/var\(--icon-grad-2\)/g,n).replace(/currentColor/g,r),a}function Ma(e,t){const r=e.match(/\swidth="([0-9.]+)(px)?"/i),n=e.match(/\sheight="([0-9.]+)(px)?"/i);if(r&&n){const e=parseFloat(r[1]),i=parseFloat(n[1]);if(Number.isFinite(e)&&Number.isFinite(i)&&e>0&&i>0){const r=e/i;return r>=1?{width:t,height:Math.max(1,Math.round(t/r))}:{width:Math.max(1,Math.round(t*r)),height:t}}}const i=e.match(/viewBox="([^"]+)"/i);if(i){const e=i[1].trim().split(/\s+/);if(4===e.length){const r=parseFloat(e[2]),n=parseFloat(e[3]);if(Number.isFinite(r)&&Number.isFinite(n)&&r>0&&n>0){const e=r/n;return e>=1?{width:t,height:Math.max(1,Math.round(t/e))}:{width:Math.max(1,Math.round(t*e)),height:t}}}}return{width:t,height:t}}function Ra(e){if(!e)return null;const t=e.trim();if(t.endsWith("%"))return null;const r=parseFloat(t.replace(/px$/i,""));return Number.isFinite(r)&&r>0?r:null}function La(e,t=2,r=4096){const{width:n,height:i}=function(e){var t,r,n,i,o;const a=null!==(r=null===(t=e.match(/<\s*svg\b[\s\S]*?>/i))||void 0===t?void 0:t[0])&&void 0!==r?r:"",s=null===(n=a.match(/\bwidth\s*=\s*["']([^"']*)["']/i))||void 0===n?void 0:n[1],l=null===(i=a.match(/\bheight\s*=\s*["']([^"']*)["']/i))||void 0===i?void 0:i[1],c=Ra(s),u=Ra(l);if(null!=c&&null!=u)return{width:c,height:u};const d=null===(o=e.match(/viewBox\s*=\s*["']([^"']+)["']/i))||void 0===o?void 0:o[1];if(d){const e=d.trim().split(/[\s,]+/);if(4===e.length){const t=parseFloat(e[2]),r=parseFloat(e[3]);if(Number.isFinite(t)&&Number.isFinite(r)&&t>0&&r>0)return{width:t,height:r}}}return null!=c?{width:c,height:c}:null!=u?{width:u,height:u}:{width:300,height:300}}(e);let o=Math.max(1,Math.round(n*t)),a=Math.max(1,Math.round(i*t));const s=Math.max(64,r),l=Math.max(o,a);if(l>s){const e=s/l;o=Math.max(1,Math.round(o*e)),a=Math.max(1,Math.round(a*e))}return{width:o,height:a}}async function Na(e,t,r,n,i){var o;const a=null!==(o=null==i?void 0:i.canvasScale)&&void 0!==o?o:2,s=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(s);try{const e=new Image;await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=()=>r(new Error("Failed to load SVG image")),e.src=l});const n=document.createElement("canvas"),i=Math.max(1,Math.round(t*a)),o=Math.max(1,Math.round(r*a));n.width=i,n.height=o;const s=n.getContext("2d");if(!s)throw new Error("Canvas 2D context is not available");return s.clearRect(0,0,i,o),s.drawImage(e,0,0,i,o),function(e){return new Promise((t,r)=>{e.toBlob(e=>{e?t(e):r(new Error("canvas.toBlob returned null"))},"image/png")})}(n)}finally{URL.revokeObjectURL(l)}}async function ja(e,t,r,n,i){const o=await Na(e,t,r,0,i);return a=o,new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>{var e;return t(null!==(e=r.error)&&void 0!==e?e:new Error("readAsDataURL failed"))},r.readAsDataURL(a)});var a}function Da(e,t,r,n){return new File([e],t,{type:r,lastModified:n})}function za(e,t){return t&&t!==e.name?Da(e,t,e.type,e.lastModified):e}async function Ba(e,t={}){const{maxSizeMB:r=Fa.MAX_SIZE_MB,maxWidthOrHeight:n=Fa.MAX_WIDTH_OR_HEIGHT,mimeType:i,fileName:o,libURL:a,enableCompression:s=!0,convertSvgToPng:l=!1}=t;if(!(e&&e instanceof File))return e;let c=e,u=!1;if(l){const t=(c.type||"").toLowerCase(),r=/\.svg$/i.test(c.name.trim()),i=t.includes("svg");let a=!1;if(!i&&!r)try{const e=await async function(e,t=24e3){const r=Math.min(t,Math.max(0,e.size));return e.slice(0,r).text()}(c);a=function(e){const t=e.trimStart().replace(/^\uFEFF/,"");return!!t.startsWith("<")&&/<\s*svg[\s>/]/i.test(t)}(e)}catch(e){a=!1}if(i||r||a)try{c=await async function(e,t={}){var r,n,i;const o=null!==(r=t.pixelScale)&&void 0!==r?r:2,a=null!==(n=t.maxLongEdge)&&void 0!==n?n:4096,s=await e.text(),{width:l,height:c}=La(s,o,a),u=await Na(s,l,c,0,{canvasScale:1}),d=null!==(i=t.outputFileName)&&void 0!==i?i:e.name,h=/\.svg$/i.test(d)?d.replace(/\.svg$/i,".png"):`${d}.png`;return new File([u],h,{type:"image/png",lastModified:e.lastModified})}(c,{maxLongEdge:n,outputFileName:null!=o?o:c.name}),u=!0}catch(t){console.warn("prepareImageForUpload: SVG to PNG conversion failed, using original",t),c=e}}if(u)return c;const d=(c.type&&""!==c.type.trim()?c.type:Er(c.name))||i||"image/jpeg",h=_r(d);if(!h.startsWith("image/"))return za(c,o);const f="image/webp"===(p=h)?"image/jpeg":p;var p;const g=kr(h),m=kr(f),v=f!==h?function(e,t){const r=t.startsWith(".")?t.slice(1):t,n=e.lastIndexOf(".");return n>0?`${e.substring(0,n)}.${r}`:`${e}.${r}`}(null!=o?o:c.name,m):null!=o?o:c.name,y=s&&(b=g,!Oa.includes(b));var b;if(!y&&!(f!==h))return za(c,v);try{const t={libURL:a,useWebWorker:!0,fileType:f};y?(t.maxSizeMB=r,t.maxWidthOrHeight=n):(t.maxSizeMB=Math.max(e.size/1048576+1,1),t.initialQuality=1,t.alwaysKeepResolution=!0);const i=await Ia(c,t);return function(e,t,r,n){const i=null!=n?n:t.name;return e instanceof File?e.type!==r||e.lastModified!==t.lastModified||e.name!==i?Da(e,i,r,t.lastModified):e:Da(e,i,r,t.lastModified)}(i,c,_r(i.type||f),v)}catch(e){console.error("prepareImageForUpload failed",e);try{return za(c,v)}catch(e){return console.error("Failed to create File with normalized name after image preparation error",e),c}}}async function Ua(e){const{folderId:t,dataProviders:r,folders:n,pathHistory:i,t:o}=e,a=null==t?"":String(t);if(!a||"folders"===a)return o("Folders");if("Trash"===a)return o("Trash");const s=i||[],l=s[s.length-1];if((null==l?void 0:l.id)===a&&l.name)return l.name;const c=[...s].reverse().find(e=>e.id===a);if(null==c?void 0:c.name)return c.name;const u=null==r?void 0:r.getItem;if(u)try{const e=await Promise.resolve(u(a));if(null==e?void 0:e.name)return e.name}catch(e){}const d=null==n?void 0:n.find(e=>e.id===a);return(null==d?void 0:d.name)?d.name:a}const Va=/^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;function Ha(e){const t=new URL(e.trim());t.hash="",t.hostname=t.hostname.toLowerCase(),("https:"===t.protocol&&"443"===t.port||"http:"===t.protocol&&"80"===t.port)&&(t.port="");const r=Array.from(t.searchParams.entries()).filter(([e])=>!Va.test(e)).sort(([e,t],[r,n])=>{const i=e.localeCompare(r);return 0!==i?i:t.localeCompare(n)});return t.search="",r.forEach(([e,r])=>t.searchParams.append(e,r)),t.toString()}function Wa(e){return!!(null==e?void 0:e.startsWith("image/"))&&"image/gif"!==e}function $a(e,t){if(t===e.name)return e;try{return new File([e],t,{type:e.type,lastModified:e.lastModified})}catch(t){return console.warn("Failed to create normalized File:",t),e}}function qa(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>{var e;return r(null!==(e=n.error)&&void 0!==e?e:new Error("Failed to read proxied file"))},n.readAsDataURL(e)})}function Ga(e){try{const t=new URL(e).pathname.split("/").pop();return t?decodeURIComponent(t):void 0}catch(e){return}}function Ya(e){return null==e||""===e||"folders"===e?null:e}async function Xa(e){const t=await fetch(e,{mode:"cors"});if(!t.ok)throw new qo(`HTTP ${t.status}`,"UploadUrlDownloadFailed",t.status);return t.blob()}function Ka(e,t){var r,n;if(!(e instanceof Blob)||0===e.size)throw new qo(t("Failed to download file from the URL."),"UploadUrlDownloadFailed");const i=(null===(n=null===(r=e.type)||void 0===r?void 0:r.split(";")[0])||void 0===n?void 0:n.trim())||"image/png";if(!i.startsWith("image/"))throw new qo(t("Content type at the URL is not allowed."),"UploadUrlContentTypeNotAllowed");return{blob:e,mimeType:i}}const Za=()=>{var e,t,r,n;const{state:o,actions:a,options:s}=fo(),l=Eo(),{sortBy:u,sortOrder:d}=l.state,{actions:{fetchFolders:h}}=Wo(),{t:f}=Gn(),p=Fo(),{deleteItems:g}=$o(),{selectedFolder:m,urlForm:v,pagination:y,files:b,pathHistory:w,folders:x}=o,C=i.useRef(null),_=i.useRef([]);C.current=y,_.current=Array.isArray(b)?b:[];const S=i.useRef(null),{setFiles:A,setLoading:k,setIsUrlModalVisible:E,setActiveLibraryItem:I,setPagination:T,setSelectedFolder:F,setPathHistory:O}=a,{dataProviders:P}=s,M=c(async e=>{var t,r,n;if(!(null==P?void 0:P.getFiles))return[];const i=null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.disablePagination,{files:o,pagination:a}=await P.getFiles({folderId:"folders"!==(null==e?void 0:e.folderId)?null==e?void 0:e.folderId:void 0,noFolder:null==e?void 0:e.noFolder,search:(null===(r=null==e?void 0:e.search)||void 0===r?void 0:r.trim())||void 0,sortBy:null==e?void 0:e.sortBy,sortOrder:null==e?void 0:e.sortOrder,page:i||null==e?void 0:e.page,limit:i||null==e?void 0:e.limit,itemType:(null==e?void 0:e.itemType)||"all"});return T&&((null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.disablePagination)?T({current:1,pageSize:o.length||1,total:o.length||0}):a&&T({current:a.page,pageSize:a.limit,total:a.total})),o},[P,null===(e=null==s?void 0:s.config)||void 0===e?void 0:e.disablePagination,T]),R=c(async(e,t,r)=>di(P,e,t,r,zr(null==s?void 0:s.config)),[P,null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient]),L=c(async(e,t=!1)=>{var r,n,i;try{null==k||k(!0);let t=[];if(!(null==P?void 0:P.getFiles))return void console.error("DataProvider for getting files is not defined");t=await M(e);const r=null!=e?e:{folderId:m||"",itemType:"all"};"file"!==r.itemType&&(t=await ko(t,r,null==P?void 0:P.getFolders)),"Trash"!==(m||"")&&(t=t.filter(e=>!(e.isFolder&&"Trash"===e.id))),null==A||A(t);const n=Ya(r.folderId);if(n===Ya(m)){const e=Array.isArray(w)?w:[];S.current={selectedFolder:null!=m?m:null,pathHistory:e.map(e=>Object.assign({},e))}}}catch(o){if("StaleLoad"===(null==o?void 0:o.name))return;const a=Lo(o),l=404===(null==a?void 0:a.status)||"FileNotFound"===(null==a?void 0:a.code)||"path_folder_not_found"===(null==a?void 0:a.code);if(l||console.error("Error loading files:",o),!t&&l){const t=Vo(o,w||[]);try{return await Ho({options:s,pathFolder:t,dataProviders:null==s?void 0:s.dataProviders}),void await L(e,!0)}catch(e){console.error("Cache clear failed:",e)}}if(l&&F&&O){const t=Array.isArray(w)?w:[];if(t.length>1){const n=t.slice(0,-1),i=n[n.length-1],o=null!==(r=null==i?void 0:i.id)&&void 0!==r?r:"folders";return O(n),F(o),await h(),p.success({id:"FOLDER_NOT_FOUND_NAVIGATE",message:f("Folder not found"),description:f("Navigated to parent folder"),placement:"bottomRight"}),void await L(Object.assign(Object.assign({},e),{folderId:o}),!1)}return O([{id:"folders",name:f("Folders")}]),F("folders"),await h(),p.success({id:"FOLDER_NOT_FOUND_NAVIGATE",message:f("Folder not found"),description:f("Navigated to root folder"),placement:"bottomRight"}),void await L(Object.assign(Object.assign({},e),{folderId:"folders"}),!1)}const c=S.current;if(c&&F&&O){const e=Array.isArray(w)?w:[],t=(null!==(n=c.selectedFolder)&&void 0!==n?n:null)===(null!=m?m:null),r=function(e,t){return e.length===t.length&&e.every((e,r)=>{var n;return e.id===(null===(n=t[r])||void 0===n?void 0:n.id)})}(c.pathHistory,e);t&&r||(F(c.selectedFolder),O(c.pathHistory.map(e=>Object.assign({},e))),s.onPathChange&&s.onPathChange(c.pathHistory.map(e=>e.name)))}const u=Mo(null==a?void 0:a.code,f),d=null!=e?e:{folderId:m||"",itemType:"all"},g=void 0!==d.folderId&&""!==d.folderId?d.folderId:m||"",v=Array.isArray(w)?w.map(e=>Object.assign({},e)):[],y=null===(i=d.folderName)||void 0===i?void 0:i.trim(),b=y&&y.length>0?y:await Ua({folderId:g,dataProviders:P,folders:Array.isArray(x)?x:[],pathHistory:v,t:f}),C=f("Failed to load files"),_=f("Failed to load files in folder",{folderName:b}),A=u&&u!==C?u:void 0;p.error({id:"FILES_FETCH_FAILED",message:_,description:A,placement:"bottomRight",innerException:o,notificationDedupe:!0,data:{params:Object.assign(Object.assign({},d),{folderName:b}),folderName:b}})}finally{null==k||k(!1)}},[P,A,k,F,O,M,h,m,x,p,f,w,s]),N=c(e=>L(e),[L]),j=c(async(e,t)=>{var r;if(!(null==P?void 0:P.findFileByUrl))return null;const n=Ha(e);try{return null!==(r=await P.findFileByUrl(n))&&void 0!==r?r:null}catch(e){return console.warn("findFileByUrl failed, falling back to direct loading",e),null}},[P]),D=c(async(e,t)=>{var r,n;Xo(e,f);const i=Ha(e),o=await j(i,t);if(o)return{kind:"existing",file:o,normalizedUrl:i};let a,l,c;const u=null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.handleFileProxy,d=null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.handleProxyUrl,h=function(e){if("undefined"==typeof window)return!1;try{return new URL(e).origin===window.location.origin}catch(e){return!1}}(i);if(!h&&u)try{const e=Ka(await Promise.resolve(u(i)),f);a=e.blob,l=e.mimeType}catch(e){c=e,console.warn("handleFileProxy failed or returned a non-image blob, falling back to next strategy",e)}if(!h&&!a&&d)try{const e=await Promise.resolve(d(i)),t=Ka(await Xa(e),f);a=t.blob,l=t.mimeType}catch(e){c=e,console.warn("handleProxyUrl fetch failed or returned a non-image blob, falling back to direct fetch",e)}if(!a)try{const e=Ka(await Xa(i),f);a=e.blob,l=e.mimeType}catch(e){c=e}if(!a||!l)throw c instanceof Error?c:new qo(f("Failed to download file from the URL."),"UploadUrlDownloadFailed");const p=kr(l),g=Ga(i)||"uploaded-file",m=g.replace(/\.[^.]+$/,"")||"uploaded-file";return{kind:"blob",blob:a,normalizedUrl:i,mimeType:l,extension:p,fileName:jr(g.includes(".")?g:`${m}.${p}`,null==s?void 0:s.config)}},[j,null==s?void 0:s.config,f]),z=c(async(e,t)=>{var r,n,i,o;Xo(e,f);const a=Ha(e);try{const e=await D(a,t);if("existing"===e.kind)return e.file;return{thumbnail:await qa(e.blob),name:e.fileName,type:e.mimeType,extension:e.extension,size:e.blob.size,sourceUrl:e.normalizedUrl,saveWithoutFolder:!0}}catch(e){let u=e;if(null==P?void 0:P.uploadFileByUrl)try{const e=null!=m?m:"",t=jr(Ga(a)||"uploaded-file",null==s?void 0:s.config),i=await R(t,e,!1),o=await P.uploadFileByUrl({url:a,folderId:e,name:i,eventSource:"pixie"}),l=Ka(null!==(r=(null==o?void 0:o.id)&&P.getFileData?await P.getFileData(o.id):void 0)&&void 0!==r?r:(null==o?void 0:o.url)?await Xa(o.url):(null==o?void 0:o.thumbnailUrl)?await Xa(o.thumbnailUrl):(null==o?void 0:o.sourceUrl)?await Xa(o.sourceUrl):void 0,f),c=await qa(l.blob);return Object.assign(Object.assign({},o),{thumbnail:c,type:o.type||l.mimeType,extension:o.extension||kr(l.mimeType),size:null!==(n=o.size)&&void 0!==n?n:l.blob.size,sourceUrl:o.sourceUrl||a})}catch(e){u=e,console.warn("Failed to prepare file for Pixie via uploadByUrl fallback",e)}const d=Lo(u),h=(l=null==d?void 0:d.code,c="UploadUrlDownloadFailed","string"==typeof l?l:c),g=u instanceof qo?u:new qo(null!==(o=null!==(i=Mo(h,f))&&void 0!==i?i:null==d?void 0:d.message)&&void 0!==o?o:f("Failed to download file from the URL."),h,null==d?void 0:d.status);throw g.notificationShown=!0,await p.error({id:"EDITOR_PROXY_FILE_FAILED",message:g.message,placement:"bottomRight",data:{url:a,folderId:m||null,error:d,eventSource:"pixie"},innerException:u},t),g}var l,c},[P,p,null==s?void 0:s.config,D,R,m,f]),B=c(async e=>{const t=C.current;try{const r=_.current.find(t=>t.id===e),n=e=>{if(!e)return;const t=b.find(t=>t.id===e);return null==t?void 0:t.name};await g({items:[{id:e,isFolder:null==r?void 0:r.isFolder}],selectedFolder:m,getItemNameById:n,showNotifications:!0});const i=Object.assign({},t);let o=t.current;1===b.length&&(o=i.current>1?i.current-1:1),await N({folderId:m||"",page:o,limit:t.pageSize,sortBy:u,sortOrder:d})}catch(t){console.error("ОError when deleting a file:",t);const r=t;(null==r?void 0:r.notificationShown)||p.error({id:"FILES_DELETE_ERROR",message:f("Error when deleting a file"),placement:"bottomRight",innerException:t,data:{failCount:1,totalCount:1,itemIds:[e],folderId:m||null,errors:[{itemId:e,error:Lo(t)}]}})}},[g,N,m,f,p,b,u,d]),U=c(async e=>{try{const t=C.current;if(!(null==P?void 0:P.deleteFolder))return void p.error({id:"FOLDER_DELETE_ERROR",message:f("DataProvider for folder deletion is not configured"),placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e}});if(!await P.deleteFolder(e)){const e=new Error("Не удалось удалить папку");throw e.notificationShown=!1,e}p.success({id:"FOLDER_DELETE_SUCCESS",message:f("Folder deleted"),placement:"bottomRight",data:{successCount:1,totalCount:1,itemIds:[e],folderId:e}});m===e?await N({page:t.current,limit:t.pageSize,sortBy:u,sortOrder:d}):await N({folderId:m||"",sortBy:u,sortOrder:d,page:t.current,limit:t.pageSize})}catch(t){console.error("Error when deleting a folder:",t);const r=t;(null==r?void 0:r.notificationShown)||p.error({id:"FOLDER_DELETE_ERROR",message:f("Error when deleting a folder"),innerException:t,placement:"bottomRight",data:{totalCount:1,failCount:1,itemIds:[e],folderId:e,errors:[{itemId:e,error:Lo(t)}]}})}},[P,m,p,f,N,u,d]),V=c(async(e,t)=>{var r,n;try{if(null==P?void 0:P.getFileData){const t=await P.getFileData(e);if(t)return t;throw new Error(f("Failed to download file"))}{const t=await fetch(`/api/files/${e}/content`);if(!t.ok)throw new Error(f("Error loading image"));return await t.blob()}}catch(i){console.error("Error when loading a file:",i);const o=_.current.find(t=>t.id===e);t||p.error({id:"FILE_DOWNLOAD_FAILED",message:f("Failed to download file"),placement:"bottomRight",description:(null==o?void 0:o.name)||e,innerException:i,notificationDedupe:!1,data:{itemId:e,itemName:(null==o?void 0:o.name)||e,folderId:null!==(r=null==o?void 0:o.folderId)&&void 0!==r?r:null,thumbnail:null!==(n=null==o?void 0:o.thumbnail)&&void 0!==n?n:null}},t)}},[P,p,f]),H=c(async(e,t,r,n)=>{var i,a,l,c,u,d,h,g,v,y,b,w,x,C;if("Trash"===(n?"":null!=t?t:m||""))throw new Error(f("Upload to Trash is forbidden"));const _=jr(e.name,null==s?void 0:s.config),S=_.split(".").pop()||"",A=n?"":null!=t?t:m||"";let k=e;try{if(Ir(e)){const t=null!==(a=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.compressMaxSize)&&void 0!==a?a:Fa.MAX_SIZE_MB,r=null!==(c=null===(l=null==s?void 0:s.config)||void 0===l?void 0:l.compressMaxWidthOrHeight)&&void 0!==c?c:2e3,n=null!==(d=null===(u=null==s?void 0:s.config)||void 0===u?void 0:u.compessorUrl)&&void 0!==d?d:null===(h=null==s?void 0:s.config)||void 0===h?void 0:h.compressorUrl,o=(null===(g=e.type)||void 0===g?void 0:g.trim())||Er(e.name)||e.type;k=await Ba(e,{maxSizeMB:t,maxWidthOrHeight:r,mimeType:o,fileName:_,libURL:n,enableCompression:Wa(o),convertSvgToPng:!0})}else k=$a(e,_)}catch(t){console.warn("Image preparation failed, uploading original file",t),k=$a(e,_)}let E=k.name;const T=zr(null==s?void 0:s.config);T&&(E=await R(E,A,n)),T&&(k=$a(k,E));try{if(null==P?void 0:P.uploadFiles)try{const t=await P.uploadFiles({items:[{name:E,size:k.size,type:k.type||e.type,folderId:A,data:k,extension:S,noFolder:n}],folderId:A});if(t.success&&t.detailed&&t.detailed.length>0){const i=t.detailed[0];if(!i.success||!i.data){if(!r){const e=(null==i?void 0:i.error)?String(i.error):f("Failed to upload file");p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:e,placement:"bottomRight",description:_,innerException:null==i?void 0:i.error,data:{itemName:_,folderId:A||null,eventSource:"upload"}})}return void(I&&I(Qt))}{const t=i.data;if(t.id){const r=(null!==(v=t.folderId)&&void 0!==v?v:A)||void 0;await N({folderId:r,noFolder:n});let i=o.files.find(e=>e.id===t.id);if(!i)try{i=(await M({folderId:r,noFolder:n,itemType:"file"})).find(e=>e.id===t.id)}catch(e){console.warn("uploadFileWithProvider: не удалось получить свежий список файлов",e)}return I&&I(Qt),i||Object.assign(Object.assign({},t),{id:t.id,name:t.name||_,folderId:null!==(b=null!==(y=t.folderId)&&void 0!==y?y:A)&&void 0!==b?b:null,type:k.type||e.type,size:k.size,extension:S||_.split(".").pop()||"",thumbnail:null!==(w=t.thumbnail)&&void 0!==w?w:void 0,url:null!==(x=t.url)&&void 0!==x?x:void 0,thumbnailUrl:null!==(C=t.thumbnailUrl)&&void 0!==C?C:void 0,isFolder:!1,selected:!1})}}}else if(!t.success){if(!r){const e=t.error?String(t.error):f("Failed to upload file");p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:e,placement:"bottomRight",description:_,innerException:t.error,data:{itemName:_,folderId:A||null,eventSource:"upload"}})}return void(I&&I(Qt))}return void(I&&I(Qt))}catch(e){throw e}if(null==P?void 0:P.uploadFile){const t=await P.uploadFile({name:E,size:k.size,type:k.type||e.type,folderId:A,noFolder:n,data:k,extension:S});return I&&I(Qt),t}return void(r||p.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:f("DataProvider for file upload is not configured"),placement:"bottomRight"}))}catch(e){const t=Lo(e),n=Mo(null==t?void 0:t.code,f);return r?void 0:void p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!=n?n:f("Failed to upload file"),placement:"bottomRight",description:_,innerException:e,data:{itemName:_,folderId:A||null,error:Lo(e),eventSource:"upload"}})}},[P,m,I,o.files,N,M,p,f,null==s?void 0:s.config]),W=c(async(e,t)=>{var r;if(!(null==P?void 0:P.getFolders)||!(null==P?void 0:P.createFolder))return e||"";try{const n=await P.getFolders(),i=Array.isArray(n)?n:[],o=(e,t)=>i.find(r=>{var n;return(null!==(n=r.parentId)&&void 0!==n?n:null)===(null!=e?e:null)&&r.name===t});let a=null!=e?e:"";for(const e of t){if(!e)continue;let t=o(a,e);if(!t){const r=await P.createFolder({name:e,parentId:null!=a?a:null});i.push(r),t=r}a=t.id}return null!==(r=a)&&void 0!==r?r:e||""}catch(t){return console.warn("ensureFolderPath: unable to guarantee the path",t),e||""}},[P]),$=c(async(e,t)=>{var r,n,i,o;if(!(null===(n=null===(r=e.type)||void 0===r?void 0:r.startsWith)||void 0===n?void 0:n.call(r,"image/")))return null!=t?t:null;const a=null==e?void 0:e.webkitRelativePath;let s=t||"";if(a&&a.includes("/")){const e=a.split("/");e.pop();const r=e.filter(Boolean);r.length&&(s=await W(t||"",r)||t||"")}return null!==(o=null!==(i=s)&&void 0!==i?i:t)&&void 0!==o?o:null},[W]);c(async e=>{var t,r,n,i,o,a,s,l,c,u,d,h;const{file:f,selectedFolderId:p,uploadFn:g,progressCallbacks:m}=e;if(!(null===(r=null===(t=f.type)||void 0===t?void 0:t.startsWith)||void 0===r?void 0:r.call(t,"image/")))return{success:!0,fileName:f.name,folderId:null!=p?p:null};const v=null!==(i=null!==(n=await $(f,p))&&void 0!==n?n:p)&&void 0!==i?i:null,y=null!==(o=null!=v?v:p)&&void 0!==o?o:null;let b;null===(a=null==m?void 0:m.onStart)||void 0===a||a.call(m,f);try{if(null==m?void 0:m.onProgress){let e=0;b=window.setInterval(()=>{var t;e=Math.min(e+10+Math.floor(Date.now()%10),90),null===(t=null==m?void 0:m.onProgress)||void 0===t||t.call(m,f.name,e)},200)}const e=await g(f,null!=y?y:void 0);return(null==m?void 0:m.onProgress)&&(null===(s=null==m?void 0:m.onProgress)||void 0===s||s.call(m,f.name,100)),null===(l=null==m?void 0:m.onComplete)||void 0===l||l.call(m,f.name),{success:!0,fileName:f.name,fileId:null==e?void 0:e.id,folderId:null!==(u=null!==(c=null==e?void 0:e.folderId)&&void 0!==c?c:y)&&void 0!==u?u:null}}catch(e){const t=e instanceof Error?e.message:String(e);return null===(d=null==m?void 0:m.onError)||void 0===d||d.call(m,f.name,t),{success:!1,fileName:f.name,folderId:null!==(h=null!=y?y:p)&&void 0!==h?h:null,error:t}}finally{void 0!==b&&clearInterval(b)}},[$]);const q=c(async(e,t)=>{var r,n,i,o,a,l,c,u,d,h,g,v,y,b,w,x,C,_,S,A,k,E,T,F,O,M,R,L,N,j,D,z,B,U,V;if(0===e.length)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};null===(r=null==t?void 0:t.onStartBatch)||void 0===r||r.call(t,e);const H=e=>{const t=e.filter(Boolean);return t.length>0&&t.length<=5?t.join(", "):null},W=[];for(let r=0;r<e.length;r++){const v=e[r];if(!Ir(v)){const e=await p.warning({id:"FILES_UPLOAD_UNSUPPORTED_TYPE",message:f("Unsupported file type"),placement:"bottomRight",data:{itemName:v.name,fileType:v.type,folderId:m||null}});null===(n=null==t?void 0:t.onError)||void 0===n||n.call(t,v.name,e.message);continue}const y=jr(v.name,null==s?void 0:s.config);let b=v;try{if(Ir(v)){const e=null!==(o=null===(i=null==s?void 0:s.config)||void 0===i?void 0:i.compressMaxSize)&&void 0!==o?o:Fa.MAX_SIZE_MB,t=null!==(l=null===(a=null==s?void 0:s.config)||void 0===a?void 0:a.compressMaxWidthOrHeight)&&void 0!==l?l:2e3,r=null!==(u=null===(c=null==s?void 0:s.config)||void 0===c?void 0:c.compessorUrl)&&void 0!==u?u:null===(d=null==s?void 0:s.config)||void 0===d?void 0:d.compressorUrl,n=(null===(h=v.type)||void 0===h?void 0:h.trim())||Er(v.name)||v.type;b=await Ba(v,{maxSizeMB:e,maxWidthOrHeight:t,mimeType:n,fileName:y,libURL:r,enableCompression:Wa(n),convertSvgToPng:!0})}else b=$a(v,y)}catch(e){console.warn("Image preparation failed, uploading original file",e),b=$a(v,y)}const w=`${Date.now()}-${r}-${Math.random().toString(36).slice(2,8)}`,x=await $(b,m);null===(g=null==t?void 0:t.onStart)||void 0===g||g.call(t,b),W.push({file:b,targetFolderId:x,requestId:w,originalFileName:v.name,originalIndex:r})}const q=W.length;if(0===q)return{successCount:0,failCount:0,successes:[],errors:[],totalCount:0};const G=zr(null==s?void 0:s.config),Y=new Map;if(G&&(null==P?void 0:P.getFiles)){const e=[...new Set(W.map(e=>{var t,r;return null!==(r=null!==(t=e.targetFolderId)&&void 0!==t?t:m)&&void 0!==r?r:""}).filter(e=>null!=e))];for(const t of e)try{const{files:e}=await P.getFiles({folderId:""===t?"":null!=t?t:void 0,itemType:"all",page:1,limit:1e4});let r=(e||[]).map(e=>e.name).filter(e=>!!e);if(null==P?void 0:P.getFolders){const e=(await P.getFolders({parentId:t||null,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);r=[...r,...e]}Y.set(t,r)}catch(e){console.warn("Could not fetch files for duplicate check:",e)}}const X=new Map,K=W.map(e=>{const t=G?((e,t)=>{const r=null!=e?e:"";let n=Y.get(r)||[],i=X.get(r);i||(i=new Set(n.map(e=>e.toLowerCase())),X.set(r,i));const o=ui(t,Array.from(i));return i.add(o.toLowerCase()),o})(e.targetFolderId,e.file.name):e.file.name,r=G?$a(e.file,t):e.file;return Object.assign(Object.assign({},e),{resolvedUploadName:t,uploadFile:r})}),Z=!t,J=1===q&&Z,Q=[],ee=[],te=[],re=[],ne=new Map;let ie=0,oe=0;const ae=null!==(y=null===(v=null==s?void 0:s.config)||void 0===v?void 0:v.maxFileSize)&&void 0!==y?y:52428800,se=async(e,r,n,i)=>{var o,a;const{emitProgress:s=!0,emitNotification:l=!0}=null!=i?i:{};ie++,Q.push(e),ee.push(null!=n?n:e),await((e,t,r,n)=>{var i;return p.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${f("File")} ${e} ${f("has been successfully uploaded")}`,placement:"bottomRight",data:{itemId:r,itemName:e,folderId:null!==(i=null!=t?t:m)&&void 0!==i?i:null,eventSource:"upload"}},n||!Z)})(e,r,n,!l),s&&(null===(o=null==t?void 0:t.onProgress)||void 0===o||o.call(t,e,100),null===(a=null==t?void 0:t.onComplete)||void 0===a||a.call(t,e))},le=async(e,r,n,i)=>{var o;const{emitProgress:a=!0,emitNotification:s=!0,fileSize:l,progressCallbackName:c,progressCallbackIndex:u}=null!=i?i:{};oe++;const d=null!=l?{fileSize:l,maxSize:ae}:void 0,h=await((e,t,r,n,i)=>{var o,a,s,l,c,u,d;const h=Lo(r),g=null!==(o=null==i?void 0:i.fileSize)&&void 0!==o?o:null==h?void 0:h.fileSize,v=null!==(s=null!==(a=null==i?void 0:i.maxSize)&&void 0!==a?a:null==h?void 0:h.maxSize)&&void 0!==s?s:ae,y={allowedChars:"a-z A-Z 0-9 . _ -",fileSize:null!=g?si(Number(g)):void 0,maxSize:null!=v?si(Number(v)):void 0},b=null==h?void 0:h.code,w="BatchItemLimitExceeded"===b||"exceeded_max_files"===b?b:null!==(l=Ro(null==h?void 0:h.message))&&void 0!==l?l:b,x="BatchItemLimitExceeded"===w||"exceeded_max_files"===w?No(r,f):Mo(w,f,y),C=(null==h?void 0:h.message)&&"string"==typeof h.message&&h.message.length>0?h.message:null,_=r instanceof Error?r.message:"string"==typeof r?r:null,S=_&&"[object Object]"!==_?_:null;return p.error({id:"FILE_UPLOAD_ITEM_FAILED",message:null!==(u=null!==(c=null!=C?C:x)&&void 0!==c?c:S)&&void 0!==u?u:f("Error uploading file {{fileName}}",{fileName:e}),placement:"bottomRight",data:{itemName:e,folderId:null!==(d=null!=t?t:m)&&void 0!==d?d:null,error:Lo(r),eventSource:"upload"},innerException:r},n||!Z)})(e,r,n,!s,d);a&&(null===(o=null==t?void 0:t.onError)||void 0===o||o.call(t,null!=c?c:e,h.message,u)),re.push({itemId:void 0,itemName:e,error:Lo(n)}),te.push({fileName:e,error:h.message})};let ce;if(!(null==P?void 0:P.uploadFiles))return p.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:f("DataProvider for file upload is not configured"),placement:"bottomRight"}),{successCount:0,failCount:q,successes:[],errors:[],totalCount:q};{const e=[];try{(null==t?void 0:t.onProgress)&&W.forEach(r=>{let n=0;const i=window.setInterval(()=>{var e;n=Math.min(n+10+Math.floor(Date.now()%10),90),null===(e=null==t?void 0:t.onProgress)||void 0===e||e.call(t,r.file.name,n)},200);e.push(i)}),ce=await P.uploadFiles({items:K.map(e=>{var t,r;return{requestId:e.requestId,name:e.resolvedUploadName,size:e.uploadFile.size,type:e.uploadFile.type,folderId:null!==(r=null!==(t=e.targetFolderId)&&void 0!==t?t:m)&&void 0!==r?r:null,data:e.uploadFile,extension:e.uploadFile.name.split(".").pop()||""}}),folderId:null!=m?m:null}),e.forEach(e=>window.clearInterval(e)),e.length=0;const r=null!==(b=ce.detailed)&&void 0!==b?b:[],n=new Map(r.filter(e=>e.requestId).map(e=>[e.requestId,e]));if(r.length>0)for(let e=0;e<K.length;e++){const t=K[e],i=null!==(w=t.requestId?n.get(t.requestId):void 0)&&void 0!==w?w:r[e];if(i&&i.success){const e=i.data,r=null!==(x=null==e?void 0:e.name)&&void 0!==x?x:t.resolvedUploadName,n=null!==(S=null!==(_=null!==(C=null==e?void 0:e.folderId)&&void 0!==C?C:t.targetFolderId)&&void 0!==_?_:m)&&void 0!==S?S:null,o=null==e?void 0:e.id;ne.set(r,{id:o,name:r,folderId:n,size:null==e?void 0:e.size,originalFileName:t.originalFileName,originalIndex:t.originalIndex}),await se(r,n,o,{emitNotification:J})}else{const e=null==i?void 0:i.data,r=null!==(A=null==e?void 0:e.name)&&void 0!==A?A:t.resolvedUploadName,n=null!==(T=null!==(E=null!==(k=null==e?void 0:e.folderId)&&void 0!==k?k:t.targetFolderId)&&void 0!==E?E:m)&&void 0!==T?T:null;await le(r,n,null!==(F=null==i?void 0:i.error)&&void 0!==F?F:new Error(f("Error uploading file")),{emitNotification:J,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}else if(ce.success)for(const e of K){const t=e.resolvedUploadName,r=null!==(M=null!==(O=e.targetFolderId)&&void 0!==O?O:m)&&void 0!==M?M:null;await se(t,r,void 0,{emitNotification:J})}else{const e=null!==(R=ce.error)&&void 0!==R?R:new Error(f("Error uploading file"));for(const t of K){const r=t.resolvedUploadName,n=null!==(N=null!==(L=t.targetFolderId)&&void 0!==L?L:m)&&void 0!==N?N:null;await le(r,n,e,{emitNotification:J,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}}catch(e){for(const t of K){const r=t.resolvedUploadName,n=null!==(D=null!==(j=t.targetFolderId)&&void 0!==j?j:m)&&void 0!==D?D:null;await le(r,n,null!=e?e:new Error(f("Error uploading file")),{emitNotification:J,fileSize:t.file.size,progressCallbackName:t.originalFileName,progressCallbackIndex:t.originalIndex})}}finally{e.forEach(e=>window.clearInterval(e))}}if(ie>0&&(I&&I(Qt),q>1&&Z)){const e=H(Q),t=e?f("Uploaded",{names:e}):f("uploads_success_summary",{successCount:ie,totalCount:q});p.success({id:"FILES_UPLOAD_BATCH_SUCCESS",message:t,placement:"bottomRight",data:{successCount:ie,totalCount:q,itemIds:ee,itemNames:Q,folderId:null!=m?m:null,eventSource:"upload"}})}if(oe>0&&Z&&!J)if(q>1){const e=te.map(e=>e.fileName),t=H(e),r=t?f("Failed",{names:t}):f("uploads_fail_summary",{failCount:oe,totalCount:q});p.error({id:"FILES_UPLOAD_BATCH_FAILED",message:r,placement:"bottomRight",data:{failCount:oe,totalCount:q,itemNames:e,folderId:null!=m?m:null,errors:re,eventSource:"upload"}})}else if(1===q&&re.length>0&&(null===(z=re[0].error)||void 0===z?void 0:z.code)){const e=Mo(null===(B=re[0].error)||void 0===B?void 0:B.code,f),t=null!==(V=null===(U=te[0])||void 0===U?void 0:U.fileName)&&void 0!==V?V:"",r=null!=e?e:t?`${f("Failed to upload files")}: ${t}`:f("Failed to upload files");p.error({id:"FILES_UPLOAD_BATCH_FAILED",message:r,placement:"bottomRight",data:{failCount:oe,totalCount:q,itemNames:[t],folderId:null!=m?m:null,errors:re,eventSource:"upload"}})}return{successCount:ie,failCount:oe,successes:Q,errors:te,totalCount:q,uploadedFiles:ne.size>0?ne:void 0}},[P,null===(r=null==s?void 0:s.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient,p,$,m,I,f,null==s?void 0:s.config]),G=c(async e=>{var t;if(!(null==P?void 0:P.uploadFiles))return void p.error({id:"FILES_UPLOAD_PROVIDER_NOT_CONFIGURED",message:f("DataProvider for file upload is not configured"),placement:"bottomRight"});if("Trash"===m)return void p.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:f("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:m||null,reason:"Upload to Trash is not allowed"}});const r=C.current,n=document.createElement("input");n.type="file",n.accept="image/*",n.multiple=!0;try{!(!(null===(t=null==s?void 0:s.config)||void 0===t?void 0:t.features)||!s.config.features.enableDirectoryUpload)&&(n.webkitdirectory=!0)}catch(e){}n.onchange=async t=>{var n;const i=t.target.files;if(!i||0===i.length)return;const o=Array.from(i);try{null==k||k(!0);const{successes:t,errors:i,uploadedFiles:a}=await q(o,e);null===(n=null==e?void 0:e.onBatchComplete)||void 0===n||n.call(e,{files:o,successes:t,errors:i,uploadedFiles:a}),await h(),await N({folderId:m||"",sortBy:u,sortOrder:d,page:r.current,limit:r.pageSize})}catch(e){console.error("Error when loading files:",e)}finally{null==k||k(!1)}},n.click()},[null==P?void 0:P.uploadFiles,m,p,f,k,N,h,u,d,q,null===(n=null==s?void 0:s.config)||void 0===n?void 0:n.features]),Y=c(async(e,t,r,n="uploadByUrl")=>{const i=C.current,o=Boolean(e&&String(e).trim());let a,l=null!=e?e:null;try{if(!t&&"Trash"===m)throw r||p.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:f("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:m||null,reason:"Upload to Trash is not allowed"}}),new qo(f("Cannot upload files to Trash"),"UploadUrlDownloadFailed");let e,c;if(!l&&v&&(e=await v.validateFields(),l=null==e?void 0:e.fileUrl),!l)throw r||p.error({id:"FILES_UPLOAD_URL_VALIDATION_FAILED",message:f("Please fill in all fields"),placement:"bottomRight",data:{url:null!=l?l:null,folderId:m||null,eventSource:n}}),new qo(f("Please fill in all fields"),"UploadUrlInvalid");if(Xo(l,f),l=Ha(l),null==k||k(!0),l){const e=l.split("?")[0].split("#")[0].split("/");c=e[e.length-1]||"uploaded-file",c=jr(c,null==s?void 0:s.config)}const h=t?"":m||"",g=Boolean((null==P?void 0:P.uploadFiles)||(null==P?void 0:P.uploadFile)),y=Boolean(null==P?void 0:P.uploadFileByUrl);let b=c;b&&y&&(b=await R(b,h,t));try{const e=await D(l,r);if("existing"===e.kind)a=e.file;else if(g){const r=new File([e.blob],e.fileName,{type:e.mimeType,lastModified:Date.now()});try{a=await H(r,h,!0,t)}catch(e){throw e.uploadUrlStage="binaryUpload",e}if(!a){const e=new qo(f("Failed to upload file"),"FileUploadBackendError");throw e.uploadUrlStage="binaryUpload",e}}else{if(!y)throw r||p.error({id:"FILES_UPLOAD_URL_NOT_SUPPORTED",message:f("Upload by URL is not supported"),placement:"bottomRight",data:{url:l,folderId:m||null,eventSource:n}}),new qo(f("Upload by URL is not supported"),"UploadUrlDownloadFailed");a=await P.uploadFileByUrl({url:l,folderId:m||"",noFolder:t,name:b,eventSource:n})}}catch(e){const r=e;if("binaryUpload"===(null==r?void 0:r.uploadUrlStage)||!y)throw e;console.warn("Failed to fetch file by URL locally, falling back to uploadByUrl",e),a=await P.uploadFileByUrl({url:l,folderId:m||"",noFolder:t,name:b,eventSource:n})}const w=(null==e?void 0:e.name)||(null==a?void 0:a.name)||"unnamed file";return a&&p.success({id:"FILE_UPLOAD_ITEM_SUCCESS",message:`${f("File")} ${w} ${f("successfully uploaded")}`,placement:"bottomRight",data:{itemName:w,itemId:null==a?void 0:a.id,folderId:m||null,eventSource:n}},r),(e||o)&&(null==E||E(!1),null==v||v.resetFields()),I&&I(Qt),await N({folderId:m||"",noFolder:t,sortBy:u,sortOrder:d,page:i.current,limit:i.pageSize}),a}catch(e){if(console.error("Error when loading a file by URL:",e),!r){const t=Lo(e),r=t,i=e,o=Number(null==r?void 0:r.fileSize),a=Number(null==r?void 0:r.maxSize),s=Number.isFinite(o)&&Number.isFinite(a)?{fileSize:o,maxSize:a}:void 0,c="binaryUpload"===(null==i?void 0:i.uploadUrlStage)?No(t,f,s):zo(t,f);p.error({id:"FILES_UPLOAD_BY_URL_FAILED",message:c,placement:"bottomRight",data:{url:null!=l?l:null,folderId:m||null,error:t,eventSource:n},innerException:e})}throw e}finally{null==k||k(!1)}},[v,k,P,p,f,E,I,N,m,u,d,R,D,H,null==s?void 0:s.config]),X=c(async e=>{if(!e.length)return;const t=C.current;"Trash"!==m?(await q(e),await N({folderId:m||"",sortBy:u,sortOrder:d,page:t.current,limit:t.pageSize})):p.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:f("Cannot upload files to Trash"),placement:"bottomRight",data:{folderId:m||null,reason:"Upload to Trash is not allowed"}})},[N,m,u,d,q,p,f]);return{fetchFiles:N,handleDeleteFile:B,handleDeleteFolder:U,handleAddFile:G,handleAddFileByUrl:Y,handleDroppedFiles:X,getFileData:V,findFileByUrl:j,resolveFileForEditByUrl:z,uploadFileWithProvider:H}},Ja=e=>{let t;const r=new Set,n=(e,n)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(n,i,o);return o},Qa=e=>e;const es=e=>{const t=(e=>e?Ja(e):Ja)(e),r=e=>function(e,t=Qa){const r=i.useSyncExternalStore(e.subscribe,i.useCallback(()=>t(e.getState()),[e,t]),i.useCallback(()=>t(e.getInitialState()),[e,t]));return i.useDebugValue(r),r}(t,e);return Object.assign(r,t),r};function ts(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const rs=(ns=e=>({selectedFiles:new Set,visibleFileIds:[],anchorId:null,multiSelect:!0,setMultiSelect:t=>{e(e=>{var r;if(e.multiSelect===t)return e;if(t)return{multiSelect:!0};const n=null!==(r=Array.from(e.selectedFiles)[0])&&void 0!==r?r:null;return{multiSelect:!1,selectedFiles:n?new Set([n]):new Set,anchorId:n}})},syncVisibleFiles:t=>{const r=Array.isArray(t)?t.map(e=>e.id):[];e(e=>{const t=new Set(r),n=new Set(Array.from(e.selectedFiles).filter(e=>t.has(e))),i=e.anchorId&&t.has(e.anchorId)?e.anchorId:null,o=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0}(e.visibleFileIds,r),a=ts(e.selectedFiles,n),s=e.anchorId===i;return o&&a&&s?e:{visibleFileIds:r,selectedFiles:n,anchorId:i}})},setSelectedFiles:t=>{e(e=>{var r;const n=new Set(e.visibleFileIds),i=new Set(Array.from(t).filter(e=>n.has(e)));return ts(e.selectedFiles,i)?e:{selectedFiles:i,anchorId:null!==(r=Array.from(i)[0])&&void 0!==r?r:null}})},clearSelection:()=>{e(e=>0===e.selectedFiles.size&&null===e.anchorId?e:{selectedFiles:new Set,anchorId:null})},selectAllVisible:()=>{e(e=>{var t;const r=new Set(e.visibleFileIds),n=null!==(t=e.visibleFileIds[0])&&void 0!==t?t:null;return ts(e.selectedFiles,r)&&e.anchorId===n?e:{selectedFiles:r,anchorId:n}})},toggleFileSelection:(t,r)=>{e(e=>{const n=!1!==e.multiSelect,i=Boolean(null==r?void 0:r.shiftKey)&&n,o=Boolean(null==r?void 0:r.metaKey)||Boolean(null==r?void 0:r.ctrlKey)||Boolean(null==r?void 0:r.forceToggle),a=e.visibleFileIds,s=new Set(a);if(a.length>0&&!s.has(t))return e;if(!n){const r=new Set([t]);return ts(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}if(i&&e.anchorId&&s.has(e.anchorId)){const r=a.indexOf(e.anchorId),n=a.indexOf(t);if(-1===r||-1===n)return e;const[i,s]=r<n?[r,n]:[n,r],l=a.slice(i,s+1),c=o?new Set(e.selectedFiles):new Set;return l.forEach(e=>{c.add(e)}),ts(e.selectedFiles,c)?e:{selectedFiles:c}}if(i&&!e.anchorId){const r=new Set([t]);return ts(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}if(o){const r=new Set(e.selectedFiles);return r.has(t)?r.delete(t):r.add(t),ts(e.selectedFiles,r)&&e.anchorId===t?e:{selectedFiles:r,anchorId:t}}const l=new Set([t]);return ts(e.selectedFiles,l)&&e.anchorId===t?e:{selectedFiles:l,anchorId:t}})}}),ns?es(ns):es);var ns;const is=e=>{var t,r,n,i;const{state:o,actions:a,options:s}=fo(),{t:l}=Gn(),u=Wo(),d=Fo(),{fetchFolders:h}=u.actions,{renameItem:f}=(()=>{const{options:e}=fo(),{dataProviders:t}=e,{t:r}=Gn(),n=c(async({itemId:n,newName:i,isFolder:o})=>{var a,s,l,c,u,d,h,f;try{if(o){if(!(null==t?void 0:t.renameFolder))throw new Error(r("renameFolder is not implemented in dataProviders"));const o=Dr(i.trim(),e.config),c=await t.renameFolder(n,o);return{success:!0,renamedItem:{id:c.id,name:null!==(a=c.name)&&void 0!==a?a:o,parentId:null!==(s=c.parentId)&&void 0!==s?s:null,folderId:null!==(l=c.parentId)&&void 0!==l?l:null}}}if(!(null==t?void 0:t.renameFile))throw new Error(r("renameFile is not implemented in dataProviders"));const p=jr(i,e.config),g=await t.renameFile(n,p);return{success:!0,renamedItem:{id:null!==(c=null==g?void 0:g.id)&&void 0!==c?c:n,name:null!==(u=null==g?void 0:g.name)&&void 0!==u?u:p,folderId:null!==(d=null==g?void 0:g.folderId)&&void 0!==d?d:null,parentId:null!==(f=null!==(h=null==g?void 0:g.parentId)&&void 0!==h?h:null==g?void 0:g.folderId)&&void 0!==f?f:null}}}catch(e){return{success:!1,error:Lo(e)}}},[t,r,e.config]);return{renameItem:n}})(),{files:p,selectedFolder:g,fileToRename:m,renameForm:v,isRenameModalVisible:y,pagination:b}=o,{setFileToRename:w,setIsRenameModalVisible:x}=a,{dataProviders:C,config:_}=s,S=e=>{var t,r;if(!e)return null;const n=e;return null!==(r=null!==(t=n.folderId)&&void 0!==t?t:n.parentId)&&void 0!==r?r:null},A=(e,t)=>{var r;return{itemId:null!==(r=null==e?void 0:e.id)&&void 0!==r?r:t,itemName:null==e?void 0:e.name,folderId:S(e)}},k=c(e=>{var t,r;const n=null==p?void 0:p.find(t=>t.id===e);if((null==n?void 0:n.isFolder)||e.startsWith("folder_")){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:A(n,e)});if(!(null==C?void 0:C.renameFolder))throw new Error(l("renameFolder is not implemented in dataProviders"))}else{if(!(!1!==(null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:A(n,e)});if(!(null==C?void 0:C.renameFile))throw new Error(l("renameFile is not implemented in dataProviders"))}null==w||w(e),null==x||x(!0),n&&v&&v.setFieldsValue({newFileName:n.name})},[p,w,x,v,null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder,null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFile,null==C?void 0:C.renameFolder,null==C?void 0:C.renameFile,d,l]),E=c(()=>{null==x||x(!1),null==w||w(null),null==v||v.resetFields()},[x,w,v]),I=c(async()=>{var t,r,n,i,o,s,c,u,y,w,x,C;if(!m||!v)return;const S=null==p?void 0:p.find(e=>e.id===m);try{const p=await v.validateFields();if(!(null==p?void 0:p.newFileName))return;const k=(null==S?void 0:S.isFolder)||m.startsWith("folder_");if(k){if(!(!1!==(null===(t=null==_?void 0:_.features)||void 0===t?void 0:t.enableRenameFolder)))return void d.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:l("Folder rename is disabled by config"),placement:"bottomRight",data:A(S,m)})}else{if(!(!1!==(null===(r=null==_?void 0:_.features)||void 0===r?void 0:r.enableRenameFile)))return void d.error({id:"FILE_RENAME_DISABLED_BY_CONFIG",message:l("File rename is disabled by config"),placement:"bottomRight",data:A(S,m)})}const I=await f({itemId:m,newName:p.newFileName,isFolder:k});if(!I.success){const e=Mo(null===(n=I.error)||void 0===n?void 0:n.code,l);return void d.error({id:"ITEM_RENAME_FAILED",message:null!==(o=null!=e?e:null===(i=I.error)||void 0===i?void 0:i.message)&&void 0!==o?o:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},A(S,m)),{error:I.error}),innerException:I.error})}const T=I.renamedItem;k?(d.success({id:"FOLDER_RENAME_SUCCESS",message:l(`${l("Folder renamed to")} ${null!==(s=null==T?void 0:T.name)&&void 0!==s?s:p.newFileName}`),placement:"bottomRight",data:{itemId:null!==(c=null==T?void 0:T.id)&&void 0!==c?c:m,itemName:null!==(u=null==T?void 0:T.name)&&void 0!==u?u:p.newFileName,folderId:null!==(w=null!==(y=null==T?void 0:T.parentId)&&void 0!==y?y:null==T?void 0:T.folderId)&&void 0!==w?w:null}}),await h(),(null==T?void 0:T.id)&&T.id!==m&&a.setSelectedFolder&&a.setSelectedFolder(T.id)):d.success({id:"FILE_RENAME_SUCCESS",message:`${l("File renamed to")} ${null!==(x=null==T?void 0:T.name)&&void 0!==x?x:p.newFileName}`,placement:"bottomRight",data:Object.assign(Object.assign({},A(S,m)),{itemName:null!==(C=null==T?void 0:T.name)&&void 0!==C?C:p.newFileName})}),E(),await e({folderId:g||"",page:b.current,limit:b.pageSize})}catch(e){console.error("Error when renaming:",e);const t=Lo(e),r=Mo(null==t?void 0:t.code,l);d.error({id:"ITEM_RENAME_FAILED",message:null!=r?r:e instanceof Error?e.message:l("Error renaming"),placement:"bottomRight",data:Object.assign(Object.assign({},A(S,m)),{error:t}),innerException:e})}},[m,v,p,a,E,e,g,l,b,null===(n=null==_?void 0:_.features)||void 0===n?void 0:n.enableRenameFolder,null===(i=null==_?void 0:_.features)||void 0===i?void 0:i.enableRenameFile,d,h,f]);return{state:{isRenamingFile:y||!1,fileToRename:m},actions:{showRenameModal:k,handleRenameCancel:E,handleRenameOk:I}}},os=e=>{const t=t=>{if(!t)return;const r=e.find(e=>e.id===t);return null==r?void 0:r.name};return{getItemNameById:t,getItemNamesByIds:e=>e.map(t).filter(e=>Boolean(e)),getNamesPreview:e=>e.length>0&&e.length<=5?e.join(", "):null}},as=(e,t,r,n,i)=>({itemIds:e,itemNames:i&&i.length?i:void 0,successCount:t,totalCount:r,folderId:null!=n?n:null}),ss=(e,t,r,n,i,o)=>({itemIds:e,itemNames:o&&o.length?o:void 0,failCount:t,totalCount:r,folderId:null!=n?n:null,errors:i}),ls=()=>{const e=Fo(),{t:t}=Gn(),{state:r,options:n}=fo(),{folders:i,pathHistory:o}=r,{dataProviders:a}=n,{actions:{fetchFolders:s,fetchChildFolders:l}}=Wo();return{refreshFolders:c(async({parentIds:r,selectedFolder:n})=>{try{if(await s(),r&&l)for(const e of r)e&&await l(e)}catch(r){console.error("Error when updating the folder tree:",r);const n=t("Folders");e.error({id:"FOLDERS_FETCH_FAILED",message:t("Failed to refresh folder tree"),description:n,placement:"bottomRight",innerException:r,notificationDedupe:!0,data:{folderId:null,folderName:n,reason:r instanceof Error?r.message:String(r)}})}},[e,t,s,l]),refreshFiles:c(async({fetchFiles:r,selectedFolder:n,page:s,limit:l})=>{try{await r({folderId:n||"",page:s,limit:l})}catch(r){console.error("Ошибка при обновлении списка файлов:",r);const c=await Ua({folderId:n||"",dataProviders:a,folders:Array.isArray(i)?i:[],pathHistory:o,t:t}),u=t("Failed to load files"),d=r instanceof Error?r.message:String(r);e.error({id:"FILES_FETCH_FAILED",message:t("Failed to load files in folder",{folderName:c}),description:d&&d!==u?d:void 0,placement:"bottomRight",innerException:r,notificationDedupe:!0,data:{params:{folderId:n||void 0,page:s,limit:l,folderName:c},folderName:c}})}},[e,t,a,i,o])}},cs=e=>{var t;const{state:r,actions:n,options:i}=fo(),{t:o}=Gn(),a=Fo(),s=rs(e=>e.selectedFiles),l=rs(e=>e.clearSelection),{files:u,selectedFolder:d,moveForm:h,pagination:f,currentMenuFile:p}=r,{setIsMoveModalVisible:g,setPagination:m}=n,{dataProviders:v}=i,{moveItems:y}=(()=>{const{options:e}=fo(),{dataProviders:t}=e,{t:r}=Gn(),n=Fo(),i=c(async({items:e,targetFolderId:i,getItemNameById:o,showNotifications:a=!1})=>{let s=0,l=0;const c=[];if(null==t?void 0:t.moveItems)try{const r=await t.moveItems("folders"===i?"":i,e.map(e=>e.id)),n=r.detailed;if(n){const e=n.filter(e=>e.success),t=n.filter(e=>!e.success);s+=e.length,l+=t.length,t.forEach(e=>{const t=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),r=e.error,n=Lo(r);c.push({itemId:t,itemName:o(t),error:n})})}else if(r.success)s+=e.length;else{const t=r.error;if(t){l+=e.length;const r=Lo(t);c.push({error:r})}else l+=e.length}}catch(t){l+=e.length;const r=Lo(t);c.push({error:r})}else l+=e.length,c.push({error:{message:"Move provider is not configured"}});return a&&(s>0&&n.success({id:"FILES_MOVE_SUCCESS",message:r("Files moved"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&n.error({id:"FILES_MOVE_ERROR",message:r("Errors occurred while moving"),placement:"bottomRight",innerException:c.length?c:void 0,data:{failCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),errors:c.length?c:void 0}})),{successCount:s,failCount:l,errorDetails:c}},[t,n,r]);return{moveItems:i}})(),{refreshFolders:b,refreshFiles:w}=ls(),{getItemNameById:x,getItemNamesByIds:C,getNamesPreview:_}=os(u),S=c(()=>{null==g||g(!0)},[g]),A=c(()=>{null==g||g(!1),null==h||h.resetFields()},[g,h]),k=c(async t=>{var r,n,c,g,S,k,E,I;if(!((null==p?void 0:p.length)||s&&0!==s.size))return;const T=u.length,F=Object.assign({},f),O=Array.from((null==p?void 0:p.length)?[p]:s),P=O.length;let M=0,R=0;const L=[],N=O.map(e=>u.find(t=>t.id===e)).filter(e=>Boolean(e)),j=N.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let s=t;if(!t){const e=await h.validateFields();s=null==e?void 0:e.targetFolder}if(!s)return void a.error({id:"FILES_MOVE_DIRECTORY_NOT_SELECTED",message:o("Select destination folder"),placement:"bottomRight"});const u="folders"===s?null:s,f=null!=u?u:d,p=!0===(null===(r=null==i?void 0:i.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient);if(p&&(null==v?void 0:v.getFolders))try{const e=await v.getFolders({parentId:u,deep:!1}),t=new Set((e||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean));for(const e of N){if(!e.isFolder&&!(null===(c=(n=e.id).startsWith)||void 0===c?void 0:c.call(n,"folder_")))continue;const r=e.name||x(e.id)||"";if(r&&t.has(r.toLowerCase()))return void a.error({id:"FOLDER_ALREADY_EXISTS_MOVE",message:o("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:r,targetFolderId:s}})}}catch(e){console.warn("Could not check folder duplicates for move:",e)}if(p&&(null==v?void 0:v.getFiles)&&(null==v?void 0:v.renameFile))try{let e=[];if(null==v?void 0:v.getFiles){const{files:t}=await v.getFiles({folderId:null!=u?u:void 0,itemType:"all",page:1,limit:1e4});e=(t||[]).map(e=>e.name).filter(e=>!!e)}if(null==v?void 0:v.getFolders){const t=(await v.getFolders({parentId:u,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);e=[...e,...t]}const t=new Set(e.map(e=>null==e?void 0:e.toLowerCase()).filter(Boolean));for(const e of N){if(e.isFolder||(null===(S=(g=e.id).startsWith)||void 0===S?void 0:S.call(g,"folder_")))continue;const r=e.name||x(e.id)||"";if(!r||!t.has(r.toLowerCase())){t.add(r.toLowerCase());continue}const n=ui(r,Array.from(t));await v.renameFile(e.id,n),t.add(n.toLowerCase())}}catch(e){console.warn("Could not check duplicates for move:",e)}const D=await y({items:N,targetFolderId:s,getItemNameById:x,showNotifications:!1});if(M=D.successCount,R=D.failCount,L.push(...D.errorDetails),M>0){const e=C(O),t=_(e),r=t?o("Moved",{names:t}):o("move_success_summary",{successCount:M,totalCount:P});a.success({id:"FILES_MOVE_SUCCESS",message:r,placement:"bottomRight",data:as(O,M,P,u,e)})}if(R>0){const e=C(O),t=_(e);let r;if(1===P&&L.length>0&&(null===(k=L[0].error)||void 0===k?void 0:k.code)){const e=Mo(null===(E=L[0].error)||void 0===E?void 0:E.code,o);r=null!=e?e:t?o("Failed",{names:t}):o("move_fail_summary",{failCount:R,totalCount:P})}else r=t?o("Failed",{names:t}):o("move_fail_summary",{failCount:R,totalCount:P});a.error({id:"FILES_MOVE_ERROR",message:r,placement:"bottomRight",innerException:L.length?L:void 0,data:ss(O,R,P,u,L.length?L:void 0,e)})}A(),l();let z=F.current;if(M>0&&T>0&&M>=T&&F.current>1&&(z=F.current-1),M>0&&F.total>=M){const e=Math.max(0,(null!==(I=F.total)&&void 0!==I?I:0)-M);null==m||m({current:z,pageSize:F.pageSize,total:e})}j&&await b({parentIds:void 0,selectedFolder:f}),await w({fetchFiles:e,selectedFolder:d,page:z,limit:F.pageSize})}catch(e){console.error("Error when moving:",e);const t=Mo(Lo(e).code,o);a.error({id:"FILES_MOVE_ERROR",innerException:e,message:null!=t?t:o("Error moving"),placement:"bottomRight",data:ss(O,P,P,d||null,[{error:Lo(e)}],C(O))})}},[p,s,h,e,d,f,u,a,m,o,y,l,g,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient,null==v?void 0:v.getFiles,null==v?void 0:v.renameFile,x]);return{actions:{showMoveModal:S,handleMoveCancel:A,handleMoveOk:k}}},us=e=>{var t;const{state:r,actions:n,options:i}=fo(),{t:o}=Gn(),a=Fo(),s=rs(e=>e.selectedFiles),l=rs(e=>e.clearSelection),{files:u,selectedFolder:d,copyForm:h,pagination:f,currentMenuFile:p}=r,{setIsCopyModalVisible:g}=n,{dataProviders:m}=i,{copyItems:v}=(()=>{const{options:e}=fo(),{dataProviders:t}=e,{t:r}=Gn(),n=Fo(),i=c(async({items:e,targetFolderId:i,getItemNameById:o,showNotifications:a=!1})=>{let s=0,l=0;const c=[],u="folders"===i?"":i;if(null==t?void 0:t.copyItems)try{const r=await t.copyItems(u,e.map(e=>({id:e.id,newName:e.newName}))),n=r.detailed;if(n){const e=n.filter(e=>e.success),t=n.filter(e=>!e.success);s+=e.length,l+=t.length,t.forEach(e=>{const t=(e=>{var t;return null!==(t=e.requestId)&&void 0!==t?t:e.id})(e),r=e.error,n=Lo(r);c.push({itemId:t,itemName:o(t),error:n})})}else if(r.success)s+=e.length;else{const t=r.error;if(t){l+=e.length;const r=Lo(t);c.push({error:r})}else l+=e.length}}catch(t){l+=e.length;const r=Lo(t);c.push({error:r})}else if(null==t?void 0:t.copyItem)for(const r of e)try{const e=(null==r?void 0:r.isFolder)||r.id.startsWith("folder_");await t.copyItem({itemId:r.id,targetFolderId:u,isFolder:e,newName:r.newName})?s++:l++}catch(e){l++;const t=Lo(e);c.push({itemId:r.id,itemName:o(r.id),error:t})}else l+=e.length,c.push({error:{message:"Copy provider is not configured"}});return a&&(s>0&&n.success({id:"FILES_COPY_SUCCESS",message:r("Files copied"),placement:"bottomRight",data:{successCount:s,totalCount:e.length,itemIds:e.map(e=>e.id),folderId:"folders"===i?null:i}}),l>0&&n.error({id:"FILES_COPY_ERROR",message:r("Errors occurred while copying"),placement:"bottomRight",innerException:c.length?c:void 0,data:{failCount:l,totalCount:e.length,itemIds:e.map(e=>e.id),errors:c.length?c:void 0}})),{successCount:s,failCount:l,errorDetails:c}},[t,n,r]);return{copyItems:i}})(),{refreshFolders:y,refreshFiles:b}=ls(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=os(u),_=c(()=>{null==g||g(!0)},[g]),S=c(()=>{null==g||g(!1),null==h||h.resetFields()},[g,h]),A=c(async t=>{var r,n,c,g,_;if(!((null==p?void 0:p.length)||s&&0!==s.size))return;const A=Array.from((null==p?void 0:p.length)?[p]:s),k=A.length;let E=0,I=0;const T=[],F=A.map(e=>u.find(t=>t.id===e)).filter(e=>Boolean(e)),O=F.some(e=>(null==e?void 0:e.isFolder)||e.id.startsWith("folder_"));try{let s=t;if(!t){const e=await h.validateFields();s=null==e?void 0:e.targetFolder}if(!s)return void a.error({id:"FILES_COPY_DIRECTORY_NOT_SELECTED",message:o("Select destination folder"),placement:"bottomRight"});const u="folders"===s?null:s,p=null!=u?u:d;let P=F.map(e=>({id:e.id,isFolder:(null==e?void 0:e.isFolder)||e.id.startsWith("folder_")}));const M=!0===(null===(r=null==i?void 0:i.config)||void 0===r?void 0:r.dedupeUploadNamesOnClient);if(M&&(null==m?void 0:m.getFolders))try{const e=await m.getFolders({parentId:u,deep:!1}),t=new Set((e||[]).map(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean));for(const e of F){if(!e.isFolder&&!(null===(c=(n=e.id).startsWith)||void 0===c?void 0:c.call(n,"folder_")))continue;const r=e.name||w(e.id)||"";if(r&&t.has(r.toLowerCase()))return void a.error({id:"FOLDER_ALREADY_EXISTS_COPY",message:o("A folder with that name already exists. Please enter a different folder name."),placement:"bottomRight",data:{folderName:r,targetFolderId:s}})}}catch(e){console.warn("Could not check folder duplicates for copy:",e)}if(M&&(null==m?void 0:m.getFiles))try{let e=[];const{files:t}=await m.getFiles({folderId:null!=u?u:void 0,itemType:"all",page:1,limit:1e4});if(e=(t||[]).map(e=>e.name).filter(e=>!!e),null==m?void 0:m.getFolders){const t=(await m.getFolders({parentId:u,deep:!1})||[]).map(e=>e.name).filter(e=>!!e);e=[...e,...t]}const r=[...e];P=F.map(e=>{var t,n;if(e.isFolder||(null===(n=(t=e.id).startsWith)||void 0===n?void 0:n.call(t,"folder_")))return{id:e.id,isFolder:!0};const i=F.find(t=>t.id===e.id),o=(null==i?void 0:i.name)||w(e.id)||"",a=ui(o,r);return r.push(a),{id:e.id,isFolder:!1,newName:a!==o?a:void 0}})}catch(e){console.warn("Could not check duplicates for copy:",e)}else P=F.map(e=>({id:e.id,isFolder:(null==e?void 0:e.isFolder)||e.id.startsWith("folder_")}));const R=await v({items:P,targetFolderId:s,getItemNameById:w,showNotifications:!1});if(E=R.successCount,I=R.failCount,T.push(...R.errorDetails),E>0){const e=x(A),t=C(e),r=t?o("Copied",{names:t}):o("copy_success_summary",{successCount:E,totalCount:k});a.success({id:"FILES_COPY_SUCCESS",message:r,placement:"bottomRight",data:as(A,E,k,u,e)})}if(I>0){const e=x(A),t=C(e);let r;if(1===k&&T.length>0&&(null===(g=T[0].error)||void 0===g?void 0:g.code)){const e=Mo(null===(_=T[0].error)||void 0===_?void 0:_.code,o);r=null!=e?e:t?o("Failed",{names:t}):o("copy_fail_summary",{failCount:I,totalCount:k})}else r=t?o("Failed",{names:t}):o("copy_fail_summary",{failCount:I,totalCount:k});a.error({id:"FILES_COPY_ERROR",message:r,placement:"bottomRight",innerException:T.length?T:void 0,data:ss(A,I,k,u,T.length?T:void 0,e)})}S(),l(),O&&await y({parentIds:void 0,selectedFolder:p}),await b({fetchFiles:e,selectedFolder:d,page:f.current,limit:f.pageSize})}catch(e){console.error("Error when copying:",e);const t=Mo(Lo(e).code,o);a.error({id:"FILES_COPY_ERROR",message:null!=t?t:o("Error copying"),innerException:e,placement:"bottomRight",data:ss(A,k,k,d||null,[{error:Lo(e)}],x(A))})}},[p,s,h,e,d,f,u,a,o,v,l,g,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.dedupeUploadNamesOnClient,null==m?void 0:m.getFiles,w]);return{actions:{showCopyModal:_,handleCopyCancel:S,handleCopyOk:A}}},ds=e=>{const t=is(e),r=cs(e),n=us(e),i=(e=>{const{state:t,actions:r,options:n}=fo(),{t:i}=Gn(),o=Fo(),a=rs(e=>e.selectedFiles),s=rs(e=>e.clearSelection),{files:l,selectedFolder:u,pagination:d,currentMenuFile:h}=t,{setIsDeleteConfirmVisible:f,setUndoDeletion:p,setPagination:g}=r,{config:m}=n,{deleteItems:v}=$o(),{refreshFolders:y,refreshFiles:b}=ls(),{getItemNameById:w,getItemNamesByIds:x,getNamesPreview:C}=os(l),_=c(()=>{null==f||f(!0)},[f]),S=c(()=>{null==f||f(!1)},[f]),A=c(async()=>{var t,r,n;if(!((null==h?void 0:h.length)||a&&0!==a.size))return void(null==f||f(!1));const c=l.length,_=Object.assign({},d),S=Array.from(h?[h]:a),A=S.map(e=>l.find(t=>t.id===e)).filter(e=>Boolean(e)),k=new Set;A.forEach(e=>{(null==e?void 0:e.isFolder)&&k.add((e=>{var t,r;if(!e)return null;const n=e;return null!==(r=null!==(t=n.folderId)&&void 0!==t?t:n.parentId)&&void 0!==r?r:null})(e))});let E=0,I=0;const T=[];try{const a=await v({items:A,selectedFolder:u,getItemNameById:w,showNotifications:!1});E=a.successCount,I=a.failCount,T.push(...a.errorDetails);const l=(null==m?void 0:m.enableTrashFolder)&&"Trash"===u;if(E>0&&(null==m?void 0:m.enableTrashFolder)&&!l&&(null==p||p({itemIds:S,sourceFolderId:u||"folders"})),E>0){const e=S.length;(null==m?void 0:m.enableTrashFolder)&&!l?await o.success({id:"FILES_DELETE_SUCCESS",message:i("moved_to_trash",{count:E}),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:u||null}}):await o.success({id:"FILES_DELETE_SUCCESS",message:i("Files deleted"),placement:"bottomRight",data:{successCount:E,totalCount:e,itemIds:S,folderId:u||null}})}if(I>0){const e=x(S),n=C(e),a=S.length,s=1===a&&T.length>0&&(null===(t=T[0].error)||void 0===t?void 0:t.code),c=(null==m?void 0:m.enableTrashFolder)&&!l,u=i(c?"При перемещении в корзину произошли ошибки":"При удалении произошли ошибки"),d=s?Mo(null===(r=T[0].error)||void 0===r?void 0:r.code,i):void 0,h=null!=d?d:n?i("Failed",{names:n}):u;o.error({id:"FILES_DELETE_ERROR",message:h,placement:"bottomRight",innerException:T.length?T:void 0,data:{failCount:I,isTrashMove:c,totalCount:a,itemNames:e,errors:T.length?T:void 0}})}s(),null==f||f(!1),await y({parentIds:Array.from(k),selectedFolder:u});let d=_.current;if(E>0&&c>0&&E>=c&&_.current>1&&(d=_.current-1),E>0&&_.total>=E){const e=Math.max(0,(null!==(n=_.total)&&void 0!==n?n:0)-E);null==g||g({current:d,pageSize:_.pageSize,total:e})}await b({fetchFiles:e,selectedFolder:u,page:d,limit:_.pageSize})}catch(e){console.error("Error when deleting:",e),o.error({id:"FILES_DELETE_ERROR",message:i("Error deleting"),placement:"bottomRight",innerException:e,data:{failCount:I,totalCount:A.length}})}},[h,a,f,e,u,d,p,g,l,i,o,v,s,null==m?void 0:m.enableTrashFolder]);return{actions:{showDeleteConfirm:_,handleDeleteConfirmCancel:S,handleDeleteConfirmOk:A}}})(e);return{state:t.state,actions:Object.assign(Object.assign(Object.assign(Object.assign({},t.actions),r.actions),n.actions),i.actions)}},hs=()=>{const{state:e}=fo(),{files:t,loading:r,isUrlModalVisible:n}=e,i=Za(),o=(()=>{const{state:e}=fo(),t=e.multiSelect,r=rs(e=>e.selectedFiles),n=rs(e=>e.toggleFileSelection),i=rs(e=>e.setMultiSelect);return a(()=>{i(!1!==t)},[t,i]),{state:{selectedFiles:r},actions:{toggleFileSelection:n}}})(),s=ds(i.fetchFiles);return{state:{files:t||[],selectedFiles:o.state.selectedFiles,loading:r||!1,isAddingFileByUrl:n||!1,isRenamingFile:s.state.isRenamingFile,fileToRename:s.state.fileToRename},actions:{fetchFiles:i.fetchFiles,handleDeleteFile:i.handleDeleteFile,handleDeleteFolder:i.handleDeleteFolder,handleAddFile:i.handleAddFile,handleAddFileByUrl:i.handleAddFileByUrl,handleDroppedFiles:i.handleDroppedFiles,uploadFileWithProvider:i.uploadFileWithProvider,toggleFileSelection:o.actions.toggleFileSelection,showRenameModal:s.actions.showRenameModal,handleRenameCancel:s.actions.handleRenameCancel,handleRenameOk:s.actions.handleRenameOk,showMoveModal:s.actions.showMoveModal,handleMoveCancel:s.actions.handleMoveCancel,handleMoveOk:s.actions.handleMoveOk,showCopyModal:s.actions.showCopyModal,handleCopyCancel:s.actions.handleCopyCancel,handleCopyOk:s.actions.handleCopyOk,showDeleteConfirm:s.actions.showDeleteConfirm,handleDeleteConfirmCancel:s.actions.handleDeleteConfirmCancel,handleDeleteConfirmOk:s.actions.handleDeleteConfirmOk}}};function fs({maxConcurrent:e=6}={}){const t=u(new Map),r=u([]),n=u(0),i=d(()=>{const i=e=>({status:e.status,shouldLoad:"loading"===e.status||"loaded"===e.status||"error"===e.status}),o=e=>{const t=i(e);e.listeners.forEach(e=>e(t))},a=e=>{0!==r.current.length&&(r.current=r.current.filter(t=>t!==e))},s=(e,r)=>{const n=t.current.get(e);if(!n){const n={id:e,src:r,status:"idle",listeners:new Set,active:!1};return t.current.set(e,n),n}return n.src!==r&&(a(e),n.src=r,n.status="idle"),n},l=()=>{for(;n.current<e&&r.current.length>0;){const e=r.current.shift();if(!e)break;const i=t.current.get(e);i&&i.active&&"queued"===i.status&&(i.status="loading",n.current+=1,o(i))}},c=(e,t)=>{"loading"===e.status&&(e.status=t,n.current=Math.max(0,n.current-1),o(e),l())};return{getSnapshot:(e,t)=>i(s(e,t)),subscribe:(e,r,n)=>{const o=s(e,r);return o.listeners.add(n),n(i(o)),()=>{const r=t.current.get(e);r&&(r.listeners.delete(n),r.active||0!==r.listeners.size||"loading"===r.status||t.current.delete(e))}},setActive:(e,t,i)=>{const c=s(e,t);c.active=i,i?"loaded"!==c.status&&"loading"!==c.status&&"queued"!==c.status?(c.status="queued",o(c),r.current.includes(e)||r.current.push(e),l()):o(c):"queued"===c.status?(a(e),c.status="idle",o(c)):"loading"===c.status&&(n.current=Math.max(0,n.current-1),c.status="idle",o(c),l())},markLoaded:e=>{const r=t.current.get(e);r&&c(r,"loaded")},markError:e=>{const r=t.current.get(e);r&&c(r,"error")},release:e=>{const r=t.current.get(e);r&&(r.active=!1,"queued"===r.status?(a(e),r.status="idle"):"loading"===r.status&&(n.current=Math.max(0,n.current-1),r.status="idle",l()),0===r.listeners.size&&t.current.delete(e))}}},[e]);return a(()=>()=>{r.current=[],t.current.clear(),n.current=0},[]),i}const ps=/(auto|scroll|overlay)/;function gs(e,t){const r=Math.max(0,null!=t?t:e.clientWidth);return Math.max(1,Math.round(r-function(e){if("undefined"==typeof window)return 0;const t=window.getComputedStyle(e);return(Number.parseFloat(t.paddingLeft||"0")||0)+(Number.parseFloat(t.paddingRight||"0")||0)}(e)))}function ms(e){if("undefined"==typeof window)return!1;const t=window.getComputedStyle(e);return ps.test(t.overflowY)||ps.test(t.overflow)||ps.test(t.overflowX)}function vs(e){if("undefined"==typeof window)return e;let t=e;for(;t;){if(ms(t))return t;t=t.parentElement}return null}function ys(e){if("undefined"==typeof window)return[e];const t=vs(e);return t?t===e?[window,e]:[window,t]:[window]}function bs(e,t,r){Math.max(0,e.clientHeight),Math.max(0,Math.round(e.getBoundingClientRect().height));return Math.max(1,t)}function ws(e,t){if(e===t){const r=function(e){var t;if("undefined"==typeof window)return Math.max(1,e.clientHeight);const r=e.getBoundingClientRect(),n=window.innerHeight||(null===(t=document.documentElement)||void 0===t?void 0:t.clientHeight)||0,i=Math.max(0,r.top),o=Math.min(n,r.bottom);return Math.max(0,Math.round(o-i))}(t);return{scrollTop:t.scrollTop,viewportHeight:bs(e,Math.min(t.clientHeight,r||t.clientHeight)),viewportWidth:gs(t),scrollHeight:e.scrollHeight}}const r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=Math.max(r.top,n.top),o=Math.min(r.bottom,n.bottom),a=Math.max(r.left,n.left),s=Math.min(r.right,n.right),l=Math.max(0,Math.round(o-i)),c=Math.max(0,Math.round(s-a));return{scrollTop:Math.max(0,Math.round(i-n.top)),viewportHeight:bs(e,l),viewportWidth:gs(e,c||t.clientWidth||e.clientWidth),scrollHeight:e.scrollHeight}}function xs(e){if("undefined"==typeof window)return{scrollTop:e.scrollTop,viewportHeight:Math.max(1,e.clientHeight),viewportWidth:gs(e),scrollHeight:e.scrollHeight};const t=vs(e);return t&&function(e){return e.scrollHeight-e.clientHeight>1}(t)?ws(e,t):function(e){var t,r;const n=e.getBoundingClientRect(),i=window.innerHeight||(null===(t=document.documentElement)||void 0===t?void 0:t.clientHeight)||0,o=window.innerWidth||(null===(r=document.documentElement)||void 0===r?void 0:r.clientWidth)||n.width,a=Math.max(0,n.top),s=Math.min(i,n.bottom),l=Math.max(0,Math.round(s-a));return{scrollTop:Math.max(0,Math.round(-n.top)),viewportHeight:bs(e,l),viewportWidth:gs(e,Math.min(Math.round(n.width),o)),scrollHeight:e.scrollHeight}}(e)}function Cs(e,t){const r=u(null),n=c(t=>{e(xs(t))},[e]);return a(()=>{r.current&&n(r.current)},[n,...t]),a(()=>{if(!r.current||"undefined"==typeof ResizeObserver)return;const e=r.current,t=new ResizeObserver(()=>{n(e)});return t.observe(e),()=>t.disconnect()},[n]),a(()=>{const e=r.current;if(!e)return;const t=()=>{n(e)},i=ys(e);return i.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{i.forEach(e=>{e.removeEventListener("scroll",t)})}},[n,...t]),r}const _s=({onSearch:t,placeholder:r,className:n})=>{const{t:i}=Gn(),[s,l]=o(""),c=u(null),{options:d}=fo(),{config:h}=d,f=r||i("Search files...");a(()=>(c.current=So.debounce(e=>{t(e)},500),()=>{var e;null===(e=c.current)||void 0===e||e.cancel()}),[t]);return e(T,{value:s,onChange:e=>{var t;const r=e.target.value;l(r),null===(t=c.current)||void 0===t||t.call(c,r)},placeholder:f,prefix:e(Ti,{size:16,strokeWidth:null==h?void 0:h.iconStrokeWidth}),className:n,allowClear:!0,onClear:()=>{l(""),t("")}})},Ss=[{value:"date-desc",labelKey:"Newest first"},{value:"date-asc",labelKey:"Oldest first"},{value:"size-desc",labelKey:"Largest first"},{value:"size-asc",labelKey:"Smallest first"},{value:"name-asc",labelKey:"A-Z"},{value:"name-desc",labelKey:"Z-A"},{value:"type-asc",labelKey:"By type"}];var As={contentLayout:"contentLayout",headerContainer:"headerContainer",actionsContainer:"actionsContainer",filesContainer:"filesContainer",filesLoadingOverlay:"filesLoadingOverlay",emptyStateWrapper:"emptyStateWrapper",paginationContainer:"paginationContainer",uploadIcon:"uploadIcon",tableContainer:"tableContainer",tableLoadingWrapper:"tableLoadingWrapper",imagePreview:"imagePreview",fileManagerTableFolder:"fileManagerTableFolder",fileManagerTableFolderInner:"fileManagerTableFolderInner",sortSelect:"sortSelect",fileNameCol:"fileNameCol",fileItemCount:"fileItemCount",fileSize:"fileSize",fileDate:"fileDate",tableMenu:"tableMenu",tableImagePreview:"tableImagePreview",tableFolderIcon:"tableFolderIcon",buttonDeselected:"buttonDeselected",buttonSelectAll:"buttonSelectAll",gridRow:"gridRow",gridCard:"gridCard",selectedRow:"selectedRow",gridCardSelected:"gridCardSelected",gridCheckbox:"gridCheckbox",gridCardContent:"gridCardContent",gridPreviewContainer:"gridPreviewContainer",gridPreviewContainerFolder:"gridPreviewContainerFolder",gridFolderIcon:"gridFolderIcon",gridFolderIconImage:"gridFolderIconImage",gridFileName:"gridFileName",gridFileInfo:"gridFileInfo",gridFileMenu:"gridFileMenu",gridFileMenuButton:"gridFileMenuButton",actionsBox:"actionsBox",uploadContainer:"uploadContainer",uploadArea:"uploadArea",blockText:"blockText",textTitle:"textTitle",textDescription:"textDescription",buttons:"buttons",btnAi:"btnAi",btnPhoto:"btnPhoto",dragOverlay:"dragOverlay",dragOverlayInner:"dragOverlayInner",dragCaptureLayer:"dragCaptureLayer",dragOverlayGlobal:"dragOverlayGlobal",noFiles:"noFiles",noFilesIcon:"noFilesIcon",textTitle_trash:"textTitle_trash",textDescription_trash:"textDescription_trash"};const{Text:ks}=F,{Option:Es}=O;const Is=i.memo(({files:r,filesById:n,currentSortOption:i,isSmallScreen:o,iconStrokeWidth:a,multiSelectEnabled:s=!0,features:l,viewMode:c,setViewMode:u,handleSearch:h,handleSortOptionChange:f,sortOptions:p,onClearSelection:g,onRename:m,onDelete:v,onCopy:y,onMove:b,onEdit:w,t:x})=>{const C=d(()=>(null==p?void 0:p.length)?Ss.filter(e=>p.includes(e.value)):Ss,[p]),_=d(()=>C.map(e=>e.value).join("|")||"all",[C]),S=rs(e=>e.selectedFiles),A=rs(e=>e.selectedFiles.size),k=rs(e=>e.selectAllVisible),E=r.length>0&&A===r.length,I=d(()=>Array.from(S)[0],[S]),T=d(()=>I?n.get(I):void 0,[n,I]),F=(null==T?void 0:T.isFolder)?!1!==(null==l?void 0:l.enableRenameFolder):!1!==(null==l?void 0:l.enableRenameFile),N=d(()=>Array.from(S).every(e=>{const t=n.get(e);return!!t&&(t.isFolder?!1!==(null==l?void 0:l.enableMoveFolder):!1!==(null==l?void 0:l.enableMoveItem))}),[l,n,S]),j=d(()=>Array.from(S).every(e=>{const t=n.get(e);return!!t&&(t.isFolder?!1!==(null==l?void 0:l.enableCopyFolder):!1!==(null==l?void 0:l.enableCopyItem))}),[l,n,S]),D=d(()=>1===A&&function(e){var t,r,n;if(!e||e.isFolder)return!1;const i=e.extension||(e.name&&e.name.includes(".")?e.name.split(".").pop():void 0)||((null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))?null===(n=null===(r=e.type.split("/")[1])||void 0===r?void 0:r.split(";")[0])||void 0===n?void 0:n.trim():void 0);return Boolean(i&&hr.includes(i.toLowerCase()))}(T),[A,T]);return t("div",A>0?{className:`header-container ${As.headerContainer}`,children:[t(ks,{type:"secondary",className:"selected-text",children:[t("div",{children:[A," ",x("selected")]}),s&&e(P,{title:o?x("Select all"):null,children:e(M,{className:As.buttonSelectAll,onClick:k,disabled:E||0===r.length,children:x("Select all")})}),e(P,{title:o?x("Deselected"):null,children:e(M,{className:As.buttonDeselected,icon:e(Ii,{size:16,strokeWidth:a}),onClick:g,children:x("Deselected")})})]}),t(R,{children:[D&&!1!==(null==l?void 0:l.enableEdit)&&e(P,{title:o?x("Edit"):null,children:e(M,{icon:e(gi,{size:16,strokeWidth:a}),onClick:()=>w(T),disabled:!D,children:x("Edit")})}),N&&e(P,{title:o?x("Move to"):null,children:e(M,{icon:e(vi,{size:16,strokeWidth:a}),onClick:b,children:x("Move to")})}),j&&e(P,{title:o?x("Copy"):null,children:e(M,{icon:e(pi,{size:16,strokeWidth:a}),onClick:y,children:x("Copy")})}),1===A&&F&&e(P,{title:o?x("Rename"):null,children:e(M,{icon:e(Oi,{size:16,strokeWidth:a}),onClick:()=>m(),disabled:1!==A||!F,children:x("Rename")})}),!1!==(null==l?void 0:l.enableDelete)&&e(P,{title:o?x("Delete"):null,children:e(M,{danger:!0,icon:e(Mi,{size:16,strokeWidth:a}),onClick:e=>{e.stopPropagation(),e.preventDefault(),v()},children:x("Delete")})})]})]}:{className:As.headerContainer,children:[e("div",{className:"search-container",children:e(_s,{placeholder:x("Search file or folder"),onSearch:h,className:As.searchInput})}),t("div",{className:As.actionsBox,children:[e("div",{className:"sort-container",children:e(O,{value:i,onChange:f,className:As.sortSelect,popupMatchSelectWidth:!1,suffixIcon:e(hi,{size:16,strokeWidth:a}),children:C.map(({value:t,labelKey:r})=>e(Es,{value:t,children:x(r)},t))},_)}),e("div",{className:As.actionsContainer,children:e(L,{options:[{value:"grid",icon:e(xi,{size:16,strokeWidth:a})},{value:"table",icon:e(Si,{size:20,strokeWidth:a})}],value:c,onChange:e=>u(e)})})]})]})});Is.displayName="FileContentHeader";const Ts=i.memo(({fileId:t,style:r})=>{const n=rs(e=>e.selectedFiles.has(t)),i=rs(e=>e.toggleFileSelection);return e(N,{checked:n,style:r,onClick:e=>{e.stopPropagation()},onChange:e=>{const r=e.nativeEvent;i(t,{metaKey:r.metaKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,forceToggle:!0})}})});function Fs(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}Ts.displayName="FileSelectionCheckbox","function"==typeof SuppressedError&&SuppressedError;const Os=i.memo(t=>{var{className:r}=t,n=Fs(t,["className"]);const i=n["data-row-key"],o=null==i?"":String(i),a=[r,rs(e=>!!o&&e.selectedFiles.has(o))?As.selectedRow:""].filter(Boolean).join(" ");return e("tr",Object.assign({},n,{className:a}))});Os.displayName="SelectableTableRow";const Ps=i.memo(({item:t,variant:r="table",t:n,iconStrokeWidth:i,setCurrentMenuFile:a,showMoveModal:s,showCopyModal:l,showRenameModal:u,showDeleteConfirm:h,onEdit:f})=>{const[p,g]=o(!1),m=d(()=>{if(!p)return[];const r=[];return t.canEdit&&r.push({key:"edit",label:n("Edit"),icon:e(gi,{size:16,strokeWidth:i})}),t.canMove&&r.push({key:"move",label:n("Move to"),icon:e(vi,{size:16,strokeWidth:i})}),t.canCopy&&r.push({key:"copy",label:n("Copy"),icon:e(pi,{size:16,strokeWidth:i})}),t.canRename&&r.push({key:"rename",label:n("Rename"),icon:e(Oi,{size:16,strokeWidth:i})}),t.canDelete&&r.push({key:"delete",label:n("Delete"),icon:e(Mi,{size:16,strokeWidth:i}),style:{color:"#ff4d4f"}}),r},[i,p,t.canCopy,t.canDelete,t.canEdit,t.canMove,t.canRename,n]),v=c(({key:e})=>{switch(t.id&&(null==a||a(t.id)),e){case"edit":f(t.file);break;case"move":s();break;case"copy":l();break;case"rename":u(t.id);break;case"delete":null==h||h();break;default:null==a||a("")}},[t,f,a,l,h,s,u]),y=d(()=>({items:m,onClick:v}),[v,m]);return e(j,{arrow:!0,placement:"bottom",menu:y,trigger:["hover"],onOpenChange:g,children:"grid"===r?e(M,{type:"default",className:`${As.gridFileMenuButton} gridFileMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(mi,{size:16,strokeWidth:i})}):e("span",{className:`${As.tableMenu} tableMenuButton`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:e(mi,{size:16,strokeWidth:i})})})});Ps.displayName="FileItemActionsDropdown";const Ms=({thumbnailSrc:t,previewSrc:r,lightboxSrc:n,alt:i,className:s,width:l,height:u,preview:h=!1})=>{const f=i,[p,g]=o(0),m=c(e=>{const t=e.split(",")[1];return!!(t&&t.length>20)},[]),v=c(e=>{var t;if(e&&"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQABLAEsAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAAEsAAAAAQAAASwAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAQOgAwAEAAAAAQAAAMoAAAAA/+EJ2Wh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8APD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6c3RvY2s6Mzk2MmU4NTQtNjA1NC00MGZmLWEwYzMtYjJkNjcwMzQ2OWFhIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmE5M2NiZTgyLWI5NjEtNGUzNS1iYmQ0LWJjZWE1Zjc1YTQwZiIvPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9InciPz4A/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAMoBAwMBIgACEQADEQD/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/3QAEABH/2gAMAwEAAhEDEQA/APsuiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoqG7uIbWB55nCooyTS208VxCssLh0boRQBLRRRQAUUUUAFFFFAH/9D7LooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAqG7uIrWBppnCoo5Jou7iK1gaaZwqKM5NcRq2oXOsXqxQq2wnEcYPX3NABq2oXOr3qwxK3l5xHGO/ua6nw7pzadZ7ZJGaR+WBPA9hUfh7R49Pi82TDXDDkkfd9hWxQAUUUUAFFFFABRRRQB//9H7LooooAKKKKACiiuOv/EOpQX88KNDsSQqMp6H60AdjRXD/wDCTapn70P/AH7/APr0f8JPqn96H/v3/wDXoA7iiuH/AOEn1T+9D/37/wDr0f8ACT6p/eh/79//AF6AO4orh/8AhJ9U/vQ/9+//AK9H/CT6p/eh/wC/f/16AO4orh/+En1T+9D/AN+//r0f8JPqn96H/v3/APXoA7iiuH/4SfVP70P/AH7/APr0f8JPqn96H/v3/wDXoA7iiuH/AOEn1T+9D/37/wDr0f8ACT6p/eh/79//AF6AO4orh/8AhJ9U/vQ/9+//AK9H/CT6p/eh/wC/f/16AO4orh/+En1T+9D/AN+//r0f8JPqn96H/v3/APXoA7iobq4itYHmncIijJJrE0jUdQlt2v8AUJIYrNVyMJgv9Oaw9X1C51e8WGJWMecRxr39zQAatqNzq94kUasELYjjB6/Wul8P6NHp8Qlkw1ww5P8Ad9hWRmDw9bfwTajIv4Riqw8Tap6wf98f/XoA7elrh/8AhJtU/vQ/9+//AK9avhnWL3UL94bgx7BGWG1cdwPX3oA6OiiigAooooAKKKKAP//S+y6KKKACiiigArgHAbxSVYAg3mCD3+eu/rgT/wAjV/2+f+z0Adt9jtMf8esH/fsUfY7T/n1g/wC/Yqeh2CIWY4AGSaAK7WlmqktbQADkkxr/AIVUe50JJPLZ7EN6YWuX17WJr+dkRylurYVQfve5rKJoA9Ghh0+Zd0MVtIvqqKaf9jtP+fWD/v2K89sry4sphLbyFD3HY/Wu+0e9TULFLhQATww9DQBJ9jtP+fWD/v2KattZM7ILe3LL94bF4p99cx2lpJcS/dRc/X2rjdG1eSLWmuZ2Oy4bEnoPQ/hQB2P2O0/59YP+/Yo+x2n/AD6wf9+xU4IPSloAr/Y7T/n1g/79ij7Haf8APrB/37FWKKAK/wBjtP8An1g/79ij7Haf8+sH/fsVYooAr/Y7T/n1g/79ioruPTrWBppoLdUUckxj/Cp7u4itYGnmcKijJJriNX1C61i9EUKtsziOMHr7mgBNVv7jVrxYII/3YOIYl/ma6bw9o8enxCSTD3DDkn+H2FHh/R49Pi8yTDXDDkkfd9hWxQBC9rbOxZ7eJmPUlATTfsdp/wA+sH/fsVYooAztXtbVdLumW3hBELkEIOPlNc74H/5Csv8A1xP8xXUaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5igDs6KKKACiiigAooooA//0/suiiigAooooAK4E/8AI1f9vn/s9d9XAn/kav8At8/9noA72s/xI7R6HdMpwdmPzODWhUN/ALqymt26SIVoA816UlS3ML207wSrtdCQai+lAC11HgN2xdx4+XKH6Hn/AArl++K6jSv+JN4flvJhiWfBRe/Tj+ZNAEHjLUfOnFjEw2R/NJju3Yfl/Oudp0jtJIzucsxJJ96bQB2/hLUftdkLeRh50OF+q9jW3XnOkXrWF/HcDJUHDjPUV6HDIssSSIQVYAg0APooooAKhu7iK1gaeZwqKM5NF3cQ2sDTTOFRRk5riNW1C51i9WKJW8vOI4x39zQAavqF1rF6IYVbZnEcYPX3NdL4e0ePT4hLIA1w45JH3fYUeHtHj0+LzJcNcMOTj7vsK2KACiiigAooooAqaz/yCbz/AK4v/wCgmuX8D/8AIWl/64n+YrqNZ/5BN5/1xf8A9BNcv4H/AOQtL/1xP8xQB2dFFFABRRRQAUUUUAf/1PsuiiigAooooAK4E/8AI1f9vn/s9d9XAn/kav8At8/9noA72lpKWgDO1bSLXUQDKCsg6OvX/wCvWFJ4Tn3fJdxFc8FkOa66igDC0zw3a2riadzPIOeRhR+FYXinUPtl+Yoz+5h+VcdCe5/p+FdH4n1H7DYFYziaX5U9vU1wn40AFFFFABXW+DNR3xtp8x+ZPmjyeo7j/PrXJVNZzva3UdxG2HjbP/1qAPTKhu7iK2gaaZwqKOSahTULf+zFv3bZEybsmuP1XULnV70QxK3l7sRxr39zQAmrahc6xerFEreXnEcY7+5rpfD2jx6fF5suGuGHJx932FHh7R49PiEkuGuGHJ/u+wrYoAKKKKACiiigAooooAqaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5iuo1n/AJBN5/1xf/0E1y/gf/kLS/8AXE/zFAHZ0UUUAFFFFABRRRQB/9X7LooooAKKKKACuBP/ACNX/b5/7PXfVwJ/5Gr/ALfP/Z6AO9paSloAKazBVZicBRkmnVz3jHUfs9qLOJsSy/ex2XvQBzuu351DUXlDfu1+WMewqhRRQAUUUv40AFbGi6ZG8TahqB8uzTkA9ZP/AK1Gi6ZG8TajqJ2WcfIB/wCWn/1qi1W+uNWu0hhQiIHbFEv86ADU7+fVbpIIU2xZ2xRL/M103h7R00+LzZcPcMOTj7vsKyCYfD9sQNsupSr+EY/z+ddDot8uoWCTj7/Rx6N3oAvUUUUAFZ17rFta6jDZydZPvNnhPTNSaxqEWn2bTv8AM3RF9TXntxLJPK8sp3O5yx9TQB6dmlrA8Kar9qg+yzt+/jHBP8QrfoAKKKKAKms/8gm8/wCuL/8AoJrl/A//ACFpf+uJ/mK6jWf+QTef9cX/APQTXL+B/wDkLS/9cT/MUAdnRRRQAUUUUAFFFFAH/9b7LooooAKKKKACuBP/ACNX/b5/7PXfVwJ/5Gr/ALfP/Z6AO9paSloAjuZo7eB5pThEGSa851G6e9vJLl+rngeg7Ct/xpqOWXT4m6fNLj9B/X8q5mgBKKKO9AADzWzoumRvEdQ1A7LOPkA/8tP/AK1JoulxvE2oagQlnHyAf+Wn/wBaotVv59WukhhjIizthiX+dABql/catdJBDGRHnbDEv86vkweH7bHyy6jKv4Rj/P8An0UmDw/bEfLLqMq/hGP8/n/Ln5JHlkaSRi7scsx70AEkjySNLIxd2OWY961fCuo/Y78RSNiGY7T7Hsax6WgD1EGmyuscbSOwVVBJPoKy/DGofbrABzmaLCvk9fQ1k+MNU3MdPgY4X/WkevpQBla7qLajel84iTiMe3rWdS0lAEtrPJbXMdxC2HQ5HvXoWlXsd/ZpPGevDD0PevOK0/D2pHTr0FiTBJgOP60Ad/RTUYOoZSCCMg06gCprP/IJvP8Ari//AKCa5fwP/wAhaX/rif5iuo1n/kE3n/XF/wD0E1y/gf8A5C0v/XE/zFAHZ0UUUAFFFFABRRRQB//X+y6KKKACiiigArgT/wAjV/2+f+z131cCf+Rq/wC3z/2egDvarapeJY2Mlw/8I+UZ6nsKs1xni7UftN39ljb91Eecd2/z/WgDFnlknmeaRsu5JJqOigdeKAFrX0XS43iOoagQlnHyAf8Alp/9al0XTI3ibUNQISzj5Ab/AJaf/WqHVb+41a6SGGMrEDtiiX+dAC6rfT6tdJBChEWdsMS/zq+TB4ftj92XUZV/CMf5/P8AkhMPh+2x8suoyr+EY/z+f8sCSR5ZGlkYu7HLMe9ABJI8sjSSMXdjlmPemUUUAFLSUUAWtOvp7CZ5YD8zIVOenNVmJZixJJPUmkooAKKKKAClFJRQB1Pg/VOBp87Dj/VEn9K6jPFeYRs0bh0JDqQQR2Nd7oGpJqNkGJxKnEg/rQBY1n/kE3n/AFxf/wBBNcv4H/5C0v8A1xP8xXUaz/yCbz/ri/8A6Ca5fwP/AMhaX/rif5igDs6KKKACiiigAooooA//0PsuiiigAooooAK4E/8AI1f9vn/s9d8a89u5RB4hlnYEiO5LkDvhs0Adtq808Ni7W0TyTEbUCjkE964c6TqhJJspyTySVroB4stsY+xzf99Cj/hK7X/nzl/76FAHPnSdTx/x4z/981d0zRvL33eqr5NtFztbq5/wro7PVo5rF72SB7eBfutIcbvpXLatqFzq94IokYpnEca859zQAmq31xq12sEEZEQOIol/nWxBYzaPZeZBavc30oxlVyIxUVsbLw6i+epuL1wCyp/AP6VY/wCEstv+fSb/AL6FAGBLpmrSyNJJZ3DuxyzFetN/sjU/+fGf/vmug/4Su1/585f++hR/wldr/wA+cv8A30KAOf8A7I1P/nxn/wC+aP7I1P8A58Z/++a6D/hK7X/nzl/76FH/AAldr/z5y/8AfQoA5/8AsjU/+fGf/vmj+yNT/wCfGf8A75roP+Ertf8Anzl/76FH/CV2v/PnL/30KAOf/sjU/wDnxn/75o/sjU/+fGf/AL5roP8AhK7X/nzl/wC+hR/wldr/AM+cv/fQoA5/+yNT/wCfGf8A75o/sjU/+fGf/vmug/4Su1/585f++hR/wldr/wA+cv8A30KAOf8A7I1P/nxn/wC+aP7I1P8A58Z/++a6D/hK7X/nzl/76FH/AAldr/z5y/8AfQoA5/8AsjU/+fGf/vmrmkW+r6ferOllPtzh12n5hWp/wldr/wA+cv8A30KP+Ertf+fOX/voUAa+rNu0a6bBGYGOD1HymuZ8D/8AIWl/64n+YqzfeJre4spoBayqZI2UEkcZGKreB/8AkKyn/pif5igDs6KKKACiiigAooooA//R+y6KKKACiiigArHn8OadPO80nm73YscNjknNbFFAGJ/wjGmf9N/+/lRXGg6NZxG4nMnlpyQ0mQfatq7uIrWBppnCoozk1xGrajdaxeLFCh2E4jjHf3NACapfT6tdpBDGfKU4hjUfrXTeH9HTT4vNkw1yw5JH3fYUeHtHj0+LzZMNcMOSR932FbFAGNL4b0+WRpJXuHdjks0nJNN/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTP+m/8A38o/4RjTP+m//fytuigDE/4RjTPSf/v5VrTNGs9PnM1v5m4qVO5s8ZB/pWjRQAUUUUAFFFFABRRRQB//0vsuiiigAooooAKhu7mK1t2nmYKijkmpq5fxda6jNcReXukgYgBVHQ+9AGVq2oXOsXqxRK2zdiNB39zXS+H9Hj0+ISSYa4Ycn+77Cjw/o8enxebLhrhhySPu+wrYoAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAP/9P7LooooAKKKKACkxS0UAFFFFABRRTW6D6igB1FN7n8KQE+YRQA+iiigAopsnEZI64pR90UALRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAH//2Q=="!==e)return e.startsWith("data:image/")?m(e)?e:void 0:e.startsWith("blob:")?e:e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?null!==(t=(e=>{if(e&&"string"==typeof e){if(e.startsWith("data:")||e.startsWith("blob:"))return e;try{if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")){const t=new URL(e.startsWith("/")?`https://x${e}`:e),r=e.startsWith("/")?"":`${t.protocol}//${t.host}`,n=t.pathname.split("/").map(e=>{if(!e)return"";try{return encodeURIComponent(decodeURIComponent(e))}catch(t){return encodeURIComponent(e)}}).join("/");return e.startsWith("/")?n+(t.search||"")+(t.hash||""):`${r}${n}${t.search}${t.hash}`}}catch(e){}return e}})(e))&&void 0!==t?t:e:void 0},[m]),y=d(()=>v(t),[t,v]),b=d(()=>v(r),[r,v]),w=d(()=>v(n),[n,v]),x=d(()=>[y,b].filter((e,t,r)=>Boolean(e)&&r.indexOf(e)===t),[y,b]);a(()=>{g(0)},[x]);const C=c((e,t)=>e&&e.toLowerCase().endsWith(".svg")||t&&(t.includes(".svg")||t.includes("image/svg+xml")),[]),_=x[p],S=null!=w?w:_,A=c(()=>{if(!_)return;const e=p+1;C(f,_),g(e)},[_,p,f,C]),k=null!=_?_:dr,E=!(!h||!S)&&{src:S,toolbarRender:()=>null,destroyOnHidden:!0,mask:e(ge,{style:{fontSize:"20px"}})};return e(D,{className:s,src:k,alt:i,width:l,height:u,preview:E,onError:A,fallback:dr})},Rs=i.memo(({item:t,variant:r="table",FolderIcon:n,getFileData:i,className:o,width:a,height:s})=>t.isFolder?e("div","grid"===r?{className:As.gridFolderIcon,children:e(n,{className:As.gridFolderIconImage})}:{className:As.fileManagerTableFolder,children:e("div",{className:As.fileManagerTableFolderInner,children:e(n,{className:As.tableFolderIcon,style:{width:null!=a?a:40,height:null!=s?s:40}})})}):t.thumbnailSrc||t.previewSrc?e(Ms,{className:o,thumbnailSrc:t.thumbnailSrc,previewSrc:t.previewSrc,lightboxSrc:t.lightboxSrc,alt:t.file.name,width:a,height:s,preview:!0,file:t.file,getFileData:i}):null);function Ls(e){var t,r,n;if(e.isFolder)return!1;const i="string"==typeof e.name?e.name:"",o=i?null===(t=i.split(".").pop())||void 0===t?void 0:t.toLowerCase():void 0,a=null!==(n=null===(r=e.extension)||void 0===r?void 0:r.toLowerCase())&&void 0!==n?n:o;return"string"==typeof e.type&&e.type.startsWith("image/")||"string"==typeof a&&fr.includes(a)}Rs.displayName="FileItemPreview";const Ns=i.memo(({item:r,t:n,iconStrokeWidth:i,FolderIcon:o,handleItemClick:a,setCurrentMenuFile:s,showMoveModal:l,showCopyModal:u,showRenameModal:d,showDeleteConfirm:h,onEdit:f,onEditorOk:p,getFileData:g,showSelectionCheckbox:m=!0})=>{const v=rs(e=>e.selectedFiles.has(r.id)),y=c(e=>{const t=e.target;if(t.closest(".gridFileMenuButton")||t.closest(".ant-dropdown-menu"))return;Boolean(t.closest(".ant-image"))||Boolean(t.closest(".ant-image-preview-wrap"))||1===e.detail&&(r.isFolder?a(r.file):p&&Ls(r.file)&&p(r.file))},[a,r.file,r.isFolder,p]);return e(z,{className:As.gridCard_col,style:{padding:0},children:t(B,{hoverable:!0,cover:e("div",{className:r.isFolder?As.gridPreviewContainerFolder:As.gridPreviewContainer,onClick:e=>{e.stopPropagation(),y(e)},children:e(Rs,{item:r,variant:"grid",FolderIcon:o,getFileData:g,className:As.gridImagePreview})}),className:`${As.gridCard} ${v?As.gridCardSelected:""}`,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[t("div",{className:As.gridCardContent,onClick:e=>{e.stopPropagation(),e.preventDefault(),y(e)},children:[e("div",{className:As.gridFileName,children:r.nameText||n("Untitled")}),e("div",{className:As.gridFileInfo,children:r.gridInfoText})]}),e("div",{className:As.gridFileMenu,onClick:e=>{e.stopPropagation()},children:e(Ps,{item:r,variant:"grid",t:n,iconStrokeWidth:i,setCurrentMenuFile:s,showMoveModal:l,showCopyModal:u,showRenameModal:d,showDeleteConfirm:h,onEdit:f})}),m?e("div",{onClick:e=>{e.stopPropagation()},className:As.gridCheckbox,children:e(Ts,{fileId:r.id,style:{height:20}})}):null]})})});Ns.displayName="FileGridItem";const js=i.memo(({rows:t,topOffset:n=0,bottomOffset:i=0,t:o,iconStrokeWidth:a,FolderIcon:s,handleItemClick:l,setCurrentMenuFile:c,showMoveModal:u,showCopyModal:d,showRenameModal:h,showDeleteConfirm:f,onEdit:p,onEditorOk:g,getFileData:m,showSelectionCheckbox:v=!0})=>e(r,{children:e("div",{style:{paddingTop:n,paddingBottom:i},children:e(U,{gutter:[16,16],className:As.gridRow,style:{gap:20,padding:"0 24px 24px",margin:0},children:t.map(t=>e(Ns,{item:t,handleItemClick:l,iconStrokeWidth:a,t:o,FolderIcon:s,setCurrentMenuFile:c,showMoveModal:u,showCopyModal:d,showRenameModal:h,showDeleteConfirm:f,onEdit:p,onEditorOk:g,getFileData:m,showSelectionCheckbox:v},t.id))})})}));js.displayName="FileGridView";const Ds=i.memo(({rows:t,columns:n,topOffset:i=0,bottomOffset:o=0,onRow:a,components:s})=>{const l=d(()=>e("div",{style:{paddingTop:i,paddingBottom:o},children:e(k,{renderEmpty:()=>e(H,{image:e(r,{}),description:""}),children:e(V,{dataSource:t,columns:n,rowKey:"id",pagination:!1,tableLayout:"fixed",onRow:a,components:s,showHeader:!1})})}),[o,n,s,a,t,i]);return e("div",{className:As.tableLoadingWrapper,children:l})});Ds.displayName="FileTableView";const zs=i.memo(({item:t})=>t.dateText?e(P,{title:t.dateText,placement:"bottom",className:As.fileDate,children:t.dateText}):null);zs.displayName="FileItemDate";const Bs=i.memo(({item:r})=>t("div",{className:As.fileName,children:[r.nameText,r.isFolder&&e("div",{className:As.fileItemCount,children:r.folderItemsText})]}));Bs.displayName="FileItemName";const Us="filemanager_view_mode";class Vs{constructor(){this.rowsById=new Map}reconcile(e,t,r){const n=new Map,i=[];for(const o of e){const e=t.getId(o),a=t.buildSignature(o,r),s=this.rowsById.get(e);if(s&&s.signature===a){n.set(e,s),i.push(s);continue}const l=t.buildRowModel(o,r,{id:e,signature:a});n.set(e,l),i.push(l)}return this.rowsById=n,i}}class Hs{createRenderWindow(e,t){var r,n,i,o,a,s,l,c,u,d,h,f,p,g,m,v,y,b,w,x,C,_,S,A,k;const E=null!==(r=null==t?void 0:t.renderStrategy)&&void 0!==r?r:"full";if("windowed"!==E){if("positioned"===E){const r=null!==(i=null===(n=null==t?void 0:t.positioned)||void 0===n?void 0:n.layout)&&void 0!==i?i:[],v=null!==(a=null===(o=null==t?void 0:t.positioned)||void 0===o?void 0:o.viewportTop)&&void 0!==a?a:0,y=null!==(l=null===(s=null==t?void 0:t.positioned)||void 0===s?void 0:s.viewportBottom)&&void 0!==l?l:Number.MAX_SAFE_INTEGER,b=Math.max(0,null!==(u=null===(c=null==t?void 0:t.positioned)||void 0===c?void 0:c.overscanPx)&&void 0!==u?u:0),w=Math.max(0,null!==(h=null===(d=null==t?void 0:t.positioned)||void 0===d?void 0:d.containerHeight)&&void 0!==h?h:0),x=r.filter(e=>e.bottom>=v-b&&e.top<=y+b).map(t=>({row:e[t.index],layout:t})).filter(e=>Boolean(e.row)),C=null!==(p=null===(f=x[0])||void 0===f?void 0:f.layout.index)&&void 0!==p?p:-1,_=null!==(m=null===(g=x[x.length-1])||void 0===g?void 0:g.layout.index)&&void 0!==m?m:-1;return{rows:x.map(e=>e.row),startIndex:C,endIndex:_,topOffset:0,bottomOffset:0,totalCount:e.length,containerHeight:w,positionedItems:x}}return{rows:e,startIndex:0,endIndex:e.length>0?e.length-1:-1,topOffset:0,bottomOffset:0,totalCount:e.length}}const I=Math.max(0,null!==(y=null===(v=null==t?void 0:t.windowed)||void 0===v?void 0:v.startIndex)&&void 0!==y?y:0),T=null!==(w=null===(b=null==t?void 0:t.windowed)||void 0===b?void 0:b.endIndex)&&void 0!==w?w:e.length-1,F=Math.max(0,null!==(C=null===(x=null==t?void 0:t.windowed)||void 0===x?void 0:x.overscan)&&void 0!==C?C:0),O=Math.max(1,null!==(S=null===(_=null==t?void 0:t.windowed)||void 0===_?void 0:_.estimatedItemSize)&&void 0!==S?S:1),P=Math.max(1,null!==(k=null===(A=null==t?void 0:t.windowed)||void 0===A?void 0:A.itemsPerLane)&&void 0!==k?k:1),M=Math.ceil(e.length/P),R=Math.min(e.length-1,T),L=Math.floor(I/P),N=Math.floor(Math.max(I,R)/P),j=Math.max(0,L-F),D=Math.min(M-1,N+F),z=j*P,B=Math.min(e.length-1,(D+1)*P-1),U=Math.max(0,M-D-1);return{rows:e.slice(z,B+1),startIndex:z,endIndex:B,topOffset:j*O,bottomOffset:U*O,totalCount:e.length}}}function Ws({items:e,context:t,adapter:r,options:n}){const i=u(null),o=u(null);i.current||(i.current=new Vs),o.current||(o.current=new Hs);const a=d(()=>i.current.reconcile(e,r,t),[r,t,e]),s=d(()=>o.current.createRenderWindow(a,n),[n,a]);return{rowModels:a,renderWindow:s}}function $s({totalCount:e,plan:t}){const[r,n]=o(null),i=d(()=>{var n,i;if(!t.enabled)return{renderStrategy:"full"};const o=function(e,t){var r;return Math.max(1,null!==(r=null==e?void 0:e.viewportHeight)&&void 0!==r?r:t)}(r,null!==(n=t.fallbackViewportHeight)&&void 0!==n?n:800),a=Math.max(1,Math.ceil(o/t.estimatedItemSize)),s=Math.max(1,Math.ceil(e/t.itemsPerLane)),l=Math.min(s-1,Math.max(0,Math.floor((null!==(i=null==r?void 0:r.scrollTop)&&void 0!==i?i:0)/t.estimatedItemSize))),c=l+a-1;return{renderStrategy:"windowed",windowed:{startIndex:l*t.itemsPerLane,endIndex:Math.min(e-1,(c+1)*t.itemsPerLane-1),overscan:t.overscan,estimatedItemSize:t.estimatedItemSize,itemsPerLane:t.itemsPerLane}}},[t.enabled,t.estimatedItemSize,t.fallbackViewportHeight,t.itemsPerLane,t.overscan,e,r]);return{engineOptions:i,handleViewportChange:c(e=>{n(t=>(null==t?void 0:t.viewportHeight)===e.viewportHeight&&(null==t?void 0:t.viewportWidth)===e.viewportWidth&&(null==t?void 0:t.scrollHeight)===e.scrollHeight&&(null==t?void 0:t.scrollTop)===e.scrollTop?t:e)},[])}}function qs(e,t){if("number"==typeof e.childCount)return e.childCount;const r=t[e.id];return null===r?null:null!=r?r:0}function Gs(e){var t,r,n;const i=e.extension||(e.name&&e.name.includes(".")?e.name.split(".").pop():void 0)||((null===(t=e.type)||void 0===t?void 0:t.startsWith("image/"))?null===(n=null===(r=e.type.split("/")[1])||void 0===r?void 0:r.split(";")[0])||void 0===n?void 0:n.trim():void 0);return Boolean(i&&hr.includes(i.toLowerCase()))}function Ys(e,t){if(!e)return"";const r=new Date(e);if(Number.isNaN(r.getTime()))return"";const n=[t("months.january"),t("months.february"),t("months.march"),t("months.april"),t("months.may"),t("months.june"),t("months.july"),t("months.august"),t("months.september"),t("months.october"),t("months.november"),t("months.december")];return t("Added",{date:`${r.getDate()} ${n[r.getMonth()]} ${r.getFullYear()}`})}const Xs={getId:e=>e.id,buildSignature:(e,t)=>function(e,t){var r,n,i,o,a,s,l,c;const u=Boolean(e.isFolder),d=u?qs(e,t.folderFileCounts):null,h=u?null===d?"u":String(d):"0",f=Ys(e.date,t.t),p=!u&&e.size?String(e.size):"",g=e.thumbnailUrl||e.thumbnail,m=e.url&&Gs(e)?e.url:"",v=t.previewFallbackToFileUrl?m:"",y=[!1!==(null===(r=t.features)||void 0===r?void 0:r.enableEdit),!1!==(null===(n=t.features)||void 0===n?void 0:n.enableMoveFolder),!1!==(null===(i=t.features)||void 0===i?void 0:i.enableMoveItem),!1!==(null===(o=t.features)||void 0===o?void 0:o.enableCopyFolder),!1!==(null===(a=t.features)||void 0===a?void 0:a.enableCopyItem),!1!==(null===(s=t.features)||void 0===s?void 0:s.enableRenameFolder),!1!==(null===(l=t.features)||void 0===l?void 0:l.enableRenameFile),!1!==(null===(c=t.features)||void 0===c?void 0:c.enableDelete)].join("|"),b=[g||"",v,m].join("::");return[e.id,e.name,e.folderId,e.type||"",e.extension||"",b,b,e.dimensions||"",p,f,u?"1":"0",h,y].join("::")}(e,t),buildRowModel:(e,t,r)=>{var n,i,o,a,s,l,c,u;const d=Boolean(e.isFolder),h=d?qs(e,t.folderFileCounts):null,f=d&&null===h?"—":d?`${h} ${1===h?t.t("item"):t.t("items")}`:"",p=e.dimensions||"",g=!d&&e.size?ci(e.size):"",m=d?t.t("Folder"):function(e){var t,r,n;return e.extension||(null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||(e.url?null===(n=null===(r=e.url.split("?")[0].split("/").pop())||void 0===r?void 0:r.split(".").pop())||void 0===n?void 0:n.toLowerCase():"")||""}(e),v=Ys(e.date,t.t),y=d?f:[p,g,m].filter(Boolean).join(" • "),b=e.thumbnailUrl||e.thumbnail,w=e.url&&Gs(e)?e.url:void 0,x=t.previewFallbackToFileUrl?w:void 0;return{id:r.id,signature:r.signature,item:e,file:e,isFolder:d,nameText:e.name||t.t("No name"),folderItemsText:f,dimensionsText:p,sizeText:g,typeText:m,dateText:v,gridInfoText:y,thumbnailSrc:b,previewSrc:x,lightboxSrc:w,canEdit:!d&&!1!==(null===(n=t.features)||void 0===n?void 0:n.enableEdit)&&Gs(e),canMove:d?!1!==(null===(i=t.features)||void 0===i?void 0:i.enableMoveFolder):!1!==(null===(o=t.features)||void 0===o?void 0:o.enableMoveItem),canCopy:d?!1!==(null===(a=t.features)||void 0===a?void 0:a.enableCopyFolder):!1!==(null===(s=t.features)||void 0===s?void 0:s.enableCopyItem),canRename:d?!1!==(null===(l=t.features)||void 0===l?void 0:l.enableRenameFolder):!1!==(null===(c=t.features)||void 0===c?void 0:c.enableRenameFile),canDelete:!1!==(null===(u=t.features)||void 0===u?void 0:u.enableDelete)}}};const Ks=i.memo(({files:r,searchTerm:n,handleSearch:i,sortBy:s,sortOrder:l,handleSortOptionChange:h,pagination:f,setPagination:p,loading:g,handleItemClick:m,onClearSelection:v,onRename:y,onDelete:b,onCopy:w,onMove:x,showRenameModal:C,showDeleteConfirm:_,showCopyModal:A,showMoveModal:k,onEdit:E,getFileData:I,handleAddFile:T})=>{var F;const{t:O}=Gn(),P=Fo(),{DropZoneFileIcon:M,BigStockIcon:R,BigAIIcon:L,FolderIcon:N}=go(),{options:j,actions:D,state:z}=fo(),{dataProviders:B,config:U}=j,V=null==U?void 0:U.disablePagination,{setCurrentMenuFile:H,setActiveLibraryItem:$}=D,q="Trash"===(null==z?void 0:z.selectedFolder),G=!1!==(null==z?void 0:z.multiSelect),{viewMode:Y,setViewMode:X}=(()=>{const[e,t]=o(()=>{try{return localStorage.getItem(Us)||"table"}catch(e){return"table"}}),r=c(e=>{t(e);try{localStorage.setItem(Us,e)}catch(e){console.warn("Не удалось сохранить режим отображения:",e)}},[]),n=c(()=>{r("table"===e?"grid":"table")},[e,r]);return{viewMode:e,setViewMode:r,toggleViewMode:n}})(),[K,Z]=o({}),[J,Q]=o(!1),ee=u(0),te=u(null);a(()=>{const e=window.matchMedia("(max-width: 1199px)"),t=e=>{Q(e.matches)};t(e);const r=e=>t(e);return"function"==typeof e.addEventListener?(e.addEventListener("change",r),()=>e.removeEventListener("change",r)):(e.addListener(r),()=>e.removeListener(r))},[]);const re=d(()=>(null==U?void 0:U.features)||{},[null==U?void 0:U.features]),ne=null==U?void 0:U.iconStrokeWidth,ie=null==U?void 0:U.sortOptions,oe=d(()=>(null==ie?void 0:ie.length)?new Set(ie):null,[ie]),ae=`${s}-${l}`;a(()=>{var e;if(oe&&!oe.has(ae)){const t=null===(e=Ss.find(e=>oe.has(e.value)))||void 0===e?void 0:e.value;t&&h(t)}},[oe,ae,h]);const se=d(()=>new Map(r.map(e=>[e.id,e])),[r]),{renderRows:le,renderWindow:ce,hasAnyValidDate:ue,handleViewportChange:de}=function({files:e,folderFileCounts:t,features:r,t:n,viewMode:i,previewFallbackToFileUrl:a}){const s=d(()=>({folderFileCounts:t,features:r,t:n,previewFallbackToFileUrl:a}),[r,t,n,a]),[l,u]=o(()=>Math.max(1,Math.floor(5))),h=d(()=>{const t=e.length>150;return"table"===i?{enabled:t,estimatedItemSize:56,overscan:10,itemsPerLane:1,fallbackViewportHeight:800}:{enabled:t,estimatedItemSize:320,overscan:2,itemsPerLane:l,fallbackViewportHeight:800}},[e.length,l,i]),{engineOptions:f,handleViewportChange:p}=$s({totalCount:e.length,plan:h}),{rowModels:g,renderWindow:m}=Ws({items:e,context:s,adapter:Xs,options:f}),v=d(()=>g.some(e=>Boolean(e.dateText)),[g]),y=c(e=>{if("grid"===i){const t=Math.max(1,Math.floor(e.viewportWidth/240));u(e=>e===t?e:t)}p(e)},[p,i]);return{rowModels:g,renderRows:m.rows,renderWindow:m,hasAnyValidDate:v,handleViewportChange:y}}({files:r,folderFileCounts:K,features:re,t:O,viewMode:Y,previewFallbackToFileUrl:null==U?void 0:U.previewFallbackToFileUrl}),he=c(async e=>{var t,r,n,i;try{if(null==B?void 0:B.getChildrenCount)return await B.getChildrenCount("folders"===e?void 0:e);if(null==B?void 0:B.getFiles){const{files:r,pagination:n}=await B.getFiles({folderId:"folders"===e?void 0:e,itemType:"all",page:V?void 0:1,limit:V?void 0:1});return V?Array.isArray(r)?r.length:0:null!==(t=null==n?void 0:n.total)&&void 0!==t?t:Array.isArray(r)?r.length:0}return 0}catch(t){if("StaleLoad"===(null==t?void 0:t.name))return 0;const o=t;if(404===(null==o?void 0:o.status)||"FileNotFound"===(null==o?void 0:o.code)||"path_folder_not_found"===(null==o?void 0:o.code)||"path_folder_not_found"===(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.code)||404===(null===(i=null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status))return 0;console.error(`Error getting the number of files for the folder ${e}:`,t);const a=await Ua({folderId:e,dataProviders:B,folders:Array.isArray(z.folders)?z.folders:[],pathHistory:z.pathHistory,t:O});return P.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:O("Failed to load folder items count in folder",{folderName:a}),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{folderId:"folders"===e?null:e,folderName:a,reason:t instanceof Error?t.message:String(t)}}),null}},[B,V,P,z.folders,z.pathHistory,O]),fe=c(async()=>{const e=ee.current+1;ee.current=e;const t=r.filter(e=>e.isFolder);if(0===t.length)return void Z(e=>0===Object.keys(e).length?e:{});const n={},i=t.map(async e=>{"number"!=typeof e.childCount?n[e.id]=await he(e.id):n[e.id]=e.childCount});await Promise.all(i),ee.current===e&&Z(e=>{const t=Object.keys(e),r=Object.keys(n);return t.length===r.length&&t.every(t=>e[t]===n[t])?e:n})},[r,he]);a(()=>{fe()},[fe]),a(()=>{te.current&&de(xs(te.current))},[r.length,de,Y]),a(()=>{if(!te.current||"undefined"==typeof ResizeObserver)return;const e=te.current,t=new ResizeObserver(()=>{de(xs(e))});return t.observe(e),()=>{t.disconnect()}},[de]);const pe=c(e=>{const t=xs(e);de(t)},[de]);a(()=>{const e=te.current;if(!e)return;const t=()=>{pe(e)},r=ys(e);return r.forEach(e=>{e.addEventListener("scroll",t,{passive:!0})}),()=>{r.forEach(e=>{e.removeEventListener("scroll",t)})}},[r.length,pe,Y]);const ge=c((e,t)=>e!==t,[]),me=d(()=>[...G?[{key:"selection",width:46,shouldCellUpdate:ge,render:(t,r)=>e(Ts,{fileId:r.id})}]:[],{key:"preview",width:60,shouldCellUpdate:ge,render:(t,r)=>e(Rs,{item:r,variant:"table",FolderIcon:N,getFileData:I,className:`${As.imagePreview} ${As.tableImagePreview}`,width:40,height:40})},{title:O("Name"),width:"calc(100% - 430px)",dataIndex:"nameText",key:"name",className:As.fileNameCol,shouldCellUpdate:ge,render:(t,r)=>e(Bs,{item:r})},{title:O("Dimensions"),key:"dimensions",width:100,shouldCellUpdate:ge,render:(t,r)=>r.dimensionsText&&e("div",{className:As.fileSize,children:r.dimensionsText})},{title:O("Size"),key:"size",width:90,shouldCellUpdate:ge,render:(t,r)=>r.sizeText?e("div",{className:As.fileSize,children:r.sizeText}):null},{title:O("Type"),key:"type",width:90,shouldCellUpdate:ge,render:(t,r)=>e("div",{className:As.fileSize,children:r.typeText})},...ue?[{title:O("Date"),dataIndex:"dateText",key:"date",width:200,shouldCellUpdate:ge,render:(t,r)=>e(zs,{item:r})}]:[],{width:40,title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),shouldCellUpdate:ge,render:(t,r)=>e(Ps,{item:r,variant:"table",t:O,iconStrokeWidth:ne,setCurrentMenuFile:H,showMoveModal:k,showCopyModal:A,showRenameModal:C,showDeleteConfirm:_,onEdit:E})}],[N,I,ue,ne,G,E,H,ge,A,_,k,C,O]),ve=d(()=>({body:{row:Os}}),[]),ye=c(e=>({onClick:t=>{if(t.stopPropagation(),t.preventDefault(),1!==t.detail)return;const r=t.target,n=Boolean(r.closest(".ant-checkbox-wrapper")),i=Boolean(r.closest(".ant-image"))||Boolean(r.closest(".ant-image-preview-wrap")),o=Boolean(r.closest(".tableMenuButton")),a=Boolean(r.closest(".ant-dropdown-menu"));n||i||o||a||(e.isFolder?m(e.file):j.onEditorOk&&Ls(e.file)&&j.onEditorOk(e.file))}}),[m,j]);let be="table"===Y?e(Ds,{rows:le,columns:me,topOffset:ce.topOffset,bottomOffset:ce.bottomOffset,onRow:ye,components:ve}):e(js,{rows:le,topOffset:ce.topOffset,bottomOffset:ce.bottomOffset,t:O,iconStrokeWidth:ne,FolderIcon:N,handleItemClick:m,setCurrentMenuFile:H,showMoveModal:k,showCopyModal:A,showRenameModal:C,showDeleteConfirm:_,onEdit:E,onEditorOk:j.onEditorOk,getFileData:I,showSelectionCheckbox:G});n&&!r.length&&(be=e(wo,{}));const we=null===(F=null==U?void 0:U.availableImageExtensions)||void 0===F?void 0:F.map(e=>"."+e).join(", "),xe=t("div",q?{className:`${As.noFiles} ant-layout-sider-light`,children:[e(Ri,{size:48,className:As.noFilesIcon}),e("div",{className:`${As.textTitle_trash} ant-menu-submenu-title`,children:O("Trash is empty")}),e("div",{className:`${As.textDescription_trash} ant-menu-submenu-title`,children:O("Deleted files will be displayed here")})]}:{className:As.uploadContainer,children:[t("div",{className:`${As.uploadArea} `,onClick:T,children:[e("div",{className:As.uploadIcon,children:e(M,{})}),e("div",{className:As.textTitle,children:O("Click here to select a file")}),e("div",{className:As.textDescription,children:O("Supported files:")+" "+(we||"jpeg, .svg, .png")})]}),t("div",{className:As.buttons,children:[t("button",{className:As.btnPhoto,onClick:()=>{$&&$(tr)},children:[e("div",{className:As.icon,children:e(R,{})}),t("div",{className:As.blockText,children:[e("div",{className:As.textTitle,children:O("Stock")}),e("div",{className:As.textDescription,children:O("Select an image from our library")})]})]}),t("button",{className:As.btnAi,onClick:()=>{$&&$(nr)},children:[e("div",{className:As.icon,children:e(L,{})}),t("div",{className:As.blockText,children:[e("div",{className:As.textTitle,children:O("AI generation")}),e("div",{className:As.textDescription,children:O("Creating an image on demand")})]})]})]})]});return e("div",{className:`content-layout ${As.contentLayout}`,children:g||0!==(null==r?void 0:r.length)||n?t("div",{className:As.tableContainer,children:[e(Is,{files:r,filesById:se,currentSortOption:ae,isSmallScreen:J,iconStrokeWidth:ne,multiSelectEnabled:G,features:re,viewMode:Y,setViewMode:X,handleSearch:i,handleSortOptionChange:h,sortOptions:ie,onClearSelection:v,onRename:y,onDelete:b,onCopy:w,onMove:x,onEdit:E,t:O}),t("div",{ref:te,className:As.filesContainer,children:[be,g?e("div",{className:As.filesLoadingOverlay,"aria-busy":"true","aria-live":"polite",children:e(S,{size:"large"})}):null]}),!V&&f.total>f.pageSize&&e("div",{className:As.paginationContainer,children:e(W,{current:f.current,pageSize:f.pageSize,total:f.total,onChange:(e,t)=>p({current:e,pageSize:t,total:f.total}),showSizeChanger:!0,showTotal:e=>O("total pages",{total:e})})})]}):e("div",{className:As.emptyStateWrapper,children:xe})})});Ks.displayName="FileContent";var Zs="folderTree",Js="emptyFolderContainer",Qs="folderItemContainer",el="folderLabel",tl="folderLabelItem",rl="fileCount",nl="foldersTitle",il="foldersTitleItem",ol="folderMenu";const al=({selectedFolder:r,onSelect:n,onExpand:i,generateMenuItems:s,fetchChildFolders:l,disabledFolders:u=[],showFileCounts:h=!1,folderFileCounts:f={},className:p="",expandedKeys:g,setExpandedKeys:m,showTrashFolder:v=!1,mode:y="navigation",defaultExpandAll:b=!1})=>{const{t:w}=Gn(),{options:x}=fo(),{config:C}=x,{ExpandArrowIcon:_,CollapseArrowIcon:S,CollapseFolderIcon:A,ExpandFolderIcon:k,EmptyFolderIcon:E}=go(),I=c(e=>{const t=[],r=e=>{e.forEach(e=>{t.push(e.key),e.children&&r(e.children)})};return r(e),t},[]),[T,F]=o(()=>{if(b||"selection"===y&&b){const e=s();return I(e)}return[]}),O=void 0!==g?g:T,P=void 0!==m?m:F;a(()=>{if(b||"selection"===y&&b){const e=s(),t=I(e);void 0===g&&F(t)}},[b,y,s,I,g]);const M=c(async e=>{const t=e[0];t&&"empty"!==t&&!t.endsWith("_input")&&(null==n||n(e),await(null==l?void 0:l("folders"===t?null:t)))},[n,l]),R=c(async(e,t)=>{var r;P(e),null==i||i(e,t);if(!("lazy"===(null==C?void 0:C.folderTreeLoading)))return;const n=(null===(r=null==t?void 0:t.node)||void 0===r?void 0:r.key)||void 0;if(n&&"folders"!==n)try{await(null==l?void 0:l(n))}catch(e){console.warn("Failed to load child folders for",n,e)}},[null==C?void 0:C.folderTreeLoading,l,i,P]),L=c(()=>{var n,i;const o=s(),a=e=>e.filter(e=>"Trash"!==e.key).map(e=>Object.assign(Object.assign({},e),{children:e.children?a(e.children):void 0})),l=v?a(o):o,c=e=>{"selection"!==y?(O.includes(e)&&r===e?P(O.filter(t=>t!==e)):O.includes(e)||P([...O,e]),M([e])):M([e])},d=0===l.length||1===l.length&&(!l[0].children||0===l[0].children.length),p=r=>{var n;const i=h?f[r.key]:void 0,o=h&&null===i?null:h&&null!=i?i:0,a=O.includes(r.key),s=u.includes(r.key),l=(()=>{var t;return(null===(t=r.children)||void 0===t?void 0:t.length)?e(a?A:k,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}):e(E,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth})})(),d=t("div",{className:`${Qs} folder-item-container`,onClick:()=>!s&&c(r.key),style:{opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},children:[t("div",{className:el,children:[void 0!==r.icon?r.icon:l,e("span",{className:tl,children:r.label})]}),h&&e("div",{className:rl,title:null===o?void 0:`${o} ${w(1===o?"item":"items")}`,children:null===o?"—":o})]});return{key:r.key,title:d,children:null===(n=r.children)||void 0===n?void 0:n.map(p),disabled:s}},g=O.includes("folders"),m=e("div",{className:nl,onClick:()=>c("folders"),children:t("div",{className:il,children:[e(g?A:k,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:`${tl} folder-label-item`,children:"folders"===(null===(n=l[0])||void 0===n?void 0:n.key)?l[0].label:w("Folders")})]})}),b=()=>({key:"Trash",title:e("div",{className:nl,onClick:()=>c("Trash"),children:t("div",{className:il,children:[e(Mi,{size:20,strokeWidth:null==C?void 0:C.iconStrokeWidth}),e("span",{className:tl,children:w("Trash")})]})}),children:void 0});if(d){if(!v)return[{key:"empty",title:e("div",{className:Js,children:w("No folders yet")}),disabled:!0}];const t=[];return l.length>0&&"folders"===l[0].key&&t.push({key:"folders",title:m,children:[]}),t.push(b()),t}if(l.length>0&&"folders"===l[0].key){const e=[{key:"folders",title:m,children:null===(i=l[0].children)||void 0===i?void 0:i.map(p)}];return v&&e.push(b()),e}return l.map(p)},[s,O,A,null==C?void 0:C.iconStrokeWidth,k,w,r,M,h,f,E,u,v,y,P]),N=d(()=>L(),[L]);return e($,{className:`${Zs} ${ol} ${p}`,selectedKeys:r?[r]:[],expandedKeys:O,onSelect:M,onExpand:R,treeData:N,switcherIcon:({expanded:t})=>e(t?S:_,{}),showLine:!1})},sl=({style:t={},wrap:r=!1})=>{const n=Object.assign({width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},t);return e(R,{size:"large",style:n,wrap:r,children:e(S,{})})};var ll={formFooter:"formFooter",folderButton:"folderButton",foldersWrapper:"foldersWrapper",formItem:"formItem",folderToolsField:"folderToolsField",inputButtonOk:"inputButtonOk",permanentDeleteWarning:"permanentDeleteWarning",clearTrashProgress:"clearTrashProgress",progressText:"progressText",closeIcon:"closeIcon",modalContentWithLoader:"modalContentWithLoader",modalLoaderOverlay:"modalLoaderOverlay"};const cl=({folderId:n,activeFormField:i,EmptyFolderIcon:o,targetForm:a,handleModalOk:s,onComplete:l,setIsLoading:c,t:u})=>e(I.Item,{className:"form-item form-item-moveto "+(i===n?"form-item_active":""),name:"folderName",initialValue:u("New folder"),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(u("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{className:"form-input",autoFocus:!0,prefix:e(o,{style:{marginRight:6}}),suffix:t(r,{children:[e(P,{placement:"top",title:"Clean",children:e(M,{icon:e(me,{style:{fontSize:10}}),className:ll.inputButtonClose,type:"text",onClick:()=>{a.setFieldsValue({folderName:""})}})}),e(M,{className:ll.inputButtonOk,type:"text",onClick:()=>{c(!0),s(a).then(e=>{const t=null==e?void 0:e.id;l(t)}).finally(()=>c(!1))},children:u("Create")})]})})});function ul({folders:n,selectedFolder:o,EmptyFolderIcon:a,handleCreateFolderModalOk:s,setIsLoading:l,t:c}){const[u,d]=i.useState(""),h=i.useCallback((t,r)=>n=>e(cl,{folderId:n,activeFormField:u,EmptyFolderIcon:a,targetForm:t,handleModalOk:s,onComplete:r,setIsLoading:l,t:c},n),[a,u,s,l,c]),f=i.useCallback(e=>{const{folderId:t,targetForm:r,onTreeSelect:n,onComplete:i}=e;return{handleAddFolder:e=>{e.preventDefault(),e.stopPropagation(),d(t),r.setFieldsValue({folderName:c("New folder"),targetFolder:t})},handleSelectFolder:e=>{e.preventDefault(),e.stopPropagation(),n([t]).then(()=>i(t))}}},[c]),p=i.useCallback(i=>{const{targetForm:a,onTreeSelect:s,onComplete:l,actionButtonText:d}=i,p=h(a,l),g=Array.isArray(n)?n:[],m=(n=null,i=new Set)=>g.filter(e=>{const t=null===n&&!e.parentId,r=e.parentId===n;return t||r}).map(n=>{if(i.has(n.id))return{key:n.id,label:`${n.name} (циклическая ссылка)`};const c=new Set(i);c.add(n.id);const h=m(n.id,c),{handleAddFolder:g,handleSelectFolder:v}=f({folderId:n.id,targetForm:a,onTreeSelect:s,onComplete:l}),y=u===n.id?[{key:`${n.id}_input`,label:p(n.id),icon:null},...h]:h;return{key:n.id,label:t(r,{children:[n.name,o!==n.id&&t("div",{className:`${ll.folderToolsField} folder-tools-field`,children:[e(M,{onClick:g,children:"+"}),e(M,{onClick:v,children:d})]})]}),children:y}}),v=m(),{handleAddFolder:y,handleSelectFolder:b}=f({folderId:"folders",targetForm:a,onTreeSelect:s,onComplete:l}),w="folders"===u?[{key:"folders_input",label:p("folders"),icon:null},...v]:v;return[{key:"folders",label:t(r,{children:[c("Folders"),"folders"!==o&&null!==o&&t("div",{className:`${ll.folderToolsField} folder-tools-field`,children:[e(M,{onClick:y,children:"+"}),e(M,{onClick:b,children:d})]})]}),children:w}]},[u,h,f,n,o,c]);return{activeFormField:u,setActiveFormField:d,generateMenuItemsFromFolders:p}}const dl=f(({folderId:t,activeFormField:r,EmptyFolderIcon:n,targetForm:i,handleModalOk:o,onComplete:a,t:s,setIsLoading:l,defaultFolderName:u})=>{const d=c(()=>{l(!0),o(i).then(e=>a(null==e?void 0:e.id)).finally(()=>l(!1))},[o,i,a,l]);return e(I.Item,{className:"form-item form-item-moveto "+(r===t?"form-item_active":""),name:"folderName",initialValue:u,rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(s("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{className:"form-input",autoFocus:!0,prefix:e(n,{style:{marginRight:6}}),suffix:e(M,{className:ll.inputButtonOk,type:"text",onClick:()=>{l(!0),d()},children:s("Create")})})})});dl.displayName="CustomFolderInput";const hl=({isModalVisible:n,handleModalOk:i,handleModalCancel:s,form:l,selectedFolder:u,folders:h,isUrlModalVisible:f,setIsUrlModalVisible:p,handleAddFileByUrl:g,urlForm:m,isRenameModalVisible:v,handleRenameOk:y,handleRenameCancel:b,renameForm:w,fileToRename:x,files:C,isMoveModalVisible:_,handleMoveOk:S,handleMoveCancel:A,moveForm:k,selectedFiles:E,isRenameFolderModalVisible:F,handleRenameFolderOk:O,handleRenameFolderCancel:P,renameFolderForm:R,folderToRename:L,isCopyModalVisible:N,handleCopyOk:j,handleCopyCancel:D,copyForm:z,isDeleteConfirmVisible:B,handleDeleteConfirmOk:U,handleDeleteConfirmCancel:V,isClearTrashConfirmVisible:H,handleClearTrashConfirm:W,handleClearTrashCancel:$,fetchChildFolders:Y})=>{var X,K,Z;const{t:J}=Gn(),{state:Q,actions:ee,options:te}=fo(),{setCurrentMenuFile:re}=ee,{config:ne}=te,{currentMenuFile:ie}=Q,oe=I.useWatch("folderName",l),{EmptyFolderIcon:ae}=go(),[se,le]=o(!1),ce=d(()=>{var e;return(null===(e=null==ne?void 0:ne.defaultFolderName)||void 0===e?void 0:e.trim())||J("New folder")},[null==ne?void 0:ne.defaultFolderName,J]),ue=!oe||0===String(oe).trim().length,de=d(()=>Array.isArray(C)?C:[],[C]),he=x?null===(X=de.find(e=>e.id===x))||void 0===X?void 0:X.name:"",fe=Array.isArray(h)?h:[],pe=L?null===(K=fe.find(e=>e.id===L))||void 0===K?void 0:K.name:"",{activeFormField:ge,setActiveFormField:ve,generateMenuItemsFromFolders:ye}=ul({folders:fe,selectedFolder:u,EmptyFolderIcon:ae,handleCreateFolderModalOk:i,setIsLoading:e=>le(Boolean(e)),t:J});a(()=>{if(B){const e=setTimeout(()=>{const e=document.querySelector(".deleteModal");if(e){const t=e.querySelector(".ant-modal-footer");if(t){const e=t.querySelector(".ant-btn-primary");e&&e.focus()}}},100);return()=>clearTimeout(e)}},[B]);const be=x?de.find(e=>e.id===x):null,we=(null==be?void 0:be.isFolder)||(null==x?void 0:x.startsWith("folder_")),xe=c(async e=>{e.length>0&&(k.setFieldsValue({targetFolder:e[0]}),ge!==e[0].toString()&&ve(""))},[k,ge,ve]),Ce=c(async e=>{e.length>0&&(z.setFieldsValue({targetFolder:e[0]}),ge!==e[0].toString()&&ve(""))},[ge,z,ve]),_e=c(async e=>{le(!0);try{await S(e)}finally{le(!1)}},[S]),Se=c(async e=>{le(!0);try{await j(e)}finally{le(!1)}},[j]),Ae=d(()=>{const e=Array.from(E).filter(e=>{const t=de.find(t=>t.id===e);return(null==t?void 0:t.isFolder)||h.some(t=>t.id===e)});return u&&"folders"!==u?e.push(u):u&&"folders"!==u||e.push("folders"),e},[E,de,h,u]);return t(r,{children:[e(q,{title:e("div",{className:"modal-title",children:J("Creating a new folder")}),open:n,onOk:()=>i(),onCancel:s,okText:J("Create"),cancelText:J("Cancel"),okButtonProps:{disabled:ue,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>le(!1),children:t(I,{form:l,layout:"vertical",children:[e(I.Item,{name:"folderName",label:e("div",{className:"form-label",children:J("Folder name")}),rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(J("Enter the name of the folder"))):Promise.resolve()}],initialValue:ce,className:"form-item",style:{marginBottom:5},children:e(T,{autoFocus:!0,className:"form-input",disabled:se,placeholder:J("Enter the name"),onPressEnter:async()=>{le(!0);try{await l.validateFields(),ue||await i()}catch(e){le(!1)}}})}),e("div",{children:u&&"folders"!==u?t("p",{className:"fm-note",children:[J("A folder will be created inside:")," ",(null===(Z=fe.find(e=>e.id===u))||void 0===Z?void 0:Z.name)||J("selected folder"),"."]}):e("p",{className:"fm-note",children:J("The folder will be created in the root directory.")})})]})}),e(q,{title:e("div",{className:"modal-title",children:J("Upload file by URL")}),open:f,onOk:async()=>{var e;le(!0);try{const t=await m.validateFields(),r=String(null!==(e=t.fileUrl)&&void 0!==e?e:"").trim();await g(r,void 0,void 0,"uploadByUrl")}catch(e){}finally{le(!1)}},onCancel:()=>p(!1),okText:J("Download"),okButtonProps:{loading:se},cancelText:J("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>le(!1),children:e(I,{form:m,layout:"vertical",children:e(I.Item,{name:"fileUrl",label:e("div",{className:"form-label",children:J("File URL")}),rules:[{required:!0,message:J("Enter the URL of the image")},{validator:(e,t)=>{if(!t||!String(t).trim())return Promise.resolve();try{return Xo(String(t),J),Promise.resolve()}catch(e){return Promise.reject(new Error(e instanceof Error?e.message:J("The specified URL is not valid.")))}}}],validateTrigger:"onBlur",className:"form-item",children:e(T,{className:"form-input",placeholder:"https://example.com/image.jpg",autoFocus:!0,disabled:se,onPressEnter:async()=>{var e;le(!0);try{const t=await m.validateFields(),r=String(null!==(e=t.fileUrl)&&void 0!==e?e:"").trim();await g(r,void 0,void 0,"uploadByUrl")}catch(e){}finally{le(!1)}}})})})}),e(q,{title:e("div",{className:"modal-title",children:we?`${J("Rename folder")} ${he}`:J("Rename file",{currentFileName:he})}),open:v,onOk:y,okText:J("Rename"),okButtonProps:{loading:se},onCancel:b,cancelText:J("Cancel"),cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},children:e(I,{form:w,layout:"vertical",children:e(I.Item,{name:"newFileName",label:e("div",{className:"form-label",children:J(we?"New folder name":"New file name")}),rules:[{required:!0,message:J(we?"Enter a new folder name":"Enter a new file name")}],className:"form-item",children:e(T,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{le(!0);try{await w.validateFields(),y()}catch(e){le(!1)}}})})})}),e(q,{title:e("div",{className:"modal-title",children:J("Move to")}),open:_,onCancel:A,footer:t("div",{className:ll.formFooter,children:[t(M,{className:ll.folderButton,onClick:()=>{const e=null!=u?u:"folders";ve(e),k.setFieldsValue({folderName:ce,targetFolder:e})},loading:se,children:[e(bi,{size:18,strokeWidth:null==ne?void 0:ne.iconStrokeWidth}),J("Create folder")]}),e(M,{type:"primary",className:ll.folderButton,onClick:A,loading:se,children:J("Done")})]}),afterClose:()=>{re&&re(""),ve(""),le(!1)},loading:se,children:t("div",{className:ll.modalContentWithLoader,children:[se&&e("div",{className:ll.modalLoaderOverlay,children:e(sl,{})}),e(I,{form:k,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ce,is_force_create:!1},children:t("div",{className:ll.foldersWrapper,children:[e(I.Item,{name:"targetFolder",rules:[{required:!0,message:J("Select the destination folder")}],className:ll.formItem,children:e(al,{onSelect:xe,generateMenuItems:()=>ye({targetForm:k,onTreeSelect:xe,onComplete:_e,actionButtonText:J("Move here")}),fetchChildFolders:Y,disabledFolders:Ae,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(I.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(J("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{})}),e(I.Item,{name:"is_force_create",style:{display:"none"},children:e(T,{})})]})})]})}),e(q,{title:e("div",{className:"modal-title",children:J("Copy to folder")}),open:N,onCancel:D,footer:t("div",{className:ll.formFooter,children:[t(M,{className:ll.folderButton,onClick:()=>{const e=null!=u?u:"folders";ve(e),z.setFieldsValue({folderName:ce,targetFolder:e})},loading:se,children:[e(bi,{size:18,strokeWidth:null==ne?void 0:ne.iconStrokeWidth}),J("Create folder")]}),e(M,{type:"primary",className:ll.folderButton,onClick:D,loading:se,children:J("Done")})]}),afterClose:()=>{re&&re(""),ve(""),le(!1)},loading:se,children:t("div",{className:ll.modalContentWithLoader,children:[se&&e("div",{className:ll.modalLoaderOverlay,children:e(sl,{})}),e(I,{form:z,layout:"vertical",initialValues:{targetFolder:"folders",folderName:ce,is_force_create:!1},children:t("div",{className:ll.foldersWrapper,children:[e(I.Item,{name:"targetFolder",rules:[{required:!0,message:J("Select the destination folder")}],className:ll.formItem,children:e(al,{onSelect:Ce,generateMenuItems:()=>ye({targetForm:z,onTreeSelect:Ce,onComplete:Se,actionButtonText:J("Copy here")}),fetchChildFolders:Y,disabledFolders:Ae,mode:"selection",className:"folderSelectionTree",defaultExpandAll:!0})}),e(I.Item,{name:"folderName",style:{display:"none"},rules:[{required:!0,validator:(e,t)=>"string"==typeof t&&0===t.trim().length?Promise.reject(new Error(J("Enter the name of the folder"))):Promise.resolve()}],children:e(T,{})}),e(I.Item,{name:"is_force_create",style:{display:"none"},children:e(T,{})})]})})]})}),e(q,{title:t("div",{className:"modal-title",children:[J("Rename folder")," ",pe]}),open:F,onOk:O,onCancel:P,okText:J("Rename"),cancelText:J("Cancel"),okButtonProps:{loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},children:e(I,{form:R,layout:"vertical",children:e(I.Item,{name:"newFolderName",label:e("div",{className:"form-label",children:J("New folder name")}),rules:[{required:!0,message:J("Enter a new folder name")}],className:"form-item",children:e(T,{autoFocus:!0,className:"form-input",disabled:se,onPressEnter:async()=>{le(!0);try{await R.validateFields(),O()}catch(e){le(!1)}}})})})}),e(q,{className:`${ll.deleteModal} deleteModal`,title:(()=>{const t=!!(null==ne?void 0:ne.enableTrashFolder)&&"Trash"===u||!(null==ne?void 0:ne.enableTrashFolder),r=J(t?"Permanently delete":"Move to Trash");return e("div",{className:"modal-title",children:r})})(),open:!!B,onOk:()=>{le(!0);try{U&&U()}catch(e){console.error(e),le(!1)}},onCancel:()=>V&&V(),okText:(null==ne?void 0:ne.enableTrashFolder)&&"Trash"===u?J("Delete permanently"):(null==ne?void 0:ne.enableTrashFolder)?J("Move to Trash"):J("Delete"),cancelText:J("Cancel"),okButtonProps:{danger:!(null==ne?void 0:ne.enableTrashFolder)||"Trash"===u,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1),re&&re("")},closeIcon:e(me,{className:ll.closeIcon}),children:(()=>{var r,n;const i=(ie?[ie]:Array.from(E||[])).map(e=>de.find(t=>t.id===e)).filter(e=>!!e),o=i.filter(e=>e.isFolder||e.id.startsWith("folder_")),a=i.filter(e=>!(e.isFolder||e.id.startsWith("folder_"))),s=i.length,l=o.length,c=a.length,d=!!(null==ne?void 0:ne.enableTrashFolder);if(!d||d&&"Trash"===u){let n;if(1===s&&1===l){const e=o[0],t=(null==e?void 0:e.name)||"",i=null!==(r=null==e?void 0:e.childCount)&&void 0!==r?r:0;n=J("delete_folder_permanent",{name:t,count:i})}else n=0===l&&c>0?J("delete_files_permanent",{count:c}):J("delete_mixed_permanent",{total:s,folders:l,images:c});return t("div",{children:[e("div",{children:n}),e("p",{className:ll.permanentDeleteWarning,children:J("permanent_delete_warning")})]})}if(1===s&&1===l){const t=o[0],r=(null==t?void 0:t.name)||"",i=null!==(n=null==t?void 0:t.childCount)&&void 0!==n?n:0;return e("div",{children:J("move_folder_to_trash",{name:r,count:i})})}return e("div",0===l&&c>0?{children:J("move_files_to_trash",{count:c})}:{children:J("move_mixed_to_trash",{total:s,folders:l,images:c})})})()}),t(q,{className:`${ll.deleteModal} deleteModal`,title:e("div",{className:"modal-title",children:J("Clear Trash")}),open:!!H,onOk:async()=>{le(!0),W&&await W(),le(!1)},onCancel:()=>$&&$(),okText:J("Delete permanently"),cancelText:J("Cancel"),okButtonProps:{danger:!0,loading:se},cancelButtonProps:{disabled:se},afterClose:()=>{le(!1)},closeIcon:e(me,{className:ll.closeIcon}),children:[e("div",{children:J("Are you sure you want to permanently delete all items from Trash?")}),se&&t("div",{className:ll.clearTrashProgress,children:[e(G,{percent:99,status:"active",showInfo:!1}),e("div",{className:ll.progressText,children:J("Deleting items...")})]})]})]})};var fl={button:"button",folderActions:"folderActions",uploadButton:"uploadButton",foldersContainer:"foldersContainer",buttonWrapper:"buttonWrapper",uploadButtonTitle:"uploadButtonTitle"};const pl=f(p(({selectedFolder:r,generateMenuItems:n,onFolderSelect:i,folders:s,fetchChildFolders:l,handleAddFile:h,setIsUrlModalVisible:f,handleCreateFolder:p,activeLibraryItem:m,setActiveLibraryItem:v},y)=>{var b,w,x;const C=d(()=>Array.isArray(s)?s:[],[s]),{t:_}=Gn(),S=Fo(),[A,k]=o({}),{options:E,state:I}=fo(),{dataProviders:T,config:F}=E,O=I.pathHistory,P=!1!==(null===(b=null==F?void 0:F.features)||void 0===b?void 0:b.enableGif)&&(!(null==F?void 0:F.enabledTabs)||F.enabledTabs.includes("gif")),R=!1!==(null===(w=null==F?void 0:F.features)||void 0===w?void 0:w.enableStockImages)&&(!(null==F?void 0:F.enabledTabs)||F.enabledTabs.includes("stock")),L=!1!==(null===(x=null==F?void 0:F.features)||void 0===x?void 0:x.enableIconStock)&&(!(null==F?void 0:F.enabledTabs)||F.enabledTabs.includes("icons")),N=c(e=>{const t=[],r=e=>{e.forEach(e=>{t.push(e.key),e.children&&r(e.children)})};return r(e),t},[]),[j,D]=o(()=>{if(!0===(null==F?void 0:F.expandAllFoldersOnInit)&&"lazy"!==(null==F?void 0:F.folderTreeLoading)){const e=n();return N(e)}return!0===(null==F?void 0:F.expandRootFolderOnInit)?["folders"]:[]}),z=u(!1),B=u(!1);a(()=>{if(z.current)return;"lazy"===(null==F?void 0:F.folderTreeLoading)&&!0===(null==F?void 0:F.expandRootFolderOnInit)&&(z.current=!0,(async()=>{try{await(null==l?void 0:l(null))}catch(e){console.warn("Could not load the root child folders during initialization",e)}})())},[null==F?void 0:F.folderTreeLoading,null==F?void 0:F.expandRootFolderOnInit,l]),a(()=>{!0===(null==F?void 0:F.expandRootFolderOnInit)&&Array.isArray(C)&&C.length>0&&(B.current||j&&0!==j.length||(B.current=!0,D(["folders"])))},[null==F?void 0:F.expandRootFolderOnInit,C,j]),a(()=>{if(!0===(null==F?void 0:F.expandAllFoldersOnInit)&&"lazy"!==(null==F?void 0:F.folderTreeLoading)){const e=n(),t=N(e);return void D(t)}!0===(null==F?void 0:F.expandRootFolderOnInit)&&D(e=>e&&e.length>0?[...e]:["folders"])},[C,n,N,null==F?void 0:F.expandAllFoldersOnInit,null==F?void 0:F.folderTreeLoading,null==F?void 0:F.expandRootFolderOnInit]);const U=null==F?void 0:F.disablePagination,V=c(async e=>{var t,r,n,i;try{if(null==T?void 0:T.getChildrenCount)return await T.getChildrenCount("folders"===e?void 0:e);if(null==T?void 0:T.getFiles){const{files:r,pagination:n}=await T.getFiles({folderId:"folders"===e?void 0:e,itemType:"all",page:U?void 0:1,limit:U?void 0:1});return U?Array.isArray(r)?r.length:0:null!==(t=null==n?void 0:n.total)&&void 0!==t?t:Array.isArray(r)?r.length:0}return 0}catch(t){if("StaleLoad"===(null==t?void 0:t.name))return 0;const o=t;if(404===(null==o?void 0:o.status)||"FileNotFound"===(null==o?void 0:o.code)||"path_folder_not_found"===(null==o?void 0:o.code)||"path_folder_not_found"===(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.code)||404===(null===(i=null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.data)||void 0===i?void 0:i.status))return 0;console.error(`Error getting the number of files for the folder ${e}:`,t);const a=await Ua({folderId:e,dataProviders:T,folders:C,pathHistory:O,t:_});return S.error({id:"FOLDER_CHILDREN_COUNT_FAILED",message:_("Failed to load folder items count in folder",{folderName:a}),placement:"bottomRight",innerException:t,notificationDedupe:!0,data:{folderId:"folders"===e?null:e,folderName:a,reason:t instanceof Error?t.message:String(t)}}),null}},[T,U,S,O,C,_]),H=c(async()=>{if(0===C.length)return;const e={};e.folders=await V("folders");const t=C.map(async t=>{"number"!=typeof t.childCount?e[t.id]=await V(t.id):e[t.id]=t.childCount});await Promise.all(t),k(e)},[C,V]),W=c(async e=>{const t=await V(e);k(r=>Object.assign(Object.assign({},r),{[e]:t}))},[V]);g(y,()=>({refreshFileCounts:H}),[H]),a(()=>{H()},[H]),a(()=>{if(!r||"folders"===r)return;const e=(t,r=new Set)=>{if(r.has(t))return console.warn(`Cycle detected in the path to the folder with id=${t}`),[];const n=C.find(e=>e.id===t);if(!n)return[];if(!n.parentId)return[];const i=new Set(r);i.add(t);return[...e(n.parentId,i),n.parentId]},t=e(r);t.length>0?D(e=>{const r=new Set(e);return t.forEach(e=>r.add(e)),r.add("folders"),Array.from(r)}):D(e=>e.includes("folders")?e:[...e,"folders"])},[r,C]);const $=c(async()=>{await h(),r?await W(r):await W("folders")},[h,r,W]),q=[{key:Qt,label:_("My files"),icon:e(Ci,{size:20,strokeWidth:null==F?void 0:F.iconStrokeWidth})},{key:er,label:_("GIF"),icon:e(Ai,{size:20,strokeWidth:null==F?void 0:F.iconStrokeWidth}),disabled:!P},{key:tr,label:_("Stock images"),icon:e(fi,{size:20,strokeWidth:null==F?void 0:F.iconStrokeWidth}),disabled:!R},{key:rr,label:_("Icons"),icon:e(ve,{size:20}),disabled:!L},{key:nr,label:_("AI"),icon:e(Fi,{size:20,strokeWidth:null==F?void 0:F.iconStrokeWidth}),disabled:!(null==F?void 0:F.sseQuery)}].filter(e=>!e.disabled),G=c(async e=>{const t=e[0];t&&"empty"!==t&&(m!==Qt&&v(Qt),null==i||i(t),await(null==l?void 0:l(t)))},[i,m,v,l]),K=c(({key:e})=>{v(e)},[v]),Z=c(async(e,t)=>{var r;D(e);if(!("lazy"===(null==F?void 0:F.folderTreeLoading)))return;const n=(null===(r=null==t?void 0:t.node)||void 0===r?void 0:r.key)||void 0;if(n&&"folders"!==n)try{await(null==l?void 0:l(n))}catch(e){console.warn("Could not load the child folders for",n,e);const t=await Ua({folderId:n,dataProviders:T,folders:C,pathHistory:O,t:_});S.error({id:"FOLDER_CHILDREN_FETCH_FAILED",message:_("Failed to load subfolders in folder",{folderName:t}),placement:"bottomRight",innerException:e,notificationDedupe:!0,data:{folderId:n,folderName:t,reason:e instanceof Error?e.message:String(e)}})}},[null==F?void 0:F.folderTreeLoading,T,l,S,O,C,_]);return t("div",{className:"sidebar-container",children:[t("div",{className:fl.buttonWrapper,children:[e(M,{type:"primary",size:"large",icon:e(ki,{size:24,strokeWidth:null==F?void 0:F.iconStrokeWidth}),onClick:$,className:fl.uploadButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===r,children:e("span",{className:fl.uploadButtonTitle,children:_("Upload file")})}),e(M,{type:"primary",size:"large",icon:e(_i,{size:24,strokeWidth:null==F?void 0:F.iconStrokeWidth}),onClick:()=>null==f?void 0:f(!0),className:fl.uploadByURLButton,style:{whiteSpace:"nowrap"},disabled:"Trash"===r})]}),e(Y,{className:"folder-menu",items:q,defaultSelectedKeys:[Qt],onSelect:({key:e})=>K({key:e}),selectedKeys:[m]}),e(X,{className:fl.divider}),t("div",{className:fl.foldersContainer,children:[e(al,{selectedFolder:r,onSelect:G,onExpand:Z,generateMenuItems:n,fetchChildFolders:l,showFileCounts:!0,folderFileCounts:A,expandedKeys:j,setExpandedKeys:D,showTrashFolder:null==F?void 0:F.enableTrashFolder}),e("div",{className:fl.folderActions,children:e(M,{onClick:e=>{e.stopPropagation(),p()},className:fl.button,icon:e(bi,{size:18,strokeWidth:null==F?void 0:F.iconStrokeWidth}),size:"middle"})})]})]})}));pl.displayName="FolderSidebar";var gl=Object.defineProperty,ml=(e,t,r)=>(((e,t,r)=>{t in e?gl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);function vl(e,t){return void 0===t&&(t=15),+parseFloat(Number(e).toPrecision(t))}function yl(e){var t=e.toString().split(/[eE]/),r=(t[0].split(".")[1]||"").length-+(t[1]||0);return r>0?r:0}function bl(e){if(-1===e.toString().indexOf("e"))return Number(e.toString().replace(".",""));var t=yl(e);return t>0?vl(Number(e)*Math.pow(10,t)):Number(e)}function wl(e){kl&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&console.warn(e+" is beyond boundary when transfer to integer, the results may not be accurate")}function xl(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t[0];return t.slice(1).reduce(function(t,r){return e(t,r)},n)}}var Cl=xl(function(e,t){var r=bl(e),n=bl(t),i=yl(e)+yl(t),o=r*n;return wl(o),o/Math.pow(10,i)}),_l=xl(function(e,t){var r=Math.pow(10,Math.max(yl(e),yl(t)));return(Cl(e,r)+Cl(t,r))/r}),Sl=xl(function(e,t){var r=Math.pow(10,Math.max(yl(e),yl(t)));return(Cl(e,r)-Cl(t,r))/r}),Al=xl(function(e,t){var r=bl(e),n=bl(t);return wl(r),wl(n),Cl(r/n,vl(Math.pow(10,yl(t)-yl(e))))});var kl=!0;var El={strip:vl,plus:_l,minus:Sl,times:Cl,divide:Al,round:function(e,t){var r=Math.pow(10,t),n=Al(Math.round(Math.abs(Cl(e,r))),r);return e<0&&0!==n&&(n=Cl(n,-1)),n},digitLength:yl,float2Fixed:bl,enableBoundaryChecking:function(e){void 0===e&&(e=!0),kl=e}};const Il=Object.prototype.toString;function Tl(e){switch(Il.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return zl(e,Error)}}function Fl(e,t){return Il.call(e)===`[object ${t}]`}function Ol(e){return Fl(e,"ErrorEvent")}function Pl(e){return Fl(e,"DOMError")}function Ml(e){return Fl(e,"String")}function Rl(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Ll(e){return null===e||Rl(e)||"object"!=typeof e&&"function"!=typeof e}function Nl(e){return Fl(e,"Object")}function jl(e){return typeof Event<"u"&&zl(e,Event)}function Dl(e){return!(!e||!e.then||"function"!=typeof e.then)}function zl(e,t){try{return e instanceof t}catch{return!1}}function Bl(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function Ul(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function Vl(e,t){if(!Array.isArray(e))return"";const r=[];for(let t=0;t<e.length;t++){const n=e[t];try{Bl(n)?r.push("[VueViewModel]"):r.push(String(n))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function Hl(e,t,r=!1){return!!Ml(e)&&(function(e){return Fl(e,"RegExp")}(t)?t.test(e):!!Ml(t)&&(r?e===t:e.includes(t)))}function Wl(e,t=[],r=!1){return t.some(t=>Hl(e,t,r))}function $l(e,t,r=250,n,i,o,a){if(!(o.exception&&o.exception.values&&a&&zl(a.originalException,Error)))return;const s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=function(e,t){return e.map(e=>(e.value&&(e.value=Ul(e.value,t)),e))}(ql(e,t,i,a.originalException,n,o.exception.values,s,0),r))}function ql(e,t,r,n,i,o,a,s){if(o.length>=r+1)return o;let l=[...o];if(zl(n[i],Error)){Gl(a,s);const o=e(t,n[i]),c=l.length;Yl(o,i,c,s),l=ql(e,t,r,n[i],i,[o,...l],o,c)}return Array.isArray(n.errors)&&n.errors.forEach((n,o)=>{if(zl(n,Error)){Gl(a,s);const c=e(t,n),u=l.length;Yl(c,`errors[${o}]`,u,s),l=ql(e,t,r,n,i,[c,...l],c,u)}}),l}function Gl(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function Yl(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}function Xl(e){return e&&e.Math==Math?e:void 0}const Kl="object"==typeof globalThis&&Xl(globalThis)||"object"==typeof window&&Xl(window)||"object"==typeof self&&Xl(self)||"object"==typeof global&&Xl(global)||function(){return this}()||{};function Zl(){return Kl}function Jl(e,t,r){const n=r||Kl,i=n.__SENTRY__=n.__SENTRY__||{};return i[e]||(i[e]=t())}const Ql=Zl();function ec(e,t={}){if(!e)return"<unknown>";try{let r=e;const n=5,i=[];let o=0,a=0;const s=" > ",l=s.length;let c;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;r&&o++<n&&(c=tc(r,u),!("html"===c||o>1&&a+i.length*l+c.length>=d));)i.push(c),a+=c.length,r=r.parentNode;return i.reverse().join(s)}catch{return"<unknown>"}}function tc(e,t){const r=e,n=[];let i,o,a,s,l;if(!r||!r.tagName)return"";if(Ql.HTMLElement&&r instanceof HTMLElement&&r.dataset&&r.dataset.sentryComponent)return r.dataset.sentryComponent;n.push(r.tagName.toLowerCase());const c=t&&t.length?t.filter(e=>r.getAttribute(e)).map(e=>[e,r.getAttribute(e)]):null;if(c&&c.length)c.forEach(e=>{n.push(`[${e[0]}="${e[1]}"]`)});else if(r.id&&n.push(`#${r.id}`),i=r.className,i&&Ml(i))for(o=i.split(/\s+/),l=0;l<o.length;l++)n.push(`.${o[l]}`);const u=["aria-label","type","name","title","alt"];for(l=0;l<u.length;l++)a=u[l],s=r.getAttribute(a),s&&n.push(`[${a}="${s}"]`);return n.join("")}const rc=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nc=["debug","info","warn","error","log","assert","trace"],ic={};function oc(e){if(!("console"in Kl))return e();const t=Kl.console,r={},n=Object.keys(ic);n.forEach(e=>{const n=ic[e];r[e]=t[e],t[e]=n});try{return e()}finally{n.forEach(e=>{t[e]=r[e]})}}const ac=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return rc?nc.forEach(r=>{t[r]=(...t)=>{e&&oc(()=>{Kl.console[r](`Sentry Logger [${r}]:`,...t)})}}):nc.forEach(e=>{t[e]=()=>{}}),t}(),sc=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function lc(e,t=!1){const{host:r,path:n,pass:i,port:o,projectId:a,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n&&`${n}/`}${a}`}function cc(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function uc(e){const t="string"==typeof e?function(e){const t=sc.exec(e);if(!t)return void oc(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});const[r,n,i="",o,a="",s]=t.slice(1);let l="",c=s;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const e=c.match(/^\d+/);e&&(c=e[0])}return cc({host:o,pass:i,path:l,projectId:c,port:a,protocol:r,publicKey:n})}(e):cc(e);if(t&&function(e){if(!rc)return!0;const{port:t,projectId:r,protocol:n}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(ac.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(r.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(n)?t&&isNaN(parseInt(t,10))&&(ac.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(ac.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),1):(ac.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),1)))}(t))return t}class dc extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}}function hc(e,t,r){if(!(t in e))return;const n=e[t],i=r(n);"function"==typeof i&&pc(i,n),e[t]=i}function fc(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{rc&&ac.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function pc(e,t){try{const r=t.prototype||{};e.prototype=t.prototype=r,fc(e,"__sentry_original__",t)}catch{}}function gc(e){return e.__sentry_original__}function mc(e){if(Tl(e))return{message:e.message,name:e.name,stack:e.stack,...yc(e)};if(jl(e)){const t={type:e.type,target:vc(e.target),currentTarget:vc(e.currentTarget),...yc(e)};return typeof CustomEvent<"u"&&zl(e,CustomEvent)&&(t.detail=e.detail),t}return e}function vc(e){try{return function(e){return typeof Element<"u"&&zl(e,Element)}(e)?ec(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function yc(e){if("object"==typeof e&&null!==e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}return{}}function bc(e){return wc(e,new Map)}function wc(e,t){if(function(e){if(!Nl(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch{return!0}}(e)){const r=t.get(e);if(void 0!==r)return r;const n={};t.set(e,n);for(const r of Object.keys(e))typeof e[r]<"u"&&(n[r]=wc(e[r],t));return n}if(Array.isArray(e)){const r=t.get(e);if(void 0!==r)return r;const n=[];return t.set(e,n),e.forEach(e=>{n.push(wc(e,t))}),n}return e}const xc=/\(error: (.*)\)/,Cc=/captureMessage|captureException/;function _c(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,r=0)=>{const n=[],i=e.split("\n");for(let e=r;e<i.length;e++){const r=i[e];if(r.length>1024)continue;const o=xc.test(r)?r.replace(xc,"$1"):r;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){n.push(t);break}}if(n.length>=50)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),Cc.test(t[t.length-1].function||"")&&(t.pop(),Cc.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||t[t.length-1].filename,function:e.function||"?"}))}(n)}}function Sc(e){return Array.isArray(e)?_c(...e):e}const Ac="<anonymous>";function kc(e){try{return e&&"function"==typeof e&&e.name||Ac}catch{return Ac}}const Ec={},Ic={};function Tc(e,t){Ec[e]=Ec[e]||[],Ec[e].push(t)}function Fc(e,t){Ic[e]||(t(),Ic[e]=!0)}function Oc(e,t){const r=e&&Ec[e];if(r)for(const n of r)try{n(t)}catch(t){rc&&ac.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${kc(n)}\nError:`,t)}}function Pc(){"console"in Kl&&nc.forEach(function(e){e in Kl.console&&hc(Kl.console,e,function(t){return ic[e]=t,function(...t){Oc("console",{args:t,level:e});const r=ic[e];r&&r.apply(Kl.console,t)}})})}function Mc(){const e=Kl,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,e=>(e^(15&r())>>e/4).toString(16))}function Rc(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function Lc(e){const{message:t,event_id:r}=e;if(t)return t;const n=Rc(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function Nc(e,t,r){const n=e.exception=e.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function jc(e,t){const r=Rc(e);if(!r)return;const n=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...n,...t},t&&"data"in t){const e={...n&&n.data,...t.data};r.mechanism.data=e}}function Dc(e){if(e&&e.__sentry_captured__)return!0;try{fc(e,"__sentry_captured__",!0)}catch{}return!1}function zc(e){return Array.isArray(e)?e:[e]}const Bc=Kl;let Uc,Vc,Hc;function Wc(){if(!Bc.document)return;const e=Oc.bind(null,"dom"),t=$c(e,!0);Bc.document.addEventListener("click",t,!1),Bc.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const r=Bc[t]&&Bc[t].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(hc(r,"addEventListener",function(t){return function(r,n,i){if("click"===r||"keypress"==r)try{const n=this,o=n.__sentry_instrumentation_handlers__=n.__sentry_instrumentation_handlers__||{},a=o[r]=o[r]||{refCount:0};if(!a.handler){const n=$c(e);a.handler=n,t.call(this,r,n,i)}a.refCount++}catch{}return t.call(this,r,n,i)}}),hc(r,"removeEventListener",function(e){return function(t,r,n){if("click"===t||"keypress"==t)try{const r=this,i=r.__sentry_instrumentation_handlers__||{},o=i[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,n),o.handler=void 0,delete i[t]),0===Object.keys(i).length&&delete r.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,r,n)}}))})}function $c(e,t=!1){return r=>{if(!r||r._sentryCaptured)return;const n=function(e){try{return e.target}catch{return null}}(r);if(function(e,t){return!("keypress"!==e||t&&t.tagName&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable))}(r.type,n))return;fc(r,"_sentryCaptured",!0),n&&!n._sentryId&&fc(n,"_sentryId",Mc());const i="keypress"===r.type?"input":r.type;(function(e){if(e.type!==Vc)return!1;try{if(!e.target||e.target._sentryId!==Hc)return!1}catch{}return!0})(r)||(e({event:r,name:i,global:t}),Vc=r.type,Hc=n?n._sentryId:void 0),clearTimeout(Uc),Uc=Bc.setTimeout(()=>{Hc=void 0,Vc=void 0},1e3)}}const qc=Zl();function Gc(){if(!("fetch"in qc))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function Yc(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Xc(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!Gc())return!1;if(Yc(qc.fetch))return!0;let e=!1;const t=qc.document;if(t&&"function"==typeof t.createElement)try{const r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=Yc(r.contentWindow.fetch)),t.head.removeChild(r)}catch(e){rc&&ac.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e})()&&hc(Kl,"fetch",function(e){return function(...t){const{method:r,url:n}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,r]=e;return{url:Zc(t),method:Kc(r,"method")?String(r.method).toUpperCase():"GET"}}const t=e[0];return{url:Zc(t),method:Kc(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:r,url:n},startTimestamp:Date.now()};return Oc("fetch",{...i}),e.apply(Kl,t).then(e=>(Oc("fetch",{...i,endTimestamp:Date.now(),response:e}),e),e=>{throw Oc("fetch",{...i,endTimestamp:Date.now(),error:e}),e})}})}function Kc(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Zc(e){return"string"==typeof e?e:e?Kc(e,"url")?e.url:e.toString?e.toString():"":""}let Jc=null;function Qc(){Jc=Kl.onerror,Kl.onerror=function(e,t,r,n,i){return Oc("error",{column:n,error:i,line:r,msg:e,url:t}),!(!Jc||Jc.__SENTRY_LOADER__)&&Jc.apply(this,arguments)},Kl.onerror.__SENTRY_INSTRUMENTED__=!0}let eu=null;function tu(){eu=Kl.onunhandledrejection,Kl.onunhandledrejection=function(e){return Oc("unhandledrejection",e),!(eu&&!eu.__SENTRY_LOADER__)||eu.apply(this,arguments)},Kl.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const ru=Zl();const nu=Kl;let iu;function ou(e){const t="history";Tc(t,e),Fc(t,au)}function au(){if(!function(){const e=ru.chrome,t=e&&e.app&&e.app.runtime,r="history"in ru&&!!ru.history.pushState&&!!ru.history.replaceState;return!t&&r}())return;const e=nu.onpopstate;function t(e){return function(...t){const r=t.length>2?t[2]:void 0;if(r){const e=iu,t=String(r);iu=t,Oc("history",{from:e,to:t})}return e.apply(this,t)}}nu.onpopstate=function(...t){const r=nu.location.href,n=iu;if(iu=r,Oc("history",{from:n,to:r}),e)try{return e.apply(this,t)}catch{}},hc(nu.history,"pushState",t),hc(nu.history,"replaceState",t)}const su=Kl,lu="__sentry_xhr_v3__";function cu(){if(!su.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;hc(e,"open",function(e){return function(...t){const r=Date.now(),n=Ml(t[0])?t[0].toUpperCase():void 0,i=function(e){if(Ml(e))return e;try{return e.toString()}catch{}}(t[1]);if(!n||!i)return e.apply(this,t);this[lu]={method:n,url:i,request_headers:{}},"POST"===n&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const e=this[lu];if(e&&4===this.readyState){try{e.status_code=this.status}catch{}Oc("xhr",{args:[n,i],endTimestamp:Date.now(),startTimestamp:r,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?hc(this,"onreadystatechange",function(e){return function(...t){return o(),e.apply(this,t)}}):this.addEventListener("readystatechange",o),hc(this,"setRequestHeader",function(e){return function(...t){const[r,n]=t,i=this[lu];return i&&Ml(r)&&Ml(n)&&(i.request_headers[r.toLowerCase()]=n),e.apply(this,t)}}),e.apply(this,t)}}),hc(e,"send",function(e){return function(...t){const r=this[lu];if(!r)return e.apply(this,t);void 0!==t[0]&&(r.body=t[0]);return Oc("xhr",{args:[r.method,r.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}})}function uu(e,t=100,r=1/0){try{return hu("",e,t,r)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function du(e,t=3,r=102400){const n=uu(e,t);return function(e){return function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(e))}(n)>r?du(e,t-1,r):n}function hu(e,t,r=1/0,n=1/0,i=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(r){if(e)return!!t.has(r)||(t.add(r),!1);for(let e=0;e<t.length;e++)if(t[e]===r)return!0;return t.push(r),!1},function(r){if(e)t.delete(r);else for(let e=0;e<t.length;e++)if(t[e]===r){t.splice(e,1);break}}]}()){const[o,a]=i;if(null==t||["number","boolean","string"].includes(typeof t)&&!function(e){return"number"==typeof e&&e!=e}(t))return t;const s=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(Bl(t))return"[VueViewModel]";if(function(e){return Nl(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}(t))return"[SyntheticEvent]";if("number"==typeof t&&t!=t)return"[NaN]";if("function"==typeof t)return`[Function: ${kc(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}}(e,t);if(!s.startsWith("[object "))return s;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:r;if(0===l)return s.replace("object ","");if(o(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return hu("",c.toJSON(),l-1,n,i)}catch{}const u=Array.isArray(t)?[]:{};let d=0;const h=mc(t);for(const e in h){if(!Object.prototype.hasOwnProperty.call(h,e))continue;if(d>=n){u[e]="[MaxProperties ~]";break}const t=h[e];u[e]=hu(e,t,l-1,n,i),d++}return a(t),u}var fu;function pu(e){return new mu(t=>{t(e)})}function gu(e){return new mu((t,r)=>{r(e)})}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(fu||(fu={}));class mu{constructor(e){mu.prototype.__init.call(this),mu.prototype.__init2.call(this),mu.prototype.__init3.call(this),mu.prototype.__init4.call(this),this._state=fu.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new mu((r,n)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){n(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){n(e)}else n(e)}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(e){return new mu((t,r)=>{let n,i;return this.then(t=>{i=!1,n=t,e&&e()},t=>{i=!0,n=t,e&&e()}).then(()=>{i?r(n):t(n)})})}__init(){this._resolve=e=>{this._setResult(fu.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(fu.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===fu.PENDING){if(Dl(t))return void t.then(this._resolve,this._reject);this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===fu.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(this._state===fu.RESOLVED&&e[1](this._value),this._state===fu.REJECTED&&e[2](this._value),e[0]=!0)})}}}function vu(e){const t=[];function r(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(n){if(!(void 0===e||t.length<e))return gu(new dc("Not adding Promise because buffer limit was reached."));const i=n();return-1===t.indexOf(i)&&t.push(i),i.then(()=>r(i)).then(null,()=>r(i).then(null,()=>{})),i},drain:function(e){return new mu((r,n)=>{let i=t.length;if(!i)return r(!0);const o=setTimeout(()=>{e&&e>0&&r(!1)},e);t.forEach(e=>{pu(e).then(()=>{--i||(clearTimeout(o),r(!0))},n)})})}}}function yu(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}const bu=["fatal","error","warning","log","info","debug"];function wu(e){return"warn"===e?"warning":bu.includes(e)?e:"log"}function xu(){return Date.now()/1e3}const Cu=function(){const{performance:e}=Kl;if(!e||!e.now)return xu;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/1e3}();function _u(e,t=[]){return[e,t]}function Su(e,t){const[r,n]=e;return[r,[...n,t]]}function Au(e,t){const r=e[1];for(const e of r){if(t(e,e[0].type))return!0}return!1}function ku(e,t){return(t||new TextEncoder).encode(e)}function Eu(e,t){const[r,n]=e;let i=JSON.stringify(r);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[ku(i,t),e]:i.push("string"==typeof e?ku(e,t):e)}for(const e of n){const[t,r]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof r||r instanceof Uint8Array)o(r);else{let e;try{e=JSON.stringify(r)}catch{e=JSON.stringify(uu(r))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(i)}function Iu(e,t){const r="string"==typeof e.data?ku(e.data,t):e.data;return[bc({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}(()=>{const{performance:e}=Kl;if(!e||!e.now)return;const t=36e5,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+r-n):t;(o||s<t)&&(i<=s&&e.timeOrigin)})();const Tu={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Fu(e){return Tu[e]}function Ou(e){if(!e||!e.sdk)return;const{name:t,version:r}=e.sdk;return{name:t,version:r}}function Pu(e,{statusCode:t,headers:r},n=Date.now()){const i={...e},o=r&&r["x-sentry-rate-limits"],a=r&&r["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,r,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(r)for(const e of r.split(";"))"metric_bucket"===e?(!o||o.split(";").includes("custom"))&&(i[e]=n+s):i[e]=n+s;else i.all=n+s}else a?i.all=n+function(e,t=Date.now()){const r=parseInt(`${e}`,10);if(!isNaN(r))return 1e3*r;const n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}(a,n):429===t&&(i.all=n+6e4);return i}const Mu=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,Ru="production";function Lu(){return Jl("globalEventProcessors",()=>[])}function Nu(e){Lu().push(e)}function ju(e,t,r,n=0){return new mu((i,o)=>{const a=e[n];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},r);Mu&&a.id&&null===s&&ac.log(`Event processor "${a.id}" dropped event`),Dl(s)?s.then(t=>ju(e,t,r,n+1).then(i)).then(null,o):ju(e,s,r,n+1).then(i).then(null,o)}})}function Du(e){const t=Cu(),r={sid:Mc(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return bc({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(r)};return e&&zu(r,e),r}function zu(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Cu(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Mc()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Bu(e,t){let r={};"ok"===e.status&&(r={status:"exited"}),zu(e,r)}function Uu(e){const{spanId:t,traceId:r}=e.spanContext(),{data:n,op:i,parent_span_id:o,status:a,tags:s,origin:l}=Vu(e);return bc({data:n,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:r,origin:l})}function Vu(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function Hu(e,t,r,n,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||r.event_id||Mc(),timestamp:t.timestamp||xu()},c=r.integrations||e.integrations.map(e=>e.name);(function(e,t){const{environment:r,release:n,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?r:Ru),void 0===e.release&&void 0!==n&&(e.release=n),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=Ul(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=Ul(a.value,o));const s=e.request;s&&s.url&&(s.url=Ul(s.url,o))})(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,c),void 0===t.type&&function(e,t){const r=Kl._sentryDebugIds;if(!r)return;let n;const i=Wu.get(t);i?n=i:(n=new Map,Wu.set(t,n));const o=Object.keys(r).reduce((e,i)=>{let o;const a=n.get(i);a?o=a:(o=t(i),n.set(i,o));for(let t=o.length-1;t>=0;t--){const n=o[t];if(n.filename){e[n.filename]=r[i];break}}return e},{});try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.filename&&(e.debug_id=o[e.filename])})})}catch{}}(l,e.stackParser);const u=function(e,t){if(!t)return e;const r=e?e.clone():new ad;return r.update(t),r}(n,r.captureContext);r.mechanism&&jc(l,r.mechanism);const d=i&&i.getEventProcessors?i.getEventProcessors():[],h=(od||(od=new ad),od).getScopeData();if(o){nd(h,o.getScopeData())}if(u){nd(h,u.getScopeData())}const f=[...r.attachments||[],...h.attachments];f.length&&(r.attachments=f),rd(l,h);return ju([...d,...Lu(),...h.eventProcessors],l,r).then(e=>(e&&function(e){const t={};try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})})}catch{}if(0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const r=e.debug_meta.images;Object.keys(t).forEach(e=>{r.push({type:"sourcemap",code_file:e,debug_id:t[e]})})}(e),"number"==typeof a&&a>0?function(e,t,r){if(!e)return null;const n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:uu(e.data,t,r)}}))},...e.user&&{user:uu(e.user,t,r)},...e.contexts&&{contexts:uu(e.contexts,t,r)},...e.extra&&{extra:uu(e.extra,t,r)}};return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=uu(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(e=>{const n=Vu(e).data;return n&&(e.data=uu(n,t,r)),e})),n}(e,a,s):e))}const Wu=new WeakMap;function $u(e,t){return pd().captureEvent(e,t)}function qu(e,t){pd().addBreadcrumb(e,t)}function Gu(){return pd().getClient()}function Yu(){return pd().getScope()}function Xu(e){const t=Gu(),r=gd(),n=Yu(),{release:i,environment:o=Ru}=t&&t.getOptions()||{},{userAgent:a}=Kl.navigator||{},s=Du({release:i,environment:o,user:n.getUser()||r.getUser(),...a&&{userAgent:a},...e}),l=r.getSession();return l&&"ok"===l.status&&zu(l,{status:"exited"}),Ku(),r.setSession(s),n.setSession(s),s}function Ku(){const e=gd(),t=Yu(),r=t.getSession()||e.getSession();r&&Bu(r),Zu(),e.setSession(),t.setSession()}function Zu(){const e=gd(),t=Yu(),r=Gu(),n=t.getSession()||e.getSession();n&&r&&r.captureSession&&r.captureSession(n)}function Ju(e=!1){e?Ku():Zu()}function Qu(e){return e.transaction}function ed(e,t,r){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=r&&r.getUser()||{},a=bc({environment:n.environment||Ru,release:n.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function td(e){const t=Gu();if(!t)return{};const r=ed(Vu(e).trace_id||"",t,Yu()),n=Qu(e);if(!n)return r;const i=n&&n._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=n.metadata;null!=o&&(r.sample_rate=`${o}`);const s=Vu(n);return a&&"url"!==a&&(r.transaction=s.description),r.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return!!(1&t)}(n)),t.emit&&t.emit("createDsc",r),r}function rd(e,t){const{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=t;(function(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,transactionName:s}=t,l=bc(r);l&&Object.keys(l).length&&(e.extra={...l,...e.extra});const c=bc(n);c&&Object.keys(c).length&&(e.tags={...c,...e.tags});const u=bc(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=bc(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)})(e,t),n&&function(e,t){e.contexts={trace:Uu(t),...e.contexts};const r=Qu(t);if(r){e.sdkProcessingMetadata={dynamicSamplingContext:td(t),...e.sdkProcessingMetadata};const n=Vu(r).description;n&&(e.tags={transaction:n,...e.tags})}}(e,n),function(e,t){e.fingerprint=e.fingerprint?zc(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,r),function(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function nd(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:l,fingerprint:c,eventProcessors:u,attachments:d,propagationContext:h,transactionName:f,span:p}=t;id(e,"extra",r),id(e,"tags",n),id(e,"user",i),id(e,"contexts",o),id(e,"sdkProcessingMetadata",s),a&&(e.level=a),f&&(e.transactionName=f),p&&(e.span=p),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function id(e,t,r){if(r&&Object.keys(r).length){e[t]={...e[t]};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[t][n]=r[n])}}let od;class ad{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=sd()}static clone(e){return e?e.clone():new ad}clone(){const e=new ad;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&zu(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e;if(t instanceof ad){const e=t.getScopeData();this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(Nl(t)){const t=e;this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=sd(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:100;if(r<=0)return this;const n={timestamp:xu(),...e},i=this._breadcrumbs;return i.push(n),this._breadcrumbs=i.length>r?i.slice(-r):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:r,_tags:n,_extra:i,_user:o,_level:a,_fingerprint:s,_eventProcessors:l,_propagationContext:c,_sdkProcessingMetadata:u,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:r,tags:n,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:l,propagationContext:c,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},r=[]){rd(e,this.getScopeData());return ju([...r,...Lu(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t&&t.event_id?t.event_id:Mc();if(!this._client)return ac.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:Mc();if(!this._client)return ac.warn("No client configured on scope - will not capture message!"),n;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:Mc();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(ac.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function sd(){return{traceId:Mc(),spanId:Mc().substring(16)}}const ld="7.116.0",cd=parseFloat(ld),ud=100;class dd{constructor(e,t,r,n=cd){let i,o;this._version=n,t?i=t:(i=new ad,i.setClient(e)),r?o=r:(o=new ad,o.setClient(e)),this._stack=[{scope:i}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){const t=this.pushScope();let r;try{r=e(t)}catch(e){throw this.popScope(),e}return Dl(r)?r.then(e=>(this.popScope(),e),e=>{throw this.popScope(),e}):(this.popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const r=this._lastEventId=t&&t.event_id?t.event_id:Mc(),n=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:n,...t,event_id:r}),r}captureMessage(e,t,r){const n=this._lastEventId=r&&r.event_id?r.event_id:Mc(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n}),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:Mc();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...t,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:r,client:n}=this.getStackTop();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=ud}=n.getOptions&&n.getOptions()||{};if(o<=0)return;const a={timestamp:xu(),...e},s=i?oc(()=>i(a,t)):a;null!==s&&(n.emit&&n.emit("beforeAddBreadcrumb",s,t),r.addBreadcrumb(s,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:r}=this.getStackTop();r&&e(t)}run(e){const t=fd(this);try{e(this)}finally{fd(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return Mu&&ac.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const r=this._callExtensionMethod("startTransaction",e,t);return Mu&&!r&&(this.getClient()?ac.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):ac.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&Bu(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i=Ru}=r&&r.getOptions()||{},{userAgent:o}=Kl.navigator||{},a=Du({release:n,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&zu(s,{status:"exited"}),this.endSession(),t.setSession(a),a}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return!(!t||!t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}_callExtensionMethod(e,...t){const r=hd().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);Mu&&ac.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function hd(){return Kl.__SENTRY__=Kl.__SENTRY__||{extensions:{},hub:void 0},Kl}function fd(e){const t=hd(),r=md(t);return vd(t,e),r}function pd(){const e=hd();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=hd()){return(!function(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}(e)||md(e).isOlderThan(cd))&&vd(e,new dd),md(e)}(e)}function gd(){return pd().getIsolationScope()}function md(e){return Jl("hub",()=>new dd,e)}function vd(e,t){if(!e)return!1;return(e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0}function yd(e,t,r,n){const i=Ou(r),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,r&&r.sdk);const a=function(e,t,r,n){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:lc(n)},...i&&{trace:bc({...i})}}}(e,i,n,t);return delete e.sdkProcessingMetadata,_u(a,[[{type:o},e]])}function bd(e,t){return function(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}({sentry_key:e.publicKey,sentry_version:"7",...t&&{sentry_client:`${t.name}/${t.version}`}})}const wd=[];function xd(e){const t=e.defaultIntegrations||[],r=e.integrations;let n;t.forEach(e=>{e.isDefaultInstance=!0}),n=Array.isArray(r)?[...t,...r]:"function"==typeof r?zc(r(t)):t;const i=function(e){const t={};return e.forEach(e=>{const{name:r}=e,n=t[r];n&&!n.isDefaultInstance&&e.isDefaultInstance||(t[r]=e)}),Object.keys(t).map(e=>t[e])}(n),o=function(e,t){for(let r=0;r<e.length;r++)if(!0===t(e[r]))return r;return-1}(i,e=>"Debug"===e.name);if(-1!==o){const[e]=i.splice(o,1);i.push(e)}return i}function Cd(e,t){for(const r of t)r&&r.afterAllSetup&&r.afterAllSetup(e)}function _d(e,t,r){if(r[t.name])Mu&&ac.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,-1===wd.indexOf(t.name)&&(t.setupOnce(Nu,pd),wd.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,n)=>r(t,n,e))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const r=t.processEvent.bind(t),n=Object.assign((t,n)=>r(t,n,e),{id:t.name});e.addEventProcessor(n)}Mu&&ac.log(`Integration installed: ${t.name}`)}}function Sd(e,t){return Object.assign(function(...e){return t(...e)},{id:e})}function Ad(e,t,r,n){const i={sent_at:(new Date).toISOString()};r&&r.sdk&&(i.sdk={name:r.sdk.name,version:r.sdk.version}),n&&t&&(i.dsn=lc(t));const o=function(e){const t=function(e){let t="";for(const r of e){const e=Object.entries(r.tags),n=e.length>0?`|#${e.map(([e,t])=>`${e}:${t}`).join(",")}`:"";t+=`${r.name}@${r.unit}:${r.metric}|${r.metricType}${n}|T${r.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return _u(i,[o])}const kd="Not capturing exception because it's already been captured.";class Ed{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=uc(e.dsn):Mu&&ac.warn("No DSN provided, client will not send events."),this._dsn){const t=function(e,t={}){const r="string"==typeof t?t:t.tunnel,n="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return r||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${bd(e,n)}`}(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,r){if(Dc(e))return void(Mu&&ac.log(kd));let n=t&&t.event_id;return this._process(this.eventFromException(e,t).then(e=>this._captureEvent(e,t,r)).then(e=>{n=e})),n}captureMessage(e,t,r,n){let i=r&&r.event_id;const o=Rl(e)?e:String(e),a=Ll(e)?this.eventFromMessage(o,t,r):this.eventFromException(e,r);return this._process(a.then(e=>this._captureEvent(e,r,n)).then(e=>{i=e})),i}captureEvent(e,t,r){if(t&&t.originalException&&Dc(t.originalException))return void(Mu&&ac.log(kd));let n=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||r).then(e=>{n=e})),n}captureSession(e){"string"!=typeof e.release?Mu&&ac.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),zu(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then(r=>t.flush(e).then(e=>r&&e))):pu(!0)}close(e){return this.flush(e).then(e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch{return Mu&&ac.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];_d(this,e,this._integrations),t||Cd(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=yd(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])r=Su(r,Iu(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const n=this._sendEnvelope(r);n&&n.then(t=>this.emit("afterSendEvent",e,t),null)}sendSession(e){const t=function(e,t,r,n){const i=Ou(r);return _u({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!n&&t&&{dsn:lc(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,r){if(this._options.sendClientReports){const r=`${e}:${t}`;Mu&&ac.log(`Adding outcome: "${r}"`),this._outcomes[r]=this._outcomes[r]+1||1}}captureAggregateMetrics(e){Mu&&ac.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=Ad(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach(e=>e(...t))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const r={};return t.forEach(t=>{t&&_d(e,t,r)}),r}(this,e),Cd(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let r=!1,n=!1;const i=t.exception&&t.exception.values;if(i){n=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){r=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&r)&&(zu(e,{...r&&{status:"crashed"},errors:e.errors||Number(n||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new mu(t=>{let r=0;const n=setInterval(()=>{0==this._numProcessing?(clearInterval(n),t(!0)):(r+=1,e&&r>=e&&(clearInterval(n),t(!1)))},1)})}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,r,n=gd()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),Hu(i,e,t,r,this,n).then(e=>{if(null===e)return e;const t={...n.getPropagationContext(),...r?r.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:n,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:n,span_id:i,parent_span_id:o},...e.contexts};const s=a||ed(n,this,r);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e})}_captureEvent(e,t={},r){return this._processEvent(e,t,r).then(e=>e.event_id,e=>{if(Mu){const t=e;"log"===t.logLevel?ac.log(t.message):ac.warn(t)}})}_processEvent(e,t,r){const n=this.getOptions(),{sampleRate:i}=n,o=Td(e),a=Id(e),s=e.type||"error",l=`before send for type \`${s}\``;if(a&&"number"==typeof i&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",e),gu(new dc(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const c="replay_event"===s?"replay":s,u=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,r,u).then(r=>{if(null===r)throw this.recordDroppedEvent("event_processor",c,e),new dc("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return r;const i=function(e,t,r){const{beforeSend:n,beforeSendTransaction:i}=e;return Id(t)&&n?n(t,r):Td(t)&&i?i(t,r):t}(n,r,t);return function(e,t){const r=`${t} must return \`null\` or a valid event.`;if(Dl(e))return e.then(e=>{if(!Nl(e)&&null!==e)throw new dc(r);return e},e=>{throw new dc(`${t} rejected with ${e}`)});if(!Nl(e)&&null!==e)throw new dc(r);return e}(i,l)}).then(n=>{if(null===n)throw this.recordDroppedEvent("before_send",c,e),new dc(`${l} returned \`null\`, will not send event.`,"log");const i=r&&r.getSession();!o&&i&&this._updateSessionFromEvent(i,n);const a=n.transaction_info;if(o&&a&&n.transaction!==e.transaction){const e="custom";n.transaction_info={...a,source:e}}return this.sendEvent(n,t),n}).then(null,e=>{throw e instanceof dc?e:(this.captureException(e,{data:{__sentry__:!0},originalException:e}),new dc(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`))})}_process(e){this._numProcessing++,e.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,e=>{Mu&&ac.error("Error while sending event:",e)});Mu&&ac.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map(t=>{const[r,n]=t.split(":");return{reason:r,category:n,quantity:e[t]}})}}function Id(e){return void 0===e.type}function Td(e){return"transaction"===e.type}function Fd(e,t){!0===t.debug&&(Mu?ac.enable():oc(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Yu().update(t.initialScope);const r=new e(t);(function(e){const t=pd().getStackTop();t.client=e,t.scope.setClient(e)})(r),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(r)}function Od(e,t,r=vu(e.bufferSize||30)){let n={};function i(i){const o=[];if(Au(i,(t,r)=>{const i=Fu(r);if(function(e,t,r=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>r}(n,i)){const n=Pd(t,r);e.recordDroppedEvent("ratelimit_backoff",i,n)}else o.push(t)}),0===o.length)return pu();const a=_u(i[0],o),s=t=>{Au(a,(r,n)=>{const i=Pd(r,n);e.recordDroppedEvent(t,Fu(n),i)})};return r.add(()=>t({body:Eu(a,e.textEncoder)}).then(e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Mu&&ac.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),n=Pu(n,e),e),e=>{throw s("network_error"),e})).then(e=>e,e=>{if(e instanceof dc)return Mu&&ac.error("Skipped sending event because buffer is full."),s("queue_overflow"),pu();throw e})}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>r.drain(e)}}function Pd(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}function Md(e,t,r=[t],n="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:r.map(e=>({name:`${n}:@sentry/${e}`,version:ld})),version:ld}),e._metadata=i}const Rd=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],Ld=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],Nd="InboundFilters",jd=(e={})=>({name:Nd,setupOnce(){},processEvent(t,r,n){const i=n.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Rd],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:Ld],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,i);return function(e,t){return t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch{}return!1}(e)?(Mu&&ac.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Lc(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let r;e.message&&t.push(e.message);try{r=e.exception.values[e.exception.values.length-1]}catch{}return r&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`)),Mu&&0===t.length&&ac.error(`Could not extract message for event ${Lc(e)}`),t}(e).some(e=>Wl(e,t))}(e,t.ignoreErrors)?(Mu&&ac.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Lc(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const r=e.transaction;return!!r&&Wl(r,t)}(e,t.ignoreTransactions)?(Mu&&ac.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Lc(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const r=Dd(e);return!!r&&Wl(r,t)}(e,t.denyUrls)?(Mu&&ac.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Lc(e)}.\nUrl: ${Dd(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const r=Dd(e);return!r||Wl(r,t)}(e,t.allowUrls)&&(Mu&&ac.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Lc(e)}.\nUrl: ${Dd(e)}`),!0)}(t,o)?null:t}});function Dd(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const r=e[t];if(r&&"<anonymous>"!==r.filename&&"[native code]"!==r.filename)return r.filename||null}return null}(t):null}catch{return Mu&&ac.error(`Cannot extract url for event ${Lc(e)}`),null}}let zd;Sd(Nd,jd);const Bd="FunctionToString",Ud=new WeakMap,Vd=()=>({name:Bd,setupOnce(){zd=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=gc(this),r=Ud.has(Gu())&&void 0!==t?t:this;return zd.apply(r,e)}}catch{}},setup(e){Ud.set(e,!0)}});Sd(Bd,Vd);const Hd=Kl;let Wd=0;function $d(){return Wd>0}function qd(e,t={},r){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return t;if(gc(e))return e}catch{return e}const n=function(){const n=Array.prototype.slice.call(arguments);try{r&&"function"==typeof r&&r.apply(this,arguments);const i=n.map(e=>qd(e,t));return e.apply(this,i)}catch(e){throw Wd++,setTimeout(()=>{Wd--}),function(...e){const t=pd();if(2===e.length){const[r,n]=e;return r?t.withScope(()=>(t.getStackTop().scope=r,n(r))):t.withScope(n)}t.withScope(e[0])}(r=>{r.addEventProcessor(e=>(t.mechanism&&(Nc(e,void 0),jc(e,t.mechanism)),e.extra={...e.extra,arguments:n},e)),function(e){pd().captureException(e,void 0)}(e)}),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t])}catch{}pc(n,e),fc(e,"__sentry_wrapped__",n);try{Object.getOwnPropertyDescriptor(n,"name").configurable&&Object.defineProperty(n,"name",{get:()=>e.name})}catch{}return n}const Gd=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Yd(e,t){const r=Kd(e,t),n={type:t&&t.name,value:Jd(t)};return r.length&&(n.stacktrace={frames:r}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function Xd(e,t){return{exception:{values:[Yd(e,t)]}}}function Kd(e,t){const r=t.stacktrace||t.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Zd.test(e.message))return 1}return 0}(t);try{return e(r,n)}catch{}return[]}const Zd=/Minified React error #\d+;/i;function Jd(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Qd(e,t,r,n,i){let o;if(Ol(t)&&t.error)return Xd(e,t.error);if(Pl(t)||function(e){return Fl(e,"DOMException")}(t)){const i=t;if("stack"in t)o=Xd(e,t);else{const t=i.name||(Pl(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=eh(e,a,r,n),Nc(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return Tl(t)?Xd(e,t):Nl(t)||jl(t)?(o=function(e,t,r,n){const i=Gu(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:jl(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:th(t,{isUnhandledRejection:n})}]},extra:{__serialized__:du(t,o)}};if(r){const t=Kd(e,r);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,r,i),jc(o,{synthetic:!0}),o):(o=eh(e,t,r,n),Nc(o,`${t}`),jc(o,{synthetic:!0}),o)}function eh(e,t,r,n){const i={};if(n&&r){const n=Kd(e,r);n.length&&(i.exception={values:[{value:t,stacktrace:{frames:n}}]})}if(Rl(t)){const{__sentry_template_string__:e,__sentry_template_values__:r}=t;return i.logentry={message:e,params:r},i}return i.message=t,i}function th(e,{isUnhandledRejection:t}){const r=function(e,t=40){const r=Object.keys(mc(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return Ul(r[0],t);for(let e=r.length;e>0;e--){const n=r.slice(0,e).join(", ");if(!(n.length>t))return e===r.length?n:Ul(n,t)}return""}(e),n=t?"promise rejection":"exception";return Ol(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:jl(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${n}`:`Object captured as ${n} with keys: ${r}`}class rh extends Ed{constructor(e){Md(e,"browser",["browser"],Hd.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&Hd.document&&Hd.document.addEventListener("visibilitychange",()=>{"hidden"===Hd.document.visibilityState&&this._flushOutcomes()})}eventFromException(e,t){return function(e,t,r,n){const i=Qd(e,t,r&&r.syntheticException||void 0,n);return jc(i),i.level="error",r&&r.event_id&&(i.event_id=r.event_id),pu(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return function(e,t,r="info",n,i){const o=eh(e,t,n&&n.syntheticException||void 0,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),pu(o)}(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Gd&&ac.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:r,dsn:n}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!r&&!!n&&{dsn:lc(n)}},o=function(e){return[{type:"user_report"},e]}(e);return _u(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(Gd&&ac.log("No outcomes to send"));if(!this._dsn)return void(Gd&&ac.log("No dsn provided, will not send outcomes"));Gd&&ac.log("Sending outcomes:",e);const t=function(e,t){return _u(t?{dsn:t}:{},[[{type:"client_report"},{timestamp:xu(),discarded_events:e}]])}(e,this._options.tunnel&&lc(this._dsn));this._sendEnvelope(t)}}let nh;function ih(e,t=function(){if(nh)return nh;if(Yc(Hd.fetch))return nh=Hd.fetch.bind(Hd);const e=Hd.document;let t=Hd.fetch;if(e&&"function"==typeof e.createElement)try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r);const n=r.contentWindow;n&&n.fetch&&(t=n.fetch),e.head.removeChild(r)}catch(e){Gd&&ac.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return nh=t.bind(Hd)}()){let r=0,n=0;return Od(e,function(i){const o=i.body.length;r+=o,n++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15,...e.fetchOptions};try{return t(e.url,a).then(e=>(r-=o,n--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}}))}catch(e){return nh=void 0,r-=o,n--,gu(e)}})}function oh(e){return Od(e,function(t){return new mu((r,n)=>{const i=new XMLHttpRequest;i.onerror=n,i.onreadystatechange=()=>{4===i.readyState&&r({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")}})},i.open("POST",e.url);for(const t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&i.setRequestHeader(t,e.headers[t]);i.send(t.body)})})}const ah="?";function sh(e,t,r,n){const i={filename:e,function:t,in_app:!0};return void 0!==r&&(i.lineno=r),void 0!==n&&(i.colno=n),i}const lh=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ch=/\((\S*)(?::(\d+))(?::(\d+))\)/,uh=[30,e=>{const t=lh.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=ch.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,r]=vh(t[1]||ah,t[2]);return sh(r,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],dh=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,hh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fh=[50,e=>{const t=dh.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=hh.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],r=t[1]||ah;return[r,e]=vh(r,e),sh(e,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],ph=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,gh=[40,e=>{const t=ph.exec(e);return t?sh(t[2],t[1]||ah,+t[3],t[4]?+t[4]:void 0):void 0}],mh=_c(...[uh,fh,gh]),vh=(e,t)=>{const r=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return r||n?[-1!==e.indexOf("@")?e.split("@")[0]:ah,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},yh=1024,bh="Breadcrumbs",wh=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:bh,setupOnce(){},setup(e){t.console&&function(e){const t="console";Tc(t,e),Fc(t,Pc)}(function(e){return function(t){if(Gu()!==e)return;const r={category:"console",data:{arguments:t.args,logger:"console"},level:wu(t.level),message:Vl(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;r.message=`Assertion failed: ${Vl(t.args.slice(1)," ")||"console.assert"}`,r.data.arguments=t.args.slice(1)}qu(r,{input:t.args,level:t.level})}}(e)),t.dom&&function(e){Tc("dom",e),Fc("dom",Wc)}(function(e,t){return function(r){if(Gu()!==e)return;let n,i,o="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>yh&&(Gd&&ac.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=yh),"string"==typeof o&&(o=[o]);try{const e=r.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;n=ec(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!Ql.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch{n="<unknown>"}if(0===n.length)return;const s={category:`ui.${r.name}`,message:n};i&&(s.data={"ui.component_name":i}),qu(s,{event:r.event,name:r.name,global:r.global})}}(e,t.dom)),t.xhr&&function(e){Tc("xhr",e),Fc("xhr",cu)}(function(e){return function(t){if(Gu()!==e)return;const{startTimestamp:r,endTimestamp:n}=t,i=t.xhr[lu];if(!r||!n||!i)return;const{method:o,url:a,status_code:s,body:l}=i;qu({category:"xhr",data:{method:o,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:l,startTimestamp:r,endTimestamp:n})}}(e)),t.fetch&&function(e){const t="fetch";Tc(t,e),Fc(t,Xc)}(function(e){return function(t){if(Gu()!==e)return;const{startTimestamp:r,endTimestamp:n}=t;if(n&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){qu({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:r,endTimestamp:n})}else{const e=t.response;qu({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:r,endTimestamp:n})}}}(e)),t.history&&ou(function(e){return function(t){if(Gu()!==e)return;let r=t.from,n=t.to;const i=yu(Hd.location.href);let o=r?yu(r):void 0;const a=yu(n);(!o||!o.path)&&(o=i),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),qu({category:"navigation",data:{from:r,to:n}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){Gu()===e&&qu({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Lc(t)},{event:t})}}(e))}}};Sd(bh,wh);const xh="Dedupe",Ch=()=>{let e;return{name:xh,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&!(!function(e,t){const r=e.message,n=t.message;return!(!r&&!n||r&&!n||!r&&n||r!==n||!Sh(e,t)||!_h(e,t))}(e,t)&&!function(e,t){const r=Ah(t),n=Ah(e);return!!(r&&n&&r.type===n.type&&r.value===n.value&&Sh(e,t)&&_h(e,t))}(e,t))}(t,e))return Gd&&ac.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function _h(e,t){let r=kh(e),n=kh(t);if(!r&&!n)return!0;if(r&&!n||!r&&n||n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e],i=r[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Sh(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;try{return r.join("")===n.join("")}catch{return!1}}function Ah(e){return e.exception&&e.exception.values&&e.exception.values[0]}function kh(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}Sd(xh,Ch);const Eh="GlobalHandlers",Ih=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:Eh,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(e){const t="error";Tc(t,e),Fc(t,Qc)}(t=>{const{stackParser:r,attachStacktrace:n}=Oh();if(Gu()!==e||$d())return;const{msg:i,url:o,line:a,column:s,error:l}=t,c=void 0===l&&Ml(i)?function(e,t,r,n){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=Ol(e)?e.message:e,a="Error";const s=o.match(i);return s&&(a=s[1],o=s[2]),Th({exception:{values:[{type:a,value:o}]}},t,r,n)}(i,o,a,s):Th(Qd(r,l||i,void 0,n,!1),o,a,s);c.level="error",$u(c,{originalException:l,mechanism:{handled:!1,type:"onerror"}})})}(e),Fh("onerror")),t.onunhandledrejection&&(function(e){!function(e){const t="unhandledrejection";Tc(t,e),Fc(t,tu)}(t=>{const{stackParser:r,attachStacktrace:n}=Oh();if(Gu()!==e||$d())return;const i=function(e){if(Ll(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return e}(t),o=Ll(i)?function(e){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}(i):Qd(r,i,void 0,n,!0);o.level="error",$u(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}(e),Fh("onunhandledrejection"))}}};function Th(e,t,r,n){const i=e.exception=e.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=isNaN(parseInt(n,10))?void 0:n,u=isNaN(parseInt(r,10))?void 0:r,d=Ml(t)&&t.length>0?t:function(){try{return Ql.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:d,function:"?",in_app:!0,lineno:u}),e}function Fh(e){Gd&&ac.log(`Global Handler attached: ${e}`)}function Oh(){const e=Gu();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}Sd(Eh,Ih);const Ph="HttpContext",Mh=()=>({name:Ph,setupOnce(){},preprocessEvent(e){if(!Hd.navigator&&!Hd.location&&!Hd.document)return;const t=e.request&&e.request.url||Hd.location&&Hd.location.href,{referrer:r}=Hd.document||{},{userAgent:n}=Hd.navigator||{},i={...e.request&&e.request.headers,...r&&{Referer:r},...n&&{"User-Agent":n}},o={...e.request,...t&&{url:t},headers:i};e.request=o}});Sd(Ph,Mh);const Rh="LinkedErrors",Lh=(e={})=>{const t=e.limit||5,r=e.key||"cause";return{name:Rh,setupOnce(){},preprocessEvent(e,n,i){const o=i.getOptions();$l(Yd,o.stackParser,o.maxValueLength,r,t,e,n)}}};Sd(Rh,Lh);const Nh=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],jh="TryCatch",Dh=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:jh,setupOnce(){t.setTimeout&&hc(Hd,"setTimeout",zh),t.setInterval&&hc(Hd,"setInterval",zh),t.requestAnimationFrame&&hc(Hd,"requestAnimationFrame",Bh),t.XMLHttpRequest&&"XMLHttpRequest"in Hd&&hc(XMLHttpRequest.prototype,"send",Uh);const e=t.eventTarget;e&&(Array.isArray(e)?e:Nh).forEach(Vh)}}};function zh(e){return function(...t){const r=t[0];return t[0]=qd(r,{mechanism:{data:{function:kc(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function Bh(e){return function(t){return e.apply(this,[qd(t,{mechanism:{data:{function:"requestAnimationFrame",handler:kc(e)},handled:!1,type:"instrument"}})])}}function Uh(e){return function(...t){const r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in r&&"function"==typeof r[e]&&hc(r,e,function(t){const r={mechanism:{data:{function:e,handler:kc(t)},handled:!1,type:"instrument"}},n=gc(t);return n&&(r.mechanism.data.handler=kc(n)),qd(t,r)})}),e.apply(this,t)}}function Vh(e){const t=Hd,r=t[e]&&t[e].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(hc(r,"addEventListener",function(t){return function(r,n,i){try{"function"==typeof n.handleEvent&&(n.handleEvent=qd(n.handleEvent,{mechanism:{data:{function:"handleEvent",handler:kc(n),target:e},handled:!1,type:"instrument"}}))}catch{}return t.apply(this,[r,qd(n,{mechanism:{data:{function:"addEventListener",handler:kc(n),target:e},handled:!1,type:"instrument"}}),i])}}),hc(r,"removeEventListener",function(e){return function(t,r,n){const i=r;try{const r=i&&i.__sentry_wrapped__;r&&e.call(this,t,r,n)}catch{}return e.call(this,t,i,n)}}))}Sd(jh,Dh);const Hh=[jd(),Vd(),Dh(),wh(),Ih(),Lh(),Ch(),Mh()];function Wh(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[...Hh]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),Hd.SENTRY_RELEASE&&Hd.SENTRY_RELEASE.id&&(e.release=Hd.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t={...e,stackParser:Sc(e.stackParser||mh),integrations:xd(e),transport:e.transport||(Gc()?ih:oh)};Fd(rh,t),e.autoSessionTracking&&function(){if(typeof Hd.document>"u")return void(Gd&&ac.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));Xu({ignoreDuration:!0}),Ju(),ou(({from:e,to:t})=>{void 0!==e&&e!==t&&(Xu({ignoreDuration:!0}),Ju())})}()}var $h=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Gh(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Yh=(e=>(e.INLINE="inline",e.OVERLAY="overlay",e))(Yh||{}),Xh=(e=>(e.TOP="top",e.BOTTOM="bottom",e.HIDDEN="",e))(Xh||{});function Kh(e,t){return{...t,message:e}}const Zh=[{name:"emoticons",list:["afro-1","afro","agent","alien-1","alien","angel","angry-1","angry-2","angry-3","angry-4","angry-5","angry","arguing","arrogant","asian-1","asian","avatar","baby-1","baby-2","baby","bully","burglar","businessman","cheeky-1","cheeky","clown","confused-1","confused-2","confused-3","confused","creepy","crying-1","crying-2","crying-3","crying","dazed-1","dazed-2","dazed-3","dazed","dead-1","dead-2","dead-3","dead-4","dead-5","dead-6","dead","desperate-1","desperate","detective","dissapointment","doctor","drunk","dumb","emo-1","emo-2","emo","emoticon","evil","faint-1","faint","flirt-1","flirt-2","flirt","flirty","gangster","geek-1","geek","gentleman-1","gentleman-2","gentleman-3","gentleman-4","gentleman","ginger","girl-1","girl","goofy-1","goofy-2","goofy-3","goofy-4","goofy","grubby-1","grubby","happy-1","happy-10","happy-11","happy-12","happy-13","happy-14","happy-15","happy-16","happy-2","happy-3","happy-4","happy-5","happy-6","happy-7","happy-8","happy-9","happy","harry-potter","heisenberg","hipster-1","hipster-2","hipster","in-love-1","in-love-2","in-love-3","in-love-4","in-love-5","in-love-6","in-love","japan","jew","joyful-1","joyful-2","joyful","kiss-1","kiss-2","kiss-3","kiss-4","kiss","laughing-1","laughing-2","laughing-3","laughing","listening","love","manly","miserly-1","miserly","nerd-1","nerd-2","nerd-3","nerd-4","nerd","ninja","pirate-1","pirate-2","pirate","punk-1","punk-2","punk","rapper","relieved","rich-1","rich-2","rich","rockstar","sad-1","sad-2","sad-3","sad-4","sad-5","sad-6","sad","scared-1","scared-2","scared-3","scared","sceptic-1","sceptic-2","sceptic-3","sceptic-4","sceptic-5","sceptic-6","sceptic-7","sceptic","secret","shocked-1","shocked-2","shocked-3","shocked","sick-1","sick-2","sick-3","sick-4","sick","silent","skeleton","smile","smiling-1","smiling","smoked","smug-1","smug-2","smug-3","smug-4","smug-5","smug-6","smug","sporty","stunned","superhero-1","superhero-2","superhero-3","superhero-4","superhero","surprised-1","surprised","thinking","tired-1","tired-2","tired-3","tired","tough-1","tough","trendy","vampire-1","vampire","wink-1","wink-2","wink","winking-1","winking","yawning-1","yawning-2","yawning-3","yawning","yelling","zombie"],type:"svg",thumbnailUrl:"images/stickers/categories/emoticon.svg"},{name:"doodles",items:100,type:"svg",thumbnailUrl:"images/stickers/categories/doodles.svg"},{name:"landmarks",items:100,type:"svg",thumbnailUrl:"images/stickers/categories/landmark.svg",invertPreview:!0},{name:"bubbles",items:104,type:"png",thumbnailUrl:"images/stickers/categories/speech-bubble.svg"},{name:"transportation",items:22,type:"svg",thumbnailUrl:"images/stickers/categories/transportation.svg",invertPreview:!0},{name:"beach",items:22,type:"svg",thumbnailUrl:"images/stickers/categories/beach.svg",invertPreview:!0}],Jh={emoticons:Kh("Emoticons"),doodles:Kh("Doodles"),landmarks:Kh("Landmarks"),bubbles:Kh("Bubbles"),transportation:Kh("Transportation"),beach:Kh("Beach")},Qh={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},ef=[1,8,15,20,25];var tf=(e=>(e.DARK="dark",e.LIGHT="light",e))(tf||{});const rf=[{name:tf.LIGHT,colors:{"--be-foreground-base":"0 0 0","--be-primary-light":"191 219 254","--be-primary":"59 130 246","--be-primary-dark":"37 99 235","--be-on-primary":"255 255 255","--be-danger":"179 38 30","--be-on-danger":"255 255 255","--be-background":"255 255 255","--be-background-alt":"250 250 250","--be-paper":"255 255 255","--be-disabled-bg-opacity":"12%","--be-disabled-fg-opacity":"26%","--be-hover-opacity":"4%","--be-focus-opacity":"12%","--be-selected-opacity":"8%","--be-text-main-opacity":"87%","--be-text-muted-opacity":"60%","--be-divider-opacity":"12%"}},{name:tf.DARK,isDark:!0,colors:{"--be-foreground-base":"255 255 255","--be-primary-light":"239 246 255","--be-primary":"191 219 254","--be-primary-dark":"147 197 253","--be-on-primary":"56 30 114","--be-danger":"242 184 181","--be-on-danger":"96 20 16","--be-background":"20 21 23","--be-background-alt":"26 27 30","--be-paper":"44 46 51","--be-disabled-bg-opacity":"12%","--be-disabled-fg-opacity":"30%","--be-hover-opacity":"8%","--be-focus-opacity":"12%","--be-selected-opacity":"16%","--be-text-main-opacity":"100%","--be-text-muted-opacity":"70%","--be-divider-opacity":"12%"}}];var nf=(e=>(e.FILTER="filter",e.RESIZE="resize",e.CROP="crop",e.DRAW="draw",e.TEXT="text",e.SHAPES="shapes",e.STICKERS="stickers",e.FRAME="frame",e.CORNERS="corners",e.MERGE="merge",e))(nf||{});function of(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=of(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function af(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=of(e))&&(n&&(n+=" "),n+=t);return n}const sf=p((r,n)=>{const{attr:i,size:o,title:a,className:s,color:l,style:c,children:u,viewBox:d,width:h,height:f,...p}=r;return t("svg",{"aria-hidden":!a,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:d||"0 0 24 24",...i,...p,className:af("svg-icon",s,lf(o)),style:{color:l,...c},ref:n,height:f||"1em",width:h||"1em",children:[a&&e("title",{children:a}),u]})});function lf(e){switch(e){case"2xs":return"icon-2xs";case"xs":return"icon-xs";case"sm":return"icon-sm";case"md":return"icon-md";case"lg":return"icon-lg";case"xl":return"icon-xl";default:return e}}function cf(t,r="",n){return i.memo(i.forwardRef((i,o)=>e(sf,{"data-testid":`${r}Icon`,ref:o,viewBox:n,...i,size:i.size||"md",children:t})))}function uf(e,t=""){return cf(df(e),t)}function df(e){return(null==e?void 0:e.map)&&e.map((e,t)=>i.createElement(e.tag,{key:t,...e.attr},df(e.child)))}const hf=cf(e("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),ff=cf(e("path",{d:"M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8 2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"}),"PhotoSizeSelectLargeOutlined"),pf=cf(e("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),gf=cf(e("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),mf=cf(e("path",{d:"M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z"}),"ExtensionOutlined"),vf=cf(e("path",{d:"M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25zM15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10zM10.66 4.12C12.06 6.44 14.6 8 17.5 8c.46 0 .91-.05 1.34-.12C17.44 5.56 14.9 4 12 4c-.46 0-.91.05-1.34.12zM4.42 9.47c1.71-.97 3.03-2.55 3.66-4.44C6.37 6 5.05 7.58 4.42 9.47zM20 12c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8z"}),"FaceOutlined"),yf=cf(e("path",{d:"M20 4h-4l-4-4-4 4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H4V6h4.52l3.52-3.5L15.52 6H20v14zM6 18h12V8H6v10zm2-8h8v6H8v-6z"}),"FilterFramesOutlined"),bf=cf(e("path",{d:"M6.41 21 5 19.59l4.83-4.83c.75-.75 1.17-1.77 1.17-2.83v-5.1L9.41 8.41 8 7l4-4 4 4-1.41 1.41L13 6.83v5.1c0 1.06.42 2.08 1.17 2.83L19 19.59 17.59 21 12 15.41 6.41 21z"}),"MergeOutlined"),wf=cf(e("path",{d:"M19 19h2v2h-2v-2zm0-2h2v-2h-2v2zM3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm0-4h2V3H3v2zm4 0h2V3H7v2zm8 16h2v-2h-2v2zm-4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm-8 0h2v-2H7v2zm-4 0h2v-2H3v2zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2V8z"}),"RoundedCornerOutlined"),xf=cf(e("path",{d:"M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67 1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}),"PhotoLibraryOutlined"),Cf=cf(e("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"}),"HistoryOutlined"),_f=cf([e("path",{d:"m2.53 19.65 1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z"},"0"),e("circle",{cx:"11",cy:"9",r:"1"},"1"),e("path",{d:"M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"},"2")],"StyleOutlined"),Sf=cf(e("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}),"DeleteOutlined"),Af=cf(e("path",{d:"M18.85,10.39l1.06-1.06c0.78-0.78,0.78-2.05,0-2.83L18.5,5.09c-0.78-0.78-2.05-0.78-2.83,0l-1.06,1.06L18.85,10.39z M14.61,11.81L7.41,19H6v-1.41l7.19-7.19L14.61,11.81z M13.19,7.56L4,16.76V21h4.24l9.19-9.19L13.19,7.56L13.19,7.56z M19,17.5 c0,2.19-2.54,3.5-5,3.5c-0.55,0-1-0.45-1-1s0.45-1,1-1c1.54,0,3-0.73,3-1.5c0-0.47-0.48-0.87-1.23-1.2l1.48-1.48 C18.32,15.45,19,16.29,19,17.5z M4.58,13.35C3.61,12.79,3,12.06,3,11c0-1.8,1.89-2.63,3.56-3.36C7.59,7.18,9,6.56,9,6 c0-0.41-0.78-1-2-1C5.74,5,5.2,5.61,5.17,5.64C4.82,6.05,4.19,6.1,3.77,5.76C3.36,5.42,3.28,4.81,3.62,4.38C3.73,4.24,4.76,3,7,3 c2.24,0,4,1.32,4,3c0,1.87-1.93,2.72-3.64,3.47C6.42,9.88,5,10.5,5,11c0,0.31,0.43,0.6,1.07,0.86L4.58,13.35z"}),"Draw"),kf=cf(e("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),Ef={[nf.FILTER]:{name:Kh("Applied Filters"),icon:hf},[nf.RESIZE]:{name:Kh("Resized Image"),icon:ff},[nf.CROP]:{name:Kh("Cropped Image"),icon:pf},[nf.DRAW]:{name:Kh("Added Drawing"),icon:Af},[nf.TEXT]:{name:Kh("Added Text"),icon:gf},[nf.SHAPES]:{name:Kh("Added Shape"),icon:mf},[nf.STICKERS]:{name:Kh("Added Sticker"),icon:vf},[nf.FRAME]:{name:Kh("Added Frame"),icon:yf},[nf.MERGE]:{name:Kh("Merged Objects"),icon:bf},[nf.CORNERS]:{name:Kh("Rounded Corner"),icon:wf},bgImage:{name:Kh("Replaced Background Image"),icon:xf},overlayImage:{name:Kh("Added Image"),icon:xf},initial:{name:Kh("Initial"),icon:kf},loadedState:{name:Kh("Loaded State"),icon:Cf},objectStyle:{name:Kh("Changed Style"),icon:_f},deletedObject:{name:Kh("Deleted object"),icon:Sf}},If=Object.values(nf).map(e=>({name:e,icon:Ef[e].icon,action:e===nf.MERGE?e=>{e.tools.merge.apply()}:e})),Tf={filter:Kh("filter"),resize:Kh("resize"),crop:Kh("crop"),draw:Kh("draw"),text:Kh("text"),shapes:Kh("shapes"),stickers:Kh("stickers"),frame:Kh("frame"),corners:Kh("corners"),merge:Kh("merge")},Ff=cf(e("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}),"FileDownloadOutlined"),Of="3.0.5",Pf={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:Yh.INLINE,forceOverlayModeOnMobile:!0,activeTheme:tf.LIGHT,themes:rf,allowEditorClose:!0,menubar:{items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:Cf,align:"right",desktopOnly:!0,action:e=>{e.togglePanel("history")}},{type:"button",icon:Ff,label:Kh("Done"),align:"right",action:e=>{var t;null!=(t=e.state.config.ui)&&t.showExportPanel?e.state.togglePanel("export",!0):e.tools.export.save()}}]},nav:{position:Xh.BOTTOM,items:[...If]},openImageDialog:{show:!0,sampleImages:[{url:"images/samples/sample1.jpg",thumbnail:"images/samples/sample1_thumbnail.jpg"},{url:"images/samples/sample2.jpg",thumbnail:"images/samples/sample2_thumbnail.jpg"},{url:"images/samples/sample3.jpg",thumbnail:"images/samples/sample3_thumbnail.jpg"}]},colorPresets:{items:["rgb(0,0,0)","rgb(255, 255, 255)","rgb(242, 38, 19)","rgb(249, 105, 14)","rgb(253, 227, 167)","rgb(4, 147, 114)","rgb(30, 139, 195)","rgb(142, 68, 173)"]}},objectDefaults:{global:{...Qh},sticker:{fill:void 0},text:{textAlign:"initial",underline:!1,linethrough:!1,fontStyle:"normal",fontFamily:"Times New Roman",fontWeight:"normal",stroke:void 0,fontSize:40}},tools:{filter:{items:["grayscale","blackWhite","sharpen","invert","vintage","polaroid","kodachrome","technicolor","brownie","sepia","removeColor","brightness","gamma","noise","pixelate","blur","emboss","blendColor"]},zoom:{allowUserZoom:!0,fitImageToScreen:!0},crop:{allowCustomRatio:!0,defaultRatio:"1:1",presets:[{ratio:null,name:"Custom"},{ratio:"1:1",name:"Square"},{ratio:"4:3"},{ratio:"16:9"},{ratio:"5:3"},{ratio:"5:4"},{ratio:"6:4"},{ratio:"7:5"},{ratio:"10:8"}]},text:{defaultText:"Double click to edit",controlsPadding:6,items:[{family:"Roboto",src:"fonts/open-sans-v27-latin-ext_latin-regular.woff2"},{family:"Fuzzy Bubbles",src:"fonts/fuzzy-bubbles-v3-latin-700.woff2",descriptors:{weight:"700"}},{family:"Aleo Bold",src:"fonts/aleo-v4-latin-ext_latin-700.woff2",descriptors:{weight:"700"}},{family:"Amatic SC",src:"fonts/amatic-sc-v16-latin-ext_latin-regular.woff2"},{family:"Corinthia Bold",src:"fonts/corinthia-v7-latin-ext_latin-700.woff2"},{family:"Bungee Inline",src:"fonts/bungee-inline-v6-latin-ext_latin-regular.woff2"},{family:"Robot Slab Bold",src:"fonts/roboto-slab-v16-latin-ext_latin-500.woff2"},{family:"Carter One",src:"fonts/carter-one-v12-latin-regular.woff2"},{family:"Cody Star",src:"fonts/codystar-v10-latin-ext_latin-regular.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Krona One",src:"fonts/krona-one-v9-latin-ext_latin-regular.woff2"},{family:"Kumar One Outline",src:"fonts/kumar-one-outline-v8-latin-ext_latin-regular.woff2"},{family:"Lobster Two",src:"fonts/lobster-two-v13-latin-regular.woff2"},{family:"Molle Italic",src:"fonts/molle-v11-latin-ext_latin-italic.woff2"},{family:"Monoton",src:"fonts/monoton-v10-latin-regular.woff2"},{family:"Nixie One",src:"fonts/nixie-one-v11-latin-regular.woff2"},{family:"Permanent Marker",src:"fonts/permanent-marker-v10-latin-regular.woff2"},{family:"Sancreek",src:"fonts/sancreek-v13-latin-ext_latin-regular.woff2"},{family:"Stint Ultra Expanded",src:"fonts/stint-ultra-expanded-v10-latin-regular.woff2"},{family:"VT323",src:"fonts/vt323-v12-latin-ext_latin-regular.woff2"},{family:"Trash Hand",src:"fonts/TrashHand.ttf"}]},draw:{brushSizes:ef,brushTypes:["PencilBrush","EraserBrush","SprayBrush","CircleBrush","DiamondBrush","VLineBrush","HLineBrush","SquareBrush"]},shapes:{items:[{name:"circle",type:"Circle"},{name:"square",type:"Rect",options:{lockUniScaling:!1}},{name:"triangle",type:"Triangle"},{name:"ellipse",type:"Ellipse",options:{lockUniScaling:!1}},{name:"Arrow #1",type:"Path",options:{path:"M 294.9 16.4 l 15.7 42.2 c -171.4 70.3 -294 242.3 -289.1 437.4 l 14.7 -1 c 9.1 -0.6 18.1 -1.2 27.1 -1.9 l 14.7 -1 c -4.3 -170.1 102.5 -320 252 -381.3 l 15.7 42.2 c 34.7 -40.5 83.1 -76.6 144.8 -99.8 c -58.1 -26.2 -124.9 -39.6 -195.6 -36.8 z"}},{name:"Arrow #2",type:"Path",options:{path:"M 16 248.4 v 14.9 h 447.5 l -93.2 82.5 l 11.9 10.5 l 113.8 -100.2 l -113.6 -100.4 l -11.8 10.5 l 92.9 82.2 z"}},{name:"Arrow #3",type:"Path",options:{path:"M 496 256 l -118.6 -66 v 40.8 h -361.4 v 50.4 h 361.4 v 40.8 l 118.6 -66 z"}},{name:"Line",type:"Path",options:{path:"M 16 256 h 480",strokeWidth:10,stroke:"#000",padding:10}},{name:"Star",type:"Path",options:{path:"M 256 406.3 l 148.3 78 l -28.3 -165.2 l 120 -117 l -165.8 -24.1 l -74.2 -150.3 l -74.2 150.3 l -165.8 24.1 l 120 117 l -28.3 165.2 z"}},{name:"Polygon",type:"Path",options:{path:"M 256 19.6 l 156.6 57.1 l 83.4 144.3 l -28.9 164.2 l -127.7 107.2 h -166.8 l -127.7 -107.2 l -28.9 -164.2 l 83.4 -144.3 z"}},{name:"Badge",type:"Path",options:{path:"M 257.3 16.2 s -148 58.2 -204.4 81.4 c 0 75.7 -16.8 303.5 204.4 398.2 c 218.7 -94.6 201.9 -322.4 201.9 -398.2 c -62.1 -23.6 -201.9 -81.4 -201.9 -81.4 z"}}].slice()},stickers:{items:Zh},import:{validImgExtensions:["png","jpg","jpeg","svg","gif"],fitOverlayToScreen:!0,openDroppedImageAsBackground:!1},export:{defaultFormat:"png",defaultQuality:.8,defaultName:"image"},frame:{items:[{name:"basic",mode:"basic",size:{min:1,max:35,default:10}},{name:"pine",mode:"stretch",size:{min:1,max:35,default:15}},{name:"oak",mode:"stretch",size:{min:1,max:35,default:15}},{name:"rainbow",mode:"stretch",size:{min:1,max:35,default:15}},{name:"grunge1",display_name:"grunge #1",mode:"stretch",size:{min:1,max:35,default:15}},{name:"grunge2",display_name:"grunge #2",mode:"stretch",size:{min:1,max:35,default:20}},{name:"ebony",mode:"stretch",size:{min:1,max:35,default:15}},{name:"art1",display_name:"Art #1",mode:"repeat",size:{min:10,max:70,default:55}},{name:"art2",display_name:"Art #2",mode:"repeat",size:{min:10,max:70,default:55}}]}}},Mf=e=>{let t;const r=new Set,n=(e,n)=>{const i="function"==typeof e?e(t):e;if(!Object.is(i,t)){const e=t;t=n??("object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,o={setState:n,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{r.clear()}},a=t=e(n,i,o);return o};var Rf={exports:{}},Lf={},Nf={exports:{}},jf={},Df=i;
10
+ /**
11
+ * @license React
12
+ * use-sync-external-store-shim.production.min.js
13
+ *
14
+ * Copyright (c) Facebook, Inc. and its affiliates.
15
+ *
16
+ * This source code is licensed under the MIT license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */var zf="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Bf=Df.useState,Uf=Df.useEffect,Vf=Df.useLayoutEffect,Hf=Df.useDebugValue;function Wf(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!zf(e,r)}catch{return!0}}var $f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),n=Bf({inst:{value:r,getSnapshot:t}}),i=n[0].inst,o=n[1];return Vf(function(){i.value=r,i.getSnapshot=t,Wf(i)&&o({inst:i})},[e,r,t]),Uf(function(){return Wf(i)&&o({inst:i}),e(function(){Wf(i)&&o({inst:i})})},[e]),Hf(r),r};jf.useSyncExternalStore=void 0!==Df.useSyncExternalStore?Df.useSyncExternalStore:$f,Nf.exports=jf;var qf=Nf.exports,Gf=i,Yf=qf;
19
+ /**
20
+ * @license React
21
+ * use-sync-external-store-shim/with-selector.production.min.js
22
+ *
23
+ * Copyright (c) Facebook, Inc. and its affiliates.
24
+ *
25
+ * This source code is licensed under the MIT license found in the
26
+ * LICENSE file in the root directory of this source tree.
27
+ */var Xf="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Kf=Yf.useSyncExternalStore,Zf=Gf.useRef,Jf=Gf.useEffect,Qf=Gf.useMemo,ep=Gf.useDebugValue;Lf.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var o=Zf(null);if(null===o.current){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=Qf(function(){function e(e){if(!l){if(l=!0,o=e,e=n(e),void 0!==i&&a.hasValue){var t=a.value;if(i(t,e))return s=t}return s=e}if(t=s,Xf(o,e))return t;var r=n(e);return void 0!==i&&i(t,r)?t:(o=e,s=r)}var o,s,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,n,i]);var s=Kf(e,o[0],o[1]);return Jf(function(){a.hasValue=!0,a.value=s},[s]),ep(s),s},Rf.exports=Lf;const tp=qh(Rf.exports),{useDebugValue:rp}=i,{useSyncExternalStoreWithSelector:np}=tp,ip=e=>e;const op=e=>{const t="function"==typeof e?(e=>e?Mf(e):Mf)(e):e,r=(e,r)=>function(e,t=ip,r){const n=np(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return rp(n),n}(t,e,r);return Object.assign(r,t),r},ap=e=>op,sp=e=>(t,r,n)=>{const i=n.subscribe;return n.subscribe=(e,t,r)=>{let o=e;if(t){const i=(null==r?void 0:r.equalityFn)||Object.is;let a=e(n.getState());o=r=>{const n=e(r);if(!i(a,n)){const e=a;t(a=n,e)}},null!=r&&r.fireImmediately&&t(a,a)}return i(o)},e(t,r,n)};var lp=Symbol.for("immer-nothing"),cp=Symbol.for("immer-draftable"),up=Symbol.for("immer-state");function dp(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var hp=Object.getPrototypeOf;function fp(e){return!!e&&!!e[up]}function pp(e){var t;return!!e&&(mp(e)||Array.isArray(e)||!!e[cp]||!(null==(t=e.constructor)||!t[cp])||xp(e)||Cp(e))}var gp=Object.prototype.constructor.toString();function mp(e){if(!e||"object"!=typeof e)return!1;const t=hp(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===gp}function vp(e,t){0===yp(e)?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function yp(e){const t=e[up];return t?t.type_:Array.isArray(e)?1:xp(e)?2:Cp(e)?3:0}function bp(e,t){return 2===yp(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function wp(e,t,r){const n=yp(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function xp(e){return e instanceof Map}function Cp(e){return e instanceof Set}function _p(e){return e.copy_||e.base_}function Sp(e,t){if(xp(e))return new Map(e);if(Cp(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=mp(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[up];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const i=r[n],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(hp(e),t)}{const t=hp(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function Ap(e,t=!1){return Ep(e)||fp(e)||!pp(e)||(yp(e)>1&&(e.set=e.add=e.clear=e.delete=kp),Object.freeze(e),t&&Object.entries(e).forEach(([e,t])=>Ap(t,!0))),e}function kp(){dp(2)}function Ep(e){return Object.isFrozen(e)}var Ip,Tp={};function Fp(e){const t=Tp[e];return t||dp(0),t}function Op(){return Ip}function Pp(e,t){t&&(Fp("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Mp(e){Rp(e),e.drafts_.forEach(Np),e.drafts_=null}function Rp(e){e===Ip&&(Ip=e.parent_)}function Lp(e){return Ip=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(Ip,e)}function Np(e){const t=e[up];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function jp(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return void 0!==e&&e!==r?(r[up].modified_&&(Mp(t),dp(4)),pp(e)&&(e=Dp(t,e),t.parent_||Bp(t,e)),t.patches_&&Fp("Patches").generateReplacementPatches_(r[up].base_,e,t.patches_,t.inversePatches_)):e=Dp(t,r,[]),Mp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==lp?e:void 0}function Dp(e,t,r){if(Ep(t))return t;const n=t[up];if(!n)return vp(t,(i,o)=>zp(e,n,t,i,o,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return Bp(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const t=n.copy_;let i=t,o=!1;3===n.type_&&(i=new Set(t),t.clear(),o=!0),vp(i,(i,a)=>zp(e,n,t,i,a,r,o)),Bp(e,t,!1),r&&e.patches_&&Fp("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function zp(e,t,r,n,i,o,a){if(fp(i)){const a=Dp(e,i,o&&t&&3!==t.type_&&!bp(t.assigned_,n)?o.concat(n):void 0);if(wp(r,n,a),!fp(a))return;e.canAutoFreeze_=!1}else a&&r.add(i);if(pp(i)&&!Ep(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Dp(e,i),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&Bp(e,i)}}function Bp(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ap(t,r)}var Up={get(e,t){if(t===up)return e;const r=_p(e);if(!bp(r,t))return function(e,t,r){var n;const i=Wp(t,r);return i?"value"in i?i.value:null==(n=i.get)?void 0:n.call(e.draft_):void 0}(e,r,t);const n=r[t];return e.finalized_||!pp(n)?n:n===Hp(e.base_,t)?(qp(e),e.copy_[t]=Gp(n,e)):n},has:(e,t)=>t in _p(e),ownKeys:e=>Reflect.ownKeys(_p(e)),set(e,t,r){const n=Wp(_p(e),t);if(null!=n&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=Hp(_p(e),t),i=null==n?void 0:n[up];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,n)&&(void 0!==r||bp(e.base_,t)))return!0;qp(e),$p(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Hp(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,qp(e),$p(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=_p(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){dp(11)},getPrototypeOf:e=>hp(e.base_),setPrototypeOf(){dp(12)}},Vp={};function Hp(e,t){const r=e[up];return(r?_p(r):e)[t]}function Wp(e,t){if(!(t in e))return;let r=hp(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=hp(r)}}function $p(e){e.modified_||(e.modified_=!0,e.parent_&&$p(e.parent_))}function qp(e){e.copy_||(e.copy_=Sp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}vp(Up,(e,t)=>{Vp[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Vp.deleteProperty=function(e,t){return Vp.set.call(this,e,t,void 0)},Vp.set=function(e,t,r){return Up.set.call(this,e[0],t,r,e[0])};function Gp(e,t){const r=xp(e)?Fp("MapSet").proxyMap_(e,t):Cp(e)?Fp("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Op(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,o=Up;r&&(i=[n],o=Vp);const{revoke:a,proxy:s}=Proxy.revocable(i,o);return n.draft_=s,n.revoke_=a,s}(e,t);return(t?t.scope_:Op()).drafts_.push(r),r}function Yp(e){if(!pp(e)||Ep(e))return e;const t=e[up];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Sp(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Sp(e,!0);return vp(r,(e,t)=>{wp(r,e,Yp(t))}),t&&(t.finalized_=!1),r}var Xp=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,r)=>{if("function"==typeof e&&"function"!=typeof t){const r=t;t=e;const n=this;return function(e=r,...i){return n.produce(e,e=>t.call(this,e,...i))}}let n;if("function"!=typeof t&&dp(6),void 0!==r&&"function"!=typeof r&&dp(7),pp(e)){const i=Lp(this),o=Gp(e,void 0);let a=!0;try{n=t(o),a=!1}finally{a?Mp(i):Rp(i)}return Pp(i,r),jp(n,i)}if(!e||"object"!=typeof e){if(n=t(e),void 0===n&&(n=e),n===lp&&(n=void 0),this.autoFreeze_&&Ap(n,!0),r){const t=[],i=[];Fp("Patches").generateReplacementPatches_(e,n,t,i),r(t,i)}return n}dp(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,t=>e(t,...r));let r,n;return[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof(null==e?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){pp(e)||dp(8),fp(e)&&(e=function(e){return fp(e)||dp(10),Yp(e)}(e));const t=Lp(this),r=Gp(e,void 0);return r[up].isManual_=!0,Rp(t),r}finishDraft(e,t){const r=e&&e[up];(!r||!r.isManual_)&&dp(9);const{scope_:n}=r;return Pp(n,t),jp(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=Fp("Patches").applyPatches_;return fp(e)?n(e,t):this.produce(e,e=>n(e,t))}},Kp=Xp.produce;Xp.produceWithPatches.bind(Xp),Xp.setAutoFreeze.bind(Xp),Xp.setUseStrictShallowCopy.bind(Xp),Xp.applyPatches.bind(Xp),Xp.createDraft.bind(Xp),Xp.finishDraft.bind(Xp);var Zp=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===Jp}(e)}(e)};var Jp="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function Qp(e,t){return!1!==t.clone&&t.isMergeableObject(e)?ig(function(e){return Array.isArray(e)?[]:{}}(e),e,t):e}function eg(e,t,r){return e.concat(t).map(function(e){return Qp(e,r)})}function tg(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function rg(e,t){try{return t in e}catch{return!1}}function ng(e,t,r){var n={};return r.isMergeableObject(e)&&tg(e).forEach(function(t){n[t]=Qp(e[t],r)}),tg(t).forEach(function(i){(function(e,t){return rg(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(rg(e,i)&&r.isMergeableObject(t[i])?n[i]=function(e,t){if(!t.customMerge)return ig;var r=t.customMerge(e);return"function"==typeof r?r:ig}(i,r)(e[i],t[i],r):n[i]=Qp(t[i],r))}),n}function ig(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||eg,r.isMergeableObject=r.isMergeableObject||Zp,r.cloneUnlessOtherwiseSpecified=Qp;var n=Array.isArray(t);return n===Array.isArray(e)?n?r.arrayMerge(e,t,r):ng(e,t,r):Qp(t,r)}ig.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,r){return ig(e,r,t)},{})};const og=qh(ig);function ag(e,t){return sg(og(t,e),e)}function sg(e,t){return Object.keys(e).forEach(r=>{if(r.startsWith("replaceDefault")&&e[r]){const n=function(e){return e.charAt(0).toLowerCase()+e.slice(1)}(r.replace("replaceDefault","")||"items");e[n]=t?t[n]:[],delete e[r]}else"object"==typeof e[r]&&null!==e[r]&&sg(e[r],null==t?void 0:t[r])}),e}const lg=(e,t)=>({history:{...cg,updatePointerById:e=>{const r=t().history.items.findIndex(t=>t.id===e);t().history.update(r)},update:(t,r)=>{e(e=>{e.history.pointer=t,r&&(e.history.items=r),e.history.canUndo=e.history.pointer>0,e.history.canRedo=e.history.items.length>e.history.pointer+1})},reset:r=>{e({history:{...t().history,...r??cg}})}}}),cg={items:[],pointer:0,canUndo:!1,canRedo:!1};var ug=(e=>(e.Filter="filter",e.Frame="frame",e.ActiveObject="activeObj",e.Text="text",e))(ug||{});const dg=(e,t)=>({filter:{...hg,select(t,r=!1){e(e=>{e.filter.selected=t,e.activeToolOverlay=r?ug.Filter:null,e.dirty=!0})},deselect(r){t().filter.selected===r&&e(e=>{e.filter.selected=null,e.activeToolOverlay=null,e.dirty=!0})},reset(){e({filter:{...t().filter,...hg}})}}}),hg={selected:null,applied:[]},fg=(e,t)=>({crop:{...pg,setCropzoneRect:t=>{e(e=>{e.crop.zoneRect=t})},setAspectRatio:t=>{e(e=>{e.crop.selectedAspectRatio=t})},setTransformAngle:t=>{e(e=>{e.crop.straightenAngle=t})},apply:async()=>{const e=t().crop.zoneRect;if(e){const r={width:Math.ceil(e.width/t().zoom),height:Math.ceil(e.height/t().zoom),left:Math.ceil(e.left/t().zoom),top:Math.ceil(e.top/t().zoom)};await t().editor.tools.crop.apply(r)}},reset:()=>{e({crop:{...t().crop,...pg}})}}}),pg={zoneRect:null,selectedAspectRatio:null,straightenAngle:0};function gg(e){return"i-text"===(null==e?void 0:e.type)}var mg=(e=>(e.Text="text",e.Shape="shape",e.Sticker="sticker",e.Drawing="drawing",e.Image="image",e.MainImage="mainImage",e.StraightenAnchor="straightenHelper",e))(mg||{});const vg={text:{name:Kh("Text"),icon:Ef.text.icon},shape:{name:Kh("Shape"),icon:Ef.shapes.icon},sticker:{name:Kh("Sticker"),icon:Ef.stickers.icon},drawing:{name:Kh("Drawing"),icon:Ef.draw.icon},image:{name:Kh("Image"),icon:Ef.overlayImage.icon},mainImage:{name:Kh("Background Image"),icon:Ef.bgImage.icon}};const yg={isMoving:!1,editableProps:{},id:null,isText:!1,isImage:!1,name:null};const bg=(e,t)=>({objects:{...wg,setActiveIsMoving:t=>{e(e=>{e.objects.active.isMoving=t})},setIsEditingText:t=>{e(e=>{e.objects.isEditingText=t})},setActive:r=>{e(r?e=>{e.objects.active.editableProps=function(e){if(!e)return{};const t={fill:e.fill,opacity:e.opacity,backgroundColor:e.backgroundColor,stroke:e.stroke,strokeWidth:e.strokeWidth},r=e.shadow;return r&&(t.shadow={color:r.color,blur:r.blur,offsetX:r.offsetX,offsetY:r.offsetY}),gg(e)&&(t.textAlign=e.textAlign,t.underline=e.underline,t.linethrough=e.linethrough,t.fontStyle=e.fontStyle,t.fontFamily=e.fontFamily,t.fontWeight=e.fontWeight,t.fontSize=e.fontSize),t}(r),e.objects.active.id=r.data.id,e.objects.active.name=r.name??null,e.objects.active.isText=gg(r),e.objects.active.isImage=function(e){return e.name===mg.Image}(r)}:e=>{var r,n,i,o,a;const s={...null==(r=t().config.objectDefaults)?void 0:r.global,fontFamily:null==(i=null==(n=t().config.objectDefaults)?void 0:n.text)?void 0:i.fontFamily,fontSize:null==(a=null==(o=t().config.objectDefaults)?void 0:o.text)?void 0:a.fontSize};e.objects.active={...yg,editableProps:s}})},reset(){e({objects:{...t().objects,...wg}})}}}),wg={all:[],isEditingText:!1,active:yg},xg=(e,t)=>({frame:{...Cg,select:r=>{e(e=>{e.frame.active=r}),t().frame.showOptionsPanel()},deselect:()=>{e(e=>{e.frame.active=null,e.activeToolOverlay=null})},showOptionsPanel:()=>{t().activeTool===nf.FRAME&&e(e=>{e.activeToolOverlay=ug.Frame})},reset(){e({frame:{...t().frame,...Cg}})}}}),Cg={active:null},_g=(e,t)=>({resize:{...Sg,setFormValue:t=>{e(e=>{Object.entries(t).forEach(([t,r])=>{e.resize.formValue[t]=r})})},apply(){const e=t().resize.formValue,r=t().original;if(e.width===r.width&&e.height===r.height)return!1;t().editor.tools.resize.apply(e)},reset(){e({resize:{...t().resize,...Sg}})}}}),Sg={formValue:{width:1,height:1,maintainAspect:!0,usePercentages:!1}},Ag=(e,t)=>({corners:{...kg,setRadius:t=>{e(e=>{e.corners.radius=t})},apply:()=>t().editor.tools.corners.apply(t().corners.radius),reset(){e({corners:{...t().corners,...kg}})}}}),kg={radius:50},Eg=e=>(t,r,n)=>(n.setState=(e,r,...n)=>{const i="function"==typeof e?Kp(e):e;return t(i,r,...n)},e(n.setState,r,n));var Ig={exports:{}},Tg={exports:{}},Fg=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))},Og=Array.prototype.concat,Pg=Array.prototype.slice,Mg=Tg.exports=function(e){for(var t=[],r=0,n=e.length;r<n;r++){var i=e[r];Fg(i)?t=Og.call(t,Pg.call(i)):t.push(i)}return t};Mg.wrap=function(e){return function(){return e(Mg(arguments))}};var Rg=Tg.exports,Lg={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Ng=Rg,jg=Object.hasOwnProperty,Dg=Object.create(null);for(var zg in Lg)jg.call(Lg,zg)&&(Dg[Lg[zg]]=zg);var Bg=Ig.exports={to:{},get:{}};function Ug(e,t,r){return Math.min(Math.max(t,e),r)}function Vg(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}Bg.get=function(e){var t,r;switch(e.substring(0,3).toLowerCase()){case"hsl":t=Bg.get.hsl(e),r="hsl";break;case"hwb":t=Bg.get.hwb(e),r="hwb";break;default:t=Bg.get.rgb(e),r="rgb"}return t?{model:r,value:t}:null},Bg.get.rgb=function(e){if(!e)return null;var t,r,n,i=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(n=t[2],t=t[1],r=0;r<3;r++){var o=2*r;i[r]=parseInt(t.slice(o,o+2),16)}n&&(i[3]=parseInt(n,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(n=(t=t[1])[3],r=0;r<3;r++)i[r]=parseInt(t[r]+t[r],16);n&&(i[3]=parseInt(n+n,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(r=0;r<3;r++)i[r]=parseInt(t[r+1],0);t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:jg.call(Lg,t[1])?((i=Lg[t[1]])[3]=1,i):null:null;for(r=0;r<3;r++)i[r]=Math.round(2.55*parseFloat(t[r+1]));t[4]&&(t[5]?i[3]=.01*parseFloat(t[4]):i[3]=parseFloat(t[4]))}for(r=0;r<3;r++)i[r]=Ug(i[r],0,255);return i[3]=Ug(i[3],0,1),i},Bg.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,Ug(parseFloat(t[2]),0,100),Ug(parseFloat(t[3]),0,100),Ug(isNaN(r)?1:r,0,1)]}return null},Bg.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var r=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,Ug(parseFloat(t[2]),0,100),Ug(parseFloat(t[3]),0,100),Ug(isNaN(r)?1:r,0,1)]}return null},Bg.to.hex=function(){var e=Ng(arguments);return"#"+Vg(e[0])+Vg(e[1])+Vg(e[2])+(e[3]<1?Vg(Math.round(255*e[3])):"")},Bg.to.rgb=function(){var e=Ng(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},Bg.to.rgb.percent=function(){var e=Ng(arguments),t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"},Bg.to.hsl=function(){var e=Ng(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},Bg.to.hwb=function(){var e=Ng(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},Bg.to.keyword=function(e){return Dg[e.slice(0,3)]};var Hg=Ig.exports;const Wg={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},$g={};for(const e of Object.keys(Wg))$g[Wg[e]]=e;const qg={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Gg=qg;for(const e of Object.keys(qg)){if(!("channels"in qg[e]))throw new Error("missing channels property: "+e);if(!("labels"in qg[e]))throw new Error("missing channel labels property: "+e);if(qg[e].labels.length!==qg[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=qg[e];delete qg[e].channels,delete qg[e].labels,Object.defineProperty(qg[e],"channels",{value:t}),Object.defineProperty(qg[e],"labels",{value:r})}function Yg(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}qg.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=o-i;let s,l;o===i?s=0:t===o?s=(r-n)/a:r===o?s=2+(n-t)/a:n===o&&(s=4+(t-r)/a),s=Math.min(60*s,360),s<0&&(s+=360);const c=(i+o)/2;return l=o===i?0:c<=.5?a/(o+i):a/(2-o-i),[s,100*l,100*c]},qg.rgb.hsv=function(e){let t,r,n,i,o;const a=e[0]/255,s=e[1]/255,l=e[2]/255,c=Math.max(a,s,l),u=c-Math.min(a,s,l),d=function(e){return(c-e)/6/u+.5};return 0===u?(i=0,o=0):(o=u/c,t=d(a),r=d(s),n=d(l),a===c?i=n-r:s===c?i=1/3+t-n:l===c&&(i=2/3+r-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*c]},qg.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const i=qg.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[i,100*o,100*n]},qg.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(1-t,1-r,1-n);return[100*((1-t-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*i]},qg.rgb.keyword=function(e){const t=$g[e];if(t)return t;let r,n=1/0;for(const t of Object.keys(Wg)){const i=Yg(e,Wg[t]);i<n&&(n=i,r=t)}return r},qg.keyword.rgb=function(e){return Wg[e]},qg.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;return[100*(.4124*t+.3576*r+.1805*n),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},qg.rgb.lab=function(e){const t=qg.rgb.xyz(e);let r=t[0],n=t[1],i=t[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*n-16,500*(r-n),200*(n-i)]},qg.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let i,o,a;if(0===r)return a=255*n,[a,a,a];i=n<.5?n*(1+r):n+r-n*r;const s=2*n-i,l=[0,0,0];for(let e=0;e<3;e++)o=t+1/3*-(e-1),o<0&&o++,o>1&&o--,a=6*o<1?s+6*(i-s)*o:2*o<1?i:3*o<2?s+(i-s)*(2/3-o)*6:s,l[e]=255*a;return l},qg.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,i=r;const o=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=o<=1?o:2-o;return[t,100*(0===n?2*i/(o+i):2*r/(n+r)),100*((n+r)/2)]},qg.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const i=Math.floor(t)%6,o=t-Math.floor(t),a=255*n*(1-r),s=255*n*(1-r*o),l=255*n*(1-r*(1-o));switch(n*=255,i){case 0:return[n,l,a];case 1:return[s,n,a];case 2:return[a,n,l];case 3:return[a,s,n];case 4:return[l,a,n];case 5:return[n,a,s]}},qg.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,i=Math.max(n,.01);let o,a;a=(2-r)*n;const s=(2-r)*i;return o=r*i,o/=s<=1?s:2-s,o=o||0,a/=2,[t,100*o,100*a]},qg.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const i=r+n;let o;i>1&&(r/=i,n/=i);const a=Math.floor(6*t),s=1-n;o=6*t-a,1&a&&(o=1-o);const l=r+o*(s-r);let c,u,d;switch(a){default:case 6:case 0:c=s,u=l,d=r;break;case 1:c=l,u=s,d=r;break;case 2:c=r,u=s,d=l;break;case 3:c=r,u=l,d=s;break;case 4:c=l,u=r,d=s;break;case 5:c=s,u=r,d=l}return[255*c,255*u,255*d]},qg.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},qg.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let i,o,a;return i=3.2406*t+-1.5372*r+-.4986*n,o=-.9689*t+1.8758*r+.0415*n,a=.0557*t+-.204*r+1.057*n,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,a=a>.0031308?1.055*a**(1/2.4)-.055:12.92*a,i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),[255*i,255*o,255*a]},qg.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;return[116*r-16,500*(t-r),200*(r-n)]},qg.lab.xyz=function(e){let t,r,n;r=(e[0]+16)/116,t=e[1]/500+r,n=r-e[2]/200;const i=r**3,o=t**3,a=n**3;return r=i>.008856?i:(r-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,t*=95.047,r*=100,n*=108.883,[t,r,n]},qg.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let i;i=360*Math.atan2(n,r)/2/Math.PI,i<0&&(i+=360);return[t,Math.sqrt(r*r+n*n),i]},qg.lch.lab=function(e){const t=e[0],r=e[1],n=e[2]/360*2*Math.PI;return[t,r*Math.cos(n),r*Math.sin(n)]},qg.rgb.ansi16=function(e,t=null){const[r,n,i]=e;let o=null===t?qg.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),0===o)return 30;let a=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return 2===o&&(a+=60),a},qg.hsv.ansi16=function(e){return qg.rgb.ansi16(qg.hsv.rgb(e),e[2])},qg.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},qg.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},qg.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},qg.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},qg.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];3===t[0].length&&(r=r.split("").map(e=>e+e).join(""));const n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},qg.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.max(Math.max(t,r),n),o=Math.min(Math.min(t,r),n),a=i-o;let s,l;return s=a<1?o/(1-a):0,l=a<=0?0:i===t?(r-n)/a%6:i===r?2+(n-t)/a:4+(t-r)/a,l/=6,l%=1,[360*l,100*a,100*s]},qg.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let i=0;return n<1&&(i=(r-.5*n)/(1-n)),[e[0],100*n,100*i]},qg.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},qg.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];const i=[0,0,0],o=t%1*6,a=o%1,s=1-a;let l=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=a,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=a;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=a,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return l=(1-r)*n,[255*(r*i[0]+l),255*(r*i[1]+l),255*(r*i[2]+l)]},qg.hcg.hsv=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);let n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},qg.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},qg.hcg.hwb=function(e){const t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},qg.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,n=r-t;let i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},qg.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},qg.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},qg.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},qg.gray.hsl=function(e){return[0,0,e[0]]},qg.gray.hsv=qg.gray.hsl,qg.gray.hwb=function(e){return[0,100,e[0]]},qg.gray.cmyk=function(e){return[0,0,0,e[0]]},qg.gray.lab=function(e){return[e[0],0,0]},qg.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},qg.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const Xg=Gg;function Kg(e){const t=function(){const e={},t=Object.keys(Xg);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}(),r=[e];for(t[e].distance=0;r.length;){const e=r.pop(),n=Object.keys(Xg[e]);for(let i=n.length,o=0;o<i;o++){const i=n[o],a=t[i];-1===a.distance&&(a.distance=t[e].distance+1,a.parent=e,r.unshift(i))}}return t}function Zg(e,t){return function(r){return t(e(r))}}function Jg(e,t){const r=[t[e].parent,e];let n=Xg[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)r.unshift(t[i].parent),n=Zg(Xg[t[i].parent][i],n),i=t[i].parent;return n.conversion=r,n}const Qg=Gg,em=function(e){const t=Kg(e),r={},n=Object.keys(t);for(let e=n.length,i=0;i<e;i++){const e=n[i];null!==t[e].parent&&(r[e]=Jg(e,t))}return r},tm={};Object.keys(Qg).forEach(e=>{tm[e]={},Object.defineProperty(tm[e],"channels",{value:Qg[e].channels}),Object.defineProperty(tm[e],"labels",{value:Qg[e].labels});const t=em(e);Object.keys(t).forEach(r=>{const n=t[r];tm[e][r]=function(e){const t=function(...t){const r=t[0];if(null==r)return r;r.length>1&&(t=r);const n=e(t);if("object"==typeof n)for(let e=n.length,t=0;t<e;t++)n[t]=Math.round(n[t]);return n};return"conversion"in e&&(t.conversion=e.conversion),t}(n),tm[e][r].raw=function(e){const t=function(...t){const r=t[0];return null==r?r:(r.length>1&&(t=r),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)})});const rm=Hg,nm=tm,im=["keyword","gray","hex"],om={};for(const e of Object.keys(nm))om[[...nm[e].labels].sort().join("")]=e;const am={};function sm(e,t){if(!(this instanceof sm))return new sm(e,t);if(t&&t in im&&(t=null),t&&!(t in nm))throw new Error("Unknown model: "+t);let r,n;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof sm)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=rm.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,n=nm[this.model].channels,this.color=t.value.slice(0,n),this.valpha="number"==typeof t.value[n]?t.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=nm[this.model].channels;const r=Array.prototype.slice.call(e,0,n);this.color=hm(r,n),this.valpha="number"==typeof e[n]?e[n]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const n=t.sort().join("");if(!(n in om))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=om[n];const{labels:i}=nm[this.model],o=[];for(r=0;r<i.length;r++)o.push(e[i[r]]);this.color=hm(o)}if(am[this.model])for(n=nm[this.model].channels,r=0;r<n;r++){const e=am[this.model][r];e&&(this.color[r]=e(this.color[r]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}sm.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in rm.to?this:this.rgb();t=t.round("number"==typeof e?e:1);const r=1===t.valpha?t.color:[...t.color,this.valpha];return rm.to[t.model](r)},percentString(e){const t=this.rgb().round("number"==typeof e?e:1),r=1===t.valpha?t.color:[...t.color,this.valpha];return rm.to.rgb.percent(r)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=nm[this.model],{labels:r}=nm[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];return 1!==this.valpha&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,1!==this.valpha&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,1!==this.valpha&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new sm([...this.color.map(lm(e)),this.valpha],this.model)},alpha(e){return void 0!==e?new sm([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:cm("rgb",0,um(255)),green:cm("rgb",1,um(255)),blue:cm("rgb",2,um(255)),hue:cm(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:cm("hsl",1,um(100)),lightness:cm("hsl",2,um(100)),saturationv:cm("hsv",1,um(100)),value:cm("hsv",2,um(100)),chroma:cm("hcg",1,um(100)),gray:cm("hcg",2,um(100)),white:cm("hwb",1,um(100)),wblack:cm("hwb",2,um(100)),cyan:cm("cmyk",0,um(100)),magenta:cm("cmyk",1,um(100)),yellow:cm("cmyk",2,um(100)),black:cm("cmyk",3,um(100)),x:cm("xyz",0,um(95.047)),y:cm("xyz",1,um(100)),z:cm("xyz",2,um(108.833)),l:cm("lab",0,um(100)),a:cm("lab",1),b:cm("lab",2),keyword(e){return void 0!==e?new sm(e):nm[this.model].keyword(this.color)},hex(e){return void 0!==e?new sm(e):rm.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new sm(e);const t=this.rgb().round().color;let r=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===r.length&&(r="0"+r),rm.to.hex(t)+r},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[r,n]of e.entries()){const e=n/255;t[r]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),r=e.luminosity();return t>r?(t+.05)/(r+.05):(r+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return sm.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const r=e.rgb(),n=this.rgb(),i=void 0===t?.5:t,o=2*i-1,a=r.alpha()-n.alpha(),s=((o*a===-1?o:(o+a)/(1+o*a))+1)/2,l=1-s;return sm.rgb(s*r.red()+l*n.red(),s*r.green()+l*n.green(),s*r.blue()+l*n.blue(),r.alpha()*i+n.alpha()*(1-i))}};for(const e of Object.keys(nm)){if(im.includes(e))continue;const{channels:t}=nm[e];sm.prototype[e]=function(...t){return this.model===e?new sm(this):t.length>0?new sm(t,e):new sm([...dm(nm[this.model][e].raw(this.color)),this.valpha],e)},sm[e]=function(...r){let n=r[0];return"number"==typeof n&&(n=hm(r,t)),new sm(n,e)}}function lm(e){return function(t){return function(e,t){return Number(e.toFixed(t))}(t,e)}}function cm(e,t,r){e=Array.isArray(e)?e:[e];for(const n of e)(am[n]||(am[n]=[]))[t]=r;return e=e[0],function(n){let i;return void 0!==n?(r&&(n=r(n)),i=this[e](),i.color[t]=n,i):(i=this[e]().color[t],r&&(i=r(i)),i)}}function um(e){return function(t){return Math.max(0,Math.min(e,t))}}function dm(e){return Array.isArray(e)?e:[e]}function hm(e,t){for(let r=0;r<t;r++)"number"!=typeof e[r]&&(e[r]=0);return e}const fm=qh(sm);function pm(e){return e.endsWith("%")||3===e.split(" ").length?e:fm(e).rgb().array().slice(0,3).join(" ")}let gm=typeof document<"u"?document.getElementById("root")??document.body:void 0,mm=typeof document<"u"?document.documentElement:void 0;function vm(e){Object.entries(e.values).forEach(([e,t])=>{!function(e,t){null==mm||mm.style.setProperty(e,t)}(e,t)}),e.is_dark?mm.classList.add("dark"):mm.classList.remove("dark")}const ym=ap()(e=>({data:typeof window<"u"&&window.bootstrapData?wm(window.bootstrapData):null,setData:t=>{const r="string"==typeof t?wm(t):t;e({data:r})},mergeData:t=>{e(e=>({data:{...e.data,...t}}))}}));ym.getState().setData;const bm=ym.getState().mergeData;function wm(e){return"string"==typeof e?JSON.parse(e):e}const xm={top:0,right:0,bottom:0,left:0,width:0,height:0},Cm=ap()(sp(Eg((e,t)=>({editor:null,fabric:null,config:Pf,zoom:1,dirty:!1,original:{width:1,height:1},stageSize:xm,canvasSize:xm,canvasRef:null,activeTool:null,activeToolOverlay:null,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1},...lg(e,t),...bg(e,t),...dg(e,t),...fg(e,t),...xg(e,t),..._g(e,t),...Ag(e,t),setZoom:t=>e(e=>{e.zoom=t}),setOriginal:(t,r)=>e(e=>{e.original={width:t,height:r}}),setDirty:t=>e(e=>{e.dirty=t}),toggleLoading:t=>e(e=>{e.loading=t}),setStageSize:t=>e(e=>{e.stageSize=t}),setCanvasSize:t=>e(e=>{e.canvasSize=t}),setActiveTool:(t,r)=>{e(e=>{e.activeTool=t,e.activeToolOverlay=r})},setConfig:r=>e(e=>{var n,i;const o=ag(r,t().config);e.config=o;const a=o.activeLanguage||"en",s=null==(n=o.languages)?void 0:n[a],l=((null==(i=o.ui)?void 0:i.themes)||[]).map(e=>function(e){const t=e.isDark?rf.find(e=>e.isDark):rf.find(e=>!e.isDark),r={...t,...e,colors:{...null==t?void 0:t.colors,...e.colors}},n=Object.entries(r.colors).map(([e,t])=>[e,pm(t)]);return{id:r.name,name:r.name,values:Object.fromEntries(n),is_dark:r.isDark}}(e)),c=l.find(e=>{var t;return e.id===(null==(t=o.ui)?void 0:t.activeTheme)});c&&vm(c),bm({i18n:{language:a,name:a,id:0,lines:s},themes:{all:l}})}),togglePanel:(t,r)=>e(e=>{e.openPanels[t]=r??!e.openPanels[t]}),applyChanges:async()=>{var r;const n=t().activeTool;if(!n)return;const i=t()[n],o=await(null==(r=null==i?void 0:i.apply)?void 0:r.call(i));e(e=>{e.dirty=!1,e.activeTool=null,e.activeToolOverlay=null}),!1!==o&&t().editor.tools.history.addHistoryItem({name:n}),null==i||i.reset()},cancelChanges:async()=>{const r=t().activeTool;if(!r)return;const n=t().dirty;e(e=>{e.dirty=!1,e.activeTool=null,e.activeToolOverlay=null}),n&&await t().editor.tools.history.reload();const i=t()[r];null==i||i.reset()},reset:()=>{t().editor.tools.transform.resetStraightenAnchor(),e({activeTool:null,activeToolOverlay:null,zoom:1,dirty:!1,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1}}),t().history.reset(),t().objects.reset(),t().filter.reset(),t().crop.reset(),t().frame.reset(),t().resize.reset(),t().corners.reset()}}))));function _m(){return Cm.getState()}function Sm(){return _m().editor.tools}function Am(){return _m().fabric}function km(e){var t,r,n,i,o;Sm().canvas.clear(),Sm().frame.remove();const a=!(null!=(t=_m().config.ui)&&t.visible);return _m().setConfig({image:void 0,blankCanvasSize:void 0,...e}),_m().reset(),null!=(r=_m().config.ui)&&r.defaultTool&&_m().setActiveTool(null==(n=_m().config.ui)?void 0:n.defaultTool,null),a&&(null==(o=(i=_m().config).onOpen)||o.call(i)),new Promise(e=>setTimeout(e))}async function Em(e){return(await fetch(e)).json()}const Im={selectable:!1,evented:!1,lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0,lockUniScaling:!0,hasControls:!1,hasBorders:!1,hasRotatingPoint:!1,strokeWidth:0};function Tm(e=[]){var t;e=[...Object.keys(Im),"crossOrigin","name","displayName","data",...e];const r=Am().toJSON(e);r.objects=r.objects.filter(e=>!e.data.pixieInternal).map(e=>("image"===e.type&&_m().config.crossOrigin&&(e.crossOrigin="anonymous"),gg(e)&&(e.selectable=!0,e.lockMovementX=!1,e.lockMovementY=!1,e.lockUniScaling=!1),{...e,data:e.data?{...e.data}:{}}));return{canvas:r,editor:{frame:Sm().frame.active.config?{name:Sm().frame.active.config.name,sizePercent:Sm().frame.active.currentSizeInPercent}:null,zoom:_m().zoom,activeObjectId:(null==(t=_m().objects.active)?void 0:t.id)||null},canvasWidth:_m().original.width,canvasHeight:_m().original.height}}function Fm(e=null){if(_m().dirty)return;Sm().zoom.fitToScreen();const[t,r]=Om(Am().getActiveObject());e?_m().setActiveTool(e,t===e?r:null):_m().setActiveTool(t,r)}function Om(e){switch(null==e?void 0:e.name){case mg.Text:return[nf.TEXT,ug.Text];case mg.Sticker:return[nf.STICKERS,ug.ActiveObject];case mg.Image:return[null,ug.ActiveObject];case mg.Shape:return[nf.SHAPES,ug.ActiveObject];default:return[null,null]}}let Pm=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t};class Mm{constructor(e,t){ml(this,"timerId"),ml(this,"createdAt",0),this.callback=e,this.remaining=t,this.resume()}pause(){clearTimeout(this.timerId),this.remaining-=Date.now()-this.createdAt}resume(){this.createdAt=Date.now(),this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(this.callback,this.remaining)}clear(){clearTimeout(this.timerId)}}const Rm=ap()(Eg((e,t)=>({toasts:[],add:(r,n)=>{const i=t().toasts.length+1-1;i>0&&e(e=>{e.toasts.splice(0,i)});const o=(null==n?void 0:n.id)||Pm(6),a=(null==n?void 0:n.type)||"positive",s=(null==n?void 0:n.duration)??function(e){switch(e){case"danger":return 8e3;case"loading":return 0;default:return 3e3}}(a),l={timer:s>0?new Mm(()=>t().remove(o),s):null,message:r,...n,id:o,type:a,position:(null==n?void 0:n.position)||"bottom-center",duration:s,disableExitAnimation:null==n?void 0:n.disableExitAnimation,disableEnterAnimation:null==n?void 0:n.disableEnterAnimation},c=t().toasts.findIndex(e=>e.id===l.id);e(c>-1?e=>{e.toasts[c]=l}:e=>{e.toasts.push(l)})},remove:r=>{const n=t().toasts.filter(e=>{var t;return r!==e.id||(null==(t=e.timer)||t.clear(),!1)});e(e=>{e.toasts=n})}})));function Lm(){return Rm.getState()}function Nm(e,t){Lm().add(e,t)}Nm.danger=(e,t)=>{Lm().add(e,{...t,type:"danger"})},Nm.positive=(e,t)=>{Lm().add(e,{...t,type:"positive"})},Nm.loading=(e,t)=>{Lm().add(e,{...t,type:"loading"})};const jm=s({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),Dm=s({}),zm=s(null),Bm=typeof document<"u",Um=Bm?x:a,Vm=s({strict:!1}),Hm=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),Wm="data-"+Hm("framerAppearId");function $m(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function qm(e){return"string"==typeof e||Array.isArray(e)}function Gm(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}const Ym=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Xm=["initial",...Ym];function Km(e){return Gm(e.animate)||Xm.some(t=>qm(e[t]))}function Zm(e){return!(!Km(e)&&!e.variants)}function Jm(e){const{initial:t,animate:r}=function(e,t){if(Km(e)){const{initial:t,animate:r}=e;return{initial:!1===t||qm(t)?t:void 0,animate:qm(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,l(Dm));return d(()=>({initial:t,animate:r}),[Qm(t),Qm(r)])}function Qm(e){return Array.isArray(e)?e.join(" "):e}const ev={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"]},tv={};for(const e in ev)tv[e]={isEnabled:t=>ev[e].some(e=>!!t[e])};function rv(e){for(const t in e)tv[t]={...tv[t],...e[t]}}const nv=s({}),iv=s({}),ov=Symbol.for("motionComponentSymbol");function av({preloadedFeatures:e,createVisualElement:t,useRender:r,useVisualState:i,Component:o}){e&&rv(e);const s=p(function(s,d){let h;const f={...l(jm),...s,layoutId:sv(s)},{isStatic:p}=f,g=Jm(s),m=i(s,p);if(!p&&Bm){g.visualElement=function(e,t,r,n){const{visualElement:i}=l(Dm),o=l(Vm),s=l(zm),c=l(jm).reducedMotion,d=u();n=n||o.renderer,!d.current&&n&&(d.current=n(e,{visualState:t,parent:i,props:r,presenceContext:s,blockInitialAnimation:!!s&&!1===s.initial,reducedMotionConfig:c}));const h=d.current;C(()=>{h&&h.update(r,s)});const f=u(!(!r[Wm]||window.HandoffComplete));return Um(()=>{h&&(h.render(),f.current&&h.animationState&&h.animationState.animateChanges())}),a(()=>{h&&(h.updateFeatures(),!f.current&&h.animationState&&h.animationState.animateChanges(),f.current&&(f.current=!1,window.HandoffComplete=!0))}),h}(o,m,f,t);const r=l(iv),n=l(Vm).strict;g.visualElement&&(h=g.visualElement.loadFeatures(f,n,e,r))}return n.createElement(Dm.Provider,{value:g},h&&g.visualElement?n.createElement(h,{visualElement:g.visualElement,...f}):null,r(o,s,function(e,t,r){return c(n=>{n&&e.mount&&e.mount(n),t&&(n?t.mount(n):t.unmount()),r&&("function"==typeof r?r(n):$m(r)&&(r.current=n))},[t])}(m,g.visualElement,d),m,p,g.visualElement))});return s[ov]=o,s}function sv({layoutId:e}){const t=l(nv).id;return t&&void 0!==e?t+"-"+e:e}const lv=["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 cv(e){return"string"==typeof e&&!e.includes("-")&&!!(lv.indexOf(e)>-1||/[A-Z]/.test(e))}const uv={},dv=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],hv=new Set(dv);function fv(e,{layout:t,layoutId:r}){return hv.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!uv[e]||"opacity"===e)}const pv=e=>!(!e||!e.getVelocity),gv={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},mv=dv.length;const vv=e=>t=>"string"==typeof t&&t.startsWith(e),yv=vv("--"),bv=vv("var(--"),wv=(e,t)=>t&&"number"==typeof e?t.transform(e):e,xv=(e,t,r)=>Math.min(Math.max(r,e),t),Cv={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},_v={...Cv,transform:e=>xv(0,1,e)},Sv={...Cv,default:1},Av=e=>Math.round(1e5*e)/1e5,kv=/(-)?([\d]*\.?[\d])+/g,Ev=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Iv=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Tv(e){return"string"==typeof e}const Fv=e=>({test:t=>Tv(t)&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),Ov=Fv("deg"),Pv=Fv("%"),Mv=Fv("px"),Rv=Fv("vh"),Lv=Fv("vw"),Nv={...Pv,parse:e=>Pv.parse(e)/100,transform:e=>Pv.transform(100*e)},jv={...Cv,transform:Math.round},Dv={borderWidth:Mv,borderTopWidth:Mv,borderRightWidth:Mv,borderBottomWidth:Mv,borderLeftWidth:Mv,borderRadius:Mv,radius:Mv,borderTopLeftRadius:Mv,borderTopRightRadius:Mv,borderBottomRightRadius:Mv,borderBottomLeftRadius:Mv,width:Mv,maxWidth:Mv,height:Mv,maxHeight:Mv,size:Mv,top:Mv,right:Mv,bottom:Mv,left:Mv,padding:Mv,paddingTop:Mv,paddingRight:Mv,paddingBottom:Mv,paddingLeft:Mv,margin:Mv,marginTop:Mv,marginRight:Mv,marginBottom:Mv,marginLeft:Mv,rotate:Ov,rotateX:Ov,rotateY:Ov,rotateZ:Ov,scale:Sv,scaleX:Sv,scaleY:Sv,scaleZ:Sv,skew:Ov,skewX:Ov,skewY:Ov,distance:Mv,translateX:Mv,translateY:Mv,translateZ:Mv,x:Mv,y:Mv,z:Mv,perspective:Mv,transformPerspective:Mv,opacity:_v,originX:Nv,originY:Nv,originZ:Mv,zIndex:jv,fillOpacity:_v,strokeOpacity:_v,numOctaves:jv};function zv(e,t,r,n){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,c=!1,u=!0;for(const e in t){const r=t[e];if(yv(e)){o[e]=r;continue}const n=Dv[e],d=wv(r,n);if(hv.has(e)){if(l=!0,a[e]=d,!u)continue;r!==(n.default||0)&&(u=!1)}else e.startsWith("origin")?(c=!0,s[e]=d):i[e]=d}if(t.transform||(l||n?i.transform=function(e,{enableHardwareAcceleration:t=!0,allowTransformNone:r=!0},n,i){let o="";for(let t=0;t<mv;t++){const r=dv[t];void 0!==e[r]&&(o+=`${gv[r]||r}(${e[r]}) `)}return t&&!e.z&&(o+="translateZ(0)"),o=o.trim(),i?o=i(e,n?"":o):r&&n&&(o="none"),o}(e.transform,r,u,n):i.transform&&(i.transform="none")),c){const{originX:e="50%",originY:t="50%",originZ:r=0}=s;i.transformOrigin=`${e} ${t} ${r}`}}const Bv=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Uv(e,t,r){for(const n in t)!pv(t[n])&&!fv(n,r)&&(e[n]=t[n])}function Vv(e,t,r){const n={};return Uv(n,e.style||{},e),Object.assign(n,function({transformTemplate:e},t,r){return d(()=>{const n={style:{},transform:{},transformOrigin:{},vars:{}};return zv(n,t,{enableHardwareAcceleration:!r},e),Object.assign({},n.vars,n.style)},[t])}(e,t,r)),e.transformValues?e.transformValues(n):n}function Hv(e,t,r){const n={},i=Vv(e,t,r);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===e.drag?"none":"pan-"+("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const Wv=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function $v(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Wv.has(e)}let qv=e=>!$v(e);try{!function(e){e&&(qv=t=>t.startsWith("on")?!$v(t):e(t))}(require("@emotion/is-prop-valid").default)}catch{}function Gv(e,t,r){const n={};for(const i in e)"values"===i&&"object"==typeof e.values||(qv(i)||!0===r&&$v(i)||!t&&!$v(i)||e.draggable&&i.startsWith("onDrag"))&&(n[i]=e[i]);return n}function Yv(e,t,r){return"string"==typeof e?e:Mv.transform(t+r*e)}const Xv={offset:"stroke-dashoffset",array:"stroke-dasharray"},Kv={offset:"strokeDashoffset",array:"strokeDasharray"};function Zv(e,{attrX:t,attrY:r,attrScale:n,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...c},u,d,h){if(zv(e,c,u,h),d)return void(e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox));e.attrs=e.style,e.style={};const{attrs:f,style:p,dimensions:g}=e;f.transform&&(g&&(p.transform=f.transform),delete f.transform),g&&(void 0!==i||void 0!==o||p.transform)&&(p.transformOrigin=function(e,t,r){return`${Yv(t,e.x,e.width)} ${Yv(r,e.y,e.height)}`}(g,void 0!==i?i:.5,void 0!==o?o:.5)),void 0!==t&&(f.x=t),void 0!==r&&(f.y=r),void 0!==n&&(f.scale=n),void 0!==a&&function(e,t,r=1,n=0,i=!0){e.pathLength=1;const o=i?Xv:Kv;e[o.offset]=Mv.transform(-n);const a=Mv.transform(t),s=Mv.transform(r);e[o.array]=`${a} ${s}`}(f,a,s,l,!1)}const Jv=()=>({style:{},transform:{},transformOrigin:{},vars:{},attrs:{}}),Qv=e=>"string"==typeof e&&"svg"===e.toLowerCase();function ey(e,t,r,n){const i=d(()=>{const r={style:{},transform:{},transformOrigin:{},vars:{},attrs:{}};return Zv(r,t,{enableHardwareAcceleration:!1},Qv(n),e.transformTemplate),{...r.attrs,style:{...r.style}}},[t]);if(e.style){const t={};Uv(t,e.style,e),i.style={...t,...i.style}}return i}function ty(e=!1){return(t,r,n,{latestValues:i},o)=>{const a=(cv(t)?ey:Hv)(r,i,o,t),s={...Gv(r,"string"==typeof t,e),...a,ref:n},{children:l}=r,c=d(()=>pv(l)?l.get():l,[l]);return h(t,{...s,children:c})}}function ry(e,{style:t,vars:r},n,i){Object.assign(e.style,t,i&&i.getProjectionStyles(n));for(const t in r)e.style.setProperty(t,r[t])}const ny=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 iy(e,t,r,n){ry(e,t,void 0,n);for(const r in t.attrs)e.setAttribute(ny.has(r)?r:Hm(r),t.attrs[r])}function oy(e,t){const{style:r}=e,n={};for(const i in r)(pv(r[i])||t.style&&pv(t.style[i])||fv(i,e))&&(n[i]=r[i]);return n}function ay(e,t){const r=oy(e,t);for(const n in e)if(pv(e[n])||pv(t[n])){r[-1!==dv.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]}return r}function sy(e,t,r,n={},i={}){return"function"==typeof t&&(t=t(void 0!==r?r:e.custom,n,i)),"string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t&&(t=t(void 0!==r?r:e.custom,n,i)),t}function ly(e){const t=u(null);return null===t.current&&(t.current=e()),t.current}const cy=e=>Array.isArray(e),uy=e=>cy(e)?e[e.length-1]||0:e;function dy(e){const t=pv(e)?e.get():e;return(e=>!!(e&&"object"==typeof e&&e.mix&&e.toValue))(t)?t.toValue():t}const hy=e=>(t,r)=>{const n=l(Dm),i=l(zm),o=()=>function({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:r},n,i,o){const a={latestValues:fy(n,i,o,e),renderState:t()};return r&&(a.mount=e=>r(n,e,a)),a}(e,t,n,i);return r?o():ly(o)};function fy(e,t,r,n){const i={},o=n(e,{});for(const e in o)i[e]=dy(o[e]);let{initial:a,animate:s}=e;const l=Km(e),c=Zm(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===s&&(s=t.animate));let u=!!r&&!1===r.initial;u=u||!1===a;const d=u?s:a;return d&&"boolean"!=typeof d&&!Gm(d)&&(Array.isArray(d)?d:[d]).forEach(t=>{const r=sy(e,t);if(!r)return;const{transitionEnd:n,transition:o,...a}=r;for(const e in a){let t=a[e];if(Array.isArray(t)){t=t[u?t.length-1:0]}null!==t&&(i[e]=t)}for(const e in n)i[e]=n[e]}),i}const py=e=>e;class gy{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const t=this.order.indexOf(e);-1!==t&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}const my=["prepare","read","update","preRender","render","postRender"];const{schedule:vy,cancel:yy,state:by}=function(e,t){let r=!1,n=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=my.reduce((e,t)=>(e[t]=function(e){let t=new gy,r=new gy,n=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(e,o=!1,s=!1)=>{const l=s&&i,c=l?t:r;return o&&a.add(e),c.add(e)&&l&&i&&(n=t.order.length),e},cancel:e=>{r.remove(e),a.delete(e)},process:l=>{if(i)o=!0;else{if(i=!0,[t,r]=[r,t],r.clear(),n=t.order.length,n)for(let r=0;r<n;r++){const n=t.order[r];n(l),a.has(n)&&(s.schedule(n),e())}i=!1,o&&(o=!1,s.process(l))}}};return s}(()=>r=!0),e),{}),a=e=>o[e].process(i),s=()=>{const o=performance.now();r=!1,i.delta=n?1e3/60:Math.max(Math.min(o-i.timestamp,40),1),i.timestamp=o,i.isProcessing=!0,my.forEach(a),i.isProcessing=!1,r&&t&&(n=!1,e(s))};return{schedule:my.reduce((t,a)=>{const l=o[a];return t[a]=(t,o=!1,a=!1)=>(r||(r=!0,n=!0,i.isProcessing||e(s)),l.schedule(t,o,a)),t},{}),cancel:e=>my.forEach(t=>o[t].cancel(e)),state:i,steps:o}}(typeof requestAnimationFrame<"u"?requestAnimationFrame:py,!0),wy={useVisualState:hy({scrapeMotionValuesFromProps:ay,createRenderState:Jv,onMount:(e,t,{renderState:r,latestValues:n})=>{vy.read(()=>{try{r.dimensions="function"==typeof t.getBBox?t.getBBox():t.getBoundingClientRect()}catch{r.dimensions={x:0,y:0,width:0,height:0}}}),vy.render(()=>{Zv(r,n,{enableHardwareAcceleration:!1},Qv(t.tagName),e.transformTemplate),iy(t,r)})}})},xy={useVisualState:hy({scrapeMotionValuesFromProps:oy,createRenderState:Bv})};function Cy(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}function _y(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}function Sy(e,t,r,n){return Cy(e,t,(e=>t=>(e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary)(t)&&e(t,_y(t)))(r),n)}const Ay=(e,t)=>r=>t(e(r)),ky=(...e)=>e.reduce(Ay);function Ey(e){let t=null;return()=>null===t&&(t=e,()=>{t=null})}const Iy=Ey("dragHorizontal"),Ty=Ey("dragVertical");function Fy(){const e=function(){let e=!1;{const t=Iy(),r=Ty();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}();return!e||(e(),!1)}class Oy{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Py(e,t){const r="pointer"+(t?"enter":"leave"),n="onHover"+(t?"Start":"End");return Sy(e.current,r,(r,i)=>{if("touch"===r.pointerType||Fy())return;const o=e.getProps();e.animationState&&o.whileHover&&e.animationState.setActive("whileHover",t),o[n]&&vy.update(()=>o[n](r,i))},{passive:!e.getProps()[n]})}const My=(e,t)=>!!t&&(e===t||My(e,t.parentElement));function Ry(e,t){if(!t)return;const r=new PointerEvent("pointer"+e);t(r,_y(r))}const Ly=new WeakMap,Ny=new WeakMap,jy=e=>{const t=Ly.get(e.target);t&&t(e)},Dy=e=>{e.forEach(jy)};function zy(e,t,r){const n=function({root:e,...t}){const r=e||document;Ny.has(r)||Ny.set(r,{});const n=Ny.get(r),i=JSON.stringify(t);return n[i]||(n[i]=new IntersectionObserver(Dy,{root:e,...t})),n[i]}(t);return Ly.set(e,r),n.observe(e),()=>{Ly.delete(e),n.unobserve(e)}}const By={some:0,all:1};const Uy={inView:{Feature:class extends Oy{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:n="some",once:i}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:"number"==typeof n?n:By[n]};return zy(this.node.current,o,e=>{const{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),o=t?r:n;o&&o(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Oy{constructor(){super(...arguments),this.removeStartListeners=py,this.removeEndListeners=py,this.removeAccessibleListeners=py,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),n=Sy(window,"pointerup",(e,t)=>{if(!this.checkPressEnd())return;const{onTap:r,onTapCancel:n,globalTapTarget:i}=this.node.getProps();vy.update(()=>{i||My(this.node.current,e.target)?r&&r(e,t):n&&n(e,t)})},{passive:!(r.onTap||r.onPointerUp)}),i=Sy(window,"pointercancel",(e,t)=>this.cancelPress(e,t),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=ky(n,i),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=Cy(this.node.current,"keydown",e=>{if("Enter"!==e.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=Cy(this.node.current,"keyup",e=>{"Enter"!==e.key||!this.checkPressEnd()||Ry("up",(e,t)=>{const{onTap:r}=this.node.getProps();r&&vy.update(()=>r(e,t))})}),Ry("down",(e,t)=>{this.startPress(e,t)})}),t=Cy(this.node.current,"blur",()=>{this.isPressing&&Ry("cancel",(e,t)=>this.cancelPress(e,t))});this.removeAccessibleListeners=ky(e,t)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:n}=this.node.getProps();n&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&vy.update(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Fy()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&vy.update(()=>r(e,t))}mount(){const e=this.node.getProps(),t=Sy(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Cy(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=ky(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends Oy{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{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=ky(Cy(this.node.current,"focus",()=>this.onFocus()),Cy(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Oy{mount(){this.unmount=ky(Py(this.node,!0),Py(this.node,!1))}unmount(){}}}};function Vy(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Hy(e,t,r){const n=e.getProps();return sy(n,t,void 0!==r?r:n.custom,function(e){const t={};return e.values.forEach((e,r)=>t[r]=e.get()),t}(e),function(e){const t={};return e.values.forEach((e,r)=>t[r]=e.getVelocity()),t}(e))}let Wy=py;const $y=e=>1e3*e,qy=e=>e/1e3,Gy=!1,Yy=e=>Array.isArray(e)&&"number"==typeof e[0];function Xy(e){return!!(!e||"string"==typeof e&&Zy[e]||Yy(e)||Array.isArray(e)&&e.every(Xy))}const Ky=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,Zy={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ky([0,.65,.55,1]),circOut:Ky([.55,0,1,.45]),backIn:Ky([.31,.01,.66,-.59]),backOut:Ky([.33,1.53,.69,.99])};function Jy(e){if(e)return Yy(e)?Ky(e):Array.isArray(e)?e.map(Jy):Zy[e]}const Qy=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function eb(e,t,r,n){if(e===t&&r===n)return py;const i=t=>function(e,t,r,n,i){let o,a,s=0;do{a=t+(r-t)/2,o=Qy(a,n,i)-e,o>0?r=a:t=a}while(Math.abs(o)>1e-7&&++s<12);return a}(t,0,1,e,r);return e=>0===e||1===e?e:Qy(i(e),t,n)}const tb=eb(.42,0,1,1),rb=eb(0,0,.58,1),nb=eb(.42,0,.58,1),ib=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,ob=e=>t=>1-e(1-t),ab=e=>1-Math.sin(Math.acos(e)),sb=ob(ab),lb=ib(ab),cb=eb(.33,1.53,.69,.99),ub=ob(cb),db=ib(ub),hb={linear:py,easeIn:tb,easeInOut:nb,easeOut:rb,circIn:ab,circInOut:lb,circOut:sb,backIn:ub,backInOut:db,backOut:cb,anticipate:e=>(e*=2)<1?.5*ub(e):.5*(2-Math.pow(2,-10*(e-1)))},fb=e=>{if(Array.isArray(e)){Wy(4===e.length);const[t,r,n,i]=e;return eb(t,r,n,i)}return"string"==typeof e?hb[e]:e},pb=(e,t)=>r=>!!(Tv(r)&&Iv.test(r)&&r.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(r,t)),gb=(e,t,r)=>n=>{if(!Tv(n))return n;const[i,o,a,s]=n.match(kv);return{[e]:parseFloat(i),[t]:parseFloat(o),[r]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},mb={...Cv,transform:e=>Math.round((e=>xv(0,255,e))(e))},vb={test:pb("rgb","red"),parse:gb("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+mb.transform(e)+", "+mb.transform(t)+", "+mb.transform(r)+", "+Av(_v.transform(n))+")"};const yb={test:pb("#"),parse:function(e){let t="",r="",n="",i="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),i=e.substring(4,5),t+=t,r+=r,n+=n,i+=i),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:i?parseInt(i,16)/255:1}},transform:vb.transform},bb={test:pb("hsl","hue"),parse:gb("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+Pv.transform(Av(t))+", "+Pv.transform(Av(r))+", "+Av(_v.transform(n))+")"},wb={test:e=>vb.test(e)||yb.test(e)||bb.test(e),parse:e=>vb.test(e)?vb.parse(e):bb.test(e)?bb.parse(e):yb.parse(e),transform:e=>Tv(e)?e:e.hasOwnProperty("red")?vb.transform(e):bb.transform(e)},xb=(e,t,r)=>-r*e+r*t+e;function Cb(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}const _b=(e,t,r)=>{const n=e*e;return Math.sqrt(Math.max(0,r*(t*t-n)+n))},Sb=[yb,vb,bb];function Ab(e){const t=(e=>Sb.find(t=>t.test(e)))(e);let r=t.parse(e);return t===bb&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let i=0,o=0,a=0;if(t/=100){const n=r<.5?r*(1+t):r+t-r*t,s=2*r-n;i=Cb(s,n,e+1/3),o=Cb(s,n,e),a=Cb(s,n,e-1/3)}else i=o=a=r;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*a),alpha:n}}(r)),r}const kb=(e,t)=>{const r=Ab(e),n=Ab(t),i={...r};return e=>(i.red=_b(r.red,n.red,e),i.green=_b(r.green,n.green,e),i.blue=_b(r.blue,n.blue,e),i.alpha=xb(r.alpha,n.alpha,e),vb.transform(i))};const Eb={regex:/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,countKey:"Vars",token:"${v}",parse:py},Ib={regex:Ev,countKey:"Colors",token:"${c}",parse:wb.parse},Tb={regex:kv,countKey:"Numbers",token:"${n}",parse:Cv.parse};function Fb(e,{regex:t,countKey:r,token:n,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+r]=o.length,e.tokenised=e.tokenised.replace(t,n),e.values.push(...o.map(i)))}function Ob(e){const t=e.toString(),r={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return r.value.includes("var(--")&&Fb(r,Eb),Fb(r,Ib),Fb(r,Tb),r}function Pb(e){return Ob(e).values}function Mb(e){const{values:t,numColors:r,numVars:n,tokenised:i}=Ob(e),o=t.length;return e=>{let t=i;for(let i=0;i<o;i++)t=i<n?t.replace(Eb.token,e[i]):i<n+r?t.replace(Ib.token,wb.transform(e[i])):t.replace(Tb.token,Av(e[i]));return t}}const Rb=e=>"number"==typeof e?0:e;const Lb={test:function(e){var t,r;return isNaN(e)&&Tv(e)&&((null===(t=e.match(kv))||void 0===t?void 0:t.length)||0)+((null===(r=e.match(Ev))||void 0===r?void 0:r.length)||0)>0},parse:Pb,createTransformer:Mb,getAnimatableNone:function(e){const t=Pb(e);return Mb(e)(t.map(Rb))}},Nb=(e,t)=>r=>`${r>0?t:e}`;function jb(e,t){return"number"==typeof e?r=>xb(e,t,r):wb.test(e)?kb(e,t):e.startsWith("var(")?Nb(e,t):Bb(e,t)}const Db=(e,t)=>{const r=[...e],n=r.length,i=e.map((e,r)=>jb(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=i[t](e);return r}},zb=(e,t)=>{const r={...e,...t},n={};for(const i in r)void 0!==e[i]&&void 0!==t[i]&&(n[i]=jb(e[i],t[i]));return e=>{for(const t in n)r[t]=n[t](e);return r}},Bb=(e,t)=>{const r=Lb.createTransformer(t),n=Ob(e),i=Ob(t);return n.numVars===i.numVars&&n.numColors===i.numColors&&n.numNumbers>=i.numNumbers?ky(Db(n.values,i.values),r):Nb(e,t)},Ub=(e,t,r)=>{const n=t-e;return 0===n?1:(r-e)/n},Vb=(e,t)=>r=>xb(e,t,r);function Hb(e,t,r){const n=[],i=r||function(e){return"number"==typeof e?Vb:"string"==typeof e?wb.test(e)?kb:Bb:Array.isArray(e)?Db:"object"==typeof e?zb:Vb}(e[0]),o=e.length-1;for(let r=0;r<o;r++){let o=i(e[r],e[r+1]);if(t){const e=Array.isArray(t)?t[r]||py:t;o=ky(e,o)}n.push(o)}return n}function Wb(e,t,{clamp:r=!0,ease:n,mixer:i}={}){const o=e.length;if(Wy(o===t.length),1===o)return()=>t[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Hb(t,n,i),s=a.length,l=t=>{let r=0;if(s>1)for(;r<e.length-2&&!(t<e[r+1]);r++);const n=Ub(e[r],e[r+1],t);return a[r](n)};return r?t=>l(xv(e[0],e[o-1],t)):l}function $b(e){const t=[0];return function(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const i=Ub(0,t,n);e.push(xb(r,1,i))}}(t,e.length-1),t}function qb(e,t){return e.map(()=>t||nb).splice(0,e.length-1)}function Gb({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const i=(e=>Array.isArray(e)&&"number"!=typeof e[0])(n)?n.map(fb):fb(n),o={done:!1,value:t[0]},a=function(e,t){return e.map(e=>e*t)}(r&&r.length===t.length?r:$b(t),e),s=Wb(a,t,{ease:Array.isArray(i)?i:qb(t,i)});return{calculatedDuration:e,next:t=>(o.value=s(t),o.done=t>=e,o)}}function Yb(e,t){return t?e*(1e3/t):0}function Xb(e,t,r){const n=Math.max(t-5,0);return Yb(r-e(n),t-n)}const Kb=.001;function Zb({duration:e=800,bounce:t=.25,velocity:r=0,mass:n=1}){let i,o,a=1-t;a=xv(.05,1,a),e=xv(.01,10,qy(e)),a<1?(i=t=>{const n=t*a,i=n*e,o=n-r,s=Qb(t,a),l=Math.exp(-i);return Kb-o/s*l},o=t=>{const n=t*a*e,o=n*r+r,s=Math.pow(a,2)*Math.pow(t,2)*e,l=Math.exp(-n),c=Qb(Math.pow(t,2),a);return(-i(t)+Kb>0?-1:1)*((o-s)*l)/c}):(i=t=>Math.exp(-t*e)*((t-r)*e+1)-Kb,o=t=>Math.exp(-t*e)*(e*e*(r-t)));const s=function(e,t,r){let n=r;for(let r=1;r<Jb;r++)n-=e(n)/t(n);return n}(i,o,5/e);if(e=$y(e),isNaN(s))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(s,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}const Jb=12;function Qb(e,t){return e*Math.sqrt(1-t*t)}const ew=["duration","bounce"],tw=["stiffness","damping","mass"];function rw(e,t){return t.some(t=>void 0!==e[t])}function nw({keyframes:e,restDelta:t,restSpeed:r,...n}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,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(!rw(e,tw)&&rw(e,ew)){const r=Zb(e);t={...t,...r,mass:1},t.isResolvedFromDuration=!0}return t}({...n,velocity:-qy(n.velocity||0)}),f=d||0,p=l/(2*Math.sqrt(s*c)),g=o-i,m=qy(Math.sqrt(s/c)),v=Math.abs(g)<5;let y;if(r||(r=v?.01:2),t||(t=v?.005:.5),p<1){const e=Qb(m,p);y=t=>{const r=Math.exp(-p*m*t);return o-r*((f+p*m*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}}else if(1===p)y=e=>o-Math.exp(-m*e)*(g+(f+m*g)*e);else{const e=m*Math.sqrt(p*p-1);y=t=>{const r=Math.exp(-p*m*t),n=Math.min(e*t,300);return o-r*((f+p*m*g)*Math.sinh(n)+e*g*Math.cosh(n))/e}}return{calculatedDuration:h&&u||null,next:e=>{const n=y(e);if(h)a.done=e>=u;else{let i=f;0!==e&&(i=p<1?Xb(y,e,n):0);const s=Math.abs(i)<=r,l=Math.abs(o-n)<=t;a.done=s&&l}return a.value=a.done?o:n,a}}}function iw({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],h={done:!1,value:d},f=e=>void 0===s?l:void 0===l||Math.abs(s-e)<Math.abs(l-e)?s:l;let p=r*t;const g=d+p,m=void 0===a?g:a(g);m!==g&&(p=m-d);const v=e=>-p*Math.exp(-e/n),y=e=>m+v(e),b=e=>{const t=v(e),r=y(e);h.done=Math.abs(t)<=c,h.value=h.done?m:r};let w,x;const C=e=>{(e=>void 0!==s&&e<s||void 0!==l&&e>l)(h.value)&&(w=e,x=nw({keyframes:[h.value,f(h.value)],velocity:Xb(y,e,h.value),damping:i,stiffness:o,restDelta:c,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!x&&void 0===w&&(t=!0,b(e),C(e)),void 0!==w&&e>w?x.next(e-w):(!t&&b(e),h)}}}const ow=e=>{const t=({timestamp:t})=>e(t);return{start:()=>vy.update(t,!0),stop:()=>yy(t),now:()=>by.isProcessing?by.timestamp:performance.now()}};function aw(e){let t=0;let r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}const sw={decay:iw,inertia:iw,tween:Gb,keyframes:Gb,spring:nw};function lw({autoplay:e=!0,delay:t=0,driver:r=ow,keyframes:n,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:c,onComplete:u,onUpdate:d,...h}){let f,p,g=1,m=!1;const v=()=>{p=new Promise(e=>{f=e})};let y;v();const b=sw[i]||Gb;let w;b!==Gb&&"number"!=typeof n[0]&&(w=Wb([0,100],n,{clamp:!1}),n=[0,100]);const x=b({...h,keyframes:n});let C;"mirror"===s&&(C=b({...h,keyframes:[...n].reverse(),velocity:-(h.velocity||0)}));let _="idle",S=null,A=null,k=null;null===x.calculatedDuration&&o&&(x.calculatedDuration=aw(x));const{calculatedDuration:E}=x;let I=1/0,T=1/0;null!==E&&(I=E+a,T=I*(o+1)-a);let F=0;const O=e=>{if(null===A)return;g>0&&(A=Math.min(A,e)),g<0&&(A=Math.min(e-T/g,A)),F=null!==S?S:Math.round(e-A)*g;const r=F-t*(g>=0?1:-1),i=g>=0?r<0:r>T;F=Math.max(r,0),"finished"===_&&null===S&&(F=T);let l=F,c=x;if(o){const e=Math.min(F,T)/I;let t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,t=Math.min(t,o+1),!!(t%2)&&("reverse"===s?(r=1-r,a&&(r-=a/I)):"mirror"===s&&(c=C)),l=xv(0,1,r)*I}const u=i?{done:!1,value:n[0]}:c.next(l);w&&(u.value=w(u.value));let{done:h}=u;!i&&null!==E&&(h=g>=0?F>=T:F<=0);const f=null===S&&("finished"===_||"running"===_&&h);return d&&d(u.value),f&&R(),u},P=()=>{y&&y.stop(),y=void 0},M=()=>{_="idle",P(),f(),v(),A=k=null},R=()=>{_="finished",u&&u(),P(),f()},L=()=>{if(m)return;y||(y=r(O));const e=y.now();l&&l(),null!==S?A=e-S:(!A||"finished"===_)&&(A=e),"finished"===_&&v(),k=A,S=null,_="running",y.start()};e&&L();const N={then:(e,t)=>p.then(e,t),get time(){return qy(F)},set time(e){e=$y(e),F=e,null===S&&y&&0!==g?A=y.now()-e/g:S=e},get duration(){const e=null===x.calculatedDuration?aw(x):x.calculatedDuration;return qy(e)},get speed(){return g},set speed(e){e===g||!y||(g=e,N.time=qy(F))},get state(){return _},play:L,pause:()=>{_="paused",S=F},stop:()=>{m=!0,"idle"!==_&&(_="idle",c&&c(),M())},cancel:()=>{null!==k&&O(k),M()},complete:()=>{_="finished"},sample:e=>(A=0,O(e))};return N}const cw=function(e){let t;return()=>(void 0===t&&(t=e()),t)}(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),uw=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);function dw(e,t,{onUpdate:r,onComplete:n,...i}){if(!cw()||!uw.has(t)||i.repeatDelay||"mirror"===i.repeatType||0===i.damping||"inertia"===i.type)return!1;let o,a,s=!1,l=!1;const c=()=>{a=new Promise(e=>{o=e})};c();let{keyframes:u,duration:d=300,ease:h,times:f}=i;if(((e,t)=>"spring"===t.type||"backgroundColor"===e||!Xy(t.ease))(t,i)){const e=lw({...i,repeat:0,delay:0});let t={done:!1,value:u[0]};const r=[];let n=0;for(;!t.done&&n<2e4;)t=e.sample(n),r.push(t.value),n+=10;f=void 0,u=r,d=n-10,h="linear"}const p=function(e,t,r,{delay:n=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const c={[t]:r};l&&(c.offset=l);const u=Jy(s);return Array.isArray(u)&&(c.easing=u),e.animate(c,{delay:n,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===a?"alternate":"normal"})}(e.owner.current,t,u,{...i,duration:d,ease:h,times:f}),g=()=>{l=!1,p.cancel()},m=()=>{l=!0,vy.update(g),o(),c()};return p.onfinish=()=>{l||(e.set(function(e,{repeat:t,repeatType:r="loop"}){return e[t&&"loop"!==r&&t%2==1?0:e.length-1]}(u,i)),n&&n(),m())},{then:(e,t)=>a.then(e,t),attachTimeline:e=>(p.timeline=e,p.onfinish=null,py),get time(){return qy(p.currentTime||0)},set time(e){p.currentTime=$y(e)},get speed(){return p.playbackRate},set speed(e){p.playbackRate=e},get duration(){return qy(d)},play:()=>{s||(p.play(),yy(g))},pause:()=>p.pause(),stop:()=>{if(s=!0,"idle"===p.playState)return;const{currentTime:t}=p;if(t){const r=lw({...i,autoplay:!1});e.setWithVelocity(r.sample(t-10).value,r.sample(t).value,10)}m()},complete:()=>{l||p.finish()},cancel:m}}const hw={type:"spring",stiffness:500,damping:25,restSpeed:10},fw={type:"keyframes",duration:.8},pw={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},gw=(e,{keyframes:t})=>t.length>2?fw:hv.has(e)?e.startsWith("scale")?(e=>({type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restSpeed:10}))(t[1]):hw:pw,mw=(e,t)=>"zIndex"!==e&&!("number"!=typeof t&&!Array.isArray(t)&&("string"!=typeof t||!Lb.test(t)&&"0"!==t||t.startsWith("url("))),vw=new Set(["brightness","contrast","saturate","opacity"]);function yw(e){const[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;const[n]=r.match(kv)||[];if(!n)return e;const i=r.replace(n,"");let o=vw.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+i+")"}const bw=/([a-z-]*)\(.*?\)/g,ww={...Lb,getAnimatableNone:e=>{const t=e.match(bw);return t?t.map(yw).join(" "):e}},xw={...Dv,color:wb,backgroundColor:wb,outlineColor:wb,fill:wb,stroke:wb,borderColor:wb,borderTopColor:wb,borderRightColor:wb,borderBottomColor:wb,borderLeftColor:wb,filter:ww,WebkitFilter:ww},Cw=e=>xw[e];function _w(e,t){let r=Cw(e);return r!==ww&&(r=Lb),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const Sw=e=>/^0[^.\s]+$/.test(e);function Aw(e){return"number"==typeof e?0===e:null!==e?"none"===e||"0"===e||Sw(e):void 0}function kw(e,t){return e[t]||e.default||e}const Ew=!1,Iw=(e,t,r,n={})=>i=>{const o=kw(n,e)||{},a=o.delay||n.delay||0;let{elapsed:s=0}=n;s-=$y(a);const l=function(e,t,r,n){const i=mw(t,r);let o;o=Array.isArray(r)?[...r]:[null,r];const a=void 0!==n.from?n.from:e.get();let s;const l=[];for(let e=0;e<o.length;e++)null===o[e]&&(o[e]=0===e?a:o[e-1]),Aw(o[e])&&l.push(e),"string"==typeof o[e]&&"none"!==o[e]&&"0"!==o[e]&&(s=o[e]);if(i&&l.length&&s)for(let e=0;e<l.length;e++)o[l[e]]=_w(t,s);return o}(t,e,r,o),c=l[0],u=l[l.length-1],d=mw(e,c),h=mw(e,u);let f={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:s,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)||(f={...f,...gw(e,f)}),f.duration&&(f.duration=$y(f.duration)),f.repeatDelay&&(f.repeatDelay=$y(f.repeatDelay)),!d||!h||Gy||!1===o.type||Ew)return function({keyframes:e,delay:t,onUpdate:r,onComplete:n}){const i=()=>(r&&r(e[e.length-1]),n&&n(),{time:0,speed:1,duration:0,play:py,pause:py,stop:py,then:e=>(e(),Promise.resolve()),cancel:py,complete:py});return t?lw({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}(f);if(!n.isHandoff&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const r=dw(t,e,f);if(r)return r}return lw(f)};function Tw(e){return!(!pv(e)||!e.add)}const Fw=e=>/^\-?\d*\.?\d+$/.test(e);class Ow{constructor(){this.subscriptions=[]}add(e){return function(e,t){-1===e.indexOf(t)&&e.push(t)}(this.subscriptions,e),()=>function(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}(this.subscriptions,e)}notify(e,t,r){const n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let i=0;i<n;i++){const n=this.subscriptions[i];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Pw{constructor(e,t={}){this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,t=!0)=>{this.prev=this.current,this.current=e;const{delta:r,timestamp:n}=by;this.lastUpdated!==n&&(this.timeDelta=r,this.lastUpdated=n,vy.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>vy.postRender(this.velocityCheck),this.velocityCheck=({timestamp:e})=>{e!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=(e=>!isNaN(parseFloat(e)))(this.current),this.owner=t.owner}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Ow);const r=this.events[e].add(t);return"change"===e?()=>{r(),vy.read(()=>{this.events.change.getSize()||this.stop()})}:r}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,r){this.set(t),this.prev=e,this.timeDelta=r}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Yb(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}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 Mw(e,t){return new Pw(e,t)}const Rw=e=>t=>t.test(e),Lw=[Cv,Mv,Pv,Ov,Lv,Rv,{test:e=>"auto"===e,parse:e=>e}],Nw=e=>Lw.find(Rw(e)),jw=[...Lw,wb,Lb],Dw=e=>jw.find(Rw(e));function zw(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,Mw(r))}function Bw(e,t){return t?(t[e]||t.default||t).from:void 0}function Uw({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}function Vw(e,t){const r=e.get();if(!Array.isArray(t))return r!==t;for(let e=0;e<t.length;e++)if(t[e]!==r)return!0}function Hw(e,t,{delay:r=0,transitionOverride:n,type:i}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:a,...s}=e.makeTargetAnimatable(t);const l=e.getValue("willChange");n&&(o=n);const c=[],u=i&&e.animationState&&e.animationState.getState()[i];for(const t in s){const n=e.getValue(t),i=s[t];if(!n||void 0===i||u&&Uw(u,t))continue;const a={delay:r,elapsed:0,...kw(o||{},t)};if(window.HandoffAppearAnimations){const r=e.getProps()[Wm];if(r){const e=window.HandoffAppearAnimations(r,t,n,vy);null!==e&&(a.elapsed=e,a.isHandoff=!0)}}let d=!a.isHandoff&&!Vw(n,i);if("spring"===a.type&&(n.getVelocity()||a.velocity)&&(d=!1),n.animation&&(d=!1),d)continue;n.start(Iw(t,n,i,e.shouldReduceMotion&&hv.has(t)?{type:!1}:a));const h=n.animation;Tw(l)&&(l.add(t),h.then(()=>l.remove(t))),c.push(h)}return a&&Promise.all(c).then(()=>{a&&function(e,t){const r=Hy(e,t);let{transitionEnd:n={},transition:i={},...o}=r?e.makeTargetAnimatable(r,!1):{};o={...o,...n};for(const t in o)zw(e,t,uy(o[t]))}(e,a)}),c}function Ww(e,t,r={}){const n=Hy(e,t,r.custom);let{transition:i=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(i=r.transitionOverride);const o=n?()=>Promise.all(Hw(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:a,staggerDirection:s}=i;return function(e,t,r=0,n=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*n,l=1===i?(e=0)=>e*n:(e=0)=>s-e*n;return Array.from(e.variantChildren).sort($w).forEach((e,n)=>{e.notify("AnimationStart",t),a.push(Ww(e,t,{...o,delay:r+l(n)}).then(()=>e.notify("AnimationComplete",t)))}),Promise.all(a)}(e,t,o+n,a,s,r)}:()=>Promise.resolve(),{when:s}=i;if(s){const[e,t]="beforeChildren"===s?[o,a]:[a,o];return e().then(()=>t())}return Promise.all([o(),a(r.delay)])}function $w(e,t){return e.sortNodePosition(t)}const qw=[...Ym].reverse(),Gw=Ym.length;function Yw(e){return t=>Promise.all(t.map(({animation:t,options:r})=>function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t)){const i=t.map(t=>Ww(e,t,r));n=Promise.all(i)}else if("string"==typeof t)n=Ww(e,t,r);else{const i="function"==typeof t?Hy(e,t,r.custom):t;n=Promise.all(Hw(e,i,r))}return n.then(()=>e.notify("AnimationComplete",t))}(e,t,r)))}function Xw(e){let t=Yw(e);const r={animate:Zw(!0),whileInView:Zw(),whileHover:Zw(),whileTap:Zw(),whileDrag:Zw(),whileFocus:Zw(),exit:Zw()};let n=!0;const i=(t,r)=>{const n=Hy(e,r);if(n){const{transition:e,transitionEnd:r,...i}=n;t={...t,...i,...r}}return t};function o(o,a){const s=e.getProps(),l=e.getVariantContext(!0)||{},c=[],u=new Set;let d={},h=1/0;for(let t=0;t<Gw;t++){const f=qw[t],p=r[f],g=void 0!==s[f]?s[f]:l[f],m=qm(g),v=f===a?p.isActive:null;!1===v&&(h=t);let y=g===l[f]&&g!==s[f]&&m;if(y&&n&&e.manuallyAnimateOnMount&&(y=!1),p.protectedKeys={...d},!p.isActive&&null===v||!g&&!p.prevProp||Gm(g)||"boolean"==typeof g)continue;let b=Kw(p.prevProp,g)||f===a&&p.isActive&&!y&&m||t>h&&m,w=!1;const x=Array.isArray(g)?g:[g];let C=x.reduce(i,{});!1===v&&(C={});const{prevResolvedValues:_={}}=p,S={..._,...C},A=e=>{b=!0,u.has(e)&&(w=!0,u.delete(e)),p.needsAnimating[e]=!0};for(const e in S){const t=C[e],r=_[e];if(d.hasOwnProperty(e))continue;let n=!1;n=cy(t)&&cy(r)?!Vy(t,r):t!==r,n?void 0!==t?A(e):u.add(e):void 0!==t&&u.has(e)?A(e):p.protectedKeys[e]=!0}p.prevProp=g,p.prevResolvedValues=C,p.isActive&&(d={...d,...C}),n&&e.blockInitialAnimation&&(b=!1),b&&(!y||w)&&c.push(...x.map(e=>({animation:e,options:{type:f,...o}})))}if(u.size){const t={};u.forEach(r=>{const n=e.getBaseTarget(r);void 0!==n&&(t[r]=n)}),c.push({animation:t})}let f=!!c.length;return n&&(!1===s.initial||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(f=!1),n=!1,f?t(c):Promise.resolve()}return{animateChanges:o,setActive:function(t,n,i){var a;if(r[t].isActive===n)return Promise.resolve();null===(a=e.variantChildren)||void 0===a||a.forEach(e=>{var r;return null===(r=e.animationState)||void 0===r?void 0:r.setActive(t,n)}),r[t].isActive=n;const s=o(i,t);for(const e in r)r[e].protectedKeys={};return s},setAnimateFunction:function(r){t=r(e)},getState:()=>r}}function Kw(e,t){return"string"==typeof t?t!==e:!!Array.isArray(t)&&!Vy(t,e)}function Zw(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}let Jw=0;const Qw={animation:{Feature:class extends Oy{constructor(e){super(e),e.animationState||(e.animationState=Xw(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),Gm(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends Oy{constructor(){super(...arguments),this.id=Jw++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t,custom:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const i=this.node.animationState.setActive("exit",!e,{custom:r??this.node.getProps().custom});t&&!e&&i.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}};const ex=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function tx(e,t,r=1){const[n,i]=function(e){const t=ex.exec(e);if(!t)return[,];const[,r,n]=t;return[r,n]}(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const e=o.trim();return Fw(e)?parseFloat(e):e}return bv(i)?tx(i,t,r+1):i}const rx=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),nx=e=>rx.has(e),ix=e=>e===Cv||e===Mv,ox=(e,t)=>parseFloat(e.split(", ")[t]),ax=(e,t)=>(r,{transform:n})=>{if("none"===n||!n)return 0;const i=n.match(/^matrix3d\((.+)\)$/);if(i)return ox(i[1],t);{const t=n.match(/^matrix\((.+)\)$/);return t?ox(t[1],e):0}},sx=new Set(["x","y","z"]),lx=dv.filter(e=>!sx.has(e));const cx={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),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:ax(4,13),y:ax(5,14)};cx.translateX=cx.x,cx.translateY=cx.y;const ux=(e,t,r={},n={})=>{t={...t},n={...n};const i=Object.keys(t).filter(nx);let o=[],a=!1;const s=[];if(i.forEach(i=>{const l=e.getValue(i);if(!e.hasValue(i))return;let c=r[i],u=Nw(c);const d=t[i];let h;if(cy(d)){const e=d.length,t=null===d[0]?1:0;c=d[t],u=Nw(c);for(let r=t;r<e&&null!==d[r];r++)h?Wy(Nw(d[r])===h):h=Nw(d[r])}else h=Nw(d);if(u!==h)if(ix(u)&&ix(h)){const e=l.get();"string"==typeof e&&l.set(parseFloat(e)),"string"==typeof d?t[i]=parseFloat(d):Array.isArray(d)&&h===Mv&&(t[i]=d.map(parseFloat))}else null!=u&&u.transform&&null!=h&&h.transform&&(0===c||0===d)?0===c?l.set(h.transform(c)):t[i]=u.transform(d):(a||(o=function(e){const t=[];return lx.forEach(r=>{const n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t.length&&e.render(),t}(e),a=!0),s.push(i),n[i]=void 0!==n[i]?n[i]:t[i],l.jump(d))}),s.length){const r=s.indexOf("height")>=0?window.pageYOffset:null,i=((e,t,r)=>{const n=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};"none"===a&&t.setStaticValue("display",e.display||"block"),r.forEach(e=>{s[e]=cx[e](n,o)}),t.render();const l=t.measureViewportBox();return r.forEach(r=>{const n=t.getValue(r);n&&n.jump(s[r]),e[r]=cx[r](l,o)}),e})(t,e,s);return o.length&&o.forEach(([t,r])=>{e.getValue(t).set(r)}),e.render(),Bm&&null!==r&&window.scrollTo({top:r}),{target:i,transitionEnd:n}}return{target:t,transitionEnd:n}};function dx(e,t,r,n){return(e=>Object.keys(e).some(nx))(t)?ux(e,t,r,n):{target:t,transitionEnd:n}}const hx=(e,t,r,n)=>{const i=function(e,{...t},r){const n=e.current;if(!(n instanceof Element))return{target:t,transitionEnd:r};r&&(r={...r}),e.values.forEach(e=>{const t=e.get();if(!bv(t))return;const r=tx(t,n);r&&e.set(r)});for(const e in t){const i=t[e];if(!bv(i))continue;const o=tx(i,n);o&&(t[e]=o,r||(r={}),void 0===r[e]&&(r[e]=i))}return{target:t,transitionEnd:r}}(e,t,n);return dx(e,t=i.target,r,n=i.transitionEnd)},fx={current:null},px={current:!1};const gx=new WeakMap,mx=Object.keys(tv),vx=mx.length,yx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],bx=Xm.length;class wx{constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>vy.render(this.render,!1,!0);const{latestValues:a,renderState:s}=i;this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=s,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=o,this.isControllingVariants=Km(t),this.isVariantNode=Zm(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!(!e||!e.current);const{willChange:l,...c}=this.scrapeMotionValuesFromProps(t,{});for(const e in c){const t=c[e];void 0!==a[e]&&pv(t)&&(t.set(a[e],!1),Tw(l)&&l.add(e))}}scrapeMotionValuesFromProps(e,t){return{}}mount(e){this.current=e,gx.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)),px.current||function(){if(px.current=!0,Bm)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>fx.current=e.matches;e.addListener(t),t()}else fx.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||fx.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){gx.delete(this.current),this.projection&&this.projection.unmount(),yy(this.notifyUpdate),yy(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)this.features[e].unmount();this.current=null}bindToMotionValue(e,t){const r=hv.has(e),n=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&vy.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{n(),i()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}loadFeatures({children:e,...t},r,n,i){let o,a;for(let e=0;e<vx;e++){const r=mx[e],{isEnabled:n,Feature:i,ProjectionNode:s,MeasureLayout:l}=tv[r];s&&(o=s),n(t)&&(!this.features[r]&&i&&(this.features[r]=new i(this)),l&&(a=l))}if(("html"===this.type||"svg"===this.type)&&!this.projection&&o){this.projection=new o(this.latestValues,this.parent&&this.parent.projection);const{layoutId:e,layout:r,drag:n,dragConstraints:a,layoutScroll:s,layoutRoot:l}=t;this.projection.setOptions({layoutId:e,layout:r,alwaysMeasureLayout:!!n||a&&$m(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof r?r:"both",initialPromotionConfig:i,layoutScroll:s,layoutRoot:l})}return a}updateFeatures(){for(const e in this.features){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}makeTargetAnimatable(e,t=!0){return this.makeTargetAnimatableFromInstance(e,this.props,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<yx.length;t++){const r=yx[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){const{willChange:n}=t;for(const i in t){const o=t[i],a=r[i];if(pv(o))e.addValue(i,o),Tw(n)&&n.add(i);else if(pv(a))e.addValue(i,Mw(o,{owner:e})),Tw(n)&&n.remove(i);else if(a!==o)if(e.hasValue(i)){const t=e.getValue(i);!t.hasAnimated&&t.set(o)}else{const t=e.getStaticValue(i);e.addValue(i,Mw(void 0!==t?t:o,{owner:e}))}}for(const n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps),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<bx;e++){const r=Xm[e],n=this.props[r];(qm(n)||!1===n)&&(t[r]=n)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){t!==this.values.get(e)&&(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 r=this.values.get(e);return void 0===r&&void 0!==t&&(r=Mw(t,{owner:this}),this.addValue(e,r)),r}readValue(e){var t;return void 0===this.latestValues[e]&&this.current?null!==(t=this.getBaseTargetFromProps(this.props,e))&&void 0!==t?t:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e]}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props,n="string"==typeof r||"object"==typeof r?null===(t=sy(this.props,r))||void 0===t?void 0:t[e]:void 0;if(r&&void 0!==n)return n;const i=this.getBaseTargetFromProps(this.props,e);return void 0===i||pv(i)?void 0!==this.initialValues[e]&&void 0===n?void 0:this.baseTarget[e]:i}on(e,t){return this.events[e]||(this.events[e]=new Ow),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class xx extends wx{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:r}){delete t[e],delete r[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:t,...r},{transformValues:n},i){let o=function(e,t,r){const n={};for(const i in e){const e=Bw(i,t);if(void 0!==e)n[i]=e;else{const e=r.getValue(i);e&&(n[i]=e.get())}}return n}(r,e||{},this);if(n&&(t&&(t=n(t)),r&&(r=n(r)),o&&(o=n(o))),i){!function(e,t,r){var n,i;const o=Object.keys(t).filter(t=>!e.hasValue(t)),a=o.length;if(a)for(let s=0;s<a;s++){const a=o[s],l=t[a];let c=null;Array.isArray(l)&&(c=l[0]),null===c&&(c=null!==(i=null!==(n=r[a])&&void 0!==n?n:e.readValue(a))&&void 0!==i?i:t[a]),null!=c&&("string"==typeof c&&(Fw(c)||Sw(c))?c=parseFloat(c):!Dw(c)&&Lb.test(l)&&(c=_w(a,l)),e.addValue(a,Mw(c,{owner:e})),void 0===r[a]&&(r[a]=c),null!==c&&e.setBaseTarget(a,c))}}(this,r,o);const e=hx(this,r,o,t);t=e.transitionEnd,r=e.target}return{transition:e,transitionEnd:t,...r}}}class Cx extends xx{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(hv.has(t)){const e=Cw(t);return e&&e.default||0}{const r=function(e){return window.getComputedStyle(e)}(e),n=(yv(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return function(e,t){return function({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}(function(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}(e,t)}build(e,t,r,n){zv(e,t,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,t){return oy(e,t)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;pv(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}renderInstance(e,t,r,n){ry(e,t,r,n)}}class _x extends xx{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(hv.has(t)){const e=Cw(t);return e&&e.default||0}return t=ny.has(t)?t:Hm(t),e.getAttribute(t)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(e,t){return ay(e,t)}build(e,t,r,n){Zv(e,t,r,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,r,n){iy(e,t,0,n)}mount(e){this.isSVGTag=Qv(e.tagName),super.mount(e)}}const Sx=function(e){function t(t,r={}){return av(e(t,r))}if(typeof Proxy>"u")return t;const r=new Map;return new Proxy(t,{get:(e,n)=>(r.has(n)||r.set(n,t(n)),r.get(n))})}(function(e,{forwardMotionProps:t=!1},r,n){return{...cv(e)?wy:xy,preloadedFeatures:r,useRender:ty(t),createVisualElement:n,Component:e}});function Ax(){const e=u(!1);return Um(()=>(e.current=!0,()=>{e.current=!1}),[]),e}class kx extends n.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 Ex({children:e,isPresent:t}){const r=b(),i=u(null),o=u({width:0,height:0,top:0,left:0});return C(()=>{const{width:e,height:n,top:a,left:s}=o.current;if(t||!i.current||!e||!n)return;i.current.dataset.motionPopId=r;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`\n [data-motion-pop-id="${r}"] {\n position: absolute !important;\n width: ${e}px !important;\n height: ${n}px !important;\n top: ${a}px !important;\n left: ${s}px !important;\n }\n `),()=>{document.head.removeChild(l)}},[t]),n.createElement(kx,{isPresent:t,childRef:i,sizeRef:o},n.cloneElement(e,{ref:i}))}const Ix=({children:e,initial:t,isPresent:r,onExitComplete:i,custom:o,presenceAffectsLayout:a,mode:s})=>{const l=ly(Tx),c=b(),u=d(()=>({id:c,initial:t,isPresent:r,custom:o,onExitComplete:e=>{l.set(e,!0);for(const e of l.values())if(!e)return;i&&i()},register:e=>(l.set(e,!1),()=>l.delete(e))}),a?void 0:[r]);return d(()=>{l.forEach((e,t)=>l.set(t,!1))},[r]),n.useEffect(()=>{!r&&!l.size&&i&&i()},[r]),"popLayout"===s&&(e=n.createElement(Ex,{isPresent:r},e)),n.createElement(zm.Provider,{value:u},e)};function Tx(){return new Map}const Fx=e=>e.key||"";const Ox=({children:e,custom:t,initial:r=!0,onExitComplete:i,exitBeforeEnter:s,presenceAffectsLayout:d=!0,mode:h="sync"})=>{const f=l(nv).forceRender||function(){const e=Ax(),[t,r]=o(0),n=c(()=>{e.current&&r(t+1)},[t]);return[c(()=>vy.postRender(n),[n]),t]}()[0],p=Ax(),g=function(e){const t=[];return m.forEach(e,e=>{v(e)&&t.push(e)}),t}(e);let y=g;const b=u(new Map).current,x=u(y),C=u(new Map).current,_=u(!0);if(Um(()=>{_.current=!1,function(e,t){e.forEach(e=>{const r=Fx(e);t.set(r,e)})}(g,C),x.current=y}),function(e){a(()=>()=>e(),[])}(()=>{_.current=!0,C.clear(),b.clear()}),_.current)return n.createElement(n.Fragment,null,y.map(e=>n.createElement(Ix,{key:Fx(e),isPresent:!0,initial:!!r&&void 0,presenceAffectsLayout:d,mode:h},e)));y=[...y];const S=x.current.map(Fx),A=g.map(Fx),k=S.length;for(let e=0;e<k;e++){const t=S[e];-1===A.indexOf(t)&&!b.has(t)&&b.set(t,void 0)}return"wait"===h&&b.size&&(y=[]),b.forEach((e,r)=>{if(-1!==A.indexOf(r))return;const o=C.get(r);if(!o)return;const a=S.indexOf(r);let s=e;if(!s){const e=()=>{b.delete(r);const e=Array.from(C.keys()).filter(e=>!A.includes(e));if(e.forEach(e=>C.delete(e)),x.current=g.filter(t=>{const n=Fx(t);return n===r||e.includes(n)}),!b.size){if(!1===p.current)return;f(),i&&i()}};s=n.createElement(Ix,{key:Fx(o),isPresent:!1,onExitComplete:e,custom:t,presenceAffectsLayout:d,mode:h},o),b.set(r,s)}y.splice(a,0,s)}),y=y.map(e=>{const t=e.key;return b.has(t)?e:n.createElement(Ix,{key:Fx(e),isPresent:!0,presenceAffectsLayout:d,mode:h},e)}),n.createElement(n.Fragment,null,b.size?y:y.map(e=>w(e)))};function Px({children:e,features:t,strict:r=!1}){const[,i]=o(!Mx(t)),s=u(void 0);if(!Mx(t)){const{renderer:e,...r}=t;s.current=e,rv(r)}return a(()=>{Mx(t)&&t().then(({renderer:e,...t})=>{rv(t),s.current=e,i(!0)})},[]),n.createElement(Vm.Provider,{value:{renderer:s.current,strict:r}},e)}function Mx(e){return"function"==typeof e}const Rx={renderer:(e,t)=>cv(e)?new _x(t,{enableHardwareAcceleration:!1}):new Cx(t,{enableHardwareAcceleration:!0}),...Qw,...Uy},Lx=typeof document<"u"?i.useLayoutEffect:()=>{},Nx=i.createContext(!1);function jx(){return!1}function Dx(){return!0}function zx(e){return()=>{}}function Bx(){return"function"==typeof i.useSyncExternalStore?i.useSyncExternalStore(zx,jx,Dx):l(Nx)}i.useId;let Ux=new Map;function Vx(e,t){if(e===t)return e;let r=Ux.get(e);if(r)return r(t),t;let n=Ux.get(t);return n?(n(e),e):t}function Hx(...e){return(...t)=>{for(let r of e)"function"==typeof r&&r(...t)}}const Wx=e=>{var t;return null!==(t=null==e?void 0:e.ownerDocument)&&void 0!==t?t:document},$x=e=>e&&"window"in e&&e.window===e?e:Wx(e).defaultView||window;function qx(...e){let t={...e[0]};for(let r=1;r<e.length;r++){let n=e[r];for(let e in n){let r=t[e],i=n[e];"function"==typeof r&&"function"==typeof i&&"o"===e[0]&&"n"===e[1]&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=Hx(r,i):"className"!==e&&"UNSAFE_className"!==e||"string"!=typeof r||"string"!=typeof i?"id"===e&&r&&i?t.id=Vx(r,i):t[e]=void 0!==i?i:r:t[e]=af(r,i)}}return t}function Gx(e){if(function(){if(null==Yx){Yx=!1;try{document.createElement("div").focus({get preventScroll(){return Yx=!0,!0}})}catch{}}return Yx}())e.focus({preventScroll:!0});else{let t=function(e){let t=e.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==n;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&r.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}(e);e.focus(),function(e){for(let{element:t,scrollTop:r,scrollLeft:n}of e)t.scrollTop=r,t.scrollLeft=n}(t)}}let Yx=null;function Xx(){return function(e){var t;return typeof window<"u"&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}(/^Mac/i)}function Kx(){return function(e){var t;return!(typeof window>"u"||null==window.navigator)&&((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.brands.some(t=>e.test(t.brand)))||e.test(window.navigator.userAgent))}(/Android/i)}let Zx=new Map,Jx=new Set;function Qx(){if(typeof window>"u")return;function e(e){return"propertyName"in e}let t=r=>{if(!e(r)||!r.target)return;let n=Zx.get(r.target);if(n&&(n.delete(r.propertyName),0===n.size&&(r.target.removeEventListener("transitioncancel",t),Zx.delete(r.target)),0===Zx.size)){for(let e of Jx)e();Jx.clear()}};document.body.addEventListener("transitionrun",r=>{if(!e(r)||!r.target)return;let n=Zx.get(r.target);n||(n=new Set,Zx.set(r.target,n),r.target.addEventListener("transitioncancel",t,{once:!0})),n.add(r.propertyName)}),document.body.addEventListener("transitionend",t)}function eC(){let e=u(new Map),t=c((t,r,n,i)=>{let o=null!=i&&i.once?(...t)=>{e.current.delete(n),n(...t)}:n;e.current.set(n,{type:r,eventTarget:t,fn:o,options:i}),t.addEventListener(r,n,i)},[]),r=c((t,r,n,i)=>{var o;let a=(null===(o=e.current.get(n))||void 0===o?void 0:o.fn)||n;t.removeEventListener(r,a,i),e.current.delete(n)},[]),n=c(()=>{e.current.forEach((e,t)=>{r(e.eventTarget,e.type,t,e.options)})},[r]);return a(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function tC(e){const t=u(null);return d(()=>({get current(){return t.current},set current(r){t.current=r,"function"==typeof e?e(r):e&&(e.current=r)}}),[e])}typeof document<"u"&&("loading"!==document.readyState?Qx():document.addEventListener("DOMContentLoaded",Qx));let rC=typeof document<"u"&&window.visualViewport;function nC(){return{width:rC&&(null==rC?void 0:rC.width)||window.innerWidth,height:rC&&(null==rC?void 0:rC.height)||window.innerHeight}}function iC(e,t,r){let[n,i]=o(e||t),s=u(void 0!==e),l=void 0!==e;a(()=>{let e=s.current;e!==l&&console.warn(`WARN: A component changed from ${e?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),s.current=l},[l]);let d=l?e:n,h=c((e,...t)=>{let n=(e,...t)=>{r&&(Object.is(d,e)||r(e,...t)),l||(d=e)};"function"==typeof e?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),i((r,...i)=>{let o=e(l?d:r,...i);return n(o,...t),l?r:o})):(l||i(e),n(e,...t))},[l,d,r]);return[d,h]}function oC(e,t=-1/0,r=1/0){return Math.min(Math.max(e,t),r)}function aC(e,t){let r=e,n=t.toString(),i=n.indexOf("."),o=i>=0?n.length-i:0;if(o>0){let e=Math.pow(10,o);r=Math.round(r*e)/e}return r}function sC(e,t,r=10){const n=Math.pow(r,t);return Math.round(e*n)/n}var lC={};const cC=Gh(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));!function(e){
28
+ /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
29
+ var t=t||{version:"5.3.0"};if(e.fabric=t,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(""),t.window=window;else{var r=new cC.JSDOM(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]},resources:"usable"}).window;t.document=r.document,t.jsdomImplForWrapper=cC.implForWrapper,t.nodeCanvas=cC.Canvas,t.window=r,DOMParser=t.window.DOMParser}function n(e,t){var r=e.canvas,n=t.targetCanvas,i=n.getContext("2d");i.translate(0,n.height),i.scale(1,-1);var o=r.height-n.height;i.drawImage(r,0,o,n.width,n.height,0,0,n.width,n.height)}function i(e,t){var r=t.targetCanvas.getContext("2d"),n=t.destinationWidth,i=t.destinationHeight,o=n*i*4,a=new Uint8Array(this.imageBuffer,0,o),s=new Uint8ClampedArray(this.imageBuffer,0,o);e.readPixels(0,0,n,i,e.RGBA,e.UNSIGNED_BYTE,a);var l=new ImageData(s,n,i);r.putImageData(l,0,0)}t.isTouchSupported="ontouchstart"in t.window||"ontouchstart"in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof Buffer<"u"&&typeof window>"u",t.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-dashoffset","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","vector-effect","instantiated_by_use","clip-path"],t.DPI=96,t.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",t.commaWsp="(?:\\s+,?\\s*|,\\s*)",t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS="http://www.w3.org/2000/svg",t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){return t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize)?(console.log("max texture size: "+t.maxTextureSize),new t.WebglFilterBackend({tileSize:t.textureSize})):t.Canvas2dFilterBackend?new t.Canvas2dFilterBackend:void 0},typeof document<"u"&&typeof window<"u"&&(window.fabric=t),function(){function e(e,r){if(this.__eventListeners[e]){var n=this.__eventListeners[e];r?n[n.indexOf(r)]=!1:t.util.array.fill(n,!1)}}function r(e,t){var r=function(){t.apply(this,arguments),this.off(e,r)}.bind(this);this.on(e,r)}t.Observable={fire:function(e,t){if(!this.__eventListeners)return this;var r=this.__eventListeners[e];if(!r)return this;for(var n=0,i=r.length;n<i;n++)r[n]&&r[n].call(this,t||{});return this.__eventListeners[e]=r.filter(function(e){return!1!==e}),this},on:function(e,t){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var r in e)this.on(r,e[r]);else this.__eventListeners[e]||(this.__eventListeners[e]=[]),this.__eventListeners[e].push(t);return this},once:function(e,t){if(1===arguments.length)for(var n in e)r.call(this,n,e[n]);else r.call(this,e,t);return this},off:function(t,r){if(!this.__eventListeners)return this;if(0===arguments.length)for(t in this.__eventListeners)e.call(this,t);else if(1===arguments.length&&"object"==typeof arguments[0])for(var n in t)e.call(this,n,t[n]);else e.call(this,t,r);return this}}}(),t.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var e=0,t=arguments.length;e<t;e++)this._onObjectAdded(arguments[e]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(e,t,r){var n=this._objects;return r?n[t]=e:n.splice(t,0,e),this._onObjectAdded&&this._onObjectAdded(e),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var e,t=this._objects,r=!1,n=0,i=arguments.length;n<i;n++)-1!==(e=t.indexOf(arguments[n]))&&(r=!0,t.splice(e,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[n]));return this.renderOnAddRemove&&r&&this.requestRenderAll(),this},forEachObject:function(e,t){for(var r=this.getObjects(),n=0,i=r.length;n<i;n++)e.call(t,r[n],n,r);return this},getObjects:function(e){return typeof e>"u"?this._objects.concat():this._objects.filter(function(t){return t.type===e})},item:function(e){return this._objects[e]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(e,t){return this._objects.indexOf(e)>-1||!!t&&this._objects.some(function(t){return"function"==typeof t.contains&&t.contains(e,!0)})},complexity:function(){return this._objects.reduce(function(e,t){return e+=t.complexity?t.complexity():0},0)}},t.CommonMethods={_setOptions:function(e){for(var t in e)this.set(t,e[t])},_initGradient:function(e,r){e&&e.colorStops&&!(e instanceof t.Gradient)&&this.set(r,new t.Gradient(e))},_initPattern:function(e,r,n){!e||!e.source||e instanceof t.Pattern?n&&n():this.set(r,new t.Pattern(e,n))},_setObject:function(e){for(var t in e)this._set(t,e[t])},set:function(e,t){return"object"==typeof e?this._setObject(e):this._set(e,t),this},_set:function(e,t){this[e]=t},toggle:function(e){var t=this.get(e);return"boolean"==typeof t&&this.set(e,!t),this},get:function(e){return this[e]}},function(e){var r=Math.sqrt,n=Math.atan2,i=Math.pow,o=Math.PI/180,a=Math.PI/2;t.util={cos:function(e){if(0===e)return 1;switch(e<0&&(e=-e),e/a){case 1:case 3:return 0;case 2:return-1}return Math.cos(e)},sin:function(e){if(0===e)return 0;var t=1;switch(e<0&&(t=-1),e/a){case 1:return t;case 2:return 0;case 3:return-t}return Math.sin(e)},removeFromArray:function(e,t){var r=e.indexOf(t);return-1!==r&&e.splice(r,1),e},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e+1))+e},degreesToRadians:function(e){return e*o},radiansToDegrees:function(e){return e/o},rotatePoint:function(e,r,n){var i=new t.Point(e.x-r.x,e.y-r.y),o=t.util.rotateVector(i,n);return new t.Point(o.x,o.y).addEquals(r)},rotateVector:function(e,r){var n=t.util.sin(r),i=t.util.cos(r);return{x:e.x*i-e.y*n,y:e.x*n+e.y*i}},createVector:function(e,r){return new t.Point(r.x-e.x,r.y-e.y)},calcAngleBetweenVectors:function(e,t){return Math.acos((e.x*t.x+e.y*t.y)/(Math.hypot(e.x,e.y)*Math.hypot(t.x,t.y)))},getHatVector:function(e){return new t.Point(e.x,e.y).multiply(1/Math.hypot(e.x,e.y))},getBisector:function(e,r,n){var i=t.util.createVector(e,r),o=t.util.createVector(e,n),a=t.util.calcAngleBetweenVectors(i,o),s=a*(0===t.util.calcAngleBetweenVectors(t.util.rotateVector(i,a),o)?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(i,s)),angle:a}},projectStrokeOnPoints:function(e,r,n){var i=[],o=r.strokeWidth/2,a=r.strokeUniform?new t.Point(1/r.scaleX,1/r.scaleY):new t.Point(1,1),s=function(e){var r=o/Math.hypot(e.x,e.y);return new t.Point(e.x*r*a.x,e.y*r*a.y)};return e.length<=1||e.forEach(function(l,c){var u,d,h=new t.Point(l.x,l.y);0===c?(d=e[c+1],u=n?s(t.util.createVector(d,h)).addEquals(h):e[e.length-1]):c===e.length-1?(u=e[c-1],d=n?s(t.util.createVector(u,h)).addEquals(h):e[0]):(u=e[c-1],d=e[c+1]);var f,p,g=t.util.getBisector(h,u,d),m=g.vector,v=g.angle;if("miter"===r.strokeLineJoin&&(f=-o/Math.sin(v/2),p=new t.Point(m.x*f*a.x,m.y*f*a.y),Math.hypot(p.x,p.y)/o<=r.strokeMiterLimit))return i.push(h.add(p)),void i.push(h.subtract(p));f=-o*Math.SQRT2,p=new t.Point(m.x*f*a.x,m.y*f*a.y),i.push(h.add(p)),i.push(h.subtract(p))}),i},transformPoint:function(e,r,n){return n?new t.Point(r[0]*e.x+r[2]*e.y,r[1]*e.x+r[3]*e.y):new t.Point(r[0]*e.x+r[2]*e.y+r[4],r[1]*e.x+r[3]*e.y+r[5])},makeBoundingBoxFromPoints:function(e,r){if(r)for(var n=0;n<e.length;n++)e[n]=t.util.transformPoint(e[n],r);var i=[e[0].x,e[1].x,e[2].x,e[3].x],o=t.util.array.min(i),a=t.util.array.max(i)-o,s=[e[0].y,e[1].y,e[2].y,e[3].y],l=t.util.array.min(s);return{left:o,top:l,width:a,height:t.util.array.max(s)-l}},invertTransform:function(e){var r=1/(e[0]*e[3]-e[1]*e[2]),n=[r*e[3],-r*e[1],-r*e[2],r*e[0]],i=t.util.transformPoint({x:e[4],y:e[5]},n,!0);return n[4]=-i.x,n[5]=-i.y,n},toFixed:function(e,t){return parseFloat(Number(e).toFixed(t))},parseUnit:function(e,r){var n=/\D{0,2}$/.exec(e),i=parseFloat(e);switch(r||(r=t.Text.DEFAULT_SVG_FONT_SIZE),n[0]){case"mm":return i*t.DPI/25.4;case"cm":return i*t.DPI/2.54;case"in":return i*t.DPI;case"pt":return i*t.DPI/72;case"pc":return i*t.DPI/72*12;case"em":return i*r;default:return i}},falseFunction:function(){return!1},getKlass:function(e,r){return e=t.util.string.camelize(e.charAt(0).toUpperCase()+e.slice(1)),t.util.resolveNamespace(r)[e]},getSvgAttributes:function(e){var t=["instantiated_by_use","style","id","class"];switch(e){case"linearGradient":t=t.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":t=t.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":t=t.concat(["offset","stop-color","stop-opacity"])}return t},resolveNamespace:function(r){if(!r)return t;var n,i=r.split("."),o=i.length,a=e||t.window;for(n=0;n<o;++n)a=a[i[n]];return a},loadImage:function(e,r,n,i){if(e){var o=t.util.createImage(),a=function(){r&&r.call(n,o,!1),o=o.onload=o.onerror=null};o.onload=a,o.onerror=function(){t.log("Error loading "+o.src),r&&r.call(n,null,!0),o=o.onload=o.onerror=null},0!==e.indexOf("data")&&null!=i&&(o.crossOrigin=i),"data:image/svg"===e.substring(0,14)&&(o.onload=null,t.util.loadImageInDom(o,a)),o.src=e}else r&&r.call(n,e)},loadImageInDom:function(e,r){var n=t.document.createElement("div");n.style.width=n.style.height="1px",n.style.left=n.style.top="-100%",n.style.position="absolute",n.appendChild(e),t.document.querySelector("body").appendChild(n),e.onload=function(){r(),n.parentNode.removeChild(n),n=null}},enlivenObjects:function(e,r,n,i){var o=[],a=0,s=(e=e||[]).length;function l(){++a===s&&r&&r(o.filter(function(e){return e}))}s?e.forEach(function(e,r){e&&e.type?t.util.getKlass(e.type,n).fromObject(e,function(t,n){n||(o[r]=t),i&&i(e,t,n),l()}):l()}):r&&r(o)},enlivenObjectEnlivables:function(e,r,n){var i=t.Object.ENLIVEN_PROPS.filter(function(t){return!!e[t]});t.util.enlivenObjects(i.map(function(t){return e[t]}),function(e){var t={};i.forEach(function(n,i){t[n]=e[i],r&&(r[n]=e[i])}),n&&n(t)})},enlivenPatterns:function(e,r){function n(){++o===a&&r&&r(i)}var i=[],o=0,a=(e=e||[]).length;a?e.forEach(function(e,r){e&&e.source?new t.Pattern(e,function(e){i[r]=e,n()}):(i[r]=e,n())}):r&&r(i)},groupSVGElements:function(e,r,n){var i;return e&&1===e.length?(typeof n<"u"&&(e[0].sourcePath=n),e[0]):(r&&(r.width&&r.height?r.centerPoint={x:r.width/2,y:r.height/2}:(delete r.width,delete r.height)),i=new t.Group(e,r),typeof n<"u"&&(i.sourcePath=n),i)},populateWithProperties:function(e,t,r){if(r&&Array.isArray(r))for(var n=0,i=r.length;n<i;n++)r[n]in e&&(t[r[n]]=e[r[n]])},createCanvasElement:function(){return t.document.createElement("canvas")},copyCanvasElement:function(e){var r=t.util.createCanvasElement();return r.width=e.width,r.height=e.height,r.getContext("2d").drawImage(e,0,0),r},toDataURL:function(e,t,r){return e.toDataURL("image/"+t,r)},createImage:function(){return t.document.createElement("img")},multiplyTransformMatrices:function(e,t,r){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],r?0:e[0]*t[4]+e[2]*t[5]+e[4],r?0:e[1]*t[4]+e[3]*t[5]+e[5]]},qrDecompose:function(e){var t=n(e[1],e[0]),a=i(e[0],2)+i(e[1],2),s=r(a),l=(e[0]*e[3]-e[2]*e[1])/s,c=n(e[0]*e[2]+e[1]*e[3],a);return{angle:t/o,scaleX:s,scaleY:l,skewX:c/o,skewY:0,translateX:e[4],translateY:e[5]}},calcRotateMatrix:function(e){if(!e.angle)return t.iMatrix.concat();var r=t.util.degreesToRadians(e.angle),n=t.util.cos(r),i=t.util.sin(r);return[n,i,-i,n,0,0]},calcDimensionsMatrix:function(e){var r=typeof e.scaleX>"u"?1:e.scaleX,n=typeof e.scaleY>"u"?1:e.scaleY,i=[e.flipX?-r:r,0,0,e.flipY?-n:n,0,0],o=t.util.multiplyTransformMatrices,a=t.util.degreesToRadians;return e.skewX&&(i=o(i,[1,0,Math.tan(a(e.skewX)),1],!0)),e.skewY&&(i=o(i,[1,Math.tan(a(e.skewY)),0,1],!0)),i},composeMatrix:function(e){var r=[1,0,0,1,e.translateX||0,e.translateY||0],n=t.util.multiplyTransformMatrices;return e.angle&&(r=n(r,t.util.calcRotateMatrix(e))),(1!==e.scaleX||1!==e.scaleY||e.skewX||e.skewY||e.flipX||e.flipY)&&(r=n(r,t.util.calcDimensionsMatrix(e))),r},resetObjectTransform:function(e){e.scaleX=1,e.scaleY=1,e.skewX=0,e.skewY=0,e.flipX=!1,e.flipY=!1,e.rotate(0)},saveObjectTransform:function(e){return{scaleX:e.scaleX,scaleY:e.scaleY,skewX:e.skewX,skewY:e.skewY,angle:e.angle,left:e.left,flipX:e.flipX,flipY:e.flipY,top:e.top}},isTransparent:function(e,t,r,n){n>0&&(t>n?t-=n:t=0,r>n?r-=n:r=0);var i,o=!0,a=e.getImageData(t,r,2*n||1,2*n||1),s=a.data.length;for(i=3;i<s&&!1!==(o=a.data[i]<=0);i+=4);return a=null,o},parsePreserveAspectRatioAttribute:function(e){var t,r="meet",n=e.split(" ");return n&&n.length&&("meet"!==(r=n.pop())&&"slice"!==r?(t=r,r="meet"):n.length&&(t=n.pop())),{meetOrSlice:r,alignX:"none"!==t?t.slice(1,4):"none",alignY:"none"!==t?t.slice(5,8):"none"}},clearFabricFontCache:function(e){(e=(e||"").toLowerCase())?t.charWidthsCache[e]&&delete t.charWidthsCache[e]:t.charWidthsCache={}},limitDimsByArea:function(e,t){var r=Math.sqrt(t*e),n=Math.floor(t/r);return{x:Math.floor(r),y:n}},capValue:function(e,t,r){return Math.max(e,Math.min(t,r))},findScaleToFit:function(e,t){return Math.min(t.width/e.width,t.height/e.height)},findScaleToCover:function(e,t){return Math.max(t.width/e.width,t.height/e.height)},matrixToSVG:function(e){return"matrix("+e.map(function(e){return t.util.toFixed(e,t.Object.NUM_FRACTION_DIGITS)}).join(" ")+")"},removeTransformFromObject:function(e,r){var n=t.util.invertTransform(r),i=t.util.multiplyTransformMatrices(n,e.calcOwnMatrix());t.util.applyTransformToObject(e,i)},addTransformToObject:function(e,r){t.util.applyTransformToObject(e,t.util.multiplyTransformMatrices(r,e.calcOwnMatrix()))},applyTransformToObject:function(e,r){var n=t.util.qrDecompose(r),i=new t.Point(n.translateX,n.translateY);e.flipX=!1,e.flipY=!1,e.set("scaleX",n.scaleX),e.set("scaleY",n.scaleY),e.skewX=n.skewX,e.skewY=n.skewY,e.angle=n.angle,e.setPositionByOrigin(i,"center","center")},sizeAfterTransform:function(e,r,n){var i=e/2,o=r/2,a=[{x:-i,y:-o},{x:i,y:-o},{x:-i,y:o},{x:i,y:o}],s=t.util.calcDimensionsMatrix(n),l=t.util.makeBoundingBoxFromPoints(a,s);return{x:l.width,y:l.height}},mergeClipPaths:function(e,r){var n=e,i=r;n.inverted&&!i.inverted&&(n=r,i=e),t.util.applyTransformToObject(i,t.util.multiplyTransformMatrices(t.util.invertTransform(n.calcTransformMatrix()),i.calcTransformMatrix()));var o=n.inverted&&i.inverted;return o&&(n.inverted=i.inverted=!1),new t.Group([n],{clipPath:i,inverted:o})},hasStyleChanged:function(e,t,r){return r=r||!1,e.fill!==t.fill||e.stroke!==t.stroke||e.strokeWidth!==t.strokeWidth||e.fontSize!==t.fontSize||e.fontFamily!==t.fontFamily||e.fontWeight!==t.fontWeight||e.fontStyle!==t.fontStyle||e.textBackgroundColor!==t.textBackgroundColor||e.deltaY!==t.deltaY||r&&(e.overline!==t.overline||e.underline!==t.underline||e.linethrough!==t.linethrough)},stylesToArray:function(e,r){e=t.util.object.clone(e,!0);for(var n=r.split("\n"),i=-1,o={},a=[],s=0;s<n.length;s++)if(e[s])for(var l=0;l<n[s].length;l++){i++;var c=e[s][l];if(c&&Object.keys(c).length>0)t.util.hasStyleChanged(o,c,!0)?a.push({start:i,end:i+1,style:c}):a[a.length-1].end++;o=c||{}}else i+=n[s].length;return a},stylesFromArray:function(e,t){if(!Array.isArray(e))return e;for(var r=t.split("\n"),n=-1,i=0,o={},a=0;a<r.length;a++)for(var s=0;s<r[a].length;s++)n++,e[i]&&e[i].start<=n&&n<e[i].end&&(o[a]=o[a]||{},o[a][s]=Object.assign({},e[i].style),n===e[i].end-1&&i++);return o}}}(e),function(){var e=Array.prototype.join,r={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},n={m:"l",M:"L"};function i(e,r,n,i,o,a,s,l,c,u,d){var h=t.util.cos(e),f=t.util.sin(e),p=t.util.cos(r),g=t.util.sin(r),m=n*o*p-i*a*g+s,v=i*o*p+n*a*g+l;return["C",u+c*(-n*o*f-i*a*h),d+c*(-i*o*f+n*a*h),m+c*(n*o*g+i*a*p),v+c*(i*o*g-n*a*p),m,v]}function o(e,t,r,n){var i=Math.atan2(t,e),o=Math.atan2(n,r);return o>=i?o-i:2*Math.PI-(i-o)}function a(e,r,n){for(var a=n[1],s=n[2],l=n[3],c=n[4],u=n[5],d=function(e,r,n,a,s,l,c){var u=Math.PI,d=c*u/180,h=t.util.sin(d),f=t.util.cos(d),p=0,g=0,m=-f*e*.5-h*r*.5,v=-f*r*.5+h*e*.5,y=(n=Math.abs(n))*n,b=(a=Math.abs(a))*a,w=v*v,x=m*m,C=y*b-y*w-b*x,_=0;if(C<0){var S=Math.sqrt(1-C/(y*b));n*=S,a*=S}else _=(s===l?-1:1)*Math.sqrt(C/(y*w+b*x));var A=_*n*v/a,k=-_*a*m/n,E=f*A-h*k+.5*e,I=h*A+f*k+.5*r,T=o(1,0,(m-A)/n,(v-k)/a),F=o((m-A)/n,(v-k)/a,(-m-A)/n,(-v-k)/a);0===l&&F>0?F-=2*u:1===l&&F<0&&(F+=2*u);for(var O=Math.ceil(Math.abs(F/u*2)),P=[],M=F/O,R=8/3*Math.sin(M/4)*Math.sin(M/4)/Math.sin(M/2),L=T+M,N=0;N<O;N++)P[N]=i(T,L,f,h,n,a,E,I,R,p,g),p=P[N][5],g=P[N][6],T=L,L+=M;return P}(n[6]-e,n[7]-r,a,s,c,u,l),h=0,f=d.length;h<f;h++)d[h][1]+=e,d[h][2]+=r,d[h][3]+=e,d[h][4]+=r,d[h][5]+=e,d[h][6]+=r;return d}function s(e,t,r,n){return Math.sqrt((r-e)*(r-e)+(n-t)*(n-t))}function l(e,t,r,n,i,o,a,s){return function(l){var c=function(e){return e*e*e}(l),u=function(e){return 3*e*e*(1-e)}(l),d=function(e){return 3*e*(1-e)*(1-e)}(l),h=function(e){return(1-e)*(1-e)*(1-e)}(l);return{x:a*c+i*u+r*d+e*h,y:s*c+o*u+n*d+t*h}}}function c(e,t,r,n,i,o,a,s){return function(l){var c=1-l,u=3*c*c*(r-e)+6*c*l*(i-r)+3*l*l*(a-i),d=3*c*c*(n-t)+6*c*l*(o-n)+3*l*l*(s-o);return Math.atan2(d,u)}}function u(e,t,r,n,i,o){return function(a){var s=function(e){return e*e}(a),l=function(e){return 2*e*(1-e)}(a),c=function(e){return(1-e)*(1-e)}(a);return{x:i*s+r*l+e*c,y:o*s+n*l+t*c}}}function d(e,t,r,n,i,o){return function(a){var s=1-a,l=2*s*(r-e)+2*a*(i-r),c=2*s*(n-t)+2*a*(o-n);return Math.atan2(c,l)}}function h(e,t,r){var n,i,o={x:t,y:r},a=0;for(i=1;i<=100;i+=1)n=e(i/100),a+=s(o.x,o.y,n.x,n.y),o=n;return a}function f(e,t){for(var r,n,i,o=0,a=0,l=e.iterator,c={x:e.x,y:e.y},u=.01,d=e.angleFinder;a<t&&u>1e-4;)r=l(o),i=o,(n=s(c.x,c.y,r.x,r.y))+a>t?(o-=u,u/=2):(c=r,o+=u,a+=n);return r.angle=d(i),r}function p(e){for(var t,r,n,i,o=0,a=e.length,f=0,p=0,g=0,m=0,v=[],y=0;y<a;y++){switch(n={x:f,y:p,command:(t=e[y])[0]},t[0]){case"M":n.length=0,g=f=t[1],m=p=t[2];break;case"L":n.length=s(f,p,t[1],t[2]),f=t[1],p=t[2];break;case"C":r=l(f,p,t[1],t[2],t[3],t[4],t[5],t[6]),i=c(f,p,t[1],t[2],t[3],t[4],t[5],t[6]),n.iterator=r,n.angleFinder=i,n.length=h(r,f,p),f=t[5],p=t[6];break;case"Q":r=u(f,p,t[1],t[2],t[3],t[4]),i=d(f,p,t[1],t[2],t[3],t[4]),n.iterator=r,n.angleFinder=i,n.length=h(r,f,p),f=t[3],p=t[4];break;case"Z":case"z":n.destX=g,n.destY=m,n.length=s(f,p,g,m),f=g,p=m}o+=n.length,v.push(n)}return v.push({length:o,x:f,y:p}),v}t.util.joinPath=function(e){return e.map(function(e){return e.join(" ")}).join(" ")},t.util.parsePath=function(e){var i,o,a,s,l,c=[],u=[],d=t.rePathCommand,h="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+h+")"+t.commaWsp,p="([01])"+t.commaWsp+"?",g=new RegExp(f+"?"+f+"?"+f+p+p+f+"?("+h+")","g");if(!e||!e.match)return c;for(var m,v=0,y=(l=e.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;v<y;v++){s=(i=l[v]).slice(1).trim(),u.length=0;var b=i.charAt(0);if(m=[b],"a"===b.toLowerCase())for(var w;w=g.exec(s);)for(var x=1;x<w.length;x++)u.push(w[x]);else for(;a=d.exec(s);)u.push(a[0]);x=0;for(var C=u.length;x<C;x++)o=parseFloat(u[x]),isNaN(o)||m.push(o);var _=r[b.toLowerCase()],S=n[b]||b;if(m.length-1>_)for(var A=1,k=m.length;A<k;A+=_)c.push([b].concat(m.slice(A,A+_))),b=S;else c.push(m)}return c},t.util.makePathSimpler=function(e){var t,r,n,i,o,s,l=0,c=0,u=e.length,d=0,h=0,f=[];for(r=0;r<u;++r){switch(n=!1,(t=e[r].slice(0))[0]){case"l":t[0]="L",t[1]+=l,t[2]+=c;case"L":l=t[1],c=t[2];break;case"h":t[1]+=l;case"H":t[0]="L",t[2]=c,l=t[1];break;case"v":t[1]+=c;case"V":t[0]="L",c=t[1],t[1]=l,t[2]=c;break;case"m":t[0]="M",t[1]+=l,t[2]+=c;case"M":l=t[1],c=t[2],d=t[1],h=t[2];break;case"c":t[0]="C",t[1]+=l,t[2]+=c,t[3]+=l,t[4]+=c,t[5]+=l,t[6]+=c;case"C":o=t[3],s=t[4],l=t[5],c=t[6];break;case"s":t[0]="S",t[1]+=l,t[2]+=c,t[3]+=l,t[4]+=c;case"S":"C"===i?(o=2*l-o,s=2*c-s):(o=l,s=c),l=t[3],c=t[4],t[0]="C",t[5]=t[3],t[6]=t[4],t[3]=t[1],t[4]=t[2],t[1]=o,t[2]=s,o=t[3],s=t[4];break;case"q":t[0]="Q",t[1]+=l,t[2]+=c,t[3]+=l,t[4]+=c;case"Q":o=t[1],s=t[2],l=t[3],c=t[4];break;case"t":t[0]="T",t[1]+=l,t[2]+=c;case"T":"Q"===i?(o=2*l-o,s=2*c-s):(o=l,s=c),t[0]="Q",l=t[1],c=t[2],t[1]=o,t[2]=s,t[3]=l,t[4]=c;break;case"a":t[0]="A",t[6]+=l,t[7]+=c;case"A":n=!0,f=f.concat(a(l,c,t)),l=t[6],c=t[7];break;case"z":case"Z":l=d,c=h}n||f.push(t),i=t[0]}return f},t.util.getSmoothPathFromPoints=function(e,r){var n,i=[],o=new t.Point(e[0].x,e[0].y),a=new t.Point(e[1].x,e[1].y),s=e.length,l=1,c=0,u=s>2;for(r=r||0,u&&(l=e[2].x<a.x?-1:e[2].x===a.x?0:1,c=e[2].y<a.y?-1:e[2].y===a.y?0:1),i.push(["M",o.x-l*r,o.y-c*r]),n=1;n<s;n++){if(!o.eq(a)){var d=o.midPointFrom(a);i.push(["Q",o.x,o.y,d.x,d.y])}o=e[n],n+1<e.length&&(a=e[n+1])}return u&&(l=o.x>e[n-2].x?1:o.x===e[n-2].x?0:-1,c=o.y>e[n-2].y?1:o.y===e[n-2].y?0:-1),i.push(["L",o.x+l*r,o.y+c*r]),i},t.util.getPathSegmentsInfo=p,t.util.getBoundsOfCurve=function(r,n,i,o,a,s,l,c){var u;if(t.cachesBoundsOfCurve&&(u=e.call(arguments),t.boundsOfCurveCache[u]))return t.boundsOfCurveCache[u];var d,h,f,p,g,m,v,y,b=Math.sqrt,w=Math.min,x=Math.max,C=Math.abs,_=[],S=[[],[]];h=6*r-12*i+6*a,d=-3*r+9*i-9*a+3*l,f=3*i-3*r;for(var A=0;A<2;++A)if(A>0&&(h=6*n-12*o+6*s,d=-3*n+9*o-9*s+3*c,f=3*o-3*n),C(d)<1e-12){if(C(h)<1e-12)continue;0<(p=-f/h)&&p<1&&_.push(p)}else!((v=h*h-4*f*d)<0)&&(0<(g=(-h+(y=b(v)))/(2*d))&&g<1&&_.push(g),0<(m=(-h-y)/(2*d))&&m<1&&_.push(m));for(var k,E,I,T=_.length,F=T;T--;)k=(I=1-(p=_[T]))*I*I*r+3*I*I*p*i+3*I*p*p*a+p*p*p*l,S[0][T]=k,E=I*I*I*n+3*I*I*p*o+3*I*p*p*s+p*p*p*c,S[1][T]=E;S[0][F]=r,S[1][F]=n,S[0][F+1]=l,S[1][F+1]=c;var O=[{x:w.apply(null,S[0]),y:w.apply(null,S[1])},{x:x.apply(null,S[0]),y:x.apply(null,S[1])}];return t.cachesBoundsOfCurve&&(t.boundsOfCurveCache[u]=O),O},t.util.getPointOnPath=function(e,r,n){n||(n=p(e));for(var i=0;r-n[i].length>0&&i<n.length-2;)r-=n[i].length,i++;var o,a=n[i],s=r/a.length,l=a.command,c=e[i];switch(l){case"M":return{x:a.x,y:a.y,angle:0};case"Z":case"z":return(o=new t.Point(a.x,a.y).lerp(new t.Point(a.destX,a.destY),s)).angle=Math.atan2(a.destY-a.y,a.destX-a.x),o;case"L":return(o=new t.Point(a.x,a.y).lerp(new t.Point(c[1],c[2]),s)).angle=Math.atan2(c[2]-a.y,c[1]-a.x),o;case"C":case"Q":return f(a,r)}},t.util.transformPath=function(e,r,n){return n&&(r=t.util.multiplyTransformMatrices(r,[1,0,0,1,-n.x,-n.y])),e.map(function(e){for(var n=e.slice(0),i={},o=1;o<e.length-1;o+=2)i.x=e[o],i.y=e[o+1],i=t.util.transformPoint(i,r),n[o]=i.x,n[o+1]=i.y;return n})}}(),function(){var e=Array.prototype.slice;function r(e,t,r){if(e&&0!==e.length){var n=e.length-1,i=t?e[n][t]:e[n];if(t)for(;n--;)r(e[n][t],i)&&(i=e[n][t]);else for(;n--;)r(e[n],i)&&(i=e[n]);return i}}t.util.array={fill:function(e,t){for(var r=e.length;r--;)e[r]=t;return e},invoke:function(t,r){for(var n=e.call(arguments,2),i=[],o=0,a=t.length;o<a;o++)i[o]=n.length?t[o][r].apply(t[o],n):t[o][r].call(t[o]);return i},min:function(e,t){return r(e,t,function(e,t){return e<t})},max:function(e,t){return r(e,t,function(e,t){return e>=t})}}}(),function(){function e(r,n,i){if(i)if(!t.isLikelyNode&&n instanceof Element)r=n;else if(n instanceof Array){r=[];for(var o=0,a=n.length;o<a;o++)r[o]=e({},n[o],i)}else if(n&&"object"==typeof n)for(var s in n)"canvas"===s||"group"===s?r[s]=null:n.hasOwnProperty(s)&&(r[s]=e({},n[s],i));else r=n;else for(var s in n)r[s]=n[s];return r}t.util.object={extend:e,clone:function(t,r){return e({},t,r)}},t.util.object.extend(t.util,t.Observable)}(),function(){function e(e,t){var r=e.charCodeAt(t);if(isNaN(r))return"";if(r<55296||r>57343)return e.charAt(t);if(55296<=r&&r<=56319){if(e.length<=t+1)throw"High surrogate without following low surrogate";var n=e.charCodeAt(t+1);if(56320>n||n>57343)throw"High surrogate without following low surrogate";return e.charAt(t)+e.charAt(t+1)}if(0===t)throw"Low surrogate without preceding high surrogate";var i=e.charCodeAt(t-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1}t.util.string={camelize:function(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():""})},capitalize:function(e,t){return e.charAt(0).toUpperCase()+(t?e.slice(1):e.slice(1).toLowerCase())},escapeXml:function(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},graphemeSplit:function(t){var r,n=0,i=[];for(n=0;n<t.length;n++)!1!==(r=e(t,n))&&i.push(r);return i}}}(),function(){var e=Array.prototype.slice,r=function(){},n=function(){for(var e in{toString:1})if("toString"===e)return!1;return!0}(),i=function(e,t,r){for(var i in t)i in e.prototype&&"function"==typeof e.prototype[i]&&(t[i]+"").indexOf("callSuper")>-1?e.prototype[i]=function(e){return function(){var n=this.constructor.superclass;this.constructor.superclass=r;var i=t[e].apply(this,arguments);if(this.constructor.superclass=n,"initialize"!==e)return i}}(i):e.prototype[i]=t[i],n&&(t.toString!==Object.prototype.toString&&(e.prototype.toString=t.toString),t.valueOf!==Object.prototype.valueOf&&(e.prototype.valueOf=t.valueOf))};function o(){}function a(t){for(var r=null,n=this;n.constructor.superclass;){var i=n.constructor.superclass.prototype[t];if(n[t]!==i){r=i;break}n=n.constructor.superclass.prototype}return r?arguments.length>1?r.apply(this,e.call(arguments,1)):r.call(this):console.log("tried to callSuper "+t+", method not found in prototype chain",this)}t.util.createClass=function(){var t=null,n=e.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"==typeof n[0]&&(t=n.shift()),s.superclass=t,s.subclasses=[],t&&(o.prototype=t.prototype,s.prototype=new o,t.subclasses.push(s));for(var l=0,c=n.length;l<c;l++)i(s,n[l],t);return s.prototype.initialize||(s.prototype.initialize=r),s.prototype.constructor=s,s.prototype.callSuper=a,s}}(),function(){var e=!!t.document.createElement("div").attachEvent,r=["touchstart","touchmove","touchend"];t.util.addListener=function(t,r,n,i){t&&t.addEventListener(r,n,!e&&i)},t.util.removeListener=function(t,r,n,i){t&&t.removeEventListener(r,n,!e&&i)},t.util.getPointer=function(e){var r=e.target,n=t.util.getScrollLeftTop(r),i=function(e){var t=e.changedTouches;return t&&t[0]?t[0]:e}(e);return{x:i.clientX+n.left,y:i.clientY+n.top}},t.util.isTouchEvent=function(e){return r.indexOf(e.type)>-1||"touch"===e.pointerType}}(),function(){var e=t.document.createElement("div"),r="string"==typeof e.style.opacity,n="string"==typeof e.style.filter,i=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(e){return e};r?o=function(e,t){return e.style.opacity=t,e}:n&&(o=function(e,t){var r=e.style;return e.currentStyle&&!e.currentStyle.hasLayout&&(r.zoom=1),i.test(r.filter)?(t=t>=.9999?"":"alpha(opacity="+100*t+")",r.filter=r.filter.replace(i,t)):r.filter+=" alpha(opacity="+100*t+")",e}),t.util.setStyle=function(e,t){var r=e.style;if(!r)return e;if("string"==typeof t)return e.style.cssText+=";"+t,t.indexOf("opacity")>-1?o(e,t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var n in t)if("opacity"===n)o(e,t[n]);else{var i="float"===n||"cssFloat"===n?typeof r.styleFloat>"u"?"cssFloat":"styleFloat":n;r.setProperty(i,t[n])}return e}}(),function(){var e=Array.prototype.slice;var r,n,i,o,a=function(t){return e.call(t,0)};try{r=a(t.document.childNodes)instanceof Array}catch{}function s(e,r){var n=t.document.createElement(e);for(var i in r)"class"===i?n.className=r[i]:"for"===i?n.htmlFor=r[i]:n.setAttribute(i,r[i]);return n}function l(e){for(var r=0,n=0,i=t.document.documentElement,o=t.document.body||{scrollLeft:0,scrollTop:0};e&&(e.parentNode||e.host)&&((e=e.parentNode||e.host)===t.document?(r=o.scrollLeft||i.scrollLeft||0,n=o.scrollTop||i.scrollTop||0):(r+=e.scrollLeft||0,n+=e.scrollTop||0),1!==e.nodeType||"fixed"!==e.style.position););return{left:r,top:n}}r||(a=function(e){for(var t=new Array(e.length),r=e.length;r--;)t[r]=e[r];return t}),n=t.document.defaultView&&t.document.defaultView.getComputedStyle?function(e,r){var n=t.document.defaultView.getComputedStyle(e,null);return n?n[r]:void 0}:function(e,t){var r=e.style[t];return!r&&e.currentStyle&&(r=e.currentStyle[t]),r},i=t.document.documentElement.style,o="userSelect"in i?"userSelect":"MozUserSelect"in i?"MozUserSelect":"WebkitUserSelect"in i?"WebkitUserSelect":"KhtmlUserSelect"in i?"KhtmlUserSelect":"",t.util.makeElementUnselectable=function(e){return typeof e.onselectstart<"u"&&(e.onselectstart=t.util.falseFunction),o?e.style[o]="none":"string"==typeof e.unselectable&&(e.unselectable="on"),e},t.util.makeElementSelectable=function(e){return typeof e.onselectstart<"u"&&(e.onselectstart=null),o?e.style[o]="":"string"==typeof e.unselectable&&(e.unselectable=""),e},t.util.setImageSmoothing=function(e,t){e.imageSmoothingEnabled=e.imageSmoothingEnabled||e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled||e.oImageSmoothingEnabled,e.imageSmoothingEnabled=t},t.util.getById=function(e){return"string"==typeof e?t.document.getElementById(e):e},t.util.toArray=a,t.util.addClass=function(e,t){e&&-1===(" "+e.className+" ").indexOf(" "+t+" ")&&(e.className+=(e.className?" ":"")+t)},t.util.makeElement=s,t.util.wrapElement=function(e,t,r){return"string"==typeof t&&(t=s(t,r)),e.parentNode&&e.parentNode.replaceChild(t,e),t.appendChild(e),t},t.util.getScrollLeftTop=l,t.util.getElementOffset=function(e){var t,r,i=e&&e.ownerDocument,o={left:0,top:0},a={left:0,top:0},s={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!i)return a;for(var c in s)a[s[c]]+=parseInt(n(e,c),10)||0;return t=i.documentElement,typeof e.getBoundingClientRect<"u"&&(o=e.getBoundingClientRect()),r=l(e),{left:o.left+r.left-(t.clientLeft||0)+a.left,top:o.top+r.top-(t.clientTop||0)+a.top}},t.util.getNodeCanvas=function(e){var r=t.jsdomImplForWrapper(e);return r._canvas||r._image},t.util.cleanUpJsdomNode=function(e){if(t.isLikelyNode){var r=t.jsdomImplForWrapper(e);r&&(r._image=null,r._canvas=null,r._currentSrc=null,r._attributes=null,r._classList=null)}}}(),function(){function e(){}t.util.request=function(r,n){n||(n={});var i=n.method?n.method.toUpperCase():"GET",o=n.onComplete||function(){},a=new t.window.XMLHttpRequest,s=n.body||n.parameters;return a.onreadystatechange=function(){4===a.readyState&&(o(a),a.onreadystatechange=e)},"GET"===i&&(s=null,"string"==typeof n.parameters&&(r=function(e,t){return e+(/\?/.test(e)?"&":"?")+t}(r,n.parameters))),a.open(i,r,!0),("POST"===i||"PUT"===i)&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(s),a}}(),t.log=console.log,t.warn=console.warn,function(){var e=t.util.object.extend,r=t.util.object.clone,n=[];function i(){return!1}function o(e,t,r,n){return-r*Math.cos(e/n*(Math.PI/2))+r+t}t.util.object.extend(n,{cancelAll:function(){var e=this.splice(0);return e.forEach(function(e){e.cancel()}),e},cancelByCanvas:function(e){if(!e)return[];var t=this.filter(function(t){return"object"==typeof t.target&&t.target.canvas===e});return t.forEach(function(e){e.cancel()}),t},cancelByTarget:function(e){var t=this.findAnimationsByTarget(e);return t.forEach(function(e){e.cancel()}),t},findAnimationIndex:function(e){return this.indexOf(this.findAnimation(e))},findAnimation:function(e){return this.find(function(t){return t.cancel===e})},findAnimationsByTarget:function(e){return e?this.filter(function(t){return t.target===e}):[]}});var a=t.window.requestAnimationFrame||t.window.webkitRequestAnimationFrame||t.window.mozRequestAnimationFrame||t.window.oRequestAnimationFrame||t.window.msRequestAnimationFrame||function(e){return t.window.setTimeout(e,1e3/60)},s=t.window.cancelAnimationFrame||t.window.clearTimeout;function l(){return a.apply(t.window,arguments)}t.util.animate=function(n){n||(n={});var a,s=!1,c=function(){var e=t.runningAnimations.indexOf(a);return e>-1&&t.runningAnimations.splice(e,1)[0]};return a=e(r(n),{cancel:function(){return s=!0,c()},currentValue:"startValue"in n?n.startValue:0,completionRate:0,durationRate:0}),t.runningAnimations.push(a),l(function(e){var t,r=e||+new Date,u=n.duration||500,d=r+u,h=n.onChange||i,f=n.abort||i,p=n.onComplete||i,g=n.easing||o,m="startValue"in n&&n.startValue.length>0,v="startValue"in n?n.startValue:0,y="endValue"in n?n.endValue:100,b=n.byValue||(m?v.map(function(e,t){return y[t]-v[t]}):y-v);n.onStart&&n.onStart(),function e(n){var i=(t=n||+new Date)>d?u:t-r,o=i/u,w=m?v.map(function(e,t){return g(i,v[t],b[t],u)}):g(i,v,b,u),x=Math.abs(m?(w[0]-v[0])/b[0]:(w-v)/b);if(a.currentValue=m?w.slice():w,a.completionRate=x,a.durationRate=o,!s){if(f(w,x,o))return void c();if(t>d)return a.currentValue=m?y.slice():y,a.completionRate=1,a.durationRate=1,h(m?y.slice():y,1,1),p(y,1,1),void c();h(w,x,o),l(e)}}(r)}),a.cancel},t.util.requestAnimFrame=l,t.util.cancelAnimFrame=function(){return s.apply(t.window,arguments)},t.runningAnimations=n}(),function(){function e(e,t,r){var n="rgba("+parseInt(e[0]+r*(t[0]-e[0]),10)+","+parseInt(e[1]+r*(t[1]-e[1]),10)+","+parseInt(e[2]+r*(t[2]-e[2]),10);return n+=","+(e&&t?parseFloat(e[3]+r*(t[3]-e[3])):1),n+=")"}t.util.animateColor=function(r,n,i,o){var a=new t.Color(r).getSource(),s=new t.Color(n).getSource(),l=o.onComplete,c=o.onChange;return o=o||{},t.util.animate(t.util.object.extend(o,{duration:i||500,startValue:a,endValue:s,byValue:s,easing:function(t,r,n,i){return e(r,n,o.colorEasing?o.colorEasing(t,i):1-Math.cos(t/i*(Math.PI/2)))},onComplete:function(t,r,n){if(l)return l(e(s,s,0),r,n)},onChange:function(t,r,n){if(c){if(Array.isArray(t))return c(e(t,t,0),r,n);c(t,r,n)}}}))}}(),function(){function e(e,t,r,n){return e<Math.abs(t)?(e=t,n=r/4):n=0===t&&0===e?r/(2*Math.PI)*Math.asin(1):r/(2*Math.PI)*Math.asin(t/e),{a:e,c:t,p:r,s:n}}function r(e,t,r){return e.a*Math.pow(2,10*(t-=1))*Math.sin((t*r-e.s)*(2*Math.PI)/e.p)}function n(e,t,r,n){return r-i(n-e,0,r,n)+t}function i(e,t,r,n){return(e/=n)<1/2.75?r*(7.5625*e*e)+t:e<2/2.75?r*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?r*(7.5625*(e-=2.25/2.75)*e+.9375)+t:r*(7.5625*(e-=2.625/2.75)*e+.984375)+t}t.util.ease={easeInQuad:function(e,t,r,n){return r*(e/=n)*e+t},easeOutQuad:function(e,t,r,n){return-r*(e/=n)*(e-2)+t},easeInOutQuad:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e+t:-r/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,r,n){return r*(e/=n)*e*e+t},easeOutCubic:function(e,t,r,n){return r*((e=e/n-1)*e*e+1)+t},easeInOutCubic:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t},easeInQuart:function(e,t,r,n){return r*(e/=n)*e*e*e+t},easeOutQuart:function(e,t,r,n){return-r*((e=e/n-1)*e*e*e-1)+t},easeInOutQuart:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e*e*e+t:-r/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(e,t,r,n){return r*(e/=n)*e*e*e*e+t},easeOutQuint:function(e,t,r,n){return r*((e=e/n-1)*e*e*e*e+1)+t},easeInOutQuint:function(e,t,r,n){return(e/=n/2)<1?r/2*e*e*e*e*e+t:r/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(e,t,r,n){return-r*Math.cos(e/n*(Math.PI/2))+r+t},easeOutSine:function(e,t,r,n){return r*Math.sin(e/n*(Math.PI/2))+t},easeInOutSine:function(e,t,r,n){return-r/2*(Math.cos(Math.PI*e/n)-1)+t},easeInExpo:function(e,t,r,n){return 0===e?t:r*Math.pow(2,10*(e/n-1))+t},easeOutExpo:function(e,t,r,n){return e===n?t+r:r*(1-Math.pow(2,-10*e/n))+t},easeInOutExpo:function(e,t,r,n){return 0===e?t:e===n?t+r:(e/=n/2)<1?r/2*Math.pow(2,10*(e-1))+t:r/2*(2-Math.pow(2,-10*--e))+t},easeInCirc:function(e,t,r,n){return-r*(Math.sqrt(1-(e/=n)*e)-1)+t},easeOutCirc:function(e,t,r,n){return r*Math.sqrt(1-(e=e/n-1)*e)+t},easeInOutCirc:function(e,t,r,n){return(e/=n/2)<1?-r/2*(Math.sqrt(1-e*e)-1)+t:r/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(t,n,i,o){var a=0;return 0===t?n:1===(t/=o)?n+i:(a||(a=.3*o),-r(e(i,i,a,1.70158),t,o)+n)},easeOutElastic:function(t,r,n,i){var o=0;if(0===t)return r;if(1===(t/=i))return r+n;o||(o=.3*i);var a=e(n,n,o,1.70158);return a.a*Math.pow(2,-10*t)*Math.sin((t*i-a.s)*(2*Math.PI)/a.p)+a.c+r},easeInOutElastic:function(t,n,i,o){var a=0;if(0===t)return n;if(2===(t/=o/2))return n+i;a||(a=o*(.3*1.5));var s=e(i,i,a,1.70158);return t<1?-.5*r(s,t,o)+n:s.a*Math.pow(2,-10*(t-=1))*Math.sin((t*o-s.s)*(2*Math.PI)/s.p)*.5+s.c+n},easeInBack:function(e,t,r,n,i){return void 0===i&&(i=1.70158),r*(e/=n)*e*((i+1)*e-i)+t},easeOutBack:function(e,t,r,n,i){return void 0===i&&(i=1.70158),r*((e=e/n-1)*e*((i+1)*e+i)+1)+t},easeInOutBack:function(e,t,r,n,i){return void 0===i&&(i=1.70158),(e/=n/2)<1?r/2*(e*e*((1+(i*=1.525))*e-i))+t:r/2*((e-=2)*e*((1+(i*=1.525))*e+i)+2)+t},easeInBounce:n,easeOutBounce:i,easeInOutBounce:function(e,t,r,o){return e<o/2?.5*n(2*e,0,r,o)+t:.5*i(2*e-o,0,r,o)+.5*r+t}}}(),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.object.clone,i=t.util.toFixed,o=t.util.parseUnit,a=t.util.multiplyTransformMatrices,s={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-dashoffset":"strokeDashOffset","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity","clip-path":"clipPath","clip-rule":"clipRule","vector-effect":"strokeUniform","image-rendering":"imageSmoothing"},l={stroke:"strokeOpacity",fill:"fillOpacity"},c="font-size",u="clip-path";function d(e){return e in s?s[e]:e}function h(e,r,n,i){var s,l=Array.isArray(r);if("fill"!==e&&"stroke"!==e||"none"!==r){if("strokeUniform"===e)return"non-scaling-stroke"===r;if("strokeDashArray"===e)r="none"===r?null:r.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===e)r=n&&n.transformMatrix?a(n.transformMatrix,t.parseTransformAttribute(r)):t.parseTransformAttribute(r);else if("visible"===e)r="none"!==r&&"hidden"!==r,n&&!1===n.visible&&(r=!1);else if("opacity"===e)r=parseFloat(r),n&&typeof n.opacity<"u"&&(r*=n.opacity);else if("textAnchor"===e)r="start"===r?"left":"end"===r?"right":"center";else if("charSpacing"===e)s=o(r,i)/i*1e3;else if("paintFirst"===e){var c=r.indexOf("fill"),u=r.indexOf("stroke");r="fill";(c>-1&&u>-1&&u<c||-1===c&&u>-1)&&(r="stroke")}else{if("href"===e||"xlink:href"===e||"font"===e)return r;if("imageSmoothing"===e)return"optimizeQuality"===r;s=l?r.map(o):o(r,i)}}else r="";return!l&&isNaN(s)?r:s}function f(e){return new RegExp("^("+e.join("|")+")\\b","i")}function p(e,t){var r,n,i,o,a=[];for(i=0,o=t.length;i<o;i++)r=t[i],n=e.getElementsByTagName(r),a=a.concat(Array.prototype.slice.call(n));return a}function g(e,t){var r,n=!0;return(r=m(e,t.pop()))&&t.length&&(n=function(e,t){for(var r,n=!0;e.parentNode&&1===e.parentNode.nodeType&&t.length;)n&&(r=t.pop()),e=e.parentNode,n=m(e,r);return 0===t.length}(e,t)),r&&n&&0===t.length}function m(e,t){var r,n,i=e.nodeName,o=e.getAttribute("class"),a=e.getAttribute("id");if(r=new RegExp("^"+i,"i"),t=t.replace(r,""),a&&t.length&&(r=new RegExp("#"+a+"(?![a-zA-Z\\-]+)","i"),t=t.replace(r,"")),o&&t.length)for(n=(o=o.split(" ")).length;n--;)r=new RegExp("\\."+o[n]+"(?![a-zA-Z\\-]+)","i"),t=t.replace(r,"");return 0===t.length}function v(e,t){var r;if(e.getElementById&&(r=e.getElementById(t)),r)return r;var n,i,o,a=e.getElementsByTagName("*");for(i=0,o=a.length;i<o;i++)if(t===(n=a[i]).getAttribute("id"))return n}t.svgValidTagNamesRegEx=f(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),t.svgViewBoxElementsRegEx=f(["symbol","image","marker","pattern","view","svg"]),t.svgInvalidAncestorsRegEx=f(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),t.svgValidParentsRegEx=f(["symbol","g","a","svg","clipPath","defs"]),t.cssRules={},t.gradientDefs={},t.clipPaths={},t.parseTransformAttribute=function(){function e(e,r,n){e[n]=Math.tan(t.util.degreesToRadians(r[0]))}var r=t.iMatrix,n=t.reNum,i=t.commaWsp,o="(?:"+("(?:(matrix)\\s*\\(\\s*("+n+")"+i+"("+n+")"+i+"("+n+")"+i+"("+n+")"+i+"("+n+")"+i+"("+n+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+n+")(?:"+i+"("+n+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+n+")(?:"+i+"("+n+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+n+")(?:"+i+"("+n+")"+i+"("+n+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+n+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+n+")\\s*\\))")+")",a=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+i+"*"+o+")*)")+"?)\\s*$"),s=new RegExp(o,"g");return function(n){var i=r.concat(),l=[];if(!n||n&&!a.test(n))return i;n.replace(s,function(n){var a=new RegExp(o).exec(n).filter(function(e){return!!e}),s=a[1],c=a.slice(2).map(parseFloat);switch(s){case"translate":!function(e,t){e[4]=t[0],2===t.length&&(e[5]=t[1])}(i,c);break;case"rotate":c[0]=t.util.degreesToRadians(c[0]),function(e,r){var n=t.util.cos(r[0]),i=t.util.sin(r[0]),o=0,a=0;3===r.length&&(o=r[1],a=r[2]),e[0]=n,e[1]=i,e[2]=-i,e[3]=n,e[4]=o-(n*o-i*a),e[5]=a-(i*o+n*a)}(i,c);break;case"scale":!function(e,t){var r=t[0],n=2===t.length?t[1]:t[0];e[0]=r,e[3]=n}(i,c);break;case"skewX":e(i,c,2);break;case"skewY":e(i,c,1);break;case"matrix":i=c}l.push(i.concat()),i=r.concat()});for(var c=l[0];l.length>1;)l.shift(),c=t.util.multiplyTransformMatrices(c,l[0]);return c}}();var y=new RegExp("^\\s*("+t.reNum+"+)\\s*,?\\s*("+t.reNum+"+)\\s*,?\\s*("+t.reNum+"+)\\s*,?\\s*("+t.reNum+"+)\\s*$");function b(e){if(!t.svgViewBoxElementsRegEx.test(e.nodeName))return{};var r,n,i,a,s,l,c=e.getAttribute("viewBox"),u=1,d=1,h=e.getAttribute("width"),f=e.getAttribute("height"),p=e.getAttribute("x")||0,g=e.getAttribute("y")||0,m=e.getAttribute("preserveAspectRatio")||"",v=!c||!(c=c.match(y)),b=!h||!f||"100%"===h||"100%"===f,w=v&&b,x={},C="",_=0,S=0;if(x.width=0,x.height=0,x.toBeParsed=w,v&&(p||g)&&e.parentNode&&"#document"!==e.parentNode.nodeName&&(C=" translate("+o(p)+" "+o(g)+") ",s=(e.getAttribute("transform")||"")+C,e.setAttribute("transform",s),e.removeAttribute("x"),e.removeAttribute("y")),w)return x;if(v)return x.width=o(h),x.height=o(f),x;if(r=-parseFloat(c[1]),n=-parseFloat(c[2]),i=parseFloat(c[3]),a=parseFloat(c[4]),x.minX=r,x.minY=n,x.viewBoxWidth=i,x.viewBoxHeight=a,b?(x.width=i,x.height=a):(x.width=o(h),x.height=o(f),u=x.width/i,d=x.height/a),"none"!==(m=t.util.parsePreserveAspectRatioAttribute(m)).alignX&&("meet"===m.meetOrSlice&&(d=u=u>d?d:u),"slice"===m.meetOrSlice&&(d=u=u>d?u:d),_=x.width-i*u,S=x.height-a*u,"Mid"===m.alignX&&(_/=2),"Mid"===m.alignY&&(S/=2),"Min"===m.alignX&&(_=0),"Min"===m.alignY&&(S=0)),1===u&&1===d&&0===r&&0===n&&0===p&&0===g)return x;if((p||g)&&"#document"!==e.parentNode.nodeName&&(C=" translate("+o(p)+" "+o(g)+") "),s=C+" matrix("+u+" 0 0 "+d+" "+(r*u+_)+" "+(n*d+S)+") ","svg"===e.nodeName){for(l=e.ownerDocument.createElementNS(t.svgNS,"g");e.firstChild;)l.appendChild(e.firstChild);e.appendChild(l)}else(l=e).removeAttribute("x"),l.removeAttribute("y"),s=l.getAttribute("transform")+s;return l.setAttribute("transform",s),x}function w(e,t){var r="xlink:href",n=v(e,t.getAttribute(r).slice(1));if(n&&n.getAttribute(r)&&w(e,n),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach(function(e){n&&!t.hasAttribute(e)&&n.hasAttribute(e)&&t.setAttribute(e,n.getAttribute(e))}),!t.children.length)for(var i=n.cloneNode(!0);i.firstChild;)t.appendChild(i.firstChild);t.removeAttribute(r)}t.parseSVGDocument=function(e,r,i,o){if(e){!function(e){for(var r=p(e,["use","svg:use"]),n=0;r.length&&n<r.length;){var i=r[n],o=i.getAttribute("xlink:href")||i.getAttribute("href");if(null===o)return;var a,s,l,c,u=o.slice(1),d=i.getAttribute("x")||0,h=i.getAttribute("y")||0,f=v(e,u).cloneNode(!0),g=(f.getAttribute("transform")||"")+" translate("+d+", "+h+")",m=r.length,y=t.svgNS;if(b(f),/^svg$/i.test(f.nodeName)){var w=f.ownerDocument.createElementNS(y,"g");for(s=0,c=(l=f.attributes).length;s<c;s++)a=l.item(s),w.setAttributeNS(y,a.nodeName,a.nodeValue);for(;f.firstChild;)w.appendChild(f.firstChild);f=w}for(s=0,c=(l=i.attributes).length;s<c;s++)"x"!==(a=l.item(s)).nodeName&&"y"!==a.nodeName&&"xlink:href"!==a.nodeName&&"href"!==a.nodeName&&("transform"===a.nodeName?g=a.nodeValue+" "+g:f.setAttribute(a.nodeName,a.nodeValue));f.setAttribute("transform",g),f.setAttribute("instantiated_by_use","1"),f.removeAttribute("id"),i.parentNode.replaceChild(f,i),r.length===m&&n++}}(e);var a,s,l=t.Object.__uid++,c=b(e),u=t.util.toArray(e.getElementsByTagName("*"));if(c.crossOrigin=o&&o.crossOrigin,c.svgUid=l,0===u.length&&t.isLikelyNode){var d=[];for(a=0,s=(u=e.selectNodes('//*[name(.)!="svg"]')).length;a<s;a++)d[a]=u[a];u=d}var h=u.filter(function(e){return b(e),t.svgValidTagNamesRegEx.test(e.nodeName.replace("svg:",""))&&!function(e,t){for(;e&&(e=e.parentNode);)if(e.nodeName&&t.test(e.nodeName.replace("svg:",""))&&!e.getAttribute("instantiated_by_use"))return!0;return!1}(e,t.svgInvalidAncestorsRegEx)});if(!h||h&&!h.length)return void(r&&r([],{}));var f={};u.filter(function(e){return"clipPath"===e.nodeName.replace("svg:","")}).forEach(function(e){var r=e.getAttribute("id");f[r]=t.util.toArray(e.getElementsByTagName("*")).filter(function(e){return t.svgValidTagNamesRegEx.test(e.nodeName.replace("svg:",""))})}),t.gradientDefs[l]=t.getGradientDefs(e),t.cssRules[l]=t.getCSSRules(e),t.clipPaths[l]=f,t.parseElements(h,function(e,n){r&&(r(e,c,n,u),delete t.gradientDefs[l],delete t.cssRules[l],delete t.clipPaths[l])},n(c),i,o)}};var x=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+t.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+t.reNum+"))?\\s+(.*)");r(t,{parseFontDeclaration:function(e,t){var r=e.match(x);if(r){var n=r[1],i=r[3],a=r[4],s=r[5],l=r[6];n&&(t.fontStyle=n),i&&(t.fontWeight=isNaN(parseFloat(i))?i:parseFloat(i)),a&&(t.fontSize=o(a)),l&&(t.fontFamily=l),s&&(t.lineHeight="normal"===s?1:s)}},getGradientDefs:function(e){var t,r=p(e,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),n=0,i={};for(n=r.length;n--;)(t=r[n]).getAttribute("xlink:href")&&w(e,t),i[t.getAttribute("id")]=t;return i},parseAttributes:function(e,n,a){if(e){var s,f,p,m={};typeof a>"u"&&(a=e.getAttribute("svgUid")),e.parentNode&&t.svgValidParentsRegEx.test(e.parentNode.nodeName)&&(m=t.parseAttributes(e.parentNode,n,a));var v=n.reduce(function(t,r){return(s=e.getAttribute(r))&&(t[r]=s),t},{}),y=r(function(e,r){var n={};for(var i in t.cssRules[r])if(g(e,i.split(" ")))for(var o in t.cssRules[r][i])n[o]=t.cssRules[r][i][o];return n}(e,a),t.parseStyleAttribute(e));v=r(v,y),y[u]&&e.setAttribute(u,y[u]),f=p=m.fontSize||t.Text.DEFAULT_SVG_FONT_SIZE,v[c]&&(v[c]=f=o(v[c],p));var b,w,x={};for(var C in v)w=h(b=d(C),v[C],m,f),x[b]=w;x&&x.font&&t.parseFontDeclaration(x.font,x);var _=r(m,x);return t.svgValidParentsRegEx.test(e.nodeName)?_:function(e){for(var r in l)if(!(typeof e[l[r]]>"u"||""===e[r])){if(typeof e[r]>"u"){if(!t.Object.prototype[r])continue;e[r]=t.Object.prototype[r]}if(0!==e[r].indexOf("url(")){var n=new t.Color(e[r]);e[r]=n.setAlpha(i(n.getAlpha()*e[l[r]],2)).toRgba()}}return e}(_)}},parseElements:function(e,r,n,i,o){new t.ElementsParser(e,r,n,i,o).parse()},parseStyleAttribute:function(e){var t={},r=e.getAttribute("style");return r&&("string"==typeof r?function(e,t){var r,n;e.replace(/;\s*$/,"").split(";").forEach(function(e){var i=e.split(":");r=i[0].trim().toLowerCase(),n=i[1].trim(),t[r]=n})}(r,t):function(e,t){var r,n;for(var i in e)typeof e[i]>"u"||(r=i.toLowerCase(),n=e[i],t[r]=n)}(r,t)),t},parsePointsAttribute:function(e){if(!e)return null;var t,r,n=[];for(t=0,r=(e=(e=e.replace(/,/g," ").trim()).split(/\s+/)).length;t<r;t+=2)n.push({x:parseFloat(e[t]),y:parseFloat(e[t+1])});return n},getCSSRules:function(e){var r,n,i=e.getElementsByTagName("style"),o={};for(r=0,n=i.length;r<n;r++){var a=i[r].textContent;""!==(a=a.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&a.split("}").filter(function(e){return e.trim()}).forEach(function(e){var i=e.split("{"),a={},s=i[1].trim().split(";").filter(function(e){return e.trim()});for(r=0,n=s.length;r<n;r++){var l=s[r].split(":"),c=l[0].trim(),u=l[1].trim();a[c]=u}(e=i[0].trim()).split(",").forEach(function(e){""!==(e=e.replace(/^svg/i,"").trim())&&(o[e]?t.util.object.extend(o[e],a):o[e]=t.util.object.clone(a))})})}return o},loadSVGFromURL:function(e,r,n,i){e=e.replace(/^\n\s*/,"").trim(),new t.util.request(e,{method:"get",onComplete:function(e){var o=e.responseXML;if(!o||!o.documentElement)return r&&r(null),!1;t.parseSVGDocument(o.documentElement,function(e,t,n,i){r&&r(e,t,n,i)},n,i)}})},loadSVGFromString:function(e,r,n,i){var o=(new t.window.DOMParser).parseFromString(e.trim(),"text/xml");t.parseSVGDocument(o.documentElement,function(e,t,n,i){r(e,t,n,i)},n,i)}})}(e),t.ElementsParser=function(e,t,r,n,i,o){this.elements=e,this.callback=t,this.options=r,this.reviver=n,this.svgUid=r&&r.svgUid||0,this.parsingOptions=i,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},function(e){e.parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},e.createObjects=function(){var e=this;this.elements.forEach(function(t,r){t.setAttribute("svgUid",e.svgUid),e.createObject(t,r)})},e.findTag=function(e){return t[t.util.string.capitalize(e.tagName.replace("svg:",""))]},e.createObject=function(e,r){var n=this.findTag(e);if(n&&n.fromElement)try{n.fromElement(e,this.createCallback(r,e),this.options)}catch(e){t.log(e)}else this.checkIfDone()},e.createCallback=function(e,r){var n=this;return function(i){var o;n.resolveGradient(i,r,"fill"),n.resolveGradient(i,r,"stroke"),i instanceof t.Image&&i._originalElement&&(o=i.parsePreserveAspectRatioAttribute(r)),i._removeTransformMatrix(o),n.resolveClipPath(i,r),n.reviver&&n.reviver(r,i),n.instances[e]=i,n.checkIfDone()}},e.extractPropertyDefinition=function(e,r,n){var i=e[r],o=this.regexUrl;if(o.test(i)){o.lastIndex=0;var a=o.exec(i)[1];return o.lastIndex=0,t[n][this.svgUid][a]}},e.resolveGradient=function(e,r,n){var i=this.extractPropertyDefinition(e,n,"gradientDefs");if(i){var o=r.getAttribute(n+"-opacity"),a=t.Gradient.fromElement(i,e,o,this.options);e.set(n,a)}},e.createClipPathCallback=function(e,t){return function(e){e._removeTransformMatrix(),e.fillRule=e.clipRule,t.push(e)}},e.resolveClipPath=function(e,r){var n,i,o,a,s=this.extractPropertyDefinition(e,"clipPath","clipPaths");if(s){o=[],i=t.util.invertTransform(e.calcTransformMatrix());for(var l=s[0].parentNode,c=r;c.parentNode&&c.getAttribute("clip-path")!==e.clipPath;)c=c.parentNode;c.parentNode.appendChild(l);for(var u=0;u<s.length;u++)n=s[u],this.findTag(n).fromElement(n,this.createClipPathCallback(e,o),this.options);s=1===o.length?o[0]:new t.Group(o),a=t.util.multiplyTransformMatrices(i,s.calcTransformMatrix()),s.clipPath&&this.resolveClipPath(s,c);var d=t.util.qrDecompose(a);s.flipX=!1,s.flipY=!1,s.set("scaleX",d.scaleX),s.set("scaleY",d.scaleY),s.angle=d.angle,s.skewX=d.skewX,s.skewY=0,s.setPositionByOrigin({x:d.translateX,y:d.translateY},"center","center"),e.clipPath=s}else delete e.clipPath},e.checkIfDone=function(){0===--this.numElements&&(this.instances=this.instances.filter(function(e){return null!=e}),this.callback(this.instances,this.elements))}}(t.ElementsParser.prototype),function(e){var t=e.fabric||(e.fabric={});function r(e,t){this.x=e,this.y=t}t.Point?t.warn("fabric.Point is already defined"):(t.Point=r,r.prototype={type:"point",constructor:r,add:function(e){return new r(this.x+e.x,this.y+e.y)},addEquals:function(e){return this.x+=e.x,this.y+=e.y,this},scalarAdd:function(e){return new r(this.x+e,this.y+e)},scalarAddEquals:function(e){return this.x+=e,this.y+=e,this},subtract:function(e){return new r(this.x-e.x,this.y-e.y)},subtractEquals:function(e){return this.x-=e.x,this.y-=e.y,this},scalarSubtract:function(e){return new r(this.x-e,this.y-e)},scalarSubtractEquals:function(e){return this.x-=e,this.y-=e,this},multiply:function(e){return new r(this.x*e,this.y*e)},multiplyEquals:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return new r(this.x/e,this.y/e)},divideEquals:function(e){return this.x/=e,this.y/=e,this},eq:function(e){return this.x===e.x&&this.y===e.y},lt:function(e){return this.x<e.x&&this.y<e.y},lte:function(e){return this.x<=e.x&&this.y<=e.y},gt:function(e){return this.x>e.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,t){return typeof t>"u"&&(t=.5),t=Math.max(Math.min(1,t),0),new r(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t)},distanceFrom:function(e){var t=this.x-e.x,r=this.y-e.y;return Math.sqrt(t*t+r*r)},midPointFrom:function(e){return this.lerp(e)},min:function(e){return new r(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new r(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+","+this.y},setXY:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setFromPoint:function(e){return this.x=e.x,this.y=e.y,this},swap:function(e){var t=this.x,r=this.y;this.x=e.x,this.y=e.y,e.x=t,e.y=r},clone:function(){return new r(this.x,this.y)}})}(e),function(e){var t=e.fabric||(e.fabric={});function r(e){this.status=e,this.points=[]}t.Intersection?t.warn("fabric.Intersection is already defined"):(t.Intersection=r,t.Intersection.prototype={constructor:r,appendPoint:function(e){return this.points.push(e),this},appendPoints:function(e){return this.points=this.points.concat(e),this}},t.Intersection.intersectLineLine=function(e,n,i,o){var a,s=(o.x-i.x)*(e.y-i.y)-(o.y-i.y)*(e.x-i.x),l=(n.x-e.x)*(e.y-i.y)-(n.y-e.y)*(e.x-i.x),c=(o.y-i.y)*(n.x-e.x)-(o.x-i.x)*(n.y-e.y);if(0!==c){var u=s/c,d=l/c;0<=u&&u<=1&&0<=d&&d<=1?(a=new r("Intersection")).appendPoint(new t.Point(e.x+u*(n.x-e.x),e.y+u*(n.y-e.y))):a=new r}else a=new r(0===s||0===l?"Coincident":"Parallel");return a},t.Intersection.intersectLinePolygon=function(e,t,n){var i,o,a,s,l=new r,c=n.length;for(s=0;s<c;s++)i=n[s],o=n[(s+1)%c],a=r.intersectLineLine(e,t,i,o),l.appendPoints(a.points);return l.points.length>0&&(l.status="Intersection"),l},t.Intersection.intersectPolygonPolygon=function(e,t){var n,i=new r,o=e.length;for(n=0;n<o;n++){var a=e[n],s=e[(n+1)%o],l=r.intersectLinePolygon(a,s,t);i.appendPoints(l.points)}return i.points.length>0&&(i.status="Intersection"),i},t.Intersection.intersectPolygonRectangle=function(e,n,i){var o=n.min(i),a=n.max(i),s=new t.Point(a.x,o.y),l=new t.Point(o.x,a.y),c=r.intersectLinePolygon(o,s,e),u=r.intersectLinePolygon(s,a,e),d=r.intersectLinePolygon(a,l,e),h=r.intersectLinePolygon(l,o,e),f=new r;return f.appendPoints(c.points),f.appendPoints(u.points),f.appendPoints(d.points),f.appendPoints(h.points),f.points.length>0&&(f.status="Intersection"),f})}(e),function(e){var t=e.fabric||(e.fabric={});function r(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}function n(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}t.Color?t.warn("fabric.Color is already defined."):(t.Color=r,t.Color.prototype={_tryParsingColor:function(e){var t;e in r.colorNameMap&&(e=r.colorNameMap[e]),"transparent"===e&&(t=[255,255,255,0]),t||(t=r.sourceFromHex(e)),t||(t=r.sourceFromRgb(e)),t||(t=r.sourceFromHsl(e)),t||(t=[0,0,0,1]),t&&this.setSource(t)},_rgbToHsl:function(e,r,n){e/=255,r/=255,n/=255;var i,o,a,s=t.util.array.max([e,r,n]),l=t.util.array.min([e,r,n]);if(a=(s+l)/2,s===l)i=o=0;else{var c=s-l;switch(o=a>.5?c/(2-s-l):c/(s+l),s){case e:i=(r-n)/c+(r<n?6:0);break;case r:i=(n-e)/c+2;break;case n:i=(e-r)/c+4}i/=6}return[Math.round(360*i),Math.round(100*o),Math.round(100*a)]},getSource:function(){return this._source},setSource:function(e){this._source=e},toRgb:function(){var e=this.getSource();return"rgb("+e[0]+","+e[1]+","+e[2]+")"},toRgba:function(){var e=this.getSource();return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},toHsl:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return"hsl("+t[0]+","+t[1]+"%,"+t[2]+"%)"},toHsla:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return"hsla("+t[0]+","+t[1]+"%,"+t[2]+"%,"+e[3]+")"},toHex:function(){var e,t,r,n=this.getSource();return e=1===(e=n[0].toString(16)).length?"0"+e:e,t=1===(t=n[1].toString(16)).length?"0"+t:t,r=1===(r=n[2].toString(16)).length?"0"+r:r,e.toUpperCase()+t.toUpperCase()+r.toUpperCase()},toHexa:function(){var e,t=this.getSource();return e=1===(e=(e=Math.round(255*t[3])).toString(16)).length?"0"+e:e,this.toHex()+e.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(e){var t=this.getSource();return t[3]=e,this.setSource(t),this},toGrayscale:function(){var e=this.getSource(),t=parseInt((.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),10),r=e[3];return this.setSource([t,t,t,r]),this},toBlackWhite:function(e){var t=this.getSource(),r=(.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),n=t[3];return e=e||127,r=Number(r)<Number(e)?0:255,this.setSource([r,r,r,n]),this},overlayWith:function(e){e instanceof r||(e=new r(e));var t,n=[],i=this.getAlpha(),o=this.getSource(),a=e.getSource();for(t=0;t<3;t++)n.push(Math.round(.5*o[t]+.5*a[t]));return n[3]=i,this.setSource(n),this}},t.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,t.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,t.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,t.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},t.Color.fromRgb=function(e){return r.fromSource(r.sourceFromRgb(e))},t.Color.sourceFromRgb=function(e){var t=e.match(r.reRGBa);if(t){var n=parseInt(t[1],10)/(/%$/.test(t[1])?100:1)*(/%$/.test(t[1])?255:1),i=parseInt(t[2],10)/(/%$/.test(t[2])?100:1)*(/%$/.test(t[2])?255:1),o=parseInt(t[3],10)/(/%$/.test(t[3])?100:1)*(/%$/.test(t[3])?255:1);return[parseInt(n,10),parseInt(i,10),parseInt(o,10),t[4]?parseFloat(t[4]):1]}},t.Color.fromRgba=r.fromRgb,t.Color.fromHsl=function(e){return r.fromSource(r.sourceFromHsl(e))},t.Color.sourceFromHsl=function(e){var t=e.match(r.reHSLa);if(t){var i,o,a,s=(parseFloat(t[1])%360+360)%360/360,l=parseFloat(t[2])/(/%$/.test(t[2])?100:1),c=parseFloat(t[3])/(/%$/.test(t[3])?100:1);if(0===l)i=o=a=c;else{var u=c<=.5?c*(l+1):c+l-c*l,d=2*c-u;i=n(d,u,s+1/3),o=n(d,u,s),a=n(d,u,s-1/3)}return[Math.round(255*i),Math.round(255*o),Math.round(255*a),t[4]?parseFloat(t[4]):1]}},t.Color.fromHsla=r.fromHsl,t.Color.fromHex=function(e){return r.fromSource(r.sourceFromHex(e))},t.Color.sourceFromHex=function(e){if(e.match(r.reHex)){var t=e.slice(e.indexOf("#")+1),n=3===t.length||4===t.length,i=8===t.length||4===t.length,o=n?t.charAt(0)+t.charAt(0):t.substring(0,2),a=n?t.charAt(1)+t.charAt(1):t.substring(2,4),s=n?t.charAt(2)+t.charAt(2):t.substring(4,6),l=i?n?t.charAt(3)+t.charAt(3):t.substring(6,8):"FF";return[parseInt(o,16),parseInt(a,16),parseInt(s,16),parseFloat((parseInt(l,16)/255).toFixed(2))]}},t.Color.fromSource=function(e){var t=new r;return t.setSource(e),t})}(e),function(e){var t=e.fabric||(e.fabric={}),r=["e","se","s","sw","w","nw","n","ne","e"],n=["ns","nesw","ew","nwse"],i={},o="left",a="top",s="right",l="bottom",c="center",u={top:l,bottom:a,left:s,right:o,center:c},d=t.util.radiansToDegrees,h=Math.sign||function(e){return(e>0)-(e<0)||+e};function f(e,t){var r=e.angle+d(Math.atan2(t.y,t.x))+360;return Math.round(r%360/45)}function p(e,r){var n=r.transform.target,i=n.canvas,o=t.util.object.clone(r);o.target=n,i&&i.fire("object:"+e,o),n.fire(e,r)}function g(e,t){var r=t.canvas,n=e[r.uniScaleKey];return r.uniformScaling&&!n||!r.uniformScaling&&n}function m(e){return e.originX===c&&e.originY===c}function v(e,t,r){var n=e.lockScalingX,i=e.lockScalingY;return!!(n&&i||!t&&(n||i)&&r||n&&"x"===t||i&&"y"===t)}function y(e,t,r,n){return{e:e,transform:t,pointer:{x:r,y:n}}}function b(e){return function(t,r,n,i){var o=r.target,a=o.getCenterPoint(),s=o.translateToOriginPoint(a,r.originX,r.originY),l=e(t,r,n,i);return o.setPositionByOrigin(s,r.originX,r.originY),l}}function w(e,t){return function(r,n,i,o){var a=t(r,n,i,o);return a&&p(e,y(r,n,i,o)),a}}function x(e,r,n,i,o){var a=e.target,s=a.controls[e.corner],l=a.canvas.getZoom(),c=a.padding/l,u=a.toLocalPoint(new t.Point(i,o),r,n);return u.x>=c&&(u.x-=c),u.x<=-c&&(u.x+=c),u.y>=c&&(u.y-=c),u.y<=c&&(u.y+=c),u.x-=s.offsetX,u.y-=s.offsetY,u}function C(e){return e.flipX!==e.flipY}function _(e,t,r,n,i){if(0!==e[t]){var o=i/e._getTransformedDimensions()[n]*e[r];e.set(r,o)}}function S(e,t,r,n){var i,c=t.target,u=c._getTransformedDimensions(0,c.skewY),h=x(t,t.originX,t.originY,r,n),f=Math.abs(2*h.x)-u.x,p=c.skewX;f<2?i=0:(i=d(Math.atan2(f/c.scaleX,u.y/c.scaleY)),t.originX===o&&t.originY===l&&(i=-i),t.originX===s&&t.originY===a&&(i=-i),C(c)&&(i=-i));var g=p!==i;if(g){var m=c._getTransformedDimensions().y;c.set("skewX",i),_(c,"skewY","scaleY","y",m)}return g}function A(e,t,r,n){var i,c=t.target,u=c._getTransformedDimensions(c.skewX,0),h=x(t,t.originX,t.originY,r,n),f=Math.abs(2*h.y)-u.y,p=c.skewY;f<2?i=0:(i=d(Math.atan2(f/c.scaleY,u.x/c.scaleX)),t.originX===o&&t.originY===l&&(i=-i),t.originX===s&&t.originY===a&&(i=-i),C(c)&&(i=-i));var g=p!==i;if(g){var m=c._getTransformedDimensions().x;c.set("skewY",i),_(c,"skewX","scaleX","x",m)}return g}function k(e,t,r,n,i){i=i||{};var o,a,s,l,c,d,f=t.target,p=f.lockScalingX,y=f.lockScalingY,b=i.by,w=g(e,f),C=v(f,b,w),_=t.gestureScale;if(C)return!1;if(_)a=t.scaleX*_,s=t.scaleY*_;else{if(o=x(t,t.originX,t.originY,r,n),c="y"!==b?h(o.x):1,d="x"!==b?h(o.y):1,t.signX||(t.signX=c),t.signY||(t.signY=d),f.lockScalingFlip&&(t.signX!==c||t.signY!==d))return!1;if(l=f._getTransformedDimensions(),w&&!b){var S=Math.abs(o.x)+Math.abs(o.y),A=t.original,k=S/(Math.abs(l.x*A.scaleX/f.scaleX)+Math.abs(l.y*A.scaleY/f.scaleY));a=A.scaleX*k,s=A.scaleY*k}else a=Math.abs(o.x*f.scaleX/l.x),s=Math.abs(o.y*f.scaleY/l.y);m(t)&&(a*=2,s*=2),t.signX!==c&&"y"!==b&&(t.originX=u[t.originX],a*=-1,t.signX=c),t.signY!==d&&"x"!==b&&(t.originY=u[t.originY],s*=-1,t.signY=d)}var E=f.scaleX,I=f.scaleY;return b?("x"===b&&f.set("scaleX",a),"y"===b&&f.set("scaleY",s)):(!p&&f.set("scaleX",a),!y&&f.set("scaleY",s)),E!==f.scaleX||I!==f.scaleY}i.scaleCursorStyleHandler=function(e,t,n){var i=g(e,n),o="";if(0!==t.x&&0===t.y?o="x":0===t.x&&0!==t.y&&(o="y"),v(n,o,i))return"not-allowed";var a=f(n,t);return r[a]+"-resize"},i.skewCursorStyleHandler=function(e,t,r){if(0!==t.x&&r.lockSkewingY||0!==t.y&&r.lockSkewingX)return"not-allowed";var i=f(r,t)%4;return n[i]+"-resize"},i.scaleSkewCursorStyleHandler=function(e,t,r){return e[r.canvas.altActionKey]?i.skewCursorStyleHandler(e,t,r):i.scaleCursorStyleHandler(e,t,r)},i.rotationWithSnapping=w("rotating",b(function(e,t,r,n){var i=t,o=i.target,a=o.translateToOriginPoint(o.getCenterPoint(),i.originX,i.originY);if(o.lockRotation)return!1;var s,l=Math.atan2(i.ey-a.y,i.ex-a.x),c=Math.atan2(n-a.y,r-a.x),u=d(c-l+i.theta);if(o.snapAngle>0){var h=o.snapAngle,f=o.snapThreshold||h,p=Math.ceil(u/h)*h,g=Math.floor(u/h)*h;Math.abs(u-g)<f?u=g:Math.abs(u-p)<f&&(u=p)}return u<0&&(u=360+u),u%=360,s=o.angle!==u,o.angle=u,s})),i.scalingEqually=w("scaling",b(function(e,t,r,n){return k(e,t,r,n)})),i.scalingX=w("scaling",b(function(e,t,r,n){return k(e,t,r,n,{by:"x"})})),i.scalingY=w("scaling",b(function(e,t,r,n){return k(e,t,r,n,{by:"y"})})),i.scalingYOrSkewingX=function(e,t,r,n){return e[t.target.canvas.altActionKey]?i.skewHandlerX(e,t,r,n):i.scalingY(e,t,r,n)},i.scalingXOrSkewingY=function(e,t,r,n){return e[t.target.canvas.altActionKey]?i.skewHandlerY(e,t,r,n):i.scalingX(e,t,r,n)},i.changeWidth=w("resizing",b(function(e,t,r,n){var i=t.target,o=x(t,t.originX,t.originY,r,n),a=i.strokeWidth/(i.strokeUniform?i.scaleX:1),s=m(t)?2:1,l=i.width,c=Math.abs(o.x*s/i.scaleX)-a;return i.set("width",Math.max(c,0)),l!==c})),i.skewHandlerX=function(e,t,r,n){var i,l=t.target,u=l.skewX,d=t.originY;return!l.lockSkewingX&&(0===u?i=x(t,c,c,r,n).x>0?o:s:(u>0&&(i=d===a?o:s),u<0&&(i=d===a?s:o),C(l)&&(i=i===o?s:o)),t.originX=i,w("skewing",b(S))(e,t,r,n))},i.skewHandlerY=function(e,t,r,n){var i,s=t.target,u=s.skewY,d=t.originX;return!s.lockSkewingY&&(0===u?i=x(t,c,c,r,n).y>0?a:l:(u>0&&(i=d===o?a:l),u<0&&(i=d===o?l:a),C(s)&&(i=i===a?l:a)),t.originY=i,w("skewing",b(A))(e,t,r,n))},i.dragHandler=function(e,t,r,n){var i=t.target,o=r-t.offsetX,a=n-t.offsetY,s=!i.get("lockMovementX")&&i.left!==o,l=!i.get("lockMovementY")&&i.top!==a;return s&&i.set("left",o),l&&i.set("top",a),(s||l)&&p("moving",y(e,t,r,n)),s||l},i.scaleOrSkewActionName=function(e,t,r){var n=e[r.canvas.altActionKey];return 0===t.x?n?"skewX":"scaleY":0===t.y?n?"skewY":"scaleX":void 0},i.rotationStyleHandler=function(e,t,r){return r.lockRotation?"not-allowed":t.cursorStyle},i.fireEvent=p,i.wrapWithFixedAnchor=b,i.wrapWithFireEvent=w,i.getLocalPoint=x,t.controlsUtils=i}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.degreesToRadians,n=t.controlsUtils;n.renderCircleControl=function(e,t,r,n,i){n=n||{};var o,a=this.sizeX||n.cornerSize||i.cornerSize,s=this.sizeY||n.cornerSize||i.cornerSize,l=typeof n.transparentCorners<"u"?n.transparentCorners:i.transparentCorners,c=l?"stroke":"fill",u=!l&&(n.cornerStrokeColor||i.cornerStrokeColor),d=t,h=r;e.save(),e.fillStyle=n.cornerColor||i.cornerColor,e.strokeStyle=n.cornerStrokeColor||i.cornerStrokeColor,a>s?(o=a,e.scale(1,s/a),h=r*a/s):s>a?(o=s,e.scale(a/s,1),d=t*s/a):o=a,e.lineWidth=1,e.beginPath(),e.arc(d,h,o/2,0,2*Math.PI,!1),e[c](),u&&e.stroke(),e.restore()},n.renderSquareControl=function(e,t,n,i,o){i=i||{};var a=this.sizeX||i.cornerSize||o.cornerSize,s=this.sizeY||i.cornerSize||o.cornerSize,l=typeof i.transparentCorners<"u"?i.transparentCorners:o.transparentCorners,c=l?"stroke":"fill",u=!l&&(i.cornerStrokeColor||o.cornerStrokeColor),d=a/2,h=s/2;e.save(),e.fillStyle=i.cornerColor||o.cornerColor,e.strokeStyle=i.cornerStrokeColor||o.cornerStrokeColor,e.lineWidth=1,e.translate(t,n),e.rotate(r(o.angle)),e[c+"Rect"](-d,-h,a,s),u&&e.strokeRect(-d,-h,a,s),e.restore()}}(e),function(e){var t=e.fabric||(e.fabric={});t.Control=function(e){for(var t in e)this[t]=e[t]},t.Control.prototype={visible:!0,actionName:"scale",angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:"crosshair",withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(e,t){return t.cursorStyle},getActionName:function(e,t){return t.actionName},getVisibility:function(e,t){var r=e._controlsVisibility;return r&&typeof r[t]<"u"?r[t]:this.visible},setVisibility:function(e){this.visible=e},positionHandler:function(e,r){return t.util.transformPoint({x:this.x*e.x+this.offsetX,y:this.y*e.y+this.offsetY},r)},calcCornerCoords:function(e,r,n,i,o){var a,s,l,c,u=o?this.touchSizeX:this.sizeX,d=o?this.touchSizeY:this.sizeY;if(u&&d&&u!==d){var h=Math.atan2(d,u),f=Math.sqrt(u*u+d*d)/2,p=h-t.util.degreesToRadians(e),g=Math.PI/2-h-t.util.degreesToRadians(e);a=f*t.util.cos(p),s=f*t.util.sin(p),l=f*t.util.cos(g),c=f*t.util.sin(g)}else{f=.7071067812*(u&&d?u:r);p=t.util.degreesToRadians(45-e);a=l=f*t.util.cos(p),s=c=f*t.util.sin(p)}return{tl:{x:n-c,y:i-l},tr:{x:n+a,y:i-s},bl:{x:n-a,y:i+s},br:{x:n+c,y:i+l}}},render:function(e,r,n,i,o){if("circle"===((i=i||{}).cornerStyle||o.cornerStyle))t.controlsUtils.renderCircleControl.call(this,e,r,n,i,o);else t.controlsUtils.renderSquareControl.call(this,e,r,n,i,o)}}}(e),function(){function e(e,r){var n,i,o,a,s=e.getAttribute("style"),l=e.getAttribute("offset")||0;if(l=(l=parseFloat(l)/(/%$/.test(l)?100:1))<0?0:l>1?1:l,s){var c=s.split(/\s*;\s*/);for(""===c[c.length-1]&&c.pop(),a=c.length;a--;){var u=c[a].split(/\s*:\s*/),d=u[0].trim(),h=u[1].trim();"stop-color"===d?n=h:"stop-opacity"===d&&(o=h)}}return n||(n=e.getAttribute("stop-color")||"rgb(0,0,0)"),o||(o=e.getAttribute("stop-opacity")),i=(n=new t.Color(n)).getAlpha(),o=isNaN(parseFloat(o))?1:parseFloat(o),o*=i*r,{offset:l,color:n.toRgb(),opacity:o}}var r=t.util.object.clone;t.Gradient=t.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(e){e||(e={}),e.coords||(e.coords={});var r,n=this;Object.keys(e).forEach(function(t){n[t]=e[t]}),this.id?this.id+="_"+t.Object.__uid++:this.id=t.Object.__uid++,r={x1:e.coords.x1||0,y1:e.coords.y1||0,x2:e.coords.x2||0,y2:e.coords.y2||0},"radial"===this.type&&(r.r1=e.coords.r1||0,r.r2=e.coords.r2||0),this.coords=r,this.colorStops=e.colorStops.slice()},addColorStop:function(e){for(var r in e){var n=new t.Color(e[r]);this.colorStops.push({offset:parseFloat(r),color:n.toRgb(),opacity:n.getAlpha()})}return this},toObject:function(e){var r={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return t.util.populateWithProperties(this,r,e),r},toSVG:function(e,n){var i,o,a,s,l=r(this.coords,!0),c=(n=n||{},r(this.colorStops,!0)),u=l.r1>l.r2,d=this.gradientTransform?this.gradientTransform.concat():t.iMatrix.concat(),h=-this.offsetX,f=-this.offsetY,p=!!n.additionalTransform,g="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(c.sort(function(e,t){return e.offset-t.offset}),"objectBoundingBox"===g?(h/=e.width,f/=e.height):(h+=e.width/2,f+=e.height/2),"path"===e.type&&"percentage"!==this.gradientUnits&&(h-=e.pathOffset.x,f-=e.pathOffset.y),d[4]-=h,d[5]-=f,s='id="SVGID_'+this.id+'" gradientUnits="'+g+'"',s+=' gradientTransform="'+(p?n.additionalTransform+" ":"")+t.util.matrixToSVG(d)+'" ',"linear"===this.type?a=["<linearGradient ",s,' x1="',l.x1,'" y1="',l.y1,'" x2="',l.x2,'" y2="',l.y2,'">\n']:"radial"===this.type&&(a=["<radialGradient ",s,' cx="',u?l.x1:l.x2,'" cy="',u?l.y1:l.y2,'" r="',u?l.r1:l.r2,'" fx="',u?l.x2:l.x1,'" fy="',u?l.y2:l.y1,'">\n']),"radial"===this.type){if(u)for((c=c.concat()).reverse(),i=0,o=c.length;i<o;i++)c[i].offset=1-c[i].offset;var m=Math.min(l.r1,l.r2);if(m>0){var v=m/Math.max(l.r1,l.r2);for(i=0,o=c.length;i<o;i++)c[i].offset+=v*(1-c[i].offset)}}for(i=0,o=c.length;i<o;i++){var y=c[i];a.push("<stop ",'offset="',100*y.offset+"%",'" style="stop-color:',y.color,typeof y.opacity<"u"?";stop-opacity: "+y.opacity:";",'"/>\n')}return a.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),a.join("")},toLive:function(e){var r,n,i,o=t.util.object.clone(this.coords);if(this.type){for("linear"===this.type?r=e.createLinearGradient(o.x1,o.y1,o.x2,o.y2):"radial"===this.type&&(r=e.createRadialGradient(o.x1,o.y1,o.r1,o.x2,o.y2,o.r2)),n=0,i=this.colorStops.length;n<i;n++){var a=this.colorStops[n].color,s=this.colorStops[n].opacity,l=this.colorStops[n].offset;typeof s<"u"&&(a=new t.Color(a).setAlpha(s).toRgba()),r.addColorStop(l,a)}return r}}}),t.util.object.extend(t.Gradient,{fromElement:function(r,n,i,o){var a=parseFloat(i)/(/%$/.test(i)?100:1);a=a<0?0:a>1?1:a,isNaN(a)&&(a=1);var s,l,c,u,d=r.getElementsByTagName("stop"),h="userSpaceOnUse"===r.getAttribute("gradientUnits")?"pixels":"percentage",f=r.getAttribute("gradientTransform")||"",p=[],g=0,m=0;for("linearGradient"===r.nodeName||"LINEARGRADIENT"===r.nodeName?(s="linear",l=function(e){return{x1:e.getAttribute("x1")||0,y1:e.getAttribute("y1")||0,x2:e.getAttribute("x2")||"100%",y2:e.getAttribute("y2")||0}}(r)):(s="radial",l=function(e){return{x1:e.getAttribute("fx")||e.getAttribute("cx")||"50%",y1:e.getAttribute("fy")||e.getAttribute("cy")||"50%",r1:0,x2:e.getAttribute("cx")||"50%",y2:e.getAttribute("cy")||"50%",r2:e.getAttribute("r")||"50%"}}(r)),c=d.length;c--;)p.push(e(d[c],a));return u=t.parseTransformAttribute(f),function(e,t,r,n){var i,o;Object.keys(t).forEach(function(e){"Infinity"===(i=t[e])?o=1:"-Infinity"===i?o=0:(o=parseFloat(t[e],10),"string"==typeof i&&/^(\d+\.\d+)%|(\d+)%$/.test(i)&&(o*=.01,"pixels"===n&&(("x1"===e||"x2"===e||"r2"===e)&&(o*=r.viewBoxWidth||r.width),("y1"===e||"y2"===e)&&(o*=r.viewBoxHeight||r.height)))),t[e]=o})}(0,l,o,h),"pixels"===h&&(g=-n.left,m=-n.top),new t.Gradient({id:r.getAttribute("id"),type:s,coords:l,colorStops:p,gradientUnits:h,gradientTransform:u,offsetX:g,offsetY:m})}})}(),function(){var e=t.util.toFixed;t.Pattern=t.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(e,r){if(e||(e={}),this.id=t.Object.__uid++,this.setOptions(e),!e.source||e.source&&"string"!=typeof e.source)r&&r(this);else{var n=this;this.source=t.util.createImage(),t.util.loadImage(e.source,function(e,t){n.source=e,r&&r(n,t)},null,this.crossOrigin)}},toObject:function(r){var n,i,o=t.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?n=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(n=this.source.toDataURL()),i={type:"pattern",source:n,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:e(this.offsetX,o),offsetY:e(this.offsetY,o),patternTransform:this.patternTransform?this.patternTransform.concat():null},t.util.populateWithProperties(this,i,r),i},toSVG:function(e){var t="function"==typeof this.source?this.source():this.source,r=t.width/e.width,n=t.height/e.height,i=this.offsetX/e.width,o=this.offsetY/e.height,a="";return("repeat-x"===this.repeat||"no-repeat"===this.repeat)&&(n=1,o&&(n+=Math.abs(o))),("repeat-y"===this.repeat||"no-repeat"===this.repeat)&&(r=1,i&&(r+=Math.abs(i))),t.src?a=t.src:t.toDataURL&&(a=t.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+i+'" y="'+o+'" width="'+r+'" height="'+n+'">\n<image x="0" y="0" width="'+t.width+'" height="'+t.height+'" xlink:href="'+a+'"></image>\n</pattern>\n'},setOptions:function(e){for(var t in e)this[t]=e[t]},toLive:function(e){var t=this.source;return!t||typeof t.src<"u"&&(!t.complete||0===t.naturalWidth||0===t.naturalHeight)?"":e.createPattern(t,this.repeat)}})}(),function(e){var t=e.fabric||(e.fabric={}),r=t.util.toFixed;t.Shadow?t.warn("fabric.Shadow is already defined."):(t.Shadow=t.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(e){for(var r in"string"==typeof e&&(e=this._parseShadow(e)),e)this[r]=e[r];this.id=t.Object.__uid++},_parseShadow:function(e){var r=e.trim(),n=t.Shadow.reOffsetsAndBlur.exec(r)||[];return{color:(r.replace(t.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseFloat(n[1],10)||0,offsetY:parseFloat(n[2],10)||0,blur:parseFloat(n[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(e){var n=40,i=40,o=t.Object.NUM_FRACTION_DIGITS,a=t.util.rotateVector({x:this.offsetX,y:this.offsetY},t.util.degreesToRadians(-e.angle)),s=new t.Color(this.color);return e.width&&e.height&&(n=100*r((Math.abs(a.x)+this.blur)/e.width,o)+20,i=100*r((Math.abs(a.y)+this.blur)/e.height,o)+20),e.flipX&&(a.x*=-1),e.flipY&&(a.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+i+'%" height="'+(100+2*i)+'%" x="-'+n+'%" width="'+(100+2*n)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+r(this.blur?this.blur/2:0,o)+'"></feGaussianBlur>\n\t<feOffset dx="'+r(a.x,o)+'" dy="'+r(a.y,o)+'" result="oBlur" ></feOffset>\n\t<feFlood flood-color="'+s.toRgb()+'" flood-opacity="'+s.getAlpha()+'"/>\n\t<feComposite in2="oBlur" operator="in" />\n\t<feMerge>\n\t\t<feMergeNode></feMergeNode>\n\t\t<feMergeNode in="SourceGraphic"></feMergeNode>\n\t</feMerge>\n</filter>\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var e={},r=t.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach(function(t){this[t]!==r[t]&&(e[t]=this[t])},this),e}}),t.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/)}(e),function(){if(t.StaticCanvas)t.warn("fabric.StaticCanvas is already defined.");else{var e=t.util.object.extend,r=t.util.getElementOffset,n=t.util.removeFromArray,i=t.util.toFixed,o=t.util.transformPoint,a=t.util.invertTransform,s=t.util.getNodeCanvas,l=t.util.createCanvasElement,c=new Error("Could not initialize `canvas` element");t.StaticCanvas=t.util.createClass(t.CommonMethods,{initialize:function(e,t){t||(t={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:t.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(e,t){var r=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(e),this._initOptions(t),this.interactive||this._initRetinaScaling(),t.overlayImage&&this.setOverlayImage(t.overlayImage,r),t.backgroundImage&&this.setBackgroundImage(t.backgroundImage,r),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor,r),t.overlayColor&&this.setOverlayColor(t.overlayColor,r),this.calcOffset()},_isRetinaScaling:function(){return t.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,t.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var e=t.devicePixelRatio;this.__initRetinaScaling(e,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(e,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(e,t,r){t.setAttribute("width",this.width*e),t.setAttribute("height",this.height*e),r.scale(e,e)},calcOffset:function(){return this._offset=r(this.lowerCanvasEl),this},setOverlayImage:function(e,t,r){return this.__setBgOverlayImage("overlayImage",e,t,r)},setBackgroundImage:function(e,t,r){return this.__setBgOverlayImage("backgroundImage",e,t,r)},setOverlayColor:function(e,t){return this.__setBgOverlayColor("overlayColor",e,t)},setBackgroundColor:function(e,t){return this.__setBgOverlayColor("backgroundColor",e,t)},__setBgOverlayImage:function(e,r,n,i){return"string"==typeof r?t.util.loadImage(r,function(r,o){if(r){var a=new t.Image(r,i);this[e]=a,a.canvas=this}n&&n(r,o)},this,i&&i.crossOrigin):(i&&r.setOptions(i),this[e]=r,r&&(r.canvas=this),n&&n(r,!1)),this},__setBgOverlayColor:function(e,t,r){return this[e]=t,this._initGradient(t,e),this._initPattern(t,e,r),this},_createCanvasElement:function(){var e=l();if(!e||(e.style||(e.style={}),typeof e.getContext>"u"))throw c;return e},_initOptions:function(e){var t=this.lowerCanvasEl;this._setOptions(e),this.width=this.width||parseInt(t.width,10)||0,this.height=this.height||parseInt(t.height,10)||0,this.lowerCanvasEl.style&&(t.width=this.width,t.height=this.height,t.style.width=this.width+"px",t.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(e){e&&e.getContext?this.lowerCanvasEl=e:this.lowerCanvasEl=t.util.getById(e)||this._createCanvasElement(),t.util.addClass(this.lowerCanvasEl,"lower-canvas"),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(e,t){return this.setDimensions({width:e},t)},setHeight:function(e,t){return this.setDimensions({height:e},t)},setDimensions:function(e,t){var r;for(var n in t=t||{},e)r=e[n],t.cssOnly||(this._setBackstoreDimension(n,e[n]),r+="px",this.hasLostContext=!0),t.backstoreOnly||this._setCssDimension(n,r);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),t.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(e,t){return this.lowerCanvasEl[e]=t,this.upperCanvasEl&&(this.upperCanvasEl[e]=t),this.cacheCanvasEl&&(this.cacheCanvasEl[e]=t),this[e]=t,this},_setCssDimension:function(e,t){return this.lowerCanvasEl.style[e]=t,this.upperCanvasEl&&(this.upperCanvasEl.style[e]=t),this.wrapperEl&&(this.wrapperEl.style[e]=t),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(e){var t,r,n,i=this._activeObject,o=this.backgroundImage,a=this.overlayImage;for(this.viewportTransform=e,r=0,n=this._objects.length;r<n;r++)(t=this._objects[r]).group||t.setCoords(!0);return i&&i.setCoords(),o&&o.setCoords(!0),a&&a.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(e,t){var r=e,n=this.viewportTransform.slice(0);e=o(e,a(this.viewportTransform)),n[0]=t,n[3]=t;var i=o(e,n);return n[4]+=r.x-i.x,n[5]+=r.y-i.y,this.setViewportTransform(n)},setZoom:function(e){return this.zoomToPoint(new t.Point(0,0),e),this},absolutePan:function(e){var t=this.viewportTransform.slice(0);return t[4]=-e.x,t[5]=-e.y,this.setViewportTransform(t)},relativePan:function(e){return this.absolutePan(new t.Point(-e.x-this.viewportTransform[4],-e.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(e){this.stateful&&e.setupState(),e._set("canvas",this),e.setCoords(),this.fire("object:added",{target:e}),e.fire("added")},_onObjectRemoved:function(e){this.fire("object:removed",{target:e}),e.fire("removed"),delete e.canvas},clearContext:function(e){return e.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var e=this.contextContainer;return this.renderCanvas(e,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=t.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var e={},r=this.width,n=this.height,i=a(this.viewportTransform);return e.tl=o({x:0,y:0},i),e.br=o({x:r,y:n},i),e.tr=new t.Point(e.br.x,e.tl.y),e.bl=new t.Point(e.tl.x,e.br.y),this.vptCoords=e,e},cancelRequestedRender:function(){this.isRendering&&(t.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(e,r){var n=this.viewportTransform,i=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(e),t.util.setImageSmoothing(e,this.imageSmoothingEnabled),this.fire("before:render",{ctx:e}),this._renderBackground(e),e.save(),e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this._renderObjects(e,r),e.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),i&&(i.canvas=this,i.shouldCache(),i._transformDone=!0,i.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(e)),this._renderOverlay(e),this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),this.fire("after:render",{ctx:e})},drawClipPathOnCanvas:function(e){var t=this.viewportTransform,r=this.clipPath;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5]),e.globalCompositeOperation="destination-in",r.transform(e),e.scale(1/r.zoomX,1/r.zoomY),e.drawImage(r._cacheCanvas,-r.cacheTranslationX,-r.cacheTranslationY),e.restore()},_renderObjects:function(e,t){var r,n;for(r=0,n=t.length;r<n;++r)t[r]&&t[r].render(e)},_renderBackgroundOrOverlay:function(e,t){var r=this[t+"Color"],n=this[t+"Image"],i=this.viewportTransform,o=this[t+"Vpt"];if(r||n){if(r){e.save(),e.beginPath(),e.moveTo(0,0),e.lineTo(this.width,0),e.lineTo(this.width,this.height),e.lineTo(0,this.height),e.closePath(),e.fillStyle=r.toLive?r.toLive(e,this):r,o&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e.transform(1,0,0,1,r.offsetX||0,r.offsetY||0);var a=r.gradientTransform||r.patternTransform;a&&e.transform(a[0],a[1],a[2],a[3],a[4],a[5]),e.fill(),e.restore()}n&&(e.save(),o&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),n.render(e),e.restore())}},_renderBackground:function(e){this._renderBackgroundOrOverlay(e,"background")},_renderOverlay:function(e){this._renderBackgroundOrOverlay(e,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new t.Point(this.width/2,this.height/2)},centerObjectH:function(e){return this._centerObject(e,new t.Point(this.getCenterPoint().x,e.getCenterPoint().y))},centerObjectV:function(e){return this._centerObject(e,new t.Point(e.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(e){var t=this.getCenterPoint();return this._centerObject(e,t)},viewportCenterObject:function(e){var t=this.getVpCenter();return this._centerObject(e,t)},viewportCenterObjectH:function(e){var r=this.getVpCenter();return this._centerObject(e,new t.Point(r.x,e.getCenterPoint().y)),this},viewportCenterObjectV:function(e){var r=this.getVpCenter();return this._centerObject(e,new t.Point(e.getCenterPoint().x,r.y))},getVpCenter:function(){var e=this.getCenterPoint(),t=a(this.viewportTransform);return o(e,t)},_centerObject:function(e,t){return e.setPositionByOrigin(t,"center","center"),e.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(e){return this.toDatalessObject(e)},toObject:function(e){return this._toObjectMethod("toObject",e)},toDatalessObject:function(e){return this._toObjectMethod("toDatalessObject",e)},_toObjectMethod:function(r,n){var i=this.clipPath,o={version:t.version,objects:this._toObjects(r,n)};return i&&!i.excludeFromExport&&(o.clipPath=this._toObject(this.clipPath,r,n)),e(o,this.__serializeBgOverlay(r,n)),t.util.populateWithProperties(this,o,n),o},_toObjects:function(e,t){return this._objects.filter(function(e){return!e.excludeFromExport}).map(function(r){return this._toObject(r,e,t)},this)},_toObject:function(e,t,r){var n;this.includeDefaultValues||(n=e.includeDefaultValues,e.includeDefaultValues=!1);var i=e[t](r);return this.includeDefaultValues||(e.includeDefaultValues=n),i},__serializeBgOverlay:function(e,t){var r={},n=this.backgroundImage,i=this.overlayImage,o=this.backgroundColor,a=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(r.background=o.toObject(t)):o&&(r.background=o),a&&a.toObject?a.excludeFromExport||(r.overlay=a.toObject(t)):a&&(r.overlay=a),n&&!n.excludeFromExport&&(r.backgroundImage=this._toObject(n,e,t)),i&&!i.excludeFromExport&&(r.overlayImage=this._toObject(i,e,t)),r},svgViewportTransformation:!0,toSVG:function(e,t){e||(e={}),e.reviver=t;var r=[];return this._setSVGPreamble(r,e),this._setSVGHeader(r,e),this.clipPath&&r.push('<g clip-path="url(#'+this.clipPath.clipPathId+')" >\n'),this._setSVGBgOverlayColor(r,"background"),this._setSVGBgOverlayImage(r,"backgroundImage",t),this._setSVGObjects(r,t),this.clipPath&&r.push("</g>\n"),this._setSVGBgOverlayColor(r,"overlay"),this._setSVGBgOverlayImage(r,"overlayImage",t),r.push("</svg>"),r.join("")},_setSVGPreamble:function(e,t){t.suppressPreamble||e.push('<?xml version="1.0" encoding="',t.encoding||"UTF-8",'" standalone="no" ?>\n','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(e,r){var n,o=r.width||this.width,a=r.height||this.height,s='viewBox="0 0 '+this.width+" "+this.height+'" ',l=t.Object.NUM_FRACTION_DIGITS;r.viewBox?s='viewBox="'+r.viewBox.x+" "+r.viewBox.y+" "+r.viewBox.width+" "+r.viewBox.height+'" ':this.svgViewportTransformation&&(n=this.viewportTransform,s='viewBox="'+i(-n[4]/n[0],l)+" "+i(-n[5]/n[3],l)+" "+i(this.width/n[0],l)+" "+i(this.height/n[3],l)+'" '),e.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',o,'" ','height="',a,'" ',s,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",t.version,"</desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(r),"</defs>\n")},createSVGClipPathMarkup:function(e){var r=this.clipPath;return r?(r.clipPathId="CLIPPATH_"+t.Object.__uid++,'<clipPath id="'+r.clipPathId+'" >\n'+this.clipPath.toClipPathSVG(e.reviver)+"</clipPath>\n"):""},createSVGRefElementsMarkup:function(){var e=this;return["background","overlay"].map(function(r){var n=e[r+"Color"];if(n&&n.toLive){var i=e[r+"Vpt"],o=e.viewportTransform,a={width:e.width/(i?o[0]:1),height:e.height/(i?o[3]:1)};return n.toSVG(a,{additionalTransform:i?t.util.matrixToSVG(o):""})}}).join("")},createSVGFontFacesMarkup:function(){var e,r,n,i,o,a,s,l,c="",u={},d=t.fontPaths,h=[];for(this._objects.forEach(function e(t){h.push(t),t._objects&&t._objects.forEach(e)}),s=0,l=h.length;s<l;s++)if(r=(e=h[s]).fontFamily,-1!==e.type.indexOf("text")&&!u[r]&&d[r]&&(u[r]=!0,e.styles))for(o in n=e.styles)for(a in i=n[o])!u[r=i[a].fontFamily]&&d[r]&&(u[r]=!0);for(var f in u)c+=["\t\t@font-face {\n","\t\t\tfont-family: '",f,"';\n","\t\t\tsrc: url('",d[f],"');\n","\t\t}\n"].join("");return c&&(c=['\t<style type="text/css">',"<![CDATA[\n",c,"]]>","</style>\n"].join("")),c},_setSVGObjects:function(e,t){var r,n,i,o=this._objects;for(n=0,i=o.length;n<i;n++)!(r=o[n]).excludeFromExport&&this._setSVGObject(e,r,t)},_setSVGObject:function(e,t,r){e.push(t.toSVG(r))},_setSVGBgOverlayImage:function(e,t,r){this[t]&&!this[t].excludeFromExport&&this[t].toSVG&&e.push(this[t].toSVG(r))},_setSVGBgOverlayColor:function(e,r){var n=this[r+"Color"],i=this.viewportTransform,o=this.width,a=this.height;if(n)if(n.toLive){var s=n.repeat,l=t.util.invertTransform(i),c=this[r+"Vpt"]?t.util.matrixToSVG(l):"";e.push('<rect transform="'+c+" translate(",o/2,",",a/2,')"',' x="',n.offsetX-o/2,'" y="',n.offsetY-a/2,'" ','width="',"repeat-y"===s||"no-repeat"===s?n.source.width:o,'" height="',"repeat-x"===s||"no-repeat"===s?n.source.height:a,'" fill="url(#SVGID_'+n.id+')"',"></rect>\n")}else e.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',n,'"',"></rect>\n")},sendToBack:function(e){if(!e)return this;var t,r,i,o=this._activeObject;if(e===o&&"activeSelection"===e.type)for(t=(i=o._objects).length;t--;)r=i[t],n(this._objects,r),this._objects.unshift(r);else n(this._objects,e),this._objects.unshift(e);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(e){if(!e)return this;var t,r,i,o=this._activeObject;if(e===o&&"activeSelection"===e.type)for(i=o._objects,t=0;t<i.length;t++)r=i[t],n(this._objects,r),this._objects.push(r);else n(this._objects,e),this._objects.push(e);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(e,t){if(!e)return this;var r,i,o,a,s,l=this._activeObject,c=0;if(e===l&&"activeSelection"===e.type)for(s=l._objects,r=0;r<s.length;r++)i=s[r],(o=this._objects.indexOf(i))>0+c&&(a=o-1,n(this._objects,i),this._objects.splice(a,0,i)),c++;else 0!==(o=this._objects.indexOf(e))&&(a=this._findNewLowerIndex(e,o,t),n(this._objects,e),this._objects.splice(a,0,e));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(e,t,r){var n,i;if(r)for(n=t,i=t-1;i>=0;--i){if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(e)){n=i;break}}else n=t-1;return n},bringForward:function(e,t){if(!e)return this;var r,i,o,a,s,l=this._activeObject,c=0;if(e===l&&"activeSelection"===e.type)for(r=(s=l._objects).length;r--;)i=s[r],(o=this._objects.indexOf(i))<this._objects.length-1-c&&(a=o+1,n(this._objects,i),this._objects.splice(a,0,i)),c++;else(o=this._objects.indexOf(e))!==this._objects.length-1&&(a=this._findNewUpperIndex(e,o,t),n(this._objects,e),this._objects.splice(a,0,e));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(e,t,r){var n,i,o;if(r)for(n=t,i=t+1,o=this._objects.length;i<o;++i){if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(e)){n=i;break}}else n=t+1;return n},moveTo:function(e,t){return n(this._objects,e),this._objects.splice(t,0,e),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(t.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject(function(e){e.dispose&&e.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove("lower-canvas"),t.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),t.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),e(t.StaticCanvas.prototype,t.Observable),e(t.StaticCanvas.prototype,t.Collection),e(t.StaticCanvas.prototype,t.DataURLExporter),e(t.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(e){var t=l();if(!t||!t.getContext)return null;var r=t.getContext("2d");return r&&"setLineDash"===e?typeof r.setLineDash<"u":null}}),t.StaticCanvas.prototype.toJSON=t.StaticCanvas.prototype.toObject,t.isLikelyNode&&(t.StaticCanvas.prototype.createPNGStream=function(){var e=s(this.lowerCanvasEl);return e&&e.createPNGStream()},t.StaticCanvas.prototype.createJPEGStream=function(e){var t=s(this.lowerCanvasEl);return t&&t.createJPEGStream(e)})}}(),t.BaseBrush=t.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(e){e.strokeStyle=this.color,e.lineWidth=this.width,e.lineCap=this.strokeLineCap,e.miterLimit=this.strokeMiterLimit,e.lineJoin=this.strokeLineJoin,e.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(e){var t=this.canvas.viewportTransform;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5])},_setShadow:function(){if(this.shadow){var e=this.canvas,r=this.shadow,n=e.contextTop,i=e.getZoom();e&&e._isRetinaScaling()&&(i*=t.devicePixelRatio),n.shadowColor=r.color,n.shadowBlur=r.blur*i,n.shadowOffsetX=r.offsetX*i,n.shadowOffsetY=r.offsetY*i}},needsFullRender:function(){return new t.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var e=this.canvas.contextTop;e.shadowColor="",e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0},_isOutSideCanvas:function(e){return e.x<0||e.x>this.canvas.getWidth()||e.y<0||e.y>this.canvas.getHeight()}}),t.PencilBrush=t.util.createClass(t.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:"shiftKey",initialize:function(e){this.canvas=e,this._points=[]},needsFullRender:function(){return this.callSuper("needsFullRender")||this._hasStraightLine},_drawSegment:function(e,t,r){var n=t.midPointFrom(r);return e.quadraticCurveTo(t.x,t.y,n.x,n.y),n},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this.drawStraightLine=t.e[this.straightLineKey],this._prepareForDrawing(e),this._captureDrawingPath(e),this._render())},onMouseMove:function(e,t){if(this.canvas._isMainEvent(t.e)&&(this.drawStraightLine=t.e[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(e))&&this._captureDrawingPath(e)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var r=this._points,n=r.length,i=this.canvas.contextTop;this._saveAndTransform(i),this.oldEnd&&(i.beginPath(),i.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(i,r[n-2],r[n-1],!0),i.stroke(),i.restore()}},onMouseUp:function(e){return!this.canvas._isMainEvent(e.e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(e){var r=new t.Point(e.x,e.y);this._reset(),this._addPoint(r),this.canvas.contextTop.moveTo(r.x,r.y)},_addPoint:function(e){return!(this._points.length>1&&e.eq(this._points[this._points.length-1])||(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(e),0))},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(e){var r=new t.Point(e.x,e.y);return this._addPoint(r)},_render:function(e){var r,n,i=this._points[0],o=this._points[1];if(e=e||this.canvas.contextTop,this._saveAndTransform(e),e.beginPath(),2===this._points.length&&i.x===o.x&&i.y===o.y){var a=this.width/1e3;i=new t.Point(i.x,i.y),o=new t.Point(o.x,o.y),i.x-=a,o.x+=a}for(e.moveTo(i.x,i.y),r=1,n=this._points.length;r<n;r++)this._drawSegment(e,i,o),i=this._points[r],o=this._points[r+1];e.lineTo(i.x,i.y),e.stroke(),e.restore()},convertPointsToSVGPath:function(e){var r=this.width/1e3;return t.util.getSmoothPathFromPoints(e,r)},_isEmptySVGPath:function(e){return"M 0 0 Q 0 0 0 0 L 0 0"===t.util.joinPath(e)},createPath:function(e){var r=new t.Path(e,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,r.shadow=new t.Shadow(this.shadow)),r},decimatePoints:function(e,t){if(e.length<=2)return e;var r,n=this.canvas.getZoom(),i=Math.pow(t/n,2),o=e.length-1,a=e[0],s=[a];for(r=1;r<o-1;r++)Math.pow(a.x-e[r].x,2)+Math.pow(a.y-e[r].y,2)>=i&&(a=e[r],s.push(a));return s.push(e[o]),s},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var e=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(e))this.canvas.requestRenderAll();else{var t=this.createPath(e);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:t}),this.canvas.add(t),this.canvas.requestRenderAll(),t.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:t})}}}),t.CircleBrush=t.util.createClass(t.BaseBrush,{width:10,initialize:function(e){this.canvas=e,this.points=[]},drawDot:function(e){var t=this.addPoint(e),r=this.canvas.contextTop;this._saveAndTransform(r),this.dot(r,t),r.restore()},dot:function(e,t){e.fillStyle=t.fill,e.beginPath(),e.arc(t.x,t.y,t.radius,0,2*Math.PI,!1),e.closePath(),e.fill()},onMouseDown:function(e){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(e)},_render:function(){var e,t,r=this.canvas.contextTop,n=this.points;for(this._saveAndTransform(r),e=0,t=n.length;e<t;e++)this.dot(r,n[e]);r.restore()},onMouseMove:function(e){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(e)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(e),this._render()):this.drawDot(e))},onMouseUp:function(){var e,r,n=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;var i=[];for(e=0,r=this.points.length;e<r;e++){var o=this.points[e],a=new t.Circle({radius:o.radius,left:o.x,top:o.y,originX:"center",originY:"center",fill:o.fill});this.shadow&&(a.shadow=new t.Shadow(this.shadow)),i.push(a)}var s=new t.Group(i);s.canvas=this.canvas,this.canvas.fire("before:path:created",{path:s}),this.canvas.add(s),this.canvas.fire("path:created",{path:s}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=n,this.canvas.requestRenderAll()},addPoint:function(e){var r=new t.Point(e.x,e.y),n=t.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,i=new t.Color(this.color).setAlpha(t.util.getRandomInt(0,100)/100).toRgba();return r.radius=n,r.fill=i,this.points.push(r),r}}),t.SprayBrush=t.util.createClass(t.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(e){this.canvas=e,this.sprayChunks=[]},onMouseDown:function(e){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(e),this.render(this.sprayChunkPoints)},onMouseMove:function(e){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(e)||(this.addSprayChunk(e),this.render(this.sprayChunkPoints))},onMouseUp:function(){var e=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var r=[],n=0,i=this.sprayChunks.length;n<i;n++)for(var o=this.sprayChunks[n],a=0,s=o.length;a<s;a++){var l=new t.Rect({width:o[a].width,height:o[a].width,left:o[a].x+1,top:o[a].y+1,originX:"center",originY:"center",fill:this.color});r.push(l)}this.optimizeOverlapping&&(r=this._getOptimizedRects(r));var c=new t.Group(r);this.shadow&&c.set("shadow",new t.Shadow(this.shadow)),this.canvas.fire("before:path:created",{path:c}),this.canvas.add(c),this.canvas.fire("path:created",{path:c}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=e,this.canvas.requestRenderAll()},_getOptimizedRects:function(e){var t,r,n,i={};for(r=0,n=e.length;r<n;r++)i[t=e[r].left+""+e[r].top]||(i[t]=e[r]);var o=[];for(t in i)o.push(i[t]);return o},render:function(e){var t,r,n=this.canvas.contextTop;for(n.fillStyle=this.color,this._saveAndTransform(n),t=0,r=e.length;t<r;t++){var i=e[t];typeof i.opacity<"u"&&(n.globalAlpha=i.opacity),n.fillRect(i.x,i.y,i.width,i.width)}n.restore()},_render:function(){var e,t,r=this.canvas.contextTop;for(r.fillStyle=this.color,this._saveAndTransform(r),e=0,t=this.sprayChunks.length;e<t;e++)this.render(this.sprayChunks[e]);r.restore()},addSprayChunk:function(e){this.sprayChunkPoints=[];var r,n,i,o,a=this.width/2;for(o=0;o<this.density;o++){r=t.util.getRandomInt(e.x-a,e.x+a),n=t.util.getRandomInt(e.y-a,e.y+a),i=this.dotWidthVariance?t.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var s=new t.Point(r,n);s.width=i,this.randomOpacity&&(s.opacity=t.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(s)}this.sprayChunks.push(this.sprayChunkPoints)}}),t.PatternBrush=t.util.createClass(t.PencilBrush,{getPatternSrc:function(){var e=t.util.createCanvasElement(),r=e.getContext("2d");return e.width=e.height=25,r.fillStyle=this.color,r.beginPath(),r.arc(10,10,10,0,2*Math.PI,!1),r.closePath(),r.fill(),e},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(e){return e.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(e){this.callSuper("_setBrushStyles",e),e.strokeStyle=this.getPattern(e)},createPath:function(e){var r=this.callSuper("createPath",e),n=r._getLeftTopCoords().scalarAdd(r.strokeWidth/2);return r.stroke=new t.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-n.x,offsetY:-n.y}),r}}),function(){var e=t.util.getPointer,r=t.util.degreesToRadians,n=t.util.isTouchEvent;for(var i in t.Canvas=t.util.createClass(t.StaticCanvas,{initialize:function(e,t){t||(t={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=t.PencilBrush&&new t.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var e,t,r,n=this.getActiveObjects();if(n.length>0&&!this.preserveObjectStacking){t=[],r=[];for(var i=0,o=this._objects.length;i<o;i++)e=this._objects[i],-1===n.indexOf(e)?t.push(e):r.push(e);n.length>1&&(this._activeObject._objects=r),t.push.apply(t,r)}else t=this._objects;return t},renderAll:function(){this.contextTopDirty&&!this._groupSelector&&!this.isDrawingMode&&(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&(this.renderTopLayer(this.contextTop),this.hasLostContext=!1);var e=this.contextContainer;return this.renderCanvas(e,this._chooseObjectsToRender()),this},renderTopLayer:function(e){e.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(e),this.contextTopDirty=!0),e.restore()},renderTop:function(){var e=this.contextTop;return this.clearContext(e),this.renderTopLayer(e),this.fire("after:render"),this},_normalizePointer:function(e,r){var n=e.calcTransformMatrix(),i=t.util.invertTransform(n),o=this.restorePointerVpt(r);return t.util.transformPoint(o,i)},isTargetTransparent:function(e,r,n){if(e.shouldCache()&&e._cacheCanvas&&e!==this._activeObject){var i=this._normalizePointer(e,{x:r,y:n}),o=Math.max(e.cacheTranslationX+i.x*e.zoomX,0),a=Math.max(e.cacheTranslationY+i.y*e.zoomY,0);return t.util.isTransparent(e._cacheContext,Math.round(o),Math.round(a),this.targetFindTolerance)}var s=this.contextCache,l=e.selectionBackgroundColor,c=this.viewportTransform;return e.selectionBackgroundColor="",this.clearContext(s),s.save(),s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),e.render(s),s.restore(),e.selectionBackgroundColor=l,t.util.isTransparent(s,r,n,this.targetFindTolerance)},_isSelectionKeyPressed:function(e){var t=!1;return t=Array.isArray(this.selectionKey)?!!this.selectionKey.find(function(t){return!0===e[t]}):e[this.selectionKey],t},_shouldClearSelection:function(e,t){var r=this.getActiveObjects(),n=this._activeObject;return!t||t&&n&&r.length>1&&-1===r.indexOf(t)&&n!==t&&!this._isSelectionKeyPressed(e)||t&&!t.evented||t&&!t.selectable&&n&&n!==t},_shouldCenterTransform:function(e,t,r){var n;if(e)return"scale"===t||"scaleX"===t||"scaleY"===t||"resizing"===t?n=this.centeredScaling||e.centeredScaling:"rotate"===t&&(n=this.centeredRotation||e.centeredRotation),n?!r:r},_getOriginFromCorner:function(e,t){var r={x:e.originX,y:e.originY};return"ml"===t||"tl"===t||"bl"===t?r.x="right":("mr"===t||"tr"===t||"br"===t)&&(r.x="left"),"tl"===t||"mt"===t||"tr"===t?r.y="bottom":("bl"===t||"mb"===t||"br"===t)&&(r.y="top"),r},_getActionFromCorner:function(e,t,r,n){if(!t||!e)return"drag";var i=n.controls[t];return i.getActionName(r,i,n)},_setupCurrentTransform:function(e,n,i){if(n){var o=this.getPointer(e),a=n.__corner,s=n.controls[a],l=i&&a?s.getActionHandler(e,n,s):t.controlsUtils.dragHandler,c=this._getActionFromCorner(i,a,e,n),u=this._getOriginFromCorner(n,a),d=e[this.centeredKey],h={target:n,action:c,actionHandler:l,corner:a,scaleX:n.scaleX,scaleY:n.scaleY,skewX:n.skewX,skewY:n.skewY,offsetX:o.x-n.left,offsetY:o.y-n.top,originX:u.x,originY:u.y,ex:o.x,ey:o.y,lastX:o.x,lastY:o.y,theta:r(n.angle),width:n.width*n.scaleX,shiftKey:e.shiftKey,altKey:d,original:t.util.saveObjectTransform(n)};this._shouldCenterTransform(n,c,d)&&(h.originX="center",h.originY="center"),h.original.originX=u.x,h.original.originY=u.y,this._currentTransform=h,this._beforeTransform(e)}},setCursor:function(e){this.upperCanvasEl.style.cursor=e},_drawSelection:function(e){var r=this._groupSelector,n=new t.Point(r.ex,r.ey),i=t.util.transformPoint(n,this.viewportTransform),o=new t.Point(r.ex+r.left,r.ey+r.top),a=t.util.transformPoint(o,this.viewportTransform),s=Math.min(i.x,a.x),l=Math.min(i.y,a.y),c=Math.max(i.x,a.x),u=Math.max(i.y,a.y),d=this.selectionLineWidth/2;this.selectionColor&&(e.fillStyle=this.selectionColor,e.fillRect(s,l,c-s,u-l)),this.selectionLineWidth&&this.selectionBorderColor&&(e.lineWidth=this.selectionLineWidth,e.strokeStyle=this.selectionBorderColor,s+=d,l+=d,c-=d,u-=d,t.Object.prototype._setLineDash.call(this,e,this.selectionDashArray),e.strokeRect(s,l,c-s,u-l))},findTarget:function(e,t){if(!this.skipTargetFind){var r,i,o=this.getPointer(e,!0),a=this._activeObject,s=this.getActiveObjects(),l=n(e),c=s.length>1&&!t||1===s.length;if(this.targets=[],c&&a._findTargetCorner(o,l)||s.length>1&&!t&&a===this._searchPossibleTargets([a],o))return a;if(1===s.length&&a===this._searchPossibleTargets([a],o)){if(!this.preserveObjectStacking)return a;r=a,i=this.targets,this.targets=[]}var u=this._searchPossibleTargets(this._objects,o);return e[this.altSelectionKey]&&u&&r&&u!==r&&(u=r,this.targets=i),u}},_checkTarget:function(e,t,r){if(t&&t.visible&&t.evented&&t.containsPoint(e)){if(!this.perPixelTargetFind&&!t.perPixelTargetFind||t.isEditing)return!0;if(!this.isTargetTransparent(t,r.x,r.y))return!0}},_searchPossibleTargets:function(e,r){for(var n,i,o=e.length;o--;){var a=e[o],s=a.group?this._normalizePointer(a.group,r):r;if(this._checkTarget(s,a,r)){(n=e[o]).subTargetCheck&&n instanceof t.Group&&((i=this._searchPossibleTargets(n._objects,r))&&this.targets.push(i));break}}return n},restorePointerVpt:function(e){return t.util.transformPoint(e,t.util.invertTransform(this.viewportTransform))},getPointer:function(t,r){if(this._absolutePointer&&!r)return this._absolutePointer;if(this._pointer&&r)return this._pointer;var n,i=e(t),o=this.upperCanvasEl,a=o.getBoundingClientRect(),s=a.width||0,l=a.height||0;(!s||!l)&&("top"in a&&"bottom"in a&&(l=Math.abs(a.top-a.bottom)),"right"in a&&"left"in a&&(s=Math.abs(a.right-a.left))),this.calcOffset(),i.x=i.x-this._offset.left,i.y=i.y-this._offset.top,r||(i=this.restorePointerVpt(i));var c=this.getRetinaScaling();return 1!==c&&(i.x/=c,i.y/=c),n=0===s||0===l?{width:1,height:1}:{width:o.width/s,height:o.height/l},{x:i.x*n.width,y:i.y*n.height}},_createUpperCanvas:function(){var e=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),r=this.lowerCanvasEl,n=this.upperCanvasEl;n?n.className="":(n=this._createCanvasElement(),this.upperCanvasEl=n),t.util.addClass(n,"upper-canvas "+e),this.wrapperEl.appendChild(n),this._copyCanvasStyle(r,n),this._applyCanvasStyle(n),this.contextTop=n.getContext("2d")},getTopContext:function(){return this.contextTop},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute("width",this.width),this.cacheCanvasEl.setAttribute("height",this.height),this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=t.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),t.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),t.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(e){var r=this.width||e.width,n=this.height||e.height;t.util.setStyle(e,{position:"absolute",width:r+"px",height:n+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),e.width=r,e.height=n,t.util.makeElementUnselectable(e)},_copyCanvasStyle:function(e,t){t.style.cssText=e.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var e=this._activeObject;return e?"activeSelection"===e.type&&e._objects?e._objects.slice(0):[e]:[]},_onObjectRemoved:function(e){e===this._activeObject&&(this.fire("before:selection:cleared",{target:e}),this._discardActiveObject(),this.fire("selection:cleared",{target:e}),e.fire("deselected")),e===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",e)},_fireSelectionEvents:function(e,t){var r=!1,n=this.getActiveObjects(),i=[],o=[];e.forEach(function(e){-1===n.indexOf(e)&&(r=!0,e.fire("deselected",{e:t,target:e}),o.push(e))}),n.forEach(function(n){-1===e.indexOf(n)&&(r=!0,n.fire("selected",{e:t,target:n}),i.push(n))}),e.length>0&&n.length>0?r&&this.fire("selection:updated",{e:t,selected:i,deselected:o}):n.length>0?this.fire("selection:created",{e:t,selected:i}):e.length>0&&this.fire("selection:cleared",{e:t,deselected:o})},setActiveObject:function(e,t){var r=this.getActiveObjects();return this._setActiveObject(e,t),this._fireSelectionEvents(r,t),this},_setActiveObject:function(e,t){return!(this._activeObject===e||!this._discardActiveObject(t,e)||e.onSelect({e:t}))&&(this._activeObject=e,!0)},_discardActiveObject:function(e,t){var r=this._activeObject;if(r){if(r.onDeselect({e:e,object:t}))return!1;this._activeObject=null}return!0},discardActiveObject:function(e){var t=this.getActiveObjects(),r=this.getActiveObject();return t.length&&this.fire("before:selection:cleared",{target:r,e:e}),this._discardActiveObject(e),this._fireSelectionEvents(t,e),this},dispose:function(){var e=this.wrapperEl;return this.removeListeners(),e.removeChild(this.upperCanvasEl),e.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(e){t.util.cleanUpJsdomNode(this[e]),this[e]=void 0}.bind(this)),e.parentNode&&e.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,t.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(e){var t=this._activeObject;t&&t._renderControls(e)},_toObject:function(e,t,r){var n=this._realizeGroupTransformOnObject(e),i=this.callSuper("_toObject",e,t,r);return this._unwindGroupTransformOnObject(e,n),i},_realizeGroupTransformOnObject:function(e){if(e.group&&"activeSelection"===e.group.type&&this._activeObject===e.group){var r={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach(function(t){r[t]=e[t]}),t.util.addTransformToObject(e,this._activeObject.calcOwnMatrix()),r}return null},_unwindGroupTransformOnObject:function(e,t){t&&e.set(t)},_setSVGObject:function(e,t,r){var n=this._realizeGroupTransformOnObject(t);this.callSuper("_setSVGObject",e,t,r),this._unwindGroupTransformOnObject(t,n)},setViewportTransform:function(e){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),t.StaticCanvas.prototype.setViewportTransform.call(this,e)}}),t.StaticCanvas)"prototype"!==i&&(t.Canvas[i]=t.StaticCanvas[i])}(),function(){var e=t.util.addListener,r=t.util.removeListener,n={passive:!1};function i(e,t){return e.button&&e.button===t-1}t.util.object.extend(t.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(e,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(e,r){var i=this.upperCanvasEl,o=this._getEventPrefix();e(t.window,"resize",this._onResize),e(i,o+"down",this._onMouseDown),e(i,o+"move",this._onMouseMove,n),e(i,o+"out",this._onMouseOut),e(i,o+"enter",this._onMouseEnter),e(i,"wheel",this._onMouseWheel),e(i,"contextmenu",this._onContextMenu),e(i,"dblclick",this._onDoubleClick),e(i,"dragover",this._onDragOver),e(i,"dragenter",this._onDragEnter),e(i,"dragleave",this._onDragLeave),e(i,"drop",this._onDrop),this.enablePointerEvents||e(i,"touchstart",this._onTouchStart,n),typeof eventjs<"u"&&r in eventjs&&(eventjs[r](i,"gesture",this._onGesture),eventjs[r](i,"drag",this._onDrag),eventjs[r](i,"orientation",this._onOrientationChange),eventjs[r](i,"shake",this._onShake),eventjs[r](i,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(r,"remove");var e=this._getEventPrefix();r(t.document,e+"up",this._onMouseUp),r(t.document,"touchend",this._onTouchEnd,n),r(t.document,e+"move",this._onMouseMove,n),r(t.document,"touchmove",this._onMouseMove,n)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._onDrop.bind(this),this.eventsBound=!0)},_onGesture:function(e,t){this.__onTransformGesture&&this.__onTransformGesture(e,t)},_onDrag:function(e,t){this.__onDrag&&this.__onDrag(e,t)},_onMouseWheel:function(e){this.__onMouseWheel(e)},_onMouseOut:function(e){var t=this._hoveredTarget;this.fire("mouse:out",{target:t,e:e}),this._hoveredTarget=null,t&&t.fire("mouseout",{e:e});var r=this;this._hoveredTargets.forEach(function(n){r.fire("mouse:out",{target:t,e:e}),n&&t.fire("mouseout",{e:e})}),this._hoveredTargets=[]},_onMouseEnter:function(e){!this._currentTransform&&!this.findTarget(e)&&(this.fire("mouse:over",{target:null,e:e}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(e,t){this.__onOrientationChange&&this.__onOrientationChange(e,t)},_onShake:function(e,t){this.__onShake&&this.__onShake(e,t)},_onLongPress:function(e,t){this.__onLongPress&&this.__onLongPress(e,t)},_onDragOver:function(e){e.preventDefault();var t=this._simpleEventHandler("dragover",e);this._fireEnterLeaveEvents(t,e)},_onDrop:function(e){return this._simpleEventHandler("drop:before",e),this._simpleEventHandler("drop",e)},_onContextMenu:function(e){return this.stopContextMenu&&(e.stopPropagation(),e.preventDefault()),!1},_onDoubleClick:function(e){this._cacheTransformEventData(e),this._handleEvent(e,"dblclick"),this._resetTransformEventData(e)},getPointerId:function(e){var t=e.changedTouches;return t?t[0]&&t[0].identifier:this.enablePointerEvents?e.pointerId:-1},_isMainEvent:function(e){return!0===e.isPrimary||!1!==e.isPrimary&&("touchend"===e.type&&0===e.touches.length||(!e.changedTouches||e.changedTouches[0].identifier===this.mainTouchId))},_onTouchStart:function(i){i.preventDefault(),null===this.mainTouchId&&(this.mainTouchId=this.getPointerId(i)),this.__onMouseDown(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();e(t.document,"touchend",this._onTouchEnd,n),e(t.document,"touchmove",this._onMouseMove,n),r(o,a+"down",this._onMouseDown)},_onMouseDown:function(i){this.__onMouseDown(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();r(o,a+"move",this._onMouseMove,n),e(t.document,a+"up",this._onMouseUp),e(t.document,a+"move",this._onMouseMove,n)},_onTouchEnd:function(i){if(!(i.touches.length>0)){this.__onMouseUp(i),this._resetTransformEventData(),this.mainTouchId=null;var o=this._getEventPrefix();r(t.document,"touchend",this._onTouchEnd,n),r(t.document,"touchmove",this._onMouseMove,n);var a=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){e(a.upperCanvasEl,o+"down",a._onMouseDown),a._willAddMouseDown=0},400)}},_onMouseUp:function(i){this.__onMouseUp(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();this._isMainEvent(i)&&(r(t.document,a+"up",this._onMouseUp),r(t.document,a+"move",this._onMouseMove,n),e(o,a+"move",this._onMouseMove,n))},_onMouseMove:function(e){!this.allowTouchScrolling&&e.preventDefault&&e.preventDefault(),this.__onMouseMove(e)},_onResize:function(){this.calcOffset()},_shouldRender:function(e){var t=this._activeObject;return!!(!!t!=!!e||t&&e&&t!==e)||(t&&t.isEditing,!1)},__onMouseUp:function(e){var r,n=this._currentTransform,o=this._groupSelector,a=!1,s=!o||0===o.left&&0===o.top;if(this._cacheTransformEventData(e),r=this._target,this._handleEvent(e,"up:before"),i(e,3))this.fireRightClick&&this._handleEvent(e,"up",3,s);else{if(i(e,2))return this.fireMiddleClick&&this._handleEvent(e,"up",2,s),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(e);else if(this._isMainEvent(e)){if(n&&(this._finalizeCurrentTransform(e),a=n.actionPerformed),!s){var l=r===this._activeObject;this._maybeGroupObjects(e),a||(a=this._shouldRender(r)||!l&&r===this._activeObject)}var c,u;if(r){if(c=r._findTargetCorner(this.getPointer(e,!0),t.util.isTouchEvent(e)),r.selectable&&r!==this._activeObject&&"up"===r.activeOn)this.setActiveObject(r,e),a=!0;else{var d=r.controls[c],h=d&&d.getMouseUpHandler(e,r,d);h&&h(e,n,(u=this.getPointer(e)).x,u.y)}r.isMoving=!1}if(n&&(n.target!==r||n.corner!==c)){var f=n.target&&n.target.controls[n.corner],p=f&&f.getMouseUpHandler(e,r,d);u=u||this.getPointer(e),p&&p(e,n,u.x,u.y)}this._setCursorFromEvent(e,r),this._handleEvent(e,"up",1,s),this._groupSelector=null,this._currentTransform=null,r&&(r.__corner=0),a?this.requestRenderAll():s||this.renderTop()}}},_simpleEventHandler:function(e,t){var r=this.findTarget(t),n=this.targets,i={e:t,target:r,subTargets:n};if(this.fire(e,i),r&&r.fire(e,i),!n)return r;for(var o=0;o<n.length;o++)n[o].fire(e,i);return r},_handleEvent:function(e,t,r,n){var i=this._target,o=this.targets||[],a={e:e,target:i,subTargets:o,button:r||1,isClick:n||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===t&&(a.currentTarget=this.findTarget(e),a.currentSubTargets=this.targets),this.fire("mouse:"+t,a),i&&i.fire("mouse"+t,a);for(var s=0;s<o.length;s++)o[s].fire("mouse"+t,a)},_finalizeCurrentTransform:function(e){var t=this._currentTransform,r=t.target,n={e:e,target:r,transform:t,action:t.action};r._scaling&&(r._scaling=!1),r.setCoords(),(t.actionPerformed||this.stateful&&r.hasStateChanged())&&this._fire("modified",n)},_onMouseDownInDrawingMode:function(e){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(e).requestRenderAll();var t=this.getPointer(e);this.freeDrawingBrush.onMouseDown(t,{e:e,pointer:t}),this._handleEvent(e,"down")},_onMouseMoveInDrawingMode:function(e){if(this._isCurrentlyDrawing){var t=this.getPointer(e);this.freeDrawingBrush.onMouseMove(t,{e:e,pointer:t})}this.setCursor(this.freeDrawingCursor),this._handleEvent(e,"move")},_onMouseUpInDrawingMode:function(e){var t=this.getPointer(e);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:e,pointer:t}),this._handleEvent(e,"up")},__onMouseDown:function(e){this._cacheTransformEventData(e),this._handleEvent(e,"down:before");var r=this._target;if(i(e,3))this.fireRightClick&&this._handleEvent(e,"down",3);else if(i(e,2))this.fireMiddleClick&&this._handleEvent(e,"down",2);else if(this.isDrawingMode)this._onMouseDownInDrawingMode(e);else if(this._isMainEvent(e)&&!this._currentTransform){var n=this._pointer;this._previousPointer=n;var o=this._shouldRender(r),a=this._shouldGroup(e,r);if(this._shouldClearSelection(e,r)?this.discardActiveObject(e):a&&(this._handleGrouping(e,r),r=this._activeObject),this.selection&&(!r||!r.selectable&&!r.isEditing&&r!==this._activeObject)&&(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),r){var s=r===this._activeObject;r.selectable&&"down"===r.activeOn&&this.setActiveObject(r,e);var l=r._findTargetCorner(this.getPointer(e,!0),t.util.isTouchEvent(e));if(r.__corner=l,r===this._activeObject&&(l||!a)){this._setupCurrentTransform(e,r,s);var c=r.controls[l],u=(n=this.getPointer(e),c&&c.getMouseDownHandler(e,r,c));u&&u(e,this._currentTransform,n.x,n.y)}}this._handleEvent(e,"down"),(o||a)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(e){this._resetTransformEventData(),this._pointer=this.getPointer(e,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(e)||null},_beforeTransform:function(e){var t=this._currentTransform;this.stateful&&t.target.saveState(),this.fire("before:transform",{e:e,transform:t})},__onMouseMove:function(e){var t,r;if(this._handleEvent(e,"move:before"),this._cacheTransformEventData(e),this.isDrawingMode)this._onMouseMoveInDrawingMode(e);else if(this._isMainEvent(e)){var n=this._groupSelector;n?(r=this._absolutePointer,n.left=r.x-n.ex,n.top=r.y-n.ey,this.renderTop()):this._currentTransform?this._transformObject(e):(t=this.findTarget(e)||null,this._setCursorFromEvent(e,t),this._fireOverOutEvents(t,e)),this._handleEvent(e,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(e,t){var r=this._hoveredTarget,n=this._hoveredTargets,i=this.targets,o=Math.max(n.length,i.length);this.fireSyntheticInOutEvents(e,t,{oldTarget:r,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(i[a],t,{oldTarget:n[a],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=e,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(e,t){var r=this._draggedoverTarget,n=this._hoveredTargets,i=this.targets,o=Math.max(n.length,i.length);this.fireSyntheticInOutEvents(e,t,{oldTarget:r,evtOut:"dragleave",evtIn:"dragenter"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(i[a],t,{oldTarget:n[a],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=e},fireSyntheticInOutEvents:function(e,t,r){var n,i,o,a=r.oldTarget,s=a!==e,l=r.canvasEvtIn,c=r.canvasEvtOut;s&&(n={e:t,target:e,previousTarget:a},i={e:t,target:a,nextTarget:e}),o=e&&s,a&&s&&(c&&this.fire(c,i),a.fire(r.evtOut,i)),o&&(l&&this.fire(l,n),e.fire(r.evtIn,n))},__onMouseWheel:function(e){this._cacheTransformEventData(e),this._handleEvent(e,"wheel"),this._resetTransformEventData()},_transformObject:function(e){var t=this.getPointer(e),r=this._currentTransform;r.reset=!1,r.shiftKey=e.shiftKey,r.altKey=e[this.centeredKey],this._performTransformAction(e,r,t),r.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(e,t,r){var n=r.x,i=r.y,o=t.action,a=!1,s=t.actionHandler;s&&(a=s(e,t,n,i)),"drag"===o&&a&&(t.target.isMoving=!0,this.setCursor(t.target.moveCursor||this.moveCursor)),t.actionPerformed=t.actionPerformed||a},_fire:t.controlsUtils.fireEvent,_setCursorFromEvent:function(e,t){if(!t)return this.setCursor(this.defaultCursor),!1;var r=t.hoverCursor||this.hoverCursor,n=this._activeObject&&"activeSelection"===this._activeObject.type?this._activeObject:null,i=(!n||!n.contains(t))&&t._findTargetCorner(this.getPointer(e,!0));i?this.setCursor(this.getCornerCursor(i,t,e)):(t.subTargetCheck&&this.targets.concat().reverse().map(function(e){r=e.hoverCursor||r}),this.setCursor(r))},getCornerCursor:function(e,t,r){var n=t.controls[e];return n.cursorStyleHandler(r,n,t)}})}(),function(){var e=Math.min,r=Math.max;t.util.object.extend(t.Canvas.prototype,{_shouldGroup:function(e,t){var r=this._activeObject;return r&&this._isSelectionKeyPressed(e)&&t&&t.selectable&&this.selection&&(r!==t||"activeSelection"===r.type)&&!t.onSelect({e:e})},_handleGrouping:function(e,t){var r=this._activeObject;r.__corner||t===r&&(!(t=this.findTarget(e,!0))||!t.selectable)||(r&&"activeSelection"===r.type?this._updateActiveSelection(t,e):this._createActiveSelection(t,e))},_updateActiveSelection:function(e,t){var r=this._activeObject,n=r._objects.slice(0);r.contains(e)?(r.removeWithUpdate(e),this._hoveredTarget=e,this._hoveredTargets=this.targets.concat(),1===r.size()&&this._setActiveObject(r.item(0),t)):(r.addWithUpdate(e),this._hoveredTarget=r,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(n,t)},_createActiveSelection:function(e,t){var r=this.getActiveObjects(),n=this._createGroup(e);this._hoveredTarget=n,this._setActiveObject(n,t),this._fireSelectionEvents(r,t)},_createGroup:function(e){var r=this._objects,n=r.indexOf(this._activeObject)<r.indexOf(e)?[this._activeObject,e]:[e,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new t.ActiveSelection(n,{canvas:this})},_groupSelectedObjects:function(e){var r,n=this._collectObjects(e);1===n.length?this.setActiveObject(n[0],e):n.length>1&&(r=new t.ActiveSelection(n.reverse(),{canvas:this}),this.setActiveObject(r,e))},_collectObjects:function(n){for(var i,o=[],a=this._groupSelector.ex,s=this._groupSelector.ey,l=a+this._groupSelector.left,c=s+this._groupSelector.top,u=new t.Point(e(a,l),e(s,c)),d=new t.Point(r(a,l),r(s,c)),h=!this.selectionFullyContained,f=a===l&&s===c,p=this._objects.length;p--&&!((i=this._objects[p])&&i.selectable&&i.visible&&(h&&i.intersectsWithRect(u,d,!0)||i.isContainedWithinRect(u,d,!0)||h&&i.containsPoint(u,null,!0)||h&&i.containsPoint(d,null,!0))&&(o.push(i),f)););return o.length>1&&(o=o.filter(function(e){return!e.onSelect({e:n})})),o},_maybeGroupObjects:function(e){this.selection&&this._groupSelector&&this._groupSelectedObjects(e),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),t.util.object.extend(t.StaticCanvas.prototype,{toDataURL:function(e){e||(e={});var r=e.format||"png",n=e.quality||1,i=(e.multiplier||1)*(e.enableRetinaScaling?this.getRetinaScaling():1),o=this.toCanvasElement(i,e);return t.util.toDataURL(o,r,n)},toCanvasElement:function(e,r){e=e||1;var n=((r=r||{}).width||this.width)*e,i=(r.height||this.height)*e,o=this.getZoom(),a=this.width,s=this.height,l=o*e,c=this.viewportTransform,u=(c[4]-(r.left||0))*e,d=(c[5]-(r.top||0))*e,h=this.interactive,f=[l,0,0,l,u,d],p=this.enableRetinaScaling,g=t.util.createCanvasElement(),m=this.contextTop;return g.width=n,g.height=i,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=f,this.width=n,this.height=i,this.calcViewportBoundaries(),this.renderCanvas(g.getContext("2d"),this._objects),this.viewportTransform=c,this.width=a,this.height=s,this.calcViewportBoundaries(),this.interactive=h,this.enableRetinaScaling=p,this.contextTop=m,g}}),t.util.object.extend(t.StaticCanvas.prototype,{loadFromJSON:function(e,r,n){if(e){var i="string"==typeof e?JSON.parse(e):t.util.object.clone(e),o=this,a=i.clipPath,s=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete i.clipPath,this._enlivenObjects(i.objects,function(e){o.clear(),o._setBgOverlay(i,function(){a?o._enlivenObjects([a],function(t){o.clipPath=t[0],o.__setupCanvas.call(o,i,e,s,r)}):o.__setupCanvas.call(o,i,e,s,r)})},n),this}},__setupCanvas:function(e,t,r,n){var i=this;t.forEach(function(e,t){i.insertAt(e,t)}),this.renderOnAddRemove=r,delete e.objects,delete e.backgroundImage,delete e.overlayImage,delete e.background,delete e.overlay,this._setOptions(e),this.renderAll(),n&&n()},_setBgOverlay:function(e,t){var r={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(e.backgroundImage||e.overlayImage||e.background||e.overlay){var n=function(){r.backgroundImage&&r.overlayImage&&r.backgroundColor&&r.overlayColor&&t&&t()};this.__setBgOverlay("backgroundImage",e.backgroundImage,r,n),this.__setBgOverlay("overlayImage",e.overlayImage,r,n),this.__setBgOverlay("backgroundColor",e.background,r,n),this.__setBgOverlay("overlayColor",e.overlay,r,n)}else t&&t()},__setBgOverlay:function(e,r,n,i){var o=this;if(!r)return n[e]=!0,void(i&&i());"backgroundImage"===e||"overlayImage"===e?t.util.enlivenObjects([r],function(t){o[e]=t[0],n[e]=!0,i&&i()}):this["set"+t.util.string.capitalize(e,!0)](r,function(){n[e]=!0,i&&i()})},_enlivenObjects:function(e,r,n){e&&0!==e.length?t.util.enlivenObjects(e,function(e){r&&r(e)},null,n):r&&r([])},_toDataURL:function(e,t){this.clone(function(r){t(r.toDataURL(e))})},_toDataURLWithMultiplier:function(e,t,r){this.clone(function(n){r(n.toDataURLWithMultiplier(e,t))})},clone:function(e,t){var r=JSON.stringify(this.toJSON(t));this.cloneWithoutData(function(t){t.loadFromJSON(r,function(){e&&e(t)})})},cloneWithoutData:function(e){var r=t.util.createCanvasElement();r.width=this.width,r.height=this.height;var n=new t.Canvas(r);this.backgroundImage?(n.setBackgroundImage(this.backgroundImage.src,function(){n.renderAll(),e&&e(n)}),n.backgroundImageOpacity=this.backgroundImageOpacity,n.backgroundImageStretch=this.backgroundImageStretch):e&&e(n)}}),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.object.clone,i=t.util.toFixed,o=t.util.string.capitalize,a=t.util.degreesToRadians,s=!t.isLikelyNode;t.Object||(t.Object=t.util.createClass(t.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:"rgb(178,204,255)",borderDashArray:null,cornerColor:"rgb(178,204,255)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:s,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:"fill",activeOn:"down",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath".split(" "),colorProperties:"fill stroke backgroundColor".split(" "),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(e){e&&this.setOptions(e)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=t.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(e){var r=t.perfLimitSizeTotal,n=e.width,i=e.height,o=t.maxCacheSideLimit,a=t.minCacheSideLimit;if(n<=o&&i<=o&&n*i<=r)return n<a&&(e.width=a),i<a&&(e.height=a),e;var s=n/i,l=t.util.limitDimsByArea(s,r),c=t.util.capValue,u=c(a,l.x,o),d=c(a,l.y,o);return n>u&&(e.zoomX/=n/u,e.width=u,e.capped=!0),i>d&&(e.zoomY/=i/d,e.height=d,e.capped=!0),e},_getCacheCanvasDimensions:function(){var e=this.getTotalObjectScaling(),t=this._getTransformedDimensions(0,0),r=t.x*e.scaleX/this.scaleX,n=t.y*e.scaleY/this.scaleY;return{width:r+2,height:n+2,zoomX:e.scaleX,zoomY:e.scaleY,x:r,y:n}},_updateCacheCanvas:function(){var e=this.canvas;if(this.noScaleCache&&e&&e._currentTransform){var r=e._currentTransform.target,n=e._currentTransform.action;if(this===r&&n.slice&&"scale"===n.slice(0,5))return!1}var i,o,a=this._cacheCanvas,s=this._limitCacheSize(this._getCacheCanvasDimensions()),l=t.minCacheSideLimit,c=s.width,u=s.height,d=s.zoomX,h=s.zoomY,f=c!==this.cacheWidth||u!==this.cacheHeight,p=this.zoomX!==d||this.zoomY!==h,g=f||p,m=0,v=0,y=!1;if(f){var b=this._cacheCanvas.width,w=this._cacheCanvas.height,x=c>b||u>w;y=x||(c<.9*b||u<.9*w)&&b>l&&w>l,x&&!s.capped&&(c>l||u>l)&&(m=.1*c,v=.1*u)}return this instanceof t.Text&&this.path&&(g=!0,y=!0,m+=this.getHeightOfLine(0)*this.zoomX,v+=this.getHeightOfLine(0)*this.zoomY),!!g&&(y?(a.width=Math.ceil(c+m),a.height=Math.ceil(u+v)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,a.width,a.height)),i=s.x/2,o=s.y/2,this.cacheTranslationX=Math.round(a.width/2-i)+i,this.cacheTranslationY=Math.round(a.height/2-o)+o,this.cacheWidth=c,this.cacheHeight=u,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(d,h),this.zoomX=d,this.zoomY=h,!0)},setOptions:function(e){this._setOptions(e),this._initGradient(e.fill,"fill"),this._initGradient(e.stroke,"stroke"),this._initPattern(e.fill,"fill"),this._initPattern(e.stroke,"stroke")},transform:function(e){var t=this.group&&!this.group._transformDone||this.group&&this.canvas&&e===this.canvas.contextTop,r=this.calcTransformMatrix(!t);e.transform(r[0],r[1],r[2],r[3],r[4],r[5])},toObject:function(e){var r=t.Object.NUM_FRACTION_DIGITS,n={type:this.type,version:t.version,originX:this.originX,originY:this.originY,left:i(this.left,r),top:i(this.top,r),width:i(this.width,r),height:i(this.height,r),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:i(this.strokeWidth,r),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:i(this.strokeMiterLimit,r),scaleX:i(this.scaleX,r),scaleY:i(this.scaleY,r),angle:i(this.angle,r),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,r),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:i(this.skewX,r),skewY:i(this.skewY,r)};return this.clipPath&&!this.clipPath.excludeFromExport&&(n.clipPath=this.clipPath.toObject(e),n.clipPath.inverted=this.clipPath.inverted,n.clipPath.absolutePositioned=this.clipPath.absolutePositioned),t.util.populateWithProperties(this,n,e),this.includeDefaultValues||(n=this._removeDefaultValues(n)),n},toDatalessObject:function(e){return this.toObject(e)},_removeDefaultValues:function(e){var r=t.util.getKlass(e.type).prototype;return r.stateProperties.forEach(function(t){"left"===t||"top"===t||(e[t]===r[t]&&delete e[t],Array.isArray(e[t])&&Array.isArray(r[t])&&0===e[t].length&&0===r[t].length&&delete e[t])}),e},toString:function(){return"#<fabric."+o(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var e=t.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(e.scaleX),scaleY:Math.abs(e.scaleY)}},getTotalObjectScaling:function(){var e=this.getObjectScaling(),t=e.scaleX,r=e.scaleY;if(this.canvas){var n=this.canvas.getZoom(),i=this.canvas.getRetinaScaling();t*=n*i,r*=n*i}return{scaleX:t,scaleY:r}},getObjectOpacity:function(){var e=this.opacity;return this.group&&(e*=this.group.getObjectOpacity()),e},_set:function(e,r){var n="scaleX"===e||"scaleY"===e,i=this[e]!==r,o=!1;return n&&(r=this._constrainScale(r)),"scaleX"===e&&r<0?(this.flipX=!this.flipX,r*=-1):"scaleY"===e&&r<0?(this.flipY=!this.flipY,r*=-1):"shadow"!==e||!r||r instanceof t.Shadow?"dirty"===e&&this.group&&this.group.set("dirty",r):r=new t.Shadow(r),this[e]=r,i&&(o=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(e)>-1?(this.dirty=!0,o&&this.group.set("dirty",!0)):o&&this.stateProperties.indexOf(e)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:t.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(e){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(e.save(),this._setupCompositeOperation(e),this.drawSelectionBackground(e),this.transform(e),this._setOpacity(e),this._setShadow(e,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(e)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(e),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),e.restore())},renderCache:function(e){e=e||{},(!this._cacheCanvas||!this._cacheContext)&&this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,e.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this._cacheContext=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&"transparent"!==this.stroke&&0!==this.strokeWidth},hasFill:function(){return this.fill&&"transparent"!==this.fill},needsItsOwnCache:function(){return!!("stroke"===this.paintFirst&&this.hasFill()&&this.hasStroke()&&"object"==typeof this.shadow||this.clipPath)},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(0!==this.shadow.offsetX||0!==this.shadow.offsetY)},drawClipPathOnCache:function(e,r){if(e.save(),r.inverted?e.globalCompositeOperation="destination-out":e.globalCompositeOperation="destination-in",r.absolutePositioned){var n=t.util.invertTransform(this.calcTransformMatrix());e.transform(n[0],n[1],n[2],n[3],n[4],n[5])}r.transform(e),e.scale(1/r.zoomX,1/r.zoomY),e.drawImage(r._cacheCanvas,-r.cacheTranslationX,-r.cacheTranslationY),e.restore()},drawObject:function(e,t){var r=this.fill,n=this.stroke;t?(this.fill="black",this.stroke="",this._setClippingProperties(e)):this._renderBackground(e),this._render(e),this._drawClipPath(e,this.clipPath),this.fill=r,this.stroke=n},_drawClipPath:function(e,t){t&&(t.canvas=this.canvas,t.shouldCache(),t._transformDone=!0,t.renderCache({forClipping:!0}),this.drawClipPathOnCache(e,t))},drawCacheOnCanvas:function(e){e.scale(1/this.zoomX,1/this.zoomY),e.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(e){if(this.isNotVisible())return!1;if(this._cacheCanvas&&this._cacheContext&&!e&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&this._cacheContext&&!e){var t=this.cacheWidth/this.zoomX,r=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-t/2,-r/2,t,r)}return!0}return!1},_renderBackground:function(e){if(this.backgroundColor){var t=this._getNonTransformedDimensions();e.fillStyle=this.backgroundColor,e.fillRect(-t.x/2,-t.y/2,t.x,t.y),this._removeShadow(e)}},_setOpacity:function(e){this.group&&!this.group._transformDone?e.globalAlpha=this.getObjectOpacity():e.globalAlpha*=this.opacity},_setStrokeStyles:function(e,t){var r=t.stroke;r&&(e.lineWidth=t.strokeWidth,e.lineCap=t.strokeLineCap,e.lineDashOffset=t.strokeDashOffset,e.lineJoin=t.strokeLineJoin,e.miterLimit=t.strokeMiterLimit,r.toLive?"percentage"===r.gradientUnits||r.gradientTransform||r.patternTransform?this._applyPatternForTransformedGradient(e,r):(e.strokeStyle=r.toLive(e,this),this._applyPatternGradientTransform(e,r)):e.strokeStyle=t.stroke)},_setFillStyles:function(e,t){var r=t.fill;r&&(r.toLive?(e.fillStyle=r.toLive(e,this),this._applyPatternGradientTransform(e,t.fill)):e.fillStyle=r)},_setClippingProperties:function(e){e.globalAlpha=1,e.strokeStyle="transparent",e.fillStyle="#000000"},_setLineDash:function(e,t){!t||0===t.length||(1&t.length&&t.push.apply(t,t),e.setLineDash(t))},_renderControls:function(e,r){var n,i,o,s=this.getViewportTransform(),l=this.calcTransformMatrix();i=typeof(r=r||{}).hasBorders<"u"?r.hasBorders:this.hasBorders,o=typeof r.hasControls<"u"?r.hasControls:this.hasControls,l=t.util.multiplyTransformMatrices(s,l),n=t.util.qrDecompose(l),e.save(),e.translate(n.translateX,n.translateY),e.lineWidth=1*this.borderScaleFactor,this.group||(e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(n.angle-=180),e.rotate(a(this.group?n.angle:this.angle)),r.forActiveSelection||this.group?i&&this.drawBordersInGroup(e,n,r):i&&this.drawBorders(e,r),o&&this.drawControls(e,r),e.restore()},_setShadow:function(e){if(this.shadow){var r,n=this.shadow,i=this.canvas,o=i&&i.viewportTransform[0]||1,a=i&&i.viewportTransform[3]||1;r=n.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),i&&i._isRetinaScaling()&&(o*=t.devicePixelRatio,a*=t.devicePixelRatio),e.shadowColor=n.color,e.shadowBlur=n.blur*t.browserShadowBlurConstant*(o+a)*(r.scaleX+r.scaleY)/4,e.shadowOffsetX=n.offsetX*o*r.scaleX,e.shadowOffsetY=n.offsetY*a*r.scaleY}},_removeShadow:function(e){this.shadow&&(e.shadowColor="",e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0)},_applyPatternGradientTransform:function(e,t){if(!t||!t.toLive)return{offsetX:0,offsetY:0};var r=t.gradientTransform||t.patternTransform,n=-this.width/2+t.offsetX||0,i=-this.height/2+t.offsetY||0;return"percentage"===t.gradientUnits?e.transform(this.width,0,0,this.height,n,i):e.transform(1,0,0,1,n,i),r&&e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),{offsetX:n,offsetY:i}},_renderPaintInOrder:function(e){"stroke"===this.paintFirst?(this._renderStroke(e),this._renderFill(e)):(this._renderFill(e),this._renderStroke(e))},_render:function(){},_renderFill:function(e){this.fill&&(e.save(),this._setFillStyles(e,this),"evenodd"===this.fillRule?e.fill("evenodd"):e.fill(),e.restore())},_renderStroke:function(e){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this.strokeUniform&&this.group){var t=this.getObjectScaling();e.scale(1/t.scaleX,1/t.scaleY)}else this.strokeUniform&&e.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(e,this.strokeDashArray),this._setStrokeStyles(e,this),e.stroke(),e.restore()}},_applyPatternForTransformedGradient:function(e,r){var n,i=this._limitCacheSize(this._getCacheCanvasDimensions()),o=t.util.createCanvasElement(),a=this.canvas.getRetinaScaling(),s=i.x/this.scaleX/a,l=i.y/this.scaleY/a;o.width=s,o.height=l,(n=o.getContext("2d")).beginPath(),n.moveTo(0,0),n.lineTo(s,0),n.lineTo(s,l),n.lineTo(0,l),n.closePath(),n.translate(s/2,l/2),n.scale(i.zoomX/this.scaleX/a,i.zoomY/this.scaleY/a),this._applyPatternGradientTransform(n,r),n.fillStyle=r.toLive(e),n.fill(),e.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),e.scale(a*this.scaleX/i.zoomX,a*this.scaleY/i.zoomY),e.strokeStyle=n.createPattern(o,"no-repeat")},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var e=t.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",e.scaleX),this.set("scaleY",e.scaleY),this.angle=e.angle,this.skewX=e.skewX,this.skewY=0}},_removeTransformMatrix:function(e){var r=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),r=t.util.transformPoint(r,this.transformMatrix)),this.transformMatrix=null,e&&(this.scaleX*=e.scaleX,this.scaleY*=e.scaleY,this.cropX=e.cropX,this.cropY=e.cropY,r.x+=e.offsetLeft,r.y+=e.offsetTop,this.width=e.width,this.height=e.height),this.setPositionByOrigin(r,"center","center")},clone:function(e,r){var n=this.toObject(r);this.constructor.fromObject?this.constructor.fromObject(n,e):t.Object._fromObject("Object",n,e)},cloneAsImage:function(e,r){var n=this.toCanvasElement(r);return e&&e(new t.Image(n)),this},toCanvasElement:function(e){e||(e={});var r=t.util,n=r.saveObjectTransform(this),i=this.group,o=this.shadow,a=Math.abs,s=(e.multiplier||1)*(e.enableRetinaScaling?t.devicePixelRatio:1);delete this.group,e.withoutTransform&&r.resetObjectTransform(this),e.withoutShadow&&(this.shadow=null);var l,c,u,d,h=t.util.createCanvasElement(),f=this.getBoundingRect(!0,!0),p=this.shadow,g={x:0,y:0};p&&(c=p.blur,l=p.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),g.x=2*Math.round(a(p.offsetX)+c)*a(l.scaleX),g.y=2*Math.round(a(p.offsetY)+c)*a(l.scaleY)),u=f.width+g.x,d=f.height+g.y,h.width=Math.ceil(u),h.height=Math.ceil(d);var m=new t.StaticCanvas(h,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===e.format&&(m.backgroundColor="#fff"),this.setPositionByOrigin(new t.Point(m.width/2,m.height/2),"center","center");var v=this.canvas;m.add(this);var y=m.toCanvasElement(s||1,e);return this.shadow=o,this.set("canvas",v),i&&(this.group=i),this.set(n).setCoords(),m._objects=[],m.dispose(),m=null,y},toDataURL:function(e){return e||(e={}),t.util.toDataURL(this.toCanvasElement(e),e.format||"png",e.quality||1)},isType:function(e){return arguments.length>1?Array.from(arguments).includes(this.type):this.type===e},complexity:function(){return 1},toJSON:function(e){return this.toObject(e)},rotate:function(e){var t=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return t&&this._setOriginToCenter(),this.set("angle",e),t&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(e,r){r=r||this.canvas.getPointer(e);var n=new t.Point(r.x,r.y),i=this._getLeftTopCoords();return this.angle&&(n=t.util.rotatePoint(n,i,a(-this.angle))),{x:n.x-i.x,y:n.y-i.y}},_setupCompositeOperation:function(e){this.globalCompositeOperation&&(e.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){t.runningAnimations&&t.runningAnimations.cancelByTarget(this)}}),t.util.createAccessors&&t.util.createAccessors(t.Object),r(t.Object.prototype,t.Observable),t.Object.NUM_FRACTION_DIGITS=2,t.Object.ENLIVEN_PROPS=["clipPath"],t.Object._fromObject=function(e,r,i,o){var a=t[e];r=n(r,!0),t.util.enlivenPatterns([r.fill,r.stroke],function(e){typeof e[0]<"u"&&(r.fill=e[0]),typeof e[1]<"u"&&(r.stroke=e[1]),t.util.enlivenObjectEnlivables(r,r,function(){var e=o?new a(r[o],r):new a(r);i&&i(e)})})},t.Object.__uid=0)}(e),function(){var e=t.util.degreesToRadians,r={left:-.5,center:0,right:.5},n={top:-.5,center:0,bottom:.5};t.util.object.extend(t.Object.prototype,{translateToGivenOrigin:function(e,i,o,a,s){var l,c,u,d=e.x,h=e.y;return"string"==typeof i?i=r[i]:i-=.5,"string"==typeof a?a=r[a]:a-=.5,"string"==typeof o?o=n[o]:o-=.5,"string"==typeof s?s=n[s]:s-=.5,c=s-o,((l=a-i)||c)&&(u=this._getTransformedDimensions(),d=e.x+l*u.x,h=e.y+c*u.y),new t.Point(d,h)},translateToCenterPoint:function(r,n,i){var o=this.translateToGivenOrigin(r,n,i,"center","center");return this.angle?t.util.rotatePoint(o,r,e(this.angle)):o},translateToOriginPoint:function(r,n,i){var o=this.translateToGivenOrigin(r,"center","center",n,i);return this.angle?t.util.rotatePoint(o,r,e(this.angle)):o},getCenterPoint:function(){var e=new t.Point(this.left,this.top);return this.translateToCenterPoint(e,this.originX,this.originY)},getPointByOrigin:function(e,t){var r=this.getCenterPoint();return this.translateToOriginPoint(r,e,t)},toLocalPoint:function(r,n,i){var o,a,s=this.getCenterPoint();return o=typeof n<"u"&&typeof i<"u"?this.translateToGivenOrigin(s,"center","center",n,i):new t.Point(this.left,this.top),a=new t.Point(r.x,r.y),this.angle&&(a=t.util.rotatePoint(a,s,-e(this.angle))),a.subtractEquals(o)},setPositionByOrigin:function(e,t,r){var n=this.translateToCenterPoint(e,t,r),i=this.translateToOriginPoint(n,this.originX,this.originY);this.set("left",i.x),this.set("top",i.y)},adjustPosition:function(n){var i,o,a=e(this.angle),s=this.getScaledWidth(),l=t.util.cos(a)*s,c=t.util.sin(a)*s;i="string"==typeof this.originX?r[this.originX]:this.originX-.5,o="string"==typeof n?r[n]:n-.5,this.left+=l*(o-i),this.top+=c*(o-i),this.setCoords(),this.originX=n},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var e=this.getCenterPoint();this.originX="center",this.originY="center",this.left=e.x,this.top=e.y},_resetOrigin:function(){var e=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=e.x,this.top=e.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){var e=t.util,r=e.degreesToRadians,n=e.multiplyTransformMatrices,i=e.transformPoint;e.object.extend(t.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(e,t){return t?e?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),e?this.aCoords:this.lineCoords)},getCoords:function(e,r){return function(e){return[new t.Point(e.tl.x,e.tl.y),new t.Point(e.tr.x,e.tr.y),new t.Point(e.br.x,e.br.y),new t.Point(e.bl.x,e.bl.y)]}(this._getCoords(e,r))},intersectsWithRect:function(e,r,n,i){var o=this.getCoords(n,i);return"Intersection"===t.Intersection.intersectPolygonRectangle(o,e,r).status},intersectsWithObject:function(e,r,n){return"Intersection"===t.Intersection.intersectPolygonPolygon(this.getCoords(r,n),e.getCoords(r,n)).status||e.isContainedWithinObject(this,r,n)||this.isContainedWithinObject(e,r,n)},isContainedWithinObject:function(e,t,r){for(var n=this.getCoords(t,r),i=t?e.aCoords:e.lineCoords,o=0,a=e._getImageLines(i);o<4;o++)if(!e.containsPoint(n[o],a))return!1;return!0},isContainedWithinRect:function(e,t,r,n){var i=this.getBoundingRect(r,n);return i.left>=e.x&&i.left+i.width<=t.x&&i.top>=e.y&&i.top+i.height<=t.y},containsPoint:function(e,t,r,n){var i=this._getCoords(r,n),o=(t=t||this._getImageLines(i),this._findCrossPoints(e,t));return 0!==o&&o%2==1},isOnScreen:function(e){if(!this.canvas)return!1;var t=this.canvas.vptCoords.tl,r=this.canvas.vptCoords.br;return!(!this.getCoords(!0,e).some(function(e){return e.x<=r.x&&e.x>=t.x&&e.y<=r.y&&e.y>=t.y})&&!this.intersectsWithRect(t,r,!0,e))||this._containsCenterOfCanvas(t,r,e)},_containsCenterOfCanvas:function(e,t,r){var n={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return!!this.containsPoint(n,null,!0,r)},isPartiallyOnScreen:function(e){if(!this.canvas)return!1;var t=this.canvas.vptCoords.tl,r=this.canvas.vptCoords.br;return!!this.intersectsWithRect(t,r,!0,e)||this.getCoords(!0,e).every(function(e){return(e.x>=r.x||e.x<=t.x)&&(e.y>=r.y||e.y<=t.y)})&&this._containsCenterOfCanvas(t,r,e)},_getImageLines:function(e){return{topline:{o:e.tl,d:e.tr},rightline:{o:e.tr,d:e.br},bottomline:{o:e.br,d:e.bl},leftline:{o:e.bl,d:e.tl}}},_findCrossPoints:function(e,t){var r,n,i,o,a,s=0;for(var l in t)if(!((a=t[l]).o.y<e.y&&a.d.y<e.y||a.o.y>=e.y&&a.d.y>=e.y||(a.o.x===a.d.x&&a.o.x>=e.x?o=a.o.x:(r=(a.d.y-a.o.y)/(a.d.x-a.o.x),n=e.y-0*e.x,i=a.o.y-r*a.o.x,o=-(n-i)/(0-r)),o>=e.x&&(s+=1),2!==s)))break;return s},getBoundingRect:function(t,r){var n=this.getCoords(t,r);return e.makeBoundingBoxFromPoints(n)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(e){return Math.abs(e)<this.minScaleLimit?e<0?-this.minScaleLimit:this.minScaleLimit:0===e?1e-4:e},scale:function(e){return this._set("scaleX",e),this._set("scaleY",e),this.setCoords()},scaleToWidth:function(e,t){var r=this.getBoundingRect(t).width/this.getScaledWidth();return this.scale(e/this.width/r)},scaleToHeight:function(e,t){var r=this.getBoundingRect(t).height/this.getScaledHeight();return this.scale(e/this.height/r)},calcLineCoords:function(){var t=this.getViewportTransform(),n=this.padding,o=r(this.angle),a=e.cos(o)*n,s=e.sin(o)*n,l=a+s,c=a-s,u=this.calcACoords(),d={tl:i(u.tl,t),tr:i(u.tr,t),bl:i(u.bl,t),br:i(u.br,t)};return n&&(d.tl.x-=c,d.tl.y-=l,d.tr.x+=l,d.tr.y-=c,d.bl.x-=l,d.bl.y+=c,d.br.x+=c,d.br.y+=l),d},calcOCoords:function(){var e=this._calcRotateMatrix(),t=this._calcTranslateMatrix(),r=this.getViewportTransform(),i=n(r,t),o=n(i,e),a=(o=n(o,[1/r[0],0,0,1/r[3],0,0]),this._calculateCurrentDimensions()),s={};return this.forEachControl(function(e,t,r){s[t]=e.positionHandler(a,o,r)}),s},calcACoords:function(){var e=this._calcRotateMatrix(),t=this._calcTranslateMatrix(),r=n(t,e),o=this._getTransformedDimensions(),a=o.x/2,s=o.y/2;return{tl:i({x:-a,y:-s},r),tr:i({x:a,y:-s},r),bl:i({x:-a,y:s},r),br:i({x:a,y:s},r)}},setCoords:function(e){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),e||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return e.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var e=this.getCenterPoint();return[1,0,0,1,e.x,e.y]},transformMatrixKey:function(e){var t="_",r="";return!e&&this.group&&(r=this.group.transformMatrixKey(e)+t),r+this.top+t+this.left+t+this.scaleX+t+this.scaleY+t+this.skewX+t+this.skewY+t+this.angle+t+this.originX+t+this.originY+t+this.width+t+this.height+t+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(e){var t=this.calcOwnMatrix();if(e||!this.group)return t;var r=this.transformMatrixKey(e),i=this.matrixCache||(this.matrixCache={});return i.key===r?i.value:(this.group&&(t=n(this.group.calcTransformMatrix(!1),t)),i.key=r,i.value=t,t)},calcOwnMatrix:function(){var t=this.transformMatrixKey(!0),r=this.ownMatrixCache||(this.ownMatrixCache={});if(r.key===t)return r.value;var n=this._calcTranslateMatrix(),i={angle:this.angle,translateX:n[4],translateY:n[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return r.key=t,r.value=e.composeMatrix(i),r.value},_getNonTransformedDimensions:function(){var e=this.strokeWidth;return{x:this.width+e,y:this.height+e}},_getTransformedDimensions:function(t,r){typeof t>"u"&&(t=this.skewX),typeof r>"u"&&(r=this.skewY);var n,i,o,a=0===t&&0===r;if(this.strokeUniform?(i=this.width,o=this.height):(i=(n=this._getNonTransformedDimensions()).x,o=n.y),a)return this._finalizeDimensions(i*this.scaleX,o*this.scaleY);var s=e.sizeAfterTransform(i,o,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:t,skewY:r});return this._finalizeDimensions(s.x,s.y)},_finalizeDimensions:function(e,t){return this.strokeUniform?{x:e+this.strokeWidth,y:t+this.strokeWidth}:{x:e,y:t}},_calculateCurrentDimensions:function(){var e=this.getViewportTransform(),t=this._getTransformedDimensions();return i(t,e,!0).scalarAdd(2*this.padding)}})}(),t.util.object.extend(t.Object.prototype,{sendToBack:function(){return this.group?t.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?t.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(e){return this.group?t.StaticCanvas.prototype.sendBackwards.call(this.group,this,e):this.canvas&&this.canvas.sendBackwards(this,e),this},bringForward:function(e){return this.group?t.StaticCanvas.prototype.bringForward.call(this.group,this,e):this.canvas&&this.canvas.bringForward(this,e),this},moveTo:function(e){return this.group&&"activeSelection"!==this.group.type?t.StaticCanvas.prototype.moveTo.call(this.group,this,e):this.canvas&&this.canvas.moveTo(this,e),this}}),function(){function e(e,r){if(r){if(r.toLive)return e+": url(#SVGID_"+r.id+"); ";var n=new t.Color(r),i=e+": "+n.toRgb()+"; ",o=n.getAlpha();return 1!==o&&(i+=e+"-opacity: "+o.toString()+"; "),i}return e+": none; "}var r=t.util.toFixed;t.util.object.extend(t.Object.prototype,{getSvgStyles:function(t){var r=this.fillRule?this.fillRule:"nonzero",n=this.strokeWidth?this.strokeWidth:"0",i=this.strokeDashArray?this.strokeDashArray.join(" "):"none",o=this.strokeDashOffset?this.strokeDashOffset:"0",a=this.strokeLineCap?this.strokeLineCap:"butt",s=this.strokeLineJoin?this.strokeLineJoin:"miter",l=this.strokeMiterLimit?this.strokeMiterLimit:"4",c=typeof this.opacity<"u"?this.opacity:"1",u=this.visible?"":" visibility: hidden;",d=t?"":this.getSvgFilter(),h=e("fill",this.fill);return[e("stroke",this.stroke),"stroke-width: ",n,"; ","stroke-dasharray: ",i,"; ","stroke-linecap: ",a,"; ","stroke-dashoffset: ",o,"; ","stroke-linejoin: ",s,"; ","stroke-miterlimit: ",l,"; ",h,"fill-rule: ",r,"; ","opacity: ",c,";",d,u].join("")},getSvgSpanStyles:function(t,r){var n="; ",i=t.fontFamily?"font-family: "+(-1===t.fontFamily.indexOf("'")&&-1===t.fontFamily.indexOf('"')?"'"+t.fontFamily+"'":t.fontFamily)+n:"",o=t.strokeWidth?"stroke-width: "+t.strokeWidth+n:"",a=(i=i,t.fontSize?"font-size: "+t.fontSize+"px"+n:""),s=t.fontStyle?"font-style: "+t.fontStyle+n:"",l=t.fontWeight?"font-weight: "+t.fontWeight+n:"",c=t.fill?e("fill",t.fill):"",u=t.stroke?e("stroke",t.stroke):"",d=this.getSvgTextDecoration(t);return d&&(d="text-decoration: "+d+n),[u,o,i,a,s,l,d,c,t.deltaY?"baseline-shift: "+-t.deltaY+"; ":"",r?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(e){return["overline","underline","line-through"].filter(function(t){return e[t.replace("-","")]}).join(" ")},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""},getSvgCommons:function(){return[this.id?'id="'+this.id+'" ':"",this.clipPath?'clip-path="url(#'+this.clipPath.clipPathId+')" ':""].join("")},getSvgTransform:function(e,r){var n=e?this.calcTransformMatrix():this.calcOwnMatrix();return'transform="'+t.util.matrixToSVG(n)+(r||"")+'" '},_setSVGBg:function(e){if(this.backgroundColor){var n=t.Object.NUM_FRACTION_DIGITS;e.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',r(-this.width/2,n),'" y="',r(-this.height/2,n),'" width="',r(this.width,n),'" height="',r(this.height,n),'"></rect>\n')}},toSVG:function(e){return this._createBaseSVGMarkup(this._toSVG(e),{reviver:e})},toClipPathSVG:function(e){return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(e),{reviver:e})},_createBaseClipPathSVGMarkup:function(e,t){var r=(t=t||{}).reviver,n=t.additionalTransform||"",i=[this.getSvgTransform(!0,n),this.getSvgCommons()].join(""),o=e.indexOf("COMMON_PARTS");return e[o]=i,r?r(e.join("")):e.join("")},_createBaseSVGMarkup:function(e,r){var n,i,o=(r=r||{}).noStyle,a=r.reviver,s=o?"":'style="'+this.getSvgStyles()+'" ',l=r.withShadow?'style="'+this.getSvgFilter()+'" ':"",c=this.clipPath,u=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",d=c&&c.absolutePositioned,h=this.stroke,f=this.fill,p=this.shadow,g=[],m=e.indexOf("COMMON_PARTS"),v=r.additionalTransform;return c&&(c.clipPathId="CLIPPATH_"+t.Object.__uid++,i='<clipPath id="'+c.clipPathId+'" >\n'+c.toClipPathSVG(a)+"</clipPath>\n"),d&&g.push("<g ",l,this.getSvgCommons()," >\n"),g.push("<g ",this.getSvgTransform(!1),d?"":l+this.getSvgCommons()," >\n"),n=[s,u,o?"":this.addPaintOrder()," ",v?'transform="'+v+'" ':""].join(""),e[m]=n,f&&f.toLive&&g.push(f.toSVG(this)),h&&h.toLive&&g.push(h.toSVG(this)),p&&g.push(p.toSVG(this)),c&&g.push(i),g.push(e.join("")),g.push("</g>\n"),d&&g.push("</g>\n"),a?a(g.join("")):g.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var e=t.util.object.extend,r="stateProperties";function n(t,r,n){var i={};n.forEach(function(e){i[e]=t[e]}),e(t[r],i,!0)}function i(e,t,r){if(e===t)return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var n=0,o=e.length;n<o;n++)if(!i(e[n],t[n]))return!1;return!0}if(e&&"object"==typeof e){var a,s=Object.keys(e);if(!t||"object"!=typeof t||!r&&s.length!==Object.keys(t).length)return!1;for(n=0,o=s.length;n<o;n++)if("canvas"!==(a=s[n])&&"group"!==a&&!i(e[a],t[a]))return!1;return!0}}t.util.object.extend(t.Object.prototype,{hasStateChanged:function(e){var t="_"+(e=e||r);return Object.keys(this[t]).length<this[e].length||!i(this[t],this,!0)},saveState:function(e){var t=e&&e.propertySet||r,i="_"+t;return this[i]?(n(this,i,this[t]),e&&e.stateProperties&&n(this,i,e.stateProperties),this):this.setupState(e)},setupState:function(e){var t=(e=e||{}).propertySet||r;return e.propertySet=t,this["_"+t]={},this.saveState(e),this}})}(),function(){var e=t.util.degreesToRadians;t.util.object.extend(t.Object.prototype,{_findTargetCorner:function(e,t){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var r,n,i,o=e.x,a=e.y,s=Object.keys(this.oCoords),l=s.length-1;for(this.__corner=0;l>=0;l--)if(i=s[l],this.isControlVisible(i)&&(n=this._getImageLines(t?this.oCoords[i].touchCorner:this.oCoords[i].corner),0!==(r=this._findCrossPoints({x:o,y:a},n))&&r%2==1))return this.__corner=i,i;return!1},forEachControl:function(e){for(var t in this.controls)e(this.controls[t],t,this)},_setCornerCoords:function(){var e=this.oCoords;for(var t in e){var r=this.controls[t];e[t].corner=r.calcCornerCoords(this.angle,this.cornerSize,e[t].x,e[t].y,!1),e[t].touchCorner=r.calcCornerCoords(this.angle,this.touchCornerSize,e[t].x,e[t].y,!0)}},drawSelectionBackground:function(t){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;t.save();var r=this.getCenterPoint(),n=this._calculateCurrentDimensions(),i=this.canvas.viewportTransform;return t.translate(r.x,r.y),t.scale(1/i[0],1/i[3]),t.rotate(e(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-n.x/2,-n.y/2,n.x,n.y),t.restore(),this},drawBorders:function(e,t){t=t||{};var r=this._calculateCurrentDimensions(),n=this.borderScaleFactor,i=r.x+n,o=r.y+n,a=typeof t.hasControls<"u"?t.hasControls:this.hasControls,s=!1;return e.save(),e.strokeStyle=t.borderColor||this.borderColor,this._setLineDash(e,t.borderDashArray||this.borderDashArray),e.strokeRect(-i/2,-o/2,i,o),a&&(e.beginPath(),this.forEachControl(function(t,r,n){t.withConnection&&t.getVisibility(n,r)&&(s=!0,e.moveTo(t.x*i,t.y*o),e.lineTo(t.x*i+t.offsetX,t.y*o+t.offsetY))}),s&&e.stroke()),e.restore(),this},drawBordersInGroup:function(e,r,n){n=n||{};var i=t.util.sizeAfterTransform(this.width,this.height,r),o=this.strokeWidth,a=this.strokeUniform,s=this.borderScaleFactor,l=i.x+o*(a?this.canvas.getZoom():r.scaleX)+s,c=i.y+o*(a?this.canvas.getZoom():r.scaleY)+s;return e.save(),this._setLineDash(e,n.borderDashArray||this.borderDashArray),e.strokeStyle=n.borderColor||this.borderColor,e.strokeRect(-l/2,-c/2,l,c),e.restore(),this},drawControls:function(e,r){r=r||{},e.save();var n,i,o=this.canvas.getRetinaScaling();return e.setTransform(o,0,0,o,0,0),e.strokeStyle=e.fillStyle=r.cornerColor||this.cornerColor,this.transparentCorners||(e.strokeStyle=r.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(e,r.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(n=this.group.calcTransformMatrix()),this.forEachControl(function(o,a,s){i=s.oCoords[a],o.getVisibility(s,a)&&(n&&(i=t.util.transformPoint(i,n)),o.render(e,i.x,i.y,r,s))}),e.restore(),this},isControlVisible:function(e){return this.controls[e]&&this.controls[e].getVisibility(this,e)},setControlVisible:function(e,t){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[e]=t,this},setControlsVisibility:function(e){for(var t in e||(e={}),e)this.setControlVisible(t,e[t]);return this},onDeselect:function(){},onSelect:function(){}})}(),t.util.object.extend(t.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(e,r){var n=function(){},i=(r=r||{}).onComplete||n,o=r.onChange||n,a=this;return t.util.animate({target:this,startValue:e.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(t){e.set("left",t),a.requestRenderAll(),o()},onComplete:function(){e.setCoords(),i()}})},fxCenterObjectV:function(e,r){var n=function(){},i=(r=r||{}).onComplete||n,o=r.onChange||n,a=this;return t.util.animate({target:this,startValue:e.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(t){e.set("top",t),a.requestRenderAll(),o()},onComplete:function(){e.setCoords(),i()}})},fxRemove:function(e,r){var n=function(){},i=(r=r||{}).onComplete||n,o=r.onChange||n,a=this;return t.util.animate({target:this,startValue:e.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(t){e.set("opacity",t),a.requestRenderAll(),o()},onComplete:function(){a.remove(e),i()}})}}),t.util.object.extend(t.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var e,t,r=[],n=[];for(e in arguments[0])r.push(e);for(var i=0,o=r.length;i<o;i++)e=r[i],t=i!==o-1,n.push(this._animate(e,arguments[0][e],arguments[1],t));return n}return this._animate.apply(this,arguments)},_animate:function(e,r,n,i){var o,a=this;r=r.toString(),n=n?t.util.object.clone(n):{},~e.indexOf(".")&&(o=e.split("."));var s=a.colorProperties.indexOf(e)>-1||o&&a.colorProperties.indexOf(o[1])>-1,l=o?this.get(o[0])[o[1]]:this.get(e);"from"in n||(n.from=l),s||(r=~r.indexOf("=")?l+parseFloat(r.replace("=","")):parseFloat(r));var c={target:this,startValue:n.from,endValue:r,byValue:n.by,easing:n.easing,duration:n.duration,abort:n.abort&&function(e,t,r){return n.abort.call(a,e,t,r)},onChange:function(t,r,s){o?a[o[0]][o[1]]=t:a.set(e,t),!i&&n.onChange&&n.onChange(t,r,s)},onComplete:function(e,t,r){i||(a.setCoords(),n.onComplete&&n.onComplete(e,t,r))}};return s?t.util.animateColor(c.startValue,c.endValue,c.duration,c):t.util.animate(c)}}),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.object.clone,i={x1:1,x2:1,y1:1,y2:1};function o(e,t){var r=e.origin,n=e.axis1,i=e.axis2,o=e.dimension,a=t.nearest,s=t.center,l=t.farthest;return function(){switch(this.get(r)){case a:return Math.min(this.get(n),this.get(i));case s:return Math.min(this.get(n),this.get(i))+.5*this.get(o);case l:return Math.max(this.get(n),this.get(i))}}}t.Line?t.warn("fabric.Line is already defined"):(t.Line=t.util.createClass(t.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:t.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(e,t){e||(e=[0,0,0,0]),this.callSuper("initialize",t),this.set("x1",e[0]),this.set("y1",e[1]),this.set("x2",e[2]),this.set("y2",e[3]),this._setWidthHeight(t)},_setWidthHeight:function(e){e||(e={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in e?e.left:this._getLeftToOriginX(),this.top="top"in e?e.top:this._getTopToOriginY()},_set:function(e,t){return this.callSuper("_set",e,t),typeof i[e]<"u"&&this._setWidthHeight(),this},_getLeftToOriginX:o({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:o({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(e){e.beginPath();var t=this.calcLinePoints();e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineWidth=this.strokeWidth;var r=e.strokeStyle;e.strokeStyle=this.stroke||e.fillStyle,this.stroke&&this._renderStroke(e),e.strokeStyle=r},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(e){return r(this.callSuper("toObject",e),this.calcLinePoints())},_getNonTransformedDimensions:function(){var e=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(e.y-=this.strokeWidth),0===this.height&&(e.x-=this.strokeWidth)),e},calcLinePoints:function(){var e=this.x1<=this.x2?-1:1,t=this.y1<=this.y2?-1:1,r=e*this.width*.5,n=t*this.height*.5;return{x1:r,x2:e*this.width*-.5,y1:n,y2:t*this.height*-.5}},_toSVG:function(){var e=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',e.x1,'" y1="',e.y1,'" x2="',e.x2,'" y2="',e.y2,'" />\n']}}),t.Line.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),t.Line.fromElement=function(e,n,i){i=i||{};var o=t.parseAttributes(e,t.Line.ATTRIBUTE_NAMES),a=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];n(new t.Line(a,r(o,i)))},t.Line.fromObject=function(e,r){var i=n(e,!0);i.points=[e.x1,e.y1,e.x2,e.y2],t.Object._fromObject("Line",i,function(e){delete e.points,r&&r(e)},"points")})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.degreesToRadians;t.Circle?t.warn("fabric.Circle is already defined."):(t.Circle=t.util.createClass(t.Object,{type:"circle",radius:0,startAngle:0,endAngle:360,cacheProperties:t.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(e,t){return this.callSuper("_set",e,t),"radius"===e&&this.setRadius(t),this},toObject:function(e){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(e))},_toSVG:function(){var e,n=(this.endAngle-this.startAngle)%360;if(0===n)e=["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n'];else{var i=r(this.startAngle),o=r(this.endAngle),a=this.radius;e=['<path d="M '+t.util.cos(i)*a+" "+t.util.sin(i)*a," A "+a+" "+a," 0 ",+(n>180?"1":"0")+" 1"," "+t.util.cos(o)*a+" "+t.util.sin(o)*a,'" ',"COMMON_PARTS"," />\n"]}return e},_render:function(e){e.beginPath(),e.arc(0,0,this.radius,r(this.startAngle),r(this.endAngle),!1),this._renderPaintInOrder(e)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(e){return this.radius=e,this.set("width",2*e).set("height",2*e)}}),t.Circle.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),t.Circle.fromElement=function(e,r){var n=t.parseAttributes(e,t.Circle.ATTRIBUTE_NAMES);if(!function(e){return"radius"in e&&e.radius>=0}(n))throw new Error("value of `r` attribute is required and can not be negative");n.left=(n.left||0)-n.radius,n.top=(n.top||0)-n.radius,r(new t.Circle(n))},t.Circle.fromObject=function(e,r){t.Object._fromObject("Circle",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={});t.Triangle?t.warn("fabric.Triangle is already defined"):(t.Triangle=t.util.createClass(t.Object,{type:"triangle",width:100,height:100,_render:function(e){var t=this.width/2,r=this.height/2;e.beginPath(),e.moveTo(-t,r),e.lineTo(0,-r),e.lineTo(t,r),e.closePath(),this._renderPaintInOrder(e)},_toSVG:function(){var e=this.width/2,t=this.height/2;return["<polygon ","COMMON_PARTS",'points="',[-e+" "+t,"0 "+-t,e+" "+t].join(","),'" />']}}),t.Triangle.fromObject=function(e,r){return t.Object._fromObject("Triangle",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={}),r=2*Math.PI;t.Ellipse?t.warn("fabric.Ellipse is already defined."):(t.Ellipse=t.util.createClass(t.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:t.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(e){this.callSuper("initialize",e),this.set("rx",e&&e.rx||0),this.set("ry",e&&e.ry||0)},_set:function(e,t){switch(this.callSuper("_set",e,t),e){case"rx":this.rx=t,this.set("width",2*t);break;case"ry":this.ry=t,this.set("height",2*t)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(e){return this.callSuper("toObject",["rx","ry"].concat(e))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" />\n']},_render:function(e){e.beginPath(),e.save(),e.transform(1,0,0,this.ry/this.rx,0,0),e.arc(0,0,this.rx,0,r,!1),e.restore(),this._renderPaintInOrder(e)}}),t.Ellipse.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),t.Ellipse.fromElement=function(e,r){var n=t.parseAttributes(e,t.Ellipse.ATTRIBUTE_NAMES);n.left=(n.left||0)-n.rx,n.top=(n.top||0)-n.ry,r(new t.Ellipse(n))},t.Ellipse.fromObject=function(e,r){t.Object._fromObject("Ellipse",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend;t.Rect?t.warn("fabric.Rect is already defined"):(t.Rect=t.util.createClass(t.Object,{stateProperties:t.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:t.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(e){this.callSuper("initialize",e),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(e){var t=this.rx?Math.min(this.rx,this.width/2):0,r=this.ry?Math.min(this.ry,this.height/2):0,n=this.width,i=this.height,o=-this.width/2,a=-this.height/2,s=0!==t||0!==r,l=.4477152502;e.beginPath(),e.moveTo(o+t,a),e.lineTo(o+n-t,a),s&&e.bezierCurveTo(o+n-l*t,a,o+n,a+l*r,o+n,a+r),e.lineTo(o+n,a+i-r),s&&e.bezierCurveTo(o+n,a+i-l*r,o+n-l*t,a+i,o+n-t,a+i),e.lineTo(o+t,a+i),s&&e.bezierCurveTo(o+l*t,a+i,o,a+i-l*r,o,a+i-r),e.lineTo(o,a+r),s&&e.bezierCurveTo(o,a+l*r,o+l*t,a,o+t,a),e.closePath(),this._renderPaintInOrder(e)},toObject:function(e){return this.callSuper("toObject",["rx","ry"].concat(e))},_toSVG:function(){return["<rect ","COMMON_PARTS",'x="',-this.width/2,'" y="',-this.height/2,'" rx="',this.rx,'" ry="',this.ry,'" width="',this.width,'" height="',this.height,'" />\n']}}),t.Rect.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),t.Rect.fromElement=function(e,n,i){if(!e)return n(null);i=i||{};var o=t.parseAttributes(e,t.Rect.ATTRIBUTE_NAMES);o.left=o.left||0,o.top=o.top||0,o.height=o.height||0,o.width=o.width||0;var a=new t.Rect(r(i?t.util.object.clone(i):{},o));a.visible=a.visible&&a.width>0&&a.height>0,n(a)},t.Rect.fromObject=function(e,r){return t.Object._fromObject("Rect",e,r)})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.util.array.min,i=t.util.array.max,o=t.util.toFixed,a=t.util.projectStrokeOnPoints;t.Polyline?t.warn("fabric.Polyline is already defined"):(t.Polyline=t.util.createClass(t.Object,{type:"polyline",points:null,exactBoundingBox:!1,cacheProperties:t.Object.prototype.cacheProperties.concat("points"),initialize:function(e,t){t=t||{},this.points=e||[],this.callSuper("initialize",t),this._setPositionDimensions(t)},_projectStrokeOnPoints:function(){return a(this.points,this,!0)},_setPositionDimensions:function(e){var t,r=this._calcDimensions(e),n=this.exactBoundingBox?this.strokeWidth:0;this.width=r.width-n,this.height=r.height-n,e.fromSVG||(t=this.translateToGivenOrigin({x:r.left-this.strokeWidth/2+n/2,y:r.top-this.strokeWidth/2+n/2},"left","top",this.originX,this.originY)),typeof e.left>"u"&&(this.left=e.fromSVG?r.left:t.x),typeof e.top>"u"&&(this.top=e.fromSVG?r.top:t.y),this.pathOffset={x:r.left+this.width/2+n/2,y:r.top+this.height/2+n/2}},_calcDimensions:function(){var e=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,t=n(e,"x")||0,r=n(e,"y")||0;return{left:t,top:r,width:(i(e,"x")||0)-t,height:(i(e,"y")||0)-r}},toObject:function(e){return r(this.callSuper("toObject",e),{points:this.points.concat()})},_toSVG:function(){for(var e=[],r=this.pathOffset.x,n=this.pathOffset.y,i=t.Object.NUM_FRACTION_DIGITS,a=0,s=this.points.length;a<s;a++)e.push(o(this.points[a].x-r,i),",",o(this.points[a].y-n,i)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',e.join(""),'" />\n']},commonRender:function(e){var t,r=this.points.length,n=this.pathOffset.x,i=this.pathOffset.y;if(!r||isNaN(this.points[r-1].y))return!1;e.beginPath(),e.moveTo(this.points[0].x-n,this.points[0].y-i);for(var o=0;o<r;o++)t=this.points[o],e.lineTo(t.x-n,t.y-i);return!0},_render:function(e){this.commonRender(e)&&this._renderPaintInOrder(e)},complexity:function(){return this.get("points").length}}),t.Polyline.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(),t.Polyline.fromElementGenerator=function(e){return function(n,i,o){if(!n)return i(null);o||(o={});var a=t.parsePointsAttribute(n.getAttribute("points")),s=t.parseAttributes(n,t[e].ATTRIBUTE_NAMES);s.fromSVG=!0,i(new t[e](a,r(s,o)))}},t.Polyline.fromElement=t.Polyline.fromElementGenerator("Polyline"),t.Polyline.fromObject=function(e,r){return t.Object._fromObject("Polyline",e,r,"points")})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.projectStrokeOnPoints;t.Polygon?t.warn("fabric.Polygon is already defined"):(t.Polygon=t.util.createClass(t.Polyline,{type:"polygon",_projectStrokeOnPoints:function(){return r(this.points,this)},_render:function(e){this.commonRender(e)&&(e.closePath(),this._renderPaintInOrder(e))}}),t.Polygon.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(),t.Polygon.fromElement=t.Polyline.fromElementGenerator("Polygon"),t.Polygon.fromObject=function(e,r){t.Object._fromObject("Polygon",e,r,"points")})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.array.min,n=t.util.array.max,i=t.util.object.extend,o=t.util.object.clone,a=t.util.toFixed;t.Path?t.warn("fabric.Path is already defined"):(t.Path=t.util.createClass(t.Object,{type:"path",path:null,cacheProperties:t.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:t.Object.prototype.stateProperties.concat("path"),initialize:function(e,t){delete(t=o(t||{})).path,this.callSuper("initialize",t),this._setPath(e||[],t)},_setPath:function(e,r){this.path=t.util.makePathSimpler(Array.isArray(e)?e:t.util.parsePath(e)),t.Polyline.prototype._setPositionDimensions.call(this,r||{})},_renderPathCommands:function(e){var t,r=0,n=0,i=0,o=0,a=0,s=0,l=-this.pathOffset.x,c=-this.pathOffset.y;e.beginPath();for(var u=0,d=this.path.length;u<d;++u)switch(t=this.path[u],t[0]){case"L":i=t[1],o=t[2],e.lineTo(i+l,o+c);break;case"M":r=i=t[1],n=o=t[2],e.moveTo(i+l,o+c);break;case"C":i=t[5],o=t[6],a=t[3],s=t[4],e.bezierCurveTo(t[1]+l,t[2]+c,a+l,s+c,i+l,o+c);break;case"Q":e.quadraticCurveTo(t[1]+l,t[2]+c,t[3]+l,t[4]+c),i=t[3],o=t[4],a=t[1],s=t[2];break;case"z":case"Z":i=r,o=n,e.closePath()}},_render:function(e){this._renderPathCommands(e),this._renderPaintInOrder(e)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(e){return i(this.callSuper("toObject",e),{path:this.path.map(function(e){return e.slice()})})},toDatalessObject:function(e){var t=this.toObject(["sourcePath"].concat(e));return t.sourcePath&&delete t.path,t},_toSVG:function(){return["<path ","COMMON_PARTS",'d="',t.util.joinPath(this.path),'" stroke-linecap="round" ',"/>\n"]},_getOffsetTransform:function(){var e=t.Object.NUM_FRACTION_DIGITS;return" translate("+a(-this.pathOffset.x,e)+", "+a(-this.pathOffset.y,e)+")"},toClipPathSVG:function(e){var t=this._getOffsetTransform();return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:t})},toSVG:function(e){var t=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:t})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var e,i,o=[],a=[],s=0,l=0,c=0,u=0,d=0,h=this.path.length;d<h;++d){switch((e=this.path[d])[0]){case"L":c=e[1],u=e[2],i=[];break;case"M":s=c=e[1],l=u=e[2],i=[];break;case"C":i=t.util.getBoundsOfCurve(c,u,e[1],e[2],e[3],e[4],e[5],e[6]),c=e[5],u=e[6];break;case"Q":i=t.util.getBoundsOfCurve(c,u,e[1],e[2],e[1],e[2],e[3],e[4]),c=e[3],u=e[4];break;case"z":case"Z":c=s,u=l}i.forEach(function(e){o.push(e.x),a.push(e.y)}),o.push(c),a.push(u)}var f=r(o)||0,p=r(a)||0;return{left:f,top:p,width:(n(o)||0)-f,height:(n(a)||0)-p}}}),t.Path.fromObject=function(e,r){if("string"==typeof e.sourcePath){var n=e.sourcePath;t.loadSVGFromURL(n,function(n){var i=n[0];i.setOptions(e),e.clipPath?t.util.enlivenObjects([e.clipPath],function(e){i.clipPath=e[0],r&&r(i)}):r&&r(i)})}else t.Object._fromObject("Path",e,r,"path")},t.Path.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(["d"]),t.Path.fromElement=function(e,r,n){var o=t.parseAttributes(e,t.Path.ATTRIBUTE_NAMES);o.fromSVG=!0,r(new t.Path(o.d,i(o,n)))})}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.array.min,n=t.util.array.max;t.Group||(t.Group=t.util.createClass(t.Object,t.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(e,t,r){t=t||{},this._objects=[],r&&this.callSuper("initialize",t),this._objects=e||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;if(r)this._updateObjectsACoords();else{var i=t&&t.centerPoint;void 0!==t.originX&&(this.originX=t.originX),void 0!==t.originY&&(this.originY=t.originY),i||this._calcBounds(),this._updateObjectsCoords(i),delete t.centerPoint,this.callSuper("initialize",t)}this.setCoords()},_updateObjectsACoords:function(){for(var e=this._objects.length;e--;)this._objects[e].setCoords(true)},_updateObjectsCoords:function(e){e=e||this.getCenterPoint();for(var t=this._objects.length;t--;)this._updateObjectCoords(this._objects[t],e)},_updateObjectCoords:function(e,t){var r=e.left,n=e.top;e.set({left:r-t.x,top:n-t.y}),e.group=this,e.setCoords(!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(e){var r=!!this.group;return this._restoreObjectsState(),t.util.resetObjectTransform(this),e&&(r&&t.util.removeTransformFromObject(e,this.group.calcTransformMatrix()),this._objects.push(e),e.group=this,e._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,r?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(e){return this._restoreObjectsState(),t.util.resetObjectTransform(this),this.remove(e),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(e){this.dirty=!0,e.group=this,e._set("canvas",this.canvas)},_onObjectRemoved:function(e){this.dirty=!0,delete e.group},_set:function(e,r){var n=this._objects.length;if(this.useSetOnGroup)for(;n--;)this._objects[n].setOnGroup(e,r);if("canvas"===e)for(;n--;)this._objects[n]._set(e,r);t.Object.prototype._set.call(this,e,r)},toObject:function(e){var r=this.includeDefaultValues,n=this._objects.filter(function(e){return!e.excludeFromExport}).map(function(t){var n=t.includeDefaultValues;t.includeDefaultValues=r;var i=t.toObject(e);return t.includeDefaultValues=n,i}),i=t.Object.prototype.toObject.call(this,e);return i.objects=n,i},toDatalessObject:function(e){var r,n=this.sourcePath;if(n)r=n;else{var i=this.includeDefaultValues;r=this._objects.map(function(t){var r=t.includeDefaultValues;t.includeDefaultValues=i;var n=t.toDatalessObject(e);return t.includeDefaultValues=r,n})}var o=t.Object.prototype.toDatalessObject.call(this,e);return o.objects=r,o},render:function(e){this._transformDone=!0,this.callSuper("render",e),this._transformDone=!1},shouldCache:function(){var e=t.Object.prototype.shouldCache.call(this);if(e)for(var r=0,n=this._objects.length;r<n;r++)if(this._objects[r].willDrawShadow())return this.ownCaching=!1,!1;return e},willDrawShadow:function(){if(t.Object.prototype.willDrawShadow.call(this))return!0;for(var e=0,r=this._objects.length;e<r;e++)if(this._objects[e].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(e){for(var t=0,r=this._objects.length;t<r;t++)this._objects[t].render(e);this._drawClipPath(e,this.clipPath)},isCacheDirty:function(e){if(this.callSuper("isCacheDirty",e))return!0;if(!this.statefullCache)return!1;for(var t=0,r=this._objects.length;t<r;t++)if(this._objects[t].isCacheDirty(!0)){if(this._cacheCanvas){var n=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-n/2,-i/2,n,i)}return!0}return!1},_restoreObjectsState:function(){var e=this.calcOwnMatrix();return this._objects.forEach(function(r){t.util.addTransformToObject(r,e),delete r.group,r.setCoords()}),this},destroy:function(){return this._objects.forEach(function(e){e.set("dirty",!0)}),this._restoreObjectsState()},dispose:function(){this.callSuper("dispose"),this.forEachObject(function(e){e.dispose&&e.dispose()}),this._objects=[]},toActiveSelection:function(){if(this.canvas){var e=this._objects,r=this.canvas;this._objects=[];var n=this.toObject();delete n.objects;var i=new t.ActiveSelection([]);return i.set(n),i.type="activeSelection",r.remove(this),e.forEach(function(e){e.group=i,e.dirty=!0,r.add(e)}),i.canvas=r,i._objects=e,r._activeObject=i,i.setCoords(),i}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject(function(e){e.setCoords(true)}),this},_calcBounds:function(e){for(var t,r,n,i,o=[],a=[],s=["tr","br","bl","tl"],l=0,c=this._objects.length,u=s.length;l<c;++l){for(n=(t=this._objects[l]).calcACoords(),i=0;i<u;i++)r=s[i],o.push(n[r].x),a.push(n[r].y);t.aCoords=n}this._getBounds(o,a,e)},_getBounds:function(e,i,o){var a=new t.Point(r(e),r(i)),s=new t.Point(n(e),n(i)),l=a.y||0,c=a.x||0,u=s.x-a.x||0,d=s.y-a.y||0;this.width=u,this.height=d,o||this.setPositionByOrigin({x:c,y:l},"left","top")},_toSVG:function(e){for(var t=["<g ","COMMON_PARTS"," >\n"],r=0,n=this._objects.length;r<n;r++)t.push("\t\t",this._objects[r].toSVG(e));return t.push("</g>\n"),t},getSvgStyles:function(){var e=typeof this.opacity<"u"&&1!==this.opacity?"opacity: "+this.opacity+";":"",t=this.visible?"":" visibility: hidden;";return[e,this.getSvgFilter(),t].join("")},toClipPathSVG:function(e){for(var t=[],r=0,n=this._objects.length;r<n;r++)t.push("\t",this._objects[r].toClipPathSVG(e));return this._createBaseClipPathSVGMarkup(t,{reviver:e})}}),t.Group.fromObject=function(e,r){var n=e.objects,i=t.util.object.clone(e,!0);delete i.objects,"string"!=typeof n?t.util.enlivenObjects(n,function(n){t.util.enlivenObjectEnlivables(e,i,function(){r&&r(new t.Group(n,i,!0))})}):t.loadSVGFromURL(n,function(o){var a=t.util.groupSVGElements(o,e,n),s=i.clipPath;delete i.clipPath,a.set(i),s?t.util.enlivenObjects([s],function(e){a.clipPath=e[0],r&&r(a)}):r&&r(a)})})}(e),function(e){var t=e.fabric||(e.fabric={});t.ActiveSelection||(t.ActiveSelection=t.util.createClass(t.Group,{type:"activeSelection",initialize:function(e,r){r=r||{},this._objects=e||[];for(var n=this._objects.length;n--;)this._objects[n].group=this;r.originX&&(this.originX=r.originX),r.originY&&(this.originY=r.originY),this._calcBounds(),this._updateObjectsCoords(),t.Object.prototype.initialize.call(this,r),this.setCoords()},toGroup:function(){var e=this._objects.concat();this._objects=[];var r=t.Object.prototype.toObject.call(this),n=new t.Group([]);if(delete r.type,n.set(r),e.forEach(function(e){e.canvas.remove(e),e.group=n}),n._objects=e,!this.canvas)return n;var i=this.canvas;return i.add(n),i._activeObject=n,n.setCoords(),n},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(e,t,r){e.save(),e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",e,t),typeof(r=r||{}).hasControls>"u"&&(r.hasControls=!1),r.forActiveSelection=!0;for(var n=0,i=this._objects.length;n<i;n++)this._objects[n]._renderControls(e,r);e.restore()}}),t.ActiveSelection.fromObject=function(e,r){t.util.enlivenObjects(e.objects,function(n){delete e.objects,r&&r(new t.ActiveSelection(n,e,!0))})})}(e),function(e){var r=t.util.object.extend;e.fabric||(e.fabric={}),e.fabric.Image?t.warn("fabric.Image is already defined."):(t.Image=t.util.createClass(t.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:t.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:t.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(e,r){r||(r={}),this.filters=[],this.cacheKey="texture"+t.Object.__uid++,this.callSuper("initialize",r),this._initElement(e,r)},getElement:function(){return this._element||{}},setElement:function(e,t){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=e,this._originalElement=e,this._initConfig(t),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(e){var r=t.filterBackend;r&&r.evictCachesForKey&&r.evictCachesForKey(e)},dispose:function(){this.callSuper("dispose"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(e){t.util.cleanUpJsdomNode(this[e]),this[e]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var e=this.getElement();return{width:e.naturalWidth||e.width,height:e.naturalHeight||e.height}},_stroke:function(e){if(this.stroke&&0!==this.strokeWidth){var t=this.width/2,r=this.height/2;e.beginPath(),e.moveTo(-t,-r),e.lineTo(t,-r),e.lineTo(t,r),e.lineTo(-t,r),e.lineTo(-t,-r),e.closePath()}},toObject:function(e){var t=[];this.filters.forEach(function(e){e&&t.push(e.toObject())});var n=r(this.callSuper("toObject",["cropX","cropY"].concat(e)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:t});return this.resizeFilter&&(n.resizeFilter=this.resizeFilter.toObject()),n},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var e,r=[],n=[],i=this._element,o=-this.width/2,a=-this.height/2,s="",l="";if(!i)return[];if(this.hasCrop()){var c=t.Object.__uid++;r.push('<clipPath id="imageCrop_'+c+'">\n','\t<rect x="'+o+'" y="'+a+'" width="'+this.width+'" height="'+this.height+'" />\n',"</clipPath>\n"),s=' clip-path="url(#imageCrop_'+c+')" '}if(this.imageSmoothing||(l='" image-rendering="optimizeSpeed'),n.push("\t<image ","COMMON_PARTS",'xlink:href="',this.getSvgSrc(!0),'" x="',o-this.cropX,'" y="',a-this.cropY,'" width="',i.width||i.naturalWidth,'" height="',i.height||i.height,l,'"',s,"></image>\n"),this.stroke||this.strokeDashArray){var u=this.fill;this.fill=null,e=["\t<rect ",'x="',o,'" y="',a,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'],this.fill=u}return r="fill"!==this.paintFirst?r.concat(e,n):r.concat(n,e)},getSrc:function(e){var t=e?this._element:this._originalElement;return t?t.toDataURL?t.toDataURL():this.srcFromAttribute?t.getAttribute("src"):t.src:this.src||""},setSrc:function(e,r,n){return t.util.loadImage(e,function(e,t){this.setElement(e,n),this._setWidthHeight(),r&&r(this,t)},this,n&&n.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var e=this.resizeFilter,r=this.minimumScaleTrigger,n=this.getTotalObjectScaling(),i=n.scaleX,o=n.scaleY,a=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!e||i>r&&o>r)return this._element=a,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=o);t.filterBackend||(t.filterBackend=t.initFilterBackend());var s=t.util.createCanvasElement(),l=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,c=a.width,u=a.height;s.width=c,s.height=u,this._element=s,this._lastScaleX=e.scaleX=i,this._lastScaleY=e.scaleY=o,t.filterBackend.applyFilters([e],a,c,u,this._element,l),this._filterScalingX=s.width/this._originalElement.width,this._filterScalingY=s.height/this._originalElement.height},applyFilters:function(e){if(e=(e=e||this.filters||[]).filter(function(e){return e&&!e.isNeutralState()}),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===e.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var r=this._originalElement,n=r.naturalWidth||r.width,i=r.naturalHeight||r.height;if(this._element===this._originalElement){var o=t.util.createCanvasElement();o.width=n,o.height=i,this._element=o,this._filteredEl=o}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,n,i),this._lastScaleX=1,this._lastScaleY=1;return t.filterBackend||(t.filterBackend=t.initFilterBackend()),t.filterBackend.applyFilters(e,this._originalElement,n,i,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(e){t.util.setImageSmoothing(e,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(e),this._renderPaintInOrder(e)},drawCacheOnCanvas:function(e){t.util.setImageSmoothing(e,this.imageSmoothing),t.Object.prototype.drawCacheOnCanvas.call(this,e)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(e){var t=this._element;if(t){var r=this._filterScalingX,n=this._filterScalingY,i=this.width,o=this.height,a=Math.min,s=Math.max,l=s(this.cropX,0),c=s(this.cropY,0),u=t.naturalWidth||t.width,d=t.naturalHeight||t.height,h=l*r,f=c*n,p=a(i*r,u-h),g=a(o*n,d-f),m=-i/2,v=-o/2,y=a(i,u/r-l),b=a(o,d/n-c);t&&e.drawImage(t,h,f,p,g,m,v,y,b)}},_needsResize:function(){var e=this.getTotalObjectScaling();return e.scaleX!==this._lastScaleX||e.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(e,r){this.setElement(t.util.getById(e),r),t.util.addClass(this.getElement(),t.Image.CSS_CANVAS)},_initConfig:function(e){e||(e={}),this.setOptions(e),this._setWidthHeight(e)},_initFilters:function(e,r){e&&e.length?t.util.enlivenObjects(e,function(e){r&&r(e)},"fabric.Image.filters"):r&&r()},_setWidthHeight:function(e){e||(e={});var t=this.getElement();this.width=e.width||t.naturalWidth||t.width||0,this.height=e.height||t.naturalHeight||t.height||0},parsePreserveAspectRatioAttribute:function(){var e,r=t.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),n=this._element.width,i=this._element.height,o=1,a=1,s=0,l=0,c=0,u=0,d=this.width,h=this.height,f={width:d,height:h};return!r||"none"===r.alignX&&"none"===r.alignY?(o=d/n,a=h/i):("meet"===r.meetOrSlice&&(e=(d-n*(o=a=t.util.findScaleToFit(this._element,f)))/2,"Min"===r.alignX&&(s=-e),"Max"===r.alignX&&(s=e),e=(h-i*a)/2,"Min"===r.alignY&&(l=-e),"Max"===r.alignY&&(l=e)),"slice"===r.meetOrSlice&&(e=n-d/(o=a=t.util.findScaleToCover(this._element,f)),"Mid"===r.alignX&&(c=e/2),"Max"===r.alignX&&(c=e),e=i-h/a,"Mid"===r.alignY&&(u=e/2),"Max"===r.alignY&&(u=e),n=d/o,i=h/a)),{width:n,height:i,scaleX:o,scaleY:a,offsetLeft:s,offsetTop:l,cropX:c,cropY:u}}}),t.Image.CSS_CANVAS="canvas-img",t.Image.prototype.getSvgSrc=t.Image.prototype.getSrc,t.Image.fromObject=function(e,r){var n=t.util.object.clone(e);t.util.loadImage(n.src,function(e,i){i?r&&r(null,!0):t.Image.prototype._initFilters.call(n,n.filters,function(i){n.filters=i||[],t.Image.prototype._initFilters.call(n,[n.resizeFilter],function(i){n.resizeFilter=i[0],t.util.enlivenObjectEnlivables(n,n,function(){var i=new t.Image(e,n);r(i,!1)})})})},null,n.crossOrigin)},t.Image.fromURL=function(e,r,n){t.util.loadImage(e,function(e,i){r&&r(new t.Image(e,n),i)},null,n&&n.crossOrigin)},t.Image.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),t.Image.fromElement=function(e,n,i){var o=t.parseAttributes(e,t.Image.ATTRIBUTE_NAMES);t.Image.fromURL(o["xlink:href"],n,r(i?t.util.object.clone(i):{},o))})}(e),t.util.object.extend(t.Object.prototype,{_getAngleValueForStraighten:function(){var e=this.angle%360;return e>0?90*Math.round((e-1)/90):90*Math.round(e/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(e){var r=function(){},n=(e=e||{}).onComplete||r,i=e.onChange||r,o=this;return t.util.animate({target:this,startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(e){o.rotate(e),i()},onComplete:function(){o.setCoords(),n()}})}}),t.util.object.extend(t.StaticCanvas.prototype,{straightenObject:function(e){return e.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(e){return e.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){function e(e,t){var r="precision "+t+" float;\nvoid main(){}",n=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(n,r),e.compileShader(n),!!e.getShaderParameter(n,e.COMPILE_STATUS)}function r(e){e&&e.tileSize&&(this.tileSize=e.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}t.isWebglSupported=function(r){if(t.isLikelyNode)return!1;r=r||t.WebglFilterBackend.prototype.tileSize;var n=document.createElement("canvas"),i=n.getContext("webgl")||n.getContext("experimental-webgl"),o=!1;if(i){t.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),o=t.maxTextureSize>=r;for(var a=["highp","mediump","lowp"],s=0;s<3;s++)if(e(i,a[s])){t.webGlPrecision=a[s];break}}return this.isSupported=o,o},t.WebglFilterBackend=r,r.prototype={tileSize:2048,resources:{},setupGLContext:function(e,t){this.dispose(),this.createWebGLCanvas(e,t),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(e,t)},chooseFastestCopyGLTo2DMethod:function(e,r){var o,a=typeof window.performance<"u";try{new ImageData(1,1),o=!0}catch{o=!1}var s=typeof ArrayBuffer<"u",l=typeof Uint8ClampedArray<"u";if(a&&o&&s&&l){var c=t.util.createCanvasElement(),u=new ArrayBuffer(e*r*4);if(t.forceGLPutImageData)return this.imageBuffer=u,void(this.copyGLTo2D=i);var d,h,f={imageBuffer:u,destinationWidth:e,destinationHeight:r,targetCanvas:c};c.width=e,c.height=r,d=window.performance.now(),n.call(f,this.gl,f),h=window.performance.now()-d,d=window.performance.now(),i.call(f,this.gl,f),h>window.performance.now()-d?(this.imageBuffer=u,this.copyGLTo2D=i):this.copyGLTo2D=n}},createWebGLCanvas:function(e,r){var n=t.util.createCanvasElement();n.width=e,n.height=r;var i={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},o=n.getContext("webgl",i);o||(o=n.getContext("experimental-webgl",i)),o&&(o.clearColor(0,0,0,0),this.canvas=n,this.gl=o)},applyFilters:function(e,t,r,n,i,o){var a,s=this.gl;o&&(a=this.getCachedTexture(o,t));var l={originalWidth:t.width||t.originalWidth,originalHeight:t.height||t.originalHeight,sourceWidth:r,sourceHeight:n,destinationWidth:r,destinationHeight:n,context:s,sourceTexture:this.createTexture(s,r,n,!a&&t),targetTexture:this.createTexture(s,r,n),originalTexture:a||this.createTexture(s,r,n,!a&&t),passes:e.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:i},c=s.createFramebuffer();return s.bindFramebuffer(s.FRAMEBUFFER,c),e.forEach(function(e){e&&e.applyTo(l)}),function(e){var t=e.targetCanvas,r=t.width,n=t.height,i=e.destinationWidth,o=e.destinationHeight;(r!==i||n!==o)&&(t.width=i,t.height=o)}(l),this.copyGLTo2D(s,l),s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(l.sourceTexture),s.deleteTexture(l.targetTexture),s.deleteFramebuffer(c),i.getContext("2d").setTransform(1,0,0,1,0,0),l},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(e,t,r,n,i){var o=e.createTexture();return e.bindTexture(e.TEXTURE_2D,o),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,i||e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,i||e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),n?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null),o},getCachedTexture:function(e,t){if(this.textureCache[e])return this.textureCache[e];var r=this.createTexture(this.gl,t.width,t.height,t);return this.textureCache[e]=r,r},evictCachesForKey:function(e){this.textureCache[e]&&(this.gl.deleteTexture(this.textureCache[e]),delete this.textureCache[e])},copyGLTo2D:n,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var e=this.gl,t={renderer:"",vendor:""};if(!e)return t;var r=e.getExtension("WEBGL_debug_renderer_info");if(r){var n=e.getParameter(r.UNMASKED_RENDERER_WEBGL),i=e.getParameter(r.UNMASKED_VENDOR_WEBGL);n&&(t.renderer=n.toLowerCase()),i&&(t.vendor=i.toLowerCase())}return this.gpuInfo=t,t}}}(),function(){var e=function(){};function r(){}t.Canvas2dFilterBackend=r,r.prototype={evictCachesForKey:e,dispose:e,clearWebGLCaches:e,resources:{},applyFilters:function(e,t,r,n,i){var o=i.getContext("2d");o.drawImage(t,0,0,r,n);var a={sourceWidth:r,sourceHeight:n,imageData:o.getImageData(0,0,r,n),originalEl:t,originalImageData:o.getImageData(0,0,r,n),canvasEl:i,ctx:o,filterBackend:this};return e.forEach(function(e){e.applyTo(a)}),(a.imageData.width!==r||a.imageData.height!==n)&&(i.width=a.imageData.width,i.height=a.imageData.height),o.putImageData(a.imageData,0,0),a}}}(),t.Image=t.Image||{},t.Image.filters=t.Image.filters||{},t.Image.filters.BaseFilter=t.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(e){e&&this.setOptions(e)},setOptions:function(e){for(var t in e)this[t]=e[t]},createProgram:function(e,r,n){r=r||this.fragmentSource,n=n||this.vertexSource,"highp"!==t.webGlPrecision&&(r=r.replace(/precision highp float/g,"precision "+t.webGlPrecision+" float"));var i=e.createShader(e.VERTEX_SHADER);if(e.shaderSource(i,n),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+e.getShaderInfoLog(i));var o=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(o,r),e.compileShader(o),!e.getShaderParameter(o,e.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+e.getShaderInfoLog(o));var a=e.createProgram();if(e.attachShader(a,i),e.attachShader(a,o),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+e.getProgramInfoLog(a));var s=this.getAttributeLocations(e,a),l=this.getUniformLocations(e,a)||{};return l.uStepW=e.getUniformLocation(a,"uStepW"),l.uStepH=e.getUniformLocation(a,"uStepH"),{program:a,attributeLocations:s,uniformLocations:l}},getAttributeLocations:function(e,t){return{aPosition:e.getAttribLocation(t,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(e,t,r){var n=t.aPosition,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0),e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)},_setupFrameBuffer:function(e){var t,r,n=e.context;e.passes>1?(t=e.destinationWidth,r=e.destinationHeight,(e.sourceWidth!==t||e.sourceHeight!==r)&&(n.deleteTexture(e.targetTexture),e.targetTexture=e.filterBackend.createTexture(n,t,r)),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e.targetTexture,0)):(n.bindFramebuffer(n.FRAMEBUFFER,null),n.finish())},_swapTextures:function(e){e.passes--,e.pass++;var t=e.targetTexture;e.targetTexture=e.sourceTexture,e.sourceTexture=t},isNeutralState:function(){var e=this.mainParameter,r=t.Image.filters[this.type].prototype;if(e){if(Array.isArray(r[e])){for(var n=r[e].length;n--;)if(this[e][n]!==r[e][n])return!1;return!0}return r[e]===this[e]}return!1},applyTo:function(e){e.webgl?(this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e)):this.applyTo2d(e)},retrieveShader:function(e){return e.programCache.hasOwnProperty(this.type)||(e.programCache[this.type]=this.createProgram(e.context)),e.programCache[this.type]},applyToWebGL:function(e){var t=e.context,r=this.retrieveShader(e);0===e.pass&&e.originalTexture?t.bindTexture(t.TEXTURE_2D,e.originalTexture):t.bindTexture(t.TEXTURE_2D,e.sourceTexture),t.useProgram(r.program),this.sendAttributeData(t,r.attributeLocations,e.aPosition),t.uniform1f(r.uniformLocations.uStepW,1/e.sourceWidth),t.uniform1f(r.uniformLocations.uStepH,1/e.sourceHeight),this.sendUniformData(t,r.uniformLocations),t.viewport(0,0,e.destinationWidth,e.destinationHeight),t.drawArrays(t.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(e,t,r){e.activeTexture(r),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE0)},unbindAdditionalTexture:function(e,t){e.activeTexture(t),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(e){this[this.mainParameter]=e},sendUniformData:function(){},createHelpLayer:function(e){if(!e.helpLayer){var t=document.createElement("canvas");t.width=e.sourceWidth,t.height=e.sourceHeight,e.helpLayer=t}},toObject:function(){var e={type:this.type},t=this.mainParameter;return t&&(e[t]=this[t]),e},toJSON:function(){return this.toObject()}}),t.Image.filters.BaseFilter.fromObject=function(e,r){var n=new t.Image.filters[e.type](e);return r&&r(n),n},function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.ColorMatrix=n(r.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(e){this.callSuper("initialize",e),this.matrix=this.matrix.slice(0)},applyTo2d:function(e){var t,r,n,i,o,a=e.imageData.data,s=a.length,l=this.matrix,c=this.colorsOnly;for(o=0;o<s;o+=4)t=a[o],r=a[o+1],n=a[o+2],c?(a[o]=t*l[0]+r*l[1]+n*l[2]+255*l[4],a[o+1]=t*l[5]+r*l[6]+n*l[7]+255*l[9],a[o+2]=t*l[10]+r*l[11]+n*l[12]+255*l[14]):(i=a[o+3],a[o]=t*l[0]+r*l[1]+n*l[2]+i*l[3]+255*l[4],a[o+1]=t*l[5]+r*l[6]+n*l[7]+i*l[8]+255*l[9],a[o+2]=t*l[10]+r*l[11]+n*l[12]+i*l[13]+255*l[14],a[o+3]=t*l[15]+r*l[16]+n*l[17]+i*l[18]+255*l[19])},getUniformLocations:function(e,t){return{uColorMatrix:e.getUniformLocation(t,"uColorMatrix"),uConstants:e.getUniformLocation(t,"uConstants")}},sendUniformData:function(e,t){var r=this.matrix,n=[r[0],r[1],r[2],r[3],r[5],r[6],r[7],r[8],r[10],r[11],r[12],r[13],r[15],r[16],r[17],r[18]],i=[r[4],r[9],r[14],r[19]];e.uniformMatrix4fv(t.uColorMatrix,!1,n),e.uniform4fv(t.uConstants,i)}}),t.Image.filters.ColorMatrix.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Brightness=n(r.BaseFilter,{type:"Brightness",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}",brightness:0,mainParameter:"brightness",applyTo2d:function(e){if(0!==this.brightness){var t,r=e.imageData.data,n=r.length,i=Math.round(255*this.brightness);for(t=0;t<n;t+=4)r[t]=r[t]+i,r[t+1]=r[t+1]+i,r[t+2]=r[t+2]+i}},getUniformLocations:function(e,t){return{uBrightness:e.getUniformLocation(t,"uBrightness")}},sendUniformData:function(e,t){e.uniform1f(t.uBrightness,this.brightness)}}),t.Image.filters.Brightness.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.Image.filters,i=t.util.createClass;n.Convolute=i(n.BaseFilter,{type:"Convolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_3_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_5_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_5_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_7_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_7_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_9_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_9_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}"},retrieveShader:function(e){var t=Math.sqrt(this.matrix.length),r=this.type+"_"+t+"_"+(this.opaque?1:0),n=this.fragmentSource[r];return e.programCache.hasOwnProperty(r)||(e.programCache[r]=this.createProgram(e.context,n)),e.programCache[r]},applyTo2d:function(e){var t,r,n,i,o,a,s,l,c,u,d,h,f,p=e.imageData,g=p.data,m=this.matrix,v=Math.round(Math.sqrt(m.length)),y=Math.floor(v/2),b=p.width,w=p.height,x=e.ctx.createImageData(b,w),C=x.data,_=this.opaque?1:0;for(d=0;d<w;d++)for(u=0;u<b;u++){for(o=4*(d*b+u),t=0,r=0,n=0,i=0,f=0;f<v;f++)for(h=0;h<v;h++)a=u+h-y,!((s=d+f-y)<0||s>=w||a<0||a>=b)&&(l=4*(s*b+a),c=m[f*v+h],t+=g[l]*c,r+=g[l+1]*c,n+=g[l+2]*c,_||(i+=g[l+3]*c));C[o]=t,C[o+1]=r,C[o+2]=n,C[o+3]=_?g[o+3]:i}e.imageData=x},getUniformLocations:function(e,t){return{uMatrix:e.getUniformLocation(t,"uMatrix"),uOpaque:e.getUniformLocation(t,"uOpaque"),uHalfSize:e.getUniformLocation(t,"uHalfSize"),uSize:e.getUniformLocation(t,"uSize")}},sendUniformData:function(e,t){e.uniform1fv(t.uMatrix,this.matrix)},toObject:function(){return r(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),t.Image.filters.Convolute.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Grayscale=n(r.BaseFilter,{type:"Grayscale",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(e){var t,r,n=e.imageData.data,i=n.length,o=this.mode;for(t=0;t<i;t+=4)"average"===o?r=(n[t]+n[t+1]+n[t+2])/3:"lightness"===o?r=(Math.min(n[t],n[t+1],n[t+2])+Math.max(n[t],n[t+1],n[t+2]))/2:"luminosity"===o&&(r=.21*n[t]+.72*n[t+1]+.07*n[t+2]),n[t]=r,n[t+1]=r,n[t+2]=r},retrieveShader:function(e){var t=this.type+"_"+this.mode;if(!e.programCache.hasOwnProperty(t)){var r=this.fragmentSource[this.mode];e.programCache[t]=this.createProgram(e.context,r)}return e.programCache[t]},getUniformLocations:function(e,t){return{uMode:e.getUniformLocation(t,"uMode")}},sendUniformData:function(e,t){e.uniform1i(t.uMode,1)},isNeutralState:function(){return!1}}),t.Image.filters.Grayscale.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Invert=n(r.BaseFilter,{type:"Invert",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}",invert:!0,mainParameter:"invert",applyTo2d:function(e){var t,r=e.imageData.data,n=r.length;for(t=0;t<n;t+=4)r[t]=255-r[t],r[t+1]=255-r[t+1],r[t+2]=255-r[t+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(e,t){return{uInvert:e.getUniformLocation(t,"uInvert")}},sendUniformData:function(e,t){e.uniform1i(t.uInvert,this.invert)}}),t.Image.filters.Invert.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.Image.filters,i=t.util.createClass;n.Noise=i(n.BaseFilter,{type:"Noise",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}",mainParameter:"noise",noise:0,applyTo2d:function(e){if(0!==this.noise){var t,r,n=e.imageData.data,i=n.length,o=this.noise;for(t=0,i=n.length;t<i;t+=4)r=(.5-Math.random())*o,n[t]+=r,n[t+1]+=r,n[t+2]+=r}},getUniformLocations:function(e,t){return{uNoise:e.getUniformLocation(t,"uNoise"),uSeed:e.getUniformLocation(t,"uSeed")}},sendUniformData:function(e,t){e.uniform1f(t.uNoise,this.noise/255),e.uniform1f(t.uSeed,Math.random())},toObject:function(){return r(this.callSuper("toObject"),{noise:this.noise})}}),t.Image.filters.Noise.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Pixelate=n(r.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}",applyTo2d:function(e){var t,r,n,i,o,a,s,l,c,u,d,h=e.imageData,f=h.data,p=h.height,g=h.width;for(r=0;r<p;r+=this.blocksize)for(n=0;n<g;n+=this.blocksize)for(i=f[t=4*r*g+4*n],o=f[t+1],a=f[t+2],s=f[t+3],u=Math.min(r+this.blocksize,p),d=Math.min(n+this.blocksize,g),l=r;l<u;l++)for(c=n;c<d;c++)f[t=4*l*g+4*c]=i,f[t+1]=o,f[t+2]=a,f[t+3]=s},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(e,t){return{uBlocksize:e.getUniformLocation(t,"uBlocksize"),uStepW:e.getUniformLocation(t,"uStepW"),uStepH:e.getUniformLocation(t,"uStepH")}},sendUniformData:function(e,t){e.uniform1f(t.uBlocksize,this.blocksize)}}),t.Image.filters.Pixelate.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.extend,n=t.Image.filters,i=t.util.createClass;n.RemoveColor=i(n.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}",distance:.02,useAlpha:!1,applyTo2d:function(e){var r,n,i,o,a=e.imageData.data,s=255*this.distance,l=new t.Color(this.color).getSource(),c=[l[0]-s,l[1]-s,l[2]-s],u=[l[0]+s,l[1]+s,l[2]+s];for(r=0;r<a.length;r+=4)n=a[r],i=a[r+1],o=a[r+2],n>c[0]&&i>c[1]&&o>c[2]&&n<u[0]&&i<u[1]&&o<u[2]&&(a[r+3]=0)},getUniformLocations:function(e,t){return{uLow:e.getUniformLocation(t,"uLow"),uHigh:e.getUniformLocation(t,"uHigh")}},sendUniformData:function(e,r){var n=new t.Color(this.color).getSource(),i=parseFloat(this.distance),o=[0+n[0]/255-i,0+n[1]/255-i,0+n[2]/255-i,1],a=[n[0]/255+i,n[1]/255+i,n[2]/255+i,1];e.uniform4fv(r.uLow,o),e.uniform4fv(r.uHigh,a)},toObject:function(){return r(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),t.Image.filters.RemoveColor.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass,i={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var o in i)r[o]=n(r.ColorMatrix,{type:o,matrix:i[o],mainParameter:!1,colorsOnly:!0}),t.Image.filters[o].fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric,r=t.Image.filters,n=t.util.createClass;r.BlendColor=n(r.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",diff:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n",tint:"gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n"},buildSource:function(e){return"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n"+this.fragmentSource[e]+"}\n}"},retrieveShader:function(e){var t,r=this.type+"_"+this.mode;return e.programCache.hasOwnProperty(r)||(t=this.buildSource(this.mode),e.programCache[r]=this.createProgram(e.context,t)),e.programCache[r]},applyTo2d:function(e){var r,n,i,o,a,s,l,c=e.imageData.data,u=c.length,d=1-this.alpha;r=(l=new t.Color(this.color).getSource())[0]*this.alpha,n=l[1]*this.alpha,i=l[2]*this.alpha;for(var h=0;h<u;h+=4)switch(o=c[h],a=c[h+1],s=c[h+2],this.mode){case"multiply":c[h]=o*r/255,c[h+1]=a*n/255,c[h+2]=s*i/255;break;case"screen":c[h]=255-(255-o)*(255-r)/255,c[h+1]=255-(255-a)*(255-n)/255,c[h+2]=255-(255-s)*(255-i)/255;break;case"add":c[h]=o+r,c[h+1]=a+n,c[h+2]=s+i;break;case"diff":case"difference":c[h]=Math.abs(o-r),c[h+1]=Math.abs(a-n),c[h+2]=Math.abs(s-i);break;case"subtract":c[h]=o-r,c[h+1]=a-n,c[h+2]=s-i;break;case"darken":c[h]=Math.min(o,r),c[h+1]=Math.min(a,n),c[h+2]=Math.min(s,i);break;case"lighten":c[h]=Math.max(o,r),c[h+1]=Math.max(a,n),c[h+2]=Math.max(s,i);break;case"overlay":c[h]=r<128?2*o*r/255:255-2*(255-o)*(255-r)/255,c[h+1]=n<128?2*a*n/255:255-2*(255-a)*(255-n)/255,c[h+2]=i<128?2*s*i/255:255-2*(255-s)*(255-i)/255;break;case"exclusion":c[h]=r+o-2*r*o/255,c[h+1]=n+a-2*n*a/255,c[h+2]=i+s-2*i*s/255;break;case"tint":c[h]=r+o*d,c[h+1]=n+a*d,c[h+2]=i+s*d}},getUniformLocations:function(e,t){return{uColor:e.getUniformLocation(t,"uColor")}},sendUniformData:function(e,r){var n=new t.Color(this.color).getSource();n[0]=this.alpha*n[0]/255,n[1]=this.alpha*n[1]/255,n[2]=this.alpha*n[2]/255,n[3]=this.alpha,e.uniform4fv(r.uColor,n)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),t.Image.filters.BlendColor.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric,r=t.Image.filters,n=t.util.createClass;r.BlendImage=n(r.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:{multiply:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}",mask:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}"},retrieveShader:function(e){var t=this.type+"_"+this.mode,r=this.fragmentSource[this.mode];return e.programCache.hasOwnProperty(t)||(e.programCache[t]=this.createProgram(e.context,r)),e.programCache[t]},applyToWebGL:function(e){var t=e.context,r=this.createTexture(e.filterBackend,this.image);this.bindAdditionalTexture(t,r,t.TEXTURE1),this.callSuper("applyToWebGL",e),this.unbindAdditionalTexture(t,t.TEXTURE1)},createTexture:function(e,t){return e.getCachedTexture(t.cacheKey,t._element)},calculateMatrix:function(){var e=this.image,t=e._element.width,r=e._element.height;return[1/e.scaleX,0,0,0,1/e.scaleY,0,-e.left/t,-e.top/r,1]},applyTo2d:function(e){var r,n,i,o,a,s,l,c,u,d,h,f=e.imageData,p=e.filterBackend.resources,g=f.data,m=g.length,v=f.width,y=f.height,b=this.image;p.blendImage||(p.blendImage=t.util.createCanvasElement()),d=(u=p.blendImage).getContext("2d"),u.width!==v||u.height!==y?(u.width=v,u.height=y):d.clearRect(0,0,v,y),d.setTransform(b.scaleX,0,0,b.scaleY,b.left,b.top),d.drawImage(b._element,0,0,v,y),h=d.getImageData(0,0,v,y).data;for(var w=0;w<m;w+=4)switch(a=g[w],s=g[w+1],l=g[w+2],c=g[w+3],r=h[w],n=h[w+1],i=h[w+2],o=h[w+3],this.mode){case"multiply":g[w]=a*r/255,g[w+1]=s*n/255,g[w+2]=l*i/255,g[w+3]=c*o/255;break;case"mask":g[w+3]=o}},getUniformLocations:function(e,t){return{uTransformMatrix:e.getUniformLocation(t,"uTransformMatrix"),uImage:e.getUniformLocation(t,"uImage")}},sendUniformData:function(e,t){var r=this.calculateMatrix();e.uniform1i(t.uImage,1),e.uniformMatrix3fv(t.uTransformMatrix,!1,r)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),t.Image.filters.BlendImage.fromObject=function(e,r){t.Image.fromObject(e.image,function(n){var i=t.util.object.clone(e);i.image=n,r(new t.Image.filters.BlendImage(i))})}}(e),function(e){var t=e.fabric||(e.fabric={}),r=Math.pow,n=Math.floor,i=Math.sqrt,o=Math.abs,a=Math.round,s=Math.sin,l=Math.ceil,c=t.Image.filters,u=t.util.createClass;c.Resize=u(c.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(e,t){return{uDelta:e.getUniformLocation(t,"uDelta"),uTaps:e.getUniformLocation(t,"uTaps")}},sendUniformData:function(e,t){e.uniform2fv(t.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),e.uniform1fv(t.uTaps,this.taps)},retrieveShader:function(e){var t=this.getFilterWindow(),r=this.type+"_"+t;if(!e.programCache.hasOwnProperty(r)){var n=this.generateShader(t);e.programCache[r]=this.createProgram(e.context,n)}return e.programCache[r]},getFilterWindow:function(){var e=this.tempScale;return Math.ceil(this.lanczosLobes/e)},getTaps:function(){for(var e=this.lanczosCreate(this.lanczosLobes),t=this.tempScale,r=this.getFilterWindow(),n=new Array(r),i=1;i<=r;i++)n[i-1]=e(i*t);return n},generateShader:function(e){for(var t=new Array(e),r=this.fragmentSourceTOP,n=1;n<=e;n++)t[n-1]=n+".0 * uDelta";return r+="uniform float uTaps["+e+"];\n",r+="void main() {\n",r+=" vec4 color = texture2D(uTexture, vTexCoord);\n",r+=" float sum = 1.0;\n",t.forEach(function(e,t){r+=" color += texture2D(uTexture, vTexCoord + "+e+") * uTaps["+t+"];\n",r+=" color += texture2D(uTexture, vTexCoord - "+e+") * uTaps["+t+"];\n",r+=" sum += 2.0 * uTaps["+t+"];\n"}),r+=" gl_FragColor = color / sum;\n",r+="}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(e){e.webgl?(e.passes++,this.width=e.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=e.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),e.destinationWidth=this.dW,this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e),e.sourceWidth=e.destinationWidth,this.height=e.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),e.destinationHeight=this.dH,this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e),e.sourceHeight=e.destinationHeight):this.applyTo2d(e)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(e){return function(t){if(t>=e||t<=-e)return 0;if(t<1.1920929e-7&&t>-1.1920929e-7)return 1;var r=(t*=Math.PI)/e;return s(t)/t*s(r)/r}},applyTo2d:function(e){var t=e.imageData,r=this.scaleX,n=this.scaleY;this.rcpScaleX=1/r,this.rcpScaleY=1/n;var i,o=t.width,s=t.height,l=a(o*r),c=a(s*n);"sliceHack"===this.resizeType?i=this.sliceByTwo(e,o,s,l,c):"hermite"===this.resizeType?i=this.hermiteFastResize(e,o,s,l,c):"bilinear"===this.resizeType?i=this.bilinearFiltering(e,o,s,l,c):"lanczos"===this.resizeType&&(i=this.lanczosResize(e,o,s,l,c)),e.imageData=i},sliceByTwo:function(e,r,i,o,a){var s,l,c=e.imageData,u=.5,d=!1,h=!1,f=r*u,p=i*u,g=t.filterBackend.resources,m=0,v=0,y=r,b=0;for(g.sliceByTwo||(g.sliceByTwo=document.createElement("canvas")),((s=g.sliceByTwo).width<1.5*r||s.height<i)&&(s.width=1.5*r,s.height=i),(l=s.getContext("2d")).clearRect(0,0,1.5*r,i),l.putImageData(c,0,0),o=n(o),a=n(a);!d||!h;)r=f,i=p,o<n(f*u)?f=n(f*u):(f=o,d=!0),a<n(p*u)?p=n(p*u):(p=a,h=!0),l.drawImage(s,m,v,r,i,y,b,f,p),m=y,v=b,b+=p;return l.getImageData(m,v,o,a)},lanczosResize:function(e,t,a,s,c){var u=e.imageData.data,d=e.ctx.createImageData(s,c),h=d.data,f=this.lanczosCreate(this.lanczosLobes),p=this.rcpScaleX,g=this.rcpScaleY,m=2/this.rcpScaleX,v=2/this.rcpScaleY,y=l(p*this.lanczosLobes/2),b=l(g*this.lanczosLobes/2),w={},x={},C={};return function e(l){var _,S,A,k,E,I,T,F,O,P,M;for(x.x=(l+.5)*p,C.x=n(x.x),_=0;_<c;_++){for(x.y=(_+.5)*g,C.y=n(x.y),E=0,I=0,T=0,F=0,O=0,S=C.x-y;S<=C.x+y;S++)if(!(S<0||S>=t)){P=n(1e3*o(S-x.x)),w[P]||(w[P]={});for(var R=C.y-b;R<=C.y+b;R++)R<0||R>=a||(M=n(1e3*o(R-x.y)),w[P][M]||(w[P][M]=f(i(r(P*m,2)+r(M*v,2))/1e3)),(A=w[P][M])>0&&(E+=A,I+=A*u[k=4*(R*t+S)],T+=A*u[k+1],F+=A*u[k+2],O+=A*u[k+3]))}h[k=4*(_*s+l)]=I/E,h[k+1]=T/E,h[k+2]=F/E,h[k+3]=O/E}return++l<s?e(l):d}(0)},bilinearFiltering:function(e,t,r,i,o){var a,s,l,c,u,d,h,f,p,g=0,m=this.rcpScaleX,v=this.rcpScaleY,y=4*(t-1),b=e.imageData.data,w=e.ctx.createImageData(i,o),x=w.data;for(l=0;l<o;l++)for(c=0;c<i;c++)for(u=m*c-(a=n(m*c)),d=v*l-(s=n(v*l)),p=4*(s*t+a),h=0;h<4;h++)f=b[p+h]*(1-u)*(1-d)+b[p+4+h]*u*(1-d)+b[p+y+h]*d*(1-u)+b[p+y+4+h]*u*d,x[g++]=f;return w},hermiteFastResize:function(e,t,r,a,s){for(var c=this.rcpScaleX,u=this.rcpScaleY,d=l(c/2),h=l(u/2),f=e.imageData.data,p=e.ctx.createImageData(a,s),g=p.data,m=0;m<s;m++)for(var v=0;v<a;v++){for(var y=4*(v+m*a),b=0,w=0,x=0,C=0,_=0,S=0,A=0,k=(m+.5)*u,E=n(m*u);E<(m+1)*u;E++)for(var I=o(k-(E+.5))/h,T=(v+.5)*c,F=I*I,O=n(v*c);O<(v+1)*c;O++){var P=o(T-(O+.5))/d,M=i(F+P*P);M>1&&M<-1||(b=2*M*M*M-3*M*M+1)>0&&(A+=b*f[(P=4*(O+E*t))+3],x+=b,f[P+3]<255&&(b=b*f[P+3]/250),C+=b*f[P],_+=b*f[P+1],S+=b*f[P+2],w+=b)}g[y]=C/w,g[y+1]=_/w,g[y+2]=S/w,g[y+3]=A/x}return p},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),t.Image.filters.Resize.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Contrast=n(r.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(e){if(0!==this.contrast){var t,r=e.imageData.data,n=r.length,i=Math.floor(255*this.contrast),o=259*(i+255)/(255*(259-i));for(t=0;t<n;t+=4)r[t]=o*(r[t]-128)+128,r[t+1]=o*(r[t+1]-128)+128,r[t+2]=o*(r[t+2]-128)+128}},getUniformLocations:function(e,t){return{uContrast:e.getUniformLocation(t,"uContrast")}},sendUniformData:function(e,t){e.uniform1f(t.uContrast,this.contrast)}}),t.Image.filters.Contrast.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Saturation=n(r.BaseFilter,{type:"Saturation",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}",saturation:0,mainParameter:"saturation",applyTo2d:function(e){if(0!==this.saturation){var t,r,n=e.imageData.data,i=n.length,o=-this.saturation;for(t=0;t<i;t+=4)r=Math.max(n[t],n[t+1],n[t+2]),n[t]+=r!==n[t]?(r-n[t])*o:0,n[t+1]+=r!==n[t+1]?(r-n[t+1])*o:0,n[t+2]+=r!==n[t+2]?(r-n[t+2])*o:0}},getUniformLocations:function(e,t){return{uSaturation:e.getUniformLocation(t,"uSaturation")}},sendUniformData:function(e,t){e.uniform1f(t.uSaturation,-this.saturation)}}),t.Image.filters.Saturation.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Vibrance=n(r.BaseFilter,{type:"Vibrance",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uVibrance;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat max = max(color.r, max(color.g, color.b));\nfloat avg = (color.r + color.g + color.b) / 3.0;\nfloat amt = (abs(max - avg) * 2.0) * uVibrance;\ncolor.r += max != color.r ? (max - color.r) * amt : 0.00;\ncolor.g += max != color.g ? (max - color.g) * amt : 0.00;\ncolor.b += max != color.b ? (max - color.b) * amt : 0.00;\ngl_FragColor = color;\n}",vibrance:0,mainParameter:"vibrance",applyTo2d:function(e){if(0!==this.vibrance){var t,r,n,i,o=e.imageData.data,a=o.length,s=-this.vibrance;for(t=0;t<a;t+=4)r=Math.max(o[t],o[t+1],o[t+2]),n=(o[t]+o[t+1]+o[t+2])/3,i=2*Math.abs(r-n)/255*s,o[t]+=r!==o[t]?(r-o[t])*i:0,o[t+1]+=r!==o[t+1]?(r-o[t+1])*i:0,o[t+2]+=r!==o[t+2]?(r-o[t+2])*i:0}},getUniformLocations:function(e,t){return{uVibrance:e.getUniformLocation(t,"uVibrance")}},sendUniformData:function(e,t){e.uniform1f(t.uVibrance,-this.vibrance)}}),t.Image.filters.Vibrance.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Blur=n(r.BaseFilter,{type:"Blur",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}",blur:0,mainParameter:"blur",applyTo:function(e){e.webgl?(this.aspectRatio=e.sourceWidth/e.sourceHeight,e.passes++,this._setupFrameBuffer(e),this.horizontal=!0,this.applyToWebGL(e),this._swapTextures(e),this._setupFrameBuffer(e),this.horizontal=!1,this.applyToWebGL(e),this._swapTextures(e)):this.applyTo2d(e)},applyTo2d:function(e){e.imageData=this.simpleBlur(e)},simpleBlur:function(e){var r,n,i=e.filterBackend.resources,o=e.imageData.width,a=e.imageData.height;i.blurLayer1||(i.blurLayer1=t.util.createCanvasElement(),i.blurLayer2=t.util.createCanvasElement()),r=i.blurLayer1,n=i.blurLayer2,(r.width!==o||r.height!==a)&&(n.width=r.width=o,n.height=r.height=a);var s,l,c,u,d=r.getContext("2d"),h=n.getContext("2d"),f=15,p=.06*this.blur*.5;for(d.putImageData(e.imageData,0,0),h.clearRect(0,0,o,a),u=-f;u<=f;u++)c=p*(l=u/f)*o+(s=(Math.random()-.5)/4),h.globalAlpha=1-Math.abs(l),h.drawImage(r,c,s),d.drawImage(n,0,0),h.globalAlpha=1,h.clearRect(0,0,n.width,n.height);for(u=-f;u<=f;u++)c=p*(l=u/f)*a+(s=(Math.random()-.5)/4),h.globalAlpha=1-Math.abs(l),h.drawImage(r,s,c),d.drawImage(n,0,0),h.globalAlpha=1,h.clearRect(0,0,n.width,n.height);e.ctx.drawImage(r,0,0);var g=e.ctx.getImageData(0,0,r.width,r.height);return d.globalAlpha=1,d.clearRect(0,0,r.width,r.height),g},getUniformLocations:function(e,t){return{delta:e.getUniformLocation(t,"uDelta")}},sendUniformData:function(e,t){var r=this.chooseRightDelta();e.uniform2fv(t.delta,r)},chooseRightDelta:function(){var e,t=1,r=[0,0];return this.horizontal?this.aspectRatio>1&&(t=1/this.aspectRatio):this.aspectRatio<1&&(t=this.aspectRatio),e=t*this.blur*.12,this.horizontal?r[0]=e:r[1]=e,r}}),r.Blur.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Gamma=n(r.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(e){this.gamma=[1,1,1],r.BaseFilter.prototype.initialize.call(this,e)},applyTo2d:function(e){var t,r=e.imageData.data,n=this.gamma,i=r.length,o=1/n[0],a=1/n[1],s=1/n[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),t=0,i=256;t<i;t++)this.rVals[t]=255*Math.pow(t/255,o),this.gVals[t]=255*Math.pow(t/255,a),this.bVals[t]=255*Math.pow(t/255,s);for(t=0,i=r.length;t<i;t+=4)r[t]=this.rVals[r[t]],r[t+1]=this.gVals[r[t+1]],r[t+2]=this.bVals[r[t+2]]},getUniformLocations:function(e,t){return{uGamma:e.getUniformLocation(t,"uGamma")}},sendUniformData:function(e,t){e.uniform3fv(t.uGamma,this.gamma)}}),t.Image.filters.Gamma.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.Composed=n(r.BaseFilter,{type:"Composed",subFilters:[],initialize:function(e){this.callSuper("initialize",e),this.subFilters=this.subFilters.slice(0)},applyTo:function(e){e.passes+=this.subFilters.length-1,this.subFilters.forEach(function(t){t.applyTo(e)})},toObject:function(){return t.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(e){return e.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(e){return!e.isNeutralState()})}}),t.Image.filters.Composed.fromObject=function(e,r){var n=(e.subFilters||[]).map(function(e){return new t.Image.filters[e.type](e)}),i=new t.Image.filters.Composed({subFilters:n});return r&&r(i),i}}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.Image.filters,n=t.util.createClass;r.HueRotation=n(r.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var e=this.rotation*Math.PI,r=t.util.cos(e),n=t.util.sin(e),i=1/3,o=Math.sqrt(i)*n,a=1-r;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=r+a/3,this.matrix[1]=i*a-o,this.matrix[2]=i*a+o,this.matrix[5]=i*a+o,this.matrix[6]=r+i*a,this.matrix[7]=i*a-o,this.matrix[10]=i*a-o,this.matrix[11]=i*a+o,this.matrix[12]=r+i*a},isNeutralState:function(e){return this.calculateMatrix(),r.BaseFilter.prototype.isNeutralState.call(this,e)},applyTo:function(e){this.calculateMatrix(),r.BaseFilter.prototype.applyTo.call(this,e)}}),t.Image.filters.HueRotation.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||(e.fabric={}),r=t.util.object.clone;if(t.Text)t.warn("fabric.Text is already defined");else{var n="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" ");t.Text=t.util.createClass(t.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles","path","pathStartOffset","pathSide","pathAlign"],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:"",stateProperties:t.Object.prototype.stateProperties.concat(n),cacheProperties:t.Object.prototype.cacheProperties.concat(n),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:"left",pathAlign:"baseline",_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:"ltr",_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(e,t){this.styles=t&&t.styles||{},this.text=e,this.__skipDimension=!0,this.callSuper("initialize",t),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var e=this.path;e&&(e.segmentsInfo=t.util.getPathSegmentsInfo(e.path))},getMeasuringContext:function(){return t._measuringContext||(t._measuringContext=this.canvas&&this.canvas.contextCache||t.util.createCanvasElement().getContext("2d")),t._measuringContext},_splitText:function(){var e=this._splitTextIntoLines(this.text);return this.textLines=e.lines,this._textLines=e.graphemeLines,this._unwrappedTextLines=e._unwrappedLines,this._text=e.graphemeText,e},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var e,t,r,n,i,o,a,s=0,l=this._textLines.length;s<l;s++)if(("justify"===this.textAlign||s!==l-1&&!this.isEndOfWrapping(s))&&(n=0,i=this._textLines[s],(t=this.getLineWidth(s))<this.width&&(a=this.textLines[s].match(this._reSpacesAndTabs)))){r=a.length,e=(this.width-t)/r;for(var c=0,u=i.length;c<=u;c++)o=this.__charBounds[s][c],this._reSpaceAndTab.test(i[c])?(o.width+=e,o.kernedWidth+=e,o.left+=n,n+=e):o.left+=n}},isEndOfWrapping:function(e){return e===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var e=this.callSuper("_getCacheCanvasDimensions"),t=this.fontSize;return e.width+=t*e.zoomX,e.height+=t*e.zoomY,e},_render:function(e){var t=this.path;t&&!t.isNotVisible()&&t._render(e),this._setTextStyles(e),this._renderTextLinesBackground(e),this._renderTextDecoration(e,"underline"),this._renderText(e),this._renderTextDecoration(e,"overline"),this._renderTextDecoration(e,"linethrough")},_renderText:function(e){"stroke"===this.paintFirst?(this._renderTextStroke(e),this._renderTextFill(e)):(this._renderTextFill(e),this._renderTextStroke(e))},_setTextStyles:function(e,t,r){if(e.textBaseline="alphabetical",this.path)switch(this.pathAlign){case"center":e.textBaseline="middle";break;case"ascender":e.textBaseline="top";break;case"descender":e.textBaseline="bottom"}e.font=this._getFontDeclaration(t,r)},calcTextWidth:function(){for(var e=this.getLineWidth(0),t=1,r=this._textLines.length;t<r;t++){var n=this.getLineWidth(t);n>e&&(e=n)}return e},_renderTextLine:function(e,t,r,n,i,o){this._renderChars(e,t,r,n,i,o)},_renderTextLinesBackground:function(e){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var t,r,n,i,o,a,s,l=e.fillStyle,c=this._getLeftOffset(),u=this._getTopOffset(),d=0,h=0,f=this.path,p=0,g=this._textLines.length;p<g;p++)if(t=this.getHeightOfLine(p),this.textBackgroundColor||this.styleHas("textBackgroundColor",p)){n=this._textLines[p],r=this._getLineLeftOffset(p),h=0,d=0,i=this.getValueOfPropertyAt(p,0,"textBackgroundColor");for(var m=0,v=n.length;m<v;m++)o=this.__charBounds[p][m],a=this.getValueOfPropertyAt(p,m,"textBackgroundColor"),f?(e.save(),e.translate(o.renderLeft,o.renderTop),e.rotate(o.angle),e.fillStyle=a,a&&e.fillRect(-o.width/2,-t/this.lineHeight*(1-this._fontSizeFraction),o.width,t/this.lineHeight),e.restore()):a!==i?(s=c+r+d,"rtl"===this.direction&&(s=this.width-s-h),e.fillStyle=i,i&&e.fillRect(s,u,h,t/this.lineHeight),d=o.left,h=o.width,i=a):h+=o.kernedWidth;a&&!f&&(s=c+r+d,"rtl"===this.direction&&(s=this.width-s-h),e.fillStyle=a,e.fillRect(s,u,h,t/this.lineHeight)),u+=t}else u+=t;e.fillStyle=l,this._removeShadow(e)}},getFontCache:function(e){var r=e.fontFamily.toLowerCase();t.charWidthsCache[r]||(t.charWidthsCache[r]={});var n=t.charWidthsCache[r],i=e.fontStyle.toLowerCase()+"_"+(e.fontWeight+"").toLowerCase();return n[i]||(n[i]={}),n[i]},_measureChar:function(e,t,r,n){var i,o,a,s,l=this.getFontCache(t),c=r+e,u=this._getFontDeclaration(t)===this._getFontDeclaration(n),d=t.fontSize/this.CACHE_FONT_SIZE;if(r&&void 0!==l[r]&&(a=l[r]),void 0!==l[e]&&(s=i=l[e]),u&&void 0!==l[c]&&(s=(o=l[c])-a),void 0===i||void 0===a||void 0===o){var h=this.getMeasuringContext();this._setTextStyles(h,t,!0)}return void 0===i&&(s=i=h.measureText(e).width,l[e]=i),void 0===a&&u&&r&&(a=h.measureText(r).width,l[r]=a),u&&void 0===o&&(o=h.measureText(c).width,l[c]=o,s=o-a),{width:i*d,kernedWidth:s*d}},getHeightOfChar:function(e,t){return this.getValueOfPropertyAt(e,t,"fontSize")},measureLine:function(e){var t=this._measureLine(e);return 0!==this.charSpacing&&(t.width-=this._getWidthOfCharSpacing()),t.width<0&&(t.width=0),t},_measureLine:function(e){var r,n,i,o,a,s,l=0,c=this._textLines[e],u=new Array(c.length),d=0,h=this.path,f="right"===this.pathSide;for(this.__charBounds[e]=u,r=0;r<c.length;r++)n=c[r],o=this._getGraphemeBox(n,e,r,i),u[r]=o,l+=o.kernedWidth,i=n;if(u[r]={left:o?o.left+o.width:0,width:0,kernedWidth:0,height:this.fontSize},h){switch(s=h.segmentsInfo[h.segmentsInfo.length-1].length,(a=t.util.getPointOnPath(h.path,0,h.segmentsInfo)).x+=h.pathOffset.x,a.y+=h.pathOffset.y,this.textAlign){case"left":d=f?s-l:0;break;case"center":d=(s-l)/2;break;case"right":d=f?0:s-l}for(d+=this.pathStartOffset*(f?-1:1),r=f?c.length-1:0;f?r>=0:r<c.length;f?r--:r++)o=u[r],d>s?d%=s:d<0&&(d+=s),this._setGraphemeOnPath(d,o,a),d+=o.kernedWidth}return{width:l,numOfSpaces:0}},_setGraphemeOnPath:function(e,r,n){var i=e+r.kernedWidth/2,o=this.path,a=t.util.getPointOnPath(o.path,i,o.segmentsInfo);r.renderLeft=a.x-n.x,r.renderTop=a.y-n.y,r.angle=a.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(e,t,r,n,i){var o,a=this.getCompleteStyleDeclaration(t,r),s=n?this.getCompleteStyleDeclaration(t,r-1):{},l=this._measureChar(e,a,n,s),c=l.kernedWidth,u=l.width;0!==this.charSpacing&&(u+=o=this._getWidthOfCharSpacing(),c+=o);var d={width:u,left:0,height:a.fontSize,kernedWidth:c,deltaY:a.deltaY};if(r>0&&!i){var h=this.__charBounds[t][r-1];d.left=h.left+h.width+l.kernedWidth-l.width}return d},getHeightOfLine:function(e){if(this.__lineHeights[e])return this.__lineHeights[e];for(var t=this._textLines[e],r=this.getHeightOfChar(e,0),n=1,i=t.length;n<i;n++)r=Math.max(this.getHeightOfChar(e,n),r);return this.__lineHeights[e]=r*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var e,t=0,r=0,n=this._textLines.length;r<n;r++)e=this.getHeightOfLine(r),t+=r===n-1?e/this.lineHeight:e;return t},_getLeftOffset:function(){return"ltr"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(e,t){e.save();for(var r=0,n=this._getLeftOffset(),i=this._getTopOffset(),o=0,a=this._textLines.length;o<a;o++){var s=this.getHeightOfLine(o),l=s/this.lineHeight,c=this._getLineLeftOffset(o);this._renderTextLine(t,e,this._textLines[o],n+c,i+r+l,o),r+=s}e.restore()},_renderTextFill:function(e){!this.fill&&!this.styleHas("fill")||this._renderTextCommon(e,"fillText")},_renderTextStroke:function(e){(!this.stroke||0===this.strokeWidth)&&this.isEmptyStyles()||(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this._setLineDash(e,this.strokeDashArray),e.beginPath(),this._renderTextCommon(e,"strokeText"),e.closePath(),e.restore())},_renderChars:function(e,r,n,i,o,a){var s,l,c,u,d,h=this.getHeightOfLine(a),f=-1!==this.textAlign.indexOf("justify"),p="",g=0,m=this.path,v=!f&&0===this.charSpacing&&this.isEmptyStyles(a)&&!m,y="ltr"===this.direction,b="ltr"===this.direction?1:-1,w=r.canvas.getAttribute("dir");if(r.save(),w!==this.direction&&(r.canvas.setAttribute("dir",y?"ltr":"rtl"),r.direction=y?"ltr":"rtl",r.textAlign=y?"left":"right"),o-=h*this._fontSizeFraction/this.lineHeight,v)return this._renderChar(e,r,a,0,n.join(""),i,o,h),void r.restore();for(var x=0,C=n.length-1;x<=C;x++)u=x===C||this.charSpacing||m,p+=n[x],c=this.__charBounds[a][x],0===g?(i+=b*(c.kernedWidth-c.width),g+=c.width):g+=c.kernedWidth,f&&!u&&this._reSpaceAndTab.test(n[x])&&(u=!0),u||(s=s||this.getCompleteStyleDeclaration(a,x),l=this.getCompleteStyleDeclaration(a,x+1),u=t.util.hasStyleChanged(s,l,!1)),u&&(m?(r.save(),r.translate(c.renderLeft,c.renderTop),r.rotate(c.angle),this._renderChar(e,r,a,x,p,-g/2,0,h),r.restore()):(d=i,this._renderChar(e,r,a,x,p,d,o,h)),p="",s=l,i+=b*g,g=0);r.restore()},_applyPatternGradientTransformText:function(e){var r,n=t.util.createCanvasElement(),i=this.width+this.strokeWidth,o=this.height+this.strokeWidth;return n.width=i,n.height=o,(r=n.getContext("2d")).beginPath(),r.moveTo(0,0),r.lineTo(i,0),r.lineTo(i,o),r.lineTo(0,o),r.closePath(),r.translate(i/2,o/2),r.fillStyle=e.toLive(r),this._applyPatternGradientTransform(r,e),r.fill(),r.createPattern(n,"no-repeat")},handleFiller:function(e,t,r){var n,i;return r.toLive?"percentage"===r.gradientUnits||r.gradientTransform||r.patternTransform?(n=-this.width/2,i=-this.height/2,e.translate(n,i),e[t]=this._applyPatternGradientTransformText(r),{offsetX:n,offsetY:i}):(e[t]=r.toLive(e,this),this._applyPatternGradientTransform(e,r)):(e[t]=r,{offsetX:0,offsetY:0})},_setStrokeStyles:function(e,t){return e.lineWidth=t.strokeWidth,e.lineCap=this.strokeLineCap,e.lineDashOffset=this.strokeDashOffset,e.lineJoin=this.strokeLineJoin,e.miterLimit=this.strokeMiterLimit,this.handleFiller(e,"strokeStyle",t.stroke)},_setFillStyles:function(e,t){return this.handleFiller(e,"fillStyle",t.fill)},_renderChar:function(e,t,r,n,i,o,a){var s,l,c=this._getStyleDeclaration(r,n),u=this.getCompleteStyleDeclaration(r,n),d="fillText"===e&&u.fill,h="strokeText"===e&&u.stroke&&u.strokeWidth;!h&&!d||(t.save(),d&&(s=this._setFillStyles(t,u)),h&&(l=this._setStrokeStyles(t,u)),t.font=this._getFontDeclaration(u),c&&c.textBackgroundColor&&this._removeShadow(t),c&&c.deltaY&&(a+=c.deltaY),d&&t.fillText(i,o-s.offsetX,a-s.offsetY),h&&t.strokeText(i,o-l.offsetX,a-l.offsetY),t.restore())},setSuperscript:function(e,t){return this._setScript(e,t,this.superscript)},setSubscript:function(e,t){return this._setScript(e,t,this.subscript)},_setScript:function(e,t,r){var n=this.get2DCursorLocation(e,!0),i=this.getValueOfPropertyAt(n.lineIndex,n.charIndex,"fontSize"),o=this.getValueOfPropertyAt(n.lineIndex,n.charIndex,"deltaY"),a={fontSize:i*r.size,deltaY:o+i*r.baseline};return this.setSelectionStyles(a,e,t),this},_getLineLeftOffset:function(e){var t=this.getLineWidth(e),r=this.width-t,n=this.textAlign,i=this.direction,o=0,a=this.isEndOfWrapping(e);return"justify"===n||"justify-center"===n&&!a||"justify-right"===n&&!a||"justify-left"===n&&!a?0:("center"===n&&(o=r/2),"right"===n&&(o=r),"justify-center"===n&&(o=r/2),"justify-right"===n&&(o=r),"rtl"===i&&(o-=r),o)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var e=this._forceClearCache;return e||(e=this.hasStateChanged("_dimensionAffectingProps")),e&&(this.dirty=!0,this._forceClearCache=!1),e},getLineWidth:function(e){if(void 0!==this.__lineWidths[e])return this.__lineWidths[e];var t=this.measureLine(e).width;return this.__lineWidths[e]=t,t},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(e,t,r){var n=this._getStyleDeclaration(e,t);return n&&typeof n[r]<"u"?n[r]:this[r]},_renderTextDecoration:function(e,t){if(this[t]||this.styleHas(t)){for(var r,n,i,o,a,s,l,c,u,d,h,f,p,g,m,v,y=this._getLeftOffset(),b=this._getTopOffset(),w=this.path,x=this._getWidthOfCharSpacing(),C=this.offsets[t],_=0,S=this._textLines.length;_<S;_++)if(r=this.getHeightOfLine(_),this[t]||this.styleHas(t,_)){l=this._textLines[_],g=r/this.lineHeight,o=this._getLineLeftOffset(_),d=0,h=0,c=this.getValueOfPropertyAt(_,0,t),v=this.getValueOfPropertyAt(_,0,"fill"),u=b+g*(1-this._fontSizeFraction),n=this.getHeightOfChar(_,0),a=this.getValueOfPropertyAt(_,0,"deltaY");for(var A=0,k=l.length;A<k;A++)if(f=this.__charBounds[_][A],p=this.getValueOfPropertyAt(_,A,t),m=this.getValueOfPropertyAt(_,A,"fill"),i=this.getHeightOfChar(_,A),s=this.getValueOfPropertyAt(_,A,"deltaY"),w&&p&&m)e.save(),e.fillStyle=v,e.translate(f.renderLeft,f.renderTop),e.rotate(f.angle),e.fillRect(-f.kernedWidth/2,C*i+s,f.kernedWidth,this.fontSize/15),e.restore();else if((p!==c||m!==v||i!==n||s!==a)&&h>0){var E=y+o+d;"rtl"===this.direction&&(E=this.width-E-h),c&&v&&(e.fillStyle=v,e.fillRect(E,u+C*n+a,h,this.fontSize/15)),d=f.left,h=f.width,c=p,v=m,n=i,a=s}else h+=f.kernedWidth;E=y+o+d;"rtl"===this.direction&&(E=this.width-E-h),e.fillStyle=m,p&&m&&e.fillRect(E,u+C*n+a,h-x,this.fontSize/15),b+=r}else b+=r;this._removeShadow(e)}},_getFontDeclaration:function(e,r){var n=e||this,i=this.fontFamily,o=t.Text.genericFonts.indexOf(i.toLowerCase())>-1,a=void 0===i||i.indexOf("'")>-1||i.indexOf(",")>-1||i.indexOf('"')>-1||o?n.fontFamily:'"'+n.fontFamily+'"';return[t.isLikelyNode?n.fontWeight:n.fontStyle,t.isLikelyNode?n.fontStyle:n.fontWeight,r?this.CACHE_FONT_SIZE+"px":n.fontSize+"px",a].join(" ")},render:function(e){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",e)))},_splitTextIntoLines:function(e){for(var r=e.split(this._reNewline),n=new Array(r.length),i=["\n"],o=[],a=0;a<r.length;a++)n[a]=t.util.string.graphemeSplit(r[a]),o=o.concat(n[a],i);return o.pop(),{_unwrappedLines:n,lines:r,graphemeText:o,graphemeLines:n}},toObject:function(e){var r=n.concat(e),i=this.callSuper("toObject",r);return i.styles=t.util.stylesToArray(this.styles,this.text),i.path&&(i.path=this.path.toObject()),i},set:function(e,t){this.callSuper("set",e,t);var r=!1,n=!1;if("object"==typeof e)for(var i in e)"path"===i&&this.setPathInfo(),r=r||-1!==this._dimensionAffectingProps.indexOf(i),n=n||"path"===i;else r=-1!==this._dimensionAffectingProps.indexOf(e),n="path"===e;return n&&this.setPathInfo(),r&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),t.Text.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),t.Text.DEFAULT_SVG_FONT_SIZE=16,t.Text.fromElement=function(e,n,i){if(!e)return n(null);var o=t.parseAttributes(e,t.Text.ATTRIBUTE_NAMES),a=o.textAnchor||"left";if((i=t.util.object.extend(i?r(i):{},o)).top=i.top||0,i.left=i.left||0,o.textDecoration){var s=o.textDecoration;-1!==s.indexOf("underline")&&(i.underline=!0),-1!==s.indexOf("overline")&&(i.overline=!0),-1!==s.indexOf("line-through")&&(i.linethrough=!0),delete i.textDecoration}"dx"in o&&(i.left+=o.dx),"dy"in o&&(i.top+=o.dy),"fontSize"in i||(i.fontSize=t.Text.DEFAULT_SVG_FONT_SIZE);var l="";"textContent"in e?l=e.textContent:"firstChild"in e&&null!==e.firstChild&&"data"in e.firstChild&&null!==e.firstChild.data&&(l=e.firstChild.data),l=l.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var c=i.strokeWidth;i.strokeWidth=0;var u=new t.Text(l,i),d=u.getScaledHeight()/u.height,h=((u.height+u.strokeWidth)*u.lineHeight-u.height)*d,f=u.getScaledHeight()+h,p=0;"center"===a&&(p=u.getScaledWidth()/2),"right"===a&&(p=u.getScaledWidth()),u.set({left:u.left-p,top:u.top-(f-u.fontSize*(.07+u._fontSizeFraction))/u.lineHeight,strokeWidth:typeof c<"u"?c:1}),n(u)},t.Text.fromObject=function(e,n){var i=r(e),o=e.path;return delete i.path,t.Object._fromObject("Text",i,function(r){r.styles=t.util.stylesFromArray(e.styles,e.text),o?t.Object._fromObject("Path",o,function(e){r.set("path",e),n(r)},"path"):n(r)},"text")},t.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],t.util.createAccessors&&t.util.createAccessors(t.Text)}}(e),t.util.object.extend(t.Text.prototype,{isEmptyStyles:function(e){if(!this.styles||typeof e<"u"&&!this.styles[e])return!0;var t=typeof e>"u"?this.styles:{line:this.styles[e]};for(var r in t)for(var n in t[r])for(var i in t[r][n])return!1;return!0},styleHas:function(e,t){if(!this.styles||!e||""===e||typeof t<"u"&&!this.styles[t])return!1;var r=typeof t>"u"?this.styles:{0:this.styles[t]};for(var n in r)for(var i in r[n])if(typeof r[n][i][e]<"u")return!0;return!1},cleanStyle:function(e){if(!this.styles||!e||""===e)return!1;var t,r,n=this.styles,i=0,o=!0,a=0;for(var s in n){for(var l in t=0,n[s]){var c;i++,(c=n[s][l]).hasOwnProperty(e)?(r?c[e]!==r&&(o=!1):r=c[e],c[e]===this[e]&&delete c[e]):o=!1,0!==Object.keys(c).length?t++:delete n[s][l]}0===t&&delete n[s]}for(var u=0;u<this._textLines.length;u++)a+=this._textLines[u].length;o&&i===a&&(this[e]=r,this.removeStyle(e))},removeStyle:function(e){if(this.styles&&e&&""!==e){var t,r,n,i=this.styles;for(r in i){for(n in t=i[r])delete t[n][e],0===Object.keys(t[n]).length&&delete t[n];0===Object.keys(t).length&&delete i[r]}}},_extendStyles:function(e,r){var n=this.get2DCursorLocation(e);this._getLineStyle(n.lineIndex)||this._setLineStyle(n.lineIndex),this._getStyleDeclaration(n.lineIndex,n.charIndex)||this._setStyleDeclaration(n.lineIndex,n.charIndex,{}),t.util.object.extend(this._getStyleDeclaration(n.lineIndex,n.charIndex),r)},get2DCursorLocation:function(e,t){typeof e>"u"&&(e=this.selectionStart);for(var r=t?this._unwrappedTextLines:this._textLines,n=r.length,i=0;i<n;i++){if(e<=r[i].length)return{lineIndex:i,charIndex:e};e-=r[i].length+this.missingNewlineOffset(i)}return{lineIndex:i-1,charIndex:r[i-1].length<e?r[i-1].length:e}},getSelectionStyles:function(e,t,r){typeof e>"u"&&(e=this.selectionStart||0),typeof t>"u"&&(t=this.selectionEnd||e);for(var n=[],i=e;i<t;i++)n.push(this.getStyleAtPosition(i,r));return n},getStyleAtPosition:function(e,t){var r=this.get2DCursorLocation(e);return(t?this.getCompleteStyleDeclaration(r.lineIndex,r.charIndex):this._getStyleDeclaration(r.lineIndex,r.charIndex))||{}},setSelectionStyles:function(e,t,r){typeof t>"u"&&(t=this.selectionStart||0),typeof r>"u"&&(r=this.selectionEnd||t);for(var n=t;n<r;n++)this._extendStyles(n,e);return this._forceClearCache=!0,this},_getStyleDeclaration:function(e,t){var r=this.styles&&this.styles[e];return r?r[t]:null},getCompleteStyleDeclaration:function(e,t){for(var r,n=this._getStyleDeclaration(e,t)||{},i={},o=0;o<this._styleProperties.length;o++)i[r=this._styleProperties[o]]=typeof n[r]>"u"?this[r]:n[r];return i},_setStyleDeclaration:function(e,t,r){this.styles[e][t]=r},_deleteStyleDeclaration:function(e,t){delete this.styles[e][t]},_getLineStyle:function(e){return!!this.styles[e]},_setLineStyle:function(e){this.styles[e]={}},_deleteLineStyle:function(e){delete this.styles[e]}}),function(){function e(e){e.textDecoration&&(e.textDecoration.indexOf("underline")>-1&&(e.underline=!0),e.textDecoration.indexOf("line-through")>-1&&(e.linethrough=!0),e.textDecoration.indexOf("overline")>-1&&(e.overline=!0),delete e.textDecoration)}t.IText=t.util.createClass(t.Text,t.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"",cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(e,t){this.callSuper("initialize",e,t),this.initBehavior()},setSelectionStart:function(e){e=Math.max(e,0),this._updateAndFire("selectionStart",e)},setSelectionEnd:function(e){e=Math.min(e,this.text.length),this._updateAndFire("selectionEnd",e)},_updateAndFire:function(e,t){this[e]!==t&&(this._fireSelectionChanged(),this[e]=t),this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed"),this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper("initDimensions")},render:function(e){this.clearContextTop(),this.callSuper("render",e),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(e){this.callSuper("_render",e)},clearContextTop:function(e){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this.canvas.contextTop,r=this.canvas.viewportTransform;t.save(),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this.transform(t),this._clearTextArea(t),e||t.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this._getCursorBoundaries(),t=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(e,t):this.renderSelection(e,t),t.restore()}},_clearTextArea:function(e){var t=this.width+4,r=this.height+4;e.clearRect(-t/2,-r/2,t,r)},_getCursorBoundaries:function(e){typeof e>"u"&&(e=this.selectionStart);var t=this._getLeftOffset(),r=this._getTopOffset(),n=this._getCursorBoundariesOffsets(e);return{left:t,top:r,leftOffset:n.left,topOffset:n.top}},_getCursorBoundariesOffsets:function(e){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var t,r,n,i,o=0,a=0,s=this.get2DCursorLocation(e);n=s.charIndex,r=s.lineIndex;for(var l=0;l<r;l++)o+=this.getHeightOfLine(l);t=this._getLineLeftOffset(r);var c=this.__charBounds[r][n];return c&&(a=c.left),0!==this.charSpacing&&n===this._textLines[r].length&&(a-=this._getWidthOfCharSpacing()),i={top:o,left:t+(a>0?a:0)},"rtl"===this.direction&&(i.left*=-1),this.cursorOffsetCache=i,this.cursorOffsetCache},renderCursor:function(e,t){var r=this.get2DCursorLocation(),n=r.lineIndex,i=r.charIndex>0?r.charIndex-1:0,o=this.getValueOfPropertyAt(n,i,"fontSize"),a=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/a,l=e.topOffset,c=this.getValueOfPropertyAt(n,i,"deltaY");l+=(1-this._fontSizeFraction)*this.getHeightOfLine(n)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(e,t),t.fillStyle=this.cursorColor||this.getValueOfPropertyAt(n,i,"fill"),t.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,t.fillRect(e.left+e.leftOffset-s/2,l+e.top+c,s,o)},renderSelection:function(e,t){for(var r=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,n=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,i=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(r),a=this.get2DCursorLocation(n),s=o.lineIndex,l=a.lineIndex,c=o.charIndex<0?0:o.charIndex,u=a.charIndex<0?0:a.charIndex,d=s;d<=l;d++){var h,f=this._getLineLeftOffset(d)||0,p=this.getHeightOfLine(d),g=0,m=0;if(d===s&&(g=this.__charBounds[s][c].left),d>=s&&d<l)m=i&&!this.isEndOfWrapping(d)?this.width:this.getLineWidth(d)||5;else if(d===l)if(0===u)m=this.__charBounds[l][u].left;else{var v=this._getWidthOfCharSpacing();m=this.__charBounds[l][u-1].left+this.__charBounds[l][u-1].width-v}h=p,(this.lineHeight<1||d===l&&this.lineHeight>1)&&(p/=this.lineHeight);var y=e.left+f+g,b=m-g,w=p,x=0;this.inCompositionMode?(t.fillStyle=this.compositionColor||"black",w=1,x=p):t.fillStyle=this.selectionColor,"rtl"===this.direction&&(y=this.width-y-b),t.fillRect(y,e.top+e.topOffset+x,b,w),e.topOffset+=h}},getCurrentCharFontSize:function(){var e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,"fontSize")},getCurrentCharColor:function(){var e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,"fill")},_getCurrentCharIndex:function(){var e=this.get2DCursorLocation(this.selectionStart,!0),t=e.charIndex>0?e.charIndex-1:0;return{l:e.lineIndex,c:t}}}),t.IText.fromObject=function(r,n){var i=t.util.stylesFromArray(r.styles,r.text),o=Object.assign({},r,{styles:i});if(e(o),o.styles)for(var a in o.styles)for(var s in o.styles[a])e(o.styles[a][s]);t.Object._fromObject("IText",o,n,"text")}}(),function(){var e=t.util.object.clone;t.util.object.extend(t.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var e=this;this.on("added",function(){var t=e.canvas;t&&(t._hasITextHandlers||(t._hasITextHandlers=!0,e._initCanvasHandlers(t)),t._iTextInstances=t._iTextInstances||[],t._iTextInstances.push(e))})},initRemovedHandler:function(){var e=this;this.on("removed",function(){var r=e.canvas;r&&(r._iTextInstances=r._iTextInstances||[],t.util.removeFromArray(r._iTextInstances,e),0===r._iTextInstances.length&&(r._hasITextHandlers=!1,e._removeCanvasHandlers(r)))})},_initCanvasHandlers:function(e){e._mouseUpITextHandler=function(){e._iTextInstances&&e._iTextInstances.forEach(function(e){e.__isMousedown=!1})},e.on("mouse:up",e._mouseUpITextHandler)},_removeCanvasHandlers:function(e){e.off("mouse:up",e._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(e,t,r,n){var i;return i={isAborted:!1,abort:function(){this.isAborted=!0}},e.animate("_currentCursorOpacity",t,{duration:r,onComplete:function(){i.isAborted||e[n]()},onChange:function(){e.canvas&&e.selectionStart===e.selectionEnd&&e.renderCursorOrSelection()},abort:function(){return i.isAborted}}),i},_onTickComplete:function(){var e=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){e._currentTickCompleteState=e._animateCursor(e,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(e){var t=this,r=e?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){t._tick()},r)},abortCursorAnimation:function(){var e=this._currentTickState||this._currentTickCompleteState,t=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,e&&t&&t.clearContext(t.contextTop||t.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(e){var t=0,r=e-1;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)t++,r--;for(;/\S/.test(this._text[r])&&r>-1;)t++,r--;return e-t},findWordBoundaryRight:function(e){var t=0,r=e;if(this._reSpace.test(this._text[r]))for(;this._reSpace.test(this._text[r]);)t++,r++;for(;/\S/.test(this._text[r])&&r<this._text.length;)t++,r++;return e+t},findLineBoundaryLeft:function(e){for(var t=0,r=e-1;!/\n/.test(this._text[r])&&r>-1;)t++,r--;return e-t},findLineBoundaryRight:function(e){for(var t=0,r=e;!/\n/.test(this._text[r])&&r<this._text.length;)t++,r++;return e+t},searchWordBoundary:function(e,r){for(var n=this._text,i=this._reSpace.test(n[e])?e-1:e,o=n[i],a=t.reNonWord;!a.test(o)&&i>0&&i<n.length;)o=n[i+=r];return a.test(o)&&(i+=1===r?0:1),i},selectWord:function(e){e=e||this.selectionStart;var t=this.searchWordBoundary(e,-1),r=this.searchWordBoundary(e,1);this.selectionStart=t,this.selectionEnd=r,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(e){e=e||this.selectionStart;var t=this.findLineBoundaryLeft(e),r=this.findLineBoundaryRight(e);return this.selectionStart=t,this.selectionEnd=r,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(e){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(e),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),this.canvas?(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this):this},exitEditingOnOthers:function(e){e._iTextInstances&&e._iTextInstances.forEach(function(e){e.selected=!1,e.isEditing&&e.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(e){if(this.__isMousedown&&this.isEditing){document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus();var t=this.getSelectionStartFromPointer(e.e),r=this.selectionStart,n=this.selectionEnd;(t!==this.__selectionStartOnMouseDown||r===n)&&(r===t||n===t)||(t>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=t):(this.selectionStart=t,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==r||this.selectionEnd!==n)&&(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text",this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text"),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(e,r,n){var i=n.slice(0,e),o=t.util.string.graphemeSplit(i).length;if(e===r)return{selectionStart:o,selectionEnd:o};var a=n.slice(e,r);return{selectionStart:o,selectionEnd:o+t.util.string.graphemeSplit(a).length}},fromGraphemeToStringSelection:function(e,t,r){var n=r.slice(0,e).join("").length;return e===t?{selectionStart:n,selectionEnd:n}:{selectionStart:n,selectionEnd:n+r.slice(e,t).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var e=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=e.selectionStart,this.hiddenTextarea.selectionEnd=e.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var e=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=e.selectionEnd,this.inCompositionMode||(this.selectionStart=e.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var e=this._calcTextareaPosition();this.hiddenTextarea.style.left=e.left,this.hiddenTextarea.style.top=e.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var e=this.inCompositionMode?this.compositionStart:this.selectionStart,r=this._getCursorBoundaries(e),n=this.get2DCursorLocation(e),i=n.lineIndex,o=n.charIndex,a=this.getValueOfPropertyAt(i,o,"fontSize")*this.lineHeight,s=r.leftOffset,l=this.calcTransformMatrix(),c={x:r.left+s,y:r.top+r.topOffset+a},u=this.canvas.getRetinaScaling(),d=this.canvas.upperCanvasEl,h=d.width/u,f=d.height/u,p=h-a,g=f-a,m=d.clientWidth/h,v=d.clientHeight/f;return c=t.util.transformPoint(c,l),(c=t.util.transformPoint(c,this.canvas.viewportTransform)).x*=m,c.y*=v,c.x<0&&(c.x=0),c.x>p&&(c.x=p),c.y<0&&(c.y=0),c.y>g&&(c.y=g),c.x+=this.canvas._offset.left,c.y+=this.canvas._offset.top,{left:c.x+"px",top:c.y+"px",fontSize:a+"px",charHeight:a}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var e=this._textBeforeEdit!==this.text,t=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,t&&(t.blur&&t.blur(),t.parentNode&&t.parentNode.removeChild(t)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),e&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),e&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var e in this.styles)this._textLines[e]||delete this.styles[e]},removeStyleFromTo:function(e,t){var r,n,i=this.get2DCursorLocation(e,!0),o=this.get2DCursorLocation(t,!0),a=i.lineIndex,s=i.charIndex,l=o.lineIndex,c=o.charIndex;if(a!==l){if(this.styles[a])for(r=s;r<this._unwrappedTextLines[a].length;r++)delete this.styles[a][r];if(this.styles[l])for(r=c;r<this._unwrappedTextLines[l].length;r++)(n=this.styles[l][r])&&(this.styles[a]||(this.styles[a]={}),this.styles[a][s+r-c]=n);for(r=a+1;r<=l;r++)delete this.styles[r];this.shiftLineStyles(l,a-l)}else if(this.styles[a]){n=this.styles[a];var u,d,h=c-s;for(r=s;r<c;r++)delete n[r];for(d in this.styles[a])(u=parseInt(d,10))>=c&&(n[u-h]=n[d],delete n[d])}},shiftLineStyles:function(t,r){var n=e(this.styles);for(var i in this.styles){var o=parseInt(i,10);o>t&&(this.styles[o+r]=n[o],n[o-r]||delete this.styles[o])}},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(t,r,n,i){var o,a={},s=!1,l=this._unwrappedTextLines[t].length===r;for(var c in n||(n=1),this.shiftLineStyles(t,n),this.styles[t]&&(o=this.styles[t][0===r?r:r-1]),this.styles[t]){var u=parseInt(c,10);u>=r&&(s=!0,a[u-r]=this.styles[t][c],l&&0===r||delete this.styles[t][c])}var d=!1;for(s&&!l&&(this.styles[t+n]=a,d=!0),d&&n--;n>0;)i&&i[n-1]?this.styles[t+n]={0:e(i[n-1])}:o?this.styles[t+n]={0:e(o)}:delete this.styles[t+n],n--;this._forceClearCache=!0},insertCharStyleObject:function(t,r,n,i){this.styles||(this.styles={});var o=this.styles[t],a=o?e(o):{};for(var s in n||(n=1),a){var l=parseInt(s,10);l>=r&&(o[l+n]=a[l],a[l-n]||delete o[l])}if(this._forceClearCache=!0,i)for(;n--;)Object.keys(i[n]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][r+n]=e(i[n]));else if(o)for(var c=o[r?r-1:1];c&&n--;)this.styles[t][r+n]=e(c)},insertNewStyleBlock:function(e,t,r){for(var n=this.get2DCursorLocation(t,!0),i=[0],o=0,a=0;a<e.length;a++)"\n"===e[a]?i[++o]=0:i[o]++;i[0]>0&&(this.insertCharStyleObject(n.lineIndex,n.charIndex,i[0],r),r=r&&r.slice(i[0]+1)),o&&this.insertNewlineStyleObject(n.lineIndex,n.charIndex+i[0],o);for(a=1;a<o;a++)i[a]>0?this.insertCharStyleObject(n.lineIndex+a,0,i[a],r):r&&this.styles[n.lineIndex+a]&&r[0]&&(this.styles[n.lineIndex+a][0]=r[0]),r=r&&r.slice(i[a]+1);i[a]>0&&this.insertCharStyleObject(n.lineIndex+a,0,i[a],r)},setSelectionStartEndWithShift:function(e,t,r){r<=e?(t===e?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=e),this.selectionStart=r):r>e&&r<t?"right"===this._selectionDirection?this.selectionEnd=r:this.selectionStart=r:(t===e?this._selectionDirection="right":"left"===this._selectionDirection&&(this._selectionDirection="right",this.selectionStart=t),this.selectionEnd=r)},setSelectionInBoundaries:function(){var e=this.text.length;this.selectionStart>e?this.selectionStart=e:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>e?this.selectionEnd=e:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(e){if(this.canvas){this.__newClickTime=+new Date;var t=e.pointer;this.isTripleClick(t)&&(this.fire("tripleclick",e),this._stopEvent(e.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=t,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(e){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===e.x&&this.__lastPointer.y===e.y},_stopEvent:function(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(e){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(e.e))},tripleClickHandler:function(e){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(e.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(e){!this.canvas||!this.editable||e.e.button&&1!==e.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(e.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(e){!this.canvas||!this.editable||e.e.button&&1!==e.e.button||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler),this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(e){if(this.__isMousedown=!1,!(!this.editable||this.group||e.transform&&e.transform.actionPerformed||e.e.button&&1!==e.e.button)){if(this.canvas){var t=this.canvas._activeObject;if(t&&t!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(e.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(e){var t=this.getSelectionStartFromPointer(e),r=this.selectionStart,n=this.selectionEnd;e.shiftKey?this.setSelectionStartEndWithShift(r,n,t):(this.selectionStart=t,this.selectionEnd=t),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(e){for(var t,r=this.getLocalPointer(e),n=0,i=0,o=0,a=0,s=0,l=0,c=this._textLines.length;l<c&&o<=r.y;l++)o+=this.getHeightOfLine(l)*this.scaleY,s=l,l>0&&(a+=this._textLines[l-1].length+this.missingNewlineOffset(l-1));i=this._getLineLeftOffset(s)*this.scaleX,t=this._textLines[s],"rtl"===this.direction&&(r.x=this.width*this.scaleX-r.x+i);for(var u=0,d=t.length;u<d&&(n=i,(i+=this.__charBounds[s][u].kernedWidth*this.scaleX)<=r.x);u++)a++;return this._getNewSelectionStartFromOffset(r,n,i,a,d)},_getNewSelectionStartFromOffset:function(e,t,r,n,i){var o=e.x-t,a=r-e.x,s=n+(a>o||a<0?0:1);return this.flipX&&(s=i-s),s>this._text.length&&(s=this._text.length),s}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement("textarea"),this.hiddenTextarea.setAttribute("autocapitalize","off"),this.hiddenTextarea.setAttribute("autocorrect","off"),this.hiddenTextarea.setAttribute("autocomplete","off"),this.hiddenTextarea.setAttribute("spellcheck","false"),this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea",""),this.hiddenTextarea.setAttribute("wrap","off");var e=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+e.top+"; left: "+e.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: "+e.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},keysMapRtl:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorLeft",36:"moveCursorRight",37:"moveCursorRight",38:"moveCursorUp",39:"moveCursorLeft",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(e){if(this.isEditing){var t="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(e.keyCode in t)this[t[e.keyCode]](e);else{if(!(e.keyCode in this.ctrlKeysMapDown)||!e.ctrlKey&&!e.metaKey)return;this[this.ctrlKeysMapDown[e.keyCode]](e)}e.stopImmediatePropagation(),e.preventDefault(),e.keyCode>=33&&e.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(e){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:e.keyCode in this.ctrlKeysMapUp&&(e.ctrlKey||e.metaKey)&&(this[this.ctrlKeysMapUp[e.keyCode]](e),e.stopImmediatePropagation(),e.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(e){var r=this.fromPaste;if(this.fromPaste=!1,e&&e.stopPropagation(),this.isEditing){var n,i,o,a,s,l=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,c=this._text.length,u=l.length,d=u-c,h=this.selectionStart,f=this.selectionEnd,p=h!==f;if(""===this.hiddenTextarea.value)return this.styles={},this.updateFromTextArea(),this.fire("changed"),void(this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll()));var g=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),m=h>g.selectionStart;p?(n=this._text.slice(h,f),d+=f-h):u<c&&(n=m?this._text.slice(f+d,f):this._text.slice(h,h-d)),i=l.slice(g.selectionEnd-d,g.selectionEnd),n&&n.length&&(i.length&&(o=this.getSelectionStyles(h,h+1,!1),o=i.map(function(){return o[0]})),p?(a=h,s=f):m?(a=f-n.length,s=f):(a=f,s=f+n.length),this.removeStyleFromTo(a,s)),i.length&&(r&&i.join("")===t.copiedText&&!t.disableStyleCopyPaste&&(o=t.copiedTextStyle),this.insertNewStyleBlock(i,h,o)),this.updateFromTextArea(),this.fire("changed"),this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(e){this.compositionStart=e.target.selectionStart,this.compositionEnd=e.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(t.copiedText=this.getSelectedText(),t.disableStyleCopyPaste?t.copiedTextStyle=null:t.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(e){return e&&e.clipboardData||t.window.clipboardData},_getWidthBeforeCursor:function(e,t){var r,n=this._getLineLeftOffset(e);return t>0&&(n+=(r=this.__charBounds[e][t-1]).left+r.width),n},getDownCursorOffset:function(e,t){var r=this._getSelectionForOffset(e,t),n=this.get2DCursorLocation(r),i=n.lineIndex;if(i===this._textLines.length-1||e.metaKey||34===e.keyCode)return this._text.length-r;var o=n.charIndex,a=this._getWidthBeforeCursor(i,o),s=this._getIndexOnLine(i+1,a);return this._textLines[i].slice(o).length+s+1+this.missingNewlineOffset(i)},_getSelectionForOffset:function(e,t){return e.shiftKey&&this.selectionStart!==this.selectionEnd&&t?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(e,t){var r=this._getSelectionForOffset(e,t),n=this.get2DCursorLocation(r),i=n.lineIndex;if(0===i||e.metaKey||33===e.keyCode)return-r;var o=n.charIndex,a=this._getWidthBeforeCursor(i,o),s=this._getIndexOnLine(i-1,a),l=this._textLines[i].slice(0,o),c=this.missingNewlineOffset(i-1);return-this._textLines[i-1].length+s-l.length+(1-c)},_getIndexOnLine:function(e,t){for(var r,n,i=this._textLines[e],o=this._getLineLeftOffset(e),a=0,s=0,l=i.length;s<l;s++)if((o+=r=this.__charBounds[e][s].width)>t){n=!0;var c=o-r,u=o,d=Math.abs(c-t);a=Math.abs(u-t)<d?s:s-1;break}return n||(a=i.length-1),a},moveCursorDown:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",e)},moveCursorUp:function(e){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",e)},_moveCursorUpOrDown:function(e,t){var r=this["get"+e+"CursorOffset"](t,"right"===this._selectionDirection);t.shiftKey?this.moveCursorWithShift(r):this.moveCursorWithoutShift(r),0!==r&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(e){var t="left"===this._selectionDirection?this.selectionStart+e:this.selectionEnd+e;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,t),0!==e},moveCursorWithoutShift:function(e){return e<0?(this.selectionStart+=e,this.selectionEnd=this.selectionStart):(this.selectionEnd+=e,this.selectionStart=this.selectionEnd),0!==e},moveCursorLeft:function(e){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",e)},_move:function(e,t,r){var n;if(e.altKey)n=this["findWordBoundary"+r](this[t]);else{if(!e.metaKey&&35!==e.keyCode&&36!==e.keyCode)return this[t]+="Left"===r?-1:1,!0;n=this["findLineBoundary"+r](this[t])}if(typeof n<"u"&&this[t]!==n)return this[t]=n,!0},_moveLeft:function(e,t){return this._move(e,t,"Left")},_moveRight:function(e,t){return this._move(e,t,"Right")},moveCursorLeftWithoutShift:function(e){var t=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(t=this._moveLeft(e,"selectionStart")),this.selectionEnd=this.selectionStart,t},moveCursorLeftWithShift:function(e){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(e,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(e,"selectionStart")):void 0},moveCursorRight:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",e)},_moveCursorLeftOrRight:function(e,t){var r="moveCursor"+e+"With";this._currentCursorOpacity=1,t.shiftKey?r+="Shift":r+="outShift",this[r](t)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(e){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(e,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(e,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(e){var t=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(t=this._moveRight(e,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,t},removeChars:function(e,t){typeof t>"u"&&(t=e+1),this.removeStyleFromTo(e,t),this._text.splice(e,t-e),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(e,r,n,i){typeof i>"u"&&(i=n),i>n&&this.removeStyleFromTo(n,i);var o=t.util.string.graphemeSplit(e);this.insertNewStyleBlock(o,n,r),this._text=[].concat(this._text.slice(0,n),o,this._text.slice(i)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var e=t.util.toFixed,r=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var e=this._getSVGLeftTopOffsets(),t=this._getSVGTextAndBg(e.textTop,e.textLeft);return this._wrapSVGTextAndBg(t)},toSVG:function(e){return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(e){var t=this.getSvgTextDecoration(this);return[e.textBgRects.join(""),'\t\t<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",t?'text-decoration="'+t+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",e.textSpans.join(""),"</text>\n"]},_getSVGTextAndBg:function(e,t){var r,n=[],i=[],o=e;this._setSVGBg(i);for(var a=0,s=this._textLines.length;a<s;a++)r=this._getLineLeftOffset(a),(this.textBackgroundColor||this.styleHas("textBackgroundColor",a))&&this._setSVGTextLineBg(i,a,t+r,o),this._setSVGTextLineText(n,a,t+r,o),o+=this.getHeightOfLine(a);return{textSpans:n,textBgRects:i}},_createTextCharSpan:function(n,i,o,a){var s=n!==n.trim()||n.match(r),l=this.getSvgSpanStyles(i,s),c=l?'style="'+l+'"':"",u=i.deltaY,d="",h=t.Object.NUM_FRACTION_DIGITS;return u&&(d=' dy="'+e(u,h)+'" '),['<tspan x="',e(o,h),'" y="',e(a,h),'" ',d,c,">",t.util.string.escapeXml(n),"</tspan>"].join("")},_setSVGTextLineText:function(e,r,n,i){var o,a,s,l,c,u=this.getHeightOfLine(r),d=-1!==this.textAlign.indexOf("justify"),h="",f=0,p=this._textLines[r];i+=u*(1-this._fontSizeFraction)/this.lineHeight;for(var g=0,m=p.length-1;g<=m;g++)c=g===m||this.charSpacing,h+=p[g],s=this.__charBounds[r][g],0===f?(n+=s.kernedWidth-s.width,f+=s.width):f+=s.kernedWidth,d&&!c&&this._reSpaceAndTab.test(p[g])&&(c=!0),c||(o=o||this.getCompleteStyleDeclaration(r,g),a=this.getCompleteStyleDeclaration(r,g+1),c=t.util.hasStyleChanged(o,a,!0)),c&&(l=this._getStyleDeclaration(r,g)||{},e.push(this._createTextCharSpan(h,l,n,i)),h="",o=a,n+=f,f=0)},_pushTextBgRect:function(r,n,i,o,a,s){var l=t.Object.NUM_FRACTION_DIGITS;r.push("\t\t<rect ",this._getFillAttributes(n),' x="',e(i,l),'" y="',e(o,l),'" width="',e(a,l),'" height="',e(s,l),'"></rect>\n')},_setSVGTextLineBg:function(e,t,r,n){for(var i,o,a=this._textLines[t],s=this.getHeightOfLine(t)/this.lineHeight,l=0,c=0,u=this.getValueOfPropertyAt(t,0,"textBackgroundColor"),d=0,h=a.length;d<h;d++)i=this.__charBounds[t][d],(o=this.getValueOfPropertyAt(t,d,"textBackgroundColor"))!==u?(u&&this._pushTextBgRect(e,u,r+c,n,l,s),c=i.left,l=i.width,u=o):l+=i.kernedWidth;o&&this._pushTextBgRect(e,o,r+c,n,l,s)},_getFillAttributes:function(e){var r=e&&"string"==typeof e?new t.Color(e):"";return r&&r.getSource()&&1!==r.getAlpha()?'opacity="'+r.getAlpha()+'" fill="'+r.setAlpha(1).toRgb()+'"':'fill="'+e+'"'},_getSVGLineTopOffset:function(e){for(var t,r=0,n=0;n<e;n++)r+=this.getHeightOfLine(n);return t=this.getHeightOfLine(n),{lineTop:r,offset:(this._fontSizeMult-this._fontSizeFraction)*t/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(e){return t.Object.prototype.getSvgStyles.call(this,e)+" white-space: pre;"}})}(),function(e){var t=e.fabric||(e.fabric={});t.Textbox=t.util.createClass(t.IText,t.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:t.Text.prototype._dimensionAffectingProps.concat("width"),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),-1!==this.textAlign.indexOf("justify")&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(e){for(var t=0,r=0,n=0,i={},o=0;o<e.graphemeLines.length;o++)"\n"===e.graphemeText[n]&&o>0?(r=0,n++,t++):!this.splitByGrapheme&&this._reSpaceAndTab.test(e.graphemeText[n])&&o>0&&(r++,n++),i[o]={line:t,offset:r},n+=e.graphemeLines[o].length,r+=e.graphemeLines[o].length;return i},styleHas:function(e,r){if(this._styleMap&&!this.isWrapping){var n=this._styleMap[r];n&&(r=n.line)}return t.Text.prototype.styleHas.call(this,e,r)},isEmptyStyles:function(e){if(!this.styles)return!0;var t,r,n=0,i=!1,o=this._styleMap[e],a=this._styleMap[e+1];for(var s in o&&(e=o.line,n=o.offset),a&&(i=a.line===e,t=a.offset),r=typeof e>"u"?this.styles:{line:this.styles[e]})for(var l in r[s])if(l>=n&&(!i||l<t))for(var c in r[s][l])return!1;return!0},_getStyleDeclaration:function(e,t){if(this._styleMap&&!this.isWrapping){var r=this._styleMap[e];if(!r)return null;e=r.line,t=r.offset+t}return this.callSuper("_getStyleDeclaration",e,t)},_setStyleDeclaration:function(e,t,r){var n=this._styleMap[e];e=n.line,t=n.offset+t,this.styles[e][t]=r},_deleteStyleDeclaration:function(e,t){var r=this._styleMap[e];e=r.line,t=r.offset+t,delete this.styles[e][t]},_getLineStyle:function(e){var t=this._styleMap[e];return!!this.styles[t.line]},_setLineStyle:function(e){var t=this._styleMap[e];this.styles[t.line]={}},_wrapText:function(e,t){var r,n=[];for(this.isWrapping=!0,r=0;r<e.length;r++)n=n.concat(this._wrapLine(e[r],r,t));return this.isWrapping=!1,n},_measureWord:function(e,t,r){var n,i=0;r=r||0;for(var o=0,a=e.length;o<a;o++){i+=this._getGraphemeBox(e[o],t,o+r,n,true).kernedWidth,n=e[o]}return i},_wrapLine:function(e,r,n,i){var o=0,a=this.splitByGrapheme,s=[],l=[],c=a?t.util.string.graphemeSplit(e):e.split(this._wordJoiners),u="",d=0,h=a?"":" ",f=0,p=0,g=0,m=!0,v=this._getWidthOfCharSpacing();i=i||0;0===c.length&&c.push([]),n-=i;for(var y=0;y<c.length;y++)u=a?c[y]:t.util.string.graphemeSplit(c[y]),f=this._measureWord(u,r,d),d+=u.length,(o+=p+f-v)>n&&!m?(s.push(l),l=[],o=f,m=!0):o+=v,!m&&!a&&l.push(h),l=l.concat(u),p=a?0:this._measureWord([h],r,d),d++,m=!1,f>g&&(g=f);return y&&s.push(l),g+i>this.dynamicMinWidth&&(this.dynamicMinWidth=g-v+i),s},isEndOfWrapping:function(e){return!this._styleMap[e+1]||this._styleMap[e+1].line!==this._styleMap[e].line},missingNewlineOffset:function(e){return this.splitByGrapheme?this.isEndOfWrapping(e)?1:0:1},_splitTextIntoLines:function(e){for(var r=t.Text.prototype._splitTextIntoLines.call(this,e),n=this._wrapText(r.lines,this.width),i=new Array(n.length),o=0;o<n.length;o++)i[o]=n[o].join("");return r.lines=i,r.graphemeLines=n,r},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var e={};for(var t in this._styleMap)this._textLines[t]&&(e[this._styleMap[t].line]=1);for(var t in this.styles)e[t]||delete this.styles[t]},toObject:function(e){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(e))}}),t.Textbox.fromObject=function(e,r){var n=t.util.stylesFromArray(e.styles,e.text),i=Object.assign({},e,{styles:n});return t.Object._fromObject("Textbox",i,r,"text")}}(e),function(){var e=t.controlsUtils,r=e.scaleSkewCursorStyleHandler,n=e.scaleCursorStyleHandler,i=e.scalingEqually,o=e.scalingYOrSkewingX,a=e.scalingXOrSkewingY,s=e.scaleOrSkewActionName,l=t.Object.prototype.controls;if(l.ml=new t.Control({x:-.5,y:0,cursorStyleHandler:r,actionHandler:a,getActionName:s}),l.mr=new t.Control({x:.5,y:0,cursorStyleHandler:r,actionHandler:a,getActionName:s}),l.mb=new t.Control({x:0,y:.5,cursorStyleHandler:r,actionHandler:o,getActionName:s}),l.mt=new t.Control({x:0,y:-.5,cursorStyleHandler:r,actionHandler:o,getActionName:s}),l.tl=new t.Control({x:-.5,y:-.5,cursorStyleHandler:n,actionHandler:i}),l.tr=new t.Control({x:.5,y:-.5,cursorStyleHandler:n,actionHandler:i}),l.bl=new t.Control({x:-.5,y:.5,cursorStyleHandler:n,actionHandler:i}),l.br=new t.Control({x:.5,y:.5,cursorStyleHandler:n,actionHandler:i}),l.mtr=new t.Control({x:0,y:-.5,actionHandler:e.rotationWithSnapping,cursorStyleHandler:e.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),t.Textbox){var c=t.Textbox.prototype.controls={};c.mtr=l.mtr,c.tr=l.tr,c.br=l.br,c.tl=l.tl,c.bl=l.bl,c.mt=l.mt,c.mb=l.mb,c.mr=new t.Control({x:.5,y:0,actionHandler:e.changeWidth,cursorStyleHandler:r,actionName:"resizing"}),c.ml=new t.Control({x:-.5,y:0,actionHandler:e.changeWidth,cursorStyleHandler:r,actionName:"resizing"})}}()}(lC);const uC={lockScalingFlip:!0,originY:"center",originX:"center",lockMovementX:!0,lockMovementY:!0,borderColor:"transparent"};function dC(e=36){let t="";const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let n=0;n<e;n+=1)t+=r.charAt(Math.floor(62*Math.random()));return t}let hC=null;function fC(e){hC=e}class pC{constructor(){ml(this,"maxZoom",2),ml(this,"minZoom",1),ml(this,"step",.05),this.allowUserZoom&&this.bindMouseWheel(),Cm.subscribe(e=>e.stageSize,()=>{setTimeout(()=>{this.fitToScreen()},1)})}get allowUserZoom(){var e,t,r;return(null==(r=null==(t=null==(e=_m().config)?void 0:e.tools)?void 0:t.zoom)?void 0:r.allowUserZoom)??!0}get currentZoom(){return _m().zoom}zoomIn(e=this.step){this.set(this.currentZoom+e)}canZoomIn(e=this.step){return this.currentZoom+e<=this.maxZoom}canZoomOut(e=this.step){return this.currentZoom-e>=this.minZoom}zoomOut(e=this.step){this.set(this.currentZoom-e)}set(e,t=!0){if(e<this.minZoom||e>this.maxZoom)return;const r=El.round(_m().original.width*e,0),n=El.round(_m().original.height*e,0);Am().setZoom(e),t&&Am().setDimensions({width:r,height:n}),_m().setZoom(e)}fitToScreen(){var e,t;if(null==(t=null==(e=_m().config.tools)?void 0:e.zoom)||!t.fitImageToScreen)return;const{width:r,height:n}=_m().stageSize,i=Math.max(n,1),o=Math.max(r,1);if(_m().original.height>i||_m().original.width>o){const e=Math.min(i/_m().original.height,o/_m().original.width);this.minZoom=Math.min(e,1)}else this.minZoom=1;this.set(this.minZoom)}bindMouseWheel(){Am().on("mouse:wheel",e=>{e.e.preventDefault(),e.e.stopPropagation(),null==hC&&(e.e.deltaY<0?this.zoomIn():this.zoomOut())})}}function gC(e){return new Promise(t=>{lC.fabric.util.loadImage(e,e=>t(new lC.fabric.Image(e)),null,_m().config.crossOrigin?"anonymous":void 0)})}function mC(){return!(_m().config.image||_m().config.blankCanvasSize||Am()&&0!==Am().getObjects().length)}class vC{constructor(){ml(this,"minWidth",50),ml(this,"minHeight",50)}resize(e,t,{applyZoom:r=!1,resizeHelper:n=!0}={}){const i=_m().zoom;Am().setWidth(e*(r?i:1)),Am().setHeight(t*(r?i:1)),_m().setOriginal(e,t),n&&Sm().transform.resetStraightenAnchor()}async addMainImage(e,t="mainImage"){var r,n;_m().toggleLoading(t);const i=await gC(e);if(i)return this.clear(),i.set(Im),i.name=mg.MainImage,Am().add(i),this.resize(i.width,i.height),i.center(),i.setCoords(),Sm().zoom.fitToScreen(),_m().toggleLoading(!1),null==(n=(r=_m().config).onMainImageLoaded)||n.call(r,i),i}openNew(e,t,r){return e=Math.max(this.minWidth,e),t=Math.max(this.minHeight,t),this.clear(),this.resize(e,t),Am().backgroundColor=r,Sm().zoom.fitToScreen(),_m().toggleLoading("newCanvas"),requestAnimationFrame(()=>{_m().toggleLoading(!1)}),Promise.resolve({width:e,height:t})}getMainImage(){return Am().getObjects().find(e=>e.name===mg.MainImage)}render(){Am().requestRenderAll()}async loadInitialContent(){var e,t;const r=_m().config.image,n=_m().config.blankCanvasSize,i=_m().config.state;if(r&&r.endsWith("json")){const e=await Em(r);await Sm().import.loadState(e)}else r&&r.startsWith('{"canvas')?await Sm().import.loadState(r):r?await this.addMainImage(r):i?await Sm().import.loadState(i):n&&await this.openNew(n.width,n.height);return mC()&&null!=(t=null==(e=_m().config.ui)?void 0:e.openImageDialog)&&t.show&&_m().togglePanel("newImage",!0),new Promise(e=>{setTimeout(()=>{Sm().history.addInitial(),e()},10)})}clear(){Am().clear(),Sm().frame.remove(),Sm().transform.resetStraightenAnchor()}}const yC=["fontSize","fontFamily","left","top","width","height","scaleX","scaleY","flipX","flipY","angle","src","strokeWidth"];function bC(e={}){Am().fire("object:modified",function(e){return{values:e,sizeOrPositionChanged:wC(e)}}(e))}function wC(e){return Object.keys(e).some(e=>yC.includes(e))}function xC(e){var t,r;const[n]=Om(null==(t=e.selected)?void 0:t[0]),i=n===_m().activeTool;return!(!_m().dirty||null!=(r=e.selected)&&r[0]&&i)&&(e.deselected&&Sm().objects.select(e.deselected[0]),!0)}function CC(e){(null==e?void 0:e.data.id)!==_m().objects.active.id&&(_m().objects.setActive(e??null),_m().activeTool!==nf.DRAW&&Fm())}class _C{constructor(){this.syncObjects(),_m().fabric.on("selection:created",e=>{var t;null!=(t=e.selected)&&t[0]&&!xC(e)&&CC(e.selected[0])}),_m().fabric.on("selection:updated",e=>{var t;xC(e)||CC(null==(t=e.selected)?void 0:t[0])}),_m().fabric.on("selection:cleared",()=>{CC()}),_m().fabric.on("text:editing:entered",()=>{_m().objects.setIsEditingText(!0)}),_m().fabric.on("text:editing:exited",()=>{_m().objects.setIsEditingText(!1)}),_m().fabric.on("object:added",()=>{this.syncObjects()}),_m().fabric.on("object:removed",()=>{this.syncObjects()})}getAll(){return Am().getObjects().filter(e=>{var t;return!(null!=(t=null==e?void 0:e.data)&&t.pixieInternal)})}get(e){return this.getAll().find(t=>t.name===e)}getById(e){return this.getAll().find(t=>t.data.id===e)}isActive(e){var t;const r="string"==typeof e?e:e.data.id;return(null==(t=_m().objects.active)?void 0:t.id)===r}getActive(){return Am().getActiveObject()}has(e){return this.getAll().findIndex(t=>t.name===e)>-1}select(e){const t="string"==typeof e?this.getById(e):e;t&&(Am().setActiveObject(t),Am().requestRenderAll())}deselectActive(){Am().discardActiveObject(),Am().requestRenderAll()}setValues(e,t){if(!(t=t||this.getActive()))return;let r=!1;(function(e){return e.name===mg.Sticker&&"forEachObject"in e})(t)&&e.fill&&e.fill!==t.fill&&t.forEachObject(t=>t.set("fill",e.fill)),gg(t)?((e.fontFamily!==t.fontFamily||e.fontSize!==t.fontSize)&&(r=!0),t.selectionStart!==t.selectionEnd?t.setSelectionStyles(e):t.set(e)):t.set(e),r?setTimeout(()=>{Am().requestRenderAll()},50):Am().requestRenderAll(),_m().objects.setActive(t),bC(e)}move(e,t=1,r){(r=r||this.getActive())&&("up"===e?this.setValues({top:r.top-t}):"down"===e?this.setValues({top:r.top+t}):"left"===e?this.setValues({left:r.left-t}):"right"===e&&this.setValues({left:r.left+t}),Sm().canvas.render())}bringToFront(e){(e=e||this.getActive())&&(e.bringToFront(),Sm().canvas.render())}sendToBack(e){(e=e||this.getActive())&&(e.sendToBack(),Sm().canvas.render())}flipHorizontally(e){(e=e||this.getActive())&&(this.setValues({flipX:!e.flipX}),Sm().canvas.render())}duplicate(e){const t=e||this.getActive();t&&(this.deselectActive(),t.clone(e=>{e.set({left:t.left+40,top:t.top+40,data:{...t.data,id:dC(10)},name:t.name}),Am().add(e),this.select(e),Sm().canvas.render()}))}delete(e){(e=e||this.getActive())&&(this.deselectActive(),Am().remove(e),Am().requestRenderAll(),Sm().history.addHistoryItem({name:"deletedObject"}))}syncObjects(){const e=this.getAll().map(e=>({name:e.name,selectable:e.selectable??!1,id:e.data.id}));Cm.setState({objects:{..._m().objects,all:e}})}}const SC={frame:null,fonts:[]};function AC(e){return e.state||(e.state=Tm()),{...e.state||Tm(),name:e.name,id:dC(15)}}function kC(e){return!!e&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(e)}function EC(e){return e?kC(e)?e:`${_m().config.baseUrl?`${_m().config.baseUrl}/`:""}${e}`:""}function IC(e,t){return t||btoa(e.split("/").pop())}const TC=new class{constructor(){ml(this,"loadedAssets",{})}loadAsset(e,t={type:"js"}){var r;e=e.startsWith("//")?`${window.location.protocol}${e}`:e;const n=null==(r=this.loadedAssets[e])?void 0:r.state;return"loaded"!==n||t.force?!n||this.loadedAssets[e].doc!==t.document||t.force&&"loaded"===n?(this.loadedAssets[e]={state:new Promise(r=>{const n={url:kC(e)?e:`assets/${e}`,id:IC(e,t.id),resolve:r,parentEl:t.parentEl,document:t.document};"css"===t.type?this.loadStyleAsset(n):this.loadScriptAsset(n)}),doc:t.document},this.loadedAssets[e].state):this.loadedAssets[e].state:new Promise(e=>e())}isLoadingOrLoaded(e){return null!=this.loadedAssets[e]}loadStyleAsset(e){var t;const r=e.document||document,n=e.parentEl||r.head,i=r.createElement("link"),o=IC(e.url,e.id);i.rel="stylesheet",i.id=o,i.href=e.url;try{n.querySelector(`#${o}`)&&(null==(t=n.querySelector(`#${o}`))||t.remove())}catch{}i.onload=()=>{this.loadedAssets[e.url].state="loaded",e.resolve()},n.appendChild(i)}loadScriptAsset(e){var t;const r=e.document||document,n=e.parentEl||r.body,i=r.createElement("script"),o=IC(e.url,e.id);i.async=!0,i.id=o,i.src=e.url;try{n.querySelector(`#${o}`)&&(null==(t=n.querySelector(`#${o}`))||t.remove())}catch{}i.onload=()=>{this.loadedAssets[e.url].state="loaded",e.resolve()},(n||n).appendChild(i)}};function FC(e){return`be-fonts-${e}`}function OC(e,t){const r=t.document||document,n=[],i=[];let o=[];if(e.forEach(e=>{"google"in e&&e.google?n.push(e):"src"in e&&i.push(e)}),null!=n&&n.length){const n=t.weights||[400],i=e.map(e=>`${e.family}:${n.join(",")}`).join("|"),a=TC.loadAsset(`https://fonts.googleapis.com/css?family=${i}&display=swap`,{type:"css",id:FC(t.id),force:t.forceAssetLoad,document:r});o.push(a)}if(null!=i&&i.length){const e=i.map(async e=>{const n=Array.from(r.fonts.values()).find(t=>t.family===e.family);if(n)return n.loaded;const i=new FontFace(e.family,`url(${null!=t&&t.prefixSrc?t.prefixSrc(e.src):e.src})`,e.descriptors);return r.fonts.add(i),i.load()});o=o.concat(e)}return Promise.all(o)}class PC{async undo(){if(this.canUndo()){const e=_m().history.items[_m().history.pointer-1];await this.load(e)}}async redo(){if(this.canRedo()){const e=_m().history.items[_m().history.pointer+1];await this.load(e)}}canUndo(){return _m().history.canUndo}canRedo(){return _m().history.canRedo}reload(){return this.load(_m().history.items[_m().history.pointer])}replaceCurrent(){const e=_m().history.items[_m().history.pointer];[..._m().history.items][_m().history.pointer]=AC({name:e.name,state:e})}addHistoryItem(e){const t=AC(e),r=[..._m().history.items.slice(0,_m().history.pointer+1),t];_m().history.update(r.length-1,r)}load(e){return e={...e,editor:e.editor||SC},new Promise(t=>{OC(function(e){const t=[];return e.forEach(e=>{var r,n,i;if(!gg(e))return;const o=null==(i=null==(n=null==(r=_m().config.tools)?void 0:r.text)?void 0:n.items)?void 0:i.find(t=>t.family===e.fontFamily);o&&t.push(o)}),t}(e.canvas.objects),{prefixSrc:EC,id:"pixie-fonts"}).finally(()=>{Am().loadFromJSON(e.canvas,()=>{Sm().zoom.set(1),e.canvasWidth&&e.canvasHeight&&Sm().canvas.resize(e.canvasWidth,e.canvasHeight,{resizeHelper:!1,applyZoom:!1}),Sm().frame.remove(),e.editor.frame&&Sm().frame.add(e.editor.frame.name,e.editor.frame.sizePercent),Sm().objects.syncObjects(),Sm().objects.getAll().forEach(e=>{var t,r;if(!e.data.pixieInternal&&"left"===e.originX&&"top"===e.originY){const t=e.getPointByOrigin("center","center");e.set("left",t.x),e.set("top",t.y)}e.set({...uC}),"i-text"===e.type&&(e.padding=null==(r=null==(t=_m().config.tools)?void 0:t.text)?void 0:r.controlsPadding)}),Sm().canvas.render(),Am().calcOffset(),Sm().zoom.fitToScreen(),_m().history.updatePointerById(e.id),Sm().transform.resetStraightenAnchor(),t()})})})}addInitial(e){!_m().history.items.find(e=>"initial"===e.name)&&(e||!mC())&&this.addHistoryItem({name:"initial",state:e})}}class MC{canMerge(){return Sm().objects.getAll().filter(e=>e.name!==mg.MainImage).length>0}async apply(){_m().toggleLoading("merge");const e=Sm().export.getDataUrl();e&&await Sm().canvas.addMainImage(e,"merge")}}const RC=[{name:"grayscale"},{name:"blackWhite",fabricType:"blackwhite"},{name:"sharpen",uses:"Convolute",matrix:[0,-1,0,-1,5,-1,0,-1,0]},{name:"invert"},{name:"vintage"},{name:"polaroid"},{name:"kodachrome"},{name:"technicolor"},{name:"brownie"},{name:"sepia"},{name:"removeColor",fabricType:"removecolor",options:{distance:{type:"slider",current:.1,min:0,max:1,step:.01},color:{current:"#fff",type:"colorPicker"}}},{name:"brightness",options:{brightness:{type:"slider",current:.1,min:-1,max:1,step:.1}}},{name:"gamma",options:{red:{type:"slider",current:.1,min:.2,max:2.2,step:.003921},green:{type:"slider",current:.1,min:.2,max:2.2,step:.003921},blue:{type:"slider",current:.1,min:.2,max:2.2,step:.003921}},apply:e=>{e.gamma=[e.red,e.green,e.blue]}},{name:"noise",options:{noise:{type:"slider",current:40,min:1,max:600}}},{name:"pixelate",options:{blocksize:{type:"slider",min:1,max:40,current:6}}},{name:"blur",uses:"Convolute",matrix:[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9]},{name:"emboss",uses:"Convolute",matrix:[1,1,1,1,.7,-1,-1,-1,-1]},{name:"blendColor",fabricType:"blendcolor",options:{alpha:{type:"slider",current:.5,min:.1,max:1,step:.1},mode:{current:"add",type:"select",available:[{key:"add"},{key:"multiply"},{key:"subtract"},{key:"diff"},{key:"screen"},{key:"lighten"},{key:"darken"}]},color:{type:"colorPicker",current:"#FF4081"}}}],LC={grayscale:Kh("grayscale"),blackWhite:Kh("Black & White"),sharpen:Kh("Sharpen"),invert:Kh("Invert"),vintage:Kh("Vintage"),polaroid:Kh("Polaroid"),kodachrome:Kh("Kodachrome"),technicolor:Kh("Technicolor"),brownie:Kh("Brownie"),sepia:Kh("Sepia"),removeColor:Kh("Remove Color"),brightness:Kh("Brightness"),gamma:Kh("Gamma"),noise:Kh("Noise"),pixelate:Kh("Pixelate"),blur:Kh("Blur"),emboss:Kh("Emboss"),blendColor:Kh("Blend Color")},NC={distance:Kh("distance"),color:Kh("color"),brightness:Kh("brightness"),red:Kh("red"),green:Kh("green"),blue:Kh("blue"),noise:Kh("noise"),blocksize:Kh("blocksize"),mode:Kh("mode"),alpha:Kh("alpha")};function jC(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}class DC{constructor(){Cm.subscribe(e=>e.history.pointer,()=>{this.syncState()})}apply(e){_m().filter.select(e,this.hasOptions(e));const t=this.getByName(e);if(this.isApplied(t.name))return void this.remove(t.name);const r=this.create(t);this.getImages().forEach(e=>{var t;null==(t=e.filters)||t.push(r),e.applyFilters()}),this.syncState(),Sm().canvas.render()}remove(e){_m().filter.deselect(e);const t=this.getByName(e);this.getImages().forEach(e=>{var r;const n=this.findFilterIndex(t.name,e.filters);null==(r=e.filters)||r.splice(n,1),e.applyFilters()}),this.syncState(),Sm().canvas.render()}getAll(){return RC}getByName(e){return RC.find(t=>t.name===e)}isApplied(e){const t=Sm().canvas.getMainImage();return!!t&&this.findFilterIndex(e,t.filters)>-1}applyValue(e,t,r){const n=this.getByName(e);this.getImages().forEach(e=>{const i=(e.filters||[]).find(e=>e.type.toLowerCase()===n.name.toLowerCase());i&&(i[t]=r,n.apply&&n.apply(i,t,r),e.applyFilters())}),Sm().canvas.render()}addCustom(e,t,r,n){const i=lC.fabric.Image.filters;i[jC(e)]=lC.fabric.util.createClass(i.BaseFilter,t),i[jC(e)].fromObject=i.BaseFilter.fromObject,RC.push({name:e,options:r,initialConfig:n})}create(e){const t=e.initialConfig||{};let r;return e.uses?(t.matrix=e.matrix,r=new(lC.fabric.Image.filters[jC(e.uses)])(t)):(Object.entries(e.options||{}).forEach(([e,r])=>{t[e]=r.current}),r=new(lC.fabric.Image.filters[jC(e.name)])(t)),r.name=e.name,r}hasOptions(e){return!!this.getByName(e).options}findFilterIndex(e,t){if(null==t||!t.length)return-1;const r=this.getByName(e);return t.findIndex(e=>this.configMatchesFabricFilter(r,e))}syncState(){var e;const t=[];((null==(e=this.getImages()[0])?void 0:e.filters)||[]).forEach(e=>{const r=this.getByFabricFilter(e);r&&t.push(r.name)}),Cm.setState({filter:{..._m().filter,applied:t}})}getByFabricFilter(e){return RC.find(t=>this.configMatchesFabricFilter(t,e))}configMatchesFabricFilter(e,t){const r=t.type.toLowerCase().replace(" ","");return r===e.fabricType||r===e.name||"convolute"===r&&this.matrixAreEqual(e.matrix,t.matrix)}matrixAreEqual(e,t){if(!e||!t||e.length!==t.length)return!1;for(let r=e.length;r--;)if(e[r]!==t[r])return!1;return!0}getImages(){return Sm().objects.getAll().filter(e=>e.name===mg.Image||e.name===mg.MainImage)}}function zC(e){var t,r;const n=(null==(r=null==(t=_m().config.tools)?void 0:t.resize)?void 0:r.minWidth)||50;return e?Math.ceil(100*n/_m().original.width):n}function BC(e){var t,r;const n=(null==(r=null==(t=_m().config.tools)?void 0:t.resize)?void 0:r.maxWidth)||2400;return e?Math.ceil(100*n/_m().original.width):n}function UC(e){var t,r;const n=(null==(r=null==(t=_m().config.tools)?void 0:t.resize)?void 0:r.minHeight)||50;return e?Math.ceil(100*n/_m().original.height):n}function VC(e){var t,r;const n=(null==(r=null==(t=_m().config.tools)?void 0:t.resize)?void 0:r.maxHeight)||2400;return e?Math.ceil(100*n/_m().original.height):n}function HC(e,t){if(t)return e;const r=_m().original.height/e;return Math.floor(_m().original.width/r)}function WC(e,t){if(t)return e;const r=_m().original.width/e;return Math.floor(_m().original.height/r)}class $C{apply(e){const{width:t,height:r,usePercentages:n}=function(e){return e.width<zC(e.usePercentages)&&(e.width=zC(e.usePercentages),e.maintainAspect&&(e.height=WC(e.width,e.usePercentages))),e.width>BC(e.usePercentages)&&(e.width=BC(e.usePercentages),e.maintainAspect&&(e.height=WC(e.width,e.usePercentages))),e.height<UC(e.usePercentages)&&(e.height=UC(e.usePercentages),e.maintainAspect&&(e.width=HC(e.height,e.usePercentages))),e.height>VC(e.usePercentages)&&(e.height=VC(e.usePercentages),e.maintainAspect&&(e.width=HC(e.height,e.usePercentages))),e}(e),i=Math.ceil(_m().original.width),o=Math.ceil(_m().original.height),a=Math.ceil(t),s=Math.ceil(r);let l,c;n?(l=t/100,c=r/100):(l=t/_m().original.width,c=r/_m().original.height),(i!==a||o!==s)&&this.resize(l,c)}resize(e,t){Sm().zoom.set(1,!1);const r=Math.round(_m().original.height*t),n=Math.round(_m().original.width*e);Sm().canvas.resize(n,r,{applyZoom:!1,resizeHelper:!0}),Sm().objects.getAll().forEach(r=>{const n=r.scaleX||1,i=r.scaleY||1,o=r.left||0,a=r.top||0,s=n*e,l=i*t,c=o*e,u=a*t;r.scaleX=s,r.scaleY=l,r.left=c,r.top=u,r.setCoords()}),Sm().zoom.fitToScreen(),Am().requestRenderAll()}}function qC(e,t){null!==t.innerZone&&(function(e,t){t.innerZone.style.width=`${e.width}px`,t.innerZone.style.height=`${e.height}px`,t.innerZone.style.transform=`translate(${e.left}px, ${e.top}px)`}(e,t),function(e,t){const r=_m().canvasSize.width,n=_m().canvasSize.height;t.maskTop.style.height=`${e.top}px`,t.maskTop.style.width=`${r}px`,t.maskLeft.style.top=`${e.top}px`,t.maskLeft.style.height=`${e.height}px`,t.maskLeft.style.width=`${e.left}px`;const i=e.left+e.width;t.maskRight.style.left=`${i}px`,t.maskRight.style.top=`${e.top}px`,t.maskRight.style.height=`${e.height}px`,t.maskRight.style.width=r-i+"px",t.maskBottom.style.height=n-(e.top+e.height)+"px",t.maskBottom.style.width=`${r}px`}(e,t),function(e,t){const r=(e.width-2)/3;t.lineVer1.style.height=`${e.height}px`,t.lineVer1.style.transform=`translate(${r}px, 0)`,t.lineVer2.style.height=`${e.height}px`,t.lineVer2.style.transform=`translate(${2*r}px, 0)`;const n=(e.height-2)/3;t.lineHor1.style.width=`${e.width}px`,t.lineHor1.style.transform=`translate(0, ${n}px)`,t.lineHor2.style.width=`${e.width}px`,t.lineHor2.style.transform=`translate(0, ${2*n}px)`}(e,t))}function GC(e,t,r){let n=t,i=r;return e&&(r*e>t?i=t/e:n=r*e),{width:Math.floor(n),height:Math.floor(i)}}function YC(e){if(!e)return null;const t=e.split(":");return parseInt(t[0])/parseInt(t[1])}class XC{constructor(){ml(this,"refs",null)}apply(e){var t;const r=null==(t=Sm().frame.active.config)?void 0:t.name,n=Sm().frame.active.currentSizeInPercent;return Sm().frame.active.hide(),Sm().merge.apply().then(()=>{Sm().canvas.resize(Math.round(e.width),Math.round(e.height),{applyZoom:!0,resizeHelper:!0});const t=Sm().canvas.getMainImage();t.cropX=Math.round(e.left),t.cropY=Math.round(e.top),t.width=Math.round(e.width),t.height=Math.round(e.height),t.viewportCenter(),r&&Sm().frame.add(r,n),Sm().zoom.fitToScreen(),Sm().canvas.render()})}drawZone(e){var t;null!=(t=this.refs)&&t.current&&(_m().crop.setCropzoneRect(e),qC(e,this.refs.current))}resetCropzone(e){const t=_m().canvasSize,r=YC(e);if(!t)return;_m().crop.setAspectRatio(e);const n=function(e,t=null){const r={width:e.width,height:e.height,top:0,left:0,angle:0};if(t){const e=GC(t,r.width,r.height);r.width=e.width,r.height=e.height}return r.left=(e.width-r.width)/2,r.top=(e.height-r.height)/2,r}(t,r);this.drawZone(n)}registerRefs(e){this.refs=e}}class KC{getShapeByName(e){var t,r;const n=null==(r=null==(t=_m().config.tools)?void 0:t.shapes)?void 0:r.items;return(null==n?void 0:n.find(t=>t.name===e))||null}addBasicShape(e){var t;const r=this.getShapeByName(e);if(!r)return null;const{width:n,height:i,...o}=(null==(t=_m().config.objectDefaults)?void 0:t.shape)||{},a={...o,...r.options};let s;if("circle"===r.name)s=new lC.fabric.Circle({...a,radius:100});else if("ellipse"===r.name)s=new lC.fabric.Ellipse({...a,rx:100,ry:50});else if("Path"===r.type)s=new lC.fabric.Path(a.path,{displayName:r.name,...a});else{const e=r.type;s=new lC.fabric[e]({...a,width:150,height:150})}return this.addAndPositionShape(s,mg.Shape,{width:n,height:i}),s}addSticker(e,t){var r,n,i;const o=null==(i=null==(n=null==(r=_m().config.tools)?void 0:r.stickers)?void 0:n.items)?void 0:i.find(t=>t.name===e);if(!o)return Promise.resolve();if("svg"===o.type){const e=ZC(o,t);return this.addSvgSticker(e)}return this.addRegularSticker(o,t)}addRegularSticker(e,t){return new Promise(r=>{lC.fabric.util.loadImage(ZC(e,t),e=>{var t;const{width:n,height:i,...o}=(null==(t=_m().config.objectDefaults)?void 0:t.sticker)||{},a=new lC.fabric.Image(e,o);this.addAndPositionShape(a,mg.Sticker,{width:n,height:i}),r()})})}addSvgSticker(e,t=mg.Sticker){return new Promise(r=>{lC.fabric.loadSVGFromURL(e,(e,n)=>{var i;const{width:o,height:a,...s}=(null==(i=_m().config.objectDefaults)?void 0:i.sticker)||{},l=lC.fabric.util.groupSVGElements(e,n);l.set(s),this.addAndPositionShape(l,t,{width:o,height:a}),r()})})}addAndPositionShape(e,t,{width:r}){e.name=t,e.scaleX=1,e.scaleY=1,Am().add(e);const n=r||_m().original.width*_m().zoom/4;e.scaleToWidth(Math.min(150,n)),e.viewportCenter(),e.setCoords(),Sm().canvas.render(),Am().setActiveObject(e)}}function ZC(e,t){return EC(`images/stickers/${e.name}/${t}.${e.type}`)}class JC{constructor(e){ml(this,"patternCache",[]),this.activeFrame=e}fillParts(e){this.patternCache.forEach(t=>{this.fillPartWithPattern(t,e)})}fillPartWithPattern(e,t){if(!this.activeFrame.parts)return;e.canvas=new lC.fabric.StaticCanvas(null),e.canvas.add(e.img);const r=new lC.fabric.Pattern({source:e.canvas.getElement(),repeat:"repeat"===t?"repeat":"no-repeat"});this.activeFrame.parts[e.name]&&this.activeFrame.parts[e.name].set("fill",r)}scale(e){if(!this.activeFrame.config||!this.patternCache)return;const t=this.activeFrame.config.mode;e/=Am().getRetinaScaling(),this.patternCache.forEach(r=>{this.activeFrame.parts&&("top"===r.name||"bottom"===r.name?"stretch"===t?(this.scalePatternToWidth(r.img,this.activeFrame.parts.top.getScaledWidth()),this.scalePatternToHeight(r.img,e)):r.img.scaleToHeight(e):"left"===r.name||"right"===r.name?"stretch"===t?(this.scalePatternToWidth(r.img,e),this.scalePatternToHeight(r.img,this.activeFrame.parts.left.getScaledHeight())):r.img.scaleToWidth(e):"stretch"===t?(this.scalePatternToWidth(r.img,e),this.scalePatternToHeight(r.img,e)):r.img.scaleToWidth(e),r.canvas.setDimensions({width:r.img.getScaledWidth(),height:r.img.getScaledHeight()}))}),Sm().canvas.render()}scalePatternToWidth(e,t){if(!e.width)return;const r=e.getBoundingRect().width/e.getScaledWidth();e.set("scaleX",t/e.width/r),e.setCoords()}scalePatternToHeight(e,t){if(!e.height)return;const r=e.getBoundingRect().height/e.getScaledHeight();e.set("scaleY",t/e.height/r),e.setCoords()}load(e){const t=this.activeFrame.getPartNames().map(t=>new Promise(r=>{const n={...Im,originX:"left",originY:"top"};_m().config.crossOrigin&&(n.crossOrigin="anonymous"),lC.fabric.Image.fromURL(this.getPartUrl(e,t),e=>{r({name:t,img:e})},n)}));return Promise.all(t).then(t=>{this.patternCache=t,this.fillParts(e.mode)})}getPartUrl(e,t){return EC(`images/frames/${e.name}/${t}.png`)}}class QC{constructor(e,t){this.activeFrame=e,this.patterns=t}get defaultColor(){var e,t;return null==(t=null==(e=_m().config.objectDefaults)?void 0:e.global)?void 0:t.fill}build(e,t){this.createParts(e),this.resize(t),this.activeFrame.config=e,"basic"!==e.mode?this.patterns.load(e).then(()=>{this.patterns.scale(t),Sm().canvas.render()}):Sm().canvas.render()}createParts(e){const t={};this.activeFrame.getPartNames().forEach(r=>{const n="basic"===e.mode?this.defaultColor:void 0;t[r]=new lC.fabric.Rect({...Im,fill:n,originX:"left",originY:"top",name:`frame.rect.${r}`,objectCaching:!1,data:{pixieInternal:!0}}),Am().add(t[r])}),this.activeFrame.parts=t}resize(e){const t=_m().original.width,r=_m().original.height,n=this.activeFrame,i=e;n.parts&&(n.parts.topLeft.set({width:i,height:i}),n.parts.topRight.set({left:t-n.parts.topLeft.getScaledWidth(),width:i,height:i}),n.parts.top.set({left:n.parts.topLeft.getScaledWidth()-1,width:t-n.parts.topLeft.getScaledWidth()-n.parts.topRight.getScaledWidth()+3,height:i}),n.parts.bottomLeft.set({top:r-n.parts.topLeft.getScaledHeight(),width:i,height:i}),n.parts.left.set({top:n.parts.topLeft.getScaledHeight()-1,width:i,height:r-n.parts.topLeft.getScaledHeight()-n.parts.bottomLeft.getScaledHeight()+3}),n.parts.bottomRight.set({left:t-n.parts.bottomLeft.getScaledWidth(),top:r-n.parts.topRight.getScaledWidth(),width:i,height:i}),n.parts.bottom.set({left:n.parts.top.left,top:r-n.parts.top.getScaledHeight(),width:n.parts.top.getScaledWidth(),height:i}),n.parts.right.set({left:t-n.parts.left.getScaledWidth(),top:n.parts.left.top,width:n.parts.left.width,height:n.parts.left.getScaledHeight()}))}}class e_{constructor(){ml(this,"corners",["topLeft","topRight","bottomLeft","bottomRight"]),ml(this,"sides",["top","right","bottom","left"]),ml(this,"parts",null),ml(this,"config",null),ml(this,"currentSizeInPercent",100)}getPartNames(){return[...this.corners,...this.sides]}hide(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!1})),Sm().canvas.render())}show(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!0})),Sm().canvas.render())}remove(){this.parts&&(this.config=null,Object.values(this.parts).forEach(e=>{Am().remove(e)}),this.parts=null,Sm().canvas.render())}is(e){return!!this.config&&this.config.name===e.name}changeColor(e){var t;"basic"!==(null==(t=this.config)?void 0:t.mode)||!this.parts||(Object.values(this.parts).forEach(t=>{t.set("fill",e)}),Sm().canvas.render())}getMinSize(){var e;return(null==(e=this.config)?void 0:e.size.min)??1}getMaxSize(){var e;return(null==(e=this.config)?void 0:e.size.max)??35}}class t_{constructor(){ml(this,"patterns"),ml(this,"builder"),ml(this,"active"),this.active=new e_,this.patterns=new JC(this.active),this.builder=new QC(this.active,this.patterns),Am().on("object:added",()=>{Object.values(this.active.parts||[]).forEach(e=>e.moveTo(98))})}add(e,t){const r=this.getByName(e);if(!r||this.active.is(r))return;this.active.remove(),this.active.currentSizeInPercent=t??r.size.default;const n=this.calcFrameSizeInPixels(this.active.currentSizeInPercent);this.builder.build(r,n),_m().frame.select(r)}resize(e){if(!this.active.parts||!this.active.config)return;e?this.active.currentSizeInPercent=e:e=this.active.currentSizeInPercent;const t=this.calcFrameSizeInPixels(e);this.builder.resize(t),this.patterns.scale(t),Sm().canvas.render()}changeColor(e){this.active.changeColor(e)}remove(){this.active.remove(),_m().frame.deselect()}getByName(e){var t,r;const n=null==(r=null==(t=_m().config.tools)?void 0:t.frame)?void 0:r.items;if(n)return n.find(t=>t.name===e)}getActiveFrameConfig(){return this.active.config}calcFrameSizeInPixels(e){const t=Math.min(_m().original.width,_m().original.height);return Math.ceil(e/100*t)}}class r_{constructor(){ml(this,"minWidth",250)}add(e,t={}){var r,n,i,o,a;if(!(e=e||(null==(n=null==(r=_m().config.tools)?void 0:r.text)?void 0:n.defaultText)))return;const s={...null==(i=_m().config.objectDefaults)?void 0:i.text,...t,name:mg.Text,padding:null==(a=null==(o=_m().config.tools)?void 0:o.text)?void 0:a.controlsPadding,editingBorderColor:Qh.fill},l=new lC.fabric.IText(e,s);Am().add(l),null==t.left&&null==t.top&&this.autoPositionText(l),Sm().objects.select(l)}autoPositionText(e){const t=Am().getWidth(),r=Am().getHeight(),n=Math.min(Am().getWidth(),this.minWidth);e.scaleToWidth(Math.max(t/3,n)),e.getScaledHeight()>r&&e.scaleToHeight(r-e.getScaledHeight()-20),e.viewportCenter(),Am().getObjects("i-text").forEach(t=>{if(t!==e&&t.intersectsWithObject(e)){const r=t.top-e.top+t.getScaledHeight();let n=e.top+r;n>_m().original.height-t.getScaledHeight()&&(n=0),e.set("top",n),e.setCoords()}})}selectOrAddText(e,t={}){if(_m().objects.active.isText)return!1;const r=Sm().objects.getAll().find(e=>gg(e));return r?(Sm().objects.select(r),!1):(this.add(e,t),!0)}}const n_=e=>{const t=new lC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=lC.fabric.document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext("2d");return t.strokeStyle=this.color,t.lineWidth=5,t.beginPath(),t.moveTo(0,5),t.lineTo(10,5),t.closePath(),t.stroke(),e},t},i_=e=>{const t=new lC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext("2d");return t.strokeStyle=this.color,t.lineWidth=5,t.beginPath(),t.moveTo(5,0),t.lineTo(5,10),t.closePath(),t.stroke(),e},t},o_=e=>{const t=new lC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=this.width/2,t=document.createElement("canvas"),r=new lC.fabric.Rect({width:e,height:e,angle:45,fill:this.color}),n=r.getBoundingRect().width;t.width=n+5,t.height=n+5,r.set({left:n/2,top:n/2});const i=t.getContext("2d");return r.render(i),t},t},a_=e=>{const t=new lC.fabric.PatternBrush(e);return t.getPatternSrc=function(){const e=document.createElement("canvas");e.width=12,e.height=12;const t=e.getContext("2d");return t.fillStyle=this.color,t.fillRect(0,0,10,10),e},t};var s_,l_;class c_{constructor(){ml(this,"customBrushes",{VLineBrush:n_,HLineBrush:i_,DiamondBrush:o_,SquareBrush:a_}),ml(this,"currentBrush",{type:"PencilBrush",color:null==(l_=null==(s_=_m().config.objectDefaults)?void 0:s_.global)?void 0:l_.fill,width:ef[1]}),ml(this,"onPathCreated",e=>{e.path.name=mg.Drawing,e.path.set(function(){const e={...Im};return delete e.strokeWidth,e}()),_m().setDirty(!0)})}enable(){Am().on("path:created",this.onPathCreated),Am().isDrawingMode=!0,this.setBrushType(this.currentBrush.type),this.setBrushSize(this.currentBrush.width)}disable(){Am().off("path:created",this.onPathCreated),Am().isDrawingMode=!1}getBrushType(){return this.currentBrush.type}setBrushType(e){this.currentBrush.type=e,Am().freeDrawingBrush=e in lC.fabric?new lC.fabric[e](Am()):this.customBrushes[e](Am()),this.applyBrushStyles()}applyBrushStyles(){Object.keys(this.currentBrush).forEach(e=>{Am().freeDrawingBrush[e]=this.currentBrush[e]});const e=Am().freeDrawingBrush;e.getPatternSrc&&(e.source=e.getPatternSrc.call(e))}setBrushSize(e){this.currentBrush.width=e,this.applyBrushStyles()}getBrushSize(){return this.currentBrush.width}setBrushColor(e){this.currentBrush.color=e,this.applyBrushStyles()}getBrushColor(){return this.currentBrush.color}}async function u_(e,t=!0,r=!0){const n=await gC(e);if(n)return new Promise(e=>{n.name=mg.Image,n.opacity=0;const i=_m().original.width,o=_m().original.height;if(t&&(n.width>=i||n.height>=o)){const e=i-.1*i,t=o-.1*o,r=1/Math.min(t/n.getScaledHeight(),e/n.getScaledWidth());n.scaleX*=1/r,n.scaleY*=1/r}_m().fabric.add(n),r&&_m().fabric.setActiveObject(n),n.viewportCenter(),n.setCoords(),_m().fabric.requestRenderAll(),Sm().zoom.fitToScreen(),n.animate("opacity","1",{duration:425,onChange:()=>{_m().fabric.requestRenderAll()},onComplete:()=>{e(n)}})})}function d_(e){var t;return(null==(t=/(?:\.([^.]+))?$/.exec(e))?void 0:t[1])||""}class h_{constructor(e,t){ml(this,"id"),ml(this,"fingerprint"),ml(this,"name"),ml(this,"relativePath",""),ml(this,"size"),ml(this,"mime",""),ml(this,"extension",""),ml(this,"native"),ml(this,"lastModified"),ml(this,"cachedData"),this.id=Pm(),this.name=e.name,this.size=e.size,this.mime=function(e){const t={md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",gif:"image/gif",yaml:"text/yaml",yml:"text/yaml",log:"text/plain"},r=e.name?d_(e.name):null;return e.type?e.type:r&&r in t?t[r]:"application/octet-stream"}(e),this.lastModified=e.lastModified,this.extension=d_(e.name)||"bin",this.native=e,(t=(t=t||e.webkitRelativePath||"").replace(/^\/+/g,""))&&t.split("/").length>1&&(this.relativePath=t),this.fingerprint=function({name:e,mime:t,size:r,relativePath:n,lastModified:i}){let o="be";return"string"==typeof e&&(o+=`-${f_(e.toLowerCase())}`),t&&(o+=`-${t}`),"string"==typeof n&&(o+=`-${f_(n.toLowerCase())}`),void 0!==r&&(o+=`-${r}`),void 0!==i&&(o+=`-${i}`),o}({name:this.name,size:this.size,mime:this.mime,lastModified:this.lastModified})}get data(){return new Promise(e=>{this.cachedData&&e(this.cachedData);const t=new FileReader;t.addEventListener("load",()=>{this.cachedData=t.result,e(this.cachedData)}),"json"===this.extension?t.readAsText(this.native):t.readAsDataURL(this.native)})}}function f_(e){let t="";return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${function(e){return e.charCodeAt(0).toString(32)}(e)}`,"/"))+t}function p_(e={}){return new Promise(t=>{const r=function(e={}){const t=document.querySelector("#hidden-file-upload-input");t&&t.remove();const r=document.createElement("input");return r.type="file",r.multiple=e.multiple??!1,r.classList.add("hidden"),r.style.display="none",r.style.visibility="hidden",r.id="hidden-file-upload-input",r.accept=function({extensions:e=[],types:t=[]}){const r=[];return null!=e&&e.length&&(e=e.map(e=>e.startsWith(".")?e:`.${e}`),r.push(e.join(","))),null!=t&&t.length&&r.push(t.join(",")),r.join(",")}(e),e.directory&&(r.webkitdirectory=!0),document.body.appendChild(r),r}(e);r.onchange=e=>{const n=e.target.files;if(!n)return t([]);const i=Array.from(n).filter(e=>".DS_Store"!==e.name).map(e=>new h_(e));t(i),r.remove()},document.body.appendChild(r),r.click()})}var g_=(e=>(e.image="image/*",e.audio="audio/*",e.text="text/*",e.json="application/json",e.video="video/mp4,video/mpeg,video/x-m4v,video/*",e))(g_||{});function m_(e,t=1){if(null==e||Number.isNaN(e))return"";const r=e<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(r&&(e=-e),e<1)return(r?"-":"")+e+" B";const i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),n.length-1);e=Number(e/Math.pow(1024,i));const o=n[i];return e>=10||e%1==0?`${(r?"-":"")+e.toFixed(0)} ${o}`:`${(r?"-":"")+e.toFixed(t)} ${o}`}function v_(e,t){this.text=e=e||"",this.hasWild=~e.indexOf("*"),this.separator=t,this.parts=e.split(t)}v_.prototype.match=function(e){var t,r,n=!0,i=this.parts,o=i.length;if("string"==typeof e||e instanceof String)if(this.hasWild||this.text==e){for(r=(e||"").split(this.separator),t=0;n&&t<o;t++)"*"!==i[t]&&(n=t<r.length&&i[t]===r[t]);n=n&&r}else n=!1;else if("function"==typeof e.splice)for(n=[],t=e.length;t--;)this.match(e[t])&&(n[n.length]=e[t]);else if("object"==typeof e)for(var a in n={},e)this.match(a)&&(n[a]=e[a]);return n};var y_=function(e,t,r){var n=new v_(e,r||/[\/\.]/);return typeof t<"u"?n.match(t):n},b_=/[\/\+\.]/,w_=function(e,t){function r(t){var r=y_(t,e,b_);return r&&r.length>=2}return t?r(t.split(";")[0]):r};const x_=qh(w_);function C_(e,t){return t.map(e=>e.split(",")).flat().some(t=>{if(t.includes("/"))return!!e.mime&&x_(e.mime.replace(/;.*?$/,""),t);const r=t.replace(".","").toLowerCase();return!(!r||!e.extension)&&e.extension.toLowerCase()===r})}class __{async uploadAndAddImage(e=!0){const t=await this.openUploadWindow();await this.openUploadedFile(t,e)}async uploadAndReplaceMainImage(){const e=await this.openUploadWindow();e&&await this.openBackgroundImage(e)}async uploadAndOpenStateFile(){const e=await this.openUploadWindow(S_);e&&await this.loadState(await e.data)}async addImageFromUrl(e,t=!0){var r,n;await u_(e,(null==(n=null==(r=_m().config.tools)?void 0:r.import)?void 0:n.fitOverlayToScreen)??!0,t),Sm().history.addHistoryItem({name:"overlayImage"})}async addImageFromData(e,t=!0){var r,n;await u_(e,(null==(n=null==(r=_m().config.tools)?void 0:r.import)?void 0:n.fitOverlayToScreen)??!0,t),Sm().history.addHistoryItem({name:"overlayImage"})}async openUploadedFile(e,t=!0){if(!e)return;const r=await e.data;switch(e.extension){case"json":await this.loadState(r);break;case"svg":await Sm().shape.addSvgSticker(r,mg.Image),Sm().history.addHistoryItem({name:"overlayImage"});break;default:await this.addImageFromData(r,t)}}async loadState(e){let t;_m().toggleLoading("state"),await km(),t="string"==typeof e?e.endsWith(".json")?await Em(e):JSON.parse(e):e,t.history?_m().history.reset(t.history):await Sm().history.addInitial(t),await Sm().history.reload(),_m().toggleLoading(!1)}async openUploadWindow(e){var t,r;e=e||function(){var e,t;const r=null==(t=null==(e=_m().config.tools)?void 0:e.import)?void 0:t.validImgExtensions;return r?{extensions:r}:{types:[g_.image]}}();const n=(await p_(e))[0];return this.fileIsValid(n)?(null==(r=(t=_m().config).onFileOpen)||r.call(t,n),n):null}async openBackgroundImage(e){let t;await km(),t=e instanceof HTMLImageElement?e.src:e instanceof h_?await e.data:e;const r=await Sm().canvas.addMainImage(t);return await Sm().history.addInitial(),r}fileIsValid(e){var t,r,n,i;const o=(null==(r=null==(t=_m().config.tools)?void 0:t.import)?void 0:r.maxFileSize)??function(e,t){switch(t){case"KB":return 1024*e;case"MB":return 1048576*e;case"GB":return e*1024**3;case"TB":return e*1024**4;case"PB":return e*1024**5;default:return e}}(10,"MB"),a=function(e,t){if(!t)return;const{maxFileSize:r,allowedFileTypes:n,blockedFileTypes:i}=t;return r&&null!=e.size&&e.size>r?Kh("`:file` exceeds maximum allowed size of :size",{values:{file:e.name,size:m_(r)}}):null!=n&&n.length&&!C_(e,n)||null!=i&&i.length&&C_(e,i)?Kh("This file type is not allowed"):void 0}(e,{maxFileSize:o,allowedFileTypes:[...(null==(i=null==(n=_m().config.tools)?void 0:n.import)?void 0:i.validImgExtensions)??[],"json"]});return!a||(Nm.danger(a),!1)}}const S_={types:[".json",g_.json]};class A_{constructor(){ml(this,"watermark",null),ml(this,"lineStyle",{stroke:"rgba(255,255,255,0.3)",strokeWidth:5,strokeLineCap:"round",strokeLineJoin:"round"})}add(e){this.createGroup(),this.addText(e),this.addLines(),Am().add(this.watermark),Sm().canvas.render()}remove(){this.watermark&&(Am().remove(this.watermark),this.watermark=null,Sm().canvas.render())}createGroup(){this.watermark=new lC.fabric.Group(void 0,{...Im,width:_m().original.width,height:_m().original.height,excludeFromExport:!0,top:0,left:0,originX:"left",originY:"top"})}addText(e){var t;const r=new lC.fabric.Text(e,{fill:"rgba(255,255,255,0.3)",strokeWidth:2,stroke:"rgba(255,255,255,0.4)",originX:"center",originY:"center",fontWeight:600,fontSize:150,fontFamily:"Courier New"});r.scaleToWidth(_m().original.width/2),null==(t=this.watermark)||t.add(r)}addLines(){var e;if(!this.watermark)return;const t=null==(e=this.watermark)?void 0:e.getObjects("text")[0],r=_m().original.width/2,n=_m().original.height/2,i=100,o=t.width/4,a=new lC.fabric.Line(void 0,this.lineStyle),s=new lC.fabric.Line(void 0,this.lineStyle),l=new lC.fabric.Line(void 0,this.lineStyle),c=new lC.fabric.Line(void 0,this.lineStyle);this.watermark.add(a,s,l,c),a.set({x1:o,y1:-i,x2:r,y2:-n}),s.set({x1:o,y1:i,x2:r,y2:n}),l.set({x1:-o,y1:-i,x2:-r,y2:-n}),c.set({x1:-o,y1:i,x2:-r,y2:n})}}var k_={exports:{}};!function(e){!function(){function t(e,t){return typeof t>"u"?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function r(e,t,r){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){s(n.response,t,r)},n.onerror=function(){console.error("could not download file")},n.send()}function n(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof $h&&$h.global===$h?$h:void 0,a=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=o.saveAs||("object"!=typeof window||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(e,t,a){var s=o.URL||o.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?i(l):n(l.href)?r(e,t,a):i(l,l.target="_blank")):(l.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(l.href)},4e4),setTimeout(function(){i(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,o,a){if(o=o||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,a),o);else if(n(e))r(e,o,a);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){i(s)})}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return r(e,t,n);var s="application/octet-stream"===e.type,l=/constructor/i.test(o.HTMLElement)||o.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||s&&l||a)&&typeof FileReader<"u"){var u=new FileReader;u.onloadend=function(){var e=u.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var d=o.URL||o.webkitURL,h=d.createObjectURL(e);i?i.location=h:location.href=h,i=null,setTimeout(function(){d.revokeObjectURL(h)},4e4)}});o.saveAs=s.saveAs=s,e.exports=s}()}(k_);var E_=k_.exports;class I_{save(e,t,r){var n,i,o;const a=null==(n=_m().config.tools)?void 0:n.export;e=e||(null==a?void 0:a.defaultName),t=this.getFormat(t),r=this.getQuality(r);const s=`${e}.${t}`;this.applyWaterMark();const l="json"===t?this.getJsonState():this.getDataUrl(t,r);if(Sm().watermark.remove(),l)if(_m().config.saveUrl)fetch(_m().config.saveUrl,{method:"POST",body:JSON.stringify({data:l,filename:s,format:t})});else if(_m().config.onSave)null==(o=(i=_m().config).onSave)||o.call(i,l,s,t);else{const e=this.getCanvasBlob(t,l);E_.saveAs(e,s)}}getDataUrl(e,t){try{return"svg"===e?Am().toSVG():Am().toDataURL({format:this.getFormat(e),quality:this.getQuality(t),multiplier:Math.max(_m().original.width/Am().width,_m().original.height/Am().height)})}catch(e){e.message.toLowerCase().includes("tainted")&&Nm.danger(Kh("Could not export canvas with external image."))}return null}getCanvasBlob(e,t){if("json"===e)return new Blob([t],{type:"application/json"});if("svg"===e)return new Blob([t],{type:"image/svg+xml"});const r=`image/${e}`;return function(e,t,r){t=t||"",r=r||512;const n=atob(e),i=[];for(let e=0;e<n.length;e+=r){const t=n.slice(e,e+r),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);const a=new Uint8Array(o);i.push(a)}return new Blob(i,{type:t})}(t=t.replace(/data:image\/([a-z]*)?;base64,/,""),r)}getJsonState(){return JSON.stringify({...Tm(),history:_m().history})}applyWaterMark(){const e=_m().config.watermarkText;e&&Sm().watermark.add(e)}getFormat(e){var t;const r=null==(t=_m().config.tools)?void 0:t.export;return"jpg"===(e=e||(null==r?void 0:r.defaultFormat)||"png")&&(e="jpeg"),e}getQuality(e){var t;const r=null==(t=_m().config.tools)?void 0:t.export;return e=e||(null==r?void 0:r.defaultQuality)||.8}}class T_{constructor(){ml(this,"previewRect",null)}async apply(e){this.previewRect||this.showPreview(),this.updatePreview(e),Am().remove(this.previewRect),Am().clipPath=this.previewRect;const t=Sm().export.getDataUrl();t&&Sm().canvas.clear(),this.hidePreview(),t&&await Sm().canvas.addMainImage(t),Am().clipPath=void 0}getPreviewRadius(){var e;return(null==(e=this.previewRect)?void 0:e.rx)||0}updatePreview(e){this.previewRect&&(this.previewRect.set({rx:e,ry:e}),Sm().canvas.render())}showPreview(){const e=.04*_m().original.width;this.previewRect=new lC.fabric.Rect({width:_m().original.width,height:_m().original.height,rx:e,ry:e,objectCaching:!1,fill:"transparent",name:"round.rect",data:{pixieInternal:!0},stroke:"rgba(255,255,255,0.8)",strokeWidth:3,strokeDashArray:[4,4],selectable:!1,evented:!1}),Am().add(this.previewRect),this.previewRect.moveTo(99),this.previewRect.viewportCenter(),Sm().canvas.render()}hidePreview(){this.previewRect&&(Am().remove(this.previewRect),Sm().canvas.render(),this.previewRect=null)}}class F_{get straightenAnchor(){return Am().getObjects().find(e=>e.name===mg.StraightenAnchor)}rotateLeft(){this.rotateFixed(-90)}rotateRight(){this.rotateFixed(90)}straighten(e){this.storeObjectsRelationToHelper(),Sm().objects.deselectActive();const t=(this.straightenAnchor.data.rotateAngle||0)+e,r=this.getImageScale(t,this.straightenAnchor);this.straightenAnchor.angle=t,this.straightenAnchor.scaleX=r,this.straightenAnchor.scaleY=r,this.straightenAnchor.data.straightenAngle=e,this.transformObjectsBasedOnHelper()}flip(e){const t="horizontal"===e?"flipY":"flipX";Sm().objects.getAll().forEach(e=>{e[t]=!e[t]}),Sm().canvas.render()}rotateFixed(e){Sm().zoom.set(1,!1),Sm().objects.deselectActive();const t=this.straightenAnchor.data.rotateAngle||0;e=90*Math.round(e/90);const r=t+(this.straightenAnchor.data.straightenAngle||0)+e;Sm().canvas.resize(_m().original.height,_m().original.width,{applyZoom:!1,resizeHelper:!1}),this.storeObjectsRelationToHelper(),this.straightenAnchor.rotate(r),this.straightenAnchor.data.rotateAngle=t+e,this.straightenAnchor.center(),this.transformObjectsBasedOnHelper(),Sm().frame.resize(Sm().frame.active.currentSizeInPercent),requestAnimationFrame(()=>{Sm().zoom.fitToScreen()})}getImageScale(e,t){e=lC.fabric.util.degreesToRadians(e);const r=_m().original.width/2,n=_m().original.height/2,i=t.width/2,o=t.height/2,a=Math.sqrt(r**2+n**2),s=Math.asin(n/a);let l=(e%(2*Math.PI)+4*Math.PI)%(2*Math.PI);l>Math.PI&&(l-=Math.PI),l>Math.PI/2&&l<=Math.PI&&(l=Math.PI/2-(l-Math.PI/2));const c=Math.PI/2-s-Math.abs(l),u=Math.abs(s-Math.abs(l)),d=Math.cos(c)*a,h=Math.cos(u)*a;return Math.max(h/i,d/o)}storeObjectsRelationToHelper(){Sm().objects.getAll().forEach(e=>{if(e!==this.straightenAnchor){const t=lC.fabric.util.multiplyTransformMatrices(lC.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()),e.calcTransformMatrix());e.data={...e.data,relationToCanvas:t}}})}transformObjectsBasedOnHelper(){Sm().objects.getAll().forEach(e=>{if(e.data.relationToCanvas){const t=lC.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(),e.data.relationToCanvas),r=lC.fabric.util.qrDecompose(t);e.set({flipX:!1,flipY:!1}),e.setPositionByOrigin({x:r.translateX,y:r.translateY},"center","center"),e.set(r),e.setCoords(),e.data.relationToCanvas=null}})}resetStraightenAnchor(){const e=this.straightenAnchor;e&&Am().remove(e);const t=new lC.fabric.Rect({...Im,name:mg.StraightenAnchor,visible:!1,width:_m().original.width,height:_m().original.height,data:{pixieInternal:!0,straightenAngle:0,rotateAngle:0}});Am().add(t),t.viewportCenter()}}function O_(e){const t=function(e){var t;const r=new lC.fabric.Canvas(e,{width:1,height:1});r.preserveObjectStacking=!0,r.selection=!1,r.renderOnAddRemove=!1;const n=_m().config.textureSize;n&&(lC.fabric.textureSize=n);const i={...null==(t=_m().config.objectDefaults)?void 0:t.global,...uC};Object.keys(i).forEach(e=>{lC.fabric.Object.prototype[e]=i[e]}),r.on("object:added",e=>{var t,r;e.target&&(null==(r=null==(t=e.target)?void 0:t.data)||!r.id)&&(e.target.data||(e.target.data={}),e.target.data.id=dC(10))});const o=lC.fabric.Object.prototype.controls;return Object.keys(o).forEach(e=>{delete o[e]}),r}(e);_m().editor.fabric=t,Cm.setState({fabric:t}),_m().editor.tools={canvas:new vC,objects:new _C,zoom:new pC,history:new PC,filter:new DC,resize:new $C,crop:new XC,merge:new MC,shape:new KC,frame:new t_,text:new r_,draw:new c_,transform:new F_,import:new __,watermark:new A_,export:new I_,corners:new T_}}function P_(e,t){const r=new ResizeObserver(e=>{const r=e[0].contentRect;t({width:r.width,height:r.height})});return e.current&&r.observe(e.current),()=>{e.current&&r.unobserve(e.current)}}function M_(e){const t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}const R_="flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]",L_={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute"},transition:{type:"tween",duration:.15}};function N_(e,{padding:t,equalWidth:r,variant:n}={}){switch(e){case"2xs":return"link"===n?"text-xs":`text-xs h-24 ${r?"w-24":t||"px-10"}`;case"xs":return"link"===n?"text-xs":`text-xs h-30 ${r?"w-30":t||"px-14"}`;case"sm":return"link"===n?"text-sm":`text-sm h-36 ${r?"w-36":t||"px-18"}`;case"md":return"link"===n?"text-base":`text-base h-42 ${r?"w-42":t||"px-22"}`;case"lg":return"link"===n?"text-lg":`text-base h-50 ${r?"w-50":t||"px-26"}`;case"xl":return"link"===n?"text-xl":`text-lg h-60 ${r?"w-60":t||"px-32"}`;default:return e||""}}function j_(e){const{variant:t,shadow:r,whitespace:n="whitespace-nowrap",display:i="inline-flex"}=e,o={...e,border:e.border||"border"};let a=[];return"outline"===t?a=function({color:e,border:t}){const r="disabled:text-disabled disabled:bg-transparent disabled:border-disabled-bg";switch(e){case"primary":return[`text-primary bg-transparent ${t} border-primary/50`,"hover:bg-primary/hover hover:border-primary",r];case"danger":return[`text-danger bg-transparent ${t} border-danger/50`,"hover:bg-danger/4 hover:border-danger",r];case"positive":return[`text-positive bg-transparent ${t} border-positive/50`,"hover:bg-positive/4 hover:border-positive",r];case"paper":return[`text bg-paper ${t}`,"hover:bg-hover",r];case"white":return["text-white bg-transparent border border-white","hover:bg-white/20","disabled:text-white/70 disabled:border-white/70 disabled:bg-transparent"];default:return[`bg-transparent ${t}`,"hover:bg-hover",r]}}(o):"text"===t?a=function({color:e}){const t="disabled:text-disabled disabled:bg-transparent";switch(e){case"primary":return["text-primary bg-transparent border-transparent","hover:bg-primary/4",t];case"danger":return["text-danger bg-transparent border-transparent","hover:bg-danger/4",t];case"positive":return["text-positive bg-transparent border-transparent","hover:bg-positive/4",t];case"white":return["text-white bg-transparent border-transparent","hover:bg-white/20","disabled:text-white/70 disabled:bg-transparent"];default:return["bg-transparent border-transparent","hover:bg-hover",t]}}(o):"flat"===t||"raised"===t?a=function({color:e,border:t}){const r="disabled:text-disabled disabled:bg-disabled disabled:border-transparent disabled:shadow-none";switch(e){case"primary":return[`text-on-primary bg-primary ${t} border-primary`,"hover:bg-primary-dark hover:border-primary-dark",r];case"danger":return[`text-white bg-danger ${t} border-danger`,"hover:bg-danger/90 hover:border-danger/90",r];case"chip":return[`text-main bg-chip ${t} border-chip`,"hover:bg-chip/90 hover:border-chip/90",r];case"paper":return[`text-main bg-paper ${t} border-paper`,"hover:bg-paper/90 hover:border-paper/90",r];case"white":return[`text-black bg-white ${t} border-white`,"hover:bg-white",r];default:return[`bg ${t} border-background`,"hover:bg-hover",r]}}(o):"link"===t&&(a=function({color:e}){switch(e){case"primary":return["text-primary","hover:underline","disabled:text-disabled"];case"danger":return["text-danger","hover:underline","disabled:text-disabled"];default:return["text-main","hover:underline","disabled:text-disabled"]}}(o)),[...a,r||"raised"===t&&"shadow-md",n,i,t&&"align-middle flex-shrink-0 items-center transition-button duration-200","select-none appearance-none no-underline outline-none disabled:pointer-events-none disabled:cursor-default"]}function D_(e){return e&&(t=>{t.currentTarget.contains(t.target)&&e(t)})}const z_=p((t,r)=>{const{children:n,color:i=null,variant:o,radius:a,shadow:s,whitespace:l,justify:c="justify-center",className:u,href:d,form:h,border:f,elementType:p,to:g,relative:m,replace:v,end:y,display:b,type:w="button",onClick:x,onPointerDown:C,onPointerUp:_,onKeyDown:S,...A}=t,k=p||(d?"a":"button"),E="a"===k;return e(k,{ref:r,form:E?void 0:h,href:d,to:g,relative:m,type:E?void 0:w,replace:v,end:y,onPointerDown:D_(C),onPointerUp:D_(_),onClick:D_(x),onKeyDown:D_(S),className:af("focus-visible:ring",j_({variant:o,color:i,border:f,whitespace:l,display:b}),a,c,u),...A,children:n})}),B_=i.forwardRef(({children:r,startIcon:n,endIcon:i,size:o="sm",sizeClassName:a,className:s,equalWidth:l=!1,radius:c="rounded-button",variant:u="text",disabled:d,elementType:h,to:f,replace:p,href:g,download:m,...v},y)=>{const b=af("font-semibold",a||N_(o,{equalWidth:l,variant:u}),s);return t(z_,{className:b,ref:y,radius:c,variant:u,disabled:d,to:d?void 0:f,href:d?void 0:g,download:d?void 0:m,elementType:d?void 0:h,replace:d?void 0:p,...v,children:[n&&e(U_,{position:"start",icon:n,size:o}),r,i&&e(U_,{position:"end",icon:i,size:o})]})});function U_({icon:e,position:t,size:r}){const n=af("m-auto",{"-ml-4 mr-8":"start"===t,"-mr-4 ml-8":"end"===t},e.props.className);return i.cloneElement(e,{className:n,size:r})}const V_=s(null);function H_(){return l(V_)}const W_=cf(e("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"}),"CheckOutlined"),$_=i.forwardRef((r,n)=>{let{startIcon:i,capitalizeFirst:o,children:a,description:s,endIcon:l,endSection:c,isDisabled:u,isActive:d,isSelected:h,showCheckmark:f,elementType:p="div",radius:g,padding:m,...v}=r;!i&&f&&(i=e(W_,{size:"sm",className:af("text-primary",!h&&"invisible")}));const y=af("icon-sm rounded overflow-hidden flex-shrink-0",!u&&"text-muted"),b=af(!u&&"text-muted");return t(p,{...v,"aria-disabled":u,className:q_(r),ref:n,children:[i&&e("div",{className:y,children:i}),t("div",{className:af("min-w-auto mr-auto w-full overflow-hidden overflow-ellipsis",o&&"first-letter:capitalize"),children:[a,s&&e("div",{className:af("mt-4 whitespace-normal text-xs",u?"text-disabled":"text-muted"),children:s})]}),(l||c)&&e("div",{className:l?y:b,children:l||c})]})});function q_({className:e,isSelected:t,isActive:r,isDisabled:n,showCheckmark:i,endIcon:o,endSection:a,radius:s,padding:l}){let c,u="";return u=n?"text-disabled pointer-events-none":t?r?"bg-primary/focus":"bg-primary/selected hover:bg-primary/focus":r?"hover:bg-fg-base/15 bg-focus":"hover:bg-hover",c=l||(i?o||a?"pl-8 pr-8 py-8":"pl-8 pr-24 py-8":"px-20 py-8"),af("w-full select-none outline-none cursor-pointer","text-sm truncate flex items-center gap-10",!n&&"text-main",c,u,e,s)}function G_({children:t,value:r,startIcon:n,endIcon:i,endSection:o,description:a,capitalizeFirst:s,textLabel:l,isDisabled:c,onSelected:u,onClick:d,...h}){var f;const{collection:p,showCheckmark:g,virtualFocus:m,listboxId:v,role:y,listItemsRef:b,handleItemSelection:w,state:{selectedValues:x,activeIndex:C,setActiveIndex:_}}=H_(),S=x.includes(r),A=null==(f=p.get(r))?void 0:f.index,k=C===A;if(null==A)return null;return e($_,{...h,onFocus:()=>{m||_(A)},onPointerEnter:e=>{_(A),m||e.currentTarget.focus()},onPointerDown:e=>{m&&e.preventDefault()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),w(r),null==u||u())},onClick:e=>{w(r),null==u||u(),null==d||d(e)},ref:e=>b.current[A]=e,id:`${v}-${A}`,role:"menu"===y?"menuitem":"option",tabIndex:m?void 0:k&&!c?-1:0,"aria-selected":k&&S,showCheckmark:g,isDisabled:c,isActive:k,isSelected:S,startIcon:n,description:a,endIcon:i,endSection:o,capitalizeFirst:s,"data-value":r,children:t})}var Y_={exports:{}};!function(e){(function(){var t=Object.assign;function r(e,r){r||(r={});var n,i,o,a=r.vargs||function(e){var t=e+"",r=t.indexOf("...");return r>=0&&(r<t.indexOf(")")||t.indexOf("arguments")>=0)}(e),s=Object.create(null),l=[],c=[],u=new WeakMap,d=r.maxAge>0&&r.maxAge<1/0?function(e,t,n){return setTimeout(function(){if(n)return t.splice(e,1),void n.splice(e,1);t instanceof WeakMap?t.delete(e):delete t[e]},r.maxAge)}:0,h=r.equals?r.equals:function(e,t){return e===t},f=r.maxArgs,p=r.serializer;return 1!==e.length||r.equals||a?i=function(){var t=arguments.length;if(!t&&null!=n)return c[n];var r,i=f||t;for(r=l.length-1;r>=0;r--)if(f||l[r].length===i)for(var o=i-1;o>=0&&h(l[r][o],arguments[o]);o--)if(0===o)return c[r];return r=l.length-(r+1),!t&&null==n&&(n=r),!d||d(r,c,l),c[r]=e.apply(this,l[r]=arguments)}.bind(this):(i=function(t){var r,n=typeof t;if(!p&&("object"===n&&t||"function"===n))return u.get(t)||(!d||d(t,u),u.set(t,r=e.call(this,t)),r);var i="number"===n||"boolean"===n||null==t?t:"string"===n?JSON.stringify(t):p(t);return s[i]||(!d||d(i,s),s[i]=e.call(this,t))}.bind(this),o=1),i.clear=function(){u=new WeakMap,s=Object.create(null),l=[],c=[],n=void 0},i.keys=function(){return o?null:l.slice()},i.values=function(){return o?null:c.slice()},i.keyValues=function(){return o?{primitives:t({},s),objects:u}:null},i}"function"!=typeof t&&(t=function(){var e=arguments,t=arguments[0];if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var r=1;r<e.length;r++)if(e[r]&&"object"==typeof e[r])for(var n in e[r])t[n]=e[r][n];return t}),e.exports=r,typeof window<"u"&&(window.nanomemoize=r)}).call($h)}(Y_);const X_=qh(Y_.exports);function K_({children:r,label:n,index:i}){const o=b();return t("div",{role:"group",className:af(0!==i&&"border-t my-4"),"aria-labelledby":n?`be-select-${o}`:void 0,children:[n&&e("div",{className:"block uppercase text-muted text-xs px-16 py-10",role:"presentation",id:`be-select-${o}`,"aria-hidden":"true",children:n}),r]})}const Z_=X_(({maxItems:e,children:t,items:r,inputValue:n})=>{let i=Q_({children:t,items:r}),o=J_({collection:i,inputValue:n});return e&&(i=new Map([...i.entries()].slice(0,e)),o=new Map([...o.entries()].slice(0,e))),{collection:i,filteredCollection:o}}),J_=X_(({collection:e,inputValue:t})=>{let r=new Map;const n=t?`${t}`.toLowerCase().trim():"";if(n){let t=0;e.forEach((e,i)=>{(e.item?JSON.stringify(e.item):e.textLabel).toLowerCase().trim().includes(n)&&r.set(i,{...e,index:t++})})}else r=e;return r}),Q_=X_(({children:e,items:t})=>{let r;r=t&&"function"==typeof e?t.map(t=>e(t)):e;const n=new Map;let i=0;const o=(e,r,o,a)=>{const s=i++,l=r?null==t?void 0:t[o].items[a]:null==t?void 0:t[s];n.set(e.props.value,{index:s,element:e,textLabel:eS(e),item:l,section:r,isDisabled:e.props.isDisabled,value:e.props.value})};return m.forEach(r,(e,t)=>{v(e)&&(e.type===K_?m.forEach(e.props.children,(r,n)=>{o(r,e,t,n)}):o(e))}),n});function eS(e){var t;const r=e.props.children;return e.props.textLabel?e.props.textLabel:null!=(t=null==r?void 0:r.props)&&t.message?r.props.message:`${r}`||""}const tS=Math.min,rS=Math.max,nS=Math.round,iS=Math.floor,oS=e=>({x:e,y:e}),aS={left:"right",right:"left",bottom:"top",top:"bottom"},sS={start:"end",end:"start"};function lS(e,t,r){return rS(e,tS(t,r))}function cS(e,t){return"function"==typeof e?e(t):e}function uS(e){return e.split("-")[0]}function dS(e){return e.split("-")[1]}function hS(e){return"x"===e?"y":"x"}function fS(e){return"y"===e?"height":"width"}function pS(e){return["top","bottom"].includes(uS(e))?"y":"x"}function gS(e){return hS(pS(e))}function mS(e){return e.replace(/start|end/g,e=>sS[e])}function vS(e){return e.replace(/left|right|bottom|top/g,e=>aS[e])}function yS(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function bS(e){const{x:t,y:r,width:n,height:i}=e;return{width:n,height:i,top:r,left:t,right:t+n,bottom:r+i,x:t,y:r}}function wS(e,t,r){let{reference:n,floating:i}=e;const o=pS(t),a=gS(t),s=fS(a),l=uS(t),c="y"===o,u=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,h=n[s]/2-i[s]/2;let f;switch(l){case"top":f={x:u,y:n.y-i.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-i.width,y:d};break;default:f={x:n.x,y:n.y}}switch(dS(t)){case"start":f[a]-=h*(r&&c?-1:1);break;case"end":f[a]+=h*(r&&c?-1:1)}return f}async function xS(e,t){var r;void 0===t&&(t={});const{x:n,y:i,platform:o,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=cS(t,e),p=yS(f),g=s[h?"floating"===d?"reference":"floating":d],m=bS(await o.getClippingRect({element:null==(r=await(null==o.isElement?void 0:o.isElement(g)))||r?g:g.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:n,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),b=await(null==o.isElement?void 0:o.isElement(y))&&await(null==o.getScale?void 0:o.getScale(y))||{x:1,y:1},w=bS(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(m.top-w.top+p.top)/b.y,bottom:(w.bottom-m.bottom+p.bottom)/b.y,left:(m.left-w.left+p.left)/b.x,right:(w.right-m.right+p.right)/b.x}}function CS(e){return AS(e)?(e.nodeName||"").toLowerCase():"#document"}function _S(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function SS(e){var t;return null==(t=(AS(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function AS(e){return e instanceof Node||e instanceof _S(e).Node}function kS(e){return e instanceof Element||e instanceof _S(e).Element}function ES(e){return e instanceof HTMLElement||e instanceof _S(e).HTMLElement}function IS(e){return!(typeof ShadowRoot>"u")&&(e instanceof ShadowRoot||e instanceof _S(e).ShadowRoot)}function TS(e){const{overflow:t,overflowX:r,overflowY:n,display:i}=RS(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(i)}function FS(e){return["table","td","th"].includes(CS(e))}function OS(e){const t=PS(),r=RS(e);return"none"!==r.transform||"none"!==r.perspective||!!r.containerType&&"normal"!==r.containerType||!t&&!!r.backdropFilter&&"none"!==r.backdropFilter||!t&&!!r.filter&&"none"!==r.filter||["transform","perspective","filter"].some(e=>(r.willChange||"").includes(e))||["paint","layout","strict","content"].some(e=>(r.contain||"").includes(e))}function PS(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function MS(e){return["html","body","#document"].includes(CS(e))}function RS(e){return _S(e).getComputedStyle(e)}function LS(e){return kS(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function NS(e){if("html"===CS(e))return e;const t=e.assignedSlot||e.parentNode||IS(e)&&e.host||SS(e);return IS(t)?t.host:t}function jS(e){const t=NS(e);return MS(t)?e.ownerDocument?e.ownerDocument.body:e.body:ES(t)&&TS(t)?t:jS(t)}function DS(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);const i=jS(e),o=i===(null==(n=e.ownerDocument)?void 0:n.body),a=_S(i);return o?t.concat(a,a.visualViewport||[],TS(i)?i:[],a.frameElement&&r?DS(a.frameElement):[]):t.concat(i,DS(i,[],r))}function zS(e){const t=RS(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=ES(e),o=i?e.offsetWidth:r,a=i?e.offsetHeight:n,s=nS(r)!==o||nS(n)!==a;return s&&(r=o,n=a),{width:r,height:n,$:s}}function BS(e){return kS(e)?e:e.contextElement}function US(e){const t=BS(e);if(!ES(t))return oS(1);const r=t.getBoundingClientRect(),{width:n,height:i,$:o}=zS(t);let a=(o?nS(r.width):r.width)/n,s=(o?nS(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const VS=oS(0);function HS(e){const t=_S(e);return PS()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:VS}function WS(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=!1);const i=e.getBoundingClientRect(),o=BS(e);let a=oS(1);t&&(n?kS(n)&&(a=US(n)):a=US(e));const s=function(e,t,r){return void 0===t&&(t=!1),!(!r||t&&r!==_S(e))&&t}(o,r,n)?HS(o):oS(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(o){const e=_S(o),t=n&&kS(n)?_S(n):n;let r=e,i=r.frameElement;for(;i&&n&&t!==r;){const e=US(i),t=i.getBoundingClientRect(),n=RS(i),o=t.left+(i.clientLeft+parseFloat(n.paddingLeft))*e.x,a=t.top+(i.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=o,c+=a,r=_S(i),i=r.frameElement}}return bS({width:u,height:d,x:l,y:c})}const $S=[":popover-open",":modal"];function qS(e){return $S.some(t=>{try{return e.matches(t)}catch{return!1}})}function GS(e){return WS(SS(e)).left+LS(e).scrollLeft}function YS(e,t,r){let n;if("viewport"===t)n=function(e,t){const r=_S(e),n=SS(e),i=r.visualViewport;let o=n.clientWidth,a=n.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;const e=PS();(!e||e&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s,y:l}}(e,r);else if("document"===t)n=function(e){const t=SS(e),r=LS(e),n=e.ownerDocument.body,i=rS(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=rS(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+GS(e);const s=-r.scrollTop;return"rtl"===RS(n).direction&&(a+=rS(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:a,y:s}}(SS(e));else if(kS(t))n=function(e,t){const r=WS(e,!0,"fixed"===t),n=r.top+e.clientTop,i=r.left+e.clientLeft,o=ES(e)?US(e):oS(1);return{width:e.clientWidth*o.x,height:e.clientHeight*o.y,x:i*o.x,y:n*o.y}}(t,r);else{const r=HS(e);n={...t,x:t.x-r.x,y:t.y-r.y}}return bS(n)}function XS(e,t){const r=NS(e);return!(r===t||!kS(r)||MS(r))&&("fixed"===RS(r).position||XS(r,t))}function KS(e,t){const r=t.get(e);if(r)return r;let n=DS(e,[],!1).filter(e=>kS(e)&&"body"!==CS(e)),i=null;const o="fixed"===RS(e).position;let a=o?NS(e):e;for(;kS(a)&&!MS(a);){const t=RS(a),r=OS(a);!r&&"fixed"===t.position&&(i=null),(o?!r&&!i:!r&&"static"===t.position&&i&&["absolute","fixed"].includes(i.position)||TS(a)&&!r&&XS(e,a))?n=n.filter(e=>e!==a):i=t,a=NS(a)}return t.set(e,n),n}function ZS(e,t,r){const n=ES(t),i=SS(t),o="fixed"===r,a=WS(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=oS(0);if(n||!n&&!o)if(("body"!==CS(t)||TS(i))&&(s=LS(t)),n){const e=WS(t,!0,o,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else i&&(l.x=GS(i));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function JS(e){return"static"===RS(e).position}function QS(e,t){return ES(e)&&"fixed"!==RS(e).position?t?t(e):e.offsetParent:null}function eA(e,t){const r=_S(e);if(qS(e))return r;if(!ES(e)){let t=NS(e);for(;t&&!MS(t);){if(kS(t)&&!JS(t))return t;t=NS(t)}return r}let n=QS(e,t);for(;n&&FS(n)&&JS(n);)n=QS(n,t);return n&&MS(n)&&JS(n)&&!OS(n)?r:n||function(e){let t=NS(e);for(;ES(t)&&!MS(t);){if(OS(t))return t;t=NS(t)}return null}(e)||r}const tA={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:i}=e;const o="fixed"===i,a=SS(n),s=!!t&&qS(t.floating);if(n===a||s&&o)return r;let l={scrollLeft:0,scrollTop:0},c=oS(1);const u=oS(0),d=ES(n);if((d||!d&&!o)&&(("body"!==CS(n)||TS(a))&&(l=LS(n)),ES(n))){const e=WS(n);c=US(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-l.scrollLeft*c.x+u.x,y:r.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:SS,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:i}=e;const o=[..."clippingAncestors"===r?qS(t)?[]:KS(t,this._c):[].concat(r),n],a=o[0],s=o.reduce((e,r)=>{const n=YS(t,r,i);return e.top=rS(n.top,e.top),e.right=tS(n.right,e.right),e.bottom=tS(n.bottom,e.bottom),e.left=rS(n.left,e.left),e},YS(t,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:eA,getElementRects:async function(e){const t=this.getOffsetParent||eA,r=this.getDimensions,n=await r(e.floating);return{reference:ZS(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:r}=zS(e);return{width:t,height:r}},getScale:US,isElement:kS,isRTL:function(e){return"rtl"===RS(e).direction}};function rA(e,t,r,n){void 0===n&&(n={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=BS(e),u=i||o?[...c?DS(c):[],...DS(t)]:[];u.forEach(e=>{i&&e.addEventListener("scroll",r,{passive:!0}),o&&e.addEventListener("resize",r)});const d=c&&s?function(e,t){let r,n=null;const i=SS(e);function o(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),o();const{left:c,top:u,width:d,height:h}=e.getBoundingClientRect();if(s||t(),!d||!h)return;const f={rootMargin:-iS(u)+"px "+-iS(i.clientWidth-(c+d))+"px "+-iS(i.clientHeight-(u+h))+"px "+-iS(c)+"px",threshold:rS(0,tS(1,l))||1};let p=!0;function g(e){const t=e[0].intersectionRatio;if(t!==l){if(!p)return a();t?a(!1,t):r=setTimeout(()=>{a(!1,1e-7)},1e3)}p=!1}try{n=new IntersectionObserver(g,{...f,root:i.ownerDocument})}catch{n=new IntersectionObserver(g,f)}n.observe(e)}(!0),o}(c,r):null;let h=-1,f=null;a&&(f=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=f)||e.observe(t)})),r()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?WS(e):null;return l&&function t(){const n=WS(e);g&&(n.x!==g.x||n.y!==g.y||n.width!==g.width||n.height!==g.height)&&r(),g=n,p=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener("scroll",r),o&&e.removeEventListener("resize",r)}),null==d||d(),null==(e=f)||e.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const nA=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:i,y:o,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:r,platform:n,elements:i}=e,o=await(null==n.isRTL?void 0:n.isRTL(i.floating)),a=uS(r),s=dS(r),l="y"===pS(r),c=["left","top"].includes(a)?-1:1,u=o&&l?-1:1,d=cS(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:p}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof p&&(f="end"===s?-1*p:p),l?{x:f*u,y:h*c}:{x:h*c,y:f*u}}(t,e);return a===(null==(r=s.offset)?void 0:r.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:a}}}}},iA=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=cS(e,t),c={x:r,y:n},u=await xS(t,l),d=pS(uS(i)),h=hS(d);let f=c[h],p=c[d];if(o){const e="y"===h?"bottom":"right";f=lS(f+u["y"===h?"top":"left"],f,f-u[e])}if(a){const e="y"===d?"bottom":"right";p=lS(p+u["y"===d?"top":"left"],p,p-u[e])}const g=s.fn({...t,[h]:f,[d]:p});return{...g,data:{x:g.x-r,y:g.y-n}}}}},oA=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:i,middlewareData:o,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...m}=cS(e,t);if(null!=(r=o.arrow)&&r.alignmentOffset)return{};const v=uS(i),y=uS(s)===s,b=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=h||(y||!g?[vS(s)]:function(e){const t=vS(e);return[mS(e),t,mS(t)]}(s));!h&&"none"!==p&&w.push(...function(e,t,r,n){const i=dS(e);let o=function(e,t,r){const n=["left","right"],i=["right","left"],o=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:n:t?n:i;case"left":case"right":return t?o:a;default:return[]}}(uS(e),"start"===r,n);return i&&(o=o.map(e=>e+"-"+i),t&&(o=o.concat(o.map(mS)))),o}(s,g,p,b));const x=[s,...w],C=await xS(t,m),_=[];let S=(null==(n=o.flip)?void 0:n.overflows)||[];if(u&&_.push(C[v]),d){const e=function(e,t,r){void 0===r&&(r=!1);const n=dS(e),i=gS(e),o=fS(i);let a="x"===i?n===(r?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=vS(a)),[a,vS(a)]}(i,a,b);_.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:i,overflows:_}],!_.every(e=>e<=0)){var A,k;const e=((null==(A=o.flip)?void 0:A.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let r=null==(k=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:k.placement;if(!r)switch(f){case"bestFit":{var E;const e=null==(E=S.map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:E[0];e&&(r=e);break}case"initialPlacement":r=s}if(i!==r)return{reset:{placement:r}}}return{}}}},aA=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:n,platform:i,elements:o}=t,{apply:a=()=>{},...s}=cS(e,t),l=await xS(t,s),c=uS(r),u=dS(r),d="y"===pS(r),{width:h,height:f}=n.floating;let p,g;"top"===c||"bottom"===c?(p=c,g=u===(await(null==i.isRTL?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=c,p="end"===u?"top":"bottom");const m=f-l.top-l.bottom,v=h-l.left-l.right,y=tS(f-l[p],m),b=tS(h-l[g],v),w=!t.middlewareData.shift;let x=y,C=b;if(d?C=u||w?tS(b,v):v:x=u||w?tS(y,m):m,w&&!u){const e=rS(l.left,0),t=rS(l.right,0),r=rS(l.top,0),n=rS(l.bottom,0);d?C=h-2*(0!==e||0!==t?e+t:rS(l.left,l.right)):x=f-2*(0!==r||0!==n?r+n:rS(l.top,l.bottom))}await a({...t,availableWidth:C,availableHeight:x});const _=await i.getDimensions(o.floating);return h!==_.width||f!==_.height?{reset:{rects:!0}}:{}}}},sA=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:i,rects:o,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=cS(e,t)||{};if(null==c)return{};const d=yS(u),h={x:r,y:n},f=gS(i),p=fS(f),g=await a.getDimensions(c),m="y"===f,v=m?"top":"left",y=m?"bottom":"right",b=m?"clientHeight":"clientWidth",w=o.reference[p]+o.reference[f]-h[f]-o.floating[p],x=h[f]-o.reference[f],C=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let _=C?C[b]:0;(!_||!await(null==a.isElement?void 0:a.isElement(C)))&&(_=s.floating[b]||o.floating[p]);const S=w/2-x/2,A=_/2-g[p]/2-1,k=tS(d[v],A),E=tS(d[y],A),I=k,T=_-g[p]-E,F=_/2-g[p]/2+S,O=lS(I,F,T),P=!l.arrow&&null!=dS(i)&&F!==O&&o.reference[p]/2-(F<I?k:E)-g[p]/2<0,M=P?F<I?F-I:F-T:0;return{[f]:h[f]+M,data:{[f]:O,centerOffset:F-O-M,...P&&{alignmentOffset:M}},reset:P}}}),lA=(e,t,r)=>{const n=new Map,i={platform:tA,...r},o={...i.platform,_c:n};return(async(e,t,r)=>{const{placement:n="bottom",strategy:i="absolute",middleware:o=[],platform:a}=r,s=o.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=wS(c,n,l),h=n,f={},p=0;for(let r=0;r<s.length;r++){const{name:o,fn:g}=s[r],{x:m,y:v,data:y,reset:b}=await g({x:u,y:d,initialPlacement:n,placement:h,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=m??u,d=v??d,f={...f,[o]:{...f[o],...y}},b&&p<=50&&(p++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:i}):b.rects),({x:u,y:d}=wS(c,h,l))),r=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}})(e,t,{...i,platform:o})};var cA=typeof document<"u"?x:a;function uA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let r,n,i;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;0!==n--;)if(!uA(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=r;0!==n--;){const r=i[n];if(!("_owner"===r&&e.$$typeof||uA(e[r],t[r])))return!1}return!0}return e!=e&&t!=t}function dA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hA(e,t){const r=dA(e);return Math.round(t*r)/r}function fA(e){const t=n.useRef(e);return cA(()=>{t.current=e}),t}function pA({floatingWidth:e,ref:t,disablePositioning:r=!1,placement:i="bottom",offset:o=2,showArrow:a=!1,maxHeight:s,shiftCrossAxis:l=!0,fallbackPlacements:c}){const h=u(null),f={placement:i,strategy:"fixed"};r||(f.whileElementsMounted=rA,f.middleware=[nA(o),iA({padding:16,crossAxis:l,mainAxis:!0}),oA({padding:16,fallbackPlacements:c}),aA({apply({rects:t,availableHeight:r,availableWidth:n,elements:i}){"matchTrigger"===e&&null!=s?Object.assign(i.floating.style,{width:`${t.reference.width}px`,maxWidth:`${n}`,maxHeight:`${Math.min(r,s)}px`}):null!=s&&Object.assign(i.floating.style,{maxHeight:`${Math.min(r,s)}px`})},padding:16})],a&&f.middleware.push((e=>({name:"arrow",options:e,fn(t){const{element:r,padding:n}="function"==typeof e?e(t):e;return r&&function(e){return{}.hasOwnProperty.call(e,"current")}(r)?null!=r.current?sA({element:r.current,padding:n}).fn(t):{}:r?sA({element:r,padding:n}).fn(t):{}}}))({element:h})));const p=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:o,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=n.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=n.useState(i);uA(f,i)||p(i);const[g,m]=n.useState(null),[v,y]=n.useState(null),b=n.useCallback(e=>{e!=_.current&&(_.current=e,m(e))},[m]),w=n.useCallback(e=>{e!==S.current&&(S.current=e,y(e))},[y]),x=a||g,C=s||v,_=n.useRef(null),S=n.useRef(null),A=n.useRef(d),k=fA(c),E=fA(o),I=n.useCallback(()=>{if(!_.current||!S.current)return;const e={placement:t,strategy:r,middleware:f};E.current&&(e.platform=E.current),lA(_.current,S.current,e).then(e=>{const t={...e,isPositioned:!0};T.current&&!uA(A.current,t)&&(A.current=t,Ae.flushSync(()=>{h(t)}))})},[f,t,r,E]);cA(()=>{!1===u&&A.current.isPositioned&&(A.current.isPositioned=!1,h(e=>({...e,isPositioned:!1})))},[u]);const T=n.useRef(!1);cA(()=>(T.current=!0,()=>{T.current=!1}),[]),cA(()=>{if(x&&(_.current=x),C&&(S.current=C),x&&C){if(k.current)return k.current(x,C,I);I()}},[x,C,I,k]);const F=n.useMemo(()=>({reference:_,floating:S,setReference:b,setFloating:w}),[b,w]),O=n.useMemo(()=>({reference:x,floating:C}),[x,C]),P=n.useMemo(()=>{const e={position:r,left:0,top:0};if(!O.floating)return e;const t=hA(O.floating,d.x),n=hA(O.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...dA(O.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,l,O.floating,d.x,d.y]);return n.useMemo(()=>({...d,update:I,refs:F,elements:O,floatingStyles:P}),[d,I,F,O,P])}(f),g=d(()=>function(e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}([t,p.refs.setReference]),[p.refs.setReference,t]),{x:m,y:v}=p.middlewareData.arrow||{},y={top:"bottom",right:"left",bottom:"top",left:"right"}[p.placement.split("-")[0]],b={left:m,top:v,right:"",bottom:"",[y]:"-4px"};return{...p,reference:g,arrowRef:h,arrowStyle:b}}function gA(e,t){const{children:r,items:n,role:i="listbox",virtualFocus:a,focusLoopingMode:s="stay",autoFocusFirstItem:l=!0,onItemSelected:h,clearInputOnItemSelection:f,blurReferenceOnItemSelection:p,floatingWidth:g="matchTrigger",floatingMinWidth:m,floatingMaxHeight:v,offset:y,placement:w,showCheckmark:x,showEmptyMessage:C,maxItems:_,isAsync:S,allowCustomValue:A,clearSelectionOnInputClear:k}=e,E=e.selectionMode||"none",I=`${b()}-listbox`,[T,F]=iC(e.inputValue,e.defaultInputValue||"",e.onInputValueChange),[O,P]=o("all"),M=Z_({children:r,items:n,inputValue:S?void 0:T,maxItems:_}),R="all"===O?M.collection:M.filteredCollection,L=u([]),N=d(()=>[...R.values()].map(e=>e.isDisabled?null:e.textLabel),[R]),{selectedValues:j,selectValues:D}=function(e){const{selectionMode:t,allowEmptySelection:r}=e,n="single"===t||"multiple"===t,[i,o]=iC(n?e.selectedValue:void 0,n?e.defaultSelectedValue:void 0,n?e.onSelectionChange:void 0),a=d(()=>typeof i>"u"?[]:Array.isArray(i)?i:[i],[i]),s=c(e=>{const n=Array.isArray(e)?e:[e];"single"===t?o(n[0]):n.forEach(e=>{const t=a.indexOf(e);-1===t?(a.push(e),o([...a])):(a.length>1||r)&&(a.splice(t,1),o([...a]))})},[r,a,t,o]);return{selectedValues:a,selectValues:s}}(e),[z,B]=iC(e.isOpen,e.defaultIsOpen,e.onOpenChange),[U,V]=o(null),H=pA({floatingWidth:g,ref:t,placement:w,offset:y,maxHeight:v??420,shiftCrossAxis:!a}),{refs:W,strategy:$,x:q,y:G}=H,Y="none"===E?void 0:R.get(j[0]),X="none"===E||null==Y?void 0:Y.index,K=c((e,t)=>{var r,n;const i=[...R.values()],o=!i.find(e=>!e.isDisabled),l=R.size-1;null==t||!R.size||t>l||t<0||o?V(null):(t=function(e,t,r,n){var i;const o=e.length-1;for(;null!=(i=e[t])&&i.isDisabled;)if("increment"===n){if(++t>=o){if("loop"!==r)return"stay"===r?t-1:null;t=0}}else if(--t<0){if("loop"!==r)return"stay"===r?t+1:null;t=o}return t}(i,t,s,e),V(t),null!=t&&(a?null==(r=L.current[t])||r.scrollIntoView({block:"nearest"}):null==(n=L.current[t])||n.focus()))},[R,a,s]);return{handleItemSelection:e=>{const t=W.reference.current;"none"!==E?D(e):t&&"focus"in t&&t.focus(),a&&(F(f?"":`${e}`),p&&t&&"blur"in t&&t.blur()),P("all"),B(!1),null==h||h(e),V(null)},onInputChange:c(e=>{F(e.target.value),P(e.target.value.trim()?"filtered":"all"),e.target.value?B(!0):k&&D(""),l&&null==U?K("increment",0):V(null)},[F,B,P,D,k,K,l,U]),focusLoopingMode:s,floatingWidth:g,floatingMinWidth:m,floatingMaxHeight:v,showCheckmark:x,collection:R,collections:M,virtualFocus:a,focusItem:K,showEmptyMessage:C&&!!T,allowCustomValue:A,refs:W,reference:H.reference,floating:W.setFloating,positionStyle:{position:$,top:G??"",left:q??""},listContent:N,listItemsRef:L,listboxId:I,role:i,state:{activeIndex:U,setActiveIndex:V,selectedIndex:X,setSelectedIndex:e=>{if("none"!==E){const t=[...R.values()][e];t&&D(t.value)}},selectionMode:E,selectedValues:j,selectValues:D,inputValue:T,setInputValue:F,isOpen:z,setIsOpen:B,setActiveCollection:P}}}function mA(){return Bx()||typeof window>"u"?ym.getState().data.is_mobile_device??!1:window.screen.width<=768}let vA=null,yA=new Set,bA=new Map,wA=!1,xA=!1;function CA(e,t){for(let r of yA)r(e,t)}function _A(e){wA=!0,function(e){return!(e.metaKey||!Xx()&&e.altKey||e.ctrlKey||"Control"===e.key||"Shift"===e.key||"Meta"===e.key)}(e)&&(vA="keyboard",CA("keyboard",e))}function SA(e){vA="pointer",("mousedown"===e.type||"pointerdown"===e.type)&&(wA=!0,CA("pointer",e))}function AA(e){(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Kx()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)})(e)&&(wA=!0,vA="virtual")}function kA(e){e.target===window||e.target===document||(!wA&&!xA&&(vA="virtual",CA("virtual",e)),wA=!1,xA=!1)}function EA(){wA=!1,xA=!0}function IA(e){if(typeof window>"u"||bA.get($x(e)))return;const t=$x(e),r=Wx(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){wA=!0,n.apply(this,arguments)},r.addEventListener("keydown",_A,!0),r.addEventListener("keyup",_A,!0),r.addEventListener("click",AA,!0),t.addEventListener("focus",kA,!0),t.addEventListener("blur",EA,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",SA,!0),r.addEventListener("pointermove",SA,!0),r.addEventListener("pointerup",SA,!0)):(r.addEventListener("mousedown",SA,!0),r.addEventListener("mousemove",SA,!0),r.addEventListener("mouseup",SA,!0)),t.addEventListener("beforeunload",()=>{TA(e)},{once:!0}),bA.set(t,{focus:n})}const TA=(e,t)=>{const r=$x(e),n=Wx(e);t&&n.removeEventListener("DOMContentLoaded",t),bA.has(r)&&(r.HTMLElement.prototype.focus=bA.get(r).focus,n.removeEventListener("keydown",_A,!0),n.removeEventListener("keyup",_A,!0),n.removeEventListener("click",AA,!0),r.removeEventListener("focus",kA,!0),r.removeEventListener("blur",EA,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",SA,!0),n.removeEventListener("pointermove",SA,!0),n.removeEventListener("pointerup",SA,!0)):(n.removeEventListener("mousedown",SA,!0),n.removeEventListener("mousemove",SA,!0),n.removeEventListener("mouseup",SA,!0)),bA.delete(r))};function FA(e){const t=Wx(e);if("virtual"===vA){let r=t.activeElement;!function(e){requestAnimationFrame(()=>{0===Zx.size?e():Jx.add(e)})}(()=>{t.activeElement===r&&e.isConnected&&Gx(e)})}else Gx(e)}function OA(e,t){return"#comment"!==e.nodeName&&function(e){const t=$x(e);if(!(e instanceof t.HTMLElement||e instanceof t.SVGElement))return!1;let{display:r,visibility:n}=e.style,i="none"!==r&&"hidden"!==n&&"collapse"!==n;if(i){const{getComputedStyle:t}=e.ownerDocument.defaultView;let{display:r,visibility:n}=t(e);i="none"!==r&&"hidden"!==n&&"collapse"!==n}return i}(e)&&function(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||OA(e.parentElement,e))}typeof document<"u"&&function(e){const t=Wx(e);let r;"loading"!==t.readyState?IA(e):(r=()=>{IA(e)},t.addEventListener("DOMContentLoaded",r))}();const PA=i.createContext(null);let MA=null;function RA(e){let{children:t,contain:r,restoreFocus:n,autoFocus:o}=e,s=u(null),c=u(null),h=u([]),{parentNode:f}=l(PA)||{},p=d(()=>new YA({scopeRef:h}),[h]);Lx(()=>{let e=f||XA.root;if(XA.getTreeNode(e.scopeRef)&&MA&&!HA(MA,e.scopeRef)){let t=XA.getTreeNode(MA);t&&(e=t)}e.addChild(p),XA.addNode(p)},[p,f]),Lx(()=>{let e=XA.getTreeNode(h);e&&(e.contain=!!r)},[r]),Lx(()=>{var e;let t=null===(e=s.current)||void 0===e?void 0:e.nextSibling,r=[];for(;t&&t!==c.current;)r.push(t),t=t.nextSibling;h.current=r},[t]),function(e,t,r){Lx(()=>{if(t||r)return;let n=e.current;const i=Wx(n?n[0]:void 0);let o=t=>{let r=t.target;UA(r,e.current)?MA=e:BA(r)||(MA=null)};return i.addEventListener("focusin",o,!1),null==n||n.forEach(e=>e.addEventListener("focusin",o,!1)),()=>{i.removeEventListener("focusin",o,!1),null==n||n.forEach(e=>e.removeEventListener("focusin",o,!1))}},[e,t,r])}(h,n,r),function(e,t){let r=u(),n=u();Lx(()=>{let i=e.current;if(!t)return void(n.current&&(cancelAnimationFrame(n.current),n.current=void 0));const o=Wx(i?i[0]:void 0);let a=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!zA(e)||t.isComposing)return;let r=o.activeElement,n=e.current;if(!n||!UA(r,n))return;let i=qA(DA(n),{tabbable:!0},n);if(!r)return;i.currentNode=r;let a=t.shiftKey?i.previousNode():i.nextNode();a||(i.currentNode=t.shiftKey?n[n.length-1].nextElementSibling:n[0].previousElementSibling,a=t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&WA(a,!0)},s=t=>{MA&&!HA(MA,e)||!UA(t.target,e.current)?zA(e)&&!VA(t.target,e)?r.current?r.current.focus():MA&&MA.current&&$A(MA.current):zA(e)&&(r.current=t.target):(MA=e,r.current=t.target)},l=t=>{n.current&&cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{if(o.activeElement&&zA(e)&&!VA(o.activeElement,e))if(MA=e,o.body.contains(t.target)){var n;r.current=t.target,null===(n=r.current)||void 0===n||n.focus()}else MA.current&&$A(MA.current)})};return o.addEventListener("keydown",a,!1),o.addEventListener("focusin",s,!1),null==i||i.forEach(e=>e.addEventListener("focusin",s,!1)),null==i||i.forEach(e=>e.addEventListener("focusout",l,!1)),()=>{o.removeEventListener("keydown",a,!1),o.removeEventListener("focusin",s,!1),null==i||i.forEach(e=>e.removeEventListener("focusin",s,!1)),null==i||i.forEach(e=>e.removeEventListener("focusout",l,!1))}},[e,t]),Lx(()=>()=>{n.current&&cancelAnimationFrame(n.current)},[n])}(h,r),function(e,t,r){const n=u(typeof document<"u"?Wx(e.current?e.current[0]:void 0).activeElement:null);Lx(()=>{let n=e.current;const i=Wx(n?n[0]:void 0);if(!t||r)return;let o=()=>{(!MA||HA(MA,e))&&UA(i.activeElement,e.current)&&(MA=e)};return i.addEventListener("focusin",o,!1),null==n||n.forEach(e=>e.addEventListener("focusin",o,!1)),()=>{i.removeEventListener("focusin",o,!1),null==n||n.forEach(e=>e.removeEventListener("focusin",o,!1))}},[e,r]),Lx(()=>{const n=Wx(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||!zA(e)||t.isComposing)return;let r=n.activeElement;if(!UA(r,e.current))return;let i=XA.getTreeNode(e);if(!i)return;let o=i.nodeToRestore,a=qA(n.body,{tabbable:!0});a.currentNode=r;let s=t.shiftKey?a.previousNode():a.nextNode();if((!o||!n.body.contains(o)||o===n.body)&&(o=void 0,i.nodeToRestore=void 0),(!s||!UA(s,e.current))&&o){a.currentNode=o;do{s=t.shiftKey?a.previousNode():a.nextNode()}while(UA(s,e.current));t.preventDefault(),t.stopPropagation(),s?WA(s,!0):BA(o)?WA(o,!0):r.blur()}};return r||n.addEventListener("keydown",i,!0),()=>{r||n.removeEventListener("keydown",i,!0)}},[e,t,r]),Lx(()=>{const r=Wx(e.current?e.current[0]:void 0);if(!t)return;let i=XA.getTreeNode(e);var o;return i?(i.nodeToRestore=null!==(o=n.current)&&void 0!==o?o:void 0,()=>{let n=XA.getTreeNode(e);if(!n)return;let i=n.nodeToRestore;if(t&&i&&(UA(r.activeElement,e.current)||r.activeElement===r.body&&function(e){let t=XA.getTreeNode(MA);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return(null==t?void 0:t.scopeRef)===e}(e))){let t=XA.clone();requestAnimationFrame(()=>{if(r.activeElement===r.body){let r=t.getTreeNode(e);for(;r;){if(r.nodeToRestore&&r.nodeToRestore.isConnected)return void WA(r.nodeToRestore);r=r.parent}for(r=t.getTreeNode(e);r;){if(r.scopeRef&&r.scopeRef.current&&XA.getTreeNode(r.scopeRef))return void $A(r.scopeRef.current,!0);r=r.parent}}})}}):void 0},[e,t])}(h,n,r),function(e,t){const r=i.useRef(t);a(()=>{if(r.current){MA=e;!UA(Wx(e.current?e.current[0]:void 0).activeElement,MA.current)&&e.current&&$A(e.current)}r.current=!1},[e])}(h,o),a(()=>{const e=Wx(h.current?h.current[0]:void 0).activeElement;let t=null;if(UA(e,h.current)){for(let r of XA.traverse())r.scopeRef&&UA(e,r.scopeRef.current)&&(t=r);t===XA.getTreeNode(h)&&(MA=t.scopeRef)}},[h]),Lx(()=>()=>{var e,t,r;let n=null!==(r=null===(t=XA.getTreeNode(h))||void 0===t||null===(e=t.parent)||void 0===e?void 0:e.scopeRef)&&void 0!==r?r:null;(h===MA||HA(h,MA))&&(!n||XA.getTreeNode(n))&&(MA=n),XA.removeTreeNode(h)},[h]);let g=d(()=>function(e){return{focusNext(t={}){let r=e.current,{from:n,tabbable:i,wrap:o,accept:a}=t,s=n||Wx(r[0]).activeElement,l=r[0].previousElementSibling,c=qA(DA(r),{tabbable:i,accept:a},r);c.currentNode=UA(s,r)?s:l;let u=c.nextNode();return!u&&o&&(c.currentNode=l,u=c.nextNode()),u&&WA(u,!0),u},focusPrevious(t={}){let r=e.current,{from:n,tabbable:i,wrap:o,accept:a}=t,s=n||Wx(r[0]).activeElement,l=r[r.length-1].nextElementSibling,c=qA(DA(r),{tabbable:i,accept:a},r);c.currentNode=UA(s,r)?s:l;let u=c.previousNode();return!u&&o&&(c.currentNode=l,u=c.previousNode()),u&&WA(u,!0),u},focusFirst(t={}){let r=e.current,{tabbable:n,accept:i}=t,o=qA(DA(r),{tabbable:n,accept:i},r);o.currentNode=r[0].previousElementSibling;let a=o.nextNode();return a&&WA(a,!0),a},focusLast(t={}){let r=e.current,{tabbable:n,accept:i}=t,o=qA(DA(r),{tabbable:n,accept:i},r);o.currentNode=r[r.length-1].nextElementSibling;let a=o.previousNode();return a&&WA(a,!0),a}}}(h),[]),m=d(()=>({focusManager:g,parentNode:p}),[p,g]);return i.createElement(PA.Provider,{value:m},i.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:s}),t,i.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:c}))}const LA=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],NA=LA.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";LA.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const jA=LA.join(':not([hidden]):not([tabindex="-1"]),');function DA(e){return e[0].parentElement}function zA(e){let t=XA.getTreeNode(MA);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function BA(e){return VA(e)}function UA(e,t){return!(!e||!t)&&t.some(t=>t.contains(e))}function VA(e,t=null){if(e instanceof Element&&e.closest("[data-react-aria-top-layer]"))return!0;for(let{scopeRef:r}of XA.traverse(XA.getTreeNode(t)))if(r&&UA(e,r.current))return!0;return!1}function HA(e,t){var r;let n=null===(r=XA.getTreeNode(t))||void 0===r?void 0:r.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function WA(e,t=!1){if(null==e||t){if(null!=e)try{e.focus()}catch{}}else try{FA(e)}catch{}}function $A(e,t=!0){let r=e[0].previousElementSibling,n=DA(e),i=qA(n,{tabbable:t},e);i.currentNode=r;let o=i.nextNode();t&&!o&&(n=DA(e),i=qA(n,{tabbable:!1},e),i.currentNode=r,o=i.nextNode()),WA(o)}function qA(e,t,r){let n=null!=t&&t.tabbable?jA:NA,i=Wx(e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){var i;return null!=t&&null!==(i=t.from)&&void 0!==i&&i.contains(e)?NodeFilter.FILTER_REJECT:!e.matches(n)||!OA(e)||r&&!UA(e,r)||null!=t&&t.accept&&!t.accept(e)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});return null!=t&&t.from&&(i.currentNode=t.from),i}class GA{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,r){let n=this.fastMap.get(t??null);if(!n)return;let i=new YA({scopeRef:e});n.addChild(i),i.parent=n,this.fastMap.set(e,i),r&&(i.nodeToRestore=r)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(null===e)return;let t=this.fastMap.get(e);if(!t)return;let r=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&UA(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let n=t.children;r&&(r.removeChild(t),n.size>0&&n.forEach(e=>r&&r.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(null!=e.scopeRef&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){var e;let t=new GA;var r;for(let n of this.traverse())t.addTreeNode(n.scopeRef,null!==(r=null===(e=n.parent)||void 0===e?void 0:e.scopeRef)&&void 0!==r?r:null,n.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new YA({scopeRef:null}),this.fastMap.set(null,this.root)}}class YA{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}let XA=new GA;function KA(){const{width:e,height:t}=function(){let e=Bx(),[t,r]=o(()=>e?{width:0,height:0}:nC());return a(()=>{let e=()=>{r(e=>{let t=nC();return t.width===e.width&&t.height===e.height?e:t})};return rC?rC.addEventListener("resize",e):window.addEventListener("resize",e),()=>{rC?rC.removeEventListener("resize",e):window.removeEventListener("resize",e)}},[]),t}();return{"--be-viewport-height":`${t}px`,"--be-viewport-width":`${e}px`}}const ZA={initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:"tween",duration:.125}},JA=p(({children:t,style:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o,isContextMenu:s,isOpen:l,onClose:d,triggerRef:h,arrowRef:f,arrowStyle:p,onPointerLeave:g,onPointerEnter:m},v)=>{const y=KA(),b=tC(v),{domProps:w}=function({onClose:e,isDismissable:t=!0,triggerRef:r,isContextMenu:n=!1},i){const o=u({isPointerDown:!1,isContextMenu:n,onClose:e}),s=o.current;s.isContextMenu=n,s.onClose=e;const l=c(e=>{const t=e.target;if(t){const e=t.ownerDocument;if(!e||!e.documentElement.contains(t))return!1}return i.current&&!i.current.contains(t)},[i]),d=c(()=>QA[QA.length-1]===i,[i]),h=c(()=>{d()&&s.onClose()},[d,s]),f=c(e=>{var t,n;return!(!r.current||!("contains"in r.current))&&(null==(n=(t=r.current).contains)?void 0:n.call(t,e))},[r]),p=c(e=>{f(e.target)||d()&&(e.stopPropagation(),e.preventDefault())},[f,d]),g=c(e=>{f(e.target)||(d()&&(e.stopPropagation(),e.preventDefault()),(!s.isContextMenu||2!==e.button)&&h())},[f,h,s,d]);return a(()=>{QA.push(i);const e=e=>{l(e)&&(p(e),o.current.isPointerDown=!0)},t=e=>{o.current.isPointerDown&&l(e)&&(o.current.isPointerDown=!1,g(e))},n=e=>{e.preventDefault(),l(e)&&h()},a=e=>{if(!r.current)return;const t=e.target;let n;r.current instanceof Node?n=r.current:"contextElement"in r.current&&(n=r.current.contextElement),(!(t instanceof Node)||!n||t.contains(n))&&s.onClose()};return document.addEventListener("pointerdown",e,!0),document.addEventListener("pointerup",t,!0),document.addEventListener("contextmenu",n,!0),document.addEventListener("scroll",a,!0),()=>{const r=QA.indexOf(i);r>=0&&QA.splice(r,1),document.removeEventListener("pointerdown",e,!0),document.removeEventListener("pointerup",t,!0),document.removeEventListener("contextmenu",n,!0),document.removeEventListener("scroll",a,!0)}},[i,l,s,g,p,r,f,h]),{domProps:{onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),e.preventDefault(),h())}}}}({isDismissable:o,onClose:d,triggerRef:h,isContextMenu:s},b);return e(Sx.div,{className:"isolate z-popover",role:"presentation",ref:b,style:{...y,...r,position:"fixed"},...ZA,...qx(w,{onPointerLeave:g,onPointerEnter:m}),children:e(RA,{restoreFocus:i,autoFocus:n,contain:!1,children:t})})}),QA=[];const ek={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}};function tk({position:t="absolute",className:r,isTransparent:n=!1,disableInitialTransition:i,...o}){return e(Sx.div,{...o,className:af(r,!n&&"bg-background/80","inset-0 z-10 h-full w-full",t,"backdrop-blur-sm"),"aria-hidden":!0,initial:i?void 0:{opacity:0},animate:{opacity:1},exit:{opacity:0},...ek,transition:{duration:.15}})}const rk=p(({children:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o,isOpen:a,onClose:s},l)=>{const c=KA(),u=tC(l);return t("div",{className:"fixed inset-0 isolate z-tray",style:c,children:[e(tk,{onClick:()=>{o&&s()}},"tray-underlay"),e(Sx.div,{ref:u,className:"absolute bottom-0 left-0 right-0 z-20 mx-auto max-h-tray w-full max-w-375 overflow-hidden rounded-t pb-safe-area",role:"presentation",initial:{opacity:0,y:"100%"},animate:{opacity:1,y:0},exit:{opacity:0,y:"100%"},transition:{type:"tween",duration:.2},children:e(RA,{restoreFocus:i,autoFocus:n,contain:!0,children:r})})]})});function nk(e,t){if(e===t)return!0;if(!e||!t)return!1;const r=Object.keys(e),n=Object.keys(t),i=r.length;if(n.length!==i)return!1;for(let n=0;n<i;n++){const i=r[n];if(e[i]!==t[i]||!Object.prototype.hasOwnProperty.call(t,i))return!1}return!0}function ik(){const{i18n:e}=ym(e=>e.data);return{locale:e,localeCode:(null==e?void 0:e.language)||"en",lines:null==e?void 0:e.lines}}function ok(e,{message:t,values:r}){const n=t.match(/\[(.+?)]/),i=null==r?void 0:r.count;if(n&&n[1]&&!Number.isNaN(i)){const[r,o]=n,a=o.split("|");if(!a.length)return t;const s=ak(e).select(i);let l=a.find(e=>e.startsWith(s));l||(l=a[0]);const c=l.substring(l.indexOf(" ")+1);return t.replace(r,c)}return t}const ak=X_(e=>new Intl.PluralRules(e));function sk(e,t){return null!=e&&(void 0!==Object.hasOwn?Object.hasOwn(e,t):Object.hasOwnProperty(t))}const lk=f(t=>{const{message:r,values:n}=t,{lines:i,localeCode:o}=ik();let a;if(a=sk(i,r)?null==i?void 0:i[r]:sk(i,null==r?void 0:r.toLowerCase())?null==i?void 0:i[null==r?void 0:r.toLowerCase()]:r,!n||!a)return e(y,{children:a});a=ok(o,{message:a,values:n});const s=[],l=[];if(Object.entries(n).forEach(([e,t])=>{"function"==typeof t?l.push(e):v(t)?s.push(e):null!=t&&(a=null==a?void 0:a.replace(`:${e}`,`${t}`))}),l.length||s.length){const t=[];if(l.length){const e=l.join("");t.push(`(<[${e}]>.+?<\\/[${e}]>)`)}if(s.length){const e=s.join("|");t.push(`(:(?:${e}))`)}const r=new RegExp(t.join("|"),"gm"),i=a.split(r).filter(Boolean).map((e,t)=>{if(e.startsWith("<")&&e.endsWith(">")){const r=e.match(/<([a-z]+)>(.+?)<\/([a-z]+)>/);if(r){const[,e,i]=r,o=null==n?void 0:n[e];if("function"==typeof o){const e=o(i);return w(e,{key:t})}}}if(e.startsWith(":")){const r=e.replace(":",""),i=null==n?void 0:n[r];if(v(i))return w(i,{key:t})}return e});return e(y,{children:i})}return e(y,{children:a})},function(e,t){const{values:r,...n}=e,{values:i,...o}=t;return nk(i,r)&&nk(n,o)});function ck({listbox:r,children:n,isLoading:i,mobileOverlay:o=rk,searchField:a,onClose:s,prepend:l,className:c,...u}){const h=mA(),{floatingWidth:f,floatingMinWidth:p="min-w-180",collection:g,showEmptyMessage:m,state:{isOpen:v,setIsOpen:y},positionStyle:b,floating:x,refs:C}=r,_=!l&&h?o:JA,S=af("text-base sm:text-sm outline-none bg max-h-inherit flex flex-col",!l&&"shadow-xl border py-4",c,_===JA&&"rounded-panel",_===JA&&"auto"===f?`max-w-288 ${p}`:""),A=d(()=>{let e=0;const t=[];return[...g.values()].reduce((r,n)=>{if(n.section){if(!t.includes(n.section)){const i=w(n.section,{key:n.section.key||e,index:e});r.push(i),t.push(n.section),e++}}else r.push(w(n.element,{key:n.element.key||n.element.props.value}));return r},[])},[g]),k=A.length>0||m&&!i,E=k?t("div",{className:S,role:"presentation",children:[a,e(uk,{isLoading:i,...u,children:A})]}):null;return t(V_.Provider,{value:r,children:[n,l?E:gm&&ke(e(Ox,{children:v&&k&&e(_,{triggerRef:C.reference,restoreFocus:!0,isOpen:v,onClose:()=>{null==s||s(),y(!1)},isDismissable:!0,style:b,ref:x,children:E})}),gm)]})}function uk({className:t,children:r,isLoading:n,...i}){const{role:o,listboxId:s,virtualFocus:l,focusItem:c,state:{activeIndex:d,setActiveIndex:h,selectedIndex:f}}=H_(),p=u(!0),g=u(null);return a(()=>()=>h(null),[h]),a(()=>{if(p.current){const e=d??f;null!=e||l?null!=e&&requestAnimationFrame(()=>{c("increment",e)}):requestAnimationFrame(()=>{var e;null==(e=g.current)||e.focus({preventScroll:!0})})}p.current=!1},[d,f,c,l]),e("div",{tabIndex:l?void 0:-1,role:o,id:s,className:"flex-auto overflow-y-auto overscroll-contain outline-none",ref:g,...i,children:r.length?r:e(dk,{})})}function dk(){return e("div",{className:"px-8 py-4 text-sm italic text-muted",children:e(lk,{message:"There are no items matching your query"})})}function hk({state:{isOpen:e,setIsOpen:t,selectedIndex:r,activeIndex:n,setInputValue:i,setActiveIndex:o},focusLoopingMode:a,collection:s,focusItem:l,handleItemSelection:c,allowCustomValue:u}){const d=n=>{if(!e&&n.currentTarget.contains(n.target)){if("ArrowDown"===n.key)return n.preventDefault(),t(!0),l("increment",r??0),!0;if("ArrowUp"===n.key)return n.preventDefault(),t(!0),l("decrement",r??s.size-1),!0;if("Enter"===n.key||"Space"===n.key)return n.preventDefault(),t(!0),l("increment",r??0),!0}},h=r=>{const i=Math.max(0,s.size-1);if(e&&r.currentTarget.contains(r.target))switch(r.key){case"ArrowDown":return r.preventDefault(),null==n?l("increment",0):n>=i?"loop"===a?l("increment",0):"deselect"===a&&o(null):l("increment",n+1),!0;case"ArrowUp":return r.preventDefault(),null==n?l("decrement",i):n<=0?"loop"===a?l("decrement",i):"deselect"===a&&o(null):l("decrement",n-1),!0;case"Home":return r.preventDefault(),l("increment",0),!0;case"End":return r.preventDefault(),l("decrement",i),!0;case"Tab":return t(!1),!0}};return{handleTriggerKeyDown:d,handleListboxKeyboardNavigation:h,handleListboxSearchFieldKeydown:r=>{var o,a;if("Enter"===r.key&&null!=n&&s.size){r.preventDefault();const[e,t]=[...s.entries()][n];return void(e&&(c(e),null==(a=(o=t.element.props).onSelected)||a.call(o)))}"Escape"===r.key&&e&&(t(!1),u||i("")),d(r)||h(r)}}}const fk=new Map;function pk(){const e=function(e){const{localeCode:t}=ik(),r=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(fk.has(r))return fk.get(r);const n=new Intl.Collator(t,e);return fk.set(r,n),n}({usage:"search",sensitivity:"base"}),t=u({search:"",timeout:void 0}).current,r=(r,n)=>{let i=n??0;for(;null!=i;){const n=r[i],o=null==n?void 0:n.slice(0,t.search.length);if(o&&0===e.compare(o,t.search))return i;if(!(i<r.length-1))return null;i++}return null};return{findMatchingItem:(e,n,i=0)=>{const o=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(e.key);if(!o||e.ctrlKey||e.metaKey)return null;" "===o&&t.search.trim().length>0&&(e.preventDefault(),e.stopPropagation()),t.search+=o;let a=r(n,i);return null==a&&(a=r(n,0)),clearTimeout(t.timeout),t.timeout=setTimeout(()=>{t.search=""},500),a??null}}}function gk(e){return function(e,{noSSR:t}={noSSR:!0}){const r=typeof window<"u"&&"function"==typeof window.matchMedia,[n,i]=o(t?()=>!!r&&window.matchMedia(e).matches:null);return a(()=>{if(!r)return;const n=window.matchMedia(e),o=()=>{i(n.matches)};return n.addEventListener("change",o),t||o(),()=>{n.removeEventListener("change",o)}},[r,e,t]),typeof window>"u"?null:n}("(max-width: 768px)",e)}const mk=cf(e("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),"SearchOutlined");var vk=e=>null==e;var yk=e=>!vk(e)&&!Array.isArray(e)&&(e=>"object"==typeof e)(e)&&!(e=>e instanceof Date)(e),bk=e=>yk(e)&&e.target?(e=>"checkbox"===e.type)(e.target)?e.target.checked:e.target.value:e,wk=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function xk(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(wk&&(e instanceof Blob||e instanceof FileList)||!r&&!yk(e))return e;if(t=r?[]:{},r||(e=>{const t=e.constructor&&e.constructor.prototype;return yk(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=xk(e[r]));else t=e}return t}var Ck=e=>Array.isArray(e)?e.filter(Boolean):[],_k=e=>void 0===e,Sk=(e,t,r)=>{if(!t||!yk(e))return r;const n=Ck(t.split(/[,[\].]+?/)).reduce((e,t)=>vk(e)?e:e[t],e);return _k(n)||n===e?_k(e[t])?r:e[t]:n},Ak=e=>"boolean"==typeof e,kk=(e,t,r)=>{let n=-1;const i=(e=>/^\w*$/.test(e))(t)?[t]:(e=>Ck(e.replace(/["|']|\]/g,"").split(/\.|\[/)))(t),o=i.length,a=o-1;for(;++n<o;){const t=i[n];let o=r;if(n!==a){const r=e[t];o=yk(r)||Array.isArray(r)?r:isNaN(+i[n+1])?{}:[]}if("__proto__"===t)return;e[t]=o,e=e[t]}return e};const Ek="blur",Ik="change",Tk="all",Fk=i.createContext(null),Ok=()=>i.useContext(Fk);var Pk=(e,t,r,n)=>{r(e);const{name:i,...o}=e;return(e=>yk(e)&&!Object.keys(e).length)(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(e=>!0===t[e])},Mk=(e,t,r)=>!e||!t||e===t||(e=>Array.isArray(e)?e:[e])(e).some(e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e)));function Rk(e){const t=i.useRef(e);t.current=e,i.useEffect(()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}function Lk(e){const t=Ok(),{control:r=t.control,disabled:n,name:o,exact:a}=e||{},[s,l]=i.useState(r._formState),c=i.useRef(!0),u=i.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=i.useRef(o);return d.current=o,Rk({disabled:n,next:e=>c.current&&Mk(d.current,e.name,a)&&Pk(e,u.current,r._updateFormState)&&l({...r._formState,...e}),subject:r._subjects.state}),i.useEffect(()=>(c.current=!0,u.current.isValid&&r._updateValid(!0),()=>{c.current=!1}),[r]),((e,t,r,n=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Tk&&(t._proxyFormState[i]=!n||Tk),r&&(r[i]=!0),e[i]}});return i})(s,r,u.current,!1)}function Nk(e){const t=Ok(),{control:r=t.control,name:n,defaultValue:o,disabled:a,exact:s}=e||{},l=i.useRef(n);l.current=n,Rk({disabled:a,subject:r._subjects.values,next:e=>{Mk(l.current,e.name,s)&&u(xk(((e,t,r,n,i)=>(e=>"string"==typeof e)(e)?Sk(r,e,i):Array.isArray(e)?e.map(e=>Sk(r,e)):r)(l.current,r._names,e.values||r._formValues,0,o)))}});const[c,u]=i.useState(r._getWatch(n,o));return i.useEffect(()=>r._removeUnmounted()),c}function jk(e={}){const{size:t="md",startAppend:r,endAppend:n,className:i,labelPosition:o,labelDisplay:a="block",inputClassName:s,inputWrapperClassName:l,unstyled:c,invalid:u,disabled:d,background:h="bg-transparent",flexibleHeight:f,inputShadow:p="shadow-sm",descriptionPosition:g="bottom",inputRing:m,inputFontSize:v,labelSuffix:y}={...e};if(c)return{label:"",input:s||"",wrapper:i||"",inputWrapper:l||"",adornment:"",append:{size:"",radius:""},size:{font:"",height:""},description:"",error:""};const b=function({size:e,flexibleHeight:t}){switch(e){case"2xs":return{font:"text-xs",height:t?"min-h-24":"h-24"};case"xs":return{font:"text-xs",height:t?"min-h-30":"h-30"};case"sm":return{font:"text-sm",height:t?"min-h-36":"h-36"};case"lg":return{font:"text-md md:text-lg",height:t?"min-h-50":"h-50"};case"xl":return{font:"text-xl",height:t?"min-h-60":"h-60"};default:return{font:"text-sm",height:t?"min-h-42":"h-42"}}}({size:e.size,flexibleHeight:f});v&&(b.font=v);const w=r||n,x=m||"focus:ring "+(u?"focus:ring-danger/focus focus:border-danger/60":"focus:ring-primary/focus focus:border-primary/60"),C=function(e){const{startAppend:t,endAppend:r,inputRadius:n}=e,i=t||r;return"rounded-full"===n?{input:af(!i&&"rounded-full",t&&"rounded-r-full rounded-l-none",r&&"rounded-l-full rounded-r-none"),append:t?"rounded-l-full":"rounded-r-full"}:"rounded-none"===n?{input:"",append:""}:n?{input:n,append:n}:{input:af(!i&&"rounded-input",t&&"rounded-r-input rounded-l-none",r&&"rounded-l-input rounded-r-none"),append:t?"rounded-l-input":"rounded-r-input"}}(e);return{label:af(a,"first-letter:capitalize text-left whitespace-nowrap",d&&"text-disabled",b.font,y?"":"side"===o?"mr-16":"mb-4"),input:af("block text-left relative w-full appearance-none transition-shadow text",h,C.input,Dk(e),!d&&`${x} focus:outline-none ${p}`,d&&"text-disabled cursor-not-allowed",s,b.font,b.height,zk(e)),adornment:Bk(t),append:{size:N_(t),radius:C.append},wrapper:af(i,b.font,{"flex items-center":"side"===o}),inputWrapper:af("isolate relative",l,w&&"flex items-stretch"),size:b,description:`text-muted ${"bottom"===g?"pt-10":"pb-10"} text-xs`,error:"text-danger pt-10 text-xs"}}function Dk({startAppend:e,endAppend:t,inputBorder:r,invalid:n}){if(r)return r;const i=n?"border-danger":"border-divider";return e||t?e?`${i} border-y border-r`:`${i} border-y border-l`:`${i} border`}function zk({startAdornment:e,endAdornment:t,inputRadius:r}){return"rounded-full"===r?af(e?"pl-54":"pl-28",t?"pr-54":"pr-28"):af(e?"pl-46":"pl-12",t?"pr-46":"pr-12")}function Bk(e){switch(e){case"2xs":return"icon-2xs";case"xs":return"icon-xs";case"sm":case"md":return"icon-sm";case"lg":return"icon-lg";case"xl":return"icon-xl";default:return""}}function Uk({children:t,direction:r,className:n,position:i=("start"===r?"left-0":"right-0")}){return t?e("div",{className:af("pointer-events-none absolute top-0 z-10 flex h-full min-w-42 items-center justify-center text-muted",i,n),children:t}):null}function Vk(e,t){const r={...e};return Object.keys(r).forEach(e=>{const t=e;(null==r[t]||""===r[t])&&delete r[t]}),r}const Hk=i.forwardRef((r,n)=>{const{children:i,description:o,errorMessage:a,descriptionProps:s={},errorMessageProps:l={},startAdornment:c,endAdornment:u,adornmentPosition:d,startAppend:h,endAppend:f,fieldClassNames:p,disabled:g,wrapperProps:m}=r;return t("div",{className:p.wrapper,ref:n,...m,children:[e(Wk,{...r}),t("div",{className:p.inputWrapper,children:[e(Uk,{direction:"start",className:p.adornment,position:d,children:c}),h&&e($k,{style:p.append,disabled:g,children:h}),i,f&&e($k,{style:p.append,disabled:g,children:f}),e(Uk,{direction:"end",className:p.adornment,position:d,children:u})]}),o&&!a&&e("div",{className:p.description,...s,children:o}),a&&e("div",{className:p.error,...l,children:a})]})});function Wk({labelElementType:r,fieldClassNames:n,labelProps:i,label:o,labelSuffix:a,labelSuffixPosition:s="spaced",required:l}){if(!o)return null;const c=t(r||"label",{className:n.label,...i,children:[o,l&&e("span",{className:"text-danger",children:" *"})]});return a?t("div",{className:af("mb-4 flex w-full gap-4","spaced"===s?"items-end":"items-center"),children:[c,e("div",{className:af("text-xs text-muted","spaced"===s?"ml-auto":""),children:a})]}):c}function $k({children:e,style:t,disabled:r}){return i.cloneElement(e,{...e.props,disabled:e.props.disabled||r,...Vk(t)})}function qk({autoFocus:e,autoSelectText:t},r){const n=u(e);a(()=>{n.current&&r.current&&requestAnimationFrame(()=>{var e,n;null==(e=r.current)||e.focus(),t&&"input"===(null==(n=r.current)?void 0:n.nodeName.toLowerCase())&&r.current.select()}),n.current=!1},[r,t])}function Gk(e){const{focusRef:t,labelElementType:r="label",label:n,labelSuffix:i,labelSuffixPosition:o,autoFocus:a,autoSelectText:s,labelPosition:l,descriptionPosition:c,size:u,errorMessage:d,description:h,flexibleHeight:f,startAdornment:p,endAdornment:g,startAppend:m,adornmentPosition:v,endAppend:y,className:w,inputClassName:x,inputWrapperClassName:C,unstyled:_,background:S,invalid:A,disabled:k,id:E,inputRadius:I,inputBorder:T,inputShadow:F,inputRing:O,inputFontSize:P,...M}=e;qk(e,t);const R=b(),L=E||R,N={id:`${L}-label`,htmlFor:"label"===r?L:void 0},j={id:`${L}-description`},D={id:`${L}-error`},z={"aria-label":e.label||e["aria-label"]||!e.placeholder?e["aria-label"]:e.placeholder,"aria-invalid":A||void 0,id:L,disabled:k,...M},B=[];n&&B.push(N.id),z["aria-labelledby"]&&B.push(z["aria-labelledby"]),z["aria-labelledby"]=B.length?B.join(" "):void 0;const U=[];return h&&U.push(j.id),d&&U.push(D.id),z["aria-describedby"]&&U.push(z["aria-describedby"]),z["aria-describedby"]=U.length?U.join(" "):void 0,{fieldProps:{errorMessageProps:D,descriptionProps:j,labelProps:N,disabled:k,label:n,labelSuffix:i,labelSuffixPosition:o,autoFocus:a,autoSelectText:s,labelPosition:l,descriptionPosition:c,size:u,errorMessage:d,description:h,flexibleHeight:f,startAdornment:p,endAdornment:g,startAppend:m,adornmentPosition:v,endAppend:y,className:w,inputClassName:x,inputWrapperClassName:C,unstyled:_,background:S,invalid:A},inputProps:z}}const Yk=p(({inputElementType:t="input",flexibleHeight:r,inputRef:n,inputTestId:i,...o},a)=>{const s=tC(n),{fieldProps:l,inputProps:c}=Gk({...o,focusRef:s}),u="textarea"===t,d=u?"textarea":"input",h=jk({...o,flexibleHeight:r||"textarea"===t});return"textarea"===t&&!o.unstyled&&(h.input=`${h.input} py-12`),e(Hk,{ref:a,fieldClassNames:h,...l,children:e(d,{"data-testid":i,ref:s,...c,rows:u?c.rows||4:void 0,className:h.input})})});i.forwardRef(({name:t,...r},n)=>{const{field:{onChange:o,onBlur:a,value:s="",ref:l},fieldState:{invalid:c,error:u}}=function(e){const t=Ok(),{name:r,disabled:n,control:o=t.control,shouldUnregister:a}=e,s=((e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)))(o._names.array,r),l=Nk({control:o,name:r,defaultValue:Sk(o._formValues,r,Sk(o._defaultValues,r,e.defaultValue)),exact:!0}),c=Lk({control:o,name:r}),u=i.useRef(o.register(r,{...e.rules,value:l,...Ak(e.disabled)?{disabled:e.disabled}:{}}));return i.useEffect(()=>{const e=o._options.shouldUnregister||a,t=(e,t)=>{const r=Sk(o._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){const e=xk(Sk(o._options.defaultValues,r));kk(o._defaultValues,r,e),_k(Sk(o._formValues,r))&&kk(o._formValues,r,e)}return()=>{(s?e&&!o._state.action:e)?o.unregister(r):t(r,!1)}},[r,o,s,a]),i.useEffect(()=>{Sk(o._fields,r)&&o._updateDisabledField({disabled:n,fields:o._fields,name:r,value:Sk(o._fields,r)._f.value})},[n,r,o]),{field:{name:r,value:l,...Ak(n)||c.disabled?{disabled:c.disabled||n}:{},onChange:i.useCallback(e=>u.current.onChange({target:{value:bk(e),name:r},type:Ik}),[r]),onBlur:i.useCallback(()=>u.current.onBlur({target:{value:Sk(o._formValues,r),name:r},type:Ek}),[r,o]),ref:e=>{const t=Sk(o._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Sk(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!Sk(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Sk(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Sk(c.validatingFields,r)},error:{enumerable:!0,get:()=>Sk(c.errors,r)}})}}({name:t}),d={onChange:o,onBlur:a,value:s??"",invalid:c,errorMessage:null==u?void 0:u.message,inputRef:l,name:t};return e(Yk,{ref:n,...qx(d,r)})});const Xk=p((t,r)=>{const{searchPlaceholder:n,showSearchField:i,children:[o,a],floatingWidth:s="auto",isLoading:l}=t,c=b(),u=gk(),d=gA({...t,clearInputOnItemSelection:!0,showEmptyMessage:i,floatingWidth:u?"auto":s,virtualFocus:i,role:i?"listbox":"menu",focusLoopingMode:i?"stay":"loop",children:a.props.children},r),{state:{isOpen:h,setIsOpen:f,activeIndex:p,inputValue:g,setInputValue:m},listboxId:v,focusItem:y,listContent:x,reference:C,onInputChange:_}=d,{handleTriggerKeyDown:S,handleListboxKeyboardNavigation:A,handleListboxSearchFieldKeydown:k}=hk(d),{findMatchingItem:E}=pk();return e(ck,{onClick:e=>e.stopPropagation(),listbox:d,onKeyDownCapture:i?void 0:e=>{if(!h)return;const t=E(e,x,p);null!=t&&y("increment",t)},onKeyDown:A,onClose:i?()=>m(""):void 0,"aria-labelledby":c,isLoading:l,searchField:i?e(Yk,{size:"sm",placeholder:n,startAdornment:e(mk,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":h?"true":"false","aria-haspopup":"listbox","aria-controls":h?v:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:g,onChange:_,onKeyDown:e=>{k(e)}}):null,children:w(o,{id:c,"aria-expanded":h?"true":"false","aria-haspopup":"menu","aria-controls":h?v:void 0,ref:C,onKeyDown:S,onClick:D_(e=>{var t,r;null==(r=null==(t=o.props)?void 0:t.onClick)||r.call(t,e),f(!h)})})})});function Kk({children:e}){return e}function Zk({item:r,button:n}){return t(Xk,{children:[n,e(Kk,{children:(r.menuItems||[]).map(t=>e(G_,{value:t.label,onSelected:()=>{t.action(_m().editor)},children:t.label},t.label))})]})}const Jk=p(({children:e,size:r="md",iconSize:n=(r&&r.length<=3?r:"md"),variant:i="text",radius:o="rounded-button",className:a,padding:s,equalWidth:l=!0,badge:c,...u},d)=>{const h=af(N_(r,{padding:s,equalWidth:l,variant:i}),a,c&&"relative");return t(z_,{...u,ref:d,radius:o,variant:i,className:h,children:[w(e,{size:n}),c]})});const Qk=i.memo(function({icon:t,className:r,size:n}){let o;return o=i.isValidElement(t)?i.cloneElement(t,{className:"svg-iconEl"}):"string"==typeof t?e("img",{className:"w-font h-font",src:t,alt:""}):Array.isArray(t)?i.createElement(uf(t),{size:n}):i.createElement(t,{size:n}),e("span",{className:af(r,"leading-none"),children:o})});function eE({value:t}){return t?e(lk,"string"==typeof t?{message:t}:{...t}):null}function tE({item:t}){const r=t.label?e(nE,{item:t}):e(rE,{item:t});return t.menuItems?e(Zk,{item:t,button:r}):i.cloneElement(r,{onClick:()=>{var e;null==(e=t.action)||e.call(t,_m().editor)}})}const rE=p(({item:t,...r},n)=>e(Jk,{ref:n,radius:"rounded-full",size:"sm",...r,children:e(Qk,{icon:t.icon})})),nE=p(({item:t,...r},n)=>e(B_,{ref:n,radius:"rounded-full",size:"xs",color:t.buttonColor||"primary",variant:t.buttonVariant||"flat",startIcon:t.icon&&e(Qk,{icon:t.icon}),...r,children:e(eE,{value:t.label})}));function iE({children:t,color:r,variant:n,radius:o="rounded-button",size:a,className:s,value:l,onChange:c,multiple:u,disabled:d}){const h=i.Children.map(t,(e,s)=>{if(i.isValidElement(e)){const h=(e=>void 0!==l&&(u?l.includes(e):e===l))(e.props.value),f=h?"primary":r;return i.cloneElement(e,{color:h?"primary":r,variant:n,size:a,radius:null,disabled:e.props.disabled||d,...e.props,onClick:t=>{e.props.onClick&&e.props.onClick(t),c&&(u?null==c||c((e=>{const t=[...l],r=l.indexOf(e);return r>-1?t.splice(r,1):t.push(e),t})(e.props.value)):null==c||c(e.props.value))},className:af(e.props.className,h?"z-20":"z-10",oE(s,t,o,f))})}});return e("div",{className:af(o,"isolate inline-flex",s),children:h})}function oE(e,t,r,n){return 0===e?af(r,"rounded-tr-none rounded-br-none",!n&&"border-r-transparent disabled:border-r-transparent"):e===t.length-1?af(r,"rounded-tl-none rounded-bl-none -ml-1"):af("rounded-none -ml-1",!n&&"border-r-transparent disabled:border-r-transparent")}const aE=cf(e("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"}),"UndoOutlined"),sE=cf(e("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"}),"RedoOutlined");function lE(){const r=Cm(e=>e.history.canUndo),n=Cm(e=>e.history.canRedo);return t(iE,{variant:"outline",children:[e(Jk,{equalWidth:!1,size:"xs",padding:"pl-12 pr-10",radius:"rounded-full",disabled:!r,onClick:()=>{Sm().history.undo()},children:e(aE,{})},"undo"),e(Jk,{equalWidth:!1,padding:"pl-10 pr-12",size:"xs",radius:"rounded-full",disabled:!n,onClick:()=>{Sm().history.redo()},children:e(sE,{})},"redo")]})}const cE=cf(e("path",{d:"M19 13H5v-2h14v2z"}),"RemoveOutlined"),uE=cf(e("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddOutlined");function dE(){var r,n;const i=Cm(e=>e.zoom)||1;return Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.zoom)?void 0:r.allowUserZoom})??1?t("div",{className:"flex items-center select-none",children:[e(Jk,{size:"sm",disabled:!(null!=(r=Sm().zoom)&&r.canZoomOut()),onClick:()=>{Sm().zoom.zoomOut(Sm().zoom.step)},children:e(cE,{})}),t("div",{className:"w-[4ch] text-sm text-center",children:[Math.round(100*i),"%"]}),e(Jk,{size:"sm",disabled:!(null!=(n=Sm().zoom)&&n.canZoomIn()),onClick:()=>{Sm().zoom.zoomIn(Sm().zoom.step)},children:e(uE,{})})]}):null}function hE({item:t}){switch(t.type){case"undoWidget":return e(lE,{});case"zoomWidget":return e(dE,{});case"button":return e(tE,{item:t});case"image":return e("img",{className:"h-30 object-cover",src:EC(t.src),alt:""});default:return null}}const fE=cf(e("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"}),"CloseOutlined");function pE(){var e;let t=Cm(e=>{var t;return(null==(t=e.config.ui)?void 0:t.mode)===Yh.OVERLAY});const{width:r}=Cm(e=>e.stageSize),n=r<=700;return n&&null!=(e=_m().config.ui)&&e.forceOverlayModeOnMobile&&(t=!0),{isModal:t,isMobile:n}}function gE(){const{isModal:r,isMobile:n}=pE(),i=Cm(e=>{var t;return null==(t=e.config.ui)?void 0:t.allowEditorClose})??!0,o=Cm(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.menubar)?void 0:r.items}),{left:a,center:s,right:l}=d(()=>function(e,t){const r={left:[],center:[],right:[]};(e||[]).filter(e=>!t&&!e.mobileOnly||t&&!e.desktopOnly).forEach(e=>{"left"===e.align?r.left.push({...e,position:e.position??1}):"right"===e.align?r.right.push({...e,position:e.position??1}):r.center.push({...e,position:e.position??1})});const n=Object.entries(r).map(([e,t])=>[e,t.sort((e,t)=>(e.position??0)-(t.position??0))]);return Object.fromEntries(n)}(o||[],n),[o,n]),c=r&&n&&i&&e(Jk,{size:"sm",className:"ml-10",onClick:()=>{_m().editor.close()},children:e(fE,{})});return t(Sx.div,{className:R_,...L_,children:[e("div",{className:"mr-auto flex items-center gap-8",children:a.map((t,r)=>e(hE,{item:t},r))}),e("div",{className:"flex items-center gap-10",children:s.map((t,r)=>e(hE,{item:t},r))}),e("div",{className:"ml-auto flex items-center gap-8",children:l.map((t,r)=>e(hE,{item:t},r))}),c]})}function mE(){const t=Cm(e=>{var t;return null==(t=e.crop.zoneRect)?void 0:t.width})||1,r=Cm(e=>{var t;return null==(t=e.crop.zoneRect)?void 0:t.height})||1;return e("div",{className:"text-sm",children:`${t}x${r}`})}function vE(){const r=Cm(e=>e.activeTool);return t(Sx.div,{className:R_,...L_,children:[e(yE,{}),bE(r),e(wE,{})]})}function yE(){const{isMobile:t}=pE(),r=Cm(e=>e.dirty);return t?e(Jk,{size:"sm",onClick:()=>{_m().cancelChanges()},children:e(fE,{})}):e(B_,{variant:"outline",size:"xs",startIcon:e(fE,{}),radius:"rounded-full",className:"min-w-92",onClick:()=>{_m().cancelChanges()},children:e(lk,r?{message:"Cancel"}:{message:"Close"})})}function bE(t){var r,n;if(!t)return null;const i=e("div",{className:"capitalize text-sm",children:e(lk,{message:t})});return t===nf.CROP&&((null==(n=null==(r=_m().config.tools)?void 0:r.crop)?void 0:n.allowCustomRatio)??1)?e(mE,{}):i}function wE(){const{isMobile:t}=pE(),r=Cm(e=>e.dirty);return t?e(Jk,{size:"sm",disabled:!r,onClick:()=>{_m().applyChanges()},children:e(W_,{})}):e(B_,{variant:"flat",color:"primary",size:"xs",disabled:!r,startIcon:e(W_,{}),radius:"rounded-full",onClick:()=>{_m().applyChanges()},children:e(lk,{message:"Apply"})})}function xE(){const t=Cm(e=>e.activeTool);return e(Ox,{initial:!1,children:t?e(vE,{},"activeToolbar"):e(gE,{},"mainToolbar")})}const CE={newCanvas:Kh("Loading Canvas"),mainImage:Kh("Loading Image"),state:Kh("Loading State"),merge:Kh("Processing Image")};function _E(){const[t,r]=o(!1);return a(()=>{Cm.subscribe(e=>e.loading,e=>{e&&r(e)})},[]),e(Ox,{children:t&&e(Sx.div,{initial:{y:"60%",opacity:0},animate:{y:0,opacity:1},exit:{y:"-60%",opacity:0},transition:{type:"tween",duration:.3},onAnimationComplete:()=>{setTimeout(()=>{r(!1)},400)},className:"absolute z-loading-indicator inset-0 m-auto p-6 w-144 h-32 text-center text-sm bg-paper rounded-full shadow-lg",children:e(lk,{...CE[t]})})})}const SE={toVector:(e,t)=>(void 0===e&&(e=t),Array.isArray(e)?e:[e,e]),add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function AE(e,t,r){return 0===t||Math.abs(t)===1/0?Math.pow(e,5*r):e*t*r/(t+r*e)}function kE(e,t,r,n=.15){return 0===n?function(e,t,r){return Math.max(t,Math.min(e,r))}(e,t,r):e<t?-AE(t-e,r-t,n)+t:e>r?+AE(e-r,r-t,n)+r:e}function EE(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function IE(e,t,r){return(t=EE(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function FE(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?TE(Object(r),!0).forEach(function(t){IE(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TE(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const OE={pointer:{start:"down",change:"move",end:"up"},mouse:{start:"down",change:"move",end:"up"},touch:{start:"start",change:"move",end:"end"},gesture:{start:"start",change:"change",end:"end"}};function PE(e){return e?e[0].toUpperCase()+e.slice(1):""}const ME=["enter","leave"];function RE(e,t="",r=!1){const n=OE[e],i=n&&n[t]||t;return"on"+PE(e)+PE(i)+(function(e=!1,t){return e&&!ME.includes(t)}(r,i)?"Capture":"")}const LE=["gotpointercapture","lostpointercapture"];function NE(e){let t=e.substring(2).toLowerCase();const r=!!~t.indexOf("passive");r&&(t=t.replace("passive",""));const n=LE.includes(t)?"capturecapture":"capture",i=!!~t.indexOf(n);return i&&(t=t.replace("capture","")),{device:t,capture:i,passive:r}}function jE(e){return"touches"in e}function DE(e){return jE(e)?"touch":"pointerType"in e?e.pointerType:"mouse"}function zE(e){return jE(e)?function(e){return"touchend"===e.type||"touchcancel"===e.type?e.changedTouches:e.targetTouches}(e)[0]:e}function BE(e,t){try{const r=t.clientX-e.clientX,n=t.clientY-e.clientY,i=(t.clientX+e.clientX)/2,o=(t.clientY+e.clientY)/2,a=Math.hypot(r,n);return{angle:-180*Math.atan2(r,n)/Math.PI,distance:a,origin:[i,o]}}catch{}return null}function UE(e){return function(e){return Array.from(e.touches).filter(t=>{var r,n;return t.target===e.currentTarget||(null===(r=e.currentTarget)||void 0===r||null===(n=r.contains)||void 0===n?void 0:n.call(r,t.target))})}(e).map(e=>e.identifier)}function VE(e,t){const[r,n]=Array.from(e.touches).filter(e=>t.includes(e.identifier));return BE(r,n)}function HE(e){const t=zE(e);return jE(e)?t.identifier:t.pointerId}function WE(e){const t=zE(e);return[t.clientX,t.clientY]}function $E(e){let{deltaX:t,deltaY:r,deltaMode:n}=e;return 1===n?(t*=40,r*=40):2===n&&(t*=800,r*=800),[t,r]}function qE(e,...t){return"function"==typeof e?e(...t):e}function GE(){}function YE(...e){return 0===e.length?GE:1===e.length?e[0]:function(){let t;for(const r of e)t=r.apply(this,arguments)||t;return t}}function XE(e,t){return Object.assign({},t,e||{})}class KE{constructor(e,t,r){this.ctrl=e,this.args=t,this.key=r,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:r,args:n}=this;t[r]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=n,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,r=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=r.from?qE(r.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:r,shared:n}=this;t.args=this.args;let i=0;if(e&&(t.event=e,r.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,n.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,n.locked=!!document.pointerLockElement,Object.assign(n,function(e){const t={};if("buttons"in e&&(t.buttons=e.buttons),"shiftKey"in e){const{shiftKey:r,altKey:n,metaKey:i,ctrlKey:o}=e;Object.assign(t,{shiftKey:r,altKey:n,metaKey:i,ctrlKey:o})}return t}(e)),n.down=n.pressed=n.buttons%2==1||n.touches>0,i=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const e=t._delta.map(Math.abs);SE.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[s,l]=r.threshold,{_step:c,values:u}=t;if(r.hasCustomTransform?(!1===c[0]&&(c[0]=Math.abs(o)>=s&&u[0]),!1===c[1]&&(c[1]=Math.abs(a)>=l&&u[1])):(!1===c[0]&&(c[0]=Math.abs(o)>=s&&Math.sign(o)*s),!1===c[1]&&(c[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=!1!==c[0]||!1!==c[1],!t.intentional)return;const d=[0,0];if(r.hasCustomTransform){const[e,t]=u;d[0]=!1!==c[0]?e-c[0]:0,d[1]=!1!==c[1]?t-c[1]:0}else d[0]=!1!==c[0]?o-c[0]:0,d[1]=!1!==c[1]?a-c[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);const h=t.offset,f=t._active&&!t._blocked||t.active;f&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=n[this.ingKey]=t._active,e&&(t.first&&("bounds"in r&&(t._bounds=qE(r.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));const[p,g]=t.offset,[[m,v],[y,b]]=t._bounds;t.overflow=[p<m?-1:p>v?1:0,g<y?-1:g>b?1:0],t._movementBound[0]=!!t.overflow[0]&&(!1===t._movementBound[0]?t._movement[0]:t._movementBound[0]),t._movementBound[1]=!!t.overflow[1]&&(!1===t._movementBound[1]?t._movement[1]:t._movementBound[1]);const w=t._active&&r.rubberband||[0,0];if(t.offset=function(e,[t,r],[n,i]){const[[o,a],[s,l]]=e;return[kE(t,o,a,n),kE(r,s,l,i)]}(t._bounds,t.offset,w),t.delta=SE.sub(t.offset,h),this.computeMovement(),f&&(!t.last||i>32)){t.delta=SE.sub(t.offset,h);const e=t.delta.map(Math.abs);SE.addTo(t.distance,e),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&i>0&&(t.velocity=[e[0]/i,e[1]/i],t.timeDelta=i)}}emit(){const e=this.state,t=this.shared,r=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!r.triggerAllEvents)return;const n=this.handler(FE(FE(FE({},t),e),{},{[this.aliasKey]:e.values}));void 0!==n&&(e.memo=n)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class ZE extends KE{constructor(...e){super(...e),IE(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=SE.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=SE.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,r=this.config;if(!t.axis&&e){const n="object"==typeof r.axisThreshold?r.axisThreshold[DE(e)]:r.axisThreshold;t.axis=function([e,t],r){const n=Math.abs(e),i=Math.abs(t);return n>i&&n>r?"x":i>n&&i>r?"y":void 0}(t._movement,n)}t._blocked=(r.lockDirection||!!r.axis)&&!t.axis||!!r.axis&&r.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0}}}const JE=e=>e,QE={enabled:(e=!0)=>e,eventOptions:(e,t,r)=>FE(FE({},r.shared.eventOptions),e),preventDefault:(e=!1)=>e,triggerAllEvents:(e=!1)=>e,rubberband(e=0){switch(e){case!0:return[.15,.15];case!1:return[0,0];default:return SE.toVector(e)}},from:e=>"function"==typeof e?e:null!=e?SE.toVector(e):void 0,transform(e,t,r){const n=e||r.shared.transform;return this.hasCustomTransform=!!n,n||JE},threshold:e=>SE.toVector(e,0)},eI=FE(FE({},QE),{},{axis(e,t,{axis:r}){if(this.lockDirection="lock"===r,!this.lockDirection)return r},axisThreshold:(e=0)=>e,bounds(e={}){if("function"==typeof e)return t=>eI.bounds(e(t));if("current"in e)return()=>e.current;if("function"==typeof HTMLElement&&e instanceof HTMLElement)return e;const{left:t=-1/0,right:r=1/0,top:n=-1/0,bottom:i=1/0}=e;return[[t,r],[n,i]]}}),tI={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]};const rI=typeof window<"u"&&window.document&&window.document.createElement;function nI(){return rI&&"ontouchstart"in window}const iI={isBrowser:rI,gesture:function(){try{return"constructor"in GestureEvent}catch{return!1}}(),touch:nI(),touchscreen:nI()||rI&&window.navigator.maxTouchPoints>1,pointer:rI&&"onpointerdown"in window,pointerLock:rI&&"exitPointerLock"in window.document},oI={mouse:0,touch:0,pen:8},aI=FE(FE({},eI),{},{device(e,t,{pointer:{touch:r=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&iI.pointerLock,iI.touch&&r?"touch":this.pointerLock?"mouse":iI.pointer&&!i?"pointer":iI.touch?"touch":"mouse"},preventScrollAxis(e,t,{preventScroll:r}){if(this.preventScrollDelay="number"==typeof r?r:r||void 0===r&&e?250:void 0,iI.touchscreen&&!1!==r)return e||(void 0!==r?"y":void 0)},pointerCapture(e,t,{pointer:{capture:r=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&"pointer"===this.device&&r},threshold(e,t,{filterTaps:r=!1,tapsThreshold:n=3,axis:i}){const o=SE.toVector(e,r?n:i?1:0);return this.filterTaps=r,this.tapsThreshold=n,o},swipe({velocity:e=.5,distance:t=50,duration:r=250}={}){return{velocity:this.transform(SE.toVector(e)),distance:this.transform(SE.toVector(t)),duration:r}},delay(e=0){switch(e){case!0:return 180;case!1:return 0;default:return e}},axisThreshold:e=>e?FE(FE({},oI),e):oI,keyboardDisplacement:(e=10)=>e});const sI=FE(FE({},QE),{},{device(e,t,{shared:r,pointer:{touch:n=!1}={}}){if(r.target&&!iI.touch&&iI.gesture)return"gesture";if(iI.touch&&n)return"touch";if(iI.touchscreen){if(iI.pointer)return"pointer";if(iI.touch)return"touch"}},bounds(e,t,{scaleBounds:r={},angleBounds:n={}}){const i=e=>{const t=XE(qE(r,e),{min:-1/0,max:1/0});return[t.min,t.max]},o=e=>{const t=XE(qE(n,e),{min:-1/0,max:1/0});return[t.min,t.max]};return"function"!=typeof r&&"function"!=typeof n?[i(),o()]:e=>[i(e),o(e)]},threshold(e,t,r){return this.lockDirection="lock"===r.axis,SE.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey:e=>void 0===e?"ctrlKey":e,pinchOnWheel:(e=!0)=>e});FE(FE({},eI),{},{mouseOnly:(e=!0)=>e}),FE(FE({},eI),{},{mouseOnly:(e=!0)=>e});const lI=new Map,cI=new Map;function uI(e){lI.set(e.key,e.engine),cI.set(e.key,e.resolver)}const dI={key:"drag",engine:class extends ZE{constructor(...e){super(...e),IE(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),r=e.currentTarget.getBoundingClientRect(),n={left:t.left-r.left+e.offset[0],right:t.right-r.right+e.offset[0],top:t.top-r.top+e.offset[1],bottom:t.bottom-r.bottom+e.offset[1]};e._bounds=eI.bounds(n)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,r=this.state;if(null!=e.buttons&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):-1!==t.pointerButtons&&t.pointerButtons!==e.buttons))return;const n=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(n&&n.size>1&&r._pointerActive)&&(this.start(e),this.setupPointer(e),r._pointerId=HE(e),r._pointerActive=!0,this.computeValues(WE(e)),this.computeInitial(),t.preventScrollAxis&&"mouse"!==DE(e)?(r._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,r=this.config;if(!t._pointerActive)return;const n=HE(e);if(void 0!==t._pointerId&&n!==t._pointerId)return;const i=WE(e);return document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=SE.sub(i,t._values),this.computeValues(i)),SE.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional?(this.timeoutStore.remove("dragDelay"),t.active=!1,void this.startPointerDrag(e)):r.preventScrollAxis&&!t._preventScroll?t.axis?t.axis===r.preventScrollAxis||"xy"===r.preventScrollAxis?(t._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(e)):void 0:void this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,r=this.config;if(!t._active||!t._pointerActive)return;const n=HE(e);if(void 0!==t._pointerId&&n!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[i,o]=t._distance;if(t.tap=i<=r.tapsThreshold&&o<=r.tapsThreshold,t.tap&&r.filterTaps)t._force=!0;else{const[e,n]=t._delta,[i,o]=t._movement,[a,s]=r.swipe.velocity,[l,c]=r.swipe.distance,u=r.swipe.duration;if(t.elapsedTime<u){const r=Math.abs(e/t.timeDelta),u=Math.abs(n/t.timeDelta);r>a&&Math.abs(i)>l&&(t.swipe[0]=Math.sign(e)),u>s&&Math.abs(o)>c&&(t.swipe[1]=Math.sign(n))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,r=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,r,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,r,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,function(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=tI[e.key];if(t){const r=this.state,n=e.shiftKey?10:e.altKey?.1:1;this.start(e),r._delta=t(this.config.keyboardDisplacement,n),r._keyboardActive=!0,SE.addTo(r._movement,r._delta),this.compute(e),this.emit()}}keyUp(e){e.key in tI&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},resolver:aI},hI={key:"pinch",engine:class extends KE{constructor(...e){super(...e),IE(this,"ingKey","pinching"),IE(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:r}=this.state;this.state.offset="wheel"===e?SE.add(t,r):[(1+t[0])*r[0],t[1]+r[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,r]=e._movement;if(!e.axis){const n=30*Math.abs(t)-Math.abs(r);n<0?e.axis="angle":n>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&("scale"===this.state.axis?e[1]=0:"angle"===this.state.axis&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,r=this.ctrl.touchIds;if(t._active&&t._touchIds.every(e=>r.has(e))||r.size<2)return;this.start(e),t._touchIds=Array.from(r).slice(0,2);const n=VE(e,t._touchIds);n&&this.pinchStart(e,n)}pointerStart(e){if(null!=e.buttons&&e.buttons%2!=1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,r=t._pointerEvents,n=this.ctrl.pointerIds;if(t._active&&Array.from(r.keys()).every(e=>n.has(e))||(r.size<2&&r.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const i=BE(...Array.from(r.values()));i&&this.pinchStart(e,i)}pinchStart(e,t){this.state.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=VE(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const r=BE(...Array.from(t.values()));r&&this.pinchMove(e,r)}pinchMove(e,t){const r=this.state,n=r._values[1],i=t.angle-n;let o=0;Math.abs(i)>270&&(o+=Math.sign(i)),this.computeValues([t.distance,t.angle-360*o]),r.origin=t.origin,r.turns=o,r._movement=[r._values[0]/r._initial[0]-1,r._values[1]-r._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(e=>!this.ctrl.touchIds.has(e))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const r=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=SE.sub(t._movement,r),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(t=>e[t]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const t=this.state;t._delta=[-$E(e)[1]/100*t.offset[0],0],SE.addTo(t._movement,t._delta),function(e){const[t,r]=e.overflow,[n,i]=e._delta,[o,a]=e._direction;(t<0&&n>0&&o<0||t>0&&n<0&&o>0)&&(e._movement[0]=e._movementBound[0]),(r<0&&i>0&&a<0||r>0&&i<0&&a>0)&&(e._movement[1]=e._movementBound[1])}(t),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}},resolver:sI};function fI(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const pI={target(e){if(e)return()=>"current"in e?e.current:e},enabled:(e=!0)=>e,window:(e=(iI.isBrowser?window:void 0))=>e,eventOptions:({passive:e=!0,capture:t=!1}={})=>({passive:e,capture:t}),transform:e=>e},gI=["target","eventOptions","window","enabled","transform"];function mI(e={},t){const r={};for(const[n,i]of Object.entries(t))switch(typeof i){case"function":r[n]=i.call(r,e[n],n,e);break;case"object":r[n]=mI(e[n],i);break;case"boolean":i&&(r[n]=e[n])}return r}class vI{constructor(e,t){IE(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,r,n,i){const o=this._listeners,a=function(e,t=""){const r=OE[e];return e+(r&&r[t]||t)}(t,r),s=FE(FE({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);e.addEventListener(a,n,s);const l=()=>{e.removeEventListener(a,n,s),o.delete(l)};return o.add(l),l}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class yI{constructor(){IE(this,"_timeouts",new Map)}add(e,t,r=140,...n){this.remove(e),this._timeouts.set(e,window.setTimeout(t,r,...n))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>{window.clearTimeout(e)}),this._timeouts.clear()}}class bI{constructor(e){IE(this,"gestures",new Set),IE(this,"_targetEventStore",new vI(this)),IE(this,"gestureEventStores",{}),IE(this,"gestureTimeoutStores",{}),IE(this,"handlers",{}),IE(this,"config",{}),IE(this,"pointerIds",new Set),IE(this,"touchIds",new Set),IE(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(e,t){t.drag&&wI(e,"drag"),t.wheel&&wI(e,"wheel"),t.scroll&&wI(e,"scroll"),t.move&&wI(e,"move"),t.pinch&&wI(e,"pinch"),t.hover&&wI(e,"hover")}(this,e)}setEventIds(e){return jE(e)?(this.touchIds=new Set(UE(e)),this.touchIds):"pointerId"in e?("pointerup"===e.type||"pointercancel"===e.type?this.pointerIds.delete(e.pointerId):"pointerdown"===e.type&&this.pointerIds.add(e.pointerId),this.pointerIds):void 0}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=function(e,t,r={}){const n=e,{target:i,eventOptions:o,window:a,enabled:s,transform:l}=n,c=fI(n,gI);if(r.shared=mI({target:i,eventOptions:o,window:a,enabled:s,transform:l},pI),t){const e=cI.get(t);r[t]=mI(FE({shared:r.shared},c),e)}else for(const e in c){const t=cI.get(e);t&&(r[e]=mI(FE({shared:r.shared},c[e]),t))}return r}(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,r={};let n;if(!t.target||(n=t.target(),n)){if(t.enabled){for(const t of this.gestures){const i=this.config[t],o=xI(r,i.eventOptions,!!n);if(i.enabled){new(lI.get(t))(this,e,t).bind(o)}}const i=xI(r,t.eventOptions,!!n);for(const t in this.nativeHandlers)i(t,"",r=>this.nativeHandlers[t](FE(FE({},this.state.shared),{},{event:r,args:e})),void 0,!0)}for(const e in r)r[e]=YE(...r[e]);if(!n)return r;for(const e in r){const{device:t,capture:i,passive:o}=NE(e);this._targetEventStore.add(n,t,"",r[e],{capture:i,passive:o})}}}}function wI(e,t){e.gestures.add(t),e.gestureEventStores[t]=new vI(e,t),e.gestureTimeoutStores[t]=new yI}const xI=(e,t,r)=>(n,i,o,a={},s=!1)=>{var l,c;const u=null!==(l=a.capture)&&void 0!==l?l:t.capture,d=null!==(c=a.passive)&&void 0!==c?c:t.passive;let h=s?n:RE(n,i,u);r&&d&&(h+="Passive"),e[h]=e[h]||[],e[h].push(o)},CI=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function _I(e,t,r,n,i,o){if(!e.has(r)||!lI.has(n))return;const a=r+"Start",s=r+"End";i[n]=e=>{let n;return e.first&&a in t&&t[a](e),r in t&&(n=t[r](e)),e.last&&s in t&&t[s](e),n},o[n]=o[n]||{}}function SI(e,t){const[r,n,i]=function(e){const t={},r={},n=new Set;for(let i in e)CI.test(i)?(n.add(RegExp.lastMatch),r[i]=e[i]):t[i]=e[i];return[r,t,n]}(e),o={};return _I(i,r,"onDrag","drag",o,t),_I(i,r,"onWheel","wheel",o,t),_I(i,r,"onScroll","scroll",o,t),_I(i,r,"onPinch","pinch",o,t),_I(i,r,"onMove","move",o,t),_I(i,r,"onHover","hover",o,t),{handlers:o,config:t,nativeHandlers:n}}function AI({e:e,rect:t,deltaX:r,deltaY:n}){return{rect:t,x:e.clientX,y:e.clientY,deltaX:r??0,deltaY:n??0,nativeEvent:e}}function kI({onMoveStart:e,onMove:t,onMoveEnd:r,minimumMovement:n=0,preventDefault:i,stopPropagation:o=!0,onPress:a,onLongPress:s,...l}){const c=u({lastPosition:{x:0,y:0},started:!1,longPressTriggered:!1}).current,{addGlobalListener:d,removeGlobalListener:h}=eC(),f=r=>{if(r.pointerId===c.id){const i=r.clientX-c.lastPosition.x,o=r.clientY-c.lastPosition.y;(Math.abs(i)>=n||Math.abs(o)>=n)&&!c.started&&(t=>{!c.el||!1===(null==e?void 0:e(t,c.el))||(c.originalTouchAction=c.el.style.touchAction,c.el.style.touchAction="none",c.originalUserSelect=document.documentElement.style.userSelect,document.documentElement.style.userSelect="none",c.started=!0)})(r),c.started&&(null==t||t(r,i,o),c.lastPosition={x:r.clientX,y:r.clientY})}},p=e=>{var t;if(e.pointerId===c.id){c.longPressTimer&&clearTimeout(c.longPressTimer);const n=c.longPressTriggered;c.longPressTriggered=!1,c.started&&(null==r||r(e)),c.el&&("pointercancel"!==e.type&&(null==(t=l.onPointerUp)||t.call(l,e,c.el),e.target&&c.el.contains(e.target)&&(n?null==s||s(e,c.el):null==a||a(e,c.el))),document.documentElement.style.userSelect=c.originalUserSelect||"",c.el.style.touchAction=c.originalTouchAction||""),c.id=void 0,c.started=!1,h(window,"pointermove",f,!1),h(window,"pointerup",p,!1),h(window,"pointercancel",p,!1)}};return{domProps:{onPointerDown:D_(r=>{var n;if(0===r.button&&null==c.id){if(c.started=!1,!1===(null==(n=l.onPointerDown)?void 0:n.call(l,r)))return;o&&r.stopPropagation(),i&&r.preventDefault(),c.id=r.pointerId,c.el=r.currentTarget,c.lastPosition={x:r.clientX,y:r.clientY},s&&(c.longPressTimer=setTimeout(()=>{s(r,c.el),c.longPressTriggered=!0},400)),(e||t)&&d(window,"pointermove",f,!1),d(window,"pointerup",p,!1),d(window,"pointercancel",p,!1)}})}}}function EI(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}var II=(e=>(e.topLeft="topLeft",e.topRight="topRight",e.bottomLeft="bottomLeft",e.bottomRight="bottomRight",e))(II||{});let TI={};const FI=(e={})=>{fC(null),TI=e};function OI({aspectRatio:e,boundaryRef:t,boundaryRect:r,restrictWithinBoundary:n=!0,minWidth:i=50,minHeight:o=50,...a}){const s={onMoveStart:(e,n)=>{var i;const o=e.target;if(!o.dataset.resizeHandle||hC||(FI({currentRect:EI(n.getBoundingClientRect()),resizeDir:o.dataset.resizeHandle}),!TI.currentRect))return!1;fC("resize"),r?TI.boundaryRect=r:null!=t&&t.current&&(TI.boundaryRect=EI(t.current.getBoundingClientRect())),TI.currentRect&&TI.boundaryRect&&(TI.currentRect.left-=TI.boundaryRect.left,TI.currentRect.top-=TI.boundaryRect.top),TI.initialAspectRatio=TI.currentRect.width/TI.currentRect.height,null==(i=a.onResizeStart)||i.call(a,AI({rect:TI.currentRect,e:e}))},onMove:(t,r,n)=>{var s;if(!TI.resizeDir||!TI.currentRect)return;const l="initial"===e?TI.initialAspectRatio:e,c=function(e,t,r,n){const i={...e},o={...e};return"topRight"===TI.resizeDir?(o.width=Math.floor(o.width+t),o.height=n?Math.floor(o.width/n):Math.floor(o.height-r),o.top=Math.floor(o.top+(i.height-o.height))):"bottomRight"===TI.resizeDir?(o.width=Math.floor(o.width+t),o.height=n?Math.floor(o.width/n):Math.floor(o.height+r)):"topLeft"===TI.resizeDir?(o.width=Math.floor(o.width-t),o.height=n?Math.floor(o.width/n):Math.floor(o.height-r),o.left=Math.floor(o.left+(i.width-o.width)),o.top=Math.floor(o.top+(i.height-o.height))):"bottomLeft"===TI.resizeDir&&(o.width=Math.floor(o.width-t),o.height=n?Math.floor(o.width/n):Math.floor(o.height+r),o.left=Math.floor(o.left+t)),o}(TI.currentRect,r,n,l),u=function(e,t,r,n){const i="bottomLeft"===TI.resizeDir||"topLeft"===TI.resizeDir,o="topRight"===TI.resizeDir||"topLeft"===TI.resizeDir;let a={...e};a.width=Math.max(t,e.width),a.height=Math.max(r,e.height);const s=a.width-e.width;i&&s>0&&(a.left-=s);const l=a.height-e.height;if(o&&l>0&&(a.top-=l),TI.boundaryRect&&(a=function(e,t){const r={...e};r.left=Math.max(0,r.left);const n=r.left-e.left;n>0&&(r.width-=n),r.top=Math.max(0,r.top);const i=r.top-e.top;return i>0&&(r.height-=i),r.width=Math.min(r.width,t.width-r.left),r.height=Math.min(r.height,t.height-r.top),r}(a,TI.boundaryRect)),n){const e=a.width,t=a.height,r=GC(n,a.width,a.height);a.width=r.width,a.height=r.height,o&&(a.top+=t-a.height),i&&(a.left+=e-a.width)}return a}(c,i,o,l);null==(s=a.onResize)||s.call(a,AI({rect:u,e:t,deltaX:r,deltaY:n})),TI.currentRect=c},onMoveEnd:e=>{var t;TI.currentRect&&(null==(t=a.onResizeEnd)||t.call(a,AI({rect:TI.currentRect,e:e}))),FI()}},{domProps:l}=kI(s);return{resizeProps:l}}function PI({position:t,inset:r=!1}){const n=function(e,t){const r=t?"left-0":"-left-5",n=t?"top-0":"-top-5",i=t?"bottom-0":"-bottom-5",o=t?"right-0":"-right-5";switch(e){case II.topLeft:return`${r} ${n} border-l-4 border-t-4 cursor-nwse-resize`;case II.topRight:return`${o} ${n} border-r-4 border-t-4 cursor-nesw-resize`;case II.bottomRight:return`${o} ${i} border-r-4 border-b-4 cursor-se-resize`;case II.bottomLeft:return`${r} ${i} border-l-4 border-b-4 cursor-sw-resize`;default:return""}}(t,r);return e("div",{"data-resize-handle":t,className:`border-white absolute w-20 h-20 ${n}`})}var MI=(e=>(e.top="maskTop",e.right="maskRight",e.bottom="maskBottom",e.left="maskLeft",e))(MI||{});function RI({position:t,refs:r}){const n=function(e){switch(e){case"maskTop":return"left-0 top-0";case"maskBottom":return"bottom-0 left-0";default:return""}}(t);return e("div",{className:`cropzone-transition bg-black/50 bottom absolute ${n}`,ref:e=>r.current[t]=e})}function LI({name:t,refs:r}){const n=af("cropzone-transition pointer-events-none absolute left-0 top-0 bg-white/50",t.startsWith("lineHor")?"h-px":"w-px");return e("div",{className:n,ref:e=>{r.current[t]=e}})}function NI(e,t,r){return Math.min(Math.max(e,t),r)}let jI={};function DI({boundaryRef:e,boundaryRect:t,minimumMovement:r,restrictWithinBoundary:n=!0,...i}){const o={minimumMovement:r,onMoveStart:(r,n)=>{var o;if(hC)return!1;jI={currentRect:EI(n.getBoundingClientRect())},fC("move"),t?jI.boundaryRect=t:null!=e&&e.current&&(jI.boundaryRect=EI(e.current.getBoundingClientRect())),jI.currentRect&&jI.boundaryRect&&(jI.currentRect.left-=jI.boundaryRect.left,jI.currentRect.top-=jI.boundaryRect.top),null==(o=i.onMoveStart)||o.call(i,AI({rect:jI.currentRect,e:r}))},onMove:(e,t,r)=>{var o;if(!jI.currentRect)return;const a={...jI.currentRect,left:jI.currentRect.left+t,top:jI.currentRect.top+r},s={...a};jI.boundaryRect&&n&&(s.left=NI(a.left,0,jI.boundaryRect.width-a.width),s.top=NI(a.top,0,jI.boundaryRect.height-a.height)),null==(o=i.onMove)||o.call(i,AI({rect:s,e:e,deltaX:t,deltaY:r})),jI.currentRect=a},onMoveEnd:e=>{var t;jI.currentRect&&(null==(t=i.onMoveEnd)||t.call(i,AI({rect:jI.currentRect,e:e})),fC(null),jI={})}},{domProps:a}=kI(o);return{moveProps:a}}function zI(){const r=u({}),[n,i]=o(!0),a=Cm(e=>e.canvasSize),s=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.cropzone}),l=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.defaultRatio})||null,c=Cm(e=>e.crop.selectedAspectRatio)||null,{moveProps:d}=DI({boundaryRect:a,onMoveStart:()=>i(!0),onMove:e=>Sm().crop.drawZone(e.rect),onMoveEnd:()=>i(!1)}),{resizeProps:h}=OI({boundaryRect:a,minHeight:50,minWidth:50,aspectRatio:YC(c),onResizeStart:()=>i(!0),onResize:e=>Sm().crop.drawZone(e.rect),onResizeEnd:()=>i(!1)});x(()=>{Sm().crop.registerRefs(r),Sm().crop.resetCropzone(l)},[l,a]);const f=af("cropzone absolute z-cropzone isolate left-0 top-0 w-full h-full overflow-hidden",n&&"moving");return t("div",{className:f,onPointerDown:e=>{e.stopPropagation(),e.preventDefault()},children:[t("div",{className:"cropzone-transition border-white/50 absolute z-10 left-0 top-0 border",...qx(h,d),ref:e=>r.current.innerZone=e,children:[!(null!=s&&s.hideTopLeft)&&e(PI,{position:II.topLeft,inset:!0}),!(null!=s&&s.hideTopRight)&&e(PI,{position:II.topRight,inset:!0}),!(null!=s&&s.hideBottomLeft)&&e(PI,{position:II.bottomLeft,inset:!0}),!(null!=s&&s.hideBottomRight)&&e(PI,{position:II.bottomRight,inset:!0}),e(LI,{name:"lineVer1",refs:r}),e(LI,{name:"lineVer2",refs:r}),e(LI,{name:"lineHor1",refs:r}),e(LI,{name:"lineHor2",refs:r})]}),e(RI,{refs:r,position:MI.top}),e(RI,{refs:r,position:MI.left}),e(RI,{refs:r,position:MI.right}),e(RI,{refs:r,position:MI.bottom})]})}const BI=cf(e("path",{d:"M 7 2 C 6.448 2 6 2.448 6 3 C 6 3.552 6.448 4 7 4 L 20 4 L 20 17 C 20 17.552 20.448 18 21 18 C 21.552 18 22 17.552 22 17 L 22 4 C 22 2.895 21.105 2 20 2 L 7 2 z M 4 6 C 2.895 6 2 6.895 2 8 L 2 20 C 2 21.105 2.895 22 4 22 L 16 22 C 17.105 22 18 21.105 18 20 L 18 8 C 18 6.895 17.105 6 16 6 L 4 6 z M 10 10 C 10.552 10 11 10.448 11 11 L 11 13 L 13 13 C 13.552 13 14 13.448 14 14 C 14 14.552 13.552 15 13 15 L 11 15 L 11 17 C 11 17.552 10.552 18 10 18 C 9.448 18 9 17.552 9 17 L 9 15 L 7 15 C 6.448 15 6 14.552 6 14 C 6 13.448 6.448 13 7 13 L 9 13 L 9 11 C 9 10.448 9.448 10 10 10 z"})),UI=cf(e("path",{d:"M 11 3 L 2 21 L 11 21 L 11 3 z M 13 3 L 13 21 L 22 21 L 13 3 z M 9 11.472656 L 9 19 L 5.2363281 19 L 9 11.472656 z"})),VI=cf(e("path",{d:"M 16.476562 2.4511719 C 16.392047 2.4657656 16.308531 2.5061719 16.238281 2.5761719 L 14.130859 4.6835938 C 13.956859 4.8575938 13.956859 5.1394531 14.130859 5.3144531 L 16.238281 7.4238281 C 16.519281 7.7048281 17 7.5054219 17 7.1074219 L 17 6 L 20 6 L 20 9 A 1.0001 1.0001 0 1 0 22 9 L 22 6 C 22 4.9069372 21.093063 4 20 4 L 17 4 L 17 2.8925781 C 17 2.5940781 16.730109 2.4073906 16.476562 2.4511719 z M 4 5 C 2.9069372 5 2 5.9069372 2 7 L 2 14 C 2 15.093063 2.9069372 16 4 16 L 7 16 L 7 19 C 7 20.105 7.895 21 9 21 L 16 21 C 17.105 21 18 20.105 18 19 L 18 12 C 18 10.895 17.105 10 16 10 L 13 10 L 13 7 C 13 5.9069372 12.093063 5 11 5 L 4 5 z M 4 7 L 11 7 L 11 14 L 4 14 L 4 7 z"})),HI=cf(e("path",{d:"M 10 2 L 9 3 L 3 3 L 3 5 L 21 5 L 21 3 L 15 3 L 14 2 L 10 2 z M 4.3652344 7 L 5.8925781 20.263672 C 6.0245781 21.253672 6.877 22 7.875 22 L 16.123047 22 C 17.121047 22 17.974422 21.254859 18.107422 20.255859 L 19.634766 7 L 4.3652344 7 z"})),WI={width:120,height:30},$I=[{name:"Duplicate",icon:BI,onClick:()=>{Sm().objects.duplicate()}},{name:"Flip",icon:UI,onClick:()=>{Sm().objects.flipHorizontally()}},{name:"Bring to front",icon:VI,onClick:()=>{Sm().objects.bringToFront()}},{name:"Delete",icon:HI,onClick:()=>{Sm().objects.delete()}}],qI=i.forwardRef((t,r)=>{const n=Cm(e=>e.objects.active.isMoving)?"opacity-0":"opacity-100";return e("div",{ref:r,className:`${n} absolute z-obj-box left-0 top-0 flex items-center text-white bg-controls rounded shadow transition-opacity overflow-hidden`,children:$I.map(t=>{const r=t.icon;return e(Jk,{size:"sm",className:"w-30 h-30 hover:bg-white/hover",radius:"rounded-none",onClick:t.onClick,children:e(r,{})},t.name)})})});function GI(e,t){const r=Sm().objects.getActive();if(!r||!e.current)return;const n=e.current,i=lC.fabric.util.degreesToRadians(r.angle??0);let o=Math.round(r.getScaledWidth()*_m().zoom),a=Math.round(r.getScaledHeight()*_m().zoom),s=Math.round((r.left??0)*_m().zoom),l=Math.round((r.top??0)*_m().zoom);const c="center"===r.originX?o/2:0,u="center"===r.originY?a/2:0;r.padding&&(o+=2*r.padding,a+=2*r.padding,s-=r.padding,l-=r.padding),n.style.width=`${o}px`,n.style.height=`${a}px`,n.style.transform=`translate(${s-c}px, ${l-u}px) rotate(${i}rad)`,Sm().canvas.render(),function(e,t){if(!t)return;const r=e.angle||0,n=r>168&&r<188?-30:-15,i=_m().canvasSize,o=_m().stageSize,a=WI,s=i.top-o.top,l=i.left-o.left,c=o.width-(l+i.width),u=o.height-(s+i.height),d=-s,h=-(i.left-o.left),f=i.width-a.width+c,p=i.height-a.height+u,g=e.getBoundingRect();let m=g.top-a.height+n,v=g.left+g.width/2-a.width/2;m=Math.min(p,Math.max(d,m)),v=Math.min(f,Math.max(h,v)),t.style.transform=`translate(${v}px, ${m}px) rotate(0deg)`}(r,t.current)}function YI(){return e("div",{className:"absolute -bottom-20 left-1/2 w-2 h-20 bg-white cursor-default -translate-x-1/2",children:e("div",{"data-rotate-handle":!0,className:"w-18 h-18 absolute -bottom-10 -left-8 bg-white rounded-full cursor-move"})})}let XI={};function KI(e){const t=XI.centerX||0,r=XI.centerY||0;return Math.atan2(r-e.pageY,t-e.pageX)-(XI.startAngle||0)}const ZI=(e={})=>{fC(null),XI=e};function JI(){const r=u(null),n=u(null),i=Cm(e=>e.objects.active.id),o=Cm(e=>e.objects.isEditingText),s=Cm(e=>e.zoom),l=function(){const e=Sm().objects.getActive();if(!e||!e.name)return{};const t=_m().config.objectControls||{},r=e.name;return{...t.global,...t[r]}}(),d=u(null),h=c(()=>{d.current?(clearTimeout(d.current),d.current=null,function(){var e;const t=Sm().objects.getActive();gg(t)&&(t.enterEditing(),null==(e=t.hiddenTextarea)||e.focus())}()):d.current=setTimeout(()=>{d.current=null},300)},[]);let{moveProps:f}=DI({boundaryRef:_m().canvasRef,restrictWithinBoundary:!1,onMoveEnd:()=>{_m().objects.setActiveIsMoving(!1)},onMove:e=>{_m().objects.setActiveIsMoving(!0),function(e){const t=e.rect.width/2,r=e.rect.height/2;Sm().objects.setValues({left:(e.rect.left+t)/_m().zoom,top:(e.rect.top+r)/_m().zoom})}(e)}});l.lockMovement&&(f={});const{resizeProps:p}=OI({minWidth:50,minHeight:50,aspectRatio:l.unlockAspectRatio?null:"initial",boundaryRef:l.containWithinCanvas?_m().canvasRef:void 0,restrictWithinBoundary:!1,onResizeEnd:()=>{_m().objects.setActiveIsMoving(!1)},onResize:e=>{_m().objects.setActiveIsMoving(!0),function(e){const t=Sm().objects.getActive();if(!t)return;const r={};gg(t)?(e.deltaX>0||t.getScaledHeight()>=20&&t.getScaledWidth()>=20)&&(r.fontSize=(t.fontSize||1)+e.deltaX):(t.width&&(r.scaleX=e.rect.width/_m().zoom/t.width),t.height&&(r.scaleY=e.rect.height/_m().zoom/t.height)),Sm().objects.setValues(r)}(e)}}),{rotateProps:g}=function(e){const t={onMoveStart:(t,r)=>{var n,i;if(!t.target.dataset.rotateHandle||hC)return!1;const o=EI(r.getBoundingClientRect());if(!o)return!1;const a=null==(n=r.style.transform.match(/rotate\((.+?)\)/))?void 0:n[1],[s="0"]=a?a.split(","):[];ZI({currentRect:o,centerX:o.left+o.width/2,centerY:o.top+o.height/2,startAngle:parseFloat(s)}),fC("rotate"),XI.startAngle=KI(t),null==(i=e.onRotateStart)||i.call(e,AI({rect:o,e:t}))},onMove:(t,r,n)=>{var i;if(!XI.currentRect)return;const o={...XI.currentRect};o.angle=KI(t),o.left+=r,o.top+=n,null==(i=e.onRotate)||i.call(e,AI({rect:o,e:t,deltaX:r,deltaY:n})),XI.currentRect=o},onMoveEnd:t=>{var r;XI.currentRect&&(null==(r=e.onRotateEnd)||r.call(e,AI({rect:XI.currentRect,e:t}))),ZI()}},{domProps:r}=kI(t);return{rotateProps:r}}({boundaryRef:_m().canvasRef,onRotateEnd:()=>{_m().objects.setActiveIsMoving(!1)},onRotate:e=>{_m().objects.setActiveIsMoving(!0),function(e){const t=Sm().objects.getActive();if(!t||!e.rect.angle)return;const r=lC.fabric.util.radiansToDegrees(e.rect.angle);r!==t.angle&&Sm().objects.setValues({angle:r})}(e)}});return a(()=>{Am()&&_m().editor.on("object:modified",e=>{e.sizeOrPositionChanged&&GI(r,n)})},[]),a(()=>{GI(r,n)},[i,s,o]),t("div",{className:i&&!o?"block":"hidden",children:[t("div",{ref:r,...qx(g,p,f),onClick:h,className:"absolute z-obj-box border-2 border-white shadow-md cursor-move",children:[!l.hideTopLeft&&e(PI,{position:II.topLeft}),!l.hideTopRight&&e(PI,{position:II.topRight}),!l.hideBottomLeft&&e(PI,{position:II.bottomLeft}),!l.hideBottomRight&&e(PI,{position:II.bottomRight}),!l.hideRotatingPoint&&e(YI,{})]}),e(qI,{ref:n})]})}function QI(){const r=Cm(e=>e.activeTool===nf.CROP),n=Cm(e=>e.objects.active.id);return t("div",{children:[r&&e(zI,{}),n&&e(JI,{})]})}const eT=function(e){return e.forEach(uI),function(e,t){const{handlers:r,nativeHandlers:n,config:o}=SI(e,t||{});return function(e,t={},r,n){const o=i.useMemo(()=>new bI(e),[]);if(o.applyHandlers(e,n),o.applyConfig(t,r),i.useEffect(o.effect.bind(o)),i.useEffect(()=>o.clean.bind(o),[]),void 0===t.target)return o.bind.bind(o)}(r,o,void 0,n)}}([dI,hI]),tT=i.forwardRef((r,n)=>{const[i,s]=o(!1);a(()=>Cm.subscribe(e=>e.loading,e=>{s(!e)}),[]);return e(rT,{children:t(Sx.div,{initial:{opacity:0},variants:{visible:{opacity:1,transition:{duration:.35,delay:.5}},hidden:{opacity:0,transition:{duration:0}}},animate:i?"visible":"hidden",className:"relative m-auto w-max",style:{backgroundImage:`url(${EC("images/empty-canvas-bg.png")})`},children:[e(QI,{}),e("canvas",{ref:n})]})})});function rT({children:t}){const r=u(null),n=eT({onPinch:e=>{if(!Sm().zoom.allowUserZoom||!nT(e))return e.cancel();1===e.direction[0]?Sm().zoom.zoomIn(.01):Sm().zoom.zoomOut(.01),e.event.stopPropagation(),e.event.preventDefault()},onDrag:e=>{if(e.pinching||!nT(e))return e.cancel();r.current.scrollLeft-=e.delta[0],r.current.scrollTop-=e.delta[1]}});return e("div",{ref:r,className:"w-full h-full overflow-hidden touch-none flex",...n(),children:t})}function nT(e){return!(Am().findTarget(e.event,!1)||Am().isDrawingMode)}function iT({actionBtn:r,children:n,className:i}){return t("div",{className:af(i,"flex gap-16 items-center h-full"),children:[r&&e("div",{className:"flex-shrink-0",children:r}),e("div",{className:"w-full flex-auto",children:n}),r&&e("div",{className:"w-96"})]})}function oT(){return(oT=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function aT(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}function sT(e){var t=u(e),r=u(function(e){t.current&&t.current(e)});return t.current=e,r.current}var lT=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),e>r?r:e<t?t:e},cT=function(e){return"touches"in e},uT=function(e){return e&&e.ownerDocument.defaultView||self},dT=function(e,t,r){var n=e.getBoundingClientRect(),i=cT(t)?function(e,t){for(var r=0;r<e.length;r++)if(e[r].identifier===t)return e[r];return e[0]}(t.touches,r):t;return{left:lT((i.pageX-(n.left+uT(e).pageXOffset))/n.width),top:lT((i.pageY-(n.top+uT(e).pageYOffset))/n.height)}},hT=function(e){!cT(e)&&e.preventDefault()},fT=i.memo(function(e){var t=e.onMove,r=e.onKey,n=aT(e,["onMove","onKey"]),o=u(null),s=sT(t),l=sT(r),c=u(null),h=u(!1),f=d(function(){var e=function(e){hT(e),(cT(e)?e.touches.length>0:e.buttons>0)&&o.current?s(dT(o.current,e,c.current)):r(!1)},t=function(){return r(!1)};function r(r){var n=h.current,i=uT(o.current),a=r?i.addEventListener:i.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",t)}return[function(e){var t,n=e.nativeEvent,i=o.current;if(i&&(hT(n),t=n,(!h.current||cT(t))&&i)){if(cT(n)){h.current=!0;var a=n.changedTouches||[];a.length&&(c.current=a[0].identifier)}i.focus(),s(dT(i,n,c.current)),r(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),l({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},r]},[l,s]),p=f[0],g=f[1],m=f[2];return a(function(){return m},[m]),i.createElement("div",oT({},n,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:o,onKeyDown:g,tabIndex:0,role:"slider"}))}),pT=function(e){return e.filter(Boolean).join(" ")},gT=function(e){var t=e.color,r=e.left,n=e.top,o=void 0===n?.5:n,a=pT(["react-colorful__pointer",e.className]);return i.createElement("div",{className:a,style:{top:100*o+"%",left:100*r+"%"}},i.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},mT=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=Math.pow(10,t)),Math.round(r*e)/r},vT=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?mT(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?mT(parseInt(e.substring(6,8),16)/255,2):1}},yT=function(e){var t=function(e){var t=e.s,r=e.v,n=e.a,i=(200-t)*r/100;return{h:mT(e.h),s:mT(i>0&&i<200?t*r/100/(i<=100?i:200-i)*100:0),l:mT(i/2),a:mT(n,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},bT=function(e){var t=e.h,r=e.s,n=e.v,i=e.a;t=t/360*6,r/=100,n/=100;var o=Math.floor(t),a=n*(1-r),s=n*(1-(t-o)*r),l=n*(1-(1-t+o)*r),c=o%6;return{r:mT(255*[n,s,a,a,l,n][c]),g:mT(255*[l,n,n,s,a,a][c]),b:mT(255*[a,a,l,n,n,s][c]),a:mT(i,2)}},wT=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},xT=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,o=i<1?wT(mT(255*i)):"";return"#"+wT(t)+wT(r)+wT(n)+o},CT=function(e){var t=e.r,r=e.g,n=e.b,i=e.a,o=Math.max(t,r,n),a=o-Math.min(t,r,n),s=a?o===t?(r-n)/a:o===r?2+(n-t)/a:4+(t-r)/a:0;return{h:mT(60*(s<0?s+6:s)),s:mT(o?a/o*100:0),v:mT(o/255*100),a:i}},_T=i.memo(function(e){var t=e.hue,r=e.onChange,n=pT(["react-colorful__hue",e.className]);return i.createElement("div",{className:n},i.createElement(fT,{onMove:function(e){r({h:360*e.left})},onKey:function(e){r({h:lT(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":mT(t),"aria-valuemax":"360","aria-valuemin":"0"},i.createElement(gT,{className:"react-colorful__hue-pointer",left:t/360,color:yT({h:t,s:100,v:100,a:1})})))}),ST=i.memo(function(e){var t=e.hsva,r=e.onChange,n={backgroundColor:yT({h:t.h,s:100,v:100,a:1})};return i.createElement("div",{className:"react-colorful__saturation",style:n},i.createElement(fT,{onMove:function(e){r({s:100*e.left,v:100-100*e.top})},onKey:function(e){r({s:lT(t.s+100*e.left,0,100),v:lT(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+mT(t.s)+"%, Brightness "+mT(t.v)+"%"},i.createElement(gT,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:yT(t)})))}),AT=function(e,t){if(e===t)return!0;for(var r in e)if(e[r]!==t[r])return!1;return!0};var kT,ET=typeof window<"u"?x:a,IT=new Map,TT=function(e){ET(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!IT.has(t)){var r=t.createElement("style");r.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',IT.set(t,r);var n=typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0;n&&r.setAttribute("nonce",n),t.head.appendChild(r)}},[])},FT=function(e){var t=e.className,r=e.colorModel,n=e.color,s=void 0===n?r.defaultColor:n,l=e.onChange,d=aT(e,["className","colorModel","color","onChange"]),h=u(null);TT(h);var f=function(e,t,r){var n=sT(r),i=o(function(){return e.toHsva(t)}),s=i[0],l=i[1],d=u({color:t,hsva:s});a(function(){if(!e.equal(t,d.current.color)){var r=e.toHsva(t);d.current={hsva:r,color:t},l(r)}},[t,e]),a(function(){var t;AT(s,d.current.hsva)||e.equal(t=e.fromHsva(s),d.current.color)||(d.current={hsva:s,color:t},n(t))},[s,e,n]);var h=c(function(e){l(function(t){return Object.assign({},t,e)})},[]);return[s,h]}(r,s,l),p=f[0],g=f[1],m=pT(["react-colorful",t]);return i.createElement("div",oT({},d,{ref:h,className:m}),i.createElement(ST,{hsva:p,onChange:g}),i.createElement(_T,{hue:p.h,onChange:g,className:"react-colorful__last-control"}))},OT={defaultColor:"000",toHsva:function(e){return CT(vT(e))},fromHsva:function(e){return function(e){return xT(bT(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||AT(vT(e),vT(t))}},PT=function(e){return i.createElement(FT,oT({},e,{colorModel:OT}))},MT=/^#?([0-9A-F]{3,8})$/i,RT=function(e){var t=e.color,r=void 0===t?"":t,n=e.onChange,s=e.onBlur,l=e.escape,u=e.validate,d=e.format,h=e.process,f=aT(e,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return l(r)}),g=p[0],m=p[1],v=sT(n),y=sT(s),b=c(function(e){var t=l(e.target.value);m(t),u(t)&&v(h?h(t):t)},[l,h,u,v]),w=c(function(e){u(e.target.value)||m(l(r)),y(e)},[r,l,u,y]);return a(function(){m(l(r))},[r,l]),i.createElement("input",oT({},f,{value:d?d(g):g,spellCheck:"false",onChange:b,onBlur:w}))},LT=function(e){return"#"+e},NT=function(e){var t=e.prefixed,r=e.alpha,n=aT(e,["prefixed","alpha"]),o=c(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,r?8:6)},[r]),a=c(function(e){return function(e,t){var r=MT.exec(e),n=r?r[1].length:0;return 3===n||6===n||!!t&&4===n||!!t&&8===n}(e,r)},[r]);return i.createElement(RT,oT({},n,{escape:o,format:t?LT:void 0,process:LT,validate:a}))};kT={alpha:"ألفا",black:"أسود",blue:"أزرق","blue purple":"أرجواني مزرق",brightness:"السطوع",brown:"بني","brown yellow":"أصفر بني",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"سماوي","cyan blue":"أزرق سماوي",dark:"داكن",gray:"رمادي",grayish:"مائل للرمادي",green:"أخضر","green cyan":"سماوي مخضر",hue:"درجة اللون",light:"فاتح",lightness:"الإضاءة",magenta:"أرجواني","magenta pink":"أرجواني وردي",orange:"برتقالي","orange yellow":"أصفر برتقالي",pale:"باهت",pink:"وردي","pink red":"أحمر وردي",purple:"أرجواني","purple magenta":"بنفسجي",red:"أحمر","red orange":"برتقالي محمر",saturation:"التشبع",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} شفاف`,"very dark":"داكن جدًا","very light":"فاتح جدًا",vibrant:"ساطع",white:"أبيض",yellow:"أصفر","yellow green":"أخضر مصفر"};var jT;jT={alpha:"Алфа",black:"черно",blue:"Синьо","blue purple":"синьо лилаво",brightness:"Яркост",brown:"кафяво","brown yellow":"кафяво жълто",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"циан","cyan blue":"циан синьо",dark:"тъмно",gray:"сиво",grayish:"сивкав",green:"Зелено","green cyan":"зелен циан",hue:"Оттенък",light:"светло",lightness:"Лекота",magenta:"магента","magenta pink":"магента розово",orange:"оранжево","orange yellow":"оранжево жълто",pale:"бледо",pink:"розово","pink red":"розово червено",purple:"лилаво","purple magenta":"лилаво магента",red:"Червено","red orange":"червен портокал",saturation:"Наситеност",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} прозрачен`,"very dark":"много тъмно","very light":"много светло",vibrant:" ярко",white:"бяло",yellow:"жълто","yellow green":"жълто зелен"};var DT;DT={alpha:"Alfa",black:"černá",blue:"Modrá","blue purple":"modrofialová",brightness:"Jas",brown:"hnědá","brown yellow":"hnědožlutá",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"tyrkysová","cyan blue":"tyrkysovomodrá",dark:"tmavá",gray:"šedá",grayish:"našedlá",green:"Zelená","green cyan":"zelenotyrkysová",hue:"Odstín",light:"světlá",lightness:"Světlost",magenta:"purpurová","magenta pink":"purpurově růžová",orange:"oranžová","orange yellow":"oranžovožlutá",pale:"bledá",pink:"růžová","pink red":"růžovočervená",purple:"fialová","purple magenta":"fialově purpurová",red:"Červená","red orange":"červenooranžová",saturation:"Sytost",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} průhledné`,"very dark":"velmi tmavá","very light":"velmi světlá",vibrant:"zářivá",white:"bílá",yellow:"žlutá","yellow green":"žlutozelená"};var zT;zT={alpha:"Alfa",black:"sort",blue:"Blå","blue purple":"blålilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyan","cyan blue":"cyan blå",dark:"mørk",gray:"grå",grayish:"grålig",green:"Grøn","green cyan":"grøn cyan",hue:"Tone",light:"lys",lightness:"Lyshed",magenta:"magenta","magenta pink":"magenta pink",orange:"orange","orange yellow":"orangegul",pale:"bleg",pink:"lyserød","pink red":"lyserødlig rød",purple:"lilla","purple magenta":"lilla magenta",red:"Rød","red orange":"rødorange",saturation:"Farvemætning",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} gennemsigtig`,"very dark":"meget mørk","very light":"meget lys",vibrant:"klar",white:"hvid",yellow:"gul","yellow green":"gulgrøn"};var BT;BT={alpha:"Alpha",black:"Schwarz",blue:"Blau","blue purple":"Blaulila",brightness:"Helligkeit",brown:"Braun","brown yellow":"Braungelb",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"Cyan","cyan blue":"Cyanblau",dark:"dunkles",gray:"Grau",grayish:"gräuliches",green:"Grün","green cyan":"Grüncyan",hue:"Farbton",light:"helles",lightness:"Leuchtkraft",magenta:"Magenta","magenta pink":"Magentarosa",orange:"Orange","orange yellow":"Orangegelb",pale:"blasses",pink:"Rosa","pink red":"Rosarot",purple:"Lila","purple magenta":"Lilamagenta",red:"Rot","red orange":"Rotorange",saturation:"Sättigung",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, zu ${e.percentTransparent} transparent`,"very dark":"sehr dunkles","very light":"sehr helles",vibrant:"lebhaftes",white:"Weiß",yellow:"Gelb","yellow green":"Gelbgrün"};var UT;UT={alpha:"Άλφα",black:"μαύρο",blue:"Μπλε","blue purple":"μπλε μωβ",brightness:"Φωτεινότητα",brown:"καφέ","brown yellow":"καφέ κίτρινο",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"κυανό","cyan blue":"κυανό μπλε",dark:"σκούρο",gray:"γκρι",grayish:"γκριζωπό",green:"Πράσινο","green cyan":"πράσινο κυανό",hue:"Τόνος",light:"ανοιχτό",lightness:"Φωτεινότητα",magenta:"ματζέντα","magenta pink":"ματζέντα ροζ",orange:"πορτοκαλί","orange yellow":"πορτοκαλί κίτρινο",pale:"ανοιχτό",pink:"ροζ","pink red":"ροζ κόκκινο",purple:"μωβ","purple magenta":"μωβ ματζέντα",red:"Κόκκινο","red orange":"κόκκινο πορτοκαλί",saturation:"Κορεσμός",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} διαφανές`,"very dark":"πολύ σκούρο","very light":"πολύ ανοιχτό",vibrant:"έντονο",white:"λευκό",yellow:"κίτρινο","yellow green":"κίτρινο πράσινο"};var VT;VT={hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":"very dark",dark:"dark",light:"light","very light":"very light",pale:"pale",grayish:"grayish",vibrant:"vibrant",black:"black",white:"white",gray:"gray",pink:"pink","pink red":"pink red","red orange":"red orange",brown:"brown",orange:"orange","orange yellow":"orange yellow","brown yellow":"brown yellow",yellow:"yellow","yellow green":"yellow green","green cyan":"green cyan",cyan:"cyan","cyan blue":"cyan blue","blue purple":"blue purple",purple:"purple","purple magenta":"purple magenta",magenta:"magenta","magenta pink":"magenta pink"};var HT;HT={alpha:"Alpha",black:"negro",blue:"Azul","blue purple":"púrpura azulado",brightness:"Brillo",brown:"marrón","brown yellow":"amarillo amarronado",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cian","cyan blue":"azul cian",dark:"oscuro",gray:"gris",grayish:"grisáceo",green:"Verde","green cyan":"cian verdoso",hue:"Tono",light:"claro",lightness:"Luminosidad",magenta:"magenta","magenta pink":"rosa magenta",orange:"naranja","orange yellow":"amarillo anaranjado",pale:"pálido",pink:"rosa","pink red":"rojo rosado",purple:"morado","purple magenta":"magenta violáceo",red:"Rojo","red orange":"naranja rojizo",saturation:"Saturación",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":"muy oscuro","very light":"muy claro",vibrant:"intenso",white:"blanco",yellow:"amarillo","yellow green":"verde amarillento"};var WT;WT={alpha:"Alfa",black:"must",blue:"Sinine","blue purple":"sinakaslilla",brightness:"Heledus",brown:"pruun","brown yellow":"pruunikaskollane",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"tsüaan","cyan blue":"tsüaansinine",dark:"tume",gray:"hall",grayish:"hallikas",green:"Roheline","green cyan":"tsüaanroheline",hue:"Värv",light:"valgus",lightness:"Valgus",magenta:"magentapunane","magenta pink":"magentaroosa",orange:"oranž","orange yellow":"oranžikaskollane",pale:"kahvatu",pink:"roosa","pink red":"vaarikapunane",purple:"lilla","purple magenta":"purpurne magenta",red:"Punane","red orange":"punakasoranž",saturation:"Küllastus",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} läbipaistev`,"very dark":"väga tume","very light":"väga hele",vibrant:"ere",white:"valge",yellow:"kollane","yellow green":"kollakasroheline"};var $T;$T={alpha:"Alpha",black:"musta",blue:"Sininen","blue purple":"sinivioletti",brightness:"Kirkkaus",brown:"ruskea","brown yellow":"ruskeankeltainen",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"syaani","cyan blue":"syaaninsininen",dark:"tumma",gray:"harmaa",grayish:"harmahtava",green:"Vihreä","green cyan":"vihreänsyaani",hue:"Sävy",light:"vaalea",lightness:"Valomäärä",magenta:"magenta","magenta pink":"magentapinkki",orange:"oranssi","orange yellow":"oranssinkeltainen",pale:"vaalea",pink:"pinkki","pink red":"vaaleanpunainen",purple:"violetti","purple magenta":"violettimagenta",red:"Punainen","red orange":"punaoranssi",saturation:"Värikylläisyys",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} läpinäkyvä`,"very dark":"hyvin tumma","very light":"erittäin vaalea",vibrant:"eloisa",white:"valkea",yellow:"keltainen","yellow green":"keltavihreä"};var qT;qT={alpha:"Alpha",black:"Noir",blue:"Bleu","blue purple":"Violet bleu",brightness:"Luminosité",brown:"Brun","brown yellow":"Jaune brun",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"Cyan","cyan blue":"Bleu cyan",dark:"Sombre",gray:"Gris",grayish:"Grisâtre",green:"Vert","green cyan":"Cyan vert",hue:"Teinte",light:"Clair",lightness:"Luminosité",magenta:"Magenta","magenta pink":"Rose magenta",orange:"Orange","orange yellow":"Jaune orangé",pale:"Pâle",pink:"Rose","pink red":"Rouge rosé",purple:"Violet","purple magenta":"Magenta violet",red:"Rouge","red orange":"Orange rouge",saturation:"Saturation",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":"Très sombre","very light":"Très clair",vibrant:"Vif",white:"Blanc",yellow:"Jaune","yellow green":"Vert jaune"};var GT;GT={alpha:"אלפא",black:"שחור",blue:"כחול","blue purple":"כחול סגול",brightness:"בהירות",brown:"חום","brown yellow":"חום צהוב",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"טורקיז","cyan blue":"כחול ציאן",dark:"כהה",gray:"אפור",grayish:"אפרפר",green:"ירוק","green cyan":"ציאן ירוק",hue:"גוון",light:"אור",lightness:"כמות אור",magenta:"מג'נטה","magenta pink":"ורוד מג'נטה",orange:"כתום","orange yellow":"כתום צהוב",pale:"חיוור",pink:"ורוד","pink red":"ורוד אדום",purple:"סגול","purple magenta":"מג'נטה סגול",red:"אדום","red orange":"כתום אדום",saturation:"רוויה",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} שקוף`,"very dark":"כהה מאוד","very light":"בהיר מאוד",vibrant:"תוסס",white:"לבן",yellow:"צהוב","yellow green":"צהוב ירוק"};var YT;YT={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavo ljubičasta",brightness:"Svjetlina",brown:"smeđa","brown yellow":"smeđe žuta",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasto",green:"Zelena","green cyan":"zelena cijan",hue:"Nijansa",light:"svjetlo",lightness:"Osvijetljenost",magenta:"magenta","magenta pink":"magentno ružičasta",orange:"narančasta","orange yellow":"narančasto žuta",pale:"blijeda",pink:"ružičasta","pink red":"ružičasto crvena",purple:"ljubičasta","purple magenta":"ljubičasta magenta",red:"Crvena","red orange":"crveno narančasta",saturation:"Zasićenost",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozirnosti`,"very dark":"jako tamna","very light":"vrlo svijetlo",vibrant:"vibrantna",white:"bijela",yellow:"žuto","yellow green":"žuto zelena"};var XT;XT={alpha:"Alfa",black:"fekete",blue:"Kék","blue purple":"kék lila",brightness:"Fényesség",brown:"barna","brown yellow":"barna sárga",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciánkék","cyan blue":"ciánkék",dark:"sötét",gray:"szürke",grayish:"szürkés",green:"Zöld","green cyan":"zöld ciánkék",hue:"Színárnyalat",light:"világos",lightness:"Világosság",magenta:"bíbor","magenta pink":"bíbor rózsaszín",orange:"narancs","orange yellow":"narancssárga",pale:"halvány",pink:"rózsaszín","pink red":"rózsaszín piros",purple:"lila","purple magenta":"lila bíbor",red:"Piros","red orange":"piros narancs",saturation:"Telítettség",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} átlátszó`,"very dark":"nagyon sötét","very light":"nagyon világos",vibrant:"élénk",white:"fehér",yellow:"sárga","yellow green":"sárga zöld"};var KT;KT={alpha:"Alfa",black:"nero",blue:"Blu","blue purple":"blu viola",brightness:"Luminosità",brown:"marrone","brown yellow":"giallo bruno",colorName:e=>`${e.hue} ${e.chroma} ${e.lightness}`,cyan:"ciano","cyan blue":"blu ciano",dark:"scuro",gray:"grigio",grayish:"grigiastro",green:"Verde","green cyan":"verde ciano",hue:"Tonalità",light:"chiaro",lightness:"Luminosità",magenta:"magenta","magenta pink":"rosa magenta",orange:"arancio","orange yellow":"giallo arancio",pale:"tenue",pink:"rosa","pink red":"rosa rosso",purple:"viola","purple magenta":"viola magenta",red:"Rosso","red orange":"rosso arancio",saturation:"Saturazione",transparentColorName:e=>`${e.hue} ${e.chroma} ${e.lightness}, trasparenza ${e.percentTransparent}`,"very dark":"molto scuro","very light":"molto chiaro",vibrant:"vivace",white:"bianco",yellow:"giallo","yellow green":"giallo verde"};var ZT;ZT={alpha:"アルファ",black:"ブラック",blue:"青","blue purple":"ブルーパープル",brightness:"明るさ",brown:"ブラウン","brown yellow":"ブラウンイエロー",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"シアン","cyan blue":"シアンブルー",dark:"ダーク",gray:"グレー",grayish:"グレイッシュ",green:"緑","green cyan":"グリーンシアン",hue:"色相",light:"ライト",lightness:"明度",magenta:"マゼンタ","magenta pink":"マゼンタピンク",orange:"オレンジ","orange yellow":"オレンジイエロー",pale:"ペール",pink:"ピンク","pink red":"ピンクレッド",purple:"パープル","purple magenta":"パープルマゼンタ",red:"赤","red orange":"レッドオレンジ",saturation:"彩度",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":"最も暗い","very light":"ベリーライト",vibrant:"鮮やか",white:"ホワイト",yellow:"イエロー","yellow green":"イエローグリーン"};var JT;JT={alpha:"알파",black:"검은색",blue:"파랑","blue purple":"청자색",brightness:"명도",brown:"갈색","brown yellow":"황갈색",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"청록색","cyan blue":"청록색",dark:"다크",gray:"회색",grayish:"회갈색",green:"초록","green cyan":"청록색",hue:"색조",light:"라이트",lightness:"밝기",magenta:"자홍색","magenta pink":"마젠타 핑크",orange:"주황색","orange yellow":"불그스름한 노랑",pale:"흙색",pink:"분홍색","pink red":"핑크 레드",purple:"자주색","purple magenta":"보라빛 자홍색",red:"빨강","red orange":"붉은 주황색",saturation:"채도",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 투명도`,"very dark":"매우 어두운","very light":"매우 연함",vibrant:"강렬한",white:"흰색",yellow:"노란색","yellow green":"연두색"};var QT;QT={alpha:"Alfa",black:"juoda",blue:"Mėlyna","blue purple":"melsvai violetinė",brightness:"Ryškumas",brown:"ruda","brown yellow":"rusvai geltona",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"žalsvai mėlyna","cyan blue":"žalsvai mėlyna",dark:"tamsi",gray:"pilka",grayish:"pilkšva",green:"Žalia","green cyan":"žalsvai mėlyna",hue:"Atspalvis",light:"šviesi",lightness:"Šviesumas",magenta:"rausvai raudona","magenta pink":"purpurinė",orange:"oranžinė","orange yellow":"oranžinio atspalvio geltona",pale:"blyški",pink:"rožinė","pink red":"rožinė raudona",purple:"violetinė","purple magenta":"purpurinė rausvai raudona",red:"Raudona","red orange":"rausvai oranžinė",saturation:"Įsotinimas",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} skaidri`,"very dark":"labai tamsi","very light":"labai šviesi",vibrant:"ryški",white:"balta",yellow:"geltona","yellow green":"gelsvai žalia"};var eF;eF={alpha:"Alfa",black:"melns",blue:"Zila","blue purple":"zili violets",brightness:"Spilgtums",brown:"brūns","brown yellow":"brūni dzeltens",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciāns","cyan blue":"ciāna zils",dark:"tumšs",gray:"pelēks",grayish:"pelēcīgs",green:"Zaļa","green cyan":"zaļš ciāns",hue:"Nokrāsa",light:"gaišs",lightness:"Gaišums",magenta:"fuksiju","magenta pink":"fuksiju rozā",orange:"oranžs","orange yellow":"oranži dzeltens",pale:"bāls",pink:"rozā","pink red":"rozīgi sarkans",purple:"violets","purple magenta":"violets fuksiju",red:"Sarkana","red orange":"sarkanīgi oranžs",saturation:"Piesātinājums",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} caurspīdīgs`,"very dark":"ļoti tumšs","very light":"ļoti gaišs",vibrant:"košs",white:"balts",yellow:"dzeltens","yellow green":"dzelteni zaļš"};var tF;tF={alpha:"Alfa",black:"svart",blue:"Blå","blue purple":"blålilla",brightness:"Lysstyrke",brown:"brun","brown yellow":"brungul",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyan","cyan blue":"cyanblå",dark:"mørk",gray:"grå",grayish:"gråaktig",green:"Grønn","green cyan":"grønncyan",hue:"Fargetone",light:"lys",lightness:"Lyshet",magenta:"magenta","magenta pink":"magentarosa",orange:"oransje","orange yellow":"oransjegul",pale:"blek",pink:"rosa","pink red":"rosarød",purple:"lilla","purple magenta":"lillamagenta",red:"Rød","red orange":"rødoransje",saturation:"Metning",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} gjennomsiktig`,"very dark":"svært mørk","very light":"svært lys",vibrant:"levende",white:"hvit",yellow:"gul","yellow green":"gulgrønn"};var rF;rF={alpha:"Alfa",black:"zwart",blue:"Blauw","blue purple":"paarsblauw",brightness:"Helderheid",brown:"bruin","brown yellow":"bruingeel",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyaan","cyan blue":"cyaanblauw",dark:"donker",gray:"grijs",grayish:"grijsachtig",green:"Groen","green cyan":"cyaangroen",hue:"Kleurtoon",light:"licht",lightness:"Lichtsterkte",magenta:"magenta","magenta pink":"magentaroze",orange:"oranje","orange yellow":"oranjegeel",pale:"bleek",pink:"roze","pink red":"rozerood",purple:"paars","purple magenta":"magentapaars",red:"Rood","red orange":"roodoranje",saturation:"Verzadiging",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparant`,"very dark":"heel donker","very light":"heel licht",vibrant:"levendig",white:"wit",yellow:"geel","yellow green":"geelgroen"};var nF;nF={alpha:"Alfa",black:"czarny",blue:"Niebieski","blue purple":"niebiesko-fioletowy",brightness:"Jasność",brown:"brązowy","brown yellow":"brązowo-żółty",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyjanowy","cyan blue":"cyjanowo-niebieski",dark:"ciemny",gray:"szary",grayish:"szarawy",green:"Zielony","green cyan":"zielono-cyjanowy",hue:"Odcień",light:"jasny",lightness:"Jaskrawość",magenta:"purpurowy","magenta pink":"purpurowo-różowy",orange:"pomarańczowy","orange yellow":"pomarańczowo-żółty",pale:"blady",pink:"różowy","pink red":"różowo-czerwony",purple:"fioletowy","purple magenta":"fioletowo-purpurowy",red:"Czerwony","red orange":"czerwono-pomarańczowy",saturation:"Nasycenie",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} przezroczystości`,"very dark":"bardzo ciemny","very light":"bardzo jasny",vibrant:"intensywny",white:"biały",yellow:"żółty","yellow green":"żółto-zielony"};var iF;iF={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"roxo azulado",brightness:"Brilho",brown:"marrom","brown yellow":"marrom amarelado",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinza",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Matiz",light:"claro",lightness:"Luminosidade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo alaranjado",pale:"pálido",pink:"rosa","pink red":"rosa avermelhado",purple:"roxo","purple magenta":"roxo-magenta",red:"Vermelho","red orange":"laranja avermelhado",saturation:"Saturação",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde amarelado"};var oF;oF={alpha:"Alfa",black:"preto",blue:"Azul","blue purple":"azul-púrpura",brightness:"Luminosidade",brown:"castanho","brown yellow":"amarelo-castanho",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"ciano","cyan blue":"azul-ciano",dark:"escuro",gray:"cinzento",grayish:"acinzentado",green:"Verde","green cyan":"verde-ciano",hue:"Tonalidade",light:"claro",lightness:"Claridade",magenta:"magenta","magenta pink":"rosa-magenta",orange:"laranja","orange yellow":"amarelo-laranja",pale:"pálido",pink:"cor-de-rosa","pink red":"vermelho-rosa",purple:"púrpura","purple magenta":"púrpura-magenta",red:"Vermelho","red orange":"laranja-vermelho",saturation:"Saturação",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":"muito escuro","very light":"muito claro",vibrant:"vibrante",white:"branco",yellow:"amarelo","yellow green":"verde-amarelo"};var aF;aF={alpha:"Alfa",black:"negru",blue:"Albastru","blue purple":"albastru-violet",brightness:"Luminozitate",brown:"maro","brown yellow":"galben maro",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"bleu","cyan blue":"albastru-bleu",dark:"închis",gray:"gri",grayish:"cenușiu",green:"Verde","green cyan":"verde bleu",hue:"Nuanță",light:"deschis",lightness:"Luminozitate",magenta:"fucsia","magenta pink":"roz-fucsia",orange:"portocaliu","orange yellow":"galben-portocaliu",pale:"pal",pink:"roz","pink red":"roz-roșu",purple:"violet","purple magenta":"violet-fucsia",red:"Roșu","red orange":"portocaliu-roșu",saturation:"Saturație",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":"foarte închis","very light":"foarte deschis",vibrant:"plin de viață",white:"alb",yellow:"galben","yellow green":"galben-verde"};var sF;sF={alpha:"Альфа",black:"черный",blue:"Синий","blue purple":"сине-фиолетовый",brightness:"Яркость",brown:"коричневый","brown yellow":"коричнево-желтый",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"голубой","cyan blue":"цвет морской волны",dark:"темный",gray:"серый",grayish:"сероватый",green:"Зеленый","green cyan":"сине-зеленый",hue:"Оттенок",light:"светлый",lightness:"Освещенность",magenta:"пурпурный","magenta pink":"пурпурно-розовый",orange:"оранжевый","orange yellow":"оранжево-желтый",pale:"бледный",pink:"розовый","pink red":"розово-красный",purple:"фиолетовый","purple magenta":"фиолетово-пурпурный",red:"Красный","red orange":"красно-оранжевый",saturation:"Насыщенность",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, прозрачный на ${e.percentTransparent}`,"very dark":"очень темный","very light":"очень светлый",vibrant:"яркий",white:"белый",yellow:"желтый","yellow green":"желто-зеленый"};var lF;lF={alpha:"Alfa",black:"čierna",blue:"Modrá","blue purple":"modrofialová",brightness:"Jas",brown:"hnedá","brown yellow":"hnedožltá",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"azúrová","cyan blue":"azúrová modrá",dark:"tmavá",gray:"sivá",grayish:"sivastá",green:"Zelená","green cyan":"zelená azúrová",hue:"Odtieň",light:"svetlá",lightness:"Svetlosť",magenta:"purpurová","magenta pink":"ružová purpurová",orange:"oranžová","orange yellow":"oranžovožltá",pale:"bledá",pink:"ružová","pink red":"ružovočervená",purple:"fialová","purple magenta":"fialová purpurová",red:"Červená","red orange":"červenooranžová",saturation:"Sýtosť",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} priehľadná`,"very dark":"veľmi tmavá","very light":"veľmi svetlá",vibrant:"energická",white:"biela",yellow:"žltá","yellow green":"žltozelená"};var cF;cF={alpha:"Alfa",black:"črna",blue:"Modra","blue purple":"modro vijolična",brightness:"Svetlost",brown:"rjava","brown yellow":"rjavo rumena",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cian","cyan blue":"cian modra",dark:"temna",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zelena cian",hue:"Barva",light:"svetla",lightness:"Lahkost",magenta:"škrlatna","magenta pink":"škrlatno roza",orange:"oranžna","orange yellow":"oranžno rumena",pale:"bleda",pink:"roza","pink red":"roza rdeča",purple:"vijolična","purple magenta":"vijolično škrlatna",red:"Rdeča","red orange":"rdeče oranžna",saturation:"Nasičenost",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozorna`,"very dark":"zelo temna","very light":"zelo svetla",vibrant:"živahna",white:"bela",yellow:"rumena","yellow green":"rumeno zelena"};var uF;uF={alpha:"Alfa",black:"crno",blue:"Plava","blue purple":"plavoljubičasta",brightness:"Osvetljenost",brown:"smeđa","brown yellow":"smeđežuta",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cijan","cyan blue":"cijan plava",dark:"tamno",gray:"siva",grayish:"sivkasta",green:"Zelena","green cyan":"zeleno cijan",hue:"Nijansa",light:"svetla",lightness:"Osvetljenje",magenta:"purpurnocrvena","magenta pink":"magenta ružičasta",orange:"narandžasta","orange yellow":"narandžastožuta",pale:"bledo",pink:"ružičasta","pink red":"ružičastocrvena",purple:"ljubičasta","purple magenta":"ljubičasta magenta",red:"Crvena","red orange":"crvenonarandžasta",saturation:"Zasićenje",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozirna`,"very dark":"veoma tamno","very light":"vrlo svetlo",vibrant:"živopisna",white:"bela",yellow:"žuto","yellow green":"žutozelena"};var dF;dF={alpha:"Alfa",black:"svart",blue:"Blått","blue purple":"blålila",brightness:"Ljusstyrka",brown:"brun","brown yellow":"brungul",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"cyan","cyan blue":"cyanblå",dark:"mörk",gray:"grå",grayish:"gråaktig",green:"Grönt","green cyan":"grön cyan",hue:"Nyans",light:"ljus",lightness:"Ljushet",magenta:"magenta","magenta pink":"magentarosa",orange:"orange","orange yellow":"orangegul",pale:"blek",pink:"rosa","pink red":"rosaröd",purple:"lila","purple magenta":"lila magenta",red:"Rött","red orange":"rödorange",saturation:"Mättnad",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} genomskinlig`,"very dark":"mycket mörk","very light":"mycket ljus",vibrant:"livfull",white:"vit",yellow:"gul","yellow green":"gulgrön"};var hF;hF={alpha:"Alfa",black:"siyah",blue:"Mavi","blue purple":"mavi mor",brightness:"Parlaklık",brown:"kahverengi","brown yellow":"kahverengi sarı",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"camgöbeği","cyan blue":"camgöbeği mavi",dark:"koyu",gray:"gri",grayish:"grimsi",green:"Yeşil","green cyan":"yeşil camgöbeği",hue:"Ton",light:"açık",lightness:"Canlılık",magenta:"eflatun","magenta pink":"eflatun pembe",orange:"turuncu","orange yellow":"turuncu sarı",pale:"solgun",pink:"pembe","pink red":"pembe kırmızı",purple:"mor","purple magenta":"mor eflatun",red:"Kırmızı","red orange":"kırmızı portakal",saturation:"Doygunluk",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} saydam`,"very dark":"çok koyu","very light":"çok açık",vibrant:"canlı",white:"beyaz",yellow:"sarı","yellow green":"sarı yeşil"};var fF;fF={alpha:"Альфа",black:"чорний",blue:"Синій","blue purple":"синьо-фіолетовий",brightness:"Яскравість",brown:"коричневий","brown yellow":"коричнево-жовтий",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"блакитний","cyan blue":"синьо-блакитний",dark:"темний",gray:"сірий",grayish:"сіруватий",green:"Зелений","green cyan":"зелено-блакитний",hue:"Тон",light:"світлий",lightness:"Освітленість",magenta:"пурпуровий","magenta pink":"пурпурово-рожевий",orange:"помаранчевий","orange yellow":"помаранчево-жовтий",pale:"блідий",pink:"рожевий","pink red":"рожево-червоний",purple:"фіолетовий","purple magenta":"фіолетово-пурпуровий",red:"Червоний","red orange":"червоно-помаранчевий",saturation:"Насиченість",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, прозорий на ${e.percentTransparent}`,"very dark":"дуже темний","very light":"дуже світлий",vibrant:"яскравий",white:"білий",yellow:"жовтий","yellow green":"жовто-зелений"};var pF;pF={alpha:"Alpha",black:"黑色",blue:"蓝色","blue purple":"蓝紫色",brightness:"亮度",brown:"棕色的","brown yellow":"棕黄色",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"蓝绿色","cyan blue":"青蓝色",dark:"深色",gray:"灰色",grayish:"浅灰色的",green:"绿色","green cyan":"绿青色",hue:"色相",light:"浅色",lightness:"明亮度",magenta:"紫红色","magenta pink":"紫粉色",orange:"橙色","orange yellow":"橙黄色",pale:"苍白的",pink:"粉色","pink red":"粉红色",purple:"紫色","purple magenta":"紫洋红色",red:"红色","red orange":"红橙色",saturation:"饱和度",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":"很暗","very light":"很浅",vibrant:"生机勃勃",white:"白色",yellow:"黄色","yellow green":"黄色/绿色"};var gF;gF={alpha:"Alpha",black:"黑",blue:"藍色","blue purple":"藍紫",brightness:"亮度",brown:"棕","brown yellow":"棕黃",colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:"青","cyan blue":"青藍",dark:"暗",gray:"灰",grayish:"偏灰",green:"綠色","green cyan":"青綠",hue:"色相",light:"淺",lightness:"明亮",magenta:"洋紅","magenta pink":"淺洋紅",orange:"橙","orange yellow":"橙黃",pale:"淡",pink:"粉紅","pink red":"粉紅",purple:"紫","purple magenta":"紫洋紅",red:"紅色","red orange":"橙紅",saturation:"飽和度",transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":"很暗","very light":"很淺",vibrant:"鮮豔",white:"白",yellow:"黃","yellow green":"黃綠"};var mF;mF={"ar-AE":kT,"bg-BG":jT,"cs-CZ":DT,"da-DK":zT,"de-DE":BT,"el-GR":UT,"en-US":VT,"es-ES":HT,"et-EE":WT,"fi-FI":$T,"fr-FR":qT,"he-IL":GT,"hr-HR":YT,"hu-HU":XT,"it-IT":KT,"ja-JP":ZT,"ko-KR":JT,"lt-LT":QT,"lv-LV":eF,"nb-NO":tF,"nl-NL":rF,"pl-PL":nF,"pt-BR":iF,"pt-PT":oF,"ro-RO":aF,"ru-RU":sF,"sk-SK":lF,"sl-SI":cF,"sr-SP":uF,"sv-SE":dF,"tr-TR":hF,"uk-UA":fF,"zh-CN":pF,"zh-TW":gF};const vF=Symbol.for("react-aria.i18n.locale"),yF=Symbol.for("react-aria.i18n.strings");let bF;class wF{getStringForLocale(e,t){let r=this.getStringsForLocale(t)[e];if(!r)throw new Error(`Could not find intl message ${e} in ${t} locale`);return r}getStringsForLocale(e){let t=this.strings[e];return t||(t=function(e,t,r="en-US"){if(t[e])return t[e];let n=function(e){return Intl.Locale?new Intl.Locale(e).language:e.split("-")[0]}(e);if(t[n])return t[n];for(let e in t)if(e.startsWith(n+"-"))return t[e];return t[r]}(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(e){if(typeof window>"u")return null;let t=window[vF];if(void 0===bF){let e=window[yF];if(!e)return null;bF={};for(let r in e)bF[r]=new wF({[t]:e[r]},t)}let r=null==bF?void 0:bF[e];if(!r)throw new Error(`Strings for package "${e}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}constructor(e,t="en-US"){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}}const xF=new Map,CF=new Map;class _F{format(e,t){let r=this.strings.getStringForLocale(e,this.locale);return"function"==typeof r?r(t,this):r}plural(e,t,r="cardinal"){let n=t["="+e];if(n)return"function"==typeof n?n():n;let i=this.locale+":"+r,o=xF.get(i);return o||(o=new Intl.PluralRules(this.locale,{type:r}),xF.set(i,o)),n=t[o.select(e)]||t.other,"function"==typeof n?n():n}number(e){let t=CF.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),CF.set(this.locale,t)),t.format(e)}select(e,t){let r=e[t]||e.other;return"function"==typeof r?r():r}constructor(e,t){this.locale=e,this.strings=t}}let SF=new Map,AF=!1;try{AF="exceptZero"===new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay}catch{}let kF=!1;try{kF="unit"===new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style}catch{}const EF={degree:{narrow:{default:"°","ja-JP":" 度","zh-TW":"度","sl-SI":" °"}}};class IF{format(e){let t="";if(t=AF||null==this.options.signDisplay?this.numberFormatter.format(e):function(e,t,r){if("auto"===t)return e.format(r);if("never"===t)return e.format(Math.abs(r));{let n=!1;if("always"===t?n=r>0||Object.is(r,0):"exceptZero"===t&&(Object.is(r,-0)||Object.is(r,0)?r=Math.abs(r):n=r>0),n){let t=e.format(-r),n=e.format(r),i=t.replace(n,"").replace(/\u200e|\u061C/,"");return 1!==[...i].length&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),t.replace(n,"!!!").replace(i,"+").replace("!!!",n)}return e.format(r)}}(this.numberFormatter,this.options.signDisplay,e),"unit"===this.options.style&&!kF){var r;let{unit:e,unitDisplay:n="short",locale:i}=this.resolvedOptions();if(!e)return t;let o=null===(r=EF[e])||void 0===r?void 0:r[n];t+=o[i]||o.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if("function"==typeof this.numberFormatter.formatRange)return this.numberFormatter.formatRange(e,t);if(t<e)throw new RangeError("End date must be >= start date");return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if("function"==typeof this.numberFormatter.formatRangeToParts)return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw new RangeError("End date must be >= start date");let r=this.numberFormatter.formatToParts(e),n=this.numberFormatter.formatToParts(t);return[...r.map(e=>({...e,source:"startRange"})),{type:"literal",value:" – ",source:"shared"},...n.map(e=>({...e,source:"endRange"}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!AF&&null!=this.options.signDisplay&&(e={...e,signDisplay:this.options.signDisplay}),!kF&&"unit"===this.options.style&&(e={...e,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=function(e,t={}){let{numberingSystem:r}=t;if(r&&e.includes("-nu-")&&(e.includes("-u-")||(e+="-u-"),e+=`-nu-${r}`),"unit"===t.style&&!kF){var n;let{unit:e,unitDisplay:r="short"}=t;if(!e)throw new Error('unit option must be provided with style: "unit"');if(null===(n=EF[e])||void 0===n||!n[r])throw new Error(`Unsupported unit ${e} with unitDisplay = ${r}`);t={...t,style:"decimal"}}let i=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():"");if(SF.has(i))return SF.get(i);let o=new Intl.NumberFormat(e,t);return SF.set(i,o),o}(e,t),this.options=t}}let TF=new wF(function(e){return e&&e.__esModule?e.default:e}(mF));const FF=[[0,"pink"],[15,"red"],[48,"orange"],[94,"yellow"],[135,"green"],[175,"cyan"],[264,"blue"],[284,"purple"],[320,"magenta"],[349,"pink"]];class OF{toHexInt(){return this.toFormat("rgb").toHexInt()}getChannelValue(e){if(e in this)return this[e];throw new Error("Unsupported color channel: "+e)}withChannelValue(e,t){if(e in this){let r=this.clone();return r[e]=t,r}throw new Error("Unsupported color channel: "+e)}getChannelName(e,t){return(wF.getGlobalDictionaryForPackage("@react-stately/color")||TF).getStringForLocale(e,t)}getColorSpaceAxes(e){let{xChannel:t,yChannel:r}=e,n=t||this.getColorChannels().find(e=>e!==r),i=r||this.getColorChannels().find(e=>e!==n),o=this.getColorChannels().find(e=>e!==n&&e!==i);return{xChannel:n,yChannel:i,zChannel:o}}getColorName(e){let t,[r,n,i]=DF(this),o=wF.getGlobalDictionaryForPackage("@react-stately/color")||TF;if(r>.999)return o.getStringForLocale("white",e);if(r<.001)return o.getStringForLocale("black",e);[t,r]=this.getOklchHue(r,n,i,e);let a="",s="";n<=.1&&n>=.001?s=r>=.7?"pale":"grayish":n>=.15&&(s="vibrant"),r<.3?a="very dark":r<.55?a="dark":r<.7||(a=r<.85?"light":"very light"),s&&(s=o.getStringForLocale(s,e)),a&&(a=o.getStringForLocale(a,e));let l=this.getChannelValue("alpha"),c=new _F(e,o);if(l<1){let r=new IF(e,{style:"percent"}).format(1-l);return c.format("transparentColorName",{lightness:a,chroma:s,hue:t,percentTransparent:r}).replace(/\s+/g," ").trim()}return c.format("colorName",{lightness:a,chroma:s,hue:t}).replace(/\s+/g," ").trim()}getOklchHue(e,t,r,n){let i=wF.getGlobalDictionaryForPackage("@react-stately/color")||TF;if(t<.001)return[i.getStringForLocale("gray",n),e];for(let t=0;t<FF.length;t++){let[o,a]=FF[t],[s,l]=FF[t+1]||[360,"pink"];if(r>=o&&r<s)return"orange"===a&&(e<.68?a="brown":e=e-.68+.55),r>o+(s-o)/2&&a!==l?a=`${a} ${l}`:"yellow"===a&&e<.85&&(a="yellow green"),[i.getStringForLocale(a,n).toLocaleLowerCase(n),e]}throw new Error("Unexpected hue")}getHueName(e){let[t,r,n]=DF(this),[i]=this.getOklchHue(t,r,n,e);return i}}class PF extends OF{static parse(e){let t=[];if(/^#[\da-f]+$/i.test(e)&&[4,5,7,9].includes(e.length)){const r=(e.length<6?e.replace(/[^#]/gi,"$&$&"):e).slice(1).split("");for(;r.length>0;)t.push(parseInt(r.splice(0,2).join(""),16));t[3]=void 0!==t[3]?t[3]/255:void 0}const r=e.match(/^rgba?\((.*)\)$/);var n;return null!=r&&r[1]&&(t=r[1].split(",").map(e=>Number(e.trim())),t=t.map((e,t)=>oC(e,0,t<3?255:1))),t.length<3?void 0:new PF(t[0],t[1],t[2],null!==(n=t[3])&&void 0!==n?n:1)}toString(e="css"){switch(e){case"hex":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")).toUpperCase();case"hexa":return"#"+(this.red.toString(16).padStart(2,"0")+this.green.toString(16).padStart(2,"0")+this.blue.toString(16).padStart(2,"0")+Math.round(255*this.alpha).toString(16).padStart(2,"0")).toUpperCase();case"rgb":return`rgb(${this.red}, ${this.green}, ${this.blue})`;case"css":case"rgba":return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hex":case"hexa":case"rgb":case"rgba":return this;case"hsb":case"hsba":return this.toHSB();case"hsl":case"hsla":return this.toHSL();default:throw new Error("Unsupported color conversion: rgb -> "+e)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){const e=this.red/255,t=this.green/255,r=this.blue/255,n=Math.min(e,t,r),i=Math.max(e,t,r),o=i-n,a=0===i?0:o/i;let s=0;if(0!==o){switch(i){case e:s=(t-r)/o+(t<r?6:0);break;case t:s=(r-e)/o+2;break;case r:s=(e-t)/o+4}s/=6}return new RF(sC(360*s,2),sC(100*a,2),sC(100*i,2),this.alpha)}toHSL(){const e=this.red/255,t=this.green/255,r=this.blue/255,n=Math.min(e,t,r),i=Math.max(e,t,r),o=(i+n)/2,a=i-n;let s,l;if(0===a)s=l=0;else{switch(l=a/(o<.5?i+n:2-i-n),i){case e:s=(t-r)/a+(t<r?6:0);break;case t:s=(r-e)/a+2;break;case r:s=(e-t)/a+4}s/=6}return new jF(sC(360*s,2),sC(100*l,2),sC(100*o,2),this.alpha)}clone(){return new PF(this.red,this.green,this.blue,this.alpha)}getChannelRange(e){switch(e){case"red":case"green":case"blue":return{minValue:0,maxValue:255,step:1,pageSize:17};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"red":case"green":case"blue":return{style:"decimal"};case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,t){let r=this.getChannelFormatOptions(e),n=this.getChannelValue(e);return new IF(t,r).format(n)}getColorSpace(){return"rgb"}getColorChannels(){return PF.colorChannels}constructor(e,t,r,n){super(),this.red=e,this.green=t,this.blue=r,this.alpha=n}}PF.colorChannels=["red","green","blue"];const MF=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;class RF extends OF{static parse(e){let t;if(t=e.match(MF)){var r;const[e,n,i,o]=(null!==(r=t[1])&&void 0!==r?r:t[2]).split(",").map(e=>Number(e.trim().replace("%","")));return new RF(NF(e,360),oC(n,0,100),oC(i,0,100),oC(o??1,0,1))}}toString(e="css"){switch(e){case"css":return this.toHSL().toString("css");case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsb":return`hsb(${this.hue}, ${sC(this.saturation,2)}%, ${sC(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${sC(this.saturation,2)}%, ${sC(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hsb":case"hsba":return this;case"hsl":case"hsla":return this.toHSL();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsb -> "+e)}}toHSL(){let e=this.saturation/100,t=this.brightness/100,r=t*(1-e/2);return e=0===r||1===r?0:(t-r)/Math.min(r,1-r),new jF(sC(this.hue,2),sC(100*e,2),sC(100*r,2),this.alpha)}toRGB(){let e=this.hue,t=this.saturation/100,r=this.brightness/100,n=(n,i=(n+e/60)%6)=>r-t*r*Math.max(Math.min(i,4-i,1),0);return new PF(Math.round(255*n(5)),Math.round(255*n(3)),Math.round(255*n(1)),this.alpha)}clone(){return new RF(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(e){switch(e){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"brightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"brightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,t){let r=this.getChannelFormatOptions(e),n=this.getChannelValue(e);return("saturation"===e||"brightness"===e)&&(n/=100),new IF(t,r).format(n)}getColorSpace(){return"hsb"}getColorChannels(){return RF.colorChannels}constructor(e,t,r,n){super(),this.hue=e,this.saturation=t,this.brightness=r,this.alpha=n}}RF.colorChannels=["hue","saturation","brightness"];const LF=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;function NF(e,t){return(e%t+t)%t}class jF extends OF{static parse(e){let t;if(t=e.match(LF)){var r;const[e,n,i,o]=(null!==(r=t[1])&&void 0!==r?r:t[2]).split(",").map(e=>Number(e.trim().replace("%","")));return new jF(NF(e,360),oC(n,0,100),oC(i,0,100),oC(o??1,0,1))}}toString(e="css"){switch(e){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${sC(this.saturation,2)}%, ${sC(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${sC(this.saturation,2)}%, ${sC(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case"hsl":case"hsla":return this;case"hsb":case"hsba":return this.toHSB();case"rgb":case"rgba":return this.toRGB();default:throw new Error("Unsupported color conversion: hsl -> "+e)}}toHSB(){let e=this.saturation/100,t=this.lightness/100,r=t+e*Math.min(t,1-t);return e=0===r?0:2*(1-t/r),new RF(sC(this.hue,2),sC(100*e,2),sC(100*r,2),this.alpha)}toRGB(){let e=this.hue,t=this.saturation/100,r=this.lightness/100,n=t*Math.min(r,1-r),i=(t,i=(t+e/30)%12)=>r-n*Math.max(Math.min(i-3,9-i,1),-1);return new PF(Math.round(255*i(0)),Math.round(255*i(8)),Math.round(255*i(4)),this.alpha)}clone(){return new jF(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(e){switch(e){case"hue":return{minValue:0,maxValue:360,step:1,pageSize:15};case"saturation":case"lightness":return{minValue:0,maxValue:100,step:1,pageSize:10};case"alpha":return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw new Error("Unknown color channel: "+e)}}getChannelFormatOptions(e){switch(e){case"hue":return{style:"unit",unit:"degree",unitDisplay:"narrow"};case"saturation":case"lightness":case"alpha":return{style:"percent"};default:throw new Error("Unknown color channel: "+e)}}formatChannelValue(e,t){let r=this.getChannelFormatOptions(e),n=this.getChannelValue(e);return("saturation"===e||"lightness"===e)&&(n/=100),new IF(t,r).format(n)}getColorSpace(){return"hsl"}getColorChannels(){return jF.colorChannels}constructor(e,t,r,n){super(),this.hue=e,this.saturation=t,this.lightness=r,this.alpha=n}}function DF(e){let t=e.toFormat("rgb"),r=t.getChannelValue("red")/255,n=t.getChannelValue("green")/255,i=t.getChannelValue("blue")/255;[r,n,i]=function(e,t,r){return[zF(e),zF(t),zF(r)]}(r,n,i);let[o,a,s]=function(e,t,r){return BF([.4123907992659595,.35758433938387796,.1804807884018343,.21263900587151036,.7151686787677559,.07219231536073371,.01933081871559185,.11919477979462599,.9505321522496606],e,t,r)}(r,n,i),[l,c,u]=function(e,t,r){const n=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],i=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774];let[o,a,s]=BF(n,e,t,r);return BF(i,Math.cbrt(o),Math.cbrt(a),Math.cbrt(s))}(o,a,s);return function(e,t,r){var n=180*Math.atan2(r,t)/Math.PI;return[e,Math.sqrt(t**2+r**2),n>=0?n:n+360]}(l,c,u)}function zF(e){let t=e<0?-1:1,r=Math.abs(e);return r<=.04045?e/12.92:t*Math.pow((r+.055)/1.055,2.4)}function BF(e,t,r,n){return[e[0]*t+e[1]*r+e[2]*n,e[3]*t+e[4]*r+e[5]*n,e[6]*t+e[7]*r+e[8]*n]}jF.colorChannels=["hue","saturation","lightness"];function UF({onChange:t,value:r,colors:n}){const i=n.map(n=>{const i=r===n;return e(z_,{onClick:()=>{null==t||t(n)},className:af("relative block flex-shrink-0 w-26 h-26 border rounded",i&&"shadow-md"),style:{backgroundColor:n},children:i&&e("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},n)});return e("div",{className:"flex flex-wrap gap-6",children:i})}const VF=[{color:"rgb(255, 255, 255)",name:Kh("White")},{color:"rgb(239,245,245)",name:Kh("Solitude")},{color:"rgb(245,213,174)",name:Kh("Wheat")},{color:"rgb(253,227,167)",name:Kh("Cape Honey")},{color:"rgb(242,222,186)",name:Kh("Milk punch")},{color:"rgb(97,118,75)",name:Kh("Dingy"),foreground:"rgb(255, 255, 255)"},{color:"rgb(4, 147, 114)",name:Kh("Aquamarine"),foreground:"rgb(255, 255, 255)"},{color:"rgb(222,245,229)",name:Kh("Cosmic Latte")},{color:"rgb(233,119,119)",name:Kh("Geraldine"),foreground:"rgb(90,14,14)"},{color:"rgb(247,164,164)",name:Kh("Sundown")},{color:"rgb(30,139,195)",name:Kh("Pelorous"),foreground:"rgb(255, 255, 255)"},{color:"rgb(142,68,173)",name:Kh("Deep Lilac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(108,74,182)",name:Kh("Blue marguerite"),foreground:"rgb(255, 255, 255)"},{color:"rgb(139,126,116)",name:Kh("Americano"),foreground:"rgb(255, 255, 255)"},{color:"rgb(0,0,0)",name:Kh("Black"),foreground:"rgb(255, 255, 255)"},{color:"rgb(64,66,88)",name:Kh("Blue zodiac"),foreground:"rgb(255, 255, 255)"},{color:"rgb(101,100,124)",name:Kh("Comet"),foreground:"rgb(255, 255, 255)"}].map(({color:e})=>e).slice(0,14);function HF({defaultValue:r,onChange:n,colorPresets:i,showInput:a}){const[s,l]=o(r),c=i||VF,u=jk({size:"sm"});return t("div",{children:[e(PT,{className:"!w-auto",color:s,onChange:e=>{null==n||n(e),l(e)}}),t("div",{className:"px-12 py-20",children:[c&&e(UF,{colors:c,onChange:e=>{if(e){const t=function(e){let t=PF.parse(e)||RF.parse(e)||jF.parse(e);if(t)return t;throw new Error("Invalid color value: "+e)}(e).toString("hex");null==n||n(t),l(t)}},value:s}),a&&e("div",{className:"pt-20",children:e(NT,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:u.input,color:s,onChange:e=>{null==n||n(e),l(e)}})})]})]})}const WF=i.createContext(null);function $F(){return l(WF)}function qF(){const{lines:e,localeCode:t}=ik();return{trans:c(r=>GF({...r,lines:e,localeCode:t}),[e,t])}}const GF=X_(e=>{let{lines:t,message:r,values:n,localeCode:i}=e;return null==r?"":(r=(null==t?void 0:t[r])||(null==t?void 0:t[r.toLowerCase()])||r,n&&(r=ok(i,e),Object.entries(n).forEach(([e,t])=>{r=r.replace(`:${e}`,`${t}`)})),r)},{equals:nk,callTimeout:0});function YF({onDismiss:t}){const{trans:r}=qF();return e("button",{className:"sr-only","aria-label":r(Kh("Dismiss")),tabIndex:-1,onClick:()=>{t&&t()}})}function XF(r){const{type:n="modal",dialogProps:i,...o}=l(WF),{children:a,className:s,size:c="md",background:u,radius:d="rounded",maxWidth:h="max-w-dialog",...f}=r;let p=null;("popover"===n||"tray"===n)&&(p=e(YF,{onDismiss:o.close}));const g="fullscreenTakeover"===c||"tray"===n,y=af("mx-auto pointer-events-auto outline-none flex flex-col overflow-hidden",u||"bg","tray"!==n&&function(e){switch(e){case"2xs":return"w-256";case"xs":return"w-320";case"sm":return"w-384";case"md":return"w-440";case"lg":return"w-620";case"xl":return"w-780";case"2xl":return"w-850";case"fullscreen":return"w-1280";case"fullscreenTakeover":return"w-full h-full";default:return e}}(c),"tray"===n&&"rounded-t border-b-bg","fullscreenTakeover"!==c&&"shadow-2xl border max-h-dialog",!g&&`${d} ${h}`,s);return t("div",{...qx({role:"dialog",tabIndex:-1},i,f),style:{...r.style,"--be-dialog-padding":"24px"},"aria-modal":!0,className:y,children:[m.toArray(a).map(e=>v(e)?w(e,{size:e.props.size??c}):e),p]})}const KF=cf(e("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined"),ZF=p(({children:r,autoFocus:n=!1,restoreFocus:i=!0,isDismissable:o=!0,isOpen:a=!1,placement:s="center",onClose:l},c)=>{const u=KA(),d=tC(c);return t("div",{className:"fixed inset-0 isolate z-modal",style:u,onKeyDown:e=>{"Escape"===e.key&&(e.stopPropagation(),e.preventDefault(),l())},children:[e(tk,{onClick:()=>{o&&l()}},"modal-underlay"),e(Sx.div,{ref:d,className:af("pointer-events-none absolute inset-0 z-20 flex h-full w-full","center"===s&&"items-center justify-center","top"===s&&"items-start justify-center pt-40"),role:"presentation",initial:{opacity:0,scale:"top"===s?1:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},transition:{duration:.1},children:e(RA,{restoreFocus:i,autoFocus:n,contain:!0,children:r})})]})});function JF(r){let{children:n,type:i,disableInitialTransition:o,isDismissable:s=!0,moveFocusToDialog:l=!0,returnFocusToTrigger:h=!0,triggerOnHover:f=!1,triggerOnContextMenu:p=!1,usePortal:g=!0,mobileType:v,alwaysReturnCurrentValueOnClose:x}=r;const C=u(null),_=p&&!r.triggerRef?C:r.triggerRef,S=u(r.value),[A,k]=iC(r.isOpen,r.defaultIsOpen,r.onOpenChange),[E,I]=iC(r.value,r.defaultValue,r.onValueChange);gk()&&"popover"===i&&(i=v||"modal");const T=u(null),{x:F,y:O,reference:P,strategy:M,refs:R}=pA({...r,disablePositioning:"modal"===i}),L="popover"===i?{position:M,top:O??"",left:F??""}:{},N=b(),j=`${N}-label`,D=`${N}-description`,z=`${N}-form`,B=function(e){const t=u(e);return a(()=>{t.current=e}),d(()=>(...e)=>{var r;return null==(r=t.current)?void 0:r.call(t,...e)},[])}(r.onClose),U=c(e=>{typeof e>"u"&&x&&(e=E);const t=typeof e<"u"?e:S.current;null==B||B(t,{initialValue:S.current,valueChanged:t!==S.current}),k(!1)},[B,k,E,x]),V=c(()=>{k(!0),S.current=r.value},[r.value,k]);Lx(()=>{null!=_&&_.current&&R.reference.current!==_.current&&P(_.current)},[P,null==_?void 0:_.current,R]);const H=d(()=>({"aria-labelledby":j,"aria-describedby":D}),[j,D]);let W;W="modal"===i?ZF:"tray"===i?rk:JA;const $=d(()=>({dialogProps:H,type:i,labelId:j,descriptionId:D,isDismissable:s,close:U,value:E,initialValue:S.current,setValue:I,formId:z}),[U,D,H,z,j,i,s,E,I]);f=f&&"popover"===i;const q={onPointerEnter:D_(e=>{V()}),onPointerLeave:D_(e=>{T.current=setTimeout(()=>{U()},150)})},G={onPointerEnter:D_(e=>{T.current&&clearTimeout(T.current)}),onPointerLeave:D_(e=>{U()})},Y={onContextMenu:D_(e=>{e.preventDefault(),C.current=function({x:e,y:t},r){return{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,right:e,bottom:t,left:e}),contextElement:r}}({x:e.clientX,y:e.clientY},e.currentTarget),V()})},X={onClick:D_(e=>{e.stopPropagation(),A?U():V()})},{dialogTrigger:K,dialog:Z}=function(e,t){const r=Array.isArray(e)?e:m.toArray(e);let n=2===r.length?r[1]:r[0];return n="function"==typeof n?n(t):n,2===r.length?{dialogTrigger:r[0],dialog:n}:{dialog:n}}(n,$),J=e(Ox,{initial:!o,children:A&&e(WF.Provider,{value:$,children:e(W,{...f?G:{},ref:R.setFloating,triggerRef:R.reference,style:L,restoreFocus:h,autoFocus:l,isOpen:A,onClose:U,isDismissable:s,isContextMenu:p,placement:r.placement,children:Z})})});return t(y,{children:[K&&w(K,qx({..._||p?{}:{ref:P},...p?{}:X,...f?q:{},...p?Y:{}},{...K.props})),g?gm&&ke(J,gm):J]})}function QF(r){const{label:n,className:i,value:a,onChange:s,size:l,width:c="w-max"}=r,u=Cm(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.colorPresets)?void 0:r.items})||[],d=jk({size:l}),[h,f]=o(a),[p,g]=o(!1);return t("div",{className:af(i,c),children:[n&&e("span",{className:d.label,children:n}),t(JF,{type:"popover",isOpen:p,onOpenChange:g,children:[t(z_,{className:af(d.input,"inline-flex items-center"),"aria-label":r["aria-label"],children:[e("span",{className:"block flex-shrink-0 mr-5 border rounded h-2/4 aspect-square",style:{backgroundColor:h}}),e(eO,{isActive:p,className:d.adornment})]}),e(XF,{size:"auto",children:e(HF,{onChange:e=>{f(e),null==s||s(e)},defaultValue:h,colorPresets:u})})]})]})}function eO({isActive:t,className:r}){return e(KF,{size:"sm",className:`transition-transform ml-auto flex-shrink-0 ${t?"rotate-180":"rotate-0"} ${r}`})}function tO(r){const{size:n="md",inline:i,label:o,showValueLabel:a=!!o,className:s,width:l="w-full",slider:c,children:u,trackColor:d="primary",fillColor:h="primary"}=r,{domProps:f,trackRef:p,getThumbPercent:g,getThumbValueLabel:m,labelId:v,groupId:y,thumbIds:b,isDisabled:w,numberFormatter:x,minValue:C,maxValue:_,step:S,values:A,getValueLabel:k}=c;let E="",I=Math.max([...x.format(C)].length,[...x.format(_)].length,[...x.format(S)].length);k?E=k(A[0]):1===A.length?E=m(0):2===A.length&&(E=`${m(0)} – ${m(1)}`,I=3+2*Math.max(I,[...x.format(C)].length,[...x.format(_)].length));const T=jk({size:n,disabled:w,labelDisplay:"flex"}),F=af("touch-none",s,l,{"flex items-center":i});return t("div",{className:F,role:"group",id:y,children:[(o||a)&&t("div",{className:af(T.label,"select-none"),children:[o&&e("label",{onClick:()=>{var e;null==(e=document.getElementById(b[0]))||e.focus()},id:v,htmlFor:y,children:o}),a&&e("output",{htmlFor:b[0],className:"ml-auto text-right","aria-live":"off",style:I?{width:`${I}ch`,minWidth:`${I}ch`}:void 0,children:E})]}),t("div",{ref:p,className:af("relative",rO(r)),...f,role:"presentation",children:[e("div",{className:af("absolute inset-0 m-auto rounded",iO(d,w),nO(n))}),e("div",{className:af("absolute inset-0 my-auto rounded",oO(h,w),nO(n)),style:{width:`${Math.max(100*g(0),0)}%`}}),u]})]})}function rO({size:e,wrapperHeight:t}){if(t)return t;switch(e){case"xs":return"h-14";case"sm":return"h-20";default:return"h-30"}}function nO(e){switch(e){case"xs":return"h-2";case"sm":return"h-3";default:return"h-4"}}function iO(e,t){switch(t&&(e="disabled"),e){case"disabled":return"bg-slider-disabled/60";case"primary":return"bg-primary-light";case"neutral":return"bg-divider";default:return e}}function oO(e,t){switch(t&&(e="disabled"),e){case"disabled":return"bg-slider-disabled";case"primary":return"bg-primary";default:return e}}function aO(e={}){const{localeCode:t}=ik();return d(()=>new IF(t,e),[t,e])}function sO({minValue:e=0,maxValue:t=100,isDisabled:r=!1,step:n=1,formatOptions:i,onChangeEnd:a,onPointerDown:s,label:l,getValueLabel:c,showThumbOnHoverOnly:d,thumbSize:h,onPointerMove:f,...p}){const[g,m]=o(!1),v=aO(i),{addGlobalListener:y,removeGlobalListener:w}=eC(),x=u(null),[C,_]=iC(p.value?p.value:void 0,p.defaultValue??[e],p.onChange),S=u(null);S.current=C;const[A,k]=o(new Array(C.length).fill(!1)),E=u(null);E.current=A;const I=t=>0===t?e:C[t-1],T=e=>e===C.length-1?t:C[e+1],F=(e,t)=>{if(r||!j(e)||!S.current)return;t=function(e,t,r,n){t=Number(t),r=Number(r);let i=(e-(isNaN(t)?0:t))%n,o=aC(2*Math.abs(i)>=n?e+Math.sign(i)*(n-Math.abs(i)):e-i,n);return isNaN(t)?!isNaN(r)&&o>r&&(o=Math.floor(aC(r/n,n))*n):o<t?o=t:!isNaN(r)&&o>r&&(o=t+Math.floor(aC((r-t)/n,n))*n),o=aC(o,n),o}(t,I(e),T(e),n),S.current=lO(S.current,e,t),_(S.current)},O=(e,t)=>{var n;if(r||!j(e))return;const i=null==(n=E.current)?void 0:n[e];E.current=lO(E.current||[],e,t),k(E.current),a&&i&&!E.current.some(Boolean)&&a(S.current||[])},[P,M]=o(void 0),R=r=>(r=>{const n=Math.min(1,(r-e)/(t-e));return isNaN(n)?0:n})(S.current[r]),L=r=>NI((t=>Math.round((t-e)/n)*n+e)(r*(t-e)+e),e,t),N=u(new Array(C.length).fill(!0)),j=e=>N.current[e],D=u(null),z=u(void 0),B=u(null),{domProps:U}=kI({onPointerDown:e=>{if(("mouse"!==e.pointerType||!(0!==e.button||e.altKey||e.ctrlKey||e.metaKey))&&(null==s||s(),x.current&&!r&&C.every((e,t)=>!A[t]))){const t=x.current.offsetWidth,r=x.current.getBoundingClientRect().left,n=(e.clientX-r)/t,i=L(n);let o;const a=C.findIndex(e=>i-e<0);if(0===a)o=a;else if(-1===a)o=C.length-1;else{const e=C[a-1],t=C[a];o=Math.abs(e-i)<Math.abs(t-i)?a-1:a}o>=0&&j(o)?(e.preventDefault(),D.current=o,M(o),z.current=e.pointerId,O(D.current,!0),F(o,i),y(window,"pointerup",H,!1)):D.current=null}},onMoveStart(){B.current=null},onMove(e,t){var r;const n=(null==(r=x.current)?void 0:r.offsetWidth)||0;if(null==B.current&&(B.current=R(D.current||0)*n),B.current+=t,null!=D.current&&x.current){const e=NI(B.current/n,0,1);((e,t)=>{F(e,L(t))})(D.current,e)}},onMoveEnd(){null!=D.current&&(O(D.current,!1),D.current=null)}}),V=qx(U,{onPointerEnter:()=>{m(!0)},onPointerLeave:()=>{m(!1)},onPointerMove:e=>{null==f||f(e)}}),H=e=>{e.pointerId===z.current&&(null!=D.current&&(O(D.current,!1),D.current=null),w(window,"pointerup",H,!1))},W=b(),$=l?`${W}-label`:void 0,q=`${W}-group`,G=[...Array(C.length)].map((e,t)=>`${W}-thumb-${t}`);return{domProps:V,trackRef:x,isDisabled:r,step:n,values:C,minValue:e,maxValue:t,focusedThumb:P,labelId:$,groupId:q,thumbIds:G,numberFormatter:v,getThumbPercent:R,getThumbMinValue:I,getThumbMaxValue:T,getThumbValueLabel:e=>function(e){return v.format(e)}(C[e]),isThumbDragging:e=>{var t;return(null==(t=E.current)?void 0:t[e])||!1},setThumbValue:F,updateDraggedThumbs:O,setThumbEditable:(e,t)=>{N.current[e]=t},setFocusedThumb:M,getValueLabel:c,isPointerOver:g,showThumbOnHoverOnly:d,thumbSize:h}}function lO(e,t,r){return e[t]===r?e:[...e.slice(0,t),r,...e.slice(t+1)]}function cO({index:t,slider:r,isDisabled:n,ariaLabel:i,inputRef:o,onBlur:s,fillColor:l="primary"}){const d=tC(o),{addGlobalListener:h,removeGlobalListener:f}=eC(),{step:p,values:g,focusedThumb:m,labelId:v,thumbIds:y,isDisabled:b,getThumbPercent:w,getThumbMinValue:x,getThumbMaxValue:C,getThumbValueLabel:_,setThumbValue:S,updateDraggedThumbs:A,isThumbDragging:k,setThumbEditable:E,setFocusedThumb:I,isPointerOver:T,showThumbOnHoverOnly:F,thumbSize:O="w-18 h-18"}=r,P=k(t),M=g[t];E(t,!n);const R=n||b,L=c(()=>{d.current&&d.current.focus({preventScroll:!0})},[d]),N=m===t;a(()=>{N&&L()},[N,L]);const j=u(void 0),D=e=>{e.pointerId===j.current&&(L(),A(t,!1),f(window,"pointerup",D,!1))},z=af("outline-none rounded-full top-1/2 -translate-y-1/2 -translate-x-1/2 absolute inset-0 transition-button duration-200",O,!R&&"shadow-md",function({isDisabled:e,isDragging:t,fillColor:r}){return e?"bg-slider-disabled cursor-default":r&&"primary"!==r?r:af("hover:bg-primary-dark",t?"bg-primary-dark":"bg-primary")}({fillColor:l,isDisabled:R,isDragging:P}),!F||F&&P||T?"visible":"invisible");return e("div",{role:"presentation",className:z,style:{left:`${Math.max(100*w(t),0)}%`},onPointerDown:e=>{0!==e.button||e.altKey||e.ctrlKey||e.metaKey||(L(),j.current=e.pointerId,A(t,!0),h(window,"pointerup",D,!1))},children:e("input",{id:y[t],onKeyDown:D_(()=>{A(t,!0)}),onKeyUp:D_(()=>{A(t,!1)}),ref:d,tabIndex:R?void 0:0,min:x(t),max:C(t),step:p,value:M,disabled:R,"aria-label":i,"aria-labelledby":v,"aria-orientation":"horizontal","aria-valuetext":_(t),onFocus:()=>{I(t)},onBlur:e=>{I(void 0),A(t,!1),null==s||s(e)},onChange:e=>{S(t,parseFloat(e.target.value))},type:"range",className:"sr-only"})})}function uO({inputRef:t,onBlur:r,...n}){const{onChange:i,onChangeEnd:o,value:a,defaultValue:s,...l}=n,c={...l,value:null!=a?[a]:void 0,defaultValue:null!=s?[s]:void 0,onChange:e=>{null==i||i(e[0])},onChangeEnd:e=>{null==o||o(e[0])}},u=sO(c);return e(tO,{...c,slider:u,children:e(cO,{fillColor:n.fillColor,index:0,slider:u,inputRef:t,onBlur:r})})}const dO=i.forwardRef((r,n)=>{let{value:i=0,minValue:o=0,maxValue:a=100,size:s="md",isIndeterminate:l=!1,className:c,position:u="relative",trackColor:d,fillColor:h="border-primary",...f}=r;i=NI(i,o,a);const p=function(e){switch(e){case"xs":return"w-20 h-20";case"sm":return"w-24 h-24";case"md":return"w-32 h-32";case"lg":return"w-42 h-42";default:return e}}(s),g=(i-o)/(a-o),m=aO({style:"percent"});let v="";!l&&!v&&(v=m.format(g));const y={},b={};if(!l){const e=(i-o)/(a-o)*100;let t;e>0&&e<=50?(t=e/50*180-180,y.transform=`rotate(${t}deg)`,b.transform="rotate(-180deg)"):e>50&&(t=(e-50)/50*180-180,y.transform="rotate(0deg)",b.transform=`rotate(${t}deg)`)}return t("div",{...f,"aria-valuenow":l?void 0:i,"aria-valuemin":o,"aria-valuemax":a,"aria-valuetext":l?void 0:v,role:"progressbar",ref:n,className:af("progress-circle",u,p,l&&"indeterminate",c),children:[e("div",{className:af(p,d,"rounded-full border-4")}),t("div",{className:af("fills absolute left-0 top-0 h-full w-full",l&&"progress-circle-fills-animate"),children:[e(hO,{circleSize:p,subMaskStyle:y,isIndeterminate:l,className:"rotate-180",fillColor:h,subMaskClassName:af(l&&"progress-circle-fill-submask-1-animate")}),e(hO,{circleSize:p,subMaskStyle:b,isIndeterminate:l,fillColor:h,subMaskClassName:af(l&&"progress-circle-fill-submask-2-animate")})]})]})});function hO({subMaskStyle:t,subMaskClassName:r,className:n,circleSize:i,isIndeterminate:o,fillColor:a}){return e("div",{className:af("absolute h-full w-1/2 origin-[100%] overflow-hidden",n),children:e("div",{className:af("h-full w-full origin-[100%] rotate-180 overflow-hidden",!o&&"transition-transform duration-100",r),style:t,children:e("div",{className:af(i,a,"rounded-full border-4")})})})}function fO({isLoading:t,icon:r}){const n=u(null),{trans:i}=qF(),[s,l]=o(!1),{state:{isOpen:c,inputValue:d}}=H_(),h=u(d);return a(()=>{t&&!s?(null===n.current&&(n.current=setTimeout(()=>{l(!0)},500)),d!==h.current&&(clearTimeout(n.current),n.current=setTimeout(()=>{l(!0)},500))):t||(l(!1),clearTimeout(n.current),n.current=null),h.current=d},[t,s,d]),s&&(c||t)?e(dO,{"aria-label":i({message:"Loading"}),size:"sm",isIndeterminate:!0}):r||e(KF,{})}const pO=i.forwardRef(function(r,n){const i=gk(),{hideCaret:o,placeholder:a=e(lk,{message:"Select an option..."}),selectedValue:s,onItemSelected:l,onOpenChange:c,onInputValueChange:u,onSelectionChange:d,selectionMode:h,minWidth:f="min-w-128",children:p,searchPlaceholder:g,showEmptyMessage:m,showSearchField:v,defaultInputValue:y,inputValue:b,isLoading:w,isAsync:x,valueClassName:C,floatingWidth:_=(i?"auto":"matchTrigger"),...S}=r,A=gA({...r,clearInputOnItemSelection:!0,showEmptyMessage:m||v,floatingWidth:_,selectionMode:"single",role:"listbox",virtualFocus:v},n),{state:{selectedValues:k,isOpen:E,setIsOpen:I,activeIndex:T,setSelectedIndex:F,inputValue:O,setInputValue:P},collections:M,focusItem:R,listboxId:L,reference:N,refs:j,listContent:D,onInputChange:z}=A,{fieldProps:B,inputProps:U}=Gk({...S,focusRef:j.reference}),V=M.collection.get(k[0]),H=V?t("span",{className:"flex items-center gap-10",children:[V.element.props.startIcon,e("span",{className:af("overflow-hidden overflow-ellipsis whitespace-nowrap",C),children:V.element.props.children})]}):e("span",{className:"italic",children:a}),W=jk({...r,endAdornment:!0}),{handleTriggerKeyDown:$,handleListboxKeyboardNavigation:q,handleListboxSearchFieldKeydown:G}=hk(A),{findMatchingItem:Y}=pk();return e(ck,{listbox:A,onKeyDownCapture:v?void 0:e=>{if(!E)return;const t=Y(e,D,T);null!=t&&R("increment",t)},onKeyDown:q,onClose:v?()=>P(""):void 0,isLoading:w,searchField:v&&e(Yk,{size:"xs"===r.size||"sm"===r.size?"xs":"sm",placeholder:g,startAdornment:e(mk,{}),className:"flex-shrink-0 px-8 pb-8 pt-4",autoFocus:!0,"aria-expanded":E?"true":"false","aria-haspopup":"listbox","aria-controls":E?L:void 0,"aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:"false",value:O,onChange:z,onKeyDown:e=>{G(e)}}),children:e(Hk,{fieldClassNames:W,...B,endAdornment:!o&&e(fO,{isLoading:w}),children:e("button",{...U,type:"button","data-selected-value":null==V?void 0:V.value,"aria-expanded":E?"true":"false","aria-haspopup":"listbox","aria-controls":E?L:void 0,ref:N,onKeyDown:$,onKeyDownCapture:v?void 0:e=>{if(E)return;const t=Y(e,D,T);null!=t&&F(t)},disabled:S.disabled,onClick:()=>{I(!E)},className:af(W.input,!B.unstyled&&f),children:H})})})});function gO(){const t=Cm(e=>e.filter.selected);if(!t)return null;const r=Sm().filter.getByName(t).options,n=(e,r)=>{var n;null==(n=Sm().filter)||n.applyValue(t,e,r),_m().setDirty(!0)},i=Sm().canvas.getMainImage().filters,o=Sm().filter.findFilterIndex(t,i),a=null==i?void 0:i[o];if(r){const t=Object.entries(r).map(([t,r])=>{let i;const o=a?a[t]:r.current;return"slider"===r.type?i=e(uO,{label:e("span",{className:"capitalize",children:e(lk,{...NC[t]})}),minValue:r.min,maxValue:r.max,step:r.step,defaultValue:o,formatOptions:{style:"percent"},size:"sm",onChange:e=>{n(t,e)}}):"colorPicker"===r.type?i=e(QF,{label:e(lk,{...NC[t]}),size:"sm",width:"w-full",value:o,onChange:e=>{n(t,e)}}):"select"===r.type&&(i=e(pO,{selectionMode:"single",size:"sm",label:e(lk,{...NC[t]}),defaultValue:o,onSelectionChange:e=>{n(t,e)},children:r.available.map(t=>e(G_,{value:t.key,children:e("span",{className:"capitalize",children:e(lk,{message:t.key})})},t.key))})),e("div",{className:"pb-10",children:i},t)});return e(iT,{children:e("div",{className:"max-w-240 pt-10 mx-auto",children:t})})}return null}function mO(){const r=Cm(e=>e.frame.active),n="basic"===(null==r?void 0:r.mode),i=c(e=>`${e}%`,[]);return e(iT,{className:"pb-18 pt-6",children:t("div",{className:"max-w-288 m-auto",children:[n&&e(QF,{className:"mb-20",width:"w-full",size:"sm",label:e(lk,{message:"Color"}),value:Sm().frame.builder.defaultColor,onChange:e=>{Sm().frame.active.changeColor(e)}}),e(uO,{size:"sm",label:e(lk,{message:"Size"}),step:1,minValue:Sm().frame.active.getMinSize(),maxValue:Sm().frame.active.getMaxSize(),defaultValue:Sm().frame.active.currentSizeInPercent,getValueLabel:i,onChange:e=>{Sm().frame.resize(e)}})]})})}const vO=i.createContext(null);function yO(){const{tabsRef:t,selectedTab:r}=l(vO),[n,i]=o({width:void 0,transform:void 0,className:void 0});return Lx(()=>{if(null!=r&&t.current){const e=t.current[r];if(!e)return;i(t=>({width:`${e.offsetWidth}px`,transform:`translateX(${e.offsetLeft}px)`,className:void 0===t.width?"":"transition-all"}))}},[i,r,t]),e("div",{className:af("absolute bottom-0 left-0 h-2 bg-primary",n.className),role:"presentation",style:{width:n.width,transform:n.transform}})}function bO({children:r,center:n,expand:i,className:o}){const a=m.toArray(r);return e(RA,{children:t("div",{className:af("flex relative max-w-full overflow-auto border-b max-sm:hidden-scrollbar md:compact-scrollbar",o),role:"tablist","aria-orientation":"horizontal",children:[a.map((e,t)=>v(e)?w(e,{index:t,className:af(e.props.className,i&&"flex-auto",n&&0===t&&"ml-auto",n&&t===a.length-1&&"mr-auto")}):null),e(yO,{})]})})}function wO(t){const{size:r="md",children:n,className:i,isLazy:o,overflow:a="overflow-hidden"}=t,s=u([]),l=b(),[c,h]=iC(t.selectedTab,t.defaultSelectedTab||0,t.onTabChange),f=d(()=>({selectedTab:c,setSelectedTab:h,tabsRef:s,size:r,isLazy:o,id:l}),[c,l,o,h,r]);return e(vO.Provider,{value:f,children:e("div",{className:af(i,a,"max-w-full"),children:n})})}const xO=cf(e("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"}),"FormatUnderlinedOutlined"),CO=cf(e("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"}),"FormatStrikethroughOutlined"),_O=cf(e("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),SO=cf(e("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),AO=cf(e("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),kO=cf(e("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined");function EO(){return t("div",{className:"flex gap-20 justify-center",children:[e(IO,{}),e(TO,{}),e(FO,{})]})}function IO(){const t=Cm(e=>e.objects.active.editableProps.fontSize)??40,{trans:r}=qF();return e(Yk,{type:"number",size:"xs","aria-label":r({message:"Font Size"}),min:1,max:300,className:"w-64 flex-shrink-0",value:t,onChange:e=>{Sm().objects.setValues({fontSize:e.target.valueAsNumber}),_m().setDirty(!0)}})}function TO(){const r=Cm(e=>e.objects.active.editableProps.fontStyle),n=Cm(e=>e.objects.active.editableProps.underline),i=Cm(e=>e.objects.active.editableProps.linethrough),[a,s]=o([r,n&&"underline",i&&"linethrough"]);return t(iE,{size:"xs",variant:"outline",radius:"rounded",value:a,multiple:!0,onChange:e=>{s(e),Sm().objects.setValues({underline:e.includes("underline"),linethrough:e.includes("linethrough"),fontStyle:e.includes("italic")?"italic":""}),_m().setDirty(!0)},children:[e(Jk,{value:"underline",children:e(xO,{})}),e(Jk,{value:"linethrough",children:e(CO,{})}),e(Jk,{value:"italic",children:e(_O,{})})]})}function FO(){const r=Cm(e=>e.objects.active.editableProps.textAlign);return t(iE,{size:"xs",variant:"outline",radius:"rounded",value:r,onChange:e=>{Sm().objects.setValues({textAlign:e}),_m().setDirty(!0)},children:[e(Jk,{value:"left",children:e(AO,{})}),e(Jk,{value:"center",children:e(kO,{})}),e(Jk,{value:"right",children:e(SO,{})})]})}function OO({children:t,className:r}){const{selectedTab:n,isLazy:i}=l(vO),o=m.toArray(t).filter(e=>!!e);let a;if(i){const e=o[n];a=v(e)?w(o[n],{index:n}):null}else a=o.map((e,t)=>{if(v(e)){const r=t===n;return w(e,{index:t,"aria-hidden":!r,className:r?e.props.className:af(e.props.className,"hidden")})}return null});return e("div",{className:r,children:a})}function PO({className:t,children:r,index:n,...i}){const{id:a}=l(vO),[s,c]=o(0),d=u(null);return Lx(()=>{if(null!=d&&d.current){const e=()=>{const e=qA(d.current,{tabbable:!0});c(e.nextNode()?void 0:0)};e();const t=new MutationObserver(e);return t.observe(d.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{t.disconnect()}}},[d]),e("div",{tabIndex:s,ref:d,id:`${a}-${n}-tabpanel`,"aria-labelledby":`${a}-${n}-tab`,className:af(t,"focus-visible:outline-primary-light"),role:"tabpanel",...i,children:r})}const MO=[{type:"linear",coords:{x1:-80,y1:0,x2:80,y2:0},colorStops:[{color:"#ffe47b",offset:0},{color:"rgb(111,154,211)",offset:1}]},{type:"linear",coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{color:"#ff4040",offset:0},{color:"#e6399b",offset:1}]},{type:"linear",coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:"rgb(166,111,213)"},{offset:.5,color:"rgba(106, 72, 215, 0.5)"},{offset:1,color:"#200772"}]},{type:"radial",coords:{r1:100,r2:10,x1:0,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:"#FF4F4F"},{offset:1,color:"rgb(255, 239, 64)"}]},{type:"radial",coords:{r1:100,r2:10,x1:0,y1:0,x2:20,y2:20},colorStops:[{offset:0,color:"#ffe47b"},{offset:.5,color:"rgb(111,154,211)"},{offset:1,color:"rgb(166,111,213)"}]},{type:"radial",coords:{r1:50,r2:80,x1:45,y1:45,x2:52,y2:50},colorStops:[{offset:0,color:"rgb(155, 237, 0)"},{offset:1,color:"rgba(0, 164, 128,0.4)"}]},{type:"linear",coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:"#9ecb2d"},{offset:.5,color:"#72aa00"},{offset:1,color:"#bfd255"}]},{type:"radial",coords:{r1:100,r2:50,x1:30,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:"#aebcbf"},{offset:1,color:"#0a0809"}]},{type:"linear",coords:{x1:-80,y1:0,x2:80,y2:0},colorStops:[{offset:0,color:"#ffffff"},{offset:1,color:"#f6f6f6"}]},{type:"linear",coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{offset:0,color:"#fefcea"},{offset:1,color:"#f1da36"}]},{type:"linear",coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:"rgb(166,111,213)"},{offset:.5,color:"rgba(106, 72, 215, 0.5)"},{offset:1,color:"#ff1a00"}]},{type:"linear",coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{offset:0,color:"#b7deed"},{offset:1,color:"#21b4e2"}]},{type:"linear",coords:{x1:-80,y1:100,x2:80,y2:-100},colorStops:[{offset:0,color:"#ffe47b"},{offset:1,color:"rgb(111,154,211)"}]}],RO=cf(e("path",{d:"M19.51 3.08 3.08 19.51c.09.34.27.65.51.9.25.24.56.42.9.51L20.93 4.49c-.19-.69-.73-1.23-1.42-1.41zM11.88 3 3 11.88v2.83L14.71 3h-2.83zM5 3c-1.1 0-2 .9-2 2v2l4-4H5zm14 18c.55 0 1.05-.22 1.41-.59.37-.36.59-.86.59-1.41v-2l-4 4h2zm-9.71 0h2.83L21 12.12V9.29L9.29 21z"}),"TextureOutlined"),LO=cf(e("path",{d:"M11 9h2v2h-2V9zm-2 2h2v2H9v-2zm4 0h2v2h-2v-2zm2-2h2v2h-2V9zM7 9h2v2H7V9zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z"}),"GradientOutlined"),NO=cf(e("path",{d:"M18 20H4V6h9V4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2v9zm-7.79-3.17-1.96-2.36L5.5 18h11l-3.54-4.71zM20 4V1h-2v3h-3c.01.01 0 2 0 2h3v2.99c.01.01 2 0 2 0V6h3V4h-3z"}),"AddPhotoAlternateOutlined");function jO({property:r}){const{trans:n}=qF(),i=Cm(e=>e.objects.active.editableProps[r]);return t("div",{className:"flex items-center justify-center gap-14",children:[e(QF,{className:"flex-shrink-0",size:"xs","aria-label":n({message:"Color"}),value:"string"==typeof i?i:Qh.fill,onChange:e=>{Sm().objects.setValues({[r]:e}),_m().setDirty(!0)}}),e(DO,{type:"gradient",property:r}),e(DO,{type:"texture",property:r})]})}function DO({type:r,property:n}){return e(y,{children:t(JF,{type:"popover",children:[e(B_,{className:"flex-shrink-0",id:`${r}-panel-trigger`,variant:"outline",size:"xs",startIcon:e("texture"===r?RO:LO,{}),endIcon:e(KF,{}),children:e("span",{className:"capitalize",children:e(lk,"gradient"===r?{message:"Gradient"}:{message:"Texture"})})}),e(XF,{size:"auto",children:e("div",{className:"grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md",children:e(zO,{property:n,type:r})})})]})})}function zO({type:t,property:r}){const{close:n}=$F(),i=Array.from(Array("gradient"===t?MO.length:28).keys()),o="w-56 h-56 bg border shadow-sm hover:scale-110",a=i.map(i=>{const a=EC(`images/${t}s/${i}.png`);return e(z_,{radius:"rounded",className:o,style:{backgroundImage:`url(${a})`},"aria-label":`Select ${t} #${i}`,onClick:async()=>{n();const e="gradient"===t?new lC.fabric.Gradient(MO[i]):await UO(a);Sm().objects.setValues({[r]:e}),_m().setDirty(!0)}},i)});return"texture"===t&&a.unshift(e(BO,{property:r,className:o},"upload-btn")),e(y,{children:a})}function BO({className:t,property:r}){const{close:n}=$F();return e(z_,{radius:"rounded",className:t,"aria-label":"Upload an image",onClick:async()=>{const e=await Sm().import.openUploadWindow();if(n(),e){const t=await UO(await e.data);Sm().objects.setValues({[r]:t})}},children:e(NO,{className:"icon-md"})})}function UO(e){return new Promise(t=>{lC.fabric.util.loadImage(e,e=>{const r=new lC.fabric.Pattern({source:e,repeat:"repeat"});t(r)})})}function VO(){const t=Cm(e=>e.objects.active.editableProps.opacity);return e(uO,{className:"max-w-240 w-full mx-auto","aria-label":"Opacity",value:t,minValue:.1,step:.1,maxValue:1,onChange:e=>{Sm().objects.setValues({opacity:e}),_m().setDirty(!0)}})}function HO(){const{trans:r}=qF(),n=Cm(e=>e.objects.active.editableProps.stroke),i=Cm(e=>e.objects.active.editableProps.strokeWidth);return t("div",{className:"flex items-center gap-40",children:[e(QF,{className:"ml-auto flex-shrink-0",size:"xs",value:n,"aria-label":r({message:"Outline Color"}),onChange:e=>{Sm().objects.setValues({stroke:e}),_m().setDirty(!0)}}),e(uO,{"aria-label":"Outline Width",className:"max-w-240 mr-auto flex-shrink-0",value:i,onChange:e=>{Sm().objects.setValues({strokeWidth:e}),_m().setDirty(!0)}})]})}const WO=cf(e("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z"}),"ImageOutlined");function $O(){return e("div",{className:"flex justify-center",children:e(B_,{type:"button",variant:"outline",size:"xs",startIcon:e(WO,{}),radius:"rounded-full",onClick:async()=>{const e=await Sm().import.openUploadWindow();if(e){const t=Sm().objects.getActive();if(t&&"setSrc"in t){const r=await e.data;t.setSrc(r,()=>{bC({src:r}),Sm().canvas.render()})}}},children:e(lk,{message:"Replace Image"})})})}const qO={color:"rgba(0, 0, 0, 0.6)",blur:3,offsetX:-1,offsetY:0};function GO(){const{trans:r}=qF(),n=Cm(e=>e.objects.active.editableProps.shadow)||qO;return t("div",{className:"flex items-center gap-40",children:[e(QF,{className:"ml-auto flex-shrink-0",value:n.color,size:"xs","aria-label":r({message:"Shadow Color"}),onChange:e=>{Sm().objects.setValues({shadow:YO({color:e})}),_m().setDirty(!0)}}),e(uO,{"aria-label":"Shadow Blur",className:"max-w-240 mr-auto flex-shrink-0",defaultValue:n.blur,onChange:e=>{Sm().objects.setValues({shadow:YO({blur:e})}),_m().setDirty(!0)}})]})}function YO(e){var t;const r=null==(t=Sm().objects.getActive())?void 0:t.shadow;return r?(Object.entries(e).forEach(([e,t])=>{r[e]=t}),r):new lC.fabric.Shadow({...qO,...e})}function XO({index:t,className:r,isDisabled:n,children:i,padding:o,elementType:a="button",to:s,relative:c,width:u="min-w-min"}){const{selectedTab:d,setSelectedTab:h,tabsRef:f,size:p="md",id:g}=l(vO),m=t===d,v=function(){var e;return null===(e=l(PA))||void 0===e?void 0:e.focusManager}(),y=o||("sm"===p?"px-12":"px-18"),b=af("tracking-wide overflow-hidden capitalize text-sm flex items-center justify-center outline-none transition-colors","focus-visible:ring focus-visible:ring-2 ring-inset rounded whitespace-nowrap cursor-pointer",u,function({isDisabled:e,isSelected:t}){return e?"text-disabled cursor-default":t?"text-primary":"text-muted hover:text-main"}({isDisabled:n,isSelected:m}),r,"md"===p&&`${y} h-48`,"sm"===p&&`${y} h-32`,n&&"pointer-events-none");return e(a,{disabled:n,id:`${g}-${t}-tab`,"aria-controls":`${g}-${t}-tabpanel`,type:"button",role:"tab","aria-selected":m,tabIndex:n?void 0:m?0:-1,onKeyDown:e=>{switch(e.key){case"ArrowLeft":null==v||v.focusPrevious();break;case"ArrowRight":null==v||v.focusNext();break;case"Home":null==v||v.focusFirst();break;case"End":null==v||v.focusLast()}},onClick:()=>{h(t)},to:s,relative:c,className:b,ref:e=>{f.current&&e&&(f.current[t]=e)},children:i})}function KO(){const r=Cm(e=>e.objects.active);return t(wO,{size:"sm",className:"pb-18 pt-6",children:[t(bO,{center:!0,children:[r.isText&&e(XO,{children:e(lk,{message:"Font"})}),!r.isImage&&e(XO,{children:e(lk,{message:"Color"})}),!r.isImage&&e(XO,{children:e(lk,{message:"Background"})}),r.isImage&&e(XO,{children:e(lk,{message:"Image"})}),e(XO,{children:e(lk,{message:"Opacity"})}),e(XO,{children:e(lk,{message:"Outline"})}),e(XO,{children:e(lk,{message:"Shadow"})})]}),t(OO,{className:"pt-16 h-50",children:[r.isText&&e(PO,{children:e(EO,{})},"font"),!r.isImage&&e(PO,{children:e(jO,{property:"fill"})}),!r.isImage&&e(PO,{children:e(jO,{property:"backgroundColor"})}),r.isImage&&e(PO,{children:e($O,{})}),e(PO,{children:e(VO,{})}),e(PO,{children:e(HO,{})}),e(PO,{children:e(GO,{})})]})]})}function ZO(){const t=!gk()&&e(B_,{size:"sm",color:"primary",variant:"outline",onClick:()=>{Sm().text.add(),_m().setDirty(!0)},children:e(lk,{message:"New Text"})});return e(iT,{actionBtn:t,children:e(KO,{})})}const JO=cf(e("path",{d:"m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownwardOutlined"),QO={};let eP=!1,tP=null,rP=null;const nP=e=>{var t;for(const r in QO)r!==e&&(null==(t=QO[r])||t.call(QO,!0),delete QO[r])},iP=p(({children:r,label:n,placement:i="top",offset:s=10,variant:l="neutral",delay:d=1500,isDisabled:h,usePortal:f=!0,...p},g)=>{const{x:m,y:v,reference:x,strategy:C,arrowRef:_,arrowStyle:S,refs:A}=pA({placement:i,offset:s,ref:g,showArrow:!0}),[k,E]=o(!1),I=b(),T=u(),F=()=>{clearTimeout(T.current),T.current=void 0,nP(I),QO[I]=O,eP=!0,E(!0),tP&&(clearTimeout(tP),tP=null),rP&&(clearTimeout(rP),rP=null)},O=c(e=>{e?(clearTimeout(T.current),T.current=void 0,E(!1)):T.current||(T.current=setTimeout(()=>{T.current=void 0,E(!1)},500)),tP&&(clearTimeout(tP),tP=null),eP&&(rP&&clearTimeout(rP),rP=setTimeout(()=>{delete QO[I],rP=null,eP=!1},500))},[I]),P=e=>{!e&&d>0&&!T.current?(nP(I),QO[I]=O,k||tP||eP?k||F():tP=setTimeout(()=>{tP=null,eP=!0,F()},d)):F()};a(()=>()=>{clearTimeout(T.current),QO[I]&&delete QO[I]},[I]),a(()=>{const e=e=>{"Escape"===e.key&&O(!0)};if(k)return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[k,O]);const M=e(Ox,{children:k&&t(Sx.div,{...ZA,ref:A.setFloating,id:I,role:"tooltip",onPointerEnter:()=>{P(!0)},onPointerLeave:()=>{O()},className:af("z-tooltip my-4 max-w-240 break-words rounded px-8 py-4 text-xs text-white shadow","positive"===l&&"bg-positive","danger"===l&&"bg-danger","neutral"===l&&"bg-toast"),style:{position:C,top:v??"",left:m??""},children:[e("div",{ref:_,className:"absolute h-8 w-8 rotate-45 bg-inherit",style:S}),n]})});return t(y,{children:[w(r,qx({"aria-describedby":k?I:void 0,ref:x,onPointerEnter:e=>{"mouse"===e.pointerType&&P()},onFocus:e=>{e.target.matches(":focus-visible")&&P(!0)},onPointerLeave:e=>{"mouse"===e.pointerType&&O()},onPointerDown:()=>{O(!0)},onBlur:()=>{O()},"aria-label":"string"==typeof n?n:n.props.message},p)),f?gm&&ke(M,gm):M]})});function oP(){const r=Cm(e=>e.activeToolOverlay),n=Cm(e=>e.objects.active.id),i=function(t,r){switch(t){case ug.Filter:return e(gO,{});case ug.Frame:return e(mO,{});case ug.Text:return r&&e(ZO,{});case ug.ActiveObject:return r&&e(KO,{});default:return null}}(r,n),[a,s]=o(!0);return t("div",{className:"relative z-tool-overlay text-sm",children:[i&&e("div",{className:af("absolute right-16 text-muted z-50 transition-all",!a&&"rotate-180",a?"-top-144":"-top-40"),children:e(iP,{label:e(lk,a?{message:"Hide options"}:{message:"Show options"}),children:e(Jk,{variant:"outline",radius:"rounded-lg",size:"xs",onClick:()=>{s(!a)},children:e(JO,{})})})}),e(Ox,{children:i&&a&&e(Sx.div,{initial:{y:0,opacity:0},animate:{y:"-100%",opacity:1},exit:{y:0,opacity:0},transition:{type:"tween",duration:.15},className:"absolute inset-x-0 gap-16 px-5vw bg bg-opacity-95 border-t",children:i},"tool-controls-overlay")})]})}const aP=cf(e("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined");function sP({filter:r}){const n=Cm(e=>e.filter.applied.includes(r)),i=Sm().filter.hasOptions(r),o=af("block flex-shrink-0 rounded",{"text-primary border-primary":n}),a=LC[r],s=t(y,{children:[t("div",{className:"relative",children:[e(lP,{filter:r}),n&&e(cP,{filter:r,hasOptions:i})]}),e("div",{className:"mt-4 text-center text-xs capitalize",children:a?e(lk,{...a}):r})]});return n&&i?e("div",{className:o,children:s}):e(z_,{className:o,onClick:()=>{n?Sm().filter.remove(r):Sm().filter.apply(r)},children:s})}function lP({filter:t}){const r=Cm(e=>e.filter.selected===t),n=af("m-auto w-96 h-56 border rounded object-cover",{shadow:r});return e("img",{src:EC(`images/filter/${t}.jpg`),className:n,alt:""})}function cP({filter:r,hasOptions:n}){return t("div",{className:"flex items-center justify-center bg-background/70 absolute inset-0 border-2 border-primary rounded",children:[n?e(Jk,{color:"primary",size:"md",onClick:()=>{Sm().filter.remove(r)},children:e(aP,{})}):e(aP,{className:"svg-icon icon-md"}),n&&e(uP,{filter:r,hasOptions:n})]})}function uP({filter:t,hasOptions:r}){return e(Jk,{color:"primary",size:"md",onClick:()=>{_m().activeToolOverlay===ug.Filter&&_m().filter.selected===t?_m().setActiveTool(_m().activeTool,null):_m().filter.select(t,r)},children:e(hf,{})})}const dP=p(({children:t,className:r,gap:n="gap-10"},o)=>{const a=i.Children.map(t,(e,r)=>i.isValidElement(e)?i.cloneElement(e,{isFirst:0===r,isLast:i.Children.count(t)===r+1}):e);return e("div",{ref:o,className:af("tiny-scrollbar pb-4 overflow-x-auto relative flex items-center",n,r),children:a})});function hP({isFirst:t,isLast:r,children:n,className:i}){const o=af(i,"flex-shrink-0",{"ml-auto":t,"mr-auto":r});return e("div",{className:o,children:n})}function fP(){const t=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.filter)?void 0:r.items})||[];a(()=>{Sm().filter.syncState()},[]);const r=t.map(t=>e(hP,{children:e(sP,{filter:t})},t));return e(dP,{children:r})}const pP=cf(e("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"}),"LockOutlined"),gP=cf(e("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h2c0-1.66 1.34-3 3-3s3 1.34 3 3v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"}),"LockOpenOutlined"),mP=cf(e("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlankOutlined"),vP=cf(e("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),yP=cf(e("path",{d:"M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M17,13H7v-2h10V13z"}),"CheckBox"),bP=p((r,n)=>{const{size:i="md",children:o,className:s,icon:l,checkedIcon:u,disabled:d,isIndeterminate:h,errorMessage:f,invalid:p,orientation:g="horizontal",onChange:m,autoFocus:v,required:y,value:b,name:w,inputTestId:x}=r,C=jk({...r,label:o}),_=l||mP,S=u||(h?yP:vP),A=tC(n);qk({autoFocus:v},A),a(()=>{A.current&&(A.current.indeterminate=h||!1)});const[k,E]=iC(r.checked,r.defaultChecked||!1),I=c(e=>{null==m||m(e),E(e.target.checked)},[m,E]),T=af("select-none",s,p&&"text-danger",!p&&d&&"text-disabled");let F,O=p?"text-danger":null;return h?(F=yP,O=O||"text-primary"):k?(F=S,O=O||"text-primary"):(F=_,O=O||"text-muted"),t("div",{children:[e("label",{className:T,children:t("div",{className:af("relative flex items-center","vertical"===g&&"flex-col flex-col-reverse"),children:[e("input",{className:"absolute left-0 top-0 h-24 w-24 appearance-none overflow-hidden rounded outline-none ring-inset transition-shadow focus-visible:ring",type:"checkbox","aria-checked":h?"mixed":k,"aria-invalid":p||void 0,onChange:I,ref:A,required:y,disabled:d,value:b,name:w,"data-testid":x}),e(F,{size:i,className:af("pointer-events-none",d?"text-disabled":O)}),o&&e("div",{className:af("first-letter:capitalize",C.size.font,"vertical"===g?"mb-6":"ml-6"),children:o})]})}),f&&e("div",{className:C.error,children:f})]})});function wP(){const{trans:r}=qF(),{minWidth:n=50,minHeight:i=50,maxHeight:o=2400,maxWidth:s=2400}=Cm(e=>{var t;return null==(t=e.config.tools)?void 0:t.resize})||{},l=Cm(e=>e.original),c=Cm(e=>e.resize.formValue);a(()=>{_m().resize.setFormValue({...l})},[l]),a(()=>{_m().setDirty(!0)},[]);return t("form",{className:"flex items-center justify-center gap-16 w-full",onSubmit:e=>{e.preventDefault(),_m().applyChanges()},children:[e(Yk,{type:"number",min:n,max:s,size:"sm",className:"w-full max-w-112",label:e(lk,{message:"Width"}),value:c.width,onChange:e=>{(e=>{const t={...c,width:e};c.maintainAspect&&(t.height=WC(e,c.usePercentages)),_m().resize.setFormValue(t)})(e.target.valueAsNumber)}}),e("div",{className:"mt-24",children:e(bP,{size:"md",checked:c.maintainAspect,onChange:e=>{(e=>{const t={...c,maintainAspect:e};e&&(t.height=WC(t.width,t.usePercentages)),_m().resize.setFormValue(t)})(!c.maintainAspect)},"aria-label":r({message:"Maintain aspect ratio"}),checkedIcon:pP,icon:gP})}),e(Yk,{type:"number",min:i,max:o,size:"sm",className:"w-full max-w-112",label:e(lk,{message:"Height"}),value:c.height,onChange:e=>{(e=>{const t={...c,height:e};e&&c.maintainAspect&&(t.width=HC(e,c.usePercentages)),_m().resize.setFormValue(t)})(e.target.valueAsNumber)}}),e("button",{type:"submit",className:"hidden",children:e(lk,{message:"Resize"})})]})}function xP(){const r=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.presets})||[],n=Cm(e=>e.crop.selectedAspectRatio),i=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.crop)?void 0:r.allowCustomRatio})??!0,o=r.filter(e=>e.ratio||!e.ratio&&i).map(r=>e(hP,{children:t(z_,{onClick:()=>Sm().crop.resetCropzone(r.ratio),className:"flex flex-col items-center justify-between cursor-pointer h-56",children:[e(CP,{preset:r,selectedRatio:n}),e(_P,{preset:r,selectedRatio:n})]})},r.ratio||r.name));return e(dP,{gap:"gap-18",children:o})}function CP({preset:t,selectedRatio:r}){let n=40,i=30;if(t.ratio){const e=YC(t.ratio);({width:n,height:i}=GC(e,n,i))}const o=af("border-2",{"border-dotted":null===t.ratio,"border-primary":r===t.ratio});return e("div",{style:{width:`${n}px`,height:`${i}px`},className:o})}function _P({preset:t,selectedRatio:r}){const n=af("mt-4 text-center text-xs",{"text-primary":r===t.ratio});return e("div",{className:n,children:t.name?e(lk,{message:t.name}):t.ratio})}const SP=cf(e("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}),"FlipOutlined");function AP(){return t("div",{children:[e(Jk,{size:"sm",onClick:()=>{Sm().transform.flip("vertical"),_m().setDirty(!0)},children:e(SP,{})}),e(Jk,{size:"sm",onClick:()=>{Sm().transform.flip("horizontal"),_m().setDirty(!0)},children:e(SP,{className:"rotate-90"})})]})}const kP=cf(e("path",{d:"M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z"}),"RotateLeftOutlined"),EP=cf(e("path",{d:"M15.55 5.55 11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42 1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z"}),"RotateRightOutlined");function IP(){return t("div",{children:[e(Jk,{size:"sm",onClick:()=>{Sm().transform.rotateLeft(),_m().setDirty(!0)},children:e(kP,{})}),e(Jk,{size:"sm",onClick:()=>{Sm().transform.rotateRight(),_m().setDirty(!0)},children:e(EP,{})})]})}function TP(){return t("div",{className:"flex items-center justify-center gap-16",children:[e(AP,{}),e(FP,{}),e(IP,{})]})}function FP(){const r=u(null),{domProps:n,groupId:i,thumbIds:o,trackRef:a,getThumbValueLabel:s}=sO({minValue:-45,maxValue:45,step:1,defaultValue:[_m().crop.straightenAngle],onChange:e=>{const t=e[0];Sm().transform.straighten(t),_m().crop.setTransformAngle(t),_m().setDirty(!0),r.current.style.transform=`translateX(${t}px)`}});return e("div",{id:i,role:"group",className:"flex-auto flex-shrink-0 max-w-320 touch-none isolate",children:t("div",{...n,ref:a,className:"h-36 relative",children:[t("output",{htmlFor:o[0],"aria-live":"off",className:"absolute left-1/2 top-1/2 w-40 text-center bg -translate-x-1/2 -translate-y-1/2 z-10",children:[s(0),"°"]}),e(OP,{ref:r})]})})}const OP=i.forwardRef((t,r)=>{const n=[...Array(80).keys()],i=n.map(t=>e("circle",{cx:2+10*t,cy:"20",r:t%5?.75:2},t));return e("div",{className:"relative h-full cursor-pointer overflow-hidden",children:e("svg",{ref:r,style:{width:10*n.length},className:"absolute -left-80 h-full fill-current",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:i})})});function PP(){return a(()=>(_m().setDirty(!0),Sm().frame.active.hide(),()=>{Sm().frame.active.show()}),[]),t("div",{className:"pb-16",children:[e("div",{className:"mb-10",children:e(TP,{})}),e(xP,{})]})}const MP=cf(e("path",{d:"M 16 6 C 12.484375 6 9.273438 7.070313 6.90625 8.84375 C 4.539063 10.617188 3 13.15625 3 16 C 3 18.84375 4.539063 21.382813 6.90625 23.15625 C 9.273438 24.929688 12.484375 26 16 26 C 19.515625 26 22.726563 24.929688 25.09375 23.15625 C 27.460938 21.382813 29 18.84375 29 16 C 29 13.15625 27.460938 10.617188 25.09375 8.84375 C 22.726563 7.070313 19.515625 6 16 6 Z M 16 8 C 19.109375 8 21.898438 8.957031 23.875 10.4375 C 25.851563 11.917969 27 13.875 27 16 C 27 18.125 25.851563 20.082031 23.875 21.5625 C 21.898438 23.042969 19.109375 24 16 24 C 12.890625 24 10.101563 23.042969 8.125 21.5625 C 6.148438 20.082031 5 18.125 5 16 C 5 13.875 6.148438 11.917969 8.125 10.4375 C 10.101563 8.957031 12.890625 8 16 8 Z "})),RP=cf(e("path",{d:"M 16 4 C 9.382813 4 4 9.382813 4 16 C 4 22.617188 9.382813 28 16 28 C 22.617188 28 28 22.617188 28 16 C 28 9.382813 22.617188 4 16 4 Z M 16 6 C 21.535156 6 26 10.464844 26 16 C 26 21.535156 21.535156 26 16 26 C 10.464844 26 6 21.535156 6 16 C 6 10.464844 10.464844 6 16 6 Z "})),LP=cf(e("path",{d:"M 3 6 L 3 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 5 24 Z "})),NP=cf(e("path",{d:"M 16 4.90625 L 15.125 6.40625 L 4.71875 24.5 L 3.875 26 L 28.125 26 L 27.28125 24.5 L 16.875 6.40625 Z M 16 8.9375 L 24.65625 24 L 7.34375 24 Z "}));function jP(){const t=(Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.shapes)?void 0:r.items})||[]).map(t=>e(hP,{children:e(Jk,{variant:"outline",radius:"rounded-2xl",size:"xl",onClick:()=>{Sm().shape.addBasicShape(t.name),_m().setDirty(!0)},children:e(DP,{shape:t})})},t.name));return e(dP,{children:t})}function DP({shape:t}){var r;return"Path"===t.type?e("svg",{className:"m-auto w-36 h-36",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -100 512 700",children:e("path",{className:"fill-transparent stroke-current",d:null==(r=t.options)?void 0:r.path,strokeWidth:25})}):i.cloneElement(zP[t.name],{className:"w-30 h-30"})}const zP={circle:e(RP,{viewBox:"0 0 32 32"}),square:e(LP,{viewBox:"0 0 32 32"}),triangle:e(NP,{viewBox:"0 0 32 32"}),ellipse:e(MP,{viewBox:"0 0 32 32"})};function BP(e,t,r){let n,i=r.initialDeps??[];return()=>{var o,a,s,l;let c;r.key&&null!=(o=r.debug)&&o.call(r)&&(c=Date.now());const u=e();if(u.length===i.length&&!u.some((e,t)=>i[t]!==e))return n;let d;if(i=u,r.key&&null!=(a=r.debug)&&a.call(r)&&(d=Date.now()),n=t(...u),r.key&&null!=(s=r.debug)&&s.call(r)){const e=Math.round(100*(Date.now()-c))/100,t=Math.round(100*(Date.now()-d))/100,n=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*n,120))}deg 100% 31%);`,null==r?void 0:r.key)}return null==(l=null==r?void 0:r.onChange)||l.call(r,n),n}}function UP(e,t){if(void 0===e)throw new Error("Unexpected undefined");return e}const VP=(e,t,r)=>{let n;return function(...i){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,i),r)}},HP=e=>e,WP=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let e=t;e<=r;e++)n.push(e);return n},$P=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;const i=e=>{const{width:r,height:n}=e;t({width:Math.round(r),height:Math.round(n)})};if(i(r.getBoundingClientRect()),!n.ResizeObserver)return()=>{};const o=new n.ResizeObserver(e=>{const t=e[0];if(null!=t&&t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void i({width:e.inlineSize,height:e.blockSize})}i(r.getBoundingClientRect())});return o.observe(r,{box:"border-box"}),()=>{o.unobserve(r)}},qP={passive:!0},GP=typeof window>"u"||"onscrollend"in window,YP=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;let i=0;const o=GP?()=>{}:VP(n,()=>{t(i,!1)},e.options.isScrollingResetDelay),a=n=>()=>{i=r[e.options.horizontal?"scrollLeft":"scrollTop"],o(),t(i,n)},s=a(!0),l=a(!1);return l(),r.addEventListener("scroll",s,qP),r.addEventListener("scrollend",l,qP),()=>{r.removeEventListener("scroll",s),r.removeEventListener("scrollend",l)}},XP=(e,t,r)=>{if(null!=t&&t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[r.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[r.options.horizontal?"width":"height"])},KP=(e,{adjustments:t=0,behavior:r},n)=>{var i,o;const a=e+t;null==(o=null==(i=n.scrollElement)?void 0:i.scrollTo)||o.call(i,{[n.options.horizontal?"left":"top"]:a,behavior:r})};class ZP{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let e=null;const t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{this._measureElement(e.target,e)})}):null);return{disconnect:()=>{var e;return null==(e=t())?void 0:e.disconnect()},observe:e=>{var r;return null==(r=t())?void 0:r.observe(e,{box:"border-box"})},unobserve:e=>{var r;return null==(r=t())?void 0:r.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,r])=>{typeof r>"u"&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:HP,rangeExtractor:WP,onChange:()=>{},measureElement:XP,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,...e}},this.notify=(e,t)=>{var r,n;const{startIndex:i,endIndex:o}=this.range??{startIndex:void 0,endIndex:void 0},a=this.calculateRange();(e||i!==(null==a?void 0:a.startIndex)||o!==(null==a?void 0:a.endIndex))&&(null==(n=(r=this.options).onChange)||n.call(r,this,t))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{var e;const t=this.options.getScrollElement();this.scrollElement!==t&&(this.cleanup(),this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.scrollOffset<e?"forward":"backward":null,this.scrollOffset=e;const r=this.isScrolling;this.isScrolling=t,this.notify(r!==t,t)})))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.getMeasurementOptions=BP(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey],(e,t,r,n)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:r,getItemKey:n}),{key:!1}),this.getFurthestMeasurement=(e,t)=>{const r=new Map,n=new Map;for(let i=t-1;i>=0;i--){const t=e[i];if(r.has(t.lane))continue;const o=n.get(t.lane);if(null==o||t.end>o.end?n.set(t.lane,t):t.end<o.end&&r.set(t.lane,!0),r.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurements=BP(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:r,getItemKey:n},i)=>{const o=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const a=this.measurementsCache.slice(0,o);for(let s=o;s<e;s++){const e=n(s),o=1===this.options.lanes?a[s-1]:this.getFurthestMeasurement(a,s),l=o?o.end+this.options.gap:t+r,c=i.get(e),u="number"==typeof c?c:this.options.estimateSize(s),d=l+u,h=o?o.lane:s%this.options.lanes;a[s]={index:s,start:l,size:u,end:d,key:e,lane:h}}return this.measurementsCache=a,a},{key:!1,debug:()=>this.options.debug}),this.calculateRange=BP(()=>[this.getMeasurements(),this.getSize(),this.scrollOffset],(e,t,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:r}){const n=e.length-1,i=JP(0,n,t=>e[t].start,r);let o=i;for(;o<n&&e[o].end<r+t;)o++;return{startIndex:i,endIndex:o}}({measurements:e,outerSize:t,scrollOffset:r}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=BP(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(e,t,r,n)=>null===t?[]:e({startIndex:t.startIndex,endIndex:t.endIndex,overscan:r,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,r=e.getAttribute(t);return r?parseInt(r,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this._measureElement=(e,t)=>{const r=this.measurementsCache[this.indexFromElement(e)];if(!r||!e.isConnected)return void this.measureElementCache.forEach((t,r)=>{t===e&&(this.observer.unobserve(e),this.measureElementCache.delete(r))});const n=this.measureElementCache.get(r.key);n!==e&&(n&&this.observer.unobserve(n),this.observer.observe(e),this.measureElementCache.set(r.key,e));const i=this.options.measureElement(e,t,this);this.resizeItem(r,i)},this.resizeItem=(e,t)=>{const r=t-(this.itemSizeCache.get(e.key)??e.size);0!==r&&((void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(e,r,this):e.start<this.scrollOffset+this.scrollAdjustments)&&this._scrollToOffset(this.scrollOffset,{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(e.index),this.itemSizeCache=new Map(this.itemSizeCache.set(e.key,t)),this.notify(!0,!1))},this.measureElement=e=>{e&&this._measureElement(e,void 0)},this.getVirtualItems=BP(()=>[this.getIndexes(),this.getMeasurements()],(e,t)=>{const r=[];for(let n=0,i=e.length;n<i;n++){const i=t[e[n]];r.push(i)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();return UP(t[JP(0,t.length-1,e=>UP(t[e]).start,e)])},this.getOffsetForAlignment=(e,t)=>{const r=this.getSize();"auto"===t&&(t=e<=this.scrollOffset?"start":e>=this.scrollOffset+r?"end":"start"),"start"===t||("end"===t?e-=r:"center"===t&&(e-=r/2));const n=this.options.horizontal?"scrollWidth":"scrollHeight",i=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[n]:this.scrollElement[n]:0)-this.getSize();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const r=UP(this.getMeasurements()[e]);if("auto"===t)if(r.end>=this.scrollOffset+this.getSize()-this.options.scrollPaddingEnd)t="end";else{if(!(r.start<=this.scrollOffset+this.options.scrollPaddingStart))return[this.scrollOffset,t];t="start"}const n="end"===t?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(n,t),t]},this.isDynamicMode=()=>this.measureElementCache.size>0,this.cancelScrollToIndex=()=>{null!==this.scrollToIndexTimeoutId&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(e,{align:t="start",behavior:r}={})=>{this.cancelScrollToIndex(),"smooth"===r&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:r})},this.scrollToIndex=(e,{align:t="auto",behavior:r}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),"smooth"===r&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const[n,i]=this.getOffsetForIndex(e,t);this._scrollToOffset(n,{adjustments:void 0,behavior:r}),"smooth"!==r&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.measureElementCache.has(this.options.getItemKey(e))){const[t]=this.getOffsetForIndex(e,i);((e,t)=>Math.abs(e-t)<1)(t,this.scrollOffset)||this.scrollToIndex(e,{align:i,behavior:r})}else this.scrollToIndex(e,{align:i,behavior:r})}))},this.scrollBy=(e,{behavior:t}={})=>{this.cancelScrollToIndex(),"smooth"===t&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.scrollOffset+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let r;return r=0===t.length?this.options.paddingStart:1===this.options.lanes?(null==(e=t[t.length-1])?void 0:e.end)??0:Math.max(...t.slice(-this.options.lanes).map(e=>e.end)),r-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(e,{adjustments:t,behavior:r})=>{this.options.scrollToFn(e,{behavior:r,adjustments:t},this)},this.measure=()=>{var e,t;this.itemSizeCache=new Map,null==(t=(e=this.options).onChange)||t.call(e,this,!1)},this.setOptions(e),this.scrollRect=this.options.initialRect,this.scrollOffset="function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}),this.notify(!1,!1)}}const JP=(e,t,r,n)=>{for(;e<=t;){const i=(e+t)/2|0,o=r(i);if(o<n)e=i+1;else{if(!(o>n))return i;t=i-1}}return e>0?e-1:0};const QP=typeof document<"u"?n.useLayoutEffect:n.useEffect;function eM(e){return function(e){const t=n.useReducer(()=>({}),{})[1],r={...e,onChange:(r,n)=>{var i;n?Ee(t):t(),null==(i=e.onChange)||i.call(e,r,n)}},[i]=n.useState(()=>new ZP(r));return i.setOptions(r),n.useEffect(()=>i._didMount(),[]),QP(()=>i._willUpdate()),i}({observeElementRect:$P,observeElementOffset:YP,scrollToFn:KP,...e})}function tM(){const e=Cm(e=>{var t;return null==(t=e.config.ui)?void 0:t.activeTheme});return Cm(t=>{var r;return((null==(r=t.config.ui)?void 0:r.themes)||[]).find(t=>t.name===e)})}function rM({category:t}){const r=tM(),n=t.name,i=t.list?t.list:Array.from(Array(t.items).keys()),o=u(null),s=eM({horizontal:!0,count:i.length,getScrollElement:()=>o.current,estimateSize:c(()=>52,[]),overscan:5});return a(()=>{s.scrollToIndex(0)},[n]),e(y,{children:e("div",{ref:o,className:"tiny-scrollbar overflow-x-auto overflow-y-hidden",style:{height:"52px"},children:e("div",{className:"h-full relative mx-auto",style:{width:`${s.getTotalSize()}px`},children:s.getVirtualItems().map(n=>{const o=`${i[n.index]}`;return e("div",{className:"absolute top-0 left-0 h-full",style:{width:`${n.size}px`,transform:`translateX(${n.start}px)`},children:e(B_,{variant:"outline",radius:"rounded-xl",size:"md",equalWidth:!0,onClick:async()=>{await Sm().shape.addSticker(t.name,o),_m().setDirty(!0)},children:e("img",{className:af("m-auto m-auto w-28 h-28",t.invertPreview&&(null==r?void 0:r.isDark)&&"invert"),src:ZC(t,o),alt:o})})},n.index)})})})})}function nM(){const r=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.stickers)?void 0:r.items})||[],[n,i]=o(r[0]),a=r.map(t=>{const r=n===t,i=Jh[t.name];return e(B_,{size:"xs",color:r?"primary":null,value:t,children:e("span",{className:"capitalize",children:i?e(lk,{...i}):t.name})},t.name)});return t("div",{className:"h-92",children:[e("div",{className:"mb-10 w-full hide-scrollbar overflow-x-auto overflow-y-hidden flex",children:e(iE,{value:n,onChange:e=>i(e),variant:"outline",radius:"rounded-full",className:"mx-auto",children:a})}),n&&e(rM,{category:n})]})}function iM(){const r=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.frame)?void 0:r.items})||[],n=Cm(e=>e.frame.active);a(()=>{_m().frame.active&&_m().frame.showOptionsPanel()},[]);const i=r.map(r=>{const i=EC(`images/frames/${r.name}/thumbnail.png`),o=(null==n?void 0:n.name)===r.name;return e(hP,{children:t("button",{type:"button",className:"border-2 overflow-hidden relative rounded border cursor-pointer "+(o?"border-primary":""),onClick:()=>{_m().setDirty(!0),o?Sm().frame.remove():Sm().frame.add(r.name)},children:[o&&e(oM,{}),e("img",{draggable:"false",className:"w-64 h-64",src:i,alt:r.name})]})},r.name)});return e(dP,{children:i})}function oM(){return e("span",{className:"bg-background/70 absolute inset-0 text-primary",children:e(aP,{className:"svg-icon icon-md absolute inset-0 block m-auto"})})}function aM(){const t=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.text)?void 0:r.items});a(()=>{t&&OC(t,{prefixSrc:EC,id:"pixie-fonts"}).catch(()=>{})},[t]),a(()=>{Sm().text.selectOrAddText()&&_m().setDirty(!0)},[]);const r=(t||[]).map(t=>e(hP,{children:e(sM,{fontConfig:t})},t.family));return e(dP,{className:"pt-6",children:r})}function sM({fontConfig:t}){var r;const n=Cm(e=>e.objects.active.editableProps.fontFamily),i=af("block px-6 w-110 h-68 text-sm bg border rounded-2xl",{"border-primary":n===t.family,"text-primary":n===t.family});return e("button",{type:"button",className:i,style:{fontFamily:t.family.includes('"')?t.family:`"${t.family}"`,fontWeight:(null==(r=t.descriptors)?void 0:r.weight)||"normal"},onClick:async()=>{Sm().text.selectOrAddText(),_m().setDirty(!0),Sm().objects.setValues({fontFamily:t.family})},children:t.family})}const lM=cf(e("path",{d:"M290.7 57.4L57.4 290.7c-25 25-25 65.5 0 90.5l80 80c12 12 28.3 18.7 45.3 18.7H288h9.4H512c17.7 0 32-14.3 32-32s-14.3-32-32-32H387.9L518.6 285.3c25-25 25-65.5 0-90.5L381.3 57.4c-25-25-65.5-25-90.5 0zM297.4 416H288l-105.4 0-80-80L227.3 211.3 364.7 348.7 297.4 416z"}),"EraserFA","0 0 576 512");function cM(){return a(()=>(Sm().draw.enable(),()=>{Sm().draw.disable()}),[]),t(dP,{gap:"gap-16",children:[e(hP,{children:e(QF,{size:"sm",label:e(lk,{message:"Brush Color"}),value:Sm().draw.currentBrush.color,onChange:e=>{Sm().draw.setBrushColor(e)}})}),e(hP,{children:e(dM,{})}),e(hP,{children:e(uM,{})})]})}function uM(){const r=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.draw)?void 0:r.brushSizes})||[],[n,i]=o(Sm().draw.currentBrush.width);return e(pO,{selectionMode:"single",selectedValue:n,onSelectionChange:e=>{i(e),Sm().draw.setBrushSize(e)},size:"sm",label:e(lk,{message:"Brush Size"}),children:r.map(r=>e(G_,{value:r,children:t("div",{className:"flex items-center",children:[e("div",{className:"flex-shrink-0 mr-8 border-[3px] rounded-full",style:{width:`${r}px`,height:`${r}px`}}),r]})},r))})}function dM(){const r=Cm(e=>{var t,r;return null==(r=null==(t=e.config.tools)?void 0:t.draw)?void 0:r.brushTypes})||[],n=tM(),[i,a]=o(Sm().draw.currentBrush.type);return e(pO,{selectionMode:"single",selectedValue:i,onSelectionChange:e=>{a(e),Sm().draw.setBrushType(e)},size:"sm",label:e(lk,{message:"Brush Type"}),children:r.map(r=>e(G_,{value:r,children:t("div",{className:"flex items-center",children:["EraserBrush"===r?e(lM,{className:"mr-8"}):e("img",{className:"flex-shrink-0 mr-8 w-24 h-24",src:hM(r,null==n?void 0:n.isDark),alt:""}),e(lk,{message:r.replace(/([A-Z])/g," $1").trim()})]})},r))})}function hM(e,t=!1){return EC(`images/brushes/${t?"white":"black"}/${e.replace("Brush","").toLowerCase()}.png`)}function fM(){const{trans:t}=qF(),r=Cm(e=>e.corners.radius);return a(()=>(_m().setDirty(!0),Sm().corners.showPreview(),()=>Sm().corners.hidePreview()),[]),e("div",{className:"max-w-320 mx-auto",children:e(uO,{minValue:1,maxValue:300,label:t({message:"Radius"}),getValueLabel:e=>`${e}px`,onChange:e=>{Sm().corners.updatePreview(e),_m().corners.setRadius(e)},value:r})})}const pM={initial:{y:"130%",opacity:0},animate:{y:0,opacity:1},exit:{y:"130%",opacity:0,left:0,position:"absolute",overflowY:"hidden"},transition:{type:"tween",duration:.15}};function gM({activeTool:t}){const r=function(t){switch(t){case nf.FILTER:return e(fP,{});case nf.RESIZE:return e(wP,{});case nf.CROP:return e(PP,{});case nf.DRAW:return e(cM,{});case nf.TEXT:return e(aM,{});case nf.SHAPES:return e(jP,{});case nf.STICKERS:return e(nM,{});case nf.FRAME:return e(iM,{});case nf.CORNERS:return e(fM,{});default:return null}}(t);return e(Sx.div,{className:"relative h-full w-full text-sm bg select-none overflow-hidden",...pM,children:r})}function mM({className:t}){const r=Cm(e=>e.activeTool);return e("nav",{className:af("z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden",t),children:e(Ox,{initial:!1,children:r?e(gM,{activeTool:r},"tool-controls"):e(vM,{},"nav-items")})})}function vM(){const t=Cm(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.nav)?void 0:r.items})||[];return e(Sx.div,{className:"w-full h-full bg-inherit",...pM,children:e(dP,{children:t.map(t=>e(hP,{children:e(yM,{item:t})},t.name))})})}function yM({item:r}){const n=Tf[r.name];return t(z_,{variant:"outline",color:"paper",className:"flex-col flex-shrink-0 w-68 h-68",radius:"rounded-2xl",onClick:()=>{"string"==typeof r.action?Fm(r.action):"function"==typeof r.action&&r.action(_m().editor)},children:[e("div",{className:"mb-1",children:e(Qk,{className:"icon-md",icon:r.icon})}),e("div",{className:"mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis",children:n?e(lk,{...n}):r.name})]})}function bM(){const r=Cm(e=>e.history.items),n=Cm(e=>e.history.pointer);return t(Sx.div,{...ZA,className:"absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden",children:[t("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[e(lk,{message:"History"}),e(Jk,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{_m().togglePanel("history",!1)},children:e(fE,{})})]}),e("div",{className:"p-10",children:r.map(t=>{const o=t.id===r[n].id,a=Ef[t.name],s=a.icon&&i.createElement(a.icon,{className:"icon-sm"});return e(B_,{onClick:()=>{o||Sm().history.load(t)},variant:"outline",color:o?"primary":null,size:"sm",className:af("w-full mb-8",o&&"pointer-events-none"),justify:"justify-start",startIcon:s,children:e(lk,{...a.name})},t.id)})})]})}function wM(r){const{children:n,className:i,color:o,onDismiss:a,leftAdornment:s,rightAdornment:c,hideDismissButton:u=!1,size:d,showDivider:h,justify:f="justify-between",titleFontWeight:p="font-semibold",titleTextSize:g=("xs"===d?"text-xs":"text-sm"),closeButtonSize:m=("xs"===d?"xs":"sm"),actions:v}=r,{labelId:y,isDismissable:b,close:w}=l(WF);return t("div",{className:af(i,"flex flex-shrink-0 items-center gap-10",p,h&&"border-b",xM(r),o||"text-main",f),children:[s,e("h3",{id:y,className:af(g,"mr-auto leading-5 opacity-90"),children:n}),c,v,b&&!u&&e(Jk,{"aria-label":"Dismiss",onClick:()=>{a?a():w()},size:m,className:af("-mr-8 text-muted",c&&"sr-only"),children:e(fE,{})})]})}function xM({size:e,padding:t}){if(t)return t;switch(e){case"2xs":case"xs":return"px-14 py-4";case"sm":return"px-18 py-4";default:return"px-24 py-6"}}const CM=p((t,r)=>{const{children:n,className:i,padding:o,size:a,...s}=t;return e("div",{...s,ref:r,className:af(i,_M(t),"overflow-y-auto overflow-x-hidden overscroll-contain text-sm flex-auto"),children:n})});function _M({size:e,padding:t}){if(t)return t;switch(e){case"xs":return"p-14";case"sm":return"p-18";default:return"px-24 py-20"}}function SM(){const t=Cm(e=>e.openPanels.newImage);return e(JF,{isOpen:t,disableInitialTransition:!0,type:"modal",isDismissable:!1,children:e(AM,{})})}function AM(){const[r,n]=o("default");return t(XF,{className:"text-center max-w-max text-main",size:"auto",children:[e(wM,{padding:"px-24 pt-24 pb-12",showDivider:!1,children:e(lk,{message:"Open a photo or design to get started"})}),e(CM,{children:e("default"===r?kM:IM,{setActivePanel:n})})]})}function kM({setActivePanel:n}){return t(r,{children:[e(B_,{className:"mr-20",size:"sm",variant:"raised",color:"primary",onClick:()=>{Sm().import.uploadAndReplaceMainImage()},children:e(lk,{message:"Open Photo"})}),e(B_,{variant:"outline",size:"sm",color:"primary",onClick:()=>{n("newCanvas")},children:e(lk,{message:"Create New"})}),e(EM,{})]})}function EM(){const n=Cm(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.openImageDialog)?void 0:r.sampleImages});return null!=n&&n.length?t(r,{children:[t("div",{className:"relative py-20 text-main",children:[e("hr",{className:"absolute h-1 border-none bg-divider w-full top inset-0 m-auto"}),e("span",{className:"text-sm bg px-6 relative",children:e(lk,{message:"or use sample"})})]}),e("ul",{className:"flex items-center gap-16",children:n.map(t=>e("li",{className:"shrink-0",children:e("button",{type:"button",onClick:async()=>{"function"==typeof t.action?t.action():t.url.endsWith(".json")?(await Em(EC(t.url)),_m().togglePanel("newImage",!1)):(await Sm().import.openBackgroundImage(EC(t.url)),_m().togglePanel("newImage",!1))},children:e("img",{className:"w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md",src:EC(t.thumbnail),alt:""})})},t.url||t.thumbnail))})]}):null}function IM({setActivePanel:r}){const[n,i]=o({width:800,height:600,bgColor:"transparent"});return t("form",{onSubmit:e=>{e.preventDefault();const{width:t,height:r,bgColor:i}=n;t&&r&&(_m().setConfig({blankCanvasSize:{width:t,height:r}}),Sm().canvas.openNew(t,r,i),_m().togglePanel("newImage",!1),Sm().history.addInitial())},children:[e(Yk,{type:"number",label:e(lk,{message:"Width"}),value:n.width,min:1,required:!0,className:"mb-16",onChange:e=>{i({...n,width:e.target.valueAsNumber})}}),e(Yk,{type:"number",label:e(lk,{message:"Height"}),value:n.height,min:1,required:!0,className:"mb-16",onChange:e=>{i({...n,height:e.target.valueAsNumber})}}),e(QF,{onChange:e=>{i({...n,bgColor:e})},className:"mb-16",value:n.bgColor,label:e(lk,{message:"Background color"})}),t("div",{className:"text-right",children:[e(B_,{size:"sm",variant:"text",className:"mr-10",onClick:()=>{r("default")},children:e(lk,{message:"Cancel"})}),e(B_,{size:"sm",type:"submit",variant:"raised",color:"primary",children:e(lk,{message:"Create"})})]})]})}const TM=p((r,n)=>{const i=jk(r),{label:o,children:a,size:s,className:l,orientation:c="horizontal",disabled:u,required:d,invalid:h,errorMessage:f,description:p}=r,g=b(),y=r.name||g;return t("fieldset",{"aria-describedby":p?`${g}-description`:void 0,ref:n,className:af("text-left",l),children:[o&&e("legend",{className:i.label,children:o}),e("div",{className:af("flex",o?"mt-6":"mt-0","vertical"===c?"flex-col gap-10":"flex-row gap-16"),children:m.map(a,e=>{if(v(e))return w(e,{name:y,size:s,invalid:e.props.invalid||h||void 0,disabled:e.props.disabled||u,required:e.props.required||d})})}),p&&!f&&e("div",{className:i.description,id:`${g}-description`,children:p}),f&&e("div",{className:i.error,children:f})]})}),FM=p((r,n)=>{const{children:i,autoFocus:o,size:a,invalid:s,isFirst:l,...c}=r,u=tC(n);qk({autoFocus:o},u);const d=function(e){switch(e){case"xs":return{circle:"h-12 w-12",label:"text-xs"};case"sm":return{circle:"h-16 w-16",label:"text-sm"};case"lg":return{circle:"h-24 w-24",label:"text-lg"};default:return{circle:"h-20 w-20",label:"text-base"}}}(a);return t("label",{className:af("inline-flex gap-8 select-none items-center whitespace-nowrap align-middle",d.label,r.disabled&&"text-disabled pointer-events-none",r.invalid&&"text-danger"),children:[e("input",{type:"radio",className:af("focus-visible:ring outline-none","rounded-full transition-button border-2 appearance-none","border-text-muted disabled:border-disabled-fg checked:border-primary checked:hover:border-primary-dark","before:bg-primary disabled:before:bg-disabled-fg before:hover:bg-primary-dark","before:h-full before:w-full before:block before:rounded-full before:scale-10 before:opacity-0 before:transition before:duration-200","checked:before:scale-[.65] checked:before:opacity-100",d.circle),ref:u,...c}),i&&e("span",{children:i})]})});function OM(){const t=Cm(e=>e.openPanels.export);return e(JF,{isOpen:t,onOpenChange:e=>{e||_m().togglePanel("export",!1)},type:"modal",children:e(PM,{})})}function PM(){const[r,n]=o(()=>{var e,t,r,n,i,o;return{filename:(null==(t=null==(e=_m().config.tools)?void 0:e.export)?void 0:t.defaultName)||"image",format:(null==(n=null==(r=_m().config.tools)?void 0:r.export)?void 0:n.defaultFormat)||"jpeg",quality:(null==(o=null==(i=_m().config.tools)?void 0:i.export)?void 0:o.defaultQuality)||.8}});return e(XF,{className:"text-center max-w-max text-main",size:"auto",children:e(CM,{children:t("form",{onSubmit:e=>{e.preventDefault(),Sm().export.save(r.filename,r.format,r.quality),_m().togglePanel("export",!1)},children:[e(Yk,{required:!0,size:"sm",label:e(lk,{message:"Save As"}),value:r.filename,onChange:e=>{n({...r,filename:e.target.value})}}),t(TM,{size:"sm",className:"my-20","aria-label":"Image format",children:[e(FM,{value:"jpeg",checked:"jpeg"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"JPEG"}),e(FM,{value:"png",checked:"png"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"PNG"}),e(FM,{value:"json",checked:"json"===r.format,onChange:e=>{n({...r,format:e.target.value})},children:"JSON"})]}),e(uO,{size:"sm",minValue:.1,step:.1,maxValue:1,value:r.quality,onChange:e=>{n({...r,quality:e})},formatOptions:{style:"percent"},label:e(lk,{message:"Quality"})}),e(B_,{variant:"raised",color:"primary",type:"submit",className:"mt-20 w-full",size:"sm",children:e(lk,{message:"Save"})})]})})})}function MM(){const r=Cm(e=>e.objects.all),n=Cm(e=>e.objects.active.id);return t(Sx.div,{...ZA,className:"absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden",children:[t("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[e(lk,{message:"Objects"}),e(Jk,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{_m().togglePanel("objects",!1)},children:e(fE,{})})]}),e("div",{className:"p-8",children:r.map(t=>{const r=t.id===n,o=t.name;if(!o)return null;const a=vg[o],s=a.icon&&i.createElement(a.icon,{className:"icon-sm"});return e(B_,{onClick:()=>{r||!t.selectable||Sm().objects.select(t.id)},variant:"outline",color:r?"primary":null,size:"sm",className:af("w-full mb-8",(r||!t.selectable)&&"pointer-events-none"),justify:"justify-start",startIcon:s,children:e(lk,{...a.name})},t.id)})})]})}function RM(){const r=Cm(e=>e.openPanels.history),n=Cm(e=>e.openPanels.objects);return t("div",{className:"z-modal",children:[t(Ox,{children:[r&&e(bM,{},"historyPanel"),n&&e(MM,{},"objListPanel")]}),e(SM,{}),e(OM,{})]})}
30
+ /**
31
+ * @remix-run/router v1.16.1
32
+ *
33
+ * Copyright (c) Remix Software Inc.
34
+ *
35
+ * This source code is licensed under the MIT license found in the
36
+ * LICENSE.md file in the root directory of this source tree.
37
+ *
38
+ * @license MIT
39
+ */function LM(){return LM=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},LM.apply(this,arguments)}var NM,jM;function DM(e,t){if(!1===e||null===e||typeof e>"u")throw new Error(t)}function zM(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&"?"!==r&&(t+="?"===r.charAt(0)?r:"?"+r),n&&"#"!==n&&(t+="#"===n.charAt(0)?n:"#"+n),t}function BM(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function UM(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?r.length>1&&r.pop():"."!==e&&r.push(e)}),r.length>1?r.join("/"):"/"}function VM(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the `to."+r+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function HM(e,t){let r=function(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}(e);return t?r.map((t,r)=>r===e.length-1?t.pathname:t.pathnameBase):r.map(e=>e.pathnameBase)}function WM(e,t,r,n){let i;void 0===n&&(n=!1),"string"==typeof e?i=BM(e):(i=LM({},e),DM(!i.pathname||!i.pathname.includes("?"),VM("?","pathname","search",i)),DM(!i.pathname||!i.pathname.includes("#"),VM("#","pathname","hash",i)),DM(!i.search||!i.search.includes("#"),VM("#","search","hash",i)));let o,a=""===e||""===i.pathname,s=a?"/":i.pathname;if(null==s)o=r;else{let e=t.length-1;if(!n&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}o=e>=0?t[e]:"/"}let l=function(e,t){void 0===t&&(t="/");let{pathname:r,search:n="",hash:i=""}="string"==typeof e?BM(e):e;return{pathname:r?r.startsWith("/")?r:UM(r,t):t,search:qM(n),hash:GM(i)}}(i,o),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&r.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(NM||(NM={})),function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(jM||(jM={}));const $M=e=>e.join("/").replace(/\/\/+/g,"/"),qM=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",GM=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",YM=["post","put","patch","delete"];new Set(YM);const XM=["get",...YM];
40
+ /**
41
+ * React Router v6.23.1
42
+ *
43
+ * Copyright (c) Remix Software Inc.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE.md file in the root directory of this source tree.
47
+ *
48
+ * @license MIT
49
+ */
50
+ function KM(){return KM=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},KM.apply(this,arguments)}new Set(XM);const ZM=n.createContext(null),JM=n.createContext(null),QM=n.createContext(null),eR=n.createContext({outlet:null,matches:[],isDataRoute:!1});function tR(){return null!=n.useContext(QM)}function rR(){return tR()||DM(!1),n.useContext(QM).location}function nR(e){n.useContext(JM).static||n.useLayoutEffect(e)}function iR(){let{isDataRoute:e}=n.useContext(eR);return e?function(){let{router:e}=function(){let e=n.useContext(ZM);return e||DM(!1),e}(aR.UseNavigateStable),t=function(){let e=function(){let e=n.useContext(eR);return e||DM(!1),e}(),t=e.matches[e.matches.length-1];return t.route.id||DM(!1),t.route.id}(sR.UseNavigateStable),r=n.useRef(!1);return nR(()=>{r.current=!0}),n.useCallback(function(n,i){void 0===i&&(i={}),r.current&&("number"==typeof n?e.navigate(n):e.navigate(n,KM({fromRouteId:t},i)))},[e,t])}():function(){tR()||DM(!1);let e=n.useContext(ZM),{basename:t,future:r,navigator:i}=n.useContext(JM),{matches:o}=n.useContext(eR),{pathname:a}=rR(),s=JSON.stringify(HM(o,r.v7_relativeSplatPath)),l=n.useRef(!1);return nR(()=>{l.current=!0}),n.useCallback(function(r,n){if(void 0===n&&(n={}),!l.current)return;if("number"==typeof r)return void i.go(r);let o=WM(r,JSON.parse(s),a,"path"===n.relative);null==e&&"/"!==t&&(o.pathname="/"===o.pathname?t:$M([t,o.pathname])),(n.replace?i.replace:i.push)(o,n.state,n)},[t,i,s,a,e])}()}function oR(e,t){let{relative:r}=void 0===t?{}:t,{future:i}=n.useContext(JM),{matches:o}=n.useContext(eR),{pathname:a}=rR(),s=JSON.stringify(HM(o,i.v7_relativeSplatPath));return n.useMemo(()=>WM(e,JSON.parse(s),a,"path"===r),[e,s,a,r])}var aR=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(aR||{}),sR=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(sR||{});
51
+ /**
52
+ * React Router DOM v6.23.1
53
+ *
54
+ * Copyright (c) Remix Software Inc.
55
+ *
56
+ * This source code is licensed under the MIT license found in the
57
+ * LICENSE.md file in the root directory of this source tree.
58
+ *
59
+ * @license MIT
60
+ */
61
+ function lR(){return lR=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},lR.apply(this,arguments)}new Promise(()=>{});const cR=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch{}const uR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hR=n.forwardRef(function(e,t){let r,{onClick:i,relative:o,reloadDocument:a,replace:s,state:l,target:c,to:u,preventScrollReset:d,unstable_viewTransition:h}=e,f=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&(i[r]=e[r]);return i}(e,cR),{basename:p}=n.useContext(JM),g=!1;if("string"==typeof u&&dR.test(u)&&(r=u,uR))try{let e=new URL(window.location.href),t=u.startsWith("//")?new URL(e.protocol+u):new URL(u),r=function(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&"/"!==n?null:e.slice(r)||"/"}(t.pathname,p);t.origin===e.origin&&null!=r?u=r+t.search+t.hash:g=!0}catch{}let m=function(e,t){let{relative:r}=void 0===t?{}:t;tR()||DM(!1);let{basename:i,navigator:o}=n.useContext(JM),{hash:a,pathname:s,search:l}=oR(e,{relative:r}),c=s;return"/"!==i&&(c="/"===s?i:$M([i,s])),o.createHref({pathname:c,search:l,hash:a})}(u,{relative:o}),v=function(e,t){let{target:r,replace:i,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l}=void 0===t?{}:t,c=iR(),u=rR(),d=oR(e,{relative:s});return n.useCallback(t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,r)){t.preventDefault();let r=void 0!==i?i:zM(u)===zM(d);c(e,{replace:r,state:o,preventScrollReset:a,relative:s,unstable_viewTransition:l})}},[u,c,d,i,o,r,e,a,s,l])}(u,{replace:s,state:l,target:c,preventScrollReset:d,relative:o,unstable_viewTransition:h});return n.createElement("a",lR({},f,{href:r||m,onClick:g||a?i:function(e){i&&i(e),e.defaultPrevented||v(e)},ref:t,target:c}))});var fR,pR;!function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"}(fR||(fR={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(pR||(pR={}));const gR=cf(e("path",{d:"M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutlineOutlined"),mR=cf(e("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),vR={opacity:0,y:50,scale:.3},yR={opacity:1,y:0,scale:1},bR={opacity:0,scale:.5};function wR(){const r=Rm(e=>e.toasts);return e("div",{className:"pointer-events-none relative",children:e(Ox,{initial:!1,children:r.map(r=>e("div",{className:af("fixed z-toast mx-auto p-20","bottom-center"===r.position?"bottom-0 left-0 right-0":"bottom-0 right-0"),children:t(Sx.div,{initial:r.disableEnterAnimation?void 0:vR,animate:r.disableEnterAnimation?void 0:yR,exit:r.disableExitAnimation?void 0:bR,className:af("pointer-events-auto mx-auto flex max-h-100 min-h-50 w-min min-w-288 max-w-500 items-center gap-10 rounded-lg border bg-paper bg-paper py-6 pl-16 pr-6 text-sm text-main shadow-lg"),onPointerEnter:()=>{var e;return null==(e=r.timer)?void 0:e.pause()},onPointerLeave:()=>{var e;return null==(e=r.timer)?void 0:e.resume()},role:"alert","aria-live":"danger"===r.type?"assertive":"polite",children:["danger"===r.type&&e(gR,{className:"flex-shrink-0 text-danger",size:"md"}),"loading"===r.type&&e(dO,{size:"sm",className:"flex-shrink-0",isIndeterminate:!0}),"positive"===r.type&&e(mR,{className:"flex-shrink-0 text-positive",size:"md"}),e("div",{className:"mr-auto w-max overflow-hidden overflow-ellipsis","data-testid":"toast-message",children:e(eE,{value:r.message})}),r.action&&e(B_,{variant:"text",color:"primary",size:"sm",className:"flex-shrink-0",onFocus:()=>{var e;return null==(e=r.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=r.timer)?void 0:e.resume()},onClick:()=>Lm().remove(r.id),elementType:hR,to:r.action.action,children:e(eE,{value:r.action.label})}),"loading"!==r.type&&e(Jk,{onFocus:()=>{var e;return null==(e=r.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=r.timer)?void 0:e.resume()},type:"button",className:"flex-shrink-0",onClick:()=>{Lm().remove(r.id)},size:"sm",children:e(fE,{})})]})},r.id))})})}function xR(e){return Xx()?e.metaKey:e.ctrlKey}function CR(e){switch(e.key){case"z":xR(e)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?Sm().history.redo():Sm().history.undo());break;case"ArrowUp":e.preventDefault(),e.stopPropagation(),Sm().objects.move("up");break;case"ArrowRight":e.preventDefault(),e.stopPropagation(),Sm().objects.move("right");break;case"ArrowDown":e.preventDefault(),e.stopPropagation(),Sm().objects.move("down");break;case"ArrowLeft":e.preventDefault(),e.stopPropagation(),Sm().objects.move("left");break;case"Delete":e.preventDefault(),e.stopPropagation(),Sm().objects.delete();break;case"v":xR(e)&&(e.preventDefault(),e.stopPropagation(),async function(){try{const e=await navigator.clipboard.read();for(const t of e)for(const e of t.types)if(e.startsWith("image/")){const r=await t.getType(e),n=new FileReader;return n.onload=e=>{var t;null!=(t=e.target)&&t.result&&Sm().import.addImageFromData(e.target.result)},void n.readAsDataURL(r)}}catch(e){console.error(e)}}())}}const _R=new Map,SR=new Map,AR={};async function*kR(e){const t=e.createReader();let r;do{r=await new Promise((e,r)=>{t.readEntries(e,r)});for(const e of r)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await ER(e);yield new h_(t,e.fullPath)}else e.isDirectory&&(yield*kR(e))}while(r.length>0)}function ER(e){return new Promise((t,r)=>e.file(t,r))}function IR(e){return null!=AR.dragTargetId?_R.get(AR.dragTargetId):e.dataTransfer.types.includes("Files")?{type:"nativeFile",el:null,ref:null,getData:()=>async function(e){const t=[];for await(const r of e)t.push(r);return t}(async function*(e){const t=[];for(const r of e.items)if("file"===r.kind){const e=r.webkitGetAsEntry();e&&t.push(e)}for(const e of t)if(e.isFile){if(".DS_Store"===e.name)continue;const t=await ER(e);yield new h_(t,e.fullPath)}else e.isDirectory&&(yield*kR(e))}(e.dataTransfer))}:void 0}function TR(){const r=Cm(e=>{var t;return null==(t=e.config.ui)?void 0:t.visible})??!0,n=Cm(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.nav)?void 0:r.position})??"bottom",i=Cm(e=>{var t,r;return null==(r=null==(t=e.config.ui)?void 0:t.menubar)?void 0:r.position})??"top",o=Cm(e=>{var t;return null==(t=e.config.ui)?void 0:t.allowEditorClose})??!0,s=u(null),l=u(null),{isModal:d,isMobile:h}=pE(),f=c(async e=>{var t,r;if(_m().activeTool||_m().dirty||"nativeFile"!==e.type)return;const n=await e.getData();Sm().import.fileIsValid(n[0])&&((null==(r=null==(t=_m().config.tools)?void 0:t.import)?void 0:r.openDroppedImageAsBackground)?await Sm().import.openBackgroundImage(n[0]):await Sm().import.openUploadedFile(n[0]))},[]),{droppableProps:p}=function({id:e,disabled:t,ref:r,...n}){const i=u({dragOverElements:new Set,dropActivateTimer:void 0}).current,o=u(n);o.current=n,x(()=>(SR.set(e,{...SR.get(e),disabled:t,id:e,ref:r}),()=>{SR.delete(e)}),[e,o,t,r]);const a=e=>{var t;const n=o.current,i=n.allowDragEventsFromItself||r.current!==(null==(t=e.ref)?void 0:t.current);return!(!(null!=e&&e.type&&i&&n.types.includes(e.type))||n.acceptsDrop&&!n.acceptsDrop(e))},s=e=>{var t,r;const n=IR(e);n&&(null==(r=(t=o.current).onDragLeave)||r.call(t,n))};return{droppableProps:t?{}:{onDragOver:e=>{var t,r;e.preventDefault(),e.stopPropagation();const n=IR(e);n&&a(n)&&(null==(r=(t=o.current).onDragOver)||r.call(t,n,e))},onDragEnter:e=>{var t,r;if(e.stopPropagation(),i.dragOverElements.add(e.target),i.dragOverElements.size>1)return;const n=IR(e);n&&a(n)&&(null==(r=(t=o.current).onDragEnter)||r.call(t,n),clearTimeout(i.dropActivateTimer),"function"==typeof o.current.onDropActivate&&(i.dropActivateTimer=setTimeout(()=>{var e,t;n&&(null==(t=(e=o.current).onDropActivate)||t.call(e,n))},400)))},onDragLeave:e=>{e.stopPropagation(),i.dragOverElements.delete(e.target);for(const t of i.dragOverElements)e.currentTarget.contains(t)||i.dragOverElements.delete(t);if(i.dragOverElements.size>0)return;const t=IR(e);t&&a(t)&&(s(e),clearTimeout(i.dropActivateTimer))},onDrop:async e=>{var t,r,n,l;e.preventDefault(),e.stopPropagation(),i.dragOverElements.clear(),s(e),clearTimeout(i.dropActivateTimer);const c=IR(e);c&&(null==(r=(t=o.current).onDragLeave)||r.call(t,c),a(c)&&(null==(l=(n=o.current).onDrop)||l.call(n,c)))}}}}({id:"pixie-root",ref:l,types:["nativeFile"],onDrop:f});a(()=>{var e,t;_m().fabric||(Cm.setState({canvasRef:s}),O_(s.current),null!=(e=_m().config.ui)&&e.defaultTool&&_m().setActiveTool(null==(t=_m().config.ui)?void 0:t.defaultTool,null),Sm().canvas.loadInitialContent().then(()=>{var e,t;null==(t=(e=_m().config).onLoad)||t.call(e,_m().editor)}));const r=P_(l,()=>{_m().setStageSize(M_(l.current))}),n=P_(s,()=>{_m().setCanvasSize(M_(s.current))});return()=>{r(),n()}},[l]);const g=af("pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full",{relative:!d,"fixed inset-0 w-full h-full z-20":d,"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]":d&&!h});return t(Px,{features:Rx,strict:!0,children:[d&&r&&!h&&o&&e(Jk,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{_m().editor.close()},children:e(fE,{})}),d&&r&&e(tk,{position:"fixed",disableInitialTransition:!0}),t(Sx.div,{initial:!1,variants:{visible:{opacity:1,scale:1,display:"flex"},hidden:{opacity:0,transitionEnd:{display:"none"}}},animate:r?"visible":"hidden",className:g,children:["top"===i&&e(xE,{}),"top"===n&&e(mM,{className:"pt-14"}),t("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...qx(p,{onKeyDownCapture:CR}),ref:l,children:[e(_E,{}),e(tT,{ref:s})]}),e(oP,{}),"bottom"===n&&e(mM,{}),"bottom"===i&&e(xE,{}),e(RM,{}),e(wR,{})]})]})}!function(){fabric.Object.ENLIVEN_PROPS.push("eraser");var e=fabric.Object.prototype._drawClipPath,t=fabric.Object.prototype.needsItsOwnCache,r=fabric.Object.prototype.toObject,n=fabric.Object.prototype.getSvgCommons,i=fabric.Object.prototype._createBaseClipPathSVGMarkup,o=fabric.Object.prototype._createBaseSVGMarkup;fabric.Object.prototype.cacheProperties.push("eraser"),fabric.Object.prototype.stateProperties.push("eraser"),fabric.util.object.extend(fabric.Object.prototype,{erasable:!0,eraser:void 0,needsItsOwnCache:function(){return t.call(this)||!!this.eraser},_drawClipPath:function(t,r){if(e.call(this,t,r),this.eraser){var n=this._getNonTransformedDimensions();this.eraser.isType("eraser")&&this.eraser.set({width:n.x,height:n.y}),e.call(this,t,this.eraser)}},toObject:function(e){var t=r.call(this,["erasable"].concat(e));return this.eraser&&!this.eraser.excludeFromExport&&(t.eraser=this.eraser.toObject(e)),t},getSvgCommons:function(){return n.call(this)+(this.eraser?'mask="url(#'+this.eraser.clipPathId+')" ':"")},_createEraserSVGMarkup:function(e){return this.eraser?(this.eraser.clipPathId="MASK_"+fabric.Object.__uid++,['<mask id="',this.eraser.clipPathId,'" >',this.eraser.toSVG(e),"</mask>","\n"].join("")):""},_createBaseClipPathSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),i.call(this,e,t)].join("")},_createBaseSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),o.call(this,e,t)].join("")}});var a=fabric.Group.prototype._restoreObjectsState;fabric.util.object.extend(fabric.Group.prototype,{_addEraserPathToObjects:function(e){this._objects.forEach(function(t){fabric.EraserBrush.prototype._addPathToObjectEraser.call(fabric.EraserBrush.prototype,t,e)})},applyEraserToObjects:function(){var e=this,t=this.eraser;if(t){delete this.eraser;var r=e.calcTransformMatrix();t.clone(function(t){var n=e.clipPath;t.getObjects("path").forEach(function(t){var i=fabric.util.multiplyTransformMatrices(r,t.calcTransformMatrix());fabric.util.applyTransformToObject(t,i),n?n.clone(function(n){var i=fabric.EraserBrush.prototype.applyClipPathToPath.call(fabric.EraserBrush.prototype,t,n,r);e._addEraserPathToObjects(i)},["absolutePositioned","inverted"]):e._addEraserPathToObjects(t)})})}},_restoreObjectsState:function(){return!0===this.erasable&&this.applyEraserToObjects(),a.call(this)}}),fabric.Eraser=fabric.util.createClass(fabric.Group,{type:"eraser",originX:"center",originY:"center",drawObject:function(e){e.save(),e.fillStyle="black",e.fillRect(-this.width/2,-this.height/2,this.width,this.height),e.restore(),this.callSuper("drawObject",e)},_getBounds:function(){},_toSVG:function(e){var t=["<g ","COMMON_PARTS"," >\n"],r=["<rect ",'fill="white" ','x="',-this.width/2,'" y="',-this.height/2,'" width="',this.width,'" height="',this.height,'" />\n'].join("");t.push("\t\t",r);for(var n=0,i=this._objects.length;n<i;n++)t.push("\t\t",this._objects[n].toSVG(e));return t.push("</g>\n"),t}}),fabric.Eraser.fromObject=function(e,t){var r=e.objects;fabric.util.enlivenObjects(r,function(r){var n=fabric.util.object.clone(e,!0);delete n.objects,fabric.util.enlivenObjectEnlivables(e,n,function(){t&&t(new fabric.Eraser(r,n,!0))})})};var s=fabric.Canvas.prototype._renderOverlay;fabric.util.object.extend(fabric.Canvas.prototype,{isErasing:function(){return this.isDrawingMode&&this.freeDrawingBrush&&"eraser"===this.freeDrawingBrush.type&&this.freeDrawingBrush._isErasing},_renderOverlay:function(e){s.call(this,e),this.isErasing()&&!this.freeDrawingBrush.inverted&&this.freeDrawingBrush._render()}}),fabric.EraserBrush=fabric.util.createClass(fabric.PencilBrush,{type:"eraser",inverted:!1,_isErasing:!1,_isErasable:function(e){return!1!==e.erasable},_prepareCollectionTraversal:function(e,t,r){e.forEachObject(function(n){n.forEachObject&&"deep"===n.erasable?this._prepareCollectionTraversal(n,t,r):!this.inverted&&n.erasable&&n.visible?(n.visible=!1,e.dirty=!0,r.visibility.push(n),r.collection.push(e)):this.inverted&&n.visible&&(n.erasable&&n.eraser?(n.eraser.inverted=!0,n.dirty=!0,e.dirty=!0,r.eraser.push(n),r.collection.push(e)):(n.visible=!1,e.dirty=!0,r.visibility.push(n),r.collection.push(e)))},this)},preparePattern:function(){this._patternCanvas||(this._patternCanvas=fabric.util.createCanvasElement());var e=this._patternCanvas;e.width=this.canvas.width,e.height=this.canvas.height;var t=e.getContext("2d");if(this.canvas._isRetinaScaling()){var r=this.canvas.getRetinaScaling();this.canvas.__initRetinaScaling(r,e,t)}var n=this.canvas.backgroundImage,i=n&&this._isErasable(n),o=this.canvas.overlayImage,a=o&&this._isErasable(o);if(!this.inverted&&(n&&!i||this.canvas.backgroundColor))i&&(this.canvas.backgroundImage=void 0),this.canvas._renderBackground(t),i&&(this.canvas.backgroundImage=n);else if(this.inverted&&n&&i){var l=this.canvas.backgroundColor;this.canvas.backgroundColor=void 0,this.canvas._renderBackground(t),this.canvas.backgroundColor=l}t.save(),t.transform.apply(t,this.canvas.viewportTransform);var c={visibility:[],eraser:[],collection:[]};if(this._prepareCollectionTraversal(this.canvas,t,c),this.canvas._renderObjects(t,this.canvas._objects),c.visibility.forEach(function(e){e.visible=!0}),c.eraser.forEach(function(e){e.eraser.inverted=!1,e.dirty=!0}),c.collection.forEach(function(e){e.dirty=!0}),t.restore(),!this.inverted&&(o&&!a||this.canvas.overlayColor))a&&(this.canvas.overlayImage=void 0),s.call(this.canvas,t),a&&(this.canvas.overlayImage=o);else if(this.inverted&&o&&a){l=this.canvas.overlayColor;this.canvas.overlayColor=void 0,s.call(this.canvas,t),this.canvas.overlayColor=l}},_setBrushStyles:function(e){this.callSuper("_setBrushStyles",e),e.strokeStyle="black"},_saveAndTransform:function(e){this.callSuper("_saveAndTransform",e),this._setBrushStyles(e),e.globalCompositeOperation=e===this.canvas.getContext()?"destination-out":"source-over"},needsFullRender:function(){return!0},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this._prepareForDrawing(e),this._captureDrawingPath(e),this.preparePattern(),this._isErasing=!0,this.canvas.fire("erasing:start"),this._render())},_render:function(){var e;this.inverted||(e=this.canvas.getContext(),this.callSuper("_render",e)),e=this.canvas.contextTop,this.canvas.clearContext(e),this.callSuper("_render",e),e.save();var t=1/this.canvas.getRetinaScaling();e.scale(t,t),e.globalCompositeOperation="source-in",e.drawImage(this._patternCanvas,0,0),e.restore()},createPath:function(e){var t=this.callSuper("createPath",e);return t.globalCompositeOperation=this.inverted?"source-over":"destination-out",t.stroke=this.inverted?"white":"black",t},applyClipPathToPath:function(e,t,r){var n=fabric.util.invertTransform(e.calcTransformMatrix()),i=t.calcTransformMatrix(),o=t.absolutePositioned?n:fabric.util.multiplyTransformMatrices(n,r);return t.absolutePositioned=!1,fabric.util.applyTransformToObject(t,fabric.util.multiplyTransformMatrices(o,i)),e.clipPath=e.clipPath?fabric.util.mergeClipPaths(t,e.clipPath):t,e},clonePathWithClipPath:function(e,t,r){var n=t.calcTransformMatrix(),i=t.clipPath,o=this;e.clone(function(e){i.clone(function(t){r(o.applyClipPathToPath(e,t,n))},["absolutePositioned","inverted"])})},_addPathToObjectEraser:function(e,t){var r=this;if(e.forEachObject&&"deep"===e.erasable){var n=e._objects.filter(function(e){return e.erasable});n.length>0&&e.clipPath?this.clonePathWithClipPath(t,e,function(e){n.forEach(function(t){r._addPathToObjectEraser(t,e)})}):n.length>0&&n.forEach(function(e){r._addPathToObjectEraser(e,t)})}else{var i=e.eraser;i||(i=new fabric.Eraser,e.eraser=i),t.clone(function(t){var n=fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(e.calcTransformMatrix()),t.calcTransformMatrix());fabric.util.applyTransformToObject(t,n),i.addWithUpdate(t),e.set("dirty",!0),e.fire("erasing:end",{path:t}),e.group&&Array.isArray(r.__subTargets)&&r.__subTargets.push(e)})}},applyEraserToCanvas:function(e){var t=this.canvas,r={};return["backgroundImage","overlayImage"].forEach(function(n){var i=t[n];i&&i.erasable&&(this._addPathToObjectEraser(i,e),r[n]=i)},this),r},_finalizeAndAddPath:function(){var e=this.canvas.contextTop,t=this.canvas;e.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate)),t.clearContext(t.contextTop),this._isErasing=!1;var r=this._points&&this._points.length>1?this.convertPointsToSVGPath(this._points):null;if(!r||this._isEmptySVGPath(r))return t.fire("erasing:end"),void t.requestRenderAll();var n=this.createPath(r);n.setCoords(),t.fire("before:path:created",{path:n});var i=this.applyEraserToCanvas(n),o=this;this.__subTargets=[];var a=[];t.forEachObject(function(e){e.erasable&&e.intersectsWithObject(n,!0,!0)&&(o._addPathToObjectEraser(e,n),a.push(e))}),t.fire("erasing:end",{path:n,targets:a,subTargets:this.__subTargets,drawables:i}),delete this.__subTargets,t.requestRenderAll(),this._resetShadow(),t.fire("path:created",{path:n})}})}(),El.enableBoundaryChecking(!1);const FR=class t{constructor(t){if(ml(this,"tools",{}),ml(this,"fabric",null),t.sentryDsn&&function(e){const t={...e};Md(t,"react"),Wh(t)}({dsn:t.sentryDsn}),function(e,t){void 0===t&&(t={});var r=t.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===r&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/.pi *,.pi :after,.pi :before{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));border-style:solid;border-width:0;box-sizing:border-box}.pi :after,.pi :before{--tw-content:""}.pi hr{border-top-width:1px;color:inherit;height:0}.pi abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6{font-size:inherit;font-weight:inherit}.pi a{color:inherit;text-decoration:inherit}.pi b,.pi strong{font-weight:bolder}.pi code,.pi kbd,.pi pre,.pi samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.pi small{font-size:80%}.pi sub,.pi sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.pi sub{bottom:-.25em}.pi sup{top:-.5em}.pi table{border-collapse:collapse;border-color:inherit;text-indent:0}.pi button,.pi input,.pi optgroup,.pi select,.pi textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.pi button,.pi select{text-transform:none}.pi [type=button],.pi [type=reset],.pi [type=submit],.pi button{-webkit-appearance:button;background-color:transparent;background-image:none}.pi :-moz-focusring{outline:auto}.pi :-moz-ui-invalid{box-shadow:none}.pi progress{vertical-align:baseline}.pi ::-webkit-inner-spin-button,.pi ::-webkit-outer-spin-button{height:auto}.pi [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.pi ::-webkit-search-decoration{-webkit-appearance:none}.pi ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.pi summary{display:list-item}.pi blockquote,.pi dd,.pi dl,.pi figure,.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6,.pi hr,.pi p,.pi pre{margin:0}.pi fieldset{margin:0;padding:0}.pi legend{padding:0}.pi menu,.pi ol,.pi ul{list-style:none;margin:0;padding:0}.pi textarea{resize:vertical}.pi input::-moz-placeholder,.pi textarea::-moz-placeholder{color:#9ca3af;opacity:1}.pi input::placeholder,.pi textarea::placeholder{color:#9ca3af;opacity:1}.pi [role=button],.pi button{cursor:pointer}.pi :disabled{cursor:default}.pi audio,.pi canvas,.pi embed,.pi iframe,.pi img,.pi object,.pi svg,.pi video{display:block;vertical-align:middle}.pi img,.pi video{height:auto;max-width:100%}.pi [hidden]{display:none}.pi *,.pi :after,.pi :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi .\\!container{width:100%!important}.pi .container{width:100%}@media (min-width:640px){.pi .\\!container{max-width:640px!important}.pi .container{max-width:640px}}@media (min-width:768px){.pi .\\!container{max-width:768px!important}.pi .container{max-width:768px}}@media (min-width:1024px){.pi .\\!container{max-width:1024px!important}.pi .container{max-width:1024px}}@media (min-width:1280px){.pi .\\!container{max-width:1280px!important}.pi .container{max-width:1280px}}@media (min-width:1536px){.pi .\\!container{max-width:1536px!important}.pi .container{max-width:1536px}}.pi .sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .\\!visible{visibility:visible!important}.pi .visible{visibility:visible}.pi .invisible{visibility:hidden}.pi .collapse{visibility:collapse}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .inset-0{top:0;right:0;bottom:0;left:0}.pi .inset-x-0{left:0;right:0}.pi .-bottom-10{bottom:-10px}.pi .-bottom-20{bottom:-20px}.pi .-bottom-5{bottom:-5px}.pi .-left-5{left:-5px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-right-5{right:-5px}.pi .-top-144{top:-144px}.pi .-top-40{top:-40px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .bottom-20{bottom:20px}.pi .left-0{left:0}.pi .left-1\\/2{left:50%}.pi .left-20{left:20px}.pi .right-0{right:0}.pi .right-16{right:16px}.pi .right-2{right:2px}.pi .right-20{right:20px}.pi .right-4{right:4px}.pi .top-0{top:0}.pi .top-1\\/2{top:50%}.pi .top-2{top:2px}.pi .isolate{isolation:isolate}.pi .z-10{z-index:10}.pi .z-20{z-index:20}.pi .z-50{z-index:50}.pi .z-cropzone{z-index:10}.pi .z-loading-indicator{z-index:50}.pi .z-modal{z-index:110}.pi .z-navbar{z-index:40}.pi .z-obj-box{z-index:20}.pi .z-popover{z-index:130}.pi .z-toast{z-index:160}.pi .z-tool-overlay{z-index:30}.pi .z-tooltip{z-index:150}.pi .z-tray{z-index:120}.pi .m-auto{margin:auto}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .my-6{margin-bottom:6px;margin-top:6px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .-ml-1{margin-left:-1px}.pi .-ml-10{margin-left:-10px}.pi .-ml-12{margin-left:-12px}.pi .-ml-3{margin-left:-3px}.pi .-ml-4{margin-left:-4px}.pi .-ml-6{margin-left:-6px}.pi .-mr-4{margin-right:-4px}.pi .-mr-8{margin-right:-8px}.pi .mb-1{margin-bottom:1px}.pi .mb-10{margin-bottom:10px}.pi .mb-16{margin-bottom:16px}.pi .mb-2{margin-bottom:2px}.pi .mb-20{margin-bottom:20px}.pi .mb-24{margin-bottom:24px}.pi .mb-4{margin-bottom:4px}.pi .mb-6{margin-bottom:6px}.pi .mb-8{margin-bottom:8px}.pi .ml-10{margin-left:10px}.pi .ml-12{margin-left:12px}.pi .ml-4{margin-left:4px}.pi .ml-6{margin-left:6px}.pi .ml-8{margin-left:8px}.pi .ml-auto{margin-left:auto}.pi .mr-10{margin-right:10px}.pi .mr-16{margin-right:16px}.pi .mr-20{margin-right:20px}.pi .mr-4{margin-right:4px}.pi .mr-5{margin-right:5px}.pi .mr-6{margin-right:6px}.pi .mr-8{margin-right:8px}.pi .mr-auto{margin-right:auto}.pi .mt-0{margin-top:0}.pi .mt-10{margin-top:10px}.pi .mt-14{margin-top:14px}.pi .mt-20{margin-top:20px}.pi .mt-24{margin-top:24px}.pi .mt-4{margin-top:4px}.pi .mt-6{margin-top:6px}.pi .box-content{box-sizing:content-box}.pi .block{display:block}.pi .inline-block{display:inline-block}.pi .inline{display:inline}.pi .flex{display:flex}.pi .inline-flex{display:inline-flex}.pi .grid{display:grid}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-1{height:1px}.pi .h-12{height:12px}.pi .h-128{height:128px}.pi .h-14{height:14px}.pi .h-16{height:16px}.pi .h-18{height:18px}.pi .h-2{height:2px}.pi .h-2\\/4{height:50%}.pi .h-20{height:20px}.pi .h-22{height:22px}.pi .h-24{height:24px}.pi .h-26{height:26px}.pi .h-28{height:28px}.pi .h-3{height:3px}.pi .h-30{height:30px}.pi .h-32{height:32px}.pi .h-36{height:36px}.pi .h-38{height:2.375rem}.pi .h-4{height:4px}.pi .h-40{height:40px}.pi .h-42{height:42px}.pi .h-48{height:48px}.pi .h-50{height:50px}.pi .h-56{height:56px}.pi .h-6{height:6px}.pi .h-60{height:60px}.pi .h-64{height:64px}.pi .h-68{height:68px}.pi .h-8{height:8px}.pi .h-80{height:80px}.pi .h-84{height:84px}.pi .h-92{height:92px}.pi .h-\\[54px\\]{height:54px}.pi .h-font{height:1em}.pi .h-full{height:100%}.pi .h-px{height:1px}.pi .h-screen{height:100dvh}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-full{max-height:100%}.pi .max-h-inherit{max-height:inherit}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-24{min-height:24px}.pi .min-h-30{min-height:30px}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-50{min-height:50px}.pi .min-h-60{min-height:60px}.pi .min-h-86{min-height:86px}.pi .\\!w-auto{width:auto!important}.pi .w-1\\/2{width:50%}.pi .w-110{width:110px}.pi .w-12{width:12px}.pi .w-1280{width:80rem}.pi .w-14{width:14px}.pi .w-144{width:144px}.pi .w-16{width:16px}.pi .w-18{width:18px}.pi .w-2{width:2px}.pi .w-20{width:20px}.pi .w-22{width:22px}.pi .w-224{width:224px}.pi .w-24{width:24px}.pi .w-256{width:256px}.pi .w-26{width:26px}.pi .w-28{width:28px}.pi .w-280{width:17.5rem}.pi .w-30{width:30px}.pi .w-32{width:32px}.pi .w-320{width:320px}.pi .w-36{width:36px}.pi .w-38{width:2.375rem}.pi .w-384{width:384px}.pi .w-40{width:40px}.pi .w-42{width:42px}.pi .w-440{width:27.5rem}.pi .w-46{width:2.875rem}.pi .w-50{width:50px}.pi .w-56{width:56px}.pi .w-60{width:60px}.pi .w-620{width:38.75rem}.pi .w-64{width:64px}.pi .w-68{width:68px}.pi .w-780{width:48.75rem}.pi .w-8{width:8px}.pi .w-80{width:80px}.pi .w-850{width:53.125rem}.pi .w-96{width:96px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-auto{width:auto}.pi .w-font{width:1em}.pi .w-full{width:100%}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-px{width:1px}.pi .w-screen{width:100vw}.pi .min-w-0{min-width:0}.pi .min-w-128{min-width:128px}.pi .min-w-180{min-width:11.25rem}.pi .min-w-192{min-width:192px}.pi .min-w-288{min-width:288px}.pi .min-w-30{min-width:30px}.pi .min-w-4{min-width:4px}.pi .min-w-42{min-width:42px}.pi .min-w-92{min-width:92px}.pi .min-w-min{min-width:-moz-min-content;min-width:min-content}.pi .max-w-112{max-width:112px}.pi .max-w-240{max-width:240px}.pi .max-w-288{max-width:288px}.pi .max-w-320{max-width:320px}.pi .max-w-375{max-width:375px}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-full{max-width:100%}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .flex-\\[1_1_60px\\]{flex:1 1 60px}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .origin-\\[0_55\\%\\]{transform-origin:0 55%}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-x-1\\/2{--tw-translate-x:-50%}.pi .-translate-x-1\\/2,.pi .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .-translate-y-1\\/2{--tw-translate-y:-50%}.pi .rotate-0{--tw-rotate:0deg}.pi .rotate-0,.pi .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-180{--tw-rotate:180deg}.pi .rotate-45{--tw-rotate:45deg}.pi .rotate-45,.pi .rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-90{--tw-rotate:90deg}.pi .scale-y-\\[0\\.6\\]{--tw-scale-y:.6}.pi .scale-y-\\[0\\.6\\],.pi .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-not-allowed{cursor:not-allowed}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-pointer{cursor:pointer}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .grid-cols-5-min-content{grid-template-columns:repeat(5,min-content)}.pi .flex-row{flex-direction:row}.pi .flex-col{flex-direction:column}.pi .flex-col-reverse{flex-direction:column-reverse}.pi .flex-wrap{flex-wrap:wrap}.pi .flex-nowrap{flex-wrap:nowrap}.pi .items-start{align-items:flex-start}.pi .items-end{align-items:flex-end}.pi .items-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-10{gap:10px}.pi .gap-14{gap:14px}.pi .gap-16{gap:16px}.pi .gap-18{gap:18px}.pi .gap-20{gap:20px}.pi .gap-36{gap:36px}.pi .gap-4{gap:4px}.pi .gap-40{gap:40px}.pi .gap-6{gap:6px}.pi .gap-8{gap:8px}.pi .space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(10px*var(--tw-space-y-reverse));margin-top:calc(10px*(1 - var(--tw-space-y-reverse)))}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-x-auto{overflow-x:auto}.pi .overflow-y-auto{overflow-y:auto}.pi .overflow-x-hidden{overflow-x:hidden}.pi .overflow-y-hidden{overflow-y:hidden}.pi .overscroll-contain{overscroll-behavior:contain}.pi .truncate{overflow:hidden;white-space:nowrap}.pi .overflow-ellipsis,.pi .text-ellipsis,.pi .truncate{text-overflow:ellipsis}.pi .whitespace-normal{white-space:normal}.pi .whitespace-nowrap{white-space:nowrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-2xl{border-radius:16px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-button{border-radius:var(--be-button-radius,.25rem)}.pi .rounded-full{border-radius:9999px}.pi .rounded-input{border-radius:var(--be-input-radius,.25rem)}.pi .rounded-lg{border-radius:8px}.pi .rounded-md{border-radius:6px}.pi .rounded-none{border-radius:0}.pi .rounded-panel{border-radius:var(--be-panel-radius,.25rem)}.pi .rounded-xl{border-radius:12px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-l-input{border-bottom-left-radius:var(--be-input-radius,.25rem);border-top-left-radius:var(--be-input-radius,.25rem)}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-r-input{border-bottom-right-radius:var(--be-input-radius,.25rem);border-top-right-radius:var(--be-input-radius,.25rem)}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-bl-none{border-bottom-left-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-tr-none{border-top-right-radius:0}.pi .border{border-width:1px}.pi .border-2{border-width:2px}.pi .border-4{border-width:4px}.pi .border-\\[3px\\]{border-width:3px}.pi .border-y{border-top-width:1px}.pi .border-b,.pi .border-y{border-bottom-width:1px}.pi .border-b-4{border-bottom-width:4px}.pi .border-l{border-left-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-r{border-right-width:1px}.pi .border-r-4{border-right-width:4px}.pi .border-t{border-top-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-bg-alt{--tw-border-opacity:1;border-color:rgb(var(--be-background-alt)/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-positive\\/50{border-color:#22c55e80}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-transparent{border-color:transparent}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-b-bg{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-b-transparent{border-bottom-color:transparent}.pi .border-r-transparent{border-right-color:transparent}.pi .bg{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-background\\/80{background-color:rgb(var(--be-background)/.8)}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-black\\/80{background-color:#000c}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-primary-dark{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/var(--tw-bg-opacity))}.pi .bg-slider-disabled\\/60{background-color:#bdbdbd99}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-white\\/50{background-color:#ffffff80}.pi .bg-opacity-95{--tw-bg-opacity:.95}.pi .bg-no-repeat{background-repeat:no-repeat}.pi .fill-current{fill:currentColor}.pi .fill-transparent{fill:transparent}.pi .stroke-current{stroke:currentColor}.pi .object-contain{-o-object-fit:contain;object-fit:contain}.pi .object-cover{-o-object-fit:cover;object-fit:cover}.pi .p-0{padding:0}.pi .p-10{padding:10px}.pi .p-14{padding:14px}.pi .p-16{padding:16px}.pi .p-18{padding:18px}.pi .p-2{padding:2px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-40{padding:40px}.pi .p-6{padding:6px}.pi .p-8{padding:8px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .px-12{padding-left:12px;padding-right:12px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .pb-10{padding-bottom:10px}.pi .pb-12{padding-bottom:12px}.pi .pb-14{padding-bottom:14px}.pi .pb-16{padding-bottom:16px}.pi .pb-18{padding-bottom:18px}.pi .pb-20{padding-bottom:20px}.pi .pb-4{padding-bottom:4px}.pi .pb-8{padding-bottom:8px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-10{padding-left:10px}.pi .pl-12{padding-left:12px}.pi .pl-14{padding-left:14px}.pi .pl-16{padding-left:16px}.pi .pl-18{padding-left:18px}.pi .pl-28{padding-left:28px}.pi .pl-46{padding-left:2.875rem}.pi .pl-54{padding-left:3.375rem}.pi .pl-8{padding-left:8px}.pi .pr-10{padding-right:10px}.pi .pr-12{padding-right:12px}.pi .pr-18{padding-right:18px}.pi .pr-24{padding-right:24px}.pi .pr-28{padding-right:28px}.pi .pr-46{padding-right:2.875rem}.pi .pr-54{padding-right:3.375rem}.pi .pr-6{padding-right:6px}.pi .pr-8{padding-right:8px}.pi .pt-10{padding-top:10px}.pi .pt-12{padding-top:12px}.pi .pt-14{padding-top:14px}.pi .pt-16{padding-top:16px}.pi .pt-20{padding-top:20px}.pi .pt-24{padding-top:24px}.pi .pt-4{padding-top:4px}.pi .pt-40{padding-top:40px}.pi .pt-6{padding-top:6px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-middle{vertical-align:middle}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-xs{font-size:12px;line-height:16px}.pi .font-bold{font-weight:700}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .uppercase{text-transform:uppercase}.pi .capitalize{text-transform:capitalize}.pi .italic{font-style:italic}.pi .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.pi .leading-5{line-height:1.25rem}.pi .leading-none{line-height:1}.pi .tracking-wide{letter-spacing:.025em}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.pi .text-black\\/30{color:#0000004d}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-link{--tw-text-opacity:1;color:rgb(var(--be-link-color,var(--be-primary))/var(--tw-text-opacity))}.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .underline{text-decoration-line:underline}.pi .no-underline{text-decoration-line:none}.pi .caret-transparent{caret-color:transparent}.pi .opacity-0{opacity:0}.pi .opacity-100{opacity:1}.pi .opacity-70{opacity:.7}.pi .opacity-80{opacity:.8}.pi .opacity-90{opacity:.9}.pi .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.pi .shadow,.pi .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.pi .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.pi .shadow-lg,.pi .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.pi .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.pi .shadow-sm,.pi .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.pi .outline-none{outline:2px solid transparent;outline-offset:2px}.pi .outline{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .ring-inset{--tw-ring-inset:inset}.pi .blur{--tw-blur:blur(8px)}.pi .blur,.pi .grayscale{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .grayscale{--tw-grayscale:grayscale(100%)}.pi .invert{--tw-invert:invert(100%)}.pi .invert,.pi .sepia{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .sepia{--tw-sepia:sepia(100%)}.pi .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.pi .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-width{transition-duration:.15s;transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-100{transition-duration:.1s}.pi .duration-200{transition-duration:.2s}.pi .will-change-transform{will-change:transform}.pi .icon-2xs{font-size:.75rem}.pi .icon-xs{font-size:1rem}.pi .icon-sm{font-size:1.25rem}.pi .icon-md{font-size:1.5rem}.pi .icon-lg{font-size:2.1875rem}.pi .icon-xl{font-size:2.6875rem}.pi .no-tap-highlight{-webkit-tap-highlight-color:transparent}@media only screen and (min-device-width:768px){.pi .tiny-scrollbar{scrollbar-color:rgba(0,0,0,.2) transparent;scrollbar-width:thin}.pi .tiny-scrollbar::-webkit-scrollbar{background-color:transparent;height:6px;width:6px}.pi .tiny-scrollbar::-webkit-scrollbar-thumb{background-color:rgb(var(--be-foreground-base)/.2);border-radius:10px}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:start{background:transparent}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:end{background:transparent}}.pi .hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;display:none;height:0;width:0}.pi .svg-icon{display:inline-block;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;fill:currentColor;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .cropzone:not(.moving) .cropzone-transition{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .first-letter\\:capitalize:first-letter{text-transform:capitalize}.pi .file\\:mr-10::file-selector-button{margin-right:10px}.pi .file\\:h-24::file-selector-button{height:24px}.pi .file\\:rounded::file-selector-button{border-radius:4px}.pi .file\\:border-none::file-selector-button{border-style:none}.pi .file\\:bg-primary::file-selector-button{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .file\\:px-10::file-selector-button{padding-left:10px;padding-right:10px}.pi .file\\:text-sm::file-selector-button{font-size:14px;line-height:20px}.pi .file\\:font-semibold::file-selector-button{font-weight:600}.pi .file\\:text-on-primary::file-selector-button{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .before\\:z-10:before{content:var(--tw-content);z-index:10}.pi .before\\:block:before{content:var(--tw-content);display:block}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before,.pi .before\\:translate-x-2:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-primary:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .before\\:opacity-0:before{content:var(--tw-content);opacity:0}.pi .before\\:transition:before{content:var(--tw-content);transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:transition-transform:before{content:var(--tw-content);transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:duration-200:before{content:var(--tw-content);transition-duration:.2s}.pi .after\\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.pi .after\\:absolute:after{content:var(--tw-content);position:absolute}.pi .after\\:inset-0:after{content:var(--tw-content);top:0;right:0;bottom:0;left:0}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-14:checked:before{--tw-translate-x:14px}.pi .checked\\:before\\:translate-x-14:checked:before,.pi .checked\\:before\\:translate-x-20:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-24:checked:before,.pi .checked\\:before\\:translate-x-30:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before,.pi .checked\\:before\\:translate-x-36:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{content:var(--tw-content);--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .checked\\:before\\:opacity-100:checked:before{content:var(--tw-content);opacity:1}.pi .focus-within\\:border-primary\\/60:focus-within{border-color:rgb(var(--be-primary)/.6)}.pi .focus-within\\:ring:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-within\\:ring-primary\\/focus:focus-within{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .hover\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-paper\\/90:hover{border-color:rgb(var(--be-paper)/.9)}.pi .hover\\:border-positive:hover{--tw-border-opacity:1;border-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-primary-dark:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-positive\\/4:hover{background-color:#22c55e0a}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .hover\\:bg-white\\/20:hover{background-color:#fff3}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .before\\:hover\\:bg-primary-dark:hover:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:after\\:bg-black\\/5:hover:after{background-color:#0000000d;content:var(--tw-content)}.pi .checked\\:hover\\:border-primary-dark:hover:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .focus\\:border-danger\\/60:focus{border-color:#ef444499}.pi .focus\\:border-primary\\/60:focus{border-color:rgb(var(--be-primary)/.6)}.pi .focus\\:bg-primary:focus{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .focus\\:text-on-primary:focus{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.pi .focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-danger\\/focus:focus{--tw-ring-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .focus\\:ring-primary\\/focus:focus{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus\\:after\\:bg-black\\/10:focus:after{background-color:#0000001a;content:var(--tw-content)}.pi .focus-visible\\:bg-primary\\/focus:focus-visible{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.pi .focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.pi .disabled\\:pointer-events-none:disabled{pointer-events:none}.pi .disabled\\:cursor-default:disabled{cursor:default}.pi .disabled\\:border-disabled-bg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-transparent:disabled{border-color:transparent}.pi .disabled\\:border-white\\/70:disabled{border-color:#ffffffb3}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:text-white\\/70:disabled{color:#ffffffb3}.pi .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .disabled\\:before\\:bg-disabled-fg:disabled:before{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity));content:var(--tw-content)}.pi :is(.dark .dark\\:bg-chip){--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi :is(.dark .dark\\:text-white\\/50){color:#ffffff80}.pi :is(.dark .dark\\:checked\\:border-primary-dark:checked){--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi :is(.dark .dark\\:checked\\:bg-primary-dark:checked){--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}@media (min-width:640px){.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:text-lg{font-size:18px;line-height:28px}}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-2:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-inset:focus-visible>.tree-label{--tw-ring-inset:inset}\n'),!t.selector)throw new Error('Pixie required "selector" option.');const r=document.querySelector(t.selector);r&&(r.classList.add("pi"),function(e){gm=e,mm=e}(r),this.setConfig(t),Cm.setState({editor:this}),_(r).render(e(i.StrictMode,{children:e(TR,{})})))}get state(){return _m()}get defaultConfig(){return t.defaultConfig}open(e={}){return new Promise(async t=>{var r;Object.keys(e).length?await this.resetEditor({...og(e,{ui:{visible:!0},image:e.image||_m().config.image,state:e.state||_m().config.state,blankCanvasSize:e.blankCanvasSize||_m().config.blankCanvasSize})}):null!=(r=_m().config.ui)&&r.visible||_m().setConfig({ui:{visible:!0}}),t()})}close(){var e,t,r;null!=(e=_m().config.ui)&&e.visible&&(this.setConfig({ui:{visible:!1}}),null==(r=(t=_m().config).onClose)||r.call(t))}setConfig(e){_m().setConfig(e)}uploadAndAddImage(){return Sm().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return Sm().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return Sm().import.uploadAndOpenStateFile()}newCanvas(e,t,r){return Sm().canvas.openNew(e,t,r)}getState(e){return JSON.stringify(Tm(e))}setState(e){return Sm().import.loadState(e)}async setStateFromUrl(e){const t=await Em(e);return Sm().import.loadState(t)}openTool(e){Fm(e)}applyChanges(){_m().applyChanges()}cancelChanges(){_m().cancelChanges()}async resetEditor(e){await km(e),await Sm().canvas.loadInitialContent()}togglePanel(e,t){"objects"===e&&_m().togglePanel("history",!1),"history"===e&&_m().togglePanel("objects",!1),_m().togglePanel(e,t)}on(e,t){var r;null==(r=this.fabric)||r.on(e,t)}isDirty(){return _m().dirty}get(e){return this.tools[e]}notify(e){return Nm(e)}static init(e){return new Promise(t=>{const r=e.onLoad;e.onLoad=e=>{null==r||r(e),t(e)},new this(e)})}};ml(FR,"defaultConfig",Pf),ml(FR,"version",Of);let OR=FR;function PR(e){if(!this.backgroundColor)return;const t=this._getNonTransformedDimensions(),r=-t.x/2,n=-t.y/2,i=t.x,o=t.y,a=this.backgroundColor;if("string"==typeof a||a instanceof CanvasGradient||a instanceof CanvasPattern)e.fillStyle=a,e.fillRect(r,n,i,o);else if("object"!=typeof a||!("type"in a)||"linear"!==a.type&&"radial"!==a.type){if("source"in a&&(a.source instanceof HTMLImageElement||a.source instanceof HTMLCanvasElement))if(a.repeat){const t=e.createPattern(a.source,a.repeat);t&&(e.fillStyle=t,e.fillRect(r,n,i,o))}else e.drawImage(a.source,r,n,i,o)}else{const t=function(e,t,r,n){var i,o;if("linear"===t.type){const i=e.createLinearGradient(r+t.coords.x1,n+t.coords.y1,r+t.coords.x2,n+t.coords.y2);return t.colorStops.forEach(e=>i.addColorStop(e.offset,e.color)),i}if("radial"===t.type){const a=e.createRadialGradient(r+t.coords.x1,n+t.coords.y1,null!==(i=t.coords.r1)&&void 0!==i?i:0,r+t.coords.x2,n+t.coords.y2,null!==(o=t.coords.r2)&&void 0!==o?o:0);return t.colorStops.forEach(e=>a.addColorStop(e.offset,e.color)),a}throw new Error("Unknown gradient type")}(e,a,r,n);e.fillStyle=t,e.fillRect(r,n,i,o)}this._removeShadow(e)}const MR="fm-pixie-editor";const RR=new class{constructor(){this._container=document.createElement("div"),this._instance=null,this._container.classList.add(MR),this._container.style.width="100%",this._container.style.height="85vh",this._container.style.minHeight="400px"}get className(){return`.${MR}`}get canvas(){var e,t;return null===(t=null===(e=this._instance)||void 0===e?void 0:e.state.canvasRef)||void 0===t?void 0:t.current}get tools(){var e;return null===(e=this._instance)||void 0===e?void 0:e.tools}isLoaded(){return!!this._instance}async _setConfig(e){var t;this._instance?await this._instance.resetEditor(e):this._instance=await OR.init(Object.assign(Object.assign({},e),{selector:this.className})),(t=this._instance).fabric?t.fabric.on("object:added",e=>{const t=e.target;t&&"text"===t.name&&(t._renderBackground=PR)}):console.warn("Pixie fabric instance is not available")}async show(e,t,r=t.firstChild){t.insertBefore(this._container,r),await this._setConfig(e),this._instance.open()}close(){var e;null===(e=this._container.parentNode)||void 0===e||e.removeChild(this._container)}};function LR(e,t){if(!e)return t;if(!t)return e;return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}function NR(e,t){if(/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t))return t;const r=function(e){const t="undefined"!=typeof __webpack_public_path__?__webpack_public_path__:"";if(e&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(e))return e;let r=LR(t,e||"");return!r||r.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(r)||(r="/"+r),r}(e),n=LR(r,t);return!n||n.startsWith("/")||/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(n)?n:"/"+n}var jR,DR;!function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(jR||(jR={})),function(e){e.TOP="top",e.BOTTOM="bottom",e.HIDDEN=""}(DR||(DR={}));const zR=(e,t="image/png")=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function BR(e){return new Promise((t,r)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>{var e;return r(null!==(e=n.error)&&void 0!==e?e:new Error("Failed to convert blob to data URL"))},n.readAsDataURL(e)})}const UR=({visible:r,onClose:n,file:o,onSave:a,onSaveCopy:s})=>{var l;const{t:c}=Gn(),u=i.useRef(null),d=Fo(),h=Za(),{options:f,actions:p}=fo(),{i18n:g}=Gn(),{config:m}=f,{setCurrentMenuFile:v}=p,{getFileData:y,resolveFileForEditByUrl:b}=h,[w,x]=i.useState(!1),[C,_]=i.useState(null),[S,A]=i.useState(""),[k,E]=i.useState(!1),[I,T]=i.useState(!1),[F,O]=i.useState(null),P=i.useRef(!1),R=i.useRef(),L=i.useRef(),N=i.useRef("saveCopy"),j=i.useRef(void 0);R.current=a,L.current=s,i.useEffect(()=>{o&&!P.current&&(async()=>{if(j.current!==o)if("object"!=typeof o){j.current=o,x(!0);try{if(o.startsWith("data:"))O({thumbnail:o,saveWithoutFolder:!0});else{const e=await b(o);j.current===o&&O(e)}}catch(e){console.error("Failed to load file for editor:",e),j.current===o&&(j.current=null),null==n||n()}finally{x(!1)}}else O(o)})()},[o,n,b]);const D=i.useCallback(async e=>{try{if("string"==typeof e.thumbnail&&e.thumbnail.startsWith("data:"))return e.thumbnail;const t=await y(e.id,!0);if(!t)throw new Error(c("Error loading image"));return new Promise(e=>{const r=new FileReader;r.onload=()=>e(r.result),r.readAsDataURL(t)})}catch(e){throw console.error("Error getting the image data:",e),e}},[y,c]);i.useEffect(()=>{if(!C&&r&&F){let e=!1;const t=async()=>{var t,r,i;x(!0);try{const t=await D(F);if(!t||"string"!=typeof t||""===t.trim())throw new Error("Invalid image data: empty or null");if(!t.startsWith("data:"))throw new Error("Invalid image data: not a valid data URL");const r=t.match(/^data:([^;]+);base64,(.+)$/);if(!r)throw new Error("Invalid image data: malformed data URL format");const[,n,i]=r;if(!n.startsWith("image/"))throw new Error(`Invalid image data: unsupported MIME type ${n}`);if(i.length<10)throw new Error("Invalid image data: base64 content too short");if(!/^[A-Za-z0-9+/]+=*$/.test(i))throw new Error("Invalid image data: corrupted base64 content");if(!e){_(t);const e=Ta(F,"image/png");A(e.mimeType)}}catch(o){e||(d.error({id:"IMAGE_DOWNLOAD_FAILED",innerException:o,message:c("Error loading image"),placement:"bottomRight",data:{itemId:null!==(t=null==F?void 0:F.id)&&void 0!==t?t:void 0,itemName:null!==(r=null==F?void 0:F.name)&&void 0!==r?r:void 0,folderId:null!==(i=null==F?void 0:F.folderId)&&void 0!==i?i:null,thumbnail:null==F?void 0:F.thumbnail}}),null==n||n())}finally{x(!1)}};return t(),()=>{e=!0}}},[F,D,C,n,c,r]);const z=i.useCallback(async(e,t,r)=>{var n;let i=await function(e,t){if("json"===e)return new Blob([t],{type:"application/json"});if("svg"===e)return new Blob([t],{type:"image/svg+xml"});let r=`image/${e}`;if(t.startsWith("data:")){const e=Sr(t);e&&e.startsWith("image/")&&(r=e);const n=t.replace(/data:image\/[^;]+;base64,/,"");return zR(n,_r(r))}return zR(t,_r(r))}(r,e),o=_r(i.type||`image/${r}`);const a=null!==(n=null==m?void 0:m.compessorUrl)&&void 0!==n?n:null==m?void 0:m.compressorUrl;if(o.startsWith("image/"))try{const e=new File([i],t,{type:o}),r=await Ba(e,{maxSizeMB:null==m?void 0:m.compressMaxSize,maxWidthOrHeight:null==m?void 0:m.compressMaxWidthOrHeight,mimeType:o,fileName:t,libURL:a,enableCompression:Boolean(m)&&"image/gif"!==o});i=r,o=r.type}catch(e){console.warn("Image preparation failed, using original:",e)}return{blob:i,mimeType:o,thumbnailDataUrl:await BR(i)}},[m]),B=i.useCallback(async(e,t,r,n)=>{var i,o,a,s,l,u;const h="save"===n?R.current:L.current;if(!F||!h)return;const f="object"==typeof F&&null!==F?F:null;let p=null;try{x(!0);const{blob:o,mimeType:a,thumbnailDataUrl:s}=await z(e,t,r),l=Object.assign(Object.assign({},F),{thumbnail:s,size:o.size,date:(new Date).toISOString().split("T")[0],type:a,folderId:F.folderId||"",name:F.name||t,extension:F.extension||(null===(i=(F.name||t).split(".").pop())||void 0===i?void 0:i.toLowerCase())||""});p=l;const u={blob:o,mimeType:a,thumbnail:s,mode:n},d=await h(l,u);if(d)return x(!1),d;throw new Error(c("saveCopy"===n?"Failed to save image copy":"Failed to save changes"))}catch(e){console.error("Error saving:",e);const r=null!=p?p:f,i=e;if(!(null==i?void 0:i.notificationShown)){const i=Lo(e),h=null!==(a=null!==(o=Mo(null==i?void 0:i.code,c))&&void 0!==o?o:null==i?void 0:i.message)&&void 0!==a?a:c("saveCopy"===n?"Failed to save image copy":"Error saving image");d.error({id:"saveCopy"===n?"IMAGE_SAVE_COPY_FAILED":"IMAGE_SAVE_FAILED",message:h,placement:"bottomRight",data:{itemId:null!==(s=null==r?void 0:r.id)&&void 0!==s?s:void 0,itemName:null!==(l=null==r?void 0:r.name)&&void 0!==l?l:t,folderId:null!==(u=null==r?void 0:r.folderId)&&void 0!==u?u:null,thumbnail:null==r?void 0:r.thumbnail},innerException:e})}x(!1)}},[F,d,z,c]),U=i.useCallback(async e=>{var t;if(!RR.isLoaded()||!F)return void console.error("❌ Pixie instance or file is missing");N.current=e;const r=F.name||"edited-image",n=Ta(F,S);try{await(null===(t=RR.tools)||void 0===t?void 0:t.export.save(r.replace(/\.[^/.]+$/,""),n.pixieFormat,Fa.QUALITY))}catch(t){console.error("🎨 Error saving through the button:",t);try{const t=RR.canvas,i=t?t.toDataURL(n.mimeType):null;i&&await B(i,r,n.extension,e)}catch(e){console.error("🎨 Alternative method also did not work:",e)}}},[F,S,B]),V=i.useCallback(async()=>{var t;if(C&&r&&k&&!P.current)try{P.current=!0;const r=u.current;let i=0;for(;i<20&&(0===r.clientWidth||0===r.clientHeight);)await new Promise(e=>setTimeout(e,50)),i++;const o=(null==m?void 0:m.locale)?null==m?void 0:m.locale.replace("_","-"):"en",a=matchMedia(cr).matches?sr:ar,s=(null==m?void 0:m.theme)===lr?a:null==m?void 0:m.theme,l=((null==m?void 0:m.locale)||g.language||"en").split("-")[0].split("_")[0],c=(g.getResourceBundle(l,"translation")||{}).pixie||{},d=e=>e.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "),h={};Object.entries(c).forEach(([e,t])=>{const r=d(e);h[r]=t,h[e]=t});const f={[o]:h},p=Ta(F,S),v={selector:"#pixie-editor",baseUrl:NR((null==m?void 0:m.baseUrl)||"",(null==m?void 0:m.assetsUrl)||"assets/image-editor"),image:C,activeLanguage:o,languages:f,ui:{activeTheme:s,mode:"inline",forceOverlayModeOnMobile:!1,visible:!0,menubar:{replaceDefaultItems:!0,position:jR.TOP,items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",align:"right",desktopOnly:!0,icon:()=>e(ye,{style:{fontSize:20}}),action:e=>{e.togglePanel("history")}},{type:"button",icon:()=>e(me,{style:{fontSize:20}}),align:"right",desktopOnly:!0,action:n}]},nav:{position:DR.TOP}},tools:{export:{defaultFormat:p.pixieFormat,defaultQuality:Fa.QUALITY,defaultName:(null===(t=null==F?void 0:F.name)||void 0===t?void 0:t.replace(/\.[^/.]+$/,""))||"image"},text:{replaceDefaultItems:!0,defaultText:"Handwriting",items:[{family:"Inter",src:"fonts/inter-v20-cyrillic_latin-regular.woff2"},{family:"Commissioner",src:"fonts/commissioner-v24-cyrillic_latin-regular.woff2"},{family:"Montserrat Light",src:"fonts/Montserrat-Light.woff2"},{family:"Montserrat Regular",src:"fonts/Montserrat-Regular.woff2"},{family:"Montserrat Bold",src:"fonts/Montserrat-Bold.woff2"},{family:"Montserrat Black",src:"fonts/Montserrat-Black.woff2"},{family:"Roboto Light",src:"fonts/Roboto-Light.woff2"},{family:"Roboto Regular",src:"fonts/Roboto-Regular.woff2"},{family:"Roboto Bold",src:"fonts/Roboto-Bold.woff2"},{family:"Roboto Black",src:"fonts/Roboto-Black.woff2"},{family:"Lato Light",src:"fonts/Lato-Light.woff2"},{family:"Lato Regular",src:"fonts/Lato-Regular.woff2"},{family:"Lato Bold",src:"fonts/Lato-Bold.woff2"},{family:"Lato Black",src:"fonts/Lato-Black.woff2"},{family:"Rubik Light",src:"fonts/Rubik-Light.woff2"},{family:"Rubik Regular",src:"fonts/Rubik-Regular.woff2"},{family:"Rubik Bold",src:"fonts/Rubik-Bold.woff2"},{family:"Rubik Black",src:"fonts/Rubik-Black.woff2"},{family:"Bebas Neue Light",src:"fonts/BebasNeueLight.woff2"},{family:"Bebas Neue Regular",src:"fonts/BebasNeueRegular.woff2"},{family:"Bebas Neue Book",src:"fonts/BebasNeueBook.woff2"},{family:"Bebas Neue Bold",src:"fonts/BebasNeueBold.woff2"},{family:"Fira Sans",src:"fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2"},{family:"Lobster",src:"fonts/Lobster.woff2"},{family:"Pacifico",src:"fonts/pacifico-v23-cyrillic_latin-regular.woff2"},{family:"Playfair Display",src:"fonts/playfair-display-v40-cyrillic_latin-regular.woff2"},{family:"Oswald",src:"fonts/oswald-v57-cyrillic_latin-regular.woff2"},{family:"Caveat",src:"fonts/caveat-v23-cyrillic_latin-regular.woff2"}]}},onSave:async function(e,t,r){try{x(!0);return await B(e,t,r,N.current)}catch(e){throw console.error("🎨 PIXIE onSave ERROR:",e),x(!1),e}}};try{T(!1),await RR.show(v,u.current);const e=RR.canvas;e&&e.focus(),T(!0),x(!1)}catch(e){console.error("init pixie failed:",e)}}catch(e){console.error("Error initializing Pixie:",e),d.error({id:"EDITOR_INIT_FAILED",message:c("Error initializing editor"),placement:"bottomRight",innerException:e}),P.current=!1,null==n||n()}},[F,S,C,r,k,null==m?void 0:m.locale,null==m?void 0:m.theme,null==m?void 0:m.baseUrl,null==m?void 0:m.assetsUrl,n,B,d,g,c]);i.useEffect(()=>{r&&C&&k&&V()},[r,C,k,V]),i.useEffect(()=>{if(!r){try{RR.close()}catch(e){console.warn("Error closing Pixie:",e)}x(!1),_(null),A(""),P.current=!1,E(!1),T(!1)}return()=>{try{RR.close()}catch(e){console.warn("Error closing Pixie when unmounting:",e)}}},[r]);const H=Boolean(null==F?void 0:F.id)&&!1!==(null===(l=null==m?void 0:m.features)||void 0===l?void 0:l.enableUpdateFile);return e(q,{title:(null==F?void 0:F.name)?c("Editing: {{name}}",{name:F.name}):c("Editing image"),open:r,closeIcon:null,onCancel:n,afterOpenChange:e=>E(e),forceRender:!0,width:"100vw",style:{top:0,height:"100vh",maxWidth:"none",padding:10},styles:{body:{height:"85vh",padding:0}},footer:[e(M,{onClick:n,disabled:!k||w,children:c("Cancel")},"cancel"),e(M,{type:"primary",onClick:()=>U("saveCopy"),loading:w,children:c("Save as copy and choose")},"save-copy"),...H?[e(M,{type:"primary",onClick:()=>U("save"),loading:w,children:c("Save and choose")},"save")]:[]],maskClosable:!1,destroyOnHidden:!1,afterClose:()=>{v&&v("")},children:t("div",{ref:u,style:{position:"relative",width:"100%",height:"100%"},children:[r&&!I?e("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.45)",backdropFilter:"blur(1px)",pointerEvents:"all",zIndex:10},children:e("span",{style:{fontSize:14,color:"#555"},children:c("Loading editor...")})}):null,w&&I&&e(sl,{style:{position:"absolute",top:0,background:"var(--colorBgLayout)",zIndex:100,opacity:.7}})]})})};var VR="uploadProgress",HR="uploadProgress__card",WR="uploadProgress__header",$R="uploadProgress__header-title",qR="uploadProgress__header-buttons",GR="uploadProgress__header-button",YR="uploadProgress__close-icon",XR="uploadProgress__body",KR="uploadProgress__common-error",ZR="uploadProgress__common-error-row",JR="uploadProgress__common-error-hint",QR="uploadProgress__list-wrapper",eL="uploadProgress__status-icon",tL="uploadProgress__file-item",rL="uploadProgress__file-item--error",nL="uploadProgress__body--error",iL="uploadProgress__error-item",oL="uploadProgress__error-message",aL="uploadProgress__error-hint",sL="uploadProgress__file-avatar",lL="uploadProgress__file-info",cL="uploadProgress__file-name",uL="uploadProgress__file-size",dL="uploadProgress__progress-bar",hL="uploadProgress__minimized",fL="uploadProgress__minimized-button",pL="uploadProgress__file-list";const{Text:gL}=F,mL=({visible:r,files:n,totalFiles:i,completedFiles:o,onClose:a,onMinimize:s,onInsert:l,minimized:c=!1})=>{var u;const{token:d}=A.useToken(),{t:h}=Gn();if(!r)return null;const f=t=>{switch(t){case"success":return e("div",{className:eL,children:e(xe,{style:{color:d.colorSuccess}})});case"error":return e(be,{style:{color:d.colorError}});default:return e(we,{style:{color:"#1890ff"}})}},p=t=>"success"===t.status?[e(M,{type:"primary",size:"small",onClick:()=>l(t),children:h("Insert")},"insert")]:[];if(c)return e("div",{className:hL,children:e(M,{type:"primary",size:"small",onClick:s,className:fL,children:h("Upload progress",{completed:o,total:i})})});const g=n.filter(e=>"uploading"===e.status).length,m=n.filter(e=>"success"===e.status).length,v=n.filter(e=>"error"===e.status).length,y=n.filter(e=>"error"===e.status),b=y.length>1&&y.every(e=>{var t;return e.error&&e.error===(null===(t=y[0])||void 0===t?void 0:t.error)}),w=b?null===(u=y[0])||void 0===u?void 0:u.error:null;return e("div",{className:VR+" fm-upload-progress",children:t("div",{className:HR,children:[t("div",{className:WR,children:[e(gL,{strong:!0,className:$R,children:g>0?h("Uploading files",{completed:o,total:i}):m>0?h("Uploaded files",{success:m,total:i}):h("Upload error files",{errorCount:v})}),e("div",{className:qR,children:e(M,{type:"text",size:"small",icon:e(me,{className:YR}),onClick:a,className:GR})})]}),t("div",{className:`${XR} ${n.some(e=>"error"===e.status)?nL:""}`,children:[e("div",{className:QR,children:e(K,{className:pL,size:"small",dataSource:n,renderItem:r=>{const n="error"===r.status,i=n?(e=>{if(!e)return null;const t=e.toLowerCase();return t.includes("type")||t.includes("format")||t.includes("формат")||t.includes("тип")||t.includes("not allowed")||t.includes("дозволен")||t.includes("name")||t.includes("invalid")||t.includes("назва")||t.includes("неприпустим")||t.includes("allowed characters")?null:t.includes("large")||t.includes("size")||t.includes("розмір")||t.includes("размер")?h("upload_error_hint_size"):t.includes("exists")||t.includes("вже існує")||t.includes("уже существует")?h("upload_error_hint_exists"):null})(r.error):null;return e(K.Item,{className:`${tL} ${n?rL:""}`,actions:p(r),children:e(K.Item.Meta,{avatar:e(Z,{size:"small",icon:f(r.status),className:sL}),title:t("div",{className:lL,children:[e(gL,{ellipsis:!0,className:cL,children:r.name}),e(gL,{type:"secondary",className:uL,children:void 0!==r.size?ci(r.size):""})]}),description:"uploading"===r.status?e(G,{percent:r.progress,size:"small",status:"active",showInfo:!1,className:dL}):n?b?null:t("div",{className:iL,children:[e(gL,{type:"danger",className:oL,children:r.error||h("Error")}),i&&e(gL,{type:"secondary",className:aL,children:i})]}):null})})}})}),w&&t("div",{className:KR,children:[t("div",{className:ZR,children:[e(be,{style:{color:d.colorError,marginRight:8,flexShrink:0}}),e(gL,{type:"danger",children:w})]}),e(gL,{type:"secondary",className:JR,children:h("Applies to all {{count}} files",{count:y.length})})]})]})]})})},{Header:vL}=J,{Title:yL}=F,bL=({activeLibraryItem:r,selectedFolder:i,isTrashFolder:o,onClearTrash:a,files:s,loading:l,onRefresh:c,refreshDisabled:u,showRefresh:d=!1})=>{const{t:h}=Gn(),f=r===Qt&&(null!=o?o:i===or),[p,g]=n.useState(!1),m={[Qt]:h("My files"),[er]:h("GIF"),[tr]:h("Stock images"),[rr]:h("Icons"),[nr]:h("AI image generation")};let v;return n.useEffect(()=>{const e=setTimeout(()=>{g(f&&s.length>0&&!l)},200);return()=>clearTimeout(e)},[f,s.length,l]),v=r===Qt?f?h("Trash"):i:m[r],e(vL,{className:"actions-header",children:t("div",{className:"header-title-container",children:[e(yL,{level:5,className:"header-title",children:v}),p&&a&&e(M,{type:"default",onClick:a,className:"clear-trash-button","aria-label":h("Clear Trash"),children:h("Clear")}),r===Qt&&d&&c&&e(P,{title:h("Refresh"),children:e(M,{type:"text",className:"folder-refresh-button",icon:e(Ei,{size:16}),onClick:c,disabled:u})})]})})};function wL(e,t){return!e||!t||e<=0||t<=0?1:e/t}const xL=1200;function CL({items:e,getId:t,getPreviewSrc:r,getAltText:n,getWidth:i,getHeight:a,layoutMode:s="masonry",minColumnWidth:l=240,estimatedItemHeight:c=240,gap:u=20,overscanPx:h=800,prefetchThresholdPx:f=1200,resolveColumnCount:p,virtualizationThreshold:g=40}){var m,v;const[y,b]=o({scrollTop:0,viewportHeight:800,viewportWidth:xL,scrollHeight:0}),w=d(()=>function(e){return{getId:e,buildSignature:(t,r)=>{var n,i;const o=r.getPreviewSrc(t)||"",a=r.getAltText(t),s=null===(n=r.getWidth)||void 0===n?void 0:n.call(r,t),l=null===(i=r.getHeight)||void 0===i?void 0:i.call(r,t);return[e(t),o,a,null!=s?s:"",null!=l?l:""].join("::")},buildRowModel:(e,t,r)=>{var n,i;const o=null===(n=t.getWidth)||void 0===n?void 0:n.call(t,e),a=null===(i=t.getHeight)||void 0===i?void 0:i.call(t,e);return{id:r.id,signature:r.signature,item:e,previewSrc:t.getPreviewSrc(e),altText:t.getAltText(e),width:o,height:a,aspectRatio:wL(o,a)}}}}(t),[t]),x=d(()=>({getPreviewSrc:r,getAltText:n,getWidth:i,getHeight:a}),[n,a,r,i]),C=d(()=>{const e=Math.max(1,y.viewportWidth||xL);return p?Math.max(1,p(e)):Math.max(1,Math.floor((e+u)/(l+u)))},[u,l,p,y.viewportWidth]),_=d(()=>{const e=Math.max(1,y.viewportWidth||xL);return Math.max(1,(e-u*Math.max(0,C-1))/C)},[C,u,y.viewportWidth]),S=d(()=>{const t=new Array(C).fill(0),r=[];e:for(let n=0;n<e.length;n+=1){const o=e[n],l=null==i?void 0:i(o),d=null==a?void 0:a(o),h=l&&d&&l>0&&d>0?l/d:void 0,f=h?_/h:c;if("grid"===s){const e=Math.floor(n/C)*(f+u),t=n%C*(_+u);r.push({index:n,top:e,left:t,width:_,height:f,bottom:e+f});continue e}let p=0;for(let e=1;e<t.length;e+=1)t[e]<t[p]&&(p=e);const g=t[p],m=p*(_+u);t[p]=g+f+u,r.push({index:n,top:g,left:m,width:_,height:f,bottom:g+f})}const n=0===r.length?0:"grid"===s?Math.max(...r.map(e=>e.bottom)):Math.max(0,...t.map(e=>e-u));return{positionedItems:r,containerHeight:n}},[C,_,c,u,a,i,e,s]),A=d(()=>e.length<=g?{renderStrategy:"full"}:{renderStrategy:"positioned",positioned:{layout:S.positionedItems,viewportTop:y.scrollTop,viewportBottom:y.scrollTop+y.viewportHeight,overscanPx:h,containerHeight:S.containerHeight}},[e.length,S.containerHeight,S.positionedItems,h,y.scrollTop,y.viewportHeight,g]),{rowModels:k,renderWindow:E}=Ws({items:e,context:x,adapter:w,options:A}),I=null!==(m=E.positionedItems)&&void 0!==m?m:k.map((e,t)=>{var r;return{row:e,layout:null!==(r=S.positionedItems[t])&&void 0!==r?r:{index:t,top:0,left:0,width:_,height:c,bottom:c}}}),T=null!==(v=E.containerHeight)&&void 0!==v?v:S.containerHeight,F=T>0&&y.scrollTop+y.viewportHeight>=T-f;return{rowModels:k,renderRows:E.rows,renderWindow:E,positionedItems:I,containerHeight:T,isNearEnd:F,viewportMetrics:y,handleViewportChange:e=>{b(t=>t.scrollTop===e.scrollTop&&t.viewportHeight===e.viewportHeight&&t.viewportWidth===e.viewportWidth&&t.scrollHeight===e.scrollHeight?t:e)}}}const _L=t=>{var r,{imageId:n,sourceUrl:i,shouldLoad:s=!0,loader:l,onLoad:c}=t,d=Fs(t,["imageId","sourceUrl","shouldLoad","loader","onLoad"]);const[h,f]=o(()=>l.getSnapshot(n,i)),p=u(null);return a(()=>(f(l.getSnapshot(n,i)),l.subscribe(n,i,f)),[n,l,i]),a(()=>(l.setActive(n,i,s),()=>{l.setActive(n,i,!1),l.release(n)}),[n,l,s,i]),h.shouldLoad?e("img",Object.assign({},d,{ref:p,src:i,loading:null!==(r=d.loading)&&void 0!==r?r:"lazy",onLoad:e=>{l.markLoaded(n),null==c||c(e)},onError:e=>{var t;l.markError(n),null===(t=d.onError)||void 0===t||t.call(d,e)}})):null};var SL={gifTab:"gifTab",scrollableDiv:"scrollableDiv",gifSearchInput:"gifSearchInput",search:"search",searchResults:"searchResults",virtualCanvas:"virtualCanvas",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",searchOutputWrapper:"searchOutputWrapper",divider:"divider",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const AL=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=700?1:t<=1100?2:t<=1600?3:4},kL=e=>e.images.downsized.url,EL=({setImageGifList:n,imageGifList:i=[],currentReqGif:s,setCurrentReqGif:l,inputRef:d,customRequest:h})=>{const{t:f}=Gn(),{GifPlayIcon:p}=go(),{options:g}=fo(),{config:m}=g,v=fs({maxConcurrent:6}),[y,b]=o(null),[w,x]=o(new Set),[C,_]=o(!1),[A,k]=o(!1),[E,F]=o(!1),[O]=I.useForm(),P=u(s),M=u(null),R=u(null),L=u(null),N=u(0),j=u(0),D=u(new Set);a(()=>{P.current=s},[s]),a(()=>{O.setFieldsValue({keywords:s.keywords})},[]);const z=null==m?void 0:m.handleProxyUrl,B=async e=>z?Promise.resolve(z(e)):e,U=async e=>Promise.all(e.map(async e=>Object.assign(Object.assign({},e),{images:Object.assign(Object.assign({},e.images),{downsized:Object.assign(Object.assign({},e.images.downsized),{url:await B(e.images.downsized.url)}),fixed_width:e.images.fixed_width?Object.assign(Object.assign({},e.images.fixed_width),{url:await B(e.images.fixed_width.url)}):void 0,fixed_width_downsampled:e.images.fixed_width_downsampled?Object.assign(Object.assign({},e.images.fixed_width_downsampled),{url:await B(e.images.fixed_width_downsampled.url)}):void 0})}))),V=async function({query:e,page:t}){var r;const n=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{const e=`https://api.giphy.com/v1/gifs/search?api_key=${null!==(r=null==m?void 0:m.REACT_APP_GIPHY_KEY)&&void 0!==r?r:"Nh77eBlPeMn1ed9MBAvL542NUGeNO26F"}&q=${encodeURIComponent(n)}&limit=50&offset=${t}&lang=en`,i=await fetch(await B(e));return{data:await i.json()}}catch(e){console.warn(e)}},{positionedItems:H,containerHeight:W,isNearEnd:$,viewportMetrics:q,handleViewportChange:G}=CL({items:i,getId:e=>e.id,getPreviewSrc:kL,getAltText:e=>e.title,getWidth:e=>e.images.downsized.width?Number(e.images.downsized.width):void 0,getHeight:e=>e.images.downsized.height?Number(e.images.downsized.height):void 0,layoutMode:"masonry",minColumnWidth:240,estimatedItemHeight:220,prefetchThresholdPx:320,resolveColumnCount:AL}),Y=Cs(G,[i.length]),X=()=>{M.current&&(clearTimeout(M.current),M.current=null)},K=e=>!D.current.has(e)&&(D.current.add(e),!0),Z=e=>{D.current.delete(e)},J=c(async()=>{var e,t,r;const i=null===(e=P.current.keywords)||void 0===e?void 0:e.trim();if(!i||C||A||!E)return;const o=`gif:${i}:${j.current}`;if(!K(o))return;const a=N.current;k(!0);try{const e=await V({query:P.current,page:j.current});if(a!==N.current)return;const i=null!==(r=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data)&&void 0!==r?r:[];if(!Array.isArray(i)||0===i.length)return void F(!1);const o=await U(i);if(a!==N.current)return;n(e=>{const t=new Set(e.map(e=>e.id)),r=o.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),j.current+=i.length,F(50===i.length)}finally{Z(o),a===N.current&&k(!1)}},[E,C,A,n]),Q=async()=>{var e,t;X();const r=null===(e=P.current.keywords)||void 0===e?void 0:e.trim();if(!r)return R.current=null,L.current=null,N.current+=1,j.current=0,n([]),x(new Set),F(!1),void k(!1);if(L.current===r)return;if(R.current===r||C&&R.current===r)return;const i=`gif:${r}:0`;if(!K(i))return;const o=N.current+1;N.current=o,R.current=r,j.current=0,n([]),x(new Set),F(!1),k(!1),_(!0);try{const e=await V({query:P.current,page:0});if(o!==N.current)return;const i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data;if(Array.isArray(i)&&i.length>0){const e=await U(i);if(o!==N.current)return;n(e),j.current=i.length,F(50===i.length)}else n([]),F(!1);L.current=r}catch(e){F(!1)}finally{Z(i),R.current===r&&(R.current=null),_(!1)}};return a(()=>()=>{X()},[]),a(()=>{!C&&!A&&E&&i.length>0&&$&&J()},[E,i.length,$,J,C,A]),e("div",{className:SL.gifTab,children:e("div",{className:SL.searchOutputWrapper,children:t("div",{id:"scrollableDiv",ref:Y,className:SL.scrollableDiv,children:[t(I,{form:O,onValuesChange:e=>{if(void 0!==e.keywords){const t=Object.assign(Object.assign({},P.current),{keywords:e.keywords});l(t),P.current=t,X(),M.current=setTimeout(Q,800)}},className:i.length>0?SL.searchResults:SL.search,children:[e(I.Item,{name:"keywords",className:SL.gifSearchInput,children:e(T,{onPressEnter:()=>{Q()},allowClear:!0,placeholder:f("Search GIFs"),ref:d,spellCheck:"false",prefix:e(Ti,{size:16,strokeWidth:null==m?void 0:m.iconStrokeWidth,onClick:()=>{Q()}})})}),i.length>0&&!C&&e("div",{className:`ant-divider ${SL.divider}`,role:"separator"})]}),!i.length&&!C&&e(r,{children:s.keywords?e(wo,{}):t("div",{className:SL.resultsContainer,children:[e("div",{className:SL.videoIcon,children:e(p,{className:SL.playButton})}),e("h1",{className:SL.title,children:f("Over 350,000 live images")}),e("p",{className:SL.subtitle,children:f("Enter a search query and we'll find the perfect image for you")})]})}),!i.length&&C&&e(sl,{}),i.length>0&&t(r,{children:[e("div",{className:SL.virtualCanvas,style:{height:W},children:H.map(({row:r,layout:n})=>{const i=r.item,o=w.has(i.id),a=kL(i),s=n.bottom>=q.scrollTop-240&&n.top<=q.scrollTop+q.viewportHeight+240;return t("div",{className:`${SL.listItem} ${o?SL.loaded:""}`,onClick:()=>(async(e,t)=>{var r;b(t),setTimeout(()=>{b(null)},2e3);let n=e.split("?")[0].split("#")[0].split("/"),i=n[n.length-1]||"uploaded-file";i.includes(".")&&(null===(r=i.split(".").pop())||void 0===r?void 0:r.length)&&i.split(".").pop().length<=5||(i+=".gif"),h(e,i)})(i.images.downsized.url,i.id,i.title),style:{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height,minHeight:n.height,maxHeight:"none",marginBottom:0},children:[e(_L,{imageId:i.id,sourceUrl:a,shouldLoad:s,loader:v,className:y===i.id?SL.loadedImage:"",width:"100%",height:"100%",alt:i.title,decoding:"async",onLoad:()=>{x(e=>{if(e.has(i.id))return e;const t=new Set(e);return t.add(i.id),t})}}),e("a",{rel:"noreferrer",href:"https://giphy.com/",target:"_blank",onClick:e=>e.stopPropagation()}),y===i.id&&e(S,{className:SL.antSpin})]},i.id)})}),A&&e(sl,{})]})]})})})};var IL={stockTab:"stockTab",stockSearchInput:"stockSearchInput",searchOutputWrapper:"searchOutputWrapper",divider:"divider",search:"search",searchResults:"searchResults",virtualCanvas:"virtualCanvas",scrollableDiv:"scrollableDiv",listItem:"listItem",loaded:"loaded",loadedImage:"loadedImage",creatorInfo:"creatorInfo",stockColorFilter:"stockColorFilter",allColors:"allColors",blackColor:"blackColor",bwColor:"bwColor",whiteColor:"whiteColor",orangeColor:"orangeColor",redColor:"redColor",purpleColor:"purpleColor",magentaColor:"magentaColor",greenColor:"greenColor",tealColor:"tealColor",blueColor:"blueColor",resultsContainer:"resultsContainer",playButton:"playButton",title:"title",subtitle:"subtitle"};const TL=e=>{const t="undefined"!=typeof window?window.innerWidth:e;return t<=650?1:t<=1e3?2:t<=1450?3:4},FL=(e,t)=>{const r=new URL(e);return r.searchParams.set("w",t.toString()),r.toString()},OL=({imageStockList:n,setImageStockList:i,currentReq:s,setCurrentReq:l,inputRef:d,customRequest:h})=>{var f,p;const{t:g}=Gn(),{StockBigIcon:m,MixedViewIcon:v,LandscapeViewIcon:y,PortraitViewIcon:b,SquareViewIcon:w}=go(),{options:x}=fo(),{config:C}=x,_=fs({maxConcurrent:6}),[A,k]=o(!1),[E,F]=o(!1),[O,M]=o(!1),[R,L]=o(null),[N,j]=o(new Set),[D]=I.useForm(),B=null==C?void 0:C.handleProxyUrl,V=null!==(f=null==C?void 0:C.UNSPLASH_KEY)&&void 0!==f?f:"HX2_qqq3F3ljmtYtfmb9P6h0dn2u9mnnOl36IdV8el0",H=(null===(p=null==C?void 0:C.locale)||void 0===p?void 0:p.slice(0,2))||"ru",W=u(s),$=u(null),q=u(null),G=u(0),Y=u(1),X=u(new Set),K=async e=>B?Promise.resolve(B(e)):e,Z=()=>{$.current&&(clearTimeout($.current),$.current=null)},J=e=>!X.current.has(e)&&(X.current.add(e),!0),ee=e=>{X.current.delete(e)},te=async e=>Promise.all(e.map(async e=>Object.assign(Object.assign({},e),{urls:{raw:await K(FL(e.urls.raw,1200)),small:await K(FL(e.urls.raw,540))}})));a(()=>{W.current=s},[s]),a(()=>{0===n.length&&D.setFieldsValue({color:"",orientation:""})},[n,D]),a(()=>{D.setFieldsValue({keywords:s.keywords,color:s.color,orientation:s.orientation})},[]);const re=async function({query:e,page:t}){const r=e.keywords.replace(/[^\w\sа-яёА-ЯЁ]|_/g,"").replace(/[\s_-]+/g," ");try{let n=`https://api.unsplash.com/search/photos?client_id=${V}&lang=${H}&per_page=30&query=${encodeURIComponent(r)}&page=${t}`;""!==e.color&&(n+=`&color=${e.color}`),""!==e.orientation&&(n+=`&orientation=${e.orientation}`);const i=await fetch(await K(n));return{data:await i.json()}}catch(e){console.warn(e)}},{positionedItems:ne,containerHeight:ie,isNearEnd:oe,viewportMetrics:ae,handleViewportChange:se}=CL({items:n,getId:e=>e.id,getPreviewSrc:e=>e.urls.small,getAltText:e=>e.description||e.user.name,getWidth:e=>e.width,getHeight:e=>e.height,layoutMode:"masonry",minColumnWidth:240,estimatedItemHeight:220,prefetchThresholdPx:320,resolveColumnCount:TL}),le=Cs(se,[n.length]),ce=c(async()=>{var e,t;if(A||E||!O||!W.current.keywords.trim())return;const r=G.current,n=Y.current,o=`stock:${`${W.current.keywords.trim()}|${W.current.color}|${W.current.orientation}`}:${n}`;if(J(o)){F(!0);try{const o=await re({query:W.current,page:n});if(r!==G.current)return;const a=null!==(t=null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[];if(0===a.length)return void M(!1);const s=await te(a);if(r!==G.current)return;i(e=>{const t=new Set(e.map(e=>e.id)),r=s.filter(e=>!t.has(e.id));return r.length>0?[...e,...r]:e}),Y.current=n+1,M(30===a.length)}finally{ee(o),r===G.current&&F(!1)}}},[O,A,E,i]),ue=async()=>{var e,t;Z();const r=`${W.current.keywords.trim()}|${W.current.color}|${W.current.orientation}`;if(!W.current.keywords.trim())return void(q.current=null);if(q.current===r)return;const n=`stock:${r}:1`;if(!J(n))return;const o=G.current+1;G.current=o,k(!0),F(!1),M(!1),Y.current=1,i([]),j(new Set);try{const n=await re({query:W.current,page:1});if(o!==G.current)return;const a=null!==(t=null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.results)&&void 0!==t?t:[];if(a.length>0){const e=await te(a);if(o!==G.current)return;i(e),Y.current=2,M(30===a.length)}else M(!1);q.current=r}finally{ee(n),k(!1)}};a(()=>()=>{Z()},[]),a(()=>{!A&&!E&&O&&n.length>0&&oe&&ce()},[O,n.length,oe,ce,A,E]);const de=async(e,t,r,n)=>{var i;!async function(e){try{const t=`${e}${e.includes("?")?"&":"?"}client_id=${V}`,r=await K(t),n=await fetch(r);return{data:await n.json()}}catch(e){console.warn(e)}}(t.download_location),L(r),setTimeout(()=>L(null),2e3);const o=e.raw,a=o.split("?")[0].split("#")[0].split("/");let s=a[a.length-1]||"uploaded-file";s.includes(".")&&(null===(i=s.split(".").pop())||void 0===i?void 0:i.length)&&s.split(".").pop().length<=5||(s+=".jpg"),h(o,s)};return e("div",{className:IL.stockTab,children:e("div",{className:IL.searchOutputWrapper,children:t("div",{className:IL.scrollableDiv,id:"scrollableDiv",ref:le,children:[t(I,{form:D,initialValues:pr,onValuesChange:(e,t)=>{const r=Object.assign(Object.assign({},pr),t);l(r),W.current=r,Z(),""!==r.keywords?$.current=setTimeout(ue,800):(q.current=null,G.current+=1,Y.current=1,i([]),j(new Set),M(!1),F(!1),l(Object.assign({},pr)),W.current=pr,D.resetFields())},className:n.length>0?IL.searchResults:IL.search,children:[t(U,{gutter:24,children:[e(z,{span:n.length>0?void 0:24,children:e(I.Item,{name:"keywords",className:IL.stockSearchInput,children:e(T,{allowClear:!0,placeholder:g("Search image"),ref:d,spellCheck:"false",prefix:e(Ti,{size:16,strokeWidth:null==C?void 0:C.iconStrokeWidth})})})}),!!n.length&&t(r,{children:[e(z,{children:e(I.Item,{name:"orientation",children:t(Q.Group,{onChange:e=>l(t=>Object.assign(Object.assign({},t),{orientation:e.target.value})),children:[e(P,{title:g("All"),placement:"top",children:e(Q.Button,{value:"",children:e(v,{})})}),e(P,{title:g("Landscape"),placement:"top",children:e(Q.Button,{value:"landscape",children:e(y,{})})}),e(P,{title:g("Portrait"),placement:"top",children:e(Q.Button,{value:"portrait",children:e(b,{})})}),e(P,{title:g("Squarish"),placement:"top",children:e(Q.Button,{value:"squarish",children:e(w,{})})})]})})}),e(z,{children:e(I.Item,{name:"color",children:t(Q.Group,{className:IL.stockColorFilter,onChange:e=>l(t=>Object.assign(Object.assign({},t),{color:e.target.value})),children:[e(P,{title:g("All"),placement:"top",children:e(Q.Button,{className:IL.allColors,value:"",children:"All"})}),e(P,{title:g("Black"),placement:"top",children:e(Q.Button,{className:IL.blackColor,value:"black",children:"B"})}),e(P,{title:g("Black and White"),placement:"top",children:e(Q.Button,{className:IL.bwColor,value:"black_and_white",children:"B&W"})}),e(P,{title:g("White"),placement:"top",children:e(Q.Button,{className:IL.whiteColor,value:"white",children:"W"})}),e(P,{title:g("Orange"),placement:"top",children:e(Q.Button,{className:IL.orangeColor,value:"orange",children:"O"})}),e(P,{title:g("Red"),placement:"top",children:e(Q.Button,{className:IL.redColor,value:"red",children:"R"})}),e(P,{title:g("Purple"),placement:"top",children:e(Q.Button,{className:IL.purpleColor,value:"purple",children:"P"})}),e(P,{title:g("Magenta"),placement:"top",children:e(Q.Button,{className:IL.magentaColor,value:"magenta",children:"M"})}),e(P,{title:g("Green"),placement:"top",children:e(Q.Button,{className:IL.greenColor,value:"green",children:"G"})}),e(P,{title:g("Teal"),placement:"top",children:e(Q.Button,{className:IL.tealColor,value:"teal",children:"T"})}),e(P,{title:g("Blue"),placement:"top",children:e(Q.Button,{className:IL.blueColor,value:"blue",children:"B"})})]})})})]})]}),n.length>0&&!A&&e("div",{className:`ant-divider ${IL.divider}`,role:"separator"})]}),!n.length&&!A&&e(r,{children:s.keywords?e(wo,{}):t("div",{className:IL.resultsContainer,children:[e("div",{className:IL.videoIcon,children:e(m,{className:IL.playButton})}),e("h1",{className:IL.title,children:g("Millions of free stock images")}),e("p",{className:IL.subtitle,children:g("Enter a search query and we'll find the perfect image for you")})]})}),!n.length&&A&&e(sl,{}),n.length>0&&t(r,{children:[e("div",{className:IL.virtualCanvas,style:{height:ie},children:ne.map(({row:r,layout:n})=>{const i=r.item,o=N.has(i.id),a=n.bottom>=ae.scrollTop-240&&n.top<=ae.scrollTop+ae.viewportHeight+240;return t("div",{className:`${IL.listItem} ${o?IL.loaded:""}`,onClick:()=>de(i.urls,i.links,i.id,i.description),style:{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height,minHeight:n.height,maxHeight:"none",marginBottom:0},children:[e(_L,{imageId:i.id,sourceUrl:i.urls.small,shouldLoad:a,loader:_,className:R===i.id?IL.loadedImage:"",width:"100%",height:"100%",alt:i.description,decoding:"async",onLoad:()=>{j(e=>{if(e.has(i.id))return e;const t=new Set(e);return t.add(i.id),t})}}),t("p",{className:IL.creatorInfo,onClick:e=>e.stopPropagation(),children:[g("Photo by")," ",e("a",{target:"_blank",href:`${i.user.links.html}?utm_source=${null==C?void 0:C.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:i.user.name})," ",g("on")," ",e("a",{target:"_blank",href:`https://unsplash.com/?utm_source=${null==C?void 0:C.APP_NAME_UNSPLASH}&utm_medium=referral`,rel:"noreferrer",children:"Unsplash"})]}),R===i.id&&e(S,{className:IL.antSpin})]},i.id)})}),E&&e(sl,{})]})]})})})},PL=()=>{const{options:e}=fo(),t=e.config;return c((e,r)=>{!1!==(null==t?void 0:t.pushToGTM)&&((e,t)=>{const r=()=>{try{const t=Object.assign(Object.assign({},e),{appLabel:"blocks_app"});window.dataLayer&&"function"==typeof window.dataLayer.push&&window.dataLayer.push(t)}catch(e){console.error("Ошибка при вызове GTM:",e)}};t?setTimeout(r,t):r()})(e,r)},[null==t?void 0:t.pushToGTM])};var ML="slideshowContainer",RL="slideshowImage";const LL=({images:t,transitionDuration:r=1e3,frameHeight:n})=>{const[i,s]=o([]),[l,c]=o(n);a(()=>{const e=()=>{if("undefined"==typeof window)return void c(n);const e=window.innerHeight,t=Math.max(e-260,130);if("number"==typeof n){const e=Math.min(n,t);c(e)}else c(t)};if(e(),"undefined"!=typeof window)return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n]);const u=()=>{s(e=>e.map((t,r)=>r===e.length-1?Object.assign(Object.assign({},t),{opacity:1}):t))};return a(()=>{if(t.length>0){const e=t[t.length-1];s(t=>[...t,{src:e,opacity:0}]),setTimeout(u,1e3)}else s([])},[t]),e("div",{className:ML,style:{height:l,minHeight:130},children:i.map((t,n)=>e("img",{src:`data:image/jpeg;base64, ${t.src}`,alt:`Slide ${n+1}`,className:RL,style:{opacity:t.opacity,transition:`opacity ${r}ms linear`,display:"block"}},n))})},NL=t=>{var{className:r,style:n,color:i,text:o,bordered:a}=t,s=Fs(t,["className","style","color","text","bordered"]);const l=o||"";return e(ee,Object.assign({style:n,color:i,bordered:a,className:r},s,{children:l}))},jL=({text:r,counter:n,limits:i,wrapperStyles:o})=>{const{t:a}=Gn(),{options:s}=fo(),l=s.config,{token:c}=A.useToken(),u=+i>0,d=!u||n<+i,h=(null==l?void 0:l.billingPageUrl)||"/billing",f=n+" "+a("of")+" "+(u?i:"∞")+" "+(r||a("tests",{count:i}))+" "+a("was used",{count:n});return t("div",{className:"limits-couter-wrapper",style:o,children:[e(NL,{bordered:!1,text:f,className:"limit-counter",style:{color:d?c.colorText:"white"},color:d?c.colorFillSecondary:"rgb(255, 77, 79)"}),u&&e("div",{style:{fontSize:14,textDecoration:"underline",cursor:"pointer"},onClick:()=>window.location.assign(h),children:a("Need more?")})]})};var DL={imageAi:"imageAi",imageAiExample:"imageAiExample",imageItem:"imageItem",textAreaInputHybrid:"textAreaInputHybrid",loading:"loading",carousel:"carousel",arrow:"arrow",arrowNext:"arrowNext",arrowPrev:"arrowPrev",arrowBtn:"arrowBtn",arrowBtnNext:"arrowBtnNext",arrowBtnPrev:"arrowBtnPrev",row:"row",inputAffixWrapper:"inputAffixWrapper",textarea:"textarea",inputIcon:"inputIcon"};const zL=f(({className:t,onClick:r})=>e("div",{className:`${DL.arrow} ${DL.arrowNext} ${t||""}`,onClick:r,children:e(M,{className:`${DL.arrowBtn} ${DL.arrowBtnNext}`,size:"large",icon:e(Ce,{})})}));zL.displayName="SampleNextArrow";const BL=f(({className:t,onClick:r})=>e("div",{className:`${DL.arrow} ${DL.arrowPrev} ${t||""}`,onClick:r,children:e(M,{className:`${DL.arrowBtn} ${DL.arrowBtnPrev}`,size:"large",icon:e(_e,{})})}));BL.displayName="SamplePrevArrow";const UL=({customRequest:r,inputAiRef:n,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,setAiImageRequest:f,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v})=>{const{t:y}=Gn(),{AiIcon_2:b}=go(),w=i.useRef(null),[x,C]=o("auto"),{aiImageCounter:_,currentAiImgLimits:S,loadingDuringGeneration:A,requestStatus:k,handleGenerate:E,convertBase64ToFile:F,isShiftPressed:O,setIsShiftPressed:P,limitsInPlugin:R}=function({setFrameHeight:e,customRequest:t,aiTabRef:r,isImageUploaded:n,setIsImageUploaded:i,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p}){const{t:g}=Gn(),{options:m}=fo(),v=m.config,y=Fo(),b=PL(),{messages:w}=m.config,[x,C]=o([]),[_,S]=o(0),[A,k]=o(null),[E,I]=o(!1),[T,F]=o(g("Evaluating the task")),[O,P]=o(!1),M=u(new Set),R=u(new Set),L=u(new Set);a(()=>{C(w)},[w]),a(()=>{l.length||A||(C([]),M.current.clear(),R.current.clear(),L.current.clear(),D.current=-1)},[l,A]);const N=d(()=>v&&"function"==typeof(null==v?void 0:v.sendAIImageRequest)?null==v?void 0:v.sendAIImageRequest:()=>Promise.resolve({}),[v]),j=c(e=>{const t=`${A}-${e.progress}-${JSON.stringify(e.images||e.data)}`;if(!L.current.has(t))if(L.current.add(t),"error"!==e.status&&"Canceled"!==e.status){if(e.images){if(F(String(e.status)),100===e.progress){p(!1),h(e.images);const t=A,r=Array.isArray(e.images)?e.images:[];r.length>0&&t&&!M.current.has(t)&&(M.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:g("Images generated successfully"),placement:"bottomRight",data:{request:s,taskId:t,images:r}})),k(null),P(!1)}}else if(e.data&&(h([String(e.data)]),100===e.progress)){p(!1);const t=A,r=e.data?[String(e.data)]:[];r.length>0&&t&&!M.current.has(t)&&(M.current.add(t),y.success({id:"AI_IMAGE_GENERERATION_SUCCESS",message:g("Images generated successfully"),placement:"bottomRight",data:{request:s,taskId:t,images:r}})),k(null),P(!1)}}else p(!1),P(!1),A&&!R.current.has(A)&&(R.current.add(A),y.error({id:"AI_RESPONSE_INVALID",message:g("Something went wrong, please try again"),placement:"bottomRight",description:String(A)||void 0,data:{requestId:A,request:s,response:e},innerException:e}))},[s,h,F,g,p,A,y,P]),D=u(-1);a(()=>{if(x.length>0){const e=x.length-1;e>D.current&&(D.current=e,j(x[e]))}},[j,x]);const z=d(()=>{if(v&&"function"==typeof(null==v?void 0:v.sseQuery)){const e=null==v?void 0:v.sseQuery;return t=>e(t)}return e=>{}},[v]),B=d(()=>v&&"object"==typeof(null==v?void 0:v.handleLimitUsageEmitter)?null==v?void 0:v.handleLimitUsageEmitter:{fire:()=>{}},[v]),U=null==v?void 0:v.elementId,{projectId:V}=v,{limits:H}=(null==v?void 0:v.limits)?v:{limits:{ai_img_limit:0}},{ai_img_limit:W}=H,$=W>0&&_>=W,q=!(!(null==v?void 0:v.limits)||!v.counters)&&ur,G=c(()=>{B.fire({name:"AiImgCount",count:_+1})},[B,_]),Y=d(()=>!$&&!q,[$,q,_,W]),X=c(async()=>{F(g("Evaluating the task")),""===s||f||(p(!0),P(!0),h([]),C([]),b({event:"submit_form",action:"ai_image_generation",entity_id:U,project_id:V}),N({body:{project_id:V,request:"create-image",connection:"midjourney",message:s}}).then(e=>{var t,r,n,i,o,a,l,c,u;const{data:d,error:f}=e||{};if(f)throw f;const m=d;if(401===(null==m?void 0:m.status)||401===(null===(t=null==m?void 0:m.data)||void 0===t?void 0:t.status))throw new Error("ERROR");const v=null!==(r=null==m?void 0:m.data)&&void 0!==r?r:m;if((null==v?void 0:v._eventResult)&&Array.isArray(null===(n=v.task)||void 0===n?void 0:n.images)&&(null!==(o=null===(i=v.task.images)||void 0===i?void 0:i.length)&&void 0!==o?o:0)>0){const e=v.task.images;return h(e),p(!1),P(!1),void k(null)}const b=(null==m?void 0:m.task)||(null===(a=null==m?void 0:m.data)||void 0===a?void 0:a.task),w=null!==(c=null!==(l=null==b?void 0:b.id)&&void 0!==l?l:A)&&void 0!==c?c:void 0;200===(null==m?void 0:m.status)||200===(null===(u=null==m?void 0:m.data)||void 0===u?void 0:u.status)?((null==b?void 0:b.id)&&(F(b.message),k(b.id)),(null==m?void 0:m.message)&&y.success({id:"AI_IMAGE_GENERATION_STARTED",message:m.message,placement:"bottomRight",data:{request:s,taskId:w,response:null==m?void 0:m.data}}),z({task_id:null==b?void 0:b.id,entity_id:U})):(p(!1),P(!1),w&&!R.current.has(w)&&(R.current.add(w),y.error({id:"AI_IMAGE_GENERATION_FAILED",message:(null==m?void 0:m.message)||g("Something went wrong, please try again"),placement:"bottomRight",description:s,data:{request:s,taskId:w,response:m},innerException:m})))}).catch(e=>{p(!1),P(!1);const t=e;return((null==t?void 0:t.error)||(null==t?void 0:t.data))&&A&&!R.current.has(A)&&(R.current.add(A),null==y||y.error({id:"AI_IMAGE_GENERATION_FAILED",message:g("Something went wrong, please try again"),placement:"bottomRight",description:s,innerException:e,data:{request:s,taskId:A,response:null==t?void 0:t.data,error:Lo(null==t?void 0:t.error)}})),t}))},[s,f,p,P,h,b,U,V,N,y,z,g,A]),K=c(()=>{Y&&X()},[Y,q,S,G,X,y,g]);a(()=>{},[v,q]);const Z=c(e=>{if(n)return;const r=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!r)return;const o=r[1],a=r[2],s=atob(a),l=new Array(s.length);for(let e=0;e<s.length;e++)l[e]=s.charCodeAt(e);const c=new Uint8Array(l),u=new Blob([c],{type:`image/${o}`}),d=new File([u],"image.jpeg",{type:u.type,lastModified:Date.now()});i(!0),(async()=>{try{"function"==typeof t&&await Promise.resolve(t({file:d}))}catch(e){console.error("FM AI: customRequest error",e)}finally{i(!1)}})()},[n,i,t]);return a(()=>{(f||l.length>0)&&setTimeout(()=>{var t,n;let i=350;if(r.current){const e=null===(t=r.current)||void 0===t?void 0:t.firstChild;e&&e instanceof HTMLElement&&(i=(null===(n=r.current.getBoundingClientRect())||void 0===n?void 0:n.height)-48-e.clientHeight)}e(i)},0)},[r,l.length,f,e]),{aiImageCounter:_,setAiImageCounter:S,currentAiImgLimits:W,isFieldsDisabled:$,canGenerateImage:Y,aiImageRequest:s,imageAiList:l,setImageAiList:h,isLoadingAi:f,setIsLoadingAi:p,loadingDuringGeneration:O,setLoadingDuringGeneration:P,requestStatus:T,setRequestStatus:F,handleGenerate:K,handleLimitAiImgCount:G,convertBase64ToFile:Z,isShiftPressed:E,setIsShiftPressed:I,currentReqId:A,setCurrentReqId:k,limitsInPlugin:q}}({setFrameHeight:C,customRequest:r,aiTabRef:w,isImageUploaded:s,setIsImageUploaded:l,aiImageRequest:h,imageAiList:p,setImageAiList:g,isLoadingAi:m,setIsLoadingAi:v});a(()=>{},[s]);const[L,N]=o(!1),j=c(()=>N(!0),[]),D=c(()=>N(!1),[]),B=c(e=>f(e.target.value),[f]),V=c(e=>{"Shift"===e.key?P(!0):"Enter"!==e.key||O||(e.preventDefault(),E())},[O,E,P]),H=c(e=>{"Shift"===e.key&&P(!1)},[P]);return t("div",{className:DL.imageAi,ref:w,children:[R&&e(jL,{text:"images",counter:_,limits:S,wrapperStyles:{marginTop:-25}}),e(U,{gutter:24,className:DL.row,children:t(z,{span:24,children:[e(I.Item,{children:t("span",{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg ${DL.inputAffixWrapper}${L?" ant-input-affix-wrapper-focused":""}`,children:[e(T.TextArea,{ref:n,onKeyDown:V,onKeyUp:H,onFocus:j,onBlur:D,autoSize:!0,allowClear:!0,className:`${DL.textAreaInputHybrid} ${DL.textarea}`,placeholder:y("Generate image"),value:h,onChange:B,spellCheck:"false"}),e("span",{className:`ant-input-suffix ${DL.inputSuffix}`,children:m||A?e(ie,{className:`${DL.inputIcon} input-icon`,spin:!0}):e(b,{className:`${DL.inputIcon} input-icon`,onClick:E})})]})}),t("div",{className:DL.imageAiExample,children:[e("span",{children:y("For example:")})," ",y("A beautiful image of a sunset over a calm ocean.")]})]})}),(m||p.length>0)&&t(te,{dotPosition:"top",arrows:!0,nextArrow:e(zL,{}),prevArrow:e(BL,{}),className:DL.carousel,infinite:!1,children:[m&&!p.length&&e("div",{className:DL.loading,children:t("div",{className:"spin",children:[e(ie,{style:{fontSize:48},spin:!0}),e("p",{className:"status",children:k})]})}),p.length>0&&p.map((r,n)=>t("div",{className:DL.imageItem,children:[e(LL,{images:p,frameHeight:x}),e("div",{className:"buttons",children:p.length>0&&!m&&e(M,{onClick:()=>F(`data:image/jpeg;base64, ${r}`),loading:s,icon:e(Se,{}),children:y("Use this variant")})})]},n))]})]})},VL=e=>{(null==e?void 0:e.customTheme)&&((e={})=>{const t=document.querySelector("head");if(!t)return;const r=document.createElement("style");if(r.type="text/css",r.dataset.themeVariablesFm="true",r.setAttribute("data-file-manager","true"),Object.entries(e).length){let n="";Object.entries(e).forEach(([e,t])=>{"object"!=typeof t&&(n+=`\t--${e}: ${t};\n`)}),n=`.em-filemanager {\n${n}}`,r.appendChild(document.createTextNode(n));const i=t.querySelector('[data-theme-variables-fm="true"]');i?t.replaceChild(r,i):t.insertBefore(r,t.firstChild)}})(null==e?void 0:e.customTheme)},{Sider:HL,Content:WL}=J,$L=i.lazy(()=>import("./file-manager-IconsTab-7TU2tOCK.js")),qL={keywords:""},GL=()=>{var s,l,d;const h=Wo(),f=hs(),p=(()=>{var e,t;const{state:r,actions:n,options:i}=fo(),{selectedFolder:o,pathHistory:a,folders:s}=r,{t:l}=Gn(),{setSelectedFolder:u,setPathHistory:d}=n,h=c(()=>{var e;return`em_fm:lastFolder:${(null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.projectId)||"default"}`},[null===(e=null==i?void 0:i.config)||void 0===e?void 0:e.projectId]),f=c((e,t=new Set)=>{if(t.has(e))return console.warn(`Cycle detected in the path to the folder with id=${e}`),[];const r=(Array.isArray(s)?s:[]).find(t=>t.id===e);if(!r)return[];const n=new Set(t);return n.add(e),r.parentId?r.parentId===r.id?(console.warn(`Cycle detected: folder ${r.id} is a parent of itself`),[{id:r.id,name:r.name+" (ошибка)"}]):[...f(r.parentId,n),{id:r.id,name:r.name}]:[{id:r.id,name:r.name}]},[s]),p=c(e=>{var t;if("undefined"==typeof window)return;const r=!0===(null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder),n=h();try{if(!r)return void localStorage.removeItem(n);e?localStorage.setItem(n,e):localStorage.removeItem(n)}catch(e){}},[h,null===(t=null==i?void 0:i.config)||void 0===t?void 0:t.rememberLastFolder]),g=c(e=>{if("folders"===e){const e=[{id:"folders",name:l("Folders")}];return null==d||d(e),void(i.onPathChange&&i.onPathChange([]))}const t=(Array.isArray(s)?s:[]).find(t=>t.id===e);if(!t)return void console.warn("⚠️ Folder not found:",e);const r=f(e),n=[{id:"folders",name:l("Folders")},...r];null==d||d(n),i.onPathChange&&i.onPathChange(n.map(e=>e.name))},[s,f,d,i,l]),m=c(e=>{const t="folders"===e?null:e;t!==o&&(null==u||u(t),p(t),g(e))},[p,o,u,g]),v=c(e=>{if(-1===e)null==u||u(null),null==d||d([{id:"folders",name:l("Folders")}]),i.onPathChange&&i.onPathChange([]);else{const t=a.slice(0,e+1),r=t[t.length-1],n="folders"===r.id?void 0:r.id;null==u||u(n||null),null==d||d(t),i.onPathChange&&i.onPathChange(t.map(e=>e.name))}},[i,a,d,u,l]),y=c(e=>{if(!e.isFolder)return;null==u||u(e.id);const t={id:e.id,name:e.name};if(d){const e=[...a,t];d(e)}if(i.onPathChange){const t=[...a.map(e=>e.name),e.name];i.onPathChange(t)}},[i,a,d,u]);return{state:{selectedFolder:o,pathHistory:a},actions:{handleFolderSelect:m,handleBreadcrumbClick:v,handleItemClick:y},selectedFolder:o,pathHistory:a,handleFolderSelect:m,handleBreadcrumbClick:v,handleItemClick:y}})(),g=(()=>{const{state:e,actions:t}=fo(),{pagination:r}=e,{setPagination:n}=t,i=c((e,t)=>{const i=t||r.pageSize;null==n||n({current:e,pageSize:i,total:r.total})},[r.pageSize,r.total,n]);return{state:{pagination:r},actions:{handlePaginationChange:i}}})(),m=(()=>{const[e,t]=o([]),[r,n]=o(!1),[i,a]=o(!1),s=u(0),l=u(new Map),d=c(()=>(s.current+=1,`upload_${s.current}_${Date.now()}`),[]),h=c(e=>ci(e.size),[]),f=c((e,r)=>{const i=r.map(t=>({id:d(),folderId:e,name:t.name,size:h(t),status:"uploading",progress:0}));return t(i),n(!0),a(!1),i.map(e=>e.id)},[d,h]),p=c((e,r)=>{const i={id:d(),folderId:e,name:r,size:void 0,status:"uploading",progress:0};return t(e=>[...e,i]),n(!0),a(!1),i.id},[d]),g=c((e,r)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{progress:Math.min(100,Math.max(0,r))}):t))},[]),m=c((e,r)=>{r&&l.current.set(e,r),t(t=>t.map(t=>{if(t.id===e){const e=Object.assign(Object.assign({},t),{status:"success",progress:100});return(null==r?void 0:r.name)&&(e.name=r.name),(null==r?void 0:r.size)&&void 0===t.size&&(e.size=ci(r.size)),e}return t}))},[]),v=c((e,r)=>{t(t=>t.map(t=>t.id===e?Object.assign(Object.assign({},t),{status:"error",error:r}):t))},[]),y=c(()=>{n(!1),a(!1),setTimeout(()=>{t([]),l.current.clear()},300)},[]),b=c(()=>{a(e=>!e)},[]),w=c(e=>l.current.get(e),[]),x=e.length,C=e.filter(e=>"success"===e.status||"error"===e.status).length;return{uploadFiles:e,isUploadVisible:r,isUploadMinimized:i,totalFiles:x,completedFiles:C,startUpload:f,startUploadByUrl:p,updateProgress:g,markAsSuccess:m,markAsError:v,getUploadedFile:w,closeUpload:y,minimizeUpload:b}})(),v=Za(),{deleteItems:y}=$o(),b=Fo(),{t:w}=Gn(),{options:C,state:_,actions:A}=fo(),k=C,E=null==k?void 0:k.onChangeSelection,I=_,T=null==k?void 0:k.config,{dataProviders:F}=k,{form:O,urlForm:P,renameForm:M,moveForm:R,renameFolderForm:L,copyForm:N,isModalVisible:j,isUrlModalVisible:D,isMoveModalVisible:z,isRenameFolderModalVisible:B,isCopyModalVisible:U,isDeleteConfirmVisible:V,folderToRename:H,activeLibraryItem:W}=_,{setIsUrlModalVisible:$,setActiveLibraryItem:q}=A,{config:G}=C,{DropZoneFileIcon:Y}=go(),[K,Z]=o(!1),[Q,ee]=o(!1),[te,re]=o(!1),ne=u(0),ie=u(!1);ie.current=Q;const oe=i.useRef(null),ae=i.useRef([]),[se,le]=o(!1),[ce,ue]=o(!1),de=rs(e=>e.selectedFiles),he=rs(e=>e.clearSelection),fe=rs(e=>e.syncVisibleFiles),{folders:pe,loading:ge}=h.state,{fetchFolders:me,fetchChildFolders:ve,handleCreateFolder:ye,handleModalOk:be,handleModalCancel:we,generateMenuItems:xe}=h.actions,Ce=(e=>{var t;const{state:r,actions:n,options:i}=fo(),{t:o}=Gn(),a=Fo(),{folders:s,folderToRename:l,renameFolderForm:u,isRenameFolderModalVisible:d}=r,{setFolderToRename:h,setIsRenameFolderModalVisible:f}=n,{apiEndpoints:p,dataProviders:g,config:m}=i,v=c(e=>{null==h||h(e),null==f||f(!0);const t=null==s?void 0:s.find(t=>t.id===e);t&&u&&u.setFieldsValue({newFolderName:t.name})},[h,f,s,u]),y=c(()=>{null==f||f(!1),null==h||h(null),null==u||u.resetFields()},[f,h,u]),b=c(async()=>{var t,r;if(l&&u)try{const i=await u.validateFields();if(!(null==i?void 0:i.newFolderName))return void a.warning({id:"FOLDER_OPERATION_VALIDATION_FAILED",message:o("Folder name cannot be empty"),placement:"bottomRight",data:{folderId:l,folderName:null==i?void 0:i.newFolderName,reason:"emptyName"}});if(!1===(null===(t=null==m?void 0:m.features)||void 0===t?void 0:t.enableRenameFolder))return void a.error({id:"FOLDER_RENAME_DISABLED_BY_CONFIG",message:o("Folder rename is disabled by config"),placement:"bottomRight",data:{itemId:null!=l?l:void 0,itemName:null==i?void 0:i.newFolderName}});if(!(null==g?void 0:g.renameFolder))throw new Error(o("renameFolder is not implemented in dataProviders"));const s=await g.renameFolder(l,i.newFolderName.trim());if(!(null==s?void 0:s.id))return void a.error({id:"FOLDER_RENAME_FAILED",message:o("Unexpected response when renaming folder"),placement:"bottomRight",data:{itemId:null!=l?l:void 0,itemName:i.newFolderName,error:{message:"invalidResponse"}}});a.success({id:"FOLDER_RENAME_SUCCESS",message:o("Folder renamed"),placement:"bottomRight",data:{itemId:s.id,itemName:s.name,folderId:null!==(r=s.parentId)&&void 0!==r?r:null}}),y(),await e(),l!==s.id&&n.setSelectedFolder&&n.setSelectedFolder(s.id)}catch(e){console.error("Ошибка при переименовании папки:",e),a.error({id:"FOLDER_RENAME_FAILED",message:o("Failed to rename folder"),placement:"bottomRight",innerException:e,data:{itemId:null!=l?l:void 0,itemName:null==u?void 0:u.getFieldValue("newFolderName"),error:{message:e instanceof Error?e.message:String(e)}}})}},[l,u,p,y,e,o,null===(t=null==m?void 0:m.features)||void 0===t?void 0:t.enableRenameFolder,a]);return{state:{isRenamingFolder:d||!1,folderToRename:l},actions:{showRenameFolderModal:v,handleRenameFolderCancel:y,handleRenameFolderOk:b}}})(me),{files:_e,loading:Se,isRenamingFile:Ae,fileToRename:Ee}=f.state,{fetchFiles:Ie,handleDeleteFile:Te,handleDeleteFolder:Fe,handleAddFile:Oe,handleAddFileByUrl:Pe,showRenameModal:Me,handleRenameCancel:Re,handleRenameOk:Le,handleDroppedFiles:Ne,showMoveModal:je,handleMoveCancel:De,handleMoveOk:ze,handleCopyOk:Be,handleCopyCancel:Ue,showDeleteConfirm:Ve,handleDeleteConfirmCancel:He,handleDeleteConfirmOk:We}=f.actions,{selectedFolder:$e,pathHistory:qe}=p.state,{handleFolderSelect:Ge,handleItemClick:Ye}=p.actions,{pagination:Xe}=g.state,Ke=Eo(Ie),{searchTerm:Ze,sortBy:Je,sortOrder:Qe}=Ke.state,{handleSearch:et,handleSort:tt,handlePaginationChange:rt}=Ke.actions,nt=c(async()=>{const e=(e=>Bo(e))(qe||[]);try{await Ho({options:k,pathFolder:e,dataProviders:null==k?void 0:k.dataProviders})}catch(e){console.error("Cache clear failed:",e)}await me(),await Ie({folderId:$e||"",page:Xe.current,limit:Xe.pageSize,search:Ze,sortBy:Je,sortOrder:Qe,itemType:"all"})},[Ie,me,k,Xe,qe,Ze,$e,Je,Qe]),it=(({files:e,fetchFiles:t,selectedFolder:r})=>{var i;const{t:o}=Gn(),a=Fo(),{options:s,actions:l,state:c}=n.useContext(ho),{setActiveLibraryItem:u}=l,{activeLibraryItem:d}=c,h=Za(),[f,p]=n.useState(!1),[g,m]=n.useState(null),v=n.useCallback(e=>{var t;if(e.type&&e.type.startsWith("image/"))return!0;if(e.extension){const t=e.extension.toLowerCase();return hr.includes(t)}const r=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return!!r&&hr.includes(r)},[]),y=n.useCallback(async(e,t)=>{var r,n;const{dataProviders:i}=s;if(!1===(null===(n=null===(r=s.config)||void 0===r?void 0:r.features)||void 0===n?void 0:n.enableUpdateFile))throw new qo(o("Updating files is disabled by configuration"),"UnsupportedOperation");if(!e.id||!e.thumbnail||!(null==i?void 0:i.updateFile))throw new qo(o("Failed to save changes"),"UnsupportedOperation");const a=(null==t?void 0:t.mimeType)||Ar(e.thumbnail,e.type),l=kr(a),c=e.name.lastIndexOf("."),u=`${c>0?e.name.substring(0,c):e.name}.${l}`,d=(null==t?void 0:t.blob)||Pr(e.thumbnail,a);return i.updateFile(e.id,{name:u,type:a,data:d})},[s,o]),b=n.useCallback(async(e,t)=>{var r,n,i;if(!e.thumbnail)throw new qo(o("Failed to save changes"),"ValidationError");const a=!(!0===(null===(r=s.config)||void 0===r?void 0:r.saveCopyToCurrentFolder))||(null!==(n=e.saveWithoutFolder)&&void 0!==n?n:!e.id),l=a?void 0:null!==(i=e.folderId)&&void 0!==i?i:void 0,c=(null==t?void 0:t.mimeType)||Ar(e.thumbnail,e.type),u=(null==t?void 0:t.blob)||Pr(e.thumbnail,c),d=new File([u],e.name,{type:c,lastModified:Date.now()}),f=await h.uploadFileWithProvider(d,l,void 0,a);if(!f)throw new qo(o("Failed to save image copy"),"FileWriteError");return f},[h,null===(i=s.config)||void 0===i?void 0:i.saveCopyToCurrentFolder,o]),w=n.useCallback(t=>{let r;if(t)r=t;else{const t=rs.getState().selectedFiles;if(1!==t.size)return;const n=Array.from(t)[0];if(r=e.find(e=>e.id===n),!r||r.isFolder||!v(r))return}u&&u(ir),m(r),p(!0)},[e,v,p,u]),x=n.useCallback(()=>{u&&d===ir&&u(Qt),p(!1),m(null)},[d,u]),C=n.useCallback(async(e,n)=>{var i,l,c,u,d,h;try{const c=await y(e,n);return a.success({id:"IMAGE_UPDATE_SUCCESS",message:o("Success"),description:o("Image updated successfully"),placement:"bottomRight",data:{itemId:null!==(i=null==c?void 0:c.id)&&void 0!==i?i:void 0,itemName:null==c?void 0:c.name,folderId:null!==(l=null==c?void 0:c.folderId)&&void 0!==l?l:null,thumbnail:null==c?void 0:c.thumbnail}}),c&&s.onEditorOk&&s.onEditorOk(c,{mode:n.mode}),await t({folderId:r||""}),x(),null!=c?c:void 0}catch(t){const r=Lo(t),n=null!==(u=null!==(c=Mo(null==r?void 0:r.code,o))&&void 0!==c?c:null==r?void 0:r.message)&&void 0!==u?u:o("Failed to save changes");throw a.error({id:"IMAGE_SAVE_FAILED",message:n,innerException:t,placement:"bottomRight",data:{itemId:null!==(d=e.id)&&void 0!==d?d:void 0,itemName:e.name,folderId:null!==(h=e.folderId)&&void 0!==h?h:null,thumbnail:e.thumbnail}}),t.notificationShown=!0,t}},[y,s,t,r,a,x,o]),_=n.useCallback(async(e,n)=>{var i,l,c,u,d,h;try{const c=await b(e,n);return a.success({id:"IMAGE_SAVE_COPY_SUCCESS",message:o("Success"),description:o("Image copy saved successfully"),placement:"bottomRight",data:{itemId:null!==(i=null==c?void 0:c.id)&&void 0!==i?i:void 0,itemName:null==c?void 0:c.name,folderId:null!==(l=null==c?void 0:c.folderId)&&void 0!==l?l:null,thumbnail:null==c?void 0:c.thumbnail}}),c&&s.onEditorOk&&s.onEditorOk(c,{mode:n.mode}),await t({folderId:r||""}),x(),null!=c?c:void 0}catch(t){const r=Lo(t),n=null!==(u=null!==(c=Mo(null==r?void 0:r.code,o))&&void 0!==c?c:null==r?void 0:r.message)&&void 0!==u?u:o("Failed to save image copy");throw a.error({id:"IMAGE_SAVE_COPY_FAILED",message:n,innerException:t,placement:"bottomRight",data:{itemId:null!==(d=e.id)&&void 0!==d?d:void 0,itemName:e.name,folderId:null!==(h=e.folderId)&&void 0!==h?h:null,thumbnail:e.thumbnail}}),t.notificationShown=!0,t}},[b,s,t,r,a,x,o]);return{isPixieEditorVisible:f,editingFile:g,handleEdit:w,handlePixieEditorSave:C,handlePixieEditorSaveCopy:_,handlePixieEditorClose:x}})({files:_e||[],fetchFiles:Ie,selectedFolder:$e||null}),[ot,at]=o(!1),st=c(e=>{if(e.preventDefault(),e.stopPropagation(),!e.dataTransfer||!e.dataTransfer.types||!e.dataTransfer.types.includes("Files"))return;e.dataTransfer.dropEffect="copy";const t=e.relatedTarget,r=e.currentTarget;t&&r.contains(t)||(ne.current+=1,ne.current>0&&Z(!0))},[]),lt=c(e=>{e.preventDefault(),e.stopPropagation();const t=e.relatedTarget,r=e.currentTarget;if(t&&!r.contains(t))ne.current=Math.max(0,ne.current-1),ne.current<=0&&Z(!1);else if(t){const e=t.closest('[class*="dragOverlay"]');if(e&&r.contains(e))return}},[]),ct=c(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},[]),ut=c(e=>{e.preventDefault(),e.stopPropagation(),Z(!1),ne.current=0;const t=(()=>{var t;const r=e.dataTransfer;if(!r)return[];if(null===(t=r.files)||void 0===t?void 0:t.length)return Array.from(r.files);const n=[];if(r.items)for(let e=0;e<r.items.length;e++){const t=r.items[e].getAsFile();t&&n.push(t)}return n})();t.length&&(at(!0),Ne(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error("Ошибка при загрузке файлов:",e)}).finally(()=>{at(!1)}))},[Ne]),dt=c(()=>{Z(!1),ne.current=0,document.body.removeAttribute("data-fm-dragging"),re(!1),ee(!1)},[]);i.useEffect(()=>{ae.current=_e||[]},[_e]);const ht=null==I?void 0:I.activeLibraryItem;a(()=>{const e=e=>{e?document.body.setAttribute("data-fm-dragging","true"):document.body.removeAttribute("data-fm-dragging")};let t=!1;const r=r=>{var n,i;!t&&(null===(i=null===(n=r.dataTransfer)||void 0===n?void 0:n.types)||void 0===i?void 0:i.includes("Files"))&&(t=!0,re(!0),e(!0),ht===Qt&&ee(!0))},n=r=>{const n=r.relatedTarget;(!n||!document.documentElement.contains(n))&&t&&(t=!1,re(!1),ee(!1),e(!1))};return window.addEventListener("dragenter",r,!0),window.addEventListener("dragleave",n,!0),()=>{window.removeEventListener("dragenter",r,!0),window.removeEventListener("dragleave",n,!0),document.body.removeAttribute("data-fm-dragging")}},[ht]),a(()=>{const e=e=>{var t,r;if(document.body.removeAttribute("data-fm-dragging"),re(!1),!(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files")))return;e.preventDefault();const n=(e=>{var t;if(!e)return[];if(null===(t=e.files)||void 0===t?void 0:t.length)return Array.from(e.files);const r=[];if(e.items)for(let t=0;t<e.items.length;t++){const n=e.items[t].getAsFile();n&&r.push(n)}return r})(e.dataTransfer);if(!n.length)return;const i=e.target,o=i.closest(`.${As.filesContainer.replace(/\s+/g,".")}`)||i.closest("[data-files-container]"),a=i.closest(".em-filemanager")||i.closest(".file-manager__layout")||i.closest("[data-drop-overlay]")||i.closest("[data-drag-capture]");(ie.current||K||o||a)&&(e.preventDefault(),e.stopPropagation(),ee(!1),Z(!1),ne.current=0,at(!0),Ne(n).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error("Ошибка при загрузке файлов:",e)}).finally(()=>at(!1)))},t=e=>{var t,r;(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",document.body.hasAttribute("data-fm-dragging")||(document.body.setAttribute("data-fm-dragging","true"),re(!0)),ht!==Qt||ie.current||ee(!0))},r=e=>{var t,r;(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",document.body.setAttribute("data-fm-dragging","true"),re(!0))},n={capture:!0,passive:!1};return window.addEventListener("drop",e,n),window.addEventListener("dragover",t,n),window.addEventListener("dragenter",r,n),()=>{window.removeEventListener("drop",e,n),window.removeEventListener("dragover",t,n),window.removeEventListener("dragenter",r,n)}},[K,Ne,ht]),a(()=>{const e=e=>{K&&dt(),ee(!1),re(!1),document.body.removeAttribute("data-fm-dragging")};return window.addEventListener("dragend",e,!0),()=>window.removeEventListener("dragend",e,!0)},[K,dt]),a(()=>{let e=null;const t=t=>{K&&(e=setTimeout(()=>{K&&dt()},200))};return document.addEventListener("mouseup",t,!0),()=>{document.removeEventListener("mouseup",t,!0),e&&clearTimeout(e)}},[K,dt]),a(()=>{const e=e=>{"Escape"===e.key&&K&&dt()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[K,dt]),a(()=>{const e=e=>{K&&setTimeout(()=>{K&&dt()},100)};return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}},[K,dt]);const ft=i.useCallback(async()=>{await We(),await me(),$e===or&&ve&&await ve(or),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var e,t;return null===(t=null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts)||void 0===t?void 0:t.call(e)})})},[me,ve,We,$e]),pt=i.useCallback(()=>{ue(!0)},[]),gt=i.useCallback(async()=>{var e,t;if($e!==or)return console.error("Clear trash called outside of trash folder"),void ue(!1);try{if(null==F?void 0:F.cleanTrash){const t=await F.cleanTrash();await Ie({folderId:or}),await(null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts()),t.success?b.success({id:"TRASH_CLEARED_SUCCESS",message:w("Trash cleared successfully"),description:w("{{count}} items permanently deleted",{count:t.deletedCount||0}),placement:"bottomRight"}):b.error({id:"TRASH_CLEAR_FAILED",message:w("Failed to clear trash"),placement:"bottomRight"})}else{const e=ae.current||[];if(0===e.length)return void ue(!1);const r=e.map(e=>({id:e.id,isFolder:e.isFolder})),n=await y({items:r,selectedFolder:or,getItemNameById:t=>{var r;return(null===(r=e.find(e=>e.id===t))||void 0===r?void 0:r.name)||t||""},showNotifications:!1});await Ie({folderId:or}),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts());const{successCount:i,failCount:o}=n;0===o?b.success({id:"TRASH_CLEARED_SUCCESS",message:w("Trash cleared successfully"),description:w("{{count}} items permanently deleted",{count:i}),placement:"bottomRight"}):i>0?b.warning({id:"TRASH_CLEARED_PARTIAL",message:w("Trash partially cleared"),description:w("{{succeeded}} items deleted, {{failed}} items failed",{succeeded:i,failed:o}),placement:"bottomRight"}):b.error({id:"TRASH_CLEAR_FAILED",message:w("Failed to clear trash"),placement:"bottomRight"})}ue(!1)}catch(e){console.error("Error clearing trash:",e),b.error({id:"TRASH_CLEAR_ERROR",message:w("Error clearing trash"),placement:"bottomRight"}),ue(!1)}},[$e,F,Ie,b,w,y]),mt=i.useCallback(()=>{ue(!1)},[]),vt=i.useCallback(async e=>{var t;await ze(e),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[ze]),yt=i.useCallback(async e=>{var t;await Be(e),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[Be]),bt=i.useCallback(async()=>{let e=[],t=new Map;const r=null==k?void 0:k.config;await Oe({onStartBatch:n=>{e=m.startUpload($e||void 0,n),t=new Map,n.forEach((n,i)=>{const o=e[i];o&&(t.set(n.name,o),t.set(jr(n.name,r),o))})},onStart:n=>{if(0===e.length){e=m.startUpload($e||void 0,[n]);const i=e[0];i&&(t.set(n.name,i),t.set(jr(n.name,r),i))}},onProgress:(e,r)=>{const n=t.get(e);n&&m.updateProgress(n,r)},onComplete:async e=>{var r;const n=t.get(e);if(n){await new Promise(e=>setTimeout(e,100));const t=null==_e?void 0:_e.find(t=>t.name===e&&!t.isFolder);m.markAsSuccess(n,t)}await(null===(r=oe.current)||void 0===r?void 0:r.refreshFileCounts())},onError:(r,n,i)=>{var o;const a=null!==(o=t.get(r))&&void 0!==o?o:null!=i&&i<e.length?e[i]:void 0;a&&m.markAsError(a,n)},onBatchComplete:async r=>{var n,i,o,a,s,l,c,u;for(let u=0;u<r.successes.length;u++){const d=r.successes[u],h=null===(n=r.uploadedFiles)||void 0===n?void 0:n.get(d),f=null!==(a=null!==(o=null!==(i=t.get(d))&&void 0!==i?i:(null==h?void 0:h.originalFileName)?t.get(h.originalFileName):void 0)&&void 0!==o?o:null!=(null==h?void 0:h.originalIndex)&&h.originalIndex<e.length?e[h.originalIndex]:void 0)&&void 0!==a?a:u<e.length?e[u]:void 0;if(f){let e;if(null==h?void 0:h.id){const t=h;e={id:t.id,name:null!==(s=t.name)&&void 0!==s?s:d,folderId:null!==(c=null!==(l=t.folderId)&&void 0!==l?l:$e)&&void 0!==c?c:null,isFolder:!1,size:t.size}}else await new Promise(e=>setTimeout(e,100)),e=null==_e?void 0:_e.find(e=>e.name===d&&!e.isFolder);m.updateProgress(f,100),m.markAsSuccess(f,e)}}r.errors.forEach(({fileName:e,error:r})=>{const n=t.get(e);n&&m.markAsError(n,r)}),await(null===(u=oe.current)||void 0===u?void 0:u.refreshFileCounts())}})},[Oe,m,_e,$e,null==k?void 0:k.config]),wt=i.useCallback(async(e,t,r,n)=>{var i,o;try{le(!0);let a=r||"uploaded-file";if(!r&&e){const t=e.split("?")[0].split("#")[0].split("/");a=t[t.length-1]||"uploaded-file";a.includes(".")&&(null===(i=a.split(".").pop())||void 0===i?void 0:i.length)&&a.split(".").pop().length<=5||(a+=".jpg")}const s=m.startUploadByUrl($e||void 0,a);try{const r=await Pe(e,t,!0,null!=n?n:"uploadByUrl");if(m.updateProgress(s,100),r){await new Promise(e=>setTimeout(e,100));const e=(null==_e?void 0:_e.find(e=>e.id===r.id&&!e.isFolder))||r;m.markAsSuccess(s,e)}else m.markAsSuccess(s);await(null===(o=oe.current)||void 0===o?void 0:o.refreshFileCounts())}catch(e){const t=Lo(e),r=zo(t,w);m.markAsError(s,r)}}finally{le(!1)}},[Pe,m,$e,_e,w]),xt=i.useCallback(async({file:e})=>{var t;const r=m.startUpload($e||void 0,[e])[0];let n=0;const i=setInterval(()=>{n=Math.min(n+10+Math.floor(Date.now()%10),90),m.updateProgress(r,n)},200);try{const n=await v.uploadFileWithProvider(e,void 0,!0);if(clearInterval(i),m.updateProgress(r,100),n){await new Promise(e=>setTimeout(e,100));const e=(null==_e?void 0:_e.find(e=>e.id===n.id&&!e.isFolder))||n;m.markAsSuccess(r,e)}else m.markAsSuccess(r);const o=n&&n.folderId||$e||null;return Ge&&Ge(o&&"folders"!==o?o:"folders"),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts()),n}catch(e){clearInterval(i);const t=e instanceof Error?e.message:String(e);throw m.markAsError(r,t),e}},[v,m,$e,_e,Ge]),Ct=i.useCallback(async e=>{var t;if(Ne){const r=m.startUpload($e||void 0,e);e.forEach(async(e,t)=>{const n=r[t];if(!n)return;let i=0;const o=setInterval(()=>{i=Math.min(i+10+Math.floor(Date.now()%10),85),m.updateProgress(n,i)},200);setTimeout(()=>{clearInterval(o)},2e3)}),await Ne(e),r.forEach(e=>{m.updateProgress(e,100),m.markAsSuccess(e)}),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())}},[Ne,m,$e]),_t=i.useCallback(async e=>{var t;await Fe(e),await me(),await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())},[Fe,me]),St=(({files:e,clearSelection:t,showRenameModal:r,showMoveModal:i,showCopyModal:o,handleDeleteFile:a,handleDeleteFolder:s,showDeleteConfirm:l,onEdit:c})=>{const u=n.useCallback(()=>{t()},[t]),d=n.useCallback(e=>{const t=rs.getState().selectedFiles;if(t&&1===t.size||e){const n=e||Array.from(t)[0];r(n)}},[r]),h=n.useCallback(t=>{const r=rs.getState().selectedFiles;if(r&&r.size>0||(null==t?void 0:t.id)){if(l)return void l();(t?[t.id]:r).forEach(t=>{const r=e.find(e=>e.id===t);r?r.isFolder?s(t):a(t):console.warn(`Объект с ID ${t} не найден в списке файлов`)})}},[e,a,s,l]);return{handleClearSelection:u,handleRename:d,handleDeleteSelected:h,handleCopy:n.useCallback(()=>{o()},[o]),handleMove:n.useCallback(()=>{i()},[i]),handleEdit:n.useCallback(()=>{c()},[c])}})({files:_e||[],clearSelection:he,showRenameModal:Me,showMoveModal:je,showCopyModal:f.actions.showCopyModal||(()=>{}),handleDeleteFile:Te,handleDeleteFolder:_t,showDeleteConfirm:Ve,onEdit:it.handleEdit}),At=ge||Se||ot;a(()=>{xr()},[]),x(()=>{W!==Qt?he():fe(_e||[])},[W,_e,fe,he]),a(()=>{if(!E||W!==Qt)return;if(!lr.current)return void(lr.current=!0);const e=(Array.isArray(_e)?_e:[]).filter(e=>de.has(e.id));E(e)},[W,_e,de,E]),i.useEffect(()=>{if(!Ge||0===pe.length)return;const e=!1!==(null==T?void 0:T.rememberLastFolder),t=`em_fm:lastFolder:${(null==T?void 0:T.projectId)||"default"}`;if(e&&"undefined"!=typeof window)try{const e=localStorage.getItem(t),r=e&&pe.some(t=>t.id===e);if(r)return void Ge(e)}catch(e){}$e||Ge("folders")},[$e,Ge,pe,null==T?void 0:T.rememberLastFolder,null==T?void 0:T.projectId]);const{handleRenameFolderCancel:kt,handleRenameFolderOk:Et}=Ce.actions;a(()=>{const e=async e=>{if(W!==Qt)return;const t=document.activeElement;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||"true"===(null==t?void 0:t.getAttribute("contenteditable")))return;const r=e.clipboardData;if(!r)return;const n=Array.from(r.items),i=n.filter(e=>e.type.startsWith("image/"));if(i.length>0){const t=i.map(e=>e.getAsFile()).filter(e=>null!==e);return void(t.length>0&&(e.preventDefault(),await Ct(t)))}const o=n.find(e=>"text/plain"===e.type);o&&o.getAsString(async t=>{const r=t.trim();if(r.startsWith("http://")||r.startsWith("https://"))e.preventDefault(),await wt(r);else if(r.includes("<meta")||r.includes("http")){const t=r.match(/https?:\/\/[^\s"']+/);t&&(e.preventDefault(),await wt(t[0]))}})};return document.addEventListener("paste",e),()=>{document.removeEventListener("paste",e)}},[W,wt,Ct]);const It=u(Xe);a(()=>{It.current=Xe},[Xe]);const Tt=c(e=>{rt(e.current||It.current.current,e.pageSize||It.current.pageSize)},[rt]),Ft=c(e=>{null==Ye||Ye(e)},[Ye]),Ot=i.useCallback(e=>{const{sortBy:t,sortOrder:r}=(e=>{const[t,r]=e.split("-");return{sortBy:t,sortOrder:r}})(e);tt(t,r)},[tt]),[Pt,Mt]=o(qL),[Rt,Lt]=o([]),Nt=u(null),[jt,Dt]=o(pr),[zt,Bt]=o([]),Ut=u(null),[Vt,Ht]=o(""),Wt=u(null),[$t,qt]=o(""),[Gt,Yt]=o([]),Xt=i.useRef(void 0),[Kt,Zt]=o(!1),[Jt,ar]=o(!1),sr=i.useRef(null),lr=i.useRef(!1),cr=i.useRef(W),ur=i.useCallback(e=>{const t=e.indexOf(",");if(-1===t)return null;const r=e.substring(0,t),n=r.match(/^data:([^;]+)/),i=n&&n[1]||"image/svg+xml";let o,a="svg";if(i.includes("png")?a="png":(i.includes("jpeg")||i.includes("jpg"))&&(a="jpg"),/;base64/i.test(r)){const r=e.substring(t+1),n=atob(r),a=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)a[e]=n.charCodeAt(e);o=new Blob([a],{type:i})}else{const r=decodeURIComponent(e.substring(t+1));o=new Blob([r],{type:i})}return new File([o],`icon_${Date.now()}.${a}`,{type:i})},[]),dr=i.useCallback(async e=>{var t;const r=m.startUpload($e||void 0,[e])[0];let n=0;const i=setInterval(()=>{n=Math.min(n+10+Math.floor(Date.now()%10),90),m.updateProgress(r,n)},200);try{const n=await v.uploadFileWithProvider(e,void 0,!0);if(clearInterval(i),m.updateProgress(r,100),n){await new Promise(e=>setTimeout(e,100));const e=(null==_e?void 0:_e.find(e=>e.id===n.id&&!e.isFolder))||n;m.markAsSuccess(r,e)}else m.markAsSuccess(r);await(null===(t=oe.current)||void 0===t?void 0:t.refreshFileCounts())}catch(e){clearInterval(i);const t=e instanceof Error?e.message:String(e);throw m.markAsError(r,t),e}},[m,_e,v,$e]),fr=c(async e=>{if(Boolean(e&&e.startsWith("data:"))){const t=ur(e);if(!t)return;return void await dr(t)}e&&await wt(e,void 0,void 0,"iconStock")},[ur,wt,dr]),gr=c(async()=>{const e=null==G?void 0:G.fileForEdit;if(Xt.current===e)return;if(W===ir&&e&&!it.editingFile){Xt.current=e;try{if("string"==typeof e){if(e.startsWith("data:"))return void(null==it||it.handleEdit({thumbnail:e,saveWithoutFolder:!0}));const t=await v.resolveFileForEditByUrl(e);Xt.current===e&&(null==it||it.handleEdit(t))}}catch(t){Xt.current===e&&(Xt.current=null),console.error("Failed to open file in editor:",t),null==it||it.handlePixieEditorClose()}}},[null==G?void 0:G.fileForEdit,W,it,v]);a(()=>{gr()},[gr]),a(()=>{var e,t,r,n;const i=cr.current;cr.current=W,W===Qt?(Lt([]),Mt(qL),Bt([]),Dt(pr),Yt([]),qt(""),ar(!1),Zt(!1),i===Qt||i!==tr&&i!==er&&i!==nr||et("")):W===nr?null===(e=sr.current)||void 0===e||e.focus():W===er?null===(t=Nt.current)||void 0===t||t.focus():W===tr?null===(r=Ut.current)||void 0===r||r.focus():W===rr&&(null===(n=Wt.current)||void 0===n||n.focus())},[W,et]);const mr=i.useCallback(async()=>{var e;await Et(),await(null===(e=oe.current)||void 0===e?void 0:e.refreshFileCounts())},[Et]),vr=c(e=>{var t;return e?(null===(t=e.files)||void 0===t?void 0:t.length)?Array.from(e.files):e.items?Array.from(e.items).map(e=>e.getAsFile()).filter(e=>Boolean(e)):[]:[]},[]);return t(r,{children:[te&&ht===Qt&&ke(e("div",{className:As.dragCaptureLayer,"data-drag-capture":"true",onDragOver:e=>{var t,r;e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"),(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&!ie.current&&ee(!0)},onDragEnter:e=>{var t,r;e.preventDefault(),e.stopPropagation(),(null===(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)||void 0===r?void 0:r.includes("Files"))&&ee(!0)},onDragLeave:e=>{const t=e.relatedTarget;t&&document.documentElement.contains(t)||(ee(!1),re(!1),document.body.removeAttribute("data-fm-dragging"))},onDrop:e=>{e.preventDefault(),e.stopPropagation(),re(!1),ee(!1),document.body.removeAttribute("data-fm-dragging");const t=vr(e.dataTransfer);t.length&&(at(!0),Ne(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error(e)}).finally(()=>at(!1)))},"aria-hidden":"true"}),document.body),Q&&ke(e("div",{className:As.dragOverlayGlobal,"data-drop-overlay":"true",onDragOver:e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},onDragEnter:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),e.stopPropagation(),ee(!1),re(!1),document.body.removeAttribute("data-fm-dragging");const t=vr(e.dataTransfer);t.length&&(at(!0),Ne(t).catch(e=>{"StaleLoad"!==(null==e?void 0:e.name)&&console.error(e)}).finally(()=>at(!1)))},"aria-hidden":"true",children:t("div",{className:As.dragOverlayInner,children:[e("div",{className:As.uploadIcon,children:e(Y,{})}),e("div",{className:As.textTitle,children:w("Drop files here to upload")}),e("div",{className:As.textDescription,children:w("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),document.body),e(J,{className:"file-manager__layout",children:t("div",{className:As.filesContainer,"data-files-container":"true",onDragOver:ct,onDragLeave:lt,onDragEnter:st,onDrop:ut,children:[K&&e("div",{className:As.dragOverlay,children:t("div",{className:As.dragOverlayInner,children:[e("div",{className:As.uploadIcon,children:e(Y,{})}),e("div",{className:As.textTitle,children:w("Drop files here to upload")}),e("div",{className:As.textDescription,children:w("Supported files:")+" .jpg, .jpeg, .svg, .png"})]})}),t(J,{className:"file-manager__content",children:[e(HL,{width:320,theme:"light",className:"file-manager-sider",children:e(pl,{ref:oe,selectedFolder:$e||"folders",generateMenuItems:xe,onFolderSelect:e=>null==Ge?void 0:Ge(e),folders:pe||[],fetchFolders:me,fetchChildFolders:ve,handleAddFile:bt,setIsUrlModalVisible:e=>null==$?void 0:$(e),handleDeleteFolder:_t,handleCreateFolder:ye,activeLibraryItem:W,setActiveLibraryItem:e=>null==q?void 0:q(e)})}),t(J,{className:"file-manager__main-content",children:[ot&&e(sl,{style:{position:"absolute",width:"100%",height:"100%",top:0,left:0,zIndex:100,background:"var(--colorBgLayout)"}}),t(WL,{className:"main-content",children:[e(bL,{activeLibraryItem:W,selectedFolder:(null===(s=null==pe?void 0:pe.find(e=>(null==e?void 0:e.id)===$e))||void 0===s?void 0:s.name)||w("Folders"),isTrashFolder:"Trash"===$e,onClearTrash:pt,files:_e||[],loading:At,onRefresh:nt,refreshDisabled:Se||ge,showRefresh:!(!(null===(l=null==k?void 0:k.apiEndpoints)||void 0===l?void 0:l.clearCache)&&!(null===(d=null==k?void 0:k.dataProviders)||void 0===d?void 0:d.clearCache))}),e(X,{className:"zero-divider"}),W===Qt&&e(Ks,{searchTerm:Ze,handleAddFile:bt,files:_e||[],handleSearch:et,sortBy:Je,sortOrder:Qe,handleSortOptionChange:Ot,pagination:Xe,setPagination:Tt,loading:At,handleItemClick:Ft,onClearSelection:St.handleClearSelection,onRename:St.handleRename,onCopy:St.handleCopy,onMove:St.handleMove,onDelete:St.handleDeleteSelected,showRenameModal:Me,showDeleteConfirm:Ve,showCopyModal:f.actions.showCopyModal||(()=>{}),showMoveModal:je,onEdit:it.handleEdit,getFileData:v.getFileData}),W===er&&e(EL,{imageGifList:Rt,setImageGifList:Lt,currentReqGif:Pt,setCurrentReqGif:Mt,inputRef:Nt,customRequest:(e,t)=>wt(e,void 0,t,"gif")}),W===tr&&e(OL,{imageStockList:zt,setImageStockList:Bt,currentReq:jt,setCurrentReq:Dt,inputRef:Ut,customRequest:(e,t)=>wt(e,void 0,t,"imageStock")}),W===rr&&e(i.Suspense,{fallback:e("div",{style:{display:"flex",justifyContent:"center",padding:"48px 0"},children:e(S,{size:"large"})}),children:e($L,{customRequest:fr,query:Vt,setQuery:Ht,inputRef:Wt})}),W===nr&&!!(null==G?void 0:G.sseQuery)&&e(UL,{imageAiList:Gt,setImageAiList:Yt,aiImageRequest:$t,setAiImageRequest:qt,inputAiRef:sr,customRequest:xt,isLoadingAi:Kt,setIsLoadingAi:Zt,isImageUploaded:Jt,setIsImageUploaded:ar}),W===ir&&e(r,{})]})]})]}),se&&!m.isUploadVisible&&e("div",{style:{position:"fixed",inset:0,zIndex:1500,backgroundColor:"rgba(255, 255, 255, 0.5)",pointerEvents:"all",display:"flex",alignItems:"center",justifyContent:"center"},children:e(S,{size:"large"})}),e(hl,{isModalVisible:j,handleModalOk:be,handleModalCancel:we,form:O,selectedFolder:$e||null,folders:pe||[],isUrlModalVisible:D,setIsUrlModalVisible:e=>null==$?void 0:$(e),handleAddFileByUrl:wt,urlForm:P,isRenameModalVisible:Ae,handleRenameOk:()=>null==Le?void 0:Le(),handleRenameCancel:()=>null==Re?void 0:Re(),renameForm:M,fileToRename:Ee,files:_e||[],isMoveModalVisible:z,handleMoveOk:vt,handleMoveCancel:De,moveForm:R,selectedFiles:de||new Set,isRenameFolderModalVisible:B,handleRenameFolderOk:mr,handleRenameFolderCancel:kt,renameFolderForm:L,folderToRename:H,isCopyModalVisible:U,handleCopyOk:yt,handleCopyCancel:Ue,copyForm:N,isDeleteConfirmVisible:V,handleDeleteConfirmOk:ft,handleDeleteConfirmCancel:()=>null==He?void 0:He(),isClearTrashConfirmVisible:ce,handleClearTrashConfirm:gt,handleClearTrashCancel:mt,fetchChildFolders:ve}),e(UR,{visible:it.isPixieEditorVisible,onClose:it.handlePixieEditorClose,file:it.editingFile,onSave:it.handlePixieEditorSave,onSaveCopy:it.handlePixieEditorSaveCopy}),e(mL,{files:m.uploadFiles,visible:m.isUploadVisible,minimized:m.isUploadMinimized,totalFiles:m.totalFiles,completedFiles:m.completedFiles,onClose:m.closeUpload,onMinimize:m.minimizeUpload,onInsert:e=>{var t;const r=m.getUploadedFile(e.id)||e;null===(t=C.onEditorOk)||void 0===t||t.call(C,r)}})]})})]})},YL=f(({config:n={},onPathChange:o,onChangeSelection:s,onEditorOk:l,searchQuery:c="",sortBySize:d="name",apiEndpoints:h={},customIcons:f,dragDropIcon:p,dataProviders:g,handleNotify:m,handleError:v,handleSuccess:y})=>{const b=i.useMemo(()=>Object.assign({folderTreeLoading:"lazy",expandAllFoldersOnInit:!1,expandRootFolderOnInit:!1,iconStrokeWidth:1.4,availableImageExtensions:["jpg","jpeg","png","gif"],fileNameProcessing:Object.assign(Object.assign({},{transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0}),n.fileNameProcessing),folderNameProcessing:Object.assign(Object.assign({},{transliterate:!0,replaceSpaces:!0,removeForbiddenChars:!0,toLowerCase:!0}),n.folderNameProcessing)},n),[n]);i.useEffect(()=>{b.theme&&(e=>{if("system"===e){const t=matchMedia(cr).matches?sr:ar;e=e===lr?t:e}document.documentElement.setAttribute("data-theme",e)})(b.theme),VL(b)},[b]),a(()=>{b.locale&&b.locale!==Fn.language&&Fn.changeLanguage(b.locale),b.customLocale&&b.locale&&Fn.addResourceBundle(b.locale,"translation",b.customLocale,!0,!0)},[b.locale,b.customLocale]);const w=u(null),x=i.useMemo(()=>({apiEndpoints:h,searchQuery:c,sortBySize:d,onPathChange:o,onChangeSelection:s,onEditorOk:l,config:b,customIcons:f,dragDropIcon:p,dataProviders:g,handleNotify:m,handleError:v,handleSuccess:y}),[h,c,d,o,s,l,b,f,p,g,m,v,y]);return e(E,{className:"em-filemanager",children:t(r,{children:[e(k,{getPopupContainer:()=>w.current||document.body,children:e(po,{options:x,children:e(GL,{})})}),e("div",{ref:w,className:"file-manager-modal-root"})]})})});YL.displayName="FileManagerApp";const XL=t=>{var r,n,i;return e(Yn,{i18n:Fn,children:e(vr,{externalTheme:null!==(n=null===(r=t.config)||void 0===r?void 0:r.theme)&&void 0!==n?n:"light",customThemeToken:null===(i=t.config)||void 0===i?void 0:i.customTheme,children:e(re,{children:e(YL,Object.assign({},t))})})})},KL=new Map,ZL=(t,r)=>{var n;let i;xr();let o={};const a=e=>{const t=!e||"fileManager"!==e.mode&&"imageCenter"!==e.mode&&"plugin"!==e.mode?void 0:e.mode;return"imageCenter"===t?br("imageCenter",e):br(t)};if(t instanceof HTMLElement){i=t;o={config:a(r),apiEndpoints:null==r?void 0:r.apiEndpoints}}else{i=t.element;const e=a(t.config),r=Object.assign(Object.assign({},null===(n=t.config)||void 0===n?void 0:n.apiEndpoints),t.apiEndpoints);o={config:e,currentPath:t.currentPath,onPathChange:t.onPathChange,onChangeSelection:t.onChangeSelection,searchQuery:t.searchQuery,sortBySize:t.sortBySize,apiEndpoints:r,dataProviders:t.dataProviders,customIcons:t.customIcons,dragDropIcon:t.dragDropIcon,handleNotify:t.handleNotify,handleError:t.handleError,handleSuccess:t.handleSuccess}}const s=_(i);s.render(e(XL,Object.assign({},o))),KL.set(i.id||`container_${Date.now()}`,s)},JL=e=>{const t=e.id||Object.keys(KL).find(e=>e.startsWith("container_"));if(t&&KL.has(t)){const e=KL.get(t);null==e||e.unmount(),KL.delete(t)}else{console.warn("Couldn t find the root to unmount");try{_(e).unmount()}catch(e){console.error("Error unmounting the component:",e)}}},QL=new Map,eN=n=>{const{onClose:o,onSave:s,dataProviders:l,theme:c,locale:d,hasPagination:h,disablePagination:f,paginationAvailable:p,dedupeUploadNamesOnClient:g,saveCopyToCurrentFolder:m}=n,v=i.useMemo(()=>{var e,t;return{theme:null!=c?c:"light",locale:d,baseUrl:n.baseUrl,assetsUrl:n.assetsUrl,compressMaxSize:n.compressMaxSize,compressMaxWidthOrHeight:n.compressMaxWidthOrHeight,compessorUrl:null!==(e=n.compessorUrl)&&void 0!==e?e:n.compressorUrl,compressorUrl:null!==(t=n.compressorUrl)&&void 0!==t?t:n.compessorUrl,showNotifications:n.showNotifications,handleFileProxy:n.handleFileProxy,hasPagination:h,disablePagination:f,paginationAvailable:p,dedupeUploadNamesOnClient:g,saveCopyToCurrentFolder:m}},[c,d,n.baseUrl,n.assetsUrl,n.compressMaxSize,n.compressMaxWidthOrHeight,n.compessorUrl,n.compressorUrl,n.showNotifications,n.handleFileProxy,h,f,p,g,m]),y=i.useCallback(async(e,t,r,n)=>{if(!e&&!t||!(null==l?void 0:l.getFiles))return null;try{const i=await l.getFiles({folderId:n?void 0:null!=r?r:void 0,noFolder:n,search:t||void 0,itemType:"file",page:1,limit:1}),[o]=i.files;return o?e&&o.id!==e?null:o:null}catch(e){return console.warn("Standalone Pixie: failed to resolve uploaded file from provider",e),null}},[l]),b=i.useMemo(()=>{if(n.file)return n.file;const e=n.name||"edited-image",t=n.extension||(n.type?n.type.split("/")[1]:"png"),r=n.type||`image/${t}`;return{thumbnail:n.imageDataUrl||"",name:e,id:void 0,type:r,extension:t,saveWithoutFolder:!0}},[n.file,n.imageDataUrl,n.name,n.extension,n.type]),w=i.useCallback(async(e,t)=>{if((null==l?void 0:l.updateFile)&&e.thumbnail)try{const r=(null==t?void 0:t.mimeType)||Ar(e.thumbnail,e.type),n=kr(r),i=e.name.substring(0,e.name.lastIndexOf("."))+"."+n,o=(null==t?void 0:t.blob)||Pr(e.thumbnail,r);return await l.updateFile(e.id,{name:i,type:r,data:o})}catch(e){return console.error("Error updating the file through updateFile:",e),null}return console.warn("DataProvider for updating files is not configured"),null},[l]),x=i.useCallback(async(e,t)=>{var r,n,i,o,a,s;if(!e.thumbnail)return null;try{const c=!0!==v.saveCopyToCurrentFolder||(null!==(r=e.saveWithoutFolder)&&void 0!==r?r:!e.id),u=c?"":e.folderId||"",d=(null==t?void 0:t.mimeType)||Ar(e.thumbnail,e.type),h=(null==t?void 0:t.blob)||Pr(e.thumbnail,d),f=jr(e.name,v),p=await di(l,f,u,c,zr(v)),g=new File([h],p,{type:d,lastModified:Date.now()});if(null==l?void 0:l.uploadFiles){const t=await l.uploadFiles({items:[{name:g.name,size:g.size,type:g.type,folderId:u,noFolder:c,data:g,extension:kr(d)}],folderId:u}),r=null===(n=t.detailed)||void 0===n?void 0:n[0];if(t.success&&(null==r?void 0:r.success)&&r.data){const t=r.data;if(t.url||t.thumbnailUrl||t.thumbnail)return{id:t.id||e.id||"",name:t.name||e.name,folderId:null!==(i=t.folderId)&&void 0!==i?i:u,type:t.type||g.type,size:null!==(o=t.size)&&void 0!==o?o:g.size,extension:t.extension||kr(d),url:t.url,thumbnailUrl:t.thumbnailUrl,thumbnail:t.thumbnail,date:t.date,dimensions:t.dimensions,aspectRatio:t.aspectRatio,sourceUrl:t.sourceUrl,isFolder:!1,selected:!1};const n=await y(r.data.id,r.data.name||g.name,null!==(a=r.data.folderId)&&void 0!==a?a:u,c);return n||{id:r.data.id||e.id||"",name:r.data.name||e.name,folderId:null!==(s=r.data.folderId)&&void 0!==s?s:u,type:g.type,size:g.size,extension:kr(d),url:r.data.url,thumbnailUrl:r.data.thumbnailUrl,thumbnail:r.data.thumbnail,isFolder:!1,selected:!1}}}return(null==l?void 0:l.uploadFile)?await l.uploadFile({name:g.name,size:g.size,type:g.type,folderId:u,noFolder:c,data:g,extension:kr(d)}):null}catch(e){return console.error("Error saving file copy:",e),null}},[l,y,v]),C=i.useCallback(async(e,t)=>{if((null==l?void 0:l.updateFile)&&e.id&&e.thumbnail)try{const r=await w(e,t);r&&(e=r)}catch(e){console.error("Standalone Pixie: saveFileToServer error",e)}return s&&await s(e,t),o&&o(),e},[l,s,o,w]),_=i.useCallback(async(e,t)=>{let r=e;if(e.thumbnail)try{const n=await x(e,t);n&&(r=n)}catch(e){console.error("Standalone Pixie: saveFileCopyToServer error",e)}return s&&await s(r,t),o&&o(),r},[o,s,x]),S=u(null);return a(()=>{d&&d!==Fn.language&&Fn.changeLanguage(d)},[d]),e(E,{className:"em-filemanager",children:t(r,{children:[e(k,{getPopupContainer:()=>S.current||document.body,children:e(Yn,{i18n:Fn,children:e(vr,{externalTheme:null!=c?c:"light",children:e(re,{children:e(po,{options:{dataProviders:l,handleNotify:n.handleNotify,handleError:n.handleError,handleSuccess:n.handleSuccess,config:v},children:e(UR,{visible:!0,onClose:o,file:b,onSave:C,onSaveCopy:_})})})})})}),e("div",{ref:S,className:"file-manager-modal-root"})]})})},tN=t=>{xr();const r=t.element,n=_(r);n.render(e(eN,Object.assign({},t))),QL.set(r.id||`pixie_container_${Date.now()}`,n)},rN=e=>{const t=Array.from(QL.keys()).find(e=>e.startsWith("pixie_container_")),r=e.id||t;if(r&&QL.has(r)){const e=QL.get(r);null==e||e.unmount(),QL.delete(r)}else{console.warn("Couldn t find the root to unmount Pixie");try{_(e).unmount()}catch(e){console.error("Error unmounting Pixie:",e)}}},nN=e=>{var t,r;const{mode:n,element:i,fileManager:o,pixieEditor:a,theme:s,dataProviders:l}=e;let c,u;const d={unmount:()=>{c&&JL(c),u&&rN(u)},unmountFileManager:void 0,unmountPixieEditor:void 0};switch(n){case"fileManager":c=i,ZL(i,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(t=null==o?void 0:o.config)||void 0===t?void 0:t.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),d.unmountFileManager=()=>JL(c);break;case"pixieEditor":u=i,tN(Object.assign({element:i,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountPixieEditor=()=>rN(u);break;case"both":{const e=document.createElement("div");e.id="file-manager-container",e.style.cssText="height: 50%; border-bottom: 1px solid #d9d9d9;";const t=document.createElement("div");t.id="pixie-editor-container",t.style.cssText="height: 50%;",i.appendChild(e),i.appendChild(t),c=e,u=t,ZL(c,Object.assign(Object.assign({},null==o?void 0:o.config),{theme:s||(null===(r=null==o?void 0:o.config)||void 0===r?void 0:r.theme),apiEndpoints:null==o?void 0:o.apiEndpoints})),tN(Object.assign({element:u,theme:s||(null==a?void 0:a.theme),dataProviders:l||(null==a?void 0:a.dataProviders)},a)),d.unmountFileManager=()=>JL(c),d.unmountPixieEditor=()=>rN(u);break}}return d};function iN(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}var oN={init:ZL,unmount:JL,initPixieEditor:tN,unmountPixieEditor:rN,initFileManager:nN};export{YL as A,Ks as B,hl as C,pl as D,xr as E,al as F,Cr as G,qo as H,iN as I,wo as N,eN as P,fo as a,go as b,CL as c,Cs as d,Fo as e,Wo as f,ul as g,zr as h,Ti as i,Pa as j,Ma as k,ja as l,Ii as m,jr as n,pi as o,ll as p,ZL as q,di as r,bi as s,JL as t,Gn as u,XL as v,tN as w,rN as x,nN as y,oN as z};
62
+ //# sourceMappingURL=file-manager-index-CBQ0C6Zs.js.map