@emailmaker/emailmaker 1.0.60 → 1.0.62
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.
- package/README.md +1 -1
- package/asset-manifest.json +20 -20
- package/emailmaker-esm.js +1 -1
- package/emailmaker.js +1 -1
- package/iframe/css/sandbox.css +6 -2
- package/iframe/{iframe-eblock.1ef394c83ed0138fa7e1.html → iframe-eblock.b34985f1b45339a1dbe1.html} +1 -1
- package/iframe/{iframe.1ef394c83ed0138fa7e1.html → iframe.b34985f1b45339a1dbe1.html} +1 -1
- package/iframe/js/cssbeautify.js +1 -1
- package/iframe/sandbox-eblock.js +1 -1
- package/iframe/sandbox.js +1 -1
- package/package.json +1 -1
- package/plugin.html +1 -1
- package/plugin_blocks_test.html +1 -1
- package/plugin_default.html +3 -3
- package/plugin_idigital.html +1 -1
- package/plugin_s.html +1 -1
- package/static/js/1399.162f8a92.js +1 -0
- package/static/js/{2299.bd334036.chunk.js → 2299.cf90b757.chunk.js} +1 -1
- package/static/js/2574.56baa8a0.js +1 -0
- package/static/js/4529.eae85391.js +1 -0
- package/static/js/5211.d27a1e14.js +1 -0
- package/static/js/7291.d2241d85.js +1 -0
- package/static/js/{7967.28137472.js → 7967.5136da11.js} +1 -1
- package/static/js/8689.aa776e90.chunk.js +1 -0
- package/static/js/8879.96cdfd59.js +2 -0
- package/static/js/{8879.26995270.js.LICENSE.txt → 8879.96cdfd59.js.LICENSE.txt} +3 -35
- package/static/js/{8995.410bef51.js → 8995.54a7ed6e.js} +1 -1
- package/static/js/{emailmaker_core.f09929d2.js → emailmaker_core.6e2a56e1.js} +1 -1
- package/translations.pot +204 -194
- package/static/js/1399.258dd710.js +0 -1
- package/static/js/2574.2f48eb7a.js +0 -1
- package/static/js/4529.2f2fc56b.js +0 -1
- package/static/js/5211.e473201c.js +0 -1
- package/static/js/7291.37dee66e.js +0 -1
- package/static/js/8689.fa42b226.chunk.js +0 -1
- package/static/js/8879.26995270.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 8879.26995270.js.LICENSE.txt */
|
|
2
|
-
"use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[8879],{68879:(t,e,n)=>{var r;n.d(e,{A:()=>xS});var i=n(92810),o=n(22587);t=n.hmd(t);var a=n(29876),s=n(33825).Buffer,l=Object.defineProperty,c=(t,e,n)=>(((t,e,n)=>{e in t?l(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n),n),u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{};function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(t){var e=t.default;if("function"==typeof e){var n=function(){return e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var f=function(t){return!!(e=t)&&"object"==typeof e&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===p}(t)}(t);var e};var p="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function g(t,e){return!1!==e.clone&&e.isMergeableObject(t)?x(function(t){return Array.isArray(t)?[]:{}}(t),t,e):t}function m(t,e,n){return t.concat(e).map((function(t){return g(t,n)}))}function v(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(e){return t.propertyIsEnumerable(e)})):[]}(t))}function b(t,e){try{return e in t}catch{return!1}}function y(t,e,n){var r={};return n.isMergeableObject(t)&&v(t).forEach((function(e){r[e]=g(t[e],n)})),v(e).forEach((function(i){(function(t,e){return b(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,i)||(b(t,i)&&n.isMergeableObject(e[i])?r[i]=function(t,e){if(!e.customMerge)return x;var n=e.customMerge(t);return"function"==typeof n?n:x}(i,n)(t[i],e[i],n):r[i]=g(e[i],n))})),r}function x(t,e,n){(n=n||{}).arrayMerge=n.arrayMerge||m,n.isMergeableObject=n.isMergeableObject||f,n.cloneUnlessOtherwiseSpecified=g;var r=Array.isArray(e);return r===Array.isArray(t)?r?n.arrayMerge(t,e,n):y(t,e,n):g(e,n)}x.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,n){return x(t,n,e)}),{})};var w=x;function _(t,e){return void 0===e&&(e=15),+parseFloat(Number(t).toPrecision(e))}function S(t){var e=t.toString().split(/[eE]/),n=(e[0].split(".")[1]||"").length-+(e[1]||0);return n>0?n:0}function C(t){if(-1===t.toString().indexOf("e"))return Number(t.toString().replace(".",""));var e=S(t);return e>0?_(Number(t)*Math.pow(10,e)):Number(t)}function k(t){M&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER)&&console.warn(t+" is beyond boundary when transfer to integer, the results may not be accurate")}function T(t,e){var n=t[0],r=t[1],i=t.slice(2),o=e(n,r);return i.forEach((function(t){o=e(o,t)})),o}function E(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length>2)return T(t,E);var n=t[0],r=t[1],i=C(n),o=C(r),a=S(n)+S(r),s=i*o;return k(s),s/Math.pow(10,a)}function O(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(t.length>2)return T(t,O);var n=t[0],r=t[1],i=C(n),o=C(r);return k(i),k(o),E(i/o,_(Math.pow(10,S(r)-S(n))))}var M=!0;var P={strip:_,plus:function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(e.length>2)return T(e,t);var r=e[0],i=e[1],o=Math.pow(10,Math.max(S(r),S(i)));return(E(r,o)+E(i,o))/o},minus:function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(e.length>2)return T(e,t);var r=e[0],i=e[1],o=Math.pow(10,Math.max(S(r),S(i)));return(E(r,o)-E(i,o))/o},times:E,divide:O,round:function(t,e){var n=Math.pow(10,e),r=O(Math.round(Math.abs(E(t,n))),n);return t<0&&0!==r&&(r=E(r,-1)),r},digitLength:S,float2Fixed:C,enableBoundaryChecking:function(t){void 0===t&&(t=!0),M=t}};function A(t){return t&&t.Math==Math?t:void 0}var j="object"==typeof globalThis&&A(globalThis)||"object"==typeof window&&A(window)||"object"==typeof self&&A(self)||"object"==typeof n.g&&A(n.g)||function(){return this}()||{};function D(){return j}function R(t,e,n){var r=n||j,i=r.__SENTRY__=r.__SENTRY__||{};return i[t]||(i[t]=e())}var I=Object.prototype.toString;function L(t){switch(I.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return Y(t,Error)}}function z(t,e){return I.call(t)===`[object ${e}]`}function F(t){return z(t,"ErrorEvent")}function N(t){return z(t,"DOMError")}function B(t){return z(t,"String")}function V(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function H(t){return z(t,"Object")}function W(t){return typeof Event<"u"&&Y(t,Event)}function U(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function Y(t,e){try{return t instanceof e}catch{return!1}}function X(t,e){try{let r=t;var n=[];let i=0,o=0;let a;for(;r&&i++<5&&(a=G(r,e),!("html"===a||i>1&&o+3*n.length+a.length>=80));)n.push(a),o+=a.length,r=r.parentNode;return n.reverse().join(" > ")}catch{return"<unknown>"}}function G(t,e){var n=t,r=[];let i,o,a,s,l;if(!n||!n.tagName)return"";r.push(n.tagName.toLowerCase());var c=e&&e.length?e.filter((t=>n.getAttribute(t))).map((t=>[t,n.getAttribute(t)])):null;if(c&&c.length)c.forEach((t=>{r.push(`[${t[0]}="${t[1]}"]`)}));else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&B(i))for(o=i.split(/\s+/),l=0;l<o.length;l++)r.push(`.${o[l]}`);var u=["type","name","title","alt"];for(l=0;l<u.length;l++)a=u[l],s=n.getAttribute(a),s&&r.push(`[${a}="${s}"]`);return r.join("")}class $ extends Error{constructor(t,e="warn"){super(t),this.message=t,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=e}}var q=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;function K(t,e=!1){const{host:n,path:r,pass:i,port:o,projectId:a,protocol:s,publicKey:l}=t;return`${s}://${l}${e&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r&&`${r}/`}${a}`}function Z(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function J(t){var e="string"==typeof t?function(t){var e=q.exec(t);if(!e)throw new $(`Invalid Sentry Dsn: ${t}`);const[n,r,i="",o,a="",s]=e.slice(1);let l="",c=s;var u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){var h=c.match(/^\d+/);h&&(c=h[0])}return Z({host:o,pass:i,path:l,projectId:c,port:a,protocol:n,publicKey:r})}(t):Z(t);return function(t){if(!(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__))return;const{port:e,projectId:n,protocol:r}=t;if(["protocol","publicKey","host","projectId"].forEach((e=>{if(!t[e])throw new $(`Invalid Sentry Dsn: ${e} missing`)})),!n.match(/^\d+$/))throw new $(`Invalid Sentry Dsn: Invalid projectId ${n}`);if(!function(t){return"http"===t||"https"===t}(r))throw new $(`Invalid Sentry Dsn: Invalid protocol ${r}`);if(e&&isNaN(parseInt(e,10)))throw new $(`Invalid Sentry Dsn: Invalid port ${e}`)}(e),e}var Q=D(),tt=["debug","info","warn","error","log","assert","trace"];function et(t){var e=D();if(!("console"in e))return t();var n=e.console,r={};tt.forEach((t=>{var i=n[t]&&n[t].__sentry_original__;t in e.console&&i&&(r[t]=n[t],n[t]=i)}));try{return t()}finally{Object.keys(r).forEach((t=>{n[t]=r[t]}))}}function nt(){let t=!1;var e={enable:()=>{t=!0},disable:()=>{t=!1}};return typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?tt.forEach((n=>{e[n]=(...e)=>{t&&et((()=>{Q.console[n](`Sentry Logger [${n}]:`,...e)}))}})):tt.forEach((t=>{e[t]=()=>{}})),e}let rt;function it(t,e=0){return"string"!=typeof t||0===e||t.length<=e?t:`${t.substr(0,e)}...`}function ot(t,e){if(!Array.isArray(t))return"";var n=[];for(let i=0;i<t.length;i++){var r=t[i];try{n.push(String(r))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function at(t,e){return!!B(t)&&(function(t){return z(t,"RegExp")}(e)?e.test(t):"string"==typeof e&&-1!==t.indexOf(e))}function st(t,e,n){if(e in t){var r=t[e],i=n(r);if("function"==typeof i)try{ct(i,r)}catch{}t[e]=i}}function lt(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}function ct(t,e){var n=e.prototype||{};t.prototype=e.prototype=n,lt(t,"__sentry_original__",e)}function ut(t){return t.__sentry_original__}function ht(t){if(L(t))return{message:t.message,name:t.name,stack:t.stack,...ft(t)};if(W(t)){var e={type:t.type,target:dt(t.target),currentTarget:dt(t.currentTarget),...ft(t)};return typeof CustomEvent<"u"&&Y(t,CustomEvent)&&(e.detail=t.detail),e}return t}function dt(t){try{return function(t){return typeof Element<"u"&&Y(t,Element)}(t)?X(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function ft(t){if("object"==typeof t&&null!==t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}return{}}function pt(t,e=40){var n=Object.keys(ht(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return it(n[0],e);for(let i=n.length;i>0;i--){var r=n.slice(0,i).join(", ");if(!(r.length>e))return i===n.length?r:it(r,e)}return""}function gt(t){return mt(t,new Map)}function mt(t,e){if(H(t)){if(void 0!==(i=e.get(t)))return i;var n={};for(var r of(e.set(t,n),Object.keys(t)))typeof t[r]<"u"&&(n[r]=mt(t[r],e));return n}if(Array.isArray(t)){var i;if(void 0!==(i=e.get(t)))return i;n=[];return e.set(t,n),t.forEach((t=>{n.push(mt(t,e))})),n}return t}rt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?R("logger",nt):nt();function vt(...t){var e=t.sort(((t,e)=>t[0]-e[0])).map((t=>t[1]));return(t,n=0)=>{var r=[];for(var i of t.split("\n").slice(n)){var o=i.replace(/\(error: (.*)\)/,"$1");for(var a of e){var s=a(o);if(s){r.push(s);break}}}return function(t){if(!t.length)return[];let e=t;var n=e[0].function||"",r=e[e.length-1].function||"";return(-1!==n.indexOf("captureMessage")||-1!==n.indexOf("captureException"))&&(e=e.slice(1)),-1!==r.indexOf("sentryWrapped")&&(e=e.slice(0,-1)),e.slice(0,50).map((t=>({...t,filename:t.filename||e[0].filename,function:t.function||"?"}))).reverse()}(r)}}function bt(t){return Array.isArray(t)?vt(...t):t}var yt="<anonymous>";function xt(t){try{return t&&"function"==typeof t&&t.name||yt}catch{return yt}}function wt(){if(!("fetch"in D()))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function _t(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}var St=D(),Ct={},kt={};function Tt(t){if(!kt[t])switch(kt[t]=!0,t){case"console":"console"in St&&tt.forEach((function(t){t in St.console&&st(St.console,t,(function(e){return function(...n){Ot("console",{args:n,level:t}),e&&e.apply(St.console,n)}}))}));break;case"dom":!function(){if("document"in St){var t=Ot.bind(null,"dom"),e=It(t,!0);St.document.addEventListener("click",e,!1),St.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach((e=>{var n=St[e]&&St[e].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(st(n,"addEventListener",(function(e){return function(n,r,i){if("click"===n||"keypress"==n)try{var o=this,a=o.__sentry_instrumentation_handlers__=o.__sentry_instrumentation_handlers__||{},s=a[n]=a[n]||{refCount:0};if(!s.handler){var l=It(t);s.handler=l,e.call(this,n,l,i)}s.refCount+=1}catch{}return e.call(this,n,r,i)}})),st(n,"removeEventListener",(function(t){return function(e,n,r){if("click"===e||"keypress"==e)try{var i=this,o=i.__sentry_instrumentation_handlers__||{},a=o[e];a&&(a.refCount-=1,a.refCount<=0&&(t.call(this,e,a.handler,r),a.handler=void 0,delete o[e]),0===Object.keys(o).length&&delete i.__sentry_instrumentation_handlers__)}catch{}return t.call(this,e,n,r)}})))}))}}();break;case"xhr":!function(){if("XMLHttpRequest"in St){var t=XMLHttpRequest.prototype;st(t,"open",(function(t){return function(...e){var n=this,r=e[1],i=n.__sentry_xhr__={method:B(e[0])?e[0].toUpperCase():e[0],url:e[1]};B(r)&&"POST"===i.method&&r.match(/sentry_key/)&&(n.__sentry_own_request__=!0);var o=function(){if(4===n.readyState){try{i.status_code=n.status}catch{}Ot("xhr",{args:e,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:n})}};return"onreadystatechange"in n&&"function"==typeof n.onreadystatechange?st(n,"onreadystatechange",(function(t){return function(...e){return o(),t.apply(n,e)}})):n.addEventListener("readystatechange",o),t.apply(n,e)}})),st(t,"send",(function(t){return function(...e){return this.__sentry_xhr__&&void 0!==e[0]&&(this.__sentry_xhr__.body=e[0]),Ot("xhr",{args:e,startTimestamp:Date.now(),xhr:this}),t.apply(this,e)}}))}}();break;case"fetch":!function(){if(!wt())return!1;var t=D();if(_t(t.fetch))return!0;let e=!1;var n=t.document;if(n&&"function"==typeof n.createElement)try{var r=n.createElement("iframe");r.hidden=!0,n.head.appendChild(r),r.contentWindow&&r.contentWindow.fetch&&(e=_t(r.contentWindow.fetch)),n.head.removeChild(r)}catch(i){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return e}()||st(St,"fetch",(function(t){return function(...e){var n={args:e,fetchData:{method:Mt(e),url:Pt(e)},startTimestamp:Date.now()};return Ot("fetch",{...n}),t.apply(St,e).then((t=>(Ot("fetch",{...n,endTimestamp:Date.now(),response:t}),t)),(t=>{throw Ot("fetch",{...n,endTimestamp:Date.now(),error:t}),t}))}}));break;case"history":!function(){if(!function(){var t=D(),e=t.chrome,n=e&&e.app&&e.app.runtime,r="history"in t&&!!t.history.pushState&&!!t.history.replaceState;return!n&&r}())return;var t=St.onpopstate;function e(t){return function(...e){var n=e.length>2?e[2]:void 0;if(n){var r=At,i=String(n);At=i,Ot("history",{from:r,to:i})}return t.apply(this,e)}}St.onpopstate=function(...e){var n=St.location.href,r=At;if(At=n,Ot("history",{from:r,to:n}),t)try{return t.apply(this,e)}catch{}},st(St.history,"pushState",e),st(St.history,"replaceState",e)}();break;case"error":Lt=St.onerror,St.onerror=function(t,e,n,r,i){return Ot("error",{column:r,error:i,line:n,msg:t,url:e}),!!Lt&&Lt.apply(this,arguments)};break;case"unhandledrejection":zt=St.onunhandledrejection,St.onunhandledrejection=function(t){return Ot("unhandledrejection",t),!zt||zt.apply(this,arguments)};break;default:return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("unknown instrumentation type:",t))}}function Et(t,e){Ct[t]=Ct[t]||[],Ct[t].push(e),Tt(t)}function Ot(t,e){if(t&&Ct[t])for(var n of Ct[t]||[])try{n(e)}catch(r){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${xt(n)}\nError:`,r)}}function Mt(t=[]){return"Request"in St&&Y(t[0],Request)&&t[0].method?String(t[0].method).toUpperCase():t[1]&&t[1].method?String(t[1].method).toUpperCase():"GET"}function Pt(t=[]){return"string"==typeof t[0]?t[0]:"Request"in St&&Y(t[0],Request)?t[0].url:String(t[0])}let At;var jt=1e3;let Dt,Rt;function It(t,e=!1){return n=>{if(n&&Rt!==n&&!function(t){if("keypress"!==t.type)return!1;try{var e=t.target;if(!e||!e.tagName)return!0;if("INPUT"===e.tagName||"TEXTAREA"===e.tagName||e.isContentEditable)return!1}catch{}return!0}(n)){var r="keypress"===n.type?"input":n.type;(void 0===Dt||function(t,e){if(!t||t.type!==e.type)return!0;try{if(t.target!==e.target)return!0}catch{}return!1}(Rt,n))&&(t({event:n,name:r,global:e}),Rt=n),clearTimeout(Dt),Dt=St.setTimeout((()=>{Dt=void 0}),jt)}}}let Lt=null;let zt=null;function Ft(){var t=D(),e=t.crypto||t.msCrypto;if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");var n=e&&e.getRandomValues?()=>e.getRandomValues(new Uint8Array(1))[0]:()=>16*Math.random();return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(t=>(t^(15&n())>>t/4).toString(16)))}function Nt(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Bt(t){const{message:e,event_id:n}=t;if(e)return e;var r=Nt(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Vt(t,e,n){var r=t.exception=t.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=e||""),o.type||(o.type=n||"Error")}function Ht(t,e){var n=Nt(t);if(n){var r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...e},e&&"data"in e){var i={...r&&r.data,...e.data};n.mechanism.data=i}}}function Wt(t){if(t&&t.__sentry_captured__)return!0;try{lt(t,"__sentry_captured__",!0)}catch{}return!1}function Ut(t){return Array.isArray(t)?t:[t]}function Yt(){return!(typeof __SENTRY_BROWSER_BUNDLE__<"u"&&__SENTRY_BROWSER_BUNDLE__)&&"[object process]"===Object.prototype.toString.call(typeof a<"u"?a:0)}function Xt(t,e=1/0,n=1/0){try{return $t("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Gt(t,e=3,n=102400){var r=Xt(t,e);return function(t){return function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(t))}(r)>n?Gt(t,e-1,n):r}function $t(t,e,r=1/0,i=1/0,o=function(){var t="function"==typeof WeakSet,e=t?new WeakSet:[];return[function(n){if(t)return!!e.has(n)||(e.add(n),!1);for(let t=0;t<e.length;t++)if(e[t]===n)return!0;return e.push(n),!1},function(n){if(t)e.delete(n);else for(let t=0;t<e.length;t++)if(e[t]===n){e.splice(t,1);break}}]}()){const[a,s]=o;if(null===e||["number","boolean","string"].includes(typeof e)&&!function(t){return"number"==typeof t&&t!==t}(e))return e;var l=function(t,e){try{return"domain"===t&&e&&"object"==typeof e&&e._events?"[Domain]":"domainEmitter"===t?"[DomainEmitter]":typeof n.g<"u"&&e===n.g?"[Global]":typeof window<"u"&&e===window?"[Window]":typeof document<"u"&&e===document?"[Document]":function(t){return H(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}(e)?"[SyntheticEvent]":"number"==typeof e&&e!==e?"[NaN]":void 0===e?"[undefined]":"function"==typeof e?`[Function: ${xt(e)}]`:"symbol"==typeof e?`[${String(e)}]`:"bigint"==typeof e?`[BigInt: ${String(e)}]`:`[object ${Object.getPrototypeOf(e).constructor.name}]`}catch(r){return`**non-serializable** (${r})`}}(t,e);if(!l.startsWith("[object "))return l;if(e.__sentry_skip_normalization__)return e;if(0===r)return l.replace("object ","");if(a(e))return"[Circular ~]";var c=e;if(c&&"function"==typeof c.toJSON)try{return $t("",c.toJSON(),r-1,i,o)}catch{}var u=Array.isArray(e)?[]:{};let h=0;var d=ht(e);for(var f in d)if(Object.prototype.hasOwnProperty.call(d,f)){if(h>=i){u[f]="[MaxProperties ~]";break}var p=d[f];u[f]=$t(f,p,r-1,i,o),h+=1}return s(e),u}var qt;function Kt(t){return new Jt((e=>{e(t)}))}function Zt(t){return new Jt(((e,n)=>{n(t)}))}!function(t){t[t.PENDING=0]="PENDING";t[t.RESOLVED=1]="RESOLVED";t[t.REJECTED=2]="REJECTED"}(qt||(qt={}));class Jt{__init(){this._state=qt.PENDING}__init2(){this._handlers=[]}constructor(t){Jt.prototype.__init.call(this),Jt.prototype.__init2.call(this),Jt.prototype.__init3.call(this),Jt.prototype.__init4.call(this),Jt.prototype.__init5.call(this),Jt.prototype.__init6.call(this);try{t(this._resolve,this._reject)}catch(e){this._reject(e)}}then(t,e){return new Jt(((n,r)=>{this._handlers.push([!1,e=>{if(t)try{n(t(e))}catch(i){r(i)}else n(e)},t=>{if(e)try{n(e(t))}catch(i){r(i)}else r(t)}]),this._executeHandlers()}))}catch(t){return this.then((t=>t),t)}finally(t){return new Jt(((e,n)=>{let r,i;return this.then((e=>{i=!1,r=e,t&&t()}),(e=>{i=!0,r=e,t&&t()})).then((()=>{i?n(r):e(r)}))}))}__init3(){this._resolve=t=>{this._setResult(qt.RESOLVED,t)}}__init4(){this._reject=t=>{this._setResult(qt.REJECTED,t)}}__init5(){this._setResult=(t,e)=>{if(this._state===qt.PENDING){if(U(e))return void e.then(this._resolve,this._reject);this._state=t,this._value=e,this._executeHandlers()}}}__init6(){this._executeHandlers=()=>{if(this._state!==qt.PENDING){var t=this._handlers.slice();this._handlers=[],t.forEach((t=>{t[0]||(this._state===qt.RESOLVED&&t[1](this._value),this._state===qt.REJECTED&&t[2](this._value),t[0]=!0)}))}}}}function Qt(t){var e=[];function n(t){return e.splice(e.indexOf(t),1)[0]}return{$:e,add:function(r){if(!(void 0===t||e.length<t))return Zt(new $("Not adding Promise because buffer limit was reached."));var i=r();return-1===e.indexOf(i)&&e.push(i),i.then((()=>n(i))).then(null,(()=>n(i).then(null,(()=>{})))),i},drain:function(t){return new Jt(((n,r)=>{let i=e.length;if(!i)return n(!0);var o=setTimeout((()=>{t&&t>0&&n(!1)}),t);e.forEach((t=>{Kt(t).then((()=>{--i||(clearTimeout(o),n(!0))}),r)}))}))}}}function te(t){if(!t)return{};var e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};var n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+r}}var ee=["fatal","error","warning","log","info","debug"];function ne(t){return"warn"===t?"warning":ee.includes(t)?t:"log"}var re={nowSeconds:()=>Date.now()/1e3};var ie=Yt()?function(){try{return function(t,e){return t.require(e)}(t,"perf_hooks").performance}catch{return}}():function(){const{performance:t}=D();if(t&&t.now)return{now:()=>t.now(),timeOrigin:Date.now()-t.now()}}(),oe=void 0===ie?re:{nowSeconds:()=>(ie.timeOrigin+ie.now())/1e3},ae=re.nowSeconds.bind(re),se=oe.nowSeconds.bind(oe);function le(t,e=[]){return[t,e]}function ce(t,e){const[n,r]=t;return[n,[...r,e]]}function ue(t,e){t[1].forEach((t=>{var n=t[0].type;e(t,n)}))}function he(t,e){return(e||new TextEncoder).encode(t)}function de(t,e){const[n,r]=t;let i=JSON.stringify(n);function o(t){"string"==typeof i?i="string"==typeof t?i+t:[he(i,e),t]:i.push("string"==typeof t?he(t,e):t)}for(var a of r){const[t,e]=a;o(`\n${JSON.stringify(t)}\n`),o("string"==typeof e||e instanceof Uint8Array?e:JSON.stringify(e))}return"string"==typeof i?i:function(t){var e=t.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(e);let r=0;for(var i of t)n.set(i,r),r+=i.length;return n}(i)}function fe(t,e){var n="string"==typeof t.data?he(t.data,e):t.data;return[gt({type:"attachment",length:n.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),n]}(()=>{const{performance:t}=D();if(t&&t.now){var e=36e5,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,o=i<e,a=t.timing&&t.timing.navigationStart,s="number"==typeof a?Math.abs(a+n-r):e;(o||s<e)&&(i<=s&&t.timeOrigin)}})();var pe={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default"};function ge(t){return pe[t]}function me(t,{statusCode:e,headers:n},r=Date.now()){var i={...t},o=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(o)for(var s of o.trim().split(",")){const[t,e]=s.split(":",2);var l=parseInt(t,10),c=1e3*(isNaN(l)?60:l);if(e)for(var u of e.split(";"))i[u]=r+c;else i.all=r+c}else a?i.all=r+function(t,e=Date.now()){var n=parseInt(`${t}`,10);if(!isNaN(n))return 1e3*n;var r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}(a,r):429===e&&(i.all=r+6e4);return i}function ve(t){var e=se(),n={sid:Ft(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(t){return gt({sid:`${t.sid}`,init:t.init,started:new Date(1e3*t.started).toISOString(),timestamp:new Date(1e3*t.timestamp).toISOString(),status:t.status,errors:t.errors,did:"number"==typeof t.did||"string"==typeof t.did?`${t.did}`:void 0,duration:t.duration,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}})}(n)};return t&&be(n,t),n}function be(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||se(),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=32===e.sid.length?e.sid:Ft()),void 0!==e.init&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),"number"==typeof e.started&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if("number"==typeof e.duration)t.duration=e.duration;else{var n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),"number"==typeof e.errors&&(t.errors=e.errors),e.status&&(t.status=e.status)}class ye{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={}}static clone(t){var e=new ye;return t&&(e._breadcrumbs=[...t._breadcrumbs],e._tags={...t._tags},e._extra={...t._extra},e._contexts={...t._contexts},e._user=t._user,e._level=t._level,e._span=t._span,e._session=t._session,e._transactionName=t._transactionName,e._fingerprint=t._fingerprint,e._eventProcessors=[...t._eventProcessors],e._requestSession=t._requestSession,e._attachments=[...t._attachments]),e}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{},this._session&&be(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,e){return this._tags={...this._tags,[t]:e},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,e){return this._extra={...this._extra,[t]:e},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,e){return null===e?delete this._contexts[t]:this._contexts={...this._contexts,[t]:e},this._notifyScopeListeners(),this}setSpan(t){return this._span=t,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){var t=this.getSpan();return t&&t.transaction}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;if("function"==typeof t){var e=t(this);return e instanceof ye?e:this}return t instanceof ye?(this._tags={...this._tags,...t._tags},this._extra={...this._extra,...t._extra},this._contexts={...this._contexts,...t._contexts},t._user&&Object.keys(t._user).length&&(this._user=t._user),t._level&&(this._level=t._level),t._fingerprint&&(this._fingerprint=t._fingerprint),t._requestSession&&(this._requestSession=t._requestSession)):H(t)&&(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)),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}addBreadcrumb(t,e){var n="number"==typeof e?Math.min(e,100):100;if(n<=0)return this;var r={timestamp:ae(),...t};return this._breadcrumbs=[...this._breadcrumbs,r].slice(-n),this._notifyScopeListeners(),this}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}getAttachments(){return this._attachments}clearAttachments(){return this._attachments=[],this}applyToEvent(t,e={}){if(this._extra&&Object.keys(this._extra).length&&(t.extra={...this._extra,...t.extra}),this._tags&&Object.keys(this._tags).length&&(t.tags={...this._tags,...t.tags}),this._user&&Object.keys(this._user).length&&(t.user={...this._user,...t.user}),this._contexts&&Object.keys(this._contexts).length&&(t.contexts={...this._contexts,...t.contexts}),this._level&&(t.level=this._level),this._transactionName&&(t.transaction=this._transactionName),this._span){t.contexts={trace:this._span.getTraceContext(),...t.contexts};var n=this._span.transaction&&this._span.transaction.name;n&&(t.tags={transaction:n,...t.tags})}return this._applyFingerprint(t),t.breadcrumbs=[...t.breadcrumbs||[],...this._breadcrumbs],t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...this._sdkProcessingMetadata},this._notifyEventProcessors([...xe(),...this._eventProcessors],t,e)}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...t},this}_notifyEventProcessors(t,e,n,r=0){return new Jt(((i,o)=>{var a=t[r];if(null===e||"function"!=typeof a)i(e);else{var s=a({...e},n);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&a.id&&null===s&&rt.log(`Event processor "${a.id}" dropped event`),U(s)?s.then((e=>this._notifyEventProcessors(t,e,n,r+1).then(i))).then(null,o):this._notifyEventProcessors(t,s,n,r+1).then(i).then(null,o)}}))}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((t=>{t(this)})),this._notifyingListeners=!1)}_applyFingerprint(t){t.fingerprint=t.fingerprint?Ut(t.fingerprint):[],this._fingerprint&&(t.fingerprint=t.fingerprint.concat(this._fingerprint)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}}function xe(){return R("globalEventProcessors",(()=>[]))}function we(t){xe().push(t)}var _e=100;class Se{__init(){this._stack=[{}]}constructor(t,e=new ye,n=4){this._version=n,Se.prototype.__init.call(this),this.getStackTop().scope=e,t&&this.bindClient(t)}isOlderThan(t){return this._version<t}bindClient(t){this.getStackTop().client=t,t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){var t=ye.clone(this.getScope());return this.getStack().push({client:this.getClient(),scope:t}),t}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(t){var e=this.pushScope();try{t(e)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(t,e){var n=this._lastEventId=e&&e.event_id?e.event_id:Ft(),r=new Error("Sentry syntheticException");return this._withClient(((i,o)=>{i.captureException(t,{originalException:t,syntheticException:r,...e,event_id:n},o)})),n}captureMessage(t,e,n){var r=this._lastEventId=n&&n.event_id?n.event_id:Ft(),i=new Error(t);return this._withClient(((o,a)=>{o.captureMessage(t,e,{originalException:t,syntheticException:i,...n,event_id:r},a)})),r}captureEvent(t,e){var n=e&&e.event_id?e.event_id:Ft();return"transaction"!==t.type&&(this._lastEventId=n),this._withClient(((r,i)=>{r.captureEvent(t,{...e,event_id:n},i)})),n}lastEventId(){return this._lastEventId}addBreadcrumb(t,e){const{scope:n,client:r}=this.getStackTop();if(!n||!r)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=_e}=r.getOptions&&r.getOptions()||{};if(!(o<=0)){var a={timestamp:ae(),...t},s=i?et((()=>i(a,e))):a;null!==s&&n.addBreadcrumb(s,o)}}setUser(t){var e=this.getScope();e&&e.setUser(t)}setTags(t){var e=this.getScope();e&&e.setTags(t)}setExtras(t){var e=this.getScope();e&&e.setExtras(t)}setTag(t,e){var n=this.getScope();n&&n.setTag(t,e)}setExtra(t,e){var n=this.getScope();n&&n.setExtra(t,e)}setContext(t,e){var n=this.getScope();n&&n.setContext(t,e)}configureScope(t){const{scope:e,client:n}=this.getStackTop();e&&n&&t(e)}run(t){var e=ke(this);try{t(this)}finally{ke(e)}}getIntegration(t){var e=this.getClient();if(!e)return null;try{return e.getIntegration(t)}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startTransaction(t,e){return this._callExtensionMethod("startTransaction",t,e)}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(t=!1){if(t)return this.endSession();this._sendSessionUpdate()}endSession(){var t=this.getStackTop(),e=t&&t.scope,n=e&&e.getSession();n&&function(t,e){let n={};e?n={status:e}:"ok"===t.status&&(n={status:"exited"}),be(t,n)}(n),this._sendSessionUpdate(),e&&e.setSession()}startSession(t){const{scope:e,client:n}=this.getStackTop(),{release:r,environment:i}=n&&n.getOptions()||{};var o=D();const{userAgent:a}=o.navigator||{};var s=ve({release:r,environment:i,...e&&{user:e.getUser()},...a&&{userAgent:a},...t});if(e){var l=e.getSession&&e.getSession();l&&"ok"===l.status&&be(l,{status:"exited"}),this.endSession(),e.setSession(s)}return s}shouldSendDefaultPii(){var t=this.getClient(),e=t&&t.getOptions();return Boolean(e&&e.sendDefaultPii)}_sendSessionUpdate(){const{scope:t,client:e}=this.getStackTop();if(t){var n=t.getSession();n&&e&&e.captureSession&&e.captureSession(n)}}_withClient(t){const{scope:e,client:n}=this.getStackTop();n&&t(n,e)}_callExtensionMethod(t,...e){var n=Ce().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[t])return n.extensions[t].apply(this,e);(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function Ce(){var t=D();return t.__SENTRY__=t.__SENTRY__||{extensions:{},hub:void 0},t}function ke(t){var e=Ce(),n=Oe(e);return Me(e,t),n}function Te(){var t=Ce();return(!Ee(t)||Oe(t).isOlderThan(4))&&Me(t,new Se),Yt()?function(t){try{var e=Ce().__SENTRY__,n=e&&e.extensions&&e.extensions.domain&&e.extensions.domain.active;if(!n)return Oe(t);if(!Ee(n)||Oe(n).isOlderThan(4)){var r=Oe(t).getStackTop();Me(n,new Se(r.client,ye.clone(r.scope)))}return Oe(n)}catch{return Oe(t)}}(t):Oe(t)}function Ee(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function Oe(t){return R("hub",(()=>new Se),t)}function Me(t,e){return!!t&&((t.__SENTRY__=t.__SENTRY__||{}).hub=e,!0)}function Pe(t,e){return function(t){return Object.keys(t).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`)).join("&")}({sentry_key:t.publicKey,sentry_version:"7",...e&&{sentry_client:`${e.name}/${e.version}`}})}function Ae(t,e={}){var n="string"==typeof e?e:e.tunnel,r="string"!=typeof e&&e._metadata?e._metadata.sdk:void 0;return n||`${function(t){return`${function(t){var e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}(t)}${t.projectId}/envelope/`}(t)}?${Pe(t,r)}`}function je(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function De(t,e,n,r){var i=je(n),o=t.type||"event";!function(t,e){e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]])}(t,n&&n.sdk);var a=function(t,e,n,r){var i=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:(new Date).toISOString(),...e&&{sdk:e},...!!n&&{dsn:K(r)},..."transaction"===t.type&&i&&{trace:gt({...i})}}}(t,i,r,e);return delete t.sdkProcessingMetadata,le(a,[[{type:o},t]])}var Re=[];function Ie(t){var e=t.defaultIntegrations||[],n=t.integrations;let r;e.forEach((t=>{t.isDefaultInstance=!0})),r=Array.isArray(n)?[...e,...n]:"function"==typeof n?Ut(n(e)):e;var i=function(t){var e={};return t.forEach((t=>{const{name:n}=t;var r=e[n];r&&!r.isDefaultInstance&&t.isDefaultInstance||(e[n]=t)})),Object.values(e)}(r),o=i.findIndex((t=>"Debug"===t.name));if(-1!==o){const[t]=i.splice(o,1);i.push(t)}return i}var Le="Not capturing exception because it's already been captured.";class ze{__init(){this._integrations={}}__init2(){this._integrationsInitialized=!1}__init3(){this._numProcessing=0}__init4(){this._outcomes={}}constructor(t){if(ze.prototype.__init.call(this),ze.prototype.__init2.call(this),ze.prototype.__init3.call(this),ze.prototype.__init4.call(this),this._options=t,t.dsn){this._dsn=J(t.dsn);var e=Ae(this._dsn,t);this._transport=t.transport({recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:e})}else(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("No DSN provided, client will not do anything.")}captureException(t,e,n){if(Wt(t))return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log(Le));let r=e&&e.event_id;return this._process(this.eventFromException(t,e).then((t=>this._captureEvent(t,e,n))).then((t=>{r=t}))),r}captureMessage(t,e,n,r){let i=n&&n.event_id;var o=V(t)?this.eventFromMessage(String(t),e,n):this.eventFromException(t,n);return this._process(o.then((t=>this._captureEvent(t,n,r))).then((t=>{i=t}))),i}captureEvent(t,e,n){if(e&&e.originalException&&Wt(e.originalException))return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log(Le));let r=e&&e.event_id;return this._process(this._captureEvent(t,e,n).then((t=>{r=t}))),r}captureSession(t){this._isEnabled()?"string"!=typeof t.release?(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("Discarded session because of missing or non-string release"):(this.sendSession(t),be(t,{init:!1})):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("SDK not enabled, will not capture session.")}getDsn(){return this._dsn}getOptions(){return this._options}getTransport(){return this._transport}flush(t){var e=this._transport;return e?this._isClientDoneProcessing(t).then((n=>e.flush(t).then((t=>n&&t)))):Kt(!0)}close(t){return this.flush(t).then((t=>(this.getOptions().enabled=!1,t)))}setupIntegrations(){this._isEnabled()&&!this._integrationsInitialized&&(this._integrations=function(t){var e={};return t.forEach((t=>{e[t.name]=t,-1===Re.indexOf(t.name)&&(t.setupOnce(we,Te),Re.push(t.name),(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log(`Integration installed: ${t.name}`))})),e}(this._options.integrations),this._integrationsInitialized=!0)}getIntegrationById(t){return this._integrations[t]}getIntegration(t){try{return this._integrations[t.id]||null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Cannot retrieve integration ${t.id} from the current Client`),null}}sendEvent(t,e={}){if(this._dsn){let r=De(t,this._dsn,this._options._metadata,this._options.tunnel);for(var n of e.attachments||[])r=ce(r,fe(n,this._options.transportOptions&&this._options.transportOptions.textEncoder));this._sendEnvelope(r)}}sendSession(t){if(this._dsn){var e=function(t,e,n,r){var i=je(n);return le({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&{dsn:K(e)}},["aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t]])}(t,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(e)}}recordDroppedEvent(t,e){if(this._options.sendClientReports){var n=`${t}:${e}`;(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log(`Adding outcome: "${n}"`),this._outcomes[n]=this._outcomes[n]+1||1}}_updateSessionFromEvent(t,e){let n=!1,r=!1;var i=e.exception&&e.exception.values;if(i)for(var o of(r=!0,i)){var a=o.mechanism;if(a&&!1===a.handled){n=!0;break}}var s="ok"===t.status;(s&&0===t.errors||s&&n)&&(be(t,{...n&&{status:"crashed"},errors:t.errors||Number(r||n)}),this.captureSession(t))}_isClientDoneProcessing(t){return new Jt((e=>{let n=0;var r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),e(!0)):(n+=1,t&&n>=t&&(clearInterval(r),e(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._dsn}_prepareEvent(t,e,n){const{normalizeDepth:r=3,normalizeMaxBreadth:i=1e3}=this.getOptions();var o={...t,event_id:t.event_id||e.event_id||Ft(),timestamp:t.timestamp||ae()};this._applyClientOptions(o),this._applyIntegrationsMetadata(o);let a=n;e.captureContext&&(a=ye.clone(a).update(e.captureContext));let s=Kt(o);if(a){var l=[...e.attachments||[],...a.getAttachments()];l.length&&(e.attachments=l),s=a.applyToEvent(o,e)}return s.then((t=>"number"==typeof r&&r>0?this._normalizeEvent(t,r,i):t))}_normalizeEvent(t,e,n){if(!t)return null;var r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map((t=>({...t,...t.data&&{data:Xt(t.data,e,n)}})))},...t.user&&{user:Xt(t.user,e,n)},...t.contexts&&{contexts:Xt(t.contexts,e,n)},...t.extra&&{extra:Xt(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Xt(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map((t=>(t.data&&(t.data=Xt(t.data,e,n)),t)))),r}_applyClientOptions(t){var e=this.getOptions();const{environment:n,release:r,dist:i,maxValueLength:o=250}=e;"environment"in t||(t.environment="environment"in e?n:"production"),void 0===t.release&&void 0!==r&&(t.release=r),void 0===t.dist&&void 0!==i&&(t.dist=i),t.message&&(t.message=it(t.message,o));var a=t.exception&&t.exception.values&&t.exception.values[0];a&&a.value&&(a.value=it(a.value,o));var s=t.request;s&&s.url&&(s.url=it(s.url,o))}_applyIntegrationsMetadata(t){var e=Object.keys(this._integrations);e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}_captureEvent(t,e={},n){return this._processEvent(t,e,n).then((t=>t.event_id),(t=>{if(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__){var e=t;"log"===e.logLevel?rt.log(e.message):rt.warn(e)}}))}_processEvent(t,e,n){const{beforeSend:r,sampleRate:i}=this.getOptions();if(!this._isEnabled())return Zt(new $("SDK not enabled, will not capture event.","log"));var o="transaction"===t.type;return!o&&"number"==typeof i&&Math.random()>i?(this.recordDroppedEvent("sample_rate","error"),Zt(new $(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"))):this._prepareEvent(t,e,n).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",t.type||"error"),new $("An event processor returned null, will not send event.","log");return e.data&&!0===e.data.__sentry__||o||!r?n:function(t){var e="`beforeSend` method has to return `null` or a valid event.";if(U(t))return t.then((t=>{if(!H(t)&&null!==t)throw new $(e);return t}),(t=>{throw new $(`beforeSend rejected with ${t}`)}));if(!H(t)&&null!==t)throw new $(e);return t}(r(n,e))})).then((r=>{if(null===r)throw this.recordDroppedEvent("before_send",t.type||"error"),new $("`beforeSend` returned `null`, will not send event.","log");var i=n&&n.getSession();!o&&i&&this._updateSessionFromEvent(i,r);var a=r.transaction_info;if(o&&a&&r.transaction!==t.transaction){var s="custom";r.transaction_info={...a,source:s,changes:[...a.changes,{source:s,timestamp:r.timestamp,propagations:a.propagations}]}}return this.sendEvent(r,e),r})).then(null,(t=>{throw t instanceof $?t:(this.captureException(t,{data:{__sentry__:!0},originalException:t}),new $(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`))}))}_process(t){this._numProcessing+=1,t.then((t=>(this._numProcessing-=1,t)),(t=>(this._numProcessing-=1,t)))}_sendEnvelope(t){this._transport&&this._dsn?this._transport.send(t).then(null,(t=>{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error("Error while sending event:",t)})):(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error("Transport disabled")}_clearOutcomes(){var t=this._outcomes;return this._outcomes={},Object.keys(t).map((e=>{const[n,r]=e.split(":");return{reason:n,category:r,quantity:t[e]}}))}}function Fe(t,e,n=Qt(t.bufferSize||30)){let r={};return{send:function(i){var o=[];if(ue(i,((e,n)=>{var i=ge(n);!function(t,e,n=Date.now()){return function(t,e){return t[e]||t.all||0}(t,e)>n}(r,i)?o.push(e):t.recordDroppedEvent("ratelimit_backoff",i)})),0===o.length)return Kt();var a=le(i[0],o),s=e=>{ue(a,((n,r)=>{t.recordDroppedEvent(e,ge(r))}))};return n.add((()=>e({body:de(a,t.textEncoder)}).then((t=>{void 0!==t.statusCode&&(t.statusCode<200||t.statusCode>=300)&&(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Sentry responded with status code ${t.statusCode} to sent event.`),r=me(r,t)}),(t=>{(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error("Failed while sending event:",t),s("network_error")})))).then((t=>t),(t=>{if(t instanceof $)return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error("Skipped sending event because buffer is full."),s("queue_overflow"),Kt();throw t}))},flush:t=>n.drain(t)}}var Ne="7.14.0";let Be;class Ve{constructor(){Ve.prototype.__init.call(this)}static __initStatic(){this.id="FunctionToString"}__init(){this.name=Ve.id}setupOnce(){Be=Function.prototype.toString,Function.prototype.toString=function(...t){var e=ut(this)||this;return Be.apply(e,t)}}}Ve.__initStatic();var He=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/];class We{static __initStatic(){this.id="InboundFilters"}__init(){this.name=We.id}constructor(t={}){this._options=t,We.prototype.__init.call(this)}setupOnce(t,e){var n=t=>{var n=e();if(n){var r=n.getIntegration(We);if(r){var i=n.getClient(),o=i?i.getOptions():{},a=function(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...He],ignoreInternal:void 0===t.ignoreInternal||t.ignoreInternal}}(r._options,o);return function(t,e){return e.ignoreInternal&&function(t){try{return"SentryError"===t.exception.values[0].type}catch{}return!1}(t)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${Bt(t)}`),!0):function(t,e){return!(!e||!e.length)&&function(t){if(t.message)return[t.message];if(t.exception)try{const{type:e="",value:n=""}=t.exception.values&&t.exception.values[0]||{};return[`${n}`,`${e}: ${n}`]}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error(`Cannot extract message for event ${Bt(t)}`),[]}return[]}(t).some((t=>e.some((e=>at(t,e)))))}(t,e.ignoreErrors)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Bt(t)}`),!0):function(t,e){if(!e||!e.length)return!1;var n=Ue(t);return!!n&&e.some((t=>at(n,t)))}(t,e.denyUrls)?((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Bt(t)}.\nUrl: ${Ue(t)}`),!0):!function(t,e){if(!e||!e.length)return!0;var n=Ue(t);return!n||e.some((t=>at(n,t)))}(t,e.allowUrls)&&((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Bt(t)}.\nUrl: ${Ue(t)}`),!0)}(t,a)?null:t}}return t};n.id=this.name,t(n)}}function Ue(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?function(t=[]){for(let n=t.length-1;n>=0;n--){var e=t[n];if(e&&"<anonymous>"!==e.filename&&"[native code]"!==e.filename)return e.filename||null}return null}(e):null}catch{return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error(`Cannot extract url for event ${Bt(t)}`),null}}function Ye(t,e){var n=Ge(t,e),r={type:e&&e.name,value:qe(e)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Xe(t,e){return{exception:{values:[Ye(t,e)]}}}function Ge(t,e){var n=e.stacktrace||e.stack||"",r=function(t){if(t){if("number"==typeof t.framesToPop)return t.framesToPop;if($e.test(t.message))return 1}return 0}(e);try{return t(n,r)}catch{}return[]}We.__initStatic();var $e=/Minified React error #\d+;/i;function qe(t){var e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}function Ke(t,e,n,r,i){let o;if(F(e)&&e.error)return Xe(t,e.error);if(N(e)||function(t){return z(t,"DOMException")}(e)){var a=e;if("stack"in e)o=Xe(t,e);else{var s=a.name||(N(a)?"DOMError":"DOMException"),l=a.message?`${s}: ${a.message}`:s;o=Ze(t,l,n,r),Vt(o,l)}return"code"in a&&(o.tags={...o.tags,"DOMException.code":`${a.code}`}),o}return L(e)?Xe(t,e):H(e)||W(e)?(o=function(t,e,n,r){var i=Te().getClient(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:W(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:`Non-Error ${r?"promise rejection":"exception"} captured with keys: ${pt(e)}`}]},extra:{__serialized__:Gt(e,o)}};if(n){var s=Ge(t,n);s.length&&(a.exception.values[0].stacktrace={frames:s})}return a}(t,e,n,i),Ht(o,{synthetic:!0}),o):(o=Ze(t,e,n,r),Vt(o,`${e}`,void 0),Ht(o,{synthetic:!0}),o)}function Ze(t,e,n,r){var i={message:e};if(r&&n){var o=Ge(t,n);o.length&&(i.exception={values:[{value:e,stacktrace:{frames:o}}]})}return i}var Je="Breadcrumbs";class Qe{static __initStatic(){this.id=Je}__init(){this.name=Qe.id}constructor(t){Qe.prototype.__init.call(this),this.options={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t}}setupOnce(){this.options.console&&Et("console",tn),this.options.dom&&Et("dom",function(t){function e(e){let n,r="object"==typeof t?t.serializeAttribute:void 0;"string"==typeof r&&(r=[r]);try{n=e.event.target?X(e.event.target,r):X(e.event,r)}catch{n="<unknown>"}0!==n.length&&Te().addBreadcrumb({category:`ui.${e.name}`,message:n},{event:e.event,name:e.name,global:e.global})}return e}(this.options.dom)),this.options.xhr&&Et("xhr",en),this.options.fetch&&Et("fetch",nn),this.options.history&&Et("history",rn)}}function tn(t){var e={category:"console",data:{arguments:t.args,logger:"console"},level:ne(t.level),message:ot(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;e.message=`Assertion failed: ${ot(t.args.slice(1)," ")||"console.assert"}`,e.data.arguments=t.args.slice(1)}Te().addBreadcrumb(e,{input:t.args,level:t.level})}function en(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;const{method:e,url:n,status_code:r,body:i}=t.xhr.__sentry_xhr__||{};Te().addBreadcrumb({category:"xhr",data:{method:e,url:n,status_code:r},type:"http"},{xhr:t.xhr,input:i})}else;}function nn(t){!t.endTimestamp||t.fetchData.url.match(/sentry_key/)&&"POST"===t.fetchData.method||(t.error?Te().addBreadcrumb({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args}):Te().addBreadcrumb({category:"fetch",data:{...t.fetchData,status_code:t.response.status},type:"http"},{input:t.args,response:t.response}))}function rn(t){var e=D();let n=t.from,r=t.to;var i=te(e.location.href);let o=te(n);var a=te(r);o.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Te().addBreadcrumb({category:"navigation",data:{from:n,to:r}})}Qe.__initStatic();var on=D();class an extends ze{constructor(t){t._metadata=t._metadata||{},t._metadata.sdk=t._metadata.sdk||{name:"sentry.javascript.browser",packages:[{name:"npm:@sentry/browser",version:Ne}],version:Ne},super(t),t.sendClientReports&&on.document&&on.document.addEventListener("visibilitychange",(()=>{"hidden"===on.document.visibilityState&&this._flushOutcomes()}))}eventFromException(t,e){return function(t,e,n,r){var i=Ke(t,e,n&&n.syntheticException||void 0,r);return Ht(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),Kt(i)}(this._options.stackParser,t,e,this._options.attachStacktrace)}eventFromMessage(t,e="info",n){return function(t,e,n="info",r,i){var o=Ze(t,e,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Kt(o)}(this._options.stackParser,t,e,n,this._options.attachStacktrace)}sendEvent(t,e){var n=this.getIntegrationById(Je);n&&n.options&&n.options.sentry&&Te().addBreadcrumb({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Bt(t)},{event:t}),super.sendEvent(t,e)}_prepareEvent(t,e,n){return t.platform=t.platform||"javascript",super._prepareEvent(t,e,n)}_flushOutcomes(){var t=this._clearOutcomes();if(0!==t.length)if(this._dsn){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log("Sending outcomes:",t);var e=Ae(this._dsn,this._options),n=function(t,e,n){return le(e?{dsn:e}:{},[[{type:"client_report"},{timestamp:n||ae(),discarded_events:t}]])}(t,this._options.tunnel&&K(this._dsn));try{var r=D();if("[object Navigator]"===Object.prototype.toString.call(r&&r.navigator)&&"function"==typeof r.navigator.sendBeacon&&!this._options.transportOptions)r.navigator.sendBeacon.bind(r.navigator)(e,de(n));else this._sendEnvelope(n)}catch(i){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.error(i)}}else(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log("No dsn provided, will not send outcomes");else(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log("No outcomes to send")}}var sn=D();let ln;function cn(t,e=function(){if(ln)return ln;if(_t(sn.fetch))return ln=sn.fetch.bind(sn);var t=sn.document;let e=sn.fetch;if(t&&"function"==typeof t.createElement)try{var n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n);var r=n.contentWindow;r&&r.fetch&&(e=r.fetch),t.head.removeChild(n)}catch(i){(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",i)}return ln=e.bind(sn)}()){return Fe(t,(function(n){var r={body:n.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n.body.length<=65536,...t.fetchOptions};return e(t.url,r).then((t=>({statusCode:t.status,headers:{"x-sentry-rate-limits":t.headers.get("X-Sentry-Rate-Limits"),"retry-after":t.headers.get("Retry-After")}})))}))}function un(t){return Fe(t,(function(e){return new Jt(((n,r)=>{var i=new XMLHttpRequest;for(var o in i.onerror=r,i.onreadystatechange=()=>{4===i.readyState&&n({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":i.getResponseHeader("Retry-After")}})},i.open("POST",t.url),t.headers)Object.prototype.hasOwnProperty.call(t.headers,o)&&i.setRequestHeader(o,t.headers[o]);i.send(e.body)}))}))}var hn="?";function dn(t,e,n,r){var i={filename:t,function:e,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}var fn=/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pn=/\((\S*)(?::(\d+))(?::(\d+))\)/,gn=[30,t=>{var e=fn.exec(t);if(e){if(e[2]&&0===e[2].indexOf("eval")){var n=pn.exec(e[2]);n&&(e[2]=n[1],e[3]=n[2],e[4]=n[3])}const[t,r]=_n(e[1]||hn,e[2]);return dn(r,t,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}}],mn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,vn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,bn=[50,t=>{var e=mn.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var n=vn.exec(e[3]);n&&(e[1]=e[1]||"eval",e[3]=n[1],e[4]=n[2],e[5]="")}let t=e[3],r=e[1]||hn;return[r,t]=_n(r,t),dn(t,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}],yn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,xn=[40,t=>{var e=yn.exec(t);return e?dn(e[2],e[1]||hn,+e[3],e[4]?+e[4]:void 0):void 0}],wn=vt(...[gn,bn,xn]),_n=(t,e)=>{var n=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return n||r?[-1!==t.indexOf("@")?t.split("@")[0]:hn,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};let Sn=0;function Cn(){return Sn>0}function kn(t,e={},n){if("function"!=typeof t)return t;try{var r=t.__sentry_wrapped__;if(r)return r;if(ut(t))return t}catch{return t}var i=function(){var r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);var i=r.map((t=>kn(t,e)));return t.apply(this,i)}catch(o){throw Sn+=1,setTimeout((()=>{Sn-=1})),function(t){Te().withScope(t)}((t=>{t.addEventProcessor((t=>(e.mechanism&&(Vt(t,void 0,void 0),Ht(t,e.mechanism)),t.extra={...t.extra,arguments:r},t))),function(t,e){Te().captureException(t,{captureContext:e})}(o)})),o}};try{for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}catch{}ct(i,t),lt(t,"__sentry_wrapped__",i);try{Object.getOwnPropertyDescriptor(i,"name").configurable&&Object.defineProperty(i,"name",{get:()=>t.name})}catch{}return i}class Tn{static __initStatic(){this.id="GlobalHandlers"}__init(){this.name=Tn.id}__init2(){this._installFunc={onerror:En,onunhandledrejection:On}}constructor(t){Tn.prototype.__init.call(this),Tn.prototype.__init2.call(this),this._options={onerror:!0,onunhandledrejection:!0,...t}}setupOnce(){Error.stackTraceLimit=50;var t,e=this._options;for(var n in e){var r=this._installFunc[n];r&&e[n]&&(t=n,(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.log(`Global Handler attached: ${t}`),r(),this._installFunc[n]=void 0)}}}function En(){Et("error",(t=>{const[e,n,r]=An();if(!e.getIntegration(Tn))return;const{msg:i,url:o,line:a,column:s,error:l}=t;if(!(Cn()||l&&l.__sentry_own_request__)){var c=void 0===l&&B(i)?function(t,e,n,r){var i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=F(t)?t.message:t,a="Error";var s=o.match(i);s&&(a=s[1],o=s[2]);var l={exception:{values:[{type:a,value:o}]}};return Mn(l,e,n,r)}(i,o,a,s):Mn(Ke(n,l||i,void 0,r,!1),o,a,s);c.level="error",Pn(e,l,c,"onerror")}}))}function On(){Et("unhandledrejection",(t=>{const[e,n,r]=An();if(!e.getIntegration(Tn))return;let i=t;try{"reason"in t?i=t.reason:"detail"in t&&"reason"in t.detail&&(i=t.detail.reason)}catch{}if(Cn()||i&&i.__sentry_own_request__)return!0;var o=V(i)?function(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}(i):Ke(n,i,void 0,r,!0);o.level="error",Pn(e,i,o,"onunhandledrejection")}))}function Mn(t,e,n,r){var i=t.exception=t.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},l=s.frames=s.frames||[],c=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,h=B(e)&&e.length>0?e:function(){var t=D();try{return t.document.location.href}catch{return""}}();return 0===l.length&&l.push({colno:c,filename:h,function:"?",in_app:!0,lineno:u}),t}function Pn(t,e,n,r){Ht(n,{handled:!1,type:r}),t.captureEvent(n,{originalException:e})}function An(){var t=Te(),e=t.getClient(),n=e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1};return[t,n.stackParser,n.attachStacktrace]}Tn.__initStatic();var jn=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];class Dn{static __initStatic(){this.id="TryCatch"}__init(){this.name=Dn.id}constructor(t){Dn.prototype.__init.call(this),this._options={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t}}setupOnce(){var t=D();this._options.setTimeout&&st(t,"setTimeout",Rn),this._options.setInterval&&st(t,"setInterval",Rn),this._options.requestAnimationFrame&&st(t,"requestAnimationFrame",In),this._options.XMLHttpRequest&&"XMLHttpRequest"in t&&st(XMLHttpRequest.prototype,"send",Ln);var e=this._options.eventTarget;e&&(Array.isArray(e)?e:jn).forEach(zn)}}function Rn(t){return function(...e){var n=e[0];return e[0]=kn(n,{mechanism:{data:{function:xt(t)},handled:!0,type:"instrument"}}),t.apply(this,e)}}function In(t){return function(e){return t.apply(this,[kn(e,{mechanism:{data:{function:"requestAnimationFrame",handler:xt(t)},handled:!0,type:"instrument"}})])}}function Ln(t){return function(...e){var n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((t=>{t in n&&"function"==typeof n[t]&&st(n,t,(function(e){var n={mechanism:{data:{function:t,handler:xt(e)},handled:!0,type:"instrument"}},r=ut(e);return r&&(n.mechanism.data.handler=xt(r)),kn(e,n)}))})),t.apply(this,e)}}function zn(t){var e=D(),n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(st(n,"addEventListener",(function(e){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=kn(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:xt(r),target:t},handled:!0,type:"instrument"}}))}catch{}return e.apply(this,[n,kn(r,{mechanism:{data:{function:"addEventListener",handler:xt(r),target:t},handled:!0,type:"instrument"}}),i])}})),st(n,"removeEventListener",(function(t){return function(e,n,r){var i=n;try{var o=i&&i.__sentry_wrapped__;o&&t.call(this,e,o,r)}catch{}return t.call(this,e,i,r)}})))}Dn.__initStatic();class Fn{static __initStatic(){this.id="LinkedErrors"}__init(){this.name=Fn.id}constructor(t={}){Fn.prototype.__init.call(this),this._key=t.key||"cause",this._limit=t.limit||5}setupOnce(){var t=Te().getClient();!t||we(((e,n)=>{var r=Te().getIntegration(Fn);return r?function(t,e,n,r,i){if(!r.exception||!r.exception.values||!i||!Y(i.originalException,Error))return r;var o=Nn(t,n,i.originalException,e);return r.exception.values=[...o,...r.exception.values],r}(t.getOptions().stackParser,r._key,r._limit,e,n):e}))}}function Nn(t,e,n,r,i=[]){if(!Y(n[r],Error)||i.length+1>=e)return i;var o=Ye(t,n[r]);return Nn(t,e,n[r],r,[o,...i])}Fn.__initStatic();var Bn=D();class Vn{constructor(){Vn.prototype.__init.call(this)}static __initStatic(){this.id="HttpContext"}__init(){this.name=Vn.id}setupOnce(){we((t=>{if(Te().getIntegration(Vn)){if(!Bn.navigator&&!Bn.location&&!Bn.document)return t;var e=t.request&&t.request.url||Bn.location&&Bn.location.href;const{referrer:r}=Bn.document||{},{userAgent:i}=Bn.navigator||{};var n={...e&&{url:e},headers:{...t.request&&t.request.headers,...r&&{Referer:r},...i&&{"User-Agent":i}}};return{...t,request:n}}return t}))}}Vn.__initStatic();class Hn{constructor(){Hn.prototype.__init.call(this)}static __initStatic(){this.id="Dedupe"}__init(){this.name=Hn.id}setupOnce(t,e){var n=t=>{var n=e().getIntegration(Hn);if(n){try{if(function(t,e){return!!e&&!(!function(t,e){var n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Un(t,e)||!Wn(t,e))}(t,e)&&!function(t,e){var n=Yn(e),r=Yn(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Un(t,e)||!Wn(t,e))}(t,e))}(t,n._previousEvent))return(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{return n._previousEvent=t}return n._previousEvent=t}return t};n.id=this.name,t(n)}}function Wn(t,e){let n=Xn(t),r=Xn(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||r.length!==n.length)return!1;for(let a=0;a<r.length;a++){var i=r[a],o=n[a];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function Un(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return n.join("")===r.join("")}catch{return!1}}function Yn(t){return t.exception&&t.exception.values&&t.exception.values[0]}function Xn(t){var e=t.exception;if(e)try{return e.values[0].stacktrace.frames}catch{return}}Hn.__initStatic();var Gn=[new We,new Ve,new Dn,new Qe,new Tn,new Fn,new Hn,new Vn];function $n(t={}){if(void 0===t.defaultIntegrations&&(t.defaultIntegrations=Gn),void 0===t.release){var e=D();e.SENTRY_RELEASE&&e.SENTRY_RELEASE.id&&(t.release=e.SENTRY_RELEASE.id)}void 0===t.autoSessionTracking&&(t.autoSessionTracking=!0),void 0===t.sendClientReports&&(t.sendClientReports=!0);var n={...t,stackParser:bt(t.stackParser||wn),integrations:Ie(t),transport:t.transport||(wt()?cn:un)};(function(t,e){!0===e.debug&&(typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__?rt.enable():console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle."));var n=Te(),r=n.getScope();r&&r.update(e.initialScope);var i=new t(e);n.bindClient(i)})(an,n),t.autoSessionTracking&&function(){var t=D(),e=t.document;if(typeof e>"u")return void((typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__)&&rt.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));var n=Te();!n.captureSession||(qn(n),Et("history",(({from:t,to:e})=>{void 0===t||t===e||qn(Te())})))}()}function qn(t){t.startSession({ignoreDuration:!0}),t.captureSession()}var Kn={exports:{}},Zn={},Jn=i,Qn=Symbol.for("react.element"),tr=Symbol.for("react.fragment"),er=Object.prototype.hasOwnProperty,nr=Jn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0};function ir(t,e,n){var r,i={},o=null,a=null;for(r in void 0!==n&&(o=""+n),void 0!==e.key&&(o=""+e.key),void 0!==e.ref&&(a=e.ref),e)er.call(e,r)&&!rr.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===i[r]&&(i[r]=e[r]);return{$$typeof:Qn,type:t,key:o,ref:a,props:i,_owner:nr.current}}Zn.Fragment=tr,Zn.jsx=ir,Zn.jsxs=ir,Kn.exports=Zn;const or=Kn.exports.Fragment,ar=Kn.exports.jsx,sr=Kn.exports.jsxs;var lr=(t=>(t.INLINE="inline",t.OVERLAY="overlay",t))(lr||{}),cr=(t=>(t.TOP="top",t.BOTTOM="bottom",t.HIDDEN="",t))(cr||{});function ur(t,e){return{...e,message:t}}const hr=[{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}],dr={emoticons:ur("Emoticons"),doodles:ur("Doodles"),landmarks:ur("Landmarks"),bubbles:ur("Bubbles"),transportation:ur("Transportation"),beach:ur("Beach")},fr={fill:"#1565C0",opacity:1,backgroundColor:null,strokeWidth:.05,stroke:"#000"},pr=[1,8,15,20,25];var gr=(t=>(t.DARK="dark",t.LIGHT="light",t))(gr||{});const mr=[{name:gr.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:gr.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 vr=(t=>(t.FILTER="filter",t.RESIZE="resize",t.CROP="crop",t.DRAW="draw",t.TEXT="text",t.SHAPES="shapes",t.STICKERS="stickers",t.FRAME="frame",t.CORNERS="corners",t.MERGE="merge",t))(vr||{});function br(t){var e,n,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=br(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function yr(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=br(t))&&(r&&(r+=" "),r+=e);return r}const xr=(0,i.forwardRef)(((t,e)=>{const{attr:n,size:r,title:i,className:o,color:a,style:s,children:l,viewBox:c,width:u,height:h,...d}=t;return sr("svg",{"aria-hidden":!i,focusable:!1,xmlns:"http://www.w3.org/2000/svg",viewBox:c||"0 0 24 24",...n,...d,className:yr("svg-icon",o,wr(r)),style:{color:a,...s},ref:e,height:h||"1em",width:u||"1em",children:[i&&ar("title",{children:i}),l]})}));function wr(t){switch(t){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""}}function _r(t,e="",n){return i.memo(i.forwardRef(((r,i)=>ar(xr,{"data-testid":`${e}Icon`,ref:i,viewBox:n,...r,size:r.size||"md",children:t}))))}function Sr(t,e=""){return _r(Cr(t),e)}function Cr(t){return(null==t?void 0:t.map)&&t.map(((t,e)=>i.createElement(t.tag,{key:e,...t.attr},Cr(t.child))))}const kr=_r(ar("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}),"TuneOutlined"),Tr=_r(ar("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"),Er=_r(ar("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}),"CropOutlined"),Or=_r(ar("path",{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}),"TextFieldsOutlined"),Mr=_r(ar("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"),Pr=_r(ar("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"),Ar=_r(ar("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"),jr=_r(ar("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"),Dr=_r(ar("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"),Rr=_r(ar("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"),Ir=_r(ar("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"),Lr=_r([ar("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"),ar("circle",{cx:"11",cy:"9",r:"1"},"1"),ar("path",{d:"M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z"},"2")],"StyleOutlined"),zr=_r(ar("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"),Fr=_r(ar("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"),Nr=_r(ar("path",{d:"m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}),"HomeOutlined"),Br={[vr.FILTER]:{name:ur("Applied Filters"),icon:kr},[vr.RESIZE]:{name:ur("Resized Image"),icon:Tr},[vr.CROP]:{name:ur("Cropped Image"),icon:Er},[vr.DRAW]:{name:ur("Added Drawing"),icon:Fr},[vr.TEXT]:{name:ur("Added Text"),icon:Or},[vr.SHAPES]:{name:ur("Added Shape"),icon:Mr},[vr.STICKERS]:{name:ur("Added Sticker"),icon:Pr},[vr.FRAME]:{name:ur("Added Frame"),icon:Ar},[vr.MERGE]:{name:ur("Merged Objects"),icon:jr},[vr.CORNERS]:{name:ur("Rounded Corner"),icon:Dr},bgImage:{name:ur("Replaced Background Image"),icon:Rr},overlayImage:{name:ur("Added Image"),icon:Rr},initial:{name:ur("Initial"),icon:Nr},loadedState:{name:ur("Loaded State"),icon:Ir},objectStyle:{name:ur("Changed Style"),icon:Lr},deletedObject:{name:ur("Deleted object"),icon:zr}},Vr=Object.values(vr).map((t=>({name:t,icon:Br[t].icon,action:t===vr.MERGE?t=>{t.tools.merge.apply()}:t}))),Hr={filter:ur("Filter"),resize:ur("Resize"),crop:ur("Crop"),draw:ur("Draw"),text:ur("Text"),shapes:ur("Shapes"),Stickers:ur("Stickers"),frame:ur("Frame"),corners:ur("Corners"),merge:ur("Merge")},Wr=_r(ar("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"),Ur="3.0.3",Yr={selector:"pixie-editor",textureSize:4096,activeLanguage:"en",ui:{visible:!0,mode:lr.INLINE,forceOverlayModeOnMobile:!0,activeTheme:gr.LIGHT,themes:mr,allowEditorClose:!0,menubar:{items:[{type:"undoWidget",align:"left"},{type:"zoomWidget",align:"center",desktopOnly:!0},{type:"button",icon:Ir,align:"right",desktopOnly:!0,action:t=>{t.togglePanel("history")}},{type:"button",icon:Wr,label:ur("Done"),align:"right",action:t=>{var e;null!=(e=t.state.config.ui)&&e.showExportPanel?t.state.togglePanel("export",!0):t.tools.export.save("image")}}]},nav:{position:cr.BOTTOM,items:[...Vr]},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:{...fr},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",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:pr,brushTypes:["PencilBrush","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:hr},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}}]}}},Xr=t=>{let e;const n=new Set,r=(t,r)=>{const i="function"==typeof t?t(e):t;if(i!==e){const t=e;e=(null!=r?r:"object"!=typeof i)?i:Object.assign({},e,i),n.forEach((n=>n(e,t)))}},i=()=>e,o={setState:r,getState:i,subscribe:t=>(n.add(t),()=>n.delete(t)),destroy:()=>n.clear()};return e=t(r,i,o),o};var Gr={exports:{}},$r={},qr={exports:{}},Kr={},Zr=i;var Jr="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e},Qr=Zr.useState,ti=Zr.useEffect,ei=Zr.useLayoutEffect,ni=Zr.useDebugValue;function ri(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Jr(t,n)}catch{return!0}}var ii=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(t,e){return e()}:function(t,e){var n=e(),r=Qr({inst:{value:n,getSnapshot:e}}),i=r[0].inst,o=r[1];return ei((function(){i.value=n,i.getSnapshot=e,ri(i)&&o({inst:i})}),[t,n,e]),ti((function(){return ri(i)&&o({inst:i}),t((function(){ri(i)&&o({inst:i})}))}),[t]),ni(n),n};Kr.useSyncExternalStore=void 0!==Zr.useSyncExternalStore?Zr.useSyncExternalStore:ii,function(t){t.exports=Kr}(qr);var oi=i,ai=qr.exports;var si="function"==typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e},li=ai.useSyncExternalStore,ci=oi.useRef,ui=oi.useEffect,hi=oi.useMemo,di=oi.useDebugValue;$r.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var o=ci(null);if(null===o.current){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=hi((function(){function t(t){if(!l){if(l=!0,o=t,t=r(t),void 0!==i&&a.hasValue){var e=a.value;if(i(e,t))return s=e}return s=t}if(e=s,si(o,t))return e;var n=r(t);return void 0!==i&&i(e,n)?e:(o=t,s=n)}var o,s,l=!1,c=void 0===n?null:n;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,n,r,i]);var s=li(t,o[0],o[1]);return ui((function(){a.hasValue=!0,a.value=s}),[s]),di(s),s},function(t){t.exports=$r}(Gr);const fi=h(Gr.exports),{useSyncExternalStoreWithSelector:pi}=fi;const gi=t=>{const e="function"==typeof t?(t=>t?Xr(t):Xr)(t):t,n=(t,n)=>function(t,e=t.getState,n){const r=pi(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return(0,i.useDebugValue)(r),r}(e,t,n);return Object.assign(n,e),n};var mi=t=>t?gi(t):gi;const vi=t=>(e,n,r)=>{const i=r.subscribe;return r.subscribe=(t,e,n)=>{let o=t;if(e){const i=(null==n?void 0:n.equalityFn)||Object.is;let a=t(r.getState());o=n=>{const r=t(n);if(!i(a,r)){const t=a;e(a=r,t)}},null!=n&&n.fireImmediately&&e(a,a)}return i(o)},t(e,n,r)};function bi(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+t+(n.length?" "+n.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function yi(t){return!!t&&!!t[io]}function xi(t){return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===oo}(t)||Array.isArray(t)||!!t[ro]||!!t.constructor[ro]||ki(t)||Ti(t))}function wi(t,e,n){void 0===n&&(n=!1),0===_i(t)?(n?Object.keys:ao)(t).forEach((function(r){n&&"symbol"==typeof r||e(r,t[r],t)})):t.forEach((function(n,r){return e(r,n,t)}))}function _i(t){var e=t[io];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:ki(t)?2:Ti(t)?3:0}function Si(t,e){return 2===_i(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Ci(t,e,n){var r=_i(t);2===r?t.set(e,n):3===r?(t.delete(e),t.add(n)):t[e]=n}function ki(t){return Qi&&t instanceof Map}function Ti(t){return to&&t instanceof Set}function Ei(t){return t.o||t.t}function Oi(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=so(t);delete e[io];for(var n=ao(e),r=0;r<n.length;r++){var i=n[r],o=e[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(e[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),e)}function Mi(t,e){return void 0===e&&(e=!1),Ai(t)||yi(t)||!xi(t)||(_i(t)>1&&(t.set=t.add=t.clear=t.delete=Pi),Object.freeze(t),e&&wi(t,(function(t,e){return Mi(e,!0)}),!0)),t}function Pi(){bi(2)}function Ai(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function ji(t){var e=lo[t];return e||bi(18,t),e}function Di(){return Zi}function Ri(t,e){e&&(ji("Patches"),t.u=[],t.s=[],t.v=e)}function Ii(t){Li(t),t.p.forEach(Fi),t.p=null}function Li(t){t===Zi&&(Zi=t.l)}function zi(t){return Zi={p:[],l:Zi,h:t,m:!0,_:0}}function Fi(t){var e=t[io];0===e.i||1===e.i?e.j():e.O=!0}function Ni(t,e){e._=e.p.length;var n=e.p[0],r=void 0!==t&&t!==n;return e.h.g||ji("ES5").S(e,t,r),r?(n[io].P&&(Ii(e),bi(4)),xi(t)&&(t=Bi(e,t),e.l||Hi(e,t)),e.u&&ji("Patches").M(n[io].t,t,e.u,e.s)):t=Bi(e,n,[]),Ii(e),e.u&&e.v(e.u,e.s),t!==no?t:void 0}function Bi(t,e,n){if(Ai(e))return e;var r=e[io];if(!r)return wi(e,(function(i,o){return Vi(t,r,e,i,o,n)}),!0),e;if(r.A!==t)return e;if(!r.P)return Hi(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=Oi(r.k):r.o;wi(3===r.i?new Set(i):i,(function(e,o){return Vi(t,r,i,e,o,n)})),Hi(t,i,!1),n&&t.u&&ji("Patches").R(r,n,t.u,t.s)}return r.o}function Vi(t,e,n,r,i,o){if(yi(i)){var a=Bi(t,i,o&&e&&3!==e.i&&!Si(e.D,r)?o.concat(r):void 0);if(Ci(n,r,a),!yi(a))return;t.m=!1}if(xi(i)&&!Ai(i)){if(!t.h.F&&t._<1)return;Bi(t,i),e&&e.A.l||Hi(t,i)}}function Hi(t,e,n){void 0===n&&(n=!1),t.h.F&&t.m&&Mi(e,n)}function Wi(t,e){var n=t[io];return(n?Ei(n):t)[e]}function Ui(t,e){if(e in t)for(var n=Object.getPrototypeOf(t);n;){var r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function Yi(t){t.P||(t.P=!0,t.l&&Yi(t.l))}function Xi(t){t.o||(t.o=Oi(t.t))}function Gi(t,e,n){var r=ki(e)?ji("MapSet").N(e,n):Ti(e)?ji("MapSet").T(e,n):t.g?function(t,e){var n=Array.isArray(t),r={i:n?1:0,A:e?e.A:Di(),P:!1,I:!1,D:{},l:e,t:t,k:null,o:null,j:null,C:!1},i=r,o=co;n&&(i=[r],o=uo);var a=Proxy.revocable(i,o),s=a.revoke,l=a.proxy;return r.k=l,r.j=s,l}(e,n):ji("ES5").J(e,n);return(n?n.A:Di()).p.push(r),r}function $i(t){return yi(t)||bi(22,t),function t(e){if(!xi(e))return e;var n,r=e[io],i=_i(e);if(r){if(!r.P&&(r.i<4||!ji("ES5").K(r)))return r.t;r.I=!0,n=qi(e,i),r.I=!1}else n=qi(e,i);return wi(n,(function(e,i){r&&function(t,e){return 2===_i(t)?t.get(e):t[e]}(r.t,e)===i||Ci(n,e,t(i))})),3===i?new Set(n):n}(t)}function qi(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Oi(t)}var Ki,Zi,Ji=typeof Symbol<"u"&&"symbol"==typeof Symbol("x"),Qi=typeof Map<"u",to=typeof Set<"u",eo=typeof Proxy<"u"&&void 0!==Proxy.revocable&&typeof Reflect<"u",no=Ji?Symbol.for("immer-nothing"):((Ki={})["immer-nothing"]=!0,Ki),ro=Ji?Symbol.for("immer-draftable"):"__$immer_draftable",io=Ji?Symbol.for("immer-state"):"__$immer_state",oo=""+Object.prototype.constructor,ao=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,so=Object.getOwnPropertyDescriptors||function(t){var e={};return ao(t).forEach((function(n){e[n]=Object.getOwnPropertyDescriptor(t,n)})),e},lo={},co={get:function(t,e){if(e===io)return t;var n=Ei(t);if(!Si(n,e))return function(t,e,n){var r,i=Ui(e,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(t.k):void 0}(t,n,e);var r=n[e];return t.I||!xi(r)?r:r===Wi(t.t,e)?(Xi(t),t.o[e]=Gi(t.A.h,r,t)):r},has:function(t,e){return e in Ei(t)},ownKeys:function(t){return Reflect.ownKeys(Ei(t))},set:function(t,e,n){var r=Ui(Ei(t),e);if(null!=r&&r.set)return r.set.call(t.k,n),!0;if(!t.P){var i=Wi(Ei(t),e),o=null==i?void 0:i[io];if(o&&o.t===n)return t.o[e]=n,t.D[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(n,i)&&(void 0!==n||Si(t.t,e)))return!0;Xi(t),Yi(t)}return t.o[e]===n&&"number"!=typeof n&&(void 0!==n||e in t.o)||(t.o[e]=n,t.D[e]=!0,!0)},deleteProperty:function(t,e){return void 0!==Wi(t.t,e)||e in t.t?(t.D[e]=!1,Xi(t),Yi(t)):delete t.D[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var n=Ei(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:1!==t.i||"length"!==e,enumerable:r.enumerable,value:n[e]}},defineProperty:function(){bi(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){bi(12)}},uo={};wi(co,(function(t,e){uo[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),uo.deleteProperty=function(t,e){return uo.set.call(this,t,e,void 0)},uo.set=function(t,e,n){return co.set.call(this,t[0],e,n,t[0])};var ho=function(){function t(t){var e=this;this.g=eo,this.F=!0,this.produce=function(t,n,r){if("function"==typeof t&&"function"!=typeof n){var i=n;n=t;var o=e;return function(t){var e=this;void 0===t&&(t=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return o.produce(t,(function(t){var r;return(r=n).call.apply(r,[e,t].concat(a))}))}}var a;if("function"!=typeof n&&bi(6),void 0!==r&&"function"!=typeof r&&bi(7),xi(t)){var s=zi(e),l=Gi(e,t,void 0),c=!0;try{a=n(l),c=!1}finally{c?Ii(s):Li(s)}return typeof Promise<"u"&&a instanceof Promise?a.then((function(t){return Ri(s,r),Ni(t,s)}),(function(t){throw Ii(s),t})):(Ri(s,r),Ni(a,s))}if(!t||"object"!=typeof t){if(void 0===(a=n(t))&&(a=t),a===no&&(a=void 0),e.F&&Mi(a,!0),r){var u=[],h=[];ji("Patches").M(t,a,u,h),r(u,h)}return a}bi(21,t)},this.produceWithPatches=function(t,n){if("function"==typeof t)return function(n){for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return e.produceWithPatches(n,(function(e){return t.apply(void 0,[e].concat(i))}))};var r,i,o=e.produce(t,n,(function(t,e){r=t,i=e}));return typeof Promise<"u"&&o instanceof Promise?o.then((function(t){return[t,r,i]})):[o,r,i]},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var e=t.prototype;return e.createDraft=function(t){xi(t)||bi(8),yi(t)&&(t=$i(t));var e=zi(this),n=Gi(this,t,void 0);return n[io].C=!0,Li(e),n},e.finishDraft=function(t,e){var n=(t&&t[io]).A;return Ri(n,e),Ni(void 0,n)},e.setAutoFreeze=function(t){this.F=t},e.setUseProxies=function(t){t&&!eo&&bi(20),this.g=t},e.applyPatches=function(t,e){var n;for(n=e.length-1;n>=0;n--){var r=e[n];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}n>-1&&(e=e.slice(n+1));var i=ji("Patches").$;return yi(t)?i(t,e):this.produce(t,(function(t){return i(t,e)}))},t}(),fo=new ho,po=fo.produce;function go(t,e){return mo(w(e,t),t)}function mo(t,e){return Object.keys(t).forEach((n=>{if(n.startsWith("replaceDefault")&&t[n]){const r=function(t){return t?t.charAt(0).toLowerCase()+t.slice(1):""}(n.replace("replaceDefault","")||"items");t[r]=e?e[r]:[],delete t[n]}else"object"==typeof t[n]&&null!==t[n]&&mo(t[n],null==e?void 0:e[n])})),t}fo.produceWithPatches.bind(fo),fo.setAutoFreeze.bind(fo),fo.setUseProxies.bind(fo),fo.applyPatches.bind(fo),fo.createDraft.bind(fo),fo.finishDraft.bind(fo);const vo=(t,e)=>({history:{...bo,updatePointerById:t=>{const n=e().history.items.findIndex((e=>e.id===t));e().history.update(n)},update:(e,n)=>{t((t=>{t.history.pointer=e,n&&(t.history.items=n),t.history.canUndo=t.history.pointer>0,t.history.canRedo=t.history.items.length>t.history.pointer+1}))},reset:()=>{t({history:{...e().history,...bo}})}}}),bo={items:[],pointer:0,canUndo:!1,canRedo:!1};var yo=(t=>(t.Filter="filter",t.Frame="frame",t.ActiveObject="activeObj",t.Text="text",t))(yo||{});const xo=(t,e)=>({filter:{...wo,select(e,n=!1){t((t=>{t.filter.selected=e,t.activeToolOverlay=n?yo.Filter:null,t.dirty=!0}))},deselect(n){e().filter.selected===n&&t((t=>{t.filter.selected=null,t.activeToolOverlay=null,t.dirty=!0}))},reset(){t({filter:{...e().filter,...wo}})}}}),wo={selected:null,applied:[]},_o=(t,e)=>({crop:{...So,setCropzoneRect:e=>{t((t=>{t.crop.zoneRect=e}))},setAspectRatio:e=>{t((t=>{t.crop.selectedAspectRatio=e}))},setTransformAngle:e=>{t((t=>{t.crop.straightenAngle=e}))},apply:async()=>{const t=e().crop.zoneRect;if(t){const n={width:Math.ceil(t.width/e().zoom),height:Math.ceil(t.height/e().zoom),left:Math.ceil(t.left/e().zoom),top:Math.ceil(t.top/e().zoom)};await e().editor.tools.crop.apply(n)}},reset:()=>{t({crop:{...e().crop,...So}})}}}),So={zoneRect:null,selectedAspectRatio:null,straightenAngle:0};function Co(t){return"i-text"===(null==t?void 0:t.type)}var ko=(t=>(t.Text="text",t.Shape="shape",t.Sticker="sticker",t.Drawing="drawing",t.Image="image",t.MainImage="mainImage",t.StraightenAnchor="straightenHelper",t))(ko||{});const To={text:{name:ur("Text"),icon:Br.text.icon},shape:{name:ur("Shape"),icon:Br.shapes.icon},sticker:{name:ur("Sticker"),icon:Br.stickers.icon},drawing:{name:ur("Drawing"),icon:Br.draw.icon},image:{name:ur("Image"),icon:Br.overlayImage.icon},mainImage:{name:ur("Background Image"),icon:Br.bgImage.icon}};const Eo={isMoving:!1,editableProps:{},id:null,isText:!1,isImage:!1,name:null};const Oo=(t,e)=>({objects:{...Mo,setActiveIsMoving:e=>{t((t=>{t.objects.active.isMoving=e}))},setIsEditingText:e=>{t((t=>{t.objects.isEditingText=e}))},setActive:n=>{t(n?t=>{var e;t.objects.active.editableProps=function(t){if(!t)return{};const e={fill:t.fill,opacity:t.opacity,backgroundColor:t.backgroundColor,stroke:t.stroke,strokeWidth:t.strokeWidth},n=t.shadow;return n&&(e.shadow={color:n.color,blur:n.blur,offsetX:n.offsetX,offsetY:n.offsetY}),Co(t)&&(e.textAlign=t.textAlign,e.underline=t.underline,e.linethrough=t.linethrough,e.fontStyle=t.fontStyle,e.fontFamily=t.fontFamily,e.fontWeight=t.fontWeight,e.fontSize=t.fontSize),e}(n),t.objects.active.id=n.data.id,t.objects.active.name=null!=(e=n.name)?e:null,t.objects.active.isText=Co(n),t.objects.active.isImage=function(t){return t.name===ko.Image}(n)}:t=>{var n,r,i,o,a;const s={...null==(n=e().config.objectDefaults)?void 0:n.global,fontFamily:null==(i=null==(r=e().config.objectDefaults)?void 0:r.text)?void 0:i.fontFamily,fontSize:null==(a=null==(o=e().config.objectDefaults)?void 0:o.text)?void 0:a.fontSize};t.objects.active={...Eo,editableProps:s}})},reset(){t({objects:{...e().objects,...Mo}})}}}),Mo={all:[],isEditingText:!1,active:Eo},Po=(t,e)=>({frame:{...Ao,select:n=>{t((t=>{t.frame.active=n})),e().frame.showOptionsPanel()},deselect:()=>{t((t=>{t.frame.active=null,t.activeToolOverlay=null}))},showOptionsPanel:()=>{e().activeTool===vr.FRAME&&t((t=>{t.activeToolOverlay=yo.Frame}))},reset(){t({frame:{...e().frame,...Ao}})}}}),Ao={active:null},jo=(t,e)=>({resize:{...Do,setFormValue:e=>{t((t=>{Object.entries(e).forEach((([e,n])=>{t.resize.formValue[e]=n}))}))},apply(){const t=e().resize.formValue,n=e().original;if(t.width===n.width&&t.height===n.height)return!1;e().editor.tools.resize.apply(t)},reset(){t({resize:{...e().resize,...Do}})}}}),Do={formValue:{width:1,height:1,maintainAspect:!0,usePercentages:!1}},Ro=(t,e)=>({corners:{...Io,setRadius:e=>{t((t=>{t.corners.radius=e}))},apply:()=>e().editor.tools.corners.apply(e().corners.radius),reset(){t({corners:{...e().corners,...Io}})}}}),Io={radius:50},Lo=t=>(e,n,r)=>(r.setState=(t,n,...r)=>{const i="function"==typeof t?po(t):t;return e(i,n,...r)},t(r.setState,n,r));var zo={exports:{}},Fo={exports:{}},No=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},Bo=Array.prototype.concat,Vo=Array.prototype.slice,Ho=Fo.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];No(i)?e=Bo.call(e,Vo.call(i)):e.push(i)}return e};Ho.wrap=function(t){return function(){return t(Ho(arguments))}};var Wo={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]},Uo=Fo.exports,Yo=Object.hasOwnProperty,Xo=Object.create(null);for(var Go in Wo)Yo.call(Wo,Go)&&(Xo[Wo[Go]]=Go);var $o=zo.exports={to:{},get:{}};function qo(t,e,n){return Math.min(Math.max(e,t),n)}function Ko(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}$o.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=$o.get.hsl(t),n="hsl";break;case"hwb":e=$o.get.hwb(t),n="hwb";break;default:e=$o.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},$o.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:Yo.call(Wo,e[1])?((i=Wo[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=qo(i[n],0,255);return i[3]=qo(i[3],0,1),i},$o.get.hsl=function(t){if(!t)return null;var e=t.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(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,qo(parseFloat(e[2]),0,100),qo(parseFloat(e[3]),0,100),qo(isNaN(n)?1:n,0,1)]}return null},$o.get.hwb=function(t){if(!t)return null;var e=t.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(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,qo(parseFloat(e[2]),0,100),qo(parseFloat(e[3]),0,100),qo(isNaN(n)?1:n,0,1)]}return null},$o.to.hex=function(){var t=Uo(arguments);return"#"+Ko(t[0])+Ko(t[1])+Ko(t[2])+(t[3]<1?Ko(Math.round(255*t[3])):"")},$o.to.rgb=function(){var t=Uo(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},$o.to.rgb.percent=function(){var t=Uo(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},$o.to.hsl=function(){var t=Uo(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},$o.to.hwb=function(){var t=Uo(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},$o.to.keyword=function(t){return Xo[t.slice(0,3)]};const Zo={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]},Jo={};for(const wS of Object.keys(Zo))Jo[Zo[wS]]=wS;const Qo={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 ta=Qo;for(const wS of Object.keys(Qo)){if(!("channels"in Qo[wS]))throw new Error("missing channels property: "+wS);if(!("labels"in Qo[wS]))throw new Error("missing channel labels property: "+wS);if(Qo[wS].labels.length!==Qo[wS].channels)throw new Error("channel and label counts mismatch: "+wS);const{channels:t,labels:e}=Qo[wS];delete Qo[wS].channels,delete Qo[wS].labels,Object.defineProperty(Qo[wS],"channels",{value:t}),Object.defineProperty(Qo[wS],"labels",{value:e})}function ea(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Qo.rgb.hsl=function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=o-i;let s,l;o===i?s=0:e===o?s=(n-r)/a:n===o?s=2+(r-e)/a:r===o&&(s=4+(e-n)/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]},Qo.rgb.hsv=function(t){let e,n,r,i,o;const a=t[0]/255,s=t[1]/255,l=t[2]/255,c=Math.max(a,s,l),u=c-Math.min(a,s,l),h=function(t){return(c-t)/6/u+.5};return 0===u?(i=0,o=0):(o=u/c,e=h(a),n=h(s),r=h(l),a===c?i=r-n:s===c?i=1/3+e-r:l===c&&(i=2/3+n-e),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*c]},Qo.rgb.hwb=function(t){const e=t[0],n=t[1];let r=t[2];const i=Qo.rgb.hsl(t)[0],o=1/255*Math.min(e,Math.min(n,r));return r=1-1/255*Math.max(e,Math.max(n,r)),[i,100*o,100*r]},Qo.rgb.cmyk=function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.min(1-e,1-n,1-r);return[100*((1-e-i)/(1-i)||0),100*((1-n-i)/(1-i)||0),100*((1-r-i)/(1-i)||0),100*i]},Qo.rgb.keyword=function(t){const e=Jo[t];if(e)return e;let n,r=1/0;for(const i of Object.keys(Zo)){const e=ea(t,Zo[i]);e<r&&(r=e,n=i)}return n},Qo.keyword.rgb=function(t){return Zo[t]},Qo.rgb.xyz=function(t){let e=t[0]/255,n=t[1]/255,r=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;return[100*(.4124*e+.3576*n+.1805*r),100*(.2126*e+.7152*n+.0722*r),100*(.0193*e+.1192*n+.9505*r)]},Qo.rgb.lab=function(t){const e=Qo.rgb.xyz(t);let n=e[0],r=e[1],i=e[2];n/=95.047,r/=100,i/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*r-16,500*(n-r),200*(r-i)]},Qo.hsl.rgb=function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100;let i,o,a;if(0===n)return a=255*r,[a,a,a];i=r<.5?r*(1+n):r+n-r*n;const s=2*r-i,l=[0,0,0];for(let c=0;c<3;c++)o=e+1/3*-(c-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[c]=255*a;return l},Qo.hsl.hsv=function(t){const e=t[0];let n=t[1]/100,r=t[2]/100,i=n;const o=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=o<=1?o:2-o;return[e,100*(0===r?2*i/(o+i):2*n/(r+n)),100*((r+n)/2)]},Qo.hsv.rgb=function(t){const e=t[0]/60,n=t[1]/100;let r=t[2]/100;const i=Math.floor(e)%6,o=e-Math.floor(e),a=255*r*(1-n),s=255*r*(1-n*o),l=255*r*(1-n*(1-o));switch(r*=255,i){case 0:return[r,l,a];case 1:return[s,r,a];case 2:return[a,r,l];case 3:return[a,s,r];case 4:return[l,a,r];case 5:return[r,a,s]}},Qo.hsv.hsl=function(t){const e=t[0],n=t[1]/100,r=t[2]/100,i=Math.max(r,.01);let o,a;a=(2-n)*r;const s=(2-n)*i;return o=n*i,o/=s<=1?s:2-s,o=o||0,a/=2,[e,100*o,100*a]},Qo.hwb.rgb=function(t){const e=t[0]/360;let n=t[1]/100,r=t[2]/100;const i=n+r;let o;i>1&&(n/=i,r/=i);const a=Math.floor(6*e),s=1-r;o=6*e-a,0!==(1&a)&&(o=1-o);const l=n+o*(s-n);let c,u,h;switch(a){default:case 6:case 0:c=s,u=l,h=n;break;case 1:c=l,u=s,h=n;break;case 2:c=n,u=s,h=l;break;case 3:c=n,u=l,h=s;break;case 4:c=l,u=n,h=s;break;case 5:c=s,u=n,h=l}return[255*c,255*u,255*h]},Qo.cmyk.rgb=function(t){const e=t[0]/100,n=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},Qo.xyz.rgb=function(t){const e=t[0]/100,n=t[1]/100,r=t[2]/100;let i,o,a;return i=3.2406*e+-1.5372*n+-.4986*r,o=-.9689*e+1.8758*n+.0415*r,a=.0557*e+-.204*n+1.057*r,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]},Qo.xyz.lab=function(t){let e=t[0],n=t[1],r=t[2];e/=95.047,n/=100,r/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;return[116*n-16,500*(e-n),200*(n-r)]},Qo.lab.xyz=function(t){let e,n,r;n=(t[0]+16)/116,e=t[1]/500+n,r=n-t[2]/200;const i=n**3,o=e**3,a=r**3;return n=i>.008856?i:(n-16/116)/7.787,e=o>.008856?o:(e-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,e*=95.047,n*=100,r*=108.883,[e,n,r]},Qo.lab.lch=function(t){const e=t[0],n=t[1],r=t[2];let i;i=360*Math.atan2(r,n)/2/Math.PI,i<0&&(i+=360);return[e,Math.sqrt(n*n+r*r),i]},Qo.lch.lab=function(t){const e=t[0],n=t[1],r=t[2]/360*2*Math.PI;return[e,n*Math.cos(r),n*Math.sin(r)]},Qo.rgb.ansi16=function(t,e=null){const[n,r,i]=t;let o=null===e?Qo.rgb.hsv(t)[2]:e;if(o=Math.round(o/50),0===o)return 30;let a=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return 2===o&&(a+=60),a},Qo.hsv.ansi16=function(t){return Qo.rgb.ansi16(Qo.hsv.rgb(t),t[2])},Qo.rgb.ansi256=function(t){const e=t[0],n=t[1],r=t[2];return e===n&&n===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},Qo.ansi16.rgb=function(t){let e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},Qo.ansi256.rgb=function(t){if(t>=232){const e=10*(t-232)+8;return[e,e,e]}let e;t-=16;return[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},Qo.rgb.hex=function(t){const e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},Qo.hex.rgb=function(t){const e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let n=e[0];3===e[0].length&&(n=n.split("").map((t=>t+t)).join(""));const r=parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},Qo.rgb.hcg=function(t){const e=t[0]/255,n=t[1]/255,r=t[2]/255,i=Math.max(Math.max(e,n),r),o=Math.min(Math.min(e,n),r),a=i-o;let s,l;return s=a<1?o/(1-a):0,l=a<=0?0:i===e?(n-r)/a%6:i===n?2+(r-e)/a:4+(e-n)/a,l/=6,l%=1,[360*l,100*a,100*s]},Qo.hsl.hcg=function(t){const e=t[1]/100,n=t[2]/100,r=n<.5?2*e*n:2*e*(1-n);let i=0;return r<1&&(i=(n-.5*r)/(1-r)),[t[0],100*r,100*i]},Qo.hsv.hcg=function(t){const e=t[1]/100,n=t[2]/100,r=e*n;let i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},Qo.hcg.rgb=function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100;if(0===n)return[255*r,255*r,255*r];const i=[0,0,0],o=e%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-n)*r,[255*(n*i[0]+l),255*(n*i[1]+l),255*(n*i[2]+l)]},Qo.hcg.hsv=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);let r=0;return n>0&&(r=e/n),[t[0],100*r,100*n]},Qo.hcg.hsl=function(t){const e=t[1]/100,n=t[2]/100*(1-e)+.5*e;let r=0;return n>0&&n<.5?r=e/(2*n):n>=.5&&n<1&&(r=e/(2*(1-n))),[t[0],100*r,100*n]},Qo.hcg.hwb=function(t){const e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},Qo.hwb.hcg=function(t){const e=t[1]/100,n=1-t[2]/100,r=n-e;let i=0;return r<1&&(i=(n-r)/(1-r)),[t[0],100*r,100*i]},Qo.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},Qo.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},Qo.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},Qo.gray.hsl=function(t){return[0,0,t[0]]},Qo.gray.hsv=Qo.gray.hsl,Qo.gray.hwb=function(t){return[0,100,t[0]]},Qo.gray.cmyk=function(t){return[0,0,0,t[0]]},Qo.gray.lab=function(t){return[t[0],0,0]},Qo.gray.hex=function(t){const e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},Qo.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};const na=ta;function ra(t){const e=function(){const t={},e=Object.keys(na);for(let n=e.length,r=0;r<n;r++)t[e[r]]={distance:-1,parent:null};return t}(),n=[t];for(e[t].distance=0;n.length;){const t=n.pop(),r=Object.keys(na[t]);for(let i=r.length,o=0;o<i;o++){const i=r[o],a=e[i];-1===a.distance&&(a.distance=e[t].distance+1,a.parent=t,n.unshift(i))}}return e}function ia(t,e){return function(n){return e(t(n))}}function oa(t,e){const n=[e[t].parent,t];let r=na[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)n.unshift(e[i].parent),r=ia(na[e[i].parent][i],r),i=e[i].parent;return r.conversion=n,r}const aa=ta,sa=function(t){const e=ra(t),n={},r=Object.keys(e);for(let i=r.length,o=0;o<i;o++){const t=r[o];null!==e[t].parent&&(n[t]=oa(t,e))}return n},la={};Object.keys(aa).forEach((t=>{la[t]={},Object.defineProperty(la[t],"channels",{value:aa[t].channels}),Object.defineProperty(la[t],"labels",{value:aa[t].labels});const e=sa(t);Object.keys(e).forEach((n=>{const r=e[n];la[t][n]=function(t){const e=function(...e){const n=e[0];if(null==n)return n;n.length>1&&(e=n);const r=t(e);if("object"==typeof r)for(let t=r.length,i=0;i<t;i++)r[i]=Math.round(r[i]);return r};return"conversion"in t&&(e.conversion=t.conversion),e}(r),la[t][n].raw=function(t){const e=function(...e){const n=e[0];return null==n?n:(n.length>1&&(e=n),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(r)}))}));var ca=la;const ua=zo.exports,ha=ca,da=["keyword","gray","hex"],fa={};for(const wS of Object.keys(ha))fa[[...ha[wS].labels].sort().join("")]=wS;const pa={};function ga(t,e){if(!(this instanceof ga))return new ga(t,e);if(e&&e in da&&(e=null),e&&!(e in ha))throw new Error("Unknown model: "+e);let n,r;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof ga)this.model=t.model,this.color=[...t.color],this.valpha=t.valpha;else if("string"==typeof t){const e=ua.get(t);if(null===e)throw new Error("Unable to parse color from string: "+t);this.model=e.model,r=ha[this.model].channels,this.color=e.value.slice(0,r),this.valpha="number"==typeof e.value[r]?e.value[r]:1}else if(t.length>0){this.model=e||"rgb",r=ha[this.model].channels;const n=Array.prototype.slice.call(t,0,r);this.color=xa(n,r),this.valpha="number"==typeof t[r]?t[r]:1}else if("number"==typeof t)this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;const e=Object.keys(t);"alpha"in t&&(e.splice(e.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);const r=e.sort().join("");if(!(r in fa))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=fa[r];const{labels:i}=ha[this.model],o=[];for(n=0;n<i.length;n++)o.push(t[i[n]]);this.color=xa(o)}if(pa[this.model])for(r=ha[this.model].channels,n=0;n<r;n++){const t=pa[this.model][n];t&&(this.color[n]=t(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}ga.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(t){let e=this.model in ua.to?this:this.rgb();e=e.round("number"==typeof t?t:1);const n=1===e.valpha?e.color:[...e.color,this.valpha];return ua.to[e.model](n)},percentString(t){const e=this.rgb().round("number"==typeof t?t:1),n=1===e.valpha?e.color:[...e.color,this.valpha];return ua.to.rgb.percent(n)},array(){return 1===this.valpha?[...this.color]:[...this.color,this.valpha]},object(){const t={},{channels:e}=ha[this.model],{labels:n}=ha[this.model];for(let r=0;r<e;r++)t[n[r]]=this.color[r];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray(){const t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject(){const t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round(t){return t=Math.max(t||0,0),new ga([...this.color.map(ma(t)),this.valpha],this.model)},alpha(t){return void 0!==t?new ga([...this.color,Math.max(0,Math.min(1,t))],this.model):this.valpha},red:va("rgb",0,ba(255)),green:va("rgb",1,ba(255)),blue:va("rgb",2,ba(255)),hue:va(["hsl","hsv","hsl","hwb","hcg"],0,(t=>(t%360+360)%360)),saturationl:va("hsl",1,ba(100)),lightness:va("hsl",2,ba(100)),saturationv:va("hsv",1,ba(100)),value:va("hsv",2,ba(100)),chroma:va("hcg",1,ba(100)),gray:va("hcg",2,ba(100)),white:va("hwb",1,ba(100)),wblack:va("hwb",2,ba(100)),cyan:va("cmyk",0,ba(100)),magenta:va("cmyk",1,ba(100)),yellow:va("cmyk",2,ba(100)),black:va("cmyk",3,ba(100)),x:va("xyz",0,ba(95.047)),y:va("xyz",1,ba(100)),z:va("xyz",2,ba(108.833)),l:va("lab",0,ba(100)),a:va("lab",1),b:va("lab",2),keyword(t){return void 0!==t?new ga(t):ha[this.model].keyword(this.color)},hex(t){return void 0!==t?new ga(t):ua.to.hex(this.rgb().round().color)},hexa(t){if(void 0!==t)return new ga(t);const e=this.rgb().round().color;let n=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===n.length&&(n="0"+n),ua.to.hex(e)+n},rgbNumber(){const t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity(){const t=this.rgb().color,e=[];for(const[n,r]of t.entries()){const t=r/255;e[n]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(t){const e=this.luminosity(),n=t.luminosity();return e>n?(e+.05)/(n+.05):(n+.05)/(e+.05)},level(t){const e=this.contrast(t);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const t=this.rgb().color;return(2126*t[0]+7152*t[1]+722*t[2])/1e4<128},isLight(){return!this.isDark()},negate(){const t=this.rgb();for(let e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten(t){const e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken(t){const e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate(t){const e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate(t){const e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten(t){const e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken(t){const e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale(){const t=this.rgb().color,e=.3*t[0]+.59*t[1]+.11*t[2];return ga.rgb(e,e,e)},fade(t){return this.alpha(this.valpha-this.valpha*t)},opaquer(t){return this.alpha(this.valpha+this.valpha*t)},rotate(t){const e=this.hsl();let n=e.color[0];return n=(n+t)%360,n=n<0?360+n:n,e.color[0]=n,e},mix(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);const n=t.rgb(),r=this.rgb(),i=void 0===e?.5:e,o=2*i-1,a=n.alpha()-r.alpha(),s=((o*a===-1?o:(o+a)/(1+o*a))+1)/2,l=1-s;return ga.rgb(s*n.red()+l*r.red(),s*n.green()+l*r.green(),s*n.blue()+l*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(const wS of Object.keys(ha)){if(da.includes(wS))continue;const{channels:t}=ha[wS];ga.prototype[wS]=function(...t){return this.model===wS?new ga(this):t.length>0?new ga(t,wS):new ga([...ya(ha[this.model][wS].raw(this.color)),this.valpha],wS)},ga[wS]=function(...e){let n=e[0];return"number"==typeof n&&(n=xa(e,t)),new ga(n,wS)}}function ma(t){return function(e){return function(t,e){return Number(t.toFixed(e))}(e,t)}}function va(t,e,n){t=Array.isArray(t)?t:[t];for(const r of t)(pa[r]||(pa[r]=[]))[e]=n;return t=t[0],function(r){let i;return void 0!==r?(n&&(r=n(r)),i=this[t](),i.color[e]=r,i):(i=this[t]().color[e],n&&(i=n(i)),i)}}function ba(t){return function(e){return Math.max(0,Math.min(t,e))}}function ya(t){return Array.isArray(t)?t:[t]}function xa(t,e){for(let n=0;n<e;n++)"number"!=typeof t[n]&&(t[n]=0);return t}const wa=ga;function _a(t){return t.endsWith("%")||3===t.split(" ").length?t:wa(t).rgb().array().slice(0,3).join(" ")}var Sa;let Ca=typeof document<"u"?null!=(Sa=document.getElementById("root"))?Sa:document.body:void 0;function ka(t){Object.entries(t.colors).forEach((([t,e])=>{!function(t,e){null==Ca||Ca.style.setProperty(t,e)}(t,e)})),t.is_dark?Ca.classList.add("dark"):Ca.classList.remove("dark")}const Ta={top:0,right:0,bottom:0,left:0,width:0,height:0},Ea=mi()(vi(Lo(((t,e)=>({editor:null,fabric:null,bootstrapData:{},config:Yr,zoom:1,dirty:!1,original:{width:1,height:1},stageSize:Ta,canvasSize:Ta,canvasRef:null,activeTool:null,activeToolOverlay:null,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1},...vo(t,e),...Oo(t,e),...xo(t,e),..._o(t,e),...Po(t,e),...jo(t,e),...Ro(t,e),setZoom:e=>t((t=>{t.zoom=e})),setOriginal:(e,n)=>t((t=>{t.original={width:e,height:n}})),setDirty:e=>t((t=>{t.dirty=e})),toggleLoading:e=>t((t=>{t.loading=e})),setStageSize:e=>t((t=>{t.stageSize=e})),setCanvasSize:e=>t((t=>{t.canvasSize=e})),setActiveTool:(e,n)=>{t((t=>{t.activeTool=e,t.activeToolOverlay=n}))},setConfig:n=>t((t=>{var r,i;const o=go(n,e().config);t.config=o;const a=o.activeLanguage||"en",s=null==(r=o.languages)?void 0:r[a],l=((null==(i=o.ui)?void 0:i.themes)||[]).map((t=>function(t){const e=t.isDark?mr.find((t=>t.isDark)):mr.find((t=>!t.isDark)),n={...e,...t,colors:{...null==e?void 0:e.colors,...t.colors}},r=Object.entries(n.colors).map((([t,e])=>[t,_a(e)]));return{id:n.name,name:n.name,colors:Object.fromEntries(r),is_dark:n.isDark}}(t))),c=l.find((t=>{var e;return t.id===(null==(e=o.ui)?void 0:e.activeTheme)}));c&&ka(c),t.bootstrapData={i18n:{language:a,name:a,id:0,lines:s},themes:{all:l}}})),togglePanel:(e,n)=>t((t=>{t.openPanels[e]=null!=n?n:!t.openPanels[e]})),applyChanges:async()=>{var n;const r=e().activeTool;if(!r)return;const i=e()[r],o=await(null==(n=null==i?void 0:i.apply)?void 0:n.call(i));t((t=>{t.dirty=!1,t.activeTool=null,t.activeToolOverlay=null})),!1!==o&&e().editor.tools.history.addHistoryItem({name:r}),null==i||i.reset()},cancelChanges:async()=>{const n=e().activeTool;if(!n)return;const r=e().dirty;t((t=>{t.dirty=!1,t.activeTool=null,t.activeToolOverlay=null})),r&&await e().editor.tools.history.reload();const i=e()[n];null==i||i.reset()},reset:()=>{e().editor.tools.transform.resetStraightenAnchor(),t({activeTool:null,activeToolOverlay:null,zoom:1,dirty:!1,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1}}),e().history.reset(),e().objects.reset(),e().filter.reset(),e().crop.reset(),e().frame.reset(),e().resize.reset(),e().corners.reset()}})))));function Oa(){return Ea.getState()}function Ma(){return Oa().editor.tools}function Pa(){return Oa().fabric}function Aa(t){return Ma().canvas.clear(),Ma().frame.remove(),Oa().setConfig({image:void 0,blankCanvasSize:void 0,...t}),Oa().reset(),new Promise((t=>setTimeout(t)))}async function ja(t){return(await fetch(t)).json()}const Da={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 Ra(t=[]){var e;t=[...Object.keys(Da),"crossOrigin","name","displayName","data",...t];const n=Pa().toJSON(t);n.objects=n.objects.filter((t=>!t.data.pixieInternal)).map((t=>("image"===t.type&&Oa().config.crossOrigin&&(t.crossOrigin="anonymous"),Co(t)&&(t.selectable=!0,t.lockMovementX=!1,t.lockMovementY=!1,t.lockUniScaling=!1),{...t,data:t.data?{...t.data}:{}})));return{canvas:n,editor:{frame:Ma().frame.active.config?{name:Ma().frame.active.config.name,sizePercent:Ma().frame.active.currentSizeInPercent}:null,zoom:Oa().zoom,activeObjectId:(null==(e=Oa().objects.active)?void 0:e.id)||null},canvasWidth:Oa().original.width,canvasHeight:Oa().original.height}}function Ia(t=null){if(Oa().dirty)return;Ma().zoom.fitToScreen();const[e,n]=La(Pa().getActiveObject());t?Oa().setActiveTool(t,e===t?n:null):Oa().setActiveTool(e,n)}function La(t){switch(null==t?void 0:t.name){case ko.Text:return[vr.TEXT,yo.Text];case ko.Sticker:case ko.Image:return[vr.STICKERS,yo.ActiveObject];case ko.Shape:return[vr.SHAPES,yo.ActiveObject];default:return[null,null]}}function za(){return!Oa().config.image&&!Oa().config.blankCanvasSize&&(!Pa()||0===Pa().getObjects().length)}let Fa=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");class Na{constructor(t,e){c(this,"timerId"),c(this,"createdAt",0),this.callback=t,this.remaining=e,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 Ba=mi()(Lo(((t,e)=>({toasts:[],add:(n,r)=>{var i;const o=e().toasts.length+1-1;o>0&&t((t=>{t.toasts.splice(0,o)}));const a=(null==r?void 0:r.id)||Fa(6),s=(null==r?void 0:r.type)||"positive",l=null!=(i=null==r?void 0:r.duration)?i:function(t){return"danger"===t?8e3:3e3}(s),c={timer:l>0?new Na((()=>e().remove(a)),l):null,message:n,...r,id:a,type:s,position:(null==r?void 0:r.position)||"bottom-center",duration:l},u=e().toasts.findIndex((t=>t.id===c.id));t(u>-1?t=>{t.toasts[u]=c}:t=>{t.toasts.push(c)})},remove:n=>{const r=e().toasts.filter((t=>{var e;return n!==t.id||(null==(e=t.timer)||e.clear(),!1)}));t((t=>{t.toasts=r}))}}))));function Va(){return Ba.getState()}function Ha(t,e){Va().add(t,e)}Ha.danger=(t,e)=>{Va().add(t,{...e,type:"danger"})},Ha.positive=(t,e)=>{Va().add(t,{...e,type:"positive"})};var Wa,Ua=o;Wa=Ua.createRoot,Ua.hydrateRoot;const Ya=(0,i.createContext)({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Xa=(0,i.createContext)({});const Ga=(0,i.createContext)(null),$a=typeof document<"u",qa=$a?i.useLayoutEffect:i.useEffect,Ka=(0,i.createContext)({strict:!1});function Za(t,e,n,r){const o=(0,i.useContext)(Xa).visualElement,a=(0,i.useContext)(Ka),s=(0,i.useContext)(Ga),l=(0,i.useContext)(Ya).reducedMotion,c=(0,i.useRef)(void 0);r=r||a.renderer,!c.current&&r&&(c.current=r(t,{visualState:e,parent:o,props:n,presenceId:s?s.id:void 0,blockInitialAnimation:!!s&&!1===s.initial,reducedMotionConfig:l}));const u=c.current;return qa((()=>{u&&u.syncRender()})),(0,i.useEffect)((()=>{u&&u.animationState&&u.animationState.animateChanges()})),qa((()=>()=>u&&u.notifyUnmount()),[]),u}function Ja(t){return"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function Qa(t,e,n){return(0,i.useCallback)((r=>{r&&t.mount&&t.mount(r),e&&(r?e.mount(r):e.unmount()),n&&("function"==typeof n?n(r):Ja(n)&&(n.current=r))}),[e])}function ts(t){return"string"==typeof t||Array.isArray(t)}function es(t){return"object"==typeof t&&"function"==typeof t.start}const ns=["initial","animate","exit","whileHover","whileDrag","whileTap","whileFocus","whileInView"];function rs(t){return es(t.animate)||ns.some((e=>ts(t[e])))}function is(t){return Boolean(rs(t)||t.variants)}function os(t){const{initial:e,animate:n}=function(t,e){if(rs(t)){const{initial:e,animate:n}=t;return{initial:!1===e||ts(e)?e:void 0,animate:ts(n)?n:void 0}}return!1!==t.inherit?e:{}}(t,(0,i.useContext)(Xa));return(0,i.useMemo)((()=>({initial:e,animate:n})),[as(e),as(n)])}function as(t){return Array.isArray(t)?t.join(" "):t}const ss=t=>({isEnabled:e=>t.some((t=>!!e[t]))}),ls={measureLayout:ss(["layout","layoutId","drag"]),animation:ss(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:ss(["exit"]),drag:ss(["drag","dragControls"]),focus:ss(["whileFocus"]),hover:ss(["whileHover","onHoverStart","onHoverEnd"]),tap:ss(["whileTap","onTap","onTapStart","onTapCancel"]),pan:ss(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:ss(["whileInView","onViewportEnter","onViewportLeave"])};function cs(t){for(const e in t)"projectionNodeConstructor"===e?ls.projectionNodeConstructor=t[e]:ls[e].Component=t[e]}function us(t){const e=(0,i.useRef)(null);return null===e.current&&(e.current=t()),e.current}const hs=!1;let ds=1;const fs=(0,i.createContext)({});class ps extends i.Component{getSnapshotBeforeUpdate(){const{visualElement:t,props:e}=this.props;return t&&t.setProps(e),null}componentDidUpdate(){}render(){return this.props.children}}const gs=(0,i.createContext)({}),ms=Symbol.for("motionComponentSymbol");function vs({preloadedFeatures:t,createVisualElement:e,projectionNodeConstructor:n,useRender:r,useVisualState:o,Component:a}){t&&cs(t);const s=(0,i.forwardRef)((function(s,l){const c={...(0,i.useContext)(Ya),...s,layoutId:bs(s)},{isStatic:u}=c;let h=null;const d=os(s),f=u?void 0:us((()=>{if(hs)return ds++})),p=o(s,u);if(!u&&$a){d.visualElement=Za(a,p,c,e);const r=(0,i.useContext)(Ka).strict,o=(0,i.useContext)(gs);d.visualElement&&(h=d.visualElement.loadFeatures(c,r,t,f,n||ls.projectionNodeConstructor,o))}return sr(ps,{visualElement:d.visualElement,props:c,children:[h,ar(Xa.Provider,{value:d,children:r(a,s,f,Qa(p,d.visualElement,l),p,u,d.visualElement)})]})}));return s[ms]=a,s}function bs({layoutId:t}){const e=(0,i.useContext)(fs).id;return e&&void 0!==t?e+"-"+t:t}const ys=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function xs(t){return"string"==typeof t&&!t.includes("-")&&!!(ys.indexOf(t)>-1||/[A-Z]/.test(t))}const ws={},_s=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ss=new Set(_s);function Cs(t,{layout:e,layoutId:n}){return Ss.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!ws[t]||"opacity"===t)}const ks=t=>!(null==t||!t.getVelocity),Ts={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Es=(t,e)=>_s.indexOf(t)-_s.indexOf(e);function Os(t){return t.startsWith("--")}const Ms=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Ps=(t,e)=>n=>Math.max(Math.min(n,e),t),As=t=>t%1?Number(t.toFixed(5)):t,js=/(-)?([\d]*\.?[\d])+/g,Ds=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Rs=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Is(t){return"string"==typeof t}const Ls={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},zs=Object.assign(Object.assign({},Ls),{transform:Ps(0,1)}),Fs=Object.assign(Object.assign({},Ls),{default:1}),Ns=t=>({test:e=>Is(e)&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),Bs=Ns("deg"),Vs=Ns("%"),Hs=Ns("px"),Ws=Ns("vh"),Us=Ns("vw"),Ys=Object.assign(Object.assign({},Vs),{parse:t=>Vs.parse(t)/100,transform:t=>Vs.transform(100*t)}),Xs=(t,e)=>n=>Boolean(Is(n)&&Rs.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),Gs=(t,e,n)=>r=>{if(!Is(r))return r;const[i,o,a,s]=r.match(js);return{[t]:parseFloat(i),[e]:parseFloat(o),[n]:parseFloat(a),alpha:void 0!==s?parseFloat(s):1}},$s={test:Xs("hsl","hue"),parse:Gs("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Vs.transform(As(e))+", "+Vs.transform(As(n))+", "+As(zs.transform(r))+")"},qs=Ps(0,255),Ks=Object.assign(Object.assign({},Ls),{transform:t=>Math.round(qs(t))}),Zs={test:Xs("rgb","red"),parse:Gs("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Ks.transform(t)+", "+Ks.transform(e)+", "+Ks.transform(n)+", "+As(zs.transform(r))+")"};const Js={test:Xs("#"),parse:function(t){let e="",n="",r="",i="";return t.length>5?(e=t.substr(1,2),n=t.substr(3,2),r=t.substr(5,2),i=t.substr(7,2)):(e=t.substr(1,1),n=t.substr(2,1),r=t.substr(3,1),i=t.substr(4,1),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:Zs.transform},Qs={test:t=>Zs.test(t)||Js.test(t)||$s.test(t),parse:t=>Zs.test(t)?Zs.parse(t):$s.test(t)?$s.parse(t):Js.parse(t),transform:t=>Is(t)?t:t.hasOwnProperty("red")?Zs.transform(t):$s.transform(t)},tl="${c}",el="${n}";function nl(t){"number"==typeof t&&(t=`${t}`);const e=[];let n=0;const r=t.match(Ds);r&&(n=r.length,t=t.replace(Ds,tl),e.push(...r.map(Qs.parse)));const i=t.match(js);return i&&(t=t.replace(js,el),e.push(...i.map(Ls.parse))),{values:e,numColors:n,tokenised:t}}function rl(t){return nl(t).values}function il(t){const{values:e,numColors:n,tokenised:r}=nl(t),i=e.length;return t=>{let e=r;for(let r=0;r<i;r++)e=e.replace(r<n?tl:el,r<n?Qs.transform(t[r]):As(t[r]));return e}}const ol=t=>"number"==typeof t?0:t;const al={test:function(t){var e,n,r,i;return isNaN(t)&&Is(t)&&(null!==(n=null===(e=t.match(js))||void 0===e?void 0:e.length)&&void 0!==n?n:0)+(null!==(i=null===(r=t.match(Ds))||void 0===r?void 0:r.length)&&void 0!==i?i:0)>0},parse:rl,createTransformer:il,getAnimatableNone:function(t){const e=rl(t);return il(t)(e.map(ol))}},sl=new Set(["brightness","contrast","saturate","opacity"]);function ll(t){let[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(js)||[];if(!r)return t;const i=n.replace(r,"");let o=sl.has(e)?1:0;return r!==n&&(o*=100),e+"("+o+i+")"}const cl=/([a-z-]*)\(.*?\)/g,ul=Object.assign(Object.assign({},al),{getAnimatableNone:t=>{const e=t.match(cl);return e?e.map(ll).join(" "):t}}),hl={...Ls,transform:Math.round},dl={borderWidth:Hs,borderTopWidth:Hs,borderRightWidth:Hs,borderBottomWidth:Hs,borderLeftWidth:Hs,borderRadius:Hs,radius:Hs,borderTopLeftRadius:Hs,borderTopRightRadius:Hs,borderBottomRightRadius:Hs,borderBottomLeftRadius:Hs,width:Hs,maxWidth:Hs,height:Hs,maxHeight:Hs,size:Hs,top:Hs,right:Hs,bottom:Hs,left:Hs,padding:Hs,paddingTop:Hs,paddingRight:Hs,paddingBottom:Hs,paddingLeft:Hs,margin:Hs,marginTop:Hs,marginRight:Hs,marginBottom:Hs,marginLeft:Hs,rotate:Bs,rotateX:Bs,rotateY:Bs,rotateZ:Bs,scale:Fs,scaleX:Fs,scaleY:Fs,scaleZ:Fs,skew:Bs,skewX:Bs,skewY:Bs,distance:Hs,translateX:Hs,translateY:Hs,translateZ:Hs,x:Hs,y:Hs,z:Hs,perspective:Hs,transformPerspective:Hs,opacity:zs,originX:Ys,originY:Ys,originZ:Hs,zIndex:hl,fillOpacity:zs,strokeOpacity:zs,numOctaves:hl};function fl(t,e,n,r){const{style:i,vars:o,transform:a,transformKeys:s,transformOrigin:l}=t;s.length=0;let c=!1,u=!1,h=!0;for(const d in e){const t=e[d];if(Os(d)){o[d]=t;continue}const n=dl[d],r=Ms(t,n);if(Ss.has(d)){if(c=!0,a[d]=r,s.push(d),!h)continue;t!==(n.default||0)&&(h=!1)}else d.startsWith("origin")?(u=!0,l[d]=r):i[d]=r}if(e.transform||(c||r?i.transform=function({transform:t,transformKeys:e},{enableHardwareAcceleration:n=!0,allowTransformNone:r=!0},i,o){let a="";e.sort(Es);for(const s of e)a+=`${Ts[s]||s}(${t[s]}) `;return n&&!t.z&&(a+="translateZ(0)"),a=a.trim(),o?a=o(t,i?"":a):r&&i&&(a="none"),a}(t,n,h,r):i.transform&&(i.transform="none")),u){const{originX:t="50%",originY:e="50%",originZ:n=0}=l;i.transformOrigin=`${t} ${e} ${n}`}}const pl=()=>({style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}});function gl(t,e,n){for(const r in e)!ks(e[r])&&!Cs(r,n)&&(t[r]=e[r])}function ml(t,e,n){const r={};return gl(r,t.style||{},t),Object.assign(r,function({transformTemplate:t},e,n){return(0,i.useMemo)((()=>{const r={style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}};return fl(r,e,{enableHardwareAcceleration:!n},t),Object.assign({},r.vars,r.style)}),[e])}(t,e,n)),t.transformValues?t.transformValues(r):r}function vl(t,e,n){const r={},i=ml(t,e,n);return t.drag&&!1!==t.dragListener&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===t.drag?"none":"pan-"+("x"===t.drag?"y":"x")),r.style=i,r}const bl=new Set(["initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","onHoverStart","onHoverEnd","layoutScroll","whileInView","onViewportEnter","onViewportLeave","viewport","whileTap","onTap","onTapStart","onTapCancel","animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView","onPan","onPanStart","onPanSessionStart","onPanEnd"]);function yl(t){return bl.has(t)}let xl=t=>!yl(t);try{!function(t){!t||(xl=e=>e.startsWith("on")?!yl(e):t(e))}(n(10351).A)}catch{}function wl(t,e,n){const r={};for(const i in t)(xl(i)||!0===n&&yl(i)||!e&&!yl(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}function _l(t,e,n){return"string"==typeof t?t:Hs.transform(e+n*t)}const Sl={offset:"stroke-dashoffset",array:"stroke-dasharray"},Cl={offset:"strokeDashoffset",array:"strokeDasharray"};function kl(t,{attrX:e,attrY:n,originX:r,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:s=0,...l},c,u){fl(t,l,c,u),t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:f}=t;h.transform&&(f&&(d.transform=h.transform),delete h.transform),f&&(void 0!==r||void 0!==i||d.transform)&&(d.transformOrigin=function(t,e,n){return`${_l(e,t.x,t.width)} ${_l(n,t.y,t.height)}`}(f,void 0!==r?r:.5,void 0!==i?i:.5)),void 0!==e&&(h.x=e),void 0!==n&&(h.y=n),void 0!==o&&function(t,e,n=1,r=0,i=!0){t.pathLength=1;const o=i?Sl:Cl;t[o.offset]=Hs.transform(-r);const a=Hs.transform(e),s=Hs.transform(n);t[o.array]=`${a} ${s}`}(h,o,a,s,!1)}const Tl=()=>({style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{},attrs:{}});function El(t,e){const n=(0,i.useMemo)((()=>{const n={style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{},attrs:{}};return kl(n,e,{enableHardwareAcceleration:!1},t.transformTemplate),{...n.attrs,style:{...n.style}}}),[e]);if(t.style){const e={};gl(e,t.style,t),n.style={...e,...n.style}}return n}function Ol(t=!1){return(e,n,r,o,{latestValues:a},s)=>{const l=(xs(e)?El:vl)(n,a,s),c={...wl(n,"string"==typeof e,t),...l,ref:o};return r&&(c["data-projection-id"]=r),(0,i.createElement)(e,c)}}const Ml=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function Pl(t,{style:e,vars:n},r,i){Object.assign(t.style,e,i&&i.getProjectionStyles(r));for(const o in n)t.style.setProperty(o,n[o])}const Al=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function jl(t,e,n,r){Pl(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(Al.has(i)?i:Ml(i),e.attrs[i])}function Dl(t){const{style:e}=t,n={};for(const r in e)(ks(e[r])||Cs(r,t))&&(n[r]=e[r]);return n}function Rl(t){const e=Dl(t);for(const n in t)if(ks(t[n])){e["x"===n||"y"===n?"attr"+n.toUpperCase():n]=t[n]}return e}function Il(t,e,n,r={},i={}){return"function"==typeof e&&(e=e(void 0!==n?n:t.custom,r,i)),"string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e&&(e=e(void 0!==n?n:t.custom,r,i)),e}const Ll=t=>Array.isArray(t),zl=t=>Ll(t)?t[t.length-1]||0:t;function Fl(t){const e=ks(t)?t.get():t;return(t=>Boolean(t&&"object"==typeof t&&t.mix&&t.toValue))(e)?e.toValue():e}const Nl=t=>(e,n)=>{const r=(0,i.useContext)(Xa),o=(0,i.useContext)(Ga),a=()=>function({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},r,i,o){const a={latestValues:Bl(r,i,o,t),renderState:e()};return n&&(a.mount=t=>n(r,t,a)),a}(t,e,r,o);return n?a():us(a)};function Bl(t,e,n,r){const i={},o=r(t);for(const d in o)i[d]=Fl(o[d]);let{initial:a,animate:s}=t;const l=rs(t),c=is(t);e&&c&&!l&&!1!==t.inherit&&(void 0===a&&(a=e.initial),void 0===s&&(s=e.animate));let u=!!n&&!1===n.initial;u=u||!1===a;const h=u?s:a;return h&&"boolean"!=typeof h&&!es(h)&&(Array.isArray(h)?h:[h]).forEach((e=>{const n=Il(t,e);if(!n)return;const{transitionEnd:r,transition:o,...a}=n;for(const t in a){let e=a[t];if(Array.isArray(e)){e=e[u?e.length-1:0]}null!==e&&(i[t]=e)}for(const t in r)i[t]=r[t]})),i}const Vl={useVisualState:Nl({scrapeMotionValuesFromProps:Rl,createRenderState:Tl,onMount:(t,e,{renderState:n,latestValues:r})=>{try{n.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}kl(n,r,{enableHardwareAcceleration:!1},t.transformTemplate),jl(e,n)}})},Hl={useVisualState:Nl({scrapeMotionValuesFromProps:Dl,createRenderState:pl})};var Wl;function Ul(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Yl(t,e,n,r){(0,i.useEffect)((()=>{const i=t.current;if(n&&i)return Ul(i,e,n,r)}),[t,e,n,r])}function Xl(t){return!!t.touches}!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(Wl||(Wl={}));const Gl={pageX:0,pageY:0};function $l(t,e="page"){const n=t.touches[0]||t.changedTouches[0]||Gl;return{x:n[e+"X"],y:n[e+"Y"]}}function ql(t,e="page"){return{x:t[e+"X"],y:t[e+"Y"]}}const Kl=(t,e=!1)=>{const n=e=>t(e,function(t,e="page"){return{point:Xl(t)?$l(t,e):ql(t,e)}}(e));return e?function(t){return e=>{const n=e instanceof MouseEvent;(!n||n&&0===e.button)&&t(e)}}(n):n},Zl={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},Jl={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function Ql(t){return $a&&null===window.onpointerdown?t:$a&&null===window.ontouchstart?Jl[t]:$a&&null===window.onmousedown?Zl[t]:t}function tc(t,e,n,r){return Ul(t,Ql(e),Kl(n,"pointerdown"===e),r)}function ec(t,e,n,r){return Yl(t,Ql(e),n&&Kl(n,"pointerdown"===e),r)}function nc(t){let e=null;return()=>null===e&&(e=t,()=>{e=null})}const rc=nc("dragHorizontal"),ic=nc("dragVertical");function oc(){const t=function(t){let e=!1;if("y"===t)e=ic();else if("x"===t)e=rc();else{const t=rc(),n=ic();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function ac(t,e,n){return(r,i)=>{!function(t){return typeof PointerEvent<"u"&&t instanceof PointerEvent?"mouse"===t.pointerType:t instanceof MouseEvent}(r)||oc()||(t.animationState&&t.animationState.setActive(Wl.Hover,e),n&&n(r,i))}}const sc=(t,e)=>!!e&&(t===e||sc(t,e.parentElement));function lc(t){return(0,i.useEffect)((()=>()=>t()),[])}function cc(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}const uc=(t,e,n)=>Math.min(Math.max(n,t),e),hc=.001;function dc({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let i,o,a=1-e;a=uc(.05,1,a),t=uc(.01,10,t/1e3),a<1?(i=e=>{const r=e*a,i=r*t,o=r-n,s=pc(e,a),l=Math.exp(-i);return hc-o/s*l},o=e=>{const r=e*a*t,o=r*n+n,s=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-r),c=pc(Math.pow(e,2),a);return(-i(e)+hc>0?-1:1)*((o-s)*l)/c}):(i=e=>Math.exp(-e*t)*((e-n)*t+1)-hc,o=e=>Math.exp(-e*t)*(t*t*(n-e)));const s=function(t,e,n){let r=n;for(let i=1;i<fc;i++)r-=t(r)/e(r);return r}(i,o,5/t);if(t*=1e3,isNaN(s))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(s,2)*r;return{stiffness:e,damping:2*a*Math.sqrt(r*e),duration:t}}}const fc=12;function pc(t,e){return t*Math.sqrt(1-e*e)}const gc=["duration","bounce"],mc=["stiffness","damping","mass"];function vc(t,e){return e.some((e=>void 0!==t[e]))}function bc(t){var{from:e=0,to:n=1,restSpeed:r=2,restDelta:i}=t,o=cc(t,["from","to","restSpeed","restDelta"]);const a={done:!1,value:e};let{stiffness:s,damping:l,mass:c,velocity:u,duration:h,isResolvedFromDuration:d}=function(t){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},t);if(!vc(t,mc)&&vc(t,gc)){const n=dc(t);e=Object.assign(Object.assign(Object.assign({},e),n),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}(o),f=yc,p=yc;function g(){const t=u?-u/1e3:0,r=n-e,o=l/(2*Math.sqrt(s*c)),a=Math.sqrt(s/c)/1e3;if(void 0===i&&(i=Math.min(Math.abs(n-e)/100,.4)),o<1){const e=pc(a,o);f=i=>{const s=Math.exp(-o*a*i);return n-s*((t+o*a*r)/e*Math.sin(e*i)+r*Math.cos(e*i))},p=n=>{const i=Math.exp(-o*a*n);return o*a*i*(Math.sin(e*n)*(t+o*a*r)/e+r*Math.cos(e*n))-i*(Math.cos(e*n)*(t+o*a*r)-e*r*Math.sin(e*n))}}else if(1===o)f=e=>n-Math.exp(-a*e)*(r+(t+a*r)*e);else{const e=a*Math.sqrt(o*o-1);f=i=>{const s=Math.exp(-o*a*i),l=Math.min(e*i,300);return n-s*((t+o*a*r)*Math.sinh(l)+e*r*Math.cosh(l))/e}}}return g(),{next:t=>{const e=f(t);if(d)a.done=t>=h;else{const o=1e3*p(t),s=Math.abs(o)<=r,l=Math.abs(n-e)<=i;a.done=s&&l}return a.value=a.done?n:e,a},flipTarget:()=>{u=-u,[e,n]=[n,e],g()}}}bc.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const yc=t=>0,xc=(t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r},wc=(t,e,n)=>-n*t+n*e+t;function _c(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Sc({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let i=0,o=0,a=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,s=2*n-r;i=_c(s,r,t+1/3),o=_c(s,r,t),a=_c(s,r,t-1/3)}else i=o=a=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*a),alpha:r}}const Cc=(t,e,n)=>{const r=t*t,i=e*e;return Math.sqrt(Math.max(0,n*(i-r)+r))},kc=[Js,Zs,$s],Tc=t=>kc.find((e=>e.test(t))),Ec=(t,e)=>{let n=Tc(t),r=Tc(e),i=n.parse(t),o=r.parse(e);n===$s&&(i=Sc(i),n=Zs),r===$s&&(o=Sc(o),r=Zs);const a=Object.assign({},i);return t=>{for(const e in a)"alpha"!==e&&(a[e]=Cc(i[e],o[e],t));return a.alpha=wc(i.alpha,o.alpha,t),n.transform(a)}},Oc=(t,e)=>n=>e(t(n)),Mc=(...t)=>t.reduce(Oc);function Pc(t,e){return(t=>"number"==typeof t)(t)?n=>wc(t,e,n):Qs.test(t)?Ec(t,e):Rc(t,e)}const Ac=(t,e)=>{const n=[...t],r=n.length,i=t.map(((t,n)=>Pc(t,e[n])));return t=>{for(let e=0;e<r;e++)n[e]=i[e](t);return n}},jc=(t,e)=>{const n=Object.assign(Object.assign({},t),e),r={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(r[i]=Pc(t[i],e[i]));return t=>{for(const e in r)n[e]=r[e](t);return n}};function Dc(t){const e=al.parse(t),n=e.length;let r=0,i=0,o=0;for(let a=0;a<n;a++)r||"number"==typeof e[a]?r++:void 0!==e[a].hue?o++:i++;return{parsed:e,numNumbers:r,numRGB:i,numHSL:o}}const Rc=(t,e)=>{const n=al.createTransformer(e),r=Dc(t),i=Dc(e);return r.numHSL===i.numHSL&&r.numRGB===i.numRGB&&r.numNumbers>=i.numNumbers?Mc(Ac(r.parsed,i.parsed),n):n=>`${n>0?e:t}`},Ic=(t,e)=>n=>wc(t,e,n);function Lc(t,e,n){const r=[],i=n||function(t){return"number"==typeof t?Ic:"string"==typeof t?Qs.test(t)?Ec:Rc:Array.isArray(t)?Ac:"object"==typeof t?jc:void 0}(t[0]),o=t.length-1;for(let a=0;a<o;a++){let n=i(t[a],t[a+1]);if(e){const t=Array.isArray(e)?e[a]:e;n=Mc(t,n)}r.push(n)}return r}function zc(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const o=t.length;e.length,!r||!Array.isArray(r)||r.length,t[0]>t[o-1]&&(t=[].concat(t),e=[].concat(e),t.reverse(),e.reverse());const a=Lc(e,r,i),s=2===o?function([t,e],[n]){return r=>n(xc(t,e,r))}(t,a):function(t,e){const n=t.length,r=n-1;return i=>{let o=0,a=!1;if(i<=t[0]?a=!0:i>=t[r]&&(o=r-1,a=!0),!a){let e=1;for(;e<n&&!(t[e]>i||e===r);e++);o=e-1}const s=xc(t[o],t[o+1],i);return e[o](s)}}(t,a);return n?e=>s(uc(t[0],t[o-1],e)):s}const Fc=t=>e=>1-t(1-e),Nc=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Bc=t=>e=>e*e*((t+1)*e-t),Vc=4/11,Hc=8/11,Wc=t=>t,Uc=(t=>e=>Math.pow(e,t))(2),Yc=Fc(Uc),Xc=Nc(Uc),Gc=t=>1-Math.sin(Math.acos(t)),$c=Fc(Gc),qc=Nc($c),Kc=Bc(1.525),Zc=Fc(Kc),Jc=Nc(Kc),Qc=(t=>{const e=Bc(t);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))})(1.525),tu=4356/361,eu=35442/1805,nu=16061/1805,ru=t=>{if(1===t||0===t)return t;const e=t*t;return t<Vc?7.5625*e:t<Hc?9.075*e-9.9*t+3.4:t<.9?tu*e-eu*t+nu:10.8*t*t-20.52*t+10.72},iu=Fc(ru);function ou(t,e){return t.map((()=>e||Xc)).splice(0,t.length-1)}function au({from:t=0,to:e=1,ease:n,offset:r,duration:i=300}){const o={done:!1,value:t},a=Array.isArray(e)?e:[t,e],s=function(t,e){return t.map((t=>t*e))}(r&&r.length===a.length?r:function(t){const e=t.length;return t.map(((t,n)=>0!==n?n/(e-1):0))}(a),i);function l(){return zc(s,a,{ease:Array.isArray(n)?n:ou(a,n)})}let c=l();return{next:t=>(o.value=c(t),o.done=t>=i,o),flipTarget:()=>{a.reverse(),c=l()}}}const su={keyframes:au,spring:bc,decay:function({velocity:t=0,from:e=0,power:n=.8,timeConstant:r=350,restDelta:i=.5,modifyTarget:o}){const a={done:!1,value:e};let s=n*t;const l=e+s,c=void 0===o?l:o(l);return c!==l&&(s=c-e),{next:t=>{const e=-s*Math.exp(-t/r);return a.done=!(e>i||e<-i),a.value=a.done?c:c+e,a},flipTarget:()=>{}}}};const lu=1/60*1e3,cu=typeof performance<"u"?()=>performance.now():()=>Date.now(),uu=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout((()=>t(cu())),lu);let hu=!0,du=!1,fu=!1;const pu={delta:0,timestamp:0},gu=["read","update","preRender","render","postRender"],mu=gu.reduce(((t,e)=>(t[e]=function(t){let e=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(t,o=!1,s=!1)=>{const l=s&&i,c=l?e:n;return o&&a.add(t),-1===c.indexOf(t)&&(c.push(t),l&&i&&(r=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),a.delete(t)},process:l=>{if(i)o=!0;else{if(i=!0,[e,n]=[n,e],n.length=0,r=e.length,r)for(let n=0;n<r;n++){const r=e[n];r(l),a.has(r)&&(s.schedule(r),t())}i=!1,o&&(o=!1,s.process(l))}}};return s}((()=>du=!0)),t)),{}),vu=gu.reduce(((t,e)=>{const n=mu[e];return t[e]=(t,e=!1,r=!1)=>(du||wu(),n.schedule(t,e,r)),t}),{}),bu=gu.reduce(((t,e)=>(t[e]=mu[e].cancel,t)),{});gu.reduce(((t,e)=>(t[e]=()=>mu[e].process(pu),t)),{});const yu=t=>mu[t].process(pu),xu=t=>{du=!1,pu.delta=hu?lu:Math.max(Math.min(t-pu.timestamp,40),1),pu.timestamp=t,fu=!0,gu.forEach(yu),fu=!1,du&&(hu=!1,uu(xu))},wu=()=>{du=!0,hu=!0,fu||uu(xu)},_u=()=>pu;function Su(t,e,n=0){return t-e-n}const Cu=t=>{const e=({delta:e})=>t(e);return{start:()=>vu.update(e,!0),stop:()=>bu.update(e)}};function ku(t){var e,n,{from:r,autoplay:i=!0,driver:o=Cu,elapsed:a=0,repeat:s=0,repeatType:l="loop",repeatDelay:c=0,onPlay:u,onStop:h,onComplete:d,onRepeat:f,onUpdate:p}=t,g=cc(t,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let m,v,b,{to:y}=g,x=0,w=g.duration,_=!1,S=!0;const C=function(t){if(Array.isArray(t.to))return au;if(su[t.type])return su[t.type];const e=new Set(Object.keys(t));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?au:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?bc:au}(g);null!==(n=(e=C).needsInterpolation)&&void 0!==n&&n.call(e,r,y)&&(b=zc([0,100],[r,y],{clamp:!1}),r=0,y=100);const k=C(Object.assign(Object.assign({},g),{from:r,to:y}));function T(){x++,"reverse"===l?(S=x%2===0,a=function(t,e,n=0,r=!0){return r?Su(e+-t,e,n):e-(t-e)+n}(a,w,c,S)):(a=Su(a,w,c),"mirror"===l&&k.flipTarget()),_=!1,f&&f()}function E(t){if(S||(t=-t),a+=t,!_){const t=k.next(Math.max(0,a));v=t.value,b&&(v=b(v)),_=S?t.done:a<=0}null==p||p(v),_&&(0===x&&(null!=w||(w=a)),x<s?function(t,e,n,r){return r?t>=e+n:t<=-n}(a,w,c,S)&&T():(m.stop(),d&&d()))}return i&&(null==u||u(),m=o(E),m.start()),{stop:()=>{null==h||h(),m.stop()}}}function Tu(t,e){return e?t*(1e3/e):0}const Eu=(t,e)=>1-3*e+3*t,Ou=(t,e)=>3*e-6*t,Mu=t=>3*t,Pu=(t,e,n)=>((Eu(e,n)*t+Ou(e,n))*t+Mu(e))*t,Au=(t,e,n)=>3*Eu(e,n)*t*t+2*Ou(e,n)*t+Mu(e);const ju=.1;function Du(t,e,n,r){if(t===e&&n===r)return Wc;const i=new Float32Array(11);for(let a=0;a<11;++a)i[a]=Pu(a*ju,t,n);function o(e){let r=0,o=1;for(;10!==o&&i[o]<=e;++o)r+=ju;--o;const a=r+(e-i[o])/(i[o+1]-i[o])*ju,s=Au(a,t,n);return s>=.001?function(t,e,n,r){for(let i=0;i<8;++i){const i=Au(e,n,r);if(0===i)return e;e-=(Pu(e,n,r)-t)/i}return e}(e,a,t,n):0===s?a:function(t,e,n,r,i){let o,a,s=0;do{a=e+(n-e)/2,o=Pu(a,r,i)-t,o>0?n=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(e,r,r+ju,t,n)}return t=>0===t||1===t?t:Pu(o(t),e,r)}const Ru=new Set;function Iu(t,e,n){t||Ru.has(e)||(console.warn(e),n&&console.warn(n),Ru.add(e))}const Lu=new WeakMap,zu=new WeakMap,Fu=t=>{const e=Lu.get(t.target);e&&e(t)},Nu=t=>{t.forEach(Fu)};function Bu(t,e,n){const r=function({root:t,...e}){const n=t||document;zu.has(n)||zu.set(n,{});const r=zu.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(Nu,{root:t,...e})),r[i]}(e);return Lu.set(t,n),r.observe(t),()=>{Lu.delete(t),r.unobserve(t)}}const Vu={some:0,all:1};function Hu(t,e,n,{root:r,margin:o,amount:a="some",once:s}){(0,i.useEffect)((()=>{if(!t)return;const i={root:null==r?void 0:r.current,rootMargin:o,threshold:"number"==typeof a?a:Vu[a]};return Bu(n.getInstance(),i,(t=>{const{isIntersecting:r}=t;if(e.isInView===r||(e.isInView=r,s&&!r&&e.hasEnteredView))return;r&&(e.hasEnteredView=!0),n.animationState&&n.animationState.setActive(Wl.InView,r);const i=n.getProps(),o=r?i.onViewportEnter:i.onViewportLeave;o&&o(t)}))}),[t,r,o,a])}function Wu(t,e,n,{fallback:r=!0}){(0,i.useEffect)((()=>{!t||!r||requestAnimationFrame((()=>{e.hasEnteredView=!0;const{onViewportEnter:t}=n.getProps();t&&t(null),n.animationState&&n.animationState.setActive(Wl.InView,!0)}))}),[t])}const Uu=t=>e=>(t(e),null),Yu={inView:Uu((function({visualElement:t,whileInView:e,onViewportEnter:n,onViewportLeave:r,viewport:o={}}){const a=(0,i.useRef)({hasEnteredView:!1,isInView:!1});let s=Boolean(e||n||r);o.once&&a.current.hasEnteredView&&(s=!1),(typeof IntersectionObserver>"u"?Wu:Hu)(s,a.current,t,o)})),tap:Uu((function({onTap:t,onTapStart:e,onTapCancel:n,whileTap:r,visualElement:o}){const a=t||e||n||r,s=(0,i.useRef)(!1),l=(0,i.useRef)(null),c={passive:!(e||t||n||p)};function u(){l.current&&l.current(),l.current=null}function h(){return u(),s.current=!1,o.animationState&&o.animationState.setActive(Wl.Tap,!1),!oc()}function d(e,r){!h()||(sc(o.getInstance(),e.target)?t&&t(e,r):n&&n(e,r))}function f(t,e){!h()||n&&n(t,e)}function p(t,n){u(),!s.current&&(s.current=!0,l.current=Mc(tc(window,"pointerup",d,c),tc(window,"pointercancel",f,c)),o.animationState&&o.animationState.setActive(Wl.Tap,!0),e&&e(t,n))}ec(o,"pointerdown",a?p:void 0,c),lc(u)})),focus:Uu((function({whileFocus:t,visualElement:e}){const{animationState:n}=e;Yl(e,"focus",t?()=>{n&&n.setActive(Wl.Focus,!0)}:void 0),Yl(e,"blur",t?()=>{n&&n.setActive(Wl.Focus,!1)}:void 0)})),hover:Uu((function({onHoverStart:t,onHoverEnd:e,whileHover:n,visualElement:r}){ec(r,"pointerenter",t||n?ac(r,!0,t):void 0,{passive:!t}),ec(r,"pointerleave",e||n?ac(r,!1,e):void 0,{passive:!e})}))};function Xu(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const Gu=t=>1e3*t,$u={linear:Wc,easeIn:Uc,easeInOut:Xc,easeOut:Yc,circIn:Gc,circInOut:qc,circOut:$c,backIn:Kc,backInOut:Jc,backOut:Zc,anticipate:Qc,bounceIn:iu,bounceInOut:t=>t<.5?.5*(1-ru(1-2*t)):.5*ru(2*t-1)+.5,bounceOut:ru},qu=t=>{if(Array.isArray(t)){t.length;const[e,n,r,i]=t;return Du(e,n,r,i)}return"string"==typeof t?$u[t]:t},Ku=(t,e)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&al.test(e)&&!e.startsWith("url(")),Zu=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),Ju=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),Qu=()=>({type:"keyframes",ease:"linear",duration:.3}),th=t=>({type:"keyframes",duration:.8,values:t}),eh={x:Zu,y:Zu,z:Zu,rotate:Zu,rotateX:Zu,rotateY:Zu,rotateZ:Zu,scaleX:Ju,scaleY:Ju,scale:Ju,opacity:Qu,backgroundColor:Qu,color:Qu,default:Ju},nh=(t,e)=>{let n;return n=Ll(e)?th:eh[t]||eh.default,{to:e,...n(e)}},rh={...dl,color:Qs,backgroundColor:Qs,outlineColor:Qs,fill:Qs,stroke:Qs,borderColor:Qs,borderTopColor:Qs,borderRightColor:Qs,borderBottomColor:Qs,borderLeftColor:Qs,filter:ul,WebkitFilter:ul},ih=t=>rh[t];function oh(t,e){var n;let r=ih(t);return r!==ul&&(r=al),null===(n=r.getAnimatableNone)||void 0===n?void 0:n.call(r,e)}const ah=!1;function sh({ease:t,times:e,yoyo:n,flip:r,loop:i,...o}){const a={...o};return e&&(a.offset=e),o.duration&&(a.duration=Gu(o.duration)),o.repeatDelay&&(a.repeatDelay=Gu(o.repeatDelay)),t&&(a.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(qu):qu(t)),"tween"===o.type&&(a.type="keyframes"),(n||i||r)&&(n?a.repeatType="reverse":i?a.repeatType="loop":r&&(a.repeatType="mirror"),a.repeat=i||n||r||o.repeat),"spring"!==o.type&&(a.type="keyframes"),a}function lh(t,e,n){return Array.isArray(e.to)&&void 0===t.duration&&(t.duration=.8),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:o,repeatType:a,repeatDelay:s,from:l,...c}){return!!Object.keys(c).length}(t)||(t={...t,...nh(n,e.to)}),{...e,...sh(t)}}function ch(t,e,n,r,i){const o=dh(r,t)||{};let a=void 0!==o.from?o.from:e.get();const s=Ku(t,n);"none"===a&&s&&"string"==typeof n?a=oh(t,n):uh(a)&&"string"==typeof n?a=hh(n):!Array.isArray(n)&&uh(n)&&"string"==typeof a&&(n=hh(a));return Ku(t,a)&&s&&!1!==o.type?function(){const r={from:a,to:n,velocity:e.getVelocity(),onComplete:i,onUpdate:t=>e.set(t)};return"inertia"===o.type||"decay"===o.type?function({from:t=0,velocity:e=0,min:n,max:r,power:i=.8,timeConstant:o=750,bounceStiffness:a=500,bounceDamping:s=10,restDelta:l=1,modifyTarget:c,driver:u,onUpdate:h,onComplete:d,onStop:f}){let p;function g(t){return void 0!==n&&t<n||void 0!==r&&t>r}function m(t){return void 0===n?r:void 0===r||Math.abs(n-t)<Math.abs(r-t)?n:r}function v(t){null==p||p.stop(),p=ku(Object.assign(Object.assign({},t),{driver:u,onUpdate:e=>{var n;null==h||h(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:d,onStop:f}))}function b(t){v(Object.assign({type:"spring",stiffness:a,damping:s,restDelta:l},t))}if(g(t))b({from:t,velocity:e,to:m(t)});else{let r=i*e+t;typeof c<"u"&&(r=c(r));const a=m(r),s=a===n?-1:1;let u,h;const d=t=>{u=h,h=t,e=Tu(t-u,_u().delta),(1===s&&t>a||-1===s&&t<a)&&b({from:t,to:a,velocity:e})};v({type:"decay",from:t,velocity:e,timeConstant:o,power:i,restDelta:l,modifyTarget:c,onUpdate:g(r)?d:void 0})}return{stop:()=>null==p?void 0:p.stop()}}({...r,...o}):ku({...lh(o,r,t),onUpdate:t=>{r.onUpdate(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{r.onComplete(),o.onComplete&&o.onComplete()}})}:function(){const t=zl(n);return e.set(t),i(),o.onUpdate&&o.onUpdate(t),o.onComplete&&o.onComplete(),{stop:()=>{}}}}function uh(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function hh(t){return"number"==typeof t?0:oh("",t)}function dh(t,e){return t[e]||t.default||t}function fh(t,e,n,r={}){return ah&&(r={type:!1}),e.start((i=>{let o,a;const s=ch(t,e,n,r,i),l=function(t,e){var n,r;return null!==(r=null!==(n=(dh(t,e)||{}).delay)&&void 0!==n?n:t.delay)&&void 0!==r?r:0}(r,t),c=()=>a=s();return l?o=window.setTimeout(c,Gu(l)):c(),()=>{clearTimeout(o),a&&a.stop()}}))}const ph=t=>/^\-?\d*\.?\d+$/.test(t),gh=t=>/^0[^.\s]+$/.test(t);class mh{constructor(){this.subscriptions=[]}add(t){return function(t,e){-1===t.indexOf(e)&&t.push(e)}(this.subscriptions,t),()=>function(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}(this.subscriptions,t)}notify(t,e,n){const r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let i=0;i<r;i++){const r=this.subscriptions[i];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class vh{constructor(t){this.version="7.5.1",this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new mh,this.velocityUpdateSubscribers=new mh,this.renderSubscribers=new mh,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:r}=_u();this.lastUpdated!==r&&(this.timeDelta=n,this.lastUpdated=r,vu.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.updateSubscribers.notify(this.current),this.velocityUpdateSubscribers.getSize()&&this.velocityUpdateSubscribers.notify(this.getVelocity()),e&&this.renderSubscribers.notify(this.current)},this.scheduleVelocityCheck=()=>vu.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.velocityUpdateSubscribers.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(t=>!isNaN(parseFloat(t)))(this.current)}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Tu(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise((e=>{this.hasAnimated=!0,this.stopAnimation=t(e)})).then((()=>this.clearAnimation()))}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}}function bh(t){return new vh(t)}const yh=t=>e=>e.test(t),xh=[Ls,Hs,Vs,Bs,Us,Ws,{test:t=>"auto"===t,parse:t=>t}],wh=t=>xh.find(yh(t)),_h=[...xh,Qs,al],Sh=t=>_h.find(yh(t));function Ch(t,e,n){const r=t.getProps();return Il(r,e,void 0!==n?n:r.custom,function(t){const e={};return t.forEachValue(((t,n)=>e[n]=t.get())),e}(t),function(t){const e={};return t.forEachValue(((t,n)=>e[n]=t.getVelocity())),e}(t))}function kh(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,bh(n))}function Th(t,e){return e?(e[t]||e.default||e).from:void 0}function Eh(t){return Boolean(ks(t)&&t.add)}function Oh(t,e,n={}){var r;const i=Ch(t,e,n.custom);let{transition:o=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(o=n.transitionOverride);const a=i?()=>Mh(t,i,n):()=>Promise.resolve(),s=null!==(r=t.variantChildren)&&void 0!==r&&r.size?(r=0)=>{const{delayChildren:i=0,staggerChildren:a,staggerDirection:s}=o;return function(t,e,n=0,r=0,i=1,o){const a=[],s=(t.variantChildren.size-1)*r,l=1===i?(t=0)=>t*r:(t=0)=>s-t*r;return Array.from(t.variantChildren).sort(Ph).forEach(((t,r)=>{a.push(Oh(t,e,{...o,delay:n+l(r)}).then((()=>t.notifyAnimationComplete(e))))})),Promise.all(a)}(t,e,i+r,a,s,n)}:()=>Promise.resolve(),{when:l}=o;if(l){const[t,e]="beforeChildren"===l?[a,s]:[s,a];return t().then(e)}return Promise.all([a(),s(n.delay)])}function Mh(t,e,{delay:n=0,transitionOverride:r,type:i}={}){var o;let{transition:a=t.getDefaultTransition(),transitionEnd:s,...l}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");r&&(a=r);const u=[],h=i&&(null===(o=t.animationState)||void 0===o?void 0:o.getState()[i]);for(const d in l){const e=t.getValue(d),r=l[d];if(!e||void 0===r||h&&Ah(h,d))continue;let i={delay:n,...a};t.shouldReduceMotion&&Ss.has(d)&&(i={...i,type:!1,delay:0});let o=fh(d,e,r,i);Eh(c)&&(c.add(d),o=o.then((()=>c.remove(d)))),u.push(o)}return Promise.all(u).then((()=>{s&&function(t,e){const n=Ch(t,e);let{transitionEnd:r={},transition:i={},...o}=n?t.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o)kh(t,a,zl(o[a]))}(t,s)}))}function Ph(t,e){return t.sortNodePosition(e)}function Ah({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}const jh=[Wl.Animate,Wl.InView,Wl.Focus,Wl.Hover,Wl.Tap,Wl.Drag,Wl.Exit],Dh=[...jh].reverse(),Rh=jh.length;function Ih(t){return e=>Promise.all(e.map((({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notifyAnimationStart(e),Array.isArray(e)){const i=e.map((e=>Oh(t,e,n)));r=Promise.all(i)}else if("string"==typeof e)r=Oh(t,e,n);else{const i="function"==typeof e?Ch(t,e,n.custom):e;r=Mh(t,i,n)}return r.then((()=>t.notifyAnimationComplete(e)))}(t,e,n))))}function Lh(t){let e=Ih(t);const n={[Wl.Animate]:Fh(!0),[Wl.InView]:Fh(),[Wl.Hover]:Fh(),[Wl.Tap]:Fh(),[Wl.Drag]:Fh(),[Wl.Focus]:Fh(),[Wl.Exit]:Fh()};let r=!0;const i=(e,n)=>{const r=Ch(t,n);if(r){const{transition:t,transitionEnd:n,...i}=r;e={...e,...i,...n}}return e};function o(o,a){var s;const l=t.getProps(),c=t.getVariantContext(!0)||{},u=[],h=new Set;let d={},f=1/0;for(let e=0;e<Rh;e++){const p=Dh[e],g=n[p],m=null!==(s=l[p])&&void 0!==s?s:c[p],v=ts(m),b=p===a?g.isActive:null;!1===b&&(f=e);let y=m===c[p]&&m!==l[p]&&v;if(y&&r&&t.manuallyAnimateOnMount&&(y=!1),g.protectedKeys={...d},!g.isActive&&null===b||!m&&!g.prevProp||es(m)||"boolean"==typeof m)continue;const x=zh(g.prevProp,m);let w=x||p===a&&g.isActive&&!y&&v||e>f&&v;const _=Array.isArray(m)?m:[m];let S=_.reduce(i,{});!1===b&&(S={});const{prevResolvedValues:C={}}=g,k={...C,...S},T=t=>{w=!0,h.delete(t),g.needsAnimating[t]=!0};for(const t in k){const e=S[t],n=C[t];d.hasOwnProperty(t)||(e!==n?Ll(e)&&Ll(n)?!Xu(e,n)||x?T(t):g.protectedKeys[t]=!0:void 0!==e?T(t):h.add(t):void 0!==e&&h.has(t)?T(t):g.protectedKeys[t]=!0)}g.prevProp=m,g.prevResolvedValues=S,g.isActive&&(d={...d,...S}),r&&t.blockInitialAnimation&&(w=!1),w&&!y&&u.push(..._.map((t=>({animation:t,options:{type:p,...o}}))))}if(h.size){const e={};h.forEach((n=>{const r=t.getBaseTarget(n);void 0!==r&&(e[n]=r)})),u.push({animation:e})}let p=Boolean(u.length);return r&&!1===l.initial&&!t.manuallyAnimateOnMount&&(p=!1),r=!1,p?e(u):Promise.resolve()}return{animateChanges:o,setActive:function(e,r,i){var a;if(n[e].isActive===r)return Promise.resolve();null===(a=t.variantChildren)||void 0===a||a.forEach((t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)})),n[e].isActive=r;const s=o(i,e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function zh(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Xu(e,t)}function Fh(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const Nh={animation:Uu((({visualElement:t,animate:e})=>{t.animationState||(t.animationState=Lh(t)),es(e)&&(0,i.useEffect)((()=>e.subscribe(t)),[e])})),exit:Uu((t=>{const{custom:e,visualElement:n}=t,[r,o]=function(){const t=(0,i.useContext)(Ga);if(null===t)return[!0,null];const{isPresent:e,onExitComplete:n,register:r}=t,o=(0,i.useId)();return(0,i.useEffect)((()=>r(o)),[]),!e&&n?[!1,()=>n&&n(o)]:[!0]}(),a=(0,i.useContext)(Ga);(0,i.useEffect)((()=>{n.isPresent=r;const t=n.animationState&&n.animationState.setActive(Wl.Exit,!r,{custom:a&&a.custom||e});t&&!r&&t.then(o)}),[r])}))};const Bh={current:null},Vh={current:!1};const Hh=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];const Wh=Object.keys(ls),Uh=Wh.length,Yh=({treeType:t="",build:e,getBaseTarget:n,makeTargetAnimatable:r,measureViewportBox:o,render:a,readValueFromInstance:s,removeValueFromRenderState:l,sortNodePosition:c,scrapeMotionValuesFromProps:u})=>({parent:h,props:d,presenceId:f,blockInitialAnimation:p,visualState:g,reducedMotionConfig:m},v={})=>{let b=!1;const{latestValues:y,renderState:x}=g;let w;const _=function(){const t=Hh.map((()=>new mh)),e={},n={clearAllListeners:()=>t.forEach((t=>t.clear())),updatePropListeners:t=>{Hh.forEach((r=>{var i;const o="on"+r,a=t[o];null===(i=e[r])||void 0===i||i.call(e),a&&(e[r]=n[o](a))}))}};return t.forEach(((t,e)=>{n["on"+Hh[e]]=e=>t.add(e),n["notify"+Hh[e]]=(...e)=>t.notify(...e)})),n}(),S=new Map,C=new Map;let k={};const T={...y};let E;function O(){!w||!b||(M(),a(w,x,d.style,L.projection))}function M(){e(L,x,y,v,d)}function P(){_.notifyUpdate(y)}function A(t,e){const n=e.onChange((e=>{y[t]=e,d.onUpdate&&vu.update(P,!1,!0)})),r=e.onRenderRequest(L.scheduleRender);C.set(t,(()=>{n(),r()}))}const{willChange:j,...D}=u(d);for(const t in D){const e=D[t];void 0!==y[t]&&ks(e)&&(e.set(y[t],!1),Eh(j)&&j.add(t))}if(d.values)for(const t in d.values)void 0!==y[t]&&d.values[t].set(y[t]);const R=rs(d),I=is(d),L={treeType:t,current:null,depth:h?h.depth+1:0,parent:h,children:new Set,presenceId:f,shouldReduceMotion:null,variantChildren:I?new Set:void 0,isVisible:void 0,manuallyAnimateOnMount:Boolean(null==h?void 0:h.isMounted()),blockInitialAnimation:p,isMounted:()=>Boolean(w),mount(t){b=!0,w=L.current=t,L.projection&&L.projection.mount(t),I&&h&&!R&&(E=null==h?void 0:h.addVariantChild(L)),S.forEach(((t,e)=>A(e,t))),Vh.current||function(){if(Vh.current=!0,$a)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Bh.current=t.matches;t.addListener(e),e()}else Bh.current=!1}(),L.shouldReduceMotion="never"!==m&&("always"===m||Bh.current),null==h||h.children.add(L),L.setProps(d)},unmount(){var t;null===(t=L.projection)||void 0===t||t.unmount(),bu.update(P),bu.render(O),C.forEach((t=>t())),null==E||E(),null==h||h.children.delete(L),_.clearAllListeners(),w=void 0,b=!1},loadFeatures(t,e,n,r,o,a){const s=[];for(let l=0;l<Uh;l++){const e=Wh[l],{isEnabled:n,Component:r}=ls[e];n(t)&&r&&s.push((0,i.createElement)(r,{key:e,...t,visualElement:L}))}if(!L.projection&&o){L.projection=new o(r,L.getLatestValues(),h&&h.projection);const{layoutId:e,layout:n,drag:i,dragConstraints:s,layoutScroll:l}=t;L.projection.setOptions({layoutId:e,layout:n,alwaysMeasureLayout:Boolean(i)||s&&Ja(s),visualElement:L,scheduleRender:()=>L.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:a,layoutScroll:l})}return s},addVariantChild(t){var e;const n=L.getClosestVariantNode();if(n)return null===(e=n.variantChildren)||void 0===e||e.add(t),()=>n.variantChildren.delete(t)},sortNodePosition:e=>c&&t===e.treeType?c(L.getInstance(),e.getInstance()):0,getClosestVariantNode:()=>I?L:null==h?void 0:h.getClosestVariantNode(),getLayoutId:()=>d.layoutId,getInstance:()=>w,getStaticValue:t=>y[t],setStaticValue:(t,e)=>y[t]=e,getLatestValues:()=>y,setVisibility(t){L.isVisible!==t&&(L.isVisible=t,L.scheduleRender())},makeTargetAnimatable:(t,e=!0)=>r(L,t,d,e),measureViewportBox:()=>o(w,d),addValue(t,e){L.hasValue(t)&&L.removeValue(t),S.set(t,e),y[t]=e.get(),A(t,e)},removeValue(t){var e;S.delete(t),null===(e=C.get(t))||void 0===e||e(),C.delete(t),delete y[t],l(t,x)},hasValue:t=>S.has(t),getValue(t,e){if(d.values&&d.values[t])return d.values[t];let n=S.get(t);return void 0===n&&void 0!==e&&(n=bh(e),L.addValue(t,n)),n},forEachValue:t=>S.forEach(t),readValue:t=>void 0!==y[t]?y[t]:s(w,t,v),setBaseTarget(t,e){T[t]=e},getBaseTarget(t){if(n){const e=n(d,t);if(void 0!==e&&!ks(e))return e}return T[t]},..._,build:()=>(M(),x),scheduleRender(){vu.render(O,!1,!0)},syncRender:O,setProps(t){(t.transformTemplate||d.transformTemplate)&&L.scheduleRender(),d=t,_.updatePropListeners(t),k=function(t,e,n){const{willChange:r}=e;for(const i in e){const o=e[i],a=n[i];if(ks(o))t.addValue(i,o),Eh(r)&&r.add(i);else if(ks(a))t.addValue(i,bh(o)),Eh(r)&&r.remove(i);else if(a!==o)if(t.hasValue(i)){const e=t.getValue(i);!e.hasAnimated&&e.set(o)}else{const e=t.getStaticValue(i);t.addValue(i,bh(void 0!==e?e:o))}}for(const i in n)void 0===e[i]&&t.removeValue(i);return e}(L,u(d),k)},getProps:()=>d,getVariant:t=>{var e;return null===(e=d.variants)||void 0===e?void 0:e[t]},getDefaultTransition:()=>d.transition,getTransformPagePoint:()=>d.transformPagePoint,getVariantContext(t=!1){if(t)return null==h?void 0:h.getVariantContext();if(!R){const t=(null==h?void 0:h.getVariantContext())||{};return void 0!==d.initial&&(t.initial=d.initial),t}const e={};for(let n=0;n<Gh;n++){const t=Xh[n],r=d[t];(ts(r)||!1===r)&&(e[t]=r)}return e}};return L},Xh=["initial",...jh],Gh=Xh.length;function $h(t){return"string"==typeof t&&t.startsWith("var(--")}const qh=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Kh(t,e,n=1){const[r,i]=function(t){const e=qh.exec(t);if(!e)return[,];const[,n,r]=e;return[n,r]}(t);if(!r)return;const o=window.getComputedStyle(e).getPropertyValue(r);return o?o.trim():$h(i)?Kh(i,e,n+1):i}const Zh=new Set(["width","height","top","left","right","bottom","x","y"]),Jh=t=>Zh.has(t),Qh=(t,e)=>{t.set(e,!1),t.set(e)},td=t=>t===Ls||t===Hs;var ed;!function(t){t.width="width",t.height="height",t.left="left",t.right="right",t.top="top",t.bottom="bottom"}(ed||(ed={}));const nd=(t,e)=>parseFloat(t.split(", ")[e]),rd=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return nd(i[1],e);{const e=r.match(/^matrix\((.+)\)$/);return e?nd(e[1],t):0}},id=new Set(["x","y","z"]),od=_s.filter((t=>!id.has(t)));const ad={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:rd(4,13),y:rd(5,14)},sd=(t,e,n={},r={})=>{e={...e},r={...r};const i=Object.keys(e).filter(Jh);let o=[],a=!1;const s=[];if(i.forEach((i=>{const l=t.getValue(i);if(!t.hasValue(i))return;let c=n[i],u=wh(c);const h=e[i];let d;if(Ll(h)){const t=h.length,e=null===h[0]?1:0;c=h[e],u=wh(c);for(let n=e;n<t;n++)d?wh(h[n]):d=wh(h[n])}else d=wh(h);if(u!==d)if(td(u)&&td(d)){const t=l.get();"string"==typeof t&&l.set(parseFloat(t)),"string"==typeof h?e[i]=parseFloat(h):Array.isArray(h)&&d===Hs&&(e[i]=h.map(parseFloat))}else(null==u?void 0:u.transform)&&(null==d?void 0:d.transform)&&(0===c||0===h)?0===c?l.set(d.transform(c)):e[i]=u.transform(h):(a||(o=function(t){const e=[];return od.forEach((n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))})),e.length&&t.syncRender(),e}(t),a=!0),s.push(i),r[i]=void 0!==r[i]?r[i]:e[i],Qh(l,h))})),s.length){const n=s.indexOf("height")>=0?window.pageYOffset:null,i=((t,e,n)=>{const r=e.measureViewportBox(),i=e.getInstance(),o=getComputedStyle(i),{display:a}=o,s={};"none"===a&&e.setStaticValue("display",t.display||"block"),n.forEach((t=>{s[t]=ad[t](r,o)})),e.syncRender();const l=e.measureViewportBox();return n.forEach((n=>{const r=e.getValue(n);Qh(r,s[n]),t[n]=ad[n](l,o)})),t})(e,t,s);return o.length&&o.forEach((([e,n])=>{t.getValue(e).set(n)})),t.syncRender(),$a&&null!==n&&window.scrollTo({top:n}),{target:i,transitionEnd:r}}return{target:e,transitionEnd:r}};function ld(t,e,n,r){return(t=>Object.keys(t).some(Jh))(e)?sd(t,e,n,r):{target:e,transitionEnd:r}}const cd=(t,e,n,r)=>{const i=function(t,{...e},n){const r=t.getInstance();if(!(r instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.forEachValue((t=>{const e=t.get();if(!$h(e))return;const n=Kh(e,r);n&&t.set(n)}));for(const i in e){const t=e[i];if(!$h(t))continue;const o=Kh(t,r);!o||(e[i]=o,n&&void 0===n[i]&&(n[i]=t))}return{target:e,transitionEnd:n}}(t,e,r);return ld(t,e=i.target,n,r=i.transitionEnd)};const ud={treeType:"dom",readValueFromInstance(t,e){if(Ss.has(e)){const t=ih(e);return t&&t.default||0}{const n=function(t){return window.getComputedStyle(t)}(t),r=(Os(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof r?r.trim():r}},sortNodePosition:(t,e)=>2&t.compareDocumentPosition(e)?1:-1,getBaseTarget(t,e){var n;return null===(n=t.style)||void 0===n?void 0:n[e]},measureViewportBox:(t,{transformPagePoint:e})=>function(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}(t,e),resetTransform(t,e,n){const{transformTemplate:r}=n;e.style.transform=r?r({},""):"none",t.scheduleRender()},restoreTransform(t,e){t.style.transform=e.style.transform},removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]},makeTargetAnimatable(t,{transition:e,transitionEnd:n,...r},{transformValues:i},o=!0){let a=function(t,e,n){var r;const i={};for(const o in t){const t=Th(o,e);i[o]=void 0!==t?t:null===(r=n.getValue(o))||void 0===r?void 0:r.get()}return i}(r,e||{},t);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){!function(t,e,n){var r,i;const o=Object.keys(e).filter((e=>!t.hasValue(e))),a=o.length;if(a)for(let s=0;s<a;s++){const a=o[s],l=e[a];let c=null;Array.isArray(l)&&(c=l[0]),null===c&&(c=null!==(i=null!==(r=n[a])&&void 0!==r?r:t.readValue(a))&&void 0!==i?i:e[a]),null!=c&&("string"==typeof c&&(ph(c)||gh(c))?c=parseFloat(c):!Sh(c)&&al.test(l)&&(c=oh(a,l)),t.addValue(a,bh(c)),void 0===n[a]&&(n[a]=c),t.setBaseTarget(a,c))}}(t,r,a);const e=cd(t,r,a,n);n=e.transitionEnd,r=e.target}return{transition:e,transitionEnd:n,...r}},scrapeMotionValuesFromProps:Dl,build(t,e,n,r,i){void 0!==t.isVisible&&(e.style.visibility=t.isVisible?"visible":"hidden"),fl(e,n,r,i.transformTemplate)},render:Pl},hd=Yh(ud),dd=Yh({...ud,getBaseTarget:(t,e)=>t[e],readValueFromInstance(t,e){var n;return Ss.has(e)?(null===(n=ih(e))||void 0===n?void 0:n.default)||0:(e=Al.has(e)?e:Ml(e),t.getAttribute(e))},scrapeMotionValuesFromProps:Rl,build(t,e,n,r,i){kl(e,n,r,i.transformTemplate)},render:jl}),fd=function(t){function e(e,n={}){return vs(t(e,n))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(t,r)=>(n.has(r)||n.set(r,e(r)),n.get(r))})}((function(t,{forwardMotionProps:e=!1},n,r,i){return{...xs(t)?Vl:Hl,preloadedFeatures:n,useRender:Ol(e),createVisualElement:r,projectionNodeConstructor:i,Component:t}}));function pd(){const t=(0,i.useRef)(!1);return qa((()=>(t.current=!0,()=>{t.current=!1})),[]),t}class gd extends i.Component{getSnapshotBeforeUpdate(t){const e=this.props.childRef.current;if(e&&t.isPresent&&!this.props.isPresent){const t=this.props.sizeRef.current;t.height=e.offsetHeight||0,t.width=e.offsetWidth||0,t.top=e.offsetTop,t.left=e.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function md({children:t,isPresent:e}){const n=(0,i.useId)(),r=(0,i.useRef)(null),o=(0,i.useRef)({width:0,height:0,top:0,left:0});return(0,i.useInsertionEffect)((()=>{const{width:t,height:i,top:a,left:s}=o.current;if(e||!r.current||!t||!i)return;r.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(`\n [data-motion-pop-id="${n}"] {\n position: absolute !important;\n width: ${t}px !important;\n height: ${i}px !important;\n top: ${a}px !important;\n left: ${s}px !important;\n }\n `),()=>{document.head.removeChild(l)}}),[e]),ar(gd,{isPresent:e,childRef:r,sizeRef:o,children:i.cloneElement(t,{ref:r})})}const vd=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:a,mode:s})=>{const l=us(bd),c=(0,i.useId)(),u=(0,i.useMemo)((()=>({id:c,initial:e,isPresent:n,custom:o,onExitComplete:t=>{l.set(t,!0);for(const e of l.values())if(!e)return;r&&r()},register:t=>(l.set(t,!1),()=>l.delete(t))})),a?void 0:[n]);return(0,i.useMemo)((()=>{l.forEach(((t,e)=>l.set(e,!1)))}),[n]),i.useEffect((()=>{!n&&!l.size&&r&&r()}),[n]),"popLayout"===s&&(t=ar(md,{isPresent:n,children:t})),ar(Ga.Provider,{value:u,children:t})};function bd(){return new Map}const yd=t=>t.key||"";const xd=({children:t,custom:e,initial:n=!0,onExitComplete:r,exitBeforeEnter:o,presenceAffectsLayout:a=!0,mode:s="sync"})=>{o&&(s="wait",Iu(!1,"Replace exitBeforeEnter with mode='wait'"));let[l]=function(){const t=pd(),[e,n]=(0,i.useState)(0),r=(0,i.useCallback)((()=>{t.current&&n(e+1)}),[e]);return[(0,i.useCallback)((()=>vu.postRender(r)),[r]),e]}();const c=(0,i.useContext)(fs).forceRender;c&&(l=c);const u=pd(),h=function(t){const e=[];return i.Children.forEach(t,(t=>{(0,i.isValidElement)(t)&&e.push(t)})),e}(t);let d=h;const f=new Set,p=(0,i.useRef)(d),g=(0,i.useRef)(new Map).current,m=(0,i.useRef)(!0);if(qa((()=>{m.current=!1,function(t,e){t.forEach((t=>{const n=yd(t);e.set(n,t)}))}(h,g),p.current=d})),lc((()=>{m.current=!0,g.clear(),f.clear()})),m.current)return ar(or,{children:d.map((t=>ar(vd,{isPresent:!0,initial:!!n&&void 0,presenceAffectsLayout:a,mode:s,children:t},yd(t))))});d=[...d];const v=p.current.map(yd),b=h.map(yd),y=v.length;for(let i=0;i<y;i++){const t=v[i];-1===b.indexOf(t)&&f.add(t)}return"wait"===s&&f.size&&(d=[]),f.forEach((t=>{if(-1!==b.indexOf(t))return;const n=g.get(t);if(!n)return;const i=v.indexOf(t);d.splice(i,0,ar(vd,{isPresent:!1,onExitComplete:()=>{g.delete(t),f.delete(t);const e=p.current.findIndex((e=>e.key===t));if(p.current.splice(e,1),!f.size){if(p.current=h,!1===u.current)return;l(),r&&r()}},custom:e,presenceAffectsLayout:a,mode:s,children:n},yd(n)))})),d=d.map((t=>{const e=t.key;return f.has(e)?t:ar(vd,{isPresent:!0,presenceAffectsLayout:a,mode:s,children:t},yd(t))})),ar(or,{children:f.size?d:d.map((t=>(0,i.cloneElement)(t)))})};function wd({children:t,features:e,strict:n=!1}){const[,r]=(0,i.useState)(!_d(e)),o=(0,i.useRef)(void 0);if(!_d(e)){const{renderer:t,...n}=e;o.current=t,cs(n)}return(0,i.useEffect)((()=>{_d(e)&&e().then((({renderer:t,...e})=>{cs(e),o.current=t,r(!0)}))}),[]),ar(Ka.Provider,{value:{renderer:o.current,strict:n},children:t})}function _d(t){return"function"==typeof t}const Sd={renderer:(t,e)=>xs(t)?dd(e,{enableHardwareAcceleration:!1}):hd(e,{enableHardwareAcceleration:!0}),...Nh,...Yu};function Cd(t,e,n){let[r,o]=(0,i.useState)(t||e),a=(0,i.useRef)(void 0!==t),s=a.current,l=void 0!==t,c=(0,i.useRef)(r);s!==l&&console.warn(`WARN: A component changed from ${s?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),a.current=l;let u=(0,i.useCallback)(((t,...e)=>{let r=(t,...e)=>{n&&(Object.is(c.current,t)||n(t,...e)),l||(c.current=t)};"function"==typeof t?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),o(((n,...i)=>{let o=t(l?c.current:n,...i);return r(o,...e),l?n:o}))):(l||o(t),r(t,...e))}),[l,n]);return l?c.current=t:t=r,[t,u]}function kd(t,e=-1/0,n=1/0){return Math.min(Math.max(t,e),n)}function Td(t,e,n=10){const r=Math.pow(n,e);return Math.round(t*r)/r}const Ed={prefix:String(Math.round(1e10*Math.random())),current:0},Od=i.createContext(Ed);const Md=typeof window<"u"?i.useLayoutEffect:()=>{};let Pd=new Map;function Ad(t,e){if(t===e)return t;let n=Pd.get(t);if(n)return n(e),e;let r=Pd.get(e);return r?(r(t),t):e}function jd(...t){return(...e)=>{for(let n of t)"function"==typeof n&&n(...e)}}function Dd(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let t in r){let n=e[t],i=r[t];"function"==typeof n&&"function"==typeof i&&"o"===t[0]&&"n"===t[1]&&t.charCodeAt(2)>=65&&t.charCodeAt(2)<=90?e[t]=jd(n,i):"className"!==t&&"UNSAFE_className"!==t||"string"!=typeof n||"string"!=typeof i?"id"===t&&n&&i?e.id=Ad(n,i):e[t]=void 0!==i?i:n:e[t]=yr(n,i)}}return e}function Rd(t){if(function(){if(null==Id){Id=!1;try{document.createElement("div").focus({get preventScroll(){return Id=!0,!0}})}catch{}}return Id}())t.focus({preventScroll:!0});else{let e=function(t){for(var e=t.parentNode,n=[],r=document.scrollingElement||document.documentElement;e instanceof HTMLElement&&e!==r;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&n.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}(t);t.focus(),function(t){for(let{element:e,scrollTop:n,scrollLeft:r}of t)e.scrollTop=n,e.scrollLeft=r}(e)}}let Id=null;let Ld=new Map,zd=new Set;function Fd(){if(typeof window>"u")return;let t=e=>{let n=Ld.get(e.target);if(n&&(n.delete(e.propertyName),0===n.size&&(e.target.removeEventListener("transitioncancel",t),Ld.delete(e.target)),0===Ld.size)){for(let t of zd)t();zd.clear()}};document.body.addEventListener("transitionrun",(e=>{let n=Ld.get(e.target);n||(n=new Set,Ld.set(e.target,n),e.target.addEventListener("transitioncancel",t)),n.add(e.propertyName)})),document.body.addEventListener("transitionend",t)}function Nd(){let t=(0,i.useRef)(new Map),e=(0,i.useCallback)(((e,n,r,i)=>{let o=null!=i&&i.once?(...e)=>{t.current.delete(r),r(...e)}:r;t.current.set(r,{type:n,eventTarget:e,fn:o,options:i}),e.addEventListener(n,r,i)}),[]),n=(0,i.useCallback)(((e,n,r,i)=>{var o;let a=(null===(o=t.current.get(r))||void 0===o?void 0:o.fn)||r;e.removeEventListener(n,a,i),t.current.delete(r)}),[]),r=(0,i.useCallback)((()=>{t.current.forEach(((t,e)=>{n(t.eventTarget,t.type,e,t.options)}))}),[n]);return(0,i.useEffect)((()=>r),[r]),{addGlobalListener:e,removeGlobalListener:n,removeAllGlobalListeners:r}}function Bd(t){const e=(0,i.useRef)();return Md((()=>{!t||("function"==typeof t?t(e.current):t.current=e.current)}),[t]),e}typeof document<"u"&&("loading"!==document.readyState?Fd():document.addEventListener("DOMContentLoaded",Fd));let Vd=typeof window<"u"&&window.visualViewport;function Hd(){return{width:(null==Vd?void 0:Vd.width)||window.innerWidth,height:(null==Vd?void 0:Vd.height)||window.innerHeight}}function Wd(){return function(t){var e;return typeof window<"u"&&null!=window.navigator&&t.test((null===(e=window.navigator.userAgentData)||void 0===e?void 0:e.platform)||window.navigator.platform)}(/^Mac/i)}var Ud={};const Yd=d(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));!function(t){var e,n=n||{version:"5.2.4"};if(t.fabric=n,typeof document<"u"&&typeof window<"u")document instanceof(typeof HTMLDocument<"u"?HTMLDocument:Document)?n.document=document:n.document=document.implementation.createHTMLDocument(""),n.window=window;else{var r=new Yd.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;n.document=r.document,n.jsdomImplForWrapper=Yd.implForWrapper,n.nodeCanvas=Yd.Canvas,n.window=r,DOMParser=n.window.DOMParser}function i(t,e){var n=t.canvas,r=e.targetCanvas,i=r.getContext("2d");i.translate(0,r.height),i.scale(1,-1);var o=n.height-r.height;i.drawImage(n,0,o,r.width,r.height,0,0,r.width,r.height)}function o(t,e){var n=e.targetCanvas.getContext("2d"),r=e.destinationWidth,i=e.destinationHeight,o=r*i*4,a=new Uint8Array(this.imageBuffer,0,o),s=new Uint8ClampedArray(this.imageBuffer,0,o);t.readPixels(0,0,r,i,t.RGBA,t.UNSIGNED_BYTE,a);var l=new ImageData(s,r,i);n.putImageData(l,0,0)}n.isTouchSupported="ontouchstart"in n.window||"ontouchstart"in n.document||n.window&&n.window.navigator&&n.window.navigator.maxTouchPoints>0,n.isLikelyNode=typeof s<"u"&&typeof window>"u",n.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"],n.DPI=96,n.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)",n.commaWsp="(?:\\s+,?\\s*|,\\s*)",n.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,n.reNonWord=/[ \n\.,;!\?\-]/,n.fontPaths={},n.iMatrix=[1,0,0,1,0,0],n.svgNS="http://www.w3.org/2000/svg",n.perfLimitSizeTotal=2097152,n.maxCacheSideLimit=4096,n.minCacheSideLimit=256,n.charWidthsCache={},n.textureSize=2048,n.disableStyleCopyPaste=!1,n.enableGLFiltering=!0,n.devicePixelRatio=n.window.devicePixelRatio||n.window.webkitDevicePixelRatio||n.window.mozDevicePixelRatio||1,n.browserShadowBlurConstant=1,n.arcToSegmentsCache={},n.boundsOfCurveCache={},n.cachesBoundsOfCurve=!0,n.forceGLPutImageData=!1,n.initFilterBackend=function(){return n.enableGLFiltering&&n.isWebglSupported&&n.isWebglSupported(n.textureSize)?(console.log("max texture size: "+n.maxTextureSize),new n.WebglFilterBackend({tileSize:n.textureSize})):n.Canvas2dFilterBackend?new n.Canvas2dFilterBackend:void 0},typeof document<"u"&&typeof window<"u"&&(window.fabric=n),function(){function t(t,e){if(this.__eventListeners[t]){var r=this.__eventListeners[t];e?r[r.indexOf(e)]=!1:n.util.array.fill(r,!1)}}function e(t,e){var n=function(){e.apply(this,arguments),this.off(t,n)}.bind(this);this.on(t,n)}n.Observable={fire:function(t,e){if(!this.__eventListeners)return this;var n=this.__eventListeners[t];if(!n)return this;for(var r=0,i=n.length;r<i;r++)n[r]&&n[r].call(this,e||{});return this.__eventListeners[t]=n.filter((function(t){return!1!==t})),this},on:function(t,e){if(this.__eventListeners||(this.__eventListeners={}),1===arguments.length)for(var n in t)this.on(n,t[n]);else this.__eventListeners[t]||(this.__eventListeners[t]=[]),this.__eventListeners[t].push(e);return this},once:function(t,n){if(1===arguments.length)for(var r in t)e.call(this,r,t[r]);else e.call(this,t,n);return this},off:function(e,n){if(!this.__eventListeners)return this;if(0===arguments.length)for(e in this.__eventListeners)t.call(this,e);else if(1===arguments.length&&"object"==typeof arguments[0])for(var r in e)t.call(this,r,e[r]);else t.call(this,e,n);return this}}}(),n.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var t=0,e=arguments.length;t<e;t++)this._onObjectAdded(arguments[t]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(t,e,n){var r=this._objects;return n?r[e]=t:r.splice(e,0,t),this._onObjectAdded&&this._onObjectAdded(t),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var t,e=this._objects,n=!1,r=0,i=arguments.length;r<i;r++)-1!==(t=e.indexOf(arguments[r]))&&(n=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&n&&this.requestRenderAll(),this},forEachObject:function(t,e){for(var n=this.getObjects(),r=0,i=n.length;r<i;r++)t.call(e,n[r],r,n);return this},getObjects:function(t){return typeof t>"u"?this._objects.concat():this._objects.filter((function(e){return e.type===t}))},item:function(t){return this._objects[t]},isEmpty:function(){return 0===this._objects.length},size:function(){return this._objects.length},contains:function(t,e){return this._objects.indexOf(t)>-1||!!e&&this._objects.some((function(e){return"function"==typeof e.contains&&e.contains(t,!0)}))},complexity:function(){return this._objects.reduce((function(t,e){return t+=e.complexity?e.complexity():0}),0)}},n.CommonMethods={_setOptions:function(t){for(var e in t)this.set(e,t[e])},_initGradient:function(t,e){t&&t.colorStops&&!(t instanceof n.Gradient)&&this.set(e,new n.Gradient(t))},_initPattern:function(t,e,r){!t||!t.source||t instanceof n.Pattern?r&&r():this.set(e,new n.Pattern(t,r))},_setObject:function(t){for(var e in t)this._set(e,t[e])},set:function(t,e){return"object"==typeof t?this._setObject(t):this._set(t,e),this},_set:function(t,e){this[t]=e},toggle:function(t){var e=this.get(t);return"boolean"==typeof e&&this.set(t,!e),this},get:function(t){return this[t]}},function(t){var e=Math.sqrt,r=Math.atan2,i=Math.pow,o=Math.PI/180,a=Math.PI/2;n.util={cos:function(t){if(0===t)return 1;switch(t<0&&(t=-t),t/a){case 1:case 3:return 0;case 2:return-1}return Math.cos(t)},sin:function(t){if(0===t)return 0;var e=1;switch(t<0&&(e=-1),t/a){case 1:return e;case 2:return 0;case 3:return-e}return Math.sin(t)},removeFromArray:function(t,e){var n=t.indexOf(e);return-1!==n&&t.splice(n,1),t},getRandomInt:function(t,e){return Math.floor(Math.random()*(e-t+1))+t},degreesToRadians:function(t){return t*o},radiansToDegrees:function(t){return t/o},rotatePoint:function(t,e,r){var i=new n.Point(t.x-e.x,t.y-e.y),o=n.util.rotateVector(i,r);return new n.Point(o.x,o.y).addEquals(e)},rotateVector:function(t,e){var r=n.util.sin(e),i=n.util.cos(e);return{x:t.x*i-t.y*r,y:t.x*r+t.y*i}},createVector:function(t,e){return new n.Point(e.x-t.x,e.y-t.y)},calcAngleBetweenVectors:function(t,e){return Math.acos((t.x*e.x+t.y*e.y)/(Math.hypot(t.x,t.y)*Math.hypot(e.x,e.y)))},getHatVector:function(t){return new n.Point(t.x,t.y).multiply(1/Math.hypot(t.x,t.y))},getBisector:function(t,e,r){var i=n.util.createVector(t,e),o=n.util.createVector(t,r),a=n.util.calcAngleBetweenVectors(i,o),s=a*(0===n.util.calcAngleBetweenVectors(n.util.rotateVector(i,a),o)?1:-1)/2;return{vector:n.util.getHatVector(n.util.rotateVector(i,s)),angle:a}},projectStrokeOnPoints:function(t,e,r){var i=[],o=e.strokeWidth/2,a=e.strokeUniform?new n.Point(1/e.scaleX,1/e.scaleY):new n.Point(1,1),s=function(t){var e=o/Math.hypot(t.x,t.y);return new n.Point(t.x*e*a.x,t.y*e*a.y)};return t.length<=1||t.forEach((function(l,c){var u,h,d=new n.Point(l.x,l.y);0===c?(h=t[c+1],u=r?s(n.util.createVector(h,d)).addEquals(d):t[t.length-1]):c===t.length-1?(u=t[c-1],h=r?s(n.util.createVector(u,d)).addEquals(d):t[0]):(u=t[c-1],h=t[c+1]);var f,p,g=n.util.getBisector(d,u,h),m=g.vector,v=g.angle;if("miter"===e.strokeLineJoin&&(f=-o/Math.sin(v/2),p=new n.Point(m.x*f*a.x,m.y*f*a.y),Math.hypot(p.x,p.y)/o<=e.strokeMiterLimit))return i.push(d.add(p)),void i.push(d.subtract(p));f=-o*Math.SQRT2,p=new n.Point(m.x*f*a.x,m.y*f*a.y),i.push(d.add(p)),i.push(d.subtract(p))})),i},transformPoint:function(t,e,r){return r?new n.Point(e[0]*t.x+e[2]*t.y,e[1]*t.x+e[3]*t.y):new n.Point(e[0]*t.x+e[2]*t.y+e[4],e[1]*t.x+e[3]*t.y+e[5])},makeBoundingBoxFromPoints:function(t,e){if(e)for(var r=0;r<t.length;r++)t[r]=n.util.transformPoint(t[r],e);var i=[t[0].x,t[1].x,t[2].x,t[3].x],o=n.util.array.min(i),a=n.util.array.max(i)-o,s=[t[0].y,t[1].y,t[2].y,t[3].y],l=n.util.array.min(s);return{left:o,top:l,width:a,height:n.util.array.max(s)-l}},invertTransform:function(t){var e=1/(t[0]*t[3]-t[1]*t[2]),r=[e*t[3],-e*t[1],-e*t[2],e*t[0]],i=n.util.transformPoint({x:t[4],y:t[5]},r,!0);return r[4]=-i.x,r[5]=-i.y,r},toFixed:function(t,e){return parseFloat(Number(t).toFixed(e))},parseUnit:function(t,e){var r=/\D{0,2}$/.exec(t),i=parseFloat(t);switch(e||(e=n.Text.DEFAULT_SVG_FONT_SIZE),r[0]){case"mm":return i*n.DPI/25.4;case"cm":return i*n.DPI/2.54;case"in":return i*n.DPI;case"pt":return i*n.DPI/72;case"pc":return i*n.DPI/72*12;case"em":return i*e;default:return i}},falseFunction:function(){return!1},getKlass:function(t,e){return t=n.util.string.camelize(t.charAt(0).toUpperCase()+t.slice(1)),n.util.resolveNamespace(e)[t]},getSvgAttributes:function(t){var e=["instantiated_by_use","style","id","class"];switch(t){case"linearGradient":e=e.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":e=e.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":e=e.concat(["offset","stop-color","stop-opacity"])}return e},resolveNamespace:function(e){if(!e)return n;var r,i=e.split("."),o=i.length,a=t||n.window;for(r=0;r<o;++r)a=a[i[r]];return a},loadImage:function(t,e,r,i){if(t){var o=n.util.createImage(),a=function(){e&&e.call(r,o,!1),o=o.onload=o.onerror=null};o.onload=a,o.onerror=function(){n.log("Error loading "+o.src),e&&e.call(r,null,!0),o=o.onload=o.onerror=null},0!==t.indexOf("data")&&void 0!==i&&null!==i&&(o.crossOrigin=i),"data:image/svg"===t.substring(0,14)&&(o.onload=null,n.util.loadImageInDom(o,a)),o.src=t}else e&&e.call(r,t)},loadImageInDom:function(t,e){var r=n.document.createElement("div");r.style.width=r.style.height="1px",r.style.left=r.style.top="-100%",r.style.position="absolute",r.appendChild(t),n.document.querySelector("body").appendChild(r),t.onload=function(){e(),r.parentNode.removeChild(r),r=null}},enlivenObjects:function(t,e,r,i){var o=[],a=0,s=(t=t||[]).length;function l(){++a===s&&e&&e(o.filter((function(t){return t})))}s?t.forEach((function(t,e){t&&t.type?n.util.getKlass(t.type,r).fromObject(t,(function(n,r){r||(o[e]=n),i&&i(t,n,r),l()})):l()})):e&&e(o)},enlivenObjectEnlivables:function(t,e,r){var i=n.Object.ENLIVEN_PROPS.filter((function(e){return!!t[e]}));n.util.enlivenObjects(i.map((function(e){return t[e]})),(function(t){var n={};i.forEach((function(r,i){n[r]=t[i],e&&(e[r]=t[i])})),r&&r(n)}))},enlivenPatterns:function(t,e){function r(){++o===a&&e&&e(i)}var i=[],o=0,a=(t=t||[]).length;a?t.forEach((function(t,e){t&&t.source?new n.Pattern(t,(function(t){i[e]=t,r()})):(i[e]=t,r())})):e&&e(i)},groupSVGElements:function(t,e,r){var i;return t&&1===t.length?(typeof r<"u"&&(t[0].sourcePath=r),t[0]):(e&&(e.width&&e.height?e.centerPoint={x:e.width/2,y:e.height/2}:(delete e.width,delete e.height)),i=new n.Group(t,e),typeof r<"u"&&(i.sourcePath=r),i)},populateWithProperties:function(t,e,n){if(n&&Array.isArray(n))for(var r=0,i=n.length;r<i;r++)n[r]in t&&(e[n[r]]=t[n[r]])},createCanvasElement:function(){return n.document.createElement("canvas")},copyCanvasElement:function(t){var e=n.util.createCanvasElement();return e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0),e},toDataURL:function(t,e,n){return t.toDataURL("image/"+e,n)},createImage:function(){return n.document.createElement("img")},multiplyTransformMatrices:function(t,e,n){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],n?0:t[0]*e[4]+t[2]*e[5]+t[4],n?0:t[1]*e[4]+t[3]*e[5]+t[5]]},qrDecompose:function(t){var n=r(t[1],t[0]),a=i(t[0],2)+i(t[1],2),s=e(a),l=(t[0]*t[3]-t[2]*t[1])/s,c=r(t[0]*t[2]+t[1]*t[3],a);return{angle:n/o,scaleX:s,scaleY:l,skewX:c/o,skewY:0,translateX:t[4],translateY:t[5]}},calcRotateMatrix:function(t){if(!t.angle)return n.iMatrix.concat();var e=n.util.degreesToRadians(t.angle),r=n.util.cos(e),i=n.util.sin(e);return[r,i,-i,r,0,0]},calcDimensionsMatrix:function(t){var e=typeof t.scaleX>"u"?1:t.scaleX,r=typeof t.scaleY>"u"?1:t.scaleY,i=[t.flipX?-e:e,0,0,t.flipY?-r:r,0,0],o=n.util.multiplyTransformMatrices,a=n.util.degreesToRadians;return t.skewX&&(i=o(i,[1,0,Math.tan(a(t.skewX)),1],!0)),t.skewY&&(i=o(i,[1,Math.tan(a(t.skewY)),0,1],!0)),i},composeMatrix:function(t){var e=[1,0,0,1,t.translateX||0,t.translateY||0],r=n.util.multiplyTransformMatrices;return t.angle&&(e=r(e,n.util.calcRotateMatrix(t))),(1!==t.scaleX||1!==t.scaleY||t.skewX||t.skewY||t.flipX||t.flipY)&&(e=r(e,n.util.calcDimensionsMatrix(t))),e},resetObjectTransform:function(t){t.scaleX=1,t.scaleY=1,t.skewX=0,t.skewY=0,t.flipX=!1,t.flipY=!1,t.rotate(0)},saveObjectTransform:function(t){return{scaleX:t.scaleX,scaleY:t.scaleY,skewX:t.skewX,skewY:t.skewY,angle:t.angle,left:t.left,flipX:t.flipX,flipY:t.flipY,top:t.top}},isTransparent:function(t,e,n,r){r>0&&(e>r?e-=r:e=0,n>r?n-=r:n=0);var i,o=!0,a=t.getImageData(e,n,2*r||1,2*r||1),s=a.data.length;for(i=3;i<s&&!1!==(o=a.data[i]<=0);i+=4);return a=null,o},parsePreserveAspectRatioAttribute:function(t){var e,n="meet",r=t.split(" ");return r&&r.length&&("meet"!==(n=r.pop())&&"slice"!==n?(e=n,n="meet"):r.length&&(e=r.pop())),{meetOrSlice:n,alignX:"none"!==e?e.slice(1,4):"none",alignY:"none"!==e?e.slice(5,8):"none"}},clearFabricFontCache:function(t){(t=(t||"").toLowerCase())?n.charWidthsCache[t]&&delete n.charWidthsCache[t]:n.charWidthsCache={}},limitDimsByArea:function(t,e){var n=Math.sqrt(e*t),r=Math.floor(e/n);return{x:Math.floor(n),y:r}},capValue:function(t,e,n){return Math.max(t,Math.min(e,n))},findScaleToFit:function(t,e){return Math.min(e.width/t.width,e.height/t.height)},findScaleToCover:function(t,e){return Math.max(e.width/t.width,e.height/t.height)},matrixToSVG:function(t){return"matrix("+t.map((function(t){return n.util.toFixed(t,n.Object.NUM_FRACTION_DIGITS)})).join(" ")+")"},removeTransformFromObject:function(t,e){var r=n.util.invertTransform(e),i=n.util.multiplyTransformMatrices(r,t.calcOwnMatrix());n.util.applyTransformToObject(t,i)},addTransformToObject:function(t,e){n.util.applyTransformToObject(t,n.util.multiplyTransformMatrices(e,t.calcOwnMatrix()))},applyTransformToObject:function(t,e){var r=n.util.qrDecompose(e),i=new n.Point(r.translateX,r.translateY);t.flipX=!1,t.flipY=!1,t.set("scaleX",r.scaleX),t.set("scaleY",r.scaleY),t.skewX=r.skewX,t.skewY=r.skewY,t.angle=r.angle,t.setPositionByOrigin(i,"center","center")},sizeAfterTransform:function(t,e,r){var i=t/2,o=e/2,a=[{x:-i,y:-o},{x:i,y:-o},{x:-i,y:o},{x:i,y:o}],s=n.util.calcDimensionsMatrix(r),l=n.util.makeBoundingBoxFromPoints(a,s);return{x:l.width,y:l.height}},mergeClipPaths:function(t,e){var r=t,i=e;r.inverted&&!i.inverted&&(r=e,i=t),n.util.applyTransformToObject(i,n.util.multiplyTransformMatrices(n.util.invertTransform(r.calcTransformMatrix()),i.calcTransformMatrix()));var o=r.inverted&&i.inverted;return o&&(r.inverted=i.inverted=!1),new n.Group([r],{clipPath:i,inverted:o})},hasStyleChanged:function(t,e,n){return n=n||!1,t.fill!==e.fill||t.stroke!==e.stroke||t.strokeWidth!==e.strokeWidth||t.fontSize!==e.fontSize||t.fontFamily!==e.fontFamily||t.fontWeight!==e.fontWeight||t.fontStyle!==e.fontStyle||t.deltaY!==e.deltaY||n&&(t.overline!==e.overline||t.underline!==e.underline||t.linethrough!==e.linethrough)},stylesToArray:function(t,e){t=n.util.object.clone(t,!0);for(var r=e.split("\n"),i=-1,o={},a=[],s=0;s<r.length;s++)if(t[s])for(var l=0;l<r[s].length;l++){i++;var c=t[s][l];if(c)n.util.hasStyleChanged(o,c,!0)?a.push({start:i,end:i+1,style:c}):a[a.length-1].end++;o=c||{}}else i+=r[s].length;return a},stylesFromArray:function(t,e){if(!Array.isArray(t))return t;for(var n=e.split("\n"),r=-1,i=0,o={},a=0;a<n.length;a++)for(var s=0;s<n[a].length;s++)r++,t[i]&&t[i].start<=r&&r<t[i].end&&(o[a]=o[a]||{},o[a][s]=Object.assign({},t[i].style),r===t[i].end-1&&i++);return o}}}(t),function(){var t=Array.prototype.join,e={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},r={m:"l",M:"L"};function i(t,e,r,i,o,a,s,l,c,u,h){var d=n.util.cos(t),f=n.util.sin(t),p=n.util.cos(e),g=n.util.sin(e),m=r*o*p-i*a*g+s,v=i*o*p+r*a*g+l;return["C",u+c*(-r*o*f-i*a*d),h+c*(-i*o*f+r*a*d),m+c*(r*o*g+i*a*p),v+c*(i*o*g-r*a*p),m,v]}function o(t,e,n,r){var i=Math.atan2(e,t),o=Math.atan2(r,n);return o>=i?o-i:2*Math.PI-(i-o)}function a(t,e,r){for(var a=r[1],s=r[2],l=r[3],c=r[4],u=r[5],h=function(t,e,r,a,s,l,c){var u=Math.PI,h=c*u/180,d=n.util.sin(h),f=n.util.cos(h),p=0,g=0,m=-f*t*.5-d*e*.5,v=-f*e*.5+d*t*.5,b=(r=Math.abs(r))*r,y=(a=Math.abs(a))*a,x=v*v,w=m*m,_=b*y-b*x-y*w,S=0;if(_<0){var C=Math.sqrt(1-_/(b*y));r*=C,a*=C}else S=(s===l?-1:1)*Math.sqrt(_/(b*x+y*w));var k=S*r*v/a,T=-S*a*m/r,E=f*k-d*T+.5*t,O=d*k+f*T+.5*e,M=o(1,0,(m-k)/r,(v-T)/a),P=o((m-k)/r,(v-T)/a,(-m-k)/r,(-v-T)/a);0===l&&P>0?P-=2*u:1===l&&P<0&&(P+=2*u);for(var A=Math.ceil(Math.abs(P/u*2)),j=[],D=P/A,R=8/3*Math.sin(D/4)*Math.sin(D/4)/Math.sin(D/2),I=M+D,L=0;L<A;L++)j[L]=i(M,I,f,d,r,a,E,O,R,p,g),p=j[L][5],g=j[L][6],M=I,I+=D;return j}(r[6]-t,r[7]-e,a,s,c,u,l),d=0,f=h.length;d<f;d++)h[d][1]+=t,h[d][2]+=e,h[d][3]+=t,h[d][4]+=e,h[d][5]+=t,h[d][6]+=e;return h}function s(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function l(t,e,n,r,i,o,a,s){return function(l){var c=function(t){return t*t*t}(l),u=function(t){return 3*t*t*(1-t)}(l),h=function(t){return 3*t*(1-t)*(1-t)}(l),d=function(t){return(1-t)*(1-t)*(1-t)}(l);return{x:a*c+i*u+n*h+t*d,y:s*c+o*u+r*h+e*d}}}function c(t,e,n,r,i,o,a,s){return function(l){var c=1-l,u=3*c*c*(n-t)+6*c*l*(i-n)+3*l*l*(a-i),h=3*c*c*(r-e)+6*c*l*(o-r)+3*l*l*(s-o);return Math.atan2(h,u)}}function u(t,e,n,r,i,o){return function(a){var s=function(t){return t*t}(a),l=function(t){return 2*t*(1-t)}(a),c=function(t){return(1-t)*(1-t)}(a);return{x:i*s+n*l+t*c,y:o*s+r*l+e*c}}}function h(t,e,n,r,i,o){return function(a){var s=1-a,l=2*s*(n-t)+2*a*(i-n),c=2*s*(r-e)+2*a*(o-r);return Math.atan2(c,l)}}function d(t,e,n){var r,i,o={x:e,y:n},a=0;for(i=1;i<=100;i+=1)r=t(i/100),a+=s(o.x,o.y,r.x,r.y),o=r;return a}function f(t,e){for(var n,r,i,o=0,a=0,l=t.iterator,c={x:t.x,y:t.y},u=.01,h=t.angleFinder;a<e&&u>1e-4;)n=l(o),i=o,(r=s(c.x,c.y,n.x,n.y))+a>e?(o-=u,u/=2):(c=n,o+=u,a+=r);return n.angle=h(i),n}function p(t){for(var e,n,r,i,o=0,a=t.length,f=0,p=0,g=0,m=0,v=[],b=0;b<a;b++){switch(r={x:f,y:p,command:(e=t[b])[0]},e[0]){case"M":r.length=0,g=f=e[1],m=p=e[2];break;case"L":r.length=s(f,p,e[1],e[2]),f=e[1],p=e[2];break;case"C":n=l(f,p,e[1],e[2],e[3],e[4],e[5],e[6]),i=c(f,p,e[1],e[2],e[3],e[4],e[5],e[6]),r.iterator=n,r.angleFinder=i,r.length=d(n,f,p),f=e[5],p=e[6];break;case"Q":n=u(f,p,e[1],e[2],e[3],e[4]),i=h(f,p,e[1],e[2],e[3],e[4]),r.iterator=n,r.angleFinder=i,r.length=d(n,f,p),f=e[3],p=e[4];break;case"Z":case"z":r.destX=g,r.destY=m,r.length=s(f,p,g,m),f=g,p=m}o+=r.length,v.push(r)}return v.push({length:o,x:f,y:p}),v}n.util.joinPath=function(t){return t.map((function(t){return t.join(" ")})).join(" ")},n.util.parsePath=function(t){var i,o,a,s,l,c=[],u=[],h=n.rePathCommand,d="[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*",f="("+d+")"+n.commaWsp,p="([01])"+n.commaWsp+"?",g=new RegExp(f+"?"+f+"?"+f+p+p+f+"?("+d+")","g");if(!t||!t.match)return c;for(var m,v=0,b=(l=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi)).length;v<b;v++){s=(i=l[v]).slice(1).trim(),u.length=0;var y=i.charAt(0);if(m=[y],"a"===y.toLowerCase())for(var x;x=g.exec(s);)for(var w=1;w<x.length;w++)u.push(x[w]);else for(;a=h.exec(s);)u.push(a[0]);w=0;for(var _=u.length;w<_;w++)o=parseFloat(u[w]),isNaN(o)||m.push(o);var S=e[y.toLowerCase()],C=r[y]||y;if(m.length-1>S)for(var k=1,T=m.length;k<T;k+=S)c.push([y].concat(m.slice(k,k+S))),y=C;else c.push(m)}return c},n.util.makePathSimpler=function(t){var e,n,r,i,o,s,l=0,c=0,u=t.length,h=0,d=0,f=[];for(n=0;n<u;++n){switch(r=!1,(e=t[n].slice(0))[0]){case"l":e[0]="L",e[1]+=l,e[2]+=c;case"L":l=e[1],c=e[2];break;case"h":e[1]+=l;case"H":e[0]="L",e[2]=c,l=e[1];break;case"v":e[1]+=c;case"V":e[0]="L",c=e[1],e[1]=l,e[2]=c;break;case"m":e[0]="M",e[1]+=l,e[2]+=c;case"M":l=e[1],c=e[2],h=e[1],d=e[2];break;case"c":e[0]="C",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c,e[5]+=l,e[6]+=c;case"C":o=e[3],s=e[4],l=e[5],c=e[6];break;case"s":e[0]="S",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c;case"S":"C"===i?(o=2*l-o,s=2*c-s):(o=l,s=c),l=e[3],c=e[4],e[0]="C",e[5]=e[3],e[6]=e[4],e[3]=e[1],e[4]=e[2],e[1]=o,e[2]=s,o=e[3],s=e[4];break;case"q":e[0]="Q",e[1]+=l,e[2]+=c,e[3]+=l,e[4]+=c;case"Q":o=e[1],s=e[2],l=e[3],c=e[4];break;case"t":e[0]="T",e[1]+=l,e[2]+=c;case"T":"Q"===i?(o=2*l-o,s=2*c-s):(o=l,s=c),e[0]="Q",l=e[1],c=e[2],e[1]=o,e[2]=s,e[3]=l,e[4]=c;break;case"a":e[0]="A",e[6]+=l,e[7]+=c;case"A":r=!0,f=f.concat(a(l,c,e)),l=e[6],c=e[7];break;case"z":case"Z":l=h,c=d}r||f.push(e),i=e[0]}return f},n.util.getSmoothPathFromPoints=function(t,e){var r,i=[],o=new n.Point(t[0].x,t[0].y),a=new n.Point(t[1].x,t[1].y),s=t.length,l=1,c=0,u=s>2;for(e=e||0,u&&(l=t[2].x<a.x?-1:t[2].x===a.x?0:1,c=t[2].y<a.y?-1:t[2].y===a.y?0:1),i.push(["M",o.x-l*e,o.y-c*e]),r=1;r<s;r++){if(!o.eq(a)){var h=o.midPointFrom(a);i.push(["Q",o.x,o.y,h.x,h.y])}o=t[r],r+1<t.length&&(a=t[r+1])}return u&&(l=o.x>t[r-2].x?1:o.x===t[r-2].x?0:-1,c=o.y>t[r-2].y?1:o.y===t[r-2].y?0:-1),i.push(["L",o.x+l*e,o.y+c*e]),i},n.util.getPathSegmentsInfo=p,n.util.getBoundsOfCurve=function(e,r,i,o,a,s,l,c){var u;if(n.cachesBoundsOfCurve&&(u=t.call(arguments),n.boundsOfCurveCache[u]))return n.boundsOfCurveCache[u];var h,d,f,p,g,m,v,b,y=Math.sqrt,x=Math.min,w=Math.max,_=Math.abs,S=[],C=[[],[]];d=6*e-12*i+6*a,h=-3*e+9*i-9*a+3*l,f=3*i-3*e;for(var k=0;k<2;++k)if(k>0&&(d=6*r-12*o+6*s,h=-3*r+9*o-9*s+3*c,f=3*o-3*r),_(h)<1e-12){if(_(d)<1e-12)continue;0<(p=-f/d)&&p<1&&S.push(p)}else!((v=d*d-4*f*h)<0)&&(0<(g=(-d+(b=y(v)))/(2*h))&&g<1&&S.push(g),0<(m=(-d-b)/(2*h))&&m<1&&S.push(m));for(var T,E,O,M=S.length,P=M;M--;)T=(O=1-(p=S[M]))*O*O*e+3*O*O*p*i+3*O*p*p*a+p*p*p*l,C[0][M]=T,E=O*O*O*r+3*O*O*p*o+3*O*p*p*s+p*p*p*c,C[1][M]=E;C[0][P]=e,C[1][P]=r,C[0][P+1]=l,C[1][P+1]=c;var A=[{x:x.apply(null,C[0]),y:x.apply(null,C[1])},{x:w.apply(null,C[0]),y:w.apply(null,C[1])}];return n.cachesBoundsOfCurve&&(n.boundsOfCurveCache[u]=A),A},n.util.getPointOnPath=function(t,e,r){r||(r=p(t));for(var i=0;e-r[i].length>0&&i<r.length-2;)e-=r[i].length,i++;var o,a=r[i],s=e/a.length,l=a.command,c=t[i];switch(l){case"M":return{x:a.x,y:a.y,angle:0};case"Z":case"z":return(o=new n.Point(a.x,a.y).lerp(new n.Point(a.destX,a.destY),s)).angle=Math.atan2(a.destY-a.y,a.destX-a.x),o;case"L":return(o=new n.Point(a.x,a.y).lerp(new n.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,e)}},n.util.transformPath=function(t,e,r){return r&&(e=n.util.multiplyTransformMatrices(e,[1,0,0,1,-r.x,-r.y])),t.map((function(t){for(var r=t.slice(0),i={},o=1;o<t.length-1;o+=2)i.x=t[o],i.y=t[o+1],i=n.util.transformPoint(i,e),r[o]=i.x,r[o+1]=i.y;return r}))}}(),function(){var t=Array.prototype.slice;function e(t,e,n){if(t&&0!==t.length){var r=t.length-1,i=e?t[r][e]:t[r];if(e)for(;r--;)n(t[r][e],i)&&(i=t[r][e]);else for(;r--;)n(t[r],i)&&(i=t[r]);return i}}n.util.array={fill:function(t,e){for(var n=t.length;n--;)t[n]=e;return t},invoke:function(e,n){for(var r=t.call(arguments,2),i=[],o=0,a=e.length;o<a;o++)i[o]=r.length?e[o][n].apply(e[o],r):e[o][n].call(e[o]);return i},min:function(t,n){return e(t,n,(function(t,e){return t<e}))},max:function(t,n){return e(t,n,(function(t,e){return t>=e}))}}}(),function(){function t(e,r,i){if(i)if(!n.isLikelyNode&&r instanceof Element)e=r;else if(r instanceof Array){e=[];for(var o=0,a=r.length;o<a;o++)e[o]=t({},r[o],i)}else if(r&&"object"==typeof r)for(var s in r)"canvas"===s||"group"===s?e[s]=null:r.hasOwnProperty(s)&&(e[s]=t({},r[s],i));else e=r;else for(var s in r)e[s]=r[s];return e}n.util.object={extend:t,clone:function(e,n){return t({},e,n)}},n.util.object.extend(n.util,n.Observable)}(),function(){function t(t,e){var n=t.charCodeAt(e);if(isNaN(n))return"";if(n<55296||n>57343)return t.charAt(e);if(55296<=n&&n<=56319){if(t.length<=e+1)throw"High surrogate without following low surrogate";var r=t.charCodeAt(e+1);if(56320>r||r>57343)throw"High surrogate without following low surrogate";return t.charAt(e)+t.charAt(e+1)}if(0===e)throw"Low surrogate without preceding high surrogate";var i=t.charCodeAt(e-1);if(55296>i||i>56319)throw"Low surrogate without preceding high surrogate";return!1}n.util.string={camelize:function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},capitalize:function(t,e){return t.charAt(0).toUpperCase()+(e?t.slice(1):t.slice(1).toLowerCase())},escapeXml:function(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")},graphemeSplit:function(e){var n,r=0,i=[];for(r=0;r<e.length;r++)!1!==(n=t(e,r))&&i.push(n);return i}}}(),function(){var t=Array.prototype.slice,e=function(){},r=function(){for(var t in{toString:1})if("toString"===t)return!1;return!0}(),i=function(t,e,n){for(var i in e)i in t.prototype&&"function"==typeof t.prototype[i]&&(e[i]+"").indexOf("callSuper")>-1?t.prototype[i]=function(t){return function(){var r=this.constructor.superclass;this.constructor.superclass=n;var i=e[t].apply(this,arguments);if(this.constructor.superclass=r,"initialize"!==t)return i}}(i):t.prototype[i]=e[i],r&&(e.toString!==Object.prototype.toString&&(t.prototype.toString=e.toString),e.valueOf!==Object.prototype.valueOf&&(t.prototype.valueOf=e.valueOf))};function o(){}function a(e){for(var n=null,r=this;r.constructor.superclass;){var i=r.constructor.superclass.prototype[e];if(r[e]!==i){n=i;break}r=r.constructor.superclass.prototype}return n?arguments.length>1?n.apply(this,t.call(arguments,1)):n.call(this):console.log("tried to callSuper "+e+", method not found in prototype chain",this)}n.util.createClass=function(){var n=null,r=t.call(arguments,0);function s(){this.initialize.apply(this,arguments)}"function"==typeof r[0]&&(n=r.shift()),s.superclass=n,s.subclasses=[],n&&(o.prototype=n.prototype,s.prototype=new o,n.subclasses.push(s));for(var l=0,c=r.length;l<c;l++)i(s,r[l],n);return s.prototype.initialize||(s.prototype.initialize=e),s.prototype.constructor=s,s.prototype.callSuper=a,s}}(),function(){var t=!!n.document.createElement("div").attachEvent,e=["touchstart","touchmove","touchend"];n.util.addListener=function(e,n,r,i){e&&e.addEventListener(n,r,!t&&i)},n.util.removeListener=function(e,n,r,i){e&&e.removeEventListener(n,r,!t&&i)},n.util.getPointer=function(t){var e=t.target,r=n.util.getScrollLeftTop(e),i=function(t){var e=t.changedTouches;return e&&e[0]?e[0]:t}(t);return{x:i.clientX+r.left,y:i.clientY+r.top}},n.util.isTouchEvent=function(t){return e.indexOf(t.type)>-1||"touch"===t.pointerType}}(),function(){var t=n.document.createElement("div"),e="string"==typeof t.style.opacity,r="string"==typeof t.style.filter,i=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(t){return t};e?o=function(t,e){return t.style.opacity=e,t}:r&&(o=function(t,e){var n=t.style;return t.currentStyle&&!t.currentStyle.hasLayout&&(n.zoom=1),i.test(n.filter)?(e=e>=.9999?"":"alpha(opacity="+100*e+")",n.filter=n.filter.replace(i,e)):n.filter+=" alpha(opacity="+100*e+")",t}),n.util.setStyle=function(t,e){var n=t.style;if(!n)return t;if("string"==typeof e)return t.style.cssText+=";"+e,e.indexOf("opacity")>-1?o(t,e.match(/opacity:\s*(\d?\.?\d*)/)[1]):t;for(var r in e)if("opacity"===r)o(t,e[r]);else{var i="float"===r||"cssFloat"===r?typeof n.styleFloat>"u"?"cssFloat":"styleFloat":r;n.setProperty(i,e[r])}return t}}(),function(){var t=Array.prototype.slice;var e,r,i=function(e){return t.call(e,0)};try{e=i(n.document.childNodes)instanceof Array}catch{}function o(t,e){var r=n.document.createElement(t);for(var i in e)"class"===i?r.className=e[i]:"for"===i?r.htmlFor=e[i]:r.setAttribute(i,e[i]);return r}function a(t){for(var e=0,r=0,i=n.document.documentElement,o=n.document.body||{scrollLeft:0,scrollTop:0};t&&(t.parentNode||t.host)&&((t=t.parentNode||t.host)===n.document?(e=o.scrollLeft||i.scrollLeft||0,r=o.scrollTop||i.scrollTop||0):(e+=t.scrollLeft||0,r+=t.scrollTop||0),1!==t.nodeType||"fixed"!==t.style.position););return{left:e,top:r}}e||(i=function(t){for(var e=new Array(t.length),n=t.length;n--;)e[n]=t[n];return e}),r=n.document.defaultView&&n.document.defaultView.getComputedStyle?function(t,e){var r=n.document.defaultView.getComputedStyle(t,null);return r?r[e]:void 0}:function(t,e){var n=t.style[e];return!n&&t.currentStyle&&(n=t.currentStyle[e]),n},function(){var t=n.document.documentElement.style,e="userSelect"in t?"userSelect":"MozUserSelect"in t?"MozUserSelect":"WebkitUserSelect"in t?"WebkitUserSelect":"KhtmlUserSelect"in t?"KhtmlUserSelect":"";n.util.makeElementUnselectable=function(t){return typeof t.onselectstart<"u"&&(t.onselectstart=n.util.falseFunction),e?t.style[e]="none":"string"==typeof t.unselectable&&(t.unselectable="on"),t},n.util.makeElementSelectable=function(t){return typeof t.onselectstart<"u"&&(t.onselectstart=null),e?t.style[e]="":"string"==typeof t.unselectable&&(t.unselectable=""),t}}(),n.util.setImageSmoothing=function(t,e){t.imageSmoothingEnabled=t.imageSmoothingEnabled||t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled||t.oImageSmoothingEnabled,t.imageSmoothingEnabled=e},n.util.getById=function(t){return"string"==typeof t?n.document.getElementById(t):t},n.util.toArray=i,n.util.addClass=function(t,e){t&&-1===(" "+t.className+" ").indexOf(" "+e+" ")&&(t.className+=(t.className?" ":"")+e)},n.util.makeElement=o,n.util.wrapElement=function(t,e,n){return"string"==typeof e&&(e=o(e,n)),t.parentNode&&t.parentNode.replaceChild(e,t),e.appendChild(t),e},n.util.getScrollLeftTop=a,n.util.getElementOffset=function(t){var e,n,i=t&&t.ownerDocument,o={left:0,top:0},s={left:0,top:0},l={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"};if(!i)return s;for(var c in l)s[l[c]]+=parseInt(r(t,c),10)||0;return e=i.documentElement,typeof t.getBoundingClientRect<"u"&&(o=t.getBoundingClientRect()),n=a(t),{left:o.left+n.left-(e.clientLeft||0)+s.left,top:o.top+n.top-(e.clientTop||0)+s.top}},n.util.getNodeCanvas=function(t){var e=n.jsdomImplForWrapper(t);return e._canvas||e._image},n.util.cleanUpJsdomNode=function(t){if(n.isLikelyNode){var e=n.jsdomImplForWrapper(t);e&&(e._image=null,e._canvas=null,e._currentSrc=null,e._attributes=null,e._classList=null)}}}(),function(){function t(){}n.util.request=function(e,r){r||(r={});var i=r.method?r.method.toUpperCase():"GET",o=r.onComplete||function(){},a=new n.window.XMLHttpRequest,s=r.body||r.parameters;return a.onreadystatechange=function(){4===a.readyState&&(o(a),a.onreadystatechange=t)},"GET"===i&&(s=null,"string"==typeof r.parameters&&(e=function(t,e){return t+(/\?/.test(t)?"&":"?")+e}(e,r.parameters))),a.open(i,e,!0),("POST"===i||"PUT"===i)&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.send(s),a}}(),n.log=console.log,n.warn=console.warn,function(){var t=n.util.object.extend,e=n.util.object.clone,r=[];function i(){return!1}function o(t,e,n,r){return-n*Math.cos(t/r*(Math.PI/2))+n+e}n.util.object.extend(r,{cancelAll:function(){var t=this.splice(0);return t.forEach((function(t){t.cancel()})),t},cancelByCanvas:function(t){if(!t)return[];var e=this.filter((function(e){return"object"==typeof e.target&&e.target.canvas===t}));return e.forEach((function(t){t.cancel()})),e},cancelByTarget:function(t){var e=this.findAnimationsByTarget(t);return e.forEach((function(t){t.cancel()})),e},findAnimationIndex:function(t){return this.indexOf(this.findAnimation(t))},findAnimation:function(t){return this.find((function(e){return e.cancel===t}))},findAnimationsByTarget:function(t){return t?this.filter((function(e){return e.target===t})):[]}});var a=n.window.requestAnimationFrame||n.window.webkitRequestAnimationFrame||n.window.mozRequestAnimationFrame||n.window.oRequestAnimationFrame||n.window.msRequestAnimationFrame||function(t){return n.window.setTimeout(t,1e3/60)},s=n.window.cancelAnimationFrame||n.window.clearTimeout;function l(){return a.apply(n.window,arguments)}n.util.animate=function(r){r||(r={});var a,s=!1,c=function(){var t=n.runningAnimations.indexOf(a);return t>-1&&n.runningAnimations.splice(t,1)[0]};return a=t(e(r),{cancel:function(){return s=!0,c()},currentValue:"startValue"in r?r.startValue:0,completionRate:0,durationRate:0}),n.runningAnimations.push(a),l((function(t){var e,n=t||+new Date,u=r.duration||500,h=n+u,d=r.onChange||i,f=r.abort||i,p=r.onComplete||i,g=r.easing||o,m="startValue"in r&&r.startValue.length>0,v="startValue"in r?r.startValue:0,b="endValue"in r?r.endValue:100,y=r.byValue||(m?v.map((function(t,e){return b[e]-v[e]})):b-v);r.onStart&&r.onStart(),function t(r){var i=(e=r||+new Date)>h?u:e-n,o=i/u,x=m?v.map((function(t,e){return g(i,v[e],y[e],u)})):g(i,v,y,u),w=Math.abs(m?(x[0]-v[0])/y[0]:(x-v)/y);if(a.currentValue=m?x.slice():x,a.completionRate=w,a.durationRate=o,!s){if(f(x,w,o))return void c();if(e>h)return a.currentValue=m?b.slice():b,a.completionRate=1,a.durationRate=1,d(m?b.slice():b,1,1),p(b,1,1),void c();d(x,w,o),l(t)}}(n)})),a.cancel},n.util.requestAnimFrame=l,n.util.cancelAnimFrame=function(){return s.apply(n.window,arguments)},n.runningAnimations=r}(),function(){function t(t,e,n){var r="rgba("+parseInt(t[0]+n*(e[0]-t[0]),10)+","+parseInt(t[1]+n*(e[1]-t[1]),10)+","+parseInt(t[2]+n*(e[2]-t[2]),10);return r+=","+(t&&e?parseFloat(t[3]+n*(e[3]-t[3])):1),r+=")"}n.util.animateColor=function(e,r,i,o){var a=new n.Color(e).getSource(),s=new n.Color(r).getSource(),l=o.onComplete,c=o.onChange;return o=o||{},n.util.animate(n.util.object.extend(o,{duration:i||500,startValue:a,endValue:s,byValue:s,easing:function(e,n,r,i){return t(n,r,o.colorEasing?o.colorEasing(e,i):1-Math.cos(e/i*(Math.PI/2)))},onComplete:function(e,n,r){if(l)return l(t(s,s,0),n,r)},onChange:function(e,n,r){if(c){if(Array.isArray(e))return c(t(e,e,0),n,r);c(e,n,r)}}}))}}(),function(){function t(t,e,n,r){return t<Math.abs(e)?(t=e,r=n/4):r=0===e&&0===t?n/(2*Math.PI)*Math.asin(1):n/(2*Math.PI)*Math.asin(e/t),{a:t,c:e,p:n,s:r}}function e(t,e,n){return t.a*Math.pow(2,10*(e-=1))*Math.sin((e*n-t.s)*(2*Math.PI)/t.p)}function r(t,e,n,r){return n-i(r-t,0,n,r)+e}function i(t,e,n,r){return(t/=r)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e}n.util.ease={easeInQuad:function(t,e,n,r){return n*(t/=r)*t+e},easeOutQuad:function(t,e,n,r){return-n*(t/=r)*(t-2)+e},easeInOutQuad:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},easeInCubic:function(t,e,n,r){return n*(t/=r)*t*t+e},easeOutCubic:function(t,e,n,r){return n*((t=t/r-1)*t*t+1)+e},easeInOutCubic:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t+e:n/2*((t-=2)*t*t+2)+e},easeInQuart:function(t,e,n,r){return n*(t/=r)*t*t*t+e},easeOutQuart:function(t,e,n,r){return-n*((t=t/r-1)*t*t*t-1)+e},easeInOutQuart:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t*t+e:-n/2*((t-=2)*t*t*t-2)+e},easeInQuint:function(t,e,n,r){return n*(t/=r)*t*t*t*t+e},easeOutQuint:function(t,e,n,r){return n*((t=t/r-1)*t*t*t*t+1)+e},easeInOutQuint:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},easeInSine:function(t,e,n,r){return-n*Math.cos(t/r*(Math.PI/2))+n+e},easeOutSine:function(t,e,n,r){return n*Math.sin(t/r*(Math.PI/2))+e},easeInOutSine:function(t,e,n,r){return-n/2*(Math.cos(Math.PI*t/r)-1)+e},easeInExpo:function(t,e,n,r){return 0===t?e:n*Math.pow(2,10*(t/r-1))+e},easeOutExpo:function(t,e,n,r){return t===r?e+n:n*(1-Math.pow(2,-10*t/r))+e},easeInOutExpo:function(t,e,n,r){return 0===t?e:t===r?e+n:(t/=r/2)<1?n/2*Math.pow(2,10*(t-1))+e:n/2*(2-Math.pow(2,-10*--t))+e},easeInCirc:function(t,e,n,r){return-n*(Math.sqrt(1-(t/=r)*t)-1)+e},easeOutCirc:function(t,e,n,r){return n*Math.sqrt(1-(t=t/r-1)*t)+e},easeInOutCirc:function(t,e,n,r){return(t/=r/2)<1?-n/2*(Math.sqrt(1-t*t)-1)+e:n/2*(Math.sqrt(1-(t-=2)*t)+1)+e},easeInElastic:function(n,r,i,o){var a=0;return 0===n?r:1===(n/=o)?r+i:(a||(a=.3*o),-e(t(i,i,a,1.70158),n,o)+r)},easeOutElastic:function(e,n,r,i){var o=0;if(0===e)return n;if(1===(e/=i))return n+r;o||(o=.3*i);var a=t(r,r,o,1.70158);return a.a*Math.pow(2,-10*e)*Math.sin((e*i-a.s)*(2*Math.PI)/a.p)+a.c+n},easeInOutElastic:function(n,r,i,o){var a=0;if(0===n)return r;if(2===(n/=o/2))return r+i;a||(a=o*(.3*1.5));var s=t(i,i,a,1.70158);return n<1?-.5*e(s,n,o)+r:s.a*Math.pow(2,-10*(n-=1))*Math.sin((n*o-s.s)*(2*Math.PI)/s.p)*.5+s.c+r},easeInBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),n*(t/=r)*t*((i+1)*t-i)+e},easeOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},easeInOutBack:function(t,e,n,r,i){return void 0===i&&(i=1.70158),(t/=r/2)<1?n/2*(t*t*((1+(i*=1.525))*t-i))+e:n/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},easeInBounce:r,easeOutBounce:i,easeInOutBounce:function(t,e,n,o){return t<o/2?.5*r(2*t,0,n,o)+e:.5*i(2*t-o,0,n,o)+.5*n+e}}}(),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.object.clone,i=e.util.toFixed,o=e.util.parseUnit,a=e.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 h(t){return t in s?s[t]:t}function d(t,n,r,i){var s,l=Array.isArray(n);if("fill"!==t&&"stroke"!==t||"none"!==n){if("strokeUniform"===t)return"non-scaling-stroke"===n;if("strokeDashArray"===t)n="none"===n?null:n.replace(/,/g," ").split(/\s+/).map(parseFloat);else if("transformMatrix"===t)n=r&&r.transformMatrix?a(r.transformMatrix,e.parseTransformAttribute(n)):e.parseTransformAttribute(n);else if("visible"===t)n="none"!==n&&"hidden"!==n,r&&!1===r.visible&&(n=!1);else if("opacity"===t)n=parseFloat(n),r&&typeof r.opacity<"u"&&(n*=r.opacity);else if("textAnchor"===t)n="start"===n?"left":"end"===n?"right":"center";else if("charSpacing"===t)s=o(n,i)/i*1e3;else if("paintFirst"===t){var c=n.indexOf("fill"),u=n.indexOf("stroke");n="fill";(c>-1&&u>-1&&u<c||-1===c&&u>-1)&&(n="stroke")}else{if("href"===t||"xlink:href"===t||"font"===t)return n;if("imageSmoothing"===t)return"optimizeQuality"===n;s=l?n.map(o):o(n,i)}}else n="";return!l&&isNaN(s)?n:s}function f(t){return new RegExp("^("+t.join("|")+")\\b","i")}function p(t,e){var n,r,i,o,a=[];for(i=0,o=e.length;i<o;i++)n=e[i],r=t.getElementsByTagName(n),a=a.concat(Array.prototype.slice.call(r));return a}function g(t,e){var n,r=!0;return(n=m(t,e.pop()))&&e.length&&(r=function(t,e){for(var n,r=!0;t.parentNode&&1===t.parentNode.nodeType&&e.length;)r&&(n=e.pop()),t=t.parentNode,r=m(t,n);return 0===e.length}(t,e)),n&&r&&0===e.length}function m(t,e){var n,r,i=t.nodeName,o=t.getAttribute("class"),a=t.getAttribute("id");if(n=new RegExp("^"+i,"i"),e=e.replace(n,""),a&&e.length&&(n=new RegExp("#"+a+"(?![a-zA-Z\\-]+)","i"),e=e.replace(n,"")),o&&e.length)for(r=(o=o.split(" ")).length;r--;)n=new RegExp("\\."+o[r]+"(?![a-zA-Z\\-]+)","i"),e=e.replace(n,"");return 0===e.length}function v(t,e){var n;if(t.getElementById&&(n=t.getElementById(e)),n)return n;var r,i,o,a=t.getElementsByTagName("*");for(i=0,o=a.length;i<o;i++)if(e===(r=a[i]).getAttribute("id"))return r}e.svgValidTagNamesRegEx=f(["path","circle","polygon","polyline","ellipse","rect","line","image","text"]),e.svgViewBoxElementsRegEx=f(["symbol","image","marker","pattern","view","svg"]),e.svgInvalidAncestorsRegEx=f(["pattern","defs","symbol","metadata","clipPath","mask","desc"]),e.svgValidParentsRegEx=f(["symbol","g","a","svg","clipPath","defs"]),e.cssRules={},e.gradientDefs={},e.clipPaths={},e.parseTransformAttribute=function(){function t(t,n,r){t[r]=Math.tan(e.util.degreesToRadians(n[0]))}var n=e.iMatrix,r=e.reNum,i=e.commaWsp,o="(?:"+("(?:(matrix)\\s*\\(\\s*("+r+")"+i+"("+r+")"+i+"("+r+")"+i+"("+r+")"+i+"("+r+")"+i+"("+r+")\\s*\\))")+"|"+("(?:(translate)\\s*\\(\\s*("+r+")(?:"+i+"("+r+"))?\\s*\\))")+"|"+("(?:(scale)\\s*\\(\\s*("+r+")(?:"+i+"("+r+"))?\\s*\\))")+"|"+("(?:(rotate)\\s*\\(\\s*("+r+")(?:"+i+"("+r+")"+i+"("+r+"))?\\s*\\))")+"|"+("(?:(skewX)\\s*\\(\\s*("+r+")\\s*\\))")+"|"+("(?:(skewY)\\s*\\(\\s*("+r+")\\s*\\))")+")",a=new RegExp("^\\s*(?:"+("(?:"+o+"(?:"+i+"*"+o+")*)")+"?)\\s*$"),s=new RegExp(o,"g");return function(r){var i=n.concat(),l=[];if(!r||r&&!a.test(r))return i;r.replace(s,(function(r){var a=new RegExp(o).exec(r).filter((function(t){return!!t})),s=a[1],c=a.slice(2).map(parseFloat);switch(s){case"translate":!function(t,e){t[4]=e[0],2===e.length&&(t[5]=e[1])}(i,c);break;case"rotate":c[0]=e.util.degreesToRadians(c[0]),function(t,n){var r=e.util.cos(n[0]),i=e.util.sin(n[0]),o=0,a=0;3===n.length&&(o=n[1],a=n[2]),t[0]=r,t[1]=i,t[2]=-i,t[3]=r,t[4]=o-(r*o-i*a),t[5]=a-(i*o+r*a)}(i,c);break;case"scale":!function(t,e){var n=e[0],r=2===e.length?e[1]:e[0];t[0]=n,t[3]=r}(i,c);break;case"skewX":t(i,c,2);break;case"skewY":t(i,c,1);break;case"matrix":i=c}l.push(i.concat()),i=n.concat()}));for(var c=l[0];l.length>1;)l.shift(),c=e.util.multiplyTransformMatrices(c,l[0]);return c}}();var b=new RegExp("^\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*,?\\s*("+e.reNum+"+)\\s*$");function y(t){if(!e.svgViewBoxElementsRegEx.test(t.nodeName))return{};var n,r,i,a,s,l,c=t.getAttribute("viewBox"),u=1,h=1,d=t.getAttribute("width"),f=t.getAttribute("height"),p=t.getAttribute("x")||0,g=t.getAttribute("y")||0,m=t.getAttribute("preserveAspectRatio")||"",v=!c||!(c=c.match(b)),y=!d||!f||"100%"===d||"100%"===f,x=v&&y,w={},_="",S=0,C=0;if(w.width=0,w.height=0,w.toBeParsed=x,v&&(p||g)&&t.parentNode&&"#document"!==t.parentNode.nodeName&&(_=" translate("+o(p)+" "+o(g)+") ",s=(t.getAttribute("transform")||"")+_,t.setAttribute("transform",s),t.removeAttribute("x"),t.removeAttribute("y")),x)return w;if(v)return w.width=o(d),w.height=o(f),w;if(n=-parseFloat(c[1]),r=-parseFloat(c[2]),i=parseFloat(c[3]),a=parseFloat(c[4]),w.minX=n,w.minY=r,w.viewBoxWidth=i,w.viewBoxHeight=a,y?(w.width=i,w.height=a):(w.width=o(d),w.height=o(f),u=w.width/i,h=w.height/a),"none"!==(m=e.util.parsePreserveAspectRatioAttribute(m)).alignX&&("meet"===m.meetOrSlice&&(h=u=u>h?h:u),"slice"===m.meetOrSlice&&(h=u=u>h?u:h),S=w.width-i*u,C=w.height-a*u,"Mid"===m.alignX&&(S/=2),"Mid"===m.alignY&&(C/=2),"Min"===m.alignX&&(S=0),"Min"===m.alignY&&(C=0)),1===u&&1===h&&0===n&&0===r&&0===p&&0===g)return w;if((p||g)&&"#document"!==t.parentNode.nodeName&&(_=" translate("+o(p)+" "+o(g)+") "),s=_+" matrix("+u+" 0 0 "+h+" "+(n*u+S)+" "+(r*h+C)+") ","svg"===t.nodeName){for(l=t.ownerDocument.createElementNS(e.svgNS,"g");t.firstChild;)l.appendChild(t.firstChild);t.appendChild(l)}else(l=t).removeAttribute("x"),l.removeAttribute("y"),s=l.getAttribute("transform")+s;return l.setAttribute("transform",s),w}function x(t,e){var n="xlink:href",r=v(t,e.getAttribute(n).slice(1));if(r&&r.getAttribute(n)&&x(t,r),["gradientTransform","x1","x2","y1","y2","gradientUnits","cx","cy","r","fx","fy"].forEach((function(t){r&&!e.hasAttribute(t)&&r.hasAttribute(t)&&e.setAttribute(t,r.getAttribute(t))})),!e.children.length)for(var i=r.cloneNode(!0);i.firstChild;)e.appendChild(i.firstChild);e.removeAttribute(n)}e.parseSVGDocument=function(t,n,i,o){if(t){!function(t){for(var n=p(t,["use","svg:use"]),r=0;n.length&&r<n.length;){var i=n[r],o=i.getAttribute("xlink:href")||i.getAttribute("href");if(null===o)return;var a,s,l,c,u=o.slice(1),h=i.getAttribute("x")||0,d=i.getAttribute("y")||0,f=v(t,u).cloneNode(!0),g=(f.getAttribute("transform")||"")+" translate("+h+", "+d+")",m=n.length,b=e.svgNS;if(y(f),/^svg$/i.test(f.nodeName)){var x=f.ownerDocument.createElementNS(b,"g");for(s=0,c=(l=f.attributes).length;s<c;s++)a=l.item(s),x.setAttributeNS(b,a.nodeName,a.nodeValue);for(;f.firstChild;)x.appendChild(f.firstChild);f=x}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),n.length===m&&r++}}(t);var a,s,l=e.Object.__uid++,c=y(t),u=e.util.toArray(t.getElementsByTagName("*"));if(c.crossOrigin=o&&o.crossOrigin,c.svgUid=l,0===u.length&&e.isLikelyNode){var h=[];for(a=0,s=(u=t.selectNodes('//*[name(.)!="svg"]')).length;a<s;a++)h[a]=u[a];u=h}var d=u.filter((function(t){return y(t),e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))&&!function(t,e){for(;t&&(t=t.parentNode);)if(t.nodeName&&e.test(t.nodeName.replace("svg:",""))&&!t.getAttribute("instantiated_by_use"))return!0;return!1}(t,e.svgInvalidAncestorsRegEx)}));if(!d||d&&!d.length)return void(n&&n([],{}));var f={};u.filter((function(t){return"clipPath"===t.nodeName.replace("svg:","")})).forEach((function(t){var n=t.getAttribute("id");f[n]=e.util.toArray(t.getElementsByTagName("*")).filter((function(t){return e.svgValidTagNamesRegEx.test(t.nodeName.replace("svg:",""))}))})),e.gradientDefs[l]=e.getGradientDefs(t),e.cssRules[l]=e.getCSSRules(t),e.clipPaths[l]=f,e.parseElements(d,(function(t,r){n&&(n(t,c,r,u),delete e.gradientDefs[l],delete e.cssRules[l],delete e.clipPaths[l])}),r(c),i,o)}};var w=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+e.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+e.reNum+"))?\\s+(.*)");n(e,{parseFontDeclaration:function(t,e){var n=t.match(w);if(n){var r=n[1],i=n[3],a=n[4],s=n[5],l=n[6];r&&(e.fontStyle=r),i&&(e.fontWeight=isNaN(parseFloat(i))?i:parseFloat(i)),a&&(e.fontSize=o(a)),l&&(e.fontFamily=l),s&&(e.lineHeight="normal"===s?1:s)}},getGradientDefs:function(t){var e,n=p(t,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),r=0,i={};for(r=n.length;r--;)(e=n[r]).getAttribute("xlink:href")&&x(t,e),i[e.getAttribute("id")]=e;return i},parseAttributes:function(t,r,a){if(t){var s,f,p,m={};typeof a>"u"&&(a=t.getAttribute("svgUid")),t.parentNode&&e.svgValidParentsRegEx.test(t.parentNode.nodeName)&&(m=e.parseAttributes(t.parentNode,r,a));var v=r.reduce((function(e,n){return(s=t.getAttribute(n))&&(e[n]=s),e}),{}),b=n(function(t,n){var r={};for(var i in e.cssRules[n])if(g(t,i.split(" ")))for(var o in e.cssRules[n][i])r[o]=e.cssRules[n][i][o];return r}(t,a),e.parseStyleAttribute(t));v=n(v,b),b[u]&&t.setAttribute(u,b[u]),f=p=m.fontSize||e.Text.DEFAULT_SVG_FONT_SIZE,v[c]&&(v[c]=f=o(v[c],p));var y,x,w={};for(var _ in v)x=d(y=h(_),v[_],m,f),w[y]=x;w&&w.font&&e.parseFontDeclaration(w.font,w);var S=n(m,w);return e.svgValidParentsRegEx.test(t.nodeName)?S:function(t){for(var n in l)if(!(typeof t[l[n]]>"u"||""===t[n])){if(typeof t[n]>"u"){if(!e.Object.prototype[n])continue;t[n]=e.Object.prototype[n]}if(0!==t[n].indexOf("url(")){var r=new e.Color(t[n]);t[n]=r.setAlpha(i(r.getAlpha()*t[l[n]],2)).toRgba()}}return t}(S)}},parseElements:function(t,n,r,i,o){new e.ElementsParser(t,n,r,i,o).parse()},parseStyleAttribute:function(t){var e={},n=t.getAttribute("style");return n&&("string"==typeof n?function(t,e){var n,r;t.replace(/;\s*$/,"").split(";").forEach((function(t){var i=t.split(":");n=i[0].trim().toLowerCase(),r=i[1].trim(),e[n]=r}))}(n,e):function(t,e){var n,r;for(var i in t)typeof t[i]>"u"||(n=i.toLowerCase(),r=t[i],e[n]=r)}(n,e)),e},parsePointsAttribute:function(t){if(!t)return null;var e,n,r=[];for(e=0,n=(t=(t=t.replace(/,/g," ").trim()).split(/\s+/)).length;e<n;e+=2)r.push({x:parseFloat(t[e]),y:parseFloat(t[e+1])});return r},getCSSRules:function(t){var n,r,i=t.getElementsByTagName("style"),o={};for(n=0,r=i.length;n<r;n++){var a=i[n].textContent;""!==(a=a.replace(/\/\*[\s\S]*?\*\//g,"")).trim()&&a.split("}").filter((function(t){return t.trim()})).forEach((function(t){var i=t.split("{"),a={},s=i[1].trim().split(";").filter((function(t){return t.trim()}));for(n=0,r=s.length;n<r;n++){var l=s[n].split(":"),c=l[0].trim(),u=l[1].trim();a[c]=u}(t=i[0].trim()).split(",").forEach((function(t){""!==(t=t.replace(/^svg/i,"").trim())&&(o[t]?e.util.object.extend(o[t],a):o[t]=e.util.object.clone(a))}))}))}return o},loadSVGFromURL:function(t,n,r,i){t=t.replace(/^\n\s*/,"").trim(),new e.util.request(t,{method:"get",onComplete:function(t){var o=t.responseXML;if(!o||!o.documentElement)return n&&n(null),!1;e.parseSVGDocument(o.documentElement,(function(t,e,r,i){n&&n(t,e,r,i)}),r,i)}})},loadSVGFromString:function(t,n,r,i){var o=(new e.window.DOMParser).parseFromString(t.trim(),"text/xml");e.parseSVGDocument(o.documentElement,(function(t,e,r,i){n(t,e,r,i)}),r,i)}})}(t),n.ElementsParser=function(t,e,n,r,i,o){this.elements=t,this.callback=e,this.options=n,this.reviver=r,this.svgUid=n&&n.svgUid||0,this.parsingOptions=i,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=o},(e=n.ElementsParser.prototype).parse=function(){this.instances=new Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},e.createObjects=function(){var t=this;this.elements.forEach((function(e,n){e.setAttribute("svgUid",t.svgUid),t.createObject(e,n)}))},e.findTag=function(t){return n[n.util.string.capitalize(t.tagName.replace("svg:",""))]},e.createObject=function(t,e){var r=this.findTag(t);if(r&&r.fromElement)try{r.fromElement(t,this.createCallback(e,t),this.options)}catch(i){n.log(i)}else this.checkIfDone()},e.createCallback=function(t,e){var r=this;return function(i){var o;r.resolveGradient(i,e,"fill"),r.resolveGradient(i,e,"stroke"),i instanceof n.Image&&i._originalElement&&(o=i.parsePreserveAspectRatioAttribute(e)),i._removeTransformMatrix(o),r.resolveClipPath(i,e),r.reviver&&r.reviver(e,i),r.instances[t]=i,r.checkIfDone()}},e.extractPropertyDefinition=function(t,e,r){var i=t[e],o=this.regexUrl;if(o.test(i)){o.lastIndex=0;var a=o.exec(i)[1];return o.lastIndex=0,n[r][this.svgUid][a]}},e.resolveGradient=function(t,e,r){var i=this.extractPropertyDefinition(t,r,"gradientDefs");if(i){var o=e.getAttribute(r+"-opacity"),a=n.Gradient.fromElement(i,t,o,this.options);t.set(r,a)}},e.createClipPathCallback=function(t,e){return function(t){t._removeTransformMatrix(),t.fillRule=t.clipRule,e.push(t)}},e.resolveClipPath=function(t,e){var r,i,o,a,s=this.extractPropertyDefinition(t,"clipPath","clipPaths");if(s){o=[],i=n.util.invertTransform(t.calcTransformMatrix());for(var l=s[0].parentNode,c=e;c.parentNode&&c.getAttribute("clip-path")!==t.clipPath;)c=c.parentNode;c.parentNode.appendChild(l);for(var u=0;u<s.length;u++)r=s[u],this.findTag(r).fromElement(r,this.createClipPathCallback(t,o),this.options);s=1===o.length?o[0]:new n.Group(o),a=n.util.multiplyTransformMatrices(i,s.calcTransformMatrix()),s.clipPath&&this.resolveClipPath(s,c);var h=n.util.qrDecompose(a);s.flipX=!1,s.flipY=!1,s.set("scaleX",h.scaleX),s.set("scaleY",h.scaleY),s.angle=h.angle,s.skewX=h.skewX,s.skewY=0,s.setPositionByOrigin({x:h.translateX,y:h.translateY},"center","center"),t.clipPath=s}else delete t.clipPath},e.checkIfDone=function(){0===--this.numElements&&(this.instances=this.instances.filter((function(t){return null!=t})),this.callback(this.instances,this.elements))},function(t){var e=t.fabric||(t.fabric={});function n(t,e){this.x=t,this.y=e}e.Point?e.warn("fabric.Point is already defined"):(e.Point=n,n.prototype={type:"point",constructor:n,add:function(t){return new n(this.x+t.x,this.y+t.y)},addEquals:function(t){return this.x+=t.x,this.y+=t.y,this},scalarAdd:function(t){return new n(this.x+t,this.y+t)},scalarAddEquals:function(t){return this.x+=t,this.y+=t,this},subtract:function(t){return new n(this.x-t.x,this.y-t.y)},subtractEquals:function(t){return this.x-=t.x,this.y-=t.y,this},scalarSubtract:function(t){return new n(this.x-t,this.y-t)},scalarSubtractEquals:function(t){return this.x-=t,this.y-=t,this},multiply:function(t){return new n(this.x*t,this.y*t)},multiplyEquals:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return new n(this.x/t,this.y/t)},divideEquals:function(t){return this.x/=t,this.y/=t,this},eq:function(t){return this.x===t.x&&this.y===t.y},lt:function(t){return this.x<t.x&&this.y<t.y},lte:function(t){return this.x<=t.x&&this.y<=t.y},gt:function(t){return this.x>t.x&&this.y>t.y},gte:function(t){return this.x>=t.x&&this.y>=t.y},lerp:function(t,e){return typeof e>"u"&&(e=.5),e=Math.max(Math.min(1,e),0),new n(this.x+(t.x-this.x)*e,this.y+(t.y-this.y)*e)},distanceFrom:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},midPointFrom:function(t){return this.lerp(t)},min:function(t){return new n(Math.min(this.x,t.x),Math.min(this.y,t.y))},max:function(t){return new n(Math.max(this.x,t.x),Math.max(this.y,t.y))},toString:function(){return this.x+","+this.y},setXY:function(t,e){return this.x=t,this.y=e,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setFromPoint:function(t){return this.x=t.x,this.y=t.y,this},swap:function(t){var e=this.x,n=this.y;this.x=t.x,this.y=t.y,t.x=e,t.y=n},clone:function(){return new n(this.x,this.y)}})}(t),function(t){var e=t.fabric||(t.fabric={});function n(t){this.status=t,this.points=[]}e.Intersection?e.warn("fabric.Intersection is already defined"):(e.Intersection=n,e.Intersection.prototype={constructor:n,appendPoint:function(t){return this.points.push(t),this},appendPoints:function(t){return this.points=this.points.concat(t),this}},e.Intersection.intersectLineLine=function(t,r,i,o){var a,s=(o.x-i.x)*(t.y-i.y)-(o.y-i.y)*(t.x-i.x),l=(r.x-t.x)*(t.y-i.y)-(r.y-t.y)*(t.x-i.x),c=(o.y-i.y)*(r.x-t.x)-(o.x-i.x)*(r.y-t.y);if(0!==c){var u=s/c,h=l/c;0<=u&&u<=1&&0<=h&&h<=1?(a=new n("Intersection")).appendPoint(new e.Point(t.x+u*(r.x-t.x),t.y+u*(r.y-t.y))):a=new n}else a=new n(0===s||0===l?"Coincident":"Parallel");return a},e.Intersection.intersectLinePolygon=function(t,e,r){var i,o,a,s,l=new n,c=r.length;for(s=0;s<c;s++)i=r[s],o=r[(s+1)%c],a=n.intersectLineLine(t,e,i,o),l.appendPoints(a.points);return l.points.length>0&&(l.status="Intersection"),l},e.Intersection.intersectPolygonPolygon=function(t,e){var r,i=new n,o=t.length;for(r=0;r<o;r++){var a=t[r],s=t[(r+1)%o],l=n.intersectLinePolygon(a,s,e);i.appendPoints(l.points)}return i.points.length>0&&(i.status="Intersection"),i},e.Intersection.intersectPolygonRectangle=function(t,r,i){var o=r.min(i),a=r.max(i),s=new e.Point(a.x,o.y),l=new e.Point(o.x,a.y),c=n.intersectLinePolygon(o,s,t),u=n.intersectLinePolygon(s,a,t),h=n.intersectLinePolygon(a,l,t),d=n.intersectLinePolygon(l,o,t),f=new n;return f.appendPoints(c.points),f.appendPoints(u.points),f.appendPoints(h.points),f.appendPoints(d.points),f.points.length>0&&(f.status="Intersection"),f})}(t),function(t){var e=t.fabric||(t.fabric={});function n(t){t?this._tryParsingColor(t):this.setSource([0,0,0,1])}function r(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}e.Color?e.warn("fabric.Color is already defined."):(e.Color=n,e.Color.prototype={_tryParsingColor:function(t){var e;t in n.colorNameMap&&(t=n.colorNameMap[t]),"transparent"===t&&(e=[255,255,255,0]),e||(e=n.sourceFromHex(t)),e||(e=n.sourceFromRgb(t)),e||(e=n.sourceFromHsl(t)),e||(e=[0,0,0,1]),e&&this.setSource(e)},_rgbToHsl:function(t,n,r){t/=255,n/=255,r/=255;var i,o,a,s=e.util.array.max([t,n,r]),l=e.util.array.min([t,n,r]);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 t:i=(n-r)/c+(n<r?6:0);break;case n:i=(r-t)/c+2;break;case r:i=(t-n)/c+4}i/=6}return[Math.round(360*i),Math.round(100*o),Math.round(100*a)]},getSource:function(){return this._source},setSource:function(t){this._source=t},toRgb:function(){var t=this.getSource();return"rgb("+t[0]+","+t[1]+","+t[2]+")"},toRgba:function(){var t=this.getSource();return"rgba("+t[0]+","+t[1]+","+t[2]+","+t[3]+")"},toHsl:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsl("+e[0]+","+e[1]+"%,"+e[2]+"%)"},toHsla:function(){var t=this.getSource(),e=this._rgbToHsl(t[0],t[1],t[2]);return"hsla("+e[0]+","+e[1]+"%,"+e[2]+"%,"+t[3]+")"},toHex:function(){var t,e,n,r=this.getSource();return t=1===(t=r[0].toString(16)).length?"0"+t:t,e=1===(e=r[1].toString(16)).length?"0"+e:e,n=1===(n=r[2].toString(16)).length?"0"+n:n,t.toUpperCase()+e.toUpperCase()+n.toUpperCase()},toHexa:function(){var t,e=this.getSource();return t=1===(t=(t=Math.round(255*e[3])).toString(16)).length?"0"+t:t,this.toHex()+t.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(t){var e=this.getSource();return e[3]=t,this.setSource(e),this},toGrayscale:function(){var t=this.getSource(),e=parseInt((.3*t[0]+.59*t[1]+.11*t[2]).toFixed(0),10),n=t[3];return this.setSource([e,e,e,n]),this},toBlackWhite:function(t){var e=this.getSource(),n=(.3*e[0]+.59*e[1]+.11*e[2]).toFixed(0),r=e[3];return t=t||127,n=Number(n)<Number(t)?0:255,this.setSource([n,n,n,r]),this},overlayWith:function(t){t instanceof n||(t=new n(t));var e,r=[],i=this.getAlpha(),o=this.getSource(),a=t.getSource();for(e=0;e<3;e++)r.push(Math.round(.5*o[e]+.5*a[e]));return r[3]=i,this.setSource(r),this}},e.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,e.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,e.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,e.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"},e.Color.fromRgb=function(t){return n.fromSource(n.sourceFromRgb(t))},e.Color.sourceFromRgb=function(t){var e=t.match(n.reRGBa);if(e){var r=parseInt(e[1],10)/(/%$/.test(e[1])?100:1)*(/%$/.test(e[1])?255:1),i=parseInt(e[2],10)/(/%$/.test(e[2])?100:1)*(/%$/.test(e[2])?255:1),o=parseInt(e[3],10)/(/%$/.test(e[3])?100:1)*(/%$/.test(e[3])?255:1);return[parseInt(r,10),parseInt(i,10),parseInt(o,10),e[4]?parseFloat(e[4]):1]}},e.Color.fromRgba=n.fromRgb,e.Color.fromHsl=function(t){return n.fromSource(n.sourceFromHsl(t))},e.Color.sourceFromHsl=function(t){var e=t.match(n.reHSLa);if(e){var i,o,a,s=(parseFloat(e[1])%360+360)%360/360,l=parseFloat(e[2])/(/%$/.test(e[2])?100:1),c=parseFloat(e[3])/(/%$/.test(e[3])?100:1);if(0===l)i=o=a=c;else{var u=c<=.5?c*(l+1):c+l-c*l,h=2*c-u;i=r(h,u,s+1/3),o=r(h,u,s),a=r(h,u,s-1/3)}return[Math.round(255*i),Math.round(255*o),Math.round(255*a),e[4]?parseFloat(e[4]):1]}},e.Color.fromHsla=n.fromHsl,e.Color.fromHex=function(t){return n.fromSource(n.sourceFromHex(t))},e.Color.sourceFromHex=function(t){if(t.match(n.reHex)){var e=t.slice(t.indexOf("#")+1),r=3===e.length||4===e.length,i=8===e.length||4===e.length,o=r?e.charAt(0)+e.charAt(0):e.substring(0,2),a=r?e.charAt(1)+e.charAt(1):e.substring(2,4),s=r?e.charAt(2)+e.charAt(2):e.substring(4,6),l=i?r?e.charAt(3)+e.charAt(3):e.substring(6,8):"FF";return[parseInt(o,16),parseInt(a,16),parseInt(s,16),parseFloat((parseInt(l,16)/255).toFixed(2))]}},e.Color.fromSource=function(t){var e=new n;return e.setSource(t),e})}(t),function(t){var e=t.fabric||(t.fabric={}),n=["e","se","s","sw","w","nw","n","ne","e"],r=["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},h=e.util.radiansToDegrees,d=Math.sign||function(t){return(t>0)-(t<0)||+t};function f(t,e){var n=t.angle+h(Math.atan2(e.y,e.x))+360;return Math.round(n%360/45)}function p(t,n){var r=n.transform.target,i=r.canvas,o=e.util.object.clone(n);o.target=r,i&&i.fire("object:"+t,o),r.fire(t,n)}function g(t,e){var n=e.canvas,r=t[n.uniScaleKey];return n.uniformScaling&&!r||!n.uniformScaling&&r}function m(t){return t.originX===c&&t.originY===c}function v(t,e,n){var r=t.lockScalingX,i=t.lockScalingY;return!!(r&&i||!e&&(r||i)&&n||r&&"x"===e||i&&"y"===e)}function b(t,e,n,r){return{e:t,transform:e,pointer:{x:n,y:r}}}function y(t){return function(e,n,r,i){var o=n.target,a=o.getCenterPoint(),s=o.translateToOriginPoint(a,n.originX,n.originY),l=t(e,n,r,i);return o.setPositionByOrigin(s,n.originX,n.originY),l}}function x(t,e){return function(n,r,i,o){var a=e(n,r,i,o);return a&&p(t,b(n,r,i,o)),a}}function w(t,n,r,i,o){var a=t.target,s=a.controls[t.corner],l=a.canvas.getZoom(),c=a.padding/l,u=a.toLocalPoint(new e.Point(i,o),n,r);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 _(t){return t.flipX!==t.flipY}function S(t,e,n,r,i){if(0!==t[e]){var o=i/t._getTransformedDimensions()[r]*t[n];t.set(n,o)}}function C(t,e,n,r){var i,c=e.target,u=c._getTransformedDimensions(0,c.skewY),d=w(e,e.originX,e.originY,n,r),f=Math.abs(2*d.x)-u.x,p=c.skewX;f<2?i=0:(i=h(Math.atan2(f/c.scaleX,u.y/c.scaleY)),e.originX===o&&e.originY===l&&(i=-i),e.originX===s&&e.originY===a&&(i=-i),_(c)&&(i=-i));var g=p!==i;if(g){var m=c._getTransformedDimensions().y;c.set("skewX",i),S(c,"skewY","scaleY","y",m)}return g}function k(t,e,n,r){var i,c=e.target,u=c._getTransformedDimensions(c.skewX,0),d=w(e,e.originX,e.originY,n,r),f=Math.abs(2*d.y)-u.y,p=c.skewY;f<2?i=0:(i=h(Math.atan2(f/c.scaleY,u.x/c.scaleX)),e.originX===o&&e.originY===l&&(i=-i),e.originX===s&&e.originY===a&&(i=-i),_(c)&&(i=-i));var g=p!==i;if(g){var m=c._getTransformedDimensions().x;c.set("skewY",i),S(c,"skewX","scaleX","x",m)}return g}function T(t,e,n,r,i){i=i||{};var o,a,s,l,c,h,f=e.target,p=f.lockScalingX,b=f.lockScalingY,y=i.by,x=g(t,f),_=v(f,y,x),S=e.gestureScale;if(_)return!1;if(S)a=e.scaleX*S,s=e.scaleY*S;else{if(o=w(e,e.originX,e.originY,n,r),c="y"!==y?d(o.x):1,h="x"!==y?d(o.y):1,e.signX||(e.signX=c),e.signY||(e.signY=h),f.lockScalingFlip&&(e.signX!==c||e.signY!==h))return!1;if(l=f._getTransformedDimensions(),x&&!y){var C=Math.abs(o.x)+Math.abs(o.y),k=e.original,T=C/(Math.abs(l.x*k.scaleX/f.scaleX)+Math.abs(l.y*k.scaleY/f.scaleY));a=k.scaleX*T,s=k.scaleY*T}else a=Math.abs(o.x*f.scaleX/l.x),s=Math.abs(o.y*f.scaleY/l.y);m(e)&&(a*=2,s*=2),e.signX!==c&&"y"!==y&&(e.originX=u[e.originX],a*=-1,e.signX=c),e.signY!==h&&"x"!==y&&(e.originY=u[e.originY],s*=-1,e.signY=h)}var E=f.scaleX,O=f.scaleY;return y?("x"===y&&f.set("scaleX",a),"y"===y&&f.set("scaleY",s)):(!p&&f.set("scaleX",a),!b&&f.set("scaleY",s)),E!==f.scaleX||O!==f.scaleY}i.scaleCursorStyleHandler=function(t,e,r){var i=g(t,r),o="";if(0!==e.x&&0===e.y?o="x":0===e.x&&0!==e.y&&(o="y"),v(r,o,i))return"not-allowed";var a=f(r,e);return n[a]+"-resize"},i.skewCursorStyleHandler=function(t,e,n){if(0!==e.x&&n.lockSkewingY||0!==e.y&&n.lockSkewingX)return"not-allowed";var i=f(n,e)%4;return r[i]+"-resize"},i.scaleSkewCursorStyleHandler=function(t,e,n){return t[n.canvas.altActionKey]?i.skewCursorStyleHandler(t,e,n):i.scaleCursorStyleHandler(t,e,n)},i.rotationWithSnapping=x("rotating",y((function(t,e,n,r){var i=e,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(r-a.y,n-a.x),u=h(c-l+i.theta);if(o.snapAngle>0){var d=o.snapAngle,f=o.snapThreshold||d,p=Math.ceil(u/d)*d,g=Math.floor(u/d)*d;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=x("scaling",y((function(t,e,n,r){return T(t,e,n,r)}))),i.scalingX=x("scaling",y((function(t,e,n,r){return T(t,e,n,r,{by:"x"})}))),i.scalingY=x("scaling",y((function(t,e,n,r){return T(t,e,n,r,{by:"y"})}))),i.scalingYOrSkewingX=function(t,e,n,r){return t[e.target.canvas.altActionKey]?i.skewHandlerX(t,e,n,r):i.scalingY(t,e,n,r)},i.scalingXOrSkewingY=function(t,e,n,r){return t[e.target.canvas.altActionKey]?i.skewHandlerY(t,e,n,r):i.scalingX(t,e,n,r)},i.changeWidth=x("resizing",y((function(t,e,n,r){var i=e.target,o=w(e,e.originX,e.originY,n,r),a=i.strokeWidth/(i.strokeUniform?i.scaleX:1),s=m(e)?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(t,e,n,r){var i,l=e.target,u=l.skewX,h=e.originY;return!l.lockSkewingX&&(0===u?i=w(e,c,c,n,r).x>0?o:s:(u>0&&(i=h===a?o:s),u<0&&(i=h===a?s:o),_(l)&&(i=i===o?s:o)),e.originX=i,x("skewing",y(C))(t,e,n,r))},i.skewHandlerY=function(t,e,n,r){var i,s=e.target,u=s.skewY,h=e.originX;return!s.lockSkewingY&&(0===u?i=w(e,c,c,n,r).y>0?a:l:(u>0&&(i=h===o?a:l),u<0&&(i=h===o?l:a),_(s)&&(i=i===a?l:a)),e.originY=i,x("skewing",y(k))(t,e,n,r))},i.dragHandler=function(t,e,n,r){var i=e.target,o=n-e.offsetX,a=r-e.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",b(t,e,n,r)),s||l},i.scaleOrSkewActionName=function(t,e,n){var r=t[n.canvas.altActionKey];return 0===e.x?r?"skewX":"scaleY":0===e.y?r?"skewY":"scaleX":void 0},i.rotationStyleHandler=function(t,e,n){return n.lockRotation?"not-allowed":e.cursorStyle},i.fireEvent=p,i.wrapWithFixedAnchor=y,i.wrapWithFireEvent=x,i.getLocalPoint=w,e.controlsUtils=i}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.degreesToRadians,r=e.controlsUtils;r.renderCircleControl=function(t,e,n,r,i){r=r||{};var o,a=this.sizeX||r.cornerSize||i.cornerSize,s=this.sizeY||r.cornerSize||i.cornerSize,l=typeof r.transparentCorners<"u"?r.transparentCorners:i.transparentCorners,c=l?"stroke":"fill",u=!l&&(r.cornerStrokeColor||i.cornerStrokeColor),h=e,d=n;t.save(),t.fillStyle=r.cornerColor||i.cornerColor,t.strokeStyle=r.cornerStrokeColor||i.cornerStrokeColor,a>s?(o=a,t.scale(1,s/a),d=n*a/s):s>a?(o=s,t.scale(a/s,1),h=e*s/a):o=a,t.lineWidth=1,t.beginPath(),t.arc(h,d,o/2,0,2*Math.PI,!1),t[c](),u&&t.stroke(),t.restore()},r.renderSquareControl=function(t,e,r,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),h=a/2,d=s/2;t.save(),t.fillStyle=i.cornerColor||o.cornerColor,t.strokeStyle=i.cornerStrokeColor||o.cornerStrokeColor,t.lineWidth=1,t.translate(e,r),t.rotate(n(o.angle)),t[c+"Rect"](-h,-d,a,s),u&&t.strokeRect(-h,-d,a,s),t.restore()}}(t),function(t){var e=t.fabric||(t.fabric={});e.Control=function(t){for(var e in t)this[e]=t[e]},e.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(t,e){return e.cursorStyle},getActionName:function(t,e){return e.actionName},getVisibility:function(t,e){var n=t._controlsVisibility;return n&&typeof n[e]<"u"?n[e]:this.visible},setVisibility:function(t){this.visible=t},positionHandler:function(t,n){return e.util.transformPoint({x:this.x*t.x+this.offsetX,y:this.y*t.y+this.offsetY},n)},calcCornerCoords:function(t,n,r,i,o){var a,s,l,c,u=o?this.touchSizeX:this.sizeX,h=o?this.touchSizeY:this.sizeY;if(u&&h&&u!==h){var d=Math.atan2(h,u),f=Math.sqrt(u*u+h*h)/2,p=d-e.util.degreesToRadians(t),g=Math.PI/2-d-e.util.degreesToRadians(t);a=f*e.util.cos(p),s=f*e.util.sin(p),l=f*e.util.cos(g),c=f*e.util.sin(g)}else{f=.7071067812*(u&&h?u:n);p=e.util.degreesToRadians(45-t);a=l=f*e.util.cos(p),s=c=f*e.util.sin(p)}return{tl:{x:r-c,y:i-l},tr:{x:r+a,y:i-s},bl:{x:r-a,y:i+s},br:{x:r+c,y:i+l}}},render:function(t,n,r,i,o){if("circle"===((i=i||{}).cornerStyle||o.cornerStyle))e.controlsUtils.renderCircleControl.call(this,t,n,r,i,o);else e.controlsUtils.renderSquareControl.call(this,t,n,r,i,o)}}}(t),function(){function t(t,e){var r,i,o,a,s=t.getAttribute("style"),l=t.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*/),h=u[0].trim(),d=u[1].trim();"stop-color"===h?r=d:"stop-opacity"===h&&(o=d)}}return r||(r=t.getAttribute("stop-color")||"rgb(0,0,0)"),o||(o=t.getAttribute("stop-opacity")),i=(r=new n.Color(r)).getAlpha(),o=isNaN(parseFloat(o))?1:parseFloat(o),o*=i*e,{offset:l,color:r.toRgb(),opacity:o}}var e=n.util.object.clone;n.Gradient=n.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:"pixels",type:"linear",initialize:function(t){t||(t={}),t.coords||(t.coords={});var e,r=this;Object.keys(t).forEach((function(e){r[e]=t[e]})),this.id?this.id+="_"+n.Object.__uid++:this.id=n.Object.__uid++,e={x1:t.coords.x1||0,y1:t.coords.y1||0,x2:t.coords.x2||0,y2:t.coords.y2||0},"radial"===this.type&&(e.r1=t.coords.r1||0,e.r2=t.coords.r2||0),this.coords=e,this.colorStops=t.colorStops.slice()},addColorStop:function(t){for(var e in t){var r=new n.Color(t[e]);this.colorStops.push({offset:parseFloat(e),color:r.toRgb(),opacity:r.getAlpha()})}return this},toObject:function(t){var e={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 n.util.populateWithProperties(this,e,t),e},toSVG:function(t,r){var i,o,a,s,l=e(this.coords,!0),c=(r=r||{},e(this.colorStops,!0)),u=l.r1>l.r2,h=this.gradientTransform?this.gradientTransform.concat():n.iMatrix.concat(),d=-this.offsetX,f=-this.offsetY,p=!!r.additionalTransform,g="pixels"===this.gradientUnits?"userSpaceOnUse":"objectBoundingBox";if(c.sort((function(t,e){return t.offset-e.offset})),"objectBoundingBox"===g?(d/=t.width,f/=t.height):(d+=t.width/2,f+=t.height/2),"path"===t.type&&"percentage"!==this.gradientUnits&&(d-=t.pathOffset.x,f-=t.pathOffset.y),h[4]-=d,h[5]-=f,s='id="SVGID_'+this.id+'" gradientUnits="'+g+'"',s+=' gradientTransform="'+(p?r.additionalTransform+" ":"")+n.util.matrixToSVG(h)+'" ',"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 b=c[i];a.push("<stop ",'offset="',100*b.offset+"%",'" style="stop-color:',b.color,typeof b.opacity<"u"?";stop-opacity: "+b.opacity:";",'"/>\n')}return a.push("linear"===this.type?"</linearGradient>\n":"</radialGradient>\n"),a.join("")},toLive:function(t){var e,r,i,o=n.util.object.clone(this.coords);if(this.type){for("linear"===this.type?e=t.createLinearGradient(o.x1,o.y1,o.x2,o.y2):"radial"===this.type&&(e=t.createRadialGradient(o.x1,o.y1,o.r1,o.x2,o.y2,o.r2)),r=0,i=this.colorStops.length;r<i;r++){var a=this.colorStops[r].color,s=this.colorStops[r].opacity,l=this.colorStops[r].offset;typeof s<"u"&&(a=new n.Color(a).setAlpha(s).toRgba()),e.addColorStop(l,a)}return e}}}),n.util.object.extend(n.Gradient,{fromElement:function(e,r,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,h=e.getElementsByTagName("stop"),d="userSpaceOnUse"===e.getAttribute("gradientUnits")?"pixels":"percentage",f=e.getAttribute("gradientTransform")||"",p=[],g=0,m=0;for("linearGradient"===e.nodeName||"LINEARGRADIENT"===e.nodeName?(s="linear",l=function(t){return{x1:t.getAttribute("x1")||0,y1:t.getAttribute("y1")||0,x2:t.getAttribute("x2")||"100%",y2:t.getAttribute("y2")||0}}(e)):(s="radial",l=function(t){return{x1:t.getAttribute("fx")||t.getAttribute("cx")||"50%",y1:t.getAttribute("fy")||t.getAttribute("cy")||"50%",r1:0,x2:t.getAttribute("cx")||"50%",y2:t.getAttribute("cy")||"50%",r2:t.getAttribute("r")||"50%"}}(e)),c=h.length;c--;)p.push(t(h[c],a));return u=n.parseTransformAttribute(f),function(t,e,n,r){var i,o;Object.keys(e).forEach((function(t){"Infinity"===(i=e[t])?o=1:"-Infinity"===i?o=0:(o=parseFloat(e[t],10),"string"==typeof i&&/^(\d+\.\d+)%|(\d+)%$/.test(i)&&(o*=.01,"pixels"===r&&(("x1"===t||"x2"===t||"r2"===t)&&(o*=n.viewBoxWidth||n.width),("y1"===t||"y2"===t)&&(o*=n.viewBoxHeight||n.height)))),e[t]=o}))}(0,l,o,d),"pixels"===d&&(g=-r.left,m=-r.top),new n.Gradient({id:e.getAttribute("id"),type:s,coords:l,colorStops:p,gradientUnits:d,gradientTransform:u,offsetX:g,offsetY:m})}})}(),function(){var t=n.util.toFixed;n.Pattern=n.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(t,e){if(t||(t={}),this.id=n.Object.__uid++,this.setOptions(t),!t.source||t.source&&"string"!=typeof t.source)e&&e(this);else{var r=this;this.source=n.util.createImage(),n.util.loadImage(t.source,(function(t,n){r.source=t,e&&e(r,n)}),null,this.crossOrigin)}},toObject:function(e){var r,i,o=n.Object.NUM_FRACTION_DIGITS;return"string"==typeof this.source.src?r=this.source.src:"object"==typeof this.source&&this.source.toDataURL&&(r=this.source.toDataURL()),i={type:"pattern",source:r,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:t(this.offsetX,o),offsetY:t(this.offsetY,o),patternTransform:this.patternTransform?this.patternTransform.concat():null},n.util.populateWithProperties(this,i,e),i},toSVG:function(t){var e="function"==typeof this.source?this.source():this.source,n=e.width/t.width,r=e.height/t.height,i=this.offsetX/t.width,o=this.offsetY/t.height,a="";return("repeat-x"===this.repeat||"no-repeat"===this.repeat)&&(r=1,o&&(r+=Math.abs(o))),("repeat-y"===this.repeat||"no-repeat"===this.repeat)&&(n=1,i&&(n+=Math.abs(i))),e.src?a=e.src:e.toDataURL&&(a=e.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+i+'" y="'+o+'" width="'+n+'" height="'+r+'">\n<image x="0" y="0" width="'+e.width+'" height="'+e.height+'" xlink:href="'+a+'"></image>\n</pattern>\n'},setOptions:function(t){for(var e in t)this[e]=t[e]},toLive:function(t){var e=this.source;return!e||typeof e.src<"u"&&(!e.complete||0===e.naturalWidth||0===e.naturalHeight)?"":t.createPattern(e,this.repeat)}})}(),function(t){var e=t.fabric||(t.fabric={}),n=e.util.toFixed;e.Shadow?e.warn("fabric.Shadow is already defined."):(e.Shadow=e.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(t){for(var n in"string"==typeof t&&(t=this._parseShadow(t)),t)this[n]=t[n];this.id=e.Object.__uid++},_parseShadow:function(t){var n=t.trim(),r=e.Shadow.reOffsetsAndBlur.exec(n)||[];return{color:(n.replace(e.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)").trim(),offsetX:parseFloat(r[1],10)||0,offsetY:parseFloat(r[2],10)||0,blur:parseFloat(r[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(t){var r=40,i=40,o=e.Object.NUM_FRACTION_DIGITS,a=e.util.rotateVector({x:this.offsetX,y:this.offsetY},e.util.degreesToRadians(-t.angle)),s=new e.Color(this.color);return t.width&&t.height&&(r=100*n((Math.abs(a.x)+this.blur)/t.width,o)+20,i=100*n((Math.abs(a.y)+this.blur)/t.height,o)+20),t.flipX&&(a.x*=-1),t.flipY&&(a.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+i+'%" height="'+(100+2*i)+'%" x="-'+r+'%" width="'+(100+2*r)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+n(this.blur?this.blur/2:0,o)+'"></feGaussianBlur>\n\t<feOffset dx="'+n(a.x,o)+'" dy="'+n(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 t={},n=e.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke","nonScaling"].forEach((function(e){this[e]!==n[e]&&(t[e]=this[e])}),this),t}}),e.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/)}(t),function(){if(n.StaticCanvas)n.warn("fabric.StaticCanvas is already defined.");else{var t=n.util.object.extend,e=n.util.getElementOffset,r=n.util.removeFromArray,i=n.util.toFixed,o=n.util.transformPoint,a=n.util.invertTransform,s=n.util.getNodeCanvas,l=n.util.createCanvasElement,c=new Error("Could not initialize `canvas` element");n.StaticCanvas=n.util.createClass(n.CommonMethods,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:n.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(t,e){var n=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(t),this._initOptions(e),this.interactive||this._initRetinaScaling(),e.overlayImage&&this.setOverlayImage(e.overlayImage,n),e.backgroundImage&&this.setBackgroundImage(e.backgroundImage,n),e.backgroundColor&&this.setBackgroundColor(e.backgroundColor,n),e.overlayColor&&this.setOverlayColor(e.overlayColor,n),this.calcOffset()},_isRetinaScaling:function(){return n.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,n.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var t=n.devicePixelRatio;this.__initRetinaScaling(t,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(t,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(t,e,n){e.setAttribute("width",this.width*t),e.setAttribute("height",this.height*t),n.scale(t,t)},calcOffset:function(){return this._offset=e(this.lowerCanvasEl),this},setOverlayImage:function(t,e,n){return this.__setBgOverlayImage("overlayImage",t,e,n)},setBackgroundImage:function(t,e,n){return this.__setBgOverlayImage("backgroundImage",t,e,n)},setOverlayColor:function(t,e){return this.__setBgOverlayColor("overlayColor",t,e)},setBackgroundColor:function(t,e){return this.__setBgOverlayColor("backgroundColor",t,e)},__setBgOverlayImage:function(t,e,r,i){return"string"==typeof e?n.util.loadImage(e,(function(e,o){if(e){var a=new n.Image(e,i);this[t]=a,a.canvas=this}r&&r(e,o)}),this,i&&i.crossOrigin):(i&&e.setOptions(i),this[t]=e,e&&(e.canvas=this),r&&r(e,!1)),this},__setBgOverlayColor:function(t,e,n){return this[t]=e,this._initGradient(e,t),this._initPattern(e,t,n),this},_createCanvasElement:function(){var t=l();if(!t||(t.style||(t.style={}),typeof t.getContext>"u"))throw c;return t},_initOptions:function(t){var e=this.lowerCanvasEl;this._setOptions(t),this.width=this.width||parseInt(e.width,10)||0,this.height=this.height||parseInt(e.height,10)||0,this.lowerCanvasEl.style&&(e.width=this.width,e.height=this.height,e.style.width=this.width+"px",e.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(t){t&&t.getContext?this.lowerCanvasEl=t:this.lowerCanvasEl=n.util.getById(t)||this._createCanvasElement(),n.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(t,e){return this.setDimensions({width:t},e)},setHeight:function(t,e){return this.setDimensions({height:t},e)},setDimensions:function(t,e){var n;for(var r in e=e||{},t)n=t[r],e.cssOnly||(this._setBackstoreDimension(r,t[r]),n+="px",this.hasLostContext=!0),e.backstoreOnly||this._setCssDimension(r,n);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),e.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(t,e){return this.lowerCanvasEl[t]=e,this.upperCanvasEl&&(this.upperCanvasEl[t]=e),this.cacheCanvasEl&&(this.cacheCanvasEl[t]=e),this[t]=e,this},_setCssDimension:function(t,e){return this.lowerCanvasEl.style[t]=e,this.upperCanvasEl&&(this.upperCanvasEl.style[t]=e),this.wrapperEl&&(this.wrapperEl.style[t]=e),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(t){var e,n,r,i=this._activeObject,o=this.backgroundImage,a=this.overlayImage;for(this.viewportTransform=t,n=0,r=this._objects.length;n<r;n++)(e=this._objects[n]).group||e.setCoords(!0);return i&&i.setCoords(),o&&o.setCoords(!0),a&&a.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(t,e){var n=t,r=this.viewportTransform.slice(0);t=o(t,a(this.viewportTransform)),r[0]=e,r[3]=e;var i=o(t,r);return r[4]+=n.x-i.x,r[5]+=n.y-i.y,this.setViewportTransform(r)},setZoom:function(t){return this.zoomToPoint(new n.Point(0,0),t),this},absolutePan:function(t){var e=this.viewportTransform.slice(0);return e[4]=-t.x,e[5]=-t.y,this.setViewportTransform(e)},relativePan:function(t){return this.absolutePan(new n.Point(-t.x-this.viewportTransform[4],-t.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(t){this.stateful&&t.setupState(),t._set("canvas",this),t.setCoords(),this.fire("object:added",{target:t}),t.fire("added")},_onObjectRemoved:function(t){this.fire("object:removed",{target:t}),t.fire("removed"),delete t.canvas},clearContext:function(t){return t.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 t=this.contextContainer;return this.renderCanvas(t,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=n.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var t={},e=this.width,r=this.height,i=a(this.viewportTransform);return t.tl=o({x:0,y:0},i),t.br=o({x:e,y:r},i),t.tr=new n.Point(t.br.x,t.tl.y),t.bl=new n.Point(t.tl.x,t.br.y),this.vptCoords=t,t},cancelRequestedRender:function(){this.isRendering&&(n.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(t,e){var r=this.viewportTransform,i=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(t),n.util.setImageSmoothing(t,this.imageSmoothingEnabled),this.fire("before:render",{ctx:t}),this._renderBackground(t),t.save(),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._renderObjects(t,e),t.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),i&&(i.canvas=this,i.shouldCache(),i._transformDone=!0,i.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(t)),this._renderOverlay(t),this.controlsAboveOverlay&&this.interactive&&this.drawControls(t),this.fire("after:render",{ctx:t})},drawClipPathOnCanvas:function(t){var e=this.viewportTransform,n=this.clipPath;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t.globalCompositeOperation="destination-in",n.transform(t),t.scale(1/n.zoomX,1/n.zoomY),t.drawImage(n._cacheCanvas,-n.cacheTranslationX,-n.cacheTranslationY),t.restore()},_renderObjects:function(t,e){var n,r;for(n=0,r=e.length;n<r;++n)e[n]&&e[n].render(t)},_renderBackgroundOrOverlay:function(t,e){var n=this[e+"Color"],r=this[e+"Image"],i=this.viewportTransform,o=this[e+"Vpt"];if(n||r){if(n){t.save(),t.beginPath(),t.moveTo(0,0),t.lineTo(this.width,0),t.lineTo(this.width,this.height),t.lineTo(0,this.height),t.closePath(),t.fillStyle=n.toLive?n.toLive(t,this):n,o&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),t.transform(1,0,0,1,n.offsetX||0,n.offsetY||0);var a=n.gradientTransform||n.patternTransform;a&&t.transform(a[0],a[1],a[2],a[3],a[4],a[5]),t.fill(),t.restore()}r&&(t.save(),o&&t.transform(i[0],i[1],i[2],i[3],i[4],i[5]),r.render(t),t.restore())}},_renderBackground:function(t){this._renderBackgroundOrOverlay(t,"background")},_renderOverlay:function(t){this._renderBackgroundOrOverlay(t,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new n.Point(this.width/2,this.height/2)},centerObjectH:function(t){return this._centerObject(t,new n.Point(this.getCenterPoint().x,t.getCenterPoint().y))},centerObjectV:function(t){return this._centerObject(t,new n.Point(t.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(t){var e=this.getCenterPoint();return this._centerObject(t,e)},viewportCenterObject:function(t){var e=this.getVpCenter();return this._centerObject(t,e)},viewportCenterObjectH:function(t){var e=this.getVpCenter();return this._centerObject(t,new n.Point(e.x,t.getCenterPoint().y)),this},viewportCenterObjectV:function(t){var e=this.getVpCenter();return this._centerObject(t,new n.Point(t.getCenterPoint().x,e.y))},getVpCenter:function(){var t=this.getCenterPoint(),e=a(this.viewportTransform);return o(t,e)},_centerObject:function(t,e){return t.setPositionByOrigin(e,"center","center"),t.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(t){return this.toDatalessObject(t)},toObject:function(t){return this._toObjectMethod("toObject",t)},toDatalessObject:function(t){return this._toObjectMethod("toDatalessObject",t)},_toObjectMethod:function(e,r){var i=this.clipPath,o={version:n.version,objects:this._toObjects(e,r)};return i&&!i.excludeFromExport&&(o.clipPath=this._toObject(this.clipPath,e,r)),t(o,this.__serializeBgOverlay(e,r)),n.util.populateWithProperties(this,o,r),o},_toObjects:function(t,e){return this._objects.filter((function(t){return!t.excludeFromExport})).map((function(n){return this._toObject(n,t,e)}),this)},_toObject:function(t,e,n){var r;this.includeDefaultValues||(r=t.includeDefaultValues,t.includeDefaultValues=!1);var i=t[e](n);return this.includeDefaultValues||(t.includeDefaultValues=r),i},__serializeBgOverlay:function(t,e){var n={},r=this.backgroundImage,i=this.overlayImage,o=this.backgroundColor,a=this.overlayColor;return o&&o.toObject?o.excludeFromExport||(n.background=o.toObject(e)):o&&(n.background=o),a&&a.toObject?a.excludeFromExport||(n.overlay=a.toObject(e)):a&&(n.overlay=a),r&&!r.excludeFromExport&&(n.backgroundImage=this._toObject(r,t,e)),i&&!i.excludeFromExport&&(n.overlayImage=this._toObject(i,t,e)),n},svgViewportTransformation:!0,toSVG:function(t,e){t||(t={}),t.reviver=e;var n=[];return this._setSVGPreamble(n,t),this._setSVGHeader(n,t),this.clipPath&&n.push('<g clip-path="url(#'+this.clipPath.clipPathId+')" >\n'),this._setSVGBgOverlayColor(n,"background"),this._setSVGBgOverlayImage(n,"backgroundImage",e),this._setSVGObjects(n,e),this.clipPath&&n.push("</g>\n"),this._setSVGBgOverlayColor(n,"overlay"),this._setSVGBgOverlayImage(n,"overlayImage",e),n.push("</svg>"),n.join("")},_setSVGPreamble:function(t,e){e.suppressPreamble||t.push('<?xml version="1.0" encoding="',e.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(t,e){var r,o=e.width||this.width,a=e.height||this.height,s='viewBox="0 0 '+this.width+" "+this.height+'" ',l=n.Object.NUM_FRACTION_DIGITS;e.viewBox?s='viewBox="'+e.viewBox.x+" "+e.viewBox.y+" "+e.viewBox.width+" "+e.viewBox.height+'" ':this.svgViewportTransformation&&(r=this.viewportTransform,s='viewBox="'+i(-r[4]/r[0],l)+" "+i(-r[5]/r[3],l)+" "+i(this.width/r[0],l)+" "+i(this.height/r[3],l)+'" '),t.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 ",n.version,"</desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(e),"</defs>\n")},createSVGClipPathMarkup:function(t){var e=this.clipPath;return e?(e.clipPathId="CLIPPATH_"+n.Object.__uid++,'<clipPath id="'+e.clipPathId+'" >\n'+this.clipPath.toClipPathSVG(t.reviver)+"</clipPath>\n"):""},createSVGRefElementsMarkup:function(){var t=this;return["background","overlay"].map((function(e){var r=t[e+"Color"];if(r&&r.toLive){var i=t[e+"Vpt"],o=t.viewportTransform,a={width:t.width/(i?o[0]:1),height:t.height/(i?o[3]:1)};return r.toSVG(a,{additionalTransform:i?n.util.matrixToSVG(o):""})}})).join("")},createSVGFontFacesMarkup:function(){var t,e,r,i,o,a,s,l,c="",u={},h=n.fontPaths,d=[];for(this._objects.forEach((function t(e){d.push(e),e._objects&&e._objects.forEach(t)})),s=0,l=d.length;s<l;s++)if(e=(t=d[s]).fontFamily,-1!==t.type.indexOf("text")&&!u[e]&&h[e]&&(u[e]=!0,t.styles))for(o in r=t.styles)for(a in i=r[o])!u[e=i[a].fontFamily]&&h[e]&&(u[e]=!0);for(var f in u)c+=["\t\t@font-face {\n","\t\t\tfont-family: '",f,"';\n","\t\t\tsrc: url('",h[f],"');\n","\t\t}\n"].join("");return c&&(c=['\t<style type="text/css">',"<![CDATA[\n",c,"]]>","</style>\n"].join("")),c},_setSVGObjects:function(t,e){var n,r,i,o=this._objects;for(r=0,i=o.length;r<i;r++)!(n=o[r]).excludeFromExport&&this._setSVGObject(t,n,e)},_setSVGObject:function(t,e,n){t.push(e.toSVG(n))},_setSVGBgOverlayImage:function(t,e,n){this[e]&&!this[e].excludeFromExport&&this[e].toSVG&&t.push(this[e].toSVG(n))},_setSVGBgOverlayColor:function(t,e){var r=this[e+"Color"],i=this.viewportTransform,o=this.width,a=this.height;if(r)if(r.toLive){var s=r.repeat,l=n.util.invertTransform(i),c=this[e+"Vpt"]?n.util.matrixToSVG(l):"";t.push('<rect transform="'+c+" translate(",o/2,",",a/2,')"',' x="',r.offsetX-o/2,'" y="',r.offsetY-a/2,'" ','width="',"repeat-y"===s||"no-repeat"===s?r.source.width:o,'" height="',"repeat-x"===s||"no-repeat"===s?r.source.height:a,'" fill="url(#SVGID_'+r.id+')"',"></rect>\n")}else t.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',r,'"',"></rect>\n")},sendToBack:function(t){if(!t)return this;var e,n,i,o=this._activeObject;if(t===o&&"activeSelection"===t.type)for(e=(i=o._objects).length;e--;)n=i[e],r(this._objects,n),this._objects.unshift(n);else r(this._objects,t),this._objects.unshift(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(t){if(!t)return this;var e,n,i,o=this._activeObject;if(t===o&&"activeSelection"===t.type)for(i=o._objects,e=0;e<i.length;e++)n=i[e],r(this._objects,n),this._objects.push(n);else r(this._objects,t),this._objects.push(t);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(t,e){if(!t)return this;var n,i,o,a,s,l=this._activeObject,c=0;if(t===l&&"activeSelection"===t.type)for(s=l._objects,n=0;n<s.length;n++)i=s[n],(o=this._objects.indexOf(i))>0+c&&(a=o-1,r(this._objects,i),this._objects.splice(a,0,i)),c++;else 0!==(o=this._objects.indexOf(t))&&(a=this._findNewLowerIndex(t,o,e),r(this._objects,t),this._objects.splice(a,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(t,e,n){var r,i;if(n)for(r=e,i=e-1;i>=0;--i){if(t.intersectsWithObject(this._objects[i])||t.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(t)){r=i;break}}else r=e-1;return r},bringForward:function(t,e){if(!t)return this;var n,i,o,a,s,l=this._activeObject,c=0;if(t===l&&"activeSelection"===t.type)for(n=(s=l._objects).length;n--;)i=s[n],(o=this._objects.indexOf(i))<this._objects.length-1-c&&(a=o+1,r(this._objects,i),this._objects.splice(a,0,i)),c++;else(o=this._objects.indexOf(t))!==this._objects.length-1&&(a=this._findNewUpperIndex(t,o,e),r(this._objects,t),this._objects.splice(a,0,t));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(t,e,n){var r,i,o;if(n)for(r=e,i=e+1,o=this._objects.length;i<o;++i){if(t.intersectsWithObject(this._objects[i])||t.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(t)){r=i;break}}else r=e+1;return r},moveTo:function(t,e){return r(this._objects,t),this._objects.splice(e,0,t),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(n.util.cancelAnimFrame(this.isRendering),this.isRendering=0),this.forEachObject((function(t){t.dispose&&t.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"),n.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute("width",this.width),this.lowerCanvasEl.setAttribute("height",this.height),n.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}}),t(n.StaticCanvas.prototype,n.Observable),t(n.StaticCanvas.prototype,n.Collection),t(n.StaticCanvas.prototype,n.DataURLExporter),t(n.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(t){var e=l();if(!e||!e.getContext)return null;var n=e.getContext("2d");return n&&"setLineDash"===t?typeof n.setLineDash<"u":null}}),n.StaticCanvas.prototype.toJSON=n.StaticCanvas.prototype.toObject,n.isLikelyNode&&(n.StaticCanvas.prototype.createPNGStream=function(){var t=s(this.lowerCanvasEl);return t&&t.createPNGStream()},n.StaticCanvas.prototype.createJPEGStream=function(t){var e=s(this.lowerCanvasEl);return e&&e.createJPEGStream(t)})}}(),n.BaseBrush=n.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(t){t.strokeStyle=this.color,t.lineWidth=this.width,t.lineCap=this.strokeLineCap,t.miterLimit=this.strokeMiterLimit,t.lineJoin=this.strokeLineJoin,t.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(t){var e=this.canvas.viewportTransform;t.save(),t.transform(e[0],e[1],e[2],e[3],e[4],e[5])},_setShadow:function(){if(this.shadow){var t=this.canvas,e=this.shadow,r=t.contextTop,i=t.getZoom();t&&t._isRetinaScaling()&&(i*=n.devicePixelRatio),r.shadowColor=e.color,r.shadowBlur=e.blur*i,r.shadowOffsetX=e.offsetX*i,r.shadowOffsetY=e.offsetY*i}},needsFullRender:function(){return new n.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var t=this.canvas.contextTop;t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0},_isOutSideCanvas:function(t){return t.x<0||t.x>this.canvas.getWidth()||t.y<0||t.y>this.canvas.getHeight()}}),n.PencilBrush=n.util.createClass(n.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:"shiftKey",initialize:function(t){this.canvas=t,this._points=[]},needsFullRender:function(){return this.callSuper("needsFullRender")||this._hasStraightLine},_drawSegment:function(t,e,n){var r=e.midPointFrom(n);return t.quadraticCurveTo(e.x,e.y,r.x,r.y),r},onMouseDown:function(t,e){!this.canvas._isMainEvent(e.e)||(this.drawStraightLine=e.e[this.straightLineKey],this._prepareForDrawing(t),this._captureDrawingPath(t),this._render())},onMouseMove:function(t,e){if(this.canvas._isMainEvent(e.e)&&(this.drawStraightLine=e.e[this.straightLineKey],(!0!==this.limitedToCanvasSize||!this._isOutSideCanvas(t))&&this._captureDrawingPath(t)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var n=this._points,r=n.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,n[r-2],n[r-1],!0),i.stroke(),i.restore()}},onMouseUp:function(t){return!this.canvas._isMainEvent(t.e)||(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1)},_prepareForDrawing:function(t){var e=new n.Point(t.x,t.y);this._reset(),this._addPoint(e),this.canvas.contextTop.moveTo(e.x,e.y)},_addPoint:function(t){return!(this._points.length>1&&t.eq(this._points[this._points.length-1]))&&(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(t),!0)},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(t){var e=new n.Point(t.x,t.y);return this._addPoint(e)},_render:function(t){var e,r,i=this._points[0],o=this._points[1];if(t=t||this.canvas.contextTop,this._saveAndTransform(t),t.beginPath(),2===this._points.length&&i.x===o.x&&i.y===o.y){var a=this.width/1e3;i=new n.Point(i.x,i.y),o=new n.Point(o.x,o.y),i.x-=a,o.x+=a}for(t.moveTo(i.x,i.y),e=1,r=this._points.length;e<r;e++)this._drawSegment(t,i,o),i=this._points[e],o=this._points[e+1];t.lineTo(i.x,i.y),t.stroke(),t.restore()},convertPointsToSVGPath:function(t){var e=this.width/1e3;return n.util.getSmoothPathFromPoints(t,e)},_isEmptySVGPath:function(t){return"M 0 0 Q 0 0 0 0 L 0 0"===n.util.joinPath(t)},createPath:function(t){var e=new n.Path(t,{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,e.shadow=new n.Shadow(this.shadow)),e},decimatePoints:function(t,e){if(t.length<=2)return t;var n,r=this.canvas.getZoom(),i=Math.pow(e/r,2),o=t.length-1,a=t[0],s=[a];for(n=1;n<o-1;n++)Math.pow(a.x-t[n].x,2)+Math.pow(a.y-t[n].y,2)>=i&&(a=t[n],s.push(a));return s.push(t[o]),s},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var t=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(t))this.canvas.requestRenderAll();else{var e=this.createPath(t);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire("before:path:created",{path:e}),this.canvas.add(e),this.canvas.requestRenderAll(),e.setCoords(),this._resetShadow(),this.canvas.fire("path:created",{path:e})}}}),n.CircleBrush=n.util.createClass(n.BaseBrush,{width:10,initialize:function(t){this.canvas=t,this.points=[]},drawDot:function(t){var e=this.addPoint(t),n=this.canvas.contextTop;this._saveAndTransform(n),this.dot(n,e),n.restore()},dot:function(t,e){t.fillStyle=e.fill,t.beginPath(),t.arc(e.x,e.y,e.radius,0,2*Math.PI,!1),t.closePath(),t.fill()},onMouseDown:function(t){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(t)},_render:function(){var t,e,n=this.canvas.contextTop,r=this.points;for(this._saveAndTransform(n),t=0,e=r.length;t<e;t++)this.dot(n,r[t]);n.restore()},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(t),this._render()):this.drawDot(t))},onMouseUp:function(){var t,e,r=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;var i=[];for(t=0,e=this.points.length;t<e;t++){var o=this.points[t],a=new n.Circle({radius:o.radius,left:o.x,top:o.y,originX:"center",originY:"center",fill:o.fill});this.shadow&&(a.shadow=new n.Shadow(this.shadow)),i.push(a)}var s=new n.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=r,this.canvas.requestRenderAll()},addPoint:function(t){var e=new n.Point(t.x,t.y),r=n.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,i=new n.Color(this.color).setAlpha(n.util.getRandomInt(0,100)/100).toRgba();return e.radius=r,e.fill=i,this.points.push(e),e}}),n.SprayBrush=n.util.createClass(n.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(t){this.canvas=t,this.sprayChunks=[]},onMouseDown:function(t){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(t),this.render(this.sprayChunkPoints)},onMouseMove:function(t){!0===this.limitedToCanvasSize&&this._isOutSideCanvas(t)||(this.addSprayChunk(t),this.render(this.sprayChunkPoints))},onMouseUp:function(){var t=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var e=[],r=0,i=this.sprayChunks.length;r<i;r++)for(var o=this.sprayChunks[r],a=0,s=o.length;a<s;a++){var l=new n.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});e.push(l)}this.optimizeOverlapping&&(e=this._getOptimizedRects(e));var c=new n.Group(e);this.shadow&&c.set("shadow",new n.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=t,this.canvas.requestRenderAll()},_getOptimizedRects:function(t){var e,n,r,i={};for(n=0,r=t.length;n<r;n++)i[e=t[n].left+""+t[n].top]||(i[e]=t[n]);var o=[];for(e in i)o.push(i[e]);return o},render:function(t){var e,n,r=this.canvas.contextTop;for(r.fillStyle=this.color,this._saveAndTransform(r),e=0,n=t.length;e<n;e++){var i=t[e];typeof i.opacity<"u"&&(r.globalAlpha=i.opacity),r.fillRect(i.x,i.y,i.width,i.width)}r.restore()},_render:function(){var t,e,n=this.canvas.contextTop;for(n.fillStyle=this.color,this._saveAndTransform(n),t=0,e=this.sprayChunks.length;t<e;t++)this.render(this.sprayChunks[t]);n.restore()},addSprayChunk:function(t){this.sprayChunkPoints=[];var e,r,i,o,a=this.width/2;for(o=0;o<this.density;o++){e=n.util.getRandomInt(t.x-a,t.x+a),r=n.util.getRandomInt(t.y-a,t.y+a),i=this.dotWidthVariance?n.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var s=new n.Point(e,r);s.width=i,this.randomOpacity&&(s.opacity=n.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(s)}this.sprayChunks.push(this.sprayChunkPoints)}}),n.PatternBrush=n.util.createClass(n.PencilBrush,{getPatternSrc:function(){var t=n.util.createCanvasElement(),e=t.getContext("2d");return t.width=t.height=25,e.fillStyle=this.color,e.beginPath(),e.arc(10,10,10,0,2*Math.PI,!1),e.closePath(),e.fill(),t},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(t){return t.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(t){this.callSuper("_setBrushStyles",t),t.strokeStyle=this.getPattern(t)},createPath:function(t){var e=this.callSuper("createPath",t),r=e._getLeftTopCoords().scalarAdd(e.strokeWidth/2);return e.stroke=new n.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-r.x,offsetY:-r.y}),e}}),function(){var t=n.util.getPointer,e=n.util.degreesToRadians,r=n.util.isTouchEvent;for(var i in n.Canvas=n.util.createClass(n.StaticCanvas,{initialize:function(t,e){e||(e={}),this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(t,e),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=n.PencilBrush&&new n.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var t,e,n,r=this.getActiveObjects();if(r.length>0&&!this.preserveObjectStacking){e=[],n=[];for(var i=0,o=this._objects.length;i<o;i++)t=this._objects[i],-1===r.indexOf(t)?e.push(t):n.push(t);r.length>1&&(this._activeObject._objects=n),e.push.apply(e,n)}else e=this._objects;return e},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 t=this.contextContainer;return this.renderCanvas(t,this._chooseObjectsToRender()),this},renderTopLayer:function(t){t.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(t),this.contextTopDirty=!0),t.restore()},renderTop:function(){var t=this.contextTop;return this.clearContext(t),this.renderTopLayer(t),this.fire("after:render"),this},_normalizePointer:function(t,e){var r=t.calcTransformMatrix(),i=n.util.invertTransform(r),o=this.restorePointerVpt(e);return n.util.transformPoint(o,i)},isTargetTransparent:function(t,e,r){if(t.shouldCache()&&t._cacheCanvas&&t!==this._activeObject){var i=this._normalizePointer(t,{x:e,y:r}),o=Math.max(t.cacheTranslationX+i.x*t.zoomX,0),a=Math.max(t.cacheTranslationY+i.y*t.zoomY,0);return n.util.isTransparent(t._cacheContext,Math.round(o),Math.round(a),this.targetFindTolerance)}var s=this.contextCache,l=t.selectionBackgroundColor,c=this.viewportTransform;return t.selectionBackgroundColor="",this.clearContext(s),s.save(),s.transform(c[0],c[1],c[2],c[3],c[4],c[5]),t.render(s),s.restore(),t.selectionBackgroundColor=l,n.util.isTransparent(s,e,r,this.targetFindTolerance)},_isSelectionKeyPressed:function(t){return Array.isArray(this.selectionKey)?!!this.selectionKey.find((function(e){return!0===t[e]})):t[this.selectionKey]},_shouldClearSelection:function(t,e){var n=this.getActiveObjects(),r=this._activeObject;return!e||e&&r&&n.length>1&&-1===n.indexOf(e)&&r!==e&&!this._isSelectionKeyPressed(t)||e&&!e.evented||e&&!e.selectable&&r&&r!==e},_shouldCenterTransform:function(t,e,n){var r;if(t)return"scale"===e||"scaleX"===e||"scaleY"===e||"resizing"===e?r=this.centeredScaling||t.centeredScaling:"rotate"===e&&(r=this.centeredRotation||t.centeredRotation),r?!n:n},_getOriginFromCorner:function(t,e){var n={x:t.originX,y:t.originY};return"ml"===e||"tl"===e||"bl"===e?n.x="right":("mr"===e||"tr"===e||"br"===e)&&(n.x="left"),"tl"===e||"mt"===e||"tr"===e?n.y="bottom":("bl"===e||"mb"===e||"br"===e)&&(n.y="top"),n},_getActionFromCorner:function(t,e,n,r){if(!e||!t)return"drag";var i=r.controls[e];return i.getActionName(n,i,r)},_setupCurrentTransform:function(t,r,i){if(r){var o=this.getPointer(t),a=r.__corner,s=r.controls[a],l=i&&a?s.getActionHandler(t,r,s):n.controlsUtils.dragHandler,c=this._getActionFromCorner(i,a,t,r),u=this._getOriginFromCorner(r,a),h=t[this.centeredKey],d={target:r,action:c,actionHandler:l,corner:a,scaleX:r.scaleX,scaleY:r.scaleY,skewX:r.skewX,skewY:r.skewY,offsetX:o.x-r.left,offsetY:o.y-r.top,originX:u.x,originY:u.y,ex:o.x,ey:o.y,lastX:o.x,lastY:o.y,theta:e(r.angle),width:r.width*r.scaleX,shiftKey:t.shiftKey,altKey:h,original:n.util.saveObjectTransform(r)};this._shouldCenterTransform(r,c,h)&&(d.originX="center",d.originY="center"),d.original.originX=u.x,d.original.originY=u.y,this._currentTransform=d,this._beforeTransform(t)}},setCursor:function(t){this.upperCanvasEl.style.cursor=t},_drawSelection:function(t){var e=this._groupSelector,r=new n.Point(e.ex,e.ey),i=n.util.transformPoint(r,this.viewportTransform),o=new n.Point(e.ex+e.left,e.ey+e.top),a=n.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),h=this.selectionLineWidth/2;this.selectionColor&&(t.fillStyle=this.selectionColor,t.fillRect(s,l,c-s,u-l)),this.selectionLineWidth&&this.selectionBorderColor&&(t.lineWidth=this.selectionLineWidth,t.strokeStyle=this.selectionBorderColor,s+=h,l+=h,c-=h,u-=h,n.Object.prototype._setLineDash.call(this,t,this.selectionDashArray),t.strokeRect(s,l,c-s,u-l))},findTarget:function(t,e){if(!this.skipTargetFind){var n,i,o=this.getPointer(t,!0),a=this._activeObject,s=this.getActiveObjects(),l=r(t),c=s.length>1&&!e||1===s.length;if(this.targets=[],c&&a._findTargetCorner(o,l)||s.length>1&&!e&&a===this._searchPossibleTargets([a],o))return a;if(1===s.length&&a===this._searchPossibleTargets([a],o)){if(!this.preserveObjectStacking)return a;n=a,i=this.targets,this.targets=[]}var u=this._searchPossibleTargets(this._objects,o);return t[this.altSelectionKey]&&u&&n&&u!==n&&(u=n,this.targets=i),u}},_checkTarget:function(t,e,n){if(e&&e.visible&&e.evented&&e.containsPoint(t)){if(!this.perPixelTargetFind&&!e.perPixelTargetFind||e.isEditing)return!0;if(!this.isTargetTransparent(e,n.x,n.y))return!0}},_searchPossibleTargets:function(t,e){for(var r,i,o=t.length;o--;){var a=t[o],s=a.group?this._normalizePointer(a.group,e):e;if(this._checkTarget(s,a,e)){(r=t[o]).subTargetCheck&&r instanceof n.Group&&((i=this._searchPossibleTargets(r._objects,e))&&this.targets.push(i));break}}return r},restorePointerVpt:function(t){return n.util.transformPoint(t,n.util.invertTransform(this.viewportTransform))},getPointer:function(e,n){if(this._absolutePointer&&!n)return this._absolutePointer;if(this._pointer&&n)return this._pointer;var r,i=t(e),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,n||(i=this.restorePointerVpt(i));var c=this.getRetinaScaling();return 1!==c&&(i.x/=c,i.y/=c),r=0===s||0===l?{width:1,height:1}:{width:o.width/s,height:o.height/l},{x:i.x*r.width,y:i.y*r.height}},_createUpperCanvas:function(){var t=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,""),e=this.lowerCanvasEl,r=this.upperCanvasEl;r?r.className="":(r=this._createCanvasElement(),this.upperCanvasEl=r),n.util.addClass(r,"upper-canvas "+t),this.wrapperEl.appendChild(r),this._copyCanvasStyle(e,r),this._applyCanvasStyle(r),this.contextTop=r.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=n.util.wrapElement(this.lowerCanvasEl,"div",{class:this.containerClass}),n.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"}),n.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(t){var e=this.width||t.width,r=this.height||t.height;n.util.setStyle(t,{position:"absolute",width:e+"px",height:r+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none","-ms-touch-action":this.allowTouchScrolling?"manipulation":"none"}),t.width=e,t.height=r,n.util.makeElementUnselectable(t)},_copyCanvasStyle:function(t,e){e.style.cssText=t.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var t=this._activeObject;return t?"activeSelection"===t.type&&t._objects?t._objects.slice(0):[t]:[]},_onObjectRemoved:function(t){t===this._activeObject&&(this.fire("before:selection:cleared",{target:t}),this._discardActiveObject(),this.fire("selection:cleared",{target:t}),t.fire("deselected")),t===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper("_onObjectRemoved",t)},_fireSelectionEvents:function(t,e){var n=!1,r=this.getActiveObjects(),i=[],o=[];t.forEach((function(t){-1===r.indexOf(t)&&(n=!0,t.fire("deselected",{e:e,target:t}),o.push(t))})),r.forEach((function(r){-1===t.indexOf(r)&&(n=!0,r.fire("selected",{e:e,target:r}),i.push(r))})),t.length>0&&r.length>0?n&&this.fire("selection:updated",{e:e,selected:i,deselected:o}):r.length>0?this.fire("selection:created",{e:e,selected:i}):t.length>0&&this.fire("selection:cleared",{e:e,deselected:o})},setActiveObject:function(t,e){var n=this.getActiveObjects();return this._setActiveObject(t,e),this._fireSelectionEvents(n,e),this},_setActiveObject:function(t,e){return!(this._activeObject===t||!this._discardActiveObject(e,t)||t.onSelect({e:e}))&&(this._activeObject=t,!0)},_discardActiveObject:function(t,e){var n=this._activeObject;if(n){if(n.onDeselect({e:t,object:e}))return!1;this._activeObject=null}return!0},discardActiveObject:function(t){var e=this.getActiveObjects(),n=this.getActiveObject();return e.length&&this.fire("before:selection:cleared",{target:n,e:t}),this._discardActiveObject(t),this._fireSelectionEvents(e,t),this},dispose:function(){var t=this.wrapperEl;return this.removeListeners(),t.removeChild(this.upperCanvasEl),t.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(t){n.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this)),t.parentNode&&t.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,n.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(t){var e=this._activeObject;e&&e._renderControls(t)},_toObject:function(t,e,n){var r=this._realizeGroupTransformOnObject(t),i=this.callSuper("_toObject",t,e,n);return this._unwindGroupTransformOnObject(t,r),i},_realizeGroupTransformOnObject:function(t){if(t.group&&"activeSelection"===t.group.type&&this._activeObject===t.group){var e={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach((function(n){e[n]=t[n]})),n.util.addTransformToObject(t,this._activeObject.calcOwnMatrix()),e}return null},_unwindGroupTransformOnObject:function(t,e){e&&t.set(e)},_setSVGObject:function(t,e,n){var r=this._realizeGroupTransformOnObject(e);this.callSuper("_setSVGObject",t,e,n),this._unwindGroupTransformOnObject(e,r)},setViewportTransform:function(t){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),n.StaticCanvas.prototype.setViewportTransform.call(this,t)}}),n.StaticCanvas)"prototype"!==i&&(n.Canvas[i]=n.StaticCanvas[i])}(),function(){var t=n.util.addListener,e=n.util.removeListener,r={passive:!1};function i(t,e){return t.button&&t.button===e-1}n.util.object.extend(n.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(t,"add")},_getEventPrefix:function(){return this.enablePointerEvents?"pointer":"mouse"},addOrRemove:function(t,e){var i=this.upperCanvasEl,o=this._getEventPrefix();t(n.window,"resize",this._onResize),t(i,o+"down",this._onMouseDown),t(i,o+"move",this._onMouseMove,r),t(i,o+"out",this._onMouseOut),t(i,o+"enter",this._onMouseEnter),t(i,"wheel",this._onMouseWheel),t(i,"contextmenu",this._onContextMenu),t(i,"dblclick",this._onDoubleClick),t(i,"dragover",this._onDragOver),t(i,"dragenter",this._onDragEnter),t(i,"dragleave",this._onDragLeave),t(i,"drop",this._onDrop),this.enablePointerEvents||t(i,"touchstart",this._onTouchStart,r),typeof eventjs<"u"&&e in eventjs&&(eventjs[e](i,"gesture",this._onGesture),eventjs[e](i,"drag",this._onDrag),eventjs[e](i,"orientation",this._onOrientationChange),eventjs[e](i,"shake",this._onShake),eventjs[e](i,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(e,"remove");var t=this._getEventPrefix();e(n.document,t+"up",this._onMouseUp),e(n.document,"touchend",this._onTouchEnd,r),e(n.document,t+"move",this._onMouseMove,r),e(n.document,"touchmove",this._onMouseMove,r)},_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(t,e){this.__onTransformGesture&&this.__onTransformGesture(t,e)},_onDrag:function(t,e){this.__onDrag&&this.__onDrag(t,e)},_onMouseWheel:function(t){this.__onMouseWheel(t)},_onMouseOut:function(t){var e=this._hoveredTarget;this.fire("mouse:out",{target:e,e:t}),this._hoveredTarget=null,e&&e.fire("mouseout",{e:t});var n=this;this._hoveredTargets.forEach((function(r){n.fire("mouse:out",{target:e,e:t}),r&&e.fire("mouseout",{e:t})})),this._hoveredTargets=[]},_onMouseEnter:function(t){!this._currentTransform&&!this.findTarget(t)&&(this.fire("mouse:over",{target:null,e:t}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(t,e){this.__onOrientationChange&&this.__onOrientationChange(t,e)},_onShake:function(t,e){this.__onShake&&this.__onShake(t,e)},_onLongPress:function(t,e){this.__onLongPress&&this.__onLongPress(t,e)},_onDragOver:function(t){t.preventDefault();var e=this._simpleEventHandler("dragover",t);this._fireEnterLeaveEvents(e,t)},_onDrop:function(t){return this._simpleEventHandler("drop:before",t),this._simpleEventHandler("drop",t)},_onContextMenu:function(t){return this.stopContextMenu&&(t.stopPropagation(),t.preventDefault()),!1},_onDoubleClick:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"dblclick"),this._resetTransformEventData(t)},getPointerId:function(t){var e=t.changedTouches;return e?e[0]&&e[0].identifier:this.enablePointerEvents?t.pointerId:-1},_isMainEvent:function(t){return!0===t.isPrimary||!1!==t.isPrimary&&("touchend"===t.type&&0===t.touches.length||(!t.changedTouches||t.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();t(n.document,"touchend",this._onTouchEnd,r),t(n.document,"touchmove",this._onMouseMove,r),e(o,a+"down",this._onMouseDown)},_onMouseDown:function(i){this.__onMouseDown(i),this._resetTransformEventData();var o=this.upperCanvasEl,a=this._getEventPrefix();e(o,a+"move",this._onMouseMove,r),t(n.document,a+"up",this._onMouseUp),t(n.document,a+"move",this._onMouseMove,r)},_onTouchEnd:function(i){if(!(i.touches.length>0)){this.__onMouseUp(i),this._resetTransformEventData(),this.mainTouchId=null;var o=this._getEventPrefix();e(n.document,"touchend",this._onTouchEnd,r),e(n.document,"touchmove",this._onMouseMove,r);var a=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout((function(){t(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)&&(e(n.document,a+"up",this._onMouseUp),e(n.document,a+"move",this._onMouseMove,r),t(o,a+"move",this._onMouseMove,r))},_onMouseMove:function(t){!this.allowTouchScrolling&&t.preventDefault&&t.preventDefault(),this.__onMouseMove(t)},_onResize:function(){this.calcOffset()},_shouldRender:function(t){var e=this._activeObject;return!!(!!e!=!!t||e&&t&&e!==t)||(e&&e.isEditing,!1)},__onMouseUp:function(t){var e,r=this._currentTransform,o=this._groupSelector,a=!1,s=!o||0===o.left&&0===o.top;if(this._cacheTransformEventData(t),e=this._target,this._handleEvent(t,"up:before"),i(t,3))this.fireRightClick&&this._handleEvent(t,"up",3,s);else{if(i(t,2))return this.fireMiddleClick&&this._handleEvent(t,"up",2,s),void this._resetTransformEventData();if(this.isDrawingMode&&this._isCurrentlyDrawing)this._onMouseUpInDrawingMode(t);else if(this._isMainEvent(t)){if(r&&(this._finalizeCurrentTransform(t),a=r.actionPerformed),!s){var l=e===this._activeObject;this._maybeGroupObjects(t),a||(a=this._shouldRender(e)||!l&&e===this._activeObject)}var c,u;if(e){if(c=e._findTargetCorner(this.getPointer(t,!0),n.util.isTouchEvent(t)),e.selectable&&e!==this._activeObject&&"up"===e.activeOn)this.setActiveObject(e,t),a=!0;else{var h=e.controls[c],d=h&&h.getMouseUpHandler(t,e,h);d&&d(t,r,(u=this.getPointer(t)).x,u.y)}e.isMoving=!1}if(r&&(r.target!==e||r.corner!==c)){var f=r.target&&r.target.controls[r.corner],p=f&&f.getMouseUpHandler(t,e,h);u=u||this.getPointer(t),p&&p(t,r,u.x,u.y)}this._setCursorFromEvent(t,e),this._handleEvent(t,"up",1,s),this._groupSelector=null,this._currentTransform=null,e&&(e.__corner=0),a?this.requestRenderAll():s||this.renderTop()}}},_simpleEventHandler:function(t,e){var n=this.findTarget(e),r=this.targets,i={e:e,target:n,subTargets:r};if(this.fire(t,i),n&&n.fire(t,i),!r)return n;for(var o=0;o<r.length;o++)r[o].fire(t,i);return n},_handleEvent:function(t,e,n,r){var i=this._target,o=this.targets||[],a={e:t,target:i,subTargets:o,button:n||1,isClick:r||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};"up"===e&&(a.currentTarget=this.findTarget(t),a.currentSubTargets=this.targets),this.fire("mouse:"+e,a),i&&i.fire("mouse"+e,a);for(var s=0;s<o.length;s++)o[s].fire("mouse"+e,a)},_finalizeCurrentTransform:function(t){var e=this._currentTransform,n=e.target,r={e:t,target:n,transform:e,action:e.action};n._scaling&&(n._scaling=!1),n.setCoords(),(e.actionPerformed||this.stateful&&n.hasStateChanged())&&this._fire("modified",r)},_onMouseDownInDrawingMode:function(t){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(t).requestRenderAll();var e=this.getPointer(t);this.freeDrawingBrush.onMouseDown(e,{e:t,pointer:e}),this._handleEvent(t,"down")},_onMouseMoveInDrawingMode:function(t){if(this._isCurrentlyDrawing){var e=this.getPointer(t);this.freeDrawingBrush.onMouseMove(e,{e:t,pointer:e})}this.setCursor(this.freeDrawingCursor),this._handleEvent(t,"move")},_onMouseUpInDrawingMode:function(t){var e=this.getPointer(t);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e:t,pointer:e}),this._handleEvent(t,"up")},__onMouseDown:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"down:before");var e=this._target;if(i(t,3))this.fireRightClick&&this._handleEvent(t,"down",3);else if(i(t,2))this.fireMiddleClick&&this._handleEvent(t,"down",2);else if(this.isDrawingMode)this._onMouseDownInDrawingMode(t);else if(this._isMainEvent(t)&&!this._currentTransform){var r=this._pointer;this._previousPointer=r;var o=this._shouldRender(e),a=this._shouldGroup(t,e);if(this._shouldClearSelection(t,e)?this.discardActiveObject(t):a&&(this._handleGrouping(t,e),e=this._activeObject),this.selection&&(!e||!e.selectable&&!e.isEditing&&e!==this._activeObject)&&(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),e){var s=e===this._activeObject;e.selectable&&"down"===e.activeOn&&this.setActiveObject(e,t);var l=e._findTargetCorner(this.getPointer(t,!0),n.util.isTouchEvent(t));if(e.__corner=l,e===this._activeObject&&(l||!a)){this._setupCurrentTransform(t,e,s);var c=e.controls[l],u=(r=this.getPointer(t),c&&c.getMouseDownHandler(t,e,c));u&&u(t,this._currentTransform,r.x,r.y)}}this._handleEvent(t,"down"),(o||a)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(t){this._resetTransformEventData(),this._pointer=this.getPointer(t,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(t)||null},_beforeTransform:function(t){var e=this._currentTransform;this.stateful&&e.target.saveState(),this.fire("before:transform",{e:t,transform:e})},__onMouseMove:function(t){var e,n;if(this._handleEvent(t,"move:before"),this._cacheTransformEventData(t),this.isDrawingMode)this._onMouseMoveInDrawingMode(t);else if(this._isMainEvent(t)){var r=this._groupSelector;r?(n=this._absolutePointer,r.left=n.x-r.ex,r.top=n.y-r.ey,this.renderTop()):this._currentTransform?this._transformObject(t):(e=this.findTarget(t)||null,this._setCursorFromEvent(t,e),this._fireOverOutEvents(e,t)),this._handleEvent(t,"move"),this._resetTransformEventData()}},_fireOverOutEvents:function(t,e){var n=this._hoveredTarget,r=this._hoveredTargets,i=this.targets,o=Math.max(r.length,i.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:n,evtOut:"mouseout",canvasEvtOut:"mouse:out",evtIn:"mouseover",canvasEvtIn:"mouse:over"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(i[a],e,{oldTarget:r[a],evtOut:"mouseout",evtIn:"mouseover"});this._hoveredTarget=t,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(t,e){var n=this._draggedoverTarget,r=this._hoveredTargets,i=this.targets,o=Math.max(r.length,i.length);this.fireSyntheticInOutEvents(t,e,{oldTarget:n,evtOut:"dragleave",evtIn:"dragenter"});for(var a=0;a<o;a++)this.fireSyntheticInOutEvents(i[a],e,{oldTarget:r[a],evtOut:"dragleave",evtIn:"dragenter"});this._draggedoverTarget=t},fireSyntheticInOutEvents:function(t,e,n){var r,i,o,a=n.oldTarget,s=a!==t,l=n.canvasEvtIn,c=n.canvasEvtOut;s&&(r={e:e,target:t,previousTarget:a},i={e:e,target:a,nextTarget:t}),o=t&&s,a&&s&&(c&&this.fire(c,i),a.fire(n.evtOut,i)),o&&(l&&this.fire(l,r),t.fire(n.evtIn,r))},__onMouseWheel:function(t){this._cacheTransformEventData(t),this._handleEvent(t,"wheel"),this._resetTransformEventData()},_transformObject:function(t){var e=this.getPointer(t),n=this._currentTransform;n.reset=!1,n.shiftKey=t.shiftKey,n.altKey=t[this.centeredKey],this._performTransformAction(t,n,e),n.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(t,e,n){var r=n.x,i=n.y,o=e.action,a=!1,s=e.actionHandler;s&&(a=s(t,e,r,i)),"drag"===o&&a&&(e.target.isMoving=!0,this.setCursor(e.target.moveCursor||this.moveCursor)),e.actionPerformed=e.actionPerformed||a},_fire:n.controlsUtils.fireEvent,_setCursorFromEvent:function(t,e){if(!e)return this.setCursor(this.defaultCursor),!1;var n=e.hoverCursor||this.hoverCursor,r=this._activeObject&&"activeSelection"===this._activeObject.type?this._activeObject:null,i=(!r||!r.contains(e))&&e._findTargetCorner(this.getPointer(t,!0));i?this.setCursor(this.getCornerCursor(i,e,t)):(e.subTargetCheck&&this.targets.concat().reverse().map((function(t){n=t.hoverCursor||n})),this.setCursor(n))},getCornerCursor:function(t,e,n){var r=e.controls[t];return r.cursorStyleHandler(n,r,e)}})}(),function(){var t=Math.min,e=Math.max;n.util.object.extend(n.Canvas.prototype,{_shouldGroup:function(t,e){var n=this._activeObject;return n&&this._isSelectionKeyPressed(t)&&e&&e.selectable&&this.selection&&(n!==e||"activeSelection"===n.type)&&!e.onSelect({e:t})},_handleGrouping:function(t,e){var n=this._activeObject;n.__corner||e===n&&(!(e=this.findTarget(t,!0))||!e.selectable)||(n&&"activeSelection"===n.type?this._updateActiveSelection(e,t):this._createActiveSelection(e,t))},_updateActiveSelection:function(t,e){var n=this._activeObject,r=n._objects.slice(0);n.contains(t)?(n.removeWithUpdate(t),this._hoveredTarget=t,this._hoveredTargets=this.targets.concat(),1===n.size()&&this._setActiveObject(n.item(0),e)):(n.addWithUpdate(t),this._hoveredTarget=n,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(r,e)},_createActiveSelection:function(t,e){var n=this.getActiveObjects(),r=this._createGroup(t);this._hoveredTarget=r,this._setActiveObject(r,e),this._fireSelectionEvents(n,e)},_createGroup:function(t){var e=this._objects,r=e.indexOf(this._activeObject)<e.indexOf(t)?[this._activeObject,t]:[t,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new n.ActiveSelection(r,{canvas:this})},_groupSelectedObjects:function(t){var e,r=this._collectObjects(t);1===r.length?this.setActiveObject(r[0],t):r.length>1&&(e=new n.ActiveSelection(r.reverse(),{canvas:this}),this.setActiveObject(e,t))},_collectObjects:function(r){for(var i,o=[],a=this._groupSelector.ex,s=this._groupSelector.ey,l=a+this._groupSelector.left,c=s+this._groupSelector.top,u=new n.Point(t(a,l),t(s,c)),h=new n.Point(e(a,l),e(s,c)),d=!this.selectionFullyContained,f=a===l&&s===c,p=this._objects.length;p--&&!((i=this._objects[p])&&i.selectable&&i.visible&&(d&&i.intersectsWithRect(u,h,!0)||i.isContainedWithinRect(u,h,!0)||d&&i.containsPoint(u,null,!0)||d&&i.containsPoint(h,null,!0))&&(o.push(i),f)););return o.length>1&&(o=o.filter((function(t){return!t.onSelect({e:r})}))),o},_maybeGroupObjects:function(t){this.selection&&this._groupSelector&&this._groupSelectedObjects(t),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),n.util.object.extend(n.StaticCanvas.prototype,{toDataURL:function(t){t||(t={});var e=t.format||"png",r=t.quality||1,i=(t.multiplier||1)*(t.enableRetinaScaling?this.getRetinaScaling():1),o=this.toCanvasElement(i,t);return n.util.toDataURL(o,e,r)},toCanvasElement:function(t,e){t=t||1;var r=((e=e||{}).width||this.width)*t,i=(e.height||this.height)*t,o=this.getZoom(),a=this.width,s=this.height,l=o*t,c=this.viewportTransform,u=(c[4]-(e.left||0))*t,h=(c[5]-(e.top||0))*t,d=this.interactive,f=[l,0,0,l,u,h],p=this.enableRetinaScaling,g=n.util.createCanvasElement(),m=this.contextTop;return g.width=r,g.height=i,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=f,this.width=r,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=d,this.enableRetinaScaling=p,this.contextTop=m,g}}),n.util.object.extend(n.StaticCanvas.prototype,{loadFromJSON:function(t,e,r){if(t){var i="string"==typeof t?JSON.parse(t):n.util.object.clone(t),o=this,a=i.clipPath,s=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete i.clipPath,this._enlivenObjects(i.objects,(function(t){o.clear(),o._setBgOverlay(i,(function(){a?o._enlivenObjects([a],(function(n){o.clipPath=n[0],o.__setupCanvas.call(o,i,t,s,e)})):o.__setupCanvas.call(o,i,t,s,e)}))}),r),this}},__setupCanvas:function(t,e,n,r){var i=this;e.forEach((function(t,e){i.insertAt(t,e)})),this.renderOnAddRemove=n,delete t.objects,delete t.backgroundImage,delete t.overlayImage,delete t.background,delete t.overlay,this._setOptions(t),this.renderAll(),r&&r()},_setBgOverlay:function(t,e){var n={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(t.backgroundImage||t.overlayImage||t.background||t.overlay){var r=function(){n.backgroundImage&&n.overlayImage&&n.backgroundColor&&n.overlayColor&&e&&e()};this.__setBgOverlay("backgroundImage",t.backgroundImage,n,r),this.__setBgOverlay("overlayImage",t.overlayImage,n,r),this.__setBgOverlay("backgroundColor",t.background,n,r),this.__setBgOverlay("overlayColor",t.overlay,n,r)}else e&&e()},__setBgOverlay:function(t,e,r,i){var o=this;if(!e)return r[t]=!0,void(i&&i());"backgroundImage"===t||"overlayImage"===t?n.util.enlivenObjects([e],(function(e){o[t]=e[0],r[t]=!0,i&&i()})):this["set"+n.util.string.capitalize(t,!0)](e,(function(){r[t]=!0,i&&i()}))},_enlivenObjects:function(t,e,r){t&&0!==t.length?n.util.enlivenObjects(t,(function(t){e&&e(t)}),null,r):e&&e([])},_toDataURL:function(t,e){this.clone((function(n){e(n.toDataURL(t))}))},_toDataURLWithMultiplier:function(t,e,n){this.clone((function(r){n(r.toDataURLWithMultiplier(t,e))}))},clone:function(t,e){var n=JSON.stringify(this.toJSON(e));this.cloneWithoutData((function(e){e.loadFromJSON(n,(function(){t&&t(e)}))}))},cloneWithoutData:function(t){var e=n.util.createCanvasElement();e.width=this.width,e.height=this.height;var r=new n.Canvas(e);this.backgroundImage?(r.setBackgroundImage(this.backgroundImage.src,(function(){r.renderAll(),t&&t(r)})),r.backgroundImageOpacity=this.backgroundImageOpacity,r.backgroundImageStretch=this.backgroundImageStretch):t&&t(r)}}),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.object.clone,i=e.util.toFixed,o=e.util.string.capitalize,a=e.util.degreesToRadians,s=!e.isLikelyNode;e.Object||(e.Object=e.util.createClass(e.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(t){t&&this.setOptions(t)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=e.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext("2d"),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(t){var n=e.perfLimitSizeTotal,r=t.width,i=t.height,o=e.maxCacheSideLimit,a=e.minCacheSideLimit;if(r<=o&&i<=o&&r*i<=n)return r<a&&(t.width=a),i<a&&(t.height=a),t;var s=r/i,l=e.util.limitDimsByArea(s,n),c=e.util.capValue,u=c(a,l.x,o),h=c(a,l.y,o);return r>u&&(t.zoomX/=r/u,t.width=u,t.capped=!0),i>h&&(t.zoomY/=i/h,t.height=h,t.capped=!0),t},_getCacheCanvasDimensions:function(){var t=this.getTotalObjectScaling(),e=this._getTransformedDimensions(0,0),n=e.x*t.scaleX/this.scaleX,r=e.y*t.scaleY/this.scaleY;return{width:n+2,height:r+2,zoomX:t.scaleX,zoomY:t.scaleY,x:n,y:r}},_updateCacheCanvas:function(){var t=this.canvas;if(this.noScaleCache&&t&&t._currentTransform){var n=t._currentTransform.target,r=t._currentTransform.action;if(this===n&&r.slice&&"scale"===r.slice(0,5))return!1}var i,o,a=this._cacheCanvas,s=this._limitCacheSize(this._getCacheCanvasDimensions()),l=e.minCacheSideLimit,c=s.width,u=s.height,h=s.zoomX,d=s.zoomY,f=c!==this.cacheWidth||u!==this.cacheHeight,p=this.zoomX!==h||this.zoomY!==d,g=f||p,m=0,v=0,b=!1;if(f){var y=this._cacheCanvas.width,x=this._cacheCanvas.height,w=c>y||u>x;b=w||(c<.9*y||u<.9*x)&&y>l&&x>l,w&&!s.capped&&(c>l||u>l)&&(m=.1*c,v=.1*u)}return this instanceof e.Text&&this.path&&(g=!0,b=!0,m+=this.getHeightOfLine(0)*this.zoomX,v+=this.getHeightOfLine(0)*this.zoomY),!!g&&(b?(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(h,d),this.zoomX=h,this.zoomY=d,!0)},setOptions:function(t){this._setOptions(t),this._initGradient(t.fill,"fill"),this._initGradient(t.stroke,"stroke"),this._initPattern(t.fill,"fill"),this._initPattern(t.stroke,"stroke")},transform:function(t){var e=this.group&&!this.group._transformDone||this.group&&this.canvas&&t===this.canvas.contextTop,n=this.calcTransformMatrix(!e);t.transform(n[0],n[1],n[2],n[3],n[4],n[5])},toObject:function(t){var n=e.Object.NUM_FRACTION_DIGITS,r={type:this.type,version:e.version,originX:this.originX,originY:this.originY,left:i(this.left,n),top:i(this.top,n),width:i(this.width,n),height:i(this.height,n),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,n),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:i(this.strokeMiterLimit,n),scaleX:i(this.scaleX,n),scaleY:i(this.scaleY,n),angle:i(this.angle,n),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,n),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,n),skewY:i(this.skewY,n)};return this.clipPath&&!this.clipPath.excludeFromExport&&(r.clipPath=this.clipPath.toObject(t),r.clipPath.inverted=this.clipPath.inverted,r.clipPath.absolutePositioned=this.clipPath.absolutePositioned),e.util.populateWithProperties(this,r,t),this.includeDefaultValues||(r=this._removeDefaultValues(r)),r},toDatalessObject:function(t){return this.toObject(t)},_removeDefaultValues:function(t){var n=e.util.getKlass(t.type).prototype;return n.stateProperties.forEach((function(e){"left"===e||"top"===e||(t[e]===n[e]&&delete t[e],Array.isArray(t[e])&&Array.isArray(n[e])&&0===t[e].length&&0===n[e].length&&delete t[e])})),t},toString:function(){return"#<fabric."+o(this.type)+">"},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var t=e.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(t.scaleX),scaleY:Math.abs(t.scaleY)}},getTotalObjectScaling:function(){var t=this.getObjectScaling(),e=t.scaleX,n=t.scaleY;if(this.canvas){var r=this.canvas.getZoom(),i=this.canvas.getRetinaScaling();e*=r*i,n*=r*i}return{scaleX:e,scaleY:n}},getObjectOpacity:function(){var t=this.opacity;return this.group&&(t*=this.group.getObjectOpacity()),t},_set:function(t,n){var r="scaleX"===t||"scaleY"===t,i=this[t]!==n,o=!1;return r&&(n=this._constrainScale(n)),"scaleX"===t&&n<0?(this.flipX=!this.flipX,n*=-1):"scaleY"===t&&n<0?(this.flipY=!this.flipY,n*=-1):"shadow"!==t||!n||n instanceof e.Shadow?"dirty"===t&&this.group&&this.group.set("dirty",n):n=new e.Shadow(n),this[t]=n,i&&(o=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(t)>-1?(this.dirty=!0,o&&this.group.set("dirty",!0)):o&&this.stateProperties.indexOf(t)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:e.iMatrix.concat()},isNotVisible:function(){return 0===this.opacity||!this.width&&!this.height&&0===this.strokeWidth||!this.visible},render:function(t){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(t.save(),this._setupCompositeOperation(t),this.drawSelectionBackground(t),this.transform(t),this._setOpacity(t),this._setShadow(t,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(t)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(t),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"})),t.restore())},renderCache:function(t){t=t||{},(!this._cacheCanvas||!this._cacheContext)&&this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext,t.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(t,n){if(t.save(),n.inverted?t.globalCompositeOperation="destination-out":t.globalCompositeOperation="destination-in",n.absolutePositioned){var r=e.util.invertTransform(this.calcTransformMatrix());t.transform(r[0],r[1],r[2],r[3],r[4],r[5])}n.transform(t),t.scale(1/n.zoomX,1/n.zoomY),t.drawImage(n._cacheCanvas,-n.cacheTranslationX,-n.cacheTranslationY),t.restore()},drawObject:function(t,e){var n=this.fill,r=this.stroke;e?(this.fill="black",this.stroke="",this._setClippingProperties(t)):this._renderBackground(t),this._render(t),this._drawClipPath(t,this.clipPath),this.fill=n,this.stroke=r},_drawClipPath:function(t,e){!e||(e.canvas=this.canvas,e.shouldCache(),e._transformDone=!0,e.renderCache({forClipping:!0}),this.drawClipPathOnCache(t,e))},drawCacheOnCanvas:function(t){t.scale(1/this.zoomX,1/this.zoomY),t.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(t){if(this.isNotVisible())return!1;if(this._cacheCanvas&&this._cacheContext&&!t&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&this._cacheContext&&!t){var e=this.cacheWidth/this.zoomX,n=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-e/2,-n/2,e,n)}return!0}return!1},_renderBackground:function(t){if(this.backgroundColor){var e=this._getNonTransformedDimensions();t.fillStyle=this.backgroundColor,t.fillRect(-e.x/2,-e.y/2,e.x,e.y),this._removeShadow(t)}},_setOpacity:function(t){this.group&&!this.group._transformDone?t.globalAlpha=this.getObjectOpacity():t.globalAlpha*=this.opacity},_setStrokeStyles:function(t,e){var n=e.stroke;n&&(t.lineWidth=e.strokeWidth,t.lineCap=e.strokeLineCap,t.lineDashOffset=e.strokeDashOffset,t.lineJoin=e.strokeLineJoin,t.miterLimit=e.strokeMiterLimit,n.toLive?"percentage"===n.gradientUnits||n.gradientTransform||n.patternTransform?this._applyPatternForTransformedGradient(t,n):(t.strokeStyle=n.toLive(t,this),this._applyPatternGradientTransform(t,n)):t.strokeStyle=e.stroke)},_setFillStyles:function(t,e){var n=e.fill;n&&(n.toLive?(t.fillStyle=n.toLive(t,this),this._applyPatternGradientTransform(t,e.fill)):t.fillStyle=n)},_setClippingProperties:function(t){t.globalAlpha=1,t.strokeStyle="transparent",t.fillStyle="#000000"},_setLineDash:function(t,e){!e||0===e.length||(1&e.length&&e.push.apply(e,e),t.setLineDash(e))},_renderControls:function(t,n){var r,i,o,s=this.getViewportTransform(),l=this.calcTransformMatrix();i=typeof(n=n||{}).hasBorders<"u"?n.hasBorders:this.hasBorders,o=typeof n.hasControls<"u"?n.hasControls:this.hasControls,l=e.util.multiplyTransformMatrices(s,l),r=e.util.qrDecompose(l),t.save(),t.translate(r.translateX,r.translateY),t.lineWidth=1*this.borderScaleFactor,this.group||(t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(r.angle-=180),t.rotate(a(this.group?r.angle:this.angle)),n.forActiveSelection||this.group?i&&this.drawBordersInGroup(t,r,n):i&&this.drawBorders(t,n),o&&this.drawControls(t,n),t.restore()},_setShadow:function(t){if(this.shadow){var n,r=this.shadow,i=this.canvas,o=i&&i.viewportTransform[0]||1,a=i&&i.viewportTransform[3]||1;n=r.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),i&&i._isRetinaScaling()&&(o*=e.devicePixelRatio,a*=e.devicePixelRatio),t.shadowColor=r.color,t.shadowBlur=r.blur*e.browserShadowBlurConstant*(o+a)*(n.scaleX+n.scaleY)/4,t.shadowOffsetX=r.offsetX*o*n.scaleX,t.shadowOffsetY=r.offsetY*a*n.scaleY}},_removeShadow:function(t){!this.shadow||(t.shadowColor="",t.shadowBlur=t.shadowOffsetX=t.shadowOffsetY=0)},_applyPatternGradientTransform:function(t,e){if(!e||!e.toLive)return{offsetX:0,offsetY:0};var n=e.gradientTransform||e.patternTransform,r=-this.width/2+e.offsetX||0,i=-this.height/2+e.offsetY||0;return"percentage"===e.gradientUnits?t.transform(this.width,0,0,this.height,r,i):t.transform(1,0,0,1,r,i),n&&t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),{offsetX:r,offsetY:i}},_renderPaintInOrder:function(t){"stroke"===this.paintFirst?(this._renderStroke(t),this._renderFill(t)):(this._renderFill(t),this._renderStroke(t))},_render:function(){},_renderFill:function(t){!this.fill||(t.save(),this._setFillStyles(t,this),"evenodd"===this.fillRule?t.fill("evenodd"):t.fill(),t.restore())},_renderStroke:function(t){if(this.stroke&&0!==this.strokeWidth){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this.strokeUniform&&this.group){var e=this.getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else this.strokeUniform&&t.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(t,this.strokeDashArray),this._setStrokeStyles(t,this),t.stroke(),t.restore()}},_applyPatternForTransformedGradient:function(t,n){var r,i=this._limitCacheSize(this._getCacheCanvasDimensions()),o=e.util.createCanvasElement(),a=this.canvas.getRetinaScaling(),s=i.x/this.scaleX/a,l=i.y/this.scaleY/a;o.width=s,o.height=l,(r=o.getContext("2d")).beginPath(),r.moveTo(0,0),r.lineTo(s,0),r.lineTo(s,l),r.lineTo(0,l),r.closePath(),r.translate(s/2,l/2),r.scale(i.zoomX/this.scaleX/a,i.zoomY/this.scaleY/a),this._applyPatternGradientTransform(r,n),r.fillStyle=n.toLive(t),r.fill(),t.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),t.scale(a*this.scaleX/i.zoomX,a*this.scaleY/i.zoomY),t.strokeStyle=r.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 t=e.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set("scaleX",t.scaleX),this.set("scaleY",t.scaleY),this.angle=t.angle,this.skewX=t.skewX,this.skewY=0}},_removeTransformMatrix:function(t){var n=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),n=e.util.transformPoint(n,this.transformMatrix)),this.transformMatrix=null,t&&(this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this.cropX=t.cropX,this.cropY=t.cropY,n.x+=t.offsetLeft,n.y+=t.offsetTop,this.width=t.width,this.height=t.height),this.setPositionByOrigin(n,"center","center")},clone:function(t,n){var r=this.toObject(n);this.constructor.fromObject?this.constructor.fromObject(r,t):e.Object._fromObject("Object",r,t)},cloneAsImage:function(t,n){var r=this.toCanvasElement(n);return t&&t(new e.Image(r)),this},toCanvasElement:function(t){t||(t={});var n=e.util,r=n.saveObjectTransform(this),i=this.group,o=this.shadow,a=Math.abs,s=(t.multiplier||1)*(t.enableRetinaScaling?e.devicePixelRatio:1);delete this.group,t.withoutTransform&&n.resetObjectTransform(this),t.withoutShadow&&(this.shadow=null);var l,c,u,h,d=e.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,h=f.height+g.y,d.width=Math.ceil(u),d.height=Math.ceil(h);var m=new e.StaticCanvas(d,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});"jpeg"===t.format&&(m.backgroundColor="#fff"),this.setPositionByOrigin(new e.Point(m.width/2,m.height/2),"center","center");var v=this.canvas;m.add(this);var b=m.toCanvasElement(s||1,t);return this.shadow=o,this.set("canvas",v),i&&(this.group=i),this.set(r).setCoords(),m._objects=[],m.dispose(),m=null,b},toDataURL:function(t){return t||(t={}),e.util.toDataURL(this.toCanvasElement(t),t.format||"png",t.quality||1)},isType:function(t){return arguments.length>1?Array.from(arguments).includes(this.type):this.type===t},complexity:function(){return 1},toJSON:function(t){return this.toObject(t)},rotate:function(t){var e=("center"!==this.originX||"center"!==this.originY)&&this.centeredRotation;return e&&this._setOriginToCenter(),this.set("angle",t),e&&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(t,n){n=n||this.canvas.getPointer(t);var r=new e.Point(n.x,n.y),i=this._getLeftTopCoords();return this.angle&&(r=e.util.rotatePoint(r,i,a(-this.angle))),{x:r.x-i.x,y:r.y-i.y}},_setupCompositeOperation:function(t){this.globalCompositeOperation&&(t.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){e.runningAnimations&&e.runningAnimations.cancelByTarget(this)}}),e.util.createAccessors&&e.util.createAccessors(e.Object),n(e.Object.prototype,e.Observable),e.Object.NUM_FRACTION_DIGITS=2,e.Object.ENLIVEN_PROPS=["clipPath"],e.Object._fromObject=function(t,n,i,o){var a=e[t];n=r(n,!0),e.util.enlivenPatterns([n.fill,n.stroke],(function(t){typeof t[0]<"u"&&(n.fill=t[0]),typeof t[1]<"u"&&(n.stroke=t[1]),e.util.enlivenObjectEnlivables(n,n,(function(){var t=o?new a(n[o],n):new a(n);i&&i(t)}))}))},e.Object.__uid=0)}(t),function(){var t=n.util.degreesToRadians,e={left:-.5,center:0,right:.5},r={top:-.5,center:0,bottom:.5};n.util.object.extend(n.Object.prototype,{translateToGivenOrigin:function(t,i,o,a,s){var l,c,u,h=t.x,d=t.y;return"string"==typeof i?i=e[i]:i-=.5,"string"==typeof a?a=e[a]:a-=.5,"string"==typeof o?o=r[o]:o-=.5,"string"==typeof s?s=r[s]:s-=.5,c=s-o,((l=a-i)||c)&&(u=this._getTransformedDimensions(),h=t.x+l*u.x,d=t.y+c*u.y),new n.Point(h,d)},translateToCenterPoint:function(e,r,i){var o=this.translateToGivenOrigin(e,r,i,"center","center");return this.angle?n.util.rotatePoint(o,e,t(this.angle)):o},translateToOriginPoint:function(e,r,i){var o=this.translateToGivenOrigin(e,"center","center",r,i);return this.angle?n.util.rotatePoint(o,e,t(this.angle)):o},getCenterPoint:function(){var t=new n.Point(this.left,this.top);return this.translateToCenterPoint(t,this.originX,this.originY)},getPointByOrigin:function(t,e){var n=this.getCenterPoint();return this.translateToOriginPoint(n,t,e)},toLocalPoint:function(e,r,i){var o,a,s=this.getCenterPoint();return o=typeof r<"u"&&typeof i<"u"?this.translateToGivenOrigin(s,"center","center",r,i):new n.Point(this.left,this.top),a=new n.Point(e.x,e.y),this.angle&&(a=n.util.rotatePoint(a,s,-t(this.angle))),a.subtractEquals(o)},setPositionByOrigin:function(t,e,n){var r=this.translateToCenterPoint(t,e,n),i=this.translateToOriginPoint(r,this.originX,this.originY);this.set("left",i.x),this.set("top",i.y)},adjustPosition:function(r){var i,o,a=t(this.angle),s=this.getScaledWidth(),l=n.util.cos(a)*s,c=n.util.sin(a)*s;i="string"==typeof this.originX?e[this.originX]:this.originX-.5,o="string"==typeof r?e[r]:r-.5,this.left+=l*(o-i),this.top+=c*(o-i),this.setCoords(),this.originX=r},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var t=this.getCenterPoint();this.originX="center",this.originY="center",this.left=t.x,this.top=t.y},_resetOrigin:function(){var t=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=t.x,this.top=t.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){var t=n.util,e=t.degreesToRadians,r=t.multiplyTransformMatrices,i=t.transformPoint;t.object.extend(n.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(t,e){return e?t?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),t?this.aCoords:this.lineCoords)},getCoords:function(t,e){return function(t){return[new n.Point(t.tl.x,t.tl.y),new n.Point(t.tr.x,t.tr.y),new n.Point(t.br.x,t.br.y),new n.Point(t.bl.x,t.bl.y)]}(this._getCoords(t,e))},intersectsWithRect:function(t,e,r,i){var o=this.getCoords(r,i);return"Intersection"===n.Intersection.intersectPolygonRectangle(o,t,e).status},intersectsWithObject:function(t,e,r){return"Intersection"===n.Intersection.intersectPolygonPolygon(this.getCoords(e,r),t.getCoords(e,r)).status||t.isContainedWithinObject(this,e,r)||this.isContainedWithinObject(t,e,r)},isContainedWithinObject:function(t,e,n){for(var r=this.getCoords(e,n),i=e?t.aCoords:t.lineCoords,o=0,a=t._getImageLines(i);o<4;o++)if(!t.containsPoint(r[o],a))return!1;return!0},isContainedWithinRect:function(t,e,n,r){var i=this.getBoundingRect(n,r);return i.left>=t.x&&i.left+i.width<=e.x&&i.top>=t.y&&i.top+i.height<=e.y},containsPoint:function(t,e,n,r){var i=this._getCoords(n,r),o=(e=e||this._getImageLines(i),this._findCrossPoints(t,e));return 0!==o&&o%2===1},isOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return!(!this.getCoords(!0,t).some((function(t){return t.x<=n.x&&t.x>=e.x&&t.y<=n.y&&t.y>=e.y}))&&!this.intersectsWithRect(e,n,!0,t))||this._containsCenterOfCanvas(e,n,t)},_containsCenterOfCanvas:function(t,e,n){var r={x:(t.x+e.x)/2,y:(t.y+e.y)/2};return!!this.containsPoint(r,null,!0,n)},isPartiallyOnScreen:function(t){if(!this.canvas)return!1;var e=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return!!this.intersectsWithRect(e,n,!0,t)||this.getCoords(!0,t).every((function(t){return(t.x>=n.x||t.x<=e.x)&&(t.y>=n.y||t.y<=e.y)}))&&this._containsCenterOfCanvas(e,n,t)},_getImageLines:function(t){return{topline:{o:t.tl,d:t.tr},rightline:{o:t.tr,d:t.br},bottomline:{o:t.br,d:t.bl},leftline:{o:t.bl,d:t.tl}}},_findCrossPoints:function(t,e){var n,r,i,o=0;for(var a in e)if(!((i=e[a]).o.y<t.y&&i.d.y<t.y)&&!(i.o.y>=t.y&&i.d.y>=t.y)&&(i.o.x===i.d.x&&i.o.x>=t.x?r=i.o.x:(n=(i.d.y-i.o.y)/(i.d.x-i.o.x),r=-(t.y-0*t.x-(i.o.y-n*i.o.x))/(0-n)),r>=t.x&&(o+=1),2===o))break;return o},getBoundingRect:function(e,n){var r=this.getCoords(e,n);return t.makeBoundingBoxFromPoints(r)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(t){return Math.abs(t)<this.minScaleLimit?t<0?-this.minScaleLimit:this.minScaleLimit:0===t?1e-4:t},scale:function(t){return this._set("scaleX",t),this._set("scaleY",t),this.setCoords()},scaleToWidth:function(t,e){var n=this.getBoundingRect(e).width/this.getScaledWidth();return this.scale(t/this.width/n)},scaleToHeight:function(t,e){var n=this.getBoundingRect(e).height/this.getScaledHeight();return this.scale(t/this.height/n)},calcLineCoords:function(){var n=this.getViewportTransform(),r=this.padding,o=e(this.angle),a=t.cos(o)*r,s=t.sin(o)*r,l=a+s,c=a-s,u=this.calcACoords(),h={tl:i(u.tl,n),tr:i(u.tr,n),bl:i(u.bl,n),br:i(u.br,n)};return r&&(h.tl.x-=c,h.tl.y-=l,h.tr.x+=l,h.tr.y-=c,h.bl.x-=l,h.bl.y+=c,h.br.x+=c,h.br.y+=l),h},calcOCoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),n=this.getViewportTransform(),i=r(n,e),o=r(i,t),a=(o=r(o,[1/n[0],0,0,1/n[3],0,0]),this._calculateCurrentDimensions()),s={};return this.forEachControl((function(t,e,n){s[e]=t.positionHandler(a,o,n)})),s},calcACoords:function(){var t=this._calcRotateMatrix(),e=this._calcTranslateMatrix(),n=r(e,t),o=this._getTransformedDimensions(),a=o.x/2,s=o.y/2;return{tl:i({x:-a,y:-s},n),tr:i({x:a,y:-s},n),bl:i({x:-a,y:s},n),br:i({x:a,y:s},n)}},setCoords:function(t){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),t||(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords()),this},_calcRotateMatrix:function(){return t.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var t=this.getCenterPoint();return[1,0,0,1,t.x,t.y]},transformMatrixKey:function(t){var e="_",n="";return!t&&this.group&&(n=this.group.transformMatrixKey(t)+e),n+this.top+e+this.left+e+this.scaleX+e+this.scaleY+e+this.skewX+e+this.skewY+e+this.angle+e+this.originX+e+this.originY+e+this.width+e+this.height+e+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(t){var e=this.calcOwnMatrix();if(t||!this.group)return e;var n=this.transformMatrixKey(t),i=this.matrixCache||(this.matrixCache={});return i.key===n?i.value:(this.group&&(e=r(this.group.calcTransformMatrix(!1),e)),i.key=n,i.value=e,e)},calcOwnMatrix:function(){var e=this.transformMatrixKey(!0),n=this.ownMatrixCache||(this.ownMatrixCache={});if(n.key===e)return n.value;var r=this._calcTranslateMatrix(),i={angle:this.angle,translateX:r[4],translateY:r[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return n.key=e,n.value=t.composeMatrix(i),n.value},_getNonTransformedDimensions:function(){var t=this.strokeWidth;return{x:this.width+t,y:this.height+t}},_getTransformedDimensions:function(e,n){typeof e>"u"&&(e=this.skewX),typeof n>"u"&&(n=this.skewY);var r,i,o,a=0===e&&0===n;if(this.strokeUniform?(i=this.width,o=this.height):(i=(r=this._getNonTransformedDimensions()).x,o=r.y),a)return this._finalizeDimensions(i*this.scaleX,o*this.scaleY);var s=t.sizeAfterTransform(i,o,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:n});return this._finalizeDimensions(s.x,s.y)},_finalizeDimensions:function(t,e){return this.strokeUniform?{x:t+this.strokeWidth,y:e+this.strokeWidth}:{x:t,y:e}},_calculateCurrentDimensions:function(){var t=this.getViewportTransform(),e=this._getTransformedDimensions();return i(e,t,!0).scalarAdd(2*this.padding)}})}(),n.util.object.extend(n.Object.prototype,{sendToBack:function(){return this.group?n.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?n.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(t){return this.group?n.StaticCanvas.prototype.sendBackwards.call(this.group,this,t):this.canvas&&this.canvas.sendBackwards(this,t),this},bringForward:function(t){return this.group?n.StaticCanvas.prototype.bringForward.call(this.group,this,t):this.canvas&&this.canvas.bringForward(this,t),this},moveTo:function(t){return this.group&&"activeSelection"!==this.group.type?n.StaticCanvas.prototype.moveTo.call(this.group,this,t):this.canvas&&this.canvas.moveTo(this,t),this}}),function(){function t(t,e){if(e){if(e.toLive)return t+": url(#SVGID_"+e.id+"); ";var r=new n.Color(e),i=t+": "+r.toRgb()+"; ",o=r.getAlpha();return 1!==o&&(i+=t+"-opacity: "+o.toString()+"; "),i}return t+": none; "}var e=n.util.toFixed;n.util.object.extend(n.Object.prototype,{getSvgStyles:function(e){var n=this.fillRule?this.fillRule:"nonzero",r=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;",h=e?"":this.getSvgFilter(),d=t("fill",this.fill);return[t("stroke",this.stroke),"stroke-width: ",r,"; ","stroke-dasharray: ",i,"; ","stroke-linecap: ",a,"; ","stroke-dashoffset: ",o,"; ","stroke-linejoin: ",s,"; ","stroke-miterlimit: ",l,"; ",d,"fill-rule: ",n,"; ","opacity: ",c,";",h,u].join("")},getSvgSpanStyles:function(e,n){var r="; ",i=e.fontFamily?"font-family: "+(-1===e.fontFamily.indexOf("'")&&-1===e.fontFamily.indexOf('"')?"'"+e.fontFamily+"'":e.fontFamily)+r:"",o=e.strokeWidth?"stroke-width: "+e.strokeWidth+r:"",a=(i=i,e.fontSize?"font-size: "+e.fontSize+"px"+r:""),s=e.fontStyle?"font-style: "+e.fontStyle+r:"",l=e.fontWeight?"font-weight: "+e.fontWeight+r:"",c=e.fill?t("fill",e.fill):"",u=e.stroke?t("stroke",e.stroke):"",h=this.getSvgTextDecoration(e);return h&&(h="text-decoration: "+h+r),[u,o,i,a,s,l,h,c,e.deltaY?"baseline-shift: "+-e.deltaY+"; ":"",n?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(t){return["overline","underline","line-through"].filter((function(e){return t[e.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(t,e){var r=t?this.calcTransformMatrix():this.calcOwnMatrix();return'transform="'+n.util.matrixToSVG(r)+(e||"")+'" '},_setSVGBg:function(t){if(this.backgroundColor){var r=n.Object.NUM_FRACTION_DIGITS;t.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',e(-this.width/2,r),'" y="',e(-this.height/2,r),'" width="',e(this.width,r),'" height="',e(this.height,r),'"></rect>\n')}},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(t),{reviver:t})},toClipPathSVG:function(t){return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(t),{reviver:t})},_createBaseClipPathSVGMarkup:function(t,e){var n=(e=e||{}).reviver,r=e.additionalTransform||"",i=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(""),o=t.indexOf("COMMON_PARTS");return t[o]=i,n?n(t.join("")):t.join("")},_createBaseSVGMarkup:function(t,e){var r,i,o=(e=e||{}).noStyle,a=e.reviver,s=o?"":'style="'+this.getSvgStyles()+'" ',l=e.withShadow?'style="'+this.getSvgFilter()+'" ':"",c=this.clipPath,u=this.strokeUniform?'vector-effect="non-scaling-stroke" ':"",h=c&&c.absolutePositioned,d=this.stroke,f=this.fill,p=this.shadow,g=[],m=t.indexOf("COMMON_PARTS"),v=e.additionalTransform;return c&&(c.clipPathId="CLIPPATH_"+n.Object.__uid++,i='<clipPath id="'+c.clipPathId+'" >\n'+c.toClipPathSVG(a)+"</clipPath>\n"),h&&g.push("<g ",l,this.getSvgCommons()," >\n"),g.push("<g ",this.getSvgTransform(!1),h?"":l+this.getSvgCommons()," >\n"),r=[s,u,o?"":this.addPaintOrder()," ",v?'transform="'+v+'" ':""].join(""),t[m]=r,f&&f.toLive&&g.push(f.toSVG(this)),d&&d.toLive&&g.push(d.toSVG(this)),p&&g.push(p.toSVG(this)),c&&g.push(i),g.push(t.join("")),g.push("</g>\n"),h&&g.push("</g>\n"),a?a(g.join("")):g.join("")},addPaintOrder:function(){return"fill"!==this.paintFirst?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){var t=n.util.object.extend,e="stateProperties";function r(e,n,r){var i={};r.forEach((function(t){i[t]=e[t]})),t(e[n],i,!0)}function i(t,e,n){if(t===e)return!0;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0,o=t.length;r<o;r++)if(!i(t[r],e[r]))return!1;return!0}if(t&&"object"==typeof t){var a,s=Object.keys(t);if(!e||"object"!=typeof e||!n&&s.length!==Object.keys(e).length)return!1;for(r=0,o=s.length;r<o;r++)if("canvas"!==(a=s[r])&&"group"!==a&&!i(t[a],e[a]))return!1;return!0}}n.util.object.extend(n.Object.prototype,{hasStateChanged:function(t){var n="_"+(t=t||e);return Object.keys(this[n]).length<this[t].length||!i(this[n],this,!0)},saveState:function(t){var n=t&&t.propertySet||e,i="_"+n;return this[i]?(r(this,i,this[n]),t&&t.stateProperties&&r(this,i,t.stateProperties),this):this.setupState(t)},setupState:function(t){var n=(t=t||{}).propertySet||e;return t.propertySet=n,this["_"+n]={},this.saveState(t),this}})}(),function(){var t=n.util.degreesToRadians;n.util.object.extend(n.Object.prototype,{_findTargetCorner:function(t,e){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var n,r,i,o=t.x,a=t.y,s=Object.keys(this.oCoords),l=s.length-1;for(this.__corner=0;l>=0;l--)if(i=s[l],this.isControlVisible(i)&&(r=this._getImageLines(e?this.oCoords[i].touchCorner:this.oCoords[i].corner),0!==(n=this._findCrossPoints({x:o,y:a},r))&&n%2===1))return this.__corner=i,i;return!1},forEachControl:function(t){for(var e in this.controls)t(this.controls[e],e,this)},_setCornerCoords:function(){var t=this.oCoords;for(var e in t){var n=this.controls[e];t[e].corner=n.calcCornerCoords(this.angle,this.cornerSize,t[e].x,t[e].y,!1),t[e].touchCorner=n.calcCornerCoords(this.angle,this.touchCornerSize,t[e].x,t[e].y,!0)}},drawSelectionBackground:function(e){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;e.save();var n=this.getCenterPoint(),r=this._calculateCurrentDimensions(),i=this.canvas.viewportTransform;return e.translate(n.x,n.y),e.scale(1/i[0],1/i[3]),e.rotate(t(this.angle)),e.fillStyle=this.selectionBackgroundColor,e.fillRect(-r.x/2,-r.y/2,r.x,r.y),e.restore(),this},drawBorders:function(t,e){e=e||{};var n=this._calculateCurrentDimensions(),r=this.borderScaleFactor,i=n.x+r,o=n.y+r,a=typeof e.hasControls<"u"?e.hasControls:this.hasControls,s=!1;return t.save(),t.strokeStyle=e.borderColor||this.borderColor,this._setLineDash(t,e.borderDashArray||this.borderDashArray),t.strokeRect(-i/2,-o/2,i,o),a&&(t.beginPath(),this.forEachControl((function(e,n,r){e.withConnection&&e.getVisibility(r,n)&&(s=!0,t.moveTo(e.x*i,e.y*o),t.lineTo(e.x*i+e.offsetX,e.y*o+e.offsetY))})),s&&t.stroke()),t.restore(),this},drawBordersInGroup:function(t,e,r){r=r||{};var i=n.util.sizeAfterTransform(this.width,this.height,e),o=this.strokeWidth,a=this.strokeUniform,s=this.borderScaleFactor,l=i.x+o*(a?this.canvas.getZoom():e.scaleX)+s,c=i.y+o*(a?this.canvas.getZoom():e.scaleY)+s;return t.save(),this._setLineDash(t,r.borderDashArray||this.borderDashArray),t.strokeStyle=r.borderColor||this.borderColor,t.strokeRect(-l/2,-c/2,l,c),t.restore(),this},drawControls:function(t,e){e=e||{},t.save();var r,i,o=this.canvas.getRetinaScaling();return t.setTransform(o,0,0,o,0,0),t.strokeStyle=t.fillStyle=e.cornerColor||this.cornerColor,this.transparentCorners||(t.strokeStyle=e.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(t,e.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(r=this.group.calcTransformMatrix()),this.forEachControl((function(o,a,s){i=s.oCoords[a],o.getVisibility(s,a)&&(r&&(i=n.util.transformPoint(i,r)),o.render(t,i.x,i.y,e,s))})),t.restore(),this},isControlVisible:function(t){return this.controls[t]&&this.controls[t].getVisibility(this,t)},setControlVisible:function(t,e){return this._controlsVisibility||(this._controlsVisibility={}),this._controlsVisibility[t]=e,this},setControlsVisibility:function(t){for(var e in t||(t={}),t)this.setControlVisible(e,t[e]);return this},onDeselect:function(){},onSelect:function(){}})}(),n.util.object.extend(n.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(t,e){var r=function(){},i=(e=e||{}).onComplete||r,o=e.onChange||r,a=this;return n.util.animate({target:this,startValue:t.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(e){t.set("left",e),a.requestRenderAll(),o()},onComplete:function(){t.setCoords(),i()}})},fxCenterObjectV:function(t,e){var r=function(){},i=(e=e||{}).onComplete||r,o=e.onChange||r,a=this;return n.util.animate({target:this,startValue:t.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(e){t.set("top",e),a.requestRenderAll(),o()},onComplete:function(){t.setCoords(),i()}})},fxRemove:function(t,e){var r=function(){},i=(e=e||{}).onComplete||r,o=e.onChange||r,a=this;return n.util.animate({target:this,startValue:t.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(e){t.set("opacity",e),a.requestRenderAll(),o()},onComplete:function(){a.remove(t),i()}})}}),n.util.object.extend(n.Object.prototype,{animate:function(){if(arguments[0]&&"object"==typeof arguments[0]){var t,e,n=[],r=[];for(t in arguments[0])n.push(t);for(var i=0,o=n.length;i<o;i++)t=n[i],e=i!==o-1,r.push(this._animate(t,arguments[0][t],arguments[1],e));return r}return this._animate.apply(this,arguments)},_animate:function(t,e,r,i){var o,a=this;e=e.toString(),r=r?n.util.object.clone(r):{},~t.indexOf(".")&&(o=t.split("."));var s=a.colorProperties.indexOf(t)>-1||o&&a.colorProperties.indexOf(o[1])>-1,l=o?this.get(o[0])[o[1]]:this.get(t);"from"in r||(r.from=l),s||(e=~e.indexOf("=")?l+parseFloat(e.replace("=","")):parseFloat(e));var c={target:this,startValue:r.from,endValue:e,byValue:r.by,easing:r.easing,duration:r.duration,abort:r.abort&&function(t,e,n){return r.abort.call(a,t,e,n)},onChange:function(e,n,s){o?a[o[0]][o[1]]=e:a.set(t,e),!i&&r.onChange&&r.onChange(e,n,s)},onComplete:function(t,e,n){i||(a.setCoords(),r.onComplete&&r.onComplete(t,e,n))}};return s?n.util.animateColor(c.startValue,c.endValue,c.duration,c):n.util.animate(c)}}),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.object.clone,i={x1:1,x2:1,y1:1,y2:1};function o(t,e){var n=t.origin,r=t.axis1,i=t.axis2,o=t.dimension,a=e.nearest,s=e.center,l=e.farthest;return function(){switch(this.get(n)){case a:return Math.min(this.get(r),this.get(i));case s:return Math.min(this.get(r),this.get(i))+.5*this.get(o);case l:return Math.max(this.get(r),this.get(i))}}}e.Line?e.warn("fabric.Line is already defined"):(e.Line=e.util.createClass(e.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:e.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(t,e){t||(t=[0,0,0,0]),this.callSuper("initialize",e),this.set("x1",t[0]),this.set("y1",t[1]),this.set("x2",t[2]),this.set("y2",t[3]),this._setWidthHeight(e)},_setWidthHeight:function(t){t||(t={}),this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left="left"in t?t.left:this._getLeftToOriginX(),this.top="top"in t?t.top:this._getTopToOriginY()},_set:function(t,e){return this.callSuper("_set",t,e),typeof i[t]<"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(t){t.beginPath();var e=this.calcLinePoints();t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.lineWidth=this.strokeWidth;var n=t.strokeStyle;t.strokeStyle=this.stroke||t.fillStyle,this.stroke&&this._renderStroke(t),t.strokeStyle=n},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(t){return n(this.callSuper("toObject",t),this.calcLinePoints())},_getNonTransformedDimensions:function(){var t=this.callSuper("_getNonTransformedDimensions");return"butt"===this.strokeLineCap&&(0===this.width&&(t.y-=this.strokeWidth),0===this.height&&(t.x-=this.strokeWidth)),t},calcLinePoints:function(){var t=this.x1<=this.x2?-1:1,e=this.y1<=this.y2?-1:1,n=t*this.width*.5,r=e*this.height*.5;return{x1:n,x2:t*this.width*-.5,y1:r,y2:e*this.height*-.5}},_toSVG:function(){var t=this.calcLinePoints();return["<line ","COMMON_PARTS",'x1="',t.x1,'" y1="',t.y1,'" x2="',t.x2,'" y2="',t.y2,'" />\n']}}),e.Line.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" ")),e.Line.fromElement=function(t,r,i){i=i||{};var o=e.parseAttributes(t,e.Line.ATTRIBUTE_NAMES),a=[o.x1||0,o.y1||0,o.x2||0,o.y2||0];r(new e.Line(a,n(o,i)))},e.Line.fromObject=function(t,n){var i=r(t,!0);i.points=[t.x1,t.y1,t.x2,t.y2],e.Object._fromObject("Line",i,(function(t){delete t.points,n&&n(t)}),"points")})}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.degreesToRadians;e.Circle?e.warn("fabric.Circle is already defined."):(e.Circle=e.util.createClass(e.Object,{type:"circle",radius:0,startAngle:0,endAngle:360,cacheProperties:e.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set:function(t,e){return this.callSuper("_set",t,e),"radius"===t&&this.setRadius(e),this},toObject:function(t){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(t))},_toSVG:function(){var t,r=(this.endAngle-this.startAngle)%360;if(0===r)t=["<circle ","COMMON_PARTS",'cx="0" cy="0" ','r="',this.radius,'" />\n'];else{var i=n(this.startAngle),o=n(this.endAngle),a=this.radius;t=['<path d="M '+e.util.cos(i)*a+" "+e.util.sin(i)*a," A "+a+" "+a," 0 ",+(r>180?"1":"0")+" 1"," "+e.util.cos(o)*a+" "+e.util.sin(o)*a,'" ',"COMMON_PARTS"," />\n"]}return t},_render:function(t){t.beginPath(),t.arc(0,0,this.radius,n(this.startAngle),n(this.endAngle),!1),this._renderPaintInOrder(t)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(t){return this.radius=t,this.set("width",2*t).set("height",2*t)}}),e.Circle.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy r".split(" ")),e.Circle.fromElement=function(t,n){var r=e.parseAttributes(t,e.Circle.ATTRIBUTE_NAMES);if(!function(t){return"radius"in t&&t.radius>=0}(r))throw new Error("value of `r` attribute is required and can not be negative");r.left=(r.left||0)-r.radius,r.top=(r.top||0)-r.radius,n(new e.Circle(r))},e.Circle.fromObject=function(t,n){e.Object._fromObject("Circle",t,n)})}(t),function(t){var e=t.fabric||(t.fabric={});e.Triangle?e.warn("fabric.Triangle is already defined"):(e.Triangle=e.util.createClass(e.Object,{type:"triangle",width:100,height:100,_render:function(t){var e=this.width/2,n=this.height/2;t.beginPath(),t.moveTo(-e,n),t.lineTo(0,-n),t.lineTo(e,n),t.closePath(),this._renderPaintInOrder(t)},_toSVG:function(){var t=this.width/2,e=this.height/2;return["<polygon ","COMMON_PARTS",'points="',[-t+" "+e,"0 "+-e,t+" "+e].join(","),'" />']}}),e.Triangle.fromObject=function(t,n){return e.Object._fromObject("Triangle",t,n)})}(t),function(t){var e=t.fabric||(t.fabric={}),n=2*Math.PI;e.Ellipse?e.warn("fabric.Ellipse is already defined."):(e.Ellipse=e.util.createClass(e.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this.set("rx",t&&t.rx||0),this.set("ry",t&&t.ry||0)},_set:function(t,e){switch(this.callSuper("_set",t,e),t){case"rx":this.rx=e,this.set("width",2*e);break;case"ry":this.ry=e,this.set("height",2*e)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_toSVG:function(){return["<ellipse ","COMMON_PARTS",'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" />\n']},_render:function(t){t.beginPath(),t.save(),t.transform(1,0,0,this.ry/this.rx,0,0),t.arc(0,0,this.rx,0,n,!1),t.restore(),this._renderPaintInOrder(t)}}),e.Ellipse.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" ")),e.Ellipse.fromElement=function(t,n){var r=e.parseAttributes(t,e.Ellipse.ATTRIBUTE_NAMES);r.left=(r.left||0)-r.rx,r.top=(r.top||0)-r.ry,n(new e.Ellipse(r))},e.Ellipse.fromObject=function(t,n){e.Object._fromObject("Ellipse",t,n)})}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend;e.Rect?e.warn("fabric.Rect is already defined"):(e.Rect=e.util.createClass(e.Object,{stateProperties:e.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:e.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(t){this.callSuper("initialize",t),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(t){var e=this.rx?Math.min(this.rx,this.width/2):0,n=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,i=this.height,o=-this.width/2,a=-this.height/2,s=0!==e||0!==n,l=.4477152502;t.beginPath(),t.moveTo(o+e,a),t.lineTo(o+r-e,a),s&&t.bezierCurveTo(o+r-l*e,a,o+r,a+l*n,o+r,a+n),t.lineTo(o+r,a+i-n),s&&t.bezierCurveTo(o+r,a+i-l*n,o+r-l*e,a+i,o+r-e,a+i),t.lineTo(o+e,a+i),s&&t.bezierCurveTo(o+l*e,a+i,o,a+i-l*n,o,a+i-n),t.lineTo(o,a+n),s&&t.bezierCurveTo(o,a+l*n,o+l*e,a,o+e,a),t.closePath(),this._renderPaintInOrder(t)},toObject:function(t){return this.callSuper("toObject",["rx","ry"].concat(t))},_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']}}),e.Rect.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" ")),e.Rect.fromElement=function(t,r,i){if(!t)return r(null);i=i||{};var o=e.parseAttributes(t,e.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 e.Rect(n(i?e.util.object.clone(i):{},o));a.visible=a.visible&&a.width>0&&a.height>0,r(a)},e.Rect.fromObject=function(t,n){return e.Object._fromObject("Rect",t,n)})}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.util.array.min,i=e.util.array.max,o=e.util.toFixed,a=e.util.projectStrokeOnPoints;e.Polyline?e.warn("fabric.Polyline is already defined"):(e.Polyline=e.util.createClass(e.Object,{type:"polyline",points:null,exactBoundingBox:!1,cacheProperties:e.Object.prototype.cacheProperties.concat("points"),initialize:function(t,e){e=e||{},this.points=t||[],this.callSuper("initialize",e),this._setPositionDimensions(e)},_projectStrokeOnPoints:function(){return a(this.points,this,!0)},_setPositionDimensions:function(t){var e,n=this._calcDimensions(t),r=this.exactBoundingBox?this.strokeWidth:0;this.width=n.width-r,this.height=n.height-r,t.fromSVG||(e=this.translateToGivenOrigin({x:n.left-this.strokeWidth/2+r/2,y:n.top-this.strokeWidth/2+r/2},"left","top",this.originX,this.originY)),typeof t.left>"u"&&(this.left=t.fromSVG?n.left:e.x),typeof t.top>"u"&&(this.top=t.fromSVG?n.top:e.y),this.pathOffset={x:n.left+this.width/2+r/2,y:n.top+this.height/2+r/2}},_calcDimensions:function(){var t=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,e=r(t,"x")||0,n=r(t,"y")||0;return{left:e,top:n,width:(i(t,"x")||0)-e,height:(i(t,"y")||0)-n}},toObject:function(t){return n(this.callSuper("toObject",t),{points:this.points.concat()})},_toSVG:function(){for(var t=[],n=this.pathOffset.x,r=this.pathOffset.y,i=e.Object.NUM_FRACTION_DIGITS,a=0,s=this.points.length;a<s;a++)t.push(o(this.points[a].x-n,i),",",o(this.points[a].y-r,i)," ");return["<"+this.type+" ","COMMON_PARTS",'points="',t.join(""),'" />\n']},commonRender:function(t){var e,n=this.points.length,r=this.pathOffset.x,i=this.pathOffset.y;if(!n||isNaN(this.points[n-1].y))return!1;t.beginPath(),t.moveTo(this.points[0].x-r,this.points[0].y-i);for(var o=0;o<n;o++)e=this.points[o],t.lineTo(e.x-r,e.y-i);return!0},_render:function(t){!this.commonRender(t)||this._renderPaintInOrder(t)},complexity:function(){return this.get("points").length}}),e.Polyline.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polyline.fromElementGenerator=function(t){return function(r,i,o){if(!r)return i(null);o||(o={});var a=e.parsePointsAttribute(r.getAttribute("points")),s=e.parseAttributes(r,e[t].ATTRIBUTE_NAMES);s.fromSVG=!0,i(new e[t](a,n(s,o)))}},e.Polyline.fromElement=e.Polyline.fromElementGenerator("Polyline"),e.Polyline.fromObject=function(t,n){return e.Object._fromObject("Polyline",t,n,"points")})}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.projectStrokeOnPoints;e.Polygon?e.warn("fabric.Polygon is already defined"):(e.Polygon=e.util.createClass(e.Polyline,{type:"polygon",_projectStrokeOnPoints:function(){return n(this.points,this)},_render:function(t){!this.commonRender(t)||(t.closePath(),this._renderPaintInOrder(t))}}),e.Polygon.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(),e.Polygon.fromElement=e.Polyline.fromElementGenerator("Polygon"),e.Polygon.fromObject=function(t,n){e.Object._fromObject("Polygon",t,n,"points")})}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.array.min,r=e.util.array.max,i=e.util.object.extend,o=e.util.object.clone,a=e.util.toFixed;e.Path?e.warn("fabric.Path is already defined"):(e.Path=e.util.createClass(e.Object,{type:"path",path:null,cacheProperties:e.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:e.Object.prototype.stateProperties.concat("path"),initialize:function(t,e){delete(e=o(e||{})).path,this.callSuper("initialize",e),this._setPath(t||[],e)},_setPath:function(t,n){this.path=e.util.makePathSimpler(Array.isArray(t)?t:e.util.parsePath(t)),e.Polyline.prototype._setPositionDimensions.call(this,n||{})},_renderPathCommands:function(t){var e,n=0,r=0,i=0,o=0,a=0,s=0,l=-this.pathOffset.x,c=-this.pathOffset.y;t.beginPath();for(var u=0,h=this.path.length;u<h;++u)switch(e=this.path[u],e[0]){case"L":i=e[1],o=e[2],t.lineTo(i+l,o+c);break;case"M":n=i=e[1],r=o=e[2],t.moveTo(i+l,o+c);break;case"C":i=e[5],o=e[6],a=e[3],s=e[4],t.bezierCurveTo(e[1]+l,e[2]+c,a+l,s+c,i+l,o+c);break;case"Q":t.quadraticCurveTo(e[1]+l,e[2]+c,e[3]+l,e[4]+c),i=e[3],o=e[4],a=e[1],s=e[2];break;case"z":case"Z":i=n,o=r,t.closePath()}},_render:function(t){this._renderPathCommands(t),this._renderPaintInOrder(t)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left": '+this.left+" }>"},toObject:function(t){return i(this.callSuper("toObject",t),{path:this.path.map((function(t){return t.slice()}))})},toDatalessObject:function(t){var e=this.toObject(["sourcePath"].concat(t));return e.sourcePath&&delete e.path,e},_toSVG:function(){return["<path ","COMMON_PARTS",'d="',e.util.joinPath(this.path),'" stroke-linecap="round" ',"/>\n"]},_getOffsetTransform:function(){var t=e.Object.NUM_FRACTION_DIGITS;return" translate("+a(-this.pathOffset.x,t)+", "+a(-this.pathOffset.y,t)+")"},toClipPathSVG:function(t){var e=this._getOffsetTransform();return"\t"+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},toSVG:function(t){var e=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,additionalTransform:e})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var t,i,o=[],a=[],s=0,l=0,c=0,u=0,h=0,d=this.path.length;h<d;++h){switch((t=this.path[h])[0]){case"L":c=t[1],u=t[2],i=[];break;case"M":s=c=t[1],l=u=t[2],i=[];break;case"C":i=e.util.getBoundsOfCurve(c,u,t[1],t[2],t[3],t[4],t[5],t[6]),c=t[5],u=t[6];break;case"Q":i=e.util.getBoundsOfCurve(c,u,t[1],t[2],t[1],t[2],t[3],t[4]),c=t[3],u=t[4];break;case"z":case"Z":c=s,u=l}i.forEach((function(t){o.push(t.x),a.push(t.y)})),o.push(c),a.push(u)}var f=n(o)||0,p=n(a)||0;return{left:f,top:p,width:(r(o)||0)-f,height:(r(a)||0)-p}}}),e.Path.fromObject=function(t,n){if("string"==typeof t.sourcePath){var r=t.sourcePath;e.loadSVGFromURL(r,(function(r){var i=r[0];i.setOptions(t),t.clipPath?e.util.enlivenObjects([t.clipPath],(function(t){i.clipPath=t[0],n&&n(i)})):n&&n(i)}))}else e.Object._fromObject("Path",t,n,"path")},e.Path.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat(["d"]),e.Path.fromElement=function(t,n,r){var o=e.parseAttributes(t,e.Path.ATTRIBUTE_NAMES);o.fromSVG=!0,n(new e.Path(o.d,i(o,r)))})}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.array.min,r=e.util.array.max;e.Group||(e.Group=e.util.createClass(e.Object,e.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(t,e,n){e=e||{},this._objects=[],n&&this.callSuper("initialize",e),this._objects=t||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;if(n)this._updateObjectsACoords();else{var i=e&&e.centerPoint;void 0!==e.originX&&(this.originX=e.originX),void 0!==e.originY&&(this.originY=e.originY),i||this._calcBounds(),this._updateObjectsCoords(i),delete e.centerPoint,this.callSuper("initialize",e)}this.setCoords()},_updateObjectsACoords:function(){for(var t=this._objects.length;t--;)this._objects[t].setCoords(true)},_updateObjectsCoords:function(t){t=t||this.getCenterPoint();for(var e=this._objects.length;e--;)this._updateObjectCoords(this._objects[e],t)},_updateObjectCoords:function(t,e){var n=t.left,r=t.top;t.set({left:n-e.x,top:r-e.y}),t.group=this,t.setCoords(!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(t){var n=!!this.group;return this._restoreObjectsState(),e.util.resetObjectTransform(this),t&&(n&&e.util.removeTransformFromObject(t,this.group.calcTransformMatrix()),this._objects.push(t),t.group=this,t._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,n?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(t){return this._restoreObjectsState(),e.util.resetObjectTransform(this),this.remove(t),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(t){this.dirty=!0,t.group=this,t._set("canvas",this.canvas)},_onObjectRemoved:function(t){this.dirty=!0,delete t.group},_set:function(t,n){var r=this._objects.length;if(this.useSetOnGroup)for(;r--;)this._objects[r].setOnGroup(t,n);if("canvas"===t)for(;r--;)this._objects[r]._set(t,n);e.Object.prototype._set.call(this,t,n)},toObject:function(t){var n=this.includeDefaultValues,r=this._objects.filter((function(t){return!t.excludeFromExport})).map((function(e){var r=e.includeDefaultValues;e.includeDefaultValues=n;var i=e.toObject(t);return e.includeDefaultValues=r,i})),i=e.Object.prototype.toObject.call(this,t);return i.objects=r,i},toDatalessObject:function(t){var n,r=this.sourcePath;if(r)n=r;else{var i=this.includeDefaultValues;n=this._objects.map((function(e){var n=e.includeDefaultValues;e.includeDefaultValues=i;var r=e.toDatalessObject(t);return e.includeDefaultValues=n,r}))}var o=e.Object.prototype.toDatalessObject.call(this,t);return o.objects=n,o},render:function(t){this._transformDone=!0,this.callSuper("render",t),this._transformDone=!1},shouldCache:function(){var t=e.Object.prototype.shouldCache.call(this);if(t)for(var n=0,r=this._objects.length;n<r;n++)if(this._objects[n].willDrawShadow())return this.ownCaching=!1,!1;return t},willDrawShadow:function(){if(e.Object.prototype.willDrawShadow.call(this))return!0;for(var t=0,n=this._objects.length;t<n;t++)if(this._objects[t].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(t){for(var e=0,n=this._objects.length;e<n;e++)this._objects[e].render(t);this._drawClipPath(t,this.clipPath)},isCacheDirty:function(t){if(this.callSuper("isCacheDirty",t))return!0;if(!this.statefullCache)return!1;for(var e=0,n=this._objects.length;e<n;e++)if(this._objects[e].isCacheDirty(!0)){if(this._cacheCanvas){var r=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-r/2,-i/2,r,i)}return!0}return!1},_restoreObjectsState:function(){var t=this.calcOwnMatrix();return this._objects.forEach((function(n){e.util.addTransformToObject(n,t),delete n.group,n.setCoords()})),this},destroy:function(){return this._objects.forEach((function(t){t.set("dirty",!0)})),this._restoreObjectsState()},dispose:function(){this.callSuper("dispose"),this.forEachObject((function(t){t.dispose&&t.dispose()})),this._objects=[]},toActiveSelection:function(){if(this.canvas){var t=this._objects,n=this.canvas;this._objects=[];var r=this.toObject();delete r.objects;var i=new e.ActiveSelection([]);return i.set(r),i.type="activeSelection",n.remove(this),t.forEach((function(t){t.group=i,t.dirty=!0,n.add(t)})),i.canvas=n,i._objects=t,n._activeObject=i,i.setCoords(),i}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){return this.forEachObject((function(t){t.setCoords(true)})),this},_calcBounds:function(t){for(var e,n,r,i,o=[],a=[],s=["tr","br","bl","tl"],l=0,c=this._objects.length,u=s.length;l<c;++l){for(r=(e=this._objects[l]).calcACoords(),i=0;i<u;i++)n=s[i],o.push(r[n].x),a.push(r[n].y);e.aCoords=r}this._getBounds(o,a,t)},_getBounds:function(t,i,o){var a=new e.Point(n(t),n(i)),s=new e.Point(r(t),r(i)),l=a.y||0,c=a.x||0,u=s.x-a.x||0,h=s.y-a.y||0;this.width=u,this.height=h,o||this.setPositionByOrigin({x:c,y:l},"left","top")},_toSVG:function(t){for(var e=["<g ","COMMON_PARTS"," >\n"],n=0,r=this._objects.length;n<r;n++)e.push("\t\t",this._objects[n].toSVG(t));return e.push("</g>\n"),e},getSvgStyles:function(){var t=typeof this.opacity<"u"&&1!==this.opacity?"opacity: "+this.opacity+";":"",e=this.visible?"":" visibility: hidden;";return[t,this.getSvgFilter(),e].join("")},toClipPathSVG:function(t){for(var e=[],n=0,r=this._objects.length;n<r;n++)e.push("\t",this._objects[n].toClipPathSVG(t));return this._createBaseClipPathSVGMarkup(e,{reviver:t})}}),e.Group.fromObject=function(t,n){var r=t.objects,i=e.util.object.clone(t,!0);delete i.objects,"string"!=typeof r?e.util.enlivenObjects(r,(function(r){e.util.enlivenObjectEnlivables(t,i,(function(){n&&n(new e.Group(r,i,!0))}))})):e.loadSVGFromURL(r,(function(o){var a=e.util.groupSVGElements(o,t,r),s=i.clipPath;delete i.clipPath,a.set(i),s?e.util.enlivenObjects([s],(function(t){a.clipPath=t[0],n&&n(a)})):n&&n(a)}))})}(t),function(t){var e=t.fabric||(t.fabric={});e.ActiveSelection||(e.ActiveSelection=e.util.createClass(e.Group,{type:"activeSelection",initialize:function(t,n){n=n||{},this._objects=t||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;n.originX&&(this.originX=n.originX),n.originY&&(this.originY=n.originY),this._calcBounds(),this._updateObjectsCoords(),e.Object.prototype.initialize.call(this,n),this.setCoords()},toGroup:function(){var t=this._objects.concat();this._objects=[];var n=e.Object.prototype.toObject.call(this),r=new e.Group([]);if(delete n.type,r.set(n),t.forEach((function(t){t.canvas.remove(t),t.group=r})),r._objects=t,!this.canvas)return r;var i=this.canvas;return i.add(r),i._activeObject=r,r.setCoords(),r},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(t,e,n){t.save(),t.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper("_renderControls",t,e),typeof(n=n||{}).hasControls>"u"&&(n.hasControls=!1),n.forActiveSelection=!0;for(var r=0,i=this._objects.length;r<i;r++)this._objects[r]._renderControls(t,n);t.restore()}}),e.ActiveSelection.fromObject=function(t,n){e.util.enlivenObjects(t.objects,(function(r){delete t.objects,n&&n(new e.ActiveSelection(r,t,!0))}))})}(t),function(t){var e=n.util.object.extend;t.fabric||(t.fabric={}),t.fabric.Image?n.warn("fabric.Image is already defined."):(n.Image=n.util.createClass(n.Object,{type:"image",strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:n.Object.prototype.stateProperties.concat("cropX","cropY"),cacheProperties:n.Object.prototype.cacheProperties.concat("cropX","cropY"),cacheKey:"",cropX:0,cropY:0,imageSmoothing:!0,initialize:function(t,e){e||(e={}),this.filters=[],this.cacheKey="texture"+n.Object.__uid++,this.callSuper("initialize",e),this._initElement(t,e)},getElement:function(){return this._element||{}},setElement:function(t,e){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=t,this._originalElement=t,this._initConfig(e),0!==this.filters.length&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(t){var e=n.filterBackend;e&&e.evictCachesForKey&&e.evictCachesForKey(t)},dispose:function(){this.callSuper("dispose"),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._cacheContext=void 0,["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(t){n.util.cleanUpJsdomNode(this[t]),this[t]=void 0}.bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var t=this.getElement();return{width:t.naturalWidth||t.width,height:t.naturalHeight||t.height}},_stroke:function(t){if(this.stroke&&0!==this.strokeWidth){var e=this.width/2,n=this.height/2;t.beginPath(),t.moveTo(-e,-n),t.lineTo(e,-n),t.lineTo(e,n),t.lineTo(-e,n),t.lineTo(-e,-n),t.closePath()}},toObject:function(t){var n=[];this.filters.forEach((function(t){t&&n.push(t.toObject())}));var r=e(this.callSuper("toObject",["cropX","cropY"].concat(t)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:n});return this.resizeFilter&&(r.resizeFilter=this.resizeFilter.toObject()),r},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var t,e=[],r=[],i=this._element,o=-this.width/2,a=-this.height/2,s="",l="";if(!i)return[];if(this.hasCrop()){var c=n.Object.__uid++;e.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'),r.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,t=["\t<rect ",'x="',o,'" y="',a,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'],this.fill=u}return e="fill"!==this.paintFirst?e.concat(t,r):e.concat(r,t)},getSrc:function(t){var e=t?this._element:this._originalElement;return e?e.toDataURL?e.toDataURL():this.srcFromAttribute?e.getAttribute("src"):e.src:this.src||""},setSrc:function(t,e,r){return n.util.loadImage(t,(function(t,n){this.setElement(t,r),this._setWidthHeight(),e&&e(this,n)}),this,r&&r.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var t=this.resizeFilter,e=this.minimumScaleTrigger,r=this.getTotalObjectScaling(),i=r.scaleX,o=r.scaleY,a=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!t||i>e&&o>e)return this._element=a,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,void(this._lastScaleY=o);n.filterBackend||(n.filterBackend=n.initFilterBackend());var s=n.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=t.scaleX=i,this._lastScaleY=t.scaleY=o,n.filterBackend.applyFilters([t],a,c,u,this._element,l),this._filterScalingX=s.width/this._originalElement.width,this._filterScalingY=s.height/this._originalElement.height},applyFilters:function(t){if(t=(t=t||this.filters||[]).filter((function(t){return t&&!t.isNeutralState()})),this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),0===t.length)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var e=this._originalElement,r=e.naturalWidth||e.width,i=e.naturalHeight||e.height;if(this._element===this._originalElement){var o=n.util.createCanvasElement();o.width=r,o.height=i,this._element=o,this._filteredEl=o}else this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,r,i),this._lastScaleX=1,this._lastScaleY=1;return n.filterBackend||(n.filterBackend=n.initFilterBackend()),n.filterBackend.applyFilters(t,this._originalElement,r,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(t){n.util.setImageSmoothing(t,this.imageSmoothing),!0!==this.isMoving&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(t),this._renderPaintInOrder(t)},drawCacheOnCanvas:function(t){n.util.setImageSmoothing(t,this.imageSmoothing),n.Object.prototype.drawCacheOnCanvas.call(this,t)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(t){var e=this._element;if(e){var n=this._filterScalingX,r=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=e.naturalWidth||e.width,h=e.naturalHeight||e.height,d=l*n,f=c*r,p=a(i*n,u-d),g=a(o*r,h-f),m=-i/2,v=-o/2,b=a(i,u/n-l),y=a(o,h/r-c);e&&t.drawImage(e,d,f,p,g,m,v,b,y)}},_needsResize:function(){var t=this.getTotalObjectScaling();return t.scaleX!==this._lastScaleX||t.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(t,e){this.setElement(n.util.getById(t),e),n.util.addClass(this.getElement(),n.Image.CSS_CANVAS)},_initConfig:function(t){t||(t={}),this.setOptions(t),this._setWidthHeight(t)},_initFilters:function(t,e){t&&t.length?n.util.enlivenObjects(t,(function(t){e&&e(t)}),"fabric.Image.filters"):e&&e()},_setWidthHeight:function(t){t||(t={});var e=this.getElement();this.width=t.width||e.naturalWidth||e.width||0,this.height=t.height||e.naturalHeight||e.height||0},parsePreserveAspectRatioAttribute:function(){var t,e=n.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),r=this._element.width,i=this._element.height,o=1,a=1,s=0,l=0,c=0,u=0,h=this.width,d=this.height,f={width:h,height:d};return!e||"none"===e.alignX&&"none"===e.alignY?(o=h/r,a=d/i):("meet"===e.meetOrSlice&&(t=(h-r*(o=a=n.util.findScaleToFit(this._element,f)))/2,"Min"===e.alignX&&(s=-t),"Max"===e.alignX&&(s=t),t=(d-i*a)/2,"Min"===e.alignY&&(l=-t),"Max"===e.alignY&&(l=t)),"slice"===e.meetOrSlice&&(t=r-h/(o=a=n.util.findScaleToCover(this._element,f)),"Mid"===e.alignX&&(c=t/2),"Max"===e.alignX&&(c=t),t=i-d/a,"Mid"===e.alignY&&(u=t/2),"Max"===e.alignY&&(u=t),r=h/o,i=d/a)),{width:r,height:i,scaleX:o,scaleY:a,offsetLeft:s,offsetTop:l,cropX:c,cropY:u}}}),n.Image.CSS_CANVAS="canvas-img",n.Image.prototype.getSvgSrc=n.Image.prototype.getSrc,n.Image.fromObject=function(t,e){var r=n.util.object.clone(t);n.util.loadImage(r.src,(function(t,i){i?e&&e(null,!0):n.Image.prototype._initFilters.call(r,r.filters,(function(i){r.filters=i||[],n.Image.prototype._initFilters.call(r,[r.resizeFilter],(function(i){r.resizeFilter=i[0],n.util.enlivenObjectEnlivables(r,r,(function(){var i=new n.Image(t,r);e(i,!1)}))}))}))}),null,r.crossOrigin)},n.Image.fromURL=function(t,e,r){n.util.loadImage(t,(function(t,i){e&&e(new n.Image(t,r),i)}),null,r&&r.crossOrigin)},n.Image.ATTRIBUTE_NAMES=n.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin image-rendering".split(" ")),n.Image.fromElement=function(t,r,i){var o=n.parseAttributes(t,n.Image.ATTRIBUTE_NAMES);n.Image.fromURL(o["xlink:href"],r,e(i?n.util.object.clone(i):{},o))})}(t),n.util.object.extend(n.Object.prototype,{_getAngleValueForStraighten:function(){var t=this.angle%360;return t>0?90*Math.round((t-1)/90):90*Math.round(t/90)},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(t){var e=function(){},r=(t=t||{}).onComplete||e,i=t.onChange||e,o=this;return n.util.animate({target:this,startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(t){o.rotate(t),i()},onComplete:function(){o.setCoords(),r()}})}}),n.util.object.extend(n.StaticCanvas.prototype,{straightenObject:function(t){return t.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(t){return t.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){function t(t,e){var n="precision "+e+" float;\nvoid main(){}",r=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(r,n),t.compileShader(r),!!t.getShaderParameter(r,t.COMPILE_STATUS)}function e(t){t&&t.tileSize&&(this.tileSize=t.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}n.isWebglSupported=function(e){if(n.isLikelyNode)return!1;e=e||n.WebglFilterBackend.prototype.tileSize;var r=document.createElement("canvas"),i=r.getContext("webgl")||r.getContext("experimental-webgl"),o=!1;if(i){n.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),o=n.maxTextureSize>=e;for(var a=["highp","mediump","lowp"],s=0;s<3;s++)if(t(i,a[s])){n.webGlPrecision=a[s];break}}return this.isSupported=o,o},n.WebglFilterBackend=e,e.prototype={tileSize:2048,resources:{},setupGLContext:function(t,e){this.dispose(),this.createWebGLCanvas(t,e),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(t,e)},chooseFastestCopyGLTo2DMethod:function(t,e){var r,a=typeof window.performance<"u";try{new ImageData(1,1),r=!0}catch{r=!1}var s=typeof ArrayBuffer<"u",l=typeof Uint8ClampedArray<"u";if(a&&r&&s&&l){var c=n.util.createCanvasElement(),u=new ArrayBuffer(t*e*4);if(n.forceGLPutImageData)return this.imageBuffer=u,void(this.copyGLTo2D=o);var h,d,f={imageBuffer:u,destinationWidth:t,destinationHeight:e,targetCanvas:c};c.width=t,c.height=e,h=window.performance.now(),i.call(f,this.gl,f),d=window.performance.now()-h,h=window.performance.now(),o.call(f,this.gl,f),d>window.performance.now()-h?(this.imageBuffer=u,this.copyGLTo2D=o):this.copyGLTo2D=i}},createWebGLCanvas:function(t,e){var r=n.util.createCanvasElement();r.width=t,r.height=e;var i={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},o=r.getContext("webgl",i);o||(o=r.getContext("experimental-webgl",i)),o&&(o.clearColor(0,0,0,0),this.canvas=r,this.gl=o)},applyFilters:function(t,e,n,r,i,o){var a,s=this.gl;o&&(a=this.getCachedTexture(o,e));var l={originalWidth:e.width||e.originalWidth,originalHeight:e.height||e.originalHeight,sourceWidth:n,sourceHeight:r,destinationWidth:n,destinationHeight:r,context:s,sourceTexture:this.createTexture(s,n,r,!a&&e),targetTexture:this.createTexture(s,n,r),originalTexture:a||this.createTexture(s,n,r,!a&&e),passes:t.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:i},c=s.createFramebuffer();return s.bindFramebuffer(s.FRAMEBUFFER,c),t.forEach((function(t){t&&t.applyTo(l)})),function(t){var e=t.targetCanvas,n=e.width,r=e.height,i=t.destinationWidth,o=t.destinationHeight;(n!==i||r!==o)&&(e.width=i,e.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(t,e,n,r){var i=t.createTexture();return t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,n,0,t.RGBA,t.UNSIGNED_BYTE,null),i},getCachedTexture:function(t,e){if(this.textureCache[t])return this.textureCache[t];var n=this.createTexture(this.gl,e.width,e.height,e);return this.textureCache[t]=n,n},evictCachesForKey:function(t){this.textureCache[t]&&(this.gl.deleteTexture(this.textureCache[t]),delete this.textureCache[t])},copyGLTo2D:i,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var t=this.gl,e={renderer:"",vendor:""};if(!t)return e;var n=t.getExtension("WEBGL_debug_renderer_info");if(n){var r=t.getParameter(n.UNMASKED_RENDERER_WEBGL),i=t.getParameter(n.UNMASKED_VENDOR_WEBGL);r&&(e.renderer=r.toLowerCase()),i&&(e.vendor=i.toLowerCase())}return this.gpuInfo=e,e}}}(),function(){var t=function(){};function e(){}n.Canvas2dFilterBackend=e,e.prototype={evictCachesForKey:t,dispose:t,clearWebGLCaches:t,resources:{},applyFilters:function(t,e,n,r,i){var o=i.getContext("2d");o.drawImage(e,0,0,n,r);var a={sourceWidth:n,sourceHeight:r,imageData:o.getImageData(0,0,n,r),originalEl:e,originalImageData:o.getImageData(0,0,n,r),canvasEl:i,ctx:o,filterBackend:this};return t.forEach((function(t){t.applyTo(a)})),(a.imageData.width!==n||a.imageData.height!==r)&&(i.width=a.imageData.width,i.height=a.imageData.height),o.putImageData(a.imageData,0,0),a}}}(),n.Image=n.Image||{},n.Image.filters=n.Image.filters||{},n.Image.filters.BaseFilter=n.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(t){t&&this.setOptions(t)},setOptions:function(t){for(var e in t)this[e]=t[e]},createProgram:function(t,e,r){e=e||this.fragmentSource,r=r||this.vertexSource,"highp"!==n.webGlPrecision&&(e=e.replace(/precision highp float/g,"precision "+n.webGlPrecision+" float"));var i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+t.getShaderInfoLog(i));var o=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(o,e),t.compileShader(o),!t.getShaderParameter(o,t.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+t.getShaderInfoLog(o));var a=t.createProgram();if(t.attachShader(a,i),t.attachShader(a,o),t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+t.getProgramInfoLog(a));var s=this.getAttributeLocations(t,a),l=this.getUniformLocations(t,a)||{};return l.uStepW=t.getUniformLocation(a,"uStepW"),l.uStepH=t.getUniformLocation(a,"uStepH"),{program:a,attributeLocations:s,uniformLocations:l}},getAttributeLocations:function(t,e){return{aPosition:t.getAttribLocation(e,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(t,e,n){var r=e.aPosition,i=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(r),t.vertexAttribPointer(r,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW)},_setupFrameBuffer:function(t){var e,n,r=t.context;t.passes>1?(e=t.destinationWidth,n=t.destinationHeight,(t.sourceWidth!==e||t.sourceHeight!==n)&&(r.deleteTexture(t.targetTexture),t.targetTexture=t.filterBackend.createTexture(r,e,n)),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.targetTexture,0)):(r.bindFramebuffer(r.FRAMEBUFFER,null),r.finish())},_swapTextures:function(t){t.passes--,t.pass++;var e=t.targetTexture;t.targetTexture=t.sourceTexture,t.sourceTexture=e},isNeutralState:function(){var t=this.mainParameter,e=n.Image.filters[this.type].prototype;if(t){if(Array.isArray(e[t])){for(var r=e[t].length;r--;)if(this[t][r]!==e[t][r])return!1;return!0}return e[t]===this[t]}return!1},applyTo:function(t){t.webgl?(this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},retrieveShader:function(t){return t.programCache.hasOwnProperty(this.type)||(t.programCache[this.type]=this.createProgram(t.context)),t.programCache[this.type]},applyToWebGL:function(t){var e=t.context,n=this.retrieveShader(t);0===t.pass&&t.originalTexture?e.bindTexture(e.TEXTURE_2D,t.originalTexture):e.bindTexture(e.TEXTURE_2D,t.sourceTexture),e.useProgram(n.program),this.sendAttributeData(e,n.attributeLocations,t.aPosition),e.uniform1f(n.uniformLocations.uStepW,1/t.sourceWidth),e.uniform1f(n.uniformLocations.uStepH,1/t.sourceHeight),this.sendUniformData(e,n.uniformLocations),e.viewport(0,0,t.destinationWidth,t.destinationHeight),e.drawArrays(e.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(t,e,n){t.activeTexture(n),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE0)},unbindAdditionalTexture:function(t,e){t.activeTexture(e),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(t){this[this.mainParameter]=t},sendUniformData:function(){},createHelpLayer:function(t){if(!t.helpLayer){var e=document.createElement("canvas");e.width=t.sourceWidth,e.height=t.sourceHeight,t.helpLayer=e}},toObject:function(){var t={type:this.type},e=this.mainParameter;return e&&(t[e]=this[e]),t},toJSON:function(){return this.toObject()}}),n.Image.filters.BaseFilter.fromObject=function(t,e){var r=new n.Image.filters[t.type](t);return e&&e(r),r},function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.ColorMatrix=r(n.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(t){this.callSuper("initialize",t),this.matrix=this.matrix.slice(0)},applyTo2d:function(t){var e,n,r,i,o,a=t.imageData.data,s=a.length,l=this.matrix,c=this.colorsOnly;for(o=0;o<s;o+=4)e=a[o],n=a[o+1],r=a[o+2],c?(a[o]=e*l[0]+n*l[1]+r*l[2]+255*l[4],a[o+1]=e*l[5]+n*l[6]+r*l[7]+255*l[9],a[o+2]=e*l[10]+n*l[11]+r*l[12]+255*l[14]):(i=a[o+3],a[o]=e*l[0]+n*l[1]+r*l[2]+i*l[3]+255*l[4],a[o+1]=e*l[5]+n*l[6]+r*l[7]+i*l[8]+255*l[9],a[o+2]=e*l[10]+n*l[11]+r*l[12]+i*l[13]+255*l[14],a[o+3]=e*l[15]+n*l[16]+r*l[17]+i*l[18]+255*l[19])},getUniformLocations:function(t,e){return{uColorMatrix:t.getUniformLocation(e,"uColorMatrix"),uConstants:t.getUniformLocation(e,"uConstants")}},sendUniformData:function(t,e){var n=this.matrix,r=[n[0],n[1],n[2],n[3],n[5],n[6],n[7],n[8],n[10],n[11],n[12],n[13],n[15],n[16],n[17],n[18]],i=[n[4],n[9],n[14],n[19]];t.uniformMatrix4fv(e.uColorMatrix,!1,r),t.uniform4fv(e.uConstants,i)}}),e.Image.filters.ColorMatrix.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Brightness=r(n.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(t){if(0!==this.brightness){var e,n=t.imageData.data,r=n.length,i=Math.round(255*this.brightness);for(e=0;e<r;e+=4)n[e]=n[e]+i,n[e+1]=n[e+1]+i,n[e+2]=n[e+2]+i}},getUniformLocations:function(t,e){return{uBrightness:t.getUniformLocation(e,"uBrightness")}},sendUniformData:function(t,e){t.uniform1f(e.uBrightness,this.brightness)}}),e.Image.filters.Brightness.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.Image.filters,i=e.util.createClass;r.Convolute=i(r.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(t){var e=Math.sqrt(this.matrix.length),n=this.type+"_"+e+"_"+(this.opaque?1:0),r=this.fragmentSource[n];return t.programCache.hasOwnProperty(n)||(t.programCache[n]=this.createProgram(t.context,r)),t.programCache[n]},applyTo2d:function(t){var e,n,r,i,o,a,s,l,c,u,h,d,f,p=t.imageData,g=p.data,m=this.matrix,v=Math.round(Math.sqrt(m.length)),b=Math.floor(v/2),y=p.width,x=p.height,w=t.ctx.createImageData(y,x),_=w.data,S=this.opaque?1:0;for(h=0;h<x;h++)for(u=0;u<y;u++){for(o=4*(h*y+u),e=0,n=0,r=0,i=0,f=0;f<v;f++)for(d=0;d<v;d++)a=u+d-b,!((s=h+f-b)<0||s>=x||a<0||a>=y)&&(l=4*(s*y+a),c=m[f*v+d],e+=g[l]*c,n+=g[l+1]*c,r+=g[l+2]*c,S||(i+=g[l+3]*c));_[o]=e,_[o+1]=n,_[o+2]=r,_[o+3]=S?g[o+3]:i}t.imageData=w},getUniformLocations:function(t,e){return{uMatrix:t.getUniformLocation(e,"uMatrix"),uOpaque:t.getUniformLocation(e,"uOpaque"),uHalfSize:t.getUniformLocation(e,"uHalfSize"),uSize:t.getUniformLocation(e,"uSize")}},sendUniformData:function(t,e){t.uniform1fv(e.uMatrix,this.matrix)},toObject:function(){return n(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}}),e.Image.filters.Convolute.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Grayscale=r(n.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(t){var e,n,r=t.imageData.data,i=r.length,o=this.mode;for(e=0;e<i;e+=4)"average"===o?n=(r[e]+r[e+1]+r[e+2])/3:"lightness"===o?n=(Math.min(r[e],r[e+1],r[e+2])+Math.max(r[e],r[e+1],r[e+2]))/2:"luminosity"===o&&(n=.21*r[e]+.72*r[e+1]+.07*r[e+2]),r[e]=n,r[e+1]=n,r[e+2]=n},retrieveShader:function(t){var e=this.type+"_"+this.mode;if(!t.programCache.hasOwnProperty(e)){var n=this.fragmentSource[this.mode];t.programCache[e]=this.createProgram(t.context,n)}return t.programCache[e]},getUniformLocations:function(t,e){return{uMode:t.getUniformLocation(e,"uMode")}},sendUniformData:function(t,e){t.uniform1i(e.uMode,1)},isNeutralState:function(){return!1}}),e.Image.filters.Grayscale.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Invert=r(n.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(t){var e,n=t.imageData.data,r=n.length;for(e=0;e<r;e+=4)n[e]=255-n[e],n[e+1]=255-n[e+1],n[e+2]=255-n[e+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(t,e){return{uInvert:t.getUniformLocation(e,"uInvert")}},sendUniformData:function(t,e){t.uniform1i(e.uInvert,this.invert)}}),e.Image.filters.Invert.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.Image.filters,i=e.util.createClass;r.Noise=i(r.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(t){if(0!==this.noise){var e,n,r=t.imageData.data,i=r.length,o=this.noise;for(e=0,i=r.length;e<i;e+=4)n=(.5-Math.random())*o,r[e]+=n,r[e+1]+=n,r[e+2]+=n}},getUniformLocations:function(t,e){return{uNoise:t.getUniformLocation(e,"uNoise"),uSeed:t.getUniformLocation(e,"uSeed")}},sendUniformData:function(t,e){t.uniform1f(e.uNoise,this.noise/255),t.uniform1f(e.uSeed,Math.random())},toObject:function(){return n(this.callSuper("toObject"),{noise:this.noise})}}),e.Image.filters.Noise.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Pixelate=r(n.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(t){var e,n,r,i,o,a,s,l,c,u,h,d=t.imageData,f=d.data,p=d.height,g=d.width;for(n=0;n<p;n+=this.blocksize)for(r=0;r<g;r+=this.blocksize)for(i=f[e=4*n*g+4*r],o=f[e+1],a=f[e+2],s=f[e+3],u=Math.min(n+this.blocksize,p),h=Math.min(r+this.blocksize,g),l=n;l<u;l++)for(c=r;c<h;c++)f[e=4*l*g+4*c]=i,f[e+1]=o,f[e+2]=a,f[e+3]=s},isNeutralState:function(){return 1===this.blocksize},getUniformLocations:function(t,e){return{uBlocksize:t.getUniformLocation(e,"uBlocksize"),uStepW:t.getUniformLocation(e,"uStepW"),uStepH:t.getUniformLocation(e,"uStepH")}},sendUniformData:function(t,e){t.uniform1f(e.uBlocksize,this.blocksize)}}),e.Image.filters.Pixelate.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.extend,r=e.Image.filters,i=e.util.createClass;r.RemoveColor=i(r.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(t){var n,r,i,o,a=t.imageData.data,s=255*this.distance,l=new e.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(n=0;n<a.length;n+=4)r=a[n],i=a[n+1],o=a[n+2],r>c[0]&&i>c[1]&&o>c[2]&&r<u[0]&&i<u[1]&&o<u[2]&&(a[n+3]=0)},getUniformLocations:function(t,e){return{uLow:t.getUniformLocation(e,"uLow"),uHigh:t.getUniformLocation(e,"uHigh")}},sendUniformData:function(t,n){var r=new e.Color(this.color).getSource(),i=parseFloat(this.distance),o=[0+r[0]/255-i,0+r[1]/255-i,0+r[2]/255-i,1],a=[r[0]/255+i,r[1]/255+i,r[2]/255+i,1];t.uniform4fv(n.uLow,o),t.uniform4fv(n.uHigh,a)},toObject:function(){return n(this.callSuper("toObject"),{color:this.color,distance:this.distance})}}),e.Image.filters.RemoveColor.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.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)n[o]=r(n.ColorMatrix,{type:o,matrix:i[o],mainParameter:!1,colorsOnly:!0}),e.Image.filters[o].fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric,n=e.Image.filters,r=e.util.createClass;n.BlendColor=r(n.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(t){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[t]+"}\n}"},retrieveShader:function(t){var e,n=this.type+"_"+this.mode;return t.programCache.hasOwnProperty(n)||(e=this.buildSource(this.mode),t.programCache[n]=this.createProgram(t.context,e)),t.programCache[n]},applyTo2d:function(t){var n,r,i,o,a,s,l,c=t.imageData.data,u=c.length,h=1-this.alpha;n=(l=new e.Color(this.color).getSource())[0]*this.alpha,r=l[1]*this.alpha,i=l[2]*this.alpha;for(var d=0;d<u;d+=4)switch(o=c[d],a=c[d+1],s=c[d+2],this.mode){case"multiply":c[d]=o*n/255,c[d+1]=a*r/255,c[d+2]=s*i/255;break;case"screen":c[d]=255-(255-o)*(255-n)/255,c[d+1]=255-(255-a)*(255-r)/255,c[d+2]=255-(255-s)*(255-i)/255;break;case"add":c[d]=o+n,c[d+1]=a+r,c[d+2]=s+i;break;case"diff":case"difference":c[d]=Math.abs(o-n),c[d+1]=Math.abs(a-r),c[d+2]=Math.abs(s-i);break;case"subtract":c[d]=o-n,c[d+1]=a-r,c[d+2]=s-i;break;case"darken":c[d]=Math.min(o,n),c[d+1]=Math.min(a,r),c[d+2]=Math.min(s,i);break;case"lighten":c[d]=Math.max(o,n),c[d+1]=Math.max(a,r),c[d+2]=Math.max(s,i);break;case"overlay":c[d]=n<128?2*o*n/255:255-2*(255-o)*(255-n)/255,c[d+1]=r<128?2*a*r/255:255-2*(255-a)*(255-r)/255,c[d+2]=i<128?2*s*i/255:255-2*(255-s)*(255-i)/255;break;case"exclusion":c[d]=n+o-2*n*o/255,c[d+1]=r+a-2*r*a/255,c[d+2]=i+s-2*i*s/255;break;case"tint":c[d]=n+o*h,c[d+1]=r+a*h,c[d+2]=i+s*h}},getUniformLocations:function(t,e){return{uColor:t.getUniformLocation(e,"uColor")}},sendUniformData:function(t,n){var r=new e.Color(this.color).getSource();r[0]=this.alpha*r[0]/255,r[1]=this.alpha*r[1]/255,r[2]=this.alpha*r[2]/255,r[3]=this.alpha,t.uniform4fv(n.uColor,r)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),e.Image.filters.BlendColor.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric,n=e.Image.filters,r=e.util.createClass;n.BlendImage=r(n.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(t){var e=this.type+"_"+this.mode,n=this.fragmentSource[this.mode];return t.programCache.hasOwnProperty(e)||(t.programCache[e]=this.createProgram(t.context,n)),t.programCache[e]},applyToWebGL:function(t){var e=t.context,n=this.createTexture(t.filterBackend,this.image);this.bindAdditionalTexture(e,n,e.TEXTURE1),this.callSuper("applyToWebGL",t),this.unbindAdditionalTexture(e,e.TEXTURE1)},createTexture:function(t,e){return t.getCachedTexture(e.cacheKey,e._element)},calculateMatrix:function(){var t=this.image,e=t._element.width,n=t._element.height;return[1/t.scaleX,0,0,0,1/t.scaleY,0,-t.left/e,-t.top/n,1]},applyTo2d:function(t){var n,r,i,o,a,s,l,c,u,h,d,f=t.imageData,p=t.filterBackend.resources,g=f.data,m=g.length,v=f.width,b=f.height,y=this.image;p.blendImage||(p.blendImage=e.util.createCanvasElement()),h=(u=p.blendImage).getContext("2d"),u.width!==v||u.height!==b?(u.width=v,u.height=b):h.clearRect(0,0,v,b),h.setTransform(y.scaleX,0,0,y.scaleY,y.left,y.top),h.drawImage(y._element,0,0,v,b),d=h.getImageData(0,0,v,b).data;for(var x=0;x<m;x+=4)switch(a=g[x],s=g[x+1],l=g[x+2],c=g[x+3],n=d[x],r=d[x+1],i=d[x+2],o=d[x+3],this.mode){case"multiply":g[x]=a*n/255,g[x+1]=s*r/255,g[x+2]=l*i/255,g[x+3]=c*o/255;break;case"mask":g[x+3]=o}},getUniformLocations:function(t,e){return{uTransformMatrix:t.getUniformLocation(e,"uTransformMatrix"),uImage:t.getUniformLocation(e,"uImage")}},sendUniformData:function(t,e){var n=this.calculateMatrix();t.uniform1i(e.uImage,1),t.uniformMatrix3fv(e.uTransformMatrix,!1,n)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),e.Image.filters.BlendImage.fromObject=function(t,n){e.Image.fromObject(t.image,(function(r){var i=e.util.object.clone(t);i.image=r,n(new e.Image.filters.BlendImage(i))}))}}(t),function(t){var e=t.fabric||(t.fabric={}),n=Math.pow,r=Math.floor,i=Math.sqrt,o=Math.abs,a=Math.round,s=Math.sin,l=Math.ceil,c=e.Image.filters,u=e.util.createClass;c.Resize=u(c.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(t,e){return{uDelta:t.getUniformLocation(e,"uDelta"),uTaps:t.getUniformLocation(e,"uTaps")}},sendUniformData:function(t,e){t.uniform2fv(e.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),t.uniform1fv(e.uTaps,this.taps)},retrieveShader:function(t){var e=this.getFilterWindow(),n=this.type+"_"+e;if(!t.programCache.hasOwnProperty(n)){var r=this.generateShader(e);t.programCache[n]=this.createProgram(t.context,r)}return t.programCache[n]},getFilterWindow:function(){var t=this.tempScale;return Math.ceil(this.lanczosLobes/t)},getTaps:function(){for(var t=this.lanczosCreate(this.lanczosLobes),e=this.tempScale,n=this.getFilterWindow(),r=new Array(n),i=1;i<=n;i++)r[i-1]=t(i*e);return r},generateShader:function(t){for(var e=new Array(t),n=this.fragmentSourceTOP,r=1;r<=t;r++)e[r-1]=r+".0 * uDelta";return n+="uniform float uTaps["+t+"];\n",n+="void main() {\n",n+=" vec4 color = texture2D(uTexture, vTexCoord);\n",n+=" float sum = 1.0;\n",e.forEach((function(t,e){n+=" color += texture2D(uTexture, vTexCoord + "+t+") * uTaps["+e+"];\n",n+=" color += texture2D(uTexture, vTexCoord - "+t+") * uTaps["+e+"];\n",n+=" sum += 2.0 * uTaps["+e+"];\n"})),n+=" gl_FragColor = color / sum;\n",n+="}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(t){t.webgl?(t.passes++,this.width=t.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=t.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),t.destinationWidth=this.dW,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceWidth=t.destinationWidth,this.height=t.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),t.destinationHeight=this.dH,this._setupFrameBuffer(t),this.applyToWebGL(t),this._swapTextures(t),t.sourceHeight=t.destinationHeight):this.applyTo2d(t)},isNeutralState:function(){return 1===this.scaleX&&1===this.scaleY},lanczosCreate:function(t){return function(e){if(e>=t||e<=-t)return 0;if(e<1.1920929e-7&&e>-1.1920929e-7)return 1;var n=(e*=Math.PI)/t;return s(e)/e*s(n)/n}},applyTo2d:function(t){var e=t.imageData,n=this.scaleX,r=this.scaleY;this.rcpScaleX=1/n,this.rcpScaleY=1/r;var i,o=e.width,s=e.height,l=a(o*n),c=a(s*r);"sliceHack"===this.resizeType?i=this.sliceByTwo(t,o,s,l,c):"hermite"===this.resizeType?i=this.hermiteFastResize(t,o,s,l,c):"bilinear"===this.resizeType?i=this.bilinearFiltering(t,o,s,l,c):"lanczos"===this.resizeType&&(i=this.lanczosResize(t,o,s,l,c)),t.imageData=i},sliceByTwo:function(t,n,i,o,a){var s,l,c=t.imageData,u=.5,h=!1,d=!1,f=n*u,p=i*u,g=e.filterBackend.resources,m=0,v=0,b=n,y=0;for(g.sliceByTwo||(g.sliceByTwo=document.createElement("canvas")),((s=g.sliceByTwo).width<1.5*n||s.height<i)&&(s.width=1.5*n,s.height=i),(l=s.getContext("2d")).clearRect(0,0,1.5*n,i),l.putImageData(c,0,0),o=r(o),a=r(a);!h||!d;)n=f,i=p,o<r(f*u)?f=r(f*u):(f=o,h=!0),a<r(p*u)?p=r(p*u):(p=a,d=!0),l.drawImage(s,m,v,n,i,b,y,f,p),m=b,v=y,y+=p;return l.getImageData(m,v,o,a)},lanczosResize:function(t,e,a,s,c){var u=t.imageData.data,h=t.ctx.createImageData(s,c),d=h.data,f=this.lanczosCreate(this.lanczosLobes),p=this.rcpScaleX,g=this.rcpScaleY,m=2/this.rcpScaleX,v=2/this.rcpScaleY,b=l(p*this.lanczosLobes/2),y=l(g*this.lanczosLobes/2),x={},w={},_={};return function t(l){var S,C,k,T,E,O,M,P,A,j,D;for(w.x=(l+.5)*p,_.x=r(w.x),S=0;S<c;S++){for(w.y=(S+.5)*g,_.y=r(w.y),E=0,O=0,M=0,P=0,A=0,C=_.x-b;C<=_.x+b;C++)if(!(C<0||C>=e)){j=r(1e3*o(C-w.x)),x[j]||(x[j]={});for(var R=_.y-y;R<=_.y+y;R++)R<0||R>=a||(D=r(1e3*o(R-w.y)),x[j][D]||(x[j][D]=f(i(n(j*m,2)+n(D*v,2))/1e3)),(k=x[j][D])>0&&(E+=k,O+=k*u[T=4*(R*e+C)],M+=k*u[T+1],P+=k*u[T+2],A+=k*u[T+3]))}d[T=4*(S*s+l)]=O/E,d[T+1]=M/E,d[T+2]=P/E,d[T+3]=A/E}return++l<s?t(l):h}(0)},bilinearFiltering:function(t,e,n,i,o){var a,s,l,c,u,h,d,f,p,g=0,m=this.rcpScaleX,v=this.rcpScaleY,b=4*(e-1),y=t.imageData.data,x=t.ctx.createImageData(i,o),w=x.data;for(l=0;l<o;l++)for(c=0;c<i;c++)for(u=m*c-(a=r(m*c)),h=v*l-(s=r(v*l)),p=4*(s*e+a),d=0;d<4;d++)f=y[p+d]*(1-u)*(1-h)+y[p+4+d]*u*(1-h)+y[p+b+d]*h*(1-u)+y[p+b+4+d]*u*h,w[g++]=f;return x},hermiteFastResize:function(t,e,n,a,s){for(var c=this.rcpScaleX,u=this.rcpScaleY,h=l(c/2),d=l(u/2),f=t.imageData.data,p=t.ctx.createImageData(a,s),g=p.data,m=0;m<s;m++)for(var v=0;v<a;v++){for(var b=4*(v+m*a),y=0,x=0,w=0,_=0,S=0,C=0,k=0,T=(m+.5)*u,E=r(m*u);E<(m+1)*u;E++)for(var O=o(T-(E+.5))/d,M=(v+.5)*c,P=O*O,A=r(v*c);A<(v+1)*c;A++){var j=o(M-(A+.5))/h,D=i(P+j*j);D>1&&D<-1||(y=2*D*D*D-3*D*D+1)>0&&(k+=y*f[(j=4*(A+E*e))+3],w+=y,f[j+3]<255&&(y=y*f[j+3]/250),_+=y*f[j],S+=y*f[j+1],C+=y*f[j+2],x+=y)}g[b]=_/x,g[b+1]=S/x,g[b+2]=C/x,g[b+3]=k/w}return p},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),e.Image.filters.Resize.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Contrast=r(n.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(t){if(0!==this.contrast){var e,n=t.imageData.data,r=n.length,i=Math.floor(255*this.contrast),o=259*(i+255)/(255*(259-i));for(e=0;e<r;e+=4)n[e]=o*(n[e]-128)+128,n[e+1]=o*(n[e+1]-128)+128,n[e+2]=o*(n[e+2]-128)+128}},getUniformLocations:function(t,e){return{uContrast:t.getUniformLocation(e,"uContrast")}},sendUniformData:function(t,e){t.uniform1f(e.uContrast,this.contrast)}}),e.Image.filters.Contrast.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Saturation=r(n.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(t){if(0!==this.saturation){var e,n,r=t.imageData.data,i=r.length,o=-this.saturation;for(e=0;e<i;e+=4)n=Math.max(r[e],r[e+1],r[e+2]),r[e]+=n!==r[e]?(n-r[e])*o:0,r[e+1]+=n!==r[e+1]?(n-r[e+1])*o:0,r[e+2]+=n!==r[e+2]?(n-r[e+2])*o:0}},getUniformLocations:function(t,e){return{uSaturation:t.getUniformLocation(e,"uSaturation")}},sendUniformData:function(t,e){t.uniform1f(e.uSaturation,-this.saturation)}}),e.Image.filters.Saturation.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Vibrance=r(n.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(t){if(0!==this.vibrance){var e,n,r,i,o=t.imageData.data,a=o.length,s=-this.vibrance;for(e=0;e<a;e+=4)n=Math.max(o[e],o[e+1],o[e+2]),r=(o[e]+o[e+1]+o[e+2])/3,i=2*Math.abs(n-r)/255*s,o[e]+=n!==o[e]?(n-o[e])*i:0,o[e+1]+=n!==o[e+1]?(n-o[e+1])*i:0,o[e+2]+=n!==o[e+2]?(n-o[e+2])*i:0}},getUniformLocations:function(t,e){return{uVibrance:t.getUniformLocation(e,"uVibrance")}},sendUniformData:function(t,e){t.uniform1f(e.uVibrance,-this.vibrance)}}),e.Image.filters.Vibrance.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Blur=r(n.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(t){t.webgl?(this.aspectRatio=t.sourceWidth/t.sourceHeight,t.passes++,this._setupFrameBuffer(t),this.horizontal=!0,this.applyToWebGL(t),this._swapTextures(t),this._setupFrameBuffer(t),this.horizontal=!1,this.applyToWebGL(t),this._swapTextures(t)):this.applyTo2d(t)},applyTo2d:function(t){t.imageData=this.simpleBlur(t)},simpleBlur:function(t){var n,r,i=t.filterBackend.resources,o=t.imageData.width,a=t.imageData.height;i.blurLayer1||(i.blurLayer1=e.util.createCanvasElement(),i.blurLayer2=e.util.createCanvasElement()),n=i.blurLayer1,r=i.blurLayer2,(n.width!==o||n.height!==a)&&(r.width=n.width=o,r.height=n.height=a);var s,l,c,u,h=n.getContext("2d"),d=r.getContext("2d"),f=15,p=.06*this.blur*.5;for(h.putImageData(t.imageData,0,0),d.clearRect(0,0,o,a),u=-f;u<=f;u++)c=p*(l=u/f)*o+(s=(Math.random()-.5)/4),d.globalAlpha=1-Math.abs(l),d.drawImage(n,c,s),h.drawImage(r,0,0),d.globalAlpha=1,d.clearRect(0,0,r.width,r.height);for(u=-f;u<=f;u++)c=p*(l=u/f)*a+(s=(Math.random()-.5)/4),d.globalAlpha=1-Math.abs(l),d.drawImage(n,s,c),h.drawImage(r,0,0),d.globalAlpha=1,d.clearRect(0,0,r.width,r.height);t.ctx.drawImage(n,0,0);var g=t.ctx.getImageData(0,0,n.width,n.height);return h.globalAlpha=1,h.clearRect(0,0,n.width,n.height),g},getUniformLocations:function(t,e){return{delta:t.getUniformLocation(e,"uDelta")}},sendUniformData:function(t,e){var n=this.chooseRightDelta();t.uniform2fv(e.delta,n)},chooseRightDelta:function(){var t,e=1,n=[0,0];return this.horizontal?this.aspectRatio>1&&(e=1/this.aspectRatio):this.aspectRatio<1&&(e=this.aspectRatio),t=e*this.blur*.12,this.horizontal?n[0]=t:n[1]=t,n}}),n.Blur.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Gamma=r(n.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(t){this.gamma=[1,1,1],n.BaseFilter.prototype.initialize.call(this,t)},applyTo2d:function(t){var e,n=t.imageData.data,r=this.gamma,i=n.length,o=1/r[0],a=1/r[1],s=1/r[2];for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),e=0,i=256;e<i;e++)this.rVals[e]=255*Math.pow(e/255,o),this.gVals[e]=255*Math.pow(e/255,a),this.bVals[e]=255*Math.pow(e/255,s);for(e=0,i=n.length;e<i;e+=4)n[e]=this.rVals[n[e]],n[e+1]=this.gVals[n[e+1]],n[e+2]=this.bVals[n[e+2]]},getUniformLocations:function(t,e){return{uGamma:t.getUniformLocation(e,"uGamma")}},sendUniformData:function(t,e){t.uniform3fv(e.uGamma,this.gamma)}}),e.Image.filters.Gamma.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.Composed=r(n.BaseFilter,{type:"Composed",subFilters:[],initialize:function(t){this.callSuper("initialize",t),this.subFilters=this.subFilters.slice(0)},applyTo:function(t){t.passes+=this.subFilters.length-1,this.subFilters.forEach((function(e){e.applyTo(t)}))},toObject:function(){return e.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map((function(t){return t.toObject()}))})},isNeutralState:function(){return!this.subFilters.some((function(t){return!t.isNeutralState()}))}}),e.Image.filters.Composed.fromObject=function(t,n){var r=(t.subFilters||[]).map((function(t){return new e.Image.filters[t.type](t)})),i=new e.Image.filters.Composed({subFilters:r});return n&&n(i),i}}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.Image.filters,r=e.util.createClass;n.HueRotation=r(n.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var t=this.rotation*Math.PI,n=e.util.cos(t),r=e.util.sin(t),i=1/3,o=Math.sqrt(i)*r,a=1-n;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]=n+a/3,this.matrix[1]=i*a-o,this.matrix[2]=i*a+o,this.matrix[5]=i*a+o,this.matrix[6]=n+i*a,this.matrix[7]=i*a-o,this.matrix[10]=i*a-o,this.matrix[11]=i*a+o,this.matrix[12]=n+i*a},isNeutralState:function(t){return this.calculateMatrix(),n.BaseFilter.prototype.isNeutralState.call(this,t)},applyTo:function(t){this.calculateMatrix(),n.BaseFilter.prototype.applyTo.call(this,t)}}),e.Image.filters.HueRotation.fromObject=e.Image.filters.BaseFilter.fromObject}(t),function(t){var e=t.fabric||(t.fabric={}),n=e.util.object.clone;if(e.Text)e.warn("fabric.Text is already defined");else{var r="fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign".split(" ");e.Text=e.util.createClass(e.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:e.Object.prototype.stateProperties.concat(r),cacheProperties:e.Object.prototype.cacheProperties.concat(r),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(t,e){this.styles=e&&e.styles||{},this.text=t,this.__skipDimension=!0,this.callSuper("initialize",e),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:"_dimensionAffectingProps"})},setPathInfo:function(){var t=this.path;t&&(t.segmentsInfo=e.util.getPathSegmentsInfo(t.path))},getMeasuringContext:function(){return e._measuringContext||(e._measuringContext=this.canvas&&this.canvas.contextCache||e.util.createCanvasElement().getContext("2d")),e._measuringContext},_splitText:function(){var t=this._splitTextIntoLines(this.text);return this.textLines=t.lines,this._textLines=t.graphemeLines,this._unwrappedTextLines=t._unwrappedLines,this._text=t.graphemeText,t},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 t,e,n,r,i,o,a,s=0,l=this._textLines.length;s<l;s++)if(("justify"===this.textAlign||s!==l-1&&!this.isEndOfWrapping(s))&&(r=0,i=this._textLines[s],(e=this.getLineWidth(s))<this.width&&(a=this.textLines[s].match(this._reSpacesAndTabs)))){n=a.length,t=(this.width-e)/n;for(var c=0,u=i.length;c<=u;c++)o=this.__charBounds[s][c],this._reSpaceAndTab.test(i[c])?(o.width+=t,o.kernedWidth+=t,o.left+=r,r+=t):o.left+=r}},isEndOfWrapping:function(t){return t===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var t=this.callSuper("_getCacheCanvasDimensions"),e=this.fontSize;return t.width+=e*t.zoomX,t.height+=e*t.zoomY,t},_render:function(t){var e=this.path;e&&!e.isNotVisible()&&e._render(t),this._setTextStyles(t),this._renderTextLinesBackground(t),this._renderTextDecoration(t,"underline"),this._renderText(t),this._renderTextDecoration(t,"overline"),this._renderTextDecoration(t,"linethrough")},_renderText:function(t){"stroke"===this.paintFirst?(this._renderTextStroke(t),this._renderTextFill(t)):(this._renderTextFill(t),this._renderTextStroke(t))},_setTextStyles:function(t,e,n){if(t.textBaseline="alphabetical",this.path)switch(this.pathAlign){case"center":t.textBaseline="middle";break;case"ascender":t.textBaseline="top";break;case"descender":t.textBaseline="bottom"}t.font=this._getFontDeclaration(e,n)},calcTextWidth:function(){for(var t=this.getLineWidth(0),e=1,n=this._textLines.length;e<n;e++){var r=this.getLineWidth(e);r>t&&(t=r)}return t},_renderTextLine:function(t,e,n,r,i,o){this._renderChars(t,e,n,r,i,o)},_renderTextLinesBackground:function(t){if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){for(var e,n,r,i,o,a,s,l=t.fillStyle,c=this._getLeftOffset(),u=this._getTopOffset(),h=0,d=0,f=this.path,p=0,g=this._textLines.length;p<g;p++)if(e=this.getHeightOfLine(p),this.textBackgroundColor||this.styleHas("textBackgroundColor",p)){r=this._textLines[p],n=this._getLineLeftOffset(p),d=0,h=0,i=this.getValueOfPropertyAt(p,0,"textBackgroundColor");for(var m=0,v=r.length;m<v;m++)o=this.__charBounds[p][m],a=this.getValueOfPropertyAt(p,m,"textBackgroundColor"),f?(t.save(),t.translate(o.renderLeft,o.renderTop),t.rotate(o.angle),t.fillStyle=a,a&&t.fillRect(-o.width/2,-e/this.lineHeight*(1-this._fontSizeFraction),o.width,e/this.lineHeight),t.restore()):a!==i?(s=c+n+h,"rtl"===this.direction&&(s=this.width-s-d),t.fillStyle=i,i&&t.fillRect(s,u,d,e/this.lineHeight),h=o.left,d=o.width,i=a):d+=o.kernedWidth;a&&!f&&(s=c+n+h,"rtl"===this.direction&&(s=this.width-s-d),t.fillStyle=a,t.fillRect(s,u,d,e/this.lineHeight)),u+=e}else u+=e;t.fillStyle=l,this._removeShadow(t)}},getFontCache:function(t){var n=t.fontFamily.toLowerCase();e.charWidthsCache[n]||(e.charWidthsCache[n]={});var r=e.charWidthsCache[n],i=t.fontStyle.toLowerCase()+"_"+(t.fontWeight+"").toLowerCase();return r[i]||(r[i]={}),r[i]},_measureChar:function(t,e,n,r){var i,o,a,s,l=this.getFontCache(e),c=n+t,u=this._getFontDeclaration(e)===this._getFontDeclaration(r),h=e.fontSize/this.CACHE_FONT_SIZE;if(n&&void 0!==l[n]&&(a=l[n]),void 0!==l[t]&&(s=i=l[t]),u&&void 0!==l[c]&&(s=(o=l[c])-a),void 0===i||void 0===a||void 0===o){var d=this.getMeasuringContext();this._setTextStyles(d,e,!0)}return void 0===i&&(s=i=d.measureText(t).width,l[t]=i),void 0===a&&u&&n&&(a=d.measureText(n).width,l[n]=a),u&&void 0===o&&(o=d.measureText(c).width,l[c]=o,s=o-a),{width:i*h,kernedWidth:s*h}},getHeightOfChar:function(t,e){return this.getValueOfPropertyAt(t,e,"fontSize")},measureLine:function(t){var e=this._measureLine(t);return 0!==this.charSpacing&&(e.width-=this._getWidthOfCharSpacing()),e.width<0&&(e.width=0),e},_measureLine:function(t){var n,r,i,o,a,s,l=0,c=this._textLines[t],u=new Array(c.length),h=0,d=this.path,f="right"===this.pathSide;for(this.__charBounds[t]=u,n=0;n<c.length;n++)r=c[n],o=this._getGraphemeBox(r,t,n,i),u[n]=o,l+=o.kernedWidth,i=r;if(u[n]={left:o?o.left+o.width:0,width:0,kernedWidth:0,height:this.fontSize},d){switch(s=d.segmentsInfo[d.segmentsInfo.length-1].length,(a=e.util.getPointOnPath(d.path,0,d.segmentsInfo)).x+=d.pathOffset.x,a.y+=d.pathOffset.y,this.textAlign){case"left":h=f?s-l:0;break;case"center":h=(s-l)/2;break;case"right":h=f?0:s-l}for(h+=this.pathStartOffset*(f?-1:1),n=f?c.length-1:0;f?n>=0:n<c.length;f?n--:n++)o=u[n],h>s?h%=s:h<0&&(h+=s),this._setGraphemeOnPath(h,o,a),h+=o.kernedWidth}return{width:l,numOfSpaces:0}},_setGraphemeOnPath:function(t,n,r){var i=t+n.kernedWidth/2,o=this.path,a=e.util.getPointOnPath(o.path,i,o.segmentsInfo);n.renderLeft=a.x-r.x,n.renderTop=a.y-r.y,n.angle=a.angle+("right"===this.pathSide?Math.PI:0)},_getGraphemeBox:function(t,e,n,r,i){var o,a=this.getCompleteStyleDeclaration(e,n),s=r?this.getCompleteStyleDeclaration(e,n-1):{},l=this._measureChar(t,a,r,s),c=l.kernedWidth,u=l.width;0!==this.charSpacing&&(u+=o=this._getWidthOfCharSpacing(),c+=o);var h={width:u,left:0,height:a.fontSize,kernedWidth:c,deltaY:a.deltaY};if(n>0&&!i){var d=this.__charBounds[e][n-1];h.left=d.left+d.width+l.kernedWidth-l.width}return h},getHeightOfLine:function(t){if(this.__lineHeights[t])return this.__lineHeights[t];for(var e=this._textLines[t],n=this.getHeightOfChar(t,0),r=1,i=e.length;r<i;r++)n=Math.max(this.getHeightOfChar(t,r),n);return this.__lineHeights[t]=n*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var t,e=0,n=0,r=this._textLines.length;n<r;n++)t=this.getHeightOfLine(n),e+=n===r-1?t/this.lineHeight:t;return e},_getLeftOffset:function(){return"ltr"===this.direction?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(t,e){t.save();for(var n=0,r=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(e,t,this._textLines[o],r+c,i+n+l,o),n+=s}t.restore()},_renderTextFill:function(t){!this.fill&&!this.styleHas("fill")||this._renderTextCommon(t,"fillText")},_renderTextStroke:function(t){(!this.stroke||0===this.strokeWidth)&&this.isEmptyStyles()||(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(t),t.save(),this._setLineDash(t,this.strokeDashArray),t.beginPath(),this._renderTextCommon(t,"strokeText"),t.closePath(),t.restore())},_renderChars:function(t,n,r,i,o,a){var s,l,c,u,h,d=this.getHeightOfLine(a),f=-1!==this.textAlign.indexOf("justify"),p="",g=0,m=this.path,v=!f&&0===this.charSpacing&&this.isEmptyStyles(a)&&!m,b="ltr"===this.direction,y="ltr"===this.direction?1:-1,x=n.canvas.getAttribute("dir");if(n.save(),x!==this.direction&&(n.canvas.setAttribute("dir",b?"ltr":"rtl"),n.direction=b?"ltr":"rtl",n.textAlign=b?"left":"right"),o-=d*this._fontSizeFraction/this.lineHeight,v)return this._renderChar(t,n,a,0,r.join(""),i,o,d),void n.restore();for(var w=0,_=r.length-1;w<=_;w++)u=w===_||this.charSpacing||m,p+=r[w],c=this.__charBounds[a][w],0===g?(i+=y*(c.kernedWidth-c.width),g+=c.width):g+=c.kernedWidth,f&&!u&&this._reSpaceAndTab.test(r[w])&&(u=!0),u||(s=s||this.getCompleteStyleDeclaration(a,w),l=this.getCompleteStyleDeclaration(a,w+1),u=e.util.hasStyleChanged(s,l,!1)),u&&(m?(n.save(),n.translate(c.renderLeft,c.renderTop),n.rotate(c.angle),this._renderChar(t,n,a,w,p,-g/2,0,d),n.restore()):(h=i,this._renderChar(t,n,a,w,p,h,o,d)),p="",s=l,i+=y*g,g=0);n.restore()},_applyPatternGradientTransformText:function(t){var n,r=e.util.createCanvasElement(),i=this.width+this.strokeWidth,o=this.height+this.strokeWidth;return r.width=i,r.height=o,(n=r.getContext("2d")).beginPath(),n.moveTo(0,0),n.lineTo(i,0),n.lineTo(i,o),n.lineTo(0,o),n.closePath(),n.translate(i/2,o/2),n.fillStyle=t.toLive(n),this._applyPatternGradientTransform(n,t),n.fill(),n.createPattern(r,"no-repeat")},handleFiller:function(t,e,n){var r,i;return n.toLive?"percentage"===n.gradientUnits||n.gradientTransform||n.patternTransform?(r=-this.width/2,i=-this.height/2,t.translate(r,i),t[e]=this._applyPatternGradientTransformText(n),{offsetX:r,offsetY:i}):(t[e]=n.toLive(t,this),this._applyPatternGradientTransform(t,n)):(t[e]=n,{offsetX:0,offsetY:0})},_setStrokeStyles:function(t,e){return t.lineWidth=e.strokeWidth,t.lineCap=this.strokeLineCap,t.lineDashOffset=this.strokeDashOffset,t.lineJoin=this.strokeLineJoin,t.miterLimit=this.strokeMiterLimit,this.handleFiller(t,"strokeStyle",e.stroke)},_setFillStyles:function(t,e){return this.handleFiller(t,"fillStyle",e.fill)},_renderChar:function(t,e,n,r,i,o,a){var s,l,c=this._getStyleDeclaration(n,r),u=this.getCompleteStyleDeclaration(n,r),h="fillText"===t&&u.fill,d="strokeText"===t&&u.stroke&&u.strokeWidth;!d&&!h||(e.save(),h&&(s=this._setFillStyles(e,u)),d&&(l=this._setStrokeStyles(e,u)),e.font=this._getFontDeclaration(u),c&&c.textBackgroundColor&&this._removeShadow(e),c&&c.deltaY&&(a+=c.deltaY),h&&e.fillText(i,o-s.offsetX,a-s.offsetY),d&&e.strokeText(i,o-l.offsetX,a-l.offsetY),e.restore())},setSuperscript:function(t,e){return this._setScript(t,e,this.superscript)},setSubscript:function(t,e){return this._setScript(t,e,this.subscript)},_setScript:function(t,e,n){var r=this.get2DCursorLocation(t,!0),i=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,"fontSize"),o=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,"deltaY"),a={fontSize:i*n.size,deltaY:o+i*n.baseline};return this.setSelectionStyles(a,t,e),this},_getLineLeftOffset:function(t){var e=this.getLineWidth(t),n=this.width-e,r=this.textAlign,i=this.direction,o=0,a=this.isEndOfWrapping(t);return"justify"===r||"justify-center"===r&&!a||"justify-right"===r&&!a||"justify-left"===r&&!a?0:("center"===r&&(o=n/2),"right"===r&&(o=n),"justify-center"===r&&(o=n/2),"justify-right"===r&&(o=n),"rtl"===i&&(o-=n),o)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var t=this._forceClearCache;return t||(t=this.hasStateChanged("_dimensionAffectingProps")),t&&(this.dirty=!0,this._forceClearCache=!1),t},getLineWidth:function(t){if(void 0!==this.__lineWidths[t])return this.__lineWidths[t];var e=this.measureLine(t).width;return this.__lineWidths[t]=e,e},_getWidthOfCharSpacing:function(){return 0!==this.charSpacing?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(t,e,n){var r=this._getStyleDeclaration(t,e);return r&&typeof r[n]<"u"?r[n]:this[n]},_renderTextDecoration:function(t,e){if(this[e]||this.styleHas(e)){for(var n,r,i,o,a,s,l,c,u,h,d,f,p,g,m,v,b=this._getLeftOffset(),y=this._getTopOffset(),x=this.path,w=this._getWidthOfCharSpacing(),_=this.offsets[e],S=0,C=this._textLines.length;S<C;S++)if(n=this.getHeightOfLine(S),this[e]||this.styleHas(e,S)){l=this._textLines[S],g=n/this.lineHeight,o=this._getLineLeftOffset(S),h=0,d=0,c=this.getValueOfPropertyAt(S,0,e),v=this.getValueOfPropertyAt(S,0,"fill"),u=y+g*(1-this._fontSizeFraction),r=this.getHeightOfChar(S,0),a=this.getValueOfPropertyAt(S,0,"deltaY");for(var k=0,T=l.length;k<T;k++)if(f=this.__charBounds[S][k],p=this.getValueOfPropertyAt(S,k,e),m=this.getValueOfPropertyAt(S,k,"fill"),i=this.getHeightOfChar(S,k),s=this.getValueOfPropertyAt(S,k,"deltaY"),x&&p&&m)t.save(),t.fillStyle=v,t.translate(f.renderLeft,f.renderTop),t.rotate(f.angle),t.fillRect(-f.kernedWidth/2,_*i+s,f.kernedWidth,this.fontSize/15),t.restore();else if((p!==c||m!==v||i!==r||s!==a)&&d>0){var E=b+o+h;"rtl"===this.direction&&(E=this.width-E-d),c&&v&&(t.fillStyle=v,t.fillRect(E,u+_*r+a,d,this.fontSize/15)),h=f.left,d=f.width,c=p,v=m,r=i,a=s}else d+=f.kernedWidth;E=b+o+h;"rtl"===this.direction&&(E=this.width-E-d),t.fillStyle=m,p&&m&&t.fillRect(E,u+_*r+a,d-w,this.fontSize/15),y+=n}else y+=n;this._removeShadow(t)}},_getFontDeclaration:function(t,n){var r=t||this,i=this.fontFamily,o=e.Text.genericFonts.indexOf(i.toLowerCase())>-1,a=void 0===i||i.indexOf("'")>-1||i.indexOf(",")>-1||i.indexOf('"')>-1||o?r.fontFamily:'"'+r.fontFamily+'"';return[e.isLikelyNode?r.fontWeight:r.fontStyle,e.isLikelyNode?r.fontStyle:r.fontWeight,n?this.CACHE_FONT_SIZE+"px":r.fontSize+"px",a].join(" ")},render:function(t){!this.visible||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",t))},_splitTextIntoLines:function(t){for(var n=t.split(this._reNewline),r=new Array(n.length),i=["\n"],o=[],a=0;a<n.length;a++)r[a]=e.util.string.graphemeSplit(n[a]),o=o.concat(r[a],i);return o.pop(),{_unwrappedLines:r,lines:n,graphemeText:o,graphemeLines:r}},toObject:function(t){var n=r.concat(t),i=this.callSuper("toObject",n);return i.styles=e.util.stylesToArray(this.styles,this.text),i.path&&(i.path=this.path.toObject()),i},set:function(t,e){this.callSuper("set",t,e);var n=!1,r=!1;if("object"==typeof t)for(var i in t)"path"===i&&this.setPathInfo(),n=n||-1!==this._dimensionAffectingProps.indexOf(i),r=r||"path"===i;else n=-1!==this._dimensionAffectingProps.indexOf(t),r="path"===t;return r&&this.setPathInfo(),n&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),e.Text.ATTRIBUTE_NAMES=e.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" ")),e.Text.DEFAULT_SVG_FONT_SIZE=16,e.Text.fromElement=function(t,r,i){if(!t)return r(null);var o=e.parseAttributes(t,e.Text.ATTRIBUTE_NAMES),a=o.textAnchor||"left";if((i=e.util.object.extend(i?n(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=e.Text.DEFAULT_SVG_FONT_SIZE);var l="";"textContent"in t?l=t.textContent:"firstChild"in t&&null!==t.firstChild&&"data"in t.firstChild&&null!==t.firstChild.data&&(l=t.firstChild.data),l=l.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");var c=i.strokeWidth;i.strokeWidth=0;var u=new e.Text(l,i),h=u.getScaledHeight()/u.height,d=((u.height+u.strokeWidth)*u.lineHeight-u.height)*h,f=u.getScaledHeight()+d,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}),r(u)},e.Text.fromObject=function(t,r){var i=n(t),o=t.path;return delete i.path,e.Object._fromObject("Text",i,(function(n){n.styles=e.util.stylesFromArray(t.styles,t.text),o?e.Object._fromObject("Path",o,(function(t){n.set("path",t),r(n)}),"path"):r(n)}),"text")},e.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"],e.util.createAccessors&&e.util.createAccessors(e.Text)}}(t),n.util.object.extend(n.Text.prototype,{isEmptyStyles:function(t){if(!this.styles||typeof t<"u"&&!this.styles[t])return!0;var e=typeof t>"u"?this.styles:{line:this.styles[t]};for(var n in e)for(var r in e[n])for(var i in e[n][r])return!1;return!0},styleHas:function(t,e){if(!this.styles||!t||""===t||typeof e<"u"&&!this.styles[e])return!1;var n=typeof e>"u"?this.styles:{0:this.styles[e]};for(var r in n)for(var i in n[r])if(typeof n[r][i][t]<"u")return!0;return!1},cleanStyle:function(t){if(!this.styles||!t||""===t)return!1;var e,n,r=this.styles,i=0,o=!0,a=0;for(var s in r){for(var l in e=0,r[s]){var c;i++,(c=r[s][l]).hasOwnProperty(t)?(n?c[t]!==n&&(o=!1):n=c[t],c[t]===this[t]&&delete c[t]):o=!1,0!==Object.keys(c).length?e++:delete r[s][l]}0===e&&delete r[s]}for(var u=0;u<this._textLines.length;u++)a+=this._textLines[u].length;o&&i===a&&(this[t]=n,this.removeStyle(t))},removeStyle:function(t){if(this.styles&&t&&""!==t){var e,n,r,i=this.styles;for(n in i){for(r in e=i[n])delete e[r][t],0===Object.keys(e[r]).length&&delete e[r];0===Object.keys(e).length&&delete i[n]}}},_extendStyles:function(t,e){var r=this.get2DCursorLocation(t);this._getLineStyle(r.lineIndex)||this._setLineStyle(r.lineIndex),this._getStyleDeclaration(r.lineIndex,r.charIndex)||this._setStyleDeclaration(r.lineIndex,r.charIndex,{}),n.util.object.extend(this._getStyleDeclaration(r.lineIndex,r.charIndex),e)},get2DCursorLocation:function(t,e){typeof t>"u"&&(t=this.selectionStart);for(var n=e?this._unwrappedTextLines:this._textLines,r=n.length,i=0;i<r;i++){if(t<=n[i].length)return{lineIndex:i,charIndex:t};t-=n[i].length+this.missingNewlineOffset(i)}return{lineIndex:i-1,charIndex:n[i-1].length<t?n[i-1].length:t}},getSelectionStyles:function(t,e,n){typeof t>"u"&&(t=this.selectionStart||0),typeof e>"u"&&(e=this.selectionEnd||t);for(var r=[],i=t;i<e;i++)r.push(this.getStyleAtPosition(i,n));return r},getStyleAtPosition:function(t,e){var n=this.get2DCursorLocation(t);return(e?this.getCompleteStyleDeclaration(n.lineIndex,n.charIndex):this._getStyleDeclaration(n.lineIndex,n.charIndex))||{}},setSelectionStyles:function(t,e,n){typeof e>"u"&&(e=this.selectionStart||0),typeof n>"u"&&(n=this.selectionEnd||e);for(var r=e;r<n;r++)this._extendStyles(r,t);return this._forceClearCache=!0,this},_getStyleDeclaration:function(t,e){var n=this.styles&&this.styles[t];return n?n[e]:null},getCompleteStyleDeclaration:function(t,e){for(var n,r=this._getStyleDeclaration(t,e)||{},i={},o=0;o<this._styleProperties.length;o++)i[n=this._styleProperties[o]]=typeof r[n]>"u"?this[n]:r[n];return i},_setStyleDeclaration:function(t,e,n){this.styles[t][e]=n},_deleteStyleDeclaration:function(t,e){delete this.styles[t][e]},_getLineStyle:function(t){return!!this.styles[t]},_setLineStyle:function(t){this.styles[t]={}},_deleteLineStyle:function(t){delete this.styles[t]}}),function(){function t(t){t.textDecoration&&(t.textDecoration.indexOf("underline")>-1&&(t.underline=!0),t.textDecoration.indexOf("line-through")>-1&&(t.linethrough=!0),t.textDecoration.indexOf("overline")>-1&&(t.overline=!0),delete t.textDecoration)}n.IText=n.util.createClass(n.Text,n.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(t,e){this.callSuper("initialize",t,e),this.initBehavior()},setSelectionStart:function(t){t=Math.max(t,0),this._updateAndFire("selectionStart",t)},setSelectionEnd:function(t){t=Math.min(t,this.text.length),this._updateAndFire("selectionEnd",t)},_updateAndFire:function(t,e){this[t]!==e&&(this._fireSelectionChanged(),this[t]=e),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(t){this.clearContextTop(),this.callSuper("render",t),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(t){this.callSuper("_render",t)},clearContextTop:function(t){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var e=this.canvas.contextTop,n=this.canvas.viewportTransform;e.save(),e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this.transform(e),this._clearTextArea(e),t||e.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var t=this._getCursorBoundaries(),e=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(t,e):this.renderSelection(t,e),e.restore()}},_clearTextArea:function(t){var e=this.width+4,n=this.height+4;t.clearRect(-e/2,-n/2,e,n)},_getCursorBoundaries:function(t){typeof t>"u"&&(t=this.selectionStart);var e=this._getLeftOffset(),n=this._getTopOffset(),r=this._getCursorBoundariesOffsets(t);return{left:e,top:n,leftOffset:r.left,topOffset:r.top}},_getCursorBoundariesOffsets:function(t){if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var e,n,r,i,o=0,a=0,s=this.get2DCursorLocation(t);r=s.charIndex,n=s.lineIndex;for(var l=0;l<n;l++)o+=this.getHeightOfLine(l);e=this._getLineLeftOffset(n);var c=this.__charBounds[n][r];return c&&(a=c.left),0!==this.charSpacing&&r===this._textLines[n].length&&(a-=this._getWidthOfCharSpacing()),i={top:o,left:e+(a>0?a:0)},"rtl"===this.direction&&(i.left*=-1),this.cursorOffsetCache=i,this.cursorOffsetCache},renderCursor:function(t,e){var n=this.get2DCursorLocation(),r=n.lineIndex,i=n.charIndex>0?n.charIndex-1:0,o=this.getValueOfPropertyAt(r,i,"fontSize"),a=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/a,l=t.topOffset,c=this.getValueOfPropertyAt(r,i,"deltaY");l+=(1-this._fontSizeFraction)*this.getHeightOfLine(r)/this.lineHeight-o*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(t,e),e.fillStyle=this.cursorColor||this.getValueOfPropertyAt(r,i,"fill"),e.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,e.fillRect(t.left+t.leftOffset-s/2,l+t.top+c,s,o)},renderSelection:function(t,e){for(var n=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,r=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,i=-1!==this.textAlign.indexOf("justify"),o=this.get2DCursorLocation(n),a=this.get2DCursorLocation(r),s=o.lineIndex,l=a.lineIndex,c=o.charIndex<0?0:o.charIndex,u=a.charIndex<0?0:a.charIndex,h=s;h<=l;h++){var d,f=this._getLineLeftOffset(h)||0,p=this.getHeightOfLine(h),g=0,m=0;if(h===s&&(g=this.__charBounds[s][c].left),h>=s&&h<l)m=i&&!this.isEndOfWrapping(h)?this.width:this.getLineWidth(h)||5;else if(h===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}d=p,(this.lineHeight<1||h===l&&this.lineHeight>1)&&(p/=this.lineHeight);var b=t.left+f+g,y=m-g,x=p,w=0;this.inCompositionMode?(e.fillStyle=this.compositionColor||"black",x=1,w=p):e.fillStyle=this.selectionColor,"rtl"===this.direction&&(b=this.width-b-y),e.fillRect(b,t.top+t.topOffset+w,y,x),t.topOffset+=d}},getCurrentCharFontSize:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fontSize")},getCurrentCharColor:function(){var t=this._getCurrentCharIndex();return this.getValueOfPropertyAt(t.l,t.c,"fill")},_getCurrentCharIndex:function(){var t=this.get2DCursorLocation(this.selectionStart,!0),e=t.charIndex>0?t.charIndex-1:0;return{l:t.lineIndex,c:e}}}),n.IText.fromObject=function(e,r){var i=n.util.stylesFromArray(e.styles,e.text),o=Object.assign({},e,{styles:i});if(t(o),o.styles)for(var a in o.styles)for(var s in o.styles[a])t(o.styles[a][s]);n.Object._fromObject("IText",o,r,"text")}}(),function(){var t=n.util.object.clone;n.util.object.extend(n.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 t=this;this.on("added",(function(){var e=t.canvas;e&&(e._hasITextHandlers||(e._hasITextHandlers=!0,t._initCanvasHandlers(e)),e._iTextInstances=e._iTextInstances||[],e._iTextInstances.push(t))}))},initRemovedHandler:function(){var t=this;this.on("removed",(function(){var e=t.canvas;e&&(e._iTextInstances=e._iTextInstances||[],n.util.removeFromArray(e._iTextInstances,t),0===e._iTextInstances.length&&(e._hasITextHandlers=!1,t._removeCanvasHandlers(e)))}))},_initCanvasHandlers:function(t){t._mouseUpITextHandler=function(){t._iTextInstances&&t._iTextInstances.forEach((function(t){t.__isMousedown=!1}))},t.on("mouse:up",t._mouseUpITextHandler)},_removeCanvasHandlers:function(t){t.off("mouse:up",t._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(t,e,n,r){var i;return i={isAborted:!1,abort:function(){this.isAborted=!0}},t.animate("_currentCursorOpacity",e,{duration:n,onComplete:function(){i.isAborted||t[r]()},onChange:function(){t.canvas&&t.selectionStart===t.selectionEnd&&t.renderCursorOrSelection()},abort:function(){return i.isAborted}}),i},_onTickComplete:function(){var t=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout((function(){t._currentTickCompleteState=t._animateCursor(t,0,this.cursorDuration/2,"_tick")}),100)},initDelayedCursor:function(t){var e=this,n=t?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout((function(){e._tick()}),n)},abortCursorAnimation:function(){var t=this._currentTickState||this._currentTickCompleteState,e=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,t&&e&&e.clearContext(e.contextTop||e.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(t){var e=0,n=t-1;if(this._reSpace.test(this._text[n]))for(;this._reSpace.test(this._text[n]);)e++,n--;for(;/\S/.test(this._text[n])&&n>-1;)e++,n--;return t-e},findWordBoundaryRight:function(t){var e=0,n=t;if(this._reSpace.test(this._text[n]))for(;this._reSpace.test(this._text[n]);)e++,n++;for(;/\S/.test(this._text[n])&&n<this._text.length;)e++,n++;return t+e},findLineBoundaryLeft:function(t){for(var e=0,n=t-1;!/\n/.test(this._text[n])&&n>-1;)e++,n--;return t-e},findLineBoundaryRight:function(t){for(var e=0,n=t;!/\n/.test(this._text[n])&&n<this._text.length;)e++,n++;return t+e},searchWordBoundary:function(t,e){for(var r=this._text,i=this._reSpace.test(r[t])?t-1:t,o=r[i],a=n.reNonWord;!a.test(o)&&i>0&&i<r.length;)o=r[i+=e];return a.test(o)&&(i+=1===e?0:1),i},selectWord:function(t){t=t||this.selectionStart;var e=this.searchWordBoundary(t,-1),n=this.searchWordBoundary(t,1);this.selectionStart=e,this.selectionEnd=n,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(t){t=t||this.selectionStart;var e=this.findLineBoundaryLeft(t),n=this.findLineBoundaryRight(t);return this.selectionStart=e,this.selectionEnd=n,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(t){if(!this.isEditing&&this.editable)return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(t),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(t){t._iTextInstances&&t._iTextInstances.forEach((function(t){t.selected=!1,t.isEditing&&t.exitEditing()}))},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(t){if(this.__isMousedown&&this.isEditing){document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus();var e=this.getSelectionStartFromPointer(t.e),n=this.selectionStart,r=this.selectionEnd;(e!==this.__selectionStartOnMouseDown||n===r)&&(n===e||r===e)||(e>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=e):(this.selectionStart=e,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==n||this.selectionEnd!==r)&&(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(t,e,r){var i=r.slice(0,t),o=n.util.string.graphemeSplit(i).length;if(t===e)return{selectionStart:o,selectionEnd:o};var a=r.slice(t,e);return{selectionStart:o,selectionEnd:o+n.util.string.graphemeSplit(a).length}},fromGraphemeToStringSelection:function(t,e,n){var r=n.slice(0,t).join("").length;return t===e?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+n.slice(t,e).join("").length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var t=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=t.selectionStart,this.hiddenTextarea.selectionEnd=t.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var t=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=t.selectionEnd,this.inCompositionMode||(this.selectionStart=t.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var t=this._calcTextareaPosition();this.hiddenTextarea.style.left=t.left,this.hiddenTextarea.style.top=t.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var t=this.inCompositionMode?this.compositionStart:this.selectionStart,e=this._getCursorBoundaries(t),r=this.get2DCursorLocation(t),i=r.lineIndex,o=r.charIndex,a=this.getValueOfPropertyAt(i,o,"fontSize")*this.lineHeight,s=e.leftOffset,l=this.calcTransformMatrix(),c={x:e.left+s,y:e.top+e.topOffset+a},u=this.canvas.getRetinaScaling(),h=this.canvas.upperCanvasEl,d=h.width/u,f=h.height/u,p=d-a,g=f-a,m=h.clientWidth/d,v=h.clientHeight/f;return c=n.util.transformPoint(c,l),(c=n.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 t=this._textBeforeEdit!==this.text,e=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,e&&(e.blur&&e.blur(),e.parentNode&&e.parentNode.removeChild(e)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),t&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),t&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var t in this.styles)this._textLines[t]||delete this.styles[t]},removeStyleFromTo:function(t,e){var n,r,i=this.get2DCursorLocation(t,!0),o=this.get2DCursorLocation(e,!0),a=i.lineIndex,s=i.charIndex,l=o.lineIndex,c=o.charIndex;if(a!==l){if(this.styles[a])for(n=s;n<this._unwrappedTextLines[a].length;n++)delete this.styles[a][n];if(this.styles[l])for(n=c;n<this._unwrappedTextLines[l].length;n++)(r=this.styles[l][n])&&(this.styles[a]||(this.styles[a]={}),this.styles[a][s+n-c]=r);for(n=a+1;n<=l;n++)delete this.styles[n];this.shiftLineStyles(l,a-l)}else if(this.styles[a]){r=this.styles[a];var u,h,d=c-s;for(n=s;n<c;n++)delete r[n];for(h in this.styles[a])(u=parseInt(h,10))>=c&&(r[u-d]=r[h],delete r[h])}},shiftLineStyles:function(e,n){var r=t(this.styles);for(var i in this.styles){var o=parseInt(i,10);o>e&&(this.styles[o+n]=r[o],r[o-n]||delete this.styles[o])}},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(e,n,r,i){var o,a={},s=!1,l=this._unwrappedTextLines[e].length===n;for(var c in r||(r=1),this.shiftLineStyles(e,r),this.styles[e]&&(o=this.styles[e][0===n?n:n-1]),this.styles[e]){var u=parseInt(c,10);u>=n&&(s=!0,a[u-n]=this.styles[e][c],l&&0===n||delete this.styles[e][c])}var h=!1;for(s&&!l&&(this.styles[e+r]=a,h=!0),h&&r--;r>0;)i&&i[r-1]?this.styles[e+r]={0:t(i[r-1])}:o?this.styles[e+r]={0:t(o)}:delete this.styles[e+r],r--;this._forceClearCache=!0},insertCharStyleObject:function(e,n,r,i){this.styles||(this.styles={});var o=this.styles[e],a=o?t(o):{};for(var s in r||(r=1),a){var l=parseInt(s,10);l>=n&&(o[l+r]=a[l],a[l-r]||delete o[l])}if(this._forceClearCache=!0,i)for(;r--;)!Object.keys(i[r]).length||(this.styles[e]||(this.styles[e]={}),this.styles[e][n+r]=t(i[r]));else if(o)for(var c=o[n?n-1:1];c&&r--;)this.styles[e][n+r]=t(c)},insertNewStyleBlock:function(t,e,n){for(var r=this.get2DCursorLocation(e,!0),i=[0],o=0,a=0;a<t.length;a++)"\n"===t[a]?i[++o]=0:i[o]++;i[0]>0&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,i[0],n),n=n&&n.slice(i[0]+1)),o&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+i[0],o);for(a=1;a<o;a++)i[a]>0?this.insertCharStyleObject(r.lineIndex+a,0,i[a],n):n&&this.styles[r.lineIndex+a]&&n[0]&&(this.styles[r.lineIndex+a][0]=n[0]),n=n&&n.slice(i[a]+1);i[a]>0&&this.insertCharStyleObject(r.lineIndex+a,0,i[a],n)},setSelectionStartEndWithShift:function(t,e,n){n<=t?(e===t?this._selectionDirection="left":"right"===this._selectionDirection&&(this._selectionDirection="left",this.selectionEnd=t),this.selectionStart=n):n>t&&n<e?"right"===this._selectionDirection?this.selectionEnd=n:this.selectionStart=n:(e===t?this._selectionDirection="right":"left"===this._selectionDirection&&(this._selectionDirection="right",this.selectionStart=e),this.selectionEnd=n)},setSelectionInBoundaries:function(){var t=this.text.length;this.selectionStart>t?this.selectionStart=t:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>t?this.selectionEnd=t:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),n.util.object.extend(n.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on("mousedown",this.onMouseDown)},onMouseDown:function(t){if(this.canvas){this.__newClickTime=+new Date;var e=t.pointer;this.isTripleClick(e)&&(this.fire("tripleclick",t),this._stopEvent(t.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=e,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(t){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===t.x&&this.__lastPointer.y===t.y},_stopEvent:function(t){t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(t){!this.isEditing||this.selectWord(this.getSelectionStartFromPointer(t.e))},tripleClickHandler:function(t){!this.isEditing||this.selectLine(this.getSelectionStartFromPointer(t.e))},initClicks:function(){this.on("mousedblclick",this.doubleClickHandler),this.on("tripleclick",this.tripleClickHandler)},_mouseDownHandler:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.e.button||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(t.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(t){!this.canvas||!this.editable||t.e.button&&1!==t.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(t){if(this.__isMousedown=!1,!(!this.editable||this.group||t.transform&&t.transform.actionPerformed||t.e.button&&1!==t.e.button)){if(this.canvas){var e=this.canvas._activeObject;if(e&&e!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(t.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(t){var e=this.getSelectionStartFromPointer(t),n=this.selectionStart,r=this.selectionEnd;t.shiftKey?this.setSelectionStartEndWithShift(n,r,e):(this.selectionStart=e,this.selectionEnd=e),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(t){for(var e,n=this.getLocalPointer(t),r=0,i=0,o=0,a=0,s=0,l=0,c=this._textLines.length;l<c&&o<=n.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,e=this._textLines[s],"rtl"===this.direction&&(n.x=this.width*this.scaleX-n.x+i);for(var u=0,h=e.length;u<h&&(r=i,(i+=this.__charBounds[s][u].kernedWidth*this.scaleX)<=n.x);u++)a++;return this._getNewSelectionStartFromOffset(n,r,i,a,h)},_getNewSelectionStartFromOffset:function(t,e,n,r,i){var o=t.x-e,a=n-t.x,s=r+(a>o||a<0?0:1);return this.flipX&&(s=i-s),s>this._text.length&&(s=this._text.length),s}}),n.util.object.extend(n.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=n.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 t=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+t.top+"; left: "+t.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding\uff70top: "+t.fontSize+";",this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):n.document.body.appendChild(this.hiddenTextarea),n.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this)),n.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this)),n.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this)),n.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this)),n.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this)),n.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this)),n.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this)),n.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this)),n.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(n.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(t){if(this.isEditing){var e="rtl"===this.direction?this.keysMapRtl:this.keysMap;if(t.keyCode in e)this[e[t.keyCode]](t);else{if(!(t.keyCode in this.ctrlKeysMapDown)||!t.ctrlKey&&!t.metaKey)return;this[this.ctrlKeysMapDown[t.keyCode]](t)}t.stopImmediatePropagation(),t.preventDefault(),t.keyCode>=33&&t.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(t){!this.isEditing||this._copyDone||this.inCompositionMode?this._copyDone=!1:t.keyCode in this.ctrlKeysMapUp&&(t.ctrlKey||t.metaKey)&&(this[this.ctrlKeysMapUp[t.keyCode]](t),t.stopImmediatePropagation(),t.preventDefault(),this.canvas&&this.canvas.requestRenderAll())},onInput:function(t){var e=this.fromPaste;if(this.fromPaste=!1,t&&t.stopPropagation(),this.isEditing){var r,i,o,a,s,l=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,c=this._text.length,u=l.length,h=u-c,d=this.selectionStart,f=this.selectionEnd,p=d!==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=d>g.selectionStart;p?(r=this._text.slice(d,f),h+=f-d):u<c&&(r=m?this._text.slice(f+h,f):this._text.slice(d,d-h)),i=l.slice(g.selectionEnd-h,g.selectionEnd),r&&r.length&&(i.length&&(o=this.getSelectionStyles(d,d+1,!1),o=i.map((function(){return o[0]}))),p?(a=d,s=f):m?(a=f-r.length,s=f):(a=f,s=f+r.length),this.removeStyleFromTo(a,s)),i.length&&(e&&i.join("")===n.copiedText&&!n.disableStyleCopyPaste&&(o=n.copiedTextStyle),this.insertNewStyleBlock(i,d,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(t){this.compositionStart=t.target.selectionStart,this.compositionEnd=t.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(n.copiedText=this.getSelectedText(),n.disableStyleCopyPaste?n.copiedTextStyle=null:n.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(t){return t&&t.clipboardData||n.window.clipboardData},_getWidthBeforeCursor:function(t,e){var n,r=this._getLineLeftOffset(t);return e>0&&(r+=(n=this.__charBounds[t][e-1]).left+n.width),r},getDownCursorOffset:function(t,e){var n=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(n),i=r.lineIndex;if(i===this._textLines.length-1||t.metaKey||34===t.keyCode)return this._text.length-n;var o=r.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(t,e){return t.shiftKey&&this.selectionStart!==this.selectionEnd&&e?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(t,e){var n=this._getSelectionForOffset(t,e),r=this.get2DCursorLocation(n),i=r.lineIndex;if(0===i||t.metaKey||33===t.keyCode)return-n;var o=r.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(t,e){for(var n,r,i=this._textLines[t],o=this._getLineLeftOffset(t),a=0,s=0,l=i.length;s<l;s++)if((o+=n=this.__charBounds[t][s].width)>e){r=!0;var c=o-n,u=o,h=Math.abs(c-e);a=Math.abs(u-e)<h?s:s-1;break}return r||(a=i.length-1),a},moveCursorDown:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",t)},moveCursorUp:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorUpOrDown("Up",t)},_moveCursorUpOrDown:function(t,e){var n=this["get"+t+"CursorOffset"](e,"right"===this._selectionDirection);e.shiftKey?this.moveCursorWithShift(n):this.moveCursorWithoutShift(n),0!==n&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(t){var e="left"===this._selectionDirection?this.selectionStart+t:this.selectionEnd+t;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,e),0!==t},moveCursorWithoutShift:function(t){return t<0?(this.selectionStart+=t,this.selectionEnd=this.selectionStart):(this.selectionEnd+=t,this.selectionStart=this.selectionEnd),0!==t},moveCursorLeft:function(t){0===this.selectionStart&&0===this.selectionEnd||this._moveCursorLeftOrRight("Left",t)},_move:function(t,e,n){var r;if(t.altKey)r=this["findWordBoundary"+n](this[e]);else{if(!t.metaKey&&35!==t.keyCode&&36!==t.keyCode)return this[e]+="Left"===n?-1:1,!0;r=this["findLineBoundary"+n](this[e])}if(typeof r<"u"&&this[e]!==r)return this[e]=r,!0},_moveLeft:function(t,e){return this._move(t,e,"Left")},_moveRight:function(t,e){return this._move(t,e,"Right")},moveCursorLeftWithoutShift:function(t){var e=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&0!==this.selectionStart&&(e=this._moveLeft(t,"selectionStart")),this.selectionEnd=this.selectionStart,e},moveCursorLeftWithShift:function(t){return"right"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveLeft(t,"selectionEnd"):0!==this.selectionStart?(this._selectionDirection="left",this._moveLeft(t,"selectionStart")):void 0},moveCursorRight:function(t){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",t)},_moveCursorLeftOrRight:function(t,e){var n="moveCursor"+t+"With";this._currentCursorOpacity=1,e.shiftKey?n+="Shift":n+="outShift",this[n](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(t){return"left"===this._selectionDirection&&this.selectionStart!==this.selectionEnd?this._moveRight(t,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(t,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(t){var e=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(e=this._moveRight(t,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,e},removeChars:function(t,e){typeof e>"u"&&(e=t+1),this.removeStyleFromTo(t,e),this._text.splice(t,e-t),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(t,e,r,i){typeof i>"u"&&(i=r),i>r&&this.removeStyleFromTo(r,i);var o=n.util.string.graphemeSplit(t);this.insertNewStyleBlock(o,r,e),this._text=[].concat(this._text.slice(0,r),o,this._text.slice(i)),this.text=this._text.join(""),this.set("dirty",!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var t=n.util.toFixed,e=/ +/g;n.util.object.extend(n.Text.prototype,{_toSVG:function(){var t=this._getSVGLeftTopOffsets(),e=this._getSVGTextAndBg(t.textTop,t.textLeft);return this._wrapSVGTextAndBg(e)},toSVG:function(t){return this._createBaseSVGMarkup(this._toSVG(),{reviver:t,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(t){var e=this.getSvgTextDecoration(this);return[t.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+'" ':"",e?'text-decoration="'+e+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",t.textSpans.join(""),"</text>\n"]},_getSVGTextAndBg:function(t,e){var n,r=[],i=[],o=t;this._setSVGBg(i);for(var a=0,s=this._textLines.length;a<s;a++)n=this._getLineLeftOffset(a),(this.textBackgroundColor||this.styleHas("textBackgroundColor",a))&&this._setSVGTextLineBg(i,a,e+n,o),this._setSVGTextLineText(r,a,e+n,o),o+=this.getHeightOfLine(a);return{textSpans:r,textBgRects:i}},_createTextCharSpan:function(r,i,o,a){var s=r!==r.trim()||r.match(e),l=this.getSvgSpanStyles(i,s),c=l?'style="'+l+'"':"",u=i.deltaY,h="",d=n.Object.NUM_FRACTION_DIGITS;return u&&(h=' dy="'+t(u,d)+'" '),['<tspan x="',t(o,d),'" y="',t(a,d),'" ',h,c,">",n.util.string.escapeXml(r),"</tspan>"].join("")},_setSVGTextLineText:function(t,e,r,i){var o,a,s,l,c,u=this.getHeightOfLine(e),h=-1!==this.textAlign.indexOf("justify"),d="",f=0,p=this._textLines[e];i+=u*(1-this._fontSizeFraction)/this.lineHeight;for(var g=0,m=p.length-1;g<=m;g++)c=g===m||this.charSpacing,d+=p[g],s=this.__charBounds[e][g],0===f?(r+=s.kernedWidth-s.width,f+=s.width):f+=s.kernedWidth,h&&!c&&this._reSpaceAndTab.test(p[g])&&(c=!0),c||(o=o||this.getCompleteStyleDeclaration(e,g),a=this.getCompleteStyleDeclaration(e,g+1),c=n.util.hasStyleChanged(o,a,!0)),c&&(l=this._getStyleDeclaration(e,g)||{},t.push(this._createTextCharSpan(d,l,r,i)),d="",o=a,r+=f,f=0)},_pushTextBgRect:function(e,r,i,o,a,s){var l=n.Object.NUM_FRACTION_DIGITS;e.push("\t\t<rect ",this._getFillAttributes(r),' x="',t(i,l),'" y="',t(o,l),'" width="',t(a,l),'" height="',t(s,l),'"></rect>\n')},_setSVGTextLineBg:function(t,e,n,r){for(var i,o,a=this._textLines[e],s=this.getHeightOfLine(e)/this.lineHeight,l=0,c=0,u=this.getValueOfPropertyAt(e,0,"textBackgroundColor"),h=0,d=a.length;h<d;h++)i=this.__charBounds[e][h],(o=this.getValueOfPropertyAt(e,h,"textBackgroundColor"))!==u?(u&&this._pushTextBgRect(t,u,n+c,r,l,s),c=i.left,l=i.width,u=o):l+=i.kernedWidth;o&&this._pushTextBgRect(t,o,n+c,r,l,s)},_getFillAttributes:function(t){var e=t&&"string"==typeof t?new n.Color(t):"";return e&&e.getSource()&&1!==e.getAlpha()?'opacity="'+e.getAlpha()+'" fill="'+e.setAlpha(1).toRgb()+'"':'fill="'+t+'"'},_getSVGLineTopOffset:function(t){for(var e,n=0,r=0;r<t;r++)n+=this.getHeightOfLine(r);return e=this.getHeightOfLine(r),{lineTop:n,offset:(this._fontSizeMult-this._fontSizeFraction)*e/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(t){return n.Object.prototype.getSvgStyles.call(this,t)+" white-space: pre;"}})}(),function(t){var e=t.fabric||(t.fabric={});e.Textbox=e.util.createClass(e.IText,e.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:e.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(t){for(var e=0,n=0,r=0,i={},o=0;o<t.graphemeLines.length;o++)"\n"===t.graphemeText[r]&&o>0?(n=0,r++,e++):!this.splitByGrapheme&&this._reSpaceAndTab.test(t.graphemeText[r])&&o>0&&(n++,r++),i[o]={line:e,offset:n},r+=t.graphemeLines[o].length,n+=t.graphemeLines[o].length;return i},styleHas:function(t,n){if(this._styleMap&&!this.isWrapping){var r=this._styleMap[n];r&&(n=r.line)}return e.Text.prototype.styleHas.call(this,t,n)},isEmptyStyles:function(t){if(!this.styles)return!0;var e,n,r=0,i=!1,o=this._styleMap[t],a=this._styleMap[t+1];for(var s in o&&(t=o.line,r=o.offset),a&&(i=a.line===t,e=a.offset),n=typeof t>"u"?this.styles:{line:this.styles[t]})for(var l in n[s])if(l>=r&&(!i||l<e))for(var c in n[s][l])return!1;return!0},_getStyleDeclaration:function(t,e){if(this._styleMap&&!this.isWrapping){var n=this._styleMap[t];if(!n)return null;t=n.line,e=n.offset+e}return this.callSuper("_getStyleDeclaration",t,e)},_setStyleDeclaration:function(t,e,n){var r=this._styleMap[t];t=r.line,e=r.offset+e,this.styles[t][e]=n},_deleteStyleDeclaration:function(t,e){var n=this._styleMap[t];t=n.line,e=n.offset+e,delete this.styles[t][e]},_getLineStyle:function(t){var e=this._styleMap[t];return!!this.styles[e.line]},_setLineStyle:function(t){var e=this._styleMap[t];this.styles[e.line]={}},_wrapText:function(t,e){var n,r=[];for(this.isWrapping=!0,n=0;n<t.length;n++)r=r.concat(this._wrapLine(t[n],n,e));return this.isWrapping=!1,r},_measureWord:function(t,e,n){var r,i=0;n=n||0;for(var o=0,a=t.length;o<a;o++){i+=this._getGraphemeBox(t[o],e,o+n,r,true).kernedWidth,r=t[o]}return i},_wrapLine:function(t,n,r,i){var o=0,a=this.splitByGrapheme,s=[],l=[],c=a?e.util.string.graphemeSplit(t):t.split(this._wordJoiners),u="",h=0,d=a?"":" ",f=0,p=0,g=0,m=!0,v=this._getWidthOfCharSpacing();i=i||0;0===c.length&&c.push([]),r-=i;for(var b=0;b<c.length;b++)u=a?c[b]:e.util.string.graphemeSplit(c[b]),f=this._measureWord(u,n,h),h+=u.length,(o+=p+f-v)>r&&!m?(s.push(l),l=[],o=f,m=!0):o+=v,!m&&!a&&l.push(d),l=l.concat(u),p=a?0:this._measureWord([d],n,h),h++,m=!1,f>g&&(g=f);return b&&s.push(l),g+i>this.dynamicMinWidth&&(this.dynamicMinWidth=g-v+i),s},isEndOfWrapping:function(t){return!this._styleMap[t+1]||this._styleMap[t+1].line!==this._styleMap[t].line},missingNewlineOffset:function(t){return this.splitByGrapheme?this.isEndOfWrapping(t)?1:0:1},_splitTextIntoLines:function(t){for(var n=e.Text.prototype._splitTextIntoLines.call(this,t),r=this._wrapText(n.lines,this.width),i=new Array(r.length),o=0;o<r.length;o++)i[o]=r[o].join("");return n.lines=i,n.graphemeLines=r,n},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var t={};for(var e in this._styleMap)this._textLines[e]&&(t[this._styleMap[e].line]=1);for(var e in this.styles)t[e]||delete this.styles[e]},toObject:function(t){return this.callSuper("toObject",["minWidth","splitByGrapheme"].concat(t))}}),e.Textbox.fromObject=function(t,n){var r=e.util.stylesFromArray(t.styles,t.text),i=Object.assign({},t,{styles:r});return e.Object._fromObject("Textbox",i,n,"text")}}(t),function(){var t=n.controlsUtils,e=t.scaleSkewCursorStyleHandler,r=t.scaleCursorStyleHandler,i=t.scalingEqually,o=t.scalingYOrSkewingX,a=t.scalingXOrSkewingY,s=t.scaleOrSkewActionName,l=n.Object.prototype.controls;if(l.ml=new n.Control({x:-.5,y:0,cursorStyleHandler:e,actionHandler:a,getActionName:s}),l.mr=new n.Control({x:.5,y:0,cursorStyleHandler:e,actionHandler:a,getActionName:s}),l.mb=new n.Control({x:0,y:.5,cursorStyleHandler:e,actionHandler:o,getActionName:s}),l.mt=new n.Control({x:0,y:-.5,cursorStyleHandler:e,actionHandler:o,getActionName:s}),l.tl=new n.Control({x:-.5,y:-.5,cursorStyleHandler:r,actionHandler:i}),l.tr=new n.Control({x:.5,y:-.5,cursorStyleHandler:r,actionHandler:i}),l.bl=new n.Control({x:-.5,y:.5,cursorStyleHandler:r,actionHandler:i}),l.br=new n.Control({x:.5,y:.5,cursorStyleHandler:r,actionHandler:i}),l.mtr=new n.Control({x:0,y:-.5,actionHandler:t.rotationWithSnapping,cursorStyleHandler:t.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:"rotate"}),n.Textbox){var c=n.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 n.Control({x:.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"}),c.ml=new n.Control({x:-.5,y:0,actionHandler:t.changeWidth,cursorStyleHandler:e,actionName:"resizing"})}}()}(Ud);const Xd={lockScalingFlip:!0,originY:"center",originX:"center",lockMovementX:!0,lockMovementY:!0,borderColor:"transparent"};function Gd(t=36){let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let r=0;r<t;r+=1)e+=n.charAt(Math.floor(62*Math.random()));return e}let $d=null;function qd(t){$d=t}class Kd{constructor(){c(this,"maxZoom",2),c(this,"minZoom",1),c(this,"step",.05),this.allowUserZoom&&this.bindMouseWheel(),Ea.subscribe((t=>t.stageSize),(()=>{setTimeout((()=>{this.fitToScreen()}),1)}))}get allowUserZoom(){var t,e,n,r;return null==(r=null==(n=null==(e=null==(t=Oa().config)?void 0:t.tools)?void 0:e.zoom)?void 0:n.allowUserZoom)||r}get currentZoom(){return Oa().zoom}zoomIn(t=this.step){this.set(this.currentZoom+t)}canZoomIn(t=this.step){return this.currentZoom+t<=this.maxZoom}canZoomOut(t=this.step){return this.currentZoom-t>=this.minZoom}zoomOut(t=this.step){this.set(this.currentZoom-t)}set(t,e=!0){if(t<this.minZoom||t>this.maxZoom)return;const n=P.round(Oa().original.width*t,0),r=P.round(Oa().original.height*t,0);Pa().setZoom(t),e&&Pa().setDimensions({width:n,height:r}),Oa().setZoom(t)}fitToScreen(){var t,e;if(null==(e=null==(t=Oa().config.tools)?void 0:t.zoom)||!e.fitImageToScreen)return;const{width:n,height:r}=Oa().stageSize,i=Math.max(r,1),o=Math.max(n,1);if(Oa().original.height>i||Oa().original.width>o){const t=Math.min(i/Oa().original.height,o/Oa().original.width);this.minZoom=Math.min(t,1)}else this.minZoom=1;this.set(this.minZoom)}bindMouseWheel(){Pa().on("mouse:wheel",(t=>{t.e.preventDefault(),t.e.stopPropagation(),null==$d&&(t.e.deltaY<0?this.zoomIn():this.zoomOut())}))}}function Zd(t){return new Promise((e=>{Ud.fabric.util.loadImage(t,(t=>e(new Ud.fabric.Image(t))),null,Oa().config.crossOrigin?"anonymous":void 0)}))}class Jd{constructor(){c(this,"minWidth",50),c(this,"minHeight",50)}resize(t,e,{applyZoom:n=!1,resizeHelper:r=!0}={}){const i=Oa().zoom;Pa().setWidth(t*(n?i:1)),Pa().setHeight(e*(n?i:1)),Oa().setOriginal(t,e),r&&Ma().transform.resetStraightenAnchor()}async addMainImage(t,e="mainImage"){var n,r;Oa().toggleLoading(e);const i=await Zd(t);if(i)return this.clear(),i.set(Da),i.name=ko.MainImage,Pa().add(i),this.resize(i.width,i.height),i.center(),i.setCoords(),Ma().zoom.fitToScreen(),Oa().toggleLoading(!1),null==(r=(n=Oa().config).onMainImageLoaded)||r.call(n,i),i}openNew(t,e,n){return t=Math.max(this.minWidth,t),e=Math.max(this.minHeight,e),this.clear(),this.resize(t,e),Pa().backgroundColor=n,Ma().zoom.fitToScreen(),Oa().toggleLoading("newCanvas"),requestAnimationFrame((()=>{Oa().toggleLoading(!1)})),Promise.resolve({width:t,height:e})}getMainImage(){return Pa().getObjects().find((t=>t.name===ko.MainImage))}render(){Pa().requestRenderAll()}async loadInitialContent(){var t,e;const n=Oa().config.image,r=Oa().config.blankCanvasSize,i=Oa().config.state;if(n&&n.endsWith("json")){const t=await ja(n);await Ma().import.loadState(t)}else n&&n.startsWith('{"canvas')?await Ma().import.loadState(n):n?await this.addMainImage(n):i?await Ma().import.loadState(i):r&&await this.openNew(r.width,r.height);return za()&&(null==(e=null==(t=Oa().config.ui)?void 0:t.openImageDialog)?void 0:e.show)&&Oa().togglePanel("newImage",!0),new Promise((t=>{setTimeout((()=>{Ma().history.addInitial(),t()}),10)}))}clear(){Pa().clear(),Ma().frame.remove(),Ma().transform.resetStraightenAnchor()}}const Qd=["fontSize","fontFamily","left","top","width","height","scaleX","scaleY","flipX","flipY","angle","src","strokeWidth"];function tf(t={}){Pa().fire("object:modified",function(t){return{values:t,sizeOrPositionChanged:ef(t)}}(t))}function ef(t){return Object.keys(t).some((t=>Qd.includes(t)))}function nf(t){var e,n;const[r]=La(null==(e=t.selected)?void 0:e[0]),i=r===Oa().activeTool;return!(!Oa().dirty||null!=(n=t.selected)&&n[0]&&i)&&(t.deselected&&Ma().objects.select(t.deselected[0]),!0)}function rf(t){(null==t?void 0:t.data.id)!==Oa().objects.active.id&&(Oa().objects.setActive(null!=t?t:null),Oa().activeTool!==vr.DRAW&&Ia())}class of{constructor(){this.syncObjects(),Oa().fabric.on("selection:created",(t=>{var e;(null==(e=t.selected)?void 0:e[0])&&!nf(t)&&rf(t.selected[0])})),Oa().fabric.on("selection:updated",(t=>{var e;nf(t)||rf(null==(e=t.selected)?void 0:e[0])})),Oa().fabric.on("selection:cleared",(()=>{rf()})),Oa().fabric.on("text:editing:entered",(()=>{Oa().objects.setIsEditingText(!0)})),Oa().fabric.on("text:editing:exited",(()=>{Oa().objects.setIsEditingText(!1)})),Oa().fabric.on("object:added",(()=>{this.syncObjects()})),Oa().fabric.on("object:removed",(()=>{this.syncObjects()}))}getAll(){return Pa().getObjects().filter((t=>{var e;return!(null!=(e=null==t?void 0:t.data)&&e.pixieInternal)}))}get(t){return this.getAll().find((e=>e.name===t))}getById(t){return this.getAll().find((e=>e.data.id===t))}isActive(t){var e;const n="string"==typeof t?t:t.data.id;return(null==(e=Oa().objects.active)?void 0:e.id)===n}getActive(){return Pa().getActiveObject()}has(t){return this.getAll().findIndex((e=>e.name===t))>-1}select(t){const e="string"==typeof t?this.getById(t):t;!e||(Pa().setActiveObject(e),Pa().requestRenderAll())}deselectActive(){Pa().discardActiveObject(),Pa().requestRenderAll()}setValues(t,e){if(!(e=e||this.getActive()))return;let n=!1;(function(t){return t.name===ko.Sticker&&"forEachObject"in t})(e)&&t.fill!==e.fill&&e.forEachObject((e=>e.set("fill",t.fill))),Co(e)?((t.fontFamily!==e.fontFamily||t.fontSize!==e.fontSize)&&(n=!0),e.selectionStart!==e.selectionEnd?e.setSelectionStyles(t):e.set(t)):e.set(t),n?setTimeout((()=>{Pa().requestRenderAll()}),50):Pa().requestRenderAll(),Oa().objects.setActive(e),tf(t)}move(t,e=1,n){(n=n||this.getActive())&&("up"===t?this.setValues({top:n.top-e}):"down"===t?this.setValues({top:n.top+e}):"left"===t?this.setValues({left:n.left-e}):"right"===t&&this.setValues({left:n.left+e}),Ma().canvas.render())}bringToFront(t){(t=t||this.getActive())&&(t.bringToFront(),Ma().canvas.render())}sendToBack(t){(t=t||this.getActive())&&(t.sendToBack(),Ma().canvas.render())}flipHorizontally(t){(t=t||this.getActive())&&(this.setValues({flipX:!t.flipX}),Ma().canvas.render())}duplicate(t){const e=t||this.getActive();!e||(this.deselectActive(),e.clone((t=>{t.set({left:e.left+40,top:e.top+40,data:{...e.data,id:Gd(10)},name:e.name}),Pa().add(t),this.select(t),Ma().canvas.render()})))}delete(t){(t=t||this.getActive())&&(this.deselectActive(),Pa().remove(t),Pa().requestRenderAll(),Ma().history.addHistoryItem({name:"deletedObject"}))}syncObjects(){const t=this.getAll().map((t=>{var e;return{name:t.name,selectable:null!=(e=t.selectable)&&e,id:t.data.id}}));Ea.setState({objects:{...Oa().objects,all:t}})}}const af={frame:null,fonts:[]};function sf(t){return t.state||(t.state=Ra()),{...t.state||Ra(),name:t.name,id:Gd(15)}}class lf{constructor(){c(this,"minWidth",250)}add(t,e={}){var n,r,i;if(!(t=t||(null==(r=null==(n=Oa().config.tools)?void 0:n.text)?void 0:r.defaultText)))return;const o={...null==(i=Oa().config.objectDefaults)?void 0:i.text,...e,name:ko.Text,padding:15,editingBorderColor:fr.fill},a=new Ud.fabric.IText(t,o);Pa().add(a),this.autoPositionText(a),Ma().objects.select(a)}autoPositionText(t){const e=Pa().getWidth(),n=Pa().getHeight(),r=Math.min(Pa().getWidth(),this.minWidth);t.scaleToWidth(Math.max(e/3,r)),t.getScaledHeight()>n&&t.scaleToHeight(n-t.getScaledHeight()-20),t.viewportCenter(),Pa().getObjects("i-text").forEach((e=>{if(e!==t&&e.intersectsWithObject(t)){const n=e.top-t.top+e.getScaledHeight();let r=t.top+n;r>Oa().original.height-e.getScaledHeight()&&(r=0),t.set("top",r),t.setCoords()}}))}selectOrAddText(t,e={}){if(Oa().objects.active.isText)return!1;const n=Ma().objects.getAll().find((t=>Co(t)));return n?(Ma().objects.select(n),!1):(this.add(t,e),!0)}}function cf(t,e){const n=t.map((async t=>{const n=Array.from(document.fonts.values()).find((e=>e.family===t.family));if(n)return n.loaded;const r=new FontFace(t.family,`url(${e?e(t.src):t.src})`,t.descriptors);return document.fonts.add(r),r.load()}));return Promise.all(n)}function uf(t){return t?function(t){return!!t&&/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(t)}(t)?t:`${Oa().config.baseUrl?`${Oa().config.baseUrl}/`:""}${t}`:""}class hf{async undo(){if(this.canUndo()){const t=Oa().history.items[Oa().history.pointer-1];await this.load(t)}}async redo(){if(this.canRedo()){const t=Oa().history.items[Oa().history.pointer+1];await this.load(t)}}canUndo(){return Oa().history.canUndo}canRedo(){return Oa().history.canRedo}reload(){return this.load(Oa().history.items[Oa().history.pointer])}replaceCurrent(){const t=Oa().history.items[Oa().history.pointer];[...Oa().history.items][Oa().history.pointer]=sf({name:t.name,state:t})}addHistoryItem(t){const e=sf(t),n=[...Oa().history.items.slice(0,Oa().history.pointer+1),e];Oa().history.update(n.length-1,n)}load(t){return t={...t,editor:t.editor||af},new Promise((e=>{cf(function(t){const e=[];return t.forEach((t=>{var n,r,i;if(!Co(t))return;const o=null==(i=null==(r=null==(n=Oa().config.tools)?void 0:n.text)?void 0:r.items)?void 0:i.find((e=>e.family===t.fontFamily));o&&e.push(o)})),e}(t.canvas.objects),uf).finally((()=>{Pa().loadFromJSON(t.canvas,(()=>{Ma().zoom.set(1),t.canvasWidth&&t.canvasHeight&&Ma().canvas.resize(t.canvasWidth,t.canvasHeight,{resizeHelper:!1,applyZoom:!1}),Ma().frame.remove(),t.editor.frame&&Ma().frame.add(t.editor.frame.name,t.editor.frame.sizePercent),Ma().objects.syncObjects(),Ma().objects.getAll().forEach((t=>{if(!t.data.pixieInternal&&"left"===t.originX&&"top"===t.originY){const e=t.getPointByOrigin("center","center");t.set("left",e.x),t.set("top",e.y)}t.set({...Xd}),"i-text"===t.type&&(t.padding=15)})),Ma().canvas.render(),Pa().calcOffset(),Ma().zoom.fitToScreen(),Oa().history.updatePointerById(t.id),Ma().transform.resetStraightenAnchor(),e()}))}))}))}addInitial(t){!Oa().history.items.find((t=>"initial"===t.name))&&(t||!za())&&this.addHistoryItem({name:"initial",state:t})}}class df{canMerge(){return Ma().objects.getAll().filter((t=>t.name!==ko.MainImage)).length>0}async apply(){Oa().toggleLoading("merge");const t=Ma().export.getDataUrl();t&&await Ma().canvas.addMainImage(t,"merge")}}const ff=[{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:t=>{t.gamma=[t.red,t.green,t.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"}}}],pf={grayscale:ur("grayscale"),blackWhite:ur("Black & White"),sharpen:ur("Sharpen"),invert:ur("Invert"),vintage:ur("Vintage"),polaroid:ur("Polaroid"),kodachrome:ur("Kodachrome"),technicolor:ur("Technicolor"),brownie:ur("Brownie"),sepia:ur("Sepia"),removeColor:ur("Remove Color"),brightness:ur("Brightness"),gamma:ur("Gamma"),noise:ur("Noise"),pixelate:ur("Pixelate"),blur:ur("Blur"),emboss:ur("Emboss"),blendColor:ur("Blend Color")},gf={distance:ur("distance"),color:ur("color"),brightness:ur("brightness"),red:ur("red"),green:ur("green"),blue:ur("blue"),noise:ur("noise"),blocksize:ur("blocksize"),mode:ur("mode"),alpha:ur("alpha")};function mf(t){return t&&t.charAt(0).toUpperCase()+t.slice(1)}class vf{constructor(){Ea.subscribe((t=>t.history.pointer),(()=>{this.syncState()}))}apply(t){Oa().filter.select(t,this.hasOptions(t));const e=this.getByName(t);if(this.isApplied(e.name))return void this.remove(e.name);const n=this.create(e);this.getImages().forEach((t=>{var e;null==(e=t.filters)||e.push(n),t.applyFilters()})),this.syncState(),Ma().canvas.render()}remove(t){Oa().filter.deselect(t);const e=this.getByName(t);this.getImages().forEach((t=>{var n;const r=this.findFilterIndex(e.name,t.filters);null==(n=t.filters)||n.splice(r,1),t.applyFilters()})),this.syncState(),Ma().canvas.render()}getAll(){return ff}getByName(t){return ff.find((e=>e.name===t))}isApplied(t){const e=Ma().canvas.getMainImage();return!!e&&this.findFilterIndex(t,e.filters)>-1}applyValue(t,e,n){const r=this.getByName(t);this.getImages().forEach((t=>{const i=(t.filters||[]).find((t=>t.type.toLowerCase()===r.name.toLowerCase()));!i||(i[e]=n,r.apply&&r.apply(i,e,n),t.applyFilters())})),Ma().canvas.render()}addCustom(t,e,n,r){const i=Ud.fabric.Image.filters;i[mf(t)]=Ud.fabric.util.createClass(i.BaseFilter,e),i[mf(t)].fromObject=i.BaseFilter.fromObject,ff.push({name:t,options:n,initialConfig:r})}create(t){const e=t.initialConfig||{};let n;return t.uses?(e.matrix=t.matrix,n=new(Ud.fabric.Image.filters[mf(t.uses)])(e)):(Object.entries(t.options||{}).forEach((([t,n])=>{e[t]=n.current})),n=new(Ud.fabric.Image.filters[mf(t.name)])(e)),n.name=t.name,n}hasOptions(t){return!!this.getByName(t).options}findFilterIndex(t,e){if(null==e||!e.length)return-1;const n=this.getByName(t);return e.findIndex((t=>this.configMatchesFabricFilter(n,t)))}syncState(){var t;const e=[];((null==(t=this.getImages()[0])?void 0:t.filters)||[]).forEach((t=>{const n=this.getByFabricFilter(t);n&&e.push(n.name)})),Ea.setState({filter:{...Oa().filter,applied:e}})}getByFabricFilter(t){return ff.find((e=>this.configMatchesFabricFilter(e,t)))}configMatchesFabricFilter(t,e){const n=e.type.toLowerCase().replace(" ","");return n===t.fabricType||n===t.name||"convolute"===n&&this.matrixAreEqual(t.matrix,e.matrix)}matrixAreEqual(t,e){if(!t||!e||t.length!==e.length)return!1;for(let n=t.length;n--;)if(t[n]!==e[n])return!1;return!0}getImages(){return Ma().objects.getAll().filter((t=>t.name===ko.Image||ko.MainImage))}}function bf(t){var e,n;const r=(null==(n=null==(e=Oa().config.tools)?void 0:e.resize)?void 0:n.minWidth)||50;return t?Math.ceil(100*r/Oa().original.width):r}function yf(t){var e,n;const r=(null==(n=null==(e=Oa().config.tools)?void 0:e.resize)?void 0:n.maxWidth)||2400;return t?Math.ceil(100*r/Oa().original.width):r}function xf(t){var e,n;const r=(null==(n=null==(e=Oa().config.tools)?void 0:e.resize)?void 0:n.minHeight)||50;return t?Math.ceil(100*r/Oa().original.height):r}function wf(t){var e,n;const r=(null==(n=null==(e=Oa().config.tools)?void 0:e.resize)?void 0:n.maxHeight)||2400;return t?Math.ceil(100*r/Oa().original.height):r}function _f(t,e){if(e)return t;const n=Oa().original.height/t;return Math.floor(Oa().original.width/n)}function Sf(t,e){if(e)return t;const n=Oa().original.width/t;return Math.floor(Oa().original.height/n)}class Cf{apply(t){const{width:e,height:n,usePercentages:r}=function(t){return t.width<bf(t.usePercentages)&&(t.width=bf(t.usePercentages),t.maintainAspect&&(t.height=Sf(t.width,t.usePercentages))),t.width>yf(t.usePercentages)&&(t.width=yf(t.usePercentages),t.maintainAspect&&(t.height=Sf(t.width,t.usePercentages))),t.height<xf(t.usePercentages)&&(t.height=xf(t.usePercentages),t.maintainAspect&&(t.width=_f(t.height,t.usePercentages))),t.height>wf(t.usePercentages)&&(t.height=wf(t.usePercentages),t.maintainAspect&&(t.width=_f(t.height,t.usePercentages))),t}(t),i=Math.ceil(Oa().original.width),o=Math.ceil(Oa().original.height),a=Math.ceil(e),s=Math.ceil(n);let l,c;r?(l=e/100,c=n/100):(l=e/Oa().original.width,c=n/Oa().original.height),(i!==a||o!==s)&&this.resize(l,c)}resize(t,e){Ma().zoom.set(1,!1);const n=Math.round(Oa().original.height*e),r=Math.round(Oa().original.width*t);Ma().canvas.resize(r,n,{applyZoom:!1,resizeHelper:!0}),Ma().objects.getAll().forEach((n=>{const r=n.scaleX||1,i=n.scaleY||1,o=n.left||0,a=n.top||0,s=r*t,l=i*e,c=o*t,u=a*e;n.scaleX=s,n.scaleY=l,n.left=c,n.top=u,n.setCoords()})),Ma().zoom.fitToScreen(),Pa().requestRenderAll()}}function kf(t,e){null!==e.innerZone&&(function(t,e){e.innerZone.style.width=`${t.width}px`,e.innerZone.style.height=`${t.height}px`,e.innerZone.style.transform=`translate(${t.left}px, ${t.top}px)`}(t,e),function(t,e){const n=Oa().canvasSize.width,r=Oa().canvasSize.height;e.maskTop.style.height=`${t.top}px`,e.maskTop.style.width=`${n}px`,e.maskLeft.style.top=`${t.top}px`,e.maskLeft.style.height=`${t.height}px`,e.maskLeft.style.width=`${t.left}px`;const i=t.left+t.width;e.maskRight.style.left=`${i}px`,e.maskRight.style.top=`${t.top}px`,e.maskRight.style.height=`${t.height}px`,e.maskRight.style.width=n-i+"px",e.maskBottom.style.height=r-(t.top+t.height)+"px",e.maskBottom.style.width=`${n}px`}(t,e),function(t,e){const n=(t.width-2)/3;e.lineVer1.style.height=`${t.height}px`,e.lineVer1.style.transform=`translate(${n}px, 0)`,e.lineVer2.style.height=`${t.height}px`,e.lineVer2.style.transform=`translate(${2*n}px, 0)`;const r=(t.height-2)/3;e.lineHor1.style.width=`${t.width}px`,e.lineHor1.style.transform=`translate(0, ${r}px)`,e.lineHor2.style.width=`${t.width}px`,e.lineHor2.style.transform=`translate(0, ${2*r}px)`}(t,e))}function Tf(t,e,n){let r=e,i=n;return t&&(n*t>e?i=e/t:r=n*t),{width:Math.floor(r),height:Math.floor(i)}}function Ef(t){if(!t)return null;const e=t.split(":");return parseInt(e[0])/parseInt(e[1])}class Of{constructor(){c(this,"refs",null)}apply(t){var e;const n=null==(e=Ma().frame.active.config)?void 0:e.name,r=Ma().frame.active.currentSizeInPercent;return Ma().frame.active.hide(),Ma().merge.apply().then((()=>{Ma().canvas.resize(Math.round(t.width),Math.round(t.height),{applyZoom:!0,resizeHelper:!0});const e=Ma().canvas.getMainImage();e.cropX=Math.round(t.left),e.cropY=Math.round(t.top),e.width=Math.round(t.width),e.height=Math.round(t.height),e.viewportCenter(),n&&Ma().frame.add(n,r),Ma().zoom.fitToScreen(),Ma().canvas.render()}))}drawZone(t){var e;null!=(e=this.refs)&&e.current&&(Oa().crop.setCropzoneRect(t),kf(t,this.refs.current))}resetCropzone(t){const e=Oa().canvasSize,n=Ef(t);if(!e)return;Oa().crop.setAspectRatio(t);const r=function(t,e=null){const n={width:t.width,height:t.height,top:0,left:0,angle:0};if(e){const t=Tf(e,n.width,n.height);n.width=t.width,n.height=t.height}return n.left=(t.width-n.width)/2,n.top=(t.height-n.height)/2,n}(e,n);this.drawZone(r)}registerRefs(t){this.refs=t}}class Mf{getShapeByName(t){var e,n;const r=null==(n=null==(e=Oa().config.tools)?void 0:e.shapes)?void 0:n.items;return(null==r?void 0:r.find((e=>e.name===t)))||null}addBasicShape(t){var e;const n=this.getShapeByName(t);if(!n)return null;const{width:r,height:i,...o}=(null==(e=Oa().config.objectDefaults)?void 0:e.shape)||{},a={...o,...n.options};let s;if("circle"===n.name)s=new Ud.fabric.Circle({...a,radius:100});else if("ellipse"===n.name)s=new Ud.fabric.Ellipse({...a,rx:100,ry:50});else if("Path"===n.type)s=new Ud.fabric.Path(a.path,{displayName:n.name,...a});else{const t=n.type;s=new Ud.fabric[t]({...a,width:150,height:150})}return this.addAndPositionShape(s,ko.Shape,{width:r,height:i}),s}addSticker(t,e){var n,r,i;const o=null==(i=null==(r=null==(n=Oa().config.tools)?void 0:n.stickers)?void 0:r.items)?void 0:i.find((e=>e.name===t));if(!o)return Promise.resolve();if("svg"===o.type){const t=Pf(o,e);return this.addSvgSticker(t)}return this.addRegularSticker(o,e)}addRegularSticker(t,e){return new Promise((n=>{Ud.fabric.util.loadImage(Pf(t,e),(t=>{var e;const{width:r,height:i,...o}=(null==(e=Oa().config.objectDefaults)?void 0:e.sticker)||{},a=new Ud.fabric.Image(t,o);this.addAndPositionShape(a,ko.Sticker,{width:r,height:i}),n()}))}))}addSvgSticker(t,e=ko.Sticker){return new Promise((n=>{Ud.fabric.loadSVGFromURL(t,((t,r)=>{var i;const{width:o,height:a,...s}=(null==(i=Oa().config.objectDefaults)?void 0:i.sticker)||{},l=Ud.fabric.util.groupSVGElements(t,r);l.set(s),this.addAndPositionShape(l,e,{width:o,height:a}),n()}))}))}addAndPositionShape(t,e,{width:n}){t.name=e,t.scaleX=1,t.scaleY=1,Pa().add(t);const r=n||Oa().original.width*Oa().zoom/4;t.scaleToWidth(Math.min(150,r)),t.viewportCenter(),t.setCoords(),Ma().canvas.render(),Pa().setActiveObject(t)}}function Pf(t,e){return uf(`images/stickers/${t.name}/${e}.${t.type}`)}class Af{constructor(t){c(this,"patternCache",[]),this.activeFrame=t}fillParts(t){this.patternCache.forEach((e=>{this.fillPartWithPattern(e,t)}))}fillPartWithPattern(t,e){if(!this.activeFrame.parts)return;t.canvas=new Ud.fabric.StaticCanvas(null),t.canvas.add(t.img);const n=new Ud.fabric.Pattern({source:t.canvas.getElement(),repeat:"repeat"===e?"repeat":"no-repeat"});this.activeFrame.parts[t.name]&&this.activeFrame.parts[t.name].set("fill",n)}scale(t){if(!this.activeFrame.config||!this.patternCache)return;const e=this.activeFrame.config.mode;t/=Pa().getRetinaScaling(),this.patternCache.forEach((n=>{!this.activeFrame.parts||("top"===n.name||"bottom"===n.name?"stretch"===e?(this.scalePatternToWidth(n.img,this.activeFrame.parts.top.getScaledWidth()),this.scalePatternToHeight(n.img,t)):n.img.scaleToHeight(t):"left"===n.name||"right"===n.name?"stretch"===e?(this.scalePatternToWidth(n.img,t),this.scalePatternToHeight(n.img,this.activeFrame.parts.left.getScaledHeight())):n.img.scaleToWidth(t):"stretch"===e?(this.scalePatternToWidth(n.img,t),this.scalePatternToHeight(n.img,t)):n.img.scaleToWidth(t),n.canvas.setDimensions({width:n.img.getScaledWidth(),height:n.img.getScaledHeight()}))})),Ma().canvas.render()}scalePatternToWidth(t,e){if(!t.width)return;const n=t.getBoundingRect().width/t.getScaledWidth();t.set("scaleX",e/t.width/n),t.setCoords()}scalePatternToHeight(t,e){if(!t.height)return;const n=t.getBoundingRect().height/t.getScaledHeight();t.set("scaleY",e/t.height/n),t.setCoords()}load(t){const e=this.activeFrame.getPartNames().map((e=>new Promise((n=>{const r={...Da,originX:"left",originY:"top"};Oa().config.crossOrigin&&(r.crossOrigin="anonymous"),Ud.fabric.Image.fromURL(this.getPartUrl(t,e),(t=>{n({name:e,img:t})}),r)}))));return Promise.all(e).then((e=>{this.patternCache=e,this.fillParts(t.mode)}))}getPartUrl(t,e){return uf(`images/frames/${t.name}/${e}.png`)}}class jf{constructor(t,e){this.activeFrame=t,this.patterns=e}get defaultColor(){var t,e;return null==(e=null==(t=Oa().config.objectDefaults)?void 0:t.global)?void 0:e.fill}build(t,e){this.createParts(t),this.resize(e),this.activeFrame.config=t,"basic"!==t.mode?this.patterns.load(t).then((()=>{this.patterns.scale(e),Ma().canvas.render()})):Ma().canvas.render()}createParts(t){const e={};this.activeFrame.getPartNames().forEach((n=>{const r="basic"===t.mode?this.defaultColor:void 0;e[n]=new Ud.fabric.Rect({...Da,fill:r,originX:"left",originY:"top",name:`frame.rect.${n}`,objectCaching:!1,data:{pixieInternal:!0}}),Pa().add(e[n])})),this.activeFrame.parts=e}resize(t){const e=Oa().original.width,n=Oa().original.height,r=this.activeFrame,i=t;!r.parts||(r.parts.topLeft.set({width:i,height:i}),r.parts.topRight.set({left:e-r.parts.topLeft.getScaledWidth(),width:i,height:i}),r.parts.top.set({left:r.parts.topLeft.getScaledWidth()-1,width:e-r.parts.topLeft.getScaledWidth()-r.parts.topRight.getScaledWidth()+3,height:i}),r.parts.bottomLeft.set({top:n-r.parts.topLeft.getScaledHeight(),width:i,height:i}),r.parts.left.set({top:r.parts.topLeft.getScaledHeight()-1,width:i,height:n-r.parts.topLeft.getScaledHeight()-r.parts.bottomLeft.getScaledHeight()+3}),r.parts.bottomRight.set({left:e-r.parts.bottomLeft.getScaledWidth(),top:n-r.parts.topRight.getScaledWidth(),width:i,height:i}),r.parts.bottom.set({left:r.parts.top.left,top:n-r.parts.top.getScaledHeight(),width:r.parts.top.getScaledWidth(),height:i}),r.parts.right.set({left:e-r.parts.left.getScaledWidth(),top:r.parts.left.top,width:r.parts.left.width,height:r.parts.left.getScaledHeight()}))}}class Df{constructor(){c(this,"corners",["topLeft","topRight","bottomLeft","bottomRight"]),c(this,"sides",["top","right","bottom","left"]),c(this,"parts",null),c(this,"config",null),c(this,"currentSizeInPercent",100)}getPartNames(){return[...this.corners,...this.sides]}hide(){!this.parts||(Object.values(this.parts).forEach((t=>t.set({visible:!1}))),Ma().canvas.render())}show(){!this.parts||(Object.values(this.parts).forEach((t=>t.set({visible:!0}))),Ma().canvas.render())}remove(){!this.parts||(this.config=null,Object.values(this.parts).forEach((t=>{Pa().remove(t)})),this.parts=null,Ma().canvas.render())}is(t){return!!this.config&&this.config.name===t.name}changeColor(t){var e;"basic"!==(null==(e=this.config)?void 0:e.mode)||!this.parts||(Object.values(this.parts).forEach((e=>{e.set("fill",t)})),Ma().canvas.render())}getMinSize(){var t,e;return null!=(e=null==(t=this.config)?void 0:t.size.min)?e:1}getMaxSize(){var t,e;return null!=(e=null==(t=this.config)?void 0:t.size.max)?e:35}}class Rf{constructor(){c(this,"patterns"),c(this,"builder"),c(this,"active"),this.active=new Df,this.patterns=new Af(this.active),this.builder=new jf(this.active,this.patterns),Pa().on("object:added",(()=>{Object.values(this.active.parts||[]).forEach((t=>t.moveTo(98)))}))}add(t,e){const n=this.getByName(t);if(!n||this.active.is(n))return;this.active.remove(),this.active.currentSizeInPercent=null!=e?e:n.size.default;const r=this.calcFrameSizeInPixels(this.active.currentSizeInPercent);this.builder.build(n,r),Oa().frame.select(n)}resize(t){if(!this.active.parts||!this.active.config)return;t?this.active.currentSizeInPercent=t:t=this.active.currentSizeInPercent;const e=this.calcFrameSizeInPixels(t);this.builder.resize(e),this.patterns.scale(e),Ma().canvas.render()}changeColor(t){this.active.changeColor(t)}remove(){this.active.remove(),Oa().frame.deselect()}getByName(t){var e,n;const r=null==(n=null==(e=Oa().config.tools)?void 0:e.frame)?void 0:n.items;if(r)return r.find((e=>e.name===t))}getActiveFrameConfig(){return this.active.config}calcFrameSizeInPixels(t){const e=Math.min(Oa().original.width,Oa().original.height);return Math.ceil(t/100*e)}}const If=t=>{const e=new Ud.fabric.PatternBrush(t);return e.getPatternSrc=function(){const t=Ud.fabric.document.createElement("canvas");t.width=10,t.height=10;const e=t.getContext("2d");return e.strokeStyle=this.color,e.lineWidth=5,e.beginPath(),e.moveTo(0,5),e.lineTo(10,5),e.closePath(),e.stroke(),t},e},Lf=t=>{const e=new Ud.fabric.PatternBrush(t);return e.getPatternSrc=function(){const t=document.createElement("canvas");t.width=10,t.height=10;const e=t.getContext("2d");return e.strokeStyle=this.color,e.lineWidth=5,e.beginPath(),e.moveTo(5,0),e.lineTo(5,10),e.closePath(),e.stroke(),t},e},zf=t=>{const e=new Ud.fabric.PatternBrush(t);return e.getPatternSrc=function(){const t=this.width/2,e=document.createElement("canvas"),n=new Ud.fabric.Rect({width:t,height:t,angle:45,fill:this.color}),r=n.getBoundingRect().width;e.width=r+5,e.height=r+5,n.set({left:r/2,top:r/2});const i=e.getContext("2d");return n.render(i),e},e},Ff=t=>{const e=new Ud.fabric.PatternBrush(t);return e.getPatternSrc=function(){const t=document.createElement("canvas");t.width=12,t.height=12;const e=t.getContext("2d");return e.fillStyle=this.color,e.fillRect(0,0,10,10),t},e};var Nf,Bf;class Vf{constructor(){c(this,"customBrushes",{VLineBrush:If,HLineBrush:Lf,DiamondBrush:zf,SquareBrush:Ff}),c(this,"currentBrush",{type:"PencilBrush",color:null==(Bf=null==(Nf=Oa().config.objectDefaults)?void 0:Nf.global)?void 0:Bf.fill,width:pr[1]}),c(this,"onPathCreated",(t=>{t.path.name=ko.Drawing,t.path.set(function(){const t={...Da};return delete t.strokeWidth,t}()),Oa().setDirty(!0)}))}enable(){Pa().on("path:created",this.onPathCreated),Pa().isDrawingMode=!0,this.setBrushType(this.currentBrush.type),this.setBrushSize(this.currentBrush.width)}disable(){Pa().off("path:created",this.onPathCreated),Pa().isDrawingMode=!1}getBrushType(){return this.currentBrush.type}setBrushType(t){this.currentBrush.type=t,Pa().freeDrawingBrush=t in Ud.fabric?new Ud.fabric[t](Pa()):this.customBrushes[t](Pa()),this.applyBrushStyles()}applyBrushStyles(){Object.keys(this.currentBrush).forEach((t=>{Pa().freeDrawingBrush[t]=this.currentBrush[t]}));const t=Pa().freeDrawingBrush;t.getPatternSrc&&(t.source=t.getPatternSrc.call(t))}setBrushSize(t){this.currentBrush.width=t,this.applyBrushStyles()}getBrushSize(){return this.currentBrush.width}setBrushColor(t){this.currentBrush.color=t,this.applyBrushStyles()}getBrushColor(){return this.currentBrush.color}}function Hf(t){var e;return(null==(e=/(?:\.([^.]+))?$/.exec(t))?void 0:e[1])||""}class Wf{constructor(t,e){c(this,"id"),c(this,"fingerprint"),c(this,"name"),c(this,"relativePath",""),c(this,"size"),c(this,"mime",""),c(this,"extension",""),c(this,"native"),c(this,"lastModified"),c(this,"cachedData"),this.id=Fa(),this.name=t.name,this.size=t.size,this.mime=function(t){const e={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"},n=t.name?Hf(t.name):null;return t.type?t.type:n&&n in e?e[n]:"application/octet-stream"}(t),this.lastModified=t.lastModified,this.extension=Hf(t.name)||"bin",this.native=t,(e=(e=e||t.webkitRelativePath||"").replace(/^\/+/g,""))&&e.split("/").length>1&&(this.relativePath=e),this.fingerprint=function({name:t,mime:e,size:n,relativePath:r,lastModified:i}){let o="be";return"string"==typeof t&&(o+=`-${Uf(t.toLowerCase())}`),e&&(o+=`-${e}`),"string"==typeof r&&(o+=`-${Uf(r.toLowerCase())}`),void 0!==n&&(o+=`-${n}`),void 0!==i&&(o+=`-${i}`),o+="0",`${o}-v1`}({name:this.name,size:this.size,mime:this.mime,lastModified:this.lastModified})}get data(){return new Promise((t=>{this.cachedData&&t(this.cachedData);const e=new FileReader;e.addEventListener("load",(()=>{this.cachedData=e.result,t(this.cachedData)})),"json"===this.extension?e.readAsText(this.native):e.readAsDataURL(this.native)}))}}function Uf(t){let e="";return t.replace(/[^A-Z0-9]/gi,(t=>(e+=`-${function(t){return t.charCodeAt(0).toString(32)}(t)}`,"/")))+e}function Yf(t={}){return new Promise((e=>{const n=function(t={}){var e;const n=document.querySelector("#hidden-file-upload-input");n&&n.remove();const r=document.createElement("input");return r.type="file",r.multiple=null!=(e=t.multiple)&&e,r.classList.add("hidden"),r.style.display="none",r.style.visibility="hidden",r.id="hidden-file-upload-input",r.accept=function({extensions:t=[],types:e=[]}){const n=[];return null!=t&&t.length&&(t=t.map((t=>t.startsWith(".")?t:`.${t}`)),n.push(t.join(","))),null!=e&&e.length&&n.push(e.join(",")),n.join(",")}(t),t.directory&&(r.webkitdirectory=!0),document.body.appendChild(r),r}(t);n.onchange=t=>{const r=t.target.files;if(!r)return e([]);const i=Array.from(r).filter((t=>".DS_Store"!==t.name)).map((t=>new Wf(t)));e(i),n.remove()},document.body.appendChild(n),n.click()}))}var Xf=(t=>(t.image="image/*",t.audio="audio/*",t.json="application/json",t.video="video/mp4,video/mpeg,video/x-m4v,video/*",t))(Xf||{});function Gf(t){if(null==t||Number.isNaN(t))return"";const e=t<0,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(e&&(t=-t),t<1)return(e?"-":"")+t+" B";const r=Math.min(Math.floor(Math.log(t)/Math.log(1024)),n.length-1);t=Number(t/Math.pow(1024,r));const i=n[r];return t>=10||t%1===0?`${(e?"-":"")+t.toFixed(0)} ${i}`:`${(e?"-":"")+t.toFixed(1)} ${i}`}function $f(t,e){this.text=t=t||"",this.hasWild=~t.indexOf("*"),this.separator=e,this.parts=t.split(e)}$f.prototype.match=function(t){var e,n,r=!0,i=this.parts,o=i.length;if("string"==typeof t||t instanceof String)if(this.hasWild||this.text==t){for(n=(t||"").split(this.separator),e=0;r&&e<o;e++)"*"!==i[e]&&(r=e<n.length&&i[e]===n[e]);r=r&&n}else r=!1;else if("function"==typeof t.splice)for(r=[],e=t.length;e--;)this.match(t[e])&&(r[r.length]=t[e]);else if("object"==typeof t)for(var a in r={},t)this.match(a)&&(r[a]=t[a]);return r};var qf=function(t,e,n){var r=new $f(t,n||/[\/\.]/);return typeof e<"u"?r.match(e):r},Kf=/[\/\+\.]/;function Zf(t,e){return e.some((e=>e.includes("/")?!!t.mime&&function(t,e){function n(e){var n=qf(e,t,Kf);return n&&n.length>=2}return e?n(e.split(";")[0]):n}(t.mime.replace(/;.*?$/,""),e):!(!e.replace(".","")||!t.extension)&&t.extension.toLowerCase()===e.toLowerCase()))}class Jf{async uploadAndAddImage(){const t=await this.openUploadWindow();await this.openUploadedFile(t)}async uploadAndReplaceMainImage(){const t=await this.openUploadWindow();t&&await this.openBackgroundImage(t)}async uploadAndOpenStateFile(){const t=await this.openUploadWindow(Qf);t&&await this.loadState(await t.data)}async openUploadedFile(t){var e,n,r;if(!t)return;const i=await t.data;switch(t.extension){case"json":await this.loadState(i);break;case"svg":await Ma().shape.addSvgSticker(i,ko.Image),Ma().history.addHistoryItem({name:"overlayImage"});break;default:await async function(t,e=!0){const n=await Zd(t);if(n)return new Promise((t=>{n.name=ko.Image,n.opacity=0;const r=Oa().original.width,i=Oa().original.height;if(e&&(n.width>=r||n.height>=i)){const t=r-.1*r,e=i-.1*i,o=1/Math.min(e/n.getScaledHeight(),t/n.getScaledWidth());n.scaleX*=1/o,n.scaleY*=1/o}Oa().fabric.add(n),Oa().fabric.setActiveObject(n),n.viewportCenter(),n.setCoords(),Oa().fabric.requestRenderAll(),Ma().zoom.fitToScreen(),n.animate("opacity","1",{duration:425,onChange:()=>{Oa().fabric.requestRenderAll()},onComplete:()=>{t(n)}})}))}(i,null==(r=null==(n=null==(e=Oa().config.tools)?void 0:e.import)?void 0:n.fitOverlayToScreen)||r),Ma().history.addHistoryItem({name:"overlayImage"})}}async loadState(t){let e;Oa().toggleLoading("state"),await Aa(),e="string"==typeof t?t.endsWith(".json")?await ja(t):JSON.parse(t):t,await Ma().history.addInitial(e),await Ma().history.reload(),Oa().toggleLoading(!1)}async openUploadWindow(t){var e,n;t=t||function(){var t,e;const n=null==(e=null==(t=Oa().config.tools)?void 0:t.import)?void 0:e.validImgExtensions;return n?{extensions:n}:{types:[Xf.image]}}();const r=(await Yf(t))[0];return this.fileIsValid(r)?(null==(n=(e=Oa().config).onFileOpen)||n.call(e,r),r):null}async openBackgroundImage(t){let e;await Aa(),e=t instanceof HTMLImageElement?t.src:t instanceof Wf?await t.data:t;const n=await Ma().canvas.addMainImage(e);return await Ma().history.addInitial(),n}fileIsValid(t){var e,n,r,i,o,a;const s=null!=(r=null==(n=null==(e=Oa().config.tools)?void 0:e.import)?void 0:n.maxFileSize)?r:function(t,e){if(null==t)return 0;switch(e){case"KB":return 1024*t;case"MB":return 1048576*t;case"GB":return t*1024**3;case"TB":return t*1024**4;case"PB":return t*1024**5;default:return t}}(10,"MB"),l=function(t,e){if(!e)return;const{maxFileSize:n,allowedFileTypes:r,blockedFileTypes:i}=e;return n&&null!=t.size&&t.size>n?ur("`:file` exceeds maximum allowed size of :size",{values:{file:t.name,size:Gf(n)}}):null!=r&&r.length&&!Zf(t,r)||null!=i&&i.length&&Zf(t,i)?ur("This file type is not allowed"):void 0}(t,{maxFileSize:s,allowedFileTypes:[...null!=(a=null==(o=null==(i=Oa().config.tools)?void 0:i.import)?void 0:o.validImgExtensions)?a:[],"json"]});return!l||(Ha.danger(l),!1)}}const Qf={types:[".json",Xf.json]};class tp{constructor(){c(this,"watermark",null),c(this,"lineStyle",{stroke:"rgba(255,255,255,0.3)",strokeWidth:5,strokeLineCap:"round",strokeLineJoin:"round"})}add(t){this.createGroup(),this.addText(t),this.addLines(),Pa().add(this.watermark),Ma().canvas.render()}remove(){!this.watermark||(Pa().remove(this.watermark),this.watermark=null,Ma().canvas.render())}createGroup(){this.watermark=new Ud.fabric.Group(void 0,{...Da,width:Oa().original.width,height:Oa().original.height,excludeFromExport:!0,top:0,left:0,originX:"left",originY:"top"})}addText(t){var e;const n=new Ud.fabric.Text(t,{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"});n.scaleToWidth(Oa().original.width/2),null==(e=this.watermark)||e.add(n)}addLines(){var t;if(!this.watermark)return;const e=null==(t=this.watermark)?void 0:t.getObjects("text")[0],n=Oa().original.width/2,r=Oa().original.height/2,i=100,o=e.width/4,a=new Ud.fabric.Line(void 0,this.lineStyle),s=new Ud.fabric.Line(void 0,this.lineStyle),l=new Ud.fabric.Line(void 0,this.lineStyle),c=new Ud.fabric.Line(void 0,this.lineStyle);this.watermark.add(a,s,l,c),a.set({x1:o,y1:-i,x2:n,y2:-r}),s.set({x1:o,y1:i,x2:n,y2:r}),l.set({x1:-o,y1:-i,x2:-n,y2:-r}),c.set({x1:-o,y1:i,x2:-n,y2:r})}}var ep={exports:{}};!function(t){!function(){function e(t,e){return typeof e>"u"?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}function n(t,e,n){var r=new XMLHttpRequest;r.open("GET",t),r.responseType="blob",r.onload=function(){s(r.response,e,n)},r.onerror=function(){console.error("could not download file")},r.send()}function r(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch{}return 200<=e.status&&299>=e.status}function i(t){try{t.dispatchEvent(new MouseEvent("click"))}catch{var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var o="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof u&&u.global===u?u: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(t,e,a){var s=o.URL||o.webkitURL,l=document.createElement("a");e=e||t.name||"download",l.download=e,l.rel="noopener","string"==typeof t?(l.href=t,l.origin===location.origin?i(l):r(l.href)?n(t,e,a):i(l,l.target="_blank")):(l.href=s.createObjectURL(t),setTimeout((function(){s.revokeObjectURL(l.href)}),4e4),setTimeout((function(){i(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(t,o,a){if(o=o||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(e(t,a),o);else if(r(t))n(t,o,a);else{var s=document.createElement("a");s.href=t,s.target="_blank",setTimeout((function(){i(s)}))}}:function(t,e,r,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof t)return n(t,e,r);var s="application/octet-stream"===t.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 t=u.result;t=c?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=t:location=t,i=null},u.readAsDataURL(t)}else{var h=o.URL||o.webkitURL,d=h.createObjectURL(t);i?i.location=d:location.href=d,i=null,setTimeout((function(){h.revokeObjectURL(d)}),4e4)}});o.saveAs=s.saveAs=s,t.exports=s}()}(ep);class np{save(t,e,n){var r,i,o;const a=null==(r=Oa().config.tools)?void 0:r.export;t=t||(null==a?void 0:a.defaultName),e=this.getFormat(e),n=this.getQuality(n);const s=`${t}.${e}`;this.applyWaterMark();const l="json"===e?this.getJsonState():this.getDataUrl(e,n);if(Ma().watermark.remove(),l)if(Oa().config.saveUrl)fetch(Oa().config.saveUrl,{method:"POST",body:JSON.stringify({data:l,filename:s,format:e})});else if(Oa().config.onSave)null==(o=(i=Oa().config).onSave)||o.call(i,l,s,e);else{const t=this.getCanvasBlob(e,l);ep.exports.saveAs(t,s)}}getDataUrl(t,e){this.prepareCanvas();try{return"svg"===t?Pa().toSVG():Pa().toDataURL({format:this.getFormat(t),quality:this.getQuality(e),multiplier:Math.max(Oa().original.width/Pa().width,Oa().original.height/Pa().height)})}catch(n){n.message.toLowerCase().includes("tainted")&&Ha.danger(ur("Could not export canvas with external image."))}return null}getCanvasBlob(t,e){if("json"===t)return new Blob([e],{type:"application/json"});if("svg"===t)return new Blob([e],{type:"image/svg+xml"});const n=`image/${t}`;return function(t,e,n){e=e||"",n=n||512;const r=atob(t),i=[];for(let o=0;o<r.length;o+=n){const t=r.slice(o,o+n),e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);const a=new Uint8Array(e);i.push(a)}return new Blob(i,{type:e})}(e=e.replace(/data:image\/([a-z]*)?;base64,/,""),n)}getJsonState(){return JSON.stringify(Ra())}prepareCanvas(){Pa().discardActiveObject()}applyWaterMark(){const t=Oa().config.watermarkText;t&&Ma().watermark.add(t)}getFormat(t){var e;const n=null==(e=Oa().config.tools)?void 0:e.export;return"jpg"===(t=t||(null==n?void 0:n.defaultFormat)||"png")&&(t="jpeg"),t}getQuality(t){var e;const n=null==(e=Oa().config.tools)?void 0:e.export;return t=t||(null==n?void 0:n.defaultQuality)||.8}}class rp{constructor(){c(this,"previewRect",null)}async apply(t){this.previewRect||this.showPreview(),this.updatePreview(t),Pa().remove(this.previewRect),Pa().clipPath=this.previewRect;const e=Ma().export.getDataUrl();e&&Ma().canvas.clear(),this.hidePreview(),e&&await Ma().canvas.addMainImage(e),Pa().clipPath=void 0}getPreviewRadius(){var t;return(null==(t=this.previewRect)?void 0:t.rx)||0}updatePreview(t){!this.previewRect||(this.previewRect.set({rx:t,ry:t}),Ma().canvas.render())}showPreview(){this.previewRect=new Ud.fabric.Rect({width:Oa().original.width,height:Oa().original.height,rx:50,ry:50,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}),Pa().add(this.previewRect),this.previewRect.moveTo(99),this.previewRect.viewportCenter(),Ma().canvas.render()}hidePreview(){!this.previewRect||(Pa().remove(this.previewRect),Ma().canvas.render(),this.previewRect=null)}}class ip{get straightenAnchor(){return Pa().getObjects().find((t=>t.name===ko.StraightenAnchor))}rotateLeft(){this.rotateFixed(-90)}rotateRight(){this.rotateFixed(90)}straighten(t){this.storeObjectsRelationToHelper(),Ma().objects.deselectActive();const e=(this.straightenAnchor.data.rotateAngle||0)+t,n=this.getImageScale(e,this.straightenAnchor);this.straightenAnchor.angle=e,this.straightenAnchor.scaleX=n,this.straightenAnchor.scaleY=n,this.straightenAnchor.data.straightenAngle=t,this.transformObjectsBasedOnHelper()}flip(t){const e="horizontal"===t?"flipY":"flipX";Ma().objects.getAll().forEach((t=>{t[e]=!t[e]})),Ma().canvas.render()}rotateFixed(t){Ma().zoom.set(1,!1),Ma().objects.deselectActive();const e=this.straightenAnchor.data.rotateAngle||0;t=90*Math.round(t/90);const n=e+(this.straightenAnchor.data.straightenAngle||0)+t;Ma().canvas.resize(Oa().original.height,Oa().original.width,{applyZoom:!1,resizeHelper:!1}),this.storeObjectsRelationToHelper(),this.straightenAnchor.rotate(n),this.straightenAnchor.data.rotateAngle=e+t,this.straightenAnchor.center(),this.transformObjectsBasedOnHelper(),Ma().frame.resize(Ma().frame.active.currentSizeInPercent),requestAnimationFrame((()=>{Ma().zoom.fitToScreen()}))}getImageScale(t,e){t=Ud.fabric.util.degreesToRadians(t);const n=Oa().original.width/2,r=Oa().original.height/2,i=e.width/2,o=e.height/2,a=Math.sqrt(n**2+r**2),s=Math.asin(r/a);let l=(t%(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)),h=Math.cos(c)*a,d=Math.cos(u)*a;return Math.max(d/i,h/o)}storeObjectsRelationToHelper(){Ma().objects.getAll().forEach((t=>{if(t!==this.straightenAnchor){const e=Ud.fabric.util.multiplyTransformMatrices(Ud.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()),t.calcTransformMatrix());t.data={...t.data,relationToCanvas:e}}}))}transformObjectsBasedOnHelper(){Ma().objects.getAll().forEach((t=>{if(t.data.relationToCanvas){const e=Ud.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(),t.data.relationToCanvas),n=Ud.fabric.util.qrDecompose(e);t.set({flipX:!1,flipY:!1}),t.setPositionByOrigin({x:n.translateX,y:n.translateY},"center","center"),t.set(n),t.setCoords(),t.data.relationToCanvas=null}}))}resetStraightenAnchor(){const t=this.straightenAnchor;t&&Pa().remove(t);const e=new Ud.fabric.Rect({...Da,name:ko.StraightenAnchor,visible:!1,width:Oa().original.width,height:Oa().original.height,data:{pixieInternal:!0,straightenAngle:0,rotateAngle:0}});Pa().add(e),e.viewportCenter()}}function op(t){const e=function(t){var e;const n=new Ud.fabric.Canvas(t,{width:1,height:1});n.preserveObjectStacking=!0,n.selection=!1,n.renderOnAddRemove=!1;const r=Oa().config.textureSize;r&&(Ud.fabric.textureSize=r);const i={...null==(e=Oa().config.objectDefaults)?void 0:e.global,...Xd};Object.keys(i).forEach((t=>{Ud.fabric.Object.prototype[t]=i[t]})),n.on("object:added",(t=>{var e,n;t.target&&(null==(n=null==(e=t.target)?void 0:e.data)||!n.id)&&(t.target.data||(t.target.data={}),t.target.data.id=Gd(10))}));const o=Ud.fabric.Object.prototype.controls;return Object.keys(o).forEach((t=>{delete o[t]})),n}(t);Oa().editor.fabric=e,Ea.setState({fabric:e}),Oa().editor.tools={canvas:new Jd,objects:new of,zoom:new Kd,history:new hf,filter:new vf,resize:new Cf,crop:new Of,merge:new df,shape:new Mf,frame:new Rf,text:new lf,draw:new Vf,transform:new ip,import:new Jf,watermark:new tp,export:new np,corners:new rp}}function ap(t,e){const n=new ResizeObserver((t=>{const n=t[0].contentRect;e({width:n.width,height:n.height})}));return t.current&&n.observe(t.current),()=>{t.current&&n.unobserve(t.current)}}function sp(t){const e=t.getBoundingClientRect();return{top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}}const lp="flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]",cp={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:"absolute"},transition:{type:"tween",duration:.15}};function up(t,{padding:e,equalWidth:n,variant:r}={}){switch(t){case"xs":return"link"===r?"text-xs":`text-xs h-30 ${n?"w-30":e||"px-14"}`;case"sm":return"link"===r?"text-sm":`text-sm h-36 ${n?"w-36":e||"px-18"}`;case"md":return"link"===r?"text-base":`text-base h-42 ${n?"w-42":e||"px-22"}`;case"lg":return"link"===r?"text-lg":`text-base h-50 ${n?"w-50":e||"px-26"}`;case"xl":return"link"===r?"text-xl":`text-lg h-60 ${n?"w-60":e||"px-32"}`;default:return t||""}}function hp(t){switch(t){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 dp(t){const{variant:e}=t,n={...t,border:t.border||"border"};let r=[];return"outline"===e?r=function({color:t,border:e}){const n="disabled:text-disabled disabled:bg-transparent disabled:border-disabled-bg";switch(t){case"primary":return[`text-primary bg-transparent ${e} border-primary/50`,"hover:bg-primary/hover hover:border-primary",n];case"danger":return[`text-danger bg-transparent ${e} border-danger/50`,"hover:bg-danger/4 hover:border-danger",n];case"paper":return[`text bg-paper ${e}`,"hover:bg-hover",n];default:return[`bg-transparent ${e}`,"hover:bg-hover",n]}}(n):"text"===e?r=function({color:t}){const e="disabled:text-disabled disabled:bg-transparent";switch(t){case"primary":return["text-primary bg-transparent border-transparent","hover:bg-primary/4",e];case"danger":return["text-danger bg-transparent border-transparent","hover:bg-danger/4",e];default:return["bg-transparent border-transparent","hover:bg-hover",e]}}(n):"flat"===e||"raised"===e?r=function({color:t,border:e}){const n="disabled:text-disabled disabled:bg-disabled disabled:border-transparent disabled:shadow-none";switch(t){case"primary":return[`text-on-primary bg-primary ${e} border-primary`,"hover:bg-primary-dark hover:border-primary-dark",n];case"danger":return[`text-white bg-danger ${e} border-danger`,"hover:bg-danger/90 hover:border-danger/90",n];case"chip":return[`text-main bg-chip ${e} border-chip`,"hover:bg-chip/90 hover:border-chip/90",n];case"paper":return[`text-main bg-paper ${e} border-paper`,"hover:bg-paper/90 hover:bg-paper-90",n];default:return[`bg ${e} border-background`,"hover:bg-hover",n]}}(n):"link"===e&&(r=function({color:t}){switch(t){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"]}}(n)),[...r,"raised"===e&&"shadow-md",e&&"align-middle whitespace-nowrap inline-flex items-center transition-button duration-200","select-none appearance-none no-underline outline-none disabled:pointer-events-none disabled:cursor-default"]}function fp(t){if(t)return e=>{e.currentTarget.contains(e.target)&&t(e)}}const pp=(0,i.forwardRef)(((t,e)=>{const{children:n,color:r=null,variant:i,radius:o,justify:a="justify-center",className:s,href:l,form:c,border:u,elementType:h,to:d,replace:f,end:p,type:g="button",onClick:m,onPointerDown:v,onPointerUp:b,onKeyDown:y,...x}=t,w=h||(l?"a":"button"),_="a"===w;return ar(w,{ref:e,form:_?void 0:c,href:l,to:d,type:_?void 0:g,replace:f,end:p,onPointerDown:fp(v),onPointerUp:fp(b),onClick:fp(m),onKeyDown:fp(y),className:yr("focus-visible:ring",dp({variant:i,color:r,border:u}),o,a,s),...x,children:n})})),gp=i.forwardRef((({children:t,startIcon:e,endIcon:n,size:r="sm",className:i,equalWidth:o=!1,radius:a="rounded",variant:s="text",...l},c)=>{const u=yr("font-semibold",up(r,{equalWidth:o,variant:s}),i);return sr(pp,{className:u,ref:c,radius:a,variant:s,...l,children:[e&&ar(mp,{position:"start",icon:e,size:r}),t,n&&ar(mp,{position:"end",icon:n,size:r})]})}));function mp({icon:t,position:e,size:n}){const r=yr("m-auto",{"-ml-4 mr-8":"start"===e,"-mr-4 ml-8":"end"===e},t.props.className);return i.cloneElement(t,{className:r,size:n})}var vp={exports:{}};!function(t){(function(){var e=Object.assign;function n(t,n){n||(n={});var r,i,o=n.vargs||function(t){var e=t+"",n=e.indexOf("...");return n>=0&&(n<e.indexOf(")")||e.indexOf("arguments")>=0)}(t),a=Object.create(null),s=[],l=[],c=new WeakMap,u=n.maxAge>0&&n.maxAge<1/0?function(t,e,r){return setTimeout((function(){if(r)return e.splice(t,1),void r.splice(t,1);e instanceof WeakMap?e.delete(t):delete e[t]}),n.maxAge)}:0,h=n.equals?n.equals:function(t,e){return t===e},d=n.maxArgs,f=n.serializer;return 1!==t.length||n.equals||o?r=function(){var e,n=d||arguments.length;for(e=s.length-1;e>=0;e--)if(d||s[e].length===n)for(var r=n-1;r>=0&&h(s[e][r],arguments[r]);r--)if(0===r)return l[e];return e=s.length-(e+1),!u||u(e,l,s),l[e]=t.apply(this,s[e]=arguments)}.bind(this):(r=function(e){var n,r=typeof e;if(!f&&("object"===r&&e||"function"===r))return c.get(e)||(!u||u(e,c),c.set(e,n=t.call(this,e)),n);var i="number"===r||"boolean"===r||null==e?e:"string"===r?JSON.stringify(e):f(e);return a[i]||(!u||u(i,a),a[i]=t.call(this,e))}.bind(this),i=1),r.clear=function(){c=new WeakMap,a=Object.create(null),s=[],l=[]},r.keys=function(){return i?null:s.slice()},r.values=function(){return i?null:l.slice()},r.keyValues=function(){return i?{primitives:e({},a),objects:c}:null},r}"function"!=typeof e&&(e=function(){var t=arguments,e=arguments[0];if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var n=1;n<t.length;n++)if(t[n]&&"object"==typeof t[n])for(var r in t[n])e[r]=t[n][r];return e}),t.exports=n,typeof window<"u"&&(window.nanomemoize=n)}).call(u)}(vp);const bp=vp.exports;function yp({children:t,label:e,index:n}){const r=(0,i.useId)();return sr("div",{role:"group",className:yr(0!==n&&"border-t my-4"),"aria-labelledby":e?`be-select-${r}`:void 0,children:[e&&ar("div",{className:"block uppercase text-muted text-xs px-16 py-10",role:"presentation",id:`be-select-${r}`,"aria-hidden":"true",children:e}),t]})}const xp=bp((({maxItems:t,children:e,items:n,inputValue:r})=>{let i=_p({children:e,items:n}),o=wp({collection:i,inputValue:r});return t&&(i=new Map([...i.entries()].slice(0,t)),o=new Map([...o.entries()].slice(0,t))),{collection:i,filteredCollection:o}})),wp=bp((({collection:t,inputValue:e})=>{let n=new Map;const r=e?`${e}`.toLowerCase().trim():"";if(r){let e=0;t.forEach(((t,i)=>{(t.item?JSON.stringify(t.item):t.textLabel).toLowerCase().trim().includes(r)&&n.set(i,{...t,index:e++})}))}else n=t;return n})),_p=bp((({children:t,items:e})=>{let n;n=e&&"function"==typeof t?e.map((e=>t(e))):t;const r=new Map;let o=0;const a=(t,n,i,a)=>{const s=o++,l=n?null==e?void 0:e[i].items[a]:null==e?void 0:e[s];r.set(t.props.value,{index:s,element:t,textLabel:Sp(t),item:l,section:n,isDisabled:t.props.isDisabled,value:t.props.value})};return i.Children.forEach(n,((t,e)=>{!(0,i.isValidElement)(t)||(t.type===yp?i.Children.forEach(t.props.children,((n,r)=>{a(n,t,e,r)})):a(t))})),r}));function Sp(t){var e;const n=t.props.children;return t.props.textLabel?t.props.textLabel:n&&(null==(e=n.props)?void 0:e.defaultMessage)?n.props.defaultMessage[0].value:`${n}`||""}function Cp(t){return t.split("-")[0]}function kp(t){return t.split("-")[1]}function Tp(t){return["top","bottom"].includes(Cp(t))?"x":"y"}function Ep(t){return"y"===t?"height":"width"}function Op(t,e,n){let{reference:r,floating:i}=t;const o=r.x+r.width/2-i.width/2,a=r.y+r.height/2-i.height/2,s=Tp(e),l=Ep(s),c=r[l]/2-i[l]/2,u="x"===s;let h;switch(Cp(e)){case"top":h={x:o,y:r.y-i.height};break;case"bottom":h={x:o,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:a};break;case"left":h={x:r.x-i.width,y:a};break;default:h={x:r.x,y:r.y}}switch(kp(e)){case"start":h[s]-=c*(n&&u?-1:1);break;case"end":h[s]+=c*(n&&u?-1:1)}return h}function Mp(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function Pp(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function Ap(t,e){var n;void 0===e&&(e={});const{x:r,y:i,platform:o,rects:a,elements:s,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:d=!1,padding:f=0}=e,p=Mp(f),g=s[d?"floating"===h?"reference":"floating":h],m=Pp(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(g)))||n?g:g.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v=Pp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===h?{...a.floating,x:r,y:i}:a.reference,offsetParent:await(null==o.getOffsetParent?void 0:o.getOffsetParent(s.floating)),strategy:l}):a[h]);return{top:m.top-v.top+p.top,bottom:v.bottom-m.bottom+p.bottom,left:m.left-v.left+p.left,right:v.right-m.right+p.right}}const jp=Math.min,Dp=Math.max;function Rp(t,e,n){return Dp(t,jp(e,n))}const Ip=t=>({name:"arrow",options:t,async fn(e){const{element:n,padding:r=0}=null!=t?t:{},{x:i,y:o,placement:a,rects:s,platform:l}=e;if(null==n)return{};const c=Mp(r),u={x:i,y:o},h=Tp(a),d=kp(a),f=Ep(h),p=await l.getDimensions(n),g="y"===h?"top":"left",m="y"===h?"bottom":"right",v=s.reference[f]+s.reference[h]-u[h]-s.floating[f],b=u[h]-s.reference[h],y=await(null==l.getOffsetParent?void 0:l.getOffsetParent(n));let x=y?"y"===h?y.clientHeight||0:y.clientWidth||0:0;0===x&&(x=s.floating[f]);const w=v/2-b/2,_=c[g],S=x-p[f]-c[m],C=x/2-p[f]/2+w,k=Rp(_,C,S),T=("start"===d?c[g]:c[m])>0&&C!==k&&s.reference[f]<=s.floating[f]?C<_?_-C:S-C:0;return{[h]:u[h]-T,data:{[h]:k,centerOffset:C-k}}}}),Lp={left:"right",right:"left",bottom:"top",top:"bottom"};function zp(t){return t.replace(/left|right|bottom|top/g,(t=>Lp[t]))}const Fp={start:"end",end:"start"};function Np(t){return t.replace(/start|end/g,(t=>Fp[t]))}const Bp=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:s,elements:l}=e,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:d="bestFit",flipAlignment:f=!0,...p}=t,g=Cp(r),m=h||(g!==a&&f?function(t){const e=zp(t);return[Np(t),e,Np(e)]}(a):[zp(a)]),v=[a,...m],b=await Ap(e,p),y=[];let x=(null==(n=i.flip)?void 0:n.overflows)||[];if(c&&y.push(b[g]),u){const{main:t,cross:e}=function(t,e,n){void 0===n&&(n=!1);const r=kp(t),i=Tp(t),o=Ep(i);let a="x"===i?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=zp(a)),{main:a,cross:zp(a)}}(r,o,await(null==s.isRTL?void 0:s.isRTL(l.floating)));y.push(b[t],b[e])}if(x=[...x,{placement:r,overflows:y}],!y.every((t=>t<=0))){var w,_;const t=(null!=(w=null==(_=i.flip)?void 0:_.index)?w:0)+1,e=v[t];if(e)return{data:{index:t,overflows:x},reset:{placement:e}};let n="bottom";switch(d){case"bestFit":{var S;const t=null==(S=x.map((t=>[t,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:S[0].placement;t&&(n=t);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};const Vp=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:r}=e,i=await async function(t,e){const{placement:n,platform:r,elements:i}=t,o=await(null==r.isRTL?void 0:r.isRTL(i.floating)),a=Cp(n),s=kp(n),l="x"===Tp(n),c=["left","top"].includes(a)?-1:1,u=o&&l?-1:1,h="function"==typeof e?e(t):e;let{mainAxis:d,crossAxis:f,alignmentAxis:p}="number"==typeof h?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...h};return s&&"number"==typeof p&&(f="end"===s?-1*p:p),l?{x:f*u,y:d*c}:{x:d*c,y:f*u}}(e,t);return{x:n+i.x,y:r+i.y,data:i}}}};const Hp=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...l}=t,c={x:n,y:r},u=await Ap(e,l),h=Tp(Cp(i)),d=function(t){return"x"===t?"y":"x"}(h);let f=c[h],p=c[d];if(o){const t="y"===h?"bottom":"right";f=Rp(f+u["y"===h?"top":"left"],f,f-u[t])}if(a){const t="y"===d?"bottom":"right";p=Rp(p+u["y"===d?"top":"left"],p,p-u[t])}const g=s.fn({...e,[h]:f,[d]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Wp=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:o}=e,{apply:a=()=>{},...s}=t,l=await Ap(e,s),c=Cp(n),u=kp(n);let h,d;"top"===c||"bottom"===c?(h=c,d=u===(await(null==i.isRTL?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(d=c,h="end"===u?"top":"bottom");const f=Dp(l.left,0),p=Dp(l.right,0),g=Dp(l.top,0),m=Dp(l.bottom,0),v={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(0!==g||0!==m?g+m:Dp(l.top,l.bottom)):l[h]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(0!==f||0!==p?f+p:Dp(l.left,l.right)):l[d])};await a({...e,...v});const b=await i.getDimensions(o.floating);return r.floating.width!==b.width||r.floating.height!==b.height?{reset:{rects:!0}}:{}}}};function Up(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function Yp(t){if(null==t)return window;if(!Up(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function Xp(t){return Yp(t).getComputedStyle(t)}function Gp(t){return Up(t)?"":t?(t.nodeName||"").toLowerCase():""}function $p(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function qp(t){return t instanceof Yp(t).HTMLElement}function Kp(t){return t instanceof Yp(t).Element}function Zp(t){if(typeof ShadowRoot>"u")return!1;return t instanceof Yp(t).ShadowRoot||t instanceof ShadowRoot}function Jp(t){const{overflow:e,overflowX:n,overflowY:r}=Xp(t);return/auto|scroll|overlay|hidden/.test(e+r+n)}function Qp(t){return["table","td","th"].includes(Gp(t))}function tg(t){const e=/firefox/i.test($p()),n=Xp(t);return"none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||["transform","perspective"].includes(n.willChange)||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter}function eg(){return!/^((?!chrome|android).)*safari/i.test($p())}const ng=Math.min,rg=Math.max,ig=Math.round;function og(t,e,n){var r,i,o,a;void 0===e&&(e=!1),void 0===n&&(n=!1);const s=t.getBoundingClientRect();let l=1,c=1;e&&qp(t)&&(l=t.offsetWidth>0&&ig(s.width)/t.offsetWidth||1,c=t.offsetHeight>0&&ig(s.height)/t.offsetHeight||1);const u=Kp(t)?Yp(t):window,h=!eg()&&n,d=(s.left+(h&&null!=(r=null==(i=u.visualViewport)?void 0:i.offsetLeft)?r:0))/l,f=(s.top+(h&&null!=(o=null==(a=u.visualViewport)?void 0:a.offsetTop)?o:0))/c,p=s.width/l,g=s.height/c;return{width:p,height:g,top:f,right:d+p,bottom:f+g,left:d,x:d,y:f}}function ag(t){return((function(t){return t instanceof Yp(t).Node}(t)?t.ownerDocument:t.document)||window.document).documentElement}function sg(t){return Kp(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function lg(t){return og(ag(t)).left+sg(t).scrollLeft}function cg(t,e,n){const r=qp(e),i=ag(e),o=og(t,r&&function(t){const e=og(t);return ig(e.width)!==t.offsetWidth||ig(e.height)!==t.offsetHeight}(e),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==Gp(e)||Jp(i))&&(a=sg(e)),qp(e)){const t=og(e,!0);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=lg(i));return{x:o.left+a.scrollLeft-s.x,y:o.top+a.scrollTop-s.y,width:o.width,height:o.height}}function ug(t){return"html"===Gp(t)?t:t.assignedSlot||t.parentNode||(Zp(t)?t.host:null)||ag(t)}function hg(t){return qp(t)&&"fixed"!==Xp(t).position?t.offsetParent:null}function dg(t){const e=Yp(t);let n=hg(t);for(;n&&Qp(n)&&"static"===Xp(n).position;)n=hg(n);return n&&("html"===Gp(n)||"body"===Gp(n)&&"static"===Xp(n).position&&!tg(n))?e:n||function(t){let e=ug(t);for(Zp(e)&&(e=e.host);qp(e)&&!["html","body"].includes(Gp(e));){if(tg(e))return e;{const t=e.parentNode;e=Zp(t)?t.host:t}}return null}(t)||e}function fg(t){if(qp(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=og(t);return{width:e.width,height:e.height}}function pg(t){const e=ug(t);return["html","body","#document"].includes(Gp(e))?t.ownerDocument.body:qp(e)&&Jp(e)?e:pg(e)}function gg(t,e){var n;void 0===e&&(e=[]);const r=pg(t),i=r===(null==(n=t.ownerDocument)?void 0:n.body),o=Yp(r),a=i?[o].concat(o.visualViewport||[],Jp(r)?r:[]):r,s=e.concat(a);return i?s:s.concat(gg(a))}function mg(t,e,n){return"viewport"===e?Pp(function(t,e){const n=Yp(t),r=ag(t),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;const t=eg();(t||!t&&"fixed"===e)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s,y:l}}(t,n)):Kp(e)?function(t,e){const n=og(t,!1,"fixed"===e),r=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:r,left:i,x:i,y:r,right:i+t.clientWidth,bottom:r+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(e,n):Pp(function(t){var e;const n=ag(t),r=sg(t),i=null==(e=t.ownerDocument)?void 0:e.body,o=rg(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),a=rg(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0);let s=-r.scrollLeft+lg(t);const l=-r.scrollTop;return"rtl"===Xp(i||n).direction&&(s+=rg(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(ag(t)))}function vg(t){const e=gg(t),n=["absolute","fixed"].includes(Xp(t).position)&&qp(t)?dg(t):t;return Kp(n)?e.filter((t=>Kp(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Zp(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,n)&&"body"!==Gp(t))):[]}const bg={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[..."clippingAncestors"===n?vg(e):[].concat(n),r],a=o[0],s=o.reduce(((t,n)=>{const r=mg(e,n,i);return t.top=rg(r.top,t.top),t.right=ng(r.right,t.right),t.bottom=ng(r.bottom,t.bottom),t.left=rg(r.left,t.left),t}),mg(e,a,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:r}=t;const i=qp(n),o=ag(n);if(n===o)return e;let a={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if((i||!i&&"fixed"!==r)&&(("body"!==Gp(n)||Jp(o))&&(a=sg(n)),qp(n))){const t=og(n,!0);s.x=t.x+n.clientLeft,s.y=t.y+n.clientTop}return{...e,x:e.x-a.scrollLeft+s.x,y:e.y-a.scrollTop+s.y}},isElement:Kp,getDimensions:fg,getOffsetParent:dg,getDocumentElement:ag,getElementRects:t=>{let{reference:e,floating:n,strategy:r}=t;return{reference:cg(e,dg(n),r),floating:{...fg(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===Xp(t).direction};function yg(t,e,n,r){void 0===r&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=!0,animationFrame:s=!1}=r,l=i&&!s,c=o&&!s,u=l||c?[...Kp(t)?gg(t):[],...gg(e)]:[];u.forEach((t=>{l&&t.addEventListener("scroll",n,{passive:!0}),c&&t.addEventListener("resize",n)}));let h=null;if(a){let r=!0;h=new ResizeObserver((()=>{r||n(),r=!1})),Kp(t)&&!s&&h.observe(t),h.observe(e)}let d,f=s?og(t):null;return s&&function e(){const r=og(t);f&&(r.x!==f.x||r.y!==f.y||r.width!==f.width||r.height!==f.height)&&n(),f=r,d=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{l&&t.removeEventListener("scroll",n),c&&t.removeEventListener("resize",n)})),null==(t=h)||t.disconnect(),h=null,s&&cancelAnimationFrame(d)}}const xg=(t,e,n)=>(async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=await(null==a.isRTL?void 0:a.isRTL(e));let l=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:u}=Op(l,r,s),h=r,d={},f=0;for(let p=0;p<o.length;p++){const{name:n,fn:g}=o[p],{x:m,y:v,data:b,reset:y}=await g({x:c,y:u,initialPlacement:r,placement:h,strategy:i,middlewareData:d,rects:l,platform:a,elements:{reference:t,floating:e}});c=null!=m?m:c,u=null!=v?v:u,d={...d,[n]:{...d[n],...b}},y&&f<=50&&(f++,"object"==typeof y&&(y.placement&&(h=y.placement),y.rects&&(l=!0===y.rects?await a.getElementRects({reference:t,floating:e,strategy:i}):y.rects),({x:c,y:u}=Op(l,h,s))),p=-1)}return{x:c,y:u,placement:h,strategy:i,middlewareData:d}})(t,e,{platform:bg,...n});var wg=typeof document<"u"?i.useLayoutEffect:i.useEffect;function _g(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;0!==r--;)if(!_g(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;0!==r--;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;for(r=n;0!==r--;){const n=i[r];if(("_owner"!==n||!t.$$typeof)&&!_g(t[n],e[n]))return!1}return!0}return t!==t&&e!==e}function Sg(t){let{middleware:e,placement:n="bottom",strategy:r="absolute",whileElementsMounted:a}=void 0===t?{}:t;const[s,l]=i.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[c,u]=i.useState(e);_g(null==c?void 0:c.map((t=>{let{name:e,options:n}=t;return{name:e,options:n}})),null==e?void 0:e.map((t=>{let{name:e,options:n}=t;return{name:e,options:n}})))||u(e);const h=i.useRef(null),d=i.useRef(null),f=i.useRef(null),p=i.useRef(s),g=function(t){const e=i.useRef(t);return wg((()=>{e.current=t})),e}(a),m=i.useCallback((()=>{!h.current||!d.current||xg(h.current,d.current,{middleware:c,placement:n,strategy:r}).then((t=>{v.current&&!_g(p.current,t)&&(p.current=t,o.flushSync((()=>{l(t)})))}))}),[c,n,r]);wg((()=>{v.current&&m()}),[m]);const v=i.useRef(!1);wg((()=>(v.current=!0,()=>{v.current=!1})),[]);const b=i.useCallback((()=>{if("function"==typeof f.current&&(f.current(),f.current=null),h.current&&d.current)if(g.current){const t=g.current(h.current,d.current,m);f.current=t}else m()}),[m,g]),y=i.useCallback((t=>{h.current=t,b()}),[b]),x=i.useCallback((t=>{d.current=t,b()}),[b]),w=i.useMemo((()=>({reference:h,floating:d})),[]);return i.useMemo((()=>({...s,update:m,refs:w,reference:y,floating:x})),[s,m,w,y,x])}const Cg=t=>{const{element:e,padding:n}=t;return{name:"arrow",options:t,fn:t=>function(t){return Object.prototype.hasOwnProperty.call(t,"current")}(e)?null!=e.current?Ip({element:e.current,padding:n}).fn(t):{}:e?Ip({element:e,padding:n}).fn(t):{}}};function kg({floatingWidth:t,ref:e,disablePositioning:n=!1,placement:r="bottom",offset:o=2,showArrow:a=!1}){const s=(0,i.useRef)(null),l={placement:r};n||(l.whileElementsMounted=yg,l.middleware=[Vp(o),Bp({padding:16}),Hp({padding:16}),Wp({apply({rects:e,availableHeight:n,availableWidth:r,elements:i}){"matchTrigger"===t&&Object.assign(i.floating.style,{width:`${e.reference.width}px`,maxWidth:`${r}`,maxHeight:`${Math.min(n,420)}px`})},padding:16})],a&&l.middleware.push(Cg({element:s})));const c=Sg(l),u=(0,i.useMemo)((()=>function(t){return e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}}([e,c.reference])),[c.reference,e]),{x:h,y:d}=c.middlewareData.arrow||{},f={top:"bottom",right:"left",bottom:"top",left:"right"}[c.placement.split("-")[0]],p={left:h,top:d,right:"",bottom:"",[f]:"-4px"};return{...c,reference:u,arrowRef:s,arrowStyle:p}}function Tg(t,e){const{children:n,items:r,role:o="listbox",virtualFocus:a,loopFocus:s=!1,onItemSelected:l,clearInputOnItemSelection:c,floatingWidth:u="matchTrigger",floatingMinWidth:h,offset:d,placement:f,showCheckmark:p,showEmptyMessage:g,maxItems:m,isAsync:v}=t,b=t.selectionMode||"none",y=`${(0,i.useId)()}-listbox`,[x,w]=Cd(t.inputValue,t.defaultInputValue||"",t.onInputValueChange),[_,S]=(0,i.useState)("all"),C=xp({children:n,items:r,inputValue:x,maxItems:m}),k="all"===_?C.collection:C.filteredCollection,T=(0,i.useRef)([]),E=(0,i.useMemo)((()=>[...k.values()].map((t=>t.isDisabled?null:t.textLabel))),[k]),{selectedValues:O,selectValues:M}=function(t){const{selectionMode:e,allowEmptySelection:n}=t,r="single"===e||"multiple"===e,[o,a]=Cd(r?t.selectedValue:void 0,r?t.defaultSelectedValue:void 0,r?t.onSelectionChange:void 0),s=(0,i.useMemo)((()=>null==o||""===o?[]:Array.isArray(o)?o:[o]),[o]),l=(0,i.useCallback)((t=>{const r=Array.isArray(t)?t:[t];"single"===e?a(r[0]):r.forEach((t=>{const e=s.indexOf(t);-1===e?(s.push(t),a([...s])):(s.length>1||n)&&(s.splice(e,1),a([...s]))}))}),[n,s,e,a]);return{selectedValues:s,selectValues:l}}(t),[P,A]=Cd(t.isOpen,t.defaultIsOpen,t.onOpenChange),[j,D]=(0,i.useState)(null),R=kg({floatingWidth:u,ref:e,placement:f,offset:d}),{refs:I,floating:L,strategy:z,x:F,y:N}=R,B="none"===b?void 0:k.get(O[0]),V="none"===b||null==B?void 0:B.index,H=(0,i.useCallback)(((t,e)=>{var n,r;const i=[...k.values()],o=!i.find((t=>!t.isDisabled)),l=k.size-1;null==e||!k.size||e>l||e<0||o?D(null):(e=function(t,e,n,r){var i;const o=t.length-1;for(;null!=(i=t[e])&&i.isDisabled;)if("increment"===r){if(++e>=o){if(!n)return e-1;e=0}}else if(--e<0){if(!n)return e+1;e=o}return e}(i,e,s,t),D(e),a?null==(n=T.current[e])||n.scrollIntoView({block:"nearest"}):null==(r=T.current[e])||r.focus())}),[k,a,s]);return{handleItemSelection:t=>{if("none"!==b)M(t);else{const t=I.reference.current;t&&"focus"in t&&t.focus()}a&&w(c?"":`${t}`),A(!1),D(null),null==l||l(t)},onInputChange:(0,i.useCallback)((t=>{w(t.target.value),v||S(t.target.value.trim()?"filtered":"all"),t.target.value?A(!0):M("")}),[w,A,S,M,v]),loopFocus:s,floatingWidth:u,floatingMinWidth:h,showCheckmark:p,collection:k,virtualFocus:a,focusItem:H,showEmptyMessage:g,refs:I,reference:R.reference,floating:L,positionStyle:{position:z,top:null!=N?N:"",left:null!=F?F:""},listContent:E,listItemsRef:T,listboxId:y,role:o,state:{activeIndex:j,setActiveIndex:D,selectedIndex:V,setSelectedIndex:t=>{if("none"!==b){const e=[...k.values()][t];e&&M(e.value)}},selectionMode:b,selectedValues:O,selectValues:M,inputValue:x,setInputValue:w,isOpen:P,setIsOpen:A,setActiveCollection:S}}}const Eg=(0,i.createContext)(null);function Og(){return(0,i.useContext)(Eg)}const Mg=_r(ar("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"}),"CheckOutlined"),Pg=i.forwardRef(((t,e)=>{let{startIcon:n,capitalizeFirst:r,children:i,description:o,endIcon:a,endSection:s,isDisabled:l,isActive:c,isSelected:u,showCheckmark:h,...d}=t;!n&&h&&(n=ar(Mg,{size:"sm",className:yr("text-primary",!u&&"invisible")}));const f=yr("icon-sm rounded overflow-hidden flex-shrink-0",!l&&"text-muted");return sr("div",{...d,"aria-disabled":l,className:Ag(t),ref:e,children:[n&&ar("div",{className:f,children:n}),sr("div",{className:yr("mr-auto",r&&"first-letter:capitalize"),children:[i,o&&ar("div",{className:yr("text-xs mt-4 whitespace-normal",l?"text-disabled":"text-muted"),children:o})]}),(a||s)&&ar("div",{className:a?f:"text-muted",children:a||s})]})}));function Ag({className:t,isSelected:e,isActive:n,isDisabled:r,showCheckmark:i}){let o="";return o=r?"text-disabled pointer-events-none":e?n?"bg-primary/focus":"bg-primary/selected hover:bg-primary/focus":n?"hover:bg-fg-base/15 bg-focus":"hover:bg-hover",yr("w-full select-none outline-none cursor-pointer","py-8 text-sm truncate flex items-center gap-10 text-main",i?"px-8":"px-20",o,t)}function jg({children:t,value:e,startIcon:n,endIcon:r,endSection:i,description:o,capitalizeFirst:a,textLabel:s,isDisabled:l,onSelected:c,onClick:u,...h}){var d;const{collection:f,showCheckmark:p,virtualFocus:g,listboxId:m,role:v,listItemsRef:b,handleItemSelection:y,state:{selectedValues:x,activeIndex:w,setActiveIndex:_}}=Og(),S=x.includes(e),C=null==(d=f.get(e))?void 0:d.index,k=w===C;if(null==C)return null;return ar(Pg,{...h,onFocus:()=>{g||_(C)},onPointerEnter:t=>{_(C),g||t.currentTarget.focus()},onPointerDown:t=>{g&&t.preventDefault()},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),y(e),null==c||c())},onClick:t=>{y(e),null==c||c(),null==u||u(t)},ref:t=>b.current[C]=t,id:`${m}-${C}`,role:"menu"===v?"menuitem":"option",tabIndex:g?void 0:k&&!l?-1:0,"aria-selected":k&&S,showCheckmark:p,isDisabled:l,isActive:k,isSelected:S,startIcon:n,description:o,endIcon:r,endSection:i,capitalizeFirst:a,children:t})}function Dg(){return!(function(){let t=(0,i.useContext)(Od)!==Ed,[e,n]=(0,i.useState)(t);return typeof window<"u"&&t&&(0,i.useLayoutEffect)((()=>{n(!1)}),[]),e}()||typeof window>"u")&&window.screen.width<=768}const Rg={initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:"tween",duration:.125}};function Ig(){const{width:t,height:e}=function(){let[t,e]=(0,i.useState)((()=>Hd()));return(0,i.useEffect)((()=>{let t=()=>{e((t=>{let e=Hd();return e.width===t.width&&e.height===t.height?t:e}))};return Vd?Vd.addEventListener("resize",t):window.addEventListener("resize",t),()=>{Vd?Vd.removeEventListener("resize",t):window.removeEventListener("resize",t)}}),[]),t}();return{"--be-viewport-height":`${e}px`,"--be-viewport-width":`${t}px`}}class Lg{isDefaultPrevented(){return this.nativeEvent.defaultPrevented}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this.nativeEvent.stopPropagation(),this.isPropagationStopped=()=>!0}isPropagationStopped(){return!1}persist(){}constructor(t,e){this.nativeEvent=e,this.target=e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget,this.bubbles=e.bubbles,this.cancelable=e.cancelable,this.defaultPrevented=e.defaultPrevented,this.eventPhase=e.eventPhase,this.isTrusted=e.isTrusted,this.timeStamp=e.timeStamp,this.type=t}}i.createContext(null).displayName="PressResponderContext";let zg=null,Fg=new Set,Ng=!1,Bg=!1,Vg=!1;function Hg(t,e){for(let n of Fg)n(t,e)}function Wg(t){Bg=!0,function(t){return!(t.metaKey||!Wd()&&t.altKey||t.ctrlKey||"Control"===t.key||"Shift"===t.key||"Meta"===t.key)}(t)&&(zg="keyboard",Hg("keyboard",t))}function Ug(t){zg="pointer",("mousedown"===t.type||"pointerdown"===t.type)&&(Bg=!0,Hg("pointer",t))}function Yg(t){(function(t){return!(0!==t.mozInputSource||!t.isTrusted)||0===t.detail&&!t.pointerType})(t)&&(Bg=!0,zg="virtual")}function Xg(t){t.target===window||t.target===document||(!Bg&&!Vg&&(zg="virtual",Hg("virtual",t)),Bg=!1,Vg=!1)}function Gg(){Bg=!1,Vg=!0}function $g(){if(typeof window>"u"||Ng)return;let t=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(){Bg=!0,t.apply(this,arguments)},document.addEventListener("keydown",Wg,!0),document.addEventListener("keyup",Wg,!0),document.addEventListener("click",Yg,!0),window.addEventListener("focus",Xg,!0),window.addEventListener("blur",Gg,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",Ug,!0),document.addEventListener("pointermove",Ug,!0),document.addEventListener("pointerup",Ug,!0)):(document.addEventListener("mousedown",Ug,!0),document.addEventListener("mousemove",Ug,!0),document.addEventListener("mouseup",Ug,!0)),Ng=!0}function qg(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=t,a=(0,i.useRef)({isFocusWithin:!1}),s=(0,i.useCallback)((t=>{a.current.isFocusWithin&&!t.currentTarget.contains(t.relatedTarget)&&(a.current.isFocusWithin=!1,n&&n(t),o&&o(!1))}),[n,o,a]),l=function(t){let e=(0,i.useRef)({isFocused:!1,onBlur:t,observer:null});return e.current.onBlur=t,Md((()=>{const t=e.current;return()=>{t.observer&&(t.observer.disconnect(),t.observer=null)}}),[]),(0,i.useCallback)((t=>{if(t.target instanceof HTMLButtonElement||t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLSelectElement){e.current.isFocused=!0;let n=t.target,r=t=>{var r,i;e.current.isFocused=!1,n.disabled&&(null===(i=(r=e.current).onBlur)||void 0===i||i.call(r,new Lg("blur",t))),e.current.observer&&(e.current.observer.disconnect(),e.current.observer=null)};n.addEventListener("focusout",r,{once:!0}),e.current.observer=new MutationObserver((()=>{e.current.isFocused&&n.disabled&&(e.current.observer.disconnect(),n.dispatchEvent(new FocusEvent("blur")),n.dispatchEvent(new FocusEvent("focusout",{bubbles:!0})))})),e.current.observer.observe(n,{attributes:!0,attributeFilter:["disabled"]})}}),[])}(s),c=(0,i.useCallback)((t=>{a.current.isFocusWithin||(r&&r(t),o&&o(!0),a.current.isFocusWithin=!0,l(t))}),[r,o,l]);return e?{focusWithinProps:{onFocus:null,onBlur:null}}:{focusWithinProps:{onFocus:c,onBlur:s}}}function Kg(t,e){if(t.button>0)return!1;if(t.target){const e=t.target.ownerDocument;if(!e||!e.documentElement.contains(t.target))return!1}return e.current&&!e.current.contains(t.target)}function Zg(t){if("virtual"===zg){let e=document.activeElement;!function(t){requestAnimationFrame((()=>{0===Ld.size?t():zd.add(t)}))}((()=>{document.activeElement===e&&document.contains(t)&&Rd(t)}))}else Rd(t)}function Jg(t,e){return"#comment"!==t.nodeName&&function(t){if(!(t instanceof HTMLElement)&&!(t instanceof SVGElement))return!1;let{display:e,visibility:n}=t.style,r="none"!==e&&"hidden"!==n&&"collapse"!==n;if(r){const{getComputedStyle:e}=t.ownerDocument.defaultView;let{display:n,visibility:i}=e(t);r="none"!==n&&"hidden"!==i&&"collapse"!==i}return r}(t)&&function(t,e){return!t.hasAttribute("hidden")&&("DETAILS"!==t.nodeName||!e||"SUMMARY"===e.nodeName||t.hasAttribute("open"))}(t,e)&&(!t.parentElement||Jg(t.parentElement,t))}typeof document<"u"&&("loading"!==document.readyState?$g():document.addEventListener("DOMContentLoaded",$g));const Qg=i.createContext(null);let tm=null,em=new Map;function nm(t){let{children:e,contain:n,restoreFocus:r,autoFocus:o}=t,a=(0,i.useRef)(),s=(0,i.useRef)(),l=(0,i.useRef)([]),c=(0,i.useContext)(Qg),u=null==c?void 0:c.scopeRef;Md((()=>{let t=a.current.nextSibling,e=[];for(;t&&t!==s.current;)e.push(t),t=t.nextSibling;l.current=e}),[e,u]),Md((()=>(em.set(l,u),()=>{(l===tm||cm(l,tm))&&(!u||em.has(u))&&(tm=u),em.delete(l)})),[l,u]),function(t,e){let n=(0,i.useRef)(),r=(0,i.useRef)(null);Md((()=>{let i=t.current;if(!e)return void(r.current&&(cancelAnimationFrame(r.current),r.current=null));let o=e=>{if("Tab"!==e.key||e.altKey||e.ctrlKey||e.metaKey||t!==tm)return;let n=document.activeElement,r=t.current;if(!sm(n,r))return;let i=dm(am(r),{tabbable:!0},r);i.currentNode=n;let o=e.shiftKey?i.previousNode():i.nextNode();o||(i.currentNode=e.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,o=e.shiftKey?i.previousNode():i.nextNode()),e.preventDefault(),o&&um(o,!0)},a=e=>{!tm||cm(tm,t)?(tm=t,n.current=e.target):t!==tm||lm(e.target,t)?t===tm&&(n.current=e.target):n.current?n.current.focus():tm&&hm(tm.current)},s=e=>{r.current=requestAnimationFrame((()=>{t===tm&&!lm(document.activeElement,t)&&(tm=t,n.current=e.target,n.current.focus())}))};return document.addEventListener("keydown",o,!1),document.addEventListener("focusin",a,!1),i.forEach((t=>t.addEventListener("focusin",a,!1))),i.forEach((t=>t.addEventListener("focusout",s,!1))),()=>{document.removeEventListener("keydown",o,!1),document.removeEventListener("focusin",a,!1),i.forEach((t=>t.removeEventListener("focusin",a,!1))),i.forEach((t=>t.removeEventListener("focusout",s,!1)))}}),[t,e]),(0,i.useEffect)((()=>()=>{r.current&&cancelAnimationFrame(r.current)}),[r])}(l,n),function(t,e,n){const r=(0,i.useRef)(typeof document<"u"?document.activeElement:null);Md((()=>{let i=r.current;if(!e)return;let o=e=>{if("Tab"!==e.key||e.altKey||e.ctrlKey||e.metaKey)return;let n=document.activeElement;if(!sm(n,t.current))return;let r=dm(document.body,{tabbable:!0});r.currentNode=n;let o=e.shiftKey?r.previousNode():r.nextNode();if((!document.body.contains(i)||i===document.body)&&(i=null),(!o||!sm(o,t.current))&&i){r.currentNode=i;do{o=e.shiftKey?r.previousNode():r.nextNode()}while(sm(o,t.current));e.preventDefault(),e.stopPropagation(),o?um(o,!0):function(t){for(let e of em.keys())if(sm(t,e.current))return!0;return!1}(i)?um(i,!0):n.blur()}};return n||document.addEventListener("keydown",o,!0),()=>{n||document.removeEventListener("keydown",o,!0),e&&i&&sm(document.activeElement,t.current)&&requestAnimationFrame((()=>{document.body.contains(i)&&document.activeElement===document.body&&um(i)}))}}),[t,e,n])}(l,r,n),function(t,e){const n=i.useRef(e);(0,i.useEffect)((()=>{n.current&&(tm=t,sm(document.activeElement,tm.current)||hm(t.current)),n.current=!1}),[])}(l,o);let h=function(t){return{focusNext(e={}){let n=t.current,{from:r,tabbable:i,wrap:o,accept:a}=e,s=r||document.activeElement,l=n[0].previousElementSibling,c=dm(am(n),{tabbable:i,accept:a},n);c.currentNode=sm(s,n)?s:l;let u=c.nextNode();return!u&&o&&(c.currentNode=l,u=c.nextNode()),u&&um(u,!0),u},focusPrevious(e={}){let n=t.current,{from:r,tabbable:i,wrap:o,accept:a}=e,s=r||document.activeElement,l=n[n.length-1].nextElementSibling,c=dm(am(n),{tabbable:i,accept:a},n);c.currentNode=sm(s,n)?s:l;let u=c.previousNode();return!u&&o&&(c.currentNode=l,u=c.previousNode()),u&&um(u,!0),u},focusFirst(e={}){let n=t.current,{tabbable:r,accept:i}=e,o=dm(am(n),{tabbable:r,accept:i},n);o.currentNode=n[0].previousElementSibling;let a=o.nextNode();return a&&um(a,!0),a},focusLast(e={}){let n=t.current,{tabbable:r,accept:i}=e,o=dm(am(n),{tabbable:r,accept:i},n);o.currentNode=n[n.length-1].nextElementSibling;let a=o.previousNode();return a&&um(a,!0),a}}}(l);return i.createElement(Qg.Provider,{value:{scopeRef:l,focusManager:h}},i.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:a}),e,i.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:s}))}const rm=["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]"],im=rm.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";rm.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const om=rm.join(':not([hidden]):not([tabindex="-1"]),');function am(t){return t[0].parentElement}function sm(t,e){return e.some((e=>e.contains(t)))}function lm(t,e){for(let n of em.keys())if((n===e||cm(e,n))&&sm(t,n.current))return!0;return!1}function cm(t,e){let n=em.get(e);return!!n&&(n===t||cm(t,n))}function um(t,e=!1){if(null==t||e){if(null!=t)try{t.focus()}catch{}}else try{Zg(t)}catch{}}function hm(t){let e=t[0].previousElementSibling,n=dm(am(t),{tabbable:!0},t);n.currentNode=e,um(n.nextNode())}function dm(t,e,n){let r=null!=e&&e.tabbable?om:im,i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){var i;return null!=e&&null!==(i=e.from)&&void 0!==i&&i.contains(t)?NodeFilter.FILTER_REJECT:!t.matches(r)||!Jg(t)||n&&!sm(t,n)||null!=e&&e.accept&&!e.accept(t)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});return null!=e&&e.from&&(i.currentNode=e.from),i}let fm=new Map,pm=!1;try{pm="exceptZero"===new Intl.NumberFormat("de-DE",{signDisplay:"exceptZero"}).resolvedOptions().signDisplay}catch{}let gm=!1;try{gm="unit"===new Intl.NumberFormat("de-DE",{style:"unit",unit:"degree"}).resolvedOptions().style}catch{}const mm={degree:{narrow:{default:"\xb0","ja-JP":" \u5ea6","zh-TW":"\u5ea6","sl-SI":" \xb0"}}};class vm{format(t){let e="";if(e=pm||null==this.options.signDisplay?this.numberFormatter.format(t):function(t,e,n){if("auto"===e)return t.format(n);if("never"===e)return t.format(Math.abs(n));{let r=!1;if("always"===e?r=n>0||Object.is(n,0):"exceptZero"===e&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let e=t.format(-n),r=t.format(n),i=e.replace(r,"").replace(/\u200e|\u061C/,"");return 1!==[...i].length&&console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case"),e.replace(r,"!!!").replace(i,"+").replace("!!!",r)}return t.format(n)}}(this.numberFormatter,this.options.signDisplay,t),"unit"===this.options.style&&!gm){var n;let{unit:t,unitDisplay:r="short",locale:i}=this.resolvedOptions(),o=null===(n=mm[t])||void 0===n?void 0:n[r];e+=o[i]||o.default}return e}formatToParts(t){return this.numberFormatter.formatToParts(t)}formatRange(t,e){if("function"==typeof this.numberFormatter.formatRange)return this.numberFormatter.formatRange(t,e);if(e<t)throw new RangeError("End date must be >= start date");return`${this.format(t)} \u2013 ${this.format(e)}`}formatRangeToParts(t,e){if("function"==typeof this.numberFormatter.formatRangeToParts)return this.numberFormatter.formatRangeToParts(t,e);if(e<t)throw new RangeError("End date must be >= start date");let n=this.numberFormatter.formatToParts(t),r=this.numberFormatter.formatToParts(e);return[...n.map((t=>({...t,source:"startRange"}))),{type:"literal",value:" \u2013 ",source:"shared"},...r.map((t=>({...t,source:"endRange"})))]}resolvedOptions(){let t=this.numberFormatter.resolvedOptions();return!pm&&null!=this.options.signDisplay&&(t={...t,signDisplay:this.options.signDisplay}),!gm&&"unit"===this.options.style&&(t={...t,style:"unit",unit:this.options.unit,unitDisplay:this.options.unitDisplay}),t}constructor(t,e={}){this.numberFormatter=function(t,e={}){let{numberingSystem:n}=e;if(n&&-1===t.indexOf("-u-nu-")&&(t=`${t}-u-nu-${n}`),"unit"===e.style&&!gm){var r;let{unit:t,unitDisplay:n="short"}=e;if(!t)throw new Error('unit option must be provided with style: "unit"');if(null===(r=mm[t])||void 0===r||!r[n])throw new Error(`Unsupported unit ${t} with unitDisplay = ${n}`);e={...e,style:"decimal"}}let i=t+(e?Object.entries(e).sort(((t,e)=>t[0]<e[0]?-1:1)).join():"");if(fm.has(i))return fm.get(i);let o=new Intl.NumberFormat(t,e);return fm.set(i,o),o}(t,e),this.options=e}}const bm=[];function ym(t,e){let{onClose:n,shouldCloseOnBlur:r,isOpen:o,isDismissable:a=!1,isKeyboardDismissDisabled:s=!1,shouldCloseOnInteractOutside:l}=t;(0,i.useEffect)((()=>(o&&bm.push(e),()=>{let t=bm.indexOf(e);t>=0&&bm.splice(t,1)})),[o,e]);let c=()=>{bm[bm.length-1]===e&&n&&n()};!function(t){let{ref:e,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:o}=t,a=(0,i.useRef)({isPointerDown:!1,ignoreEmulatedMouseEvents:!1,onInteractOutside:n,onInteractOutsideStart:o}).current;a.onInteractOutside=n,a.onInteractOutsideStart=o,(0,i.useEffect)((()=>{if(r)return;let t=t=>{Kg(t,e)&&a.onInteractOutside&&(a.onInteractOutsideStart&&a.onInteractOutsideStart(t),a.isPointerDown=!0)};if(typeof PointerEvent<"u"){let n=t=>{a.isPointerDown&&a.onInteractOutside&&Kg(t,e)&&(a.isPointerDown=!1,a.onInteractOutside(t))};return document.addEventListener("pointerdown",t,!0),document.addEventListener("pointerup",n,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("pointerup",n,!0)}}{let n=t=>{a.ignoreEmulatedMouseEvents?a.ignoreEmulatedMouseEvents=!1:a.isPointerDown&&a.onInteractOutside&&Kg(t,e)&&(a.isPointerDown=!1,a.onInteractOutside(t))},r=t=>{a.ignoreEmulatedMouseEvents=!0,a.onInteractOutside&&a.isPointerDown&&Kg(t,e)&&(a.isPointerDown=!1,a.onInteractOutside(t))};return document.addEventListener("mousedown",t,!0),document.addEventListener("mouseup",n,!0),document.addEventListener("touchstart",t,!0),document.addEventListener("touchend",r,!0),()=>{document.removeEventListener("mousedown",t,!0),document.removeEventListener("mouseup",n,!0),document.removeEventListener("touchstart",t,!0),document.removeEventListener("touchend",r,!0)}}}),[e,a,r])}({ref:e,onInteractOutside:a?t=>{(!l||l(t.target))&&(bm[bm.length-1]===e&&(t.stopPropagation(),t.preventDefault()),c())}:null,onInteractOutsideStart:t=>{(!l||l(t.target))&&bm[bm.length-1]===e&&(t.stopPropagation(),t.preventDefault())}});let{focusWithinProps:u}=qg({isDisabled:!r,onBlurWithin:t=>{(!l||l(t.relatedTarget))&&n()}});return{overlayProps:{onKeyDown:t=>{"Escape"===t.key&&!s&&(t.stopPropagation(),t.preventDefault(),c())},...u},underlayProps:{onPointerDown:t=>{t.target===t.currentTarget&&t.preventDefault()}}}}const xm=(0,i.forwardRef)((({children:t,style:e,autoFocus:n=!1,restoreFocus:r=!0,isDismissable:o,isOpen:a,onClose:s,triggerRef:l,arrowRef:c,arrowStyle:u},h)=>{const d=Ig(),f=Bd(h),{overlayProps:p}=ym({isDismissable:o,isOpen:a,onClose:s,shouldCloseOnInteractOutside:t=>{var e,n;return!l.current||!(null!=(n=(e=l.current).contains)&&n.call(e,t))}},f);return(0,i.useEffect)((()=>{if(!a)return;const t=t=>{const e=t.target;if(l.current){if(!(l.current instanceof Node))return void s();(!(e instanceof Node)||e.contains(l.current))&&s()}};return requestAnimationFrame((()=>{window.addEventListener("scroll",t,!0)})),()=>{window.removeEventListener("scroll",t,!0)}}),[a,s,l]),ar(fd.div,{className:"z-popover isolate",role:"presentation",ref:f,style:Dd(d,e),...Rg,...p,children:ar(nm,{restoreFocus:r,autoFocus:n,contain:!1,children:t})})})),wm={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}};function _m({position:t="absolute",className:e,isTransparent:n=!1,disableInitialTransition:r,...i}){return ar(fd.div,{...i,className:yr(e,!n&&"bg-black/30","w-full h-full inset-0 z-10",t),"aria-hidden":!0,initial:r?void 0:{opacity:0},animate:{opacity:1},exit:{opacity:0},...wm,transition:{duration:.3}})}const Sm=(0,i.forwardRef)((({children:t,autoFocus:e=!1,restoreFocus:n=!0,isDismissable:r,isOpen:i,onClose:o},a)=>{const s=Ig(),l=Bd(a);return sr("div",{className:"isolate z-tray fixed inset-0",style:s,children:[ar(_m,{onClick:()=>{r&&o()}},"tray-underlay"),ar(fd.div,{ref:l,className:"absolute bottom-0 left-0 right-0 w-full z-20 rounded-t overflow-hidden max-w-375 max-h-tray mx-auto 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:ar(nm,{restoreFocus:n,autoFocus:e,contain:!0,children:t})})]})}));function Cm(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e),i=n.length;if(r.length!==i)return!1;for(let o=0;o<i;o++){const r=n[o];if(t[r]!==e[r]||!Object.prototype.hasOwnProperty.call(e,r))return!1}return!0}const km=(0,i.createContext)(null);function Tm(){const{data:{i18n:t}}=(0,i.useContext)(km);return{locale:t,localeCode:(null==t?void 0:t.language)||"en",lines:null==t?void 0:t.lines}}function Em(t,{message:e,values:n}){const r=e.match(/\[(.+?)]/),i=null==n?void 0:n.count;if(r&&r[1]&&!Number.isNaN(i)){const[n,o]=r,a=o.split("|");if(!a.length)return e;const s=Om(t).select(i);let l=a.find((t=>t.startsWith(s)));l||(l=a[0]);const c=l.substring(l.indexOf(" ")+1);return e.replace(n,c)}return e}const Om=bp((t=>new Intl.PluralRules(t))),Mm=(0,i.memo)((t=>{const{message:e,values:n}=t,{lines:r,localeCode:o}=Tm();let a=(null==r?void 0:r[e])||e;if(!n)return ar(i.Fragment,{children:a});a=Em(o,{message:a,values:n});const s=[],l=[];if(Object.entries(n).forEach((([t,e])=>{"function"==typeof e?l.push(t):(0,i.isValidElement)(e)?s.push(t):null!=e&&(a=a.replace(`:${t}`,`${e}`))})),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 e=new RegExp(t.join("|"),"gm"),r=a.split(e).filter(Boolean).map(((t,e)=>{if(t.startsWith("<")&&t.endsWith(">")){const r=t.match(/<([a-z]+)>(.+?)<\/([a-z]+)>/);if(r){const[,t,o]=r,a=null==n?void 0:n[t];if("function"==typeof a){const t=a(o);return(0,i.cloneElement)(t,{key:e})}}}if(t.startsWith(":")){const r=t.replace(":",""),o=null==n?void 0:n[r];if((0,i.isValidElement)(o))return(0,i.cloneElement)(o,{key:e})}return t}));return ar(i.Fragment,{children:r})}return ar(i.Fragment,{children:a})}),(function(t,e){const{values:n,...r}=t,{values:i,...o}=e;return Cm(i,n)&&Cm(r,o)}));function Pm({listbox:t,children:e,isLoading:n,mobileOverlay:r=Sm,...a}){const s=Dg(),{floatingWidth:l,floatingMinWidth:c="min-w-180",collection:u,showEmptyMessage:h,state:{isOpen:d,setIsOpen:f},positionStyle:p,floating:g,refs:m}=t,v=s?r:xm,b=yr("py-4 text-base sm:text-sm outline-none bg-paper shadow-xl border max-h-inherit overflow-x-auto",v===xm&&"rounded",v===xm&&"auto"===l?`max-w-288 ${c}`:""),y=(0,i.useMemo)((()=>{let t=0;const e=[];return[...u.values()].reduce(((n,r)=>{if(r.section){if(!e.includes(r.section)){const o=(0,i.cloneElement)(r.section,{key:r.section.key||t,index:t});n.push(o),e.push(r.section),t++}}else n.push((0,i.cloneElement)(r.element,{key:r.element.key||r.element.props.value}));return n}),[])}),[u]);return sr(Eg.Provider,{value:t,children:[e,Ca&&(0,o.createPortal)(ar(xd,{children:d&&(y.length>0||h)&&ar(v,{triggerRef:m.reference,restoreFocus:!0,isOpen:d,onClose:()=>{f(!1)},isDismissable:!0,style:p,ref:g,children:ar(Am,{isLoading:n,className:b,...a,children:y})})}),Ca)]})}function Am({className:t,children:e,isLoading:n,...r}){const{role:o,listboxId:a,virtualFocus:s,focusItem:l,state:{activeIndex:c,setActiveIndex:u}}=Og(),h=(0,i.useRef)(!0),d=(0,i.useRef)(null);return(0,i.useEffect)((()=>()=>u(null)),[u]),(0,i.useEffect)((()=>{h.current&&(null!=c||s?null!=c&&requestAnimationFrame((()=>{l("increment",c)})):requestAnimationFrame((()=>{var t;null==(t=d.current)||t.focus({preventScroll:!0})}))),h.current=!1}),[c,l,s]),ar("div",{tabIndex:-1,role:o,id:a,className:t,ref:d,...r,children:e.length?e:ar(jm,{isLoading:n})})}function jm({isLoading:t}){return ar("div",{className:"italic px-8 py-4 text-sm text-muted",children:ar(Mm,t?{message:"Loading..."}:{message:"There are no items matching your query"})})}function Dm({state:{isOpen:t,setIsOpen:e,selectedIndex:n,activeIndex:r},loopFocus:i,collection:o,focusItem:a}){return{handleTriggerKeyDown:r=>{if(!t&&r.currentTarget.contains(r.target)){if("ArrowDown"===r.key)return r.preventDefault(),e(!0),a("increment",null!=n?n:0),!0;if("ArrowUp"===r.key)return r.preventDefault(),e(!0),a("decrement",null!=n?n:o.size-1),!0;if("Enter"===r.key||"Space"===r.key)return r.preventDefault(),e(!0),a("increment",null!=n?n:0),!0}},handleListboxKeyboardNavigation:n=>{const s=Math.max(0,o.size-1);if(t&&n.currentTarget.contains(n.target))switch(n.key){case"ArrowDown":return n.preventDefault(),null==r?a("increment",0):r>=s?i&&a("increment",0):a("increment",r+1),!0;case"ArrowUp":return n.preventDefault(),null==r?a("decrement",s):r<=0?i&&a("decrement",s):a("decrement",r-1),!0;case"Home":return n.preventDefault(),a("increment",0),!0;case"End":return n.preventDefault(),a("decrement",s),!0;case"Tab":return e(!1),!0}}}}const Rm=new Map;function Im(){const t=function(t){const{localeCode:e}=Tm(),n=e+(t?Object.entries(t).sort(((t,e)=>t[0]<e[0]?-1:1)).join():"");if(Rm.has(n))return Rm.get(n);const r=new Intl.Collator(e,t);return Rm.set(n,r),r}({usage:"search",sensitivity:"base"}),e=(0,i.useRef)({search:"",timeout:void 0}).current,n=(n,r)=>{let i=null!=r?r:0;for(;null!=i;){const r=n[i],o=null==r?void 0:r.slice(0,e.search.length);if(o&&0===t.compare(o,e.search))return i;if(!(i<n.length-1))return null;i++}return null};return{findMatchingItem:(t,r,i=0)=>{const o=function(t){return 1!==t.length&&/^[A-Z]/i.test(t)?"":t}(t.key);if(!o||t.ctrlKey||t.metaKey)return null;" "===o&&e.search.trim().length>0&&(t.preventDefault(),t.stopPropagation()),e.search+=o;let a=n(r,i);return null==a&&(a=n(r,0)),clearTimeout(e.timeout),e.timeout=setTimeout((()=>{e.search=""}),500),null!=a?a:null}}}function Lm(t){return function(t,{noSSR:e}={noSSR:!0}){const n=typeof window<"u"&&"function"==typeof window.matchMedia,[r,o]=(0,i.useState)(e?()=>!!n&&window.matchMedia(t).matches:null);return(0,i.useEffect)((()=>{if(!n)return;const r=window.matchMedia(t),i=()=>{o(r.matches)};return r.addEventListener("change",i),e||i(),()=>{r.removeEventListener("change",i)}}),[n,t,e]),typeof window>"u"?null:r}("(max-width: 768px)",t)}const zm=(0,i.forwardRef)(((t,e)=>{const{children:[n,r],floatingWidth:o="auto"}=t,a=(0,i.useId)(),s=Lm(),l=Tg({...t,floatingWidth:s?o:"auto",role:"menu",loopFocus:!0,children:r.props.children},e),{state:{isOpen:c,setIsOpen:u,activeIndex:h},listboxId:d,focusItem:f,listContent:p,reference:g}=l,{handleTriggerKeyDown:m,handleListboxKeyboardNavigation:v}=Dm(l),{findMatchingItem:b}=Im();return ar(Pm,{listbox:l,"aria-labelledby":a,onKeyDownCapture:t=>{if(!c)return;const e=b(t,p,h);e&&f("increment",e)},onKeyDown:v,children:(0,i.cloneElement)(n,{id:a,"aria-expanded":c?"true":"false","aria-haspopup":"menu","aria-controls":c?d:void 0,ref:g,onKeyDown:m,onClick:fp((t=>{var e,r;null==(r=null==(e=n.props)?void 0:e.onClick)||r.call(e,t),u(!c)}))})})}));function Fm({children:t}){return t}function Nm({item:t,button:e}){return sr(zm,{children:[e,ar(Fm,{children:(t.menuItems||[]).map((t=>ar(jg,{value:t.label,onSelected:()=>{t.action(Oa().editor)},children:t.label},t.label)))})]})}const Bm=(0,i.forwardRef)((({children:t,size:e="md",iconSize:n=e||"md",variant:r="text",radius:o="rounded-full",className:a,padding:s,equalWidth:l=!0,...c},u)=>{const h=yr(up(e,{padding:s,equalWidth:l,variant:r}),a);return ar(pp,{...c,ref:u,radius:o,variant:r,className:h,children:i.cloneElement(t,{size:n})})}));const Vm=i.memo((function({icon:t,className:e,size:n}){let r;return r=i.isValidElement(t)?i.cloneElement(t,{className:"svg-iconEl"}):"string"==typeof t?ar("img",{className:"w-font h-font",src:t,alt:""}):Array.isArray(t)?i.createElement(Sr(t),{size:n}):i.createElement(t,{size:n}),ar("span",{className:yr(e,"leading-none"),children:r})}));function Hm({value:t}){return t?"string"==typeof t?ar(i.Fragment,{children:t}):ar(Mm,{...t}):null}function Wm({item:t}){const e=t.label?ar(Ym,{item:t}):ar(Um,{item:t});return t.menuItems?ar(Nm,{item:t,button:e}):i.cloneElement(e,{onClick:()=>{var e;null==(e=t.action)||e.call(t,Oa().editor)}})}const Um=(0,i.forwardRef)((({item:t,...e},n)=>ar(Bm,{ref:n,radius:"rounded-full",size:"sm",...e,children:ar(Vm,{icon:t.icon})}))),Ym=(0,i.forwardRef)((({item:t,...e},n)=>ar(gp,{ref:n,radius:"rounded-full",size:"xs",color:t.buttonColor||"primary",variant:t.buttonVariant||"flat",startIcon:t.icon&&ar(Vm,{icon:t.icon}),...e,children:ar(Hm,{value:t.label})})));function Xm({children:t,color:e,variant:n,radius:r,size:o,className:a,value:s,onChange:l,multiple:c,disabled:u}){const h=i.Children.map(t,((a,h)=>{if(i.isValidElement(a)){const d=(t=>void 0!==s&&(c?s.includes(t):t===s))(a.props.value),f=d?"primary":e;return i.cloneElement(a,{color:d?"primary":e,variant:n,size:o,radius:null,disabled:a.props.disabled||u,...a.props,onClick:t=>{a.props.onClick&&a.props.onClick(t),l&&(c?null==l||l((t=>{const e=[...s],n=s.indexOf(t);return n>-1?e.splice(n,1):e.push(t),e})(a.props.value)):null==l||l(a.props.value))},className:yr(a.props.className,d?"z-20":"z-10",Gm(h,t,r,f))})}}));return ar("div",{className:yr(r,"inline-flex isolate",a),children:h})}function Gm(t,e,n,r){return 0===t?yr(n,"rounded-tr-none rounded-br-none",!r&&"border-r-transparent disabled:border-r-transparent"):t===e.length-1?yr(n,"rounded-tl-none rounded-bl-none -ml-1"):yr("rounded-none -ml-1",!r&&"border-r-transparent disabled:border-r-transparent")}const $m=_r(ar("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"),qm=_r(ar("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 Km(){const t=Ea((t=>t.history.canUndo)),e=Ea((t=>t.history.canRedo));return sr(Xm,{variant:"outline",children:[ar(Bm,{equalWidth:!1,size:"xs",padding:"pl-12 pr-10",radius:"rounded-full",disabled:!t,onClick:()=>{Ma().history.undo()},children:ar($m,{})}),ar(Bm,{equalWidth:!1,padding:"pl-10 pr-12",size:"xs",radius:"rounded-full",disabled:!e,onClick:()=>{Ma().history.redo()},children:ar(qm,{})})]})}const Zm=_r(ar("path",{d:"M19 13H5v-2h14v2z"}),"RemoveOutlined"),Jm=_r(ar("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"AddOutlined");function Qm(){var t,e,n;const r=Ea((t=>t.zoom))||1;return null==(t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.zoom)?void 0:n.allowUserZoom})))||t?sr("div",{className:"flex items-center select-none",children:[ar(Bm,{size:"sm",disabled:!(null!=(e=Ma().zoom)&&e.canZoomOut()),onClick:()=>{Ma().zoom.zoomOut(Ma().zoom.step)},children:ar(Zm,{})}),sr("div",{className:"w-[4ch] text-sm text-center",children:[Math.round(100*r),"%"]}),ar(Bm,{size:"sm",disabled:!(null!=(n=Ma().zoom)&&n.canZoomIn()),onClick:()=>{Ma().zoom.zoomIn(Ma().zoom.step)},children:ar(Jm,{})})]}):null}function tv({item:t}){switch(t.type){case"undoWidget":return ar(Km,{});case"zoomWidget":return ar(Qm,{});case"button":return ar(Wm,{item:t});case"image":return ar("img",{className:"h-30 object-cover",src:uf(t.src),alt:""});default:return null}}const ev=_r(ar("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 nv(){var t;let e=Ea((t=>{var e;return(null==(e=t.config.ui)?void 0:e.mode)===lr.OVERLAY}));const{width:n}=Ea((t=>t.stageSize)),r=n<=700;return r&&(null==(t=Oa().config.ui)?void 0:t.forceOverlayModeOnMobile)&&(e=!0),{isModal:e,isMobile:r}}function rv(){var t;const{isModal:e,isMobile:n}=nv(),r=null==(t=Ea((t=>{var e;return null==(e=t.config.ui)?void 0:e.allowEditorClose})))||t,o=Ea((t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.menubar)?void 0:n.items})),{left:a,center:s,right:l}=(0,i.useMemo)((()=>function(t,e){const n={left:[],center:[],right:[]};(t||[]).filter((t=>!e&&!t.mobileOnly||e&&!t.desktopOnly)).forEach((t=>{var e,r,i;"left"===t.align?n.left.push({...t,position:null!=(e=t.position)?e:1}):"right"===t.align?n.right.push({...t,position:null!=(r=t.position)?r:1}):n.center.push({...t,position:null!=(i=t.position)?i:1})}));const r=Object.entries(n).map((([t,e])=>[t,e.sort(((t,e)=>{var n,r;return(null!=(n=t.position)?n:0)-(null!=(r=e.position)?r:0)}))]));return Object.fromEntries(r)}(o||[],n)),[o,n]),c=e&&n&&r&&ar(Bm,{size:"sm",className:"ml-10",onClick:()=>{Oa().editor.close()},children:ar(ev,{})});return sr(fd.div,{className:lp,...cp,children:[ar("div",{className:"mr-auto flex items-center gap-8",children:a.map(((t,e)=>ar(tv,{item:t},e)))}),ar("div",{className:"flex items-center gap-10",children:s.map(((t,e)=>ar(tv,{item:t},e)))}),ar("div",{className:"ml-auto flex items-center gap-8",children:l.map(((t,e)=>ar(tv,{item:t},e)))}),c]})}function iv(){const t=Ea((t=>{var e;return null==(e=t.crop.zoneRect)?void 0:e.width}))||1,e=Ea((t=>{var e;return null==(e=t.crop.zoneRect)?void 0:e.height}))||1;return ar("div",{className:"text-sm",children:`${t}x${e}`})}function ov(){const t=Ea((t=>t.activeTool));return sr(fd.div,{className:lp,...cp,children:[ar(av,{}),sv(t),ar(lv,{})]})}function av(){const{isMobile:t}=nv(),e=Ea((t=>t.dirty));return t?ar(Bm,{size:"sm",onClick:()=>{Oa().cancelChanges()},children:ar(ev,{})}):ar(gp,{variant:"outline",size:"xs",startIcon:ar(ev,{}),radius:"rounded-full",onClick:()=>{Oa().cancelChanges()},children:ar(Mm,e?{message:"Cancel"}:{message:"Close"})})}function sv(t){var e,n,r;const i=ar("div",{className:"capitalize text-sm",children:t});return t===vr.CROP&&(null==(r=null==(n=null==(e=Oa().config.tools)?void 0:e.crop)?void 0:n.allowCustomRatio)||r)?ar(iv,{}):i}function lv(){const{isMobile:t}=nv(),e=Ea((t=>t.dirty));return t?ar(Bm,{size:"sm",disabled:!e,onClick:()=>{Oa().applyChanges()},children:ar(Mg,{})}):ar(gp,{variant:"flat",color:"primary",size:"xs",disabled:!e,startIcon:ar(Mg,{}),radius:"rounded-full",onClick:()=>{Oa().applyChanges()},children:ar(Mm,{message:"Apply"})})}function cv(){const t=Ea((t=>t.activeTool));return ar(xd,{initial:!1,children:t?ar(ov,{},"activeToolbar"):ar(rv,{},"mainToolbar")})}const uv={newCanvas:ur("Loading Canvas"),mainImage:ur("Loading Image"),state:ur("Loading State"),merge:ur("Processing Image")};function hv(){const[t,e]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{Ea.subscribe((t=>t.loading),(t=>{t&&e(t)}))}),[]),ar(xd,{children:t&&ar(fd.div,{initial:{y:"60%",opacity:0},animate:{y:0,opacity:1},exit:{y:"-60%",opacity:0},transition:{type:"tween",duration:.3},onAnimationComplete:()=>{setTimeout((()=>{e(!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:ar(Mm,{...uv[t]})})})}const dv={toVector:(t,e)=>(void 0===t&&(t=e),Array.isArray(t)?t:[t,t]),add:(t,e)=>[t[0]+e[0],t[1]+e[1]],sub:(t,e)=>[t[0]-e[0],t[1]-e[1]],addTo(t,e){t[0]+=e[0],t[1]+=e[1]},subTo(t,e){t[0]-=e[0],t[1]-=e[1]}};function fv(t,e,n){return 0===e||Math.abs(e)===1/0?Math.pow(t,5*n):t*e*n/(e+n*t)}function pv(t,e,n,r=.15){return 0===r?function(t,e,n){return Math.max(e,Math.min(t,n))}(t,e,n):t<e?-fv(e-t,n-e,r)+e:t>n?+fv(t-n,n-e,r)+n:t}function gv(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function vv(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?mv(Object(n),!0).forEach((function(e){gv(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mv(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}const bv={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 yv(t){return t?t[0].toUpperCase()+t.slice(1):""}const xv=["enter","leave"];function wv(t,e="",n=!1){const r=bv[t],i=r&&r[e]||e;return"on"+yv(t)+yv(i)+(function(t=!1,e){return t&&!xv.includes(e)}(n,i)?"Capture":"")}const _v=["gotpointercapture","lostpointercapture"];function Sv(t){let e=t.substring(2).toLowerCase();const n=!!~e.indexOf("passive");n&&(e=e.replace("passive",""));const r=_v.includes(e)?"capturecapture":"capture",i=!!~e.indexOf(r);return i&&(e=e.replace("capture","")),{device:e,capture:i,passive:n}}function Cv(t){return"touches"in t}function kv(t){return Cv(t)?"touch":"pointerType"in t?t.pointerType:"mouse"}function Tv(t){return Cv(t)?function(t){return"touchend"===t.type||"touchcancel"===t.type?t.changedTouches:t.targetTouches}(t)[0]:t}function Ev(t,e){const n=e.clientX-t.clientX,r=e.clientY-t.clientY,i=(e.clientX+t.clientX)/2,o=(e.clientY+t.clientY)/2,a=Math.hypot(n,r);return{angle:-180*Math.atan2(n,r)/Math.PI,distance:a,origin:[i,o]}}function Ov(t){return function(t){return Array.from(t.touches).filter((e=>{var n,r;return e.target===t.currentTarget||(null===(n=t.currentTarget)||void 0===n||null===(r=n.contains)||void 0===r?void 0:r.call(n,e.target))}))}(t).map((t=>t.identifier))}function Mv(t,e){const[n,r]=Array.from(t.touches).filter((t=>e.includes(t.identifier)));return Ev(n,r)}function Pv(t){const e=Tv(t);return Cv(t)?e.identifier:e.pointerId}function Av(t){const e=Tv(t);return[e.clientX,e.clientY]}function jv(t){let{deltaX:e,deltaY:n,deltaMode:r}=t;return 1===r?(e*=40,n*=40):2===r&&(e*=800,n*=800),[e,n]}function Dv(t,...e){return"function"==typeof t?t(...e):t}function Rv(){}function Iv(...t){return 0===t.length?Rv:1===t.length?t[0]:function(){let e;for(const n of t)e=n.apply(this,arguments)||e;return e}}function Lv(t,e){return Object.assign({},e,t||{})}class zv{constructor(t,e,n){this.ctrl=t,this.args=e,this.key=n,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(t){this.ctrl.state[this.key]=t}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:t,shared:e,ingKey:n,args:r}=this;e[n]=t._active=t.active=t._blocked=t._force=!1,t._step=[!1,!1],t.intentional=!1,t._movement=[0,0],t._distance=[0,0],t._direction=[0,0],t._delta=[0,0],t._bounds=[[-1/0,1/0],[-1/0,1/0]],t.args=r,t.axis=void 0,t.memo=void 0,t.elapsedTime=0,t.direction=[0,0],t.distance=[0,0],t.overflow=[0,0],t._movementBound=[!1,!1],t.velocity=[0,0],t.movement=[0,0],t.delta=[0,0],t.timeStamp=0}start(t){const e=this.state,n=this.config;e._active||(this.reset(),this.computeInitial(),e._active=!0,e.target=t.target,e.currentTarget=t.currentTarget,e.lastOffset=n.from?Dv(n.from,e):e.offset,e.offset=e.lastOffset),e.startTime=e.timeStamp=t.timeStamp}computeValues(t){const e=this.state;e._values=t,e.values=this.config.transform(t)}computeInitial(){const t=this.state;t._initial=t._values,t.initial=t.values}compute(t){const{state:e,config:n,shared:r}=this;e.args=this.args;let i=0;if(t&&(e.event=t,n.preventDefault&&t.cancelable&&e.event.preventDefault(),e.type=t.type,r.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,r.locked=!!document.pointerLockElement,Object.assign(r,function(t){const e={};if("buttons"in t&&(e.buttons=t.buttons),"shiftKey"in t){const{shiftKey:n,altKey:r,metaKey:i,ctrlKey:o}=t;Object.assign(e,{shiftKey:n,altKey:r,metaKey:i,ctrlKey:o})}return e}(t)),r.down=r.pressed=r.buttons%2===1||r.touches>0,i=t.timeStamp-e.timeStamp,e.timeStamp=t.timeStamp,e.elapsedTime=e.timeStamp-e.startTime),e._active){const t=e._delta.map(Math.abs);dv.addTo(e._distance,t)}this.axisIntent&&this.axisIntent(t);const[o,a]=e._movement,[s,l]=n.threshold,{_step:c,values:u}=e;if(n.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)),e.intentional=!1!==c[0]||!1!==c[1],!e.intentional)return;const h=[0,0];if(n.hasCustomTransform){const[t,e]=u;h[0]=!1!==c[0]?t-c[0]:0,h[1]=!1!==c[1]?e-c[1]:0}else h[0]=!1!==c[0]?o-c[0]:0,h[1]=!1!==c[1]?a-c[1]:0;this.restrictToAxis&&!e._blocked&&this.restrictToAxis(h);const d=e.offset,f=e._active&&!e._blocked||e.active;f&&(e.first=e._active&&!e.active,e.last=!e._active&&e.active,e.active=r[this.ingKey]=e._active,t&&(e.first&&("bounds"in n&&(e._bounds=Dv(n.bounds,e)),this.setup&&this.setup()),e.movement=h,this.computeOffset()));const[p,g]=e.offset,[[m,v],[b,y]]=e._bounds;e.overflow=[p<m?-1:p>v?1:0,g<b?-1:g>y?1:0],e._movementBound[0]=!!e.overflow[0]&&(!1===e._movementBound[0]?e._movement[0]:e._movementBound[0]),e._movementBound[1]=!!e.overflow[1]&&(!1===e._movementBound[1]?e._movement[1]:e._movementBound[1]);const x=e._active&&n.rubberband||[0,0];if(e.offset=function(t,[e,n],[r,i]){const[[o,a],[s,l]]=t;return[pv(e,o,a,r),pv(n,s,l,i)]}(e._bounds,e.offset,x),e.delta=dv.sub(e.offset,d),this.computeMovement(),f&&(!e.last||i>32)){e.delta=dv.sub(e.offset,d);const t=e.delta.map(Math.abs);dv.addTo(e.distance,t),e.direction=e.delta.map(Math.sign),e._direction=e._delta.map(Math.sign),!e.first&&i>0&&(e.velocity=[t[0]/i,t[1]/i])}}emit(){const t=this.state,e=this.shared,n=this.config;if(t._active||this.clean(),(t._blocked||!t.intentional)&&!t._force&&!n.triggerAllEvents)return;const r=this.handler(vv(vv(vv({},e),t),{},{[this.aliasKey]:t.values}));void 0!==r&&(t.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}class Fv extends zv{constructor(...t){super(...t),gv(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=dv.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=dv.sub(this.state.offset,this.state.lastOffset)}axisIntent(t){const e=this.state,n=this.config;if(!e.axis&&t){const r="object"==typeof n.axisThreshold?n.axisThreshold[kv(t)]:n.axisThreshold;e.axis=function([t,e],n){const r=Math.abs(t),i=Math.abs(e);return r>i&&r>n?"x":i>r&&i>n?"y":void 0}(e._movement,r)}e._blocked=(n.lockDirection||!!n.axis)&&!e.axis||!!n.axis&&n.axis!==e.axis}restrictToAxis(t){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":t[1]=0;break;case"y":t[0]=0}}}const Nv=t=>t,Bv={enabled:(t=!0)=>t,eventOptions:(t,e,n)=>vv(vv({},n.shared.eventOptions),t),preventDefault:(t=!1)=>t,triggerAllEvents:(t=!1)=>t,rubberband(t=0){switch(t){case!0:return[.15,.15];case!1:return[0,0];default:return dv.toVector(t)}},from:t=>"function"==typeof t?t:null!=t?dv.toVector(t):void 0,transform(t,e,n){const r=t||n.shared.transform;return this.hasCustomTransform=!!r,r||Nv},threshold:t=>dv.toVector(t,0)},Vv=vv(vv({},Bv),{},{axis(t,e,{axis:n}){if(this.lockDirection="lock"===n,!this.lockDirection)return n},axisThreshold:(t=0)=>t,bounds(t={}){if("function"==typeof t)return e=>Vv.bounds(t(e));if("current"in t)return()=>t.current;if("function"==typeof HTMLElement&&t instanceof HTMLElement)return t;const{left:e=-1/0,right:n=1/0,top:r=-1/0,bottom:i=1/0}=t;return[[e,n],[r,i]]}}),Hv={ArrowRight:(t=1)=>[10*t,0],ArrowLeft:(t=1)=>[-10*t,0],ArrowUp:(t=1)=>[0,-10*t],ArrowDown:(t=1)=>[0,10*t]};const Wv=typeof window<"u"&&window.document&&window.document.createElement;function Uv(){return Wv&&"ontouchstart"in window||Wv&&window.navigator.maxTouchPoints>1}const Yv={isBrowser:Wv,gesture:function(){try{return"constructor"in GestureEvent}catch{return!1}}(),touch:Uv(),touchscreen:Uv(),pointer:Wv&&"onpointerdown"in window,pointerLock:Wv&&"exitPointerLock"in window.document},Xv={mouse:0,touch:0,pen:8},Gv=vv(vv({},Vv),{},{device(t,e,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&Yv.pointerLock,Yv.touch&&n?"touch":this.pointerLock?"mouse":Yv.pointer&&!i?"pointer":Yv.touch?"touch":"mouse"},preventScrollAxis(t,e,{preventScroll:n}){if(this.preventScrollDelay="number"==typeof n?n:n||void 0===n&&t?250:void 0,Yv.touchscreen&&!1!==n)return t||(void 0!==n?"y":void 0)},pointerCapture(t,e,{pointer:{capture:n=!0,buttons:r=1}={}}){return this.pointerButtons=r,!this.pointerLock&&"pointer"===this.device&&n},keys:(t=!0)=>t,threshold(t,e,{filterTaps:n=!1,tapsThreshold:r=3,axis:i}){const o=dv.toVector(t,n?r:i?1:0);return this.filterTaps=n,this.tapsThreshold=r,o},swipe({velocity:t=.5,distance:e=50,duration:n=250}={}){return{velocity:this.transform(dv.toVector(t)),distance:this.transform(dv.toVector(e)),duration:n}},delay(t=0){switch(t){case!0:return 180;case!1:return 0;default:return t}},axisThreshold:t=>t?vv(vv({},Xv),t):Xv});const $v=vv(vv({},Bv),{},{device(t,e,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!Yv.touch&&Yv.gesture)return"gesture";if(Yv.touch&&r)return"touch";if(Yv.touchscreen){if(Yv.pointer)return"pointer";if(Yv.touch)return"touch"}},bounds(t,e,{scaleBounds:n={},angleBounds:r={}}){const i=t=>{const e=Lv(Dv(n,t),{min:-1/0,max:1/0});return[e.min,e.max]},o=t=>{const e=Lv(Dv(r,t),{min:-1/0,max:1/0});return[e.min,e.max]};return"function"!=typeof n&&"function"!=typeof r?[i(),o()]:t=>[i(t),o(t)]},threshold(t,e,n){return this.lockDirection="lock"===n.axis,dv.toVector(t,this.lockDirection?[.1,3]:0)},modifierKey:t=>void 0===t?"ctrlKey":t});vv(vv({},Vv),{},{mouseOnly:(t=!0)=>t}),vv(vv({},Vv),{},{mouseOnly:(t=!0)=>t});const qv=new Map,Kv=new Map;function Zv(t){qv.set(t.key,t.engine),Kv.set(t.key,t.resolver)}const Jv={key:"drag",engine:class extends Fv{constructor(...t){super(...t),gv(this,"ingKey","dragging")}reset(){super.reset();const t=this.state;t._pointerId=void 0,t._pointerActive=!1,t._keyboardActive=!1,t._preventScroll=!1,t._delayed=!1,t.swipe=[0,0],t.tap=!1,t.canceled=!1,t.cancel=this.cancel.bind(this)}setup(){const t=this.state;if(t._bounds instanceof HTMLElement){const e=t._bounds.getBoundingClientRect(),n=t.currentTarget.getBoundingClientRect(),r={left:e.left-n.left+t.offset[0],right:e.right-n.right+t.offset[0],top:e.top-n.top+t.offset[1],bottom:e.bottom-n.bottom+t.offset[1]};t._bounds=Vv.bounds(r)}}cancel(){const t=this.state;t.canceled||(t.canceled=!0,t._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(t){const e=this.config,n=this.state;if(null!=t.buttons&&(Array.isArray(e.pointerButtons)?!e.pointerButtons.includes(t.buttons):-1!==e.pointerButtons&&e.pointerButtons!==t.buttons))return;const r=this.ctrl.setEventIds(t);e.pointerCapture&&t.target.setPointerCapture(t.pointerId),!(r&&r.size>1&&n._pointerActive)&&(this.start(t),this.setupPointer(t),n._pointerId=Pv(t),n._pointerActive=!0,this.computeValues(Av(t)),this.computeInitial(),e.preventScrollAxis&&"mouse"!==kv(t)?(n._active=!1,this.setupScrollPrevention(t)):e.delay>0?(this.setupDelayTrigger(t),e.triggerAllEvents&&(this.compute(t),this.emit())):this.startPointerDrag(t))}startPointerDrag(t){const e=this.state;e._active=!0,e._preventScroll=!0,e._delayed=!1,this.compute(t),this.emit()}pointerMove(t){const e=this.state,n=this.config;if(!e._pointerActive||e.type===t.type&&t.timeStamp===e.timeStamp)return;const r=Pv(t);if(void 0!==e._pointerId&&r!==e._pointerId)return;const i=Av(t);return document.pointerLockElement===t.target?e._delta=[t.movementX,t.movementY]:(e._delta=dv.sub(i,e._values),this.computeValues(i)),dv.addTo(e._movement,e._delta),this.compute(t),e._delayed&&e.intentional?(this.timeoutStore.remove("dragDelay"),e.active=!1,void this.startPointerDrag(t)):n.preventScrollAxis&&!e._preventScroll?e.axis?e.axis===n.preventScrollAxis||"xy"===n.preventScrollAxis?(e._active=!1,void this.clean()):(this.timeoutStore.remove("startPointerDrag"),void this.startPointerDrag(t)):void 0:void this.emit()}pointerUp(t){this.ctrl.setEventIds(t);try{this.config.pointerCapture&&t.target.hasPointerCapture(t.pointerId)&&t.target.releasePointerCapture(t.pointerId)}catch{}const e=this.state,n=this.config;if(!e._active||!e._pointerActive)return;const r=Pv(t);if(void 0!==e._pointerId&&r!==e._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(t);const[i,o]=e._distance;if(e.tap=i<=n.tapsThreshold&&o<=n.tapsThreshold,e.tap&&n.filterTaps)e._force=!0;else{const[t,r]=e.direction,[i,o]=e.velocity,[a,s]=e.movement,[l,c]=n.swipe.velocity,[u,h]=n.swipe.distance,d=n.swipe.duration;e.elapsedTime<d&&(Math.abs(i)>l&&Math.abs(a)>u&&(e.swipe[0]=t),Math.abs(o)>c&&Math.abs(s)>h&&(e.swipe[1]=r))}this.emit()}pointerClick(t){!this.state.tap&&t.detail>0&&(t.preventDefault(),t.stopPropagation())}setupPointer(t){const e=this.config,n=e.device;e.pointerLock&&t.currentTarget.requestPointerLock(),e.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(t){this.state._preventScroll&&t.cancelable&&t.preventDefault()}setupScrollPrevention(t){this.state._preventScroll=!1,function(t){"persist"in t&&"function"==typeof t.persist&&t.persist()}(t);const e=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",e),this.eventStore.add(this.sharedConfig.window,"touch","cancel",e),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,t)}setupDelayTrigger(t){this.state._delayed=!0,this.timeoutStore.add("dragDelay",(()=>{this.state._step=[0,0],this.startPointerDrag(t)}),this.config.delay)}keyDown(t){const e=Hv[t.key];if(e){const n=this.state,r=t.shiftKey?10:t.altKey?.1:1;this.start(t),n._delta=e(r),n._keyboardActive=!0,dv.addTo(n._movement,n._delta),this.compute(t),this.emit()}}keyUp(t){t.key in Hv&&(this.state._keyboardActive=!1,this.setActive(),this.compute(t),this.emit())}bind(t){const e=this.config.device;t(e,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(t(e,"change",this.pointerMove.bind(this)),t(e,"end",this.pointerUp.bind(this)),t(e,"cancel",this.pointerUp.bind(this)),t("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(t("key","down",this.keyDown.bind(this)),t("key","up",this.keyUp.bind(this))),this.config.filterTaps&&t("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}},resolver:Gv},Qv={key:"pinch",engine:class extends zv{constructor(...t){super(...t),gv(this,"ingKey","pinching"),gv(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const t=this.state;t._touchIds=[],t.canceled=!1,t.cancel=this.cancel.bind(this),t.turns=0}computeOffset(){const{type:t,movement:e,lastOffset:n}=this.state;this.state.offset="wheel"===t?dv.add(e,n):[(1+e[0])*n[0],e[1]+n[1]]}computeMovement(){const{offset:t,lastOffset:e}=this.state;this.state.movement=[t[0]/e[0],t[1]-e[1]]}axisIntent(){const t=this.state,[e,n]=t._movement;if(!t.axis){const r=30*Math.abs(e)-Math.abs(n);r<0?t.axis="angle":r>0&&(t.axis="scale")}}restrictToAxis(t){this.config.lockDirection&&("scale"===this.state.axis?t[1]=0:"angle"===this.state.axis&&(t[0]=0))}cancel(){const t=this.state;t.canceled||setTimeout((()=>{t.canceled=!0,t._active=!1,this.compute(),this.emit()}),0)}touchStart(t){this.ctrl.setEventIds(t);const e=this.state,n=this.ctrl.touchIds;if(e._active&&e._touchIds.every((t=>n.has(t)))||n.size<2)return;this.start(t),e._touchIds=Array.from(n).slice(0,2);const r=Mv(t,e._touchIds);this.pinchStart(t,r)}pointerStart(t){if(null!=t.buttons&&t.buttons%2!==1)return;this.ctrl.setEventIds(t),t.target.setPointerCapture(t.pointerId);const e=this.state,n=e._pointerEvents,r=this.ctrl.pointerIds;if(e._active&&Array.from(n.keys()).every((t=>r.has(t)))||(n.size<2&&n.set(t.pointerId,t),e._pointerEvents.size<2))return;this.start(t);const i=Ev(...Array.from(n.values()));this.pinchStart(t,i)}pinchStart(t,e){this.state.origin=e.origin,this.computeValues([e.distance,e.angle]),this.computeInitial(),this.compute(t),this.emit()}touchMove(t){if(!this.state._active)return;const e=Mv(t,this.state._touchIds);this.pinchMove(t,e)}pointerMove(t){const e=this.state._pointerEvents;if(e.has(t.pointerId)&&e.set(t.pointerId,t),!this.state._active)return;const n=Ev(...Array.from(e.values()));this.pinchMove(t,n)}pinchMove(t,e){const n=this.state,r=n._values[1],i=e.angle-r;let o=0;Math.abs(i)>270&&(o+=Math.sign(i)),this.computeValues([e.distance,e.angle-360*o]),n.origin=e.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(t),this.emit()}touchEnd(t){this.ctrl.setEventIds(t),this.state._active&&this.state._touchIds.some((t=>!this.ctrl.touchIds.has(t)))&&(this.state._active=!1,this.compute(t),this.emit())}pointerEnd(t){const e=this.state;this.ctrl.setEventIds(t);try{t.target.releasePointerCapture(t.pointerId)}catch{}e._pointerEvents.has(t.pointerId)&&e._pointerEvents.delete(t.pointerId),e._active&&e._pointerEvents.size<2&&(e._active=!1,this.compute(t),this.emit())}gestureStart(t){t.cancelable&&t.preventDefault();const e=this.state;e._active||(this.start(t),this.computeValues([t.scale,t.rotation]),e.origin=[t.clientX,t.clientY],this.compute(t),this.emit())}gestureMove(t){if(t.cancelable&&t.preventDefault(),!this.state._active)return;const e=this.state;this.computeValues([t.scale,t.rotation]),e.origin=[t.clientX,t.clientY];const n=e._movement;e._movement=[t.scale-1,t.rotation],e._delta=dv.sub(e._movement,n),this.compute(t),this.emit()}gestureEnd(t){!this.state._active||(this.state._active=!1,this.compute(t),this.emit())}wheel(t){const e=this.config.modifierKey;e&&!t[e]||(this.state._active?this.wheelChange(t):this.wheelStart(t),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(t){this.start(t),this.wheelChange(t)}wheelChange(t){"uv"in t||t.cancelable&&t.preventDefault();const e=this.state;e._delta=[-jv(t)[1]/100*e.offset[0],0],dv.addTo(e._movement,e._delta),this.state.origin=[t.clientX,t.clientY],this.compute(t),this.emit()}wheelEnd(){!this.state._active||(this.state._active=!1,this.compute(),this.emit())}bind(t){const e=this.config.device;e&&(t(e,"start",this[e+"Start"].bind(this)),t(e,"change",this[e+"Move"].bind(this)),t(e,"end",this[e+"End"].bind(this)),t(e,"cancel",this[e+"End"].bind(this))),t("wheel","",this.wheel.bind(this),{passive:!1})}},resolver:$v};function tb(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],!(e.indexOf(n)>=0)&&(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],!(e.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,n)||(i[n]=t[n]))}return i}const eb={target(t){if(t)return()=>"current"in t?t.current:t},enabled:(t=!0)=>t,window:(t=(Yv.isBrowser?window:void 0))=>t,eventOptions:({passive:t=!0,capture:e=!1}={})=>({passive:t,capture:e}),transform:t=>t},nb=["target","eventOptions","window","enabled","transform"];function rb(t={},e){const n={};for(const[r,i]of Object.entries(e))switch(typeof i){case"function":n[r]=i.call(n,t[r],r,t);break;case"object":n[r]=rb(t[r],i);break;case"boolean":i&&(n[r]=t[r])}return n}class ib{constructor(t,e){gv(this,"_listeners",new Set),this._ctrl=t,this._gestureKey=e}add(t,e,n,r,i){const o=this._listeners,a=function(t,e=""){const n=bv[t];return t+(n&&n[e]||e)}(e,n),s=vv(vv({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);t.addEventListener(a,r,s);const l=()=>{t.removeEventListener(a,r,s),o.delete(l)};return o.add(l),l}clean(){this._listeners.forEach((t=>t())),this._listeners.clear()}}class ob{constructor(){gv(this,"_timeouts",new Map)}add(t,e,n=140,...r){this.remove(t),this._timeouts.set(t,window.setTimeout(e,n,...r))}remove(t){const e=this._timeouts.get(t);e&&window.clearTimeout(e)}clean(){this._timeouts.forEach((t=>{window.clearTimeout(t)})),this._timeouts.clear()}}class ab{constructor(t){gv(this,"gestures",new Set),gv(this,"_targetEventStore",new ib(this)),gv(this,"gestureEventStores",{}),gv(this,"gestureTimeoutStores",{}),gv(this,"handlers",{}),gv(this,"config",{}),gv(this,"pointerIds",new Set),gv(this,"touchIds",new Set),gv(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),function(t,e){e.drag&&sb(t,"drag"),e.wheel&&sb(t,"wheel"),e.scroll&&sb(t,"scroll"),e.move&&sb(t,"move"),e.pinch&&sb(t,"pinch"),e.hover&&sb(t,"hover")}(this,t)}setEventIds(t){return Cv(t)?(this.touchIds=new Set(Ov(t)),this.touchIds):"pointerId"in t?("pointerup"===t.type||"pointercancel"===t.type?this.pointerIds.delete(t.pointerId):"pointerdown"===t.type&&this.pointerIds.add(t.pointerId),this.pointerIds):void 0}applyHandlers(t,e){this.handlers=t,this.nativeHandlers=e}applyConfig(t,e){this.config=function(t,e,n={}){const r=t,{target:i,eventOptions:o,window:a,enabled:s,transform:l}=r,c=tb(r,nb);if(n.shared=rb({target:i,eventOptions:o,window:a,enabled:s,transform:l},eb),e){const t=Kv.get(e);n[e]=rb(vv({shared:n.shared},c),t)}else for(const u in c){const t=Kv.get(u);t&&(n[u]=rb(vv({shared:n.shared},c[u]),t))}return n}(t,e,this.config)}clean(){this._targetEventStore.clean();for(const t of this.gestures)this.gestureEventStores[t].clean(),this.gestureTimeoutStores[t].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...t){const e=this.config.shared,n={};let r;if(!e.target||(r=e.target(),r)){if(e.enabled){for(const e of this.gestures){const i=this.config[e],o=lb(n,i.eventOptions,!!r);if(i.enabled){new(qv.get(e))(this,t,e).bind(o)}}const i=lb(n,e.eventOptions,!!r);for(const e in this.nativeHandlers)i(e,"",(n=>this.nativeHandlers[e](vv(vv({},this.state.shared),{},{event:n,args:t}))),void 0,!0)}for(const t in n)n[t]=Iv(...n[t]);if(!r)return n;for(const t in n){const{device:e,capture:i,passive:o}=Sv(t);this._targetEventStore.add(r,e,"",n[t],{capture:i,passive:o})}}}}function sb(t,e){t.gestures.add(e),t.gestureEventStores[e]=new ib(t,e),t.gestureTimeoutStores[e]=new ob}const lb=(t,e,n)=>(r,i,o,a={},s=!1)=>{var l,c;const u=null!==(l=a.capture)&&void 0!==l?l:e.capture,h=null!==(c=a.passive)&&void 0!==c?c:e.passive;let d=s?r:wv(r,i,u);n&&h&&(d+="Passive"),t[d]=t[d]||[],t[d].push(o)},cb=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function ub(t,e,n,r,i,o){if(!t.has(n)||!qv.has(r))return;const a=n+"Start",s=n+"End";i[r]=t=>{let r;return t.first&&a in e&&e[a](t),n in e&&(r=e[n](t)),t.last&&s in e&&e[s](t),r},o[r]=o[r]||{}}function hb(t,e){const[n,r,i]=function(t){const e={},n={},r=new Set;for(let i in t)cb.test(i)?(r.add(RegExp.lastMatch),n[i]=t[i]):e[i]=t[i];return[n,e,r]}(t),o={};return ub(i,n,"onDrag","drag",o,e),ub(i,n,"onWheel","wheel",o,e),ub(i,n,"onScroll","scroll",o,e),ub(i,n,"onPinch","pinch",o,e),ub(i,n,"onMove","move",o,e),ub(i,n,"onHover","hover",o,e),{handlers:o,config:e,nativeHandlers:r}}function db({e:t,rect:e,deltaX:n,deltaY:r}){return{rect:e,x:t.clientX,y:t.clientY,deltaX:null!=n?n:0,deltaY:null!=r?r:0,nativeEvent:t}}function fb({onMoveStart:t,onMove:e,onMoveEnd:n,minimumMovement:r=0,preventDefault:o,stopPropagation:a=!0,onPress:s,onLongPress:l,...c}){const u=(0,i.useRef)({lastPosition:{x:0,y:0},started:!1,longPressTriggered:!1}).current,{addGlobalListener:h,removeGlobalListener:d}=Nd(),f=n=>{if(n.pointerId===u.id){const i=n.clientX-u.lastPosition.x,o=n.clientY-u.lastPosition.y;(Math.abs(i)>=r||Math.abs(o)>=r)&&!u.started&&(e=>{!u.el||!1===(null==t?void 0:t(e,u.el))||(u.originalTouchAction=u.el.style.touchAction,u.el.style.touchAction="none",u.originalUserSelect=document.documentElement.style.userSelect,document.documentElement.style.userSelect="none",u.started=!0)})(n),u.started&&(null==e||e(n,i,o),u.lastPosition={x:n.clientX,y:n.clientY})}},p=t=>{var e;if(t.pointerId===u.id){u.longPressTimer&&clearTimeout(u.longPressTimer);const r=u.longPressTriggered;u.longPressTriggered=!1,u.started&&(null==n||n(t)),u.el&&("pointercancel"!==t.type&&(null==(e=c.onPointerUp)||e.call(c,t,u.el),t.target&&u.el.contains(t.target)&&(r?null==l||l(t,u.el):null==s||s(t,u.el))),document.documentElement.style.userSelect=u.originalUserSelect||"",u.el.style.touchAction=u.originalTouchAction||""),u.id=void 0,u.started=!1,d(window,"pointermove",f,!1),d(window,"pointerup",p,!1),d(window,"pointercancel",p,!1)}};return{domProps:{onPointerDown:fp((n=>{var r;if(0===n.button&&null==u.id){if(u.started=!1,!1===(null==(r=c.onPointerDown)?void 0:r.call(c,n)))return;a&&n.stopPropagation(),o&&n.preventDefault(),u.id=n.pointerId,u.el=n.currentTarget,u.lastPosition={x:n.clientX,y:n.clientY},l&&(u.longPressTimer=setTimeout((()=>{l(n,u.el),u.longPressTriggered=!0}),400)),(t||e)&&h(window,"pointermove",f,!1),h(window,"pointerup",p,!1),h(window,"pointercancel",p,!1)}}))}}}function pb(t){return{left:t.left,top:t.top,width:t.width,height:t.height}}var gb=(t=>(t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t))(gb||{});let mb={};const vb=(t={})=>{qd(null),mb=t};function bb({aspectRatio:t,boundaryRef:e,boundaryRect:n,restrictWithinBoundary:r=!0,minWidth:i=50,minHeight:o=50,...a}){const s={onMoveStart:(t,r)=>{var i;const o=t.target;if(!o.dataset.resizeHandle||(vb({currentRect:pb(r.getBoundingClientRect()),resizeDir:o.dataset.resizeHandle}),!mb.currentRect))return!1;qd("resize"),n?mb.boundaryRect=n:null!=e&&e.current&&(mb.boundaryRect=pb(e.current.getBoundingClientRect())),mb.currentRect&&mb.boundaryRect&&(mb.currentRect.left-=mb.boundaryRect.left,mb.currentRect.top-=mb.boundaryRect.top),mb.initialAspectRatio=mb.currentRect.width/mb.currentRect.height,null==(i=a.onResizeStart)||i.call(a,db({rect:mb.currentRect,e:t}))},onMove:(e,n,r)=>{var s;if(!mb.resizeDir||!mb.currentRect)return;const l="initial"===t?mb.initialAspectRatio:t,c=function(t,e,n,r){const i={...t},o={...t};return"topRight"===mb.resizeDir?(o.width=Math.floor(o.width+e),o.height=r?Math.floor(o.width/r):Math.floor(o.height-n),o.top=Math.floor(o.top+(i.height-o.height))):"bottomRight"===mb.resizeDir?(o.width=Math.floor(o.width+e),o.height=r?Math.floor(o.width/r):Math.floor(o.height+n)):"topLeft"===mb.resizeDir?(o.width=Math.floor(o.width-e),o.height=r?Math.floor(o.width/r):Math.floor(o.height-n),o.left=Math.floor(o.left+(i.width-o.width)),o.top=Math.floor(o.top+(i.height-o.height))):"bottomLeft"===mb.resizeDir&&(o.width=Math.floor(o.width-e),o.height=r?Math.floor(o.width/r):Math.floor(o.height+n),o.left=Math.floor(o.left+e)),o}(mb.currentRect,n,r,l),u=function(t,e,n,r){const i="bottomLeft"===mb.resizeDir||"topLeft"===mb.resizeDir,o="topRight"===mb.resizeDir||"topLeft"===mb.resizeDir;let a={...t};a.width=Math.max(e,t.width),a.height=Math.max(n,t.height);const s=a.width-t.width;i&&s>0&&(a.left-=s);const l=a.height-t.height;if(o&&l>0&&(a.top-=l),mb.boundaryRect&&(a=function(t,e){const n={...t};n.left=Math.max(0,n.left);const r=n.left-t.left;r>0&&(n.width-=r),n.top=Math.max(0,n.top);const i=n.top-t.top;return i>0&&(n.height-=i),n.width=Math.min(n.width,e.width-n.left),n.height=Math.min(n.height,e.height-n.top),n}(a,mb.boundaryRect)),r){const t=a.width,e=a.height,n=Tf(r,a.width,a.height);a.width=n.width,a.height=n.height,o&&(a.top+=e-a.height),i&&(a.left+=t-a.width)}return a}(c,i,o,l);null==(s=a.onResize)||s.call(a,db({rect:u,e:e,deltaX:n,deltaY:r})),mb.currentRect=c},onMoveEnd:t=>{var e;mb.currentRect&&(null==(e=a.onResizeEnd)||e.call(a,db({rect:mb.currentRect,e:t}))),vb()}},{domProps:l}=fb(s);return{resizeProps:l}}function yb({position:t,inset:e=!1}){const n=function(t,e){const n=e?"left-0":"-left-5",r=e?"top-0":"-top-5",i=e?"bottom-0":"-bottom-5",o=e?"right-0":"-right-5";switch(t){case gb.topLeft:return`${n} ${r} border-l-4 border-t-4 cursor-nwse-resize`;case gb.topRight:return`${o} ${r} border-r-4 border-t-4 cursor-nesw-resize`;case gb.bottomRight:return`${o} ${i} border-r-4 border-b-4 cursor-se-resize`;case gb.bottomLeft:return`${n} ${i} border-l-4 border-b-4 cursor-sw-resize`;default:return""}}(t,e);return ar("div",{"data-resize-handle":t,className:`border-white absolute w-20 h-20 ${n}`})}var xb=(t=>(t.top="maskTop",t.right="maskRight",t.bottom="maskBottom",t.left="maskLeft",t))(xb||{});function wb({position:t,refs:e}){const n=function(t){switch(t){case"maskTop":return"left-0 top-0";case"maskBottom":return"bottom-0 left-0";default:return""}}(t);return ar("div",{className:`cropzone-transition bg-black/50 bottom absolute ${n}`,ref:n=>e.current[t]=n})}function _b({name:t,refs:e}){const n=yr("cropzone-transition pointer-events-none absolute left-0 top-0 bg-white/50",t.startsWith("lineHor")?"h-px":"w-px");return ar("div",{className:n,ref:n=>{e.current[t]=n}})}function Sb(t,e,n){return Math.min(Math.max(t,e),n)}let Cb={};function kb({boundaryRef:t,boundaryRect:e,minimumMovement:n,restrictWithinBoundary:r=!0,...i}){const o={minimumMovement:n,onMoveStart:(n,r)=>{var o;if($d)return!1;Cb={currentRect:pb(r.getBoundingClientRect())},qd("move"),e?Cb.boundaryRect=e:null!=t&&t.current&&(Cb.boundaryRect=pb(t.current.getBoundingClientRect())),Cb.currentRect&&Cb.boundaryRect&&(Cb.currentRect.left-=Cb.boundaryRect.left,Cb.currentRect.top-=Cb.boundaryRect.top),null==(o=i.onMoveStart)||o.call(i,db({rect:Cb.currentRect,e:n}))},onMove:(t,e,n)=>{var o;if(!Cb.currentRect)return;const a={...Cb.currentRect,left:Cb.currentRect.left+e,top:Cb.currentRect.top+n},s={...a};Cb.boundaryRect&&r&&(s.left=Sb(a.left,0,Cb.boundaryRect.width-a.width),s.top=Sb(a.top,0,Cb.boundaryRect.height-a.height)),null==(o=i.onMove)||o.call(i,db({rect:s,e:t,deltaX:e,deltaY:n})),Cb.currentRect=a},onMoveEnd:t=>{var e;!Cb.currentRect||(null==(e=i.onMoveEnd)||e.call(i,db({rect:Cb.currentRect,e:t})),qd(null),Cb={})}},{domProps:a}=fb(o);return{moveProps:a}}function Tb(){const t=(0,i.useRef)({}),[e,n]=(0,i.useState)(!0),r=Ea((t=>t.canvasSize)),o=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.cropzone})),a=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.defaultRatio}))||null,s=Ea((t=>t.crop.selectedAspectRatio))||null,{moveProps:l}=kb({boundaryRect:r,onMoveStart:()=>n(!0),onMove:t=>Ma().crop.drawZone(t.rect),onMoveEnd:()=>n(!1)}),{resizeProps:c}=bb({boundaryRect:r,minHeight:50,minWidth:50,aspectRatio:Ef(s),onResizeStart:()=>n(!0),onResize:t=>Ma().crop.drawZone(t.rect),onResizeEnd:()=>n(!1)});(0,i.useLayoutEffect)((()=>{Ma().crop.registerRefs(t),Ma().crop.resetCropzone(a)}),[a,r]);const u=yr("cropzone absolute z-cropzone isolate left-0 top-0 w-full h-full overflow-hidden",e&&"moving");return sr("div",{className:u,onPointerDown:t=>{t.stopPropagation(),t.preventDefault()},children:[sr("div",{className:"cropzone-transition border-white/50 absolute z-10 left-0 top-0 border",...Dd(c,l),ref:e=>t.current.innerZone=e,children:[!(null!=o&&o.hideTopLeft)&&ar(yb,{position:gb.topLeft,inset:!0}),!(null!=o&&o.hideTopRight)&&ar(yb,{position:gb.topRight,inset:!0}),!(null!=o&&o.hideBottomLeft)&&ar(yb,{position:gb.bottomLeft,inset:!0}),!(null!=o&&o.hideBottomRight)&&ar(yb,{position:gb.bottomRight,inset:!0}),ar(_b,{name:"lineVer1",refs:t}),ar(_b,{name:"lineVer2",refs:t}),ar(_b,{name:"lineHor1",refs:t}),ar(_b,{name:"lineHor2",refs:t})]}),ar(wb,{refs:t,position:xb.top}),ar(wb,{refs:t,position:xb.left}),ar(wb,{refs:t,position:xb.right}),ar(wb,{refs:t,position:xb.bottom})]})}const Eb=_r(ar("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"})),Ob=_r(ar("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"})),Mb=_r(ar("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"})),Pb=_r(ar("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"})),Ab={width:120,height:30},jb=[{name:"Duplicate",icon:Eb,onClick:()=>{Ma().objects.duplicate()}},{name:"Flip",icon:Ob,onClick:()=>{Ma().objects.flipHorizontally()}},{name:"Bring to front",icon:Mb,onClick:()=>{Ma().objects.bringToFront()}},{name:"Delete",icon:Pb,onClick:()=>{Ma().objects.delete()}}],Db=i.forwardRef(((t,e)=>{const n=Ea((t=>t.objects.active.isMoving))?"opacity-0":"opacity-100";return ar("div",{ref:e,className:`${n} absolute z-obj-box left-0 top-0 flex items-center text-white bg-controls rounded shadow transition-opacity overflow-hidden`,children:jb.map((t=>{const e=t.icon;return ar(Bm,{size:"sm",className:"w-30 h-30 hover:bg-white/hover",radius:"rounded-none",onClick:t.onClick,children:ar(e,{})},t.name)}))})}));function Rb(t,e){var n,r,i;const o=Ma().objects.getActive();if(!o||!t.current)return;const a=t.current,s=Ud.fabric.util.degreesToRadians(null!=(n=o.angle)?n:0);let l=Math.round(o.getScaledWidth()*Oa().zoom),c=Math.round(o.getScaledHeight()*Oa().zoom),u=Math.round((null!=(r=o.left)?r:0)*Oa().zoom),h=Math.round((null!=(i=o.top)?i:0)*Oa().zoom);const d="center"===o.originX?l/2:0,f="center"===o.originY?c/2:0;o.padding&&(l+=2*o.padding,c+=2*o.padding,u-=o.padding,h-=o.padding),a.style.width=`${l}px`,a.style.height=`${c}px`,a.style.transform=`translate(${u-d}px, ${h-f}px) rotate(${s}rad)`,Ma().canvas.render(),function(t,e){if(!e)return;const n=t.angle||0,r=n>168&&n<188?-30:-15,i=Oa().canvasSize,o=Oa().stageSize,a=Ab,s=i.top-o.top,l=i.left-o.left,c=o.width-(l+i.width),u=o.height-(s+i.height),h=-s,d=-(i.left-o.left),f=i.width-a.width+c,p=i.height-a.height+u,g=t.getBoundingRect();let m=g.top-a.height+r,v=g.left+g.width/2-a.width/2;m=Math.min(p,Math.max(h,m)),v=Math.min(f,Math.max(d,v)),e.style.transform=`translate(${v}px, ${m}px) rotate(0deg)`}(o,e.current)}function Ib(){return ar("div",{className:"absolute -bottom-20 left-1/2 w-2 h-20 bg-white cursor-default -translate-x-1/2",children:ar("div",{"data-rotate-handle":!0,className:"w-18 h-18 absolute -bottom-10 -left-8 bg-white rounded-full cursor-move"})})}let Lb={};function zb(t){const e=Lb.centerX||0,n=Lb.centerY||0;return Math.atan2(n-t.pageY,e-t.pageX)-(Lb.startAngle||0)}const Fb=(t={})=>{qd(null),Lb=t};function Nb(){const t=(0,i.useRef)(null),e=(0,i.useRef)(null),n=Ea((t=>t.objects.active.id)),r=Ea((t=>t.objects.isEditingText)),o=Ea((t=>t.zoom)),a=function(){const t=Ma().objects.getActive();if(!t||!t.name)return{};const e=Oa().config.objectControls||{},n=t.name;return{...e.global,...e[n]}}(),s=(0,i.useRef)(null),l=(0,i.useCallback)((()=>{s.current?(clearTimeout(s.current),s.current=null,function(){var t;const e=Ma().objects.getActive();Co(e)&&(e.enterEditing(),null==(t=e.hiddenTextarea)||t.focus())}()):s.current=setTimeout((()=>{s.current=null}),300)}),[]);let{moveProps:c}=kb({boundaryRef:Oa().canvasRef,restrictWithinBoundary:!1,onMoveEnd:()=>{Oa().objects.setActiveIsMoving(!1)},onMove:t=>{Oa().objects.setActiveIsMoving(!0),function(t){const e=t.rect.width/2,n=t.rect.height/2;Ma().objects.setValues({left:(t.rect.left+e)/Oa().zoom,top:(t.rect.top+n)/Oa().zoom})}(t)}});a.lockMovement&&(c={});const{resizeProps:u}=bb({minWidth:50,minHeight:50,aspectRatio:a.unlockAspectRatio?null:"initial",boundaryRef:Oa().canvasRef,restrictWithinBoundary:!1,onResizeEnd:()=>{Oa().objects.setActiveIsMoving(!1)},onResize:t=>{Oa().objects.setActiveIsMoving(!0),function(t){const e=Ma().objects.getActive();if(!e)return;const n={};Co(e)?(t.deltaX>0||e.getScaledHeight()>=20&&e.getScaledWidth()>=20)&&(n.fontSize=(e.fontSize||1)+t.deltaX):(e.width&&(n.scaleX=t.rect.width/Oa().zoom/e.width),e.height&&(n.scaleY=t.rect.height/Oa().zoom/e.height)),Ma().objects.setValues(n)}(t)}}),{rotateProps:h}=function(t){const e={onMoveStart:(e,n)=>{var r,i;if(!e.target.dataset.rotateHandle)return!1;const o=pb(n.getBoundingClientRect());if(!o)return!1;const a=null==(r=n.style.transform.match(/rotate\((.+?)\)/))?void 0:r[1],[s="0"]=a?a.split(","):[];Fb({currentRect:o,centerX:o.left+o.width/2,centerY:o.top+o.height/2,startAngle:parseFloat(s)}),qd("rotate"),Lb.startAngle=zb(e),null==(i=t.onRotateStart)||i.call(t,db({rect:o,e:e}))},onMove:(e,n,r)=>{var i;if(!Lb.currentRect)return;const o={...Lb.currentRect};o.angle=zb(e),o.left+=n,o.top+=r,null==(i=t.onRotate)||i.call(t,db({rect:o,e:e,deltaX:n,deltaY:r})),Lb.currentRect=o},onMoveEnd:e=>{var n;Lb.currentRect&&(null==(n=t.onRotateEnd)||n.call(t,db({rect:Lb.currentRect,e:e}))),Fb()}},{domProps:n}=fb(e);return{rotateProps:n}}({boundaryRef:Oa().canvasRef,onRotateEnd:()=>{Oa().objects.setActiveIsMoving(!1)},onRotate:t=>{Oa().objects.setActiveIsMoving(!0),function(t){const e=Ma().objects.getActive();if(!e||!t.rect.angle)return;const n=Ud.fabric.util.radiansToDegrees(t.rect.angle);n!==e.angle&&Ma().objects.setValues({angle:n})}(t)}});return(0,i.useEffect)((()=>{!Pa()||Oa().editor.on("object:modified",(n=>{n.sizeOrPositionChanged&&Rb(t,e)}))}),[]),(0,i.useEffect)((()=>{Rb(t,e)}),[n,o,r]),sr("div",{className:n&&!r?"block":"hidden",children:[sr("div",{ref:t,...Dd(h,u,c),onClick:l,className:"absolute z-obj-box border-2 border-white shadow-md cursor-move",children:[!a.hideTopLeft&&ar(yb,{position:gb.topLeft}),!a.hideTopRight&&ar(yb,{position:gb.topRight}),!a.hideBottomLeft&&ar(yb,{position:gb.bottomLeft}),!a.hideBottomRight&&ar(yb,{position:gb.bottomRight}),!a.hideRotatingPoint&&ar(Ib,{})]}),ar(Db,{ref:e})]})}function Bb(){const t=Ea((t=>t.activeTool===vr.CROP)),e=Ea((t=>t.objects.active.id));return sr("div",{children:[t&&ar(Tb,{}),e&&ar(Nb,{})]})}const Vb=function(t){return t.forEach(Zv),function(t,e){const{handlers:n,nativeHandlers:r,config:o}=hb(t,e||{});return function(t,e={},n,r){const o=i.useMemo((()=>new ab(t)),[]);if(o.applyHandlers(t,r),o.applyConfig(e,n),i.useEffect(o.effect.bind(o)),i.useEffect((()=>o.clean.bind(o)),[]),void 0===e.target)return o.bind.bind(o)}(n,o,void 0,r)}}([Jv,Qv]),Hb=i.forwardRef(((t,e)=>{const[n,r]=(0,i.useState)(!1);(0,i.useEffect)((()=>Ea.subscribe((t=>t.loading),(t=>{r(!t)}))),[]);return ar(Wb,{children:sr(fd.div,{initial:{opacity:0},variants:{visible:{opacity:1,transition:{duration:.35,delay:.5}},hidden:{opacity:0,transition:{duration:0}}},animate:n?"visible":"hidden",className:"relative m-auto",style:{backgroundImage:`url(${uf("images/empty-canvas-bg.png")})`},children:[ar(Bb,{}),ar("canvas",{ref:e})]})})}));function Wb({children:t}){const e=(0,i.useRef)(null),n=Vb({onPinch:t=>{if(!Ma().zoom.allowUserZoom||!Ub(t))return t.cancel();1===t.direction[0]?Ma().zoom.zoomIn(.01):Ma().zoom.zoomOut(.01),t.event.stopPropagation(),t.event.preventDefault()},onDrag:t=>{if(t.pinching||!Ub(t))return t.cancel();e.current.scrollLeft-=t.delta[0],e.current.scrollTop-=t.delta[1]}});return ar("div",{ref:e,className:"flex items-center justify-center w-full h-full overflow-hidden touch-none",...n(),children:t})}function Ub(t){return!(Pa().findTarget(t.event,!1)||Pa().isDrawingMode)}function Yb({actionBtn:t,children:e,className:n}){return sr("div",{className:yr(n,"flex gap-16 items-center h-full"),children:[t&&ar("div",{className:"flex-shrink-0",children:t}),ar("div",{className:"w-full flex-auto",children:e}),t&&ar("div",{className:"w-96"})]})}function Xb(){return(Xb=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function Gb(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)e.indexOf(n=o[r])>=0||(i[n]=t[n]);return i}function $b(t){var e=(0,i.useRef)(t),n=(0,i.useRef)((function(t){e.current&&e.current(t)}));return e.current=t,n.current}var qb=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=1),t>n?n:t<e?e:t},Kb=function(t){return"touches"in t},Zb=function(t){return t&&t.ownerDocument.defaultView||self},Jb=function(t,e,n){var r=t.getBoundingClientRect(),i=Kb(e)?function(t,e){for(var n=0;n<t.length;n++)if(t[n].identifier===e)return t[n];return t[0]}(e.touches,n):e;return{left:qb((i.pageX-(r.left+Zb(t).pageXOffset))/r.width),top:qb((i.pageY-(r.top+Zb(t).pageYOffset))/r.height)}},Qb=function(t){!Kb(t)&&t.preventDefault()},ty=i.memo((function(t){var e=t.onMove,n=t.onKey,r=Gb(t,["onMove","onKey"]),o=(0,i.useRef)(null),a=$b(e),s=$b(n),l=(0,i.useRef)(null),c=(0,i.useRef)(!1),u=(0,i.useMemo)((function(){var t=function(t){Qb(t),(Kb(t)?t.touches.length>0:t.buttons>0)&&o.current?a(Jb(o.current,t,l.current)):n(!1)},e=function(){return n(!1)};function n(n){var r=c.current,i=Zb(o.current),a=n?i.addEventListener:i.removeEventListener;a(r?"touchmove":"mousemove",t),a(r?"touchend":"mouseup",e)}return[function(t){var e,r=t.nativeEvent,i=o.current;if(i&&(Qb(r),e=r,(!c.current||Kb(e))&&i)){if(Kb(r)){c.current=!0;var s=r.changedTouches||[];s.length&&(l.current=s[0].identifier)}i.focus(),a(Jb(i,r,l.current)),n(!0)}},function(t){var e=t.which||t.keyCode;e<37||e>40||(t.preventDefault(),s({left:39===e?.05:37===e?-.05:0,top:40===e?.05:38===e?-.05:0}))},n]}),[s,a]),h=u[0],d=u[1],f=u[2];return(0,i.useEffect)((function(){return f}),[f]),ar("div",{...Xb({},r,{onTouchStart:h,onMouseDown:h,className:"react-colorful__interactive",ref:o,onKeyDown:d,tabIndex:0,role:"slider"})})})),ey=function(t){return t.filter(Boolean).join(" ")},ny=function(t){var e=t.color,n=t.left,r=t.top,i=void 0===r?.5:r,o=ey(["react-colorful__pointer",t.className]);return ar("div",{className:o,style:{top:100*i+"%",left:100*n+"%"},children:ar("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}})})},ry=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=Math.pow(10,e)),Math.round(n*t)/n},iy=function(t){return"#"===t[0]&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?ry(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:8===t.length?ry(parseInt(t.substring(6,8),16)/255,2):1}},oy=function(t){var e=function(t){var e=t.s,n=t.v,r=t.a,i=(200-e)*n/100;return{h:ry(t.h),s:ry(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:ry(i/2),a:ry(r,2)}}(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},ay=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var o=Math.floor(e),a=r*(1-n),s=r*(1-(e-o)*n),l=r*(1-(1-e+o)*n),c=o%6;return{r:ry(255*[r,s,a,a,l,r][c]),g:ry(255*[l,r,r,s,a,a][c]),b:ry(255*[a,a,l,r,r,s][c]),a:ry(i,2)}},sy=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},ly=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=i<1?sy(ry(255*i)):"";return"#"+sy(e)+sy(n)+sy(r)+o},cy=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,o=Math.max(e,n,r),a=o-Math.min(e,n,r),s=a?o===e?(n-r)/a:o===n?2+(r-e)/a:4+(e-n)/a:0;return{h:ry(60*(s<0?s+6:s)),s:ry(o?a/o*100:0),v:ry(o/255*100),a:i}},uy=i.memo((function(t){var e=t.hue,n=t.onChange,r=ey(["react-colorful__hue",t.className]);return i.createElement("div",{className:r},i.createElement(ty,{onMove:function(t){n({h:360*t.left})},onKey:function(t){n({h:qb(e+360*t.left,0,360)})},"aria-label":"Hue","aria-valuenow":ry(e),"aria-valuemax":"360","aria-valuemin":"0"},i.createElement(ny,{className:"react-colorful__hue-pointer",left:e/360,color:oy({h:e,s:100,v:100,a:1})})))})),hy=i.memo((function(t){var e=t.hsva,n=t.onChange,r={backgroundColor:oy({h:e.h,s:100,v:100,a:1})};return i.createElement("div",{className:"react-colorful__saturation",style:r},i.createElement(ty,{onMove:function(t){n({s:100*t.left,v:100-100*t.top})},onKey:function(t){n({s:qb(e.s+100*t.left,0,100),v:qb(e.v-100*t.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+ry(e.s)+"%, Brightness "+ry(e.v)+"%"},i.createElement(ny,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:oy(e)})))})),dy=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0};var fy=typeof window<"u"?i.useLayoutEffect:i.useEffect,py=new Map,gy=function(t){fy((function(){var e=t.current?t.current.ownerDocument:document;if(void 0!==e&&!py.has(e)){var r=e.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}',py.set(e,r);var i=n.nc;i&&r.setAttribute("nonce",i),e.head.appendChild(r)}}),[])},my=function(t){var e=t.className,n=t.colorModel,r=t.color,o=void 0===r?n.defaultColor:r,a=t.onChange,s=Gb(t,["className","colorModel","color","onChange"]),l=(0,i.useRef)(null);gy(l);var c=function(t,e,n){var r=$b(n),o=(0,i.useState)((function(){return t.toHsva(e)})),a=o[0],s=o[1],l=(0,i.useRef)({color:e,hsva:a});(0,i.useEffect)((function(){if(!t.equal(e,l.current.color)){var n=t.toHsva(e);l.current={hsva:n,color:e},s(n)}}),[e,t]),(0,i.useEffect)((function(){var e;dy(a,l.current.hsva)||t.equal(e=t.fromHsva(a),l.current.color)||(l.current={hsva:a,color:e},r(e))}),[a,t,r]);var c=(0,i.useCallback)((function(t){s((function(e){return Object.assign({},e,t)}))}),[]);return[a,c]}(n,o,a),u=c[0],h=c[1],d=ey(["react-colorful",e]);return sr("div",{...Xb({},s,{ref:l,className:d}),children:[ar(hy,{hsva:u,onChange:h}),ar(uy,{hue:u.h,onChange:h,className:"react-colorful__last-control"})]})},vy={defaultColor:"000",toHsva:function(t){return cy(iy(t))},fromHsva:function(t){return function(t){return ly(ay(t))}({h:t.h,s:t.s,v:t.v,a:1})},equal:function(t,e){return t.toLowerCase()===e.toLowerCase()||dy(iy(t),iy(e))}},by=function(t){return ar(my,{...Xb({},t,{colorModel:vy})})},yy=/^#?([0-9A-F]{3,8})$/i,xy=function(t){var e=t.color,n=void 0===e?"":e,r=t.onChange,o=t.onBlur,a=t.escape,s=t.validate,l=t.format,c=t.process,u=Gb(t,["color","onChange","onBlur","escape","validate","format","process"]),h=(0,i.useState)((function(){return a(n)})),d=h[0],f=h[1],p=$b(r),g=$b(o),m=(0,i.useCallback)((function(t){var e=a(t.target.value);f(e),s(e)&&p(c?c(e):e)}),[a,c,s,p]),v=(0,i.useCallback)((function(t){s(t.target.value)||f(a(n)),g(t)}),[n,a,s,g]);return(0,i.useEffect)((function(){f(a(n))}),[n,a]),ar("input",{...Xb({},u,{value:l?l(d):d,spellCheck:"false",onChange:m,onBlur:v})})},wy=function(t){return"#"+t},_y=function(t){var e=t.prefixed,n=t.alpha,r=Gb(t,["prefixed","alpha"]),o=(0,i.useCallback)((function(t){return t.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)}),[n]),a=(0,i.useCallback)((function(t){return function(t,e){var n=yy.exec(t),r=n?n[1].length:0;return 3===r||6===r||!!e&&4===r||!!e&&8===r}(t,n)}),[n]);return i.createElement(xy,Xb({},r,{escape:o,format:e?wy:void 0,process:wy,validate:a}))};function Sy(t){return t&&t.__esModule?t.default:t}var Cy;Cy={"ar-AE":{alpha:"\u0623\u0644\u0641\u0627",blue:"\u0623\u0632\u0631\u0642",brightness:"\u0627\u0644\u0633\u0637\u0648\u0639",green:"\u0623\u062e\u0636\u0631",hue:"\u062f\u0631\u062c\u0629 \u0627\u0644\u0644\u0648\u0646",lightness:"\u0627\u0644\u0625\u0636\u0627\u0621\u0629",red:"\u0623\u062d\u0645\u0631",saturation:"\u0627\u0644\u062a\u0634\u0628\u0639"},"bg-BG":{alpha:"\u0410\u043b\u0444\u0430",blue:"\u0421\u0438\u043d\u044c\u043e",brightness:"\u042f\u0440\u043a\u043e\u0441\u0442",green:"\u0417\u0435\u043b\u0435\u043d\u043e",hue:"\u041e\u0442\u0442\u0435\u043d\u044a\u043a",lightness:"\u041b\u0435\u043a\u043e\u0442\u0430",red:"\u0427\u0435\u0440\u0432\u0435\u043d\u043e",saturation:"\u041d\u0430\u0441\u0438\u0442\u0435\u043d\u043e\u0441\u0442"},"cs-CZ":{alpha:"Alfa",blue:"Modr\xe1",brightness:"Jas",green:"Zelen\xe1",hue:"Odst\xedn",lightness:"Sv\u011btlost",red:"\u010cerven\xe1",saturation:"Sytost"},"da-DK":{alpha:"Alfa",blue:"Bl\xe5",brightness:"Lysstyrke",green:"Gr\xf8n",hue:"Tone",lightness:"Lyshed",red:"R\xf8d",saturation:"Farvem\xe6tning"},"de-DE":{alpha:"Alpha",blue:"Blau",brightness:"Helligkeit",green:"Gr\xfcn",hue:"Farbton",lightness:"Leuchtkraft",red:"Rot",saturation:"S\xe4ttigung"},"el-GR":{alpha:"\u0386\u03bb\u03c6\u03b1",blue:"\u039c\u03c0\u03bb\u03b5",brightness:"\u03a6\u03c9\u03c4\u03b5\u03b9\u03bd\u03cc\u03c4\u03b7\u03c4\u03b1",green:"\u03a0\u03c1\u03ac\u03c3\u03b9\u03bd\u03bf",hue:"\u03a4\u03cc\u03bd\u03bf\u03c2",lightness:"\u03a6\u03c9\u03c4\u03b5\u03b9\u03bd\u03cc\u03c4\u03b7\u03c4\u03b1",red:"\u039a\u03cc\u03ba\u03ba\u03b9\u03bd\u03bf",saturation:"\u039a\u03bf\u03c1\u03b5\u03c3\u03bc\u03cc\u03c2"},"en-US":{hue:"Hue",saturation:"Saturation",lightness:"Lightness",brightness:"Brightness",red:"Red",green:"Green",blue:"Blue",alpha:"Alpha"},"es-ES":{alpha:"Alpha",blue:"Azul",brightness:"Brillo",green:"Verde",hue:"Tono",lightness:"Luminosidad",red:"Rojo",saturation:"Saturaci\xf3n"},"et-EE":{alpha:"Alfa",blue:"Sinine",brightness:"Heledus",green:"Roheline",hue:"V\xe4rv",lightness:"Valgus",red:"Punane",saturation:"K\xfcllastus"},"fi-FI":{alpha:"Alpha",blue:"Sininen",brightness:"Kirkkaus",green:"Vihre\xe4",hue:"S\xe4vy",lightness:"Valom\xe4\xe4r\xe4",red:"Punainen",saturation:"V\xe4rikyll\xe4isyys"},"fr-FR":{alpha:"Alpha",blue:"Bleu",brightness:"Luminosit\xe9",green:"Vert",hue:"Teinte",lightness:"Luminosit\xe9",red:"Rouge",saturation:"Saturation"},"he-IL":{alpha:"\u05d0\u05dc\u05e4\u05d0",blue:"\u05db\u05d7\u05d5\u05dc",brightness:"\u05d1\u05d4\u05d9\u05e8\u05d5\u05ea",green:"\u05d9\u05e8\u05d5\u05e7",hue:"\u05d2\u05d5\u05d5\u05df",lightness:"\u05db\u05de\u05d5\u05ea \u05d0\u05d5\u05e8",red:"\u05d0\u05d3\u05d5\u05dd",saturation:"\u05e8\u05d5\u05d5\u05d9\u05d4"},"hr-HR":{alpha:"Alfa",blue:"Plava",brightness:"Svjetlina",green:"Zelena",hue:"Nijansa",lightness:"Osvijetljenost",red:"Crvena",saturation:"Zasi\u0107enost"},"hu-HU":{alpha:"Alfa",blue:"K\xe9k",brightness:"F\xe9nyess\xe9g",green:"Z\xf6ld",hue:"Sz\xedn\xe1rnyalat",lightness:"Vil\xe1goss\xe1g",red:"Piros",saturation:"Tel\xedtetts\xe9g"},"it-IT":{alpha:"Alfa",blue:"Blu",brightness:"Luminosit\xe0",green:"Verde",hue:"Tonalit\xe0",lightness:"Luminosit\xe0",red:"Rosso",saturation:"Saturazione"},"ja-JP":{alpha:"\u30a2\u30eb\u30d5\u30a1",blue:"\u9752",brightness:"\u660e\u308b\u3055",green:"\u7dd1",hue:"\u8272\u76f8",lightness:"\u660e\u5ea6",red:"\u8d64",saturation:"\u5f69\u5ea6"},"ko-KR":{alpha:"\uc54c\ud30c",blue:"\ud30c\ub791",brightness:"\uba85\ub3c4",green:"\ucd08\ub85d",hue:"\uc0c9\uc870",lightness:"\ubc1d\uae30",red:"\ube68\uac15",saturation:"\ucc44\ub3c4"},"lt-LT":{alpha:"Alfa",blue:"M\u0117lyna",brightness:"Ry\u0161kumas",green:"\u017dalia",hue:"Atspalvis",lightness:"\u0160viesumas",red:"Raudona",saturation:"\u012esotinimas"},"lv-LV":{alpha:"Alfa",blue:"Zila",brightness:"Spilgtums",green:"Za\u013ca",hue:"Nokr\u0101sa",lightness:"Gai\u0161ums",red:"Sarkana",saturation:"Pies\u0101tin\u0101jums"},"nb-NO":{alpha:"Alfa",blue:"Bl\xe5",brightness:"Lysstyrke",green:"Gr\xf8nn",hue:"Fargetone",lightness:"Lyshet",red:"R\xf8d",saturation:"Metning"},"nl-NL":{alpha:"Alfa",blue:"Blauw",brightness:"Helderheid",green:"Groen",hue:"Kleurtoon",lightness:"Lichtsterkte",red:"Rood",saturation:"Verzadiging"},"pl-PL":{alpha:"Alfa",blue:"Niebieski",brightness:"Jasno\u015b\u0107",green:"Zielony",hue:"Odcie\u0144",lightness:"Jaskrawo\u015b\u0107",red:"Czerwony",saturation:"Nasycenie"},"pt-BR":{alpha:"Alfa",blue:"Azul",brightness:"Brilho",green:"Verde",hue:"Matiz",lightness:"Luminosidade",red:"Vermelho",saturation:"Satura\xe7\xe3o"},"pt-PT":{alpha:"Alfa",blue:"Azul",brightness:"Luminosidade",green:"Verde",hue:"Tonalidade",lightness:"Claridade",red:"Vermelho",saturation:"Satura\xe7\xe3o"},"ro-RO":{alpha:"Alfa",blue:"Albastru",brightness:"Luminozitate",green:"Verde",hue:"Nuan\u021b\u0103",lightness:"Luminozitate",red:"Ro\u0219u",saturation:"Satura\u021bie"},"ru-RU":{alpha:"\u0410\u043b\u044c\u0444\u0430",blue:"\u0421\u0438\u043d\u0438\u0439",brightness:"\u042f\u0440\u043a\u043e\u0441\u0442\u044c",green:"\u0417\u0435\u043b\u0435\u043d\u044b\u0439",hue:"\u041e\u0442\u0442\u0435\u043d\u043e\u043a",lightness:"\u041e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c",red:"\u041a\u0440\u0430\u0441\u043d\u044b\u0439",saturation:"\u041d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c"},"sk-SK":{alpha:"Alfa",blue:"Modr\xe1",brightness:"Jas",green:"Zelen\xe1",hue:"Odtie\u0148",lightness:"Svetlos\u0165",red:"\u010cerven\xe1",saturation:"S\xfdtos\u0165"},"sl-SI":{alpha:"Alfa",blue:"Modra",brightness:"Svetlost",green:"Zelena",hue:"Barva",lightness:"Lahkost",red:"Rde\u010da",saturation:"Nasi\u010denost"},"sr-SP":{alpha:"Alfa",blue:"Plava",brightness:"Osvetljenost",green:"Zelena",hue:"Nijansa",lightness:"Osvetljenje",red:"Crvena",saturation:"Zasi\u0107enje"},"sv-SE":{alpha:"Alfa",blue:"Bl\xe5tt",brightness:"Ljusstyrka",green:"Gr\xf6nt",hue:"Nyans",lightness:"Ljushet",red:"R\xf6tt",saturation:"M\xe4ttnad"},"tr-TR":{alpha:"Alfa",blue:"Mavi",brightness:"Parlakl\u0131k",green:"Ye\u015fil",hue:"Ton",lightness:"Canl\u0131l\u0131k",red:"K\u0131rm\u0131z\u0131",saturation:"Doygunluk"},"uk-UA":{alpha:"\u0410\u043b\u044c\u0444\u0430",blue:"\u0421\u0438\u043d\u0456\u0439",brightness:"\u042f\u0441\u043a\u0440\u0430\u0432\u0456\u0441\u0442\u044c",green:"\u0417\u0435\u043b\u0435\u043d\u0438\u0439",hue:"\u0422\u043e\u043d",lightness:"\u041e\u0441\u0432\u0456\u0442\u043b\u0435\u043d\u0456\u0441\u0442\u044c",red:"\u0427\u0435\u0440\u0432\u043e\u043d\u0438\u0439",saturation:"\u041d\u0430\u0441\u0438\u0447\u0435\u043d\u0456\u0441\u0442\u044c"},"zh-CN":{alpha:"Alpha",blue:"\u84dd\u8272",brightness:"\u4eae\u5ea6",green:"\u7eff\u8272",hue:"\u8272\u76f8",lightness:"\u660e\u4eae\u5ea6",red:"\u7ea2\u8272",saturation:"\u9971\u548c\u5ea6"},"zh-TW":{alpha:"Alpha",blue:"\u85cd\u8272",brightness:"\u4eae\u5ea6",green:"\u7da0\u8272",hue:"\u8272\u76f8",lightness:"\u660e\u4eae",red:"\u7d05\u8272",saturation:"\u98fd\u548c\u5ea6"}};const ky=new class{getStringForLocale(t,e){let n=this.strings[e];n||(n=function(t,e,n="en-US"){if(e[t])return e[t];let r=function(t){return Intl.Locale?new Intl.Locale(t).language:t.split("-")[0]}(t);if(e[r])return e[r];for(let i in e)if(i.startsWith(r+"-"))return e[i];return e[n]}(e,this.strings,this.defaultLocale),this.strings[e]=n);let r=n[t];if(!r)throw new Error(`Could not find intl message ${t} in ${e} locale`);return r}constructor(t,e="en-US"){this.strings={...t},this.defaultLocale=e}}(Sy(Cy));function Ty(t){let e=Oy.parse(t)||Py.parse(t)||Dy.parse(t);if(e)return e;throw new Error("Invalid color value: "+t)}class Ey{toHexInt(){return this.toFormat("rgb").toHexInt()}getChannelValue(t){if(t in this)return this[t];throw new Error("Unsupported color channel: "+t)}withChannelValue(t,e){if(t in this){let n=this.clone();return n[t]=e,n}throw new Error("Unsupported color channel: "+t)}getChannelName(t,e){return ky.getStringForLocale(t,e)}getColorSpaceAxes(t){let{xChannel:e,yChannel:n}=t,r=e||this.getColorChannels().find((t=>t!==n)),i=n||this.getColorChannels().find((t=>t!==r)),o=this.getColorChannels().find((t=>t!==r&&t!==i));return{xChannel:r,yChannel:i,zChannel:o}}}class Oy extends Ey{static parse(t){let e=[];if(/^#[\da-f]+$/i.test(t)&&[4,5,7,9].includes(t.length)){const n=(t.length<6?t.replace(/[^#]/gi,"$&$&"):t).slice(1).split("");for(;n.length>0;)e.push(parseInt(n.splice(0,2).join(""),16));e[3]=void 0!==e[3]?e[3]/255:void 0}const n=t.match(/^rgba?\((.*)\)$/);var r;return null!=n&&n[1]&&(e=n[1].split(",").map((t=>Number(t.trim()))),e=e.map(((t,e)=>kd(t,0,e<3?255:1)))),e.length<3?void 0:new Oy(e[0],e[1],e[2],null!==(r=e[3])&&void 0!==r?r:1)}toString(t){switch(t){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(t).toString(t)}}toFormat(t){switch(t){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 -> "+t)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){const t=this.red/255,e=this.green/255,n=this.blue/255,r=Math.min(t,e,n),i=Math.max(t,e,n),o=i-r,a=0===i?0:o/i;let s=0;if(0!==o){switch(i){case t:s=(e-n)/o+(e<n?6:0);break;case e:s=(n-t)/o+2;break;case n:s=(t-e)/o+4}s/=6}return new Py(Td(360*s,2),Td(100*a,2),Td(100*i,2),this.alpha)}toHSL(){const t=this.red/255,e=this.green/255,n=this.blue/255,r=Math.min(t,e,n),i=Math.max(t,e,n),o=(i+r)/2,a=i-r;let s,l;if(0===a)s=l=0;else{switch(l=a/(o<.5?i+r:2-i-r),i){case t:s=(e-n)/a+(e<n?6:0);break;case e:s=(n-t)/a+2;break;case n:s=(t-e)/a+4}s/=6}return new Dy(Td(360*s,2),Td(100*l,2),Td(100*o,2),this.alpha)}clone(){return new Oy(this.red,this.green,this.blue,this.alpha)}getChannelRange(t){switch(t){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: "+t)}}formatChannelValue(t,e){let n,r=this.getChannelValue(t);switch(t){case"red":case"green":case"blue":n={style:"decimal"};break;case"alpha":n={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new vm(e,n).format(r)}getColorSpace(){return"rgb"}getColorChannels(){return Oy.colorChannels}constructor(t,e,n,r){super(),this.red=t,this.green=e,this.blue=n,this.alpha=r}}Oy.colorChannels=["red","green","blue"];const My=/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 Py extends Ey{static parse(t){let e;if(e=t.match(My)){var n;const[t,r,i,o]=(null!==(n=e[1])&&void 0!==n?n:e[2]).split(",").map((t=>Number(t.trim().replace("%",""))));return new Py(jy(t,360),kd(r,0,100),kd(i,0,100),kd(null!=o?o:1,0,1))}}toString(t){switch(t){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}, ${Td(this.saturation,2)}%, ${Td(this.brightness,2)}%)`;case"hsba":return`hsba(${this.hue}, ${Td(this.saturation,2)}%, ${Td(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){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 -> "+t)}}toHSL(){let t=this.saturation/100,e=this.brightness/100,n=e*(1-t/2);return t=0===n||1===n?0:(e-n)/Math.min(n,1-n),new Dy(Td(this.hue,2),Td(100*t,2),Td(100*n,2),this.alpha)}toRGB(){let t=this.hue,e=this.saturation/100,n=this.brightness/100,r=(r,i=(r+t/60)%6)=>n-e*n*Math.max(Math.min(i,4-i,1),0);return new Oy(Math.round(255*r(5)),Math.round(255*r(3)),Math.round(255*r(1)),this.alpha)}clone(){return new Py(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(t){switch(t){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: "+t)}}formatChannelValue(t,e){let n,r=this.getChannelValue(t);switch(t){case"hue":n={style:"unit",unit:"degree",unitDisplay:"narrow"};break;case"saturation":case"brightness":n={style:"percent"},r/=100;break;case"alpha":n={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new vm(e,n).format(r)}getColorSpace(){return"hsb"}getColorChannels(){return Py.colorChannels}constructor(t,e,n,r){super(),this.hue=t,this.saturation=e,this.brightness=n,this.alpha=r}}Py.colorChannels=["hue","saturation","brightness"];const Ay=/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 jy(t,e){return(t%e+e)%e}class Dy extends Ey{static parse(t){let e;if(e=t.match(Ay)){var n;const[t,r,i,o]=(null!==(n=e[1])&&void 0!==n?n:e[2]).split(",").map((t=>Number(t.trim().replace("%",""))));return new Dy(jy(t,360),kd(r,0,100),kd(i,0,100),kd(null!=o?o:1,0,1))}}toString(t){switch(t){case"hex":return this.toRGB().toString("hex");case"hexa":return this.toRGB().toString("hexa");case"hsl":return`hsl(${this.hue}, ${Td(this.saturation,2)}%, ${Td(this.lightness,2)}%)`;case"css":case"hsla":return`hsla(${this.hue}, ${Td(this.saturation,2)}%, ${Td(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(t).toString(t)}}toFormat(t){switch(t){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 -> "+t)}}toHSB(){let t=this.saturation/100,e=this.lightness/100,n=e+t*Math.min(e,1-e);return t=0===n?0:2*(1-e/n),new Py(Td(this.hue,2),Td(100*t,2),Td(100*n,2),this.alpha)}toRGB(){let t=this.hue,e=this.saturation/100,n=this.lightness/100,r=e*Math.min(n,1-n),i=(e,i=(e+t/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return new Oy(Math.round(255*i(0)),Math.round(255*i(8)),Math.round(255*i(4)),this.alpha)}clone(){return new Dy(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(t){switch(t){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: "+t)}}formatChannelValue(t,e){let n,r=this.getChannelValue(t);switch(t){case"hue":n={style:"unit",unit:"degree",unitDisplay:"narrow"};break;case"saturation":case"lightness":n={style:"percent"},r/=100;break;case"alpha":n={style:"percent"};break;default:throw new Error("Unknown color channel: "+t)}return new vm(e,n).format(r)}getColorSpace(){return"hsl"}getColorChannels(){return Dy.colorChannels}constructor(t,e,n,r){super(),this.hue=t,this.saturation=e,this.lightness=n,this.alpha=r}}Dy.colorChannels=["hue","saturation","lightness"],Ty("#ffffff"),Ty("hsl(0, 100%, 50%)");const Ry=Ty("#000000"),Iy=Ty("#FFFFFF");function Ly({onChange:t,value:e,colors:n}){const r=n.map((n=>{const r=e===n;return ar(pp,{onClick:()=>{null==t||t(n)},className:yr("relative block flex-shrink-0 w-26 h-26 border rounded",r&&"shadow-md"),style:{backgroundColor:n},children:r&&ar("span",{className:"absolute inset-0 m-auto rounded-full w-8 h-8 bg-white"})},n)}));return ar("div",{className:"flex gap-6",children:r})}function zy(t={}){const{size:e="md",startAdornment:n,endAdornment:r,startAppend:i,endAppend:o,className:a,labelPosition:s,labelDisplay:l="block",inputClassName:c,inputWrapperClassName:u,unstyled:h,invalid:d,disabled:f,background:p="transparent",flexibleHeight:g}={...t};if(h)return{label:"",input:c||"",wrapper:a||"",inputWrapper:u||"",adornment:"",append:{size:"",radius:""},size:{font:"",height:""},description:"",error:""};const m=function({size:t,flexibleHeight:e}){switch(t){case"xs":return{font:"text-xs",height:e?"min-h-30":"h-30"};case"sm":return{font:"text-sm",height:e?"min-h-36":"h-36"};case"lg":return{font:"text-lg",height:e?"min-h-50":"h-50"};case"xl":return{font:"text-xl",height:e?"min-h-60":"h-60"};default:return{font:"text-sm",height:e?"min-h-42":"h-42"}}}({size:t.size,flexibleHeight:g}),v=i||o,b=d?"border-danger":"border-divider",y=d?"focus:ring-danger/focus focus:border-danger/60":"focus:ring-primary/focus focus:border-primary/60";return{label:yr(l,"first-letter:capitalize text-left",f&&"text-disabled",m.font,"side"===s?"mr-16":"mb-4"),input:yr("block text-left relative w-full appearance-none transition-shadow text","transparent"===p&&"bg-transparent","bg-alt"===p&&"bg-alt","bg-paper"===p&&"bg-paper",!v&&"rounded",i&&"rounded-r rounded-l-none",o&&"rounded-l rounded-r-none",!v&&`${b} border`,i&&`${b} border-y border-r`,o&&`${b} border-y border-l`,!f&&`focus:ring ${y} focus:outline-none shadow-sm`,f&&"text-disabled cursor-not-allowed",c,m.font,m.height,n?"pl-46":"pl-12",r?"pr-46":"pr-12"),adornment:hp(e),append:{size:up(e),radius:i?"rounded-l":"rounded-r"},wrapper:yr(a,m.font,{"flex items-center":"side"===s}),inputWrapper:yr("relative",u,v&&"flex items-stretch"),size:m,description:"text-muted pt-10 text-xs",error:"text-danger pt-10 text-xs"}}Ry.toHexInt(),Iy.toHexInt();const Fy=["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)"];function Ny({defaultValue:t,onChange:e,colorPresets:n,showInput:r}){const[o,a]=(0,i.useState)(t),s=n||Fy,l=zy({size:"sm"});return sr("div",{children:[ar(by,{className:"!w-auto",color:o,onChange:t=>{null==e||e(t),a(t)}}),sr("div",{className:"py-20 px-12",children:[s&&ar(Ly,{colors:s,onChange:t=>{if(t){const n=Ty(t).toString("hex");null==e||e(n),a(n)}},value:o}),r&&ar("div",{className:"pt-20",children:ar(_y,{autoComplete:"off",role:"textbox",autoCorrect:"off",spellCheck:"false",required:!0,"aria-label":"Hex color",prefixed:!0,className:l.input,color:o,onChange:t=>{null==e||e(t),a(t)}})})]})]})}const By=i.createContext(null);function Vy(){return(0,i.useContext)(By)}function Hy(){const{lines:t,localeCode:e}=Tm();return{trans:(0,i.useCallback)((n=>Wy({...n,lines:t,localeCode:e})),[t,e])}}const Wy=bp((t=>{let{lines:e,message:n,values:r,localeCode:i}=t;return n=(null==e?void 0:e[n])||n,r&&(n=Em(i,t),Object.entries(r).forEach((([t,e])=>{n=n.replace(`:${t}`,`${e}`)}))),n}),{equals:Cm,callTimeout:0});function Uy({onDismiss:t}){const{trans:e}=Hy();return ar("button",{className:"sr-only","aria-label":e(ur("Dismiss")),tabIndex:-1,onClick:()=>{t&&t()}})}function Yy(t){const{type:e="modal",dialogProps:n,...r}=(0,i.useContext)(By),{children:o,className:a,size:s="md",background:l,radius:c="rounded",maxWidth:u="max-w-dialog",...h}=t;let d=null;("popover"===e||"tray"===e)&&(d=ar(Uy,{onDismiss:r.close}));const f="fullscreenTakeover"===s||"tray"===e,p=yr("mx-auto pointer-events-auto outline-none flex flex-col overflow-hidden",l||"bg-paper","tray"!==e&&function(t){switch(t){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"fullscreenTakeover":return"w-full h-full";default:return t}}(s),"tray"===e&&"rounded-t","fullscreenTakeover"!==s&&"shadow-2xl border max-h-dialog",!f&&`${c} ${u}`,a);return sr("div",{...Dd({role:"dialog",tabIndex:-1},n,h),style:{"--be-dialog-padding":"24px"},"aria-modal":!0,className:p,children:[i.Children.toArray(o).map((t=>{var e;return(0,i.isValidElement)(t)?(0,i.cloneElement)(t,{size:null!=(e=t.props.size)?e:s}):t})),d]})}const Xy=_r(ar("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDownOutlined"),Gy=(0,i.forwardRef)((({children:t,autoFocus:e=!1,restoreFocus:n=!0,isDismissable:r=!0,isOpen:i=!1,onClose:o},a)=>{const s=Ig(),l=Bd(a);return sr("div",{className:"isolate z-modal fixed inset-0",style:s,children:[ar(_m,{onClick:()=>{r&&o()}},"modal-underlay"),ar(fd.div,{ref:l,className:"absolute inset-0 w-full h-full z-20 flex items-center justify-center pointer-events-none",role:"presentation",initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},children:ar(nm,{restoreFocus:n,autoFocus:e,contain:!0,children:t})})]})}));function $y(t){let{children:e,type:n,disableInitialTransition:r,onClose:a,isDismissable:s=!0,triggerRef:l,moveFocusToDialog:c=!0,returnFocusToTrigger:u=!0}=t;const[h,d]=Cd(t.isOpen,t.defaultIsOpen,t.onOpenChange),{dialogTrigger:f,dialog:p}=function(t){const e=i.Children.toArray(t);return e&&2===e.length?{dialogTrigger:e[0],dialog:e[1]}:{dialog:e[0]}}(e);Lm()&&"popover"===n&&(n="modal");const{x:g,y:m,reference:v,floating:b,strategy:y,refs:x}=kg({...t,disablePositioning:"modal"===n}),w="popover"===n?{position:y,top:null!=m?m:"",left:null!=g?g:""}:{},_=(0,i.useId)(),S=`${_}-label`,C=`${_}-description`,k=`${_}-form`,T=(0,i.useCallback)((t=>{null==a||a(t),d(!1)}),[a,d]);Md((()=>{(null==l?void 0:l.current)&&x.reference.current!==l.current&&v(l.current)}),[v,l,x]);const E=(0,i.useMemo)((()=>({"aria-labelledby":S,"aria-describedby":C})),[S,C]);let O;O="modal"===n?Gy:"tray"===n?Sm:xm;const M=(0,i.useMemo)((()=>({dialogProps:E,type:n,labelId:S,descriptionId:C,isDismissable:s,close:T,formId:k})),[T,C,E,k,S,n,s]);return sr(i.Fragment,{children:[f&&(0,i.cloneElement)(f,{onClick:fp((t=>{t.stopPropagation(),d(!h)})),ref:l?null:v,...f.props}),Ca&&(0,o.createPortal)(ar(xd,{initial:!r,children:h&&ar(By.Provider,{value:M,children:ar(O,{ref:b,triggerRef:x.reference,style:w,restoreFocus:u,autoFocus:c,isOpen:h,onClose:T,isDismissable:s,children:p})})}),Ca)]})}function qy(t){const{label:e,className:n,value:r,onChange:o,size:a}=t,s=Ea((t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.colorPresets)?void 0:n.items}))||[],l=zy({size:a}),[c,u]=(0,i.useState)(r),[h,d]=(0,i.useState)(!1);return sr("div",{className:yr(n,"w-max"),children:[e&&ar("span",{className:l.label,children:e}),sr($y,{type:"popover",isOpen:h,onOpenChange:d,children:[sr(pp,{className:yr(l.input,"inline-flex items-center"),"aria-label":t["aria-label"],children:[ar("span",{className:"block flex-shrink-0 mr-5 border rounded h-2/4 aspect-square",style:{backgroundColor:c}}),ar(Ky,{isActive:h,className:l.adornment})]}),ar(Yy,{size:"auto",children:ar(Ny,{onChange:t=>{u(t),null==o||o(t)},defaultValue:c,colorPresets:s})})]})]})}function Ky({isActive:t,className:e}){return ar(Xy,{size:"sm",className:`transition-transform ml-auto flex-shrink-0 ${t?"rotate-180":"rotate-0"} ${e}`})}function Zy(t){const{size:e="md",inline:n,label:r,showValueLabel:i=!!r,className:o,slider:a,children:s}=t,{domProps:l,trackRef:c,getThumbPercent:u,getThumbValueLabel:h,labelId:d,groupId:f,thumbIds:p,isDisabled:g,numberFormatter:m,minValue:v,maxValue:b,step:y,values:x,getValueLabel:w}=a;let _="",S=Math.max([...m.format(v)].length,[...m.format(b)].length,[...m.format(y)].length);w?_=w(x[0]):1===x.length?_=h(0):2===x.length&&(_=`${h(0)} \u2013 ${h(1)}`,S=3+2*Math.max(S,[...m.format(v)].length,[...m.format(b)].length));const C=zy({size:e,disabled:g,labelDisplay:"flex"}),k=yr("w-full flex-shrink-0 touch-none",o,{"flex items-center":n});return sr("div",{className:k,role:"group",id:f,children:[sr("div",{className:yr(C.label,"select-none"),children:[r&&ar("label",{onClick:()=>{var t;null==(t=document.getElementById(p[0]))||t.focus()},id:d,htmlFor:f,children:r}),i&&ar("output",{htmlFor:p[0],className:"ml-auto text-right","aria-live":"off",style:S?{width:`${S}ch`,minWidth:`${S}ch`}:void 0,children:_})]}),sr("div",{ref:c,className:"h-30 relative",...l,role:"presentation",children:[ar("div",{className:"absolute inset-0 m-auto h-4 rounded "+(g?"bg-disabled":"bg-primary-light")}),ar("div",{className:"absolute inset-0 my-auto h-4 rounded "+(g?"bg-disabled-fg":"bg-primary"),style:{width:100*u(0)+"%"}}),s]})]})}function Jy({minValue:t=0,maxValue:e=100,isDisabled:n=!1,step:r=1,formatOptions:o,onChangeEnd:a,label:s,getValueLabel:l,...c}){var u;const h=function(t={}){const{localeCode:e}=Tm();return(0,i.useMemo)((()=>new vm(e,t)),[e,t])}(o),{addGlobalListener:d,removeGlobalListener:f}=Nd(),p=(0,i.useRef)(null),[g,m]=Cd(c.value?c.value:void 0,null!=(u=c.defaultValue)?u:[t],c.onChange),v=(0,i.useRef)(null);v.current=g;const[b,y]=(0,i.useState)(new Array(g.length).fill(!1)),x=(0,i.useRef)(null);x.current=b;const w=e=>0===e?t:g[e-1],_=t=>t===g.length-1?e:g[t+1],S=(t,e)=>{if(n||!P(t)||!v.current)return;e=function(t,e,n,r){let i=(t-(isNaN(e)?0:e))%r,o=2*Math.abs(i)>=r?t+Math.sign(i)*(r-Math.abs(i)):t-i;isNaN(e)?!isNaN(n)&&o>n&&(o=Math.floor(n/r)*r):o<e?o=e:!isNaN(n)&&o>n&&(o=e+Math.floor((n-e)/r)*r);let a=r.toString(),s=a.indexOf("."),l=s>=0?a.length-s:0;if(l>0){let t=Math.pow(10,l);o=Math.round(o*t)/t}return o}(e,w(t),_(t),r),v.current=Qy(v.current,t,e),m(v.current)},C=(t,e)=>{var r;if(n||!P(t))return;const i=null==(r=x.current)?void 0:r[t];x.current=Qy(x.current||[],t,e),y(x.current),a&&i&&!x.current.some(Boolean)&&a(v.current||[])},[k,T]=(0,i.useState)(void 0),E=n=>(n=>(n-t)/(e-t))(v.current[n]),O=n=>Sb((e=>Math.round((e-t)/r)*r+t)(n*(e-t)+t),t,e),M=(0,i.useRef)(new Array(g.length).fill(!0)),P=t=>M.current[t],A=(0,i.useRef)(null),j=(0,i.useRef)(void 0),D=(0,i.useRef)(null),{domProps:R}=fb({onPointerDown:t=>{if(("mouse"!==t.pointerType||!(0!==t.button||t.altKey||t.ctrlKey||t.metaKey))&&p.current&&!n&&g.every(((t,e)=>!b[e]))){const e=p.current.offsetWidth,n=p.current.getBoundingClientRect().left,r=(t.clientX-n)/e,i=O(r);let o;const a=g.findIndex((t=>i-t<0));if(0===a)o=a;else if(-1===a)o=g.length-1;else{const t=g[a-1],e=g[a];o=Math.abs(t-i)<Math.abs(e-i)?a-1:a}o>=0&&P(o)?(t.preventDefault(),A.current=o,T(o),j.current=t.pointerId,C(A.current,!0),S(o,i),d(window,"pointerup",I,!1)):A.current=null}},onMoveStart(){D.current=null},onMove(t,e){var n;const r=(null==(n=p.current)?void 0:n.offsetWidth)||0;if(null==D.current&&(D.current=E(A.current||0)*r),D.current+=e,null!=A.current&&p.current){const t=Sb(D.current/r,0,1);((t,e)=>{S(t,O(e))})(A.current,t)}},onMoveEnd(){null!=A.current&&(C(A.current,!1),A.current=null)}}),I=t=>{t.pointerId===j.current&&(null!=A.current&&(C(A.current,!1),A.current=null),f(window,"pointerup",I,!1))},L=(0,i.useId)(),z=s?`${L}-label`:void 0,F=`${L}-group`,N=[...Array(g.length)].map(((t,e)=>`${L}-thumb-${e}`));return{domProps:R,trackRef:p,isDisabled:n,step:r,values:g,minValue:t,maxValue:e,focusedThumb:k,labelId:z,groupId:F,thumbIds:N,numberFormatter:h,getThumbPercent:E,getThumbMinValue:w,getThumbMaxValue:_,getThumbValueLabel:t=>function(t){return h.format(t)}(g[t]),isThumbDragging:t=>{var e;return(null==(e=x.current)?void 0:e[t])||!1},setThumbValue:S,updateDraggedThumbs:C,setThumbEditable:(t,e)=>{M.current[t]=e},setFocusedThumb:T,getValueLabel:l}}function Qy(t,e,n){return t[e]===n?t:[...t.slice(0,e),n,...t.slice(e+1)]}function tx({index:t,slider:e,isDisabled:n,ariaLabel:r,inputRef:o,onBlur:a}){const s=Bd(o),{addGlobalListener:l,removeGlobalListener:c}=Nd(),{step:u,values:h,focusedThumb:d,labelId:f,thumbIds:p,isDisabled:g,getThumbPercent:m,getThumbMinValue:v,getThumbMaxValue:b,getThumbValueLabel:y,setThumbValue:x,updateDraggedThumbs:w,isThumbDragging:_,setThumbEditable:S,setFocusedThumb:C}=e,k=h[t];S(t,!n);const T=n||g,E=(0,i.useCallback)((()=>{s.current&&s.current.focus({preventScroll:!0})}),[s]),O=d===t;(0,i.useEffect)((()=>{O&&E()}),[O,E]);const M=(0,i.useRef)(void 0),P=e=>{e.pointerId===M.current&&(E(),w(t,!1),c(window,"pointerup",P,!1))},A=yr("outline-none rounded-full w-18 h-18 top-1/2 -translate-y-1/2 -translate-x-1/2 absolute inset-0 transition-button duration-200",!T&&"focus-within:ring focus-within:ring-primary-light shadow-md",function({isDisabled:t,isDragging:e}){return t?"bg-slider-disabled cursor-default":yr("hover:bg-primary-dark",e?"bg-primary-dark":"bg-primary")}({isDisabled:T,isDragging:_(t)}));return ar("div",{role:"presentation",className:A,style:{left:`${Math.max(100*m(t),0)}%`},onPointerDown:e=>{0!==e.button||e.altKey||e.ctrlKey||e.metaKey||(E(),M.current=e.pointerId,w(t,!0),l(window,"pointerup",P,!1))},children:ar("input",{id:p[t],onKeyDown:fp((()=>{w(t,!0)})),onKeyUp:fp((()=>{w(t,!1)})),ref:s,tabIndex:T?void 0:0,min:v(t),max:b(t),step:u,value:k,disabled:T,"aria-label":r,"aria-labelledby":f,"aria-orientation":"horizontal","aria-valuetext":y(t),onFocus:()=>{C(t)},onBlur:e=>{C(void 0),w(t,!1),null==a||a(e)},onChange:e=>{x(t,parseFloat(e.target.value))},type:"range",className:"sr-only"})})}var ex=t=>null==t;var nx=t=>!ex(t)&&!Array.isArray(t)&&(t=>"object"==typeof t)(t)&&!(t=>t instanceof Date)(t),rx=t=>nx(t)&&t.target?(t=>"checkbox"===t.type)(t.target)?t.target.checked:t.target.value:t,ix=t=>void 0===t,ox=(t,e,n)=>{if(!e||!nx(t))return n;const r=(t=>Array.isArray(t)?t.filter(Boolean):[])(e.split(/[,[\].]+?/)).reduce(((t,e)=>ex(t)?t:t[e]),t);return ix(r)||r===t?ix(t[e])?n:t[e]:r};const ax="blur",sx="change",lx="all",cx=i.createContext(null),ux=()=>i.useContext(cx);var hx=(t,e,n)=>{const{name:r,...i}=t;return(t=>nx(t)&&!Object.keys(t).length)(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find((t=>e[t]===(!n||lx)))},dx=(t,e,n)=>n&&e?t===e:!t||!e||t===e||(t=>Array.isArray(t)?t:[t])(t).some((t=>t&&(t.startsWith(e)||e.startsWith(t))));function fx(t){const e=i.useRef(t);e.current=t,i.useEffect((()=>{const n=!t.disabled&&e.current.subject.subscribe({next:e.current.callback});return()=>{var t;(t=n)&&t.unsubscribe()}}),[t.disabled])}function px(t){const e=ux(),{control:n=e.control,disabled:r,name:o,exact:a}=t||{},[s,l]=i.useState(n._formState),c=i.useRef({isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=i.useRef(o),h=i.useRef(!0);u.current=o;return fx({disabled:r,callback:i.useCallback((t=>h.current&&dx(u.current,t.name,a)&&hx(t,c.current)&&l({...n._formState,...t})),[n,a]),subject:n._subjects.state}),i.useEffect((()=>(h.current=!0,()=>{h.current=!1})),[]),((t,e,n,r=!0)=>{const i={};for(const o in t)Object.defineProperty(i,o,{get:()=>{const i=o;return e[i]!==lx&&(e[i]=!r||lx),n&&(n[i]=!0),t[i]}});return i})(s,n._proxyFormState,c.current,!1)}var gx=t=>"function"==typeof t;function mx(t){const e=ux(),{control:n=e.control,name:r,defaultValue:o,disabled:a,exact:s}=t||{},l=i.useRef(r);l.current=r;const c=i.useCallback((t=>{if(dx(l.current,t.name,s)){const e=((t,e,n,r)=>{const i=Array.isArray(t);return(t=>"string"==typeof t)(t)?(r&&e.watch.add(t),ox(n,t)):i?t.map((t=>(r&&e.watch.add(t),ox(n,t)))):(r&&(e.watchAll=!0),n)})(l.current,n._names,t.values||n._formValues);h(ix(l.current)||nx(e)&&!(t=>{for(const e in t)if(gx(t[e]))return!0;return!1})(e)?{...e}:Array.isArray(e)?[...e]:ix(e)?o:e)}}),[n,s,o]);fx({disabled:a,subject:n._subjects.watch,callback:c});const[u,h]=i.useState(ix(o)?n._getWatch(r):o);return i.useEffect((()=>{n._removeUnmounted()})),u}function vx({inputRef:t,onBlur:e,...n}){const{onChange:r,onChangeEnd:i,value:o,defaultValue:a,...s}=n,l={...s,value:null!=o?[o]:void 0,defaultValue:null!=a?[a]:void 0,onChange:t=>{null==r||r(t[0])},onChangeEnd:t=>{null==i||i(t[0])}},c=Jy(l);return ar(Zy,{...l,slider:c,children:ar(tx,{index:0,slider:c,inputRef:t,onBlur:e})})}function bx({children:t,direction:e,className:n}){return t?ar("div",{className:yr("absolute h-full min-w-42 flex items-center justify-center top-0 text-muted z-10","start"===e?"left-0":"right-0",n),children:t}):null}const yx=i.forwardRef(((t,e)=>{const{children:n,description:r,errorMessage:i,descriptionProps:o={},errorMessageProps:a={},startAdornment:s,endAdornment:l,startAppend:c,endAppend:u,fieldClassNames:h,disabled:d,wrapperProps:f}=t;return sr("div",{className:h.wrapper,ref:e,...f,children:[ar(xx,{...t}),sr("div",{className:h.inputWrapper,children:[ar(bx,{direction:"start",className:h.adornment,children:s}),c&&ar(wx,{style:h.append,disabled:d,children:c}),n,u&&ar(wx,{style:h.append,disabled:d,children:u}),ar(bx,{direction:"end",className:h.adornment,children:l})]}),r&&!i&&ar("div",{className:h.description,...o,children:r}),i&&ar("div",{className:h.error,...a,children:i})]})}));function xx({labelElementType:t,fieldClassNames:e,labelProps:n,label:r,labelSuffix:i,required:o}){if(!r)return null;const a=sr(t||"label",{className:e.label,...n,children:[r,o&&ar("span",{className:"text-danger",children:" *"})]});return i?sr("div",{className:"flex items-center gap-14 w-full",children:[a,ar("div",{className:"ml-auto mb-4 text-muted text-xs",children:i})]}):a}function wx({children:t,style:e,disabled:n}){return i.cloneElement(t,{...t.props,disabled:t.props.disabled||n,...e})}function _x({autoFocus:t,autoSelectText:e},n){const r=(0,i.useRef)(t);(0,i.useEffect)((()=>{var t;r.current&&n.current&&(null==(t=n.current)||t.focus(),e&&"input"===n.current.nodeName.toLowerCase()&&requestAnimationFrame((()=>{n.current.select()}))),r.current=!1}),[n,e])}function Sx(t){const{focusRef:e,labelElementType:n="label",label:r,labelSuffix:o,autoFocus:a,autoSelectText:s,labelPosition:l,size:c,errorMessage:u,description:h,flexibleHeight:d,startAdornment:f,endAdornment:p,startAppend:g,endAppend:m,className:v,inputClassName:b,inputWrapperClassName:y,unstyled:x,background:w,invalid:_,disabled:S,id:C,...k}=t;_x(t,e);const T=(0,i.useId)(),E=C||T,O={id:`${E}-label`,htmlFor:"label"===n?E:void 0},M={id:`${E}-description`},P={id:`${E}-error`},A={"aria-label":t.label||t["aria-label"]||!t.placeholder?t["aria-label"]:t.placeholder,"aria-invalid":_||void 0,id:E,disabled:S,...k},j=[];r&&j.push(O.id),A["aria-labelledby"]&&j.push(A["aria-labelledby"]),A["aria-labelledby"]=j.length?j.join(" "):void 0;const D=[];return h&&D.push(M.id),u&&D.push(P.id),A["aria-describedby"]&&D.push(A["aria-describedby"]),A["aria-describedby"]=D.length?D.join(" "):void 0,{fieldProps:{errorMessageProps:P,descriptionProps:M,labelProps:O,disabled:S,label:r,labelSuffix:o,autoFocus:a,autoSelectText:s,labelPosition:l,size:c,errorMessage:u,description:h,flexibleHeight:d,startAdornment:f,endAdornment:p,startAppend:g,endAppend:m,className:v,inputClassName:b,inputWrapperClassName:y,unstyled:x,background:w,invalid:_},inputProps:A}}const Cx=i.forwardRef(((t,e)=>{const{hideCaret:n,placeholder:r=ar(Mm,{message:"Select an option..."}),selectedValue:i,onItemSelected:o,onOpenChange:a,onInputValueChange:s,onSelectionChange:l,selectionMode:c,minWidth:u="min-w-128",children:h,...d}=t,f=Lm(),p=Tg({...t,floatingWidth:f?"auto":"matchTrigger",selectionMode:"single",role:"listbox"},e),{state:{selectedValues:g,isOpen:m,setIsOpen:v,activeIndex:b,setSelectedIndex:y},focusItem:x,listboxId:w,reference:_,refs:S,listContent:C}=p,{fieldProps:k,inputProps:T}=Sx({...d,focusRef:S.reference}),E=p.collection.get(g[0]),O=E?sr("span",{className:"flex items-center gap-10",children:[E.element.props.startIcon,E.element.props.children]}):ar("span",{className:"italic",children:r}),M=zy({...t,endAdornment:!0}),{handleTriggerKeyDown:P,handleListboxKeyboardNavigation:A}=Dm(p),{findMatchingItem:j}=Im();return ar(Pm,{listbox:p,onKeyDownCapture:t=>{if(!m)return;const e=j(t,C,b);null!=e&&x("increment",e)},onKeyDown:A,children:ar(yx,{fieldClassNames:M,...k,children:sr("button",{...T,type:"button","aria-expanded":m?"true":"false","aria-haspopup":"listbox","aria-controls":m?w:void 0,ref:_,onKeyDown:P,onKeyDownCapture:t=>{if(m)return;const e=j(t,C,b);null!=e&&y(e)},disabled:d.disabled,onClick:()=>{v(!m)},className:yr(M.input,!k.unstyled&&u),children:[O,!n&&ar(bx,{direction:"end",children:ar(Xy,{className:M.adornment})})]})})})}));function kx(){const t=Ea((t=>t.filter.selected));if(!t)return null;const e=Ma().filter.getByName(t).options,n=(e,n)=>{var r;null==(r=Ma().filter)||r.applyValue(t,e,n),Oa().setDirty(!0)},r=Ma().canvas.getMainImage().filters,i=Ma().filter.findFilterIndex(t,r),o=null==r?void 0:r[i];if(e){const t=Object.entries(e).map((([t,e])=>{let r;const i=o?o[t]:e.current;return"slider"===e.type?r=ar(vx,{label:ar(Mm,{...gf[t]}),minValue:e.min,maxValue:e.max,step:e.step,defaultValue:i,formatOptions:{style:"percent"},size:"sm",onChange:e=>{n(t,e)}}):"colorPicker"===e.type?r=ar(qy,{label:ar(Mm,{...gf[t]}),size:"sm",className:"w-full",value:i,onChange:e=>{n(t,e)}}):"select"===e.type&&(r=ar(Cx,{selectionMode:"single",size:"sm",label:ar(Mm,{...gf[t]}),defaultValue:i,onSelectionChange:e=>{n(t,e)},children:e.available.map((t=>ar(jg,{value:t.key,children:ar("span",{className:"capitalize",children:t.key})},t.key)))})),ar("div",{className:"pb-10",children:r},t)}));return ar(Yb,{children:ar("div",{className:"max-w-240 pt-10 mx-auto",children:t})})}return null}function Tx(){const t=Ea((t=>t.frame.active)),e="basic"===(null==t?void 0:t.mode),n=(0,i.useCallback)((t=>`${t}%`),[]);return ar(Yb,{className:"pb-18 pt-6",children:sr("div",{className:"max-w-288 m-auto",children:[e&&ar(qy,{className:"w-full mb-20",size:"sm",label:ar(Mm,{message:"Color"}),value:Ma().frame.builder.defaultColor,onChange:t=>{Ma().frame.active.changeColor(t)}}),ar(vx,{size:"sm",label:ar(Mm,{message:"Size"}),step:1,minValue:Ma().frame.active.getMinSize(),maxValue:Ma().frame.active.getMaxSize(),defaultValue:Ma().frame.active.currentSizeInPercent,getValueLabel:n,onChange:t=>{Ma().frame.resize(t)}})]})})}const Ex=i.createContext(null);function Ox(){const{tabsRef:t,selectedTab:e}=(0,i.useContext)(Ex),[n,r]=(0,i.useState)({width:void 0,transform:void 0,className:void 0});return Md((()=>{if(null!=e&&t.current){const n=t.current[e];r((t=>({width:`${n.offsetWidth}px`,transform:`translateX(${n.offsetLeft}px)`,className:void 0===t.width?"":"transition-all"})))}}),[r,e,t]),ar("div",{className:yr("absolute bottom-0 left-0 h-2 bg-primary",n.className),role:"presentation",style:{width:n.width,transform:n.transform}})}function Mx({children:t,center:e}){const n=i.Children.toArray(t);return ar(nm,{children:sr("div",{className:"flex relative max-w-full overflow-auto border-b",role:"tablist","aria-orientation":"horizontal",children:[n.map(((t,r)=>(0,i.isValidElement)(t)?(0,i.cloneElement)(t,{index:r,className:yr(t.props.className,e&&0===r&&"ml-auto",e&&r===n.length-1&&"mr-auto")}):null)),ar(Ox,{})]})})}function Px(t){const{size:e="md",children:n,className:r,isLazy:o}=t,a=(0,i.useRef)([]),s=(0,i.useId)(),[l,c]=Cd(t.selectedTab,t.defaultSelectedTab||0,t.onTabChange),u=(0,i.useMemo)((()=>({selectedTab:l,setSelectedTab:c,tabsRef:a,size:e,isLazy:o,id:s})),[l,s,o,c,e]);return ar(Ex.Provider,{value:u,children:ar("div",{className:yr(r,"max-w-full overflow-hidden"),children:n})})}const Ax=_r(ar("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"),jx=_r(ar("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"}),"FormatStrikethroughOutlined"),Dx=_r(ar("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z"}),"FormatItalicOutlined"),Rx=_r(ar("path",{d:"M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"}),"FormatAlignRightOutlined"),Ix=_r(ar("path",{d:"M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"}),"FormatAlignLeftOutlined"),Lx=_r(ar("path",{d:"M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"}),"FormatAlignCenterOutlined"),zx=(0,i.forwardRef)((({inputElementType:t="input",flexibleHeight:e,inputRef:n,...r},i)=>{const o=Bd(n),{fieldProps:a,inputProps:s}=Sx({...r,focusRef:o}),l="textarea"===t,c=l?"textarea":"input",u=zy({...r,flexibleHeight:e||"textarea"===t});return"textarea"===t&&!r.unstyled&&(u.input=`${u.input} py-12`),ar(yx,{ref:i,fieldClassNames:u,...a,children:ar(c,{ref:o,...s,rows:l?s.rows||4:void 0,className:u.input})})}));function Fx(){return sr("div",{className:"flex gap-20 justify-center",children:[ar(Nx,{}),ar(Bx,{}),ar(Vx,{})]})}function Nx(){var t;const e=null!=(t=Ea((t=>t.objects.active.editableProps.fontSize)))?t:40,{trans:n}=Hy();return ar(zx,{type:"number",size:"xs","aria-label":n({message:"Font Size"}),min:1,max:300,className:"w-64 flex-shrink-0",value:e,onChange:t=>{Ma().objects.setValues({fontSize:t.target.valueAsNumber}),Oa().setDirty(!0)}})}function Bx(){const t=Ea((t=>t.objects.active.editableProps.fontStyle)),e=Ea((t=>t.objects.active.editableProps.underline)),n=Ea((t=>t.objects.active.editableProps.linethrough)),[r,o]=(0,i.useState)([t,e&&"underline",n&&"linethrough"]);return sr(Xm,{size:"xs",variant:"outline",radius:"rounded",value:r,multiple:!0,onChange:t=>{o(t),Ma().objects.setValues({underline:t.includes("underline"),linethrough:t.includes("linethrough"),fontStyle:t.includes("italic")?"italic":""}),Oa().setDirty(!0)},children:[ar(Bm,{value:"underline",children:ar(Ax,{})}),ar(Bm,{value:"linethrough",children:ar(jx,{})}),ar(Bm,{value:"italic",children:ar(Dx,{})})]})}function Vx(){const t=Ea((t=>t.objects.active.editableProps.textAlign));return sr(Xm,{size:"xs",variant:"outline",radius:"rounded",value:t,onChange:t=>{Ma().objects.setValues({textAlign:t}),Oa().setDirty(!0)},children:[ar(Bm,{value:"left",children:ar(Ix,{})}),ar(Bm,{value:"center",children:ar(Lx,{})}),ar(Bm,{value:"right",children:ar(Rx,{})})]})}function Hx({children:t,className:e}){const{selectedTab:n,isLazy:r}=(0,i.useContext)(Ex),o=i.Children.toArray(t);let a;return a=r?(0,i.cloneElement)(o[n],{index:n}):o.map(((t,e)=>{if((0,i.isValidElement)(t)){const r=e===n;return(0,i.cloneElement)(t,{index:e,"aria-hidden":!r,className:r?t.props.className:yr(t.props.className,"hidden")})}return null})),ar("div",{className:e,children:a})}function Wx({className:t,children:e,index:n,...r}){const{id:o}=(0,i.useContext)(Ex),[a,s]=(0,i.useState)(0),l=(0,i.useRef)(null);return Md((()=>{if(null!=l&&l.current){const t=()=>{const t=dm(l.current,{tabbable:!0});s(t.nextNode()?void 0:0)};t();const e=new MutationObserver(t);return e.observe(l.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{e.disconnect()}}}),[l]),ar("div",{tabIndex:a,ref:l,id:`${o}-${n}-tabpanel`,"aria-labelledby":`${o}-${n}-tab`,className:yr(t,"focus-visible:outline-primary-light"),role:"tabpanel",...r,children:e})}i.forwardRef((({name:t,...e},n)=>{const{field:{onChange:r,onBlur:o,value:a="",ref:s},fieldState:{invalid:l,error:c}}=function(t){const e=ux(),{name:n,control:r=e.control,shouldUnregister:o}=t,a=((t,e)=>t.has((t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t)(e)))(r._names.array,n),s=mx({control:r,name:n,defaultValue:ox(r._formValues,n,ox(r._defaultValues,n,t.defaultValue)),exact:!0}),l=px({control:r,name:n}),c=i.useRef(r.register(n,{...t.rules,value:s}));return i.useEffect((()=>{const t=(t,e)=>{const n=ox(r._fields,t);n&&(n._f.mount=e)};return t(n,!0),()=>{const e=r._options.shouldUnregister||o;(a?e&&!r._stateFlags.action:e)?r.unregister(n):t(n,!1)}}),[n,r,a,o]),{field:{name:n,value:s,onChange:i.useCallback((t=>{c.current.onChange({target:{value:rx(t),name:n},type:sx})}),[n]),onBlur:i.useCallback((()=>{c.current.onBlur({target:{value:ox(r._formValues,n),name:n},type:ax})}),[n,r]),ref:i.useCallback((t=>{const e=ox(r._fields,n);t&&e&&t.focus&&(e._f.ref={focus:()=>t.focus(),select:()=>t.select(),setCustomValidity:e=>t.setCustomValidity(e),reportValidity:()=>t.reportValidity()})}),[n,r._fields])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ox(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!ox(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ox(l.touchedFields,n)},error:{enumerable:!0,get:()=>ox(l.errors,n)}})}}({name:t}),u={onChange:r,onBlur:o,value:null==a?"":a,invalid:l,errorMessage:null==c?void 0:c.message,inputRef:s};return ar(zx,{ref:n,...Dd(u,e)})}));const Ux=[{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)"}]}],Yx=_r(ar("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"),Xx=_r(ar("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"),Gx=_r(ar("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 $x({property:t}){const{trans:e}=Hy(),n=Ea((e=>e.objects.active.editableProps[t]));return sr("div",{className:"flex items-center justify-center gap-14",children:[ar(qy,{className:"flex-shrink-0",size:"xs","aria-label":e({message:"Color"}),value:"string"==typeof n?n:fr.fill,onChange:e=>{Ma().objects.setValues({[t]:e}),Oa().setDirty(!0)}}),ar(qx,{type:"gradient",property:t}),ar(qx,{type:"texture",property:t})]})}function qx({type:t,property:e}){const n=ar("texture"===t?Yx:Xx,{});return ar(i.Fragment,{children:sr($y,{type:"popover",children:[ar(gp,{className:"flex-shrink-0",id:`${t}-panel-trigger`,variant:"outline",size:"xs",startIcon:n,endIcon:ar(Xy,{}),children:ar("span",{className:"capitalize",children:ar(Mm,"gradient"===t?{message:"Gradient"}:{message:"Texture"})})}),ar(Yy,{size:"auto",children:ar("div",{className:"grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md",children:ar(Kx,{property:e,type:t})})})]})})}function Kx({type:t,property:e}){const{close:n}=Vy(),r=Array.from(Array("gradient"===t?Ux.length:28).keys()),o="w-56 h-56 bg border shadow-sm hover:scale-110",a=r.map((r=>{const i=uf(`images/${t}s/${r}.png`);return ar(pp,{radius:"rounded",className:o,style:{backgroundImage:`url(${i})`},"aria-label":`Select ${t} #${r}`,onClick:async()=>{n();const o="gradient"===t?new Ud.fabric.Gradient(Ux[r]):await Jx(i);Ma().objects.setValues({[e]:o}),Oa().setDirty(!0)}},r)}));return"texture"===t&&a.unshift(ar(Zx,{property:e,className:o},"upload-btn")),ar(i.Fragment,{children:a})}function Zx({className:t,property:e}){const{close:n}=Vy();return ar(pp,{radius:"rounded",className:t,"aria-label":"Upload an image",onClick:async()=>{const t=await Ma().import.openUploadWindow();if(n(),t){const n=await Jx(await t.data);Ma().objects.setValues({[e]:n})}},children:ar(Gx,{className:"icon-md"})})}function Jx(t){return new Promise((e=>{Ud.fabric.util.loadImage(t,(t=>{const n=new Ud.fabric.Pattern({source:t,repeat:"repeat"});e(n)}))}))}function Qx(){const t=Ea((t=>t.objects.active.editableProps.opacity));return ar(vx,{className:"max-w-240 w-full mx-auto","aria-label":"Opacity",value:t,minValue:.1,step:.1,maxValue:1,onChange:t=>{Ma().objects.setValues({opacity:t}),Oa().setDirty(!0)}})}function tw(){const{trans:t}=Hy(),e=Ea((t=>t.objects.active.editableProps.stroke)),n=Ea((t=>t.objects.active.editableProps.strokeWidth));return sr("div",{className:"flex items-center gap-40",children:[ar(qy,{className:"ml-auto flex-shrink-0",size:"xs",value:e,"aria-label":t({message:"Outline Color"}),onChange:t=>{Ma().objects.setValues({stroke:t}),Oa().setDirty(!0)}}),ar(vx,{"aria-label":"Outline Width",className:"max-w-240 mr-auto flex-shrink-0",value:n,onChange:t=>{Ma().objects.setValues({strokeWidth:t}),Oa().setDirty(!0)}})]})}const ew=_r(ar("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 nw(){return ar("div",{children:ar(gp,{type:"button",variant:"outline",size:"xs",startIcon:ar(ew,{}),radius:"rounded-full",onClick:async()=>{const t=await Ma().import.openUploadWindow();if(t){const e=Ma().objects.getActive();if(e&&"setSrc"in e){const n=await t.data;e.setSrc(n,(()=>{tf({src:n}),Ma().canvas.render()}))}}},children:ar(Mm,{message:"Replace Image"})})})}const rw={color:"rgba(0, 0, 0, 0.6)",blur:3,offsetX:-1,offsetY:0};function iw(){const{trans:t}=Hy(),e=Ea((t=>t.objects.active.editableProps.shadow))||rw;return sr("div",{className:"flex items-center gap-40",children:[ar(qy,{className:"ml-auto flex-shrink-0",value:e.color,size:"xs","aria-label":t({message:"Shadow Color"}),onChange:t=>{Ma().objects.setValues({shadow:ow({color:t})}),Oa().setDirty(!0)}}),ar(vx,{"aria-label":"Shadow Blur",className:"max-w-240 mr-auto flex-shrink-0",defaultValue:e.blur,onChange:t=>{Ma().objects.setValues({shadow:ow({blur:t})}),Oa().setDirty(!0)}})]})}function ow(t){var e;const n=null==(e=Ma().objects.getActive())?void 0:e.shadow;return n?(Object.entries(t).forEach((([t,e])=>{n[t]=e})),n):new Ud.fabric.Shadow({...rw,...t})}function aw({index:t,className:e,isDisabled:n,children:r}){const{selectedTab:o,setSelectedTab:a,tabsRef:s,size:l,id:c}=(0,i.useContext)(Ex),u=t===o,h=function(){var t;return null===(t=(0,i.useContext)(Qg))||void 0===t?void 0:t.focusManager}(),d=yr("tracking-wide overflow-hidden capitalize text-sm flex-shrink-0 flex items-center justify-center outline-none transition-colors","focus-visible:ring focus-visible:ring-2 ring-inset rounded",function({isDisabled:t,isSelected:e}){return t?"text-disabled cursor-default":e?"text-primary":"text-muted hover:text-main"}({isDisabled:n,isSelected:u}),e,{"px-18 h-48":!l||"md"===l,"px-12 h-32":"sm"===l,"cursor-pointer":!n});return ar("button",{disabled:n,id:`${c}-${t}-tab`,"aria-controls":`${c}-${t}-tabpanel`,type:"button",role:"tab","aria-selected":u,tabIndex:n?void 0:u?0:-1,onKeyDown:t=>{switch(t.key){case"ArrowLeft":h.focusPrevious();break;case"ArrowRight":h.focusNext();break;case"Home":h.focusFirst();break;case"End":h.focusLast()}},onClick:()=>{a(t)},className:d,ref:e=>{s.current&&e&&(s.current[t]=e)},children:r})}function sw(){const t=Ea((t=>t.objects.active));return sr(Px,{size:"sm",className:"pb-18 pt-6",children:[sr(Mx,{center:!0,children:[t.isText&&ar(aw,{children:ar(Mm,{message:"Font"})}),!t.isImage&&ar(aw,{children:ar(Mm,{message:"Color"})}),!t.isImage&&ar(aw,{children:ar(Mm,{message:"Background"})}),t.isImage&&ar(aw,{children:ar(Mm,{message:"Image"})}),ar(aw,{children:ar(Mm,{message:"Opacity"})}),ar(aw,{children:ar(Mm,{message:"Outline"})}),ar(aw,{children:ar(Mm,{message:"Shadow"})})]}),sr(Hx,{className:"pt-16 h-50",children:[t.isText&&ar(Wx,{children:ar(Fx,{})},"font"),!t.isImage&&ar(Wx,{children:ar($x,{property:"fill"})}),!t.isImage&&ar(Wx,{children:ar($x,{property:"backgroundColor"})}),t.isImage&&ar(Wx,{children:ar(nw,{})}),ar(Wx,{children:ar(Qx,{})}),ar(Wx,{children:ar(tw,{})}),ar(Wx,{children:ar(iw,{})})]})]})}function lw(){const t=!Lm()&&ar(gp,{size:"sm",color:"primary",variant:"outline",onClick:()=>{Ma().text.add(),Oa().setDirty(!0)},children:ar(Mm,{message:"New Text"})});return ar(Yb,{actionBtn:t,children:ar(sw,{})})}function cw(){const t=function(t,e){switch(t){case yo.Filter:return ar(kx,{});case yo.Frame:return ar(Tx,{});case yo.Text:return e&&ar(lw,{});case yo.ActiveObject:return e&&ar(sw,{});default:return null}}(Ea((t=>t.activeToolOverlay)),Ea((t=>t.objects.active.id)));return ar("div",{className:"relative z-tool-overlay text-sm",children:ar(xd,{children:t&&ar(fd.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:t},"tool-controls-overlay")})})}const uw=_r(ar("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 hw({filter:t}){const e=Ea((e=>e.filter.applied.includes(t))),n=Ma().filter.hasOptions(t),r=yr("block flex-shrink-0 rounded",{"text-primary border-primary":e}),i=pf[t],o=sr(or,{children:[sr("div",{className:"relative",children:[ar(dw,{filter:t}),e&&ar(fw,{filter:t,hasOptions:n})]}),ar("div",{className:"mt-4 text-center text-xs capitalize",children:i?ar(Mm,{...i}):t})]});return e&&n?ar("div",{className:r,children:o}):ar(pp,{className:r,onClick:()=>{e?Ma().filter.remove(t):Ma().filter.apply(t)},children:o})}function dw({filter:t}){const e=yr("m-auto w-96 h-56 border rounded object-cover",{shadow:Ea((e=>e.filter.selected===t))});return ar("img",{src:uf(`images/filter/${t}.jpg`),className:e,alt:""})}function fw({filter:t,hasOptions:e}){return sr("div",{className:"flex items-center justify-center bg-background/70 absolute inset-0 border-2 border-primary rounded",children:[e?ar(Bm,{color:"primary",size:"md",onClick:()=>{Ma().filter.remove(t)},children:ar(uw,{})}):ar(uw,{className:"svg-icon icon-md"}),e&&ar(pw,{filter:t,hasOptions:e})]})}function pw({filter:t,hasOptions:e}){return ar(Bm,{color:"primary",size:"md",onClick:()=>{Oa().activeToolOverlay===yo.Filter&&Oa().filter.selected===t?Oa().setActiveTool(Oa().activeTool,null):Oa().filter.select(t,e)},children:ar(kr,{})})}const gw=(0,i.forwardRef)((({children:t,className:e,gap:n},r)=>{const o=i.Children.map(t,((e,n)=>i.isValidElement(e)?i.cloneElement(e,{isFirst:0===n,isLast:i.Children.count(t)===n+1}):e));return ar("div",{ref:r,className:`tiny-scrollbar pb-4 overflow-x-auto relative flex items-center ${n||"gap-10"} ${e}`,children:o})}));function mw({isFirst:t,isLast:e,children:n,className:r}){const i=yr(r,"flex-shrink-0",{"ml-auto":t,"mr-auto":e});return ar("div",{className:i,children:n})}function vw(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.filter)?void 0:n.items}))||[];(0,i.useEffect)((()=>{Ma().filter.syncState()}),[]);const e=t.map((t=>ar(mw,{children:ar(hw,{filter:t})},t)));return ar(gw,{children:e})}const bw=_r(ar("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"),yw=_r(ar("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"),xw=_r(ar("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"),ww=_r(ar("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"),_w=_r(ar("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"),Sw=(0,i.forwardRef)(((t,e)=>{const{size:n="md",children:r,className:o,icon:a,checkedIcon:s,disabled:l,isIndeterminate:c,errorMessage:u,invalid:h,orientation:d="horizontal",onChange:f,autoFocus:p,required:g,value:m}=t,v=zy({...t,label:r}),b=a||xw,y=s||(c?_w:ww),x=Bd(e);_x({autoFocus:p},x),(0,i.useEffect)((()=>{x.current&&(x.current.indeterminate=c||!1)}));const[w,_]=Cd(t.checked,t.defaultChecked||!1),S=(0,i.useCallback)((t=>{null==f||f(t),_(t.target.checked)}),[f,_]),C=yr("select-none",o,h&&"text-danger",!h&&l&&"text-disabled");let k,T=h?"text-danger":null;return c?(k=_w,T=T||"text-primary"):w?(k=y,T=T||"text-primary"):(k=b,T=T||"text-muted"),sr("div",{children:[ar("label",{className:C,children:sr("div",{className:yr("relative flex items-center","vertical"===d&&"flex-col flex-col-reverse"),children:[ar("input",{className:"focus-visible:ring ring-inset transition-shadow outline-none absolute left-0 top-0 w-24 h-24 rounded appearance-none",type:"checkbox","aria-checked":c?"mixed":w,"aria-invalid":h||void 0,onChange:S,ref:x,required:g,disabled:l,value:m}),ar(k,{size:n,className:yr("pointer-events-none",l?"text-disabled":T)}),r&&ar("div",{className:yr("first-letter:capitalize",v.size.font,"vertical"===d?"mb-6":"ml-6"),children:r})]})}),u&&ar("div",{className:v.error,children:u})]})}));function Cw(){const{trans:t}=Hy(),{minWidth:e=50,minHeight:n=50,maxHeight:r=2400,maxWidth:o=2400}=Ea((t=>{var e;return null==(e=t.config.tools)?void 0:e.resize}))||{},a=Ea((t=>t.original)),s=Ea((t=>t.resize.formValue));(0,i.useEffect)((()=>{Oa().resize.setFormValue({...a})}),[a]),(0,i.useEffect)((()=>{Oa().setDirty(!0)}),[]);return sr("form",{className:"flex items-center justify-center gap-16 w-full",onSubmit:t=>{t.preventDefault(),Oa().applyChanges()},children:[ar(zx,{type:"number",min:e,max:o,size:"sm",className:"w-full max-w-112",label:"Width",value:s.width,onChange:t=>{(t=>{const e={...s,width:t};s.maintainAspect&&(e.height=Sf(t,s.usePercentages)),Oa().resize.setFormValue(e)})(t.target.valueAsNumber)}}),ar("div",{className:"mt-24",children:ar(Sw,{size:"md",checked:s.maintainAspect,onChange:t=>{(t=>{const e={...s,maintainAspect:t};t&&(e.height=Sf(e.width,e.usePercentages)),Oa().resize.setFormValue(e)})(!s.maintainAspect)},"aria-label":t({message:"Maintain aspect ratio"}),checkedIcon:bw,icon:yw})}),ar(zx,{type:"number",min:n,max:r,size:"sm",className:"w-full max-w-112",label:"Height",value:s.height,onChange:t=>{(t=>{const e={...s,height:t};t&&s.maintainAspect&&(e.width=_f(t,s.usePercentages)),Oa().resize.setFormValue(e)})(t.target.valueAsNumber)}}),ar("button",{type:"submit",className:"hidden",children:ar(Mm,{message:"Resize"})})]})}function kw(){var t;const e=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.presets}))||[],n=Ea((t=>t.crop.selectedAspectRatio)),r=null==(t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.crop)?void 0:n.allowCustomRatio})))||t,i=e.filter((t=>t.ratio||!t.ratio&&r)).map((t=>ar(mw,{children:sr(pp,{onClick:()=>Ma().crop.resetCropzone(t.ratio),className:"flex flex-col items-center justify-between cursor-pointer h-56",children:[ar(Tw,{preset:t,selectedRatio:n}),ar(Ew,{preset:t,selectedRatio:n})]})},t.ratio||t.name)));return ar(gw,{gap:"gap-18",children:i})}function Tw({preset:t,selectedRatio:e}){let n=40,r=30;if(t.ratio){const e=Ef(t.ratio);({width:n,height:r}=Tf(e,n,r))}const i=yr("border-2",{"border-dotted":null===t.ratio,"border-primary":e===t.ratio});return ar("div",{style:{width:`${n}px`,height:`${r}px`},className:i})}function Ew({preset:t,selectedRatio:e}){const n=yr("mt-4 text-center text-xs",{"text-primary":e===t.ratio});return ar("div",{className:n,children:t.name||t.ratio})}const Ow=_r(ar("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 Mw(){return sr("div",{children:[ar(Bm,{size:"sm",onClick:()=>{Ma().transform.flip("vertical"),Oa().setDirty(!0)},children:ar(Ow,{})}),ar(Bm,{size:"sm",onClick:()=>{Ma().transform.flip("horizontal"),Oa().setDirty(!0)},children:ar(Ow,{className:"rotate-90"})})]})}const Pw=_r(ar("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"),Aw=_r(ar("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 jw(){return sr("div",{children:[ar(Bm,{size:"sm",onClick:()=>{Ma().transform.rotateLeft(),Oa().setDirty(!0)},children:ar(Pw,{})}),ar(Bm,{size:"sm",onClick:()=>{Ma().transform.rotateRight(),Oa().setDirty(!0)},children:ar(Aw,{})})]})}function Dw(){return sr("div",{className:"flex items-center justify-center gap-16",children:[ar(Mw,{}),ar(Rw,{}),ar(jw,{})]})}function Rw(){const t=(0,i.useRef)(null),{domProps:e,groupId:n,thumbIds:r,trackRef:o,getThumbValueLabel:a}=Jy({minValue:-45,maxValue:45,step:1,defaultValue:[Oa().crop.straightenAngle],onChange:e=>{const n=e[0];Ma().transform.straighten(n),Oa().crop.setTransformAngle(n),Oa().setDirty(!0),t.current.style.transform=`translateX(${n}px)`}});return ar("div",{id:n,role:"group",className:"flex-auto flex-shrink-0 max-w-320 touch-none isolate",children:sr("div",{...e,ref:o,className:"h-36 relative",children:[sr("output",{htmlFor:r[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:[a(0),"\xb0"]}),ar(Iw,{ref:t})]})})}const Iw=i.forwardRef(((t,e)=>{const n=[...Array(80).keys()],r=n.map((t=>ar("circle",{cx:2+10*t,cy:"20",r:t%5?.75:2},t)));return ar("div",{className:"relative h-full cursor-pointer overflow-hidden",children:ar("svg",{ref:e,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:r})})}));function Lw(){return(0,i.useEffect)((()=>(Oa().setDirty(!0),Ma().frame.active.hide(),()=>{Ma().frame.active.show()})),[]),sr("div",{className:"pb-16",children:[ar("div",{className:"mb-10",children:ar(Dw,{})}),ar(kw,{})]})}const zw=_r(ar("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 "})),Fw=_r(ar("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 "})),Nw=_r(ar("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 "})),Bw=_r(ar("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 Vw(){const t=(Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.shapes)?void 0:n.items}))||[]).map((t=>ar(mw,{children:ar(Bm,{variant:"outline",radius:"rounded-2xl",size:"xl",onClick:()=>{Ma().shape.addBasicShape(t.name),Oa().setDirty(!0)},children:ar(Hw,{shape:t})})},t.name)));return ar(gw,{children:t})}function Hw({shape:t}){var e;return"Path"===t.type?ar("svg",{className:"m-auto w-36 h-36",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -100 512 700",children:ar("path",{className:"fill-transparent stroke-current",d:null==(e=t.options)?void 0:e.path,strokeWidth:25})}):i.cloneElement(Ww[t.name],{className:"w-30 h-30"})}const Ww={circle:ar(Fw,{viewBox:"0 0 32 32"}),square:ar(Nw,{viewBox:"0 0 32 32"}),triangle:ar(Bw,{viewBox:"0 0 32 32"}),ellipse:ar(zw,{viewBox:"0 0 32 32"})};function Uw(t,e,n){let r,i=[];return()=>{let o;n.key&&null!=n.debug&&n.debug()&&(o=Date.now());const a=t();if(a.length===i.length&&!a.some(((t,e)=>i[e]!==t)))return r;let s;if(i=a,n.key&&null!=n.debug&&n.debug()&&(s=Date.now()),r=e(...a),null==n||null==n.onChange||n.onChange(r),n.key&&null!=n.debug&&n.debug()){const t=Math.round(100*(Date.now()-o))/100,e=Math.round(100*(Date.now()-s))/100,r=e/16,i=(t,e)=>{for(t=String(t);t.length<e;)t=" "+t;return t};console.info("%c\u23f1 "+i(e,5)+" /"+i(t,5)+" ms","\n font-size: .6rem;\n font-weight: bold;\n color: hsl("+Math.max(0,Math.min(120-120*r,120))+"deg 100% 31%);",null==n?void 0:n.key)}return r}}const Yw=t=>t,Xw=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let i=e;i<=n;i++)r.push(i);return r},Gw=(t,e)=>{const n=new ResizeObserver((t=>{var n,r;e({width:null==(n=t[0])?void 0:n.contentRect.width,height:null==(r=t[0])?void 0:r.contentRect.height})}));if(t.scrollElement)return e(t.scrollElement.getBoundingClientRect()),n.observe(t.scrollElement),()=>{n.unobserve(t.scrollElement)}},$w={element:["scrollLeft","scrollTop"],window:["scrollX","scrollY"]},qw=(t=>(e,n)=>{if(!e.scrollElement)return;const r=$w[t][0],i=$w[t][1];let o=e.scrollElement[r],a=e.scrollElement[i];const s=()=>{n(e.scrollElement[e.options.horizontal?r:i])};s();const l=t=>{const n=t.currentTarget,l=n[r],c=n[i];(e.options.horizontal?o-l:a-c)&&s(),o=l,a=c};return e.scrollElement.addEventListener("scroll",l,{capture:!1,passive:!0}),()=>{e.scrollElement.removeEventListener("scroll",l)}})("element"),Kw=(t,e)=>t.getBoundingClientRect()[e.options.horizontal?"width":"height"],Zw=(t,e,n)=>{var r;null==(r=n.scrollElement)||null==r.scrollTo||r.scrollTo({[n.options.horizontal?"left":"top"]:t,behavior:e?"smooth":void 0})};class Jw{constructor(t){var e=this;this.unsubs=[],this.scrollElement=null,this.measurementsCache=[],this.itemMeasurementsCache={},this.pendingMeasuredCacheIndexes=[],this.measureElementCache={},this.range={startIndex:0,endIndex:0},this.setOptions=t=>{Object.entries(t).forEach((e=>{let[n,r]=e;typeof r>"u"&&delete t[n]})),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Yw,rangeExtractor:Xw,enableSmoothScroll:!0,onChange:()=>{},measureElement:Kw,initialRect:{width:0,height:0},...t}},this.notify=()=>{var t,e;null==(t=(e=this.options).onChange)||t.call(e,this)},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((t=>t())),this.unsubs=[],this.scrollElement=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{const t=this.options.getScrollElement();this.scrollElement!==t&&(this.cleanup(),this.scrollElement=t,this._scrollToOffset(this.scrollOffset,!1),this.unsubs.push(this.options.observeElementRect(this,(t=>{this.scrollRect=t,this.calculateRange()}))),this.unsubs.push(this.options.observeElementOffset(this,(t=>{this.scrollOffset=t,this.calculateRange()}))))},this.getSize=()=>this.scrollRect[this.options.horizontal?"width":"height"],this.getMeasurements=Uw((()=>[this.options.count,this.options.paddingStart,this.options.getItemKey,this.itemMeasurementsCache]),((t,e,n,r)=>{const i=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const o=this.measurementsCache.slice(0,i);for(let a=i;a<t;a++){const t=n(a),i=r[t],s=o[a-1]?o[a-1].end:e,l="number"==typeof i?i:this.options.estimateSize(a),c=s+l;o[a]={index:a,start:s,size:l,end:c,key:t}}return this.measurementsCache=o,o}),{key:!1,debug:()=>this.options.debug}),this.calculateRange=Uw((()=>[this.getMeasurements(),this.getSize(),this.scrollOffset]),((t,e,n)=>{const r=function(t){let{measurements:e,outerSize:n,scrollOffset:r}=t;const i=e.length-1,o=Qw(0,i,(t=>e[t].start),r);let a=o;for(;a<i&&e[a].end<r+n;)a++;return{startIndex:o,endIndex:a}}({measurements:t,outerSize:e,scrollOffset:n});return(r.startIndex!==this.range.startIndex||r.endIndex!==this.range.endIndex)&&(this.range=r,this.notify()),this.range}),{key:!1,debug:()=>this.options.debug}),this.getIndexes=Uw((()=>[this.options.rangeExtractor,this.range,this.options.overscan,this.options.count]),((t,e,n,r)=>t({...e,overscan:n,count:r})),{key:!1,debug:()=>this.options.debug}),this.getVirtualItems=Uw((()=>[this.getIndexes(),this.getMeasurements(),this.options.measureElement]),((t,e,n)=>{const r=t=>e=>{var r;const i=this.measurementsCache[t];if(!e)return;const o=n(e,this),a=null!=(r=this.itemMeasurementsCache[i.key])?r:i.size;o!==a&&(i.start<this.scrollOffset&&(this.destinationOffset||this._scrollToOffset(this.scrollOffset+(o-a),!1)),this.pendingMeasuredCacheIndexes.push(t),this.itemMeasurementsCache={...this.itemMeasurementsCache,[i.key]:o},this.notify())},i=[],o={};for(let s=0,l=t.length;s<l;s++){var a;const n=t[s],l={...e[n],measureElement:o[n]=null!=(a=this.measureElementCache[n])?a:r(n)};i.push(l)}return this.measureElementCache=o,i}),{key:!1,debug:()=>this.options.debug}),this.scrollToOffset=function(t,n){let{align:r="start",smoothScroll:i=e.options.enableSmoothScroll}=void 0===n?{}:n;const o=e.scrollOffset,a=e.getSize();"auto"===r&&(r=t<=o?"start":t>=o+a?"end":"start"),"start"===r?e._scrollToOffset(t,i):"end"===r?e._scrollToOffset(t-a,i):"center"===r&&e._scrollToOffset(t-a/2,i)},this.scrollToIndex=function(t,n){let{align:r="auto",smoothScroll:i=e.options.enableSmoothScroll,...o}=void 0===n?{}:n;const a=e.getMeasurements(),s=e.scrollOffset,l=e.getSize(),{count:c}=e.options,u=a[Math.max(0,Math.min(t,c-1))];if(!u)return;if("auto"===r)if(u.end>=s+l-e.options.scrollPaddingEnd)r="end";else{if(!(u.start<=s+e.options.scrollPaddingStart))return;r="start"}const h="end"===r?u.end+e.options.scrollPaddingEnd:u.start-e.options.scrollPaddingStart;e.scrollToOffset(h,{align:r,smoothScroll:i,...o})},this.getTotalSize=()=>{var t;return((null==(t=this.getMeasurements()[this.options.count-1])?void 0:t.end)||this.options.paddingStart)+this.options.paddingEnd},this._scrollToOffset=(t,e)=>{let n;clearTimeout(this.scrollCheckFrame),this.destinationOffset=t,this.options.scrollToFn(t,e,this);const r=()=>{let t=this.scrollOffset;this.scrollCheckFrame=n=setTimeout((()=>{if(this.scrollCheckFrame===n){if(this.scrollOffset===t)return void(this.destinationOffset=void 0);t=this.scrollOffset,r()}}),100)};r()},this.measure=()=>{this.itemMeasurementsCache={},this.notify()},this.setOptions(t),this.scrollRect=this.options.initialRect,this.scrollOffset=this.options.initialOffset,this.calculateRange()}}const Qw=(t,e,n,r)=>{for(;t<=e;){const i=(t+e)/2|0,o=n(i);if(o<r)t=i+1;else{if(!(o>r))return i;e=i-1}}return t>0?t-1:0};const t_=typeof window<"u"?i.useLayoutEffect:i.useEffect;function e_(t){return function(t){const e=i.useReducer((()=>({})),{})[1],n={...t,onChange:n=>{e(),null==t.onChange||t.onChange(n)}},[r]=i.useState((()=>new Jw(n)));return r.setOptions(n),i.useEffect((()=>r._didMount()),[]),t_((()=>r._willUpdate())),r}({observeElementRect:Gw,observeElementOffset:qw,scrollToFn:Zw,...t})}function n_(){const t=Ea((t=>{var e;return null==(e=t.config.ui)?void 0:e.activeTheme}));return Ea((e=>{var n;return((null==(n=e.config.ui)?void 0:n.themes)||[]).find((e=>e.name===t))}))}function r_({category:t}){const e=n_(),n=t.name,r=t.list?t.list:Array.from(Array(t.items).keys()),o=(0,i.useRef)(null),a=e_({horizontal:!0,count:r.length,getScrollElement:()=>o.current,estimateSize:(0,i.useCallback)((()=>52),[]),overscan:5});return(0,i.useEffect)((()=>{a.scrollToIndex(0)}),[n]),ar(i.Fragment,{children:ar("div",{ref:o,className:"tiny-scrollbar overflow-x-auto overflow-y-hidden",style:{height:"52px"},children:ar("div",{className:"h-full relative mx-auto",style:{width:`${a.getTotalSize()}px`},children:a.getVirtualItems().map((n=>{const i=`${r[n.index]}`;return ar("div",{className:"absolute top-0 left-0 h-full",style:{width:`${n.size}px`,transform:`translateX(${n.start}px)`},children:ar(gp,{variant:"outline",radius:"rounded-xl",size:"md",equalWidth:!0,onClick:async()=>{await Ma().shape.addSticker(t.name,i),Oa().setDirty(!0)},children:ar("img",{className:yr("m-auto m-auto w-28 h-28",t.invertPreview&&(null==e?void 0:e.isDark)&&"invert"),src:Pf(t,i),alt:i})})},n.index)}))})})})}function i_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.stickers)?void 0:n.items}))||[],[e,n]=(0,i.useState)(t[0]),r=t.map((t=>{const n=e===t,r=dr[t.name];return ar(gp,{size:"xs",color:n?"primary":null,value:t,children:ar("span",{className:"capitalize",children:r?ar(Mm,{...r}):t.name})},t.name)}));return sr("div",{className:"h-92",children:[ar(Xm,{value:e,onChange:t=>n(t),className:"mb-10 w-full justify-center",variant:"outline",radius:"rounded-full",children:r}),e&&ar(r_,{category:e})]})}function o_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.frame)?void 0:n.items}))||[],e=Ea((t=>t.frame.active));(0,i.useEffect)((()=>{Oa().frame.active&&Oa().frame.showOptionsPanel()}),[]);const n=t.map((t=>{const n=uf(`images/frames/${t.name}/thumbnail.png`),r=(null==e?void 0:e.name)===t.name;return ar(mw,{children:sr("button",{type:"button",className:"border-2 overflow-hidden relative rounded border cursor-pointer "+(r?"border-primary":""),onClick:()=>{Oa().setDirty(!0),r?Ma().frame.remove():Ma().frame.add(t.name)},children:[r&&ar(a_,{}),ar("img",{draggable:"false",className:"w-64 h-64",src:n,alt:t.name})]})},t.name)}));return ar(gw,{children:n})}function a_(){return ar("span",{className:"bg-background/70 absolute inset-0 text-primary",children:ar(uw,{className:"svg-icon icon-md absolute inset-0 block m-auto"})})}function s_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.text)?void 0:n.items}));(0,i.useEffect)((()=>{t&&cf(t,uf).catch((()=>{}))}),[t]),(0,i.useEffect)((()=>{Ma().text.selectOrAddText()&&Oa().setDirty(!0)}),[]);const e=(t||[]).map((t=>ar(mw,{children:ar(l_,{fontConfig:t})},t.family)));return ar(gw,{className:"pt-6",children:e})}function l_({fontConfig:t}){var e;const n=Ea((t=>t.objects.active.editableProps.fontFamily)),r=yr("block px-6 w-110 h-68 text-sm bg border rounded-2xl",{"border-primary":n===t.family,"text-primary":n===t.family});return ar("button",{type:"button",className:r,style:{fontFamily:t.family,fontWeight:(null==(e=t.descriptors)?void 0:e.weight)||"normal"},onClick:async()=>{Ma().text.selectOrAddText(),Oa().setDirty(!0),Ma().objects.setValues({fontFamily:t.family})},children:t.family})}function c_(){return(0,i.useEffect)((()=>(Ma().draw.enable(),()=>{Ma().draw.disable()})),[]),sr(gw,{gap:"gap-16",className:"justify-center",children:[ar(mw,{children:ar(qy,{size:"sm",label:ar(Mm,{message:"Brush Color"}),value:Ma().draw.currentBrush.color,onChange:t=>{Ma().draw.setBrushColor(t)}})}),ar(mw,{children:ar(h_,{})}),ar(mw,{children:ar(u_,{})})]})}function u_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.draw)?void 0:n.brushSizes}))||[],[e,n]=(0,i.useState)(Ma().draw.currentBrush.width);return ar(Cx,{selectionMode:"single",selectedValue:e,onSelectionChange:t=>{n(t),Ma().draw.setBrushSize(t)},size:"sm",label:"Brush Size",children:t.map((t=>ar(jg,{value:t,children:sr("div",{className:"flex items-center",children:[ar("div",{className:"flex-shrink-0 mr-8 border-[3px] rounded-full",style:{width:`${t}px`,height:`${t}px`}}),t]})},t)))})}function h_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.tools)?void 0:e.draw)?void 0:n.brushTypes}))||[],e=n_(),[n,r]=(0,i.useState)(Ma().draw.currentBrush.type);return ar(Cx,{selectionMode:"single",selectedValue:n,onSelectionChange:t=>{r(t),Ma().draw.setBrushType(t)},size:"sm",label:"Brush Type",children:t.map((t=>ar(jg,{value:t,children:sr("div",{className:"flex items-center",children:[ar("img",{className:"flex-shrink-0 mr-8 w-24 h-24",src:d_(t,null==e?void 0:e.isDark),alt:""}),t]})},t)))})}function d_(t,e=!1){return uf(`images/brushes/${e?"white":"black"}/${t.replace("Brush","").toLowerCase()}.png`)}function f_(){const{trans:t}=Hy(),e=Ea((t=>t.corners.radius));return(0,i.useEffect)((()=>(Oa().setDirty(!0),Ma().corners.showPreview(),()=>Ma().corners.hidePreview())),[]),ar("div",{className:"max-w-320 mx-auto",children:ar(vx,{minValue:1,maxValue:300,label:t({message:"Radius"}),getValueLabel:t=>`${t}px`,onChange:t=>{Ma().corners.updatePreview(t),Oa().corners.setRadius(t)},value:e})})}const p_={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 g_({activeTool:t}){const e=function(t){switch(t){case vr.FILTER:return ar(vw,{});case vr.RESIZE:return ar(Cw,{});case vr.CROP:return ar(Lw,{});case vr.DRAW:return ar(c_,{});case vr.TEXT:return ar(s_,{});case vr.SHAPES:return ar(Vw,{});case vr.STICKERS:return ar(i_,{});case vr.FRAME:return ar(o_,{});case vr.CORNERS:return ar(f_,{});default:return null}}(t);return ar(fd.div,{className:"relative h-full w-full text-sm bg select-none overflow-hidden",...p_,children:e})}function m_({className:t}){const e=Ea((t=>t.activeTool));return ar("nav",{className:yr("z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden",t),children:ar(xd,{initial:!1,children:e?ar(g_,{activeTool:e},"tool-controls"):ar(v_,{},"nav-items")})})}function v_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.nav)?void 0:n.items}))||[];return ar(fd.div,{className:"w-full h-full",...p_,children:ar(gw,{children:t.map((t=>ar(mw,{children:ar(b_,{item:t})},t.name)))})})}function b_({item:t}){const e=Hr[t.name];return sr(pp,{variant:"outline",color:"paper",className:"flex-col flex-shrink-0 w-68 h-68",radius:"rounded-2xl",onClick:()=>{"string"==typeof t.action?Ia(t.action):"function"==typeof t.action&&t.action(Oa().editor)},children:[ar("div",{className:"mb-1",children:ar(Vm,{className:"icon-md",icon:t.icon})}),ar("div",{className:"mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis",children:e?ar(Mm,{...e}):t.name})]})}function y_(){const t=Ea((t=>t.history.items)),e=Ea((t=>t.history.pointer));return sr(fd.div,{...Rg,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:[sr("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[ar(Mm,{message:"History"}),ar(Bm,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{Oa().togglePanel("history",!1)},children:ar(ev,{})})]}),ar("div",{className:"p-10",children:t.map((n=>{const r=n.id===t[e].id,o=Br[n.name],a=o.icon&&i.createElement(o.icon,{className:"icon-sm"});return ar(gp,{onClick:()=>{r||Ma().history.load(n)},variant:"outline",color:r?"primary":null,size:"sm",className:yr("w-full mb-8",r&&"pointer-events-none"),justify:"justify-start",startIcon:a,children:ar(Mm,{...o.name})},n.id)}))})]})}function x_(t){const{children:e,className:n,color:r,onDismiss:o,leftAdornment:a,rightAdornment:s,hideDismissButton:l=!1,size:c,showDivider:u}=t,{labelId:h,isDismissable:d,close:f}=(0,i.useContext)(By);return sr("div",{className:yr(n,"flex items-center justify-between gap-10 flex-shrink-0",u&&"border-b",w_(t),r||"text-main"),children:[a,ar("h3",{id:h,className:yr(n,"xs"===c?"text-xs":"text-sm","font-semibold leading-5 opacity-90"),children:e}),s,d&&!l&&ar(Bm,{"aria-label":"Dismiss",onClick:()=>{o?o():f()},size:"xs"===c?"xs":"sm",className:yr("text-muted ml-auto",s&&"sr-only"),children:ar(ev,{})})]})}function w_({size:t,padding:e}){if(e)return e;switch(t){case"xs":return"px-14 py-4";case"sm":return"px-18 py-4";default:return"px-24 py-6"}}const __=(0,i.forwardRef)(((t,e)=>{const{children:n,className:r}=t;return ar("div",{ref:e,className:yr(r,S_(t),"overflow-y-auto overflow-x-hidden text-sm"),children:n})}));function S_({size:t,padding:e}){if(e)return e;switch(t){case"xs":return"p-14";case"sm":return"p-18";default:return"px-24 py-20"}}function C_(){const t=Ea((t=>t.openPanels.newImage));return ar($y,{isOpen:t,disableInitialTransition:!0,type:"modal",isDismissable:!1,children:ar(k_,{})})}function k_(){const[t,e]=(0,i.useState)("default");return sr(Yy,{className:"text-center max-w-max",size:"auto",children:[ar(x_,{padding:"px-24 pt-24 pb-12",showDivider:!1,children:ar(Mm,{message:"Open a photo or design to get started"})}),ar(__,{children:ar("default"===t?T_:O_,{setActivePanel:e})})]})}function T_({setActivePanel:t}){return sr(or,{children:[ar(gp,{className:"mr-20",size:"sm",variant:"raised",color:"primary",onClick:()=>{Ma().import.uploadAndReplaceMainImage()},children:ar(Mm,{message:"Open Photo"})}),ar(gp,{variant:"outline",size:"sm",color:"primary",onClick:()=>{t("newCanvas")},children:ar(Mm,{message:"Create New"})}),ar(E_,{})]})}function E_(){const t=Ea((t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.openImageDialog)?void 0:n.sampleImages}));return null!=t&&t.length?sr(or,{children:[sr("div",{className:"relative py-20",children:[ar("hr",{className:"absolute h-1 border-none bg-divider w-full top inset-0 m-auto"}),ar("span",{className:"text-sm bg-paper px-6 relative",children:ar(Mm,{message:"or use sample"})})]}),ar("ul",{className:"flex items-center gap-16",children:t.map((t=>ar("li",{className:"shrink-0",children:ar("button",{type:"button",onClick:async()=>{"function"==typeof t.action?t.action():t.url.endsWith(".json")?(await ja(uf(t.url)),Oa().togglePanel("newImage",!1)):(await Ma().import.openBackgroundImage(uf(t.url)),Oa().togglePanel("newImage",!1))},children:ar("img",{className:"w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md",src:uf(t.thumbnail),alt:""})})},t.url||t.thumbnail)))})]}):null}function O_({setActivePanel:t}){const[e,n]=(0,i.useState)({width:800,height:600,bgColor:"transparent"});return sr("form",{onSubmit:t=>{t.preventDefault();const{width:n,height:r,bgColor:i}=e;n&&r&&(Oa().setConfig({blankCanvasSize:{width:n,height:r}}),Ma().canvas.openNew(n,r,i),Oa().togglePanel("newImage",!1),Ma().history.addInitial())},children:[ar(zx,{type:"number",label:ar(Mm,{message:"Width"}),value:e.width,min:1,required:!0,className:"mb-16",onChange:t=>{n({...e,width:t.target.valueAsNumber})}}),ar(zx,{type:"number",label:ar(Mm,{message:"Height"}),value:e.height,min:1,required:!0,className:"mb-16",onChange:t=>{n({...e,height:t.target.valueAsNumber})}}),ar(qy,{onChange:t=>{n({...e,bgColor:t})},className:"mb-16",value:e.bgColor,label:ar(Mm,{message:"Background color"})}),sr("div",{className:"text-right",children:[ar(gp,{size:"sm",variant:"text",className:"mr-10",onClick:()=>{t("default")},children:ar(Mm,{message:"Cancel"})}),ar(gp,{size:"sm",type:"submit",variant:"raised",color:"primary",children:ar(Mm,{message:"Create"})})]})]})}const M_=(0,i.forwardRef)(((t,e)=>{const n=zy(t),{label:r,children:o,size:a,className:s,orientation:l="horizontal",disabled:c,required:u,invalid:h,errorMessage:d,description:f}=t,p=(0,i.useId)(),g=t.name||p;return sr("fieldset",{"aria-describedby":f?`${p}-description`:void 0,ref:e,className:yr("text-left",s),children:[r&&ar("legend",{className:n.label,children:r}),ar("div",{className:yr("flex","vertical"===l?"flex-col gap-10":"flex-row gap-16"),children:i.Children.map(o,(t=>{if((0,i.isValidElement)(t))return(0,i.cloneElement)(t,{name:g,size:a,invalid:t.props.invalid||h||void 0,disabled:t.props.disabled||c,required:t.props.required||u})}))}),f&&!d&&ar("div",{className:n.description,id:`${p}-description`,children:f}),d&&ar("div",{className:n.error,children:d})]})})),P_=(0,i.forwardRef)(((t,e)=>{const{children:n,autoFocus:r,size:i,invalid:o,isFirst:a,...s}=t,l=Bd(e);_x({autoFocus:r},l);const c=function(t){switch(t){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"}}}(i);return sr("label",{className:yr("inline-flex gap-8 select-none items-center whitespace-nowrap align-middle",c.label,t.disabled&&"text-disabled pointer-events-none",t.invalid&&"text-danger"),children:[ar("input",{type:"radio",className:yr("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",c.circle),ref:l,...s}),n&&ar("span",{children:n})]})}));function A_(){const t=Ea((t=>t.openPanels.export));return ar($y,{isOpen:t,onOpenChange:t=>{t||Oa().togglePanel("export",!1)},type:"modal",children:ar(j_,{})})}function j_(){const[t,e]=(0,i.useState)((()=>{var t,e,n,r,i,o;return{filename:(null==(e=null==(t=Oa().config.tools)?void 0:t.export)?void 0:e.defaultName)||"image",format:(null==(r=null==(n=Oa().config.tools)?void 0:n.export)?void 0:r.defaultFormat)||"jpeg",quality:(null==(o=null==(i=Oa().config.tools)?void 0:i.export)?void 0:o.defaultQuality)||.8}}));return ar(Yy,{className:"text-center max-w-max",size:"auto",children:ar(__,{children:sr("form",{onSubmit:e=>{e.preventDefault(),Ma().export.save(t.filename,t.format,t.quality),Oa().togglePanel("export",!1)},children:[ar(zx,{required:!0,size:"sm",label:ar(Mm,{message:"Save As"}),value:t.filename,onChange:n=>{e({...t,filename:n.target.value})}}),sr(M_,{size:"sm",className:"my-20","aria-label":"Image format",children:[ar(P_,{value:"jpeg",checked:"jpeg"===t.format,onChange:n=>{e({...t,format:n.target.value})},children:"JPEG"}),ar(P_,{value:"png",checked:"png"===t.format,onChange:n=>{e({...t,format:n.target.value})},children:"PNG"}),ar(P_,{value:"json",checked:"json"===t.format,onChange:n=>{e({...t,format:n.target.value})},children:"JSON"})]}),ar(vx,{size:"sm",minValue:.1,step:.1,maxValue:1,value:t.quality,onChange:n=>{e({...t,quality:n})},formatOptions:{style:"percent"},label:ar(Mm,{message:"Quality"})}),ar(gp,{variant:"raised",color:"primary",type:"submit",className:"mt-20 w-full",size:"sm",children:ar(Mm,{message:"Save"})})]})})})}function D_(){const t=Ea((t=>t.objects.all)),e=Ea((t=>t.objects.active.id));return sr(fd.div,{...Rg,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:[sr("div",{className:"px-10 py-2 mb-4 font-medium text-sm border-b flex items-center",children:[ar(Mm,{message:"Objects"}),ar(Bm,{size:"xs",className:"ml-auto flex-shrink-0",onClick:()=>{Oa().togglePanel("objects",!1)},children:ar(ev,{})})]}),ar("div",{className:"p-8",children:t.map((t=>{const n=t.id===e,r=t.name,o=To[r],a=o.icon&&i.createElement(o.icon,{className:"icon-sm"});return ar(gp,{onClick:()=>{n||!t.selectable||Ma().objects.select(t.id)},variant:"outline",color:n?"primary":null,size:"sm",className:yr("w-full mb-8",(n||!t.selectable)&&"pointer-events-none"),justify:"justify-start",startIcon:a,children:ar(Mm,{...o.name})},t.id)}))})]})}function R_(){const t=Ea((t=>t.openPanels.history)),e=Ea((t=>t.openPanels.objects));return sr("div",{className:"z-modal",children:[sr(xd,{children:[t&&ar(y_,{},"historyPanel"),e&&ar(D_,{},"objListPanel")]}),ar(C_,{}),ar(A_,{})]})}function I_(){return I_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},I_.apply(this,arguments)}var L_,z_;function F_(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&"?"!==n&&(e+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(e+="#"===r.charAt(0)?r:"#"+r),e}function N_(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function B_(t,e){if(!1===t||null===t||typeof t>"u")throw new Error(e)}function V_(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach((t=>{".."===t?n.length>1&&n.pop():"."!==t&&n.push(t)})),n.length>1?n.join("/"):"/"}function H_(t,e,n,r){void 0===r&&(r=!1);let i,o="string"==typeof t?N_(t):I_({},t),a=""===t||""===o.pathname,s=a?"/":o.pathname;if(r||null==s)i=n;else{let t=e.length-1;if(s.startsWith("..")){let e=s.split("/");for(;".."===e[0];)e.shift(),t-=1;o.pathname=e.join("/")}i=t>=0?e[t]:"/"}let l=function(t,e){void 0===e&&(e="/");let{pathname:n,search:r="",hash:i=""}="string"==typeof t?N_(t):t;return{pathname:n?n.startsWith("/")?n:V_(n,e):e,search:U_(r),hash:Y_(i)}}(o,i),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(L_||(L_={})),function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"}(z_||(z_={}));const W_=t=>t.join("/").replace(/\/\/+/g,"/"),U_=t=>t&&"?"!==t?t.startsWith("?")?t:"?"+t:"",Y_=t=>t&&"#"!==t?t.startsWith("#")?t:"#"+t:"";"function"==typeof Object.is&&Object.is;const{useState:X_,useEffect:G_,useLayoutEffect:$_,useDebugValue:q_}=r||(r=n.t(i,2));typeof window<"u"&&typeof window.document<"u"&&window.document.createElement;(t=>{t.useSyncExternalStore})(r||(r=n.t(i,2)));const K_=i.createContext(null),Z_=i.createContext(null),J_=i.createContext({outlet:null,matches:[]});function Q_(){return null!=i.useContext(Z_)}function tS(){return Q_()||B_(!1),i.useContext(Z_).location}function eS(t){return t.filter(((e,n)=>0===n||!e.route.index&&e.pathnameBase!==t[n-1].pathnameBase))}function nS(t,e){let{relative:n}=void 0===e?{}:e,{matches:r}=i.useContext(J_),{pathname:o}=tS(),a=JSON.stringify(eS(r).map((t=>t.pathnameBase)));return i.useMemo((()=>H_(t,JSON.parse(a),o,"path"===n)),[t,a,o,n])}var rS,iS;!function(t){t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator"}(rS||(rS={})),function(t){t[t.pending=0]="pending",t[t.success=1]="success",t[t.error=2]="error"}(iS||(iS={})),new Promise((()=>{}));const oS=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],aS=i.forwardRef((function(t,e){let{onClick:n,relative:r,reloadDocument:o,replace:a,state:s,target:l,to:c,preventScrollReset:u}=t,h=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],!(e.indexOf(n)>=0)&&(i[n]=t[n]);return i}(t,oS),d=function(t,e){let{relative:n}=void 0===e?{}:e;Q_()||B_(!1);let{basename:r,navigator:o}=i.useContext(K_),{hash:a,pathname:s,search:l}=nS(t,{relative:n}),c=s;return"/"!==r&&(c="/"===s?r:W_([r,s])),o.createHref({pathname:c,search:l,hash:a})}(c,{relative:r}),f=function(t,e){let{target:n,replace:r,state:o,preventScrollReset:a,relative:s}=void 0===e?{}:e,l=function(){Q_()||B_(!1);let{basename:t,navigator:e}=i.useContext(K_),{matches:n}=i.useContext(J_),{pathname:r}=tS(),o=JSON.stringify(eS(n).map((t=>t.pathnameBase))),a=i.useRef(!1);return i.useEffect((()=>{a.current=!0})),i.useCallback((function(n,i){if(void 0===i&&(i={}),!a.current)return;if("number"==typeof n)return void e.go(n);let s=H_(n,JSON.parse(o),r,"path"===i.relative);"/"!==t&&(s.pathname="/"===s.pathname?t:W_([t,s.pathname])),(i.replace?e.replace:e.push)(s,i.state,i)}),[t,e,o,r])}(),c=tS(),u=nS(t,{relative:s});return i.useCallback((e=>{if(function(t,e){return 0===t.button&&(!e||"_self"===e)&&!function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)}(e,n)){e.preventDefault();let n=void 0!==r?r:F_(c)===F_(u);l(t,{replace:n,state:o,preventScrollReset:a,relative:s})}}),[c,l,u,r,o,n,t,a,s])}(c,{replace:a,state:s,target:l,preventScrollReset:u,relative:r});return ar("a",{...h,href:d,onClick:o?n:function(t){n&&n(t),t.defaultPrevented||f(t)},ref:e,target:l})}));const sS=_r(ar("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"),lS=_r(ar("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");function cS(){const t=Ba((t=>t.toasts));return ar("div",{className:"relative pointer-events-none",children:ar(xd,{initial:!1,children:t.map((t=>ar("div",{"data-toast":!0,className:yr("fixed mx-auto p-20 z-toast","bottom-center"===t.position?"left-0 right-0 bottom-0":"right-0 bottom-0"),children:sr(fd.div,{initial:{opacity:0,y:50,scale:.3},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,scale:.5,transition:{duration:.2}},className:yr("flex items-center gap-10 min-w-288 max-w-500 shadow-lg w-min rounded-lg pl-16 pr-6 py-6 text-sm pointer-events-auto max-h-100 bg-paper text-main bg-paper border mx-auto"),onPointerEnter:()=>{var e;return null==(e=t.timer)?void 0:e.pause()},onPointerLeave:()=>{var e;return null==(e=t.timer)?void 0:e.resume()},role:"alert","aria-live":"danger"===t.type?"assertive":"polite",children:["danger"===t.type&&ar(sS,{className:"text-danger flex-shrink-0",size:"md"}),"positive"===t.type&&ar(lS,{className:"text-positive flex-shrink-0",size:"md"}),ar("div",{className:"overflow-hidden overflow-ellipsis w-max mr-auto",children:ar(Hm,{value:t.message})}),t.action&&ar(gp,{variant:"text",color:"primary",size:"sm",className:"flex-shrink-0",onFocus:()=>{var e;return null==(e=t.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=t.timer)?void 0:e.resume()},onClick:()=>Va().remove(t.id),elementType:aS,to:t.action.action,children:ar(Hm,{value:t.action.label})}),ar(Bm,{onFocus:()=>{var e;return null==(e=t.timer)?void 0:e.pause()},onBlur:()=>{var e;return null==(e=t.timer)?void 0:e.resume()},type:"button",className:"flex-shrink-0",onClick:()=>{Va().remove(t.id)},size:"sm",children:ar(ev,{})})]})},t.id)))})})}function uS(t){switch(t.key){case"z":(function(t){return Wd()?t.metaKey:t.ctrlKey})(t)&&(t.preventDefault(),t.stopPropagation(),t.shiftKey?Ma().history.redo():Ma().history.undo());break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),Ma().objects.move("up");break;case"ArrowRight":t.preventDefault(),t.stopPropagation(),Ma().objects.move("right");break;case"ArrowDown":t.preventDefault(),t.stopPropagation(),Ma().objects.move("down");break;case"ArrowLeft":t.preventDefault(),t.stopPropagation(),Ma().objects.move("left");break;case"Delete":t.preventDefault(),t.stopPropagation(),Ma().objects.delete()}}const hS=new Map,dS=new Map,fS={status:"inactive"};async function*pS(t){const e=t.createReader();let n;do{n=await new Promise(((t,n)=>{e.readEntries(t,n)}));for(const t of n)if(t.isFile){if(".DS_Store"===t.name)continue;const e=await gS(t);yield new Wf(e,t.fullPath)}else t.isDirectory&&(yield*pS(t))}while(n.length>0)}function gS(t){return new Promise(((e,n)=>t.file(e,n)))}function mS(t){return null!=fS.dragTargetId?hS.get(fS.dragTargetId):t.dataTransfer.types.includes("Files")?{type:"nativeFile",el:null,ref:null,getData:()=>async function(t){const e=[];for await(const n of t)e.push(n);return e}(async function*(t){for(const e of t.items)if("file"===e.kind)if("function"==typeof e.webkitGetAsEntry){const t=e.webkitGetAsEntry();if(!t)continue;if(t.isFile){if(".DS_Store"===t.name)continue;yield new Wf(e.getAsFile(),t.fullPath)}else t.isDirectory&&(yield*pS(t))}else{const t=e.getAsFile();if(!t||".DS_Store"===t.name)continue;yield new Wf(t,e.fullPath)}}(t.dataTransfer))}:void 0}function vS({children:t}){const e=Ea((t=>t.bootstrapData)),n=(0,i.useMemo)((()=>({data:e,setBootstrapData:()=>{},mergeBootstrapData:()=>{},invalidateBootstrapData:()=>{}})),[e]);return ar(km.Provider,{value:n,children:t})}function bS(){var t,e,n,r;const o=null==(t=Ea((t=>{var e;return null==(e=t.config.ui)?void 0:e.visible})))||t,a=null!=(e=Ea((t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.nav)?void 0:n.position})))?e:"bottom",s=null!=(n=Ea((t=>{var e,n;return null==(n=null==(e=t.config.ui)?void 0:e.menubar)?void 0:n.position})))?n:"top",l=null==(r=Ea((t=>{var e;return null==(e=t.config.ui)?void 0:e.allowEditorClose})))||r,c=(0,i.useRef)(null),u=(0,i.useRef)(null),{isModal:h,isMobile:d}=nv(),f=(0,i.useCallback)((async t=>{var e,n,r;if(Oa().activeTool||Oa().dirty||"nativeFile"!==t.type)return;const i=await t.getData();!Ma().import.fileIsValid(i[0])||(null!=(r=null==(n=null==(e=Oa().config.tools)?void 0:e.import)?void 0:n.openDroppedImageAsBackground)&&r?await Ma().import.openBackgroundImage(i[0]):await Ma().import.openUploadedFile(i[0]))}),[]),{droppableProps:p}=function({id:t,disabled:e,ref:n,...r}){const o=(0,i.useRef)({dragOverElements:new Set,dropActivateTimer:void 0}).current,a=(0,i.useRef)(r);a.current=r,(0,i.useLayoutEffect)((()=>(dS.set(t,{...dS.get(t),disabled:e,id:t,ref:n}),()=>{dS.delete(t)})),[t,a,e,n]);const s=t=>{var e;const r=a.current;return!(!(null==t?void 0:t.type)||n.current===(null==(e=t.ref)?void 0:e.current)||!r.types.includes(t.type)||r.acceptsDrop&&!r.acceptsDrop(t))},l=t=>{var e,n;const r=mS(t);r&&(null==(n=(e=a.current).onDragLeave)||n.call(e,r))};return{droppableProps:e?{}:{onDragOver:t=>{t.preventDefault(),t.stopPropagation()},onDragEnter:t=>{var e,n;if(t.stopPropagation(),o.dragOverElements.add(t.target),o.dragOverElements.size>1)return;const r=mS(t);r&&s(r)&&(null==(n=(e=a.current).onDragEnter)||n.call(e,r),clearTimeout(o.dropActivateTimer),"function"==typeof a.current.onDropActivate&&(o.dropActivateTimer=setTimeout((()=>{var t,e;r&&(null==(e=(t=a.current).onDropActivate)||e.call(t,r))}),400)))},onDragLeave:t=>{t.stopPropagation(),o.dragOverElements.delete(t.target);for(const n of o.dragOverElements)t.currentTarget.contains(n)||o.dragOverElements.delete(n);if(o.dragOverElements.size>0)return;const e=mS(t);e&&s(e)&&(l(t),clearTimeout(o.dropActivateTimer))},onDrop:async t=>{var e,n,r,i;t.preventDefault(),t.stopPropagation(),o.dragOverElements.clear(),l(t),clearTimeout(o.dropActivateTimer);const c=mS(t);c&&(null==(n=(e=a.current).onDragLeave)||n.call(e,c),s(c)&&(null==(i=(r=a.current).onDrop)||i.call(r,c)))}}}}({id:"pixie-root",ref:u,types:["nativeFile"],onDrop:f});(0,i.useEffect)((()=>{var t,e;Oa().fabric||(Ea.setState({canvasRef:c}),op(c.current),null!=(t=Oa().config.ui)&&t.defaultTool&&Oa().setActiveTool(null==(e=Oa().config.ui)?void 0:e.defaultTool,null),Ma().canvas.loadInitialContent().then((()=>{var t,e;null==(e=(t=Oa().config).onLoad)||e.call(t,Oa().editor)})));const n=ap(u,(()=>{Oa().setStageSize(sp(u.current))})),r=ap(c,(()=>{Oa().setCanvasSize(sp(c.current))}));return()=>{n(),r()}}),[u]);const g=yr("pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full",{relative:!h,"fixed inset-0 w-full h-full z-20":h,"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]":h&&!d});return ar(wd,{features:Sd,strict:!0,children:sr(vS,{children:[h&&o&&!d&&l&&ar(Bm,{className:"z-20 fixed right-2 top-2 text-white",size:"lg",onClick:()=>{Oa().editor.close()},children:ar(ev,{})}),h&&o&&ar(_m,{position:"fixed",disableInitialTransition:!0}),sr(fd.div,{initial:!1,variants:{visible:{opacity:1,scale:1,display:"flex"},hidden:{opacity:0,transitionEnd:{display:"none"}}},animate:o?"visible":"hidden",className:g,children:["top"===s&&ar(cv,{}),"top"===a&&ar(m_,{className:"pt-14"}),sr("main",{className:"relative flex-auto my-20 overflow-hidden outline-none",tabIndex:-1,...Dd(p,{onKeyDownCapture:uS}),ref:u,children:[ar(hv,{}),ar(Hb,{ref:c})]}),ar(cw,{}),"bottom"===a&&ar(m_,{}),"bottom"===s&&ar(cv,{}),ar(R_,{}),ar(cS,{})]})]})})}P.enableBoundaryChecking(!1);const yS=class{constructor(t){if(c(this,"tools",{}),c(this,"fabric",null),t.sentryDsn&&function(t){t._metadata=t._metadata||{},t._metadata.sdk=t._metadata.sdk||{name:"sentry.javascript.react",packages:[{name:"npm:@sentry/react",version:Ne}],version:Ne},$n(t)}({dsn:t.sentryDsn}),function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}('/*! tailwindcss v3.1.8 | 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 *,.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-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-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%}.pi .\\!container{width:100%!important}@media (min-width:640px){.pi .container{max-width:640px}.pi .\\!container{max-width:640px!important}}@media (min-width:768px){.pi .container{max-width:768px}.pi .\\!container{max-width:768px!important}}@media (min-width:1024px){.pi .container{max-width:1024px}.pi .\\!container{max-width:1024px!important}}@media (min-width:1280px){.pi .container{max-width:1280px}.pi .\\!container{max-width:1280px!important}}@media (min-width:1536px){.pi .container{max-width:1536px}.pi .\\!container{max-width:1536px!important}}.pi .sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .visible{visibility:visible}.pi .\\!visible{visibility:visible!important}.pi .invisible{visibility:hidden}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .sticky{position:sticky}.pi .inset-0{bottom:0;top:0}.pi .inset-0,.pi .inset-x-0{left:0;right:0}.pi .right-2{right:2px}.pi .top-2{top:2px}.pi .top-0{top:0}.pi .left-0{left:0}.pi .left-16{left:16px}.pi .top-26{top:26px}.pi .-left-5{left:-5px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .-bottom-5{bottom:-5px}.pi .right-0{right:0}.pi .-right-5{right:-5px}.pi .bottom-20{bottom:20px}.pi .right-20{right:20px}.pi .top-24{top:24px}.pi .-bottom-14{bottom:-14px}.pi .left-30{left:30px}.pi .right-4{right:4px}.pi .top-1\\/2{top:50%}.pi .-bottom-20{bottom:-20px}.pi .left-1\\/2{left:50%}.pi .-bottom-10{bottom:-10px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-bottom-2{bottom:-2px}.pi .-right-2{right:-2px}.pi .isolate{isolation:isolate}.pi .z-20{z-index:20}.pi .z-modal{z-index:110}.pi .z-10{z-index:10}.pi .z-obj-box{z-index:20}.pi .z-navbar{z-index:40}.pi .z-tool-overlay{z-index:30}.pi .z-50,.pi .z-loading-indicator{z-index:50}.pi .z-popover{z-index:130}.pi .z-tray{z-index:120}.pi .z-toast{z-index:160}.pi .z-tooltip{z-index:150}.pi .z-cropzone{z-index:10}.pi .col-auto{grid-column:auto}.pi .m-auto{margin:auto}.pi .m-10{margin:10px}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-12{margin-bottom:12px;margin-top:12px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-50{margin-bottom:50px;margin-top:50px}.pi .mx-14{margin-left:14px;margin-right:14px}.pi .my-30{margin-bottom:30px;margin-top:30px}.pi .my-24{margin-bottom:24px;margin-top:24px}.pi .my-80{margin-bottom:80px;margin-top:80px}.pi .my-32{margin-bottom:32px;margin-top:32px}.pi .my-40{margin-bottom:40px;margin-top:40px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-10{margin-bottom:10px;margin-top:10px}.pi .my-100{margin-bottom:6.25rem;margin-top:6.25rem}.pi .mx-4{margin-left:4px;margin-right:4px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .mr-5{margin-right:5px}.pi .ml-auto{margin-left:auto}.pi .mr-20{margin-right:20px}.pi .mb-16{margin-bottom:16px}.pi .mr-10{margin-right:10px}.pi .mt-auto{margin-top:auto}.pi .mt-80{margin-top:80px}.pi .mt-30{margin-top:30px}.pi .mt-4{margin-top:4px}.pi .mb-30{margin-bottom:30px}.pi .mb-20{margin-bottom:20px}.pi .mr-auto{margin-right:auto}.pi .mr-24{margin-right:24px}.pi .mb-24{margin-bottom:24px}.pi .mb-14{margin-bottom:14px}.pi .mt-6{margin-top:6px}.pi .mt-12{margin-top:12px}.pi .mb-4{margin-bottom:4px}.pi .mt-14{margin-top:14px}.pi .ml-6{margin-left:6px}.pi .mr-14{margin-right:14px}.pi .mt-8{margin-top:8px}.pi .mb-10{margin-bottom:10px}.pi .mb-8{margin-bottom:8px}.pi .mt-20{margin-top:20px}.pi .mb-1{margin-bottom:1px}.pi .ml-10{margin-left:10px}.pi .mt-10{margin-top:10px}.pi .mt-2{margin-top:2px}.pi .mb-12{margin-bottom:12px}.pi .mb-40{margin-bottom:40px}.pi .mt-40{margin-top:40px}.pi .mb-32{margin-bottom:32px}.pi .mb-64{margin-bottom:64px}.pi .mt-32{margin-top:32px}.pi .mb-48{margin-bottom:48px}.pi .mt-50{margin-top:50px}.pi .mb-6{margin-bottom:6px}.pi .mt-60{margin-top:60px}.pi .-ml-1{margin-left:-1px}.pi .-ml-4{margin-left:-4px}.pi .mr-8{margin-right:8px}.pi .-mr-4{margin-right:-4px}.pi .ml-8{margin-left:8px}.pi .mt-16{margin-top:16px}.pi .mb-2{margin-bottom:2px}.pi .mt-24{margin-top:24px}.pi .-mt-2{margin-top:-2px}.pi .mt-36{margin-top:36px}.pi .mb-110{margin-bottom:110px}.pi .mt-18{margin-top:18px}.pi .mr-6{margin-right:6px}.pi .mr-16{margin-right:16px}.pi .ml-12{margin-left:12px}.pi .mr-4{margin-right:4px}.pi .mr-12{margin-right:12px}.pi .mr-2{margin-right:2px}.pi .mb-18{margin-bottom:18px}.pi .-ml-3{margin-left:-3px}.pi .-ml-12{margin-left:-12px}.pi .-ml-6{margin-left:-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 .table{display:table}.pi .table-cell{display:table-cell}.pi .table-row{display:table-row}.pi .grid{display:grid}.pi .\\!grid{display:grid!important}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-2\\/4{height:50%}.pi .h-full{height:100%}.pi .h-font{height:1em}.pi .h-1{height:1px}.pi .h-80{height:80px}.pi .h-400{height:25rem}.pi .h-50{height:50px}.pi .h-42{height:42px}.pi .h-54{height:3.375rem}.pi .h-8{height:8px}.pi .h-24{height:24px}.pi .h-36{height:36px}.pi .h-40{height:40px}.pi .h-20{height:20px}.pi .h-30{height:30px}.pi .h-84{height:84px}.pi .h-68{height:68px}.pi .h-32{height:32px}.pi .h-\\[54px\\]{height:54px}.pi .h-\\[186px\\]{height:186px}.pi .h-60{height:60px}.pi .h-18{height:18px}.pi .h-12{height:12px}.pi .h-26{height:26px}.pi .h-90{height:5.625rem}.pi .h-128{height:128px}.pi .h-6{height:6px}.pi .h-4{height:4px}.pi .h-48{height:48px}.pi .h-2{height:2px}.pi .h-16{height:16px}.pi .h-56{height:56px}.pi .h-64{height:64px}.pi .h-144{height:144px}.pi .h-100{height:6.25rem}.pi .h-max{height:-moz-max-content;height:max-content}.pi .h-px{height:1px}.pi .h-28{height:28px}.pi .h-92{height:92px}.pi .h-14{height:14px}.pi .h-38{height:2.375rem}.pi .h-22{height:22px}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-620{max-height:38.75rem}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[36px\\]{max-height:36px}.pi .max-h-8{max-height:8px}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-\\[calc\\(100\\%-30px\\)\\]{max-height:calc(100% - 30px)}.pi .max-h-40{max-height:40px}.pi .max-h-inherit{max-height:inherit}.pi .max-h-\\[583px\\]{max-height:583px}.pi .max-h-full{max-height:100%}.pi .max-h-26{max-height:26px}.pi .max-h-36{max-height:36px}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-240{max-height:240px}.pi .min-h-440{min-height:27.5rem}.pi .min-h-full{min-height:100%}.pi .min-h-\\[238px\\]{min-height:238px}.pi .min-h-86{min-height:86px}.pi .min-h-90{min-height:5.625rem}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-dialog{min-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-50{min-height:50px}.pi .min-h-\\[228px\\]{min-height:228px}.pi .min-h-30{min-height:30px}.pi .min-h-60{min-height:60px}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-full{width:100%}.pi .w-font{width:1em}.pi .w-80{width:80px}.pi .w-50{width:50px}.pi .w-8{width:8px}.pi .w-24{width:24px}.pi .w-36{width:36px}.pi .w-20{width:20px}.pi .w-30{width:30px}.pi .w-224{width:224px}.pi .w-68{width:68px}.pi .w-96{width:96px}.pi .w-144{width:144px}.pi .w-auto{width:auto}.pi .w-1{width:1px}.pi .w-240{width:240px}.pi .w-\\[168px\\]{width:168px}.pi .w-1\\/2{width:50%}.pi .w-384{width:384px}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-256{width:256px}.pi .w-18{width:18px}.pi .w-12{width:12px}.pi .w-42{width:42px}.pi .w-60{width:60px}.pi .\\!w-auto{width:auto!important}.pi .w-26{width:26px}.pi .w-32{width:32px}.pi .w-850{width:53.125rem}.pi .w-288{width:288px}.pi .w-320{width:320px}.pi .w-440{width:27.5rem}.pi .w-40{width:40px}.pi .w-64{width:64px}.pi .w-1\\/3{width:33.333333%}.pi .w-16{width:16px}.pi .w-56{width:56px}.pi .w-2{width:2px}.pi .w-110{width:110px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-\\[233px\\]{width:233px}.pi .w-46{width:2.875rem}.pi .w-38{width:2.375rem}.pi .w-\\[210px\\]{width:210px}.pi .w-100{width:6.25rem}.pi .w-620{width:38.75rem}.pi .w-780{width:48.75rem}.pi .w-\\[calc\\(100\\%-40px\\)\\]{width:calc(100% - 40px)}.pi .w-px{width:1px}.pi .w-28{width:28px}.pi .w-90{width:5.625rem}.pi .w-14{width:14px}.pi .w-22{width:22px}.pi .w-280{width:17.5rem}.pi .min-w-0{min-width:0}.pi .min-w-320{min-width:320px}.pi .min-w-80{min-width:80px}.pi .min-w-224{min-width:224px}.pi .min-w-288{min-width:288px}.pi .min-w-240{min-width:240px}.pi .min-w-42{min-width:42px}.pi .min-w-90{min-width:5.625rem}.pi .min-w-180{min-width:11.25rem}.pi .min-w-128{min-width:128px}.pi .min-w-4{min-width:4px}.pi .min-w-192{min-width:192px}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .max-w-280{max-width:17.5rem}.pi .max-w-620{max-width:38.75rem}.pi .max-w-440{max-width:27.5rem}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-full{max-width:100%}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[464px\\]{max-width:464px}.pi .max-w-180{max-width:11.25rem}.pi .max-w-400{max-width:25rem}.pi .max-w-780{max-width:48.75rem}.pi .max-w-375{max-width:375px}.pi .max-w-240{max-width:240px}.pi .max-w-320{max-width:320px}.pi .max-w-288{max-width:288px}.pi .max-w-112{max-width:112px}.pi .max-w-80{max-width:80px}.pi .max-w-850{max-width:53.125rem}.pi .max-w-580{max-width:36.25rem}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-950{max-width:59.375rem}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .flex-grow-0{flex-grow:0}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-y-1\\/2{--tw-translate-y:-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-x-1\\/2{--tw-translate-x:-50%}.pi .rotate-180{--tw-rotate:180deg}.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-0{--tw-rotate:0deg}.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 .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-pointer{cursor:pointer}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .cursor-zoom-in{cursor:zoom-in}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-not-allowed{cursor:not-allowed}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize-none{resize:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .break-inside-avoid{-moz-column-break-inside:avoid;break-inside:avoid}.pi .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.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-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-end{justify-content:flex-end}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-16{gap:16px}.pi .gap-20{gap:20px}.pi .gap-8{gap:8px}.pi .gap-14{gap:14px}.pi .gap-24{gap:24px}.pi .gap-6{gap:6px}.pi .gap-30{gap:30px}.pi .gap-10{gap:10px}.pi .gap-12{gap:12px}.pi .gap-4{gap:4px}.pi .gap-18{gap:18px}.pi .gap-32{gap:32px}.pi .gap-40{gap:40px}.pi .gap-64{gap:64px}.pi .gap-36{gap:36px}.pi .gap-x-10{-moz-column-gap:10px;column-gap:10px}.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 .self-stretch{align-self:stretch}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-visible{overflow:visible}.pi .overflow-scroll{overflow:scroll}.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 .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 .whitespace-pre-wrap{white-space:pre-wrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-md{border-radius:6px}.pi .rounded-full{border-radius:9999px}.pi .rounded-lg{border-radius:8px}.pi .rounded-none{border-radius:0}.pi .rounded-2xl{border-radius:16px}.pi .rounded-sm{border-radius:2px}.pi .rounded-\\[16px\\]{border-radius:16px}.pi .rounded-\\[64px\\]{border-radius:64px}.pi .rounded-\\[32px\\]{border-radius:32px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-xl{border-radius:12px}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-r-md{border-bottom-right-radius:6px;border-top-right-radius:6px}.pi .rounded-l-md{border-bottom-left-radius:6px;border-top-left-radius:6px}.pi .rounded-r{border-bottom-right-radius:4px;border-top-right-radius:4px}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-tr-none{border-top-right-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-bl-none{border-bottom-left-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-bottom-width:1px;border-top-width:1px}.pi .border-r{border-right-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-b{border-bottom-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-r-4{border-right-width:4px}.pi .border-b-4{border-bottom-width:4px}.pi .border-t{border-top-width:1px}.pi .border-l{border-left-width:1px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-transparent{border-color:transparent}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-l-primary{--tw-border-opacity:1;border-left-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-l-transparent{border-left-color:transparent}.pi .border-l-positive{--tw-border-opacity:1;border-left-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .border-l-warning{--tw-border-opacity:1;border-left-color:rgb(243 164 50/var(--tw-border-opacity))}.pi .border-l-danger{--tw-border-opacity:1;border-left-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-r-transparent{border-right-color:transparent}.pi .border-r-primary-light{--tw-border-opacity:1;border-right-color:rgb(var(--be-primary-light)/var(--tw-border-opacity))}.pi .border-b-primary{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.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-primary\\/hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-positive\\/focus{background-color:rgb(34 197 94/var(--be-focus-opacity))}.pi .bg-warning\\/focus{background-color:rgb(243 164 50/var(--be-focus-opacity))}.pi .bg-danger\\/focus{background-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/5{background-color:rgb(var(--be-primary)/.05)}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-primary-light\\/20{background-color:rgb(var(--be-primary-light)/.2)}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-black\\/30{background-color:#0000004d}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-envato{--tw-bg-opacity:1;background-color:rgb(108 161 43/var(--tw-bg-opacity))}.pi .bg-disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .bg-disabled-fg{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/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-white\\/50{background-color:#ffffff80}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-primary-light\\/40{background-color:rgb(var(--be-primary-light)/.4)}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.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-14{padding:14px}.pi .p-16{padding:16px}.pi .p-24{padding:24px}.pi .p-10{padding:10px}.pi .p-8{padding:8px}.pi .p-6{padding:6px}.pi .p-12{padding:12px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-18{padding:18px}.pi .p-40{padding:40px}.pi .p-2{padding:2px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-12{padding-left:12px;padding-right:12px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .px-40{padding-left:40px;padding-right:40px}.pi .py-32{padding-bottom:32px;padding-top:32px}.pi .px-28{padding-left:28px;padding-right:28px}.pi .py-56{padding-bottom:56px;padding-top:56px}.pi .py-28{padding-bottom:28px;padding-top:28px}.pi .py-90{padding-bottom:5.625rem;padding-top:5.625rem}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-96{padding-bottom:96px;padding-top:96px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-40{padding-bottom:40px;padding-top:40px}.pi .pt-14{padding-top:14px}.pi .pt-24{padding-top:24px}.pi .pb-12{padding-bottom:12px}.pi .pt-26{padding-top:26px}.pi .pb-16{padding-bottom:16px}.pi .pb-24{padding-bottom:24px}.pi .pt-50{padding-top:50px}.pi .pt-20{padding-top:20px}.pi .pb-10{padding-bottom:10px}.pi .pb-4{padding-bottom:4px}.pi .pr-10{padding-right:10px}.pi .pl-10{padding-left:10px}.pi .pb-20{padding-bottom:20px}.pi .pb-30{padding-bottom:30px}.pi .pt-30{padding-top:30px}.pi .pl-8{padding-left:8px}.pi .pb-14{padding-bottom:14px}.pi .pl-14{padding-left:14px}.pi .pt-54{padding-top:3.375rem}.pi .pb-28{padding-bottom:28px}.pi .pb-48{padding-bottom:48px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-24{padding-left:24px}.pi .pr-16{padding-right:16px}.pi .pr-24{padding-right:24px}.pi .pl-16{padding-left:16px}.pi .pr-6{padding-right:6px}.pi .pb-18{padding-bottom:18px}.pi .pt-6{padding-top:6px}.pi .pt-16{padding-top:16px}.pi .pt-10{padding-top:10px}.pi .pl-12{padding-left:12px}.pi .pr-12{padding-right:12px}.pi .pb-6{padding-bottom:6px}.pi .pt-42{padding-top:42px}.pi .pb-32{padding-bottom:32px}.pi .pt-70{padding-top:70px}.pi .pt-40{padding-top:40px}.pi .pr-8{padding-right:8px}.pi .pl-46{padding-left:2.875rem}.pi .pr-46{padding-right:2.875rem}.pi .pl-6{padding-left:6px}.pi .pl-18{padding-left:18px}.pi .pr-18{padding-right:18px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-top{vertical-align:top}.pi .align-middle{vertical-align:middle}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xs{font-size:12px;line-height:16px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-6xl{font-size:60px;line-height:1}.pi .text-2xl{font-size:24px;line-height:32px}.pi .text-3xl{font-size:30px;line-height:36px}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-4xl{font-size:36px;line-height:40px}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .font-light{font-weight:300}.pi .font-bold{font-weight:700}.pi .font-normal{font-weight:400}.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-none{line-height:1}.pi .leading-5{line-height:1.25rem}.pi .tracking-wide{letter-spacing:.025em}.pi .text,.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text-facebook{--tw-text-opacity:1;color:rgb(59 89 152/var(--tw-text-opacity))}.pi .text-twitter{--tw-text-opacity:1;color:rgb(29 161 242/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-primary-light{--tw-text-opacity:1;color:rgb(var(--be-primary-light)/var(--tw-text-opacity))}.pi .text-primary\\/40{color:rgb(var(--be-primary)/.4)}.pi .text-black\\/30{color:#0000004d}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/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-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-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.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-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 .shadow-\\[15px_0_30px_0_rgb\\(0_0_0_\\/_18\\%\\)\\],.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-\\[15px_0_30px_0_rgb\\(0_0_0_\\/_18\\%\\)\\]{--tw-shadow:15px 0 30px 0 rgba(0,0,0,.18);--tw-shadow-colored:15px 0 30px 0 var(--tw-shadow-color)}.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-md,.pi .shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.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-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px 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 .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 .ring-offset-4{--tw-ring-offset-width:4px}.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 .transition-transform{transition-duration:.15s;transition-property:transform;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{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-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-bg-color{transition-duration:.15s;transition-property:background-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-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;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 .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-200{transition-duration:.2s}.pi .duration-100{transition-duration:.1s}.pi .will-change-\\[width\\]{will-change:width}.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 .col-w-1{flex:1 0 0px}.pi .col-w-2{flex:2 0 0px}.pi .col-w-3{flex:3 0 0px}.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{scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;height:0;width:0}.pi .svg-icon{fill:currentColor;display:inline-block;flex-shrink:0;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none}.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\\:absolute:before{content:var(--tw-content);position:absolute}.pi .before\\:left-0:before{content:var(--tw-content);left:0}.pi .before\\:top-1\\/2:before{content:var(--tw-content);top:50%}.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-1:before{content:var(--tw-content);height:1px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:-translate-y-1\\/2:before{--tw-translate-y:-50%}.pi .before\\:-translate-y-1\\/2: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\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1;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\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-divider:before{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));content:var(--tw-content)}.pi .before\\:bg-primary:before{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity));content:var(--tw-content)}.pi .before\\:bg-white:before{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));content:var(--tw-content)}.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 .before\\:content-\\[\\\\\\\\00a0\\]:before{--tw-content:\\\\00a0;content:var(--tw-content)}.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{bottom:0;content:var(--tw-content);left:0;right:0;top:0}.pi .first\\:capitalize:first-child{text-transform:capitalize}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:translate-x-30: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\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-16:checked:before,.pi .checked\\:before\\:translate-x-24: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-16:checked:before{--tw-translate-x:16px}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:scale-\\[\\.65\\]: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\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity));content:var(--tw-content)}.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 .focus-within\\:ring-primary-light:focus-within{--tw-ring-opacity:1;--tw-ring-color:rgb(var(--be-primary-light)/var(--tw-ring-opacity))}.pi .hover\\:scale-105:hover{--tw-scale-x:1.05;--tw-scale-y:1.05}.pi .hover\\:scale-105:hover,.pi .hover\\:scale-110:hover{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\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1}.pi .hover\\:cursor-move:hover{cursor:move}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/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\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-primary\\/10:hover{background-color:rgb(var(--be-primary)/.1)}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-fg-base:hover{--tw-text-opacity:1;color:rgb(var(--be-foreground-base)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:opacity-100:hover{opacity:1}.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{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity));content:var(--tw-content)}.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)}.pi .focus\\:ring-2:focus,.pi .focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-2: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(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.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\\:ring-offset-2:focus{--tw-ring-offset-width:2px}.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\\:bg-focus:focus-visible{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1)}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.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: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 .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-transparent:disabled{border-color:transparent}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.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 .dark .dark\\:bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .dark .dark\\:bg-none{background-image:none}.pi .dark .dark\\:text-white\\/50{color:#ffffff80}.pi .dark .dark\\:opacity-5{opacity:.05}.pi .dark .dark\\:opacity-80{opacity:.8}.pi .dark .dark\\:checked\\:border-primary-dark:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .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\\:justify-start{justify-content:flex-start}.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:invisible{visibility:hidden}.pi .md\\:my-24{margin-bottom:24px;margin-top:24px}.pi .md\\:mx-40{margin-left:40px;margin-right:40px}.pi .md\\:my-64{margin-bottom:64px;margin-top:64px}.pi .md\\:my-100{margin-bottom:6.25rem;margin-top:6.25rem}.pi .md\\:mr-0{margin-right:0}.pi .md\\:mb-0{margin-bottom:0}.pi .md\\:mr-10{margin-right:10px}.pi .md\\:mb-40{margin-bottom:40px}.pi .md\\:mb-24{margin-bottom:24px}.pi .md\\:mt-60{margin-top:60px}.pi .md\\:mb-70{margin-bottom:70px}.pi .md\\:mt-0{margin-top:0}.pi .md\\:mr-24{margin-right:24px}.pi .md\\:mr-80{margin-right:80px}.pi .md\\:block{display:block}.pi .md\\:flex{display:flex}.pi .md\\:h-0{height:0}.pi .md\\:w-min{width:-moz-min-content;width:min-content}.pi .md\\:w-320{width:320px}.pi .md\\:w-400{width:25rem}.pi .md\\:min-w-440{min-width:27.5rem}.pi .md\\:max-w-950{max-width:59.375rem}.pi .md\\:max-w-350{max-width:21.875rem}.pi .md\\:flex-row{flex-direction:row}.pi .md\\:items-start{align-items:flex-start}.pi .md\\:gap-12{gap:12px}.pi .md\\:gap-24{gap:24px}.pi .md\\:gap-80{gap:80px}.pi .md\\:gap-112{gap:112px}.pi .md\\:overflow-hidden{overflow:hidden}.pi .md\\:p-24{padding:24px}.pi .md\\:px-24{padding-left:24px;padding-right:24px}.pi .md\\:px-30{padding-left:30px;padding-right:30px}.pi .md\\:px-0{padding-left:0;padding-right:0}.pi .md\\:px-20{padding-left:20px;padding-right:20px}.pi .md\\:py-80{padding-bottom:80px;padding-top:80px}.pi .md\\:px-176{padding-left:176px;padding-right:176px}.pi .md\\:px-10vw{padding-left:10vw;padding-right:10vw}.pi .md\\:pt-128{padding-top:128px}.pi .md\\:pl-20{padding-left:20px}.pi .md\\:pb-0{padding-bottom:0}.pi .md\\:pb-54{padding-bottom:3.375rem}.pi .md\\:text-left{text-align:left}.pi .md\\:text-3xl{font-size:30px;line-height:36px}.pi .md\\:text-4xl{font-size:36px;line-height:40px}.pi .md\\:text-lg{font-size:18px;line-height:28px}.pi .md\\:text-base{font-size:16px;line-height:24px}.pi .md\\:font-medium{font-weight:500}.pi .md\\:font-normal{font-weight:400}.pi .md\\: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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}}@media (min-width:1024px){.pi .lg\\:min-w-500{min-width:31.25rem}.pi .lg\\:flex-row{flex-direction:row}.pi .lg\\:items-center{align-items:center}.pi .lg\\:px-96{padding-left:96px;padding-right:96px}.pi .lg\\:py-96{padding-bottom:96px;padding-top:96px}.pi .lg\\:pb-0{padding-bottom:0}}@media (min-width:1280px){.pi .xl\\:w-1\\/2{width:50%}.pi .xl\\:pt-96{padding-top:96px}}.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 e=document.querySelector(t.selector);e&&(e.classList.add("pi"),function(t){Ca=t}(e),this.setConfig(t),Ea.setState({editor:this}),Wa(e).render(ar(i.StrictMode,{children:ar(bS,{})})))}get state(){return Oa()}get defaultConfig(){return yS.defaultConfig}open(t={}){var e;null!=(e=Oa().config.ui)&&e.visible||(this.setConfig(w(t,{ui:{visible:!0}})),requestAnimationFrame((()=>{var t,e,n,r;Ma().zoom.fitToScreen(),Ma().history.addInitial(),za()&&(null==(e=null==(t=Oa().config.ui)?void 0:t.openImageDialog)?void 0:e.show)&&this.togglePanel("newImage",!0),null==(r=(n=Oa().config).onOpen)||r.call(n)})))}close(){var t,e,n;null==(t=Oa().config.ui)||!t.visible||(this.setConfig({ui:{visible:!1}}),null==(n=(e=Oa().config).onClose)||n.call(e))}setConfig(t){Oa().setConfig(t)}uploadAndAddImage(){return Ma().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return Ma().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return Ma().import.uploadAndOpenStateFile()}newCanvas(t,e,n){return Ma().canvas.openNew(t,e,n)}getState(t){return JSON.stringify(Ra(t))}setState(t){return Ma().import.loadState(t)}async setStateFromUrl(t){const e=await ja(t);return Ma().import.loadState(e)}openTool(t){Ia(t)}applyChanges(){Oa().applyChanges()}cancelChanges(){Oa().cancelChanges()}async resetEditor(t){await Aa(t),await Ma().canvas.loadInitialContent()}togglePanel(t,e){"objects"===t&&Oa().togglePanel("history",!1),"history"===t&&Oa().togglePanel("objects",!1),Oa().togglePanel(t,e)}on(t,e){var n;null==(n=this.fabric)||n.on(t,e)}isDirty(){return Oa().dirty}get(t){return this.tools[t]}notify(t){return Ha(t)}static init(t){return new Promise((e=>{const n=t.onLoad;t.onLoad=t=>{null==n||n(t),e(t)},new this(t)}))}};let xS=yS;c(xS,"defaultConfig",Yr),c(xS,"version",Ur)}}]);
|